201021
authorhgs
Fri, 28 May 2010 16:17:03 +0300
changeset 96 5d243a69bdda
parent 95 c739008478cc
child 97 1e962b12a8db
201021
activityfw/activitydatabase/bwins/hsactivitydbclientu.def
activityfw/activitydatabase/eabi/hsactivitydbclientu.def
activityfw/activitydatabase/hsactivitydbserver/group/hsactivitydbserver.mmp
activityfw/activitydatabase/hsactivitydbserver/inc/activitygraphicfilescaling.h
activityfw/activitydatabase/hsactivitydbserver/inc/activitythumbnailtask.h
activityfw/activitydatabase/hsactivitydbserver/src/activitybroadcasttask.cpp
activityfw/activitydatabase/hsactivitydbserver/src/activitygraphicfilescaling.cpp
activityfw/activitydatabase/hsactivitydbserver/src/activitythumbnailtask.cpp
activityfw/activityserviceplugin/activityserviceplugin.pro
activityfw/activityserviceplugin/src/activityclient.cpp
activityfw/orbitintegration/hbactivityplugin/hbactivityplugininterface.h
activityfw/rom/activitymanager_core.iby
activityfw/sis/activitymanager.pkg
activityfw/sis/stubs/activitymanager_stub.pkg
activityfw/sis/stubs/activitymanager_stub.sis
activityfw/tsutils/bwins/tsutilsu.def
activityfw/tsutils/eabi/tsutilsu.def
activityfw/tsutils/group/bld.inf
activityfw/tsutils/inc/tsgraphicfilescalinghandler.h
activityfw/tsutils/src/tsgraphicfilescalinghandler.cpp
contentstorage/caclient/inc/caclient_defines.h
contentstorage/caclient/inc/cahandler.h
contentstorage/caclient/inc/cahandlerloader.h
contentstorage/caclient/inc/cahandlerproxy.h
contentstorage/caclient/inc/caitemmodel_p.h
contentstorage/caclient/inc/caqtsfhandlerloader.h
contentstorage/caclient/inc/caservice_p.h
contentstorage/caclient/s60/inc/cabitmapadapter.h
contentstorage/caclient/s60/inc/caclientproxy.h
contentstorage/caclient/s60/inc/cahandler.h
contentstorage/caclient/s60/inc/cahandlerloader.h
contentstorage/caclient/s60/inc/cahandlerproxy.h
contentstorage/caclient/s60/inc/caqtsfhandlerloader.h
contentstorage/caclient/s60/src/cabitmapadapter.cpp
contentstorage/caclient/s60/src/caclientproxy.cpp
contentstorage/caclient/s60/src/cahandlerloader.cpp
contentstorage/caclient/s60/src/cahandlerproxy.cpp
contentstorage/caclient/s60/src/camenuiconutility.cpp
contentstorage/caclient/s60/src/caqtsfhandlerloader.cpp
contentstorage/caclient/src/cahandlerloader.cpp
contentstorage/caclient/src/cahandlerproxy.cpp
contentstorage/caclient/src/caitemmodel.cpp
contentstorage/caclient/src/caqtsfhandlerloader.cpp
contentstorage/caclient/src/caservice.cpp
contentstorage/caclient/stub/inc/caobjectadapter.h
contentstorage/caclient/stub/src/camenuiconutility.cpp
contentstorage/caclient/stub/src/caobjectadapter.cpp
contentstorage/cahandler/app/app.pro
contentstorage/cahandler/app/inc/caapphandler.h
contentstorage/cahandler/app/inc/cas60apphandleradapter.h
contentstorage/cahandler/app/src/caapphandler.cpp
contentstorage/cahandler/app/src/caapphandlerplugin.cpp
contentstorage/cahandler/app/src/cas60apphandleradapter.cpp
contentstorage/cahandler/tapp/inc/catapphandler.h
contentstorage/cahandler/tapp/src/catapphandler.cpp
contentstorage/cahandler/tapp/tapp.pro
contentstorage/cahandler/url/inc/cas60urlhandleradapter.h
contentstorage/cahandler/url/inc/caurlhandler.h
contentstorage/cahandler/url/inc/caurlhandlerplugin.h
contentstorage/cahandler/url/src/cas60urlhandleradapter.cpp
contentstorage/cahandler/url/src/caurlhandler.cpp
contentstorage/cahandler/url/src/caurlhandlerplugin.cpp
contentstorage/cahandler/url/url.pro
contentstorage/casoftwareregistry/casoftwareregistry.pro
contentstorage/casoftwareregistry/s60/src/casoftwareregistry_p.cpp
contentstorage/casrv/caappscanner/group/caappscanner.mmp
contentstorage/casrv/caappscanner/inc/casrvappscanner.h
contentstorage/casrv/caappscanner/src/casrvappscanner.cpp
contentstorage/casrv/calocalizerscanner/inc/calocalizerscannerproxy.h
contentstorage/casrv/calocalizerscanner/src/calocalizerscannerproxy.cpp
contentstorage/casrv/cawidgetscanner/group/cawidgetscanner.mmp
contentstorage/casrv/cawidgetscanner/inc/cawidgetdescription.h
contentstorage/casrv/cawidgetscanner/inc/cawidgetscannerdef.h
contentstorage/casrv/cawidgetscanner/inc/cawidgetstoragehandler.h
contentstorage/casrv/cawidgetscanner/src/cawidgetdescription.cpp
contentstorage/casrv/cawidgetscanner/src/cawidgetscannerparser.cpp
contentstorage/casrv/cawidgetscanner/src/cawidgetstoragehandler.cpp
contentstorage/castorage/inc/casqlcommands.h
contentstorage/castorage/src/casqlitestorage.cpp
contentstorage/cautils/inc/calocalizationentry.h
contentstorage/inc/cadef.h
contentstorage/srvinc/cainstallstrategy.h
contentstorage/srvsrc/cainstallstrategy.cpp
homescreensrv_plat/contentstorage_api/cadefs.h
homescreensrv_plat/contentstorage_api/caitemmodel.h
tstaskmonitor/backstepping/backstepping.pro
tstaskmonitor/backstepping/bwins/tsbacksteppingu.def
tstaskmonitor/backstepping/eabi/tsbacksteppingu.def
tstaskmonitor/backstepping/group/bld.inf
tstaskmonitor/backstepping/group/tsbackstepping.mmp
tstaskmonitor/backstepping/inc/tsbackstepping.h
tstaskmonitor/backstepping/src/tsbackstepping.cpp
tstaskmonitor/client/client.pri
tstaskmonitor/client/client.pro
tstaskmonitor/client/inc/tsscreenshotregistry.h
tstaskmonitor/client/inc/tstask.h
tstaskmonitor/client/s60/inc/tsscreenshotclient.h
tstaskmonitor/client/s60/inc/tsscreenshotclientimpl.h
tstaskmonitor/client/s60/inc/tsscreenshotregistry_p.h
tstaskmonitor/client/s60/inc/tssession.h
tstaskmonitor/client/s60/inc/tstaskmonitorclient.h
tstaskmonitor/client/s60/inc/tstaskmonitorclientimpl.h
tstaskmonitor/client/s60/inc/tstaskmonitorsession.h
tstaskmonitor/client/s60/src/tsapplicationtask.cpp
tstaskmonitor/client/s60/src/tsscreenshotclient.cpp
tstaskmonitor/client/s60/src/tsscreenshotclientimpl.cpp
tstaskmonitor/client/s60/src/tsscreenshotregistry_p.cpp
tstaskmonitor/client/s60/src/tssession.cpp
tstaskmonitor/client/s60/src/tstask.cpp
tstaskmonitor/client/s60/src/tstaskmonitor_p.cpp
tstaskmonitor/client/s60/src/tstaskmonitorclient.cpp
tstaskmonitor/client/s60/src/tstaskmonitorsession.cpp
tstaskmonitor/client/src/tsscreenshotregistry.cpp
tstaskmonitor/client/stub/inc/tsscreenshotregistry_p.h
tstaskmonitor/client/stub/src/tsscreenshotregistry_p.cpp
tstaskmonitor/client/stub/src/tstask.cpp
tstaskmonitor/inc/tstaskmonitorglobals.h
tstaskmonitor/rom/tstaskmonitor_core.iby
tstaskmonitor/screenshotplugin/group/bld.inf
tstaskmonitor/screenshotplugin/group/tsscreenshotplugin.mmp
tstaskmonitor/screenshotplugin/inc/tsscreenshotplugin.h
tstaskmonitor/screenshotplugin/screenshotplugin.pro
tstaskmonitor/screenshotplugin/src/tsscreenshotmain.cpp
tstaskmonitor/screenshotplugin/src/tsscreenshotplugin.cpp
tstaskmonitor/screenshotplugin/src/tsscreenshotplugin.rss
tstaskmonitor/server/group/hsrunningappmonitor.mmp
tstaskmonitor/server/inc/hsdataobserver.h
tstaskmonitor/server/inc/hsdataobservertask.h
tstaskmonitor/server/inc/hsdataprovider.h
tstaskmonitor/server/inc/hsdataprovidertask.h
tstaskmonitor/server/inc/hsrunningappserver.h
tstaskmonitor/server/inc/hsrunningappsession.h
tstaskmonitor/server/inc/tsdatastorage.h
tstaskmonitor/server/inc/tsdatatask.h
tstaskmonitor/server/inc/tsfswdatalist.h
tstaskmonitor/server/inc/tsfswengine.h
tstaskmonitor/server/inc/tsfswmonitor.h
tstaskmonitor/server/inc/tsfswobservers.h
tstaskmonitor/server/inc/tsrunningappstorage.h
tstaskmonitor/server/inc/tsscreenshotprovider.h
tstaskmonitor/server/src/hsrunningappserver.cpp
tstaskmonitor/server/src/hsrunningappsession.cpp
tstaskmonitor/server/src/tsdatatask.cpp
tstaskmonitor/server/src/tsfswdatalist.cpp
tstaskmonitor/server/src/tsfswengine.cpp
tstaskmonitor/server/src/tsfswmonitor.cpp
tstaskmonitor/server/src/tsrunningappstorage.cpp
tstaskmonitor/server/src/tsscreenshotprovider.cpp
tstaskmonitor/sis/stubs/taskmonitor_stub.pkg
tstaskmonitor/sis/stubs/taskmonitor_stub.sis
tstaskmonitor/sis/taskmonitor.SIS
tstaskmonitor/sis/taskmonitor.pkg
tstaskmonitor/tstaskmonitor.pro
tstaskmonitor/utils/inc/tsdataobserver.h
tstaskmonitor/utils/inc/tsentrykey.h
tstaskmonitor/utils/inc/tsentrykeygenerator.h
tstaskmonitor/utils/inc/tsfswentry.h
tstaskmonitor/utils/src/tsentrykey.cpp
tstaskmonitor/utils/src/tsentrykeygenerator.cpp
tstaskmonitor/utils/src/tsfswentry.cpp
--- a/activityfw/activitydatabase/bwins/hsactivitydbclientu.def	Mon May 24 20:50:46 2010 +0300
+++ b/activityfw/activitydatabase/bwins/hsactivitydbclientu.def	Fri May 28 16:17:03 2010 +0300
@@ -25,4 +25,7 @@
 	?activityRequested@HsActivityDbClient@@IAEXABVQString@@@Z @ 24 NONAME ; void HsActivityDbClient::activityRequested(class QString const &)
 	?updateActivity@HsActivityDbClient@@UAEHABV?$QHash@VQString@@VQVariant@@@@@Z @ 25 NONAME ; int HsActivityDbClient::updateActivity(class QHash<class QString, class QVariant> const &)
 	?removeActivity@HsActivityDbClient@@UAEHABV?$QHash@VQString@@VQVariant@@@@@Z @ 26 NONAME ; int HsActivityDbClient::removeActivity(class QHash<class QString, class QVariant> const &)
+	?dataChanged@HsActivityDbClient@@IAEXXZ @ 27 NONAME ; void HsActivityDbClient::dataChanged(void)
+	?notifyDataChange@HsActivityDbClient@@QAEHXZ @ 28 NONAME ; int HsActivityDbClient::notifyDataChange(void)
+	?asyncRequestCompleated@HsActivityDbClient@@UAEXHH@Z @ 29 NONAME ; void HsActivityDbClient::asyncRequestCompleated(int, int)
 
--- a/activityfw/activitydatabase/eabi/hsactivitydbclientu.def	Mon May 24 20:50:46 2010 +0300
+++ b/activityfw/activitydatabase/eabi/hsactivitydbclientu.def	Fri May 28 16:17:03 2010 +0300
@@ -35,4 +35,8 @@
 	_ZThn8_N18HsActivityDbClient14updateActivityERK5QHashI7QString8QVariantE @ 34 NONAME
 	_ZThn8_N18HsActivityDbClient21applicationActivitiesER5QListI5QHashI7QString8QVariantEERKS4_ @ 35 NONAME
 	_ZThn8_N18HsActivityDbClient27removeApplicationActivitiesERK5QHashI7QString8QVariantE @ 36 NONAME
+	_ZN18HsActivityDbClient11dataChangedEv @ 37 NONAME
+	_ZN18HsActivityDbClient16notifyDataChangeEv @ 38 NONAME
+	_ZN18HsActivityDbClient22asyncRequestCompleatedEii @ 39 NONAME
+	_ZThn12_N18HsActivityDbClient22asyncRequestCompleatedEii @ 40 NONAME
 
--- a/activityfw/activitydatabase/hsactivitydbserver/group/hsactivitydbserver.mmp	Mon May 24 20:50:46 2010 +0300
+++ b/activityfw/activitydatabase/hsactivitydbserver/group/hsactivitydbserver.mmp	Fri May 28 16:17:03 2010 +0300
@@ -18,10 +18,12 @@
 TARGETTYPE      exe
 UID             0 0x200267B4
 
-SYSTEMINCLUDE   /epoc32/include
+MW_LAYER_SYSTEMINCLUDE 
+APP_LAYER_SYSTEMINCLUDE 
 
 USERINCLUDE     ../inc
 USERINCLUDE     ../../inc
+USERINCLUDE     ../../../../inc
 
 SOURCEPATH      ../src
 SOURCE          main.cpp
@@ -33,7 +35,6 @@
 SOURCE          activitystoragesynctask.cpp
 SOURCE          activitystorageasynctask.cpp
 SOURCE          activityobservertask.cpp
-SOURCE          activitygraphicfilescaling.cpp
 SOURCE          activitythumbnailtask.cpp
 
 LIBRARY        euser.lib 
@@ -44,6 +45,7 @@
 LIBRARY        fbscli.lib
 LIBRARY        bitmaptransforms.lib
 LIBRARY        imageconversion.lib
+LIBRARY        tsutils.lib
 
 CAPABILITY     ALL -TCB
 EPOCHEAPSIZE   0x100000 0x600000 // 1MB - 6MB
--- a/activityfw/activitydatabase/hsactivitydbserver/inc/activitygraphicfilescaling.h	Mon May 24 20:50:46 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +0,0 @@
-/*
- * 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 ACTIVITYGRAPHICFILESSCALING_H
-#define ACTIVITYGRAPHICFILESSCALING_H
-
-#ifndef __E32SVR_H__
-#define __E32SVR_H__
-#endif
-
-
-#ifndef SYMBIAN_ENABLE_PUBLIC_PLATFORM_HEADER_SPLIT
-#define SYMBIAN_ENABLE_PUBLIC_PLATFORM_HEADER_SPLIT
-#endif
-
-#include <bitmaptransforms.h>
-
-class CImageDecoder;
-class CFbsBitmap;
-
-class MImageReadyCallBack
-{
-public:
-    virtual void ImageReadyCallBack(TInt error, const CFbsBitmap *bitmap ) = 0;
-};
-
-class CGraphicsSalingHandler : public CActive
-{
-public:
-
-enum TCurrentOperation{
-        ENone = 0,
-        EConvertBitmapFromFile = 1,
-        EScale = 2
-    };
-
-enum TKindOfScaling
-{
-   EIgnoreAspectRatio = 0,
-   EKeepAspectRatio = 1,
-   EKeepAspectRatioByExpanding = 2,
-};
-
-    ~CGraphicsSalingHandler();
-
-    static CGraphicsSalingHandler* NewL(MImageReadyCallBack &aNotify,
-        RFs &aFs,
-        const TDesC &aFileName,
-        const TDesC8& aMimeType,
-        const TSize &aNewSize,
-        TKindOfScaling aKindOfScaling = CGraphicsSalingHandler::EIgnoreAspectRatio);
-    static CGraphicsSalingHandler* NewLC(MImageReadyCallBack &aNotify,
-        RFs &aFs,
-        const TDesC &aFileName,
-        const TDesC8& aMimeType,
-        const TSize &aNewSize,
-        TKindOfScaling aKindOfScaling = CGraphicsSalingHandler::EIgnoreAspectRatio);
-
-protected:
-    void DoCancel();
-    void RunL();
-    TInt RunError(TInt);
-
-private:
-    void ConstructL(RFs &aFs, const TDesC &aFileName, const TDesC8& aMimeType);
-    CGraphicsSalingHandler(MImageReadyCallBack &aNotify,
-        const TSize &aNewSize,
-        TKindOfScaling aKindOfScaling = CGraphicsSalingHandler::EIgnoreAspectRatio);
-    TSize Scaling();
-
-private:
-    MImageReadyCallBack &mNotify;
-    CImageDecoder *mImageDecoder;
-    CFbsBitmap *mBitmapFromFile;
-    CFbsBitmap *mBitmapOutput;
-    CBitmapScaler *mBitmapScaler;
-    TSize mNewSize;
-    TBool mKindOfScaling;
-
-    TCurrentOperation mCurrentOperation;
-};
-
-#endif // ACTIVITYGRAPHICFILESSCALING_H
--- a/activityfw/activitydatabase/hsactivitydbserver/inc/activitythumbnailtask.h	Mon May 24 20:50:46 2010 +0300
+++ b/activityfw/activitydatabase/hsactivitydbserver/inc/activitythumbnailtask.h	Fri May 28 16:17:03 2010 +0300
@@ -27,7 +27,7 @@
 
 #include "activitytask.h"
 #include "activitytaskstorage.h"
-#include "activitygraphicfilescaling.h"
+#include "tsgraphicfilescalinghandler.h"
 
 class CFbsBitmap;
 
--- a/activityfw/activitydatabase/hsactivitydbserver/src/activitybroadcasttask.cpp	Mon May 24 20:50:46 2010 +0300
+++ b/activityfw/activitydatabase/hsactivitydbserver/src/activitybroadcasttask.cpp	Fri May 28 16:17:03 2010 +0300
@@ -27,5 +27,7 @@
     for (TInt iter(tasks.Count() - 1); iter >= 0 ; --iter ) {
         (tasks[iter])->BroadcastReceivedL(msg);
     }
-    msg.Complete(KErrNone);
+    if(EFalse == msg.IsNull()) {
+        msg.Complete(KErrNone);
+    }
 }
--- a/activityfw/activitydatabase/hsactivitydbserver/src/activitygraphicfilescaling.cpp	Mon May 24 20:50:46 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,212 +0,0 @@
-/*
- * 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 :
- *
- */
-#include "activitygraphicfilescaling.h"
-#include <imageconversion.h>
-
-
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-//
-CGraphicsSalingHandler::CGraphicsSalingHandler(MImageReadyCallBack &aNotify,
-                            const TSize &aNewSize,
-                            TKindOfScaling aKindOfScaling
-                            /* = CGraphicsSalingHandler::EIgnoreAspectRatio*/) :
-    CActive(EPriorityNormal),
-    mNotify(aNotify),
-    mNewSize(aNewSize),
-    mKindOfScaling(aKindOfScaling),
-    mCurrentOperation(ENone)
-{
-}
-
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-//
-CGraphicsSalingHandler::~CGraphicsSalingHandler()
-{
-    Cancel();
-    delete mBitmapFromFile;
-    delete mBitmapOutput;
-    delete mImageDecoder;
-    delete mBitmapScaler;
-}
-
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-//
-CGraphicsSalingHandler* CGraphicsSalingHandler::NewL(MImageReadyCallBack &aNotify,
-                                RFs &aFs,
-                                const TDesC &aFileName,
-                                const TDesC8& aMimeType,
-                                const TSize &aNewSize,
-                                TKindOfScaling aKindOfScaling
-                                /* = CGraphicsSalingHandler::EIgnoreAspectRatio*/)
-{
-    CGraphicsSalingHandler *self = CGraphicsSalingHandler::NewLC(aNotify,
-                                                                 aFs,
-                                                                 aFileName,
-                                                                 aMimeType,
-                                                                 aNewSize,
-                                                                 aKindOfScaling);
-    CleanupStack::Pop();
-    return self;
-}
-
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-//
-CGraphicsSalingHandler* CGraphicsSalingHandler::NewLC(MImageReadyCallBack &aNotify,
-                                RFs &aFs,
-                                const TDesC &aFileName,
-                                const TDesC8& aMimeType,
-                                const TSize &aNewSize,
-                                TKindOfScaling aKindOfScaling
-                                /* = CGraphicsSalingHandler::EIgnoreAspectRatio*/)
-{
-    CGraphicsSalingHandler *self = new (ELeave) CGraphicsSalingHandler(aNotify,
-                                                                       aNewSize,
-                                                                       aKindOfScaling);
-
-    
-
-    CleanupStack::PushL(self);
-    self->ConstructL(aFs, aFileName, aMimeType);
-    return self;
-}
-
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-//
-void CGraphicsSalingHandler::ConstructL(RFs &aFs, const TDesC &aFileName, const TDesC8& aMimeType)
-{
-    if (aFileName.Length() == 0
-        || aFs.IsValidName(aFileName) == EFalse) {
-        User::Leave(KErrPathNotFound);
-    }
-
-    if (aMimeType.Length() == 0) {
-        User::Leave(KErrBadName);
-    }
-
-    if(0>=mNewSize.iWidth || 0>=mNewSize.iHeight) {
-       User::Leave(KErrCorrupt);
-    }
-
-    CActiveScheduler::Add(this);
-
-    mBitmapScaler = CBitmapScaler::NewL();
-    mBitmapScaler->SetQualityAlgorithm(CBitmapScaler::EMaximumQuality);
-
-    // convert *.png to bitmap
-    mImageDecoder = CImageDecoder::FileNewL(aFs, aFileName, aMimeType);
-    mBitmapFromFile = new(ELeave)CFbsBitmap();
-    const TFrameInfo frameInfo(mImageDecoder->FrameInfo(0));
-    User::LeaveIfError(mBitmapFromFile->Create(frameInfo.iOverallSizeInPixels, 
-                                               frameInfo.iFrameDisplayMode));
-
-    mImageDecoder->Convert(&iStatus, *mBitmapFromFile, 0);
-    mCurrentOperation = EConvertBitmapFromFile;
-    SetActive();
-}
-
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-//
-void CGraphicsSalingHandler::DoCancel()
-{
-    switch (mCurrentOperation) {
-    case EConvertBitmapFromFile:
-        mImageDecoder->Cancel();
-        break;
-    case EScale:
-        mBitmapScaler->Cancel();
-        break;
-    }
-    mNotify.ImageReadyCallBack(KErrCancel, 0);
-}
-
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-//
-void CGraphicsSalingHandler::RunL()
-{
-    if(iStatus.Int()){
-        mNotify.ImageReadyCallBack(iStatus.Int(), 0);
-        return;
-    }
-
-    switch (mCurrentOperation) {
-    case EConvertBitmapFromFile: {
-            delete mImageDecoder;
-            mImageDecoder = 0;
-            
-            mBitmapOutput = new (ELeave)CFbsBitmap();
-            User::LeaveIfError(mBitmapOutput->Create(Scaling(), mBitmapFromFile->DisplayMode()));
-            mBitmapScaler->Scale(&iStatus, *mBitmapFromFile, *mBitmapOutput, EFalse);
-            mCurrentOperation = EScale;
-            SetActive();
-            break;
-        }
-    case EScale: {
-            mCurrentOperation = ENone;
-
-            delete mBitmapScaler;
-            mBitmapScaler = 0;
-            
-            delete mBitmapFromFile;
-            mBitmapFromFile = 0;
-
-            if (mKindOfScaling == CGraphicsSalingHandler::EKeepAspectRatioByExpanding) {
-                User::LeaveIfError(mBitmapOutput->Resize(mNewSize));
-            }
-
-            mNotify.ImageReadyCallBack(iStatus.Int(), mBitmapOutput);
-            break;
-        }
-    }
-}
-
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-//
-TSize CGraphicsSalingHandler::Scaling()
-{
-   TSize originalSize = mBitmapFromFile->SizeInPixels();
-   float widthFactor = mNewSize.iWidth / (float)originalSize.iWidth;
-   float heightFactor = mNewSize.iHeight / (float)originalSize.iHeight;
-
-   TSize retSize(mNewSize);
-
-   if (mKindOfScaling == CGraphicsSalingHandler::EKeepAspectRatio) {
-       retSize = (widthFactor < heightFactor) ?
-                 TSize(mNewSize.iWidth, widthFactor * originalSize.iHeight) :
-                 TSize(heightFactor * originalSize.iWidth, mNewSize.iHeight);
-   } else if (mKindOfScaling == CGraphicsSalingHandler::EKeepAspectRatioByExpanding) {
-      retSize = (widthFactor < heightFactor) ?
-                TSize(heightFactor * originalSize.iWidth, mNewSize.iHeight) :
-                TSize(mNewSize.iWidth, widthFactor * originalSize.iHeight);
-   }
-   return retSize;
-}
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-//
-TInt CGraphicsSalingHandler::RunError(TInt aError)
-{
-    mNotify.ImageReadyCallBack(aError, 0);
-    return KErrNone;
-}
--- a/activityfw/activitydatabase/hsactivitydbserver/src/activitythumbnailtask.cpp	Mon May 24 20:50:46 2010 +0300
+++ b/activityfw/activitydatabase/hsactivitydbserver/src/activitythumbnailtask.cpp	Fri May 28 16:17:03 2010 +0300
@@ -76,12 +76,12 @@
     mime.CreateL(mMsg.GetDesLengthL(3));
     mMsg.ReadL(3, mime);
 
-    mService = CGraphicsSalingHandler::NewL(*this, 
-                                            session, 
-                                            path, 
-                                            mime, 
-                                            TSize(width(), height()), 
-                                            CGraphicsSalingHandler::EKeepAspectRatio);
+    mService = CTsGraphicFileScalingHandler::NewL(*this, 
+                                    session, 
+                                    path, 
+                                    mime, 
+                                    TSize(width(), height()), 
+                                    CTsGraphicFileScalingHandler::EKeepAspectRatio);
     
     CleanupStack::PopAndDestroy(&mime);
     CleanupStack::PopAndDestroy(&path);
--- a/activityfw/activityserviceplugin/activityserviceplugin.pro	Mon May 24 20:50:46 2010 +0300
+++ b/activityfw/activityserviceplugin/activityserviceplugin.pro	Fri May 28 16:17:03 2010 +0300
@@ -21,8 +21,6 @@
 include(activityserviceplugin.pri)
 
 INCLUDEPATH += ./inc \
-             #../cautils/inc \
-             #../extinc \
 
 HEADERS +=  ./inc/activityserviceplugin.h \
             ./inc/activitydatastorage.h \
@@ -45,7 +43,7 @@
 
     SOURCES += ./s60/src/applicationlauncher_p.cpp
     
-    HEADERS += ./s60/src/applicationlauncher_p.h
+    HEADERS += ./s60/inc/applicationlauncher_p.h
 
     LIBS += -lapparc \
             -lapgrfx \
@@ -76,4 +74,8 @@
     xml.path = $$RESOURCE_FILES_DIR/activity
     
     DEPLOYMENT += xml
+
+    #temporary workaround
+    BLD_INF_RULES.prj_exports += "data/activityserviceplugin.xml z:/resource/activity/activityserviceplugin.xml"
+    
 }
--- a/activityfw/activityserviceplugin/src/activityclient.cpp	Mon May 24 20:50:46 2010 +0300
+++ b/activityfw/activityserviceplugin/src/activityclient.cpp	Fri May 28 16:17:03 2010 +0300
@@ -20,9 +20,7 @@
 
 ActivityClient::ActivityClient(QObject *parent) : QObject(parent)
 {
-    qDebug("[JCH] activity client creation started");
     d_ptr = new ActivityClientPrivate(this);
-    qDebug("[JCH] activity client creation stopped");
 }
 
 ActivityClient::~ActivityClient()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/orbitintegration/hbactivityplugin/hbactivityplugininterface.h	Fri May 28 16:17:03 2010 +0300
@@ -0,0 +1,51 @@
+/*
+* 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 HBACTIVITYPLUGININTERFACE_H
+#define HBACTIVITYPLUGININTERFACE_H
+
+#include <QtPlugin>
+#include <QObject>
+#include <QVariant>
+#include <QString>
+#include <QList>
+#include <QVariantHash>
+
+class HbActivityPluginInterface : public QObject
+{
+    Q_OBJECT
+
+public:
+    HbActivityPluginInterface(QObject *parent = 0) : QObject(parent) {}
+
+public:
+    virtual bool addActivity(const QString &activityId, const QVariant &data, const QVariantHash &parameters) = 0;
+    virtual bool removeActivity(const QString &activityId) = 0;
+    virtual bool updateActivity(const QString &activityId, const QVariant &data, const QVariantHash &parameters) = 0;
+    virtual QList<QVariantHash> activities() = 0;
+    virtual QVariant activityData(const QString &activityId) = 0;
+    virtual bool waitActivity() = 0;
+    virtual QVariantHash parseCommandLine(const QStringList &commandLineParams) = 0;
+
+signals:
+    void activityRequested(const QString &activityId);
+
+};
+
+Q_DECLARE_INTERFACE(HbActivityPluginInterface, "HbActivityPluginInterface/1.0")
+
+#endif // HBACTIVITYPLUGININTERFACE_H
--- a/activityfw/rom/activitymanager_core.iby	Mon May 24 20:50:46 2010 +0300
+++ b/activityfw/rom/activitymanager_core.iby	Fri May 28 16:17:03 2010 +0300
@@ -23,6 +23,7 @@
 file=ABI_DIR\BUILD_DIR\hsactivitydbserver.exe                            PROGRAMS_DIR\hsactivitydbserver.exe
 
 file=ABI_DIR\BUILD_DIR\hsactivitydbclient.dll					       SHARED_LIB_DIR\hsactivitydbclient.dll
+file=ABI_DIR\BUILD_DIR\tsutils.dll					       SHARED_LIB_DIR\tsutils.dll
 
 file=ABI_DIR\BUILD_DIR\hbactivityplugin.dll					       SHARED_LIB_DIR\hbactivityplugin.dll
 data=\epoc32\data\z\resource\qt\plugins\hbactivityplugin.qtplugin    resource\qt\plugins\hbactivityplugin.qtplugin
--- a/activityfw/sis/activitymanager.pkg	Mon May 24 20:50:46 2010 +0300
+++ b/activityfw/sis/activitymanager.pkg	Fri May 28 16:17:03 2010 +0300
@@ -32,6 +32,7 @@
 "/epoc32/release/armv5/urel/hsactivitydbserver.exe"    - "!:\sys\bin\hsactivitydbserver.exe"
 
 "/epoc32/release/armv5/urel/hsactivitydbclient.dll"    - "!:\sys\bin\hsactivitydbclient.dll"
+"/epoc32/release/armv5/urel/tsutils.dll"    - "!:\sys\bin\tsutils.dll"
 
 "/epoc32/release/armv5/urel/hbactivityplugin.dll"    - "!:\sys\bin\hbactivityplugin.dll"
 "/epoc32/data/z/resource/qt/plugins/hbactivityplugin.qtplugin"-"!:\resource\qt\plugins\hbactivityplugin.qtplugin"
--- a/activityfw/sis/stubs/activitymanager_stub.pkg	Mon May 24 20:50:46 2010 +0300
+++ b/activityfw/sis/stubs/activitymanager_stub.pkg	Fri May 28 16:17:03 2010 +0300
@@ -38,6 +38,7 @@
 ""    - "Z:\sys\bin\hsactivitydbserver.exe"
 
 ""    - "Z:\sys\bin\hsactivitydbclient.dll"
+""    - "Z:\sys\bin\tsutils.dll"
 
 ""    - "Z:\sys\bin\hbactivityplugin.dll"
 "" -  "Z:\resource\qt\plugins\hbactivityplugin.qtplugin"
\ No newline at end of file
Binary file activityfw/sis/stubs/activitymanager_stub.sis has changed
--- a/activityfw/tsutils/bwins/tsutilsu.def	Mon May 24 20:50:46 2010 +0300
+++ b/activityfw/tsutils/bwins/tsutilsu.def	Fri May 28 16:17:03 2010 +0300
@@ -1,5 +1,7 @@
 EXPORTS
 	?NewLC@CTsGraphicFileScalingHandler@@SAPAV1@AAVMImageReadyCallBack@@AAVRFs@@ABVTDesC16@@ABVTDesC8@@ABVTSize@@W4TKindOfScaling@1@@Z @ 1 NONAME ; class CTsGraphicFileScalingHandler * CTsGraphicFileScalingHandler::NewLC(class MImageReadyCallBack &, class RFs &, class TDesC16 const &, class TDesC8 const &, class TSize const &, enum CTsGraphicFileScalingHandler::TKindOfScaling)
 	?NewL@CTsGraphicFileScalingHandler@@SAPAV1@AAVMImageReadyCallBack@@AAVRFs@@ABVTDesC16@@ABVTDesC8@@ABVTSize@@W4TKindOfScaling@1@@Z @ 2 NONAME ; class CTsGraphicFileScalingHandler * CTsGraphicFileScalingHandler::NewL(class MImageReadyCallBack &, class RFs &, class TDesC16 const &, class TDesC8 const &, class TSize const &, enum CTsGraphicFileScalingHandler::TKindOfScaling)
-	??1CTsGraphicFileScalingHandler@@UAE@XZ @ 3 NONAME ; CTsGraphicFileScalingHandler::~CTsGraphicFileScalingHandler(void)
+	?NewLC@CTsGraphicFileScalingHandler@@SAPAV1@AAVMImageReadyCallBack@@ABVCFbsBitmap@@ABVTSize@@W4TKindOfScaling@1@@Z @ 3 NONAME ; class CTsGraphicFileScalingHandler * CTsGraphicFileScalingHandler::NewLC(class MImageReadyCallBack &, class CFbsBitmap const &, class TSize const &, enum CTsGraphicFileScalingHandler::TKindOfScaling)
+	?NewL@CTsGraphicFileScalingHandler@@SAPAV1@AAVMImageReadyCallBack@@ABVCFbsBitmap@@ABVTSize@@W4TKindOfScaling@1@@Z @ 4 NONAME ; class CTsGraphicFileScalingHandler * CTsGraphicFileScalingHandler::NewL(class MImageReadyCallBack &, class CFbsBitmap const &, class TSize const &, enum CTsGraphicFileScalingHandler::TKindOfScaling)
+	??1CTsGraphicFileScalingHandler@@UAE@XZ @ 5 NONAME ; CTsGraphicFileScalingHandler::~CTsGraphicFileScalingHandler(void)
 
--- a/activityfw/tsutils/eabi/tsutilsu.def	Mon May 24 20:50:46 2010 +0300
+++ b/activityfw/tsutils/eabi/tsutilsu.def	Fri May 28 16:17:03 2010 +0300
@@ -1,9 +1,11 @@
 EXPORTS
 	_ZN28CTsGraphicFileScalingHandler4NewLER19MImageReadyCallBackR3RFsRK7TDesC16RK6TDesC8RK5TSizeNS_14TKindOfScalingE @ 1 NONAME
-	_ZN28CTsGraphicFileScalingHandler5NewLCER19MImageReadyCallBackR3RFsRK7TDesC16RK6TDesC8RK5TSizeNS_14TKindOfScalingE @ 2 NONAME
-	_ZN28CTsGraphicFileScalingHandlerD0Ev @ 3 NONAME
-	_ZN28CTsGraphicFileScalingHandlerD1Ev @ 4 NONAME
-	_ZN28CTsGraphicFileScalingHandlerD2Ev @ 5 NONAME
-	_ZTI28CTsGraphicFileScalingHandler @ 6 NONAME
-	_ZTV28CTsGraphicFileScalingHandler @ 7 NONAME
+	_ZN28CTsGraphicFileScalingHandler4NewLER19MImageReadyCallBackRK10CFbsBitmapRK5TSizeNS_14TKindOfScalingE @ 2 NONAME
+	_ZN28CTsGraphicFileScalingHandler5NewLCER19MImageReadyCallBackR3RFsRK7TDesC16RK6TDesC8RK5TSizeNS_14TKindOfScalingE @ 3 NONAME
+	_ZN28CTsGraphicFileScalingHandler5NewLCER19MImageReadyCallBackRK10CFbsBitmapRK5TSizeNS_14TKindOfScalingE @ 4 NONAME
+	_ZN28CTsGraphicFileScalingHandlerD0Ev @ 5 NONAME
+	_ZN28CTsGraphicFileScalingHandlerD1Ev @ 6 NONAME
+	_ZN28CTsGraphicFileScalingHandlerD2Ev @ 7 NONAME
+	_ZTI28CTsGraphicFileScalingHandler @ 8 NONAME
+	_ZTV28CTsGraphicFileScalingHandler @ 9 NONAME
 
--- a/activityfw/tsutils/group/bld.inf	Mon May 24 20:50:46 2010 +0300
+++ b/activityfw/tsutils/group/bld.inf	Fri May 28 16:17:03 2010 +0300
@@ -18,7 +18,7 @@
 DEFAULT
 
 PRJ_EXPORTS
-../inc/tsgraphicfilescalinghandler.h
+../inc/tsgraphicfilescalinghandler.h |../../../inc/tsgraphicfilescalinghandler.h
 
 PRJ_MMPFILES
 tsutils.mmp
--- a/activityfw/tsutils/inc/tsgraphicfilescalinghandler.h	Mon May 24 20:50:46 2010 +0300
+++ b/activityfw/tsutils/inc/tsgraphicfilescalinghandler.h	Fri May 28 16:17:03 2010 +0300
@@ -31,31 +31,70 @@
 class CImageDecoder;
 class CFbsBitmap;
 
+/**
+ * Interface to observer contain
+ * ImageReadyCallBack function return error code and scaled/resized bitmap.
+ */
 class MImageReadyCallBack
 {
 public:
-    virtual void ImageReadyCallBack(TInt error, const CFbsBitmap *bitmap ) = 0;
+    virtual void ImageReadyCallBack(TInt error, const CFbsBitmap *bitmap) = 0;
 };
 
+/**
+ * Class to scaling graphic file/s.
+ */
 class CTsGraphicFileScalingHandler : public CActive
 {
 public:
+    /**
+     * Kind of graphic file scaling.
+     * EIgnoreAspectRatio          - the file is scaled to size, aspect ratio isn't preserving.
+     * EKeepAspectRatio            - the file is scaled to a rectangle as large as possible inside size
+     *                               preserving the aspect ratio.
+     * EKeepAspectRatioByExpanding - the file is scaled to a rectangle as small as possible outside size
+     *                               preserving the aspect ratio.
+     */
+    enum TKindOfScaling
+    {
+       EIgnoreAspectRatio = 0,
+       EKeepAspectRatio = 1,
+       EKeepAspectRatioByExpanding = 2,
+    };
 
-enum TCurrentOperation{
+private:
+    /**
+     * Active object current operation.
+     */
+    enum TCurrentOperation{
         ENone = 0,
         EConvertBitmapFromFile = 1,
         EScale = 2
     };
 
-enum TKindOfScaling
-{
-   EIgnoreAspectRatio = 0,
-   EKeepAspectRatio = 1,
-   EKeepAspectRatioByExpanding = 2,
-};
-
+public:
+    /**
+    * Destructor.
+    */
     IMPORT_C ~CTsGraphicFileScalingHandler();
 
+    /**
+     * All constructors initialise active object asynchronous operation
+     * by calling ConstructL function.
+     * 1st group - decoding and scaling.
+     * 2nd group - scaling.
+     */
+
+    /**
+     * 1st group.
+     * Exported from dll constructors for activation graphic file scaling.
+     * aNotify        - reference to observer implementation.
+     * aFs            - reference to file server session.
+     * aFileName      - path to graphic file.
+     * aMimeType      - mime type of graphic file.
+     * aNewSize       - new size of output graphic file.
+     * aKindOfScaling - kind of graphic file scaling described above.
+     */
     IMPORT_C static CTsGraphicFileScalingHandler* NewL(MImageReadyCallBack &aNotify,
         RFs &aFs,
         const TDesC &aFileName,
@@ -69,27 +108,103 @@
         const TSize &aNewSize,
         TKindOfScaling aKindOfScaling = CTsGraphicFileScalingHandler::EIgnoreAspectRatio);
 
+    /**
+     * 2nd group.
+     * Exported from dll constructors for activation graphic file scaling.
+     * aNotify         - reference to observer implementation.
+     * aImputFbsBitmap - reference to pattern CFbsBitmap.
+     * aNewSize        - new size of output graphic file.
+     * aKindOfScaling  - kind of graphic file scaling described above.
+     */
+    IMPORT_C static CTsGraphicFileScalingHandler* NewL(MImageReadyCallBack &aNotify,
+        const CFbsBitmap &aImputFbsBitmap,
+        const TSize &aNewSize,
+        TKindOfScaling aKindOfScaling = CTsGraphicFileScalingHandler::EIgnoreAspectRatio);
+     IMPORT_C static CTsGraphicFileScalingHandler* NewLC(MImageReadyCallBack &aNotify,
+        const CFbsBitmap &aImputFbsBitmap,
+        const TSize &aNewSize,
+        TKindOfScaling aKindOfScaling = CTsGraphicFileScalingHandler::EIgnoreAspectRatio);
+
 protected:
+     /**
+      * Cancels the wait for completion of an outstanding request.
+      */
     void DoCancel();
+    /**
+     * Handles an active object’s request completion event.
+     */
     void RunL();
+    /**
+     * Handles a leave occurring in the request completion event handler RunL().
+     */
     TInt RunError(TInt);
 
 private:
+    /**
+     * Functions construct active objest instance and made asynchronous operation/s.
+     * Parameters - the same meaning as in appropriate NewL/NewLC functions.
+     */
     void ConstructL(RFs &aFs, const TDesC &aFileName, const TDesC8& aMimeType);
+    void ConstructL(const CFbsBitmap &aImputFbsBitmap);
+    /**
+     * Private constructor.
+     * Parameters - the same meaning as in appropriate NewL/NewLC functions.
+     */
     CTsGraphicFileScalingHandler(MImageReadyCallBack &aNotify,
         const TSize &aNewSize,
         TKindOfScaling aKindOfScaling = CTsGraphicFileScalingHandler::EIgnoreAspectRatio);
-    TSize Scaling();
+    /**
+     * Action to made before decoding graphic file operation.
+     * Parameters - the same meaning as in appropriate NewL/NewLC functions.
+     */
+    void DecodingOperationL(RFs &aFs, const TDesC &aFileName, const TDesC8& aMimeType);
+    /**
+     * Action to made before scaling graphic file operation.
+     */
+    void ScalingOperationL();
+    /**
+     * Algorithm to determine output bitmap (returned in ImageReadyCallBack) size
+     * after scaling operation.
+     */
+    TSize NewSizeToScalingOperation();
+    /**
+     * Fix for TDisplayMode == EColor16MAP not supported by scaling operation!
+     * ! ! ! ADD OTHER NOT SUPPORTED DISPLAY MODES ! ! !
+     */
+    void FixForDisplayModeNotSupportedByScalingOperation();
 
 private:
+    /**
+     * Reference to observer implementation - return error code and output bitmap.
+     */
     MImageReadyCallBack &mNotify;
+    /**
+     * Pointer to decoder used by decoding graphic file algorithm.
+     */
     CImageDecoder *mImageDecoder;
-    CFbsBitmap *mBitmapFromFile;
-    CFbsBitmap *mBitmapOutput;
+    /**
+     * Pointer to input bitmap - before decoding/scaling operation/s.
+     */
+    CFbsBitmap *mInputBitmap;
+    /**
+     * Pointer to output bitmap - returned in mNotify object.
+     */
+    CFbsBitmap *mOutputBitmap;
+    /**
+     * Pointer to CBitmapScaler calss used by scaling graphic file algorithm.
+     */
     CBitmapScaler *mBitmapScaler;
+    /**
+     * New size of output graphic file.
+     */
     TSize mNewSize;
+    /**
+     * Kind of graphic file scaling described above.
+     */
     TBool mKindOfScaling;
-
+    /**
+     * Active object current operation.
+     */
     TCurrentOperation mCurrentOperation;
 };
 
--- a/activityfw/tsutils/src/tsgraphicfilescalinghandler.cpp	Mon May 24 20:50:46 2010 +0300
+++ b/activityfw/tsutils/src/tsgraphicfilescalinghandler.cpp	Fri May 28 16:17:03 2010 +0300
@@ -21,15 +21,16 @@
 // -----------------------------------------------------------------------------
 //
 CTsGraphicFileScalingHandler::CTsGraphicFileScalingHandler(MImageReadyCallBack &aNotify,
-                            const TSize &aNewSize,
-                            TKindOfScaling aKindOfScaling
-                            /* = CTsGraphicFileScalingHandler::EIgnoreAspectRatio*/) :
+                                const TSize &aNewSize,
+                                TKindOfScaling aKindOfScaling
+                                /* = CTsGraphicFileScalingHandler::EIgnoreAspectRatio*/) :
     CActive(EPriorityNormal),
     mNotify(aNotify),
     mNewSize(aNewSize),
     mKindOfScaling(aKindOfScaling),
     mCurrentOperation(ENone)
 {
+    CActiveScheduler::Add(this);
 }
 
 // -----------------------------------------------------------------------------
@@ -38,8 +39,8 @@
 EXPORT_C CTsGraphicFileScalingHandler::~CTsGraphicFileScalingHandler()
 {
     Cancel();
-    delete mBitmapFromFile;
-    delete mBitmapOutput;
+    delete mInputBitmap;
+    delete mOutputBitmap;
     delete mImageDecoder;
     delete mBitmapScaler;
 }
@@ -48,19 +49,19 @@
 // -----------------------------------------------------------------------------
 //
 EXPORT_C CTsGraphicFileScalingHandler* CTsGraphicFileScalingHandler::NewL(MImageReadyCallBack &aNotify,
-                                RFs &aFs,
-                                const TDesC &aFileName,
-                                const TDesC8& aMimeType,
-                                const TSize &aNewSize,
-                                TKindOfScaling aKindOfScaling
-                                /* = CTsGraphicFileScalingHandler::EIgnoreAspectRatio*/)
+                                                RFs &aFs,
+                                                const TDesC &aFileName,
+                                                const TDesC8& aMimeType,
+                                                const TSize &aNewSize,
+                                                TKindOfScaling aKindOfScaling
+                                                /* = CTsGraphicFileScalingHandler::EIgnoreAspectRatio*/)
 {
     CTsGraphicFileScalingHandler *self = CTsGraphicFileScalingHandler::NewLC(aNotify,
-                                                                 aFs,
-                                                                 aFileName,
-                                                                 aMimeType,
-                                                                 aNewSize,
-                                                                 aKindOfScaling);
+                                                                        aFs,
+                                                                        aFileName,
+                                                                        aMimeType,
+                                                                        aNewSize,
+                                                                        aKindOfScaling);
     CleanupStack::Pop();
     return self;
 }
@@ -69,16 +70,16 @@
 // -----------------------------------------------------------------------------
 //
 EXPORT_C CTsGraphicFileScalingHandler* CTsGraphicFileScalingHandler::NewLC(MImageReadyCallBack &aNotify,
-                                RFs &aFs,
-                                const TDesC &aFileName,
-                                const TDesC8& aMimeType,
-                                const TSize &aNewSize,
-                                TKindOfScaling aKindOfScaling
-                                /* = CTsGraphicFileScalingHandler::EIgnoreAspectRatio*/)
+                                                RFs &aFs,
+                                                const TDesC &aFileName,
+                                                const TDesC8& aMimeType,
+                                                const TSize &aNewSize,
+                                                TKindOfScaling aKindOfScaling
+                                                /* = CTsGraphicFileScalingHandler::EIgnoreAspectRatio*/)
 {
     CTsGraphicFileScalingHandler *self = new (ELeave) CTsGraphicFileScalingHandler(aNotify,
-                                                                       aNewSize,
-                                                                       aKindOfScaling);
+                                                                                aNewSize,
+                                                                                aKindOfScaling);
 
     CleanupStack::PushL(self);
     self->ConstructL(aFs, aFileName, aMimeType);
@@ -99,24 +100,63 @@
         User::Leave(KErrBadName);
     }
 
-    if(0>=mNewSize.iWidth || 0>=mNewSize.iHeight) {
+    if (0>=mNewSize.iWidth || 0>=mNewSize.iHeight) {
        User::Leave(KErrCorrupt);
     }
 
-    CActiveScheduler::Add(this);
+    mInputBitmap = new(ELeave)CFbsBitmap();
+    DecodingOperationL(aFs, aFileName, aMimeType);
+    SetActive();
+}
 
-    mBitmapScaler = CBitmapScaler::NewL();
-    mBitmapScaler->SetQualityAlgorithm(CBitmapScaler::EMaximumQuality);
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CTsGraphicFileScalingHandler* CTsGraphicFileScalingHandler::NewL(MImageReadyCallBack &aNotify,
+                                        const CFbsBitmap &aImputFbsBitmap,
+                                        const TSize &aNewSize,
+                                        TKindOfScaling aKindOfScaling
+                                        /* = CTsGraphicFileScalingHandler::EIgnoreAspectRatio*/)
+{
+    CTsGraphicFileScalingHandler *self = CTsGraphicFileScalingHandler::NewLC(aNotify,
+                                                                        aImputFbsBitmap,
+                                                                        aNewSize,
+                                                                        aKindOfScaling);
+    CleanupStack::Pop();
+    return self;
+}
 
-    // convert *.png to bitmap
-    mImageDecoder = CImageDecoder::FileNewL(aFs, aFileName, aMimeType);
-    mBitmapFromFile = new(ELeave)CFbsBitmap();
-    const TFrameInfo frameInfo(mImageDecoder->FrameInfo(0));
-    User::LeaveIfError(mBitmapFromFile->Create(frameInfo.iOverallSizeInPixels, 
-                                               frameInfo.iFrameDisplayMode));
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CTsGraphicFileScalingHandler* CTsGraphicFileScalingHandler::NewLC(MImageReadyCallBack &aNotify,
+                                                const CFbsBitmap &aImputFbsBitmap,
+                                                const TSize &aNewSize,
+                                                TKindOfScaling aKindOfScaling
+                                                /* = CTsGraphicFileScalingHandler::EIgnoreAspectRatio*/)
+{
+    CTsGraphicFileScalingHandler *self = new (ELeave) CTsGraphicFileScalingHandler(aNotify,
+                                                                                aNewSize,
+                                                                                aKindOfScaling);
 
-    mImageDecoder->Convert(&iStatus, *mBitmapFromFile, 0);
-    mCurrentOperation = EConvertBitmapFromFile;
+    CleanupStack::PushL(self);
+    self->ConstructL(aImputFbsBitmap);
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+//
+void CTsGraphicFileScalingHandler::ConstructL(const CFbsBitmap &aImputFbsBitmap)
+{
+    if (0>=mNewSize.iWidth || 0>=mNewSize.iHeight) {
+       User::Leave(KErrCorrupt);
+    }
+
+    mInputBitmap = new(ELeave)CFbsBitmap();
+    User::LeaveIfError(mInputBitmap->Duplicate(aImputFbsBitmap.Handle()));
+
+    ScalingOperationL();
     SetActive();
 }
 
@@ -147,11 +187,8 @@
     case EConvertBitmapFromFile: {
             delete mImageDecoder;
             mImageDecoder = 0;
-            
-            mBitmapOutput = new (ELeave)CFbsBitmap();
-            User::LeaveIfError(mBitmapOutput->Create(Scaling(), mBitmapFromFile->DisplayMode()));
-            mBitmapScaler->Scale(&iStatus, *mBitmapFromFile, *mBitmapOutput, EFalse);
-            mCurrentOperation = EScale;
+
+            ScalingOperationL();
             SetActive();
             break;
         }
@@ -161,14 +198,14 @@
             delete mBitmapScaler;
             mBitmapScaler = 0;
             
-            delete mBitmapFromFile;
-            mBitmapFromFile = 0;
+            delete mInputBitmap;
+            mInputBitmap = 0;
 
             if (mKindOfScaling == CTsGraphicFileScalingHandler::EKeepAspectRatioByExpanding) {
-                User::LeaveIfError(mBitmapOutput->Resize(mNewSize));
+                User::LeaveIfError(mOutputBitmap->Resize(mNewSize));
             }
 
-            mNotify.ImageReadyCallBack(iStatus.Int(), mBitmapOutput);
+            mNotify.ImageReadyCallBack(iStatus.Int(), mOutputBitmap);
             break;
         }
     }
@@ -177,9 +214,51 @@
 // -----------------------------------------------------------------------------
 // -----------------------------------------------------------------------------
 //
-TSize CTsGraphicFileScalingHandler::Scaling()
+void CTsGraphicFileScalingHandler::DecodingOperationL(RFs &aFs, const TDesC &aFileName, const TDesC8& aMimeType)
+{
+    // convert *.png to bitmap
+    mImageDecoder = CImageDecoder::FileNewL(aFs, aFileName, aMimeType);
+    const TFrameInfo frameInfo(mImageDecoder->FrameInfo(0));
+    mInputBitmap->Reset();
+    User::LeaveIfError(mInputBitmap->Create(frameInfo.iOverallSizeInPixels, 
+                                               frameInfo.iFrameDisplayMode));
+
+    mImageDecoder->Convert(&iStatus, *mInputBitmap, 0);
+    mCurrentOperation = EConvertBitmapFromFile;
+}
+
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+//
+void CTsGraphicFileScalingHandler::ScalingOperationL()
 {
-   TSize originalSize = mBitmapFromFile->SizeInPixels();
+    mBitmapScaler = CBitmapScaler::NewL();
+    mBitmapScaler->SetQualityAlgorithm(CBitmapScaler::EMaximumQuality);
+
+    FixForDisplayModeNotSupportedByScalingOperation();
+
+    mOutputBitmap = new (ELeave)CFbsBitmap();
+    User::LeaveIfError(mOutputBitmap->Create(NewSizeToScalingOperation(), mInputBitmap->DisplayMode()));
+    mBitmapScaler->Scale(&iStatus, *mInputBitmap, *mOutputBitmap, EFalse);
+    mCurrentOperation = EScale;
+}
+
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+//
+void CTsGraphicFileScalingHandler::FixForDisplayModeNotSupportedByScalingOperation()
+{
+    if (EColor16MAP == mInputBitmap->DisplayMode()) {
+        mInputBitmap->SetDisplayMode(EColor16MA);
+    }
+}
+
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+//
+TSize CTsGraphicFileScalingHandler::NewSizeToScalingOperation()
+{
+   TSize originalSize = mInputBitmap->SizeInPixels();
    float widthFactor = mNewSize.iWidth / (float)originalSize.iWidth;
    float heightFactor = mNewSize.iHeight / (float)originalSize.iHeight;
 
--- a/contentstorage/caclient/inc/caclient_defines.h	Mon May 24 20:50:46 2010 +0300
+++ b/contentstorage/caclient/inc/caclient_defines.h	Fri May 28 16:17:03 2010 +0300
@@ -15,9 +15,14 @@
  *
  */
 
+#ifndef CACLIENT_DEFINES_H
+#define CACLIENT_DEFINES_H
+
 const char APPLICATION_UID_ATTRIBUTE_NAME[]  = "application:uid";
 const char APPLICATION_ENTRY_TYPE_NAME[] = "application";
 const char WIDGET_ENTRY_TYPE_NAME[] = "widget";
 const char URL_ENTRY_TYPE_NAME[] = "url";
 const char PACKAGE_ENTRY_TYPE_NAME[] = "package";
 const char TEMPLATED_APPLICATION_ENTRY_TYPE_NAME[] = "templatedApplication";
+
+#endif //CACLIENT_DEFINES_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contentstorage/caclient/inc/cahandler.h	Fri May 28 16:17:03 2010 +0300
@@ -0,0 +1,37 @@
+/*
+ * 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 CAHANDLER_H
+#define CAHANDLER_H
+
+#include <QObject>
+#include <cadefs.h>
+#include <caclient_global.h>
+
+class QString;
+class CaEntry;
+
+class CaHandler // move this header to caclient/inc
+{
+public:
+    virtual ~CaHandler() {}
+    virtual int execute(const CaEntry &entry,
+                        const QString &commandName) = 0;
+};
+
+Q_DECLARE_INTERFACE(CaHandler, "com.nokia.homescreen.ICommandHandler")
+
+#endif //CAHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contentstorage/caclient/inc/cahandlerloader.h	Fri May 28 16:17:03 2010 +0300
@@ -0,0 +1,32 @@
+/*
+ * 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 CAHANDLERLOADER_H
+#define CAHANDLERLOADER_H
+
+class QString;
+class CaHandler;
+
+class CaHandlerLoader
+{
+public:
+    virtual ~CaHandlerLoader();
+    virtual CaHandler *loadHandler(const QString &entryTypeName,
+                                   const QString &commandName) = 0;
+};
+
+#endif // CAHANDLERLOADER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contentstorage/caclient/inc/cahandlerproxy.h	Fri May 28 16:17:03 2010 +0300
@@ -0,0 +1,52 @@
+/*
+ * 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 CAHANDLERPROXY_H
+#define CAHANDLERPROXY_H
+
+#include <QMap>
+#include <QString>
+#include <QSharedPointer>
+
+#include <cadefs.h>
+
+#include "cahandlerloader.h"
+
+class CaEntry;
+
+class CaHandlerProxy
+{
+public:
+
+    ~CaHandlerProxy();
+
+    explicit CaHandlerProxy(const QSharedPointer<CaHandlerLoader> &loader);
+
+    ErrorCode execute(const CaEntry &entry, const QString &commandName);
+
+private:
+    CaHandler *getHandler(const CaEntry &entry,
+                          const QString &commandName);
+
+    typedef QMap<QString, QSharedPointer<CaHandler> > ImplementationMap;
+    typedef ImplementationMap::iterator ImplementationMapIterator;
+
+    QSharedPointer<CaHandlerLoader> mLoader;
+    ImplementationMap mImplementationMap;
+};
+
+#endif // CAHANDLERPROXY_H
--- a/contentstorage/caclient/inc/caitemmodel_p.h	Mon May 24 20:50:46 2010 +0300
+++ b/contentstorage/caclient/inc/caitemmodel_p.h	Fri May 28 16:17:03 2010 +0300
@@ -84,6 +84,7 @@
     void connectSlots();
     void disconnectSlots();
     void reconnectSlots();
+    void emitEmpty(int previousCount);
 
 private slots:
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contentstorage/caclient/inc/caqtsfhandlerloader.h	Fri May 28 16:17:03 2010 +0300
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies 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 CA_QT_SF_HANDLER_LOADER_H
+#define CA_QT_SF_HANDLER_LOADER_H
+
+#include <QMap>
+#include <QString>
+#include <QScopedPointer>
+
+#include "cahandlerloader.h"
+
+class CaQtSfHandlerLoader:
+    public CaHandlerLoader
+{
+public:
+    CaQtSfHandlerLoader();
+    CaHandler *loadHandler(const QString &entryTypeName,
+                           const QString &commandName);
+protected:
+    void registerPlugins() const;
+};
+
+#endif
--- a/contentstorage/caclient/inc/caservice_p.h	Mon May 24 20:50:46 2010 +0300
+++ b/contentstorage/caclient/inc/caservice_p.h	Fri May 28 16:17:03 2010 +0300
@@ -27,6 +27,7 @@
 class CaService;
 class CaNotifier;
 class CaClientNotifierProxy;
+class CaHandlerProxy;
 
 class CaServicePrivate
 {
@@ -69,6 +70,9 @@
 
     CaService *const m_q;
 
+    // Command handler.
+    QSharedPointer<CaHandlerProxy> mCommandHandler;
+
     CaClientProxy *mProxy;
  
     CaClientNotifierProxy *mNotifierProxy;
--- a/contentstorage/caclient/s60/inc/cabitmapadapter.h	Mon May 24 20:50:46 2010 +0300
+++ b/contentstorage/caclient/s60/inc/cabitmapadapter.h	Fri May 28 16:17:03 2010 +0300
@@ -43,13 +43,6 @@
     static CFbsBitmap *copyBitmapLC(CFbsBitmap *input);
     
     /**
-     * Convert bitmap
-     * @param input bitmap.
-     * @return qPixmap.
-     */
-    static QPixmap fromSymbianCFbsBitmap(CFbsBitmap *aBitmap);
-    
-    /**
      * Convert from bitmap and mask to qpixmap
      * @param input bitmap.
      * @param pixmap to prepare.
--- a/contentstorage/caclient/s60/inc/caclientproxy.h	Mon May 24 20:50:46 2010 +0300
+++ b/contentstorage/caclient/s60/inc/caclientproxy.h	Fri May 28 16:17:03 2010 +0300
@@ -130,16 +130,6 @@
                           QList<int> &sourceIdList);
 
     /**
-     * Method for executing command
-     *
-     * @param entry entry on wchich command will be executed
-     * @param command command to execute
-     * @return error code
-     */
-    ErrorCode executeCommand(const CaEntry &entry,
-                             const QString &command);
-
-    /**
      * Method for touching entry.
      *
      * @param aEntry entry to touch
@@ -235,9 +225,6 @@
     // Own.
     RCaClientSession mSession;
 
-    // Command handler.
-    QSharedPointer<CaHandlerProxy> mCommandHandler;
-
     // Mutex to serialize access to mSessions.
     QMutex mMutex;
 };
--- a/contentstorage/caclient/s60/inc/cahandler.h	Mon May 24 20:50:46 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * 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 CA_HANDLER_H
-#define CA_HANDLER_H
-
-#include <QObject>
-#include <cadefs.h>
-#include <caclient_global.h>
-
-class CCaInnerEntry;
-class QString;
-
-class CaHandler
-{
-public:
-    virtual ~CaHandler() {}
-    virtual int execute(CCaInnerEntry &innerEntry,
-                        const QString &commandName) = 0;
-};
-
-Q_DECLARE_INTERFACE(CaHandler, "com.nokia.homescreen.ICommandHandler")
-
-#endif
--- a/contentstorage/caclient/s60/inc/cahandlerloader.h	Mon May 24 20:50:46 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
- * 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 CA_HANDLER_LOADER_H
-#define CA_HANDLER_LOADER_H
-
-#include <caclient_global.h>
-
-class QString;
-class CaHandler;
-
-class CaHandlerLoader
-{
-public:
-    virtual ~CaHandlerLoader();
-    virtual CaHandler *loadHandler(const QString &entryTypeName,
-                                   const QString &commandName) = 0;
-};
-
-#endif
--- a/contentstorage/caclient/s60/inc/cahandlerproxy.h	Mon May 24 20:50:46 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
- * 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 CA_HANDLER_PROXY_H
-#define CA_HANDLER_PROXY_H
-
-#include <e32def.h>
-#include <QMap>
-#include <QString>
-#include <QSharedPointer>
-#include <cadefs.h>
-
-#include "cahandlerloader.h"
-
-class CaEntry;
-
-class CaHandlerProxy
-{
-public:
-
-    ~CaHandlerProxy();
-
-    explicit CaHandlerProxy(CaHandlerLoader *loader);
-
-    TInt execute(const CaEntry &entry, const QString &commandName);
-
-private:
-    CaHandler *getHandler(const CaEntry &entry,
-                          const QString &commandName);
-
-    typedef QMap<QString, QSharedPointer<CaHandler> > ImplementationMap;
-    typedef ImplementationMap::iterator ImplementationMapIterator;
-
-    QSharedPointer<CaHandlerLoader> mLoader;
-    ImplementationMap mImplementationMap;
-};
-
-#endif
--- a/contentstorage/caclient/s60/inc/caqtsfhandlerloader.h	Mon May 24 20:50:46 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/*
- * 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 CA_QT_SF_HANDLER_LOADER_H
-#define CA_QT_SF_HANDLER_LOADER_H
-
-#include <QMap>
-#include <QString>
-#include <QScopedPointer>
-
-#include "cahandlerloader.h"
-
-class CaQtSfHandlerLoader:
-    public CaHandlerLoader
-{
-public:
-    CaQtSfHandlerLoader();
-    CaHandler *loadHandler(const QString &entryTypeName,
-                           const QString &commandName);
-protected:
-    void registerPlugins() const;
-};
-
-#endif
--- a/contentstorage/caclient/s60/src/cabitmapadapter.cpp	Mon May 24 20:50:46 2010 +0300
+++ b/contentstorage/caclient/s60/src/cabitmapadapter.cpp	Fri May 28 16:17:03 2010 +0300
@@ -31,60 +31,6 @@
 #include "cadef.h"
 #include "cabitmapadapter.h"
 
-static QImage::Format TDisplayMode2Format(TDisplayMode mode)
-{
-    QImage::Format format;
-    switch (mode) {
-    case EGray2:
-        format = QImage::Format_MonoLSB;
-        break;
-    case EColor256:
-    case EGray256:
-        format = QImage::Format_Indexed8;
-        break;
-    case EColor4K:
-        format = QImage::Format_RGB444;
-        break;
-    case EColor64K:
-        format = QImage::Format_RGB16;
-        break;
-    case EColor16M:
-        format = QImage::Format_RGB888;
-        break;
-    case EColor16MU:
-        format = QImage::Format_RGB32;
-        break;
-    case EColor16MA:
-        format = QImage::Format_ARGB32;
-        break;
-    case EColor16MAP:
-        format = QImage::Format_ARGB32_Premultiplied;
-        break;
-    default:
-        format = QImage::Format_Invalid;
-        break;
-    }
-    return format;
-}
-
-QPixmap CaBitmapAdapter::fromSymbianCFbsBitmap(CFbsBitmap *aBitmap)
-{
-    aBitmap->BeginDataAccess();
-    uchar *data = (uchar *)aBitmap->DataAddress();
-    TSize size = aBitmap->SizeInPixels();
-    TDisplayMode displayMode = aBitmap->DisplayMode();
-
-    // QImage format must match to bitmap format
-    QImage image(data, size.iWidth, size.iHeight, TDisplayMode2Format(
-        displayMode));
-    aBitmap->EndDataAccess();
-
-    // No data copying happens because
-    // image format matches native OpenVG format.
-    // So QPixmap actually points to CFbsBitmap data.
-    return QPixmap::fromImage(image);
-}
-
 // -----------------------------------------------------------------------------
 // copying compressed bitmap
 //----------------------------------------------------------------------------
@@ -108,17 +54,19 @@
         CFbsBitmap* fbsMask, QPixmap& pixmap)
 {
     if (fbsBitmap->Header().iCompression == ENoBitmapCompression) {
-        pixmap = CaBitmapAdapter::fromSymbianCFbsBitmap(fbsBitmap);
-        QPixmap mask = CaBitmapAdapter::fromSymbianCFbsBitmap(fbsMask);
+        pixmap = pixmap.fromSymbianCFbsBitmap(fbsBitmap);
+        QPixmap mask;
+        mask = mask.fromSymbianCFbsBitmap(fbsMask);
         pixmap.setAlphaChannel(mask);
     } else { // we need special handling for icons in 9.2 (NGA)
         // let's hope that in future it will be in QT code
         CFbsBitmap *temp(NULL);
         temp = CaBitmapAdapter::copyBitmapLC(fbsBitmap);
-        pixmap = CaBitmapAdapter::fromSymbianCFbsBitmap(temp);
+        pixmap = pixmap.fromSymbianCFbsBitmap(temp);
         CleanupStack::PopAndDestroy();
         temp = CaBitmapAdapter::copyBitmapLC(fbsMask);
-        QPixmap mask = CaBitmapAdapter::fromSymbianCFbsBitmap(temp);
+        QPixmap mask;
+        mask = mask.fromSymbianCFbsBitmap(temp);
         CleanupStack::PopAndDestroy();
         pixmap.setAlphaChannel(mask);
     }
--- a/contentstorage/caclient/s60/src/caclientproxy.cpp	Mon May 24 20:50:46 2010 +0300
+++ b/contentstorage/caclient/s60/src/caclientproxy.cpp	Fri May 28 16:17:03 2010 +0300
@@ -38,8 +38,7 @@
 //----------------------------------------------------------------------------
 //
 //----------------------------------------------------------------------------
-CaClientProxy::CaClientProxy():
-    mCommandHandler(new CaHandlerProxy(new CaQtSfHandlerLoader()))
+CaClientProxy::CaClientProxy()
 {
 }
 
@@ -169,20 +168,6 @@
 //----------------------------------------------------------------------------
 //
 //----------------------------------------------------------------------------
-ErrorCode CaClientProxy::executeCommand(const CaEntry &entry,
-                                        const QString &command)
-{
-    TInt error = mCommandHandler->execute(entry, command);
-
-    USE_QDEBUG_IF(error) << "CaClientProxy::executeCommand - Error ("
-                         << error << ")";
-
-    return CaObjectAdapter::convertErrorCode(error);
-}
-
-//----------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------
 ErrorCode CaClientProxy::touch(const CaEntry &aEntry)
 {
     TRAPD(error, touchL(aEntry));
--- a/contentstorage/caclient/s60/src/cahandlerloader.cpp	Mon May 24 20:50:46 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
- * 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:
- *
- */
-
-#include <QString>
-#include "cahandlerloader.h"
-
-/*!
-    \class CaHandlerLoader
-    \ingroup 
-    \brief Interface for class of objects providing command handlers.
-
-    \sa CaHandlerLoader
-*/
-
-/*!
-    Destructor.
-*/
-CaHandlerLoader::~CaHandlerLoader()
-{
-}
-
-
--- a/contentstorage/caclient/s60/src/cahandlerproxy.cpp	Mon May 24 20:50:46 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-/*
- * 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:
- *
- */
-
-#include <caentry.h>
-#include "cahandler.h"
-#include "cahandlerproxy.h"
-#include "cahandlerloader.h"
-#include "cainnerentry.h"
-#include "caobjectadapter.h"
-
-/*!
-    \class CaHandlerProxy
-    \ingroup
-    \brief Forwards execute request to an implemenation provided by specific handler loader.
-
-    \sa CaHandlerLoader
-*/
-
-/*!
-  Destructor.
-*/
-CaHandlerProxy::~CaHandlerProxy()
-{
-}
-
-
-/*!
-  Constructs handler proxy.
-  \param loader Provides handler implementations. It has to be pointer to a valid object.
-*/
-CaHandlerProxy::CaHandlerProxy(CaHandlerLoader *loader):
-    mLoader(loader)
-{
-    Q_ASSERT(!mLoader.isNull());
-}
-
-/*!
-  Forwards execute request to an appropriate handler if found otherwise ignores the request.
-  \param entry Subject for the requested command.
-  \param commandName Name of the command to be executed.
-  \return KErrNone (i.e. 0) on succes, error code otherwise.
-  \sa e32err.h for KErrNone definition.
-*/
-TInt CaHandlerProxy::execute(const CaEntry &entry, const QString &commandName)
-{
-    CaHandler *const handler = getHandler(entry, commandName);
-
-    TInt result = KErrNotFound;
-
-    if (handler != NULL) {
-        QScopedPointer<CCaInnerEntry> innerEntry(NULL);
-        TRAP(result,
-            innerEntry.reset(CCaInnerEntry::NewL());
-            CaObjectAdapter::convertL(entry, *innerEntry);
-            )
-        if (result == KErrNone) {
-            result = handler->execute(*innerEntry, commandName);
-        }
-    }
-    return result;
-}
-
-/*!
-  Looks for handler implementation in local cache or if not found, request it from
-  handler loader.
-  \param entry The entry being a subject for the requested command.
-  \param commandName Name of the command to be executed.
-  \return Pointer to a handler instance if available, NULL otherwise.
-*/
-CaHandler *CaHandlerProxy::getHandler(const CaEntry &entry,
-                                      const QString &commandName)
-{
-    CaHandler *implementation(0);
-
-    const QString entryTypeName(entry.entryTypeName());
-
-    const ImplementationMapIterator it(
-        mImplementationMap.find(entryTypeName));
-
-    if (it != mImplementationMap.end()) {
-        implementation = it->data();
-    } else {
-        implementation = mLoader->loadHandler(entryTypeName, commandName);
-        mImplementationMap[entryTypeName] = QSharedPointer<CaHandler>(implementation);
-    }
-
-    return implementation;
-}
--- a/contentstorage/caclient/s60/src/camenuiconutility.cpp	Mon May 24 20:50:46 2010 +0300
+++ b/contentstorage/caclient/s60/src/camenuiconutility.cpp	Fri May 28 16:17:03 2010 +0300
@@ -240,7 +240,7 @@
     if (entry.entryTypeName() == XQConversions::s60DescToQString(
             KCaTypeWidget)) {
         icon.addBadge(Qt::AlignBottom | Qt::AlignLeft,
-		    HbIcon("qtg_small_hs_widget"));
+		    HbIcon("qtg_small_homescreen"));
     }
     return icon;
 }
--- a/contentstorage/caclient/s60/src/caqtsfhandlerloader.cpp	Mon May 24 20:50:46 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
-/*
- * 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:
- *
- */
-
-#include <QApplication>
-#include <QDir>
-#include <QMap>
-#include <QScopedPointer>
-#include <QString>
-#include <qservice.h>
-#include <qstringlist.h>
-#include <qservicemanager.h>
-
-#include "cahandler.h"
-#include "caqtsfhandlerloader.h"
-#include "caclient_defines.h"
-
-QTM_USE_NAMESPACE
-
-/*!
-    \class CaQtSfHandlerLoader
-    \ingroup
-    \brief Loads handlers implementation
-
-    The purpose of the class is to find Qt SF plugins implementing command handlers.
-    Temporarily because of issues with Qt SF this is replaced by immediate object
-    creation.
-    \sa CaHandlerLoader
-*/
-
-/*!
-    Constructor.
-*/
-CaQtSfHandlerLoader::CaQtSfHandlerLoader()
-{
-    registerPlugins();
-}
-
-/*!
-    Load plugins for command handling.
-*/
-void CaQtSfHandlerLoader::registerPlugins() const
-{
-    const QString pluginPath("hsresources/plugins/commandhandler");
-    const QFileInfoList drives = QDir::drives();
-    
-    foreach(QFileInfo drive, drives) {
-        const QString driveLetter = drive.absolutePath();
-        const QString pluginAbsolutePath = driveLetter + pluginPath;
-        const QDir pluginDir(pluginAbsolutePath);
-        if(QDir(pluginDir).exists()) {
-            const QFileInfoList fileInfos = 
-                pluginDir.entryInfoList(QStringList("*.xml"));
-            
-            QApplication::addLibraryPath(pluginAbsolutePath);
-            
-            QServiceManager serviceManager;
-            foreach(QFileInfo fileInfo, fileInfos) {
-                serviceManager.addService(fileInfo.absoluteFilePath());
-            }
-        }
-    }
-}
-
-/*!
-    Loads handler implementations appropriate for the requested entry type name and command.
-
-    The caller takes ownership of the returned pointer.
-
-    \param entryTypeName Entry type name.
-    \param commandName Name of the command to be handled.
-    \return A pointer to handler serving the entry type and command if found, NULL otherwise.
-*/
-CaHandler *CaQtSfHandlerLoader::loadHandler(const QString &entryTypeName,
-        const QString &commandName)
-{
-    Q_UNUSED(commandName);
-
-    QString typeName(entryTypeName);
-    if (entryTypeName == WIDGET_ENTRY_TYPE_NAME
-        || entryTypeName == PACKAGE_ENTRY_TYPE_NAME) {
-        typeName = QString(APPLICATION_ENTRY_TYPE_NAME);
-    }
-
-    QServiceManager serviceManager;
-    QServiceFilter serviceFilter("com.nokia.homescreen.ICommandHandler");
-    serviceFilter.setCustomAttribute("entryTypeName", typeName);
-    QList<QServiceInterfaceDescriptor> serviceInterfaceDescriptorList =
-        serviceManager.findInterfaces(serviceFilter);
-    CaHandler *interfaceHandler = NULL;
-    if (!serviceInterfaceDescriptorList.isEmpty()) {
-        QServiceInterfaceDescriptor serviceInterfaceDescriptor =
-            serviceInterfaceDescriptorList[0];
-         QObject *handler =
-            serviceManager.loadInterface(serviceInterfaceDescriptor);
-         interfaceHandler = qobject_cast<CaHandler *>(handler);
-    }
-    return interfaceHandler;
-}
-
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contentstorage/caclient/src/cahandlerloader.cpp	Fri May 28 16:17:03 2010 +0300
@@ -0,0 +1,36 @@
+/*
+ * 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:
+ *
+ */
+
+#include <QString>
+#include "cahandlerloader.h"
+
+/*!
+    \class CaHandlerLoader
+    \ingroup 
+    \brief Interface for class of objects providing command handlers.
+
+    \sa CaHandlerLoader
+*/
+
+/*!
+    Destructor.
+*/
+CaHandlerLoader::~CaHandlerLoader()
+{
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contentstorage/caclient/src/cahandlerproxy.cpp	Fri May 28 16:17:03 2010 +0300
@@ -0,0 +1,95 @@
+/*
+ * 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:
+ *
+ */
+
+#include <caentry.h>
+
+#include "cahandler.h"
+#include "cahandlerproxy.h"
+#include "cahandlerloader.h"
+#include "caobjectadapter.h"
+
+/*!
+    \class CaHandlerProxy
+    \ingroup
+    \brief Forwards execute request to an implemenation provided by specific handler loader.
+
+    \sa CaHandlerLoader
+*/
+
+/*!
+  Destructor.
+*/
+CaHandlerProxy::~CaHandlerProxy()
+{
+}
+
+
+/*!
+  Constructs handler proxy.
+  \param loader Provides handler implementations. It has to be pointer to a valid object.
+*/
+CaHandlerProxy::CaHandlerProxy(const QSharedPointer<CaHandlerLoader> &loader):
+    mLoader(loader)
+{
+    Q_ASSERT(!mLoader.isNull());
+}
+
+/*!
+  Forwards execute request to an appropriate handler if found otherwise ignores the request.
+  \param entry Subject for the requested command.
+  \param commandName Name of the command to be executed.
+  \return KErrNone (i.e. 0) on succes, error code otherwise.
+  \sa e32err.h for KErrNone definition.
+*/
+ErrorCode CaHandlerProxy::execute(const CaEntry &entry, const QString &commandName)
+{
+    CaHandler *const handler = getHandler(entry, commandName);
+    ErrorCode result = NotFoundErrorCode;
+
+    if (handler) {
+            result = CaObjectAdapter::convertErrorCode(
+                handler->execute(entry, commandName));
+    }
+    return result;
+}
+
+/*!
+  Looks for handler implementation in local cache or if not found, request it from
+  handler loader.
+  \param entry The entry being a subject for the requested command.
+  \param commandName Name of the command to be executed.
+  \return Pointer to a handler instance if available, NULL otherwise.
+*/
+CaHandler *CaHandlerProxy::getHandler(const CaEntry &entry,
+                                      const QString &commandName)
+{
+    CaHandler *implementation(0);
+
+    const QString entryTypeName(entry.entryTypeName());
+
+    const ImplementationMapIterator it(
+        mImplementationMap.find(entryTypeName));
+
+    if (it != mImplementationMap.end()) {
+        implementation = it->data();
+    } else {
+        implementation = mLoader->loadHandler(entryTypeName, commandName);
+        mImplementationMap[entryTypeName] = QSharedPointer<CaHandler>(implementation);
+    }
+
+    return implementation;
+}
--- a/contentstorage/caclient/src/caitemmodel.cpp	Mon May 24 20:50:46 2010 +0300
+++ b/contentstorage/caclient/src/caitemmodel.cpp	Fri May 28 16:17:03 2010 +0300
@@ -955,6 +955,7 @@
 void CaItemModelPrivate::updateModelItem(int id, ChangeType changeType)
 {
     CACLIENTTEST_FUNC_ENTRY("CaItemModelPrivate::updateModelItem");
+    int previousCount = rowCount();
     switch (changeType) {
     case AddChangeType:
         addItem(id);
@@ -966,6 +967,7 @@
         updateItemData(id);
         break;
     }
+    emitEmpty(previousCount);
     CACLIENTTEST_FUNC_EXIT("CaItemModelPrivate::updateModelItem");
 }
 
@@ -976,6 +978,8 @@
 void CaItemModelPrivate::updateModelContent(int id)
 {
     Q_UNUSED(id);
+    int previousCount = rowCount();
+
     CACLIENTTEST_FUNC_ENTRY("CaItemModelPrivate::updateModelContent");
     QList<int> ids = mService->getEntryIds(mQuery);
 
@@ -984,5 +988,20 @@
     } else {
         removeItems(ids);
     }
+    emitEmpty(previousCount);
     CACLIENTTEST_FUNC_EXIT("CaItemModelPrivate::updateModelContent");
 }
+
+/*!
+ Emits empty signal if model state was changed
+ \param id of parent
+ */
+void CaItemModelPrivate::emitEmpty(int previousCount)
+{
+    if ( previousCount && !rowCount()) {
+        emit m_q->empty(true);
+    }
+    if ( !previousCount && rowCount()) {
+        emit m_q->empty(false);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contentstorage/caclient/src/caqtsfhandlerloader.cpp	Fri May 28 16:17:03 2010 +0300
@@ -0,0 +1,114 @@
+/*
+ * 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:
+ *
+ */
+
+#include <QApplication>
+#include <QDir>
+#include <QMap>
+#include <QScopedPointer>
+#include <QString>
+#include <qservice.h>
+#include <qstringlist.h>
+#include <qservicemanager.h>
+
+#include "cahandler.h"
+#include "caqtsfhandlerloader.h"
+#include "caclient_defines.h"
+
+QTM_USE_NAMESPACE
+
+/*!
+    \class CaQtSfHandlerLoader
+    \ingroup
+    \brief Loads handlers implementation
+
+    The purpose of the class is to find Qt SF plugins implementing command handlers.
+    Temporarily because of issues with Qt SF this is replaced by immediate object
+    creation.
+    \sa CaHandlerLoader
+*/
+
+/*!
+    Constructor.
+*/
+CaQtSfHandlerLoader::CaQtSfHandlerLoader()
+{
+    registerPlugins();
+}
+
+/*!
+    Load plugins for command handling.
+*/
+void CaQtSfHandlerLoader::registerPlugins() const
+{
+    const QString pluginPath("hsresources/plugins/commandhandler");
+    const QFileInfoList drives = QDir::drives();
+    
+    foreach(QFileInfo drive, drives) {
+        const QString driveLetter = drive.absolutePath();
+        const QString pluginAbsolutePath = driveLetter + pluginPath;
+        const QDir pluginDir(pluginAbsolutePath);
+        if(QDir(pluginDir).exists()) {
+            const QFileInfoList fileInfos = 
+                pluginDir.entryInfoList(QStringList("*.xml"));
+            
+            QApplication::addLibraryPath(pluginAbsolutePath);
+            
+            QServiceManager serviceManager;
+            foreach(QFileInfo fileInfo, fileInfos) {
+                serviceManager.addService(fileInfo.absoluteFilePath());
+            }
+        }
+    }
+}
+
+/*!
+    Loads handler implementations appropriate for the requested entry type name and command.
+
+    The caller takes ownership of the returned pointer.
+
+    \param entryTypeName Entry type name.
+    \param commandName Name of the command to be handled.
+    \return A pointer to handler serving the entry type and command if found, NULL otherwise.
+*/
+CaHandler *CaQtSfHandlerLoader::loadHandler(const QString &entryTypeName,
+        const QString &commandName)
+{
+    Q_UNUSED(commandName);
+
+    QString typeName(entryTypeName);
+    if (entryTypeName == WIDGET_ENTRY_TYPE_NAME
+        || entryTypeName == PACKAGE_ENTRY_TYPE_NAME) {
+        typeName = QString(APPLICATION_ENTRY_TYPE_NAME);
+    }
+
+    QServiceManager serviceManager;
+    QServiceFilter serviceFilter("com.nokia.homescreen.ICommandHandler");
+    serviceFilter.setCustomAttribute("entryTypeName", typeName);
+    QList<QServiceInterfaceDescriptor> serviceInterfaceDescriptorList =
+        serviceManager.findInterfaces(serviceFilter);
+    CaHandler *interfaceHandler = NULL;
+    if (!serviceInterfaceDescriptorList.isEmpty()) {
+        QServiceInterfaceDescriptor serviceInterfaceDescriptor =
+            serviceInterfaceDescriptorList[0];
+         QObject *handler =
+            serviceManager.loadInterface(serviceInterfaceDescriptor);
+         interfaceHandler = qobject_cast<CaHandler *>(handler);
+    }
+    return interfaceHandler;
+}
+
+
--- a/contentstorage/caclient/src/caservice.cpp	Mon May 24 20:50:46 2010 +0300
+++ b/contentstorage/caclient/src/caservice.cpp	Fri May 28 16:17:03 2010 +0300
@@ -30,6 +30,8 @@
 
 #include "caclientproxy.h"
 #include "caclientnotifierproxy.h"
+#include "cahandlerproxy.h"
+#include "caqtsfhandlerloader.h"
 #include "caobjectadapter.h"
 #include "caclienttest_global.h"
 
@@ -89,7 +91,6 @@
 CaService::CaService(QObject *parent) :
     QObject(parent), m_d(new CaServicePrivate(this))
 {
-
 }
 
 /*!
@@ -944,7 +945,10 @@
  \param servicePublic pointer to public service
  */
 CaServicePrivate::CaServicePrivate(CaService *servicePublic) :
-    m_q(servicePublic), mProxy(new CaClientProxy), 
+    m_q(servicePublic),
+    mCommandHandler(new CaHandlerProxy(QSharedPointer<CaHandlerLoader>
+        (new CaQtSfHandlerLoader()))),
+    mProxy(new CaClientProxy()),
     mNotifierProxy(NULL)
 {
     const ErrorCode connectionResult = mProxy->connect();
@@ -1338,7 +1342,7 @@
         touch(entry);
     }
 
-    mErrorCode = mProxy->executeCommand(entry, command);
+    mErrorCode = mCommandHandler->execute(entry, command);
 
     qDebug() << "CaServicePrivate::executeCommand mErrorCode on return:"
              << mErrorCode;
--- a/contentstorage/caclient/stub/inc/caobjectadapter.h	Mon May 24 20:50:46 2010 +0300
+++ b/contentstorage/caclient/stub/inc/caobjectadapter.h	Fri May 28 16:17:03 2010 +0300
@@ -21,6 +21,8 @@
 // INCLUDES
 #include <QPixmap>
 
+#include <cadefs.h>
+
 class QSize;
 class CaEntry;
 class CaIconDescription;
@@ -59,6 +61,12 @@
      */
     static void setId(CaIconDescription &iconDescription,
                       int id);
+                      
+    /**
+     * Converts symbian error code to error code (used in QT code).
+     */
+    static ErrorCode convertErrorCode(
+        int internalErrorCode);
 
 };
 
--- a/contentstorage/caclient/stub/src/camenuiconutility.cpp	Mon May 24 20:50:46 2010 +0300
+++ b/contentstorage/caclient/stub/src/camenuiconutility.cpp	Fri May 28 16:17:03 2010 +0300
@@ -53,6 +53,10 @@
     if (icon.isNull() || !(icon.size().isValid())) {
         icon = HbIcon(QDir(".").absoluteFilePath("resource/application.png"));
     }
+    if (entry.entryTypeName() == "widget") {
+        icon.addBadge(Qt::AlignBottom | Qt::AlignLeft,
+                    HbIcon("qtg_small_homescreen"));
+    }
     return icon;
 }
 
--- a/contentstorage/caclient/stub/src/caobjectadapter.cpp	Mon May 24 20:50:46 2010 +0300
+++ b/contentstorage/caclient/stub/src/caobjectadapter.cpp	Fri May 28 16:17:03 2010 +0300
@@ -60,3 +60,20 @@
     iconDescription.setId(id);
 }
 
+//----------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------
+ErrorCode CaObjectAdapter::convertErrorCode(int internalErrorCode)
+{
+    ErrorCode error(NoErrorCode);
+    switch (internalErrorCode) {
+    case 0:
+        error = NoErrorCode;
+        break;
+    default:
+        error = UnknownErrorCode;
+        break;
+    }
+    return error;
+}
+
--- a/contentstorage/cahandler/app/app.pro	Mon May 24 20:50:46 2010 +0300
+++ b/contentstorage/cahandler/app/app.pro	Fri May 28 16:17:03 2010 +0300
@@ -37,7 +37,6 @@
     LIBS += \
     -leuser \
     -lecom \
-    -lswinstcli \
     -lcautils \
     -lapgrfx \
     -lws32 \
@@ -48,7 +47,8 @@
     -lefsrv \
     -lsif \
     -lscrclient \
-    -lxqutils
+    -lxqutils \
+    -lcaclient
 
     exists($${EPOCROOT}epoc32/include/platform/mw/XQSettingsManager):LIBS += -lxqsettingsmanager
 }
--- a/contentstorage/cahandler/app/inc/caapphandler.h	Mon May 24 20:50:46 2010 +0300
+++ b/contentstorage/cahandler/app/inc/caapphandler.h	Fri May 28 16:17:03 2010 +0300
@@ -15,96 +15,73 @@
  *
  */
 
-#ifndef C_CAAPPHANDLER_H
-#define C_CAAPPHANDLER_H
+#ifndef CAAPPHANDLER_H
+#define CAAPPHANDLER_H
 
-#include <e32base.h>
+#include <QObject>
 
-// forward declarations
+#include "cahandler.h"
+
 class CEikonEnv;
-class CCaInnerEntry;
 class CCaUsifUninstallOperation;
+class CaEntry;
 
 /**
  *  Command handler for application entries.
  *
  *  @lib caclient.lib
  */
-NONSHARABLE_CLASS( CCaAppHandler ): public CBase
-    {
+class CaAppHandler: public QObject, public CaHandler
+{
+    Q_OBJECT
+    Q_INTERFACES(CaHandler)
 
 public:
-    /**
-    * Allocates memory for and initializes CCaAppHandler object
-    */
-    static CCaAppHandler* NewL();
+
+    explicit CaAppHandler(QObject *parent = 0);
 
     /**
      * Destructor.
      */
-    virtual ~CCaAppHandler();
-
-protected:
-
-    CCaAppHandler();
-
-    void ConstructL();
+    virtual ~CaAppHandler();
 
 public:
 
-    /**
-     * Handle command.
-     * @param aItem Item of supported type.
-     * @param aCommand Command.
-     * @param aParams. Command parameters.
-     * @param aStatus Observer request status. When the operation completes,
-     * this status will be completed with the resulting error code.
-     * @return Asynchronous operation. Owned by the caller.
-     */
-    void HandleCommandL( CCaInnerEntry& aEntry, const TDesC8& aCommand );
+    int execute(const CaEntry &entry, const QString &command);
 
 private:
+
     /**
      * Launches application
      * @param aUid UID of the application to launch
      * @param aParam command parameters
      * @param aViewId id of the view the application is to start in
      */
-    void LaunchApplicationL( const TUid aUid, const TDesC8 &aParam,
-            TInt aViewId );
+    void launchApplicationL(const TUid aUid, TInt aViewId);
 
     /**
      * Closes application
      * @param aEntry the entry represeting application to close
      */
-    void CloseApplicationL( CCaInnerEntry& aEntry );
+    int closeApplication(const EntryFlags &flags, TInt windowGroupId);
 
     /**
      * Uninstall application 
      * @param aEntry the entry represeting application to uninstall
      */
-    void HandleRemoveL( CCaInnerEntry &aEntry );
-
-    /**
-     * Gets component id 
-     * @param aEntry the entry 
-     * @param aSoftwareType indicates software type
-     * @return component id
-     */
-    TInt GetComponentIdL( const CCaInnerEntry &aEntry,
-            const TDesC& aSoftwareType );
+    int handleRemove(const EntryFlags &flags,
+        const QString &typeName,
+        const QString &componentId);
     
     /**
      * Start uninstall operation via usif 
      * @param aComponentId component id
      */
-    void StartUsifUninstallL( TInt aComponentId );
+    void startUsifUninstallL(TInt aComponentId);
     
 private:
-    // data
+    CEikonEnv *iEikEnv;
+    CCaUsifUninstallOperation *iUsifUninstallOperation;
+};
 
-    CEikonEnv* iEikEnv;
-    CCaUsifUninstallOperation* iUsifUninstallOperation;
-    };
-
-#endif // C_CAAPPHANDLER_H
+#endif // CAAPPHANDLER_H
--- a/contentstorage/cahandler/app/inc/cas60apphandleradapter.h	Mon May 24 20:50:46 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/*
- * 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 CA_S60_APP_HANDLER_ADAPTER_H
-#define CA_S60_APP_HANDLER_ADAPTER_H
-
-#include <cadefs.h>
-#include <QString>
-
-#include "cahandler.h"
-
-class CCaInnerEntry;
-
-class CaS60AppHandlerAdapter: public QObject, public CaHandler
-{
-    Q_OBJECT
-    Q_INTERFACES(CaHandler)
-
-public:
-    int execute(CCaInnerEntry &innerEntry, const QString &commandName);
-
-};
-
-#endif // CA_S60_APP_HANDLER_ADAPTER_H
--- a/contentstorage/cahandler/app/src/caapphandler.cpp	Mon May 24 20:50:46 2010 +0300
+++ b/contentstorage/cahandler/app/src/caapphandler.cpp	Fri May 28 16:17:03 2010 +0300
@@ -15,6 +15,8 @@
  *
  */
 
+#include <QString>
+#include <e32base.h>
 #include <w32std.h>
 #include <apgtask.h>
 #include <apgcli.h>
@@ -27,102 +29,86 @@
 #include <usif/usifcommon.h>
 #include <usif/scr/scr.h>
 
+#include <cadefs.h>
+#include <caentry.h>
+
 #include "caapphandler.h"
 #include "cainnerentry.h"
 #include "causifuninstalloperation.h"
 #include "catasklist.h"
-
 #include "cautils.h"
+#include "caclient_defines.h"
 #include "cadef.h"
 
-// ======== MEMBER FUNCTIONS ========
 using namespace Usif;
 
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CCaAppHandler::~CCaAppHandler()
-{
-    delete iUsifUninstallOperation;
-}
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CCaAppHandler *CCaAppHandler::NewL()
-{
-    CCaAppHandler *handler = new(ELeave) CCaAppHandler();
-    CleanupStack::PushL( handler );
-    handler->ConstructL();
-    CleanupStack::Pop( handler );
-    return handler;
-}
+static const char caTypeApp[] = "application";
+static const char caTypePackage[] = "package";
+static const char caTypeWidget[] = "widget";
+static const char caAttrView[] = "view";
+static const char caCmdClose[] = "close";
+static const char caAttrWindowGroupId[] = "window_group_id";
+static const char caAttrComponentId[] = "component_id";
+static const char caCmdRemove[] = "remove";
 
 // ---------------------------------------------------------
-// CCaAppHandler::CCaAppHandler
+//
 // ---------------------------------------------------------
 //
-CCaAppHandler::CCaAppHandler()
+CaAppHandler::CaAppHandler(QObject *parent):
+    iEikEnv(CEikonEnv::Static()),
+    iUsifUninstallOperation(NULL)
 {
-    iEikEnv = CEikonEnv::Static();
-    iUsifUninstallOperation = NULL;
+    Q_UNUSED(parent);
 }
 
 // ---------------------------------------------------------------------------
 //
 // ---------------------------------------------------------------------------
 //
-void CCaAppHandler::ConstructL()
+CaAppHandler::~CaAppHandler()
+{
+    delete iUsifUninstallOperation;
+}
+
+int CaAppHandler::execute(const CaEntry &entry, const QString &command)
 {
+    int result(KErrGeneral);
+    if (command == caCmdOpen && entry.entryTypeName() == caTypeApp) {
+        QString viewIdValue = entry.attribute(caAttrView);
+        bool viewIdIsCorrect(true);
+        int viewId(-1);
+        if (!viewIdValue.isNull()) {
+            viewId = viewIdValue.toInt(&viewIdIsCorrect, 0);
+        }
+        if (viewIdIsCorrect) {
+            QString uidValue =
+                entry.attribute(APPLICATION_UID_ATTRIBUTE_NAME);
+            int uid = uidValue.toInt();
+            TRAP(result, launchApplicationL(TUid::Uid(uid), viewId));
+        }
+    } else if (command == caCmdClose && entry.entryTypeName() == caTypeApp ) {
+        QString windowGroupId = entry.attribute(caAttrWindowGroupId);
+        if (!windowGroupId.isNull()) {
+            result = closeApplication(entry.flags(), windowGroupId.toInt());
+        }
+    } else if (command == caCmdRemove) {
+        QString componentId(entry.attribute(caAttrComponentId));
+        result = handleRemove(entry.flags(),
+            entry.entryTypeName(),
+            componentId);
+    } else {
+        result = KErrNotSupported;
+    }
+
+    return result;
 }
 
 // ---------------------------------------------------------------------------
 //
 // ---------------------------------------------------------------------------
 //
-void CCaAppHandler::HandleCommandL(
-        CCaInnerEntry &aEntry, const TDesC8 &aCommand )
-{
-
-    if( aCommand == KCaCmdOpen()
-            && aEntry.GetEntryTypeName() == KCaTypeApp() )
-        {
-        TInt viewId(-1);
-        TPtrC viewIdValue;
-        if( aEntry.FindAttribute( KCaAttrView(), viewIdValue ) )
-            {
-            if( MenuUtils::GetTUint( viewIdValue, (TUint &) viewId )
-                    != KErrNone )
-                {
-                User::Leave( KErrCorrupt );
-                }
-            }
-        LaunchApplicationL(
-                TUid::Uid( aEntry.GetUid() ), KNullDesC8(), viewId );
-        }
-    else if ( aCommand == KCaCmdClose()
-            && aEntry.GetEntryTypeName() == KCaTypeApp() )
-        {
-        CloseApplicationL( aEntry );
-        }
-    else if ( aCommand == KCaCmdRemove() )
-        {
-        HandleRemoveL(aEntry);
-        }
-    else
-        {
-        User::Leave( KErrNotSupported );
-        }
-}
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CCaAppHandler::LaunchApplicationL(
-        const TUid aUid, const TDesC8 &aParam, TInt aViewId )
+void CaAppHandler::launchApplicationL(const TUid aUid, TInt aViewId)
 {
     if( aViewId > 0 && iEikEnv )
         {
@@ -172,7 +158,7 @@
                 cmdLine->SetCommandL( EApaCommandRun );
                 }
 
-            cmdLine->SetTailEndL( aParam );
+            cmdLine->SetTailEndL( KNullDesC8 );
 
             User::LeaveIfError( appArcSession.StartApp( *cmdLine ) );
 
@@ -188,113 +174,70 @@
 //
 // ---------------------------------------------------------------------------
 //
-void CCaAppHandler::CloseApplicationL( CCaInnerEntry &aEntry )
+int CaAppHandler::closeApplication(const EntryFlags &flags, int windowGroupId)
 {
-    RWsSession wsSession;
-    User::LeaveIfError( wsSession.Connect() );
-    CleanupClosePushL<RWsSession>( wsSession );
-
-    if( ( aEntry.GetFlags() & ERunning )
-            && !( aEntry.GetFlags() & ESystem ) )
-        {
-        RBuf value;
-        CleanupClosePushL( value );
-        value.CreateL( KCaMaxAttrValueLen );
-        if( aEntry.FindAttribute( KCaAttrWindowGroupId, value ) )
-            {
-            TInt wgId( KErrNotFound );
-            TLex16 parser( value );
-            if( KErrNone == parser.Val( wgId ) && wgId > 0 )
-                {
-                TWsEvent event;
-                event.SetTimeNow();
-                event.SetType( KAknShutOrHideApp );
-                wsSession.SendEventToWindowGroup( wgId, event );
-                }
-            }
-        CleanupStack::PopAndDestroy( &value );
+    int result(KErrNone);
+    if (flags.testFlag(RunningEntryFlag)
+        && !( flags.testFlag(SystemEntryFlag))
+        && windowGroupId > 0) {
+        RWsSession wsSession;
+        result = wsSession.Connect();
+        if (result==KErrNone) {
+            TWsEvent event;
+            event.SetTimeNow();
+            event.SetType( KAknShutOrHideApp );
+            wsSession.SendEventToWindowGroup( windowGroupId, event );
+        }
+        wsSession.Close();
     }
-
-    CleanupStack::PopAndDestroy( &wsSession );
+    return result;
 }
 
 // ---------------------------------------------------------------------------
 //
 // ---------------------------------------------------------------------------
 //
-void CCaAppHandler::HandleRemoveL( CCaInnerEntry &aEntry )
-    {
-    if( !( aEntry.GetFlags() & ERemovable ) )
-        {
-        User::Leave( KErrAccessDenied );
-        }
-    
-    const TPtrC entryTypeName(aEntry.GetEntryTypeName());
-    
-    if( entryTypeName == KCaTypeApp()  ||
-        entryTypeName == KCaTypePackage() ||
-        entryTypeName == KCaTypeWidget() )
-        {
-        TPtrC componentId;
-        TBool result = aEntry.FindAttribute( KCaAttrComponentId, componentId );
-        if( result )
-            {
-            TInt32 id ;
-            TLex idDesc;
-            idDesc.Assign( componentId );
-            User::LeaveIfError( idDesc.Val( id ) );
-            StartUsifUninstallL( id );
-            }
-         else
-            {
-            User::Leave( KErrNotFound );
+int CaAppHandler::handleRemove(const EntryFlags &flags,
+    const QString &typeName,
+    const QString &componentId)
+{
+    int result(KErrNone);
+    if (flags.testFlag(RemovableEntryFlag)) {
+        if (typeName == caTypeApp
+            || typeName == caTypePackage
+            || typeName == caTypeWidget) {
+            if(componentId.isNull()) {
+                result = KErrNotFound;
+            } else {
+                bool convertStatus(false);
+                int id = componentId.toInt(&convertStatus);
+                if (convertStatus) {
+                    TRAP(result, startUsifUninstallL(id));
+                } else {
+                    result = KErrGeneral;
+                }
             }
         }
-    else
-        {
-        User::Leave( KErrNotSupported );
+        else {
+            result = KErrNotSupported;
         }
+    } else {
+        result = KErrAccessDenied;
     }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CCaAppHandler::GetComponentIdL( const CCaInnerEntry &aEntry,
-        const TDesC& aSoftwareType )
-{
-    TInt id(KErrNotFound);
-    RSoftwareComponentRegistry scr;
-    CleanupClosePushL(scr);
-    User::LeaveIfError(scr.Connect());
-    CComponentFilter* compFilter = CComponentFilter::NewLC();
-    compFilter->AddPropertyL(_L("Uid"), aEntry.GetUid());
-    compFilter->SetSoftwareTypeL(aSoftwareType);
-    RArray<TComponentId> componentIdList;
-    CleanupClosePushL(componentIdList);
-    scr.GetComponentIdsL(componentIdList, compFilter);
-    if (componentIdList.Count() > 0)
-        {
-        id = componentIdList[0];
-        }
-    CleanupStack::PopAndDestroy(&componentIdList);
-    CleanupStack::PopAndDestroy(compFilter);
-    CleanupStack::PopAndDestroy(&scr);
-    return id;
+    return result;
 }
 
 // ---------------------------------------------------------------------------
 //
 // ---------------------------------------------------------------------------
 //
-void CCaAppHandler::StartUsifUninstallL( TInt aComponentId )
+void CaAppHandler::startUsifUninstallL(TInt aComponentId)
 {
-    if ( iUsifUninstallOperation && iUsifUninstallOperation->IsActive() )
-        {
+    if (iUsifUninstallOperation && iUsifUninstallOperation->IsActive()) {
         User::Leave( KErrInUse );
-        }
+    }
     delete iUsifUninstallOperation;
     iUsifUninstallOperation = NULL;
-    iUsifUninstallOperation = CCaUsifUninstallOperation::NewL( aComponentId );
+    iUsifUninstallOperation = CCaUsifUninstallOperation::NewL(aComponentId);
 }
 
--- a/contentstorage/cahandler/app/src/caapphandlerplugin.cpp	Mon May 24 20:50:46 2010 +0300
+++ b/contentstorage/cahandler/app/src/caapphandlerplugin.cpp	Fri May 28 16:17:03 2010 +0300
@@ -23,7 +23,6 @@
 #include "cahandlerloader.h"
 #include "caapphandler.h"
 #include "caapphandlerplugin.h"
-#include "cas60apphandleradapter.h"
 
 /*!
     \class CaAppHandlerPlugin
@@ -35,7 +34,7 @@
     \param descriptor Service descriptor.
     \param context Ignored.
     \param session Ignored.
-    \return An instance of the CaS60HandlerAdapter<CCaAppHandler> when descriptor interface name
+    \return An instance of the CaS60HandlerAdapter<CaAppHandler> when descriptor interface name
     is "com.nokia.homescreen.ICommandHandler", NULL otherwise.
 */
 QObject *CaAppHandlerPlugin::createInstance(const QServiceInterfaceDescriptor &descriptor,
@@ -47,7 +46,7 @@
 
     if (descriptor.interfaceName() ==
             "com.nokia.homescreen.ICommandHandler") {
-        return new CaS60AppHandlerAdapter();
+        return new CaAppHandler();
     } else {
         return 0;
     }
--- a/contentstorage/cahandler/app/src/cas60apphandleradapter.cpp	Mon May 24 20:50:46 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:  ?Description
- *
- */
-
-#include <XQConversions>
-#include <utf.h>
-#include <QScopedPointer>
-
-#include "cas60apphandleradapter.h"
-#include "caapphandler.h"
-#include "cainnerentry.h"
-
-int CaS60AppHandlerAdapter::execute(CCaInnerEntry &innerEntry, const QString &commandName)
-{
-    QScopedPointer<HBufC8> commandNameDesc8(XQConversions::qStringToS60Desc8(commandName));
-    TRAPD(result,
-        static QScopedPointer<CCaAppHandler> plugin(CCaAppHandler::NewL());
-        plugin->HandleCommandL(innerEntry, commandNameDesc8->Des());
-        );
-    return result;
-}
--- a/contentstorage/cahandler/tapp/inc/catapphandler.h	Mon May 24 20:50:46 2010 +0300
+++ b/contentstorage/cahandler/tapp/inc/catapphandler.h	Fri May 28 16:17:03 2010 +0300
@@ -35,11 +35,11 @@
     ~CaTappHandler();
 
     Q_INVOKABLE
-    int execute(CCaInnerEntry& innerEntry, const QString& command);
+    int execute(const CaEntry &entry, const QString &command);
 
 private:
-    XQApplicationManager* mAiwMgr;
+    XQApplicationManager *mAiwMgr;
 
 };
 
-#endif
+#endif // CATAPPHANDLER_H
--- a/contentstorage/cahandler/tapp/src/catapphandler.cpp	Mon May 24 20:50:46 2010 +0300
+++ b/contentstorage/cahandler/tapp/src/catapphandler.cpp	Fri May 28 16:17:03 2010 +0300
@@ -23,10 +23,9 @@
 
 #include "caentry.h"
 #include "catapphandler.h"
-#include "cainnerentry.h"
 #include "caclient_defines.h"
 
-_LIT(hsitemLaunchUri, "item:launchuri");
+static const QString hsitemLaunchUri("item:launchuri");
 
 QTM_USE_NAMESPACE
 
@@ -61,22 +60,27 @@
  \param command Description of the command.
  \return Error code described in QSERVICEMANAGER.H
  */
-int CaTappHandler::execute(CCaInnerEntry& innerEntry, const QString& command)
+int CaTappHandler::execute(const CaEntry& entry, const QString& command)
 {
-    int error = 0; // this returns Error enum from QSERVICEMANAGER.H
+    // this returns Error enum from QSERVICEMANAGER.H
+    int error = 0;
     if (command == caCmdOpen) {
-        TPtrC attribute;
-        innerEntry.FindAttribute(hsitemLaunchUri, attribute);
-
-        // e.g. QUrl url ("application://101F7AE7?");
-        QUrl url(QString::fromUtf16(attribute.Ptr(), attribute.Length()));
-        QScopedPointer<XQAiwRequest> request(mAiwMgr->create(url, false));
-        if (!request.isNull()) {
-            bool res = request->send();
-            if (!res) {
-                error = request->lastError();
+        QString attribute = entry.attribute(hsitemLaunchUri);
+        if (!attribute.isNull()) {
+            // e.g. QUrl("appto://101F7AE7?");
+            QScopedPointer<XQAiwRequest> request(mAiwMgr->create(QUrl(attribute),
+                false));
+            if (!request.isNull()) {
+                bool res = request->send();
+                if (!res) {
+                    error = request->lastError();
+                }
             }
         }
+    } else {
+        // TODO: error code cleanning and appropriate conversion (in other classes too).
+        static const int NotSupportedErrorCode = 100;
+        error = NotSupportedErrorCode;
     }
     return error;
 }
--- a/contentstorage/cahandler/tapp/tapp.pro	Mon May 24 20:50:46 2010 +0300
+++ b/contentstorage/cahandler/tapp/tapp.pro	Fri May 28 16:17:03 2010 +0300
@@ -40,8 +40,8 @@
 	
 	LIBS += -lxqservice \
             -lxqutils \
-            -lcautils
-#        -lhsutils
+            -lcautils \
+            -lcaclient
 
 }
 
--- a/contentstorage/cahandler/url/inc/cas60urlhandleradapter.h	Mon May 24 20:50:46 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * 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 CA_S60_URL_HANDLER_ADAPTER_H
-#define CA_S60_URL_HANDLER_ADAPTER_H
-
-#include <QString>
-
-#include "cahandler.h"
-
-class CCaInnerEntry;
-
-class CaS60UrlHandlerAdapter: public QObject, public CaHandler
-{
-    Q_OBJECT
-    Q_INTERFACES(CaHandler)
-
-public:
-    int execute(CCaInnerEntry &innerEntry, const QString &commandName);
-
-};
-
-#endif //CA_S60_URL_HANDLER_ADAPTER_H
--- a/contentstorage/cahandler/url/inc/caurlhandler.h	Mon May 24 20:50:46 2010 +0300
+++ b/contentstorage/cahandler/url/inc/caurlhandler.h	Fri May 28 16:17:03 2010 +0300
@@ -15,75 +15,26 @@
  *
  */
 
-#ifndef __CCAURLHANDLER_H__
-#define __CCAURLHANDLER_H__
-
-#include <e32base.h>
-
-class CCaInnerEntry;
+#ifndef CAURLHANDLER_H
+#define CAURLHANDLER_H
 
-// Constants
-const TUid KUidBrowser =
-    {
-    0x10008D39
-    };
-_LIT( KBrowserPrefix, "4 " );
-
-/**
- *  Command handler for url entries.
- *
- *  @lib caclient.lib
- */
-NONSHARABLE_CLASS( CCaUrlHandler ): public CBase
-    {
-
-public:
-    // construction
+#include "cahandler.h"
 
-    /**
-     * Destructor.
-     */
-    virtual ~CCaUrlHandler();
-
-    /**
-     * Two-phased constructor. Leaves on failure.
-     * @return The constructed object.
-     */
-    static CCaUrlHandler* NewL();
+class QString;
 
-protected:
-    // construction
-
-    /**
-     * Constructor.
-     * @param aMenu Menu.
-     */
-    CCaUrlHandler();
-
-    /**
-     * Second-phase constructor.
-     */
-    void ConstructL();
+class CaUrlHandler: public QObject, public CaHandler
+{
+    Q_OBJECT
+    Q_INTERFACES(CaHandler)
 
 public:
 
+    explicit CaUrlHandler(QObject *parent = 0);
 
-    /**
-     * Handle command.
-     * @param aEntry The url entry to be processed.
-     * @param aCommand Command.
-     */
-    void HandleCommandL( CCaInnerEntry& aEntry, const TDesC8& aCommand );
+    virtual ~CaUrlHandler();
 
-private:
-    // internal
+    int execute(const CaEntry &entry, const QString &command);
 
-    /**
-     * Launches the url.
-     * @param aUrl The url to be launched.
-     */
-    void LaunchUrlL( const TDesC& aUrl );
+};
 
-    };
-
-#endif // __CCAURLHANDLER_H__
+#endif // CAURLHANDLER_H
--- a/contentstorage/cahandler/url/inc/caurlhandlerplugin.h	Mon May 24 20:50:46 2010 +0300
+++ b/contentstorage/cahandler/url/inc/caurlhandlerplugin.h	Fri May 28 16:17:03 2010 +0300
@@ -11,12 +11,12 @@
  *
  * Contributors:
  *
- * Description:
+ * Description: Url handler plugin.
  *
  */
 
-#ifndef CA_URL_HANDLER_PLUGIN_H
-#define CA_URL_HANDLER_PLUGIN_H
+#ifndef CAURLHANDLERPLUGIN_H
+#define CAURLHANDLERPLUGIN_H
 
 #include <QObject>
 #include <qserviceplugininterface.h>
@@ -30,8 +30,8 @@
 
 public:
     QObject *createInstance(const QServiceInterfaceDescriptor &descriptor,
-                            QServiceContext *context,
-                            QAbstractSecuritySession *session);
+        QServiceContext *context,
+        QAbstractSecuritySession *session);
 };
 
-#endif
+#endif // CAURLHANDLERPLUGIN_H
--- a/contentstorage/cahandler/url/src/cas60urlhandleradapter.cpp	Mon May 24 20:50:46 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:  ?Description
- *
- */
-
-#include <XQConversions>
-#include <utf.h>
-#include <QScopedPointer>
-
-#include "cas60urlhandleradapter.h"
-#include "caurlhandler.h"
-#include "cainnerentry.h"
-
-int CaS60UrlHandlerAdapter::execute(CCaInnerEntry &innerEntry, const QString &commandName)
-{
-    QScopedPointer<HBufC8> commandNameDesc8(XQConversions::qStringToS60Desc8(commandName));
-    TRAPD(result,
-        static QScopedPointer<CCaUrlHandler> plugin(CCaUrlHandler::NewL());
-        plugin->HandleCommandL(innerEntry, commandNameDesc8->Des());
-        );
-    return result;
-}
--- a/contentstorage/cahandler/url/src/caurlhandler.cpp	Mon May 24 20:50:46 2010 +0300
+++ b/contentstorage/cahandler/url/src/caurlhandler.cpp	Fri May 28 16:17:03 2010 +0300
@@ -15,130 +15,33 @@
  *
  */
 
-#include <w32std.h>
-#include <apgtask.h>
-#include <apgcli.h>
-#include <AknTaskList.h>
+#include <QDesktopServices>
+#include <QUrl>
+
+#include <caentry.h>
 
 #include "caurlhandler.h"
-#include "cadef.h"
-#include "cainnerentry.h"
 
-// ================= MEMBER FUNCTIONS =======================
-
-// --------------------------------------------------------------------------
-// CCaUrlHandler::~CCaUrlHandler
-// --------------------------------------------------------------------------
-//
-CCaUrlHandler::~CCaUrlHandler()
-    {
-    }
+static const QString caAttrUrl("url");
 
-// --------------------------------------------------------------------------
-// CCaUrlHandler::NewL
-// --------------------------------------------------------------------------
-//
-CCaUrlHandler* CCaUrlHandler::NewL()
-    {
-    CCaUrlHandler* handler = new ( ELeave ) CCaUrlHandler();
-    CleanupStack::PushL( handler );
-    handler->ConstructL();
-    CleanupStack::Pop( handler );
-    return handler;
-    }
-
-// --------------------------------------------------------------------------
-// CCaUrlHandler::CCaUrlHandler
-// --------------------------------------------------------------------------
-//
-CCaUrlHandler::CCaUrlHandler()
-    {
-    }
+CaUrlHandler::CaUrlHandler(QObject *parent)
+{
+    Q_UNUSED(parent);
+}
 
-// --------------------------------------------------------------------------
-// CCaUrlHandler::ConstructL
-// --------------------------------------------------------------------------
-//
-void CCaUrlHandler::ConstructL()
-    {
-    }
-
-// --------------------------------------------------------------------------
-// CCaUrlHandler::HandleCommandL
-// --------------------------------------------------------------------------
-//
-void CCaUrlHandler::HandleCommandL( CCaInnerEntry& aEntry,
-        const TDesC8& aCommand )
-    {
+CaUrlHandler::~CaUrlHandler()
+{
+}
 
-    if( !aCommand.Compare( KCaCmdOpen() ) )
-        {
-        const RCaEntryAttrArray& attributes = aEntry.GetAttributes();
-        TInt attributesArrayCount = attributes.Count();
-        for( int i = 0; i < attributesArrayCount; ++i )
-            {
-            const CCaEntryAttribute * const attribute = attributes[i];
-            if( attribute->Name().Compare( KCaAttrUrl ) == 0 )
-                {
-                LaunchUrlL( attribute->Value() );
-                break;
-                }
-            }
-        }
-    else
-        {
-        User::Leave( KErrNotSupported );
+int CaUrlHandler::execute(const CaEntry &entry, const QString &command)
+{
+    int err(KErrGeneral);
+    if (command == caCmdOpen) {
+        QString attribute = entry.attribute(caAttrUrl);
+        if (!attribute.isNull() &&
+            QDesktopServices::openUrl(QUrl(attribute))) {
+            err = KErrNone;
         }
     }
-
-// --------------------------------------------------------------------------
-// CCaUrlHandler::LaunchUrlL
-// --------------------------------------------------------------------------
-//
-
-void CCaUrlHandler::LaunchUrlL( const TDesC& aUrl )
-    {
-    // Launches browser stand-alone.
-    // Browser is launched with a parameter 4 ("4 http://...."), which 
-    // Start/Continue the browser specifying a URL. 
-    // Other available parameters are described in the Browser API Specification
-    // Document.
-    TInt length = aUrl.Length() + KBrowserPrefix.iTypeLength;
-
-    RWsSession wsSession;
-    User::LeaveIfError( wsSession.Connect() );
-    CleanupClosePushL<RWsSession> ( wsSession );
-
-    CAknTaskList* taskList = CAknTaskList::NewL( wsSession );
-    TApaTask task = taskList->FindRootApp( KUidBrowser );
-    delete taskList;
-
-    if( task.Exists() )
-        {
-        HBufC8* param8 = HBufC8::NewLC( length );
-        TPtr8 ptr8 = param8->Des();
-        ptr8.Append( KBrowserPrefix );
-        ptr8.Append( aUrl );
-
-        // Sends message to existing Browser task.
-        task.SendMessage( TUid::Uid( 0 ), *param8 ); // Uid is not used
-        CleanupStack::PopAndDestroy( param8 );
-        }
-    else
-        {
-        HBufC* buf = HBufC::NewLC( length );
-        TPtr ptr = buf->Des();
-        ptr.Append( KBrowserPrefix );
-        ptr.Append( aUrl );
-
-        RApaLsSession appArcSession;
-        User::LeaveIfError( appArcSession.Connect() );
-        CleanupClosePushL<RApaLsSession> ( appArcSession );
-        TThreadId id;
-        appArcSession.StartDocument( *buf, KUidBrowser, id );
-        CleanupStack::PopAndDestroy( &appArcSession );
-        CleanupStack::PopAndDestroy( buf );
-        }
-
-    CleanupStack::PopAndDestroy( &wsSession );
-    }
+    return err;
+}
--- a/contentstorage/cahandler/url/src/caurlhandlerplugin.cpp	Mon May 24 20:50:46 2010 +0300
+++ b/contentstorage/cahandler/url/src/caurlhandlerplugin.cpp	Fri May 28 16:17:03 2010 +0300
@@ -15,14 +15,12 @@
  *
  */
 
-#include <cadefs.h>
 #include <qserviceinterfacedescriptor.h>
 #include <qabstractsecuritysession.h>
 #include <qservicecontext.h>
+
 #include "cahandlerloader.h"
-
 #include "caurlhandlerplugin.h"
-#include "cas60urlhandleradapter.h"
 #include "caurlhandler.h"
 
 /*!
@@ -35,7 +33,7 @@
     \param descriptor Service descriptor.
     \param context Ignored.
     \param session Ignored.
-    \return An instance of the CaS60UrlHandlerAdapter<CCaUrlHandler> when descriptor interface name
+    \return An instance of the CaS60UrlHandlerAdapter<CaUrlHandler> when descriptor interface name
     is "com.nokia.homescreen.ICommandHandler", NULL otherwise.
 */
 QObject *CaUrlHandlerPlugin::createInstance(const QServiceInterfaceDescriptor &descriptor,
@@ -46,10 +44,11 @@
     Q_UNUSED(session);
 
     if (descriptor.interfaceName() ==
-            "com.nokia.homescreen.ICommandHandler") {
-        return new CaS60UrlHandlerAdapter();
+        QLatin1String("com.nokia.homescreen.ICommandHandler")) {
+        return new CaUrlHandler();
     } else {
         return 0;
     }
 }
+
 Q_EXPORT_PLUGIN2(caurlhandlerplugin, CaUrlHandlerPlugin)
--- a/contentstorage/cahandler/url/url.pro	Mon May 24 20:50:46 2010 +0300
+++ b/contentstorage/cahandler/url/url.pro	Fri May 28 16:17:03 2010 +0300
@@ -37,7 +37,6 @@
     LIBS += \
     -leuser \
     -lecom \
-    -lswinstcli \
     -lcautils \
     -lapgrfx \
     -lws32 \
@@ -46,7 +45,8 @@
     -leikcore \
     -lcone \
     -lefsrv \
-    -lxqutils
+    -lxqutils \
+    -lcaclient
 
     exists($${EPOCROOT}epoc32/include/platform/mw/XQSettingsManager):LIBS += -lxqsettingsmanager
 }
--- a/contentstorage/casoftwareregistry/casoftwareregistry.pro	Mon May 24 20:50:46 2010 +0300
+++ b/contentstorage/casoftwareregistry/casoftwareregistry.pro	Fri May 28 16:17:03 2010 +0300
@@ -40,7 +40,8 @@
         -lbafl \
         -lestor \
         -lscrclient \
-        -lxqutils
+        -lxqutils \
+        -lPlatformEnv
         
 include(casoftwareregistry_s60.pri)
 }
--- a/contentstorage/casoftwareregistry/s60/src/casoftwareregistry_p.cpp	Mon May 24 20:50:46 2010 +0300
+++ b/contentstorage/casoftwareregistry/s60/src/casoftwareregistry_p.cpp	Fri May 28 16:17:03 2010 +0300
@@ -22,6 +22,7 @@
 #include <usif/scr/scr.h>
 #include <usif/scr/screntries.h>
 #include <xqconversions.h>
+#include <driveinfo.h>
 
 #include "casoftwareregistry.h"
 #include "casoftwareregistry_p.h"
@@ -39,6 +40,9 @@
 
 typedef QScopedPointer<RSoftwareComponentRegistry, 
     RClassDeleter<RSoftwareComponentRegistry> > ScrScopedPointer;
+    
+typedef QScopedPointer<RFs, 
+    RClassDeleter<RFs> > RFSScopedPointer;
 /*!
  Constructor
  \param servicePublic Pointer to object of the public class.
@@ -67,7 +71,8 @@
     CaSoftwareRegistry::DetailMap result;
 
     if (componentId >= 1) {
-        ScrScopedPointer scr(new RSoftwareComponentRegistry);
+        RSoftwareComponentRegistry softwareComponentRegistry;
+        ScrScopedPointer scr(&softwareComponentRegistry);
         QT_TRAP_THROWING(User::LeaveIfError(scr->Connect()));
         
         QScopedPointer<CComponentEntry> entry;
@@ -99,13 +104,52 @@
         XQConversions::s60DescToQString(entry.Vendor());
         
     QString drives;
+    TChar drive;
+    
     const TInt driveListLen(entry.InstalledDrives().Length());
     for (TInt i( 0 ); i < driveListLen; ++i) {
         if (entry.InstalledDrives()[i] != '\0') {
+            
             if (!drives.isEmpty()) {
                 drives = drives.append(",");
-             }
-            drives = drives.append(QChar('A'+ i)).append(":");
+             }  
+            
+            if(DriveInfo::GetDefaultDrive(DriveInfo::EDefaultPhoneMemory, drive ) == KErrNone 
+                    && QChar('A'+ i) == QChar(drive))
+                {
+                drives = drives.append(QChar('A'+ i)).append(":").append(
+                        " txt_applib_dialog_1_device_memory");
+                }
+            else if(DriveInfo::GetDefaultDrive(DriveInfo::EDefaultMassStorage, drive ) == KErrNone 
+                    && QChar('A'+ i) == QChar(drive))
+                {
+                drives = drives.append(QChar('A'+ i)).append(":").append(
+                        " txt_applib_dialog_1_mass_storage");
+                }
+            else if(DriveInfo::GetDefaultDrive(DriveInfo::EDefaultRemovableMassStorage, drive ) == KErrNone 
+                    && QChar('A'+ i) == QChar(drive))
+                {
+                RFs fs;
+                RFSScopedPointer fSPointer(&fs);
+                qt_symbian_throwIfError(fs.Connect());
+
+                TInt driveNumber;
+                TVolumeInfo tv;
+                DriveInfo::GetDefaultDrive(DriveInfo::EDefaultRemovableMassStorage, driveNumber );
+                
+                qt_symbian_throwIfError(fs.Volume(tv, driveNumber));
+                if(tv.iName.Length()) {
+                    drives = drives.append(QChar('A'+ i)).append(": ").append(
+                                XQConversions::s60DescToQString(tv.iName));                
+                }
+                else {
+                    drives = drives.append(QChar('A'+ i)).append(":").append(
+                        " txt_applib_dialog_1_memory_card");                
+                }
+            }
+            else {
+                drives = drives.append(QChar('A'+ i)).append(":");   
+            }
         }
     }
     
--- a/contentstorage/casrv/caappscanner/group/caappscanner.mmp	Mon May 24 20:50:46 2010 +0300
+++ b/contentstorage/casrv/caappscanner/group/caappscanner.mmp	Fri May 28 16:17:03 2010 +0300
@@ -58,5 +58,3 @@
 LIBRARY         sisregistryclient.lib
 LIBRARY         platformenv.lib
 LIBRARY         scrclient.lib
-// temporary till cWRT will be in SCR
-LIBRARY         WidgetRegistryClient.lib
--- a/contentstorage/casrv/caappscanner/inc/casrvappscanner.h	Mon May 24 20:50:46 2010 +0300
+++ b/contentstorage/casrv/caappscanner/inc/casrvappscanner.h	Fri May 28 16:17:03 2010 +0300
@@ -416,12 +416,10 @@
     
     /**
      * Adds or updates component id attribute in entry based on SCR provided data
-     * @param appInfo application data carrying full path name of application file.
      * @param aEntry entry being updated with component id attribute.
      * @return ETrue when component id attribute of the entry has been added or changed.
      */
-    TBool UpdateComponentIdL( TApaAppInfo& appInfo, 
-        CCaInnerEntry& aEntry ) const;
+    TBool UpdateComponentIdL( CCaInnerEntry& aEntry ) const;
 
     /**
      * Schedule appscanner run.
--- a/contentstorage/casrv/caappscanner/src/casrvappscanner.cpp	Mon May 24 20:50:46 2010 +0300
+++ b/contentstorage/casrv/caappscanner/src/casrvappscanner.cpp	Fri May 28 16:17:03 2010 +0300
@@ -21,7 +21,6 @@
 #include <swi/sisregistryentry.h>
 #include <swi/sisregistrypackage.h>
 #include <usif/scr/screntries.h>
-#include <WidgetRegistryClient.h>
 
 #include "cadef.h"
 #include "casrvappscanner.h"
@@ -924,7 +923,7 @@
             }
         
         
-        if ( UpdateComponentIdL( *info, *aEntry ) )
+        if ( UpdateComponentIdL( *aEntry ) )
             {
             changed = ETrue;
             }
@@ -944,24 +943,37 @@
                         KCaAttrAppSettingsPlugin,
                         KCaAttrJavaAppSettingsPluginValue );
                 }
-            else if (appTypeUid == KCWRTApplicationTypeUid)
+            else if ( appTypeUid == KCWRTApplicationTypeUid )
                 {
                 aEntry->AddAttributeL(
                         KCaAttrAppType,
                         KCaAttrAppTypeValueCWRT );
-                aEntry->AddAttributeL(
-                        KCaAttrAppWidgetUri,
-                        KCaAttrAppWidgetUriCWRTValue );
-                // web id should be taken from SCR when supported
-                RWidgetRegistryClientSession wrtSession;
-                CleanupClosePushL(wrtSession);
-                User::LeaveIfError( wrtSession.Connect());
-                TFileName bundleId;
-                wrtSession.GetWidgetBundleId(info->iUid, bundleId);
-                aEntry->AddAttributeL(
-                        KCaAttrAppWidgetParamWebAppId,
-                        bundleId );
-                CleanupStack::PopAndDestroy(&wrtSession);
+                TComponentId compId = 
+                        iSoftwareRegistry.GetComponentIdForAppL( info->iUid );
+                CPropertyEntry* isMiniview = 
+                                        iSoftwareRegistry.GetComponentPropertyL( compId,
+                                                KCaScrPropertyIsMiniviewSupported );
+                CleanupStack::PushL( isMiniview );
+                // check first if we support mini view
+                if (isMiniview && isMiniview->PropertyType() == CPropertyEntry::EIntProperty &&
+                        static_cast<CIntPropertyEntry*>(isMiniview)->IntValue())
+                    {
+                    CPropertyEntry* appId = 
+                        iSoftwareRegistry.GetComponentPropertyL( compId, KCaScrPropertyAppId );
+                    CleanupStack::PushL( appId );
+                    if ( appId && 
+                         appId->PropertyType() == CPropertyEntry::ELocalizedProperty ) 
+                        {
+                        aEntry->AddAttributeL(
+                                            KCaAttrAppWidgetUri,
+                                            KCaAttrAppWidgetUriCWRTValue );
+                        aEntry->AddAttributeL(
+                                            KCaAttrAppWidgetParamWebAppId,
+                                            static_cast<CLocalizablePropertyEntry*>(appId)->StrValue() );
+                        }
+                    CleanupStack::PopAndDestroy( appId );
+                    }                
+                CleanupStack::PopAndDestroy( isMiniview );
                 }
             }
         }
@@ -1245,33 +1257,23 @@
 // ---------------------------------------------------------
 //
 // ---------------------------------------------------------//
-TBool CCaSrvAppScanner::UpdateComponentIdL( TApaAppInfo& appInfo, 
-    CCaInnerEntry& aEntry ) const
+TBool CCaSrvAppScanner::UpdateComponentIdL( CCaInnerEntry& aEntry ) const
     {
     TBool updated( EFalse );
     
-    CComponentFilter* const fileNameFilter = CComponentFilter::NewLC();
-
-    fileNameFilter->SetFileL( appInfo.iFullName );
-
-    RArray<TComponentId> componentIds;
-    CleanupClosePushL( componentIds );
-    iSoftwareRegistry.GetComponentIdsL( componentIds, fileNameFilter );
+    TUid uid;
+    TInt err(KErrNone);
+    TComponentId componentId( 0 );
+    TRAP(err, componentId = 
+            iSoftwareRegistry.GetComponentIdForAppL(
+            uid.Uid( aEntry.GetUid() ) ) )
     
-    if ( componentIds.Count() == 0 )
-    {
-        CComponentFilter* const uidFilter = CComponentFilter::NewLC();
-        uidFilter->AddPropertyL(_L("Uid"), aEntry.GetUid());
-        iSoftwareRegistry.GetComponentIdsL( componentIds, uidFilter );
-        CleanupStack::PopAndDestroy( uidFilter );
-    }
-    
-    if ( componentIds.Count() == 1 )
+    if ( componentId > 0 && err == KErrNone )
         {
         RBuf newComponentId;
         newComponentId.CleanupClosePushL();
         newComponentId.CreateL( sizeof(TComponentId) + 1 );
-        newComponentId.AppendNum( componentIds[0] );
+        newComponentId.AppendNum( componentId );
         
         RBuf oldComponentId;
         oldComponentId.CleanupClosePushL();
@@ -1293,9 +1295,5 @@
         CleanupStack::PopAndDestroy( &oldComponentId );
         CleanupStack::PopAndDestroy( &newComponentId );
         }
-
-    CleanupStack::PopAndDestroy( &componentIds );
-    CleanupStack::PopAndDestroy( fileNameFilter );
-    
     return updated;
     }
--- a/contentstorage/casrv/calocalizerscanner/inc/calocalizerscannerproxy.h	Mon May 24 20:50:46 2010 +0300
+++ b/contentstorage/casrv/calocalizerscanner/inc/calocalizerscannerproxy.h	Fri May 28 16:17:03 2010 +0300
@@ -91,6 +91,9 @@
      */
     const TDesC& GetEntryText(
             const RPointerArray<CCaInnerEntry>& aEntries, TInt aId );
+    
+    const TDesC& GetEntryDescription(
+            const RPointerArray<CCaInnerEntry>& aEntries, TInt aId );
 
 private:
 	
--- a/contentstorage/casrv/calocalizerscanner/src/calocalizerscannerproxy.cpp	Mon May 24 20:50:46 2010 +0300
+++ b/contentstorage/casrv/calocalizerscanner/src/calocalizerscannerproxy.cpp	Fri May 28 16:17:03 2010 +0300
@@ -28,8 +28,9 @@
 #include "cadef.h"
 #include "cainnerquery.h"
 #include "cainnerentry.h"
+#include "casqlcommands.h"
 
-_LIT(KPathLoc,"z:/resource/qt/translations");
+
 
 // ---------------------------------------------------------------------------
 // CCaLocalizerScannerProxy::NewL
@@ -135,9 +136,14 @@
         {
         localizedName = GetLocalizedNameLC( locals[i] );
         
-        if( localizedName->Compare(
-            GetEntryText( entries, locals[i]->GetRowId() ) ) )
-            // translation different than text
+        if( locals[i]->GetAttributeName().Compare( KColumnEnText) == 0
+                && !localizedName->Compare(
+                    GetEntryText( entries, locals[i]->GetRowId() ) ) == 0 
+                ||
+            locals[i]->GetAttributeName().Compare( KColumnEnDescription) == 0
+                && !localizedName->Compare(
+                    GetEntryDescription( entries, locals[i]->GetRowId() ) ) == 0 )
+            // translations different than text
             {
             locals[i]->SetLocalizedStringL( *localizedName );
             iStorageProxy->LocalizeEntryL( *( locals[i] ) );
@@ -160,7 +166,42 @@
     {
 	if( iRecentQmFile.Compare( aLocEntry->GetQmFilename() ) )
 		{
-	    HbTextResolverSymbian::Init( aLocEntry->GetQmFilename(), KPathLoc );
+	    
+	       if( !HbTextResolverSymbian::Init( aLocEntry->GetQmFilename(), KLocalizationFilepathC ) )
+	          {
+	          if( !HbTextResolverSymbian::Init( aLocEntry->GetQmFilename(), KLocalizationFilepathZ ) )
+	              {
+	              // this should not be called too often 
+	              TChar currentDriveLetter;
+	              TDriveList driveList;
+	              RFs fs;
+	              User::LeaveIfError( fs.Connect() );
+	              User::LeaveIfError( fs.DriveList( driveList ) );
+
+	              RBuf path;
+	              path.Create( KLocalizationFilepath().Length() + 1 );
+	              CleanupClosePushL( path );
+	              
+	              for ( TInt driveNr=EDriveY; driveNr >= EDriveA; driveNr-- )
+	                  {
+	                  if ( driveList[driveNr] )
+	                      {
+	                      User::LeaveIfError( fs.DriveToChar( driveNr,
+	                              currentDriveLetter ) );
+	                      path.Append( currentDriveLetter );
+	                      path.Append( KLocalizationFilepath );
+	                      if( HbTextResolverSymbian::Init( aLocEntry->GetQmFilename(), path ) )
+	                          {
+	                          break;
+	                          }
+	                      }
+	                  path.Zero();
+	                  }
+	              CleanupStack::PopAndDestroy( &path );
+	              fs.Close();
+	              }
+	           }
+	    
         // keeping last qm filename to avoid another initialization
 	    iRecentQmFile.Close();
 	    iRecentQmFile.Create( aLocEntry->GetQmFilename().Length() );
@@ -186,3 +227,21 @@
         }
     return KNullDesC();
     }
+
+// ---------------------------------------------------------------------------
+//  
+// ---------------------------------------------------------------------------
+//
+const TDesC& CCaLocalizerScannerProxy::GetEntryDescription(
+        const RPointerArray<CCaInnerEntry>& aEntries, TInt aId )
+    {
+    TInt entriesCount = aEntries.Count();
+    for( TInt i=0; i < entriesCount; i++ )
+        {
+        if( aEntries[i]->GetId() == aId )
+            {
+            return aEntries[i]->GetDescription();
+            }
+        }
+    return KNullDesC();
+    }
--- a/contentstorage/casrv/cawidgetscanner/group/cawidgetscanner.mmp	Mon May 24 20:50:46 2010 +0300
+++ b/contentstorage/casrv/cawidgetscanner/group/cawidgetscanner.mmp	Fri May 28 16:17:03 2010 +0300
@@ -61,4 +61,11 @@
 LIBRARY         xmlengineDOM.lib
 LIBRARY         scrclient.lib
 
+
+// HB LIBRARIES
+SYSTEMINCLUDE		/epoc32/include/mw/hb/hbcore
+LIBRARY		HbCore.lib
+
+
+
 // End of file
--- a/contentstorage/casrv/cawidgetscanner/inc/cawidgetdescription.h	Mon May 24 20:50:46 2010 +0300
+++ b/contentstorage/casrv/cawidgetscanner/inc/cawidgetdescription.h	Fri May 28 16:17:03 2010 +0300
@@ -232,6 +232,24 @@
     TPtrC GetServiceXml() const;
     
     /*
+    /*
+    * Localizes title and description, fill string id fields
+    */
+    void LocalizeTextsL();
+    
+    /*
+     * StringIdDescription time getter
+     * @return StringIdDescription
+     */
+    TPtrC GetStringIdDescription() const;
+    
+    /*
+     * StringIdTitle time getter
+     * @return widget StringIdTitle
+     */
+    TPtrC GetStringIdTitle() const;
+    
+     /*
      * Set manifest file path name.
      * @param aServiceXml Manifest file path name.
      */
@@ -242,8 +260,12 @@
      * @return Manifest file path name.
      */
     TPtrC GetManifestFilePathName() const;
+
+    void SetStringIdDescriptionL( const TDesC& aStringIdDescription );
+
+    void SetStringidTitleL( const TDesC& aStringIdTitle );
+
 private:
-
     /*
      * Library name getter
      * @return libraru name
@@ -336,6 +358,14 @@
      * Manifest file path name.
      */
     RBuf iManifestFilePathName;
+    /*
+     * Strign id of title
+     */
+    RBuf iStringIdTitle;
+    /*
+     * Strign id of description
+     */
+    RBuf iStringIdDescription;
     };
 
 typedef RPointerArray<CCaWidgetDescription> RWidgetArray;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contentstorage/casrv/cawidgetscanner/inc/cawidgetscannerdef.h	Fri May 28 16:17:03 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Globals for Content Publisher  server
+ *
+*/
+
+
+#ifndef CA_WIDGETSCANNERDEF_H
+#define CA_WIDGETSCANNERDEF_H
+
+// CONSTANTS
+const TInt KChunkSize = 8192;
+const TInt KDriveLetterLength = 2;
+const TInt KModificationTimeLength = 17;
+const TInt KNoId = -1;
+
+// LIT
+_LIT( KDoubleSlash, "\\" );
+_LIT( KWidgetScannerUnderline, "_" );
+_LIT( KWidgetScannerCaEntry, "CA_ENTRY" );
+_LIT( KWidgetScannerEnText, "EN_TEXT" );
+_LIT( KWidgetScannerEnDescription, "EN_DESCRIPTION" );
+
+
+_LIT( KManifest, ".manifest");
+_LIT( KColen, ":" );
+_LIT( KImportDir, "\\private\\20022F35\\import\\widgetregistry\\" );
+_LIT( KTrue, "true" );
+_LIT8(KWidget, "widget" );
+_LIT8(KUri, "uri" );
+_LIT8(KLibrary, "library" );
+_LIT8(KTitle, "title" );
+_LIT8(KDescription, "description" );
+_LIT8(KHidden, "hidden" );
+_LIT8(KIconUri, "iconuri" );
+_LIT8(KWidgetProvider, "widgetprovider");
+
+_LIT8(KWidgetManifest, "hswidgetmanifest");
+_LIT8(KIcon, "icon");
+_LIT8(KServiceXml, "servicexml");
+
+
+#endif // CA_WIDGETSCANNERDEF_H
--- a/contentstorage/casrv/cawidgetscanner/inc/cawidgetstoragehandler.h	Mon May 24 20:50:46 2010 +0300
+++ b/contentstorage/casrv/cawidgetscanner/inc/cawidgetstoragehandler.h	Fri May 28 16:17:03 2010 +0300
@@ -112,6 +112,14 @@
      * @param aWidget widget.
      */
     void ClearVisibleFlagL( const CCaWidgetDescription* aWidget );
+    
+    /**
+    * Set localizations for widget in db
+    * @param aWidget widget.
+    * @param aEntryId of widget.
+    */    
+    void SetLocalizationsL( const CCaWidgetDescription* aWidget,
+            TInt aEntryId );
 
 private:
 
--- a/contentstorage/casrv/cawidgetscanner/src/cawidgetdescription.cpp	Mon May 24 20:50:46 2010 +0300
+++ b/contentstorage/casrv/cawidgetscanner/src/cawidgetdescription.cpp	Fri May 28 16:17:03 2010 +0300
@@ -22,11 +22,9 @@
 #include "cawidgetdescription.h"
 #include "cainnerentry.h"
 #include "widgetscannerutils.h"
+#include "hbtextresolversymbian.h"
 
-// CONST
-const TInt KNoId = -1;
-_LIT( KDoubleSlash, "\\" );
-
+#include "cawidgetscannerdef.h"
 // ============================ MEMBER FUNCTIONS ===============================
 
 // -----------------------------------------------------------------------------
@@ -143,6 +141,8 @@
     iMmcId.Close();
     iServiceXml.Close();
     iManifestFilePathName.Close();
+    iStringIdTitle.Close();
+    iStringIdDescription.Close();
     }
 
 // ----------------------------------------------------------------------------
@@ -311,6 +311,26 @@
 //
 // -----------------------------------------------------------------------------
 //
+void CCaWidgetDescription::SetStringIdDescriptionL( const TDesC& aStringIdDescription )
+    {
+    iStringIdDescription.Close();
+    iStringIdDescription.CreateL( aStringIdDescription );
+    }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CCaWidgetDescription::SetStringidTitleL( const TDesC& aStringIdTitle )
+    {
+    iStringIdTitle.Close();
+    iStringIdTitle.CreateL( aStringIdTitle );
+    }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
 TInt CCaWidgetDescription::GetEntryId( ) const
     {
     return iEntryId;
@@ -329,6 +349,24 @@
 //
 // -----------------------------------------------------------------------------
 //
+TPtrC CCaWidgetDescription::GetStringIdDescription() const
+    {
+    return iStringIdDescription;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+
+TPtrC CCaWidgetDescription::GetStringIdTitle() const
+    {
+    return iStringIdTitle;
+    }
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
 TPtrC CCaWidgetDescription::GetLibrary( ) const
     {
     return iLibrary;
@@ -553,6 +591,74 @@
     return iServiceXml;
     }
 
+void CCaWidgetDescription::LocalizeTextsL()
+	{
+    
+    
+	if( iUri.Length() )
+		{
+	    RBuf uri;
+	    uri.Create( iUri.Length() + 1 );
+	    CleanupClosePushL( uri );
+	    uri.Copy( iUri );
+	    uri.Append( KWidgetScannerUnderline );
+	       
+	    
+	    if( !HbTextResolverSymbian::Init( uri, KLocalizationFilepathC ) )
+	      {
+	      if( !HbTextResolverSymbian::Init( uri, KLocalizationFilepathZ ) )
+	          {
+	          // this should not be called too often 
+              TChar currentDriveLetter;
+	          TDriveList driveList;
+	          RFs fs;
+	          User::LeaveIfError( fs.Connect() );
+	          User::LeaveIfError( fs.DriveList( driveList ) );
+
+	          RBuf path;
+	          path.Create( KLocalizationFilepath().Length() + 1 );
+	          CleanupClosePushL( path );
+	          
+  	          for ( TInt driveNr=EDriveY; driveNr >= EDriveA; driveNr-- )
+	              {
+	              if ( driveList[driveNr] )
+	                  {
+	                  User::LeaveIfError( fs.DriveToChar( driveNr,
+	                          currentDriveLetter ) );
+	                  path.Append( currentDriveLetter );
+	                  path.Append( KLocalizationFilepath );
+	                  if( HbTextResolverSymbian::Init( uri, path ) )
+	                      {
+	                      break;
+	                      }
+	                  }
+	              path.Zero();
+	              }
+  	          CleanupStack::PopAndDestroy( &path );
+  	          fs.Close();
+	          }
+	       }
+	    
+	    HBufC* tmp;
+	    
+	    if( iTitle.Length() )
+	    	{
+	        SetStringidTitleL( iTitle );
+	        tmp = HbTextResolverSymbian::LoadLC( iTitle );
+	        SetTitleL( *tmp );
+	        CleanupStack::PopAndDestroy( tmp );
+	    	}
+	    if( iDescription.Length() )
+	    	{
+	        SetStringIdDescriptionL( iDescription );
+	        tmp = HbTextResolverSymbian::LoadLC( iDescription );
+	        SetDescriptionL( *tmp );
+	        CleanupStack::PopAndDestroy( tmp );
+	    	}
+	    CleanupStack::PopAndDestroy( &uri );
+		}
+	}
+
 /*
  * Set manifest file path name
  * @param aManifestFilePt
--- a/contentstorage/casrv/cawidgetscanner/src/cawidgetscannerparser.cpp	Mon May 24 20:50:46 2010 +0300
+++ b/contentstorage/casrv/cawidgetscanner/src/cawidgetscannerparser.cpp	Fri May 28 16:17:03 2010 +0300
@@ -28,30 +28,8 @@
 #include "cawidgetscannerparser.h"
 #include "widgetscannerutils.h"
 
-// CONSTANTS
-
-const TInt KChunkSize = 8192;
-const TInt KDriveLetterLength = 2;
-const TInt KModificationTimeLength = 17;
+#include "cawidgetscannerdef.h"
 
-_LIT( KManifest, ".manifest");
-_LIT( KColen, ":" );
-_LIT( KImportDir, "\\private\\20022F35\\import\\widgetregistry\\" );
-//_LIT( KImportDir, "import\\widgetregistry\\" );
-_LIT( KDoubleSlash, "\\" );
-_LIT( KTrue, "true" );
-_LIT8(KWidget, "widget" );
-_LIT8(KUri, "uri" );
-_LIT8(KLibrary, "library" );
-_LIT8(KTitle, "title" );
-_LIT8(KDescription, "description" );
-_LIT8(KHidden, "hidden" );
-_LIT8(KIconUri, "iconuri" );
-_LIT8(KWidgetProvider, "widgetprovider");
-
-_LIT8(KWidgetManifest, "hswidgetmanifest");
-_LIT8(KIcon, "icon");
-_LIT8(KServiceXml, "servicexml");
 
 // ============================ MEMBER FUNCTIONS ===============================
 
@@ -182,7 +160,7 @@
             RBuf fullFilePath;
             CleanupClosePushL( fullFilePath );
             fullFilePath.CreateL( manifestDirectoryPath->Length() +
-                    (*fileList)[i].iName.Length());
+                    (*fileList)[i].iName.Length() );
             fullFilePath.Append( *manifestDirectoryPath );
             fullFilePath.Append( (*fileList)[i].iName );
             //if file is corrupted we go to the next one
@@ -233,11 +211,12 @@
         iWidgetDescriptor->SetManifestFilePathNameL( aFilePath );
 
         SetMmcIdL( iWidgetDescriptor );
-
+        
         RXmlEngNodeList<TXmlEngElement> childElementList;
         CleanupClosePushL(childElementList);
         docElement.GetChildElements(childElementList);
         TXmlEngElement element;
+        
         while (childElementList.HasNext())
           {
           element = childElementList.Next();
--- a/contentstorage/casrv/cawidgetscanner/src/cawidgetstoragehandler.cpp	Mon May 24 20:50:46 2010 +0300
+++ b/contentstorage/casrv/cawidgetscanner/src/cawidgetstoragehandler.cpp	Fri May 28 16:17:03 2010 +0300
@@ -25,9 +25,14 @@
 #include "cainnerquery.h"
 #include "castorageproxy.h"
 #include "caarraycleanup.inl"
+#include "calocalizationentry.h"
+
+#include "cawidgetscannerdef.h"
+
 
 using namespace Usif;
 
+
 // ============================ MEMBER FUNCTIONS ===============================
 
 // -----------------------------------------------------------------------------
@@ -112,6 +117,9 @@
     CCaInnerEntry* entry = aWidget->GetEntryLC();
     UpdateComponentIdL( aWidget->GetManifestFilePathName(), *entry );
     iStorage->AddL( entry );
+
+    SetLocalizationsL( aWidget, entry->GetId() );
+    
     if( entry->GetFlags() & ERemovable )
         {
         AddWidgetToDownloadCollectionL( entry );
@@ -141,6 +149,9 @@
         }
     entry->SetFlags( entry->GetFlags() & ~EMissing | EVisible );
     iStorage->AddL( entry, EFalse, itemAppearanceChange );
+    
+    SetLocalizationsL( aWidget, entry->GetId() );
+    
     if( !aWidget->IsMissing() )
         {
         AddWidgetToDownloadCollectionL( entry );
@@ -157,6 +168,7 @@
     iUpdatedIndexes.Reset();
     for( TInt i = 0; i < aWidgets.Count(); i++ )
         {
+        aWidgets[i]->LocalizeTextsL();
         TInt index = iWidgets.Find(
                 aWidgets[i], CCaWidgetDescription::Compare );
         if( index != KErrNotFound )
@@ -211,7 +223,10 @@
             else
                 {
                 //item was uninstalled so we remove its mmc id
-                ClearVisibleFlagL( iWidgets[i] );
+                if ( iWidgets[i]->IsVisible() )
+                    {
+                    ClearVisibleFlagL( iWidgets[i] );
+                    }
                 }
             }
         }
@@ -269,6 +284,7 @@
     RPointerArray<CCaInnerEntry> entries;
     CleanupResetAndDestroyPushL( entries );
     iStorage->GetEntriesL( query, entries );
+       
     iWidgets.ResetAndDestroy();
     for( TInt i = 0; i < entries.Count(); i++ )
         {
@@ -308,13 +324,10 @@
 void CCaWidgetStorageHandler::ClearVisibleFlagL(
         const CCaWidgetDescription* aWidget )
     {
-    if( aWidget->IsVisible() )
-        {
-        CCaInnerEntry* entry = aWidget->GetEntryLC();
-        entry->SetFlags( entry->GetFlags() & ~EVisible & ~EMissing & ~EUsed );
-        iStorage->AddL( entry, EFalse, EItemDisappeared );
-        CleanupStack::PopAndDestroy( entry );
-        }
+    CCaInnerEntry* entry = aWidget->GetEntryLC();
+    entry->SetFlags( entry->GetFlags() & ~EVisible & ~EMissing & ~EUsed );
+    iStorage->AddL( entry, EFalse, EItemDisappeared );
+    CleanupStack::PopAndDestroy( entry );
     }
 
 // ----------------------------------------------------------------------------
@@ -337,6 +350,52 @@
         }
     return massStorageNotInUse;
     }
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+
+void CCaWidgetStorageHandler::SetLocalizationsL(  const CCaWidgetDescription* aWidget,
+        TInt aEntryId  )
+    {
+    RBuf filename;
+    filename.Create( aWidget->GetUri().Length() + 1 ); //1 for _
+    CleanupClosePushL( filename );
+    filename.Copy( aWidget->GetUri() );
+    filename.Append( KWidgetScannerUnderline );
+    
+    // prepare localizations
+    if ( aWidget->GetTitle().Length() > 0 &&
+            aWidget->GetTitle().Compare( aWidget->GetStringIdTitle() ) )
+        // lets do not add localization when key and value are identical
+        {
+        CCaLocalizationEntry* titleEntry = CCaLocalizationEntry::NewL();
+        CleanupStack::PushL( titleEntry );
+        titleEntry->SetTableNameL( KWidgetScannerCaEntry );
+        titleEntry->SetAttributeNameL( KWidgetScannerEnText );
+        titleEntry->SetStringIdL( aWidget->GetStringIdTitle() );
+        titleEntry->SetQmFilenameL( filename );
+        titleEntry->SetRowId( aEntryId );
+        iStorage->AddLocalizationL( *titleEntry );
+        CleanupStack::PopAndDestroy( titleEntry );
+        }
+    if ( aWidget->GetDescription().Length() > 0 &&
+            aWidget->GetDescription().Compare(
+                    aWidget->GetStringIdDescription() ) )
+        // lets do not add localization when key and value are identical
+        {
+        CCaLocalizationEntry* descEntry = CCaLocalizationEntry::NewL();
+        CleanupStack::PushL( descEntry );
+        descEntry->SetTableNameL( KWidgetScannerCaEntry );
+        descEntry->SetAttributeNameL( KWidgetScannerEnDescription );
+        descEntry->SetStringIdL( aWidget->GetStringIdDescription() );
+        descEntry->SetQmFilenameL( filename );
+        descEntry->SetRowId( aEntryId );
+        iStorage->AddLocalizationL( *descEntry );
+        CleanupStack::PopAndDestroy( descEntry );
+        }
+    CleanupStack::PopAndDestroy( &filename );
+    }
 
 // ----------------------------------------------------------------------------
 //
--- a/contentstorage/castorage/inc/casqlcommands.h	Mon May 24 20:50:46 2010 +0300
+++ b/contentstorage/castorage/inc/casqlcommands.h	Fri May 28 16:17:03 2010 +0300
@@ -70,8 +70,10 @@
 _LIT( KSQLUpdateIcon, "UPDATE CA_ICON SET " );
 _LIT( KSQLUpdateEntryUsedFlag, "UPDATE CA_ENTRY SET \
 EN_FLAGS = EN_FLAGS | :EN_FLAGS WHERE ENTRY_ID = :LA_ENTRY_ID");
-_LIT( KSQLLocalizeEntry, "UPDATE CA_ENTRY SET \
+_LIT( KSQLLocalizeTextEntry, "UPDATE CA_ENTRY SET \
 EN_TEXT = :LT_STRING WHERE ENTRY_ID = :LT_ROW_ID"); // WHERE ENTRY_ID must be changed if an attribute
+_LIT( KSQLLocalizeDescriptionEntry, "UPDATE CA_ENTRY SET \
+EN_DESCRIPTION = :LT_STRING WHERE ENTRY_ID = :LT_ROW_ID"); // WHERE ENTRY_ID must be changed if an attribute
 
 _LIT( KSQLUpdatePositionInGroup, "UPDATE CA_GROUP_ENTRY SET \
 GE_POSITION = :GE_POSITION WHERE \
--- a/contentstorage/castorage/src/casqlitestorage.cpp	Mon May 24 20:50:46 2010 +0300
+++ b/contentstorage/castorage/src/casqlitestorage.cpp	Fri May 28 16:17:03 2010 +0300
@@ -214,8 +214,17 @@
 void CCaSqLiteStorage::LocalizeEntryL( CCaLocalizationEntry& aLocalization )
     {
     CCaSqlQuery* sqlLocalizeEntryQuery = CCaSqlQuery::NewLC( iSqlDb );
-    CaSqlQueryCreator::CreateLocalizationTableQueryL(sqlLocalizeEntryQuery,
-            KSQLLocalizeEntry);
+    if( aLocalization.GetAttributeName().Compare( KColumnEnText ) == 0 )
+        {
+        CaSqlQueryCreator::CreateLocalizationTableQueryL( sqlLocalizeEntryQuery,
+            KSQLLocalizeTextEntry );
+        }
+    else if ( aLocalization.GetAttributeName().Compare(
+            KColumnEnDescription ) == 0 )
+        {
+        CaSqlQueryCreator::CreateLocalizationTableQueryL( sqlLocalizeEntryQuery,
+            KSQLLocalizeDescriptionEntry );
+        }
     sqlLocalizeEntryQuery->PrepareL();
     sqlLocalizeEntryQuery->BindValuesForLocalizeL( aLocalization );
     sqlLocalizeEntryQuery->ExecuteL( );
--- a/contentstorage/cautils/inc/calocalizationentry.h	Mon May 24 20:50:46 2010 +0300
+++ b/contentstorage/cautils/inc/calocalizationentry.h	Fri May 28 16:17:03 2010 +0300
@@ -100,7 +100,7 @@
     IMPORT_C void SetRowId( TUint aRowId );
     
     /**
-
+      Sets localization id
      */
     IMPORT_C void SetTextId( TUint aId );
     
@@ -197,7 +197,7 @@
     RBuf iLocalName;
     
     /*
-     * Translated string.
+     * Qm filename.
      * Own.
      */
     RBuf iQmFilename;
--- a/contentstorage/inc/cadef.h	Mon May 24 20:50:46 2010 +0300
+++ b/contentstorage/inc/cadef.h	Fri May 28 16:17:03 2010 +0300
@@ -12,7 +12,7 @@
  * Contributors:
  *
  * Description:  Definition of different constants
- *  Version     : %version: 10.1.16 % << Don't touch! Updated by Synergy at check-out.
+ *  Version     : %version: ou1s60ui#10.1.19 % << Don't touch! Updated by Synergy at check-out.
  *
  */
 
@@ -94,11 +94,17 @@
 
 _LIT( KCaAttrAppWidgetUriCWRTValue, "wrtwidgetuiplugin");
 _LIT( KCaAttrAppWidgetParamWebAppId, "widgetparam:webAppId");
+_LIT( KCaScrPropertyAppId, "AppID");
+_LIT( KCaScrPropertyIsMiniviewSupported, "isMiniviewSupported");
 
 _LIT( KCaAppGroupName, "appgroup_name" );
 
 _LIT( KCollectionIconFileName, "qtg_large_applications_user");
 
+_LIT(KLocalizationFilepathZ, "z:/resource/qt/translations");
+_LIT(KLocalizationFilepathC, "c:/resource/qt/translations");
+_LIT(KLocalizationFilepath, ":/resource/qt/translations");
+
 const TInt KGranularityOne = 1;
 const TInt KUidChars = 10;
 const TInt KDefaultGranularity = 5;
@@ -134,7 +140,7 @@
 
 const TUid KCWRTApplicationTypeUid =
     {
-    0x200267DC
+    0x10282821 
     };
 
 const TInt KCenRepBufferSize = 255;
--- a/contentstorage/srvinc/cainstallstrategy.h	Mon May 24 20:50:46 2010 +0300
+++ b/contentstorage/srvinc/cainstallstrategy.h	Fri May 28 16:17:03 2010 +0300
@@ -156,9 +156,10 @@
 private:
 
     /**
-     * Contains uid of application that was started to uninstall.
+     * Contains uninstallation status of application 
+     * that was started to uninstall.
      */
-    TInt iAppUid;
+    TInt iUninstallStatus;
 
     };
 
--- a/contentstorage/srvsrc/cainstallstrategy.cpp	Mon May 24 20:50:46 2010 +0300
+++ b/contentstorage/srvsrc/cainstallstrategy.cpp	Fri May 28 16:17:03 2010 +0300
@@ -18,6 +18,7 @@
 #include <SWInstallerInternalPSKeys.h>
 #include <javadomainpskeys.h>
 #include "cainstallstrategy.h"
+#include <swi/swispubsubdefs.h>
 
 // ---------------------------------------------------------------------------
 //
@@ -140,16 +141,16 @@
 void CCaUsifUninstallStrategy::NotifyListenerL(
 		RProperty& aProperty, MCaInstallListener& aListener )
     {
-    TInt appUid;
-    User::LeaveIfError( aProperty.Get( KPSUidSWInstallerUiNotification,
-            KSWInstallerUninstallation, appUid ) );
-    // if there is some value!=0 in iAppUid and appUid==0 that means
-    // application with uid==iAppUid was uninstalled, so we notify aListener
-    if( iAppUid && !appUid )
+    TInt status;
+    // TODO: Temporary solution for incorrect USIF notifications     
+    User::LeaveIfError( aProperty.Get( KUidSystemCategory,
+            Swi::KUidSoftwareInstallKey, status ) );
+    //if( status == ( Swi::ESwisStatusSuccess | Swi::ESwisUninstall ) )
+    if( iUninstallStatus == Swi::ESwisUninstall && !status )
         {
-        aListener.HandleInstallNotifyL( iAppUid );
-        }
-    iAppUid = appUid;
+        aListener.HandleInstallNotifyL( iUninstallStatus );
+        }    
+    iUninstallStatus = status;
     }
 
 // ---------------------------------------------------------------------------
@@ -158,8 +159,7 @@
 //
 CCaUsifUninstallStrategy::CCaUsifUninstallStrategy( RProperty& aProperty )
     {
-	aProperty.Attach(
-			KPSUidSWInstallerUiNotification, KSWInstallerUninstallation );
+	aProperty.Attach( KUidSystemCategory, Swi::KUidSoftwareInstallKey );
     }
 
 // ---------------------------------------------------------------------------
--- a/homescreensrv_plat/contentstorage_api/cadefs.h	Mon May 24 20:50:46 2010 +0300
+++ b/homescreensrv_plat/contentstorage_api/cadefs.h	Fri May 28 16:17:03 2010 +0300
@@ -70,7 +70,7 @@
     UnknownErrorCode
 };
 
-const QString caCmdOpen("open");
+static const QString caCmdOpen("open");
 
 #ifndef QT_NO_DEBUG_OUTPUT
 #   define USE_QDEBUG_IF(predicate) if (!predicate) {} else qDebug()
--- a/homescreensrv_plat/contentstorage_api/caitemmodel.h	Mon May 24 20:50:46 2010 +0300
+++ b/homescreensrv_plat/contentstorage_api/caitemmodel.h	Fri May 28 16:17:03 2010 +0300
@@ -81,6 +81,7 @@
 
     void scrollTo(int row, QAbstractItemView::ScrollHint hint =
         QAbstractItemView::EnsureVisible);
+    void empty(bool value);
 
 protected:
     // data
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/backstepping/backstepping.pro	Fri May 28 16:17:03 2010 +0300
@@ -0,0 +1,20 @@
+#
+# 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:
+#
+
+TEMPLATE = subdirs
+symbian {
+    BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include \"group/bld.inf\""
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/backstepping/bwins/tsbacksteppingu.def	Fri May 28 16:17:03 2010 +0300
@@ -0,0 +1,5 @@
+EXPORTS
+	?NewLC@CTsBackstepping@@SAPAV1@AAVRWsSession@@@Z @ 1 NONAME ; class CTsBackstepping * CTsBackstepping::NewLC(class RWsSession &)
+	?NewL@CTsBackstepping@@SAPAV1@AAVRWsSession@@@Z @ 2 NONAME ; class CTsBackstepping * CTsBackstepping::NewL(class RWsSession &)
+	??1CTsBackstepping@@UAE@XZ @ 3 NONAME ; CTsBackstepping::~CTsBackstepping(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/backstepping/eabi/tsbacksteppingu.def	Fri May 28 16:17:03 2010 +0300
@@ -0,0 +1,9 @@
+EXPORTS
+	_ZN15CTsBackstepping4NewLER10RWsSession @ 1 NONAME
+	_ZN15CTsBackstepping5NewLCER10RWsSession @ 2 NONAME
+	_ZN15CTsBacksteppingD0Ev @ 3 NONAME
+	_ZN15CTsBacksteppingD1Ev @ 4 NONAME
+	_ZN15CTsBacksteppingD2Ev @ 5 NONAME
+	_ZTI15CTsBackstepping @ 6 NONAME
+	_ZTV15CTsBackstepping @ 7 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/backstepping/group/bld.inf	Fri May 28 16:17:03 2010 +0300
@@ -0,0 +1,21 @@
+/*
+* 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:
+*
+*/
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_MMPFILES
+tsbackstepping.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/backstepping/group/tsbackstepping.mmp	Fri May 28 16:17:03 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* 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:
+*
+*/
+
+TARGET         tsbackstepping.dll
+TARGETTYPE     dll
+UID            0x1000008d  0x200267AD
+SECUREID       0x200267AD
+CAPABILITY     ALL -TCB
+
+EPOCHEAPSIZE   0x100000 0x600000 // 1MB - 6MB
+
+MW_LAYER_SYSTEMINCLUDE
+
+USERINCLUDE    ../inc
+
+SOURCEPATH     ../src
+SOURCE         tsbackstepping.cpp
+
+LIBRARY        euser.lib 
+LIBRARY        ws32.lib // for RWsSession
+LIBRARY        apgrfx.lib // for TApaTask / TApaTasksList
+
+DEBUGLIBRARY    flogger.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/backstepping/inc/tsbackstepping.h	Fri May 28 16:17:03 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:
+*
+*/
+
+#ifndef __CBACKSTEPPING_H
+#define __CBACKSTEPPING_H
+
+#include <w32std.h>
+
+
+
+class CTsBackstepping : public CActive
+{
+public:
+    IMPORT_C static CTsBackstepping* NewL(RWsSession &);
+    IMPORT_C static CTsBackstepping* NewLC(RWsSession &);
+    IMPORT_C virtual ~CTsBackstepping();
+
+private:
+    CTsBackstepping(RWsSession&);
+    void ConstructL();
+    void RunL();
+    TInt RunError(TInt error);
+    void DoCancel();
+    void Subscribe();
+    void AnalyseWindowStackL();
+
+private:
+    RWsSession &mWsSession;
+    RWindowGroup mWg;
+};
+
+#endif // __CBACKSTEPPING_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/backstepping/src/tsbackstepping.cpp	Fri May 28 16:17:03 2010 +0300
@@ -0,0 +1,213 @@
+/*
+* 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:
+*
+*/
+
+#include <w32std.h>// key event
+#include <apgwgnam.h>// for CApaWindowGroupName
+#include <apgtask.h>
+#include <coedef.h>
+#include <f32file.h>
+#include <flogger.h>
+#include <e32property.h>
+#include <startupdomainpskeys.h>
+
+#include "tsbackstepping.h"
+
+const TUid KHSUid = {0x20022f35};
+const int KOrdinalPositionNoZOrder(-1);
+
+
+/** 
+ *  CTsBackstepping::NewL
+ *  two phase constructor
+ */
+EXPORT_C CTsBackstepping* CTsBackstepping::NewL(RWsSession &session)
+  {
+  RDebug::Print(_L("CTsBackstepping::NewL"));
+  CTsBackstepping* self = CTsBackstepping::NewLC(session);
+  CleanupStack::Pop(self);
+  return self;
+  }
+
+/** 
+ *  CTsBackstepping::NewLC
+ *  two phase constructor
+ */
+EXPORT_C CTsBackstepping* CTsBackstepping::NewLC(RWsSession &session)
+{ 
+  CTsBackstepping* self = new (ELeave) CTsBackstepping(session);
+  CleanupStack::PushL(self);
+  self->ConstructL();
+  return self;
+}
+
+/** 
+ * CTsBackstepping::CTsBackstepping
+ * constructor
+ */
+CTsBackstepping::CTsBackstepping(RWsSession &session)
+:CActive(EPriorityStandard),
+mWsSession(session)
+{
+    CActiveScheduler::Add(this);
+}
+
+
+/** 
+ *  CTsBackstepping::~CTsBackstepping
+ *  deconstructor
+ */
+EXPORT_C CTsBackstepping::~CTsBackstepping()
+{
+    RDebug::Print(_L("CTsBackstepping::~CTsBackstepping"));
+    // Cancel AO
+    Cancel();
+    // Close opened session
+    mWg.Close();
+    
+}
+
+/** 
+ *  CTsBackstepping::ConstructL
+ *  two phase constructor
+ */
+void CTsBackstepping::ConstructL ()
+{
+    RDebug::Print(_L("CTsBackstepping::ConstructL"));
+    // Initial window group
+    mWg = RWindowGroup (mWsSession);
+    User::LeaveIfError (mWg.Construct ((TUint32)&mWg, EFalse));
+    mWg.SetOrdinalPosition (KOrdinalPositionNoZOrder);
+    mWg.EnableReceiptOfFocus (EFalse);
+
+    // Hide window
+    CApaWindowGroupName* wn = CApaWindowGroupName::NewLC (mWsSession);
+    wn->SetHidden (ETrue);
+    wn->SetWindowGroupName (mWg);
+    CleanupStack::PopAndDestroy (wn);
+
+    // Window group change event
+    User::LeaveIfError (mWg.EnableGroupListChangeEvents());
+    
+    TRAP_IGNORE(AnalyseWindowStackL());//not critical operation
+    Subscribe();
+}
+
+/** 
+ *  CTsBackstepping::RunL
+ *  called for handling events from window server
+ */
+void CTsBackstepping::RunL()
+{
+    User::LeaveIfError(iStatus.Int());
+    TWsEvent wsEvent;
+    mWsSession.GetEvent (wsEvent);
+    if (EEventWindowGroupListChanged == wsEvent.Type()) {
+        RDebug::Print(_L("CTsBackstepping::RunL : EEventWindowGroupListChanged"));
+        AnalyseWindowStackL ();
+    }
+    Subscribe();
+}
+
+/** 
+ *  CTsBackstepping::DoCancel
+ *  Handling RunL errors.
+ */
+TInt CTsBackstepping::RunError(TInt error)
+{
+    if (!IsActive() && KErrCancel != error) {
+        Subscribe();
+    }
+    return KErrNone;
+}
+
+/** 
+ *  CTsBackstepping::DoCancel
+ *  Stopping active object
+ */
+void CTsBackstepping::DoCancel ()
+{
+    if (IsActive()) {
+        mWsSession.EventReadyCancel();
+    }
+}
+
+/** 
+ *  CTsBackstepping::ActivateListeningL
+ *  Starts listening to Window session events
+ */
+void CTsBackstepping::Subscribe()
+{
+    RDebug::Print(_L("CTsBackstepping::Subscribe"));
+    // and start listening
+    iStatus = KRequestPending;
+    mWsSession.EventReady( &iStatus );
+    SetActive();
+}
+
+/** 
+ * CTsBackstepping::AnalyseWindowStackL
+ * Analyzes window stack and move homescreen to proper position
+ */
+void CTsBackstepping::AnalyseWindowStackL ()
+{  
+    RDebug::Print(_L("CTsBackstepping::GetWindowCaption"));
+    
+    RArray<RWsSession::TWindowGroupChainInfo> windowGroups;
+    CleanupClosePushL(windowGroups);
+    
+    CApaWindowGroupName *windowGroupName = CApaWindowGroupName::NewLC(mWsSession );
+    //update window group list
+    mWsSession.WindowGroupList( &windowGroups );
+    
+    TInt count(windowGroups.Count());
+    TInt pos(0);
+    TInt whereToJump(1);
+    for (TInt i=0; i<count; i++) {//iterate through list and give debug info
+        const RWsSession::TWindowGroupChainInfo& info = windowGroups[i];
+        windowGroupName->ConstructFromWgIdL(info.iId);
+        if (windowGroupName->AppUid() != TUid::Null()) {
+            // find the window group id and check that it has no parent
+            if ( info.iParentId <= 0 ) {
+                RDebug::Print( _L("CTsBackstepping::GetWindowCaption wgid:%d is standalone view"), info.iId);
+                //check if it is homescreen 
+                if (windowGroupName->AppUid() == KHSUid) {
+                    RDebug::Print(_L("CTsBackstepping::GetWindowCaption Homescreen position = %d ; list:%d/%d"), pos, i, count);
+                    if (pos <= 1) {// HS is in foreground or second in line - do nothing 
+                        RDebug::Print(_L("CTsBackstepping::nothing to be done - it will stop checking here"));
+                    } else {//we should move homescreen to be second (ommit embeded views) from top
+                        RDebug::Print(_L("CTsBackstepping::moving homescreen to be second from top"));
+                        RDebug::Print(_L("CTsBackstepping::whereToJump = %d"), whereToJump);
+                        mWsSession.SetWindowGroupOrdinalPosition(info.iId, whereToJump);
+                    }
+                    // and break
+                    break;
+                }
+                pos++;
+            } else {
+                // only embeded items for first standalone launch should be counted
+                if (!pos) {
+                    ++whereToJump;
+                }
+                RDebug::Print(_L("CTsBackstepping::GetWindowCaption wgid:%d is embedded view"), info.iId);
+            }
+        }
+    }
+    CleanupStack::PopAndDestroy(windowGroupName);
+    CleanupStack::PopAndDestroy(&windowGroups);
+}
+
+// end of file
--- a/tstaskmonitor/client/client.pri	Mon May 24 20:50:46 2010 +0300
+++ b/tstaskmonitor/client/client.pri	Fri May 28 16:17:03 2010 +0300
@@ -25,24 +25,35 @@
 symbian {
     INCLUDEPATH +=  $$PWD/s60/inc \
                     $$PWD/../inc \
-                    $$PWD/../utils/inc \     
+                    $$PWD/../utils/inc \   
+                    $$PWD/../../inc \   
 
     HEADERS +=  $$PWD/s60/inc/tstaskmonitorobserver.h \
                 $$PWD/s60/inc/tstaskmonitorclient.h \
                 $$PWD/s60/inc/tstaskmonitorclientimpl.h \
-                $$PWD/s60/inc/tstaskmonitorsession.h \
+                $$PWD/s60/inc/tssession.h \
                 $$PWD/../utils/inc/tsfswentry.h \
+                $$PWD/../utils/inc/tsentrykey.h \
                 $$PWD/../utils/inc/tsutils.h \
                 $$PWD/s60/inc/tstaskmonitor_p.h \
                 $$PWD/s60/inc/tsapplicationtask.h \
+                $$PWD/s60/inc/tsscreenshotclient.h \
+                $$PWD/s60/inc/tsscreenshotclientimpl.h \
+                $$PWD/inc/tsscreenshotregistry.h \
+                $$PWD/s60/inc/tsscreenshotregistry_p.h \
                 
     SOURCES +=  $$PWD/s60/src/tstaskmonitorclient.cpp \
                 $$PWD/s60/src/tstaskmonitorclientimpl.cpp \
-                $$PWD/s60/src/tstaskmonitorsession.cpp \
+                $$PWD/s60/src/tssession.cpp \
                 $$PWD/../utils/src/tsfswentry.cpp \
+                $$PWD/../utils/src/tsentrykey.cpp \                              
                 $$PWD/s60/src/tstaskmonitor_p.cpp \
                 $$PWD/s60/src/tstask.cpp \
                 $$PWD/s60/src/tsapplicationtask.cpp \
+                $$PWD/s60/src/tsscreenshotclient.cpp \
+                $$PWD/s60/src/tsscreenshotclientimpl.cpp \
+                $$PWD/src/tsscreenshotregistry.cpp \
+                $$PWD/s60/src/tsscreenshotregistry_p.cpp \
 
     LIBS    +=  -lxqutils \
                 -lestor \
@@ -53,9 +64,11 @@
 
     HEADERS +=  $$PWD/stub/inc/tstaskmonitor_p.h \
                 $$PWD/stub/inc/tsfswentry.h \
+                $$PWD/stub/inc/tsscreenshotregistry_p.h \
                 
     SOURCES +=  $$PWD/stub/src/tstaskmonitor_p.cpp \
                 $$PWD/stub/src/tstask.cpp \
                 $$PWD/stub/src/tsfswentry.cpp \
+                $$PWD/stub/src/tsscreenshotregistry_p.cpp \
                 
 }
--- a/tstaskmonitor/client/client.pro	Mon May 24 20:50:46 2010 +0300
+++ b/tstaskmonitor/client/client.pro	Fri May 28 16:17:03 2010 +0300
@@ -25,12 +25,15 @@
     dll.sources = tstaskmonitorclient.dll
     dll.path = $$SHARED_LIB_DIR
     DEPLOYMENT += dll
+    LIBS += -ltsutils
 
     BLD_INF_RULES.prj_exports +=    "s60\inc\tstaskmonitorclient.h" \
                                     "s60\inc\tstaskmonitorobserver.h" \
                                     "inc\tstaskmonitor.h" \
                                     "inc\tstask.h" \
                                     "inc\tstaskmonitor_global.h" \
+                                    "s60\inc\tsscreenshotclient.h" \
+                                    "inc\tsscreenshotregistry.h" \
 
     TARGET.UID3 = 0x200267AF    
     TARGET.CAPABILITY = ALL -TCB
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/inc/tsscreenshotregistry.h	Fri May 28 16:17:03 2010 +0300
@@ -0,0 +1,40 @@
+/*
+* 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 TSSCREENSHOTREGISTRY_H
+#define TSSCREENSHOTREGISTRY_H
+
+#include <QPixmap>
+
+#include "tstaskmonitor_global.h"
+
+class TsScreenshotRegistryPrivate;
+
+class TSTASKMONITOR_EXPORT TsScreenshotRegistry
+{
+    
+public:
+    TsScreenshotRegistry();
+    ~TsScreenshotRegistry();
+    
+    bool registerScreenshot(const QPixmap &screenshot);
+    bool unregisterScreenshot();
+    
+private:
+    TsScreenshotRegistryPrivate *d_ptr;   
+};
+
+#endif //TSSCREENSHOTREGISTRY_H
--- a/tstaskmonitor/client/inc/tstask.h	Mon May 24 20:50:46 2010 +0300
+++ b/tstaskmonitor/client/inc/tstask.h	Fri May 28 16:17:03 2010 +0300
@@ -36,6 +36,7 @@
     
     TSTASKMONITOR_EXPORT bool isClosable() const;
     TSTASKMONITOR_EXPORT QPixmap icon() const;
+    TSTASKMONITOR_EXPORT QPixmap screenshot() const;
     TSTASKMONITOR_EXPORT QString name() const;
     
 protected:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/s60/inc/tsscreenshotclient.h	Fri May 28 16:17:03 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: 
+*
+*/
+#ifndef TSSCREENSHOTCLIENT_H
+#define TSSCREENSHOTCLIENT_H
+
+#include <e32base.h>
+
+#include "tstaskmonitorglobals.h"
+
+class CFbsBitmap;
+class CTsScreenshotClientImpl;
+
+NONSHARABLE_CLASS( CTsScreenshotClient ) : public CBase
+{
+public:
+    IMPORT_C static CTsScreenshotClient* NewL();
+    IMPORT_C static CTsScreenshotClient* NewLC();
+    IMPORT_C ~CTsScreenshotClient();
+
+public:
+    IMPORT_C TInt RegisterScreenshot(CFbsBitmap *screenshot, TInt wgId, UpdatePriority priority = Normal);
+    IMPORT_C void RegisterScreenshot(TRequestStatus &status, CFbsBitmap *screenshot, TInt wgId, UpdatePriority priority = Normal);
+    IMPORT_C TInt UnregisterScreenshot(TInt wgId);
+
+private:
+    CTsScreenshotClient();
+    void ConstructL();
+
+private:
+    CTsScreenshotClientImpl* iImpl;
+};
+
+#endif  // TSSCREENSHOTCLIENT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/s60/inc/tsscreenshotclientimpl.h	Fri May 28 16:17:03 2010 +0300
@@ -0,0 +1,45 @@
+/*
+* 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 TSSCREENSHOTCLIENTIMPL_H
+#define TSSCREENSHOTCLIENTIMPL_H
+
+#include <e32base.h>
+
+#include "tssession.h"
+
+class CFbsBitmap;
+
+NONSHARABLE_CLASS( CTsScreenshotClientImpl ) : public CBase
+{
+public:
+    static CTsScreenshotClientImpl* NewL();
+    static CTsScreenshotClientImpl* NewLC();
+    ~CTsScreenshotClientImpl();
+
+public:
+    TInt RegisterScreenshot(CFbsBitmap *screenshot, TInt wgId, UpdatePriority priority);
+    void RegisterScreenshot(TRequestStatus &status, CFbsBitmap *screenshot, TInt wgId, UpdatePriority priority);
+    TInt UnregisterScreenshot(TInt wgId);
+
+private:
+    CTsScreenshotClientImpl();
+    void ConstructL();
+
+    RTsSession iSession;
+};
+
+#endif  // TSSCREENSHOTCLIENTIMPL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/s60/inc/tsscreenshotregistry_p.h	Fri May 28 16:17:03 2010 +0300
@@ -0,0 +1,42 @@
+/*
+* 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 TSSCREENSHOTREGISTRY_P_H
+#define TSSCREENSHOTREGISTRY_P_H
+
+#include <QPixmap>
+
+class CTsScreenshotClient;
+
+class TsScreenshotRegistryPrivate
+{
+public:
+    TsScreenshotRegistryPrivate();
+    ~TsScreenshotRegistryPrivate();
+
+public:
+    bool registerScreenshot(const QPixmap &screenshot);
+    bool unregisterScreenshot();
+    
+private:
+    int wgId();
+    
+private:
+    CTsScreenshotClient *mClient;   
+    
+};
+
+#endif //TSSCREENSHOTREGISTRY_P_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/s60/inc/tssession.h	Fri May 28 16:17:03 2010 +0300
@@ -0,0 +1,44 @@
+/*
+* 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 TSSESSION_H
+#define TSSESSION_H
+
+#include <e32base.h>
+
+#include "tstaskmonitorglobals.h"
+#include "tsfswentry.h"
+
+NONSHARABLE_CLASS( RTsSession ) : public RSessionBase
+{
+public:
+    TInt Connect();
+
+public: // task monitor API
+    void TaskListL(RTsFswArray& tasks);
+    void Subscribe(TRequestStatus& aStatus);
+    void CancelSubscribe();
+
+public: // screenshots API
+    TInt RegisterScreenshot(CFbsBitmap *screenshot, TInt wgId, UpdatePriority priority);
+    void RegisterScreenshot(TRequestStatus &status, CFbsBitmap *screenshot, TInt wgId, UpdatePriority priority);
+    TInt UnregisterScreenshot(TInt wgId);    
+    
+private:
+    TInt StartServer();
+};
+
+#endif  // TSSESSION_H
--- a/tstaskmonitor/client/s60/inc/tstaskmonitorclient.h	Mon May 24 20:50:46 2010 +0300
+++ b/tstaskmonitor/client/s60/inc/tstaskmonitorclient.h	Fri May 28 16:17:03 2010 +0300
@@ -27,9 +27,9 @@
 NONSHARABLE_CLASS( CTsTaskMonitorClient ) : public CBase
 {
 public:
-    IMPORT_C static CTsTaskMonitorClient* NewL();
-    IMPORT_C static CTsTaskMonitorClient* NewLC();
-    IMPORT_C ~CTsTaskMonitorClient();
+    static CTsTaskMonitorClient* NewL();
+    static CTsTaskMonitorClient* NewLC();
+    ~CTsTaskMonitorClient();
 
 public:
     void TaskListL(RTsFswArray& tasks);
--- a/tstaskmonitor/client/s60/inc/tstaskmonitorclientimpl.h	Mon May 24 20:50:46 2010 +0300
+++ b/tstaskmonitor/client/s60/inc/tstaskmonitorclientimpl.h	Fri May 28 16:17:03 2010 +0300
@@ -20,7 +20,7 @@
 #include <e32base.h>
 
 #include "tsfswentry.h"
-#include "tstaskmonitorsession.h"
+#include "tssession.h"
 
 class MTsTaskMonitorObserver;
 
@@ -45,7 +45,7 @@
     CTsTaskMonitorClientImpl();
     void ConstructL();
 
-    RTsTaskMonitorSession iSession;
+    RTsSession iSession;
     MTsTaskMonitorObserver* iObserver; // not owned
 };
 
--- a/tstaskmonitor/client/s60/inc/tstaskmonitorsession.h	Mon May 24 20:50:46 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
-* 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 TSTASKMONITORSESSION_H
-#define TSTASKMONITORSESSION_H
-
-#include <e32base.h>
-
-#include "tsfswentry.h"
-
-NONSHARABLE_CLASS( RTsTaskMonitorSession ) : public RSessionBase
-{
-public:
-    TInt Connect();
-
-    void TaskListL(RTsFswArray& tasks);
-    void Subscribe(TRequestStatus& aStatus);
-    void CancelSubscribe();
-
-private:
-    TInt StartServer();
-};
-
-#endif  // TSTASKMONITORSESSION_H
--- a/tstaskmonitor/client/s60/src/tsapplicationtask.cpp	Mon May 24 20:50:46 2010 +0300
+++ b/tstaskmonitor/client/s60/src/tsapplicationtask.cpp	Fri May 28 16:17:03 2010 +0300
@@ -19,7 +19,7 @@
 
 #include <apgtask.h>
 #include <eikenv.h>
-#include <akndef.h>
+#include <AknDef.h>
 
 #include "tsfswentry.h"
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/s60/src/tsscreenshotclient.cpp	Fri May 28 16:17:03 2010 +0300
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#include <s32mem.h>
+
+#include "tsscreenshotclient.h"
+#include "tsscreenshotclientimpl.h"
+
+EXPORT_C CTsScreenshotClient *CTsScreenshotClient::NewL()
+{
+    CTsScreenshotClient* self = NewLC();
+    CleanupStack::Pop(self);
+    return self;
+}
+
+EXPORT_C CTsScreenshotClient *CTsScreenshotClient::NewLC()
+{
+    CTsScreenshotClient* self = new (ELeave) CTsScreenshotClient;
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+}
+
+void CTsScreenshotClient::ConstructL()
+{
+    iImpl = CTsScreenshotClientImpl::NewL();
+}
+
+CTsScreenshotClient::CTsScreenshotClient()
+{
+}
+
+EXPORT_C CTsScreenshotClient::~CTsScreenshotClient()
+{
+    delete iImpl;
+}
+
+EXPORT_C TInt CTsScreenshotClient::RegisterScreenshot(CFbsBitmap *screenshot, TInt wgId, UpdatePriority priority)
+{
+    return iImpl->RegisterScreenshot(screenshot, wgId, priority);
+}
+
+EXPORT_C void CTsScreenshotClient::RegisterScreenshot(TRequestStatus &status, CFbsBitmap *screenshot, TInt wgId, UpdatePriority priority)
+{
+    iImpl->RegisterScreenshot(status, screenshot, wgId, priority);
+}
+
+EXPORT_C TInt CTsScreenshotClient::UnregisterScreenshot(TInt wgId)
+{
+    return iImpl->UnregisterScreenshot(wgId);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/s60/src/tsscreenshotclientimpl.cpp	Fri May 28 16:17:03 2010 +0300
@@ -0,0 +1,64 @@
+    /*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#include <e32base.h>
+
+#include "tsscreenshotclientimpl.h"
+
+CTsScreenshotClientImpl* CTsScreenshotClientImpl::NewL()
+{
+    CTsScreenshotClientImpl* self = NewLC();
+    CleanupStack::Pop(self);
+    return self;
+}
+
+CTsScreenshotClientImpl* CTsScreenshotClientImpl::NewLC()
+{
+    CTsScreenshotClientImpl* self = new (ELeave) CTsScreenshotClientImpl;
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+}
+
+CTsScreenshotClientImpl::CTsScreenshotClientImpl()
+{
+}
+
+CTsScreenshotClientImpl::~CTsScreenshotClientImpl()
+{
+    iSession.Close();
+}
+
+void CTsScreenshotClientImpl::ConstructL()
+{
+    User::LeaveIfError(iSession.Connect());
+}
+
+TInt CTsScreenshotClientImpl::RegisterScreenshot(CFbsBitmap *screenshot, TInt wgId, UpdatePriority priority)
+{
+    return iSession.RegisterScreenshot(screenshot, wgId, priority);
+}
+
+void CTsScreenshotClientImpl::RegisterScreenshot(TRequestStatus &status, CFbsBitmap *screenshot, TInt wgId, UpdatePriority priority)
+{
+    iSession.RegisterScreenshot(status, screenshot, wgId, priority);
+}
+
+TInt CTsScreenshotClientImpl::UnregisterScreenshot(TInt wgId)
+{
+    return iSession.UnregisterScreenshot(wgId);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/s60/src/tsscreenshotregistry_p.cpp	Fri May 28 16:17:03 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* 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: 
+*
+*/
+#include "tsscreenshotregistry_p.h"
+
+#include <fbs.h>
+#include <coecntrl.h>
+#include <QScopedPointer>
+#include <QApplication>
+#include <QDesktopWidget>
+
+#include "tsscreenshotclient.h"
+
+TsScreenshotRegistryPrivate::TsScreenshotRegistryPrivate() : mClient(0)
+{
+    QT_TRAP_THROWING(mClient = CTsScreenshotClient::NewL());
+}
+
+TsScreenshotRegistryPrivate::~TsScreenshotRegistryPrivate()
+{
+    delete mClient;
+}
+
+bool TsScreenshotRegistryPrivate::registerScreenshot(const QPixmap &screenshot)
+{    
+    QScopedPointer<CFbsBitmap> bitmap(screenshot.toSymbianCFbsBitmap());
+    if (bitmap.isNull()) 
+        return false;
+
+    return KErrNone == mClient->RegisterScreenshot(bitmap.data(), wgId());
+}
+
+bool TsScreenshotRegistryPrivate::unregisterScreenshot()
+{
+    return KErrNone == mClient->UnregisterScreenshot(wgId());
+}
+
+int TsScreenshotRegistryPrivate::wgId()
+{
+    return QApplication::desktop()->winId()->ControlEnv()->RootWin().WindowGroupId();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/s60/src/tssession.cpp	Fri May 28 16:17:03 2010 +0300
@@ -0,0 +1,140 @@
+/*
+* 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:
+*
+*/
+#include <s32mem.h>
+#include <fbs.h>
+
+#include "tssession.h"
+
+TInt RTsSession::Connect()
+{
+    TInt retry = 4;
+    TInt error(KErrNone);
+    do {
+        error = CreateSession(KRunningAppServerName, TVersion(0, 0, 0));
+        if (KErrNotFound != error && KErrServerTerminated != error) {
+            retry = 0;
+        } else {
+            error = StartServer();
+            if (KErrNone != error && KErrAlreadyExists != error) {
+                retry = 0;
+                error = CreateSession(KRunningAppServerName, TVersion(0, 0, 0));
+            }
+        }
+    } while (--retry > 0);
+    return error;
+}
+
+TInt RTsSession::StartServer()
+{
+    RProcess server;
+    if (TInt error = server.Create(KRunningAppServerName, KNullDesC, TUidType(KNullUid, KNullUid, KRunningAppServerUid))) {
+        return error;
+    }
+
+    TRequestStatus status;
+    server.Rendezvous(status);
+    if (status != KRequestPending) {
+        server.Kill(0);
+    } else {
+        server.Resume();
+    }
+
+    User::WaitForRequest(status);
+    TInt error = (EExitPanic == server.ExitType()) ? KErrGeneral : status.Int();
+    if (KErrCancel == error) {
+        error = KErrNone;
+    }
+    server.Close();
+
+    return error;
+}
+
+void RTsSession::TaskListL(RTsFswArray& tasks)
+{
+    for (;;) {
+        TPckgBuf<TInt> dataSize;
+        User::LeaveIfError(SendReceive(GetRunningAppInfo, TIpcArgs(&dataSize)));
+        HBufC8* data = HBufC8::NewLC(dataSize());
+        TPtr8 dataPointer(data->Des());
+        TInt err = SendReceive(FlushData, TIpcArgs(&dataPointer, dataSize()));
+        if (err == KErrNone) {
+            RDesReadStream dataStream(dataPointer);
+            CleanupClosePushL(dataStream);
+            CTsFswEntry::InternalizeArrayL(dataStream, tasks);
+            CleanupStack::PopAndDestroy(&dataStream);
+        } else if (err != KErrCorrupt) {
+            User::Leave(err);
+        }
+        CleanupStack::PopAndDestroy(data);
+        if (err == KErrNone) {
+            break;
+        }
+        // If result was KErrCorrupt then the size received from GetRunningAppInfo is
+        // not valid anymore so restart the whole procedure.
+    }
+}
+
+void RTsSession::Subscribe(TRequestStatus& aStatus)
+{
+    SendReceive(SubscribeRunningAppChanges, aStatus);
+}
+
+void RTsSession::CancelSubscribe()
+{
+    SendReceive(CancelSubscribeRunningAppChanges);
+}
+
+TInt RTsSession::RegisterScreenshot(CFbsBitmap *screenshot, TInt wgId, UpdatePriority priority)
+{
+    TPckgBuf<TInt> screenshotPackage(screenshot->Handle());
+    TPckgBuf<TInt> wgIdPackage(wgId);
+    TPckgBuf<TInt> priorityPackage(priority);
+
+    TIpcArgs arguments;
+    arguments.Set(ScreenshotHandle, &screenshotPackage);
+    arguments.Set(WindowsGroup, &wgIdPackage);
+    arguments.Set(AdditionalParameters, &KNullDesC8);
+    arguments.Set(Priority, &priorityPackage);
+
+    return SendReceive(RegisterScreenshotMessage, arguments);
+}
+
+void RTsSession::RegisterScreenshot(TRequestStatus &status, CFbsBitmap *screenshot, TInt wgId, UpdatePriority priority)
+{
+    TPckgBuf<TInt> screenshotPackage(screenshot->Handle());
+    TPckgBuf<TInt> wgIdPackage(wgId);
+    TPckgBuf<TInt> priorityPackage(priority);
+
+    TIpcArgs arguments;
+    arguments.Set(ScreenshotHandle, &screenshotPackage);
+    arguments.Set(WindowsGroup, &wgIdPackage);
+    arguments.Set(AdditionalParameters, &KNullDesC8);
+    arguments.Set(Priority, &priorityPackage);
+
+    SendReceive(RegisterScreenshotMessage, arguments, status);
+}
+
+TInt RTsSession::UnregisterScreenshot(TInt wgId)
+{
+    TPckgBuf<TInt> wgIdPackage(wgId);
+    
+    TIpcArgs arguments;
+    arguments.Set(WindowsGroup, &wgIdPackage);
+    arguments.Set(AdditionalParameters, &KNullDesC8);
+    
+    return SendReceive(UnregisterScreenshotMessage, arguments);
+}
--- a/tstaskmonitor/client/s60/src/tstask.cpp	Mon May 24 20:50:46 2010 +0300
+++ b/tstaskmonitor/client/s60/src/tstask.cpp	Fri May 28 16:17:03 2010 +0300
@@ -16,7 +16,7 @@
 */
 #include "tstask.h"
 
-#include <xqconversions>
+#include <XQConversions>
 
 #include "tsfswentry.h"
 
@@ -43,6 +43,11 @@
     return pixmap;
 }
 
+QPixmap TsTask::screenshot() const
+{
+    return QPixmap::fromSymbianCFbsBitmap(mEntry->Screenshot());
+}
+
 QString TsTask::name() const
 {
     return XQConversions::s60DescToQString(mEntry->AppName());
--- a/tstaskmonitor/client/s60/src/tstaskmonitor_p.cpp	Mon May 24 20:50:46 2010 +0300
+++ b/tstaskmonitor/client/s60/src/tstaskmonitor_p.cpp	Fri May 28 16:17:03 2010 +0300
@@ -32,6 +32,7 @@
 TsTaskMonitorPrivate::~TsTaskMonitorPrivate()
 {
     mClient->CancelSubscribe();
+    delete mClient;
 }
 
 QList< QSharedPointer<TsTask> > TsTaskMonitorPrivate::taskList()
--- a/tstaskmonitor/client/s60/src/tstaskmonitorclient.cpp	Mon May 24 20:50:46 2010 +0300
+++ b/tstaskmonitor/client/s60/src/tstaskmonitorclient.cpp	Fri May 28 16:17:03 2010 +0300
@@ -20,14 +20,14 @@
 #include "tstaskmonitorclient.h"
 #include "tstaskmonitorclientimpl.h"
 
-EXPORT_C CTsTaskMonitorClient *CTsTaskMonitorClient::NewL()
+CTsTaskMonitorClient *CTsTaskMonitorClient::NewL()
 {
     CTsTaskMonitorClient* self = NewLC();
     CleanupStack::Pop(self);
     return self;
 }
 
-EXPORT_C CTsTaskMonitorClient *CTsTaskMonitorClient::NewLC()
+CTsTaskMonitorClient *CTsTaskMonitorClient::NewLC()
 {
     CTsTaskMonitorClient* self = new (ELeave) CTsTaskMonitorClient;
     CleanupStack::PushL(self);
@@ -44,7 +44,7 @@
 {
 }
 
-EXPORT_C CTsTaskMonitorClient::~CTsTaskMonitorClient()
+CTsTaskMonitorClient::~CTsTaskMonitorClient()
 {
     delete iImpl;
 }
--- a/tstaskmonitor/client/s60/src/tstaskmonitorsession.cpp	Mon May 24 20:50:46 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,99 +0,0 @@
-/*
-* 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: 
-*
-*/
-#include <s32mem.h>
-
-#include "tstaskmonitorsession.h"
-#include "tstaskmonitorglobals.h"
-
-void RTsTaskMonitorSession::TaskListL(RTsFswArray& tasks)
-{
-    for (;;) {
-        TPckgBuf<TInt> dataSize;
-        User::LeaveIfError(SendReceive(GetRunningAppInfo, TIpcArgs(&dataSize)));
-        HBufC8* data = HBufC8::NewLC(dataSize());
-        TPtr8 dataPointer(data->Des());
-        TInt err = SendReceive(FlushData, TIpcArgs(&dataPointer, dataSize()));
-        if (err == KErrNone) {
-            RDesReadStream dataStream(dataPointer);
-            CleanupClosePushL(dataStream);
-            CTsFswEntry::InternalizeArrayL(dataStream, tasks);
-            CleanupStack::PopAndDestroy(&dataStream);
-        } else if (err != KErrCorrupt) {
-            User::Leave(err);
-        }
-        CleanupStack::PopAndDestroy(data);
-        if (err == KErrNone) {
-            break;
-        }
-        // If result was KErrCorrupt then the size received from GetRunningAppInfo is
-        // not valid anymore so restart the whole procedure.
-    }
-}
-
-TInt RTsTaskMonitorSession::StartServer()
-{
-    RProcess server;
-    if (TInt error = server.Create(KRunningAppServerName, KNullDesC, TUidType(KNullUid, KNullUid, KRunningAppServerUid))) {
-        return error;
-    }
-
-    TRequestStatus status;
-    server.Rendezvous(status);
-    if (status != KRequestPending) {
-        server.Kill(0);
-    } else {
-        server.Resume();
-    }
-
-    User::WaitForRequest(status);
-    TInt error = (EExitPanic == server.ExitType()) ? KErrGeneral : status.Int();
-    if (KErrCancel == error) {
-        error = KErrNone;
-    }
-    server.Close();
-
-    return error;
-}
-
-TInt RTsTaskMonitorSession::Connect()
-{
-    TInt retry = 4;
-    TInt error(KErrNone);
-    do {
-        error = CreateSession(KRunningAppServerName, TVersion(0, 0, 0));
-        if (KErrNotFound != error && KErrServerTerminated != error) {
-            retry = 0;
-        } else {
-            error = StartServer();
-            if (KErrNone != error && KErrAlreadyExists != error) {
-                retry = 0;
-                error = CreateSession(KRunningAppServerName, TVersion(0, 0, 0));
-            }
-        }
-    } while (--retry > 0);
-    return error;
-}
-
-void RTsTaskMonitorSession::Subscribe(TRequestStatus& aStatus)
-{
-    SendReceive(SubscribeRunningAppChanges, aStatus);
-}
-
-void RTsTaskMonitorSession::CancelSubscribe()
-{
-    SendReceive(CancelSubscribeRunningAppChanges);
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/src/tsscreenshotregistry.cpp	Fri May 28 16:17:03 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* 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: 
+*
+*/
+#include "tsscreenshotregistry.h"
+#include "tsscreenshotregistry_p.h"
+
+TsScreenshotRegistry::TsScreenshotRegistry() : d_ptr(new TsScreenshotRegistryPrivate())
+{
+}
+
+TsScreenshotRegistry::~TsScreenshotRegistry()
+{
+    delete d_ptr;
+}
+
+bool TsScreenshotRegistry::registerScreenshot(const QPixmap &screenshot)
+{
+    return d_ptr->registerScreenshot(screenshot);
+}
+
+bool TsScreenshotRegistry::unregisterScreenshot()
+{
+    return d_ptr->unregisterScreenshot();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/stub/inc/tsscreenshotregistry_p.h	Fri May 28 16:17:03 2010 +0300
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#ifndef TSSCREENSHOTREGISTRY_P_H
+#define TSSCREENSHOTREGISTRY_P_H
+
+#include <QPixmap>
+
+class TsScreenshotRegistryPrivate
+{
+public:
+    bool registerScreenshot(const QPixmap &screenshot);
+    bool unregisterScreenshot();
+};
+
+#endif //TSSCREENSHOTREGISTRY_P_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/stub/src/tsscreenshotregistry_p.cpp	Fri May 28 16:17:03 2010 +0300
@@ -0,0 +1,28 @@
+/*
+* 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: 
+*
+*/
+#include "tsscreenshotregistry_p.h"
+
+bool TsScreenshotRegistryPrivate::registerScreenshot(const QPixmap &screenshot)
+{
+    Q_UNUSED(screenshot);
+    return true;
+}
+
+bool TsScreenshotRegistryPrivate::unregisterScreenshot()
+{
+    return true;
+}
--- a/tstaskmonitor/client/stub/src/tstask.cpp	Mon May 24 20:50:46 2010 +0300
+++ b/tstaskmonitor/client/stub/src/tstask.cpp	Fri May 28 16:17:03 2010 +0300
@@ -37,6 +37,11 @@
     return QPixmap();
 }
 
+QPixmap TsTask::screenshot() const
+{
+    return QPixmap();
+}
+
 QString TsTask::name() const
 {
     return QString();
--- a/tstaskmonitor/inc/tstaskmonitorglobals.h	Mon May 24 20:50:46 2010 +0300
+++ b/tstaskmonitor/inc/tstaskmonitorglobals.h	Fri May 28 16:17:03 2010 +0300
@@ -30,6 +30,8 @@
     UpdateScreenshot,
     FlushData,
     CancelSubscribeRunningAppChanges,
+    RegisterScreenshotMessage,
+    UnregisterScreenshotMessage,
 };
 
 enum UpdatePriority {
@@ -37,5 +39,13 @@
     Normal,
     High
 };
+
+enum ScreenshotMessageOffsets {
+    ScreenshotHandle = 0,
+    WindowsGroup,
+    AdditionalParameters,
+    Priority
+};
+
 #endif  //RUNNINGAPPGLOBALS_H
 
--- a/tstaskmonitor/rom/tstaskmonitor_core.iby	Mon May 24 20:50:46 2010 +0300
+++ b/tstaskmonitor/rom/tstaskmonitor_core.iby	Fri May 28 16:17:03 2010 +0300
@@ -20,6 +20,11 @@
 file=ABI_DIR\BUILD_DIR\tstaskmonitorclient.dll              SHARED_LIB_DIR\tstaskmonitorclient.dll
 file=ABI_DIR\BUILD_DIR\hsrunningappmonitor.exe              PROGRAMS_DIR\hsrunningappmonitor.exe
 
+file=ABI_DIR\BUILD_DIR\tsbackstepping.dll                   SHARED_LIB_DIR\tsbackstepping.dll
+
+
+ECOM_PLUGIN( tsscreenshotplugin.dll, tsscreenshotplugin.rsc )
+
 // stub sis
 data=ZSYSTEM/install/taskmonitor_stub.sis                  system/install/taskmonitor_stub.sis
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/screenshotplugin/group/bld.inf	Fri May 28 16:17:03 2010 +0300
@@ -0,0 +1,21 @@
+/*
+* 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:
+*
+*/
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_MMPFILES
+tsscreenshotplugin.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/screenshotplugin/group/tsscreenshotplugin.mmp	Fri May 28 16:17:03 2010 +0300
@@ -0,0 +1,42 @@
+/*
+* 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:
+*
+*/
+TARGET          tsscreenshotplugin.dll
+TARGETTYPE      PLUGIN 
+UID             0x10009D8D 0x200267AE
+CAPABILITY      CAP_ECOM_PLUGIN
+VENDORID        VID_DEFAULT
+
+OPTION_REPLACE  ARMCC --arm -O3 --cpu 6
+
+MW_LAYER_SYSTEMINCLUDE
+
+USERINCLUDE     ../inc
+
+SOURCEPATH      ../src
+SOURCE          tsscreenshotmain.cpp
+SOURCE          tsscreenshotplugin.cpp
+
+RESOURCE        tsscreenshotplugin.rss
+
+LIBRARY         ecom.lib
+LIBRARY         euser.lib
+LIBRARY         wsgraphicdrawer.lib
+LIBRARY         fbscli.lib
+LIBRARY         estor.lib
+LIBRARY         gdi.lib 
+LIBRARY         tstaskmonitorclient.lib
+DEBUGLIBRARY    flogger.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/screenshotplugin/inc/tsscreenshotplugin.h	Fri May 28 16:17:03 2010 +0300
@@ -0,0 +1,87 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#ifndef TSSCREENSHOTPLUGIN_H
+#define TSSCREENSHOTPLUGIN_H
+
+#include <w32std.h>
+#include <graphics/wsgraphicdrawerinterface.h>
+#include <graphics/wsgraphicdrawer.h>
+
+class CTsScreenshotPlugin: public CWsGraphicDrawer, 
+                           public MWsEventHandler
+{
+public:
+    /**
+     * Two phase constructor 
+     */
+    
+    static CTsScreenshotPlugin* NewL();
+    
+    /**
+     * Destructor
+     */
+    ~CTsScreenshotPlugin();
+
+private:
+    /**
+     * From CWsGraphicDrawer.
+     * @see CWsGraphicDrawer::DoDraw(MWsGc&, const TRect&, const TDesC8&) const
+     */ 
+    void DoDraw(MWsGc&, const TRect&, const TDesC8&) const;
+    
+    /**
+     * From CWsGraphicDrawer
+     * @see CWsGraphicDrawer::HandleMessage(const TDesC8&)
+     */
+    void HandleMessage(const TDesC8&);
+    
+    void HandleMessageL(const TDesC8&);
+    
+    /**
+     * From CWsGraphicDrawer
+     * @see CWsGraphicDrawer::ConstructL(MWsGraphicDrawerEnvironment&, const TGraphicDrawerId& , MWsClient&, const TDesC8&)
+     */
+    void ConstructL(MWsGraphicDrawerEnvironment& env, 
+                    const TGraphicDrawerId& id, 
+                    MWsClient& owner, 
+                    const TDesC8& data);
+    
+    /**
+     * From MWsEventHandler.
+     * 
+     * @see MWsEventHandler::DoHandleEvent(const TWservCrEvent&)
+     */
+    void DoHandleEvent(const TWservCrEvent& event);
+    
+    /**
+     * Function take screenshot od current display
+     * @param screenshot identyfier
+     */
+    void TakeScreenshot(TInt);
+        
+    /**
+     * Function take screenshot od current display
+     * @param screenshot identyfier
+     */
+    void TakeScreenshotL(TInt);
+
+private:
+    RPointerArray<CFbsBitmap> mCache;
+    TInt mWindowGroupId;
+};
+
+#endif //TSSCREENSHOTPLUGIN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/screenshotplugin/screenshotplugin.pro	Fri May 28 16:17:03 2010 +0300
@@ -0,0 +1,20 @@
+#
+# 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:
+#
+
+TEMPLATE = subdirs
+
+BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include \"group/bld.inf\""
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/screenshotplugin/src/tsscreenshotmain.cpp	Fri May 28 16:17:03 2010 +0300
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include <ecom/implementationproxy.h>
+#include "tsscreenshotplugin.h"
+
+const TInt KImpId( 0x200267AE );
+
+// --------------------------------------------------------------------------
+// KImplementationTable
+// --------------------------------------------------------------------------
+//    
+LOCAL_C const TImplementationProxy KImplementationTable[] = 
+{
+    IMPLEMENTATION_PROXY_ENTRY(KImpId, CTsScreenshotPlugin::NewL)
+};
+
+// --------------------------------------------------------------------------
+// ImplementationGroupProxy
+// --------------------------------------------------------------------------
+//    
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+{
+    aTableCount = (sizeof(KImplementationTable) / sizeof(TImplementationProxy));
+    return KImplementationTable;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/screenshotplugin/src/tsscreenshotplugin.cpp	Fri May 28 16:17:03 2010 +0300
@@ -0,0 +1,176 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "tsscreenshotplugin.h"
+#include "tstaskmonitorglobals.h"
+#include <graphics/wsscreendevice.h>
+#include <s32mem.h>
+
+const TInt KMsgSize(5);
+const TInt KInvalidGroupId(~0);
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+CTsScreenshotPlugin* CTsScreenshotPlugin::NewL()
+{
+    //no second step construction is required here
+    //window server will initialize plugin later
+    return new(ELeave)CTsScreenshotPlugin();
+}
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+void CTsScreenshotPlugin::ConstructL(MWsGraphicDrawerEnvironment& env, 
+                                     const TGraphicDrawerId& id, 
+                                     MWsClient& owner, 
+                                     const TDesC8& /*data*/ )
+{
+    BaseConstructL(env, id, owner);
+    env.RegisterEventHandler(this, 
+                             this, 
+                             TWservCrEvent::EWindowGroupChanged |
+                             TWservCrEvent::EDeviceOrientationChanged);
+    mWindowGroupId = KInvalidGroupId;
+}
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+CTsScreenshotPlugin::~CTsScreenshotPlugin()
+{
+    Env().UnregisterEventHandler(this);
+    mCache.ResetAndDestroy();
+}
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+void CTsScreenshotPlugin::DoDraw(MWsGc&, const TRect&, const TDesC8&) const
+{
+    //plugin is not a real drawer
+    //no implementation required
+}
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+void CTsScreenshotPlugin::HandleMessage(const TDesC8& msg)
+{
+    TRAP_IGNORE(HandleMessageL(msg));
+}
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+void CTsScreenshotPlugin::HandleMessageL(const TDesC8& msg)
+{
+    TInt parsedMsg[KMsgSize];
+    RDesReadStream msgStream(msg);
+    for (TInt iter(0); iter < KMsgSize; ++iter) {
+        parsedMsg[iter] = msgStream.ReadInt32L(); 
+    }
+    
+    if (RegisterScreenshotMessage == parsedMsg[0]) { //Screenshot registeration ACK 
+        for(TInt iter(0); iter < mCache.Count(); ++iter) {
+            if (mCache[iter]->Handle() == parsedMsg[ScreenshotHandle + 1]) {
+                //bitmap is not needed no more
+                delete mCache[iter];
+                mCache.Remove(iter);
+                break;
+            }
+        }
+    }
+}
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+void CTsScreenshotPlugin::DoHandleEvent(const TWservCrEvent& event)
+{
+    switch (event.Type()) {
+    case TWservCrEvent::EWindowGroupChanged:
+        if (KInvalidGroupId != mWindowGroupId) {
+            TakeScreenshot(mWindowGroupId);
+        }
+        mWindowGroupId = event.WindowGroupIdentifier();
+        break;
+    case TWservCrEvent::EDeviceOrientationChanged:
+        TakeScreenshot(mWindowGroupId);
+        break;
+    }
+}
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+void CTsScreenshotPlugin::TakeScreenshot(TInt id)
+{
+    TRAP_IGNORE(TakeScreenshotL(id);)
+}
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+void CTsScreenshotPlugin::TakeScreenshotL(TInt id)
+{
+    if(0 >= Env().ScreenCount()) {
+        User::Leave(KErrCorrupt);
+    }
+    const TInt screenId(0); //use local variable in case of changing screen selection policy
+    const MWsScreenConfig* const screenConfig = 
+        Env().Screen(screenId)->ObjectInterface<MWsScreenConfig>();
+    const MWsScreenDevice* const screenDevice = 
+        static_cast<MWsScreenDevice*>(Env().Screen(screenId)->ResolveObjectInterface(MWsScreenDevice::EWsObjectInterfaceId));
+    
+    User::LeaveIfNull(screenConfig);
+    User::LeaveIfNull(screenDevice);
+    
+    //prepare destination bitmap
+    CFbsBitmap *bitmap = new (ELeave) CFbsBitmap();
+    CleanupStack::PushL(bitmap);
+    
+    
+    User::LeaveIfError(bitmap->Create(screenConfig->SizeInPixels(), 
+                                screenConfig->DisplayMode()));
+    
+    screenDevice->CopyScreenToBitmapL(bitmap, 
+                                      screenConfig->SizeInPixels());
+    
+    
+    //prepare and send message
+    TInt msg[KMsgSize] = {RegisterScreenshotMessage};
+    
+    msg[WindowsGroup + 1] = id;
+    msg[ScreenshotHandle + 1] = bitmap->Handle();
+    msg[Priority + 1] = Low;
+    msg[AdditionalParameters + 1] = 0; //unused
+    
+    const TPckgC<TInt[sizeof(msg) / sizeof(TInt)]> buf(msg);
+    
+    User::LeaveIfError(SendMessage(buf));
+    
+    mCache.AppendL(bitmap);
+    CleanupStack::Pop(bitmap);
+    
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/screenshotplugin/src/tsscreenshotplugin.rss	Fri May 28 16:17:03 2010 +0300
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ECOM registration file
+*
+*/
+
+
+#include <ecom/registryinfo.rh>
+
+RESOURCE REGISTRY_INFO theInfo
+	{
+	dll_uid = 0x200267AE;
+	interfaces =
+		{
+		INTERFACE_INFO
+			{
+			interface_uid = 0x10281924;
+			implementations =
+				{
+				IMPLEMENTATION_INFO
+					{
+					implementation_uid = 0x200267AE;
+					version_no = 1;
+					display_name = "tsscreenshotplugin";
+					default_data = "";
+					opaque_data = "";
+					}
+				};
+			}
+		};
+	}
--- a/tstaskmonitor/server/group/hsrunningappmonitor.mmp	Mon May 24 20:50:46 2010 +0300
+++ b/tstaskmonitor/server/group/hsrunningappmonitor.mmp	Fri May 28 16:17:03 2010 +0300
@@ -18,15 +18,15 @@
 TARGETTYPE      exe
 UID             0 0x200267B0
 
-SYSTEMINCLUDE   /epoc32/include
-
 USERINCLUDE     ../inc
 USERINCLUDE     ../../inc
+USERINCLUDE     ../../../inc
 USERINCLUDE     ../../utils/inc
-SYSTEMINCLUDE   /epoc32/include
-SYSTEMINCLUDE   /epoc32/include/mw
-SYSTEMINCLUDE   /epoc32/include/platform/mw
-SYSTEMINCLUDE   /epoc32/include/platform 
+USERINCLUDE     ../../backstepping/inc
+
+MW_LAYER_SYSTEMINCLUDE 
+APP_LAYER_SYSTEMINCLUDE 
+
 
 SOURCEPATH      ../src
 SOURCE          main.cpp
@@ -34,37 +34,31 @@
 SOURCE          hsrunningappsession.cpp
 SOURCE          hsdataobservertask.cpp
 SOURCE          hsdataprovidertask.cpp
+SOURCE          tsdatatask.cpp
 
 SOURCE          tsrunningappstorage.cpp
 SOURCE          tsfswdatalist.cpp
 SOURCE          tsfswengine.cpp
 SOURCE          tsfswmonitor.cpp
+SOURCE          tsscreenshotprovider.cpp
 
 SOURCEPATH      ../../utils/src
+SOURCE          tsentrykey.cpp
+SOURCE          tsentrykeygenerator.cpp
 SOURCE          tsfswentry.cpp
 
 
-LIBRARY        euser.lib 
-LIBRARY        estor.lib
-LIBRARY eikcore.lib
-LIBRARY cone.lib
-LIBRARY ws32.lib
-LIBRARY        efsrv.lib
-LIBRARY        fbscli.lib
-LIBRARY avkon.lib
-LIBRARY apgrfx.lib
-LIBRARY flogger.lib
+LIBRARY         euser.lib 
+LIBRARY         estor.lib
+LIBRARY         apparc.lib
+LIBRARY         ws32.lib
+LIBRARY         apgrfx.lib
+LIBRARY         fbscli.lib
+LIBRARY         bitgdi.lib
+LIBRARY         aknicon.lib
+LIBRARY         tsutils.lib
+LIBRARY         tsbackstepping.lib
 
-LIBRARY apparc.lib
-LIBRARY ws32.lib
-LIBRARY apgrfx.lib
-LIBRARY fbscli.lib
-LIBRARY bitgdi.lib
-LIBRARY aknicon.lib
-LIBRARY aknskins.lib
-LIBRARY egul.lib
-LIBRARY featmgr.lib
-LIBRARY bitmaptransforms.lib
 CAPABILITY     ALL -TCB
 EPOCHEAPSIZE   0x100000 0x600000 // 1MB - 6MB
 
--- a/tstaskmonitor/server/inc/hsdataobserver.h	Mon May 24 20:50:46 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
-* 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 DATAOBSERVER_H
-#define DATAOBSERVER_H
-
-#include <e32base.h>
-
-class MHsDataObserver {
-public:
-    virtual void DataChanged() =0;
-};
-
-class CHsDataObserver: public CBase,
-                       public MHsDataObserver
-{
-public:
-    virtual void Cancel(const RMessage2& reason) =0;
-};
-
-class MHsDataObserverStorage
-{
-public:
-    virtual void PushL(CHsDataObserver*) =0;
-    virtual void Pop(CHsDataObserver*) =0;
-    virtual void Cancel(const RMessage2& reason) =0;
-};
-
-#endif //DATAOBSERVER_H
--- a/tstaskmonitor/server/inc/hsdataobservertask.h	Mon May 24 20:50:46 2010 +0300
+++ b/tstaskmonitor/server/inc/hsdataobservertask.h	Fri May 28 16:17:03 2010 +0300
@@ -16,7 +16,7 @@
 */
 #ifndef DATAOBSERVERTASK_H
 #define DATAOBSERVERTASK_H
-#include "hsdataobserver.h"
+#include "tsdataobserver.h"
 #include <e32base.h>
 class CHsDataObserverTask: public CHsDataObserver
 {
--- a/tstaskmonitor/server/inc/hsdataprovider.h	Mon May 24 20:50:46 2010 +0300
+++ b/tstaskmonitor/server/inc/hsdataprovider.h	Fri May 28 16:17:03 2010 +0300
@@ -14,11 +14,10 @@
 * Description:
 *
 */
-#ifndef DATAPROVIDR_H
-#define DATAPROVIDR_H
+#ifndef DATAPROVIDER_H
+#define DATAPROVIDER_H
 
 #include <e32base.h>
-
 class MHsDataProvider {
 public:
     virtual const TDesC8& Data() const = 0;
--- a/tstaskmonitor/server/inc/hsdataprovidertask.h	Mon May 24 20:50:46 2010 +0300
+++ b/tstaskmonitor/server/inc/hsdataprovidertask.h	Fri May 28 16:17:03 2010 +0300
@@ -14,8 +14,8 @@
 * Description:
 *
 */
-#ifndef DATAPROVIDER_H
-#define DATAPROVIDER_H
+#ifndef DATAPROVIDERTASK_H
+#define DATAPROVIDERTASK_H
 
 #include "hsdataprovider.h"
 
--- a/tstaskmonitor/server/inc/hsrunningappserver.h	Mon May 24 20:50:46 2010 +0300
+++ b/tstaskmonitor/server/inc/hsrunningappserver.h	Fri May 28 16:17:03 2010 +0300
@@ -20,8 +20,8 @@
 // INCLUDES
 #include <e32std.h>
 #include <e32base.h>
-
-#include "hsdataobserver.h"
+#include <w32std.h>
+#include "tsdataobserver.h"
 
 class CRunningAppStorage;
 /**
@@ -69,7 +69,10 @@
     CSession2* NewSessionL(const TVersion& version, const RMessage2& message) const;
 private:
     RPointerArray<CHsDataObserver> mObservers;
+    RWsSession mWsSession;
     CRunningAppStorage* mStorage;
+    CBase *mScreenshotProviderStarter;
+    CBase *mBacksteppingEngine;
 };
 
 #endif // RUNNINGAPPSERVER_H
--- a/tstaskmonitor/server/inc/hsrunningappsession.h	Mon May 24 20:50:46 2010 +0300
+++ b/tstaskmonitor/server/inc/hsrunningappsession.h	Fri May 28 16:17:03 2010 +0300
@@ -20,8 +20,9 @@
 // INCLUDES
 #include <e32std.h>
 #include <e32base.h>
-#include "hsdataobserver.h"
+#include "tsdataobserver.h"
 #include "hsdataprovider.h"
+#include "tsdatastorage.h"
 /**
  *  CActivitySession
  * 
@@ -43,7 +44,8 @@
      * @param storage - data storage
      */
     static CRunningAppSession* NewL(MHsDataObserverStorage& observerStorage, 
-                                    const MHsDataProvider& dataProvider);
+                                    const MHsDataProvider& dataProvider,
+                                    MTsDataStorage& dataStorage);
 
 private:
 
@@ -51,7 +53,8 @@
      * Constructor for performing 1st stage construction
      */
     CRunningAppSession(MHsDataObserverStorage& observerStorage, 
-                       const MHsDataProvider& dataProvider);
+                       const MHsDataProvider& dataProvider,
+                       MTsDataStorage& dataStorage);
 
     /**
      * EPOC default constructor for performing 2nd stage construction
@@ -68,6 +71,7 @@
 private:
     MHsDataObserverStorage& mObserverStorage;
     const MHsDataProvider& mDataProvider;
+    MTsDataStorage& mDataStorage;
 };
 
 #endif // RUNNINGAPPSESSION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/server/inc/tsdatastorage.h	Fri May 28 16:17:03 2010 +0300
@@ -0,0 +1,28 @@
+/*
+* 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 DATASTORAGE_H
+#define DATASTORAGE_H
+
+#include <e32base.h>
+class CFbsBitmap;
+class MTsDataStorage {
+public:
+    virtual void UpdateL(TInt key,const CFbsBitmap& data, TInt param, TInt priority) =0;
+    virtual void RemoveL(TInt key, TInt param) =0;
+};
+
+#endif //DATASTORAGE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/server/inc/tsdatatask.h	Fri May 28 16:17:03 2010 +0300
@@ -0,0 +1,34 @@
+/*
+* 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 TSDATATASK_H
+#define TSDATATASK_H
+#include "tstaskmonitorglobals.h"
+#include "tsdatastorage.h"
+class TsDataTask
+{
+public:
+    static void ExecuteL(MTsDataStorage& dataStorage, const RMessage2& msg);
+
+private:
+    static void RegisterScreenshotL(MTsDataStorage& dataStorage, 
+                                    const RMessage2& msg);
+    
+    static void UnregisterScreenshotL(MTsDataStorage& dataStorage, 
+                                      const RMessage2& msg);
+};
+
+#endif //TSDATATASK_H
--- a/tstaskmonitor/server/inc/tsfswdatalist.h	Mon May 24 20:50:46 2010 +0300
+++ b/tstaskmonitor/server/inc/tsfswdatalist.h	Fri May 28 16:17:03 2010 +0300
@@ -19,20 +19,12 @@
 #ifndef TSFSWDATALIST_H
 #define TSFSWDATALIST_H
 
-#define __E32SVR_H__
-#include <e32event.h>
-#include <f32file.h>
-
 #include <e32base.h>
-#include <e32hashtab.h>
-#include <fbs.h>
 #include <apgcli.h>
 #include <w32std.h>
 #include "tsfswentry.h"
-#include "tsfswobservers.h"
+#include "tsdataobserver.h"
 
-class CTsFswEngine;
-class CTsFswIconCache;
 class CApaWindowGroupName;
 class CFbsBitmap;
 
@@ -47,7 +39,7 @@
      *
      * @param aParent
      */
-    static CTsFswDataList* NewL( CTsFswEngine& aEngine );
+    static CTsFswDataList* NewL(MHsDataObserver& observer);
 
     /*
      * Destructor
@@ -58,7 +50,7 @@
     /**
      * Constructor.
      */
-    CTsFswDataList( CTsFswEngine& aEngine );
+    CTsFswDataList(MHsDataObserver& observer);
 
     /**
      * Performs 2nd phase construction.
@@ -79,117 +71,62 @@
      * @return   TBool   ETrue if the content iData has been modified
      */
     TBool CollectTasksL();
-
-
-    /**
-     * Set flag iTaskListDirty;
-     */
-    void SetDirty();
-
-    /**
-     * Set flag iAppDataRefreshNeeded
-     */
-    void SetAppDataRefreshNeeded();
-
-
-    /**
-     * Moves entry on given window app/widget id to 
-     * the first position on conten data list
-     */
-    void MoveEntryAtStart( TInt aAppId, TBool aWidget );
-    
-    
-    /**
-     * Finds out the app uid for the given window group id.
-     * @param   aWgId   a valid window group id
-     * @param   aUid   	requested uid
-     * @return  error code
-     */
-    TInt AppUidForWgId( TInt aWgId, TUid& aUid );
-    
-    /**
-     * Finds out the app uid for the given window group id.
-     * @param   aWgId   a valid window group id
-     * @return  application uid
-     */
-    TUid AppUidForWgIdL( TInt aWgId );
     
     /**
      * Checks if given uid is on hidden list
      * @param   aUid uid to be checked
-     * @return  ETrue if aUid is on hidden list
+     * @return  ETrue if uid is on hidden list
      */    
-    TBool IsHiddenUid( TUid aUid );
+    TBool IsHiddenUid( TUid uid );
 
+    /**
+     * Set screenshot 
+     */
+    TBool SetScreenshotL(const CFbsBitmap* bitmap, UpdatePriority priority, TInt wgId);
+    
+    /**
+     * Removes screenshot 
+     */    
+    TBool RemoveScreenshotL(TInt wgId);
+    
 private:
     /**
      * Adds running apps to the list.
-     * @param   aAppsList    array to add to
+     * @param   appsList    array to add to
      */
-    void CollectAppsL( RTsFswArray& aAppsList );
+    void CollectAppsL( RTsFswArray& appsList );
 
     /**
      * Called from CollectTasksL for each entry in the task list.
-     * @param   aWgId       window group id
-     * @param   aAppUid     application uid
-     * @param   aWgName     window group name or NULL
-     * @param   aNewList    list to add to
-     * @param   aIsWidget   true if the entry corresponds to a web widget
-     * @return  TBool   ETrue if it was really a new entry in the list
+     * @param   key       entry key
+     * @param   appUid     application uid
+     * @param   wgName     window group name or NULL
+     * @param   newList    list to add to
      */
-    TBool AddEntryL( TInt aWgId, 
-			const TUid& aAppUid,
-            CApaWindowGroupName* aWgName,
-			RTsFswArray& aNewList,
-            TBool aIsWidget );
+    void AddEntryL( const TTsEntryKey& key, 
+			const TUid& appUid,
+            CApaWindowGroupName* wgName,
+			RTsFswArray& newList );
 
     /**
      * Checks if there is an entry for same app in the content list.
      * If yes then it takes some of the data for the entry that
      * will correspond to the same app in the refreshed content list.
-     * In case of widget, update window group field in content list.
-     * @param   aEntry      new entry in content list
-     * @param   aAppUid     application uid
-     * @param   aChanged    ref to change-flag, set to ETrue if it is sure
-     * that the new content list will be different from the previous one
-     * @param   aNewList    ref to new content list
+     * @param   key      new key in content list
      * @return  ETrue if app was found
      */
-    TBool ConsiderOldDataL( CTsFswEntry& aEntry,
-        const TUid& aAppUid,
-        TBool& aChanged,
-        RTsFswArray& aNewList );
-
-    /**
-     * Adds running widgets to the list.
-     * @param   aWidgetsList    array to add to
-     */
-    void CollectWidgetsL( RTsFswArray& aWidgetsList );
-
-    /**
-     * Returns the parent's wg id or KErrNotFound.
-     * @param   aWgId   a valid window group id
-     * @return parent wg id or KErrNotFound if there is no parent
-     */
-    TInt FindParentWgId( TInt aWgId );
-
-    /**
-     * Returns the most top parent's wg id or KErrNotFound.
-     * @param   aWgId   a valid window group id
-     * @return parent wg id or KErrNotFound if there is no parent
-     */
-    TInt FindMostTopParentWgId( TInt aWgId );
+    TBool ConsiderOldDataL( const TTsEntryKey& key );
 
     /**
      * Finds out the application name.
-     * @param   aWindowName window group name or NULL
-     * @param   aAppUId     application uid
-     * @param   aWgId       window group id
+     * @param   windowName window group name or NULL
+     * @param   appUId     application uid
+     * @param   wgId       window group id
      * @return  application name, ownership transferred to caller
      */
-    HBufC* FindAppNameLC( CApaWindowGroupName* aWindowName,
-            	const TUid& aAppUid,
-				TInt aWgId );
+    HBufC* FindAppNameLC(CApaWindowGroupName* windowName,
+                         const TUid& appUid,
+                         TInt wgId );
 
 
     /**
@@ -197,60 +134,67 @@
      * Data is being changed with application type consideration that is based 
      * on aConsiderWidgets param. 
      * Function removes or add entries into data depend on given list.
-     * @param   aListToFit          list with actual data 
-     * @param   aConsiderWidgets    application type 
+     * @param   listToFit          list with actual data  
      * @return  ETrue if change occours on data list, EFalse otherwise   
      */
-    TBool FitDataToListL( RTsFswArray& aListToFit, TBool aConsiderWidgets );
+    TBool FitDataToListL( RTsFswArray& listToFit);
 
     /**
      * Checks if there is an entry for same app in the given list.
-     * @param   aEntry      entry
-     * @param   aNewList    ref to list
+     * @param   entry      entry
+     * @param   newList    ref to list
      * @return  ETrue if app was found
      */
-    TBool CheckIfExists( const CTsFswEntry& aEntry,
-            const RTsFswArray& aNewList ) const;
+    TBool CheckIfExists( const CTsFswEntry& entry,
+            const RTsFswArray& newList ) const;
             
     /**
      * Retrieves the bitmap/mask for the icon of the given app.
-     * @param   aAppUid application uid
-     * @param   aBitmap bitmap ptr, ownership transferred to caller, or NULL
-     * @param   aMask   mask ptr, ownership transferred to caller, or NULL
+     * @param   appUid application uid
+     * @param   bitmapArg bitmap ptr, ownership transferred to caller, or NULL
+     * @param   maskArg   mask ptr, ownership transferred to caller, or NULL
+     */
+    void GetAppIconL(const TUid& appUid,
+                     CFbsBitmap*& bitmapArg, 
+                     CFbsBitmap*& maskArg);
+
+    /**
+     * Finds entry in array
+     * @param   list list to find
+     * @param   key finding key
+     * @return   position or KErrNotFound
      */
-    void GetAppIconL( const TUid& aAppUid,
-        CFbsBitmap*& aBitmap, CFbsBitmap*& aMask );            
+    TInt FindEntry(const RTsFswArray& list, const TTsEntryKey& key ) const;
+
+    /**
+     * Establish entry order accridung to aKeyList, all keys MUST be in iData
+     * @param   keyList reference key list
+     * @return   ETrue if changes occured
+     */
+    TBool EstablishOrder(const RArray<TTsEntryKey>& keyList);
+    
+    /**
+     * Gets allowed uids, tries to filter non GUI application 
+     */
+    void GetAllowedUidsL();
     
 
 private:
-    CTsFswEngine& iEngine;
-
-    RTsFswArray iData; // current fsw content, i.e. the task list
+    MHsDataObserver &mObserver;
+    
+    RTsFswArray mData; // current fsw content, i.e. the task list
 
     // window server session
-    RWsSession iWsSession;
+    RWsSession mWsSession;
 
     // apparc session
-    RApaLsSession iAppArcSession;
-
-
-
-
-    // when true CollectTasksL will call GetAllApps etc.
-    // which is slow and need not be done normally, except
-    // during startup and perhaps when new applications are installed
-    TBool iAppDataRefreshNeeded;
-
-    // Dirty flag, indicates that iData is not up-to-date because
-    // there were no subscribed clients during a previous possible
-    // change of the task list.
-    TBool iTaskListDirty;
-    
-    // if ETrue application order has been changed
-    TBool iOrderChanged;
+    RApaLsSession mAppArcSession;
     
     // list of hidden uids
-    RArray<TUid> iHiddenUids;
+    RArray<TUid> mHiddenUids;
+    
+    // list of allowed uids
+    RArray<TUid> mAllowedUids;
     };
 
 #endif //TSFSWDATALIST_H
--- a/tstaskmonitor/server/inc/tsfswengine.h	Mon May 24 20:50:46 2010 +0300
+++ b/tstaskmonitor/server/inc/tsfswengine.h	Fri May 28 16:17:03 2010 +0300
@@ -19,35 +19,12 @@
 #ifndef TSFSWENGINE_H
 #define TSFSWENGINE_H
 
-#define __E32SVR_H__
-
-#include <e32event.h>
-
 #include <e32base.h>
-#include <e32cmn.h>
-#include <s32strm.h>
-#include <fbs.h>
-#include <eikenv.h>
-#include <w32std.h>
-#include <e32hashtab.h>
-#include <apgcli.h>
-#include <e32property.h>
 #include "tsfswentry.h"
-#include "tsfswobservers.h"
-#include "hsdataprovider.h"
-#include "hsdataobserver.h"
-
-class MTsFswEngineObserver;
-class CTsFastSwapPreviewProvider;
-class CApaWindowGroupName;
-class CBitmapRotator;
-class CTsRotationTask;
-class CTSCpsNotifier;
+#include "tsdataobserver.h"
 
 class CTsFswDataList;
 
-// descriptor big enough to store hex repr of 32-bit integer plus 0x prefix
-typedef TBuf<10> TAppUidHexString;
 
 /**
  * Engine for fast swap server.
@@ -55,35 +32,21 @@
  * received from the appui.
  */
 NONSHARABLE_CLASS( CTsFswEngine ) : public CBase,
-        public MTsFswTaskListObserver
+                                    public MHsDataObserver
 
     {
-    enum TTsFswFgAppType
-        {
-        /**
-         * Means that even when the foreground app has another app embedded
-         * into it the uid of the container application will be returned.
-         */
-        EUseStandaloneUid,
-        /**
-         * Means that if the foreground app has another app embedded
-         * into it then the returned uid will be the uid of the embedded
-         * app.
-         */
-        EUseEmbeddedUid
-        };
     
 public:
     /**
      * Creates a new instance.
-     * @param   aObserver   ref to observer
+     * @param   observer   ref to observer
      */
-    static CTsFswEngine* NewL( MHsDataObserver& aObserver );
+    static CTsFswEngine* NewL( MHsDataObserver& observer );
 
     /**
      * @copydoc NewL
      */
-    static CTsFswEngine* NewLC( MHsDataObserver& aObserver );
+    static CTsFswEngine* NewLC( MHsDataObserver& observer );
 
     /**
      * Destructor.
@@ -92,19 +55,25 @@
 
     /**
      * Returns a reference to the current content.
-     * Also performs sanity checks, e.g. associates application icons
-     * when no screenshot has been received.
      * @return  ref to content array
      */
     const RTsFswArray& FswDataL();
 
-
+    /**
+     * Set screenshot 
+     */
+    void SetScreenshotL(const CFbsBitmap* bitmap, UpdatePriority priority, TInt wgId);
+    
+    /**
+     * Removes screenshot 
+     */    
+    void RemoveScreenshotL(TInt wgId);
 
 
 private:
 
     // from MTsFswTaskListObserver
-    void UpdateTaskList();
+    void DataChanged();
 
 
 
@@ -112,7 +81,7 @@
     /**
      * Constructor.
      */
-    CTsFswEngine( MHsDataObserver& aObserver );
+    CTsFswEngine( MHsDataObserver& observer );
 
     /**
      * Performs 2nd phase construction.
@@ -125,53 +94,9 @@
      */
     TBool CollectTasksL();
 
-
-    /**
-     * Callback for the iUpdateStarter timer.
-     * Calls CollectTasksL and notifies the observer if the task list
-     * has really been modified.
-     */
-    static TInt UpdateStarterCallback( TAny* aParam );
-
-    /**
-     * Returns the uid of the foreground app or KNullUid.
-     * Will never return hidden apps, only those which can
-     * also be seen in the array returned by FswDataL.
-     *
-     * In case of embedded apps the behaviour is controlled
-     * by aType: it will return either the uid of the embedded
-     * application or the container app.
-     *
-     * @param   aType   @see CTsFswClient::TTsFswFgAppType
-     */
-    TUid ForegroundAppUidL( TInt aType );
-    
-    /**
-     * Gets and publishes the foreground app uid to CFW.
-     */
-    void PublishFgAppUidL();
-
 private:
-    // data    
-    MHsDataObserver& iObserver;
-
-    // window server session
-    RWsSession iWsSession;
-
-    // apparc session
-    RApaLsSession iAppArcSession;
-
-    // timer to defer content refresh
-    CPeriodic* iUpdateStarter;
-
-
-    // window group ids returned by last WindowGroupList call
-    RArray<TInt> iWgIds;
-  
-    TUid iFgAppUid;
-
-
-    CTsFswDataList* iDataList;//own
+    MHsDataObserver& mObserver;
+    CTsFswDataList* mDataList; //own
 
     };
 
--- a/tstaskmonitor/server/inc/tsfswmonitor.h	Mon May 24 20:50:46 2010 +0300
+++ b/tstaskmonitor/server/inc/tsfswmonitor.h	Fri May 28 16:17:03 2010 +0300
@@ -18,13 +18,11 @@
 
 #ifndef TSFSWMONITOR_H
 #define TSFSWMONITOR_H
-#define __E32SVR_H__
 
-#include <e32event.h>
 #include <e32debug.h>
 #include <w32std.h>
 
-class MTsFswTaskListObserver;
+class MHsDataObserver;
 class MTsFswResourceObserver;
 
 /**
@@ -39,16 +37,16 @@
     
     
 
-static CTsFswMonitor* NewL(MTsFswTaskListObserver& aTaskListObserver);
-static CTsFswMonitor* NewLC(MTsFswTaskListObserver& aTaskListObserver);
+static CTsFswMonitor* NewL(MHsDataObserver& taskListObserver);
+static CTsFswMonitor* NewLC(MHsDataObserver& taskListObserver);
 
 protected:
-    CTsFswMonitor(MTsFswTaskListObserver& aTaskListObserver);
+    CTsFswMonitor(MHsDataObserver& taskListObserver);
     void ConstructL();
     
     // from CActive
     void RunL();
-    TInt RunError( TInt aError );
+    TInt RunError( TInt error );
     void DoCancel();
 
 
@@ -56,14 +54,13 @@
     void Subscribe();        
     void ConstractObserverL();
 private:
-    MTsFswTaskListObserver* iTaskListObserver; // not own
+    MHsDataObserver* mTaskListObserver; // not own
     
     // window server session
-    RWsSession iWsSession;
-    /**
-       * Window group.
-       */
-   RWindowGroup iWg;
+    RWsSession mWsSession;
+    
+    // Window group.
+    RWindowGroup mWg;
     };
 
 #endif //TSFSWMONITOR_H
--- a/tstaskmonitor/server/inc/tsfswobservers.h	Mon May 24 20:50:46 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Observer interfaces to get notifications from appui and from engine
- *
-*/
-
-
-#ifndef TSFSWOBSERVERS_H
-#define TSFSWOBSERVERS_H
-
-/**
- * Interface to get notifications from appui when window groups
- * have changed.
- */
-class MTsFswTaskListObserver
-    {
-public:
-    /**
-     * Function called by AppUi to notify about possible
-     * changes in task list
-     */
-    virtual void UpdateTaskList() = 0;
-    };
-#endif
--- a/tstaskmonitor/server/inc/tsrunningappstorage.h	Mon May 24 20:50:46 2010 +0300
+++ b/tstaskmonitor/server/inc/tsrunningappstorage.h	Fri May 28 16:17:03 2010 +0300
@@ -21,8 +21,9 @@
 #include <e32std.h>
 #include <e32base.h>
 
-#include "hsdataobserver.h"
+#include "tsdataobserver.h"
 #include "hsdataprovider.h"
+#include "tsdatastorage.h"
 
 class CTsFswEngine;
 class CTsFswMonitor;
@@ -32,8 +33,8 @@
  */
 class CRunningAppStorage : public CBase,
                            public MHsDataProvider, 
-                           public MHsDataObserver
-                          
+                           public MHsDataObserver,
+                           public MTsDataStorage 
 {
 public:
     /**
@@ -51,6 +52,10 @@
     
     //MHsDataChangeProvider
     void DataChanged();
+    
+    void UpdateL(TInt key,const CFbsBitmap& data, TInt param, TInt priority);
+    
+    void RemoveL(TInt key, TInt param);
 
 private:
     /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/server/inc/tsscreenshotprovider.h	Fri May 28 16:17:03 2010 +0300
@@ -0,0 +1,35 @@
+/*
+* 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 TSSCREENSHOTPROVIDER_H
+#define TSSCREENSHOTPROVIDER_H
+#include "tsdatastorage.h"
+#include <w32std.h>
+
+class CTsScreenshotProvider: public CWsGraphic
+{
+public:
+    static CTsScreenshotProvider* NewL(MTsDataStorage&);
+private:
+    CTsScreenshotProvider(MTsDataStorage&);
+    void HandleMessage(const TDesC8&);
+    void HandleMessageL(const TDesC8&);
+    void OnReplace();
+private:
+    MTsDataStorage& mStorage;
+};
+
+#endif //TSSCREENSHOTTASK_H
--- a/tstaskmonitor/server/src/hsrunningappserver.cpp	Mon May 24 20:50:46 2010 +0300
+++ b/tstaskmonitor/server/src/hsrunningappserver.cpp	Fri May 28 16:17:03 2010 +0300
@@ -18,6 +18,8 @@
 #include "hsrunningappserver.h"
 #include "hsrunningappsession.h"
 #include "tsrunningappstorage.h"
+#include "tsscreenshotprovider.h"
+#include "tsbackstepping.h"
 
 _LIT(KErrObserverExists, "Observer already exists");
 // -----------------------------------------------------------------------------
@@ -37,6 +39,8 @@
 //
 CRunningAppServer::~CRunningAppServer()
 {
+    delete mBacksteppingEngine;
+    delete mScreenshotProviderStarter;
     delete mStorage;
     mObservers.ResetAndDestroy();
 }
@@ -60,7 +64,10 @@
 void CRunningAppServer::ConstructL()
 {
     StartL(KRunningAppServerName);
+    User::LeaveIfError(mWsSession.Connect());
     mStorage = CRunningAppStorage::NewL(*this);
+    TRAP_IGNORE(mScreenshotProviderStarter = CTsScreenshotProvider::NewL(*mStorage);
+    mBacksteppingEngine = CTsBackstepping::NewL(mWsSession);)
 }
 
 // -----------------------------------------------------------------------------
@@ -70,6 +77,7 @@
 CSession2* CRunningAppServer::NewSessionL(const TVersion &, const RMessage2&) const
 {
     return CRunningAppSession::NewL(*const_cast<CRunningAppServer *>(this),
+                                    *const_cast<CRunningAppServer *>(this)->mStorage,
                                     *const_cast<CRunningAppServer *>(this)->mStorage);
 }
 
--- a/tstaskmonitor/server/src/hsrunningappsession.cpp	Mon May 24 20:50:46 2010 +0300
+++ b/tstaskmonitor/server/src/hsrunningappsession.cpp	Fri May 28 16:17:03 2010 +0300
@@ -19,16 +19,19 @@
 
 #include "hsdataobservertask.h"
 #include "hsdataprovidertask.h"
+#include "tsdatatask.h"
 
 // -----------------------------------------------------------------------------
 //
 // -----------------------------------------------------------------------------
 //
 CRunningAppSession::CRunningAppSession(MHsDataObserverStorage& observerStorage,
-                                       const MHsDataProvider& dataProvider)
+                                       const MHsDataProvider& dataProvider,
+                                       MTsDataStorage& dataStorage)
 :
     mObserverStorage(observerStorage),
-    mDataProvider(dataProvider)
+    mDataProvider(dataProvider),
+    mDataStorage(dataStorage)
 {
     // No implementation required
 }
@@ -46,9 +49,12 @@
 // -----------------------------------------------------------------------------
 //
 CRunningAppSession* CRunningAppSession::NewL(MHsDataObserverStorage& observerStorage, 
-                                             const MHsDataProvider& dataProvider)
+                                             const MHsDataProvider& dataProvider,
+                                             MTsDataStorage& dataStorage)
 {
-    CRunningAppSession* self = new (ELeave) CRunningAppSession(observerStorage, dataProvider);
+    CRunningAppSession* self = new (ELeave) CRunningAppSession(observerStorage, 
+                                                               dataProvider,
+                                                               dataStorage);
     CleanupStack::PushL(self);
     self->ConstructL();
     CleanupStack::Pop(self);
@@ -82,6 +88,11 @@
     case FlushData:
         HsDataProviderTask::ExecuteL(mDataProvider, message);
         break;
+        
+    case RegisterScreenshotMessage:
+    case UnregisterScreenshotMessage:
+        TsDataTask::ExecuteL(mDataStorage, message);
+        break;
     
     default:
         message.Complete(CServer2::EBadMessageNumber);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/server/src/tsdatatask.cpp	Fri May 28 16:17:03 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* 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:
+*
+*/
+#include <fbs.h>
+#include "tsdatatask.h"
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void TsDataTask::ExecuteL(MTsDataStorage& dataStorage, const RMessage2& msg)
+{
+    switch(msg.Function()) {
+    case RegisterScreenshotMessage:
+        TsDataTask::RegisterScreenshotL(dataStorage, msg); break;
+    case UnregisterScreenshotMessage:
+        TsDataTask::UnregisterScreenshotL(dataStorage, msg); break;
+    }
+    
+    msg.Complete(KErrNone);
+}
+
+void TsDataTask::RegisterScreenshotL(MTsDataStorage& dataStorage, 
+                                           const RMessage2& msg)
+{
+    TPckgBuf<TInt> wgId, fbsHdl, param, priority;
+    
+    msg.ReadL(WindowsGroup, wgId);
+    msg.ReadL(ScreenshotHandle, fbsHdl);
+    msg.ReadL(AdditionalParameters, param);
+    msg.Read(Priority, priority);
+    
+    //convert and provide data
+    CFbsBitmap* bitmap = new(ELeave) CFbsBitmap();
+    CleanupStack::PushL(bitmap);
+    User::LeaveIfError(bitmap->Duplicate(fbsHdl()));
+    dataStorage.UpdateL(wgId(), *bitmap, param(), priority());
+    CleanupStack::PopAndDestroy(bitmap);
+}
+    
+void TsDataTask::UnregisterScreenshotL(MTsDataStorage& dataStorage, 
+                                       const RMessage2& msg)
+{
+    TPckgBuf<TInt> wgId, param;
+    
+    msg.ReadL(WindowsGroup, wgId);
+    msg.ReadL(AdditionalParameters, param);
+    
+    dataStorage.RemoveL(wgId(), param());
+}
--- a/tstaskmonitor/server/src/tsfswdatalist.cpp	Mon May 24 20:50:46 2010 +0300
+++ b/tstaskmonitor/server/src/tsfswdatalist.cpp	Fri May 28 16:17:03 2010 +0300
@@ -1,43 +1,41 @@
 /*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  File containing application list classes
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
  *
-*/
-
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  File containing application list classes
+ *
+ */
 
 //INCLUDES:
-#define __E32SVR_H__
+
 #include "tsfswdatalist.h"
 #include "tsfswengine.h"
+#include "tsentrykeygenerator.h"
 #include <mmf/common/mmfcontrollerpluginresolver.h> // for CleanupResetAndDestroyPushL
-#include <featmgr.h>
 #include <apgwgnam.h>
-#include <AknsUtils.h>
-#include <gulicon.h>
-#include <e32debug.h>
 #include <bitstd.h>
 #include <AknIconUtils.h> // avkon
-#include <APGICNFL.H> // fbsbitmap
-#include <akniconsrvclient.h> 
+#include <apgicnfl.h> // fbsbitmap
+#include <AknIconSrvClient.h> 
+#include <fbs.h>
+#include <APGWGNAM.H>
+
 
 // size for the created app icons
 const TInt KAppIconWidth = 128;
 const TInt KAppIconHeight = 128;
 
 //uids to be hidden
-const TUid KHsApplicationUid = {0x20022F35};
-const TUid KTelephoneUid = {0x100058B3};
+const TUid KHsApplicationUid = { 0x20022F35 };
 
 // ================= MEMBER FUNCTIONS =======================
 
@@ -45,526 +43,427 @@
 // CTsFswDataList::NewL
 // --------------------------------------------------------------------------
 //
-CTsFswDataList* CTsFswDataList::NewL(CTsFswEngine& aEngine)
-    {
-    CTsFswDataList* self = new (ELeave) CTsFswDataList(aEngine);
-    CleanupStack::PushL (self );
-    self->ConstructL ( );
-    CleanupStack::Pop ( self );
+CTsFswDataList* CTsFswDataList::NewL(MHsDataObserver &observer)
+{
+    CTsFswDataList* self = new (ELeave) CTsFswDataList(observer);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
     return self;
-    }
+}
 
 // --------------------------------------------------------------------------
 // CTsFswDataList::CTsFswDataList
 // --------------------------------------------------------------------------
 //
-CTsFswDataList::CTsFswDataList(CTsFswEngine& aEngine) :
-    iEngine(aEngine)
-    {
-    }
+CTsFswDataList::CTsFswDataList(MHsDataObserver& observer) :
+    mObserver(observer)
+{
+}
 
 // --------------------------------------------------------------------------
 // CTsFswDataList::~CTsFswDataList
 // --------------------------------------------------------------------------
 //
-CTsFswDataList::~CTsFswDataList( )
-    {
-    iData.ResetAndDestroy();
-    iAppArcSession.Close();
-    iWsSession.Close();
-    iHiddenUids.Close();
+CTsFswDataList::~CTsFswDataList()
+{
+    mData.ResetAndDestroy();
+    mAppArcSession.Close();
+    mWsSession.Close();
+    mHiddenUids.Close();
+    mAllowedUids.Close();
     RFbsSession::Disconnect();
     RAknIconSrvClient::Disconnect();
-    }
+}
 
 // --------------------------------------------------------------------------
 // CTsFswDataList::ConstructL
 // --------------------------------------------------------------------------
 //
-void CTsFswDataList::ConstructL( )
-    {
-    User::LeaveIfError( iWsSession.Connect() );
-    User::LeaveIfError( iAppArcSession.Connect() );
-    iHiddenUids.AppendL( KHsApplicationUid );
-    iHiddenUids.AppendL( KTelephoneUid );
+void CTsFswDataList::ConstructL()
+{
+    User::LeaveIfError(mWsSession.Connect());
+    User::LeaveIfError(mAppArcSession.Connect());
+    mHiddenUids.AppendL(KHsApplicationUid);
     User::LeaveIfError(RFbsSession::Connect());
     RAknIconSrvClient::Connect();
-    }
+}
 
 // --------------------------------------------------------------------------
 // CTsFswDataList::FswDataL
 // --------------------------------------------------------------------------
 //
 const RTsFswArray& CTsFswDataList::FswDataL()
-    {
-    // check the dirty flag and refresh if needed
-    if ( iTaskListDirty )
-        {
-        CollectTasksL();
-        // dirty flag is cleared in the above call
-        }
-
-    return iData;
-    }
+{
+    return mData;
+}
 
 // --------------------------------------------------------------------------
 // CTsFswDataList::CollectTasksL
 // --------------------------------------------------------------------------
 //
 TBool CTsFswDataList::CollectTasksL()
-    {
-    // clear dirty flag
-    iTaskListDirty = EFalse;
+{
     TBool changed = EFalse;
-    
     RTsFswArray newAppsList;
-    
     CleanupResetAndDestroyPushL(newAppsList);
-    
     CollectAppsL(newAppsList);
-    
-    changed |= FitDataToListL(newAppsList, EFalse);
-    
-    CleanupStack::PopAndDestroy( &newAppsList );
-    
+    changed |= FitDataToListL(newAppsList);
+    CleanupStack::PopAndDestroy(&newAppsList);
     return changed;
-    }
-
-
-// --------------------------------------------------------------------------
-// CTsFswDataList::SetDirty()
-// --------------------------------------------------------------------------
-//
-void CTsFswDataList::SetDirty()
-    {
-    iTaskListDirty = ETrue;
-    }
-
-// --------------------------------------------------------------------------
-// CTsFswDataList::SetAppDataRefreshNeeded()
-// --------------------------------------------------------------------------
-//
-void CTsFswDataList::SetAppDataRefreshNeeded()
-    {
-    iAppDataRefreshNeeded = ETrue;
-    }
-
-// --------------------------------------------------------------------------
-// CTsFswDataList::MoveEntryAtStart
-// --------------------------------------------------------------------------
-//
-void CTsFswDataList::MoveEntryAtStart(TInt aAppId, TBool /*aWidget*/)
-    {
-    TInt appId(0);
-    //check embeded case
-
-    TInt wgId(0);
-    CApaWindowGroupName::FindByAppUid(TUid::Uid(aAppId), iWsSession, wgId);
-    TInt parentWgId = FindMostTopParentWgId( wgId );
-    if( parentWgId != KErrNotFound )
-        {
-        TUid appUid = TUid::Uid(0);
-        AppUidForWgId(parentWgId, appUid); 
-        appId = appUid.iUid;
-        }
-
-    
-    if( !appId )
-    	{
-		appId = aAppId;
-    	}
-    
-    for ( TInt i = 0; i < iData.Count(); ++i )
-       {
-       if( iData[i]->AppUid().iUid == appId )
-           {
-           CTsFswEntry* entry = iData[i];
-           iData.Remove(i);
-           iData.Insert(entry, 0);
-           iOrderChanged = ETrue;
-           break;
-           }
-       }
-    }
+}
 
 // --------------------------------------------------------------------------
 // CTsFswDataList::
 // --------------------------------------------------------------------------
 //
-void CTsFswDataList::CollectAppsL(RTsFswArray& aAppsList)
-    {
-
-    
-    // update app data if needed
-    // (usually on startup and when new apps might have been installed)
-    if ( iAppDataRefreshNeeded )
-        {
-
-        iAppArcSession.GetAllApps();
-        iAppDataRefreshNeeded = EFalse;
-        }
+void CTsFswDataList::CollectAppsL(RTsFswArray& appsList)
+{
+    // gets allowed uids - running apps without hidden uids, null uids, filtered uid
+    GetAllowedUidsL();
 
     // get all window groups
     RArray<RWsSession::TWindowGroupChainInfo> allWgIds;
-    CleanupClosePushL( allWgIds );
-    User::LeaveIfError( iWsSession.WindowGroupList( 0, &allWgIds ) );
+    CleanupClosePushL(allWgIds);
+    User::LeaveIfError(mWsSession.WindowGroupList(0, &allWgIds));
 
     TInt count = allWgIds.Count();
-    for ( TInt i = 0; i < count; ++i )
-        {
-        // ignore uninteresting entries (e.g. embedded apps)
-        if ( allWgIds[i].iParentId > 0 )
-            {
+    for (TInt i = 0; i < count; ++i) {
+        TTsEntryKey key = TsEntryKeyGeneraror::GenerateL(allWgIds[i].iId, allWgIds.Array());
+        //skip this entry if it is already on list
+        if (FindEntry(appsList, key) >= 0) {
             continue;
-            }
-        
+        }
+
         // get window group name
-        TInt wgId = allWgIds[i].iId;
-        CApaWindowGroupName* windowName =
-            CApaWindowGroupName::NewLC( iWsSession, wgId );
+        TInt wgId = key.mParentId;
+        CApaWindowGroupName* windowName = CApaWindowGroupName::NewLC(mWsSession, wgId);
         TUid appUid = windowName->AppUid();
-        
-        // ignore entries with null uid
-        if ( !appUid.iUid )
-            {
-            CleanupStack::PopAndDestroy( windowName );
-            continue;
-            }
 
-        // add item to task list if it is not hidden
-        if ( !windowName->Hidden() && !IsHiddenUid(appUid) )
-            {
-            AddEntryL(wgId, appUid, windowName, aAppsList, EFalse);
-            }
-        CleanupStack::PopAndDestroy( windowName );
+        // add item to task list if uid is allowed
+        if (mAllowedUids.Find(appUid) >= 0) {
+            AddEntryL(key, appUid, windowName, appsList);
         }
-    CleanupStack::PopAndDestroy( &allWgIds );
+        CleanupStack::PopAndDestroy(windowName);
     }
+    CleanupStack::PopAndDestroy(&allWgIds);
+}
 
 // --------------------------------------------------------------------------
 // CTsFswDataList::AddEntryL
 // --------------------------------------------------------------------------
 //
-TBool CTsFswDataList::AddEntryL( TInt aWgId, const TUid& aAppUid,
-        CApaWindowGroupName* aWgName, RTsFswArray& aNewList,
-        TBool /*aIsWidget*/ )
-    {
-    TBool changed = EFalse;
-    CTsFswEntry* entry = CTsFswEntry::NewLC();
-    entry->SetWgId( aWgId );
-    entry->SetAppUid( aAppUid );
+void CTsFswDataList::AddEntryL(const TTsEntryKey& key, const TUid& appUid,
+    CApaWindowGroupName* wgName, RTsFswArray& newList)
+{
+    CTsFswEntry* entry = CTsFswEntry::NewLC(key, &mObserver);
 
     // check if present in old list and if yes then take some of the old data
-    TBool found = ConsiderOldDataL( *entry, aAppUid, changed, aNewList );
+    TBool found = ConsiderOldDataL(key);
 
     // if not present previously then find out app name
     // and check if screenshot is already available
-    if ( !found )
-        {
-        // when adding a new entry to the list it is changed for sure
-        changed = ETrue;
-        HBufC* name = FindAppNameLC( aWgName, aAppUid, aWgId );
-        if ( name )
-            {
-            entry->SetAppNameL( *name );
-            }
-        CleanupStack::PopAndDestroy( name );
+    if (!found) {
+        entry->SetAppUid(appUid);
+        HBufC* name = FindAppNameLC(wgName, appUid, key.mParentId);
+        if (name) {
+            entry->SetAppNameL(*name);
+        }
+        CleanupStack::PopAndDestroy(name);
 
-        if ( aWgName )
-            {
-            entry->SetCloseableApp( !aWgName->IsSystem() );
-            }
+        if (wgName) {
+            entry->SetCloseableApp(!wgName->IsSystem());
+        }
         CFbsBitmap* iconBitmap = NULL;
         CFbsBitmap* iconMask = NULL;
-        GetAppIconL(aAppUid, iconBitmap, iconMask);    
+        GetAppIconL(appUid, iconBitmap, iconMask);
         //transfer ownership to entry
-        entry->SetAppIcon( iconBitmap, iconMask );        
-        }        
+        entry->SetAppIcon(iconBitmap, iconMask);
+    }
 
     // add to new list, ownership is transferred
-    aNewList.AppendL( entry );
-    CleanupStack::Pop( entry );
-    return changed;
-    }
+    newList.AppendL(entry);
+    CleanupStack::Pop(entry);
+}
 
 // --------------------------------------------------------------------------
 // CTsFswDataList::ConsiderOldDataL
 // --------------------------------------------------------------------------
 //
-TBool CTsFswDataList::ConsiderOldDataL( CTsFswEntry& aEntry,
-        const TUid& aAppUid,
-        TBool& aChanged,
-        RTsFswArray& aNewList )
-    {
-    for ( TInt entryIdx = 0, oldCount = iData.Count();
-            entryIdx < oldCount; ++entryIdx )
-        {
-        // Enough to check appuid, no need to bother with wgid as the
-        // screenshot handle is up-to-date or will be updated later anyway.
-        if ( iData[entryIdx]->AppUid() == aAppUid )
-            {
-            iData[entryIdx]->SetWgId( aEntry.WgId());
-            // if positions do not match then the list is different than before
-            if ( entryIdx != aNewList.Count() )
-                {
-                aChanged = ETrue;
-                }
-            CTsFswEntry* oldEntry = iData[entryIdx];
-            aEntry.SetAppNameL( oldEntry->AppName() );            
-            aEntry.SetCloseableApp( oldEntry->CloseableApp() );
+TBool CTsFswDataList::ConsiderOldDataL(const TTsEntryKey& key)
+{
+    for (TInt entryIdx = 0, oldCount = mData.Count(); entryIdx < oldCount; ++entryIdx) {
+        if (mData[entryIdx]->Key() == key) {
             return ETrue;
-            }
         }
-    return EFalse;
     }
-
-
-// --------------------------------------------------------------------------
-// CTsFswDataList::FindParentWgId
-// --------------------------------------------------------------------------
-//
-TInt CTsFswDataList::FindParentWgId( TInt aWgId )
-    {
-    TInt parent( KErrNotFound );
-    RArray<RWsSession::TWindowGroupChainInfo> allWgIds;
-    // Ask for window group list from RWsSession
-    TInt error = iWsSession.WindowGroupList( 0, &allWgIds );
-    if ( !error )
-        {
-        TInt count( allWgIds.Count() );
-        for ( TInt i( 0 ); i < count; i++ )
-            {
-            RWsSession::TWindowGroupChainInfo info = allWgIds[i];
-            if ( info.iId == aWgId && info.iParentId > 0)
-                {
-                parent = info.iParentId;
-                break;
-                }
-            }
-        }
-    allWgIds.Close();
-    return parent;
-    }
-
-// --------------------------------------------------------------------------
-// CTsFswDataList::FindMostTopParentWgId
-// --------------------------------------------------------------------------
-//
-TInt CTsFswDataList::FindMostTopParentWgId( TInt aWgId )
-    {
-    TInt parent( KErrNotFound );
-    parent = FindParentWgId( aWgId );
-    if( parent != KErrNotFound)
-        {
-        TInt topParent = FindMostTopParentWgId(parent);
-        if( topParent != KErrNotFound )
-            {
-            parent = topParent;
-            }
-        }
-    return parent;
-    }
+    return EFalse;
+}
 
 // --------------------------------------------------------------------------
 // CTsFswDataList::FindAppNameLC
 // --------------------------------------------------------------------------
 //
-HBufC* CTsFswDataList::FindAppNameLC( CApaWindowGroupName* aWindowName,
-                                  const TUid& aAppUid,
-                                  TInt aWgId )
-    {
+HBufC* CTsFswDataList::FindAppNameLC(CApaWindowGroupName* windowName, const TUid& appUid, TInt wgId)
+{
     //Retrieve the app name
     TApaAppInfo info;
-    iAppArcSession.GetAppInfo( info, aAppUid );
+    mAppArcSession.GetAppInfo(info, appUid);
     TPtrC caption = info.iShortCaption;
 
     HBufC* tempName = 0;
-    if ( !caption.Length() && aWindowName ) // if not set - use thread name instead
-        {
-        if ( aWindowName->Caption().Length() )
-            {
-            tempName = aWindowName->Caption().AllocL();
+    if (!caption.Length() && windowName) // if not set - use thread name instead
+    {
+        if (windowName->Caption().Length()) {
+            tempName = windowName->Caption().AllocL();
             //put on cleanupstack after the if
-            }
-        else
-            {
+        }
+        else {
             TThreadId threadId;
-            TInt err = iWsSession.GetWindowGroupClientThreadId(
-                    aWgId, threadId );
-            if ( err == KErrNone )
-                {
+            TInt err = mWsSession.GetWindowGroupClientThreadId(wgId, threadId);
+            if (err == KErrNone) {
                 RThread thread;
-                CleanupClosePushL( thread );
-                err = thread.Open ( threadId );
-                if ( err==KErrNone )
-                    {
+                CleanupClosePushL(thread);
+                err = thread.Open(threadId);
+                if (err == KErrNone) {
                     tempName = thread.Name().AllocL(); // codescanner::forgottoputptroncleanupstack
                     // tempName put on cleanupstack after the if
-                    }
-                CleanupStack::PopAndDestroy( &thread );
                 }
+                CleanupStack::PopAndDestroy(&thread);
             }
         }
-    else
-        {
+    }
+    else {
         tempName = caption.AllocL();
         //put on cleanupstack after the if
-        }
-    CleanupStack::PushL( tempName );
+    }
+    CleanupStack::PushL(tempName);
     return tempName;
-    }
-
+}
 
 // --------------------------------------------------------------------------
 // CTsFswDataList::FitDataToListL
 // --------------------------------------------------------------------------
 //
-TBool CTsFswDataList::FitDataToListL(RTsFswArray& aListToFit,
-        TBool /*aConsiderWidgets*/)
-    {
+TBool CTsFswDataList::FitDataToListL(RTsFswArray& listToFit)
+{
     TBool changed = EFalse;
-    TInt listCount = aListToFit.Count();
-    TInt dataCount = iData.Count();
-    
+    TInt listCount = listToFit.Count();
+    TInt dataCount = mData.Count();
 
     //remove items that dont't exists in newly collected list      
-    for (TInt i = dataCount -1; i >= 0; --i)
-          {
-          if ( !CheckIfExists(*iData[i], aListToFit) )
-              {
-              delete iData[i];
-              iData.Remove(i);
-              changed = ETrue;
-              }
-          }
-      
+    for (TInt i = dataCount - 1; i >= 0; --i) {
+        if (!CheckIfExists(*mData[i], listToFit)) {
+            delete mData[i];
+            mData.Remove(i);
+            changed = ETrue;
+        }
+    }
+    RArray<TTsEntryKey> allKeys;
+
     //add new item at start
-    //for (TInt i = 0; i < aListToFit.Count(); ++i)
-    for (TInt i = aListToFit.Count()-1; i >= 0; --i)
-        {
-        if (!CheckIfExists(*aListToFit[i], iData))
-            {
-            iData.Insert(aListToFit[i], 0);
-            aListToFit[i] = 0;
+    for (TInt i = listToFit.Count() - 1; i >= 0; --i) {
+        allKeys.Insert(listToFit[i]->Key(), 0);
+        if (!CheckIfExists(*listToFit[i], mData)) {
+            mData.Insert(listToFit[i], 0);
+            listToFit[i] = 0;
             changed = ETrue;
-            }
         }
-    changed = changed || iOrderChanged;
-    iOrderChanged = EFalse;
+    }
+    //establish order
+    TBool orderChanged = EstablishOrder(allKeys);
+    changed = changed || orderChanged;
+    allKeys.Close();
     return changed;
-    }
+}
 
 // --------------------------------------------------------------------------
 // CTsFswDataList::CheckIfExists
 // --------------------------------------------------------------------------
 //
-TBool CTsFswDataList::CheckIfExists(const CTsFswEntry& aEntry,
-        const RTsFswArray& aList) const
-    {
+TBool CTsFswDataList::CheckIfExists(const CTsFswEntry& entry, const RTsFswArray& list) const
+{
     TBool exists(EFalse);
-    TInt dataCount = aList.Count();
-    for (TInt entryIdx = 0; entryIdx < dataCount; ++entryIdx)
-        {
-        if (aList[entryIdx]->AppUid() == aEntry.AppUid())
-            {
-            exists = ETrue;
-            break;
-            }
-        }
+    TTsEntryKey key;
+    TInt pos = FindEntry(list, entry.Key());
+    if (pos >= 0) {
+        exists = ETrue;
+    }
     return exists;
-    }
+}
 
 // --------------------------------------------------------------------------
-// CTsFswDataList::AppUidForWgId
+// CTsFswDataList::GetAppIconL
 // --------------------------------------------------------------------------
 //
-TInt CTsFswDataList::AppUidForWgId( TInt aWgId, TUid& aUid )
-    {
-	TRAPD(err, aUid = AppUidForWgIdL( aWgId ) );
-	return err;
+void CTsFswDataList::GetAppIconL(const TUid& aAppUid, CFbsBitmap*& bitmapArg, CFbsBitmap*& maskArg)
+{
+    bitmapArg = maskArg = NULL;
+
+    TSize size(KAppIconWidth, KAppIconHeight);
+    CApaMaskedBitmap* apaMaskedBitmap = CApaMaskedBitmap::NewLC();
+    TInt err = mAppArcSession.GetAppIcon(aAppUid, size, *apaMaskedBitmap);
+    TInt iconsCount(0);
+    if (err == KErrNone) {
+        err = mAppArcSession.NumberOfOwnDefinedIcons(aAppUid, iconsCount);
     }
 
-// --------------------------------------------------------------------------
-// CTsFswDataList::AppUidForWgIdL
-// --------------------------------------------------------------------------
-//
-TUid CTsFswDataList::AppUidForWgIdL( TInt aWgId )
-    {
-    CApaWindowGroupName* windowName =
-        CApaWindowGroupName::NewLC( iWsSession, aWgId );
-    TUid appUid = windowName->AppUid();
-    CleanupStack::PopAndDestroy( windowName );
-    return appUid;
+    if ((err == KErrNone) && (iconsCount > 0)) {
+        bitmapArg = static_cast<CFbsBitmap*> (apaMaskedBitmap);
+        TInt maskHandle = apaMaskedBitmap->Mask()->Handle();
+        maskArg = new (ELeave) CFbsBitmap;
+        maskArg->Duplicate(maskHandle);
+        CleanupStack::Pop(apaMaskedBitmap);
     }
+    else {
+        CleanupStack::PopAndDestroy(apaMaskedBitmap);
+        HBufC* fileNameFromApparc = NULL;
+        TInt err = mAppArcSession.GetAppIcon(aAppUid, fileNameFromApparc);
+        if (err == KErrNone) {
+            CleanupStack::PushL(fileNameFromApparc);
+            CFbsBitmap *bitamp(0);
+            CFbsBitmap *mask(0);
+            TInt bitmapIndex = 0;
+            TInt maskIndex = 1;
+            // it will change bitmap ids if it is mif (checking inside)
+            AknIconUtils::ValidateLogicalAppIconId(*fileNameFromApparc, bitmapIndex, maskIndex);
+            AknIconUtils::CreateIconLC(bitamp, mask, fileNameFromApparc->Des(), bitmapIndex,
+                maskIndex);
+
+            if (AknIconUtils::IsMifFile(*fileNameFromApparc)) {
+                AknIconUtils::DisableCompression(bitamp);
+                AknIconUtils::SetSize(bitamp, TSize(KAppIconWidth, KAppIconHeight),
+                    EAspectRatioPreservedAndUnusedSpaceRemoved);
+                // bitmap and icon, AknsUtils::CreateIconLC doesn't specify the order
+                CleanupStack::Pop(2);
+                bitmapArg = bitamp;
+                maskArg = mask;
+            }
+            else {
+                CleanupStack::PopAndDestroy(2);
+            }
+            CleanupStack::PopAndDestroy(fileNameFromApparc);
+        }
+    }
+}
 
 // --------------------------------------------------------------------------
 // CTsFswDataList::GetAppIconL
 // --------------------------------------------------------------------------
 //
-void CTsFswDataList::GetAppIconL( const TUid& aAppUid,
-        CFbsBitmap*& aBitmap, CFbsBitmap*& aMask )
-    {
-    aBitmap = aMask = NULL;
+TBool CTsFswDataList::IsHiddenUid(TUid uid)
+{
+    TInt result = mHiddenUids.Find(uid);
+    return result >= 0 ? ETrue : EFalse;
+}
 
-    TSize size( KAppIconWidth, KAppIconHeight );
-    CApaMaskedBitmap* apaMaskedBitmap = CApaMaskedBitmap::NewLC();
-    TInt err = iAppArcSession.GetAppIcon( aAppUid, size, *apaMaskedBitmap );
-    TInt iconsCount(0);
-    if ( err == KErrNone )
-        {
-        err = iAppArcSession.NumberOfOwnDefinedIcons(aAppUid, iconsCount);
-        }
-    
-    if ( (err == KErrNone) && (iconsCount>0) )
-        {
-        aBitmap = static_cast<CFbsBitmap*>(apaMaskedBitmap);
-        TInt maskHandle = apaMaskedBitmap->Mask()->Handle();
-        aMask = new (ELeave) CFbsBitmap;
-        aMask->Duplicate( maskHandle );
-        CleanupStack::Pop( apaMaskedBitmap );
-        }
-    else
-        {
-        CleanupStack::PopAndDestroy( apaMaskedBitmap );
-        HBufC* fileNameFromApparc = NULL;
-        TInt err = iAppArcSession.GetAppIcon(aAppUid,fileNameFromApparc);        
-        if ( err == KErrNone ) 
-            {
-            CleanupStack::PushL(fileNameFromApparc);
-            CFbsBitmap *bitamp(0);
-            CFbsBitmap *mask(0);
-            TInt bitmapIndex = 0;
-            TInt maskIndex = 1;    
-            // it will change bitmap ids if it is mif (checking inside)
-            AknIconUtils::ValidateLogicalAppIconId( *fileNameFromApparc, bitmapIndex, maskIndex );
-            AknIconUtils::CreateIconLC( bitamp, mask, fileNameFromApparc->Des(), bitmapIndex, maskIndex );
-
-            if (AknIconUtils::IsMifFile(*fileNameFromApparc)) \
-                {
-                AknIconUtils::DisableCompression(bitamp);
-                AknIconUtils::SetSize(bitamp, TSize(KAppIconWidth, KAppIconHeight), EAspectRatioPreservedAndUnusedSpaceRemoved);                                
-                // bitmap and icon, AknsUtils::CreateIconLC doesn't specify the order
-                CleanupStack::Pop(2);                  
-                aBitmap = bitamp;
-                aMask = mask;
-                }
-            else
-                {
-                CleanupStack::PopAndDestroy(2);                       
-                }
-            CleanupStack::PopAndDestroy(fileNameFromApparc);
-            }
+// --------------------------------------------------------------------------
+// CTsFswDataList::FindEntry
+// --------------------------------------------------------------------------
+//
+TInt CTsFswDataList::FindEntry(const RTsFswArray& list, const TTsEntryKey& key) const
+{
+    TInt pos(KErrNotFound);
+    TInt dataCount = list.Count();
+    for (TInt entryIdx = 0; entryIdx < dataCount; ++entryIdx) {
+        if (list[entryIdx]->Key() == key) {
+            pos = entryIdx;
+            break;
         }
     }
+    return pos;
+}
 
 // --------------------------------------------------------------------------
-// CTsFswDataList::GetAppIconL
+// CTsFswDataList::SetScreenshotL
+// --------------------------------------------------------------------------
+//
+TBool CTsFswDataList::SetScreenshotL(const CFbsBitmap* bitmap, UpdatePriority priority, TInt wgId)
+{
+    RArray<RWsSession::TWindowGroupChainInfo> allWgIds;
+    CleanupClosePushL(allWgIds);
+    User::LeaveIfError(mWsSession.WindowGroupList(0, &allWgIds));
+    TTsEntryKey key = TsEntryKeyGeneraror::GenerateL(wgId, allWgIds.Array());
+    TInt pos = FindEntry(mData, key);
+    TBool updated(EFalse);
+    if (pos >= 0) {
+        updated = mData[pos]->SetScreenshotL(bitmap, priority);
+    }
+    else {
+        User::Leave(KErrNotFound);
+    }
+    CleanupStack::PopAndDestroy(&allWgIds);
+    return updated;
+}
+
+// --------------------------------------------------------------------------
+// CTsFswDataList::RemoveScreenshotL
 // --------------------------------------------------------------------------
 //
-TBool CTsFswDataList::IsHiddenUid( TUid aUid )
-    {
-    TInt result = iHiddenUids.Find( aUid );
-    return result >= 0 ? ETrue : EFalse;
+TBool CTsFswDataList::RemoveScreenshotL(TInt wgId)
+{
+    RArray<RWsSession::TWindowGroupChainInfo> allWgIds;
+    CleanupClosePushL(allWgIds);
+    User::LeaveIfError(mWsSession.WindowGroupList(0, &allWgIds));
+    TTsEntryKey key = TsEntryKeyGeneraror::GenerateL(wgId, allWgIds.Array());
+    TInt pos = FindEntry(mData, key);
+    TBool updated(EFalse);
+    if (pos >= 0) {
+        updated = mData[pos]->RemoveScreenshot();
+    }
+    else {
+        User::Leave(KErrNotFound);
     }
+    CleanupStack::PopAndDestroy(&allWgIds);
+    return updated;
+}
+
+// --------------------------------------------------------------------------
+// CTsFswDataList::EstablishOrder
+// --------------------------------------------------------------------------
+//
+TBool CTsFswDataList::EstablishOrder(const RArray<TTsEntryKey>& keyList)
+{
+    TBool changed(EFalse);
+    __ASSERT_ALWAYS(mData.Count() == keyList.Count(), User::Panic(_L("EstablishOrder 1"), KErrBadHandle) );
+    for (TInt i = 0; i < keyList.Count(); i++) {
+        const TTsEntryKey& currentdataKey = mData[i]->Key();
+        const TTsEntryKey& referenceKey = keyList[i];
+        if (!(currentdataKey == referenceKey)) {
+            TInt foundPos = FindEntry(mData, referenceKey);
+            __ASSERT_ALWAYS(foundPos>=0, User::Panic(_L("EstablishOrder 2"), KErrBadHandle) );
+            CTsFswEntry* entry = mData[foundPos];
+            mData.Remove(foundPos);
+            mData.Insert(entry, i);
+            changed = ETrue;
+        }
+    }
+    return changed;
+}
+
+// --------------------------------------------------------------------------
+// CTsFswDataList::GetAllowedUidsL
+// --------------------------------------------------------------------------
+//
+void CTsFswDataList::GetAllowedUidsL()
+{
+    mAllowedUids.Close();
+    TApaAppInfo* appInfo = new (ELeave) TApaAppInfo();
+    CleanupStack::PushL(appInfo);
+    TApaAppCapabilityBuf appCap;
+
+    User::LeaveIfError(mAppArcSession.GetAllApps(0));
+    // for every application get uid, hidden and missing attribute
+    // and add to aArray.
+    while (KErrNone == mAppArcSession.GetNextApp(*appInfo)) {
+        TUid uid = appInfo->iUid;
+        User::LeaveIfError(mAppArcSession.GetAppCapability(appCap, uid));
+        // do not add hidden app and with null uid.
+        if (!appCap().iAppIsHidden && !IsHiddenUid(uid) && uid.iUid) {
+            mAllowedUids.AppendL(uid);
+        }
+    }
+    CleanupStack::PopAndDestroy(appInfo);
+}
 
 // end of file
--- a/tstaskmonitor/server/src/tsfswengine.cpp	Mon May 24 20:50:46 2010 +0300
+++ b/tstaskmonitor/server/src/tsfswengine.cpp	Fri May 28 16:17:03 2010 +0300
@@ -17,205 +17,114 @@
 
 
 #include "tsfswengine.h"
-
 #include "tsfswdatalist.h"
 
 
-
-
-#include <apgtask.h>
-#include <AknDef.h>
-#include <apgwgnam.h>
-#include <mmf/common/mmfcontrollerpluginresolver.h> // for CleanupResetAndDestroyPushL
-#include <featmgr.h>
-#include <swi/swispubsubdefs.h>
-#include <s32mem.h>
-#include <bitmaptransforms.h>
-
-// time to wait before refreshing content
-const TInt KContentRefreshDelay = 50000; // 0.05 sec
-
-
 // --------------------------------------------------------------------------
 // CTsFswEngine::NewL
 // --------------------------------------------------------------------------
 //
-CTsFswEngine* CTsFswEngine::NewL( MHsDataObserver& aObserver )
-    {
-    CTsFswEngine* self = NewLC( aObserver );
-    CleanupStack::Pop( self );
+CTsFswEngine* CTsFswEngine::NewL(MHsDataObserver& observer)
+{
+    CTsFswEngine* self = NewLC(observer);
+    CleanupStack::Pop(self);
     return self;
-    }
+}
 
 // --------------------------------------------------------------------------
 // CTsFswEngine::NewLC
 // --------------------------------------------------------------------------
 //
-CTsFswEngine* CTsFswEngine::NewLC( MHsDataObserver& aObserver )
-    {
-    CTsFswEngine* self = new ( ELeave ) CTsFswEngine( aObserver );
-    CleanupStack::PushL( self );
+CTsFswEngine* CTsFswEngine::NewLC(MHsDataObserver& observer)
+{
+    CTsFswEngine* self = new (ELeave) CTsFswEngine(observer);
+    CleanupStack::PushL(self);
     self->ConstructL();
     return self;
-    }
+}
 
 // --------------------------------------------------------------------------
 // CTsFswEngine::CTsFswEngine
 // --------------------------------------------------------------------------
 //
-CTsFswEngine::CTsFswEngine( MHsDataObserver& aObserver )
-        :iObserver( aObserver )
-    {
-    }
+CTsFswEngine::CTsFswEngine(MHsDataObserver& observer) :
+    mObserver(observer)
+{
+}
 
 // --------------------------------------------------------------------------
 // CTsFswEngine::ConstructL
 // --------------------------------------------------------------------------
 //
 void CTsFswEngine::ConstructL()
-    {
-    User::LeaveIfError( iWsSession.Connect() );
-    User::LeaveIfError( iAppArcSession.Connect() );
-
-    iDataList = CTsFswDataList::NewL(*this);    
-
-    // get an initial list of tasks
-    iDataList->SetAppDataRefreshNeeded();
+{
+    mDataList = CTsFswDataList::NewL(mObserver);
     CollectTasksL();
-
-    iUpdateStarter = CPeriodic::NewL( CActive::EPriorityStandard );   
-    }
+}
 
 // --------------------------------------------------------------------------
 // CTsFswEngine::~CTsFswEngine
 // --------------------------------------------------------------------------
 //
 CTsFswEngine::~CTsFswEngine()
-    {
-
-    delete iUpdateStarter;
-
-    iWgIds.Close();
-
-    iAppArcSession.Close();
-    iWsSession.Close();
-
-    delete iDataList;
-    }
+{
+    delete mDataList;
+}
 
 // --------------------------------------------------------------------------
 // CTsFswEngine::FswDataL
 // --------------------------------------------------------------------------
 //
 const RTsFswArray& CTsFswEngine::FswDataL()
-    {
-    return iDataList->FswDataL();
-    }
+{
+    return mDataList->FswDataL();
+}
 
 // --------------------------------------------------------------------------
 // CTsFswEngine::UpdateTaskList
 // Callback from appui
 // --------------------------------------------------------------------------
 //
-void CTsFswEngine::UpdateTaskList()
-    {
-    // There can be many calls in a row, use a timer to prevent degrading
-    // device performance.
-    iDataList->SetDirty();
-    if ( !iUpdateStarter->IsActive() )
-        {
-        iUpdateStarter->Start( KContentRefreshDelay, 0,
-                TCallBack( UpdateStarterCallback, this ) );
-        }    
-    // get the foreground app uid and publish it to CFW if different than before
-    TRAP_IGNORE( PublishFgAppUidL() );
+void CTsFswEngine::DataChanged()
+{
+    TBool changed = EFalse;
+    TRAPD( err, changed = CollectTasksL() );
+    if (err == KErrNone && changed) {
+        mObserver.DataChanged();
     }
-
-// --------------------------------------------------------------------------
-// CTsFswEngine::UpdateStarterCallback
-// Callback for the timer
-// --------------------------------------------------------------------------
-//
-TInt CTsFswEngine::UpdateStarterCallback( TAny* aParam )
-    {
-    CTsFswEngine* self = static_cast<CTsFswEngine*>( aParam );
-    self->iUpdateStarter->Cancel();
-    // get list of tasks and notify observer if there is a change in the list
-    TBool changed = EFalse;
-    TRAPD( err, changed = self->CollectTasksL() );
-    if ( err == KErrNone && changed )
-        {
-        self->iObserver.DataChanged();
-        }
-    return 0;
-    }
+}
 
 // --------------------------------------------------------------------------
 // CTsFswEngine::CollectTasksL
 // --------------------------------------------------------------------------
 //
 TBool CTsFswEngine::CollectTasksL()
-    {
-    TBool changed = iDataList->CollectTasksL();
+{
+    TBool changed = mDataList->CollectTasksL();
     return changed;
-    }
+}
 
 // --------------------------------------------------------------------------
-// CTsFswEngine::ForegroundAppUidL
+// CTsFswEngine::SetScreenshotL
 // --------------------------------------------------------------------------
 //
-TUid CTsFswEngine::ForegroundAppUidL( TInt aType )
-    {
-    // Do not use GetFocusWindowGroup or others.
-    // We want to see only "real" application uids in FgApp,
-    // i.e. stuff that would also be shown in the task swapper
-    // area of Taskswitcher.
-
-    TUid result = KNullUid;
-    RArray<RWsSession::TWindowGroupChainInfo> allWgIds;
-    CleanupClosePushL( allWgIds );
-    User::LeaveIfError( iWsSession.WindowGroupList( 0, &allWgIds ) );
-    TInt count = allWgIds.Count();
-    for ( TInt i = 0; i < count; ++i )
-        {
-        // Depending on aType we may not need to bother with iParentId here.
-        // If aType == EUseEmbeddedUid => embedded apps are treated as others.
-        // If aType == EUseStandaloneUid => embedded apps must be ignored.
-        if ( allWgIds[i].iParentId > 0
-                && aType == CTsFswEngine::EUseStandaloneUid )
-            {
-            continue;
-            }
-
-        CApaWindowGroupName* wgn = CApaWindowGroupName::NewLC(
-            iWsSession, allWgIds[i].iId );
-        TUid newUid = wgn->AppUid();
-        TBool hidden = wgn->Hidden();
-        CleanupStack::PopAndDestroy( wgn );
-
-        if ( !hidden && newUid.iUid && !iDataList->IsHiddenUid(newUid) )
-            {
-            result = newUid;
-            break;
-            }
-        }
-    CleanupStack::PopAndDestroy( &allWgIds );
-    
-    return result;
+void CTsFswEngine::SetScreenshotL(const CFbsBitmap* bitmap, UpdatePriority priority, TInt wgId)
+{
+    TBool changed = mDataList->SetScreenshotL(bitmap, priority, wgId);
+    if (!changed) {
+        User::Leave(KErrAccessDenied);
     }
+}
 
 // --------------------------------------------------------------------------
-// CTsFswEngine::PublishFgAppUidL
+// CTsFswEngine::SetScreenshotL
 // --------------------------------------------------------------------------
 //
-void CTsFswEngine::PublishFgAppUidL()
-    {
-    TUid newUid = ForegroundAppUidL( CTsFswEngine::EUseEmbeddedUid );
-    if ( iFgAppUid != newUid && newUid.iUid )
-        {
-        iFgAppUid = newUid;
-        iDataList->MoveEntryAtStart(newUid.iUid, EFalse);
-        }
+void CTsFswEngine::RemoveScreenshotL(TInt wgId)
+{
+    TBool changed = mDataList->RemoveScreenshotL(wgId);
+    if (changed) {
+        mObserver.DataChanged();
     }
-
+}
 // end of file
--- a/tstaskmonitor/server/src/tsfswmonitor.cpp	Mon May 24 20:50:46 2010 +0300
+++ b/tstaskmonitor/server/src/tsfswmonitor.cpp	Fri May 28 16:17:03 2010 +0300
@@ -1,92 +1,89 @@
 /*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  ws monitor implementation
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
  *
-*/
-
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  ws monitor implementation
+ *
+ */
 
 #include "tsfswmonitor.h"
-#include "tsfswobservers.h"
+#include "tsdataobserver.h"
 
 // --------------------------------------------------------------------------
 // CTsFswMonitor::~CTsFswMonitor
 // --------------------------------------------------------------------------
 //
 CTsFswMonitor::~CTsFswMonitor()
-    {
+{
     Cancel();
-    iWg.Close();
-    iWsSession.Close();
-    }
+    mWg.Close();
+    mWsSession.Close();
+}
 
 // --------------------------------------------------------------------------
 // CTsFswMonitor::CTsFswMonitor
 // --------------------------------------------------------------------------
 //
-CTsFswMonitor::CTsFswMonitor(MTsFswTaskListObserver& aTaskListObserver) : CActive( EPriorityStandard ),
-    iTaskListObserver(&aTaskListObserver)
-    {
-    }
+CTsFswMonitor::CTsFswMonitor(MHsDataObserver& taskListObserver) :
+    CActive(EPriorityStandard), mTaskListObserver(&taskListObserver)
+{
+}
 
 // --------------------------------------------------------------------------
 // CTsFswMonitor::NewL
 // --------------------------------------------------------------------------
 //        
-CTsFswMonitor* CTsFswMonitor::NewL(MTsFswTaskListObserver& aTaskListObserver)
-    {
-    CTsFswMonitor* self = NewLC(aTaskListObserver);
-    CleanupStack::Pop( self );
+CTsFswMonitor* CTsFswMonitor::NewL(MHsDataObserver& taskListObserver)
+{
+    CTsFswMonitor* self = NewLC(taskListObserver);
+    CleanupStack::Pop(self);
     return self;
-    }
+}
 
 // --------------------------------------------------------------------------
 // CTsFswMonitor::NewLC
 // --------------------------------------------------------------------------
 //
-CTsFswMonitor* CTsFswMonitor::NewLC(MTsFswTaskListObserver& aTaskListObserver)
-    {
-    CTsFswMonitor* self = new ( ELeave ) CTsFswMonitor(aTaskListObserver);
-    CleanupStack::PushL( self );
+CTsFswMonitor* CTsFswMonitor::NewLC(MHsDataObserver& taskListObserver)
+{
+    CTsFswMonitor* self = new (ELeave) CTsFswMonitor(taskListObserver);
+    CleanupStack::PushL(self);
     self->ConstructL();
     return self;
-    }
-    
+}
+
 // --------------------------------------------------------------------------
 // CTsFswMonitor::ConstructL
 // --------------------------------------------------------------------------
 //
 void CTsFswMonitor::ConstructL()
-    {
-    CActiveScheduler::Add( this );
+{
+    CActiveScheduler::Add(this);
     //Create window server observer
     ConstractObserverL();
     Subscribe();
-    }
-
+}
 
 // -----------------------------------------------------------------------------
 // Subscribe
 // -----------------------------------------------------------------------------
 //
 void CTsFswMonitor::Subscribe()
-    {
-    if( !IsActive() )
-        {
-        iWsSession.EventReady( &iStatus );
+{
+    if (!IsActive()) {
+        mWsSession.EventReady(&iStatus);
         SetActive();
-        }
     }
+}
 
 // -----------------------------------------------------------------------------
 // ConstractObserverL
@@ -94,35 +91,32 @@
 //
 void CTsFswMonitor::ConstractObserverL()
 {
-    User::LeaveIfError( iWsSession.Connect() );
-    iWg = RWindowGroup( iWsSession );
-    User::LeaveIfError( iWg.Construct( 
-                        reinterpret_cast<TUint32>( &iWg ) ) );
-    iWg.DisableFocusChangeEvents();
-    iWg.DisableModifierChangedEvents();
-    iWg.DisableOnEvents();
-    iWg.DisableScreenChangeEvents();
+    User::LeaveIfError(mWsSession.Connect());
+    mWg = RWindowGroup(mWsSession);
+    User::LeaveIfError(mWg.Construct(reinterpret_cast<TUint32> (&mWg)));
+    mWg.DisableFocusChangeEvents();
+    mWg.DisableModifierChangedEvents();
+    mWg.DisableOnEvents();
+    mWg.DisableScreenChangeEvents();
 
     //enable notifications about group lists
-    User::LeaveIfError( iWg.EnableGroupListChangeEvents() );
+    User::LeaveIfError(mWg.EnableGroupListChangeEvents());
 }
 
 void CTsFswMonitor::RunL()
 {
-    User::LeaveIfError( iStatus.Int() );
+    User::LeaveIfError(iStatus.Int());
     TWsEvent event;
-    iWsSession.GetEvent( event );
+    mWsSession.GetEvent(event);
     Subscribe();//new subscribtion has to be called after picking event
-    if( EEventWindowGroupListChanged == event.Type() /*|| EEventFocusGroupChanged == event.Type()*/ )
-        {
-        if ( iTaskListObserver )
-            {
-            iTaskListObserver->UpdateTaskList(); 
-            }
+    if (EEventWindowGroupListChanged == event.Type() /*|| EEventFocusGroupChanged == event.Type()*/) {
+        if (mTaskListObserver) {
+            mTaskListObserver->DataChanged();
         }
+    }
 }
 
-TInt CTsFswMonitor::RunError( TInt /*aError*/ )
+TInt CTsFswMonitor::RunError(TInt /*aError*/)
 {
     Subscribe();
     return KErrNone;
@@ -130,10 +124,9 @@
 
 void CTsFswMonitor::DoCancel()
 {
-    if( IsActive() )
-        {
-        iWsSession.EventReadyCancel();
-        }
+    if (IsActive()) {
+        mWsSession.EventReadyCancel();
+    }
 }
 
 // end of file
--- a/tstaskmonitor/server/src/tsrunningappstorage.cpp	Mon May 24 20:50:46 2010 +0300
+++ b/tstaskmonitor/server/src/tsrunningappstorage.cpp	Fri May 28 16:17:03 2010 +0300
@@ -19,7 +19,7 @@
 #include "tsfswmonitor.h"
 #include "tsfswentry.h"
 #include <s32strm.h>
-#include <S32MEM.H>
+#include <s32mem.h>
 // -----------------------------------------------------------------------------
 //
 // -----------------------------------------------------------------------------
@@ -84,13 +84,12 @@
     {
         mObserver.DataChanged();
     }
-    
-    int a=8;
-    if( a==9)
-    {
-        CActiveScheduler::Stop();
-    }
 }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
 void CRunningAppStorage::DataChangedL()
 {
     RTsFswArray taskList = mEngine->FswDataL();
@@ -110,6 +109,24 @@
     
 
     CleanupStack::PopAndDestroy(buf);
-    CleanupStack::PopAndDestroy(entry); 
- 
+    CleanupStack::PopAndDestroy(entry);  
 }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CRunningAppStorage::UpdateL(TInt key, const CFbsBitmap& data, TInt /*param*/, TInt priority)
+    {
+    UpdatePriority newpriority = static_cast<UpdatePriority>(priority);
+    mEngine->SetScreenshotL(&data, newpriority, key);
+    }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CRunningAppStorage::RemoveL(TInt key, TInt /*param*/)
+    {
+    mEngine->RemoveScreenshotL(key);
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/server/src/tsscreenshotprovider.cpp	Fri May 28 16:17:03 2010 +0300
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "tsscreenshotprovider.h"
+#include "tstaskmonitorglobals.h"
+#include <s32mem.h>
+
+const TUid KPluginUID = {0x200267AE};
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CTsScreenshotProvider* CTsScreenshotProvider::NewL(MTsDataStorage& storage)
+{
+    CTsScreenshotProvider *self = new (ELeave)CTsScreenshotProvider(storage);
+    CleanupStack::PushL(self);
+    self->BaseConstructL(KPluginUID, KNullDesC8);
+    CleanupStack::Pop(self);
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CTsScreenshotProvider::CTsScreenshotProvider(MTsDataStorage& storage)
+:
+mStorage(storage)
+{}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CTsScreenshotProvider::HandleMessage(const TDesC8& msg)
+{
+    TRAP_IGNORE(HandleMessageL(msg));
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CTsScreenshotProvider::HandleMessageL(const TDesC8& msg)
+{
+    const TInt KMsgSize(5); 
+    TInt parsedMsg[KMsgSize];
+    
+    RDesReadStream msgStream(msg);
+    for (TInt iter(0); iter < KMsgSize; ++iter) {
+        parsedMsg[iter] = msgStream.ReadInt32L();
+    }
+    
+    if (RegisterScreenshotMessage == parsedMsg[0]) {
+        CFbsBitmap *bitmap = new CFbsBitmap;
+        TInt errNo(KErrNoMemory);
+        if (0 != bitmap) {
+            CleanupStack::PushL(bitmap);
+            errNo = bitmap->Duplicate(parsedMsg[ScreenshotHandle + 1]);
+        }
+        const TPckgC<TInt[sizeof(parsedMsg) / sizeof(TInt)]> buf(parsedMsg);//ACK bitmap duplication
+        SendMessage(msg);
+        User::LeaveIfError(errNo);
+        
+        mStorage.UpdateL(parsedMsg[WindowsGroup +1 ], 
+                         *bitmap, 
+                         parsedMsg[AdditionalParameters + 1], 
+                         parsedMsg[Priority + 1]);
+       
+        CleanupStack::PopAndDestroy(bitmap);
+    }
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CTsScreenshotProvider::OnReplace()
+{
+    //no implementation required
+}
--- a/tstaskmonitor/sis/stubs/taskmonitor_stub.pkg	Mon May 24 20:50:46 2010 +0300
+++ b/tstaskmonitor/sis/stubs/taskmonitor_stub.pkg	Fri May 28 16:17:03 2010 +0300
@@ -33,4 +33,7 @@
 :"Nokia"
 
 "" - "Z:\sys\bin\tstaskmonitorclient.dll"
-""    - "Z:\sys\bin\hsrunningappmonitor.exe"
+"" - "Z:\sys\bin\hsrunningappmonitor.exe"
+"" - "Z:\sys\bin\tsscreenshotplugin.dll"
+"" - "Z:\resource\plugins\tsscreenshotplugin.rsc"
+"" - "Z:\sys\bin\tsbackstepping.dll"
\ No newline at end of file
Binary file tstaskmonitor/sis/stubs/taskmonitor_stub.sis has changed
Binary file tstaskmonitor/sis/taskmonitor.SIS has changed
--- a/tstaskmonitor/sis/taskmonitor.pkg	Mon May 24 20:50:46 2010 +0300
+++ b/tstaskmonitor/sis/taskmonitor.pkg	Fri May 28 16:17:03 2010 +0300
@@ -29,4 +29,6 @@
 
 "/epoc32/release/armv5/urel/hsrunningappmonitor.exe" - "!:\sys\bin\hsrunningappmonitor.exe"
 "/epoc32/release/armv5/urel/tstaskmonitorclient.dll"-"!:\sys\bin\tstaskmonitorclient.dll"
-
+"/epoc32/release/armv5/urel/tsscreenshotplugin.dll"-"!:\sys\bin\tsscreenshotplugin.dll"
+"/epoc32/data/z/resource/plugins/tsscreenshotplugin.rsc"-"!:\resource\plugins\tsscreenshotplugin.rsc"
+"/epoc32/release/armv5/urel/tsbackstepping.dll"-"!:\sys\bin\tsbackstepping.dll"
--- a/tstaskmonitor/tstaskmonitor.pro	Mon May 24 20:50:46 2010 +0300
+++ b/tstaskmonitor/tstaskmonitor.pro	Fri May 28 16:17:03 2010 +0300
@@ -17,11 +17,14 @@
 TEMPLATE = subdirs
 
 CONFIG += ordered
-
+SUBDIRS += client
 symbian {
-    SUBDIRS += server
+    SUBDIRS += backstepping \
+               server \
+               screenshotplugin
+               
+    BLD_INF_RULES.prj_exports +=    "inc\tstaskmonitorglobals.h"
+    
 }
 
-SUBDIRS += client
-
 symbian:include(rom.pri)
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/utils/inc/tsdataobserver.h	Fri May 28 16:17:03 2010 +0300
@@ -0,0 +1,42 @@
+/*
+* 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 DATAOBSERVER_H
+#define DATAOBSERVER_H
+
+#include <e32base.h>
+
+class MHsDataObserver {
+public:
+    virtual void DataChanged() =0;
+};
+
+class CHsDataObserver: public CBase,
+                       public MHsDataObserver
+{
+public:
+    virtual void Cancel(const RMessage2& reason) =0;
+};
+
+class MHsDataObserverStorage
+{
+public:
+    virtual void PushL(CHsDataObserver*) =0;
+    virtual void Pop(CHsDataObserver*) =0;
+    virtual void Cancel(const RMessage2& reason) =0;
+};
+
+#endif //DATAOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/utils/inc/tsentrykey.h	Fri May 28 16:17:03 2010 +0300
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Task list entry
+ *
+*/
+
+
+#ifndef TSENTRYKEY_H
+#define TSENTRYKEY_H
+
+#include <e32base.h>
+class RReadStream;
+class RWriteStream;
+
+class TTsEntryKey
+{
+public:
+    TTsEntryKey(TInt parentId =0);
+    TBool operator ==(const TTsEntryKey& key) const;
+    void ExternalizeL(RWriteStream& output);
+    void InternalizeL(RReadStream& input);
+
+public:
+    TInt mParentId;
+};
+
+#endif //TSENTRYKEY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/utils/inc/tsentrykeygenerator.h	Fri May 28 16:17:03 2010 +0300
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Task list entry
+ *
+*/
+
+
+#ifndef TSENTRYKEYGENERATOR_H
+#define TSENTRYKEYGENERATOR_H
+
+#include <e32base.h>
+#include <e32cmn.h>
+#include <w32std.h>
+
+#include "tsentrykey.h"
+
+
+class TsEntryKeyGeneraror
+{
+public:
+    static TTsEntryKey GenerateL(TInt windowGroupId, 
+                                 const TArray<RWsSession::TWindowGroupChainInfo>& groupChain);
+};
+
+#endif //TSENTRYKEYGENERATOR_H
--- a/tstaskmonitor/utils/inc/tsfswentry.h	Mon May 24 20:50:46 2010 +0300
+++ b/tstaskmonitor/utils/inc/tsfswentry.h	Fri May 28 16:17:03 2010 +0300
@@ -21,11 +21,16 @@
 
 #include <e32base.h>
 #include <e32cmn.h>
+#include <tsgraphicfilescalinghandler.h>
+
+#include "tsentrykey.h"
+#include "tstaskmonitorglobals.h"
 
 class CTsFswEntry;
 class RReadStream;
 class RWriteStream;
 class CFbsBitmap;
+class MHsDataObserver;
 
 typedef RPointerArray<CTsFswEntry> RTsFswArray;
 
@@ -39,11 +44,16 @@
 /**
  * An entry in the task list.
  */
-NONSHARABLE_CLASS( CTsFswEntry ) : public CBase
+NONSHARABLE_CLASS( CTsFswEntry ) : public CBase,
+                                   private MImageReadyCallBack
     {
 public:
     static CTsFswEntry* NewL();
     static CTsFswEntry* NewLC();
+    
+    static CTsFswEntry* NewL(const TTsEntryKey& key, MHsDataObserver* observer =0);
+    static CTsFswEntry* NewLC(const TTsEntryKey& key, MHsDataObserver* observer =0);
+    
     ~CTsFswEntry();
 
     /**
@@ -80,15 +90,31 @@
     
     /**
      * Application icon mask.
-     * @see AppIconBitmapHandle
      */
     CFbsBitmap* AppIconMask() const;
+    
+    /**
+     * Application screenshot.
+     */
+    CFbsBitmap* Screenshot() const;
+    
+    /**
+     * Priority.
+     */
+    UpdatePriority Priority() const;
+    
+    /**
+     * Entry's key
+     */
+    const TTsEntryKey& Key() const;
 
 
-    void SetWgId( TInt aWgId );
-    void SetAppUid( const TUid& aUid );
-    void SetAppNameL( const TDesC& aAppName );
-    void SetCloseableApp( TBool aValue );
+    void SetWgId( TInt wgId );
+    void SetAppUid( const TUid& uid );
+    void SetAppNameL( const TDesC& appName );
+    void SetCloseableApp( TBool value );
+    TBool SetScreenshotL(const CFbsBitmap* bitmap, UpdatePriority priority);
+    TBool RemoveScreenshot();
     
     // takes ownership of bitmaps
     void SetAppIcon( CFbsBitmap* aBitmap, CFbsBitmap* aMask );
@@ -101,12 +127,23 @@
         RTsFswArray& aArray );
 
 private:
-    TInt iWgId;
-    TUid iAppUid;
-    HBufC* iAppName;
-    TBool iCloseableApp;
-    CFbsBitmap* iAppIconBitmap;
-    CFbsBitmap* iAppIconMask;  
+    //constructors
+    CTsFswEntry();
+    CTsFswEntry(const TTsEntryKey& aKey, MHsDataObserver* observer);
+    void ImageReadyCallBack(TInt error, const CFbsBitmap *bitmap );
+    
+private:
+    TInt mWgId;
+    TUid mAppUid;
+    HBufC* mAppName;
+    TBool mCloseableApp;
+    CFbsBitmap* mAppIconBitmap;
+    CFbsBitmap* mAppIconMask;
+    CFbsBitmap* mScreenshot;
+    TTsEntryKey mKey;
+    UpdatePriority mPriority;
+    MHsDataObserver* mObserver;
+    CTsGraphicFileScalingHandler* mImgTool;
     };
 
 #endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/utils/src/tsentrykey.cpp	Fri May 28 16:17:03 2010 +0300
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Task list entry
+ *
+*/
+
+
+#include "tsentrykey.h"
+#include <s32strm.h>
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+TTsEntryKey::TTsEntryKey(TInt parentId)
+:
+    mParentId(parentId)
+{}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+TBool TTsEntryKey::operator ==(const TTsEntryKey& key) const
+{
+    return (mParentId == key.mParentId);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void TTsEntryKey::ExternalizeL(RWriteStream& output)
+{
+    output.WriteInt32L(mParentId);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void TTsEntryKey::InternalizeL(RReadStream& input)
+{
+    mParentId = input.ReadInt32L();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/utils/src/tsentrykeygenerator.cpp	Fri May 28 16:17:03 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Task list entry
+ *
+*/
+#include "tsentrykeygenerator.h"
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+TTsEntryKey TsEntryKeyGeneraror::GenerateL(TInt windowGroupId, 
+                                           const TArray<RWsSession::TWindowGroupChainInfo>& groupChain) 
+{
+    for (TInt iter(0); iter < groupChain.Count(); ++iter) {
+        if (groupChain[iter].iId == windowGroupId) {
+            return 0 >= groupChain[iter].iParentId ?
+                   TTsEntryKey(windowGroupId) :
+                   TsEntryKeyGeneraror::GenerateL(groupChain[iter].iParentId, groupChain);
+        }
+    }
+    User::Leave(KErrNotFound);
+    // for avoid compile error
+    return TTsEntryKey(); 
+}
+
--- a/tstaskmonitor/utils/src/tsfswentry.cpp	Mon May 24 20:50:46 2010 +0300
+++ b/tstaskmonitor/utils/src/tsfswentry.cpp	Fri May 28 16:17:03 2010 +0300
@@ -1,22 +1,23 @@
 /*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Task list entry
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
  *
-*/
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  Task list entry
+ *
+ */
 
 #define __E32SVR_H__
 #include "tsfswentry.h"
+#include "tsdataobserver.h"
 #include <s32strm.h>
 #include <fbs.h>
 
@@ -25,227 +26,370 @@
 // --------------------------------------------------------------------------
 //
 CTsFswEntry* CTsFswEntry::NewL()
-    {
+{
     CTsFswEntry* self = NewLC();
-    CleanupStack::Pop( self );
+    CleanupStack::Pop(self);
     return self;
-    }
+}
 
 // --------------------------------------------------------------------------
 // CTsFswEntry::NewLC
 // --------------------------------------------------------------------------
 //
 CTsFswEntry* CTsFswEntry::NewLC()
-    {
-    CTsFswEntry* self = new ( ELeave ) CTsFswEntry;
-    CleanupStack::PushL( self );
+{
+    CTsFswEntry* self = new (ELeave) CTsFswEntry;
+    CleanupStack::PushL(self);
     return self;
-    }
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::NewL
+// --------------------------------------------------------------------------
+//
+CTsFswEntry* CTsFswEntry::NewL(const TTsEntryKey& key, MHsDataObserver *observer)
+{
+    CTsFswEntry* self = NewLC(key, observer);
+    CleanupStack::Pop(self);
+    return self;
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::NewLC
+// --------------------------------------------------------------------------
+//
+CTsFswEntry* CTsFswEntry::NewLC(const TTsEntryKey& key, MHsDataObserver* observer)
+{
+    CTsFswEntry* self = new (ELeave) CTsFswEntry(key, observer);
+    CleanupStack::PushL(self);
+    return self;
+}
 
 // --------------------------------------------------------------------------
 // CTsFswEntry::~CTsFswEntry
 // --------------------------------------------------------------------------
 //
 CTsFswEntry::~CTsFswEntry()
-    {
-    delete iAppName;
-    delete iAppIconBitmap;
-    delete iAppIconMask;
-    }
+{
+    delete mAppName;
+    delete mAppIconBitmap;
+    delete mAppIconMask;
+    delete mScreenshot;
+    delete mImgTool;
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::CTsFswEntry
+// --------------------------------------------------------------------------
+//
+CTsFswEntry::CTsFswEntry() :
+    mPriority(Low)
+{
+    mKey = TTsEntryKey();
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::CTsFswEntry
+// --------------------------------------------------------------------------
+//
+CTsFswEntry::CTsFswEntry(const TTsEntryKey& key, MHsDataObserver *observer) :
+    mKey(key), mPriority(Low), mObserver(observer)
+{
+    mWgId = key.mParentId;
+}
 
 // --------------------------------------------------------------------------
 // CTsFswEntry::SetWgId
 // --------------------------------------------------------------------------
 //
-void CTsFswEntry::SetWgId( TInt aWgId )
-    {
-    iWgId = aWgId;
-    }
+void CTsFswEntry::SetWgId(TInt wgId)
+{
+    mWgId = wgId;
+    mKey = TTsEntryKey(mWgId);
+}
 
 // --------------------------------------------------------------------------
 // CTsFswEntry::SetAppUid
 // --------------------------------------------------------------------------
 //
-void CTsFswEntry::SetAppUid( const TUid& aUid )
-    {
-    iAppUid = aUid;
-    }
+void CTsFswEntry::SetAppUid(const TUid& uid)
+{
+    mAppUid = uid;
+}
 
 // --------------------------------------------------------------------------
 // CTsFswEntry::SetAppNameL
 // --------------------------------------------------------------------------
 //
-void CTsFswEntry::SetAppNameL( const TDesC& aAppName )
-    {
-    delete iAppName; iAppName = 0;
-    iAppName = aAppName.AllocL();
-    }
+void CTsFswEntry::SetAppNameL(const TDesC& appName)
+{
+    delete mAppName;
+    mAppName = 0;
+    mAppName = appName.AllocL();
+}
 
 // --------------------------------------------------------------------------
 // CTsFswEntry::SetSystemApp
 // --------------------------------------------------------------------------
 //
-void CTsFswEntry::SetCloseableApp( TBool aValue )
-    {
-    iCloseableApp = aValue;
-    }
+void CTsFswEntry::SetCloseableApp(TBool value)
+{
+    mCloseableApp = value;
+}
 
 // --------------------------------------------------------------------------
 // CTsFswEntry::SetAppIconHandles
 // --------------------------------------------------------------------------
 //
-void CTsFswEntry::SetAppIcon( CFbsBitmap* aBitmap, CFbsBitmap* aMask )
-    {
-    iAppIconBitmap = aBitmap;
-    iAppIconMask = aMask;
-    }
+void CTsFswEntry::SetAppIcon(CFbsBitmap* bitmap, CFbsBitmap* mask)
+{
+    mAppIconBitmap = bitmap;
+    mAppIconMask = mask;
+}
 
 // --------------------------------------------------------------------------
 // CTsFswEntry::WgId
 // --------------------------------------------------------------------------
 //
 TInt CTsFswEntry::WgId() const
-    {
-    return iWgId;
-    }
+{
+    return mWgId;
+}
 
 // --------------------------------------------------------------------------
 // CTsFswEntry::AppUid
 // --------------------------------------------------------------------------
 //
 TUid CTsFswEntry::AppUid() const
-    {
-    return iAppUid;
-    }
+{
+    return mAppUid;
+}
 
 // --------------------------------------------------------------------------
 // CTsFswEntry::AppName
 // --------------------------------------------------------------------------
 //
 const TDesC& CTsFswEntry::AppName() const
-    {
-    return iAppName ? *iAppName : KNullDesC();
-    }
+{
+    return mAppName ? *mAppName : KNullDesC();
+}
 
 // --------------------------------------------------------------------------
 // CTsFswEntry::SystemApp
 // --------------------------------------------------------------------------
 //
 TBool CTsFswEntry::CloseableApp() const
-    {
-    return iCloseableApp;
-    }
+{
+    return mCloseableApp;
+}
 
 // --------------------------------------------------------------------------
 // CTsFswEntry::AppIconBitmapHandle
 // --------------------------------------------------------------------------
 //
 CFbsBitmap* CTsFswEntry::AppIconBitmap() const
-    {
-    return iAppIconBitmap;
-    }
+{
+    return mAppIconBitmap;
+}
 
 // --------------------------------------------------------------------------
 // CTsFswEntry::AppIconMaskHandle
 // --------------------------------------------------------------------------
 //
 CFbsBitmap* CTsFswEntry::AppIconMask() const
-    {
-    return iAppIconMask;
-    }
+{
+    return mAppIconMask;
+}
 
 // --------------------------------------------------------------------------
+// CTsFswEntry::Key
+// --------------------------------------------------------------------------
+//
+const TTsEntryKey& CTsFswEntry::Key() const
+{
+    return mKey;
+}
+// --------------------------------------------------------------------------
 // CTsFswEntry::ExternalizeL
 // --------------------------------------------------------------------------
 //
-void CTsFswEntry::ExternalizeL( RWriteStream& aStream )
-    {
-    aStream.WriteInt32L( iWgId );
-    aStream.WriteInt32L( iAppUid.iUid );
-    aStream << AppName();
-    aStream.WriteInt32L( iCloseableApp );
-    if ( iAppIconBitmap )
-        {
-        aStream.WriteInt32L( iAppIconBitmap->Handle() );
-        }
-    else
-        {
-        aStream.WriteInt32L( KErrNotFound );
-        }
-    
-   if ( iAppIconMask )
-        {
-        aStream.WriteInt32L( iAppIconMask->Handle() );
-        }
-    else
-        {
-        aStream.WriteInt32L( KErrNotFound );
-        }
+void CTsFswEntry::ExternalizeL(RWriteStream& stream)
+{
+    stream.WriteInt32L(mWgId);
+    stream.WriteInt32L(mAppUid.iUid);
+    stream << AppName();
+    stream.WriteInt32L(mCloseableApp);
+    if (mAppIconBitmap) {
+        stream.WriteInt32L(mAppIconBitmap->Handle());
+    }
+    else {
+        stream.WriteInt32L(KErrNotFound);
+    }
+
+    if (mAppIconMask) {
+        stream.WriteInt32L(mAppIconMask->Handle());
     }
+    else {
+        stream.WriteInt32L(KErrNotFound);
+    }
+
+    if (mScreenshot) {
+        stream.WriteInt32L(mScreenshot->Handle());
+    }
+    else {
+        stream.WriteInt32L(KErrNotFound);
+    }
+
+    mKey.ExternalizeL(stream);
+    TInt currentPriority = static_cast<TInt> (mPriority);
+    stream.WriteInt32L(currentPriority);
+}
 
 // --------------------------------------------------------------------------
 // CTsFswEntry::InternalizeL
 // --------------------------------------------------------------------------
 //
-void CTsFswEntry::InternalizeL( RReadStream& aStream )
-    {
-    iWgId = aStream.ReadInt32L();
-    iAppUid = TUid::Uid( aStream.ReadInt32L() );
-    delete iAppName; iAppName = NULL;
-    iAppName = HBufC::NewL( aStream, KMaxTInt );
-    iCloseableApp = aStream.ReadInt32L();
-    TInt appIconBitmapHandle = aStream.ReadInt32L();
-    TInt appIconMaskHandle = aStream.ReadInt32L();
-    if ( appIconBitmapHandle != KErrNotFound )
-        {
-        iAppIconBitmap = new (ELeave) CFbsBitmap;
-        iAppIconBitmap->Duplicate( appIconBitmapHandle );  
-        }
-    if ( appIconMaskHandle != KErrNotFound )    
-        {
-        iAppIconMask = new (ELeave) CFbsBitmap;
-        iAppIconMask->Duplicate( appIconMaskHandle );  
-        }
+void CTsFswEntry::InternalizeL(RReadStream& stream)
+{
+    mWgId = stream.ReadInt32L();
+    mAppUid = TUid::Uid(stream.ReadInt32L());
+    delete mAppName;
+    mAppName = NULL;
+    mAppName = HBufC::NewL(stream, KMaxTInt);
+    mCloseableApp = stream.ReadInt32L();
+    TInt appIconBitmapHandle = stream.ReadInt32L();
+    TInt appIconMaskHandle = stream.ReadInt32L();
+    TInt screenshotHandle = stream.ReadInt32L();
+    if (appIconBitmapHandle != KErrNotFound) {
+        mAppIconBitmap = new (ELeave) CFbsBitmap;
+        mAppIconBitmap->Duplicate(appIconBitmapHandle);
     }
+    if (appIconMaskHandle != KErrNotFound) {
+        mAppIconMask = new (ELeave) CFbsBitmap;
+        mAppIconMask->Duplicate(appIconMaskHandle);
+    }
+    if (screenshotHandle != KErrNotFound) {
+        mScreenshot = new (ELeave) CFbsBitmap;
+        mScreenshot->Duplicate(screenshotHandle);
+    }
+    mKey.InternalizeL(stream);
+    TInt currentPriority = stream.ReadInt32L();
+    mPriority = static_cast<UpdatePriority> (currentPriority);
+}
 
 // --------------------------------------------------------------------------
 // CTsFswEntry::ExternalizeArrayL
 // --------------------------------------------------------------------------
 //
-void CTsFswEntry::ExternalizeArrayL( RWriteStream& aStream,
-        const RTsFswArray& aArray )
-    {
+void CTsFswEntry::ExternalizeArrayL(RWriteStream& stream, const RTsFswArray& aArray)
+{
     TInt count = aArray.Count();
-    aStream.WriteInt32L( count );
-    for ( TInt i = 0; i < count; ++i )
-        {
-        aArray[i]->ExternalizeL( aStream );
-        }
+    stream.WriteInt32L(count);
+    for (TInt i = 0; i < count; ++i) {
+        aArray[i]->ExternalizeL(stream);
     }
+}
 
 // --------------------------------------------------------------------------
 // CTsFswEntry::InternalizeArrayL
 // --------------------------------------------------------------------------
 //
-void CTsFswEntry::InternalizeArrayL( RReadStream& aStream,
-        RTsFswArray& aArray )
-    {
+void CTsFswEntry::InternalizeArrayL(RReadStream& stream, RTsFswArray& aArray)
+{
     aArray.ResetAndDestroy();
-    TInt count = aStream.ReadInt32L();    for ( TInt i = 0; i < count; ++i )
-        {
+    TInt count = stream.ReadInt32L();
+    for (TInt i = 0; i < count; ++i) {
         CTsFswEntry* entry = CTsFswEntry::NewLC();
-        entry->InternalizeL( aStream );
-        aArray.AppendL( entry );
-        CleanupStack::Pop( entry );
-        }
+        entry->InternalizeL(stream);
+        aArray.AppendL(entry);
+        CleanupStack::Pop(entry);
     }
+}
 
 // --------------------------------------------------------------------------
 // CTsFswEntry::Type
 // --------------------------------------------------------------------------
 //
 TAppType CTsFswEntry::Type() const
-    {
+{
     return EApp;
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::SetScreenshot
+// --------------------------------------------------------------------------
+//
+TBool CTsFswEntry::SetScreenshotL(const CFbsBitmap* bitmapArg, UpdatePriority priority)
+{
+    TInt currentPriority = static_cast<TInt> (mPriority);
+    TInt newPriority = static_cast<TInt> (priority);
+    if (newPriority >= currentPriority) {
+        CFbsBitmap* bitmap = new (ELeave) CFbsBitmap;
+        CleanupStack::PushL(bitmap);
+        User::LeaveIfError(bitmap->Duplicate(bitmapArg->Handle()));
+        CleanupStack::Pop(bitmap);
+
+        mPriority = priority;
+        delete mScreenshot;
+        mScreenshot = bitmap;
+
+        delete mImgTool;
+        mImgTool = 0;
+
+        mImgTool = CTsGraphicFileScalingHandler::NewL(*this, *mScreenshot, TSize(128, 128),
+            CTsGraphicFileScalingHandler::EKeepAspectRatioByExpanding);
+        return ETrue;
     }
+    return EFalse;
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::RemoveScreenshot
+// --------------------------------------------------------------------------
+//
+TBool CTsFswEntry::RemoveScreenshot()
+{
+    if (mScreenshot) {
+        delete mScreenshot;
+        mScreenshot = NULL;
+        mPriority = Low;
+        return ETrue;
+    }
+    return EFalse;
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::Screenshot
+// --------------------------------------------------------------------------
+//
+CFbsBitmap* CTsFswEntry::Screenshot() const
+{
+    return mScreenshot;
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::Priority
+// --------------------------------------------------------------------------
+//
+UpdatePriority CTsFswEntry::Priority() const
+{
+    return mPriority;
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::Priority
+// --------------------------------------------------------------------------
+//
+void CTsFswEntry::ImageReadyCallBack(TInt error, const CFbsBitmap *bitmap)
+{
+    if (KErrNone == error && 0 != bitmap) {
+        mScreenshot->Reset();
+        mScreenshot->Duplicate(bitmap->Handle());
+
+        if (mObserver) {
+            mObserver->DataChanged();
+        }
+    }
+}
+
 // end of file