Revision: 201037 default
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 04 Oct 2010 00:14:19 +0300
changeset 61 3cd404d31176
parent 58 ed94e1e8390e
Revision: 201037 Kit: 201039
app/src/mpmainwindow.cpp
inc/mpengine.h
inc/mpplaybackdata.h
mpdata/bwins/mpdatau.def
mpdata/eabi/mpdatau.def
mpdata/src/mpplaybackdata.cpp
mpengine/bwins/mpengineu.def
mpengine/eabi/mpengineu.def
mpengine/inc/mpmpxembeddedplaybackhelper.h
mpengine/inc/mpmpxplaybackframeworkwrapper.h
mpengine/inc/mpmpxplaybackframeworkwrapper_p.h
mpengine/mpengine.pro
mpengine/src/mpengine.cpp
mpengine/src/mpmpxembeddedplaybackhelper.cpp
mpengine/src/mpmpxplaybackframeworkwrapper.cpp
mpengine/src/mpmpxplaybackframeworkwrapper_p.cpp
mpengine/tsrc/unittest_mpmpxplaybackframeworkwrapper/src/unittest_mpmpxplaybackframeworkwrapper.cpp
mpengine/tsrc/unittest_mpmpxplaybackframeworkwrapper/stub/inc/mpmpxembeddedplaybackhelper.h
mpengine/tsrc/unittest_mpmpxplaybackframeworkwrapper/stub/inc/mpplaybackdata.h
mpengine/tsrc/unittest_mpmpxplaybackframeworkwrapper/stub/src/mpmpxembeddedplaybackhelper.cpp
mpengine/tsrc/unittest_mpmpxplaybackframeworkwrapper/stub/src/mpplaybackdata.cpp
mpengine/tsrc/unittest_mpmpxplaybackframeworkwrapper/unittest_mpmpxplaybackframeworkwrapper.pro
mpserviceplugins/mpxsqlitepodcastdbplugin/src/mpxdbpodcast.cpp
mpserviceplugins/mpxsqlitepodcastdbplugin/src/mpxpodcastdbhandler.cpp
mpserviceplugins/mpxsqlitepodcastdbplugin/src/mpxpodcastdbplugin.cpp
mpviewplugins/mpcollectionviewplugin/src/mpcollectionpopuphandler.cpp
mpviewplugins/mpcollectionviewplugin/src/mpcollectionview.cpp
mpviewplugins/mpplaybackviewplugin/inc/mplightmonitor.h
mpviewplugins/mpplaybackviewplugin/inc/mplightmonitor_p.h
mpviewplugins/mpplaybackviewplugin/inc/mpplaybackwidget.h
mpviewplugins/mpplaybackviewplugin/mpplaybackviewplugin.pro
mpviewplugins/mpplaybackviewplugin/src/mplightmonitor.cpp
mpviewplugins/mpplaybackviewplugin/src/mplightmonitor_p.cpp
mpviewplugins/mpplaybackviewplugin/src/mpplaybackwidget.cpp
mpviewplugins/mpplaybackviewplugin/tsrc/tsrc.pro
mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackwidget/inc/unittest_mpplaybackwidget.h
mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackwidget/src/unittest_mpplaybackwidget.cpp
mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackwidget/stub/inc/mplightmonitor.h
mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackwidget/stub/inc/mpplaybackdata.h
mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackwidget/stub/src/mplightmonitor.cpp
mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackwidget/unittest_mpplaybackwidget.pro
musicwidgetplugin/inc/musicwidget.h
musicwidgetplugin/musicwidgetplugin.pro
musicwidgetplugin/resource/music_widget.docml
musicwidgetplugin/resource/musicwidgeticon.png
musicwidgetplugin/resource/musicwidgetplugin.manifest
musicwidgetplugin/resource/musicwidgetplugin.xml
musicwidgetplugin/resource/musicwidgetui.qrc
musicwidgetplugin/rom/bld.inf
musicwidgetplugin/rom/musicwidgetplugin.iby
musicwidgetplugin/rom/musicwidgetplugin_resources.iby
musicwidgetplugin/rom/rom.pri
musicwidgetplugin/src/musicwidget.cpp
musicwidgetplugin/src/musicwidgetdocumentloader.cpp
package_definition.xml
tsrc/qvptestresultgen.pl
tsrc/readme.txt
--- a/app/src/mpmainwindow.cpp	Fri Sep 17 08:28:52 2010 +0300
+++ b/app/src/mpmainwindow.cpp	Mon Oct 04 00:14:19 2010 +0300
@@ -270,7 +270,7 @@
     TX_ENTRY_ARGS("viewType=" << viewType );
 
     bool doTransition = true;
-    Hb::ViewSwitchFlags  transitionFlags = Hb::ViewSwitchDefault;
+    Hb::ViewSwitchFlags  transitionFlags = Hb::ViewSwitchCachedFullScreen;
     
     if ( mCurrentViewPlugin ) {     
         disconnectView();
--- a/inc/mpengine.h	Fri Sep 17 08:28:52 2010 +0300
+++ b/inc/mpengine.h	Mon Oct 04 00:14:19 2010 +0300
@@ -170,6 +170,7 @@
     void handleDeleteStarted( TCollectionContext context, int count );
     void handleDeleteEnded( bool success );
     void cancelCollectionRequest();
+    void handleCollectionPlaylistOpened();
 
     // Playback related
     void playEmbedded( QString aFilename );
--- a/inc/mpplaybackdata.h	Fri Sep 17 08:28:52 2010 +0300
+++ b/inc/mpplaybackdata.h	Mon Oct 04 00:14:19 2010 +0300
@@ -74,9 +74,10 @@
     void setPlaybackState( const SimplifiedState state );
     MpPlaybackData::SimplifiedState playbackState() const;
 
-    void commitPlaybackInfo();
+    void commitPlaybackInfo( bool changed );
     void resetData();
     void setCorrupted( int id );
+    void handleCollectionPlaylistOpened();
     
 
 public slots:
@@ -91,6 +92,7 @@
     void playbackStateChanged();
     void playbackInfoChanged();
     void fileCorrupted(int id );
+    void collectionPlaylistOpened();
     
 private:
 
@@ -108,6 +110,7 @@
     HbIcon                   mAlbumArt;
     SimplifiedState          mPlaybackState;
     bool                     mRealAudio;
+    bool                     mCollectionPlaylistOpened;
 
     Q_DISABLE_COPY(MpPlaybackData)
 };
--- a/mpdata/bwins/mpdatau.def	Fri Sep 17 08:28:52 2010 +0300
+++ b/mpdata/bwins/mpdatau.def	Mon Oct 04 00:14:19 2010 +0300
@@ -161,7 +161,7 @@
 	?getStaticMetaObject@MpPlaybackData@@SAABUQMetaObject@@XZ @ 160 NONAME ; struct QMetaObject const & MpPlaybackData::getStaticMetaObject(void)
 	?composer@MpSongData@@QBE?AVQString@@XZ @ 161 NONAME ; class QString MpSongData::composer(void) const
 	?albumArt@MpPlaybackData@@QBEXAAVHbIcon@@@Z @ 162 NONAME ; void MpPlaybackData::albumArt(class HbIcon &) const
-	?commitPlaybackInfo@MpPlaybackData@@QAEXXZ @ 163 NONAME ; void MpPlaybackData::commitPlaybackInfo(void)
+	?commitPlaybackInfo@MpPlaybackData@@QAEX_N@Z @ 163 NONAME ; void MpPlaybackData::commitPlaybackInfo(bool)
 	?removeRows@MpCollectionDataModel@@UAE_NHHABVQModelIndex@@@Z @ 164 NONAME ; bool MpCollectionDataModel::removeRows(int, int, class QModelIndex const &)
 	?albumSongId@MpMpxCollectionData@@QAEHH@Z @ 165 NONAME ; int MpMpxCollectionData::albumSongId(int)
 	?thumbnailReady@MpSongData@@QAEXVQPixmap@@PAXHH@Z @ 166 NONAME ; void MpSongData::thumbnailReady(class QPixmap, void *, int, int)
@@ -181,4 +181,6 @@
 	?dataChanged@MpMpxCollectionData@@IAEXHH@Z @ 180 NONAME ; void MpMpxCollectionData::dataChanged(int, int)
 	?reloadData@MpCollectionDataModel@@QAEXHH@Z @ 181 NONAME ; void MpCollectionDataModel::reloadData(int, int)
 	?incrementalOpenUpdate@MpMpxCollectionData@@QAEXXZ @ 182 NONAME ; void MpMpxCollectionData::incrementalOpenUpdate(void)
+	?handleCollectionPlaylistOpened@MpPlaybackData@@QAEXXZ @ 183 NONAME ; void MpPlaybackData::handleCollectionPlaylistOpened(void)
+	?collectionPlaylistOpened@MpPlaybackData@@IAEXXZ @ 184 NONAME ; void MpPlaybackData::collectionPlaylistOpened(void)
 
--- a/mpdata/eabi/mpdatau.def	Fri Sep 17 08:28:52 2010 +0300
+++ b/mpdata/eabi/mpdatau.def	Mon Oct 04 00:14:19 2010 +0300
@@ -29,7 +29,7 @@
 	_ZN14MpPlaybackData15positionChangedEv @ 28 NONAME
 	_ZN14MpPlaybackData16setPlaybackStateENS_15SimplifiedStateE @ 29 NONAME
 	_ZN14MpPlaybackData16staticMetaObjectE @ 30 NONAME DATA 16
-	_ZN14MpPlaybackData18commitPlaybackInfoEv @ 31 NONAME
+	_ZN14MpPlaybackData18commitPlaybackInfoEb @ 31 NONAME
 	_ZN14MpPlaybackData19getStaticMetaObjectEv @ 32 NONAME
 	_ZN14MpPlaybackData19playbackInfoChangedEv @ 33 NONAME
 	_ZN14MpPlaybackData20playbackStateChangedEv @ 34 NONAME
@@ -181,4 +181,6 @@
 	_ZN19MpMpxCollectionData11dataChangedEii @ 180 NONAME
 	_ZN19MpMpxCollectionData21incrementalOpenUpdateEv @ 181 NONAME
 	_ZN21MpCollectionDataModel10reloadDataEii @ 182 NONAME
+	_ZN14MpPlaybackData24collectionPlaylistOpenedEv @ 183 NONAME
+	_ZN14MpPlaybackData30handleCollectionPlaylistOpenedEv @ 184 NONAME
 
--- a/mpdata/src/mpplaybackdata.cpp	Fri Sep 17 08:28:52 2010 +0300
+++ b/mpdata/src/mpplaybackdata.cpp	Mon Oct 04 00:14:19 2010 +0300
@@ -75,7 +75,11 @@
     PlayBackWrapper.  
  */
 
+/*!
+    \fn void collectionPlaylistOpened()
 
+    This signal is emitted when user selects an item from collection view.
+ */
 
 /*!
     Constructs a new MpPlaybackData.
@@ -90,7 +94,8 @@
       mId(0),
       mAlbumArt( "qtg_large_album_art" ),
       mPlaybackState( NotPlaying ),
-      mRealAudio( false )
+      mRealAudio( false ),
+	  mCollectionPlaylistOpened( false )
 {
     TX_ENTRY
     mThumbnailManager->setQualityPreference( ThumbnailManager::OptimizeForQuality );
@@ -374,12 +379,18 @@
 }
 
 /*!
-
+ Indicates that all playback information is available and ready to be committed to the view. 
+ Signal is emitted only when any information has changed indicated by \a changed. A special
+ handling is covered, when the same song is re-selected by the user from the collection view, 
+ in which case we force the reload even if the information hasn’t changed within this class.
 */
-void MpPlaybackData::commitPlaybackInfo()
+void MpPlaybackData::commitPlaybackInfo( bool changed )
 {
     TX_ENTRY
-    emit playbackInfoChanged();
+	if ( changed || mCollectionPlaylistOpened ) {
+        emit playbackInfoChanged();
+		mCollectionPlaylistOpened = false;
+	}
     TX_EXIT
 }
 
@@ -432,3 +443,11 @@
     TX_EXIT
 }
 
+/*!
+ Emit collectionPlaylistOpened signal when user selects an item from collection view.
+*/
+void MpPlaybackData::handleCollectionPlaylistOpened()
+{
+    mCollectionPlaylistOpened = true;
+    emit collectionPlaylistOpened();
+}
--- a/mpengine/bwins/mpengineu.def	Fri Sep 17 08:28:52 2010 +0300
+++ b/mpengine/bwins/mpengineu.def	Mon Oct 04 00:14:19 2010 +0300
@@ -143,4 +143,5 @@
 	?scanFinished@MpSongScanner@@IAEXHH@Z @ 142 NONAME ; void MpSongScanner::scanFinished(int, int)
 	?setLoudness@MpEngine@@QAEX_N@Z @ 143 NONAME ; void MpEngine::setLoudness(bool)
 	?handleScanStarted@MpSongScanner@@QAEXXZ @ 144 NONAME ; void MpSongScanner::handleScanStarted(void)
+	?handleCollectionPlaylistOpened@MpEngine@@QAEXXZ @ 145 NONAME ; void MpEngine::handleCollectionPlaylistOpened(void)
 
--- a/mpengine/eabi/mpengineu.def	Fri Sep 17 08:28:52 2010 +0300
+++ b/mpengine/eabi/mpengineu.def	Mon Oct 04 00:14:19 2010 +0300
@@ -143,4 +143,5 @@
 	_ZTV15MpEngineFactory @ 142 NONAME
 	_ZTV8MpEngine @ 143 NONAME
 	_ZN13MpSongScanner17handleScanStartedEv @ 144 NONAME
+	_ZN8MpEngine30handleCollectionPlaylistOpenedEv @ 145 NONAME
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpengine/inc/mpmpxembeddedplaybackhelper.h	Mon Oct 04 00:14:19 2010 +0300
@@ -0,0 +1,82 @@
+/*
+* 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: embedded playback helper.
+*
+*/
+
+#ifndef CMPMPXEMBEDDEDPLAYBACKHELPER_H
+#define CMPMPXEMBEDDEDPLAYBACKHELPER_H
+
+#include <e32base.h>
+#include <mpxcollectionobserver.h>
+#include <mpxcollectionuihelperobserver.h>
+
+// FOWARD DECLARATION
+class MMPXPlaybackUtility;
+class MMPXCollectionUtility;
+class MMPXCollectionUiHelper;
+
+class MMpMpxEmbeddedPlaybackHelperObserver
+{
+public:
+
+    virtual void HandleEmbeddedPlaybackError( TInt aError ) = 0;
+
+};
+
+class CMpMpxEmbeddedPlaybackHelper : public CBase,
+                                     public MMPXCollectionObserver,
+                                     public MMPXCHelperEmbeddedOpenObserver
+{
+
+public:
+
+    static CMpMpxEmbeddedPlaybackHelper* NewL( TUid aHostUid,
+                                               MMPXPlaybackUtility* aPlaybackUtility,
+                                               MMpMpxEmbeddedPlaybackHelperObserver* aObserver );
+    virtual ~CMpMpxEmbeddedPlaybackHelper();
+
+    void playL( const TDesC& aFilename );
+
+private: // from base class
+
+    // From MMPXCollectionObserver
+    void HandleOpenL( const CMPXMedia& aEntries,
+                     TInt aIndex,TBool aComplete,TInt aError );
+    void HandleOpenL( const CMPXCollectionPlaylist& aPlaylist,TInt aError );
+    void HandleCollectionMessage( CMPXMessage* aMsg, TInt aErr );
+    void HandleCollectionMediaL( const CMPXMedia& aMedia, TInt aError );
+
+    // From MMPXCHelperEmbeddedOpenObserver
+    void HandleEmbeddedOpenL( TInt aErr, TMPXGeneralCategory aCategory );
+
+private:
+
+    CMpMpxEmbeddedPlaybackHelper( TUid aHostUid,
+                                  MMPXPlaybackUtility* aPlaybackUtility,
+                                  MMpMpxEmbeddedPlaybackHelperObserver* aObserver );
+    void ConstructL();
+
+    void DoHandleCollectionMessageL( const CMPXMessage& aMsg );
+
+private:
+    MMPXPlaybackUtility                   *iPlaybackUtility;
+    MMPXCollectionUtility                 *iCollectionUtility;   //Owned
+    MMPXCollectionUiHelper                *iCollectionUiHelper;  //Owned
+    MMpMpxEmbeddedPlaybackHelperObserver  *iObserver;
+    TUid                                  iHostUid;
+};
+
+#endif // CMPMPXEMBEDDEDPLAYBACKHELPER_H
+
--- a/mpengine/inc/mpmpxplaybackframeworkwrapper.h	Fri Sep 17 08:28:52 2010 +0300
+++ b/mpengine/inc/mpmpxplaybackframeworkwrapper.h	Mon Oct 04 00:14:19 2010 +0300
@@ -45,8 +45,8 @@
     void setBalance( int balance );
     void applyAudioEffects();
     void applyEqualizer();
-
     void retrieveSongDetails();
+    void forceStop();
 
 signals:
 
--- a/mpengine/inc/mpmpxplaybackframeworkwrapper_p.h	Fri Sep 17 08:28:52 2010 +0300
+++ b/mpengine/inc/mpmpxplaybackframeworkwrapper_p.h	Mon Oct 04 00:14:19 2010 +0300
@@ -20,6 +20,7 @@
 
 #include <e32base.h>
 #include <mpxplaybackobserver.h>
+#include "mpmpxembeddedplaybackhelper.h"
 #include "mpcommondefs.h"
 
 
@@ -32,7 +33,8 @@
 class MpSongData;
 
 class MpMpxPlaybackFrameworkWrapperPrivate : public MMPXPlaybackObserver,
-                                             public MMPXPlaybackCallback
+                                             public MMPXPlaybackCallback,
+                                             public MMpMpxEmbeddedPlaybackHelperObserver
 {
 public:
 
@@ -71,7 +73,8 @@
     MpPlaybackData *playbackData();
 
     void retrieveSongDetails();
-
+    void forceStop();
+    
 private:
 
     // From MMPXPlaybackObserver
@@ -83,6 +86,9 @@
                                 TBool aComplete, TInt aError );
     void HandleMediaL( const CMPXMedia& aProperties, TInt aError );
 
+    // From MMpMpxEmbeddedPlaybackHelperObserver
+    void HandleEmbeddedPlaybackError( TInt aError );
+
     void DoInitL();
     void DoPlayL( QString aFilename );
     void DoPlayL( const XQSharableFile& file );
@@ -96,11 +102,12 @@
 private:
 
     MpMpxPlaybackFrameworkWrapper       *q_ptr;
-    MMPXPlaybackUtility                 *iPlaybackUtility;  // Own
-    MpPlaybackData                      *iPlaybackData;     // Own
+    MMPXPlaybackUtility                 *iPlaybackUtility;         // Own
+    CMpMpxEmbeddedPlaybackHelper        *iEmbeddedPlaybackHelper;  // Own
+    MpPlaybackData                      *iPlaybackData;            // Own
     TUid                                iHostUid;
 
-    MpSongData                          *iSongData;         // Not owned
+    MpSongData                          *iSongData;                // Not owned
     bool                                iDetailsRequest;
 
 };
--- a/mpengine/mpengine.pro	Fri Sep 17 08:28:52 2010 +0300
+++ b/mpengine/mpengine.pro	Mon Oct 04 00:14:19 2010 +0300
@@ -55,6 +55,7 @@
            inc/mpmpxharvesterframeworkwrapper.h \
            inc/mpmpxharvesterframeworkwrapper_p.h \
            inc/mpmpxplaybackframeworkwrapper.h \
+           inc/mpmpxembeddedplaybackhelper.h \
            inc/mpmpxplaybackframeworkwrapper_p.h \
            inc/mpmpxcollectionframeworkwrapper.h \
            inc/mpmpxisolatedcollectionhelper.h \
@@ -70,6 +71,7 @@
            src/mpmpxharvesterframeworkwrapper.cpp \
            src/mpmpxharvesterframeworkwrapper_p.cpp \
            src/mpmpxplaybackframeworkwrapper.cpp \
+           src/mpmpxembeddedplaybackhelper.cpp \
            src/mpmpxplaybackframeworkwrapper_p.cpp \
            src/mpmpxcollectionframeworkwrapper.cpp \
            src/mpmpxisolatedcollectionhelper.cpp \
@@ -77,5 +79,5 @@
            src/mpaudioeffectsframeworkwrapper.cpp \
            src/mpaudioeffectsframeworkwrapper_p.cpp \
            src/mpequalizerframeworkwrapper.cpp \
-           src/mpequalizerframeworkwrapper_p.cpp   
+           src/mpequalizerframeworkwrapper_p.cpp
 
--- a/mpengine/src/mpengine.cpp	Fri Sep 17 08:28:52 2010 +0300
+++ b/mpengine/src/mpengine.cpp	Mon Oct 04 00:14:19 2010 +0300
@@ -29,6 +29,7 @@
 #include "mpsongscanner.h"
 #include "mpsongdata.h"
 #include "mpapplicationmonitor.h"
+#include "mpplaybackdata.h"
 
 /*!
     \class MpEngine
@@ -222,7 +223,14 @@
 MpEngine::~MpEngine()
 {
     TX_ENTRY
-    delete mMpxPlaybackWrapper;
+    if ( mMpxPlaybackWrapper ) {
+        // Don't send stop cmd if mode=HomeScreen, because we don't want to stop playback when the music widget is deleted.
+        if ( mEngineMode != HomeScreen ) {
+            mMpxPlaybackWrapper->forceStop();
+        }
+        delete mMpxPlaybackWrapper;
+    }
+    
     delete mMpxHarvesterWrapper;
     delete mMpxCollectionWrapper;
     delete mAudioEffectsWrapper;
@@ -264,7 +272,7 @@
         // Collection Wrapper
         mMpxCollectionWrapper = new MpMpxCollectionFrameworkWrapper( clientSecureId, mSongData );
         connect( mMpxCollectionWrapper, SIGNAL( collectionPlaylistOpened() ),
-                 this, SIGNAL( collectionPlaylistOpened() ), 
+                 this, SLOT( handleCollectionPlaylistOpened() ), 
 				 Qt::QueuedConnection );
         connect( mMpxCollectionWrapper, SIGNAL( aboutToAddSongs(int) ),
                  this, SIGNAL( aboutToAddSongs(int) ) );
@@ -327,7 +335,7 @@
         // Collection Wrapper
         mMpxCollectionWrapper = new MpMpxCollectionFrameworkWrapper( clientSecureId, 0 );
         connect( mMpxCollectionWrapper, SIGNAL( collectionPlaylistOpened() ),
-                 this, SIGNAL( collectionPlaylistOpened() ), 
+                 this, SLOT( handleCollectionPlaylistOpened() ), 
 				 Qt::QueuedConnection );
         // Disabling these since fetch mode plays only one song at a time.
         mMpxCollectionWrapper->setRepeatFeatureEnabled( false );
@@ -347,7 +355,7 @@
         // Collection Wrapper
         mMpxCollectionWrapper = new MpMpxCollectionFrameworkWrapper( clientSecureId, 0 );
         connect( mMpxCollectionWrapper, SIGNAL( collectionPlaylistOpened() ),
-                 this, SIGNAL( collectionPlaylistOpened() ), 
+                 this, SLOT( handleCollectionPlaylistOpened() ), 
 				 Qt::QueuedConnection );
         connect( mMpxCollectionWrapper, SIGNAL( containerContentsChanged() ),
                  this, SIGNAL( containerContentsChanged() ), 
@@ -1256,3 +1264,15 @@
     TX_EXIT
 }
 
+/*!
+ Slot to handle the open of a collecion playlist.
+ */
+void MpEngine::handleCollectionPlaylistOpened()
+{
+    TX_ENTRY
+    
+    playbackData()->handleCollectionPlaylistOpened();
+    emit collectionPlaylistOpened();
+    
+    TX_EXIT
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpengine/src/mpmpxembeddedplaybackhelper.cpp	Mon Oct 04 00:14:19 2010 +0300
@@ -0,0 +1,205 @@
+/*
+* 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: Embedded playback helper.
+*
+*/
+
+#include <mpxplaybackutility.h>
+#include <mpxcollectionutility.h>
+#include <mpxcollectionmessage.h>
+#include <mpxmessagegeneraldefs.h>
+#include <mpxcollectionplugin.hrh>
+#include <mpxcollectionplaylist.h>
+#include <mpxcollectionuihelper.h>
+#include <mpxcollectionhelperfactory.h>
+
+#include "mpmpxembeddedplaybackhelper.h"
+#include "mptrace.h"
+
+
+/*!
+    \class CMpMpxEmbeddedPlaybackHelper
+    \brief Helper class to play isolated media, 
+
+    This class is used by mpmpxplaybackframeworkwrapper_p to play isolated content specified by an uri,
+    when MusicPlayer is launched in embedded mode.
+*/
+
+/*!
+ \internal
+ Two-phased constructor.
+ */
+CMpMpxEmbeddedPlaybackHelper* CMpMpxEmbeddedPlaybackHelper::NewL( 
+    TUid aHostUid,
+    MMPXPlaybackUtility* aPlaybackUtility,
+    MMpMpxEmbeddedPlaybackHelperObserver* aObserver )
+{
+    CMpMpxEmbeddedPlaybackHelper* self =
+            new ( ELeave ) CMpMpxEmbeddedPlaybackHelper( aHostUid, aPlaybackUtility, aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+}
+
+/*!
+ \internal
+ Destructor
+ */
+CMpMpxEmbeddedPlaybackHelper::~CMpMpxEmbeddedPlaybackHelper()
+{
+    TX_ENTRY
+    if ( iCollectionUtility ) {
+        iCollectionUtility->Collection().CancelRequest();
+        iCollectionUtility->Close();
+    }
+    if ( iCollectionUiHelper ) {
+        iCollectionUiHelper->Close();
+    }
+    TX_EXIT
+}
+
+/*!
+ \internal
+  */
+void CMpMpxEmbeddedPlaybackHelper::playL( const TDesC& aFilename )
+{
+    TX_LOG
+    iCollectionUiHelper->OpenL( iHostUid, aFilename, this, EMPXCollectionPluginMusic );
+}
+
+/*!
+ \internal
+ */
+void CMpMpxEmbeddedPlaybackHelper::HandleOpenL( 
+    const CMPXMedia& aEntries,
+    TInt aIndex,
+    TBool aComplete,
+    TInt aError )
+{
+    Q_UNUSED( aEntries );
+    Q_UNUSED( aIndex );
+    Q_UNUSED( aComplete );
+    Q_UNUSED( aError );
+}
+
+/*!
+ \internal
+ */
+void CMpMpxEmbeddedPlaybackHelper::HandleOpenL( 
+    const CMPXCollectionPlaylist& aPlaylist,
+    TInt aError )
+{
+    TX_ENTRY_ARGS( "aError=" << aError );
+    if ( aError == KErrNone ) {
+        iPlaybackUtility->InitL( aPlaylist, ETrue );
+    }
+    else {
+        iObserver->HandleEmbeddedPlaybackError( aError );
+    }
+    TX_EXIT
+}
+
+/*!
+ \internal
+ */
+void CMpMpxEmbeddedPlaybackHelper::HandleCollectionMessage( 
+    CMPXMessage* aMsg,
+    TInt aErr )
+{
+    TX_ENTRY_ARGS( "aErr=" << aErr );
+    TInt error = aErr;
+    if ( error == KErrNone && aMsg ) {
+        TRAP( error, DoHandleCollectionMessageL( *aMsg ) );
+    }
+
+    if ( error != KErrNone ) {
+        iObserver->HandleEmbeddedPlaybackError( error );
+    }
+    TX_EXIT
+}
+
+/*!
+ \internal
+ */
+void CMpMpxEmbeddedPlaybackHelper::HandleCollectionMediaL( 
+    const CMPXMedia& aMedia,
+    TInt aError )
+{
+    Q_UNUSED( aMedia );
+    Q_UNUSED( aError );
+}
+
+/*!
+ \internal
+ */
+void CMpMpxEmbeddedPlaybackHelper::HandleEmbeddedOpenL( 
+    TInt aErr,
+    TMPXGeneralCategory aCategory )
+{
+    TX_ENTRY_ARGS( "aErr=" << aErr );
+    Q_UNUSED( aCategory );
+    if ( aErr != KErrNone ) {
+        iObserver->HandleEmbeddedPlaybackError( aErr );
+    }
+}
+
+/*!
+ \internal
+ c++ Contructor
+ */
+CMpMpxEmbeddedPlaybackHelper::CMpMpxEmbeddedPlaybackHelper(
+        TUid aHostUid,
+        MMPXPlaybackUtility* aPlaybackUtility,
+        MMpMpxEmbeddedPlaybackHelperObserver* aObserver )
+    : iPlaybackUtility( aPlaybackUtility ),
+      iObserver( aObserver ),
+      iHostUid( aHostUid )
+{
+}
+
+/*!
+ \internal
+ Leaving constructor
+ */
+void CMpMpxEmbeddedPlaybackHelper::ConstructL()
+{
+    iCollectionUtility = MMPXCollectionUtility::NewL( this, iHostUid );
+    iCollectionUiHelper = CMPXCollectionHelperFactory::NewCollectionUiHelperL( iHostUid );
+}
+
+/*!
+ \internal
+ */
+void CMpMpxEmbeddedPlaybackHelper::DoHandleCollectionMessageL( 
+    const CMPXMessage& aMsg )
+{
+    TX_ENTRY
+    TMPXMessageId id( aMsg.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) );
+    if ( KMPXMessageGeneral == id ) {
+        TInt event( aMsg.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) );
+        TInt type( aMsg.ValueTObjectL<TInt>( KMPXMessageGeneralType ) );
+        TInt data( aMsg.ValueTObjectL<TInt>( KMPXMessageGeneralData ) );
+        TX_LOG_ARGS( "event=" << event << ", type=" << type << ", data=" << data );
+
+         if ( event == TMPXCollectionMessage::EPathChanged &&
+              type == EMcPathChangedByOpen &&
+              data == EMcItemOpened ) {
+            // This will result in HandleOpenL with CMPXCollectionPlaylist
+            iCollectionUtility->Collection().OpenL();
+        }
+    }
+    TX_EXIT
+}
+
--- a/mpengine/src/mpmpxplaybackframeworkwrapper.cpp	Fri Sep 17 08:28:52 2010 +0300
+++ b/mpengine/src/mpmpxplaybackframeworkwrapper.cpp	Mon Oct 04 00:14:19 2010 +0300
@@ -294,3 +294,10 @@
     d_ptr->retrieveSongDetails();
 }
 
+/*!
+ Force the playback to stop.
+ */
+void MpMpxPlaybackFrameworkWrapper::forceStop()
+{
+    d_ptr->forceStop();
+}
--- a/mpengine/src/mpmpxplaybackframeworkwrapper_p.cpp	Fri Sep 17 08:28:52 2010 +0300
+++ b/mpengine/src/mpmpxplaybackframeworkwrapper_p.cpp	Mon Oct 04 00:14:19 2010 +0300
@@ -55,6 +55,7 @@
 MpMpxPlaybackFrameworkWrapperPrivate::MpMpxPlaybackFrameworkWrapperPrivate( MpMpxPlaybackFrameworkWrapper *qq)
     : q_ptr(qq),
       iPlaybackUtility(0),
+      iEmbeddedPlaybackHelper(0),
       iPlaybackData(0),
       iDetailsRequest(false)
 {
@@ -68,10 +69,10 @@
 {
     TX_ENTRY
     if ( iPlaybackUtility ) {
-        TRAP_IGNORE( ForceStopL() );
         TRAP_IGNORE( iPlaybackUtility->RemoveObserverL(*this) );
         iPlaybackUtility->Close();
     }
+    delete iEmbeddedPlaybackHelper;
     delete iPlaybackData;
     TX_EXIT
 }
@@ -452,6 +453,19 @@
 /*!
  \internal
  */
+void MpMpxPlaybackFrameworkWrapperPrivate::forceStop()
+{
+    TX_ENTRY
+    TRAPD( err, ForceStopL() );
+    if ( err != KErrNone ) {
+        TX_LOG_ARGS("Error: " << err << "; should never get here.");
+    }
+    TX_EXIT
+}
+
+/*!
+ \internal
+ */
 void MpMpxPlaybackFrameworkWrapperPrivate::HandlePlaybackMessage( CMPXMessage *aMessage, TInt aError )
 {
     TX_ENTRY_ARGS("aError=" << aError);
@@ -609,10 +623,8 @@
                     aMedia.ValueTObjectL<TInt>( KMPXMediaGeneralId ) );
         }
 
-        if ( changed ) {
-            // This is required to propagate the playback info to UI at once.
-            iPlaybackData->commitPlaybackInfo();
-        }
+        // This is required to propagate the playback info to UI at once.
+        iPlaybackData->commitPlaybackInfo( changed );
     }
     TX_EXIT
 }
@@ -620,6 +632,17 @@
 /*!
  \internal
  */
+void MpMpxPlaybackFrameworkWrapperPrivate::HandleEmbeddedPlaybackError( TInt aError )
+{
+    TX_ENTRY_ARGS( "aError=" << aError );
+    Q_UNUSED( aError );
+    emit q_ptr->corruptedStop( true );
+    TX_EXIT
+}
+
+/*!
+ \internal
+ */
 void MpMpxPlaybackFrameworkWrapperPrivate::DoInitL()
 {
     TX_ENTRY
@@ -639,10 +662,17 @@
  */
 void MpMpxPlaybackFrameworkWrapperPrivate::DoPlayL( QString aFilename )
 {
-    TX_ENTRY
-    if ( !aFilename.isNull() ) {
+    TX_ENTRY_ARGS( "Filename: " << aFilename );
+    if ( !aFilename.isEmpty() ) {
         const TDesC& playTitle = TPtrC(reinterpret_cast<const TText*>( aFilename.constData() ));
-        iPlaybackUtility->InitL( playTitle );
+        if ( !iEmbeddedPlaybackHelper ) {
+            iEmbeddedPlaybackHelper = 
+                    CMpMpxEmbeddedPlaybackHelper::NewL( iHostUid, iPlaybackUtility, this );
+        }
+        iEmbeddedPlaybackHelper->playL( playTitle );
+    }
+    else {
+        HandleEmbeddedPlaybackError( KErrArgument );
     }
     TX_EXIT
 }
@@ -653,15 +683,7 @@
 void MpMpxPlaybackFrameworkWrapperPrivate::DoPlayL( const XQSharableFile& file )
 {
     TX_ENTRY
-
-    RFile xqfile;
-    bool ok = file.getHandle( xqfile );
-    if ( ok ) {
-        iPlaybackUtility->InitL( xqfile );
-    }
-    else {
-        TX_LOG_ARGS("Error: " << ok << "; should never get here.");
-    }
+    DoPlayL( file.fileName() );
     TX_EXIT
 }
 
--- a/mpengine/tsrc/unittest_mpmpxplaybackframeworkwrapper/src/unittest_mpmpxplaybackframeworkwrapper.cpp	Fri Sep 17 08:28:52 2010 +0300
+++ b/mpengine/tsrc/unittest_mpmpxplaybackframeworkwrapper/src/unittest_mpmpxplaybackframeworkwrapper.cpp	Mon Oct 04 00:14:19 2010 +0300
@@ -24,6 +24,7 @@
 #include "stub/inc/mpplaybackdata.h"
 #include "stub/inc/mpxplaybackutility.h"
 #include "stub/inc/mpsongdata.h"
+#include "stub/inc/mpmpxembeddedplaybackhelper.h"
 
 // Do this so we can access all member variables.
 #define private public
@@ -483,7 +484,7 @@
     //Play from filename
     QString fileName = QString("z:\\system\\data\\nullsound.mp3");
     mTest->play( fileName );
-    QVERIFY( mTestPrivate->iPlaybackUtility->iInitialized );
+    QCOMPARE( mTestPrivate->iEmbeddedPlaybackHelper->iFileNameToPlay, fileName );
 
     //Play from Shareable file
     mTestPrivate->iPlaybackUtility->iInitialized = false;
@@ -498,7 +499,7 @@
             XQSharableFile* sFile = new XQSharableFile(file);
 
             mTest->play( *sFile );
-            QVERIFY( mTestPrivate->iPlaybackUtility->iInitialized );
+            QCOMPARE( mTestPrivate->iEmbeddedPlaybackHelper->iFileNameToPlay, sFile->fileName() );
 
             sFile->close();
             delete sFile;
@@ -512,6 +513,15 @@
     else {
         QWARN("Not able to create RF Session");
     }
+    
+    //Play empty filename
+    QSignalSpy spy(mTest, SIGNAL(corruptedStop( bool )));
+    QList<QVariant> arguments;
+    QString emptyFileName = "";
+    mTest->play( emptyFileName );
+    QVERIFY( spy.count() == 1 );
+    arguments = spy.takeFirst();
+    QVERIFY( arguments.at(0).toBool() == true );
 
     //Play command
     cleanup();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpengine/tsrc/unittest_mpmpxplaybackframeworkwrapper/stub/inc/mpmpxembeddedplaybackhelper.h	Mon Oct 04 00:14:19 2010 +0300
@@ -0,0 +1,62 @@
+/*
+* 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: embedded playback helper stub for testing mpmpxpbframeworkwrapper.
+*
+*/
+
+#ifndef CMPMPXEMBEDDEDPLAYBACKHELPER_H
+#define CMPMPXEMBEDDEDPLAYBACKHELPER_H
+
+#include <QObject>
+#include <e32base.h>
+
+// FOWARD DECLARATION
+class MMPXPlaybackUtility;
+
+class MMpMpxEmbeddedPlaybackHelperObserver
+{
+public:
+
+    virtual void HandleEmbeddedPlaybackError( TInt aError ) = 0;
+
+};
+
+class CMpMpxEmbeddedPlaybackHelper : public CBase
+{
+
+public:
+
+    static CMpMpxEmbeddedPlaybackHelper* NewL( TUid aHostUid,
+                                               MMPXPlaybackUtility* aPlaybackUtility,
+                                               MMpMpxEmbeddedPlaybackHelperObserver* aObserver );
+    virtual ~CMpMpxEmbeddedPlaybackHelper();
+
+    void playL( const TDesC& aFilename );
+    void triggerError();
+
+private:
+
+    CMpMpxEmbeddedPlaybackHelper( TUid aHostUid,
+                                  MMPXPlaybackUtility* aPlaybackUtility,
+                                  MMpMpxEmbeddedPlaybackHelperObserver* aObserver );
+
+public:
+    MMPXPlaybackUtility                   *iPlaybackUtility;
+    MMpMpxEmbeddedPlaybackHelperObserver  *iObserver;
+    TUid                                  iHostUid;
+    QString                               iFileNameToPlay;
+};
+
+#endif // CMPMPXEMBEDDEDPLAYBACKHELPER_H
+
--- a/mpengine/tsrc/unittest_mpmpxplaybackframeworkwrapper/stub/inc/mpplaybackdata.h	Fri Sep 17 08:28:52 2010 +0300
+++ b/mpengine/tsrc/unittest_mpmpxplaybackframeworkwrapper/stub/inc/mpplaybackdata.h	Mon Oct 04 00:14:19 2010 +0300
@@ -52,7 +52,7 @@
     const QString& album() const;
     const QString& artist() const;
     MpPlaybackData::SimplifiedPlaybackState playbackState();
-    void commitPlaybackInfo();
+    void commitPlaybackInfo( bool changed );
     void handleMediaReady();
     bool setRealAudio( bool mode );
     bool setAlbumId( int id );
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpengine/tsrc/unittest_mpmpxplaybackframeworkwrapper/stub/src/mpmpxembeddedplaybackhelper.cpp	Mon Oct 04 00:14:19 2010 +0300
@@ -0,0 +1,74 @@
+/*
+* 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: Embedded playback helper stub for testing mpmpxpbframeworkwrapper.
+*
+*/
+
+#include <mpxplaybackutility.h>
+#include "stub/inc/mpmpxembeddedplaybackhelper.h"
+#include "mptrace.h"
+
+
+/*!
+ \internal
+ */
+CMpMpxEmbeddedPlaybackHelper* CMpMpxEmbeddedPlaybackHelper::NewL( 
+    TUid aHostUid,
+    MMPXPlaybackUtility* aPlaybackUtility,
+    MMpMpxEmbeddedPlaybackHelperObserver* aObserver )
+{
+    CMpMpxEmbeddedPlaybackHelper* self =
+            new ( ELeave ) CMpMpxEmbeddedPlaybackHelper( aHostUid, aPlaybackUtility, aObserver );
+    return self;
+}
+
+/*!
+ \internal
+ Destructor
+ */
+CMpMpxEmbeddedPlaybackHelper::~CMpMpxEmbeddedPlaybackHelper()
+{
+}
+
+/*!
+ \internal
+  */
+void CMpMpxEmbeddedPlaybackHelper::playL( const TDesC& aFilename )
+{
+    TX_LOG
+    iFileNameToPlay = QString::fromUtf16( aFilename.Ptr(), aFilename.Length() );
+}
+
+
+/*!
+ \internal
+ */
+void CMpMpxEmbeddedPlaybackHelper::triggerError()
+{
+    iObserver->HandleEmbeddedPlaybackError( KErrGeneral );
+}
+
+/*!
+ \internal
+  */
+CMpMpxEmbeddedPlaybackHelper::CMpMpxEmbeddedPlaybackHelper(
+        TUid aHostUid,
+        MMPXPlaybackUtility* aPlaybackUtility,
+        MMpMpxEmbeddedPlaybackHelperObserver* aObserver )
+    : iPlaybackUtility( aPlaybackUtility ),
+      iObserver( aObserver ),
+      iHostUid( aHostUid )
+{
+}
+
--- a/mpengine/tsrc/unittest_mpmpxplaybackframeworkwrapper/stub/src/mpplaybackdata.cpp	Fri Sep 17 08:28:52 2010 +0300
+++ b/mpengine/tsrc/unittest_mpmpxplaybackframeworkwrapper/stub/src/mpplaybackdata.cpp	Mon Oct 04 00:14:19 2010 +0300
@@ -208,10 +208,10 @@
 /*!
  Stub function.
 */
-void MpPlaybackData::commitPlaybackInfo()
+void MpPlaybackData::commitPlaybackInfo( bool changed )
 {
     TX_ENTRY
-    mMediaReady = ETrue;
+    mMediaReady = changed;
     TX_EXIT
 }
 
--- a/mpengine/tsrc/unittest_mpmpxplaybackframeworkwrapper/unittest_mpmpxplaybackframeworkwrapper.pro	Fri Sep 17 08:28:52 2010 +0300
+++ b/mpengine/tsrc/unittest_mpmpxplaybackframeworkwrapper/unittest_mpmpxplaybackframeworkwrapper.pro	Mon Oct 04 00:14:19 2010 +0300
@@ -47,11 +47,13 @@
           stub/inc/mpxplaybackutility.h \
           stub/inc/hbglobal.h \
           stub/inc/mpsongdata.h \
+          stub/inc/mpmpxembeddedplaybackhelper.h \
           ../../../mpserviceplugins/inc/mpxaudioeffectengine.h
 
 SOURCES += src/unittest_mpmpxplaybackframeworkwrapper.cpp \
           ../../src/mpmpxplaybackframeworkwrapper.cpp \
           stub/src/mpplaybackdata.cpp \
           stub/src/mpxplaybackutility.cpp \
-          stub/src/mpsongdata.cpp
+          stub/src/mpsongdata.cpp \
+          stub/src/mpmpxembeddedplaybackhelper.cpp
 
--- a/mpserviceplugins/mpxsqlitepodcastdbplugin/src/mpxdbpodcast.cpp	Fri Sep 17 08:28:52 2010 +0300
+++ b/mpserviceplugins/mpxsqlitepodcastdbplugin/src/mpxdbpodcast.cpp	Mon Oct 04 00:14:19 2010 +0300
@@ -17,7 +17,7 @@
 
 
 // INCLUDE FILES
-#include <PCRes.rsg>
+#include <pcres.rsg>
 #include <sqldb.h>
 
 #include <mpxmedia.h>
--- a/mpserviceplugins/mpxsqlitepodcastdbplugin/src/mpxpodcastdbhandler.cpp	Fri Sep 17 08:28:52 2010 +0300
+++ b/mpserviceplugins/mpxsqlitepodcastdbplugin/src/mpxpodcastdbhandler.cpp	Mon Oct 04 00:14:19 2010 +0300
@@ -18,7 +18,7 @@
 
 
 // INCLUDE FILES
-#include <PCRes.rsg>
+#include <pcres.rsg>
 #include <bautils.h>
 #include <MetaDataUtility.h>
 #ifdef RD_MULTIPLE_DRIVE
--- a/mpserviceplugins/mpxsqlitepodcastdbplugin/src/mpxpodcastdbplugin.cpp	Fri Sep 17 08:28:52 2010 +0300
+++ b/mpserviceplugins/mpxsqlitepodcastdbplugin/src/mpxpodcastdbplugin.cpp	Mon Oct 04 00:14:19 2010 +0300
@@ -18,7 +18,7 @@
 
 // INCLUDE FILES
 #include <e32cmn.h>
-#include <PCRes.rsg>
+#include <pcres.rsg>
 #include <bautils.h>
 #include <data_caging_path_literals.hrh>
 
--- a/mpviewplugins/mpcollectionviewplugin/src/mpcollectionpopuphandler.cpp	Fri Sep 17 08:28:52 2010 +0300
+++ b/mpviewplugins/mpcollectionviewplugin/src/mpcollectionpopuphandler.cpp	Mon Oct 04 00:14:19 2010 +0300
@@ -308,7 +308,7 @@
     mPermanentData->mOriginalName = currentName;
     getText( hbTrId( "txt_mus_dialog_enter_name" ), 
              currentName,
-             hbTrId( "txt_common_button_ok" ), //TODO:replace for "rename" when string is available
+             hbTrId( "txt_mus_button_rename" ),
              SLOT( handleRenamePlaylistContainer( HbAction* ) ) );
     TX_EXIT
 }
@@ -322,7 +322,7 @@
     mPermanentData->mOriginalName = currentName;
     getText( hbTrId( "txt_mus_dialog_enter_name" ), 
              currentName,
-             hbTrId( "txt_common_button_ok" ),//TODO:replace for "rename" when string is available
+             hbTrId( "txt_mus_button_rename" ),
              SLOT( handleRenamePlaylistItem( HbAction* ) ) );
     TX_EXIT
 }
@@ -333,7 +333,7 @@
 void MpCollectionPopupHandler::openAddSongsToPlaylist( QAbstractItemModel* model )
 {
     TX_ENTRY
-    getModelIndexes( hbTrId( "txt_mus_title_select_songs" ),//TODO:replace for "add songs" when string is available
+    getModelIndexes( hbTrId( "txt_mus_title_add_songs" ),
                      hbTrId( "txt_common_button_add_dialog" ),
                      model,
                      SLOT( handleAddSongsToPlayList( HbAction* ) ) );
@@ -351,7 +351,7 @@
     //this item will be deleted when clearing permanent data.
     model->setParent(mPermanentData);
     model->refreshModel();
-    getModelIndexes( hbTrId( "txt_mus_title_select_songs" ),//TODO:replace for "add songs" when string is available
+    getModelIndexes( hbTrId( "txt_mus_title_add_songs" ),
                      hbTrId( "txt_common_button_add_dialog" ),
                      model,
                      SLOT( handleAddSongsToPlayList( HbAction* ) ) );
@@ -387,7 +387,7 @@
     collectionDataModel->refreshModel();
     mPermanentData->mAbstractItemModel = collectionDataModel;
 
-    getModelIndexes( hbTrId( "txt_mus_title_select_songs" ),//TODO:replace for "add songs" when string is available
+    getModelIndexes( hbTrId( "txt_mus_title_add_songs" ),
                      hbTrId( "txt_common_button_add_dialog" ),
                      collectionDataModel,
                      SLOT( handleAddToCurrentPlaylist( HbAction* ) ) );
@@ -750,7 +750,7 @@
         QString newPlaylistName = dialog->value().toString();
         //Store the new playlist name and query for the items to be added
         mPermanentData->mOriginalName = newPlaylistName;
-        getModelIndexes( hbTrId( "txt_mus_title_select_songs" ),//TODO:replace for "add songs" when string is available
+        getModelIndexes( hbTrId( "txt_mus_title_add_songs" ),
                          hbTrId( "txt_common_button_add_dialog" ),
                          mPermanentData->mAbstractItemModel, 
                          SLOT( handleCreateNewPlaylistGetModelIndexesFinished( HbAction* ) ) );
--- a/mpviewplugins/mpcollectionviewplugin/src/mpcollectionview.cpp	Fri Sep 17 08:28:52 2010 +0300
+++ b/mpviewplugins/mpcollectionviewplugin/src/mpcollectionview.cpp	Mon Oct 04 00:14:19 2010 +0300
@@ -1108,7 +1108,7 @@
                     mShuffleAction->setDisabled( true );
                 }
                 if ( !mCollectionData->isAutoPlaylist() ) {
-                menuAction = myMenu->addAction( hbTrId( "txt_common_menu_rename_item" ) );
+                menuAction = myMenu->addAction( hbTrId( "txt_common_opt_rename_item" ) );
                     if ( !mUsbBlocked ) {
                         connect( menuAction, SIGNAL( triggered() ), this, SLOT( renameCurrentPlaylistContainer() ) );
                     }
@@ -1119,23 +1119,13 @@
                 addDefaultMenuOptions( myMenu, true, true );
                 break;
             default:
-                //if we accidentally fall in an unknown context
+                // Provide 'exit' if we accidentally fall in an unknown context
                 addDefaultMenuOptions( myMenu, false, true );
                 break;
         }
     }
     else if ( mViewMode == MpCommon::FetchView ) {
-        switch ( mCollectionContext ) {
-            case ECollectionContextAllSongs:
-            case ECollectionContextArtists:
-            case ECollectionContextAlbums:
-                addDefaultMenuOptions( myMenu, true, false );
-                break;
-            default:
-                //if we accidentally fall in an unknown context
-                addDefaultMenuOptions( myMenu, false, true );
-                break;
-        }
+        addDefaultMenuOptions( myMenu, true, false );
     }
 
     setMenu( myMenu );
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpviewplugins/mpplaybackviewplugin/inc/mplightmonitor.h	Mon Oct 04 00:14:19 2010 +0300
@@ -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: Light monitor for Playback.
+*
+*/
+
+#ifndef MPLIGHTMONITOR_H
+#define MPLIGHTMONITOR_H
+
+#include <QObject>
+
+class MpLightMonitorPrivate;
+
+class MpLightMonitor : public QObject
+{
+    Q_OBJECT
+
+    friend class MpLightMonitorPrivate;
+
+public:
+
+    explicit MpLightMonitor( QObject *parent=0 );
+    virtual ~MpLightMonitor();
+
+signals:
+
+    void lcdLightStatus( bool lightOn );
+
+private:
+
+    Q_DISABLE_COPY( MpLightMonitor )
+    MpLightMonitorPrivate        *d_ptr;
+
+};
+
+#endif  // MPLIGHTMONITOR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpviewplugins/mpplaybackviewplugin/inc/mplightmonitor_p.h	Mon Oct 04 00:14:19 2010 +0300
@@ -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: Light monitor for Playback - Private. 
+*
+*/
+
+#ifndef MPLIGHTMONITOR_P_H
+#define MPLIGHTMONITOR_P_H
+
+#include <hwrmlight.h>
+
+class MpLightMonitor;
+
+class MpLightMonitorPrivate : public MHWRMLightObserver
+{
+public:
+
+    explicit MpLightMonitorPrivate( MpLightMonitor *qq );
+    void init();
+    virtual ~MpLightMonitorPrivate();
+
+private:
+  
+    void DoInitL();
+    // From MHWRMLightObserver
+    virtual void LightStatusChanged( TInt aTarget, CHWRMLight::TLightStatus aStatus );
+
+private:
+
+    MpLightMonitor                      *q_ptr;
+    CHWRMLight::TLightStatus            iLightStatus;
+    CHWRMLight                          *iLight;        //Own            
+
+};
+
+#endif  // MPLIGHTMONITOR_P_H
--- a/mpviewplugins/mpplaybackviewplugin/inc/mpplaybackwidget.h	Fri Sep 17 08:28:52 2010 +0300
+++ b/mpviewplugins/mpplaybackviewplugin/inc/mpplaybackwidget.h	Mon Oct 04 00:14:19 2010 +0300
@@ -28,6 +28,7 @@
 class HbLabel;
 class MpPlaybackDocumentLoader;
 class MpAlbumCoverWidget;
+class MpLightMonitor;
 
 class MpPlaybackWidget : public HbWidget
 {
@@ -50,6 +51,8 @@
     void durationChanged();
     void positionChanged();
     void albumArtChanged();
+    void handleLcdLightStatus( bool lightOn );
+    void handleCollectionPlaylistOpened();
   
 private slots:
 
@@ -60,11 +63,14 @@
 private:
 
     QString formatDuration( int seconds );
+    void connectPlaybackDataSignals( bool connectSignal );
+	void updatePlaybackInfo();
 
 private:
 
     MpPlaybackData           *mPlaybackData;        // Not own
     MpPlaybackDocumentLoader *mDocumentLoader;      // Own
+    MpLightMonitor           *mLightMonitor;        // Own
 
     HbStackedLayout          *mLayout;              // Not own
     HbLabel                  *mSongTitle;           // Not own
--- a/mpviewplugins/mpplaybackviewplugin/mpplaybackviewplugin.pro	Fri Sep 17 08:28:52 2010 +0300
+++ b/mpviewplugins/mpplaybackviewplugin/mpplaybackviewplugin.pro	Mon Oct 04 00:14:19 2010 +0300
@@ -41,7 +41,8 @@
         -lmpsettingsmanager \
         -lmpengine \
         -lmpdata \
-        -lmpalbumcoverwidget
+        -lmpalbumcoverwidget \
+        -lhwrmlightclient
 
 # Input
 HEADERS += ../../inc/mpviewbase.h \
@@ -49,13 +50,17 @@
            inc/mpplaybackview.h \
            inc/mpplaybackwidget.h \
            inc/mpequalizerwidget.h \
-           inc/mpplaybackdocumentloader.h
+           inc/mpplaybackdocumentloader.h \
+           inc/mplightmonitor_p.h \
+           inc/mplightmonitor.h
 
 SOURCES += src/mpplaybackviewplugin.cpp \
           src/mpplaybackview.cpp \
           src/mpplaybackwidget.cpp \
           src/mpequalizerwidget.cpp \
-          src/mpplaybackdocumentloader.cpp
+          src/mpplaybackdocumentloader.cpp \
+          src/mplightmonitor_p.cpp \
+          src/mplightmonitor.cpp
        
 RESOURCES += resources/mpplaybackviewpluginresources.qrc
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpviewplugins/mpplaybackviewplugin/src/mplightmonitor.cpp	Mon Oct 04 00:14:19 2010 +0300
@@ -0,0 +1,53 @@
+/*
+* 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: Light monitor for Playback.
+*
+*/
+
+#include "mplightmonitor.h"
+#include "mplightmonitor_p.h"
+
+
+/*!
+    \class MpLightMonitor
+    \brief Wrapper for light monitor.
+
+    MpLightMonitor provides Qt style interface to the Light Observer.
+    It's implementation is hidden using private class data pattern.
+*/
+
+/*!
+    \fn void lcdLightStatus( bool lightOn );
+
+    This signal is emitted when the device light status changes.
+ */
+
+/*!
+ \internal
+ */
+MpLightMonitor::MpLightMonitor( QObject *parent )
+    : QObject( parent )
+{
+    d_ptr = new MpLightMonitorPrivate ( this );
+    d_ptr->init();
+}
+
+/*!
+ \internal
+ */
+MpLightMonitor::~MpLightMonitor()
+{
+    delete d_ptr;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpviewplugins/mpplaybackviewplugin/src/mplightmonitor_p.cpp	Mon Oct 04 00:14:19 2010 +0300
@@ -0,0 +1,91 @@
+/*
+* 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: Light monitor for Playback - Private.
+*
+*/
+
+#include "mplightmonitor_p.h"
+#include "mplightmonitor.h"
+#include "mptrace.h"
+
+
+/*!
+    \class MpLightMonitorPrivate
+    \brief Wrapper for light monitor - private implementation.
+
+    This is a private implementation of the light monitor interface.
+*/
+
+/*!
+ \internal
+ */
+MpLightMonitorPrivate::MpLightMonitorPrivate( MpLightMonitor *qq )
+    :q_ptr( qq ),
+    iLightStatus( CHWRMLight::ELightStatusUnknown ),
+    iLight( 0 )
+{
+    TX_LOG
+}
+
+/*!
+ \internal
+ */
+void MpLightMonitorPrivate::init()
+{
+    TX_ENTRY
+    TRAPD(err, DoInitL());
+    if ( err != KErrNone ) {
+        TX_LOG_ARGS("Error: " << err << "; should never get here.");
+    }
+    TX_EXIT
+}
+
+/*!
+ \internal
+ */
+void MpLightMonitorPrivate::DoInitL()
+{
+    TX_ENTRY
+    iLight = CHWRMLight::NewL( this );
+    TX_EXIT
+}
+
+/*!
+ \internal
+ */
+MpLightMonitorPrivate::~MpLightMonitorPrivate()
+{
+    TX_ENTRY
+    delete iLight; 
+    TX_EXIT
+}
+
+/*!
+ \internal
+ */
+void MpLightMonitorPrivate::LightStatusChanged( TInt aTarget, CHWRMLight::TLightStatus aStatus )
+{
+    TX_ENTRY
+    if ( aTarget == CHWRMLight::EPrimaryDisplay && aStatus != iLightStatus ) {        
+        if ( aStatus == CHWRMLight::ELightOn ) {
+            q_ptr->emit lcdLightStatus ( true ); 
+        }
+        else if( aStatus == CHWRMLight::ELightOff ) {
+            q_ptr->emit lcdLightStatus ( false );
+        }             
+        iLightStatus = aStatus;        
+    }
+    TX_EXIT
+}
+
--- a/mpviewplugins/mpplaybackviewplugin/src/mpplaybackwidget.cpp	Fri Sep 17 08:28:52 2010 +0300
+++ b/mpviewplugins/mpplaybackviewplugin/src/mpplaybackwidget.cpp	Mon Oct 04 00:14:19 2010 +0300
@@ -28,6 +28,7 @@
 #include "mpalbumcoverwidget.h"
 #include "mpplaybackdocumentloader.h"
 #include "mptrace.h"
+#include "mplightmonitor.h"
 
 const unsigned int KMicroSecToMiliSec( 1000 );
 
@@ -45,6 +46,13 @@
     position, \a value indicates the position.
  */
 
+ /*!
+    \fn void signalPlaybackInfoChanged()
+
+    This signal is emitted when playback information has changed. Added for MATTI testing support.
+ */
+
+
 /*!
  Constructs the collection view plugin.
  */
@@ -52,6 +60,7 @@
     : HbWidget(parent),
       mPlaybackData(data),
       mDocumentLoader(0),
+      mLightMonitor(0),
       mProgreesBarDragging(false),
       mDuration(0)
 {
@@ -98,21 +107,17 @@
         Q_ASSERT_X(widgetsOk, "MpPlaybackWidget", "invalid xml file - widget");
     }
 
+    mLightMonitor = new MpLightMonitor (this);
+    connect( mLightMonitor, SIGNAL(lcdLightStatus(bool)), this, SLOT(handleLcdLightStatus(bool)) );
+
     connect( mProgressBar, SIGNAL(sliderPressed()), this, SLOT(handleSliderPressed()) );
     connect( mProgressBar, SIGNAL(sliderReleased()), this, SLOT(handleSliderReleased()) );
     connect( mProgressBar, SIGNAL(sliderMoved(int)), this, SLOT(handleSliderMoved(int)) );
 
-    connect( mPlaybackData, SIGNAL(playbackInfoChanged()), this, SLOT(playbackInfoChanged()) );
-    connect( mPlaybackData, SIGNAL(durationChanged()), this, SLOT(durationChanged()) );
-    connect( mPlaybackData, SIGNAL(positionChanged()), this, SLOT(positionChanged()) );
-    connect( mPlaybackData, SIGNAL(albumArtReady()), this, SLOT(albumArtChanged()) );
-    
-    //Update to set initial conditions if playback has already started.
+    connectPlaybackDataSignals(true);
+    // Update to set initial conditions if playback has already started.
     if ( mPlaybackData->playbackState() != MpPlaybackData::NotPlaying ) {
-        playbackInfoChanged();
-        durationChanged();
-        positionChanged();
-        albumArtChanged();
+        updatePlaybackInfo();
     }
     TX_EXIT
 }
@@ -124,6 +129,7 @@
 {
     TX_ENTRY
     delete mDocumentLoader;
+    delete mLightMonitor;
     TX_EXIT
 }
 
@@ -132,7 +138,7 @@
  */
 void MpPlaybackWidget::repeatChanged( bool value )
 {
-    mRepeatIndicator->setVisible( value );   
+    mRepeatIndicator->setVisible( value );
 }
 
 /*!
@@ -272,3 +278,72 @@
 }
 
 
+/*!
+ Slot to be called to handle LCD light status change.
+ */
+void MpPlaybackWidget::handleLcdLightStatus( bool lightOn )
+{
+    TX_ENTRY
+    if ( lightOn ) {
+        connectPlaybackDataSignals( true );
+        updatePlaybackInfo();
+    }
+    else {
+        connectPlaybackDataSignals( false );
+    }
+    TX_EXIT
+}
+
+/*!
+ Connect/disconnect the signals from the Playback data according to /a connect.
+ */
+void MpPlaybackWidget::connectPlaybackDataSignals( bool connectSignal )
+{
+    TX_ENTRY
+    if ( connectSignal ) {
+        connect( mPlaybackData, SIGNAL(playbackInfoChanged()), this, SLOT(playbackInfoChanged()) );
+        connect( mPlaybackData, SIGNAL(durationChanged()), this, SLOT(durationChanged()) );
+        connect( mPlaybackData, SIGNAL(positionChanged()), this, SLOT(positionChanged()) );
+        connect( mPlaybackData, SIGNAL(albumArtReady()), this, SLOT(albumArtChanged()) );
+        connect( mPlaybackData, SIGNAL(collectionPlaylistOpened()), this, SLOT(handleCollectionPlaylistOpened()) );     
+       }
+    else {
+        mPlaybackData->disconnect( this );
+    }
+    TX_EXIT
+}
+
+/*!
+ Update playback information.
+ */
+void MpPlaybackWidget::updatePlaybackInfo()
+{
+    TX_ENTRY
+    playbackInfoChanged();
+    durationChanged();
+    positionChanged();
+    albumArtChanged();
+    TX_EXIT
+}
+
+/*!
+ Slot to be called to handle the selection of an item from collection view when playback
+ view was previously activated with another item. We reset or hide the view items 
+ in order to reduce the flickering.
+ */
+void MpPlaybackWidget::handleCollectionPlaylistOpened()
+{
+    TX_ENTRY
+    QString blankSpace = " ";   
+    mAlbumArt->setEnabled( false );
+    mArtistName->setPlainText( blankSpace );
+    mAlbumName->setPlainText( blankSpace );
+    mSongTitle->setPlainText( blankSpace );
+    mRealAudioIndicator->setVisible( false );
+    mProgressBar->setProgressValue( 0 );
+    mProgressBar->setSliderValue( 0 );
+    mProgressBar->setMinText( formatDuration( 0 ) );
+    mProgressBar->setMaxText( formatDuration( 0 ) );
+    TX_EXIT
+}
+
--- a/mpviewplugins/mpplaybackviewplugin/tsrc/tsrc.pro	Fri Sep 17 08:28:52 2010 +0300
+++ b/mpviewplugins/mpplaybackviewplugin/tsrc/tsrc.pro	Mon Oct 04 00:14:19 2010 +0300
@@ -19,8 +19,8 @@
 SUBDIRS += unittest_mpequalizerwidget \
            unittest_mpplaybackdocumentloader \
            unittest_mpplaybackviewplugin \
-           unittest_mpplaybackview
-#           unittest_mpplaybackwidget
+           unittest_mpplaybackview \
+           unittest_mpplaybackwidget
 
 CONFIG += ordered
 
--- a/mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackwidget/inc/unittest_mpplaybackwidget.h	Fri Sep 17 08:28:52 2010 +0300
+++ b/mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackwidget/inc/unittest_mpplaybackwidget.h	Mon Oct 04 00:14:19 2010 +0300
@@ -43,7 +43,9 @@
     void testDurationChanged();
     void testPositionChanged();
     void testAlbumArtChanged();
-
+    void testHandleLcdLightStatus();
+    void testHandleCollectionPlaylistOpened();
+	
 private:
     MpPlaybackWidget          *mTest;
 
--- a/mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackwidget/src/unittest_mpplaybackwidget.cpp	Fri Sep 17 08:28:52 2010 +0300
+++ b/mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackwidget/src/unittest_mpplaybackwidget.cpp	Mon Oct 04 00:14:19 2010 +0300
@@ -158,5 +158,26 @@
     QVERIFY( mTest->mAlbumArt->isEnabled() == true );
 }
 
+/*!
+ test handleLcdLightStatus
+ */
+void TestMpPlaybackWidget::testHandleLcdLightStatus( )
+{
+    mTest->handleLcdLightStatus( true );
+    testPlaybackInfoChanged();
+	
+}
+
+/*!
+ test handleCollectionPlaylistOpened
+ */
+void TestMpPlaybackWidget::testHandleCollectionPlaylistOpened()
+{
+    mTest->handleCollectionPlaylistOpened();
+    QVERIFY( mTest->mSongTitle->plainText() == " " );
+    QVERIFY( mTest->mArtistName->plainText() == " " );
+    QVERIFY( mTest->mAlbumName->plainText() == " " );
+}
+
 
 // End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackwidget/stub/inc/mplightmonitor.h	Mon Oct 04 00:14:19 2010 +0300
@@ -0,0 +1,46 @@
+/*
+* 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: Light monitor for Playback.
+*
+*/
+
+#ifndef MPLIGHTMONITOR_H
+#define MPLIGHTMONITOR_H
+
+#include <QObject>
+
+class MpLightMonitorPrivate;
+
+class MpLightMonitor : public QObject
+{
+    Q_OBJECT
+
+    friend class MpLightMonitorPrivate;
+
+public:
+
+    explicit MpLightMonitor( QObject *parent=0 );
+    virtual ~MpLightMonitor();
+
+signals:
+
+    void lcdLightStatus( bool lightOn );
+
+private:
+
+    Q_DISABLE_COPY( MpLightMonitor )
+
+};
+
+#endif  // MPLIGHTMONITOR_H
--- a/mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackwidget/stub/inc/mpplaybackdata.h	Fri Sep 17 08:28:52 2010 +0300
+++ b/mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackwidget/stub/inc/mpplaybackdata.h	Mon Oct 04 00:14:19 2010 +0300
@@ -24,7 +24,7 @@
 
 #include <hbicon.h>
 
-//forward declartions
+//forward declarations
 
 class MpPlaybackData : public QObject
 {
@@ -66,6 +66,8 @@
     void albumArtReady();
     void playbackStateChanged();
     void playbackInfoChanged();
+    void collectionPlaylistOpened();
+
     
 public:
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackwidget/stub/src/mplightmonitor.cpp	Mon Oct 04 00:14:19 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* 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: Light monitor for Playback.
+*
+*/
+
+#include "mplightmonitor.h"
+
+
+/*!
+    \class MpLightMonitor
+    \brief Wrapper for light monitor.
+
+    MpLightMonitor provides Qt style interface to the Light Observer.
+    It's implementation is hidden using private class data pattern.
+*/
+
+/*!
+    \fn void lcdLightStatus( bool lightOn );
+
+    This signal is emitted when the device light status changes.
+ */
+
+/*!
+ \internal
+ */
+MpLightMonitor::MpLightMonitor( QObject *parent )
+    : QObject( parent )
+{
+
+}
+
+/*!
+ \internal
+ */
+MpLightMonitor::~MpLightMonitor()
+{
+}
+
--- a/mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackwidget/unittest_mpplaybackwidget.pro	Fri Sep 17 08:28:52 2010 +0300
+++ b/mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackwidget/unittest_mpplaybackwidget.pro	Mon Oct 04 00:14:19 2010 +0300
@@ -32,6 +32,7 @@
 		   stub/inc/mpplaybackdata.h \
 		   stub/inc/mpalbumcoverwidget.h \
 		   stub/inc/mpplaybackdocumentloader.h \
+		   stub/inc/mplightmonitor.h \
            ../../inc/mpplaybackwidget.h
            
 
@@ -39,6 +40,7 @@
   		   stub/src/mpplaybackdata.cpp \
   		   stub/src/mpalbumcoverwidget.cpp \
   		   stub/src/mpplaybackdocumentloader.cpp \
+		   stub/src/mplightmonitor.cpp \
 		   ../../src/mpplaybackwidget.cpp
 
 RESOURCES += ../../resources/mpplaybackviewpluginresources.qrc
\ No newline at end of file
--- a/musicwidgetplugin/inc/musicwidget.h	Fri Sep 17 08:28:52 2010 +0300
+++ b/musicwidgetplugin/inc/musicwidget.h	Mon Oct 04 00:14:19 2010 +0300
@@ -18,14 +18,10 @@
 #ifndef MUSICWIDGET_H
 #define MUSICWIDGET_H
 
-// System includes
-#include <QGraphicsLinearLayout>
-#include <QGraphicsGridLayout>
+// includes
 #include <hbwidget.h>
 #include <xqappmgr.h>
 
-#include "mpplaybackdata.h"
-
 // Forward declarations
 class HbLabel;
 class HbPushButton;
@@ -33,11 +29,13 @@
 class HbMarqueeItem;
 class MpEngine;
 class MpAlbumCoverWidget;
+class MpApplicationMonitor;
+class MpPlaybackData;
 
 /**
  * Media key identifier for push button events
  */
-enum MediaKeyIdentifier{
+enum MediaKeyIdentifier {
     EPrevious = 1,
     EPlayPause,
     ENext
@@ -46,9 +44,10 @@
 /**
  * Music Player launch source identifier
  */    
-enum LaunchIdentifier{
-    ELaunchFromPlay,
-    ELaunchFromShortcut
+enum LaunchIdentifier {
+    ELaunchToMainView,
+    ELaunchToNowPlayingView,
+    ELaunchToNowPlayingViewWithShuffle
 };
 
 class MusicWidget: public HbWidget
@@ -74,33 +73,32 @@
     /**
      * Launch Music Player to view
      */      
-    void launchMusicPlayer(int launchMode = ELaunchFromShortcut);
-    
-    /**
-     * Similar to public slots mediaButtonPressed and mediaButtonReleased, but this oen is called internally
-     * Draws the spesified button to disabled state
-     */
-    void mediaButtonDisabled( int aMediaKeyId );
+    void launchMusicPlayer( int launchMode );
     
     /**
-     * Similar to public slots mediaButtonPressed and mediaButtonReleased, but this oen is called internally
-     * Draws the spesified button to enabled state
-     */    
-    void mediaButtonEnabled( int aMediaKeyId );
+     * Update widget buttons according to Music Player state
+     */       
+    void updateButtons();
+
+    /**
+     * Connect/disconnect Music Player engine and playback data
+     */           
+    void connectMusicPlayerEngine( bool connect );
     
     /**
-     * Disable/enable widget buttons according to Music Player state
-     */       
-    void toggleButtons();
-    
-public:
-    QRectF boundingRect() const;
-    QPainterPath shape() const;
+     * Get the playback state
+     */
+    int getPlaybackState();
+
+    /**
+     * Clear the song data
+     */
+    void clearData();
     
 public slots:
 
     /**
-     * Widget slots
+     * Widget related
      */    
     void onInitialize();
     void onShow();
@@ -108,64 +106,37 @@
     void onUninitialize();
     
     /**
-     * MpEngine slots
-     */
+     * MpEngine related
+     */    
     void libraryUpdateStarted();
     void libraryUpdated();
     void usbBlocked( bool blocked );    
 
     /**
-     * MpPlaybackData slots
+     * MpPlaybackData related
      */        
     void albumArtReady();
     void playbackStateChanged();
     void playbackInfoChanged();    
     
-    /**
-     * ?????
-     */            
-    bool eventFilter(QObject *target, QEvent *event);
-    
-    /**
-     * Button specific slots
-     */        
-    void mediaButtonPressed( int aMediaKeyId );
-    void mediaButtonReleased( int aMediaKeyId );
-    
-protected:
-    
-    /**
-     * Called from mediaButtonPressed and from mediaButtonReleased slots. 
-     * Calls defineMediaButton to redraw the media button
-     */
-    void mediaButtonEvent( MediaKeyIdentifier aMediaKeyId, QString aGraphicsId, QString aIconColor );
-
-    /**
-     * Creates the aTarget push button based on params aGraphicsId and aSuffix. 
-     * Used to change the look and feel of the button based to the aState
-     * param: aTarget is the push button to be changed, must not be Null
-     * param: aGraphicsId defines the button background graphics
-     * param: aSuffix filename suffix, see KPrevButPrefix for example from musicwidget.cpp
-     */
-    void defineMediaButton( HbPushButton& aTarget, QString aGraphicsId, QStringList aSuffix, QString aIconColor );
-
 private slots:
 
     /**
      * Slots to be called after button press
      */    
-    void prevSong();
-    void playSong();
-    void nextSong();
-    void shortcutButton();
+    void handlePrevButtonClicked();
+    void handlePlayButtonClicked();
+    void handleNextButtonClicked();
+    void handleAlbumArtClicked();
+    
+    /**
+     * MpApplicationMonitor related
+     */
+    void applicationStatusChanged( bool isrunning );
     
 private:  
-    // mShortcutButtonLayout items
-    HbPushButton *mShortcutArea;
-
     //mSongDataLayout items
-    HbWidget *mSongDataBG;
-    HbLabel *mInformationSongName;
+    HbLabel *mSongDataBackground;
     HbMarqueeItem *mMarqueeText;
     
     // mControlButtonsLayout items
@@ -174,24 +145,22 @@
     HbPushButton *mNextPushButton;
     
     // MusicPlayer related state identifiers
-    bool mMusicPlayerNoSongData;
     bool mMusicPlayerUpdating;
     bool mMusicPlayerBlocked;
+    bool mMusicPlayerRunning;
     
     // Album art for background
     MpAlbumCoverWidget *mAlbumArt;
     
-    // Artist and song title identifiers 
-    QString mArtist;
-    QString mTitle;
-    
     // Used to launch MusicPlayer
     XQApplicationManager mApplicationManager;
     
     // MusicPlayer control and state updates
-    MpEngine* mMpEngine;
-    MpPlaybackData* mMpPlaybackData;
-
+    MpEngine *mMpEngine;
+    MpPlaybackData *mMpPlaybackData;
+    
+    // Music Player observer
+    MpApplicationMonitor *mMpApplicationMonitor;
 };
 
 #endif // MUSICWIDGET_H
--- a/musicwidgetplugin/musicwidgetplugin.pro	Fri Sep 17 08:28:52 2010 +0300
+++ b/musicwidgetplugin/musicwidgetplugin.pro	Mon Oct 04 00:14:19 2010 +0300
@@ -15,28 +15,34 @@
 #
 
 TEMPLATE = lib
+TARGET   = musicwidgetplugin
+TRANSLATIONS += musicwidgetplugin.ts
 CONFIG += plugin mobility hb
 MOBILITY = serviceframework
 
-LIBS += -lxqservice
-LIBS += -lxqserviceutil
-LIBS += -lmpengine
-LIBS += -lmpdata
-LIBS += -lmpalbumcoverwidget
+LIBS += -lxqservice \
+        -lxqserviceutil \
+        -lmpengine \
+        -lmpdata \
+        -lmpalbumcoverwidget \
+        -lmpapplicationmonitor
 
-INCLUDEPATH += ./inc
-INCLUDEPATH += ../inc
+INCLUDEPATH += inc \
+               ../inc
 
-HEADERS += ./inc/*.h
-SOURCES += ./src/*.cpp
+HEADERS += inc/musicwidget.h \
+           inc/musicwidgetdocumentloader.h \
+           inc/musicwidgetplugin.h
+           
+SOURCES += src/musicwidget.cpp \
+           src/musicwidgetdocumentloader.cpp \
+           src/musicwidgetplugin.cpp
 
 
 RESOURCES = resource/musicwidgetui.qrc
 
 UID = 200286FA
 
-symbian:include(./rom/rom.pri)
-
 symbian: {
 
     DESTDIR = $${PRIVATE}/private/20022F35/import/widgetregistry/$${UID}
@@ -45,7 +51,6 @@
     TARGET.UID3 = 0x$${UID}
     TARGET.EPOCALLOWDLLDATA=1
     TARGET.CAPABILITY = ALL -TCB
-    #TRANSLATIONS    += musicwidgetplugin.ts
         
     plugins.path = $${DESTDIR}
     plugins.sources = $${TARGET}.dll 
@@ -53,7 +58,6 @@
     widgetResources.path = $${DESTDIR}
     widgetResources.sources += resource/$${TARGET}.xml
     widgetResources.sources += resource/$${TARGET}.manifest
-    widgetResources.sources += resource/musicwidgeticon.png
     
     DEPLOYMENT += plugins \
                   widgetResources
--- a/musicwidgetplugin/resource/music_widget.docml	Fri Sep 17 08:28:52 2010 +0300
+++ b/musicwidgetplugin/resource/music_widget.docml	Mon Oct 04 00:14:19 2010 +0300
@@ -1,21 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <hbdocument version="0.9">
     <widget name="containerWidget" type="HbWidget">
-        <widget name="shortcut_icon_background" type="HbLabel">
-            <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
-            <enums name="aspectRatioMode" value="IgnoreAspectRatio"/>
-            <real name="z" value="3"/>
-            <sizepolicy horizontalPolicy="Fixed" horizontalStretch="0" verticalPolicy="Fixed" verticalStretch="0"/>
-            <sizehint height="12un" type="FIXED" width="12un"/>
-        </widget>
-        <widget name="shortcut_icon" type="HbPushButton">
-            <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
-            <!--  <icon iconName="qtg_large_music" name="icon" width="11un" height="11un"/>  -->
-            <enums name="aspectRatioMode" value="IgnoreAspectRatio"/>
-            <real name="z" value="4"/>
-            <sizepolicy horizontalPolicy="Fixed" horizontalStretch="0" verticalPolicy="Fixed" verticalStretch="0"/>
-            <sizehint height="11un" type="FIXED" width="11un"/>
-        </widget>
         <widget name="widget_background_icon" type="HbLabel">
             <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
             <enums name="aspectRatioMode" value="IgnoreAspectRatio"/>
@@ -29,37 +14,29 @@
             <sizehint height="27.5un" type="FIXED" width="27.5un"/>
         </widget>
         <widget name="text_bg" type="HbLabel">
-            <real name="z" value="4"/>
-            <sizehint height="4.5un" type="PREFERRED" width="27.5un"/>
+            <real name="z" value="3"/>
+            <sizehint height="expr(var(hb-param-text-height-tiny)+2*var(hb-param-margin-gene-middle-vertical))" type="PREFERRED" width="27.5un"/>
         </widget>
-        <widget name="scrolling_text" type="HbLabel">
-            <real name="z" value="5"/>
+        <widget name="scrolling_text" type="HbMarqueeItem">
+            <real name="z" value="4"/>
             <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
-            <sizehint height="var(hb-param-text-height-tiny)" type="PREFERRED" width="26un"/>
+            <sizehint height="var(hb-param-text-height-tiny)" type="PREFERRED" width="expr(27.5un-2*var(hb-param-margin-gene-middle-horizontal))"/>
+            <fontspec name="fontSpec" role="Secondary" textheight="var(hb-param-text-height-secondary)"/>
             <string name="textColor" value="var(qtg_fr_multimedia_trans)"/>
-            <fontspec name="fontSpec" role="Secondary" textheight="var(hb-param-text-height-secondary)"/>
-        </widget>
+            </widget>
         <widget name="button_group_container" type="HbWidget">
             <widget name="btn_previous" type="HbPushButton">
                 <icon iconName="qtg_mono_previous" name="icon"/>            
-            		<sizepolicy horizontalPolicy="Preferred" horizontalStretch="0" verticalPolicy="Preferred" verticalStretch="0"/>
-                <sizehint height="8un" type="PREFERRED" width="11un"/>                               
-                <string name="text"/>
             </widget>        
             <widget name="btn_play" type="HbPushButton">
-								<icon iconName="qtg_mono_play" name="icon"/>            
-            		<sizepolicy horizontalPolicy="Preferred" horizontalStretch="0" verticalPolicy="Preferred" verticalStretch="0"/>
-                <sizehint height="8un" type="PREFERRED" width="11un"/>          
-                <string name="text"/>
+                <icon iconName="qtg_mono_play" name="icon"/>            
             </widget>
             <widget name="btn_next" type="HbPushButton">
                 <icon iconName="qtg_mono_next" name="icon"/>            
-            		<sizepolicy horizontalPolicy="Preferred" horizontalStretch="0" verticalPolicy="Preferred" verticalStretch="0"/>
-                <sizehint height="8un" type="PREFERRED" width="11un"/>            
-                <string name="text"/>
             </widget>
-            <real name="z" value="5"/>
-            <sizehint height="8un" type="PREFERRED" width="33un"/>
+            <real name="z" value="4"/>
+            <sizepolicy horizontalPolicy="Fixed" horizontalStretch="0" verticalPolicy="Fixed" verticalStretch="0"/>
+            <sizehint height="8un" type="FIXED" width="33un"/>
             <layout orientation="Horizontal" spacing="0un" type="linear">
                 <contentsmargins bottom="0un" left="0un" right="0un" top="0un"/>
                 <linearitem itemname="btn_previous" spacing="0un"/>
@@ -68,22 +45,21 @@
             </layout>
         </widget>
         <real name="z" value="1"/>
-        <sizepolicy horizontalPolicy="Fixed" horizontalStretch="0" verticalPolicy="Preferred" verticalStretch="0"/>
-        <sizehint height="38.25un" type="PREFERRED" width="33un"/>
+        <sizepolicy horizontalPolicy="Fixed" horizontalStretch="0" verticalPolicy="Fixed" verticalStretch="0"/>
+        <sizehint height="expr(37un-var(hb-param-margin-gene-middle-vertical))" type="FIXED" width="33un"/>
         <layout type="anchor">
-            <anchoritem dst="shortcut_icon_background" dstEdge="RIGHT" spacing="0un" src="" srcEdge="RIGHT"/>
-            <anchoritem dst="shortcut_icon" dstEdge="RIGHT" spacing="-0.5un" src="" srcEdge="RIGHT"/>
-            <anchoritem dst="shortcut_icon" dstEdge="TOP" spacing="0.5un" src="" srcEdge="TOP"/>
             <anchoritem dst="widget_background_icon" dstEdge="RIGHT" spacing="-var(hb-param-margin-gene-right)" src="" srcEdge="RIGHT"/>
-            <anchoritem dst="widget_background_icon" dstEdge="TOP" spacing="var(hb-param-margin-gene-top)" src="" srcEdge="TOP"/>
+            <anchoritem dst="widget_background_icon" dstEdge="TOP" spacing="0un" src="" srcEdge="TOP"/>
             <anchoritem dst="album_art_image" dstEdge="RIGHT" spacing="-var(hb-param-margin-gene-middle-horizontal)" src="widget_background_icon" srcEdge="RIGHT"/>
             <anchoritem dst="album_art_image" dstEdge="TOP" spacing="var(hb-param-margin-gene-middle-vertical)" src="widget_background_icon" srcEdge="TOP"/>
             <anchoritem dst="text_bg" dstEdge="RIGHT" spacing="0un" src="album_art_image" srcEdge="RIGHT"/>
             <anchoritem dst="text_bg" dstEdge="BOTTOM" spacing="0un" src="album_art_image" srcEdge="BOTTOM"/>
             <anchoritem dst="scrolling_text" dstEdge="RIGHT" spacing="-var(hb-param-margin-gene-middle-horizontal)" src="text_bg" srcEdge="RIGHT"/>
             <anchoritem dst="scrolling_text" dstEdge="BOTTOM" spacing="-var(hb-param-margin-gene-middle-vertical)" src="text_bg" srcEdge="BOTTOM"/>
+            <anchoritem dst="scrolling_text" dstEdge="LEFT" spacing="var(hb-param-margin-gene-middle-horizontal)" src="text_bg" srcEdge="LEFT"/>
+            <anchoritem dst="scrolling_text" dstEdge="TOP" spacing="var(hb-param-margin-gene-middle-vertical)" src="text_bg" srcEdge="TOP"/>
             <anchoritem dst="button_group_container" dstEdge="LEFT" spacing="0un" src="" srcEdge="LEFT"/>
-            <anchoritem dst="button_group_container" dstEdge="TOP" spacing="0un" src="album_art_image" srcEdge="BOTTOM"/>
+            <anchoritem dst="button_group_container" dstEdge="TOP" spacing="0un" src="text_bg" srcEdge="BOTTOM"/>
         </layout>
     </widget>
     <metadata activeUIState="Common ui state" display="NHD portrait" unit="un">
Binary file musicwidgetplugin/resource/musicwidgeticon.png has changed
--- a/musicwidgetplugin/resource/musicwidgetplugin.manifest	Fri Sep 17 08:28:52 2010 +0300
+++ b/musicwidgetplugin/resource/musicwidgetplugin.manifest	Mon Oct 04 00:14:19 2010 +0300
@@ -1,8 +1,10 @@
 <?xml version="1.0" encoding="utf-8"?>
-<widgetprovider>
-    <widget library="musicwidgetplugin"
-            uri="musicwidgetplugin"
-            title="Music Widget"
-            iconuri="musicwidgeticon.png"
-	    description="Music Player Homescreen Widget"/>
-</widgetprovider>
+<hswidgetmanifest>
+    <uri>musicwidgetplugin</uri>
+    <title>txt_muwidget_dblist_music_player</title>
+    <description>txt_muwidget_dblist_val_quick_access_to_music</description>
+    <icon>qtg_large_music</icon>
+    <hidden>false</hidden>
+    <servicexml>musicwidgetplugin.xml</servicexml>
+    <translationfile>musicwidgetplugin</translationfile>
+</hswidgetmanifest>
--- a/musicwidgetplugin/resource/musicwidgetplugin.xml	Fri Sep 17 08:28:52 2010 +0300
+++ b/musicwidgetplugin/resource/musicwidgetplugin.xml	Mon Oct 04 00:14:19 2010 +0300
@@ -8,7 +8,5 @@
         <version>1.0</version>
         <description>Music Player Homescreen Widget</description>
         <capabilities></capabilities>
-        <customproperty key="iconuri">musicwidgeticon.png</customproperty>
-        <customproperty key="title">Music Widget</customproperty>
     </interface>
 </service>
--- a/musicwidgetplugin/resource/musicwidgetui.qrc	Fri Sep 17 08:28:52 2010 +0300
+++ b/musicwidgetplugin/resource/musicwidgetui.qrc	Mon Oct 04 00:14:19 2010 +0300
@@ -1,6 +1,5 @@
 <RCC>
-    <qresource prefix="/gfx">
+    <qresource prefix="/docml">
         <file alias="music_widget.docml">music_widget.docml.bin</file>
-        <file>musicwidgeticon.png</file>
     </qresource>
 </RCC>
--- a/musicwidgetplugin/rom/bld.inf	Fri Sep 17 08:28:52 2010 +0300
+++ b/musicwidgetplugin/rom/bld.inf	Mon Oct 04 00:14:19 2010 +0300
@@ -20,7 +20,7 @@
 PRJ_EXPORTS
 
 musicwidgetplugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(musicwidgetplugin.iby)
-//  musicwidgetplugin_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(musicwidgetplugin_resources.iby)
+musicwidgetplugin_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(musicwidgetplugin_resources.iby)
 
 // #ifdef MARM
 // START EXTENSION app-services/buildstubsis
--- a/musicwidgetplugin/rom/musicwidgetplugin.iby	Fri Sep 17 08:28:52 2010 +0300
+++ b/musicwidgetplugin/rom/musicwidgetplugin.iby	Mon Oct 04 00:14:19 2010 +0300
@@ -22,6 +22,5 @@
 data=ZPRIVATE\20022f35\import\widgetregistry\200286FA\musicwidgetplugin.qtplugin        private\20022f35\import\widgetregistry\200286FA\musicwidgetplugin.qtplugin
 data=ZPRIVATE\20022f35\import\widgetregistry\200286FA\musicwidgetplugin.manifest        private\20022f35\import\widgetregistry\200286FA\musicwidgetplugin.manifest
 data=ZPRIVATE\20022f35\import\widgetregistry\200286FA\musicwidgetplugin.xml             private\20022f35\import\widgetregistry\200286FA\musicwidgetplugin.xml
-data=ZPRIVATE\20022f35\import\widgetregistry\200286FA\musicwidgeticon.png               private\20022f35\import\widgetregistry\200286FA\musicwidgeticon.png
 
 #endif // MUSICWIDGETPLUGIN_IBY
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicwidgetplugin/rom/musicwidgetplugin_resources.iby	Mon Oct 04 00:14:19 2010 +0300
@@ -0,0 +1,25 @@
+/*
+* 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: 
+*
+*/
+
+#ifndef MUSICWIDGETPLUGIN_RESOURCES_IBY
+#define MUSICWIDGETPLUGIN_RESOURCES_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+data = DATAZ_\QT_TRANSLATIONS_DIR\musicwidgetplugin.qm    QT_TRANSLATIONS_DIR\musicwidgetplugin.qm 
+
+#endif	// MUSICWIDGETPLUGIN_RESOURCES_IBY
\ No newline at end of file
--- a/musicwidgetplugin/rom/rom.pri	Fri Sep 17 08:28:52 2010 +0300
+++ b/musicwidgetplugin/rom/rom.pri	Mon Oct 04 00:14:19 2010 +0300
@@ -24,17 +24,5 @@
 BLD_INF_RULES.prj_exports += "$$MP_IBY_DIR/musicwidgetplugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(musicwidgetplugin.iby)"
 
 #iby exports to language
-#BLD_INF_RULES.prj_exports += "$$MP_IBY_DIR/musicwidgetplugin_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(musicwidgetplugin_resources.iby)"
+BLD_INF_RULES.prj_exports += "$$MP_IBY_DIR/musicwidgetplugin_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(musicwidgetplugin_resources.iby)"
 }
-
-
-BLD_INF_RULES.prj_extensions += \
-
-#$$LITERAL_HASH"ifdef MARM" \
-#" START EXTENSION app-services/buildstubsis" \
-#" OPTION SRCDIR rom" \
-#" OPTION SISNAME musicwidgetplugin_stub" \
-#" END" \
-#$$LITERAL_HASH"endif"
-
-
--- a/musicwidgetplugin/src/musicwidget.cpp	Fri Sep 17 08:28:52 2010 +0300
+++ b/musicwidgetplugin/src/musicwidget.cpp	Mon Oct 04 00:14:19 2010 +0300
@@ -15,9 +15,8 @@
 *
 */
 
-#include "musicwidget.h"
-
-#include <QtGui>
+// System includes
+#include <qgraphicslinearlayout.h>
 #include <hbpushbutton.h>
 #include <hblabel.h>
 #include <hbicon.h>
@@ -26,174 +25,95 @@
 #include <hbwidget.h>
 #include <hbframeitem.h>
 #include <hbframedrawer.h>
-#include <hbcolorscheme.h>
+#include <hbtranslator.h>
 
+// User includes
+#include "musicwidget.h"
 #include "musicwidgetdocumentloader.h"
 #include "mptrace.h"
 #include "mpenginefactory.h"
 #include "mpalbumcoverwidget.h"
+#include "mpplaybackdata.h"
+#include "mpapplicationmonitor.h"
 
 // Constants
 /** Docml */
-const QString MUSIC_WIDGET_DOCML = ":/gfx/music_widget.docml";
-
-/** File name suffix lists for push buttons */
-const QStringList PREV_BUTTON_SUFFIXES = (QStringList() << "_l" << "_c" << "_cr");
-const QStringList PLAY_BUTTON_SUFFIXES = (QStringList() << "_cl" << "_c" << "_cr");
-const QStringList NEXT_BUTTON_SUFFIXES = (QStringList() << "_cl" << "_c" << "_r");
-
-/**  Prefixes for 3 piece button background graphics */
-const QLatin1String PUSH_BUTTON_NORMAL("qtg_fr_hsbutton_normal");
-const QLatin1String PUSH_BUTTON_PRESSED ("qtg_fr_hsbutton_pressed");
-const QLatin1String PUSH_BUTTON_DISABLED ("qtg_fr_hsbutton_disabled");
-
-/**  Push button icon colors for each of the states (Normal, Pressed and Disabled) */
-const QLatin1String ICON_COLOR_NORMAL ("qtc_button_normal");
-const QLatin1String ICON_COLOR_PRESSED ("qtc_button_pressed");
-const QLatin1String ICON_COLOR_DISABLED ("qtc_button_disabled");
+const QString MUSIC_WIDGET_DOCML = ":/docml/music_widget.docml";
 
 /**  Play and Pause icons */
-const QLatin1String ICON_PLAY ("qtg_mono_play");
-const QLatin1String ICON_PAUSE ("qtg_mono_pause");
-/**  Music Player shortcut icon */
-const QLatin1String ICON_LARGE_MUSIC_PLAYER ("qtg_large_music");
-/**  Music Player shortcut icon */
-const QLatin1String ICON_FIRST_TIME_USE ("qtg_large_music_empty");
-const QLatin1String ICON_DEFAULT_ART ("qtg_large_album_art");
+const QLatin1String ICON_PLAY ( "qtg_mono_play" );
+const QLatin1String ICON_PAUSE ( "qtg_mono_pause" );
+
+/** Album art icon */
+const QLatin1String ICON_DEFAULT_ART ( "qtg_large_music_empty" );
 
 /**  HsWidget normal background */
-const QLatin1String WIDGET_BG_NORMAL ("qtg_fr_hswidget_normal");
+const QLatin1String WIDGET_BG_NORMAL ( "qtg_fr_hswidget_normal" );
 /**  Text background */
-const QLatin1String TEXT_BG_NORMAL ("qtg_fr_multimedia_trans");
+const QLatin1String TEXT_BG_NORMAL ( "qtg_fr_multimedia_trans" );
 /**  Separator : character and space between artist and song name */
-const QLatin1String SEPARATOR_TEXT (": ");
-/**  Temporary unknown artist */
-const QLatin1String TEMPORARY_UNKWNOWN_TEXT ("Unknown");
-/**  Localized unknown artist */
-const QLatin1String UNKWNOWN_TEXT ("txt_mus_other_unknown_1");
+const QLatin1String SEPARATOR_TEXT ( ": " );
 
-/**  Marquee width */
-const int MARQUEE_WIDTH = 170;
 /**  Infinite loop value for marquee */
 const int MARQUEE_LOOP_FOREVER = -1;
 
 /**  Now playing view with random play */
-const QLatin1String SERVICEREQ_FIRST_TIME_USE ("appto://10207C62?activityname=MusicNowPlayingView&launchtype=standalone&shuffle=yes");
+const QLatin1String SERVICEREQ_NOW_PLAYING_VIEW_SHUFFLE ( "appto://10207C62?activityname=MusicNowPlayingView&launchtype=standalone&shuffle=yes" );
 /**  Main view */
-const QLatin1String SERVICEREQ_MAIN_VIEW ("appto://10207C62?activityname=MusicMainView&launchtype=standalone");
+const QLatin1String SERVICEREQ_MAIN_VIEW ( "appto://10207C62?activityname=MusicMainView&launchtype=standalone" );
 /**  Now playing view */
-const QLatin1String SERVICEREQ_NOW_PLAYING_VIEW ("appto://10207C62?activityname=MusicNowPlayingView&launchtype=standalone");
+const QLatin1String SERVICEREQ_NOW_PLAYING_VIEW ( "appto://10207C62?activityname=MusicNowPlayingView&launchtype=standalone" );
+
+/**  DOCML object names */
+const QLatin1String DOCML_CONTAINER_WIDGET ( "containerWidget" );
+const QLatin1String DOCML_BG_ICON ( "widget_background_icon" );
+const QLatin1String DOCML_ALBUM_ART ( "album_art_image" );
+const QLatin1String DOCML_TEXT_BG ( "text_bg" );
+const QLatin1String DOCML_SCROLLING_TEXT ( "scrolling_text" );
+const QLatin1String DOCML_BUTTON_GROUP_CONTAINER ( "button_group_container" );
+const QLatin1String DOCML_PREV_BUTTON ( "btn_previous" );
+const QLatin1String DOCML_PLAY_BUTTON ( "btn_play" );
+const QLatin1String DOCML_NEXT_BUTTON ( "btn_next" );
 
-/**  DOCML object name for main widget */
-const QLatin1String DOCML_CONTAINER_WIDGET ("containerWidget");
-/**  DOCML object name for widget background */
-const QLatin1String DOCML_BG_ICON ("widget_background_icon");
-/**  DOCML object name for album art image */
-const QLatin1String DOCML_ALBUM_ART ("album_art_image");
-/**  DOCML object name for shortcut icon background */
-const QLatin1String DOCML_SHORTCUT_ICON_BG ("shortcut_icon_background");
-/**  DOCML object name for shortcut icon */
-const QLatin1String DOCML_SHORTCUT_ICON ("shortcut_icon");
-/**  DOCML object name for scrolling text background */
-const QLatin1String DOCML_TEXT_BG ("text_bg");
-/**  DOCML object name for scrolling text */
-const QLatin1String DOCML_SCROLLING_TEXT ("scrolling_text");
-/**  DOCML object name for button group container */
-const QLatin1String DOCML_BUTTON_GROUP_CONTAINER ("button_group_container");
-/**  DOCML object name for prev button */
-const QLatin1String DOCML_PREV_BUTTON ("btn_previous");
-/**  DOCML object name for play button */
-const QLatin1String DOCML_PLAY_BUTTON ("btn_play");
-/**  DOCML object name for next button */
-const QLatin1String DOCML_NEXT_BUTTON ("btn_next");
+/*!
+    \class MusicWidget
+    \brief Provides simple Music Player playback controls from the Home Screen.
+ */
 
-
-MusicWidget::MusicWidget(QGraphicsItem* parent, Qt::WindowFlags flags):
-    HbWidget(parent, flags),
-    mShortcutArea(0),
-    mSongDataBG(0),
-    mInformationSongName(0),
-    mMarqueeText(0),    
-    mPreviousPushButton(0),
-    mPlayPushButton(0),    
-    mNextPushButton(0),
-    mMusicPlayerNoSongData(1),
-    mMusicPlayerUpdating(0),
-    mMusicPlayerBlocked(0),
-    mAlbumArt(0),
-    mArtist(0),
-    mTitle(0),    
-    mMpEngine(0),
-    mMpPlaybackData(0)
+/*!
+ Constructs the Music Player home screen widget.
+ */
+MusicWidget::MusicWidget( QGraphicsItem* parent, Qt::WindowFlags flags ):
+    HbWidget( parent, flags ),
+    mSongDataBackground( 0 ),
+    mMarqueeText( 0 ),    
+    mPreviousPushButton( 0 ),
+    mPlayPushButton( 0 ),    
+    mNextPushButton( 0 ),
+    mMusicPlayerUpdating( false ),
+    mMusicPlayerBlocked( false ),
+    mMusicPlayerRunning( false ),
+    mAlbumArt( 0 ),
+    mMpEngine( 0 ),
+    mMpPlaybackData( 0 ),
+    mMpApplicationMonitor( 0 )
 {
-    TX_ENTRY
-    
-    // Setup UI
-    setupUi();
-    
-    // Connect to MP engine and playback data
-    mMpEngine = MpEngineFactory::createSharedEngine(MpCommon::KMusicPlayerUid, MpEngine::HomeScreen );
-    Q_ASSERT_X(mMpEngine, "music_widget", "no music player engine");
-    TX_LOG_ARGS("got mp engine")
-    
-    mMpPlaybackData = mMpEngine->playbackData();
-    Q_ASSERT_X(mMpPlaybackData, "music_widget", "no playback data");
-    TX_LOG_ARGS("got playback data")
-        
-    // Connect outgoing signals and slots
-    QObject::connect(mShortcutArea, SIGNAL(clicked()), this, SLOT(shortcutButton()));    
-    
-    // use signal mapper to indicate button identifiers to button event slots 
-    QSignalMapper* signalMapperPressed = new QSignalMapper( this ); 
-    signalMapperPressed->setMapping( mPreviousPushButton, EPrevious );
-    signalMapperPressed->setMapping( mPlayPushButton, EPlayPause);
-    signalMapperPressed->setMapping( mNextPushButton, ENext);
-
-    // need to use different signal mapper for pressed and released events, 
-    // both have same mappings but they are mapped to different slots
-    QSignalMapper* signalMapperReleased = new QSignalMapper( this );
-    signalMapperReleased->setMapping( mPreviousPushButton, EPrevious );
-    signalMapperReleased->setMapping( mPlayPushButton, EPlayPause);
-    signalMapperReleased->setMapping( mNextPushButton, ENext);
-        
-    // Connect button events to signal maps
-    QObject::connect(mPreviousPushButton, SIGNAL(pressed()), signalMapperPressed, SLOT (map()));
-    QObject::connect(mPreviousPushButton, SIGNAL(released()), signalMapperReleased, SLOT (map()));
-
-    QObject::connect(mPlayPushButton, SIGNAL(pressed()), signalMapperPressed, SLOT (map()));
-    QObject::connect(mPlayPushButton, SIGNAL(released()), signalMapperReleased, SLOT (map()));
-
-    QObject::connect(mNextPushButton, SIGNAL(pressed()), signalMapperPressed, SLOT (map()));
-    QObject::connect(mNextPushButton, SIGNAL(released()), signalMapperReleased, SLOT (map()));
-
-    // Connect mapper signals to self implemented slots
-    QObject::connect( signalMapperPressed, SIGNAL(mapped(int)), this, SLOT(mediaButtonPressed(int)));
-    QObject::connect( signalMapperReleased, SIGNAL(mapped(int)), this, SLOT(mediaButtonReleased(int)));
-
-    // Connect clicked events
-    QObject::connect(mPreviousPushButton, SIGNAL(clicked()), this, SLOT(prevSong()));
-    QObject::connect(mPlayPushButton, SIGNAL(clicked()), this, SLOT(playSong()));   
-    QObject::connect(mNextPushButton, SIGNAL(clicked()), this, SLOT(nextSong()));
-
-    // MpEngine
-    QObject::connect(mMpEngine, SIGNAL(libraryUpdateStarted()), this, SLOT(libraryUpdateStarted()));
-    QObject::connect(mMpEngine, SIGNAL(libraryUpdated()), this, SLOT(libraryUpdated()));
-    QObject::connect(mMpEngine, SIGNAL(usbBlocked(bool)), this, SLOT(usbBlocked(bool)));
-
-    //MpPlaybackData
-    QObject::connect(mMpPlaybackData, SIGNAL(albumArtReady()), this, SLOT(albumArtReady()));
-    QObject::connect(mMpPlaybackData, SIGNAL(playbackStateChanged()), this, SLOT(playbackStateChanged()));
-    QObject::connect(mMpPlaybackData, SIGNAL(playbackInfoChanged()), this, SLOT(playbackInfoChanged()));  
-    
-    // Initial data from Music Player get by onShow method call
-    TX_EXIT
+    TX_LOG
+    HbTranslator translator( QString( "musicwidgetplugin" ) );
 }
 
 /*!
-    Destructor
-*/
+ Destructor
+ */
 MusicWidget::~MusicWidget()
 {
+    TX_ENTRY
+    if ( mMpEngine ) {
+        MpEngineFactory::close();
+    }
+
+    delete mMpApplicationMonitor;
+    TX_EXIT
 }
 
 /*!
@@ -206,235 +126,66 @@
     // Use document loader to load the contents
     MusicWidgetDocumentLoader loader;
     bool ok = false;
-    loader.load( MUSIC_WIDGET_DOCML, &ok);
-    Q_ASSERT_X(ok, "music_widget", "invalid title docml file");
+    loader.load( MUSIC_WIDGET_DOCML, &ok );
+    Q_ASSERT_X( ok, "music_widget", "invalid title docml file" );
 
-    TX_LOG_ARGS("loaded docml")
+    TX_LOG_ARGS( "loaded docml" )
     
-    QGraphicsLinearLayout* mainLayout = new QGraphicsLinearLayout(Qt::Vertical, this);
-    QGraphicsWidget* container = loader.findWidget(DOCML_CONTAINER_WIDGET);
-    mainLayout->addItem(container);
+    QGraphicsLinearLayout* mainLayout = new QGraphicsLinearLayout( Qt::Vertical, this );
+    QGraphicsWidget* container = loader.findWidget( DOCML_CONTAINER_WIDGET );
+    mainLayout->addItem( container );
+    
     //Sets parent
     setLayout( mainLayout );
 
     // Load and set widget background
-    HbWidget *bgWidget = qobject_cast<HbWidget*> (loader.findWidget(DOCML_BG_ICON));
-    HbFrameItem *frameItem;
-    if (bgWidget)
-        {
-        HbFrameDrawer *drawer = new HbFrameDrawer(WIDGET_BG_NORMAL,
-            HbFrameDrawer::NinePieces);
-        frameItem = new HbFrameItem(drawer, bgWidget);
-        frameItem->setPreferredSize(bgWidget->preferredSize());
-        bgWidget->setZValue(1);
-        }
+    HbLabel *bgWidget = qobject_cast<HbLabel*> ( loader.findWidget( DOCML_BG_ICON ) );
+    HbFrameItem *frameItemWidgetBg = new HbFrameItem();
+    frameItemWidgetBg->frameDrawer().setFrameGraphicsName( WIDGET_BG_NORMAL );
+    frameItemWidgetBg->frameDrawer().setFrameType( HbFrameDrawer::NinePieces );
+    frameItemWidgetBg->frameDrawer().setFillWholeRect( true );
+    bgWidget->setBackgroundItem( frameItemWidgetBg );
 
     // Setup album art area
     QGraphicsWidget *tmpWidgetPtr;
-    tmpWidgetPtr = loader.findWidget(DOCML_ALBUM_ART);
-    mAlbumArt = qobject_cast<MpAlbumCoverWidget*>(tmpWidgetPtr);
+    tmpWidgetPtr = loader.findWidget( DOCML_ALBUM_ART );
+    mAlbumArt = qobject_cast<MpAlbumCoverWidget*>( tmpWidgetPtr );
     mAlbumArt->setEnabled( false );
     mAlbumArt->setDefaultIcon( HbIcon( ICON_DEFAULT_ART ) );
         
-    // Load shortcut background
-    HbWidget *shortcutAreaLayout = qobject_cast<HbWidget*> (loader.findWidget(DOCML_SHORTCUT_ICON_BG));
-    HbFrameItem *shortcutFrameItem;
-    if (shortcutAreaLayout) {
-        HbFrameDrawer *drawer = new HbFrameDrawer(WIDGET_BG_NORMAL,
-            HbFrameDrawer::NinePieces);
-        shortcutFrameItem = new HbFrameItem(drawer, shortcutAreaLayout);
-        shortcutFrameItem->setPreferredSize(shortcutAreaLayout->preferredSize());
-        shortcutAreaLayout->setZValue(3);
-        }
-
-    // Load shortcut widget and set background 
-    mShortcutArea = qobject_cast<HbPushButton*> (loader.findWidget(DOCML_SHORTCUT_ICON));
-    if ( mShortcutArea )
-        {
-        // icon needs to be put as a background so that it fills the whole button area
-        HbFrameDrawer* drawer = new HbFrameDrawer(ICON_LARGE_MUSIC_PLAYER, HbFrameDrawer::OnePiece);
-        mShortcutArea->setFrameBackground( drawer );
-        }
-
     // Set song data background
-    mSongDataBG = qobject_cast<HbWidget*> (loader.findWidget(DOCML_TEXT_BG));
-    HbFrameItem *scrollTextItem;
-    if (mSongDataBG) 
-        {
-        HbFrameDrawer *drawer = new HbFrameDrawer(TEXT_BG_NORMAL, 
-            HbFrameDrawer::NinePieces);
-        scrollTextItem = new HbFrameItem(drawer, mSongDataBG);
-        scrollTextItem->setPreferredSize(mSongDataBG->preferredSize());
-        mSongDataBG->setZValue(4);
-        mSongDataBG->hide(); // Hide initially...
-        }
+    mSongDataBackground = qobject_cast<HbLabel*> ( loader.findWidget( DOCML_TEXT_BG ) );
+    HbFrameItem *frameItemSongBg = new HbFrameItem();
+    frameItemSongBg->frameDrawer().setFrameGraphicsName( TEXT_BG_NORMAL );
+    frameItemSongBg->frameDrawer().setFrameType( HbFrameDrawer::NinePieces );
+    frameItemSongBg->frameDrawer().setFillWholeRect( true );
+    mSongDataBackground->setBackgroundItem( frameItemSongBg );
+    mSongDataBackground->hide();
 
     // Set scrolling song data
-    mInformationSongName = qobject_cast<HbLabel*> (loader.findWidget(DOCML_SCROLLING_TEXT));
-    if ( mInformationSongName )
-        {
-        // Setting primitive marquee item values from .css doesn't work well, set in code...
-        mMarqueeText = new HbMarqueeItem(mInformationSongName);
-        HbFontSpec fs(HbFontSpec::Secondary);
-        mMarqueeText->setFontSpec(fs);        
-        mMarqueeText->setTextColor(mInformationSongName->textColor());
-        mMarqueeText->setMinimumWidth(MARQUEE_WIDTH);
-        mMarqueeText->setLoopCount(MARQUEE_LOOP_FOREVER);
-        }
-    
-    HbWidget *buttonGroupContainer = qobject_cast<HbWidget*> (loader.findWidget(
-            DOCML_BUTTON_GROUP_CONTAINER));
-    if (buttonGroupContainer)
-        {
-        // Define push buttons in  state at this point, check the player status later and update buttons if needed
-        mPreviousPushButton = qobject_cast<HbPushButton*> (loader.findWidget(DOCML_PREV_BUTTON));
-        defineMediaButton( *mPreviousPushButton, PUSH_BUTTON_NORMAL, PREV_BUTTON_SUFFIXES, ICON_COLOR_NORMAL );
-        
-        mPlayPushButton = qobject_cast<HbPushButton*> (loader.findWidget(DOCML_PLAY_BUTTON));
-        defineMediaButton( *mPlayPushButton, PUSH_BUTTON_NORMAL, PLAY_BUTTON_SUFFIXES, ICON_COLOR_NORMAL );
-    
-        mNextPushButton = qobject_cast<HbPushButton*> (loader.findWidget(DOCML_NEXT_BUTTON));
-        defineMediaButton( *mNextPushButton, PUSH_BUTTON_NORMAL, NEXT_BUTTON_SUFFIXES, ICON_COLOR_NORMAL );
-        }
-    
+    mMarqueeText = qobject_cast<HbMarqueeItem*> ( loader.findWidget( DOCML_SCROLLING_TEXT ) );
+    mMarqueeText->setLoopCount( MARQUEE_LOOP_FOREVER );
+
+    // Get buttons
+    HbWidget *buttonGroupContainer = qobject_cast<HbWidget*> ( loader.findWidget(
+            DOCML_BUTTON_GROUP_CONTAINER ) );
+    if ( buttonGroupContainer ) {
+        // Define push buttons
+        mPreviousPushButton = qobject_cast<HbPushButton*> ( loader.findWidget( DOCML_PREV_BUTTON ) );
+        mPlayPushButton = qobject_cast<HbPushButton*> ( loader.findWidget( DOCML_PLAY_BUTTON ) );
+        mNextPushButton = qobject_cast<HbPushButton*> ( loader.findWidget( DOCML_NEXT_BUTTON ) );
+    }
+
     TX_EXIT
 }
 
 /*!
-    Makes the push button based on information aGraphicsId and aSuffix
- */
-void MusicWidget::defineMediaButton( HbPushButton& aTarget, QString aGraphicsId, QStringList aSuffix, QString aIconColor )
-    {
-    TX_ENTRY
-    
-    TX_LOG_ARGS("graphics id: " << aGraphicsId)
-    TX_LOG_ARGS("icon color: " << aIconColor)
-    
-    HbFrameDrawer* drawer;
-
-    // First check if the drawer is already created for this push button
-    if ( !aTarget.frameBackground()){
-        // Nope, create one now
-        drawer = new HbFrameDrawer(aGraphicsId, HbFrameDrawer::ThreePiecesHorizontal);
-        aTarget.setFrameBackground( drawer );
-        TX_LOG_ARGS("created drawer for button bg")
-        }
-    else {
-        // Frame drawer already created, only need to update frame graphics
-        drawer = aTarget.frameBackground();
-        drawer->setFrameGraphicsName( aGraphicsId );
-        TX_LOG_ARGS("using existing drawer for button bg")
-        }
-
-    // Set file name suffix list, so that drawer can load correct 3-piece graphic files 
-    drawer->setFileNameSuffixList( aSuffix );
-
-    // Update also the icon color
-    QColor color = HbColorScheme::color(aIconColor);
-    aTarget.icon().setColor( color );
-
-    // Lastly, check if the buttton is disabled
-    if ( aIconColor == ICON_COLOR_DISABLED )
-        {
-        aTarget.setEnabled(false);
-        TX_LOG_ARGS("button disabled")
-        }
-    else
-        {
-        aTarget.setEnabled(true);
-        TX_LOG_ARGS("button enabled")
-        }
-    
-    TX_EXIT
-    }
-
-/*!
-
- */
-void MusicWidget::mediaButtonEvent( MediaKeyIdentifier aMediaKeyId, QString aGraphicsId, QString aIconColor )
-    {
-    TX_ENTRY
-    
-    HbPushButton* target = NULL;
-    QStringList suffix;
-    
-    switch ( aMediaKeyId )
-        {
-        case EPrevious: {
-            TX_LOG_ARGS("previous")
-            target = mPreviousPushButton;
-            suffix = PREV_BUTTON_SUFFIXES;
-            break;
-            }
-        case EPlayPause: {
-            TX_LOG_ARGS("play/pause")
-            target = mPlayPushButton;
-            suffix = PLAY_BUTTON_SUFFIXES;
-            break;
-            }
-        case ENext: {
-            TX_LOG_ARGS("next")
-            target = mNextPushButton;
-            suffix = NEXT_BUTTON_SUFFIXES;
-            break;
-            }
-        default: {
-            // Do proper error handling.. should not be possible to get here ever tough
-            TX_LOG_ARGS("unknown button")
-            return;
-            }
-        }
-        
-    if ( target )
-    	{
-    	MusicWidget::defineMediaButton( *target, aGraphicsId, suffix, aIconColor );
-    	}
-    
-    TX_EXIT
-    }
-
-/*!
-   Emited from HbPushButton:pressed() signal, changes the button layout to 'Pressed'
- */
-void MusicWidget::mediaButtonPressed( int aMediaKeyId )
-    {
-    TX_LOG_ARGS("media key: " << aMediaKeyId )
-    mediaButtonEvent( (MediaKeyIdentifier)aMediaKeyId, PUSH_BUTTON_PRESSED, ICON_COLOR_PRESSED );
-    }
-
-/*!
-   Emited from HbPushButton:released() signal, changes the button layout to 'Normal'
- */
-void MusicWidget::mediaButtonReleased( int aMediaKeyId )
-    {
-    TX_LOG_ARGS("media key: " << aMediaKeyId )
-    mediaButtonEvent( (MediaKeyIdentifier)aMediaKeyId, PUSH_BUTTON_NORMAL, ICON_COLOR_NORMAL );
-    }
-
-/*!
-   Disables specified push button
- */
-void MusicWidget::mediaButtonDisabled( int aMediaKeyId )
-    {
-    TX_LOG_ARGS("media key: " << aMediaKeyId )
-    mediaButtonEvent( (MediaKeyIdentifier)aMediaKeyId, PUSH_BUTTON_DISABLED, ICON_COLOR_DISABLED );
-    }
-
-/*!
-   Disables specified push button
- */
-void MusicWidget::mediaButtonEnabled( int aMediaKeyId )
-    {
-    TX_LOG_ARGS("media key: " << aMediaKeyId )
-    mediaButtonEvent( (MediaKeyIdentifier)aMediaKeyId, PUSH_BUTTON_NORMAL, ICON_COLOR_NORMAL );
-    }
-
-/*!
  Manually update music widget state.
  */
 void MusicWidget::refreshData()
 { 
     TX_ENTRY
+    
     // Get current player state
     playbackStateChanged();
     
@@ -443,89 +194,64 @@
 
     // Get current album art
     albumArtReady();
+    
     TX_EXIT
 }
 
 /*!
- Launch music player...
+ Launch music player.
  */
-void MusicWidget::launchMusicPlayer(int launchMode)
+void MusicWidget::launchMusicPlayer( int launchMode )
 {  
     TX_ENTRY
-    //TODO: Detect if MusicPlayer is running or not properly, handle case where player not available?!
-    //TODO: Get service status from XQSettingManager
-    //TODO: Service status from signal:
-    //TODO: void statusChanged(const XQAiwInterfaceDescriptor& implementation,  ServiceStatus currentStatus);
-     
+    
     QUrl url;
-    XQAiwRequest* req;
-    
-    if ( launchMode == ELaunchFromPlay )
-        {
-        TX_LOG_ARGS("launch from play")
-        // Launch to now playing view, random play to be started!
-        url.setUrl(SERVICEREQ_FIRST_TIME_USE);        
-        }
-    else if (mMusicPlayerNoSongData)
-        {
-        TX_LOG_ARGS("to main view")
-        // Launch to main view
-        url.setUrl(SERVICEREQ_MAIN_VIEW);    
-        }
-    else
-        {
-        TX_LOG_ARGS("to now playing view")
-        // Launch to now playing view
-        url.setUrl(SERVICEREQ_NOW_PLAYING_VIEW);
-        }   
-    
-    req = mApplicationManager.create(url);    
-    if (req == NULL)
-        {
-        // No handlers for the URI
-        TX_LOG_ARGS("no req created")
-        return;
-        }
     
-    req->setBackground(false);
-    req->setSynchronous(false);
+    switch ( launchMode ) {
+        case ELaunchToMainView:
+            TX_LOG_ARGS( "to main view" )
+            // Launch to main view
+            url.setUrl( SERVICEREQ_MAIN_VIEW );    
+            break;
+        case ELaunchToNowPlayingView:
+            TX_LOG_ARGS( "to now playing view" )
+            // Launch to now playing view
+            url.setUrl( SERVICEREQ_NOW_PLAYING_VIEW );
+            break;
+        case ELaunchToNowPlayingViewWithShuffle:
+            TX_LOG_ARGS( "to now playing view with shuffle" )
+            // Launch to now playing view with shuffle
+            url.setUrl( SERVICEREQ_NOW_PLAYING_VIEW_SHUFFLE );        
+            break;
+        default:
+            //should never get here
+            TX_LOG_ARGS( "Error: invalid launchMode." )
+            return;
+    }
     
-    // Set function parameters
-   QList<QVariant> args;
-   args << url.toString();
-   req->setArguments(args);
+    XQAiwRequest* req;
+    req = mApplicationManager.create( url );    
+    if ( req ) {
+        req->setBackground( false );
+        req->setSynchronous( false );
+    
+        // Set function parameters
+        QList<QVariant> args;
+        args << url.toString();
+        req->setArguments( args );
 
-   // Send the request
-   bool res = req->send();
-   if  (!res) 
-   {
-       // Request failed. 
-      int error = req->lastError();
-      // Handle error
-      TX_LOG_ARGS("req send error: " << error)
-   }
-
-   delete req;
+        // Send the request
+        bool res = req->send();
+        if ( !res ) {
+            // Request failed. 
+            int error = req->lastError();
+            // Handle error
+            TX_LOG_ARGS( "req send error: " << error )
+        }
+        delete req;
+    }
    
-   TX_EXIT
-}
-
-/*!
-    Return bounding rect
-*/
-QRectF MusicWidget::boundingRect() const
-{
-    return childrenBoundingRect();
-}
-
-/*!
-    Return shape
-*/
-QPainterPath MusicWidget::shape() const
-{   
-    QPainterPath path;
-    path.addRect(boundingRect());
-    return path;
+    TX_EXIT
 }
 
 /*!
@@ -533,7 +259,33 @@
  */
 void MusicWidget::onInitialize()
 {
-    TX_LOG
+    TX_ENTRY
+
+    // Setup UI
+    setupUi();
+    
+    // Start Monitoring Music Player running status.
+    mMpApplicationMonitor = new MpApplicationMonitor();
+    
+    // Check if Music Player UI is up and running
+    mMusicPlayerRunning = mMpApplicationMonitor->isApplicationRunning();
+    
+    // Connect to MP engine and playback data
+    connectMusicPlayerEngine( mMusicPlayerRunning );
+
+    // Connect albumart click signal
+    QObject::connect( mAlbumArt, SIGNAL( clicked() ), this, SLOT( handleAlbumArtClicked() ) );    
+    
+    // Connect button clicked signals
+    QObject::connect( mPreviousPushButton, SIGNAL( clicked() ), this, SLOT( handlePrevButtonClicked() ) );
+    QObject::connect( mPlayPushButton, SIGNAL( clicked() ), this, SLOT( handlePlayButtonClicked() ) );   
+    QObject::connect( mNextPushButton, SIGNAL( clicked() ), this, SLOT( handleNextButtonClicked() ) );
+
+    // Connect Music Player observer signal
+    QObject::connect( mMpApplicationMonitor, SIGNAL( applicationStatusChanged( bool ) ), 
+                     this, SLOT ( applicationStatusChanged( bool ) ) );   
+    
+    TX_EXIT
 }
 
 /*!
@@ -541,8 +293,9 @@
  */
 void MusicWidget::onShow()
 {
-    TX_LOG
+    TX_ENTRY
     refreshData();
+    TX_EXIT
 }
 
 /*!
@@ -551,6 +304,9 @@
 void MusicWidget::onHide()
 {
     TX_LOG
+    if ( mMarqueeText->isAnimating() ) {
+        mMarqueeText->stopAnimation();
+    }
 }
 
 /*!
@@ -562,268 +318,340 @@
 }
 
 /*!
- Slot for shortcut button clicked.
+ Slot to handle when the album art area is clicked.
  */
-void MusicWidget::shortcutButton()
+void MusicWidget::handleAlbumArtClicked()
 {
-    TX_LOG
-    launchMusicPlayer(ELaunchFromShortcut);
+    TX_ENTRY
+    if ( getPlaybackState() == MpPlaybackData::NotPlaying ) {
+        launchMusicPlayer( ELaunchToMainView );
+    }
+    else {
+        launchMusicPlayer( ELaunchToNowPlayingView );
+    }
+    TX_EXIT
 }
 
 /*!
  Slot for previous button clicked.
  */
-void MusicWidget::prevSong()
+void MusicWidget::handlePrevButtonClicked()
 { 
-    TX_LOG
-    mMpEngine->skipBackward();
+    TX_ENTRY
+    if ( mMpEngine ) {
+        mMpEngine->skipBackward();
+    }
+    TX_EXIT
 }
 
 /*!
  Slot for play button clicked. Handles both Play and Pause!
  */
-void MusicWidget::playSong()
+void MusicWidget::handlePlayButtonClicked()
 {
     TX_ENTRY
-    if (mMusicPlayerNoSongData && mMpPlaybackData->playbackState() != MpPlaybackData::Playing )
-        {
+    // If nothing to play, start music player in playback view.
+    if ( getPlaybackState() == MpPlaybackData::NotPlaying ) {
         //Signal music player to start playing all songs with random
-        launchMusicPlayer(ELaunchFromPlay);
+        launchMusicPlayer( ELaunchToNowPlayingViewWithShuffle );
+    }
+    else {
+        // send play/pause command.
+        if ( mMpEngine ) {
+            mMpEngine->playPause();
         }
-
-    mMpEngine->playPause();
+    }
     TX_EXIT
 }
+
 /*!
  Slot for next button clicked.
  */
-void MusicWidget::nextSong()
+void MusicWidget::handleNextButtonClicked()
 {
-    TX_LOG
-    mMpEngine->skipForward();
+    TX_ENTRY
+    if ( mMpEngine ) {
+        mMpEngine->skipForward();
+    }
+    TX_EXIT
 }
 
 /*!
-
+ Slot to handle when the music player running status changed.
  */
-bool MusicWidget::eventFilter(QObject *target, QEvent *event)
- {
-    // pass the event on to the parent class
-    return HbWidget::eventFilter(target, event);    
+void MusicWidget::applicationStatusChanged( bool isRunning )
+{
+    TX_ENTRY_ARGS( "running " << isRunning );
+
+    // Connect/disconnect engine base on music player running state.
+    if ( mMusicPlayerRunning != isRunning ) {
+        TX_LOG_ARGS("running state changed");
+        mMusicPlayerRunning = isRunning;
+        connectMusicPlayerEngine( isRunning );
+        // refresh data if musicplayer is on, otherwise clear data
+        if ( isRunning ) {
+            refreshData();
+        }
+        else {
+            clearData();
+        }
+    }
+    
+    TX_EXIT
 }
 
 /*!
- MpEngine related
+ Library started refreshing.
  */
 void MusicWidget::libraryUpdateStarted()
 {
-    TX_LOG
+    TX_ENTRY
     //Refresh Library start
     mMusicPlayerUpdating = true;
     
     // Update button enabled/disabled state
-    toggleButtons();
+    updateButtons();
+    TX_EXIT
 }
 
 /*!
- MpEngine related
+ Library is finished refreshing.
  */
 void MusicWidget::libraryUpdated()
 {
-    TX_LOG
+    TX_ENTRY
     //Refresh Library done
     mMusicPlayerUpdating = false;
     
     // Update button enabled/disabled state
-    toggleButtons();
+    updateButtons();
+    TX_EXIT
 }
 
 /*!
- MpEngine related
+ USB blocking state has changed.
  */
 void MusicWidget::usbBlocked( bool blocked )
 {
-    TX_LOG_ARGS("blocked: " << blocked)
-    //Blocked state
-    //Mass storage mode
-    //Media transfer mode
-    //Ovi Suite mode
-    //Insert memory card
-    
+    TX_ENTRY_ARGS( "blocked: " << blocked )
     mMusicPlayerBlocked = blocked;
     
     // Update button enabled/disabled state
-    toggleButtons();
+    updateButtons();
+    TX_EXIT
 }
 
 /*!
- MpPlaybackData related
+ The album art has changed.
  */
 void MusicWidget::albumArtReady()
 {   
     TX_ENTRY
     HbIcon icon;
     
-    if ( mMpPlaybackData->playbackState() == MpPlaybackData::NotPlaying )
-        {
-        TX_LOG_ARGS("1st time album art")
-        icon = HbIcon(ICON_FIRST_TIME_USE);    
+    if ( getPlaybackState() == MpPlaybackData::NotPlaying ) {
+        TX_LOG_ARGS( "default album art" )
+        icon = HbIcon( ICON_DEFAULT_ART );    
+    }
+    else {
+        TX_LOG_ARGS( "playback data album art" )
+        if ( mMpPlaybackData ) {
+            mMpPlaybackData->albumArt( icon );
         }
-    else
-        {
-        TX_LOG_ARGS("playback data album art")
-        mMpPlaybackData->albumArt( icon );
-        }
+    }
     
     mAlbumArt->setIcon( icon );
     mAlbumArt->setEnabled( true );
+    TX_EXIT
+}
+
+/*!
+ Playback state has changed.
+ */
+void MusicWidget::playbackStateChanged()
+{
+    TX_ENTRY
+    
+    if ( getPlaybackState() == MpPlaybackData::Playing ) {
+        TX_LOG_ARGS( "pause icon" )
+        mPlayPushButton->setIcon( HbIcon( ICON_PAUSE ) );
+    }
+    else {
+        TX_LOG_ARGS( "play icon" )
+        mPlayPushButton->setIcon( HbIcon( ICON_PLAY ) );
+    }
+
+    // Update button enabled/disabled state
+    updateButtons();
     
     TX_EXIT
 }
 
-void MusicWidget::playbackStateChanged()
-{
+/*!
+ Song data has changed.
+ */
+void MusicWidget::playbackInfoChanged()
+{ 
     TX_ENTRY
-    // Set play/pause icon and start/stop marquee.   
-    QString iconName;
+    
+    QString songData;
+    QString artist;
+    QString title;
     
-    int state = mMpPlaybackData->playbackState();
-    
-    TX_LOG_ARGS("state: " << state)
+    if ( mMpPlaybackData ) {
+        artist = mMpPlaybackData->artist();
+        title = mMpPlaybackData->title();
+    }
     
-    switch (state)
-        {
-        case MpPlaybackData::Playing:
-            {
-            TX_LOG_ARGS("pause icon, start marquee")
-            iconName.append(ICON_PAUSE);
+    if ( !title.length() ) {
+        artist.clear();
+        title.clear();
+        // Initialize marquee with something (space), to ensure text updates to display as well.
+        songData = " ";
+        TX_LOG_ARGS( "no song data" )
+    }
+    else {
+        if ( !artist.length() ) {
+            //Show localized "Unknown" if there is no artist name
+            songData.append( hbTrId( "txt_muwidget_other_unknown_1" ).arg( title ) );
+        }
+        else {
+            songData.append( artist );
+            songData.append( SEPARATOR_TEXT );
+            songData.append( title );
+        }
+        TX_LOG_ARGS( "song data received" )
+    }    
+    
+    mMarqueeText->setText( songData );
+    TX_LOG_ARGS( "marquee text: " << songData )
+
+    // Display song data if it exist.
+    if ( title.length() ) {
+        if ( !mSongDataBackground->isVisible() ) {
+            mSongDataBackground->show();
+        }
+        if ( !mMarqueeText->isAnimating() ) {
             mMarqueeText->startAnimation();
-            break;
-            }
-        case MpPlaybackData::Paused:
-        case MpPlaybackData::Stopped:
-        case MpPlaybackData::NotPlaying:       
-            {
-            TX_LOG_ARGS("play icon, stop marquee")
-            iconName.append(ICON_PLAY);
+        }
+    }
+    else {
+        if ( mSongDataBackground->isVisible() ) {
+            mSongDataBackground->hide();
+        }
+        if ( mMarqueeText->isAnimating() ) {
             mMarqueeText->stopAnimation();
-            break;
-            }
         }
-
-    HbIcon iconPlayPause(iconName);
-    mPlayPushButton->setIcon(iconPlayPause);
+    }
     
     TX_EXIT
 }
 
 /*!
- MpPlaybackData related
+ Update buttons to disabled/enabled as required.
  */
-void MusicWidget::playbackInfoChanged()
+void MusicWidget::updateButtons()
 { 
     TX_ENTRY
-    // Initialize maqruee with something (space), to ensure
-    // text updates to display as well.
-    QString songData;
     
-    mArtist = mMpPlaybackData->artist();
-    mTitle = mMpPlaybackData->title();
-    
-    if ( !mTitle.length() )
-        {
-        mArtist.clear();
-        mTitle.clear();
-        songData = " ";
-
-        //1st time launch
-        mMusicPlayerNoSongData = true;
-        
-        TX_LOG_ARGS("no song data")
-        }
-    else
-        {
-        if ( !mArtist.length() )
-            {
-            //Show localized "Unknown" if there is no artist name
-            
-            //TODO: Widget needs own localization?!?!
-            //mArtist.append( hbTrId(UNKWNOWN_TEXT) );
-
-            //TODO: Remove temporary unknown string when localization resolved.
-            mArtist.append( TEMPORARY_UNKWNOWN_TEXT );
-            }
-        
-        songData.append(mArtist);
-        songData.append(SEPARATOR_TEXT);
-        songData.append(mTitle);
-        
-        mMusicPlayerNoSongData = false;
-        
-        TX_LOG_ARGS("song data received")
-        }    
-    
-    mMarqueeText->setText(songData);
-    TX_LOG_ARGS("marquee text: " << songData)
-
-    // Show dark BG to songdata only if there is songdata...
-    if ( mMusicPlayerNoSongData && mSongDataBG->isVisible() )
-        {
-        TX_LOG_ARGS("hide marquee bg")
-        mSongDataBG->hide();
-        }
-    else if ( !mMusicPlayerNoSongData && !mSongDataBG->isVisible() )
-        {
-        TX_LOG_ARGS("show marquee bg")
-        mSongDataBG->show();  
-        }
-    
-    // Update button enabled/disabled state
-    toggleButtons();
+    // All buttons disabled if updating or usb blocked
+    if ( mMusicPlayerUpdating || mMusicPlayerBlocked ) {
+        TX_LOG_ARGS( "refreshing" )
+        mPreviousPushButton->setEnabled( false );
+        mPlayPushButton->setEnabled( false );
+        mNextPushButton->setEnabled( false );
+    }
+    // Only play button enabled if there is no song data
+    else if ( getPlaybackState() == MpPlaybackData::NotPlaying ) {
+        TX_LOG_ARGS( "no song data" )
+        mPreviousPushButton->setEnabled( false );
+        mPlayPushButton->setEnabled( true );
+        mNextPushButton->setEnabled( false );
+    }
+    // Enable all buttons if there is song data
+    else {
+        TX_LOG_ARGS( "enable all buttons" )
+        mPreviousPushButton->setEnabled( true );
+        mPlayPushButton->setEnabled( true );
+        mNextPushButton->setEnabled( true );
+    }
     
     TX_EXIT
 }
 
 /*!
- Toggle buttons to disabled/enabled as required.
+ Connect/disconnect Music Player engine and playback data
  */
-void MusicWidget::toggleButtons()
-{ 
+void MusicWidget::connectMusicPlayerEngine( bool connect )
+{
     TX_ENTRY
-    // All buttons disabled if updating
-    if ( mMusicPlayerUpdating )
-        {
-        TX_LOG_ARGS("updating")
-        mediaButtonDisabled( EPlayPause );
-        mediaButtonDisabled( EPrevious );
-        mediaButtonDisabled( ENext );
-        }
+
+    if ( mMpEngine ) {
+        MpEngineFactory::close();
+        mMpEngine = 0;
+        mMpPlaybackData = 0;
+        mMusicPlayerUpdating = false;
+        mMusicPlayerBlocked = false;
+    }
     
-    // All buttons disabled if blocked
-    else if ( mMusicPlayerBlocked )
-        {
-        TX_LOG_ARGS("blocked")
-        mediaButtonDisabled( EPlayPause );
-        mediaButtonDisabled( EPrevious );
-        mediaButtonDisabled( ENext );
-        }    
+    if ( connect ) {
+        // Connect to MP engine and playback data
+        mMpEngine = MpEngineFactory::createSharedEngine( MpCommon::KMusicPlayerUid, MpEngine::HomeScreen );
+        Q_ASSERT_X( mMpEngine, "music_widget", "no music player engine" );
+        TX_LOG_ARGS( "got mp engine" )
+    
+        mMpPlaybackData = mMpEngine->playbackData();
+        Q_ASSERT_X( mMpPlaybackData, "music_widget", "no playback data" );
+        TX_LOG_ARGS( "got playback data" )
     
-    // Only play button enabled if there is no song data, 1st time use
-    else if ( mMusicPlayerNoSongData )
-        {
-        TX_LOG_ARGS("no song data")
-        mediaButtonEnabled( EPlayPause );
-        mediaButtonDisabled( EPrevious );
-        mediaButtonDisabled( ENext );
-        }
+        // MpEngine
+        QObject::connect( mMpEngine, SIGNAL( libraryUpdateStarted() ), this, SLOT( libraryUpdateStarted() ) );
+        QObject::connect( mMpEngine, SIGNAL( libraryUpdated() ), this, SLOT( libraryUpdated() ) );
+        QObject::connect( mMpEngine, SIGNAL( usbBlocked( bool ) ), this, SLOT( usbBlocked( bool ) ) );
+
+        //MpPlaybackData
+        QObject::connect( mMpPlaybackData, SIGNAL( albumArtReady() ), this, SLOT( albumArtReady() ) );
+        QObject::connect( mMpPlaybackData, SIGNAL( playbackStateChanged() ), this, SLOT( playbackStateChanged() ) );
+        QObject::connect( mMpPlaybackData, SIGNAL( playbackInfoChanged() ), this, SLOT( playbackInfoChanged() ) );
+    }
     
-    // Enable all buttons if there is song data
-    else
-        {
-        TX_LOG_ARGS("enable all buttons")
-        mediaButtonEnabled( EPlayPause );      
-        mediaButtonEnabled( EPrevious );
-        mediaButtonEnabled( ENext );      
-        }
     TX_EXIT
 }
+
+/*!
+ Get the playback state
+ */
+int MusicWidget::getPlaybackState()
+{
+    TX_ENTRY
+    int state;
+    if ( mMpPlaybackData ) {
+        state = mMpPlaybackData->playbackState();
+    }
+    else {
+        state = MpPlaybackData::NotPlaying;
+    }
+    TX_EXIT_ARGS( "playback state = " << state );
+    return state;
+}
+
+/*!
+ Clear the song data
+ */
+void MusicWidget::clearData()
+{
+    TX_ENTRY
+    // set play button to PLAY icon.
+    mPlayPushButton->setIcon( HbIcon( ICON_PLAY ) );
+    updateButtons();
+    
+    // remove song data.
+    mMarqueeText->setText( QString( " " ) );
+    mMarqueeText->stopAnimation();
+    mSongDataBackground->hide();
+    
+    // set default album art
+    mAlbumArt->setIcon( HbIcon( ICON_DEFAULT_ART ) );
+    mAlbumArt->setEnabled( true );
+    TX_EXIT
+}
--- a/musicwidgetplugin/src/musicwidgetdocumentloader.cpp	Fri Sep 17 08:28:52 2010 +0300
+++ b/musicwidgetplugin/src/musicwidgetdocumentloader.cpp	Mon Oct 04 00:14:19 2010 +0300
@@ -17,6 +17,7 @@
 
 
 #include <hbtoolbutton.h>
+#include <hbmarqueeitem.h>
 
 #include "musicwidgetdocumentloader.h"
 #include "mpalbumcoverwidget.h"
@@ -47,6 +48,14 @@
         return object;
     }
 
+    if (type == HbMarqueeItem::staticMetaObject.className())
+    {
+        QObject *object = new HbMarqueeItem;
+        object->setObjectName(name);
+        TX_EXIT
+        return object;
+    }
+
     TX_EXIT
     return HbDocumentLoader::createObject(type, name);
 }
--- a/package_definition.xml	Fri Sep 17 08:28:52 2010 +0300
+++ b/package_definition.xml	Mon Oct 04 00:14:19 2010 +0300
@@ -20,7 +20,7 @@
    <component id="mpengine_build" filter="s60" name="Music Player Engine Build" introduced="^4">
     <unit bldFile="mpengine" qt:proFile="mpengine.pro" qt:qmakeArgs="-r -config rom"/>
    </component>
-   <component id="mpengine_test" name="Music Player Engine Test" filter="s60,qt_unit_test,pref_test,TA_MUSICPLAYER">
+   <component id="mpengine_test" name="Music Player Engine Test" filter="s60,test,qt_unit_test,pref_test,TA_MUSICPLAYER">
      <unit bldFile="mpengine/tsrc" qt:proFile="tsrc.pro"/>
    </component>
   </collection>
@@ -40,7 +40,7 @@
    <component id="mpapplicationmonitor" filter="s60" name="MP Application Monitor" introduced="^4">
     <unit bldFile="utilities/mpapplicationmonitor" qt:proFile="mpapplicationmonitor.pro" qt:qmakeArgs="-r -config rom"/>
    </component>      
-   <component id="musicplayer_utilities_test" name="Music Player Utilities Test" filter="s60,qt_unit_test,pref_test,TA_MUSICPLAYER">
+   <component id="musicplayer_utilities_test" name="Music Player Utilities Test" filter="s60,test,qt_unit_test,pref_test,TA_MUSICPLAYER">
      <unit bldFile="utilities/tsrc" qt:proFile="tsrc.pro"/>
    </component>
    <component id="musicplayer_utilities_rom" name="Music Player Utilities ROM" filter="s60" class="config">
@@ -54,7 +54,7 @@
    <component id="musicservices_build" filter="s60" name="Music Services Build" introduced="^4">
     <unit bldFile="musicservices" qt:proFile="musicservices.pro" qt:qmakeArgs="-r -config rom"/>
    </component>
-   <component id="musicservices_test" name="Music Services Test" filter="s60,qt_unit_test,pref_test,TA_MUSICPLAYER">
+   <component id="musicservices_test" name="Music Services Test" filter="s60,test,qt_unit_test,pref_test,TA_MUSICPLAYER">
      <unit bldFile="musicservices/tsrc" qt:proFile="tsrc.pro"/>
    </component>
   </collection>
@@ -65,7 +65,7 @@
    <component id="musicplayer_app_build" filter="s60" name="Music Player Application Build" introduced="^4">
     <unit bldFile="app" qt:proFile="app.pro" qt:qmakeArgs="-r -config rom"/>
    </component>
-   <component id="musicplayer_app_test" name="Music Player Application Test" filter="s60,qt_unit_test,pref_test,TA_MUSICPLAYER">
+   <component id="musicplayer_app_test" name="Music Player Application Test" filter="s60,test,qt_unit_test,pref_test,TA_MUSICPLAYER">
      <unit bldFile="app/tsrc" qt:proFile="tsrc.pro"/>
    </component>
   </collection>
@@ -88,7 +88,7 @@
    <component id="mpviewplugins_rom" name="Music Player View Plugins ROM" filter="s60" class="config">
      <unit bldFile="mpviewplugins/rom"/>
    </component>
-   <component id="mpviewplugins_test" name="Music Player View Plugins Test" filter="s60,qt_unit_test,pref_test,TA_MUSICPLAYER">
+   <component id="mpviewplugins_test" name="Music Player View Plugins Test" filter="s60,test,qt_unit_test,pref_test,TA_MUSICPLAYER">
      <unit bldFile="mpviewplugins/tsrc" qt:proFile="tsrc.pro"/>
    </component>
   </collection>
@@ -99,7 +99,7 @@
    <component id="musicwidgetplugin_build" filter="s60" name="Music Widget Plugin" introduced="^4" class="plugin">
     <unit bldFile="musicwidgetplugin" qt:proFile="musicwidgetplugin.pro" qt:qmakeArgs="-r -config rom"/>
    </component>
-   <component id="musicwidgetplugin_test" name="Music Widget Plugin Test" filter="s60,qt_unit_test,pref_test,TA_MUSICPLAYER">
+   <component id="musicwidgetplugin_test" name="Music Widget Plugin Test" filter="s60,test,qt_unit_test,pref_test,TA_MUSICPLAYER">
      <unit bldFile="musicwidgetplugin/tsrc" qt:proFile="tsrc.pro"/>
    </component>
   </collection>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsrc/qvptestresultgen.pl	Mon Oct 04 00:14:19 2010 +0300
@@ -0,0 +1,1172 @@
+#
+# 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:
+# 
+
+#------------------------------------------------------------------------------------
+# Includes
+#------------------------------------------------------------------------------------
+use strict;
+use warnings;
+use Cwd; # for cwd
+use FindBin; # for FindBin:Bin
+use File::Path; # for mkpath
+use Date::Calc;
+
+{ # No globals.
+    my $cgidir = GetCgiDir();
+    #require( $cgidir . "utils.pl" );
+}
+
+#------------------------------------------------------------------------------------
+# Globals
+#------------------------------------------------------------------------------------
+my $lineFeed = "\n";
+
+my $RESULT_TESTCLASS =          0;      # string
+my $RESULT_TESTCASE =           1;      # string
+my $RESULT_PASSEDCOUNT =        2;      # num
+my $RESULT_FAILEDCOUNT =        3;      # num
+my $RESULT_SKIPPEDCOUNT =       4;      # num
+my $RESULT_TOTALCOUNT =         5;      # num
+my $RESULT_WARNINGMSGS =        6;      # array of strings
+my $RESULT_DEBUGMSGS =          7;      # array of strings
+my $RESULT_DEPRECATIONMSGS =    8;      # array of strings
+my $RESULT_ALLCASES =           9;     # array of arrays ( result(fail=0, pass=1), string method name, array of info strings )
+    my $CASE_RESULT = 0;
+    my $CASE_NAME = 1;
+    my $CASE_INFO = 2;
+my $RESULT_SKIPPEDCASES =       10;     # array of strings
+
+my $optionTextReport = 0;
+
+#------------------------------------------------------------------------------------
+# Main code
+#------------------------------------------------------------------------------------
+
+ReadArgs();
+
+Main();
+
+exit();
+
+#------------------------------------------------------------------------------------
+# Subs
+#------------------------------------------------------------------------------------
+
+sub ReadArgs
+{
+    while( scalar(@ARGV) > 0 )
+    {
+    	my $argument = shift(@ARGV);
+    	
+    	if( $argument eq "-h" )
+    	{
+    		ShowHelp();
+    	}
+    	elsif( $argument eq "-txt" )
+    	{
+            $optionTextReport = 1;
+    	}
+    	elsif( $argument ne "" )
+    	{
+    		print "Uknown argument: $argument\n";
+    		ShowHelp();
+    	}
+    };
+}
+
+sub ShowHelp 
+{
+
+print <<USAGE_EOF;
+qvptestresultgen.pl <options: -h -txt>
+  
+Options
+  -h                    Shows help.
+  -txt                  Creates test report in text format instead of xml (Excel).
+
+Copy the Qt test result files from device c:\\data to same folder with 
+the script and run it. Creates report from the results.
+
+Script can be run from videoplayer/internal/qt folder.
+
+USAGE_EOF
+
+	exit();
+
+}
+
+sub Main
+{
+    my @files;
+    FindFiles(".", "txt", 1, \@files);
+
+    my @allResults;
+
+    foreach my $file ( @files )
+    {
+        my @results;
+
+        if( ReadTestRunResults( $file, \@results ) )
+        {
+            push @allResults, [ @results ];
+        }
+    }
+    
+    my @totals;
+    GetTotals( \@totals, \@allResults );
+    
+    if( $optionTextReport )
+    {
+        CreateTextReport( \@totals, \@allResults );
+    }
+    else
+    {
+        CreateXmlReport( \@totals, \@allResults );
+    }
+}
+
+sub ReadTestRunResults
+{
+    my ( $file, $refResults ) = @_;
+    
+    open( FILE_HANDLE, $file ) or die("ERROR! Could not open file '" . $file . "'\n");
+	my @lines = <FILE_HANDLE>;
+	close(FILE_HANDLE);
+	
+    my $isQtResultFile = 0;
+    for( my $i = 0; $i < 10; $i++ )
+    {
+        if( $i < scalar( @lines ) && $lines[$i] =~ m/Using QTest library/i )
+        {
+            $isQtResultFile = 1;
+            last;
+        }
+    }
+    return 0 if( !$isQtResultFile );    
+	
+	@$refResults[$RESULT_TESTCLASS] = "";
+	@$refResults[$RESULT_TESTCASE] = "";
+    @$refResults[$RESULT_PASSEDCOUNT] = 0;
+    @$refResults[$RESULT_FAILEDCOUNT] = 0;
+    @$refResults[$RESULT_SKIPPEDCOUNT] = 0;
+    @$refResults[$RESULT_TOTALCOUNT] = 0;
+    @$refResults[$RESULT_WARNINGMSGS] = [ () ];
+    @$refResults[$RESULT_DEBUGMSGS] = [ () ];
+    @$refResults[$RESULT_DEPRECATIONMSGS] = [ () ];
+    @$refResults[$RESULT_ALLCASES] = [ () ];
+    @$refResults[$RESULT_SKIPPEDCASES] = [ () ];
+	
+	for( my $i = 0; $i < scalar(@lines); $i++ )
+	{
+	    my $line = $lines[$i];
+	    
+	    #              msg                 class              function
+	    if( $line =~ /([a-z\!]+)[ ]+\:[ ]+([a-z0-9\_\-]+)\:\:([a-z0-9\_\-]+\(\))/i )
+	    {
+	        my $result = $1;
+	        my $testClass = $2;
+	        my $testFunc = $3;
+	        #print("result: $result, class: $testClass, func: $testFunc\n");
+	        
+	        @$refResults[$RESULT_TESTCLASS] = $testClass;
+	        @$refResults[$RESULT_TESTCASE] = $testFunc;
+	        
+	        my @case;
+	        $case[$CASE_RESULT] = -1;
+	        $case[$CASE_NAME] = $testClass . "::" . $testFunc;;
+	        $case[$CASE_INFO] = [ () ];
+	        
+	        if( $result =~ /pass/i )
+	        {
+	            @$refResults[$RESULT_PASSEDCOUNT]++;
+	            $case[$CASE_RESULT] = 1;
+	        }
+	        if( $result =~ /fail\!/i )
+	        {
+	            @$refResults[$RESULT_FAILEDCOUNT]++;
+	            
+                $case[$CASE_RESULT] = 0;
+                
+	            my @info;
+	            # Read rest of the line for info.
+	            my $reason = substr( $line, rindex( $line, $testFunc ) + length( $testFunc ) );
+	            RemoveWhiteSpaces( \$reason );
+	            push @info, $reason;
+
+                # Read next lines starting with space to info.
+                while( $lines[$i+1] =~ m/^ / )
+                {
+                    my $str = $lines[$i+1];
+                    RemoveWhiteSpaces( \$str );
+                    push @info, $str;
+                    $i++;                    
+                    last if(!defined($lines[$i+1]));
+                }
+
+	            $case[$CASE_INFO] = [ @info ];
+	        }
+	        
+	        my $refAllCases = @$refResults[$RESULT_ALLCASES];
+	        push @$refAllCases, [ @case ];
+	        
+	        if( $result =~ /skip/i )
+	        {
+	            @$refResults[$RESULT_SKIPPEDCOUNT]++;
+	            push @{@$refResults[$RESULT_SKIPPEDCASES]}, $testClass . "::" . $testFunc;
+	        }
+	        if( $result =~ /qdebug/i )
+	        {
+	            push @{@$refResults[$RESULT_DEBUGMSGS]}, $line;
+	            if( $line =~ m/deprecated/i )
+	            {
+    	            push @{@$refResults[$RESULT_DEPRECATIONMSGS]}, $line;
+	            }
+	        }
+	        if( $result =~ /qwarn/i )
+	        {
+	            push @{@$refResults[$RESULT_WARNINGMSGS]}, $line;
+	        }	        
+	    }
+	}
+	
+	@$refResults[$RESULT_TOTALCOUNT] = @$refResults[$RESULT_PASSEDCOUNT] + @$refResults[$RESULT_FAILEDCOUNT] + @$refResults[$RESULT_SKIPPEDCOUNT];
+	return 1;
+}
+
+sub GetTotals
+{
+    my ( $refTotals, $refAllResults ) = @_;
+	
+	@$refTotals[$RESULT_TESTCLASS] = "";
+	@$refTotals[$RESULT_TESTCASE] = "";
+    @$refTotals[$RESULT_PASSEDCOUNT] = 0;
+    @$refTotals[$RESULT_FAILEDCOUNT] = 0;
+    @$refTotals[$RESULT_SKIPPEDCOUNT] = 0;
+    @$refTotals[$RESULT_TOTALCOUNT] = 0;
+    @$refTotals[$RESULT_WARNINGMSGS] = [ () ];
+    @$refTotals[$RESULT_DEBUGMSGS] = [ () ];
+    @$refTotals[$RESULT_DEPRECATIONMSGS] = [ () ];
+    @$refTotals[$RESULT_ALLCASES] = [ () ];
+    @$refTotals[$RESULT_SKIPPEDCASES] = [ () ];
+    
+    foreach my $refResults ( @$refAllResults )
+    {   
+    	@$refTotals[$RESULT_TESTCLASS] = "";
+    	@$refTotals[$RESULT_TESTCASE] = "";
+        @$refTotals[$RESULT_PASSEDCOUNT] += @$refResults[$RESULT_PASSEDCOUNT];
+        @$refTotals[$RESULT_FAILEDCOUNT] += @$refResults[$RESULT_FAILEDCOUNT];
+        @$refTotals[$RESULT_SKIPPEDCOUNT] += @$refResults[$RESULT_SKIPPEDCOUNT];
+        @$refTotals[$RESULT_TOTALCOUNT] += @$refResults[$RESULT_TOTALCOUNT];
+        @$refTotals[$RESULT_WARNINGMSGS] = [ ( @{@$refTotals[$RESULT_WARNINGMSGS]}, @{@$refResults[$RESULT_WARNINGMSGS]} ) ];
+        @$refTotals[$RESULT_DEBUGMSGS] = [ ( @{@$refTotals[$RESULT_DEBUGMSGS]}, @{@$refResults[$RESULT_DEBUGMSGS]} ) ];
+        @$refTotals[$RESULT_DEPRECATIONMSGS] = [ ( @{@$refTotals[$RESULT_DEPRECATIONMSGS]}, @{@$refResults[$RESULT_DEPRECATIONMSGS]} ) ];
+        @$refTotals[$RESULT_ALLCASES] = [ ( @{@$refTotals[$RESULT_ALLCASES]}, @{@$refResults[$RESULT_ALLCASES]} ) ];
+        @$refTotals[$RESULT_SKIPPEDCASES] = [ ( @{@$refTotals[$RESULT_SKIPPEDCASES]}, @{@$refResults[$RESULT_SKIPPEDCASES]} ) ];
+    }
+}
+
+
+sub CreateTextReport
+{
+    my ( $refTotals, $refAllResults ) = @_;
+
+    my $template = 
+"
+Test Results for qvideoplayer
+
+HW:
+SW:
+
+Test Execution Metrics
+Passed: TEMPLATE_PASSED
+Failed: TEMPLATE_FAILED
+N/A (skipped): TEMPLATE_SKIPPED
+Total number of cases: TEMPLATE_TOTAL
+Pass rate of total: TEMPLATE_PRT
+Pass rate of planned: TEMPLATE_PRP
+
+Tests
+TEMPLATE_TESTLIST
+
+Warnings: 
+TEMPLATE_WARNINGS
+Debug message count from tests: TEMPLATE_DEBUG_COUNT
+Deprecation message count from tests: TEMPLATE_DEPRECATION_COUNT
+
+Failed test cases:
+TEMPLATE_FAILED_CASES
+
+Passed test cases
+TEMPLATE_PASSED_CASES
+
+";
+    
+    # List of tests.
+
+    my $str = "";
+    
+    my @testResults;
+    GetTestResults(\@testResults, $refAllResults);
+    foreach my $refRes( @testResults )
+    {
+        my $testName =  @$refRes[0];
+        my $testResult =  @$refRes[1];
+        RemoveWhiteSpaces( \$testName );
+        RemoveWhiteSpaces( \$testResult );
+        $str .= " $testName $testResult\n" if( $testName ne "" );        
+    }
+    
+    $template =~ s/TEMPLATE_TESTLIST/$str/;
+
+    # Numeric data.
+    
+    $template =~ s/TEMPLATE_PASSED/@$refTotals[$RESULT_PASSEDCOUNT]/;
+    $template =~ s/TEMPLATE_FAILED/@$refTotals[$RESULT_FAILEDCOUNT]/;
+    $template =~ s/TEMPLATE_SKIPPED/@$refTotals[$RESULT_SKIPPEDCOUNT]/;
+    $template =~ s/TEMPLATE_TOTAL/@$refTotals[$RESULT_TOTALCOUNT]/;
+    
+    # Pass rates.
+    
+    my $prt = @$refTotals[$RESULT_PASSEDCOUNT] / @$refTotals[$RESULT_TOTALCOUNT] * 100;
+    $prt = sprintf( "%.2f", $prt );
+    $template =~ s/TEMPLATE_PRT/$prt/;
+    
+    my $prp =  @$refTotals[$RESULT_PASSEDCOUNT] / ( @$refTotals[$RESULT_PASSEDCOUNT] + @$refTotals[$RESULT_FAILEDCOUNT] ) * 100;
+    $prp = sprintf( "%.2f", $prp );
+    $template =~ s/TEMPLATE_PRP/$prp/;
+    
+    # Message counts.
+    
+    $str = "";
+    foreach my $warning ( @{@$refTotals[$RESULT_WARNINGMSGS]} )
+    {
+        RemoveWhiteSpaces( \$warning );
+        $str .= " $warning\n";
+    }
+    $template =~ s/TEMPLATE_WARNINGS/$str/;
+    
+    my $count = scalar( @{@$refTotals[$RESULT_DEBUGMSGS]} );
+    $template =~ s/TEMPLATE_DEBUG_COUNT/$count/;
+    
+    $count = scalar( @{@$refTotals[$RESULT_DEPRECATIONMSGS]} );
+    $template =~ s/TEMPLATE_DEPRECATION_COUNT/$count/;
+
+    # Failed cases.
+
+    $str = "\n";
+    foreach my $refCase ( @{@$refTotals[$RESULT_ALLCASES]} )
+    {
+        if( @$refCase[$CASE_RESULT] == 0 )
+        {
+            my $case = @$refCase[$CASE_NAME];
+            my $refInfoArray = @$refCase[$CASE_INFO];
+            if( $case ne "" )
+            {
+                $str .= " $case \n";
+                $str .= "    Info: \n";
+                foreach my $infoLine ( @$refInfoArray )
+                {                
+                    $str .= "     $infoLine \n";
+                }
+            }
+            $str .= "\n";
+        }
+    }
+    $str = substr( $str, 0, length( $str ) - 1 ) if( length( $str ) > 1 ); # Remove line break from last line.
+    $template =~ s/TEMPLATE_FAILED_CASES/$str/;
+
+    # Passed cases.
+
+    $str = "\n";
+    foreach my $refCase ( @{@$refTotals[$RESULT_ALLCASES]} )
+    {
+        if( @$refCase[$CASE_RESULT] == 1) 
+        {
+            my $case = @$refCase[$CASE_NAME];
+            $str .= " $case \n";
+        }
+    }
+
+    $str = substr( $str, 0, length( $str ) - 1 ) if( length( $str ) > 1 ); # Remove line break from last line.
+    $template =~ s/TEMPLATE_PASSED_CASES/$str/;
+    
+    # Print to default output and file.
+    print( $template);
+    
+	open(FILE_HANDLE, ">" . "qvptestreport.txt") or die("ERROR! Could not open file '" . "qvptestreport.txt" . "'\n");
+    print FILE_HANDLE $template;
+    close FILE_HANDLE;
+}
+
+sub CreateXmlReport
+{
+    my ( $refTotals, $refAllResults ) = @_;
+
+    my $data = "";
+    my $str = "";
+    
+    my $rows = @$refTotals[$RESULT_TOTALCOUNT] + scalar( @{@$refTotals[$RESULT_WARNINGMSGS]} ) + scalar( @{@$refTotals[$RESULT_DEBUGMSGS]} ) +
+               scalar( @{@$refTotals[$RESULT_DEPRECATIONMSGS]} );
+    
+    # Excel xml header
+    
+    $data = XmlHeader( $rows*2 + 100 );
+    
+    $data .= XmlEmptyRow();
+
+    # HW and SW
+
+    $str = XmlSwHwRow();
+    $str =~ s/REPLACE/INSERT SW HERE/;
+    $data .= $str;
+    
+    $str = XmlSwHwRow();
+    $str =~ s/REPLACE/INSERT HW HERE/;
+    $data .= $str;
+                
+    $data .= XmlEmptyRow();
+    
+    # Metrics
+
+    my $passCount = @$refTotals[$RESULT_PASSEDCOUNT];
+    my $failCount = @$refTotals[$RESULT_FAILEDCOUNT];
+    my $skipCount = @$refTotals[$RESULT_SKIPPEDCOUNT];
+    my $totalCount = @$refTotals[$RESULT_TOTALCOUNT];
+        
+    my $passRateTotal = $passCount / $totalCount * 100;
+    $passRateTotal = sprintf( "%.2f", $passRateTotal );
+    
+    my $passRateRun =  $passCount / ( $passCount + $failCount ) * 100;
+    $passRateRun = sprintf( "%.2f", $passRateRun );
+    
+    my $runRate = ( $passCount + $failCount ) / $totalCount * 100;
+    $runRate = sprintf( "%.2f", $runRate );
+    
+    $str = XmlMetrics();
+    $str =~ s/TOTALCASECOUNT/$totalCount/;
+    $str =~ s/PASSEDCASECOUNT/$passCount/;
+    $str =~ s/FAILEDCASECOUNT/$failCount/;
+    $str =~ s/SKIPPEDCASECOUNT/$skipCount/;
+    $str =~ s/PASSRATEOFTOTAL/$passRateTotal/;
+    $str =~ s/PASSRATEOFRUN/$passRateRun/;
+    $str =~ s/RUNRATE/$runRate/;
+    $data .= $str;
+
+    $data .= XmlEmptyRow();
+        
+    # List of tests.
+
+    $str = XmlTitleOnBlueRow();
+    $str =~ s/THETITLE/Tests/;
+    $data .= $str;
+
+    my @testResults;
+    GetTestResults(\@testResults, $refAllResults);
+    foreach my $refRes( @testResults )
+    {
+        $str = XmlTestNameRow();
+        my $testName =  @$refRes[0];
+        my $testResult =  @$refRes[1];
+        XmlReadyText( \$testName );
+        XmlReadyText( \$testResult );
+        RemoveWhiteSpaces( \$testName );
+        RemoveWhiteSpaces( \$testResult );
+        $str =~ s/TESTNAME/$testName/;
+        $str =~ s/TESTRESULT/$testResult/;
+        $data .= $str;
+    }
+    
+    $data .= XmlEmptyRow();
+    
+    # Case list.
+
+    $str = XmlTitleOnBlueRow();
+    $str =~ s/THETITLE/Cases/;
+    $data .= $str;
+
+    my $cleanupTestCaseFound = 0;
+    my $caseName = "";
+    my $caseTestClass = "";
+
+    foreach my $refCase ( @{@$refTotals[$RESULT_ALLCASES]} )
+    {
+        $caseName = @$refCase[$CASE_NAME];
+        
+        # Write warning if cleanupTestCase is not found for the test.
+        if( index($caseName, "::") != -1 )
+        {
+            my $tc = substr($caseName, 0, index($caseName, "::"));
+            if($caseTestClass ne "" && $caseTestClass ne $tc)
+            {
+                if(!$cleanupTestCaseFound) 
+                {
+                    $str = XmlTextRowRed();
+                    $str =~ s/REPLACE/cleanupTestCase was not found! Test did not finish?/;
+                    $data .= $str;            
+                }
+                $cleanupTestCaseFound = 0;
+            }
+            $caseTestClass = $tc;
+        }
+        $cleanupTestCaseFound = 1 if($caseName =~ "cleanupTestCase");
+        
+        next if( $caseName eq "" );
+
+        if( @$refCase[$CASE_RESULT] == 0 )
+        {
+            my $infoStr = "";
+            my $refInfoArray = @$refCase[$CASE_INFO];
+            foreach my $infoLine ( @$refInfoArray )
+            {                
+                $infoStr .= "$infoLine\n";
+            }
+            
+            $str = XmlFailedCaseRow();
+            XmlReadyText( \$caseName );
+            $str =~ s/TESTCASENAME/$caseName/;            
+            XmlReadyText( \$infoStr );
+            $str =~ s/FAILREASON/$infoStr/;
+            $data .= $str;
+        }
+        elsif( @$refCase[$CASE_RESULT] == 1 )
+        {
+            $str = XmlPassedCaseRow();
+            XmlReadyText( \$caseName );
+            $str =~ s/TESTCASENAME/$caseName/;            
+            $data .= $str;
+        }
+    }    
+    
+    $data .= XmlEmptyRow();
+  
+    # Warning messages
+    
+    $str = XmlTitleOnBlueRow();
+    $str =~ s/THETITLE/Warning messages/;
+    $data .= $str;
+    
+    foreach my $warning ( @{@$refTotals[$RESULT_WARNINGMSGS]} )
+    {
+        RemoveWhiteSpaces( \$warning );
+        XmlReadyText( \$warning );
+        $str = XmlMessageRow();        
+        $str =~ s/MESSAGE/$warning/;
+        $data .= $str;        
+    }
+    
+    $data .= XmlEmptyRow();
+    
+    # Message counts.
+
+    my $msgCountStr = "Debug message count: " . scalar( @{@$refTotals[$RESULT_DEBUGMSGS]} );
+    $str = XmlMessageRow();
+    $str =~ s/MESSAGE/$msgCountStr/;
+    $data .= $str;
+
+    $msgCountStr = "Deprecation message count: " . scalar( @{@$refTotals[$RESULT_DEPRECATIONMSGS]} );
+    $str = XmlMessageRow();
+    $str =~ s/MESSAGE/$msgCountStr/;
+    $data .= $str;
+    
+    for( my $i = 0; $i < 20; $i++ ) 
+    {
+        $data .= XmlEmptyRow();
+    }
+    
+    # Excel xml footer.
+    $data .= XmlFooter();
+
+    open(FILE_HANDLE, ">" . "qvptestreport.xml") or die("ERROR! Could not open file '" . "qvptestreport.xml" . "'\n");
+    print FILE_HANDLE $data;
+    close FILE_HANDLE;
+}
+
+sub GetTestResults
+{
+    my ($refResults, $refAllResults) = @_;
+
+    # Read tests and results from file.
+    open(TRFH, "qvptestresults.txt") or return "";
+    my @lines = <TRFH>;
+    close(TRFH);
+    
+    foreach my $line( @lines )
+    {
+        my @res = split(/\t/, $line);
+        RemoveWhiteSpaces(\$res[0]);
+        RemoveWhiteSpaces(\$res[1]);
+        
+        # Check if there's already result for the test.
+        my $found = 0;
+        foreach my $refRes ( @$refResults ) 
+        {
+            if(@$refRes[0] eq $res[0] )
+            {
+                # Update test result.
+                @$refRes[1] .= " " . $res[1];
+                $found = 1;
+                last;
+            }
+        }
+        
+        # Test not found, add new.
+        if( !$found )
+        {
+            push @$refResults, [ @res ];
+        }
+    }
+
+    # And add those tests that were not in the result file.
+
+    foreach my $refResult ( @$refAllResults )
+    {
+        my $testName = @$refResult[$RESULT_TESTCLASS];
+
+        my $found = 0;
+        foreach my $refRes ( @$refResults ) 
+        {
+            if(@$refRes[0] eq $testName )
+            {
+                $found = 1;
+                last;
+            }
+        }
+        
+        if(!$found)
+        {
+            push @$refResults, [ ($testName, "" ) ];
+        }
+    }        
+}
+
+sub FindFiles
+{
+	my ($godir, $fileSearch, $searchType, $refIncfiles) = @_;
+
+	my $startDir = cwd;
+
+	chdir($godir) or return;
+
+	#print("Now in: " . cwd . "\n");
+
+	opendir(DIR, ".");
+	my @filelist = sort(readdir(DIR));
+	closedir(DIR);
+
+	foreach my $file(@filelist)
+	{
+		if($file eq "." or $file eq "..") {next};
+
+		if (-d $file)
+		{
+		 	FindFiles( $file, $fileSearch, $searchType, $refIncfiles);
+		} else
+		{
+			if( ($file =~ m/$fileSearch/i and $searchType == 0 ) or ($file =~ m/$fileSearch$/i and $searchType == 1 ) )
+			{
+                $file = cwd . "/" . $file;
+				push @$refIncfiles, $file;
+				#print("$file\n");
+			}
+		}
+	}
+
+	chdir ($startDir);
+}
+
+
+sub GetCgiDir
+  {
+    # Solve where the script is located.
+    $0=~/^(.+[\\\/])[^\\\/]+[\\\/]*$/;
+    my $cgidir= $1 || "./";
+    
+    # And try to solve relative path.
+    if( index( $cgidir, "..\\" ) != -1 )
+    {
+    	my $p = cwd;
+    	$p =~ s/\//\\/g;
+    	$cgidir =~ s/\//\\/g;
+    	while(1) 
+    	{
+    		my $pos = index( $cgidir, "..\\" );
+    		last if( $pos == -1 );
+    		$cgidir = substr( $cgidir, $pos+3 );
+    		
+    		$pos = rindex( $p, "\\" );
+    		last if( $pos == -1 );
+    		$p = substr( $p, 0, $pos);
+    	}
+    	$cgidir = $p . "\\" . $cgidir;
+    }
+    return $cgidir;
+}
+
+sub GetPathFileName
+{
+    my ($str) = @_;
+
+    my $startPos = rindex($str, "\\");
+    if($startPos == -1)
+    {
+        $startPos = rindex($str, "/");
+        return $str if($startPos == -1);
+    }
+
+    my $filename = substr($str, $startPos+1);
+
+    return $filename;
+}
+
+sub GetPathDir
+{
+    my ($str) = @_;
+
+    my $endPos = rindex($str, "\\");
+    if($endPos == -1)
+    {
+        $endPos = rindex($str, "/");
+        return $str if($endPos == -1);
+    }
+
+    my $filename = substr($str, 0, $endPos);
+
+    return $filename;
+}
+
+sub RemoveWhiteSpaces
+{
+	my ($text) = @_;
+	${$text} =~ s/\s+$//; #whitespaces in the end
+	${$text} =~ s/^\s+//; #whitespaces at the start
+}
+
+sub XmlReadyText
+{
+	my ($text) = @_;
+
+	my $txtlt = "&lt;";
+	my $txtgt = "&gt;";
+	${$text} =~ s/</$txtlt/g;
+	${$text} =~ s/>/$txtgt/g;
+
+	${$text} =~ s/Ä/&Auml/g;
+	${$text} =~ s/ä/&auml/g;
+	${$text} =~ s/Ö/&Ouml/g;
+	${$text} =~ s/ö/&ouml/g;
+
+	#ä &auml;
+
+#	Ö &Ouml;
+
+#	ö &ouml;
+}
+
+sub XmlHeader 
+{ 
+    my ( $rowCount ) = @_;
+    my $str =
+"<?xml version=\"1.0\"?>\n" .
+"<?mso-application progid=\"Excel.Sheet\"?>\n" .
+"<Workbook xmlns=\"urn:schemas-microsoft-com:office:spreadsheet\"\n" .
+" xmlns:o=\"urn:schemas-microsoft-com:office:office\"\n" .
+" xmlns:x=\"urn:schemas-microsoft-com:office:excel\"\n" .
+" xmlns:ss=\"urn:schemas-microsoft-com:office:spreadsheet\"\n" .
+" xmlns:html=\"http://www.w3.org/TR/REC-html40\">\n" .
+" <DocumentProperties xmlns=\"urn:schemas-microsoft-com:office:office\">\n" .
+"  <Author>Senbom Petri</Author>\n" .
+"  <LastAuthor>Senbom Petri</LastAuthor>\n" .
+"  <Created>2006-06-09T11:08:05Z</Created>\n" .
+"  <Company>Nokia Oyj</Company>\n" .
+"  <Version>11.9999</Version>\n" .
+" </DocumentProperties>\n" .
+" <ExcelWorkbook xmlns=\"urn:schemas-microsoft-com:office:excel\">\n" .
+"  <WindowHeight>12210</WindowHeight>\n" .
+"  <WindowWidth>18780</WindowWidth>\n" .
+"  <WindowTopX>360</WindowTopX>\n" .
+"  <WindowTopY>255</WindowTopY>\n" .
+"  <ProtectStructure>False</ProtectStructure>\n" .
+"  <ProtectWindows>False</ProtectWindows>\n" .
+" </ExcelWorkbook>\n" .
+" <Styles>\n" .
+"  <Style ss:ID=\"Default\" ss:Name=\"Normal\">\n" .
+"   <Alignment ss:Vertical=\"Bottom\"/>\n" .
+"   <Borders/>\n" .
+"   <Font/>\n" .
+"   <Interior/>\n" .
+"   <NumberFormat/>\n" .
+"   <Protection/>\n" .
+"  </Style>\n" .
+"  <Style ss:ID=\"m153896384\">\n" .
+"   <Alignment ss:Horizontal=\"Left\" ss:Vertical=\"Bottom\"/>\n" .
+"   <Borders>\n" .
+"    <Border ss:Position=\"Bottom\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"    <Border ss:Position=\"Left\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"    <Border ss:Position=\"Right\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"    <Border ss:Position=\"Top\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"   </Borders>\n" .
+"   <Font x:Family=\"Swiss\"/>\n" .
+"   <Interior ss:Color=\"#FFFFFF\" ss:Pattern=\"Solid\"/>\n" .
+"  </Style>\n" .
+"  <Style ss:ID=\"m153896394\">\n" .
+"   <Alignment ss:Horizontal=\"Left\" ss:Vertical=\"Top\" ss:WrapText=\"1\"/>\n" .
+"   <Borders>\n" .
+"    <Border ss:Position=\"Bottom\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"    <Border ss:Position=\"Left\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"    <Border ss:Position=\"Right\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"    <Border ss:Position=\"Top\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"   </Borders>\n" .
+"   <Font x:Family=\"Swiss\"/>\n" .
+"   <Interior ss:Color=\"#FFFFFF\" ss:Pattern=\"Solid\"/>\n" .
+"   <NumberFormat/>\n" .
+"  </Style>\n" .
+"  <Style ss:ID=\"m153895896\">\n" .
+"   <Alignment ss:Horizontal=\"Center\" ss:Vertical=\"Center\"/>\n" .
+"   <Borders>\n" .
+"    <Border ss:Position=\"Bottom\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"    <Border ss:Position=\"Left\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"    <Border ss:Position=\"Right\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"    <Border ss:Position=\"Top\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"   </Borders>\n" .
+"   <Font x:Family=\"Swiss\" ss:Bold=\"1\"/>\n" .
+"   <Interior ss:Color=\"#FFFF00\" ss:Pattern=\"Solid\"/>\n" .
+"  </Style>\n" .
+"  <Style ss:ID=\"redbg\">\n" .
+"   <Alignment ss:Horizontal=\"Center\" ss:Vertical=\"Center\"/>\n" .
+"   <Borders>\n" .
+"    <Border ss:Position=\"Bottom\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"    <Border ss:Position=\"Left\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"    <Border ss:Position=\"Right\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"    <Border ss:Position=\"Top\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"   </Borders>\n" .
+"   <Font x:Family=\"Swiss\" ss:Bold=\"1\"/>\n" .
+"   <Interior ss:Color=\"#FF0000\" ss:Pattern=\"Solid\"/>\n" .
+"  </Style>\n" .
+"  <Style ss:ID=\"m153895906\">\n" .
+"   <Alignment ss:Horizontal=\"Left\" ss:Vertical=\"Center\"/>\n" .
+"   <Borders>\n" .
+"    <Border ss:Position=\"Bottom\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"    <Border ss:Position=\"Left\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"    <Border ss:Position=\"Right\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"    <Border ss:Position=\"Top\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"   </Borders>\n" .
+"   <Font x:Family=\"Swiss\"/>\n" .
+"   <Interior ss:Color=\"#FFFFFF\" ss:Pattern=\"Solid\"/>\n" .
+"  </Style>\n" .
+"  <Style ss:ID=\"m153881708\">\n" .
+"   <Alignment ss:Horizontal=\"Left\" ss:Vertical=\"Bottom\"/>\n" .
+"   <Borders>\n" .
+"    <Border ss:Position=\"Bottom\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"    <Border ss:Position=\"Left\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"    <Border ss:Position=\"Right\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"    <Border ss:Position=\"Top\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"   </Borders>\n" .
+"   <Font x:Family=\"Swiss\"/>\n" .
+"   <Interior ss:Color=\"#FFFFFF\" ss:Pattern=\"Solid\"/>\n" .
+"  </Style>\n" .
+"  <Style ss:ID=\"m153881728\">\n" .
+"   <Alignment ss:Horizontal=\"Left\" ss:Vertical=\"Bottom\"/>\n" .
+"   <Borders>\n" .
+"    <Border ss:Position=\"Bottom\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"    <Border ss:Position=\"Left\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"    <Border ss:Position=\"Right\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"    <Border ss:Position=\"Top\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"   </Borders>\n" .
+"   <Font x:Family=\"Swiss\" ss:Bold=\"1\"/>\n" .
+"   <Interior ss:Color=\"#99CCFF\" ss:Pattern=\"Solid\"/>\n" .
+"  </Style>\n" .
+"  <Style ss:ID=\"m153881376\">\n" .
+"   <Alignment ss:Horizontal=\"Right\" ss:Vertical=\"Bottom\"/>\n" .
+"   <Borders>\n" .
+"    <Border ss:Position=\"Left\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>" .
+"    <Border ss:Position=\"Bottom\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"    <Border ss:Position=\"Right\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"   </Borders>\n" .
+"   <Interior ss:Color=\"#99CCFF\" ss:Pattern=\"Solid\"/>\n" .
+"  </Style>\n" .
+"  <Style ss:ID=\"m153881436\">\n" .
+"   <Alignment ss:Horizontal=\"Left\" ss:Vertical=\"Bottom\"/>\n" .
+"   <Borders>\n" .
+"    <Border ss:Position=\"Bottom\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"    <Border ss:Position=\"Left\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"    <Border ss:Position=\"Right\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"    <Border ss:Position=\"Top\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"   </Borders>\n" .
+"   <Font x:Family=\"Swiss\" ss:Bold=\"1\"/>\n" .
+"   <Interior ss:Color=\"#99CCFF\" ss:Pattern=\"Solid\"/>\n" .
+"  </Style>\n" .
+"  <Style ss:ID=\"m153895744\">\n" .
+"   <Alignment ss:Horizontal=\"Right\" ss:Vertical=\"Bottom\"/>\n" .
+"   <Borders>\n" .
+"    <Border ss:Position=\"Right\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"    <Border ss:Position=\"Top\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"    <Border ss:Position=\"Left\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>" .
+"   </Borders>\n" .
+"   <Interior ss:Color=\"#99CCFF\" ss:Pattern=\"Solid\"/>\n" .
+"  </Style>\n" .
+"  <Style ss:ID=\"s24\">\n" .
+"   <Alignment ss:Horizontal=\"Left\" ss:Vertical=\"Bottom\"/>\n" .
+"   <Borders>\n" .
+"    <Border ss:Position=\"Bottom\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"    <Border ss:Position=\"Top\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"    <Border ss:Position=\"Left\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>" .
+"   </Borders>\n" .
+"   <Font x:Family=\"Swiss\" ss:Bold=\"1\"/>\n" .
+"  </Style>\n" .
+"  <Style ss:ID=\"s27\">\n" .
+"   <Borders>\n" .
+"    <Border ss:Position=\"Left\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"   </Borders>\n" .
+"   <Interior ss:Color=\"#FFFFFF\" ss:Pattern=\"Solid\"/>\n" .
+"  </Style>\n" .
+"  <Style ss:ID=\"s32\">\n" .
+"   <Alignment ss:Vertical=\"Top\" ss:WrapText=\"1\"/>\n" .
+"   <Borders>\n" .
+"    <Border ss:Position=\"Bottom\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"    <Border ss:Position=\"Left\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"    <Border ss:Position=\"Top\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"   </Borders>\n" .
+"   <Interior ss:Color=\"#FFFFFF\" ss:Pattern=\"Solid\"/>\n" .
+"  </Style>\n" .
+"  <Style ss:ID=\"s34\">\n" .
+"   <Alignment ss:Horizontal=\"Right\" ss:Vertical=\"Bottom\"/>\n" .
+"   <Borders>\n" .
+"    <Border ss:Position=\"Right\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"<Border ss:Position=\"Left\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>" .
+"   </Borders>\n" .
+"   <Interior ss:Color=\"#99CCFF\" ss:Pattern=\"Solid\"/>\n" .
+"  </Style>\n" .
+"  <Style ss:ID=\"s35\">\n" .
+"   <Alignment ss:Vertical=\"Top\" ss:WrapText=\"1\"/>\n" .
+"   <Borders>\n" .
+"    <Border ss:Position=\"Bottom\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"    <Border ss:Position=\"Left\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"    <Border ss:Position=\"Top\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"   </Borders>\n" .
+"   <Interior ss:Color=\"#FFFFFF\" ss:Pattern=\"Solid\"/>\n" .
+"   <NumberFormat ss:Format=\"Fixed\"/>\n" .
+"  </Style>\n" .
+"  <Style ss:ID=\"s48\">\n" .
+"   <Alignment ss:Horizontal=\"Center\" ss:Vertical=\"Bottom\"/>\n" .
+"   <Borders>\n" .
+"    <Border ss:Position=\"Bottom\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"    <Border ss:Position=\"Left\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"    <Border ss:Position=\"Right\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"    <Border ss:Position=\"Top\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"   </Borders>\n" .
+"   <Font x:Family=\"Swiss\" ss:Bold=\"1\"/>\n" .
+"   <Interior ss:Color=\"#CCFFCC\" ss:Pattern=\"Solid\"/>\n" .
+"  </Style>\n" .
+"  <Style ss:ID=\"s109\">\n" .
+"   <Alignment ss:Horizontal=\"Center\" ss:Vertical=\"Bottom\"/>\n" .
+"   <Interior ss:Color=\"#FFFFFF\" ss:Pattern=\"Solid\"/>\n" .
+"  </Style>\n" .
+"  <Style ss:ID=\"REDTEXT\">\n" .
+"   <Alignment ss:Horizontal=\"Center\" ss:Vertical=\"Bottom\"/>\n" .
+"   <Font x:Family=\"Swiss\" ss:Bold=\"1\"/>\n" .
+"   <Interior ss:Color=\"#FF0000\" ss:Pattern=\"Solid\"/>\n" .
+"  </Style>\n" .
+"  <Style ss:ID=\"s111\">\n" .
+"   <Alignment ss:Horizontal=\"Left\" ss:Vertical=\"Bottom\"/>\n" .
+"   <Interior ss:Color=\"#FFFFFF\" ss:Pattern=\"Solid\"/>\n" .
+"  </Style>\n" .
+"  <Style ss:ID=\"s119\">\n" .
+"   <Alignment ss:Horizontal=\"Center\" ss:Vertical=\"Bottom\"/>\n" .
+"   <Borders>\n" .
+"    <Border ss:Position=\"Left\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n" .
+"   </Borders>\n" .
+"   <Font x:Family=\"Swiss\" ss:Bold=\"1\"/>\n" .
+"   <Interior ss:Color=\"#FFFFFF\" ss:Pattern=\"Solid\"/>\n" .
+"  </Style>\n" .
+"  <Style ss:ID=\"s82\">\n" .
+"   <Interior ss:Color=\"#FFFFFF\" ss:Pattern=\"Solid\"/>\n" .
+"  </Style>\n" .
+" </Styles> \n" .
+" <Worksheet ss:Name=\"Sheet1\">\n" .
+"  <Table ss:ExpandedColumnCount=\"15\" ss:ExpandedRowCount=\"EXCELEXPANDEDROWCOUNT\" x:FullColumns=\"1\"\n" .
+"   x:FullRows=\"1\">\n" .
+"   <Column ss:StyleID=\"s82\" ss:AutoFitWidth=\"0\" ss:Width=\"12.75\"/>\n" .
+"   <Column ss:AutoFitWidth=\"0\" ss:Width=\"63\"/>\n" .
+"   <Column ss:AutoFitWidth=\"0\" ss:Width=\"69\"/>\n" .
+"   <Column ss:AutoFitWidth=\"0\" ss:Width=\"78\"/>\n" .
+"   <Column ss:AutoFitWidth=\"0\" ss:Width=\"197.25\"/>\n" .
+"   <Column ss:AutoFitWidth=\"0\" ss:Width=\"388.5\"/>\n" .
+"   <Column ss:AutoFitWidth=\"0\" ss:Width=\"39\" ss:Span=\"1\"/>\n" .
+"   <Column ss:Index=\"11\" ss:AutoFitWidth=\"0\" ss:Width=\"39.75\"/>\n" .
+"   <Column ss:Index=\"13\" ss:AutoFitWidth=\"0\" ss:Width=\"26.25\"/>\n" .
+"   <Column ss:AutoFitWidth=\"0\" ss:Width=\"15\"/>\n" .
+"   <Column ss:AutoFitWidth=\"0\" ss:Width=\"525.75\"/>\n";
+
+    $str =~ s/EXCELEXPANDEDROWCOUNT/$rowCount/;
+    return $str;
+};
+
+sub XmlFooter 
+{
+    return 
+"  </Table>\n" .
+"  <WorksheetOptions xmlns=\"urn:schemas-microsoft-com:office:excel\">\n" .
+"   <Print>\n" .
+"    <ValidPrinterInfo/>\n" .
+"    <PaperSizeIndex>9</PaperSizeIndex>\n" .
+"    <HorizontalResolution>600</HorizontalResolution>\n" .
+"    <VerticalResolution>600</VerticalResolution>\n" .
+"   </Print>\n" .
+"   <Selected/>\n" .
+"   <Panes>\n" .
+"    <Pane>\n" .
+"     <Number>3</Number>\n" .
+"     <ActiveRow>1</ActiveRow>\n" .
+"     <RangeSelection>R2C1:R2C14</RangeSelection>\n" .
+"    </Pane>\n" .
+"   </Panes>\n" .
+"   <ProtectObjects>False</ProtectObjects>\n" .
+"   <ProtectScenarios>False</ProtectScenarios>\n" .
+"  </WorksheetOptions>\n" .
+" </Worksheet>\n" .
+"</Workbook>\n";
+}
+
+sub XmlEmptyRow 
+{
+    return
+"   <Row>\n" .
+"    <Cell ss:Index=\"2\" ss:MergeAcross=\"13\" ss:StyleID=\"s109\"><Data ss:Type=\"String\"></Data></Cell>\n" .
+"   </Row>\n";
+}
+
+sub XmlSwHwRow
+{
+    return 
+"   <Row>\n" .
+"    <Cell ss:Index=\"2\" ss:MergeAcross=\"13\" ss:StyleID=\"s111\"><Data ss:Type=\"String\">REPLACE</Data></Cell>\n" .
+"   </Row>\n";
+}
+
+sub XmlMetrics
+{
+    return
+"   <Row>\n" .
+"    <Cell ss:Index=\"2\" ss:MergeAcross=\"2\" ss:StyleID=\"s24\"><Data ss:Type=\"String\">Test Execution Metrics</Data></Cell>\n" .
+"    <Cell ss:MergeAcross=\"10\" ss:StyleID=\"s27\"/>\n" .
+"   </Row>\n" .
+"   <Row>\n" .
+"    <Cell ss:Index=\"2\" ss:MergeAcross=\"1\" ss:StyleID=\"m153895744\"><Data ss:Type=\"String\">Total cases</Data></Cell>\n" .
+"    <Cell ss:StyleID=\"s32\"><Data ss:Type=\"Number\">TOTALCASECOUNT</Data></Cell>\n" .
+"    <Cell ss:MergeAcross=\"10\" ss:StyleID=\"s27\"/>\n" .
+"   </Row>\n" .
+"   <Row>\n" .
+"    <Cell ss:Index=\"2\" ss:MergeAcross=\"1\" ss:StyleID=\"s34\"><Data ss:Type=\"String\">Passed</Data></Cell>\n" .
+"    <Cell ss:StyleID=\"s32\"><Data ss:Type=\"Number\">PASSEDCASECOUNT</Data></Cell>\n" .
+"    <Cell ss:MergeAcross=\"10\" ss:StyleID=\"s27\"/>\n" .
+"   </Row>\n" .
+"   <Row>\n" .
+"    <Cell ss:Index=\"2\" ss:MergeAcross=\"1\" ss:StyleID=\"s34\"><Data ss:Type=\"String\">Failed</Data></Cell>\n" .
+"    <Cell ss:StyleID=\"s32\"><Data ss:Type=\"Number\">FAILEDCASECOUNT</Data></Cell>\n" .
+"    <Cell ss:MergeAcross=\"10\" ss:StyleID=\"s27\"/>\n" .
+"   </Row>\n" .
+"   <Row>\n" .
+"    <Cell ss:Index=\"2\" ss:MergeAcross=\"1\" ss:StyleID=\"s34\"><Data ss:Type=\"String\">Skipped</Data></Cell>\n" .
+"    <Cell ss:StyleID=\"s32\"><Data ss:Type=\"Number\">SKIPPEDCASECOUNT</Data></Cell>\n" .
+"    <Cell ss:MergeAcross=\"10\" ss:StyleID=\"s27\"/>\n" .
+"   </Row>\n" .
+"   <Row>\n" .
+"    <Cell ss:Index=\"2\" ss:MergeAcross=\"1\" ss:StyleID=\"s34\"><Data ss:Type=\"String\">Pass rate % (total cases)</Data></Cell>\n" .
+"    <Cell ss:StyleID=\"s35\"><Data ss:Type=\"Number\">PASSRATEOFTOTAL</Data></Cell>\n" .
+"    <Cell ss:MergeAcross=\"10\" ss:StyleID=\"s27\"/>\n" .
+"   </Row>\n" .
+"   <Row>\n" .
+"    <Cell ss:Index=\"2\" ss:MergeAcross=\"1\" ss:StyleID=\"s34\"><Data ss:Type=\"String\">Pass rate % (run cases)</Data></Cell>\n" .
+"    <Cell ss:StyleID=\"s35\"><Data ss:Type=\"Number\">PASSRATEOFRUN</Data></Cell>\n" .
+"    <Cell ss:MergeAcross=\"10\" ss:StyleID=\"s27\"/>\n" .
+"   </Row>\n" .
+"   <Row>\n" .
+"    <Cell ss:Index=\"2\" ss:MergeAcross=\"1\" ss:StyleID=\"m153881376\"><Data ss:Type=\"String\">Run rate %</Data></Cell>\n" .
+"    <Cell ss:StyleID=\"s35\"><Data ss:Type=\"Number\">RUNRATE</Data></Cell>\n" .
+"    <Cell ss:MergeAcross=\"10\" ss:StyleID=\"s27\"/>\n" .
+"   </Row>\n";
+}
+
+sub XmlTitleOnBlueRow 
+{
+    return
+"   <Row>\n" .
+"    <Cell ss:Index=\"2\" ss:MergeAcross=\"4\" ss:StyleID=\"m153881436\"><Data ss:Type=\"String\">THETITLE</Data></Cell>\n" .
+"    <Cell ss:MergeAcross=\"8\" ss:StyleID=\"s119\"/>\n" .
+"   </Row>\n";
+}
+
+sub XmlTestNameRow
+{
+    return
+"   <Row>\n" .
+"    <Cell ss:Index=\"2\" ss:MergeAcross=\"2\" ss:StyleID=\"m153896384\"><Data ss:Type=\"String\">TESTNAME</Data></Cell>\n" .
+"    <Cell ss:MergeAcross=\"1\" ss:StyleID=\"m153881708\"><Data ss:Type=\"String\">TESTRESULT</Data></Cell>\n" .
+"    <Cell ss:MergeAcross=\"8\" ss:StyleID=\"s119\"/>\n" .
+"   </Row>\n";
+}
+
+sub XmlMessageRow
+{
+    return
+"   <Row>\n" .
+"    <Cell ss:Index=\"2\" ss:MergeAcross=\"4\" ss:StyleID=\"m153896384\"><Data ss:Type=\"String\">MESSAGE</Data></Cell>\n" .
+"    <Cell ss:MergeAcross=\"8\" ss:StyleID=\"s119\"/>\n" .
+"   </Row>\n";
+}
+
+sub XmlPassedCaseRow
+{
+    return
+"   <Row>\n" .
+"    <Cell ss:Index=\"2\" ss:StyleID=\"s48\"><Data ss:Type=\"String\">PASSED</Data></Cell>\n" .
+"    <Cell ss:MergeAcross=\"3\" ss:StyleID=\"m153881708\"><Data ss:Type=\"String\">TESTCASENAME</Data></Cell>\n" .
+"    <Cell ss:MergeAcross=\"8\" ss:StyleID=\"s119\"/>\n" .
+"   </Row>\n";
+}
+
+sub XmlFailedCaseRow 
+{
+    return 
+"   <Row>\n" .
+"    <Cell ss:Index=\"2\" ss:MergeDown=\"1\" ss:StyleID=\"m153895896\"><Data ss:Type=\"String\">FAILED</Data></Cell>\n" .
+"    <Cell ss:MergeAcross=\"2\" ss:MergeDown=\"1\" ss:StyleID=\"m153895906\"><Data\n" .
+"      ss:Type=\"String\">TESTCASENAME</Data></Cell>\n" .
+"    <Cell ss:MergeDown=\"1\" ss:StyleID=\"m153896394\"><Data ss:Type=\"String\">FAILREASON</Data></Cell>\n" .
+"    <Cell ss:MergeAcross=\"8\" ss:StyleID=\"s119\"/>\n" .
+"   </Row>\n" .
+"   <Row>\n" .
+"    <Cell ss:Index=\"7\" ss:MergeAcross=\"8\" ss:StyleID=\"s119\"/>\n" .
+"   </Row>\n";
+}
+
+sub XmlTextRowRed
+{
+    return
+"   <Row>\n" .
+"    <Cell ss:Index=\"2\" ss:StyleID=\"redbg\"><Data ss:Type=\"String\"></Data></Cell>\n" .
+"    <Cell ss:MergeAcross=\"3\" ss:StyleID=\"m153881708\"><Data ss:Type=\"String\">REPLACE</Data></Cell>\n" .
+"    <Cell ss:MergeAcross=\"8\" ss:StyleID=\"s119\"/>\n" .
+"   </Row>\n";
+}
+
+sub XmlTextRowRedx
+{
+    return 
+"   <Row>\n" .
+"    <Cell ss:Index=\"2\" ss:MergeAcross=\"8\" ss:StyleID=\"REDTEXT\"><Data ss:Type=\"String\">REPLACE</Data></Cell>\n" .
+"   </Row>\n";
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsrc/readme.txt	Mon Oct 04 00:14:19 2010 +0300
@@ -0,0 +1,8 @@
+Script taken from videoplayer. Thanks. :)
+
+qvptestresultgen.pl
+----------------------------------------------------------------------
+Creates report from the Qt test results. Copy the test result files 
+from device c:\data or emulator \epoc32\winscw\c\data to same folder with 
+the script and run it.
+