201036
authorhgs
Mon, 13 Sep 2010 13:26:33 +0300
changeset 116 305818acdca4
parent 112 dbfb5e38438b
child 119 50e220be30d1
201036
activityfw/activityfw.pro
activityfw/activityserviceplugin/inc/afmanager.h
activityfw/activityserviceplugin/inc/afstorageproxy.h
activityfw/activityserviceplugin/s60/inc/afstorageproxy_p.h
activityfw/activityserviceplugin/s60/src/afstorageproxy_p.cpp
activityfw/activityserviceplugin/src/afactivitystorage_p.cpp
activityfw/activityserviceplugin/src/afmanager.cpp
activityfw/activityserviceplugin/src/afstorageproxy.cpp
activityfw/rom/activitymanager_core.iby
activityfw/sis/activitymanager.pkg
activityfw/sis/stubs/activitymanager_stub.pkg
activityfw/sis/stubs/activitymanager_stub.sis
activityfw/storage/client/bwins/afstorageclientu.def
activityfw/storage/client/eabi/afstorageclientu.def
activityfw/storage/client/inc/afstorageclient.h
activityfw/storage/client/inc/afstorageclient_p.h
activityfw/storage/client/inc/afstorageclientimp.h
activityfw/storage/client/src/afstorageclient.cpp
activityfw/storage/client/src/afstorageclient_p.cpp
activityfw/storage/client/src/afstorageclientimp.cpp
activityfw/storage/common/inc/afentry.h
activityfw/storage/common/src/afentry.cpp
activityfw/storage/server/group/server.mmp
activityfw/storage/server/inc/afqueries.h
activityfw/storage/server/inc/afstorage.h
activityfw/storage/server/src/afapplicationsstorage.cpp
activityfw/storage/server/src/afstorage.cpp
activityfw/storage/server/src/afstorageasynctask.cpp
activityfw/tsutils/bwins/tsutilsu.def
activityfw/tsutils/eabi/tsutilsu.def
activityfw/tsutils/group/bld.inf
activityfw/tsutils/group/tsutils.mmp
activityfw/tsutils/inc/tsgraphicfilescalinghandler.h
activityfw/tsutils/inc/tsresourcemanager.h
activityfw/tsutils/inc/tswindowgroupsobserver.h
activityfw/tsutils/src/tsgraphicfilescalinghandler.cpp
activityfw/tsutils/src/tsresourcemanager.cpp
activityfw/tsutils/src/tswindowgroupsmonitor.cpp
activityfw/tsutils/src/tswindowgroupsobserver.cpp
activityfw/tsutils/tsutils.pro
contentstorage/caclient/bwins/caclientu.def
contentstorage/caclient/eabi/caclientu.def
contentstorage/caclient/inc/cahandler.h
contentstorage/caclient/inc/cahandlerproxy.h
contentstorage/caclient/inc/caservice_p.h
contentstorage/caclient/s60/src/camenuiconutility.cpp
contentstorage/caclient/src/cahandlerproxy.cpp
contentstorage/caclient/src/caquery.cpp
contentstorage/caclient/src/caservice.cpp
contentstorage/caclient/stub/src/caclientproxy.cpp
contentstorage/cahandler/app/inc/caapphandler.h
contentstorage/cahandler/app/inc/cauninstallerobserver.h
contentstorage/cahandler/app/inc/causifuninstalloperation.h
contentstorage/cahandler/app/src/caapphandler.cpp
contentstorage/cahandler/app/src/causifuninstalloperation.cpp
contentstorage/cahandler/tapp/inc/catapphandler.h
contentstorage/cahandler/tapp/src/catapphandler.cpp
contentstorage/cahandler/url/inc/caurlhandler.h
contentstorage/cahandler/url/src/caurlhandler.cpp
contentstorage/casoftwareregistry/s60/inc/caprogresscanner.h
contentstorage/casoftwareregistry/s60/src/caprogresscanner.cpp
contentstorage/casoftwareregistry/s60/src/casoftwareregistry_p.cpp
contentstorage/casoftwareregistry/stub/src/cauninstallnotifier_p.cpp
contentstorage/casrv/carunningappmonitor/bwins/carunningappmonitoru.def
contentstorage/casrv/carunningappmonitor/data/carunningappmonitor.rss
contentstorage/casrv/carunningappmonitor/eabi/carunningappmonitoru.def
contentstorage/casrv/carunningappmonitor/group/bld.inf
contentstorage/casrv/carunningappmonitor/group/carunningappmonitor.mmp
contentstorage/casrv/carunningappmonitor/inc/carunningapphandler.h
contentstorage/casrv/carunningappmonitor/inc/carunningappmonitor.h
contentstorage/casrv/carunningappmonitor/inc/carunningtaskhandler.h
contentstorage/casrv/carunningappmonitor/inc/castoragetask.h
contentstorage/casrv/carunningappmonitor/src/carunningapphandler.cpp
contentstorage/casrv/carunningappmonitor/src/carunningappmonitor.cpp
contentstorage/casrv/carunningappmonitor/src/castoragetask.cpp
contentstorage/casrv/carunningappmonitor/src/proxy.cpp
contentstorage/casrv/causifscanner/src/causifscanner.cpp
contentstorage/castorage/conf/CI_castoragedb.confml
contentstorage/castorage/conf/castoragedb.confml
contentstorage/castorage/conf/castoragedb.implml
contentstorage/castorage/conf/castoragedb_templates/castoragedb_variant.sql
contentstorage/castorage/data/castorage.db
contentstorage/group/group.pro
contentstorage/inc/cadef.h
homescreensrv.pro
homescreensrv_plat/contentstorage_api/cadefs.h
homescreensrv_plat/contentstorage_api/caservice.h
homescreensrv_plat/homescreen_information_api/inc/homescreendomainpskeys.h
hsappkeyhandler/inc/hsappkeyplugin.h
hsappkeyhandler/src/hsappkeyplugin.cpp
hsappkeyhandler/src/hsappkeypluginproxy.cpp
rom/homescreensrv_core.iby
sis/homescreensrv.pkg
taskswitcher/backstepping/backstepping.pro
taskswitcher/backstepping/bwins/tsbacksteppingu.def
taskswitcher/backstepping/eabi/tsbacksteppingu.def
taskswitcher/backstepping/group/bld.inf
taskswitcher/backstepping/group/tsbackstepping.mmp
taskswitcher/backstepping/inc/tsbackstepping.h
taskswitcher/backstepping/inc/tsbacksteppingactivation.h
taskswitcher/backstepping/inc/tsbacksteppingfilter.h
taskswitcher/backstepping/src/tsbackstepping.cpp
taskswitcher/backstepping/src/tsbacksteppingactivation.cpp
taskswitcher/backstepping/src/tsbacksteppingfilter.cpp
taskswitcher/client/bwins/tstaskmonitorclientu.def
taskswitcher/client/client.pri
taskswitcher/client/client.pro
taskswitcher/client/eabi/tstaskmonitorclientu.def
taskswitcher/client/inc/tstask.h
taskswitcher/client/inc/tstaskchangeinfo.h
taskswitcher/client/inc/tstaskcontent.h
taskswitcher/client/inc/tstasklauncher.h
taskswitcher/client/inc/tstaskmonitor.h
taskswitcher/client/s60/inc/tsscreenshotclient.h
taskswitcher/client/s60/inc/tsscreenshotclientimpl.h
taskswitcher/client/s60/inc/tssession.h
taskswitcher/client/s60/inc/tstaskmonitor_p.h
taskswitcher/client/s60/inc/tstaskmonitorclient.h
taskswitcher/client/s60/inc/tstaskmonitorclientimpl.h
taskswitcher/client/s60/inc/tstaskmonitorhistory.h
taskswitcher/client/s60/inc/tstaskmonitorobserver.h
taskswitcher/client/s60/inc/tstasksettings_p.h
taskswitcher/client/s60/src/tsscreenshotclient.cpp
taskswitcher/client/s60/src/tsscreenshotclientimpl.cpp
taskswitcher/client/s60/src/tssession.cpp
taskswitcher/client/s60/src/tstaskmonitor_p.cpp
taskswitcher/client/s60/src/tstaskmonitorclient.cpp
taskswitcher/client/s60/src/tstaskmonitorclientimpl.cpp
taskswitcher/client/s60/src/tstaskmonitorhistory.cpp
taskswitcher/client/s60/src/tstasksettings_p.cpp
taskswitcher/client/src/tstask.cpp
taskswitcher/client/src/tstaskchangeinfo.cpp
taskswitcher/client/src/tstaskmonitor.cpp
taskswitcher/client/src/tstasksettings.cpp
taskswitcher/client/stub/inc/tstaskmonitor_p.h
taskswitcher/client/stub/inc/tstasksettings_p.h
taskswitcher/client/stub/src/tstaskmonitor_p.cpp
taskswitcher/client/stub/src/tstasksettings_p.cpp
taskswitcher/inc/tstaskmonitorglobals.h
taskswitcher/rom.pri
taskswitcher/rom/tstaskmonitor_core.iby
taskswitcher/screenshotplugin/group/bld.inf
taskswitcher/screenshotplugin/group/tsscreenshotplugin.mmp
taskswitcher/screenshotplugin/inc/tsorientationmonitor.h
taskswitcher/screenshotplugin/inc/tsorientationobserver.h
taskswitcher/screenshotplugin/inc/tsscreenshotplugin.h
taskswitcher/screenshotplugin/screenshotplugin.pro
taskswitcher/screenshotplugin/src/tsorientationmonitor.cpp
taskswitcher/screenshotplugin/src/tsscreenshotmain.cpp
taskswitcher/screenshotplugin/src/tsscreenshotplugin.cpp
taskswitcher/screenshotplugin/src/tsscreenshotplugin.rss
taskswitcher/server/inc/tsdatalist.h
taskswitcher/server/inc/tsdataobservertask.h
taskswitcher/server/inc/tsdataprovider.h
taskswitcher/server/inc/tsdataprovidertask.h
taskswitcher/server/inc/tsdatastorage.h
taskswitcher/server/inc/tsdatatask.h
taskswitcher/server/inc/tsmodel.h
taskswitcher/server/inc/tsmodelitem.h
taskswitcher/server/inc/tsmodelitemkey.h
taskswitcher/server/inc/tsmodelitemkeymsg.h
taskswitcher/server/inc/tsmodelobserver.h
taskswitcher/server/inc/tsrunningappmodel.h
taskswitcher/server/inc/tsrunningappserver.h
taskswitcher/server/inc/tsrunningappsession.h
taskswitcher/server/inc/tsscreenshotprovider.h
taskswitcher/server/inc/tsserializeddataprovider.h
taskswitcher/server/inc/tsservice.h
taskswitcher/server/inc/tsserviceobserver.h
taskswitcher/server/inc/tsservicesprovider.h
taskswitcher/server/inc/tsservicesproviderconfig.h
taskswitcher/server/inc/tsstorage.h
taskswitcher/server/server.pro
taskswitcher/server/src/main.cpp
taskswitcher/server/src/tsdatalist.cpp
taskswitcher/server/src/tsdataobservertask.cpp
taskswitcher/server/src/tsdataprovidertask.cpp
taskswitcher/server/src/tsdatatask.cpp
taskswitcher/server/src/tsmodel.cpp
taskswitcher/server/src/tsmodelitem.cpp
taskswitcher/server/src/tsmodelitemkey.cpp
taskswitcher/server/src/tsmodelitemkeymsg.cpp
taskswitcher/server/src/tsrunningappmodel.cpp
taskswitcher/server/src/tsrunningappserver.cpp
taskswitcher/server/src/tsrunningappsession.cpp
taskswitcher/server/src/tsscreenshotprovider.cpp
taskswitcher/server/src/tsserializeddataprovider.cpp
taskswitcher/server/src/tsservice.cpp
taskswitcher/server/src/tsserviceobserver.cpp
taskswitcher/server/src/tsservicesprovider.cpp
taskswitcher/server/src/tsservicesproviderconfig.cpp
taskswitcher/server/src/tsstorage.cpp
taskswitcher/sis/stubs/createstubs.bat
taskswitcher/sis/stubs/taskmonitor_stub.pkg
taskswitcher/sis/stubs/taskmonitor_stub.sis
taskswitcher/sis/taskmonitor.pkg
taskswitcher/taskswitcher.pro
taskswitcher/testapplications/tstestpluginmanager/tspluginmanager/resource/tspluginmanager.qcrml
taskswitcher/utils/inc/tsdataobserver.h
taskswitcher/utils/inc/tsentry.h
taskswitcher/utils/inc/tsentrykey.h
taskswitcher/utils/inc/tsentrykeygenerator.h
taskswitcher/utils/inc/tsresourcemanager.h
taskswitcher/utils/inc/tsscreenshotmsg.h
taskswitcher/utils/inc/tsunregscreenshotmsg.h
taskswitcher/utils/inc/tsutils.h
taskswitcher/utils/inc/tsvisibilitymsg.h
taskswitcher/utils/inc/tswindowgroupsobserver.h
taskswitcher/utils/src/tsentry.cpp
taskswitcher/utils/src/tsentrykey.cpp
taskswitcher/utils/src/tsentrykeygenerator.cpp
taskswitcher/utils/src/tsresourcemanager.cpp
taskswitcher/utils/src/tsscreenshotmsg.cpp
taskswitcher/utils/src/tsunregscreenshotmsg.cpp
taskswitcher/utils/src/tsvisibilitymsg.cpp
taskswitcher/utils/src/tswindowgroupsmonitor.cpp
taskswitcher/utils/src/tswindowgroupsobserver.cpp
tsdevicedialog/tsdevicedialog.pro
tsdevicedialog/tsdevicedialogplugin/inc/tsactivitymodelitem.h
tsdevicedialog/tsdevicedialogplugin/inc/tsdataroles.h
tsdevicedialog/tsdevicedialogplugin/inc/tsdevicedialogcontainer.h
tsdevicedialog/tsdevicedialogplugin/inc/tsdevicedialogplugin.h
tsdevicedialog/tsdevicedialogplugin/inc/tsdocumentloader.h
tsdevicedialog/tsdevicedialogplugin/inc/tsmodel.h
tsdevicedialog/tsdevicedialogplugin/inc/tsnoitemslabel.h
tsdevicedialog/tsdevicedialogplugin/resource/hbdialog.css
tsdevicedialog/tsdevicedialogplugin/resource/layout.docml
tsdevicedialog/tsdevicedialogplugin/resource/tstasksgriditem.css
tsdevicedialog/tsdevicedialogplugin/resource/tstasksgriditem.widgetml
tsdevicedialog/tsdevicedialogplugin/src/tsactivitymodelitem.cpp
tsdevicedialog/tsdevicedialogplugin/src/tsdevicedialogcontainer.cpp
tsdevicedialog/tsdevicedialogplugin/src/tsdevicedialogplugin.cpp
tsdevicedialog/tsdevicedialogplugin/src/tsdocumentloader.cpp
tsdevicedialog/tsdevicedialogplugin/src/tsmodel.cpp
tsdevicedialog/tsdevicedialogplugin/src/tstasksgrid.cpp
tsdevicedialog/tsdevicedialogplugin/src/tstasksgriditem.cpp
tsdevicedialog/tsdevicedialogplugin/tsdevicedialogplugin.pro
tsdevicedialog/tsdevicedialogplugin/tsdevicedialogplugin.qrc
utils/tsimageutils/group/bld.inf
utils/tsimageutils/group/tsimageutils.mmp
utils/tsimageutils/inc/tsgraphicfilescalinghandler.h
utils/tsimageutils/src/tsgraphicfilescalinghandler.cpp
utils/tsimageutils/tsimageutils.pro
utils/utils.pro
--- a/activityfw/activityfw.pro	Wed Aug 18 10:39:24 2010 +0300
+++ b/activityfw/activityfw.pro	Mon Sep 13 13:26:33 2010 +0300
@@ -18,8 +18,6 @@
 
 CONFIG += ordered
 
-SUBDIRS += tsutils
-
 symbian:SUBDIRS +=  storage \
                     afactivitylauncher \
 
@@ -28,7 +26,6 @@
             
 tests {
     SUBDIRS +=  activityserviceplugin/tsrc \
-                tsutils/tsrc \
 }
 
 symbian:SUBDIRS += activityserviceplugin/symbianinstaller
--- a/activityfw/activityserviceplugin/inc/afmanager.h	Wed Aug 18 10:39:24 2010 +0300
+++ b/activityfw/activityserviceplugin/inc/afmanager.h	Mon Sep 13 13:26:33 2010 +0300
@@ -35,7 +35,7 @@
     ~AfManager();
 
 public slots:
-    QList<QVariantHash> activitiesList();
+    QList<QVariantHash> activitiesList(int limit = 0);
     void launchActivity(const QString &uri);
     void launchActivity(const QUrl &uri);
     void launchActivity(int applicationId, const QString &activityId, const QVariantHash& parameters = QVariantHash());
--- a/activityfw/activityserviceplugin/inc/afstorageproxy.h	Wed Aug 18 10:39:24 2010 +0300
+++ b/activityfw/activityserviceplugin/inc/afstorageproxy.h	Mon Sep 13 13:26:33 2010 +0300
@@ -33,12 +33,12 @@
     virtual ~AfStorageProxy();
 
 public:    
-    bool addActivity(int applicationId, const QString &activityId, const QVariant &activityData, const QVariantHash &metadata, const QPixmap &screenshot);
-    bool updateActivity(int applicationId, const QString &activityId, const QVariant &activityData, const QVariantHash &metadata, const QPixmap &screenshot);
-    bool saveActivity(int applicationId, const QString &activityId, const QVariant &activityData, const QVariantHash &metadata, const QPixmap &screenshot);
+    bool addActivity(int applicationId, const QString &activityId, const QString &customActivityName, const QVariant &activityData, const QVariantHash &metadata, const QPixmap &screenshot);
+    bool updateActivity(int applicationId, const QString &activityId, const QString &customActivityName, const QVariant &activityData, const QVariantHash &metadata, const QPixmap &screenshot);
+    bool saveActivity(int applicationId, const QString &activityId, const QString &customActivityName, const QVariant &activityData, const QVariantHash &metadata, const QPixmap &screenshot);
     bool removeActivity(int applicationId, const QString &activityId);   
     bool removeApplicationActivities(int applicationId);
-    bool activities(QList<QVariantHash> &list);
+    bool activities(QList<QVariantHash> &list, int limit = 0);
     bool applicationActivities(QStringList &list, int applicationId);
     bool activityData(QVariant &data, int applicationId, const QString &activityId);
     bool activityMetaData(QVariantHash &metadata, int applicationId, const QString &activityId);
--- a/activityfw/activityserviceplugin/s60/inc/afstorageproxy_p.h	Wed Aug 18 10:39:24 2010 +0300
+++ b/activityfw/activityserviceplugin/s60/inc/afstorageproxy_p.h	Mon Sep 13 13:26:33 2010 +0300
@@ -18,11 +18,13 @@
 #ifndef AFSTORAGEPROXY_P_H
 #define AFSTORAGEPROXY_P_H
 
-#include "afasyncrequestobserver.h"
+#include <apgcli.h>
 
 #include <QVariant>
 #include <QStringList>
 
+#include "afasyncrequestobserver.h"
+
 class CAfStorageClient;
 class CAfEntry;
 class AfStorageProxy;
@@ -34,12 +36,12 @@
     ~AfStorageProxyPrivate();
 
 public:    
-    bool addActivity(int applicationId, const QString &activityId, const QVariant &activityData, const QVariantHash &metadata, const QPixmap &screenshot);
-    bool updateActivity(int applicationId, const QString &activityId, const QVariant &activityData, const QVariantHash &metadata, const QPixmap &screenshot);
-    bool saveActivity(int applicationId, const QString &activityId, const QVariant &activityData, const QVariantHash &metadata, const QPixmap &screenshot);
+    bool addActivity(int applicationId, const QString &activityId, const QString &customActivityName, const QVariant &activityData, const QVariantHash &metadata, const QPixmap &screenshot);
+    bool updateActivity(int applicationId, const QString &activityId, const QString &customActivityName, const QVariant &activityData, const QVariantHash &metadata, const QPixmap &screenshot);
+    bool saveActivity(int applicationId, const QString &activityId, const QString &customActivityName, const QVariant &activityData, const QVariantHash &metadata, const QPixmap &screenshot);
     bool removeActivity(int applicationId, const QString &activityId);   
     bool removeApplicationActivities(int applicationId);
-    bool activities(QList<QVariantHash> &list);
+    bool activities(QList<QVariantHash> &list, int limit = 0);
     bool applicationActivities(QStringList &list, int applicationId);
     bool activityData(QVariant &data, int applicationId, const QString &activityId);
     bool activityMetaData(QVariantHash &metadata, int applicationId, const QString &activityId);
@@ -55,13 +57,16 @@
     
 private:
     CAfEntry *createFilterEntry(int applicationId = 0, const QString &activityId = QString());
-    CAfEntry *createSaveEntry(int applicationId, const QString &activityId, const QVariant &activityData, const QVariantHash &metadata);
+    CAfEntry *createSaveEntry(int applicationId, const QString &activityId, const QString &customActivityName, const QVariant &activityData, const QVariantHash &metadata);
     CAfEntry *getEntry(int applicationId, const QString &activityId);
-    QVariantHash extractMetadata(CAfEntry *entry);
+    QVariantHash extractMetadata(CAfEntry *entry, bool includePublicData);
+    QString activityDisplayText(CAfEntry *entry);
     
 private:
     CAfStorageClient *mClient;
     AfStorageProxy *q_ptr;
+    RApaLsSession mAppArcSession;
+
 };
 
 #endif //AFSTORAGEPROXY_P_H
--- a/activityfw/activityserviceplugin/s60/src/afstorageproxy_p.cpp	Wed Aug 18 10:39:24 2010 +0300
+++ b/activityfw/activityserviceplugin/s60/src/afstorageproxy_p.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -33,15 +33,19 @@
 
 AfStorageProxyPrivate::AfStorageProxyPrivate(AfStorageProxy *q) : mClient(0), q_ptr(q)
 {    
-    QT_TRAP_THROWING(mClient = CAfStorageClient::NewL(*this));
+    QT_TRAP_THROWING(
+        mClient = CAfStorageClient::NewL(*this);
+        User::LeaveIfError(mAppArcSession.Connect());
+    );
 }
 
 AfStorageProxyPrivate::~AfStorageProxyPrivate()
 {
     delete mClient;
+    mAppArcSession.Close();
 }
 
-bool AfStorageProxyPrivate::addActivity(int applicationId, const QString &activityId, const QVariant &activityData, const QVariantHash &metadata, const QPixmap &screenshot)
+bool AfStorageProxyPrivate::addActivity(int applicationId, const QString &activityId, const QString &customActivityName, const QVariant &activityData, const QVariantHash &metadata, const QPixmap &screenshot)
 {    
     int screenshotHandle(-1);
     CFbsBitmap* bitmap(screenshot.toSymbianCFbsBitmap());
@@ -49,7 +53,7 @@
         screenshotHandle = bitmap->Handle();
     }
     
-    CAfEntry *entry = createSaveEntry(applicationId, activityId, activityData, metadata);
+    CAfEntry *entry = createSaveEntry(applicationId, activityId, customActivityName, activityData, metadata);
     int result = mClient->addActivity(*entry, screenshotHandle);    
     delete entry;
     delete bitmap;
@@ -57,7 +61,7 @@
     return KErrNone == result;
 }
 
-bool AfStorageProxyPrivate::updateActivity(int applicationId, const QString &activityId, const QVariant &activityData, const QVariantHash &metadata, const QPixmap &screenshot)
+bool AfStorageProxyPrivate::updateActivity(int applicationId, const QString &activityId, const QString &customActivityName, const QVariant &activityData, const QVariantHash &metadata, const QPixmap &screenshot)
 {
     int screenshotHandle(-1);
     CFbsBitmap* bitmap(screenshot.toSymbianCFbsBitmap());
@@ -65,7 +69,7 @@
         screenshotHandle = bitmap->Handle();
     }
     
-    CAfEntry *entry = createSaveEntry(applicationId, activityId, activityData, metadata);
+    CAfEntry *entry = createSaveEntry(applicationId, activityId, customActivityName, activityData, metadata);
     int result = mClient->updateActivity(*entry, screenshotHandle);    
     delete entry;
     delete bitmap;
@@ -73,7 +77,7 @@
     return KErrNone == result;
 }
 
-bool AfStorageProxyPrivate::saveActivity(int applicationId, const QString &activityId, const QVariant &activityData, const QVariantHash &metadata, const QPixmap &screenshot)
+bool AfStorageProxyPrivate::saveActivity(int applicationId, const QString &activityId, const QString &customActivityName, const QVariant &activityData, const QVariantHash &metadata, const QPixmap &screenshot)
 {
     int screenshotHandle(-1);
     CFbsBitmap* bitmap(screenshot.toSymbianCFbsBitmap());
@@ -81,7 +85,7 @@
         screenshotHandle = bitmap->Handle();
     }
     
-    CAfEntry *entry = createSaveEntry(applicationId, activityId, activityData, metadata);
+    CAfEntry *entry = createSaveEntry(applicationId, activityId, customActivityName, activityData, metadata);
     int result = mClient->saveActivity(*entry, screenshotHandle);    
     delete entry;
     delete bitmap;
@@ -105,14 +109,14 @@
     return KErrNone == result;
 }
 
-bool AfStorageProxyPrivate::activities(QList<QVariantHash> &list)
+bool AfStorageProxyPrivate::activities(QList<QVariantHash> &list, int limit)
 {
     RPointerArray<CAfEntry> results;
     
-    int result = mClient->activities(results);
+    int result = mClient->activities(results, limit);
     list.clear();
     for (int i=0; i < results.Count(); ++i) {
-        list.append(extractMetadata(results[i]));
+        list.append(extractMetadata(results[i], false));
     }
    
     results.ResetAndDestroy();
@@ -156,7 +160,7 @@
     CAfEntry *entry = getEntry(applicationId, activityId);
     
     if (entry) {
-        metadata = extractMetadata(entry);
+        metadata = extractMetadata(entry, true);
         delete entry;
         return true;
     }    
@@ -225,11 +229,11 @@
 CAfEntry *AfStorageProxyPrivate::createFilterEntry(int applicationId, const QString &activityId)
 {   
     CAfEntry *entry(0); 
-    QT_TRAP_THROWING(entry = CAfEntry::NewL(0, applicationId, TPtrC(static_cast<const TUint16*>(activityId.utf16())), KNullDesC(), KNullDesC8(), KNullDesC8()));
+    QT_TRAP_THROWING(entry = CAfEntry::NewL(0, applicationId, TPtrC(static_cast<const TUint16*>(activityId.utf16())), KNullDesC(), KNullDesC(), KNullDesC8(), KNullDesC8()));
     return entry;
 }
 
-CAfEntry *AfStorageProxyPrivate::createSaveEntry(int applicationId, const QString &activityId, const QVariant &activityData, const QVariantHash &metadata)
+CAfEntry *AfStorageProxyPrivate::createSaveEntry(int applicationId, const QString &activityId, const QString &customActivityName, const QVariant &activityData, const QVariantHash &metadata)
 {   
     CAfEntry *entry(0); 
     
@@ -254,12 +258,18 @@
         
         HBufC *actBuff = XQConversions::qStringToS60Desc(activityId);
         CleanupStack::PushL(actBuff);
+        
+        HBufC *customNameBuff = XQConversions::qStringToS60Desc(customActivityName);
+        CleanupStack::PushL(customNameBuff);
+        
         entry = CAfEntry::NewL(flags, 
                                applicationId, 
                                *actBuff, 
+                               *customNameBuff,
                                KNullDesC, 
                                privateBuff, 
                                publicBuff);
+        CleanupStack::PopAndDestroy(customNameBuff);
         CleanupStack::PopAndDestroy(actBuff);
         CleanupStack::PopAndDestroy(&publicBuff);
         CleanupStack::PopAndDestroy(&privateBuff);
@@ -282,15 +292,28 @@
     return resultEntry;
 }
 
-QVariantHash AfStorageProxyPrivate::extractMetadata(CAfEntry *entry)
+QVariantHash AfStorageProxyPrivate::extractMetadata(CAfEntry *entry, bool includePublicData)
 {
     QVariantHash metadata;
-    metadata << entry->Data(CAfEntry::Public);
+    if (includePublicData) {
+        metadata << entry->Data(CAfEntry::Public);
+    }
     metadata.insert(ActivityApplicationKeyword, entry->ApplicationId());
     metadata.insert(ActivityActivityKeyword, XQConversions::s60DescToQString(entry->ActivityId()));
+    metadata.insert(ActivityApplicationName, activityDisplayText(entry));
     metadata.insert(ActivityScreenshotKeyword, XQConversions::s60DescToQString(entry->ImageSrc()));
     metadata.insert(ActivityPersistence, (entry->Flags() & CAfEntry::Persistent) ? true : false);
     metadata.insert(ActivityVisibility, (entry->Flags() & CAfEntry::Invisible) ? false : true); 
     return metadata;
 }
 
+QString AfStorageProxyPrivate::activityDisplayText(CAfEntry *entry)
+{
+    if (entry->CustomActivityName().Compare(KNullDesC()) == 0) {
+        TApaAppInfo info;
+        mAppArcSession.GetAppInfo(info, TUid::Uid(entry->ApplicationId()));
+        return QString::fromUtf16(info.iShortCaption.Ptr(), info.iShortCaption.Length());        
+    } else {
+        return XQConversions::s60DescToQString(entry->CustomActivityName());
+    }
+}
--- a/activityfw/activityserviceplugin/src/afactivitystorage_p.cpp	Wed Aug 18 10:39:24 2010 +0300
+++ b/activityfw/activityserviceplugin/src/afactivitystorage_p.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -35,7 +35,7 @@
     publicData.insert(ActivityApplicationKeyword, applicationId());
     publicData.insert(ActivityActivityKeyword, activityId);
 
-    return mConnection->saveActivity(applicationId(), activityId, activityData, publicData, screenshot);
+    return mConnection->saveActivity(applicationId(), activityId, publicData[ActivityApplicationName].toString(), activityData, publicData, screenshot);
 }
 
 bool AfActivityStoragePrivate::removeActivity(const QString &activityId)
--- a/activityfw/activityserviceplugin/src/afmanager.cpp	Wed Aug 18 10:39:24 2010 +0300
+++ b/activityfw/activityserviceplugin/src/afmanager.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -45,10 +45,10 @@
 {
 }
 
-QList<QVariantHash> AfManager::activitiesList()
+QList<QVariantHash> AfManager::activitiesList(int limit)
 {
     QList<QVariantHash> results;
-    mServiceProvider->activities(results);
+    mServiceProvider->activities(results, limit);
     return results;
 }
 
--- a/activityfw/activityserviceplugin/src/afstorageproxy.cpp	Wed Aug 18 10:39:24 2010 +0300
+++ b/activityfw/activityserviceplugin/src/afstorageproxy.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -27,19 +27,19 @@
     delete d_ptr;
 }
 
-bool AfStorageProxy::addActivity(int applicationId, const QString &activityId, const QVariant &activityData, const QVariantHash &metadata, const QPixmap &screenshot)
+bool AfStorageProxy::addActivity(int applicationId, const QString &activityId, const QString &customActivityName, const QVariant &activityData, const QVariantHash &metadata, const QPixmap &screenshot)
 {
-    return d_ptr->addActivity(applicationId, activityId, activityData, metadata, screenshot);
+    return d_ptr->addActivity(applicationId, activityId, customActivityName, activityData, metadata, screenshot);
 }
 
-bool AfStorageProxy::updateActivity(int applicationId, const QString &activityId, const QVariant &activityData, const QVariantHash &metadata, const QPixmap &screenshot)
+bool AfStorageProxy::updateActivity(int applicationId, const QString &activityId, const QString &customActivityName, const QVariant &activityData, const QVariantHash &metadata, const QPixmap &screenshot)
 {
-    return d_ptr->updateActivity(applicationId, activityId, activityData, metadata, screenshot);
+    return d_ptr->updateActivity(applicationId, activityId, customActivityName, activityData, metadata, screenshot);
 }
 
-bool AfStorageProxy::saveActivity(int applicationId, const QString &activityId, const QVariant &activityData, const QVariantHash &metadata, const QPixmap &screenshot)
+bool AfStorageProxy::saveActivity(int applicationId, const QString &activityId, const QString &customActivityName, const QVariant &activityData, const QVariantHash &metadata, const QPixmap &screenshot)
 {
-    return d_ptr->saveActivity(applicationId, activityId, activityData, metadata, screenshot);
+    return d_ptr->saveActivity(applicationId, activityId, customActivityName, activityData, metadata, screenshot);
 }
 
 bool AfStorageProxy::removeActivity(int applicationId, const QString &activityId)
@@ -52,9 +52,9 @@
     return d_ptr->removeApplicationActivities(applicationId);
 }
 
-bool AfStorageProxy::activities(QList<QVariantHash> &list)
+bool AfStorageProxy::activities(QList<QVariantHash> &list, int limit)
 {
-    return d_ptr->activities(list);
+    return d_ptr->activities(list, limit);
 }
 
 bool AfStorageProxy::applicationActivities(QStringList &list, int applicationId)
--- a/activityfw/rom/activitymanager_core.iby	Wed Aug 18 10:39:24 2010 +0300
+++ b/activityfw/rom/activitymanager_core.iby	Mon Sep 13 13:26:33 2010 +0300
@@ -23,7 +23,6 @@
 file=ABI_DIR\BUILD_DIR\hsactivitydbserver.exe                            PROGRAMS_DIR\hsactivitydbserver.exe
 
 file=ABI_DIR\BUILD_DIR\afstorageclient.dll					       SHARED_LIB_DIR\afstorageclient.dll
-file=ABI_DIR\BUILD_DIR\tsutils.dll			    		       SHARED_LIB_DIR\tsutils.dll
 file=ABI_DIR\BUILD_DIR\afactivitylauncher.dll			    		       SHARED_LIB_DIR\afactivitylauncher.dll
 
 file=ABI_DIR\BUILD_DIR\hbactivityplugin.dll					       SHARED_LIB_DIR\hbactivityplugin.dll
--- a/activityfw/sis/activitymanager.pkg	Wed Aug 18 10:39:24 2010 +0300
+++ b/activityfw/sis/activitymanager.pkg	Mon Sep 13 13:26:33 2010 +0300
@@ -32,7 +32,6 @@
 "/epoc32/release/armv5/urel/hsactivitydbserver.exe"    - "!:\sys\bin\hsactivitydbserver.exe"
 
 "/epoc32/release/armv5/urel/afstorageclient.dll"    - "!:\sys\bin\afstorageclient.dll"
-"/epoc32/release/armv5/urel/tsutils.dll"    - "!:\sys\bin\tsutils.dll"
 "/epoc32/release/armv5/urel/afactivitylauncher.dll"    - "!:\sys\bin\afactivitylauncher.dll"
 
 "/epoc32/release/armv5/urel/hbactivityplugin.dll"    - "!:\sys\bin\hbactivityplugin.dll"
--- a/activityfw/sis/stubs/activitymanager_stub.pkg	Wed Aug 18 10:39:24 2010 +0300
+++ b/activityfw/sis/stubs/activitymanager_stub.pkg	Mon Sep 13 13:26:33 2010 +0300
@@ -38,7 +38,6 @@
 ""    - "Z:\sys\bin\hsactivitydbserver.exe"
 
 ""    - "Z:\sys\bin\afstorageclient.dll"
-""    - "Z:\sys\bin\tsutils.dll"
 ""    - "Z:\sys\bin\afactivitylauncher.dll"
 
 ""    - "Z:\sys\bin\hbactivityplugin.dll"
Binary file activityfw/sis/stubs/activitymanager_stub.sis has changed
--- a/activityfw/storage/client/bwins/afstorageclientu.def	Wed Aug 18 10:39:24 2010 +0300
+++ b/activityfw/storage/client/bwins/afstorageclientu.def	Mon Sep 13 13:26:33 2010 +0300
@@ -12,6 +12,7 @@
 	?getThumbnail@CAfStorageClient@@QAEHABVTSize@@ABVTDesC16@@PAX@Z @ 11 NONAME ; int CAfStorageClient::getThumbnail(class TSize const &, class TDesC16 const &, void *)
 	?removeActivity@CAfStorageClient@@QAEHABVCAfEntry@@@Z @ 12 NONAME ; int CAfStorageClient::removeActivity(class CAfEntry const &)
 	?removeApplicationActivities@CAfStorageClient@@QAEHABVCAfEntry@@@Z @ 13 NONAME ; int CAfStorageClient::removeApplicationActivities(class CAfEntry const &)
-	?activities@CAfStorageClient@@QAEHAAV?$RPointerArray@VCAfEntry@@@@@Z @ 14 NONAME ; int CAfStorageClient::activities(class RPointerArray<class CAfEntry> &)
+	?activities@CAfStorageClient@@QAEHAAV?$RPointerArray@VCAfEntry@@@@@Z @ 14 NONAME ABSENT ; int CAfStorageClient::activities(class RPointerArray<class CAfEntry> &)
 	?activityData@CAfStorageClient@@QAEHAAPAVCAfEntry@@ABV2@@Z @ 15 NONAME ; int CAfStorageClient::activityData(class CAfEntry * &, class CAfEntry const &)
+	?activities@CAfStorageClient@@QAEHAAV?$RPointerArray@VCAfEntry@@@@H@Z @ 16 NONAME ; int CAfStorageClient::activities(class RPointerArray<class CAfEntry> &, int)
 
--- a/activityfw/storage/client/eabi/afstorageclientu.def	Wed Aug 18 10:39:24 2010 +0300
+++ b/activityfw/storage/client/eabi/afstorageclientu.def	Mon Sep 13 13:26:33 2010 +0300
@@ -1,5 +1,5 @@
 EXPORTS
-	_ZN16CAfStorageClient10activitiesER13RPointerArrayI8CAfEntryE @ 1 NONAME
+	_ZN16CAfStorageClient10activitiesER13RPointerArrayI8CAfEntryE @ 1 NONAME ABSENT
 	_ZN16CAfStorageClient11addActivityERK8CAfEntryi @ 2 NONAME
 	_ZN16CAfStorageClient12activityDataERP8CAfEntryRKS0_ @ 3 NONAME
 	_ZN16CAfStorageClient12getThumbnailERK5TSizeRK7TDesC16Pv @ 4 NONAME
@@ -26,4 +26,5 @@
 	_ZTV26CAfThumbnailRequestPrivate @ 25 NONAME
 	_ZTV30RAfStorageClientImplementation @ 26 NONAME
 	_ZTV8CAfEntry @ 27 NONAME
+	_ZN16CAfStorageClient10activitiesER13RPointerArrayI8CAfEntryEi @ 28 NONAME
 
--- a/activityfw/storage/client/inc/afstorageclient.h	Wed Aug 18 10:39:24 2010 +0300
+++ b/activityfw/storage/client/inc/afstorageclient.h	Mon Sep 13 13:26:33 2010 +0300
@@ -40,7 +40,7 @@
     IMPORT_C int saveActivity(const CAfEntry &entry, TInt imageHandle);
     IMPORT_C int removeActivity(const CAfEntry &entry);
     IMPORT_C int removeApplicationActivities(const CAfEntry &entry);
-    IMPORT_C int activities(RPointerArray<CAfEntry> &dst);
+    IMPORT_C int activities(RPointerArray<CAfEntry> &dst, TInt limit = 0);
     IMPORT_C int applicationActivities(RPointerArray<CAfEntry> &dst, const CAfEntry &entry);
     IMPORT_C int activityData(CAfEntry *&dst, const CAfEntry &entry);
     IMPORT_C int waitActivity();
--- a/activityfw/storage/client/inc/afstorageclient_p.h	Wed Aug 18 10:39:24 2010 +0300
+++ b/activityfw/storage/client/inc/afstorageclient_p.h	Mon Sep 13 13:26:33 2010 +0300
@@ -41,7 +41,7 @@
     int saveActivity(const CAfEntry &entry, TInt imageHandle);
     int removeActivity(const CAfEntry &templateEntry);
     int removeApplicationActivities(const CAfEntry &templateEntry);
-    int activities(RPointerArray<CAfEntry> &dst);
+    int activities(RPointerArray<CAfEntry> &dst, TInt limit = 0);
     int applicationActivities(RPointerArray<CAfEntry> &dst, const CAfEntry &entry);
     int activityData(CAfEntry *&resultEntry, const CAfEntry &templateEntry);
     int waitActivity();
@@ -51,7 +51,7 @@
 
 private:
     int execute(int function, const CAfEntry &sourceEntry, TInt imageHandle);
-    int execute(int function, RPointerArray<CAfEntry> &resultsList,const CAfEntry &templateEntry);
+    int execute(int function, RPointerArray<CAfEntry> &resultsList,const CAfEntry &templateEntry, int limit = 0);
 
 private:
     RAfStorageClientImplementation mImplementation;
--- a/activityfw/storage/client/inc/afstorageclientimp.h	Wed Aug 18 10:39:24 2010 +0300
+++ b/activityfw/storage/client/inc/afstorageclientimp.h	Mon Sep 13 13:26:33 2010 +0300
@@ -39,7 +39,8 @@
 
     void executeL(int function, 
                   RPointerArray<CAfEntry> &resultsList, 
-                  const CAfEntry& templateEntry);
+                  const CAfEntry& templateEntry,
+                  TInt limit);
     
     void getThumbnailL(TSize size, 
                       const TDesC& source,
--- a/activityfw/storage/client/src/afstorageclient.cpp	Wed Aug 18 10:39:24 2010 +0300
+++ b/activityfw/storage/client/src/afstorageclient.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -138,9 +138,9 @@
  * @param dst - list of results
  * @return 0 on success, error code otherwise 
  */
-EXPORT_C int CAfStorageClient::activities(RPointerArray<CAfEntry> &dst)
+EXPORT_C int CAfStorageClient::activities(RPointerArray<CAfEntry> &dst, TInt limit)
 {
-    return d_ptr->activities(dst);
+    return d_ptr->activities(dst, limit);
 }
 
 // -----------------------------------------------------------------------------
--- a/activityfw/storage/client/src/afstorageclient_p.cpp	Wed Aug 18 10:39:24 2010 +0300
+++ b/activityfw/storage/client/src/afstorageclient_p.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -129,10 +129,10 @@
  * Function implementation
  * @see AfStorageClient::activities(RPointerArray<CAfEntry> &)
  */
-int CAfStorageClientPrivate::activities(RPointerArray<CAfEntry> &results)
+int CAfStorageClientPrivate::activities(RPointerArray<CAfEntry> &results, TInt limit)
 {
     CAfEntry *entry = CAfEntry::NewL();
-    TInt result = execute(Activities, results, *entry);
+    TInt result = execute(Activities, results, *entry, limit);
     delete entry;
     return result;
 }
@@ -243,8 +243,8 @@
 /**
  * Function execute activity framework functinality and return results 
  */
-int CAfStorageClientPrivate::execute(int function, RPointerArray<CAfEntry>& resultsList,const CAfEntry& templateEntry)
+int CAfStorageClientPrivate::execute(int function, RPointerArray<CAfEntry>& resultsList,const CAfEntry& templateEntry, int limit)
 {
-    TRAPD(errNo, mImplementation.executeL(function, resultsList, templateEntry);)
+    TRAPD(errNo, mImplementation.executeL(function, resultsList, templateEntry, limit);)
     return errNo;
 }
--- a/activityfw/storage/client/src/afstorageclientimp.cpp	Wed Aug 18 10:39:24 2010 +0300
+++ b/activityfw/storage/client/src/afstorageclientimp.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -133,7 +133,7 @@
 }
 
 // -----------------------------------------------------------------------------
-void RAfStorageClientImplementation::executeL(int function, RPointerArray<CAfEntry> &resultsList, const CAfEntry& templateEntry)
+void RAfStorageClientImplementation::executeL(int function, RPointerArray<CAfEntry> &resultsList, const CAfEntry& templateEntry, TInt limit)
 {
     resultsList.ResetAndDestroy();
     RBuf8 buffer;
@@ -145,7 +145,7 @@
     CleanupStack::PopAndDestroy(&writer);
     TPckgBuf<int> length(0), taskId(0);
     User::LeaveIfError(SendReceive(function,
-                                   TIpcArgs(&buffer, &length, &taskId)));
+                                   TIpcArgs(&buffer, &length, &taskId, limit)));
     CAfEntry::ReallocL(buffer, length());
     User::LeaveIfError(SendReceive(GetData, TIpcArgs(&taskId, &buffer)));
     resultsList << buffer;
--- a/activityfw/storage/common/inc/afentry.h	Wed Aug 18 10:39:24 2010 +0300
+++ b/activityfw/storage/common/inc/afentry.h	Mon Sep 13 13:26:33 2010 +0300
@@ -49,6 +49,7 @@
     static CAfEntry* NewL(TInt flags,
                           TInt applicationId,
                           const TDesC &activityId,
+                          const TDesC &customActivityName,
                           const TDesC &imgSrc,
                           const TDesC8 &privateData,
                           const TDesC8 &publicData);
@@ -56,6 +57,7 @@
     static CAfEntry* NewLC(TInt flags,
                            TInt applicationId,
                            const TDesC &activityId,
+                           const TDesC &customActivityName,
                            const TDesC &imgSrc,
                            const TDesC8 &privateData,
                            const TDesC8 &publicData);
@@ -82,6 +84,8 @@
     TInt ApplicationId() const;
 
     const TDesC& ActivityId() const;
+    
+    const TDesC& CustomActivityName() const;
 
     const TDesC& ImageSrc() const;
 
@@ -105,6 +109,7 @@
     void ConstructL(TInt flags,
                     TInt applicationId,
                     const TDesC &activityId,
+                    const TDesC &customActivityName,
                     const TDesC &imgSrc,
                     const TDesC8 &privateData,
                     const TDesC8 &publicData);
@@ -120,6 +125,7 @@
     TInt mFlags;
     TInt mAppId;
     RBuf mActivityId;
+    RBuf mCustomActivityName;
     RBuf mImgSrc;
     RBuf8 mPrivateData;
     RBuf8 mPublicData;
--- a/activityfw/storage/common/src/afentry.cpp	Wed Aug 18 10:39:24 2010 +0300
+++ b/activityfw/storage/common/src/afentry.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -55,6 +55,7 @@
 CAfEntry* CAfEntry::NewL(TInt flags,
                          TInt applicationId,
                          const TDesC &activityId,
+                         const TDesC &customActivityName,
                          const TDesC &imgSrc,
                          const TDesC8 &privateData,
                          const TDesC8 &publicData)
@@ -62,6 +63,7 @@
     CAfEntry* self = CAfEntry::NewLC(flags, 
                                      applicationId, 
                                      activityId, 
+                                     customActivityName,
                                      imgSrc, 
                                      privateData, 
                                      publicData);
@@ -83,6 +85,7 @@
 CAfEntry* CAfEntry::NewLC(TInt flags,
                           TInt applicationId,
                           const TDesC &activityId,
+                          const TDesC &customActivityName,
                           const TDesC &imgSrc,
                           const TDesC8 &privateData,
                           const TDesC8 &publicData)
@@ -91,6 +94,7 @@
     self->ConstructL(flags, 
                      applicationId, 
                      activityId, 
+                     customActivityName,
                      imgSrc, 
                      privateData, 
                      publicData);
@@ -133,6 +137,7 @@
 void CAfEntry::ConstructL(TInt flags,
                           TInt applicationId,
                           const TDesC &activityId,
+                          const TDesC &customActivityName,
                           const TDesC &imgSrc,
                           const TDesC8 &privateData,
                           const TDesC8 &publicData)
@@ -140,6 +145,7 @@
     mFlags = flags;
     mAppId = applicationId;
     CopyL(mActivityId, activityId);
+    CopyL(mCustomActivityName, customActivityName);
     CopyL(mImgSrc, imgSrc);
     CopyL(mPrivateData, privateData);
     CopyL(mPublicData, publicData);
@@ -152,6 +158,7 @@
 CAfEntry::~CAfEntry()
 {
     mActivityId.Close();
+    mCustomActivityName.Close();
     mPrivateData.Close();
     mPublicData.Close();
     mImgSrc.Close();
@@ -164,8 +171,9 @@
  */
 TInt CAfEntry::Size() const
 {
-    return (sizeof(TInt) * 3) + //flags + appId + actId size info 
+    return (sizeof(TInt) * 4) + //flags + appId + actId size info + customActivityName size info
            mActivityId.Size() + //actId content size
+           mCustomActivityName.Size() + // customActivityName content size
            DataSize(); //data size
            
 }
@@ -192,6 +200,7 @@
     stream.WriteInt32L(mFlags);
     stream.WriteInt32L(mAppId);
     ExternalizeL(stream, mActivityId);
+    ExternalizeL(stream, mCustomActivityName);
     ExternalizeDataOnlyL(stream);
 }
 
@@ -205,6 +214,7 @@
     mFlags = stream.ReadInt32L();
     mAppId = stream.ReadInt32L();
     InternalizeL(mActivityId, stream);
+    InternalizeL(mCustomActivityName, stream);
     InternalizeDataOnlyL(stream);
 }
 
@@ -266,6 +276,16 @@
 
 // -----------------------------------------------------------------------------
 /**
+ * Provide access to activity custom name.
+ * @return activity custom name
+ */
+const TDesC& CAfEntry::CustomActivityName() const
+{
+    return mCustomActivityName;
+}
+
+// -----------------------------------------------------------------------------
+/**
  * Provide access to activity data.
  * @param rights - type of requested data
  * @return activity data
--- a/activityfw/storage/server/group/server.mmp	Wed Aug 18 10:39:24 2010 +0300
+++ b/activityfw/storage/server/group/server.mmp	Mon Sep 13 13:26:33 2010 +0300
@@ -51,7 +51,7 @@
 LIBRARY        hash.lib 
 LIBRARY        bitmaptransforms.lib
 LIBRARY        imageconversion.lib
-LIBRARY        tsutils.lib
+STATICLIBRARY        tsimageutils.lib
 STATICLIBRARY        afstoragecommon.lib
 
 CAPABILITY     ALL -TCB
--- a/activityfw/storage/server/inc/afqueries.h	Wed Aug 18 10:39:24 2010 +0300
+++ b/activityfw/storage/server/inc/afqueries.h	Mon Sep 13 13:26:33 2010 +0300
@@ -21,7 +21,7 @@
 #include <e32base.h>
 
 _LIT( KSelectRow, "SELECT * FROM Activities WHERE ApplicationId=%S AND ActivityName='%S'");
-_LIT( KSelectRows, "SELECT * FROM Activities");
+_LIT( KSelectRows, "SELECT * FROM Activities ORDER BY Timestamp DESC");
 _LIT( KSelectAppRows, "SELECT * FROM Activities WHERE ApplicationId=%S");
 _LIT( KDeleteRow, "DELETE FROM Activities WHERE ApplicationId=%S AND ActivityName='%S'");
 _LIT( KDeleteRows, "DELETE FROM Activities WHERE ApplicationId=%S");
@@ -29,7 +29,9 @@
 
 _LIT(KApplicationColumnName, "ApplicationId");
 _LIT(KActivityColumnName, "ActivityName");
+_LIT(KCustomNameColumnName, "CustomName");
 _LIT(KFlagsColumnName, "Flags");
+_LIT(KTimestampColumnName, "Timestamp");
 _LIT(KDataColumnName, "Data");
 
 _LIT(KActivityTableName, "Activities");
--- a/activityfw/storage/server/inc/afstorage.h	Wed Aug 18 10:39:24 2010 +0300
+++ b/activityfw/storage/server/inc/afstorage.h	Mon Sep 13 13:26:33 2010 +0300
@@ -32,94 +32,103 @@
 public:
     ~CAfStorage();
 
-    static CAfStorage* NewL(RFs& session);
+    static CAfStorage* NewL(RFs& aSession);
+
+    void AddActivityL(CAfEntry &aEntry);
 
-    void AddActivityL(CAfEntry &entry);
-    
-    void UpdateActivityL(CAfEntry &entry);
-    
-    void SaveActivityL(CAfEntry &entry);
+    void UpdateActivityL(CAfEntry &aEntry);
+
+    void SaveActivityL(CAfEntry &aEntry);
 
-    void DeleteActivityL(CAfEntry &entry);
+    void DeleteActivityL(CAfEntry &aEntry);
 
-    void DeleteActivitiesL(CAfEntry &entry);
+    void DeleteActivitiesL(CAfEntry &aEntry);
 
-    void ActivitiesL(RPointerArray<CAfEntry> &dst);
+    void AllActivitiesL(RPointerArray<CAfEntry> &aDst, TInt aLimit);
 
-    void ActivitiesL(RPointerArray<CAfEntry> &dst, TInt appId);
+    void ActivitiesL(RPointerArray<CAfEntry> &aDst, TInt aAppId);
     
-    void ActivityL(RPointerArray<CAfEntry> &dst, CAfEntry &src);
+    void ActivityL(RPointerArray<CAfEntry> &aDst, CAfEntry &aSrc);
 
     RFs& Fs();
 
-    static void ThumbnailPathL(RBuf &dst, 
-                               RFs& fileSystem, 
-                               TInt uid, 
-                               const TDesC &activityName,
-                               TBool persistent);
+    static void ThumbnailPathL(RBuf &aDst, 
+                               RFs& aFileSystem, 
+                               TInt aUid, 
+                               const TDesC &aActivityName,
+                               TBool aPersistent);
 
-    static void StoragePathL(RBuf &dst, 
-                             RFs& fileSystem, 
-                             TBool persistent);
-    static void AppStoragePathL(RBuf &dst, 
-                                RFs& fileSystem,
-                                TInt uid,
-                                TBool persistent);
+    static void StoragePathL(RBuf &aDst, 
+                             RFs& aFileSystem, 
+                             TBool aPersistent);
+
+    static void AppStoragePathL(RBuf &aDst, 
+                                RFs& aFileSystem,
+                                TInt aUid,
+                                TBool aPersistent);
 private:
-    static HBufC8* Md5HexDigestL(const TDesC8 &string);
+    static HBufC8* Md5HexDigestL(const TDesC8 &aString);
     
 private:
-    CAfStorage(RFs& session);
+    CAfStorage(RFs& aSession);
 
     void ConstructL();
 
-    void CreateDbL(const TDesC& databaseFile);
+    void CreateDbL(const TDesC& aDatabaseFile);
+
+    void OpenDbL(const TDesC& aDatabaseFile);
 
-    void OpenDbL(const TDesC& databaseFile);
+    void VerifyDbL();
+
+    CDbColSet* ExpectedTableLC();
 
     void CreateTableL();
 
+    void VerifyTableL();
+
     void DeleteNonPersistentActivitiesL();
 
-    void GetActivitiesL(const TDesC& dst);
+    void GetActivitiesL(const TDesC& aDst);
 
-    HBufC* SelectRowLC(TInt appId, const TDesC& actId) const;
+    HBufC* SelectRowLC(TInt aAppId, const TDesC& aActId) const;
 
-    HBufC* SelectRowsLC(TInt appId) const;
+    HBufC* SelectRowsLC(TInt aAppId) const;
 
-    HBufC* DeleteRowLC(TInt appId, const TDesC& actId) const;
+    HBufC* DeleteRowLC(TInt aAppId, const TDesC& aActId) const;
     
-    HBufC* DeleteRowsLC(TInt appId) const;
+    HBufC* DeleteRowsLC(TInt aAppId) const;
 
-    HBufC* BuildQueryLC(const TDesC& format, TInt appId, const TDesC& actId) const;
+    HBufC* BuildQueryLC(const TDesC& aFormat, TInt aAppId, const TDesC& aActId) const;
     
-    void ActivitiesL(RPointerArray<CAfEntry>& dst, 
-                     const TDesC& query, 
-                     CAfEntry::AccessRights rights,
-                     TInt limit = 0);
+    void ActivitiesL(RPointerArray<CAfEntry>& aDst, 
+                     const TDesC& aQuery, 
+                     CAfEntry::AccessRights aRights,
+                     TInt aLimit = 0,
+                     TBool deserializeAllData = EFalse);
 
-    void ActivitiesL(RPointerArray<CAfEntry>& dst, 
-                     RDbView& query, 
-                     CAfEntry::AccessRights rights,
-                     TInt limit = 0);
+    void ActivitiesL(RPointerArray<CAfEntry>& aDst, 
+                     RDbView& aQuery, 
+                     CAfEntry::AccessRights aRights,
+                     TInt aLimit = 0,
+                     TBool deserializeAllData = EFalse);
 
-    void GetActivityForUpdateL(RDbView& query, TInt appId, const TDesC& actId);
+    void GetActivityForUpdateL(RDbView& aQuery, TInt aAppId, const TDesC& aActId);
 
-    void ReadDataL(RBuf& dst, RDbRowSet& src, TInt offset) const;
+    void ReadDataL(RBuf& aDst, RDbRowSet& aSrc, TInt aOffset) const;
 
-    void ExternalizeDataL(RDbRowSet &dst,const CAfEntry & src, TInt offset) const;
+    void ExternalizeDataL(RDbRowSet &aDst,const CAfEntry & aSrc, TInt aOffset) const;
 
-    void InternalizeDataL(CAfEntry &dst, RDbRowSet& src, TInt offset) const;
+    void InternalizeDataL(CAfEntry &aDst, RDbRowSet& aSrc, TInt aOffset) const;
 
 public:
     TBool InterruptCleanup();
     void RequestCleanup();
 
 private:
-    RFs& mFsSession;
-    RDbStoreDatabase mActDb;/* For database operations                 */
-    CFileStore* mFileStore;  /* For creating and opening database files */
-    CAfDatabaseCleaner *mDatabaseCleaner;
+    RFs& iFsSession;
+    RDbStoreDatabase iActDb;/** For database operations*/
+    CFileStore* iFileStore;  /** For creating and opening database files */
+    CAfDatabaseCleaner *iDatabaseCleaner;
 };
 
 #endif //AFSTORAGE_H
--- a/activityfw/storage/server/src/afapplicationsstorage.cpp	Wed Aug 18 10:39:24 2010 +0300
+++ b/activityfw/storage/server/src/afapplicationsstorage.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -53,9 +53,9 @@
                                     static_cast<TInt>(appId.iUid),
                                     KNullDesC,
                                     KNullDesC,
+                                    KNullDesC,
                                     KNullDesC8,
                                     KNullDesC8));
     mStorage.DeleteActivitiesL(*entry);
     CleanupStack::PopAndDestroy(entry);
 }
-
--- a/activityfw/storage/server/src/afstorage.cpp	Wed Aug 18 10:39:24 2010 +0300
+++ b/activityfw/storage/server/src/afstorage.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -39,21 +39,21 @@
  */
 CAfStorage::CAfStorage(RFs& session)
 :
-mFsSession(session)
-{
+iFsSession(session)
+    {
     // No implementation required
-}
+    }
 
 // -----------------------------------------------------------------------------
 /**
  * Destructor.
  */
 CAfStorage::~CAfStorage()
-{
-    delete mDatabaseCleaner;
-    mActDb.Close();
-    delete mFileStore;
-}
+    {
+    delete iDatabaseCleaner;
+    iActDb.Close();
+    delete iFileStore;
+    }
 
 // -----------------------------------------------------------------------------
 /**
@@ -61,35 +61,35 @@
  * @param session - initialized session to file system
  */
 CAfStorage* CAfStorage::NewL(RFs& session)
-{
+    {
     CAfStorage* self = new (ELeave) CAfStorage(session);
     CleanupStack::PushL(self);
     self->ConstructL();
     CleanupStack::Pop(); // self;
     return self;
-}
+    }
 
 // -----------------------------------------------------------------------------
 /**
  * EPOC default constructor for performing 2nd stage construction
  */
 void CAfStorage::ConstructL()
-{
+    {
     RBuf path;
     CleanupClosePushL( path );
     path.CreateL(KMaxPathLength);
-    User::LeaveIfError(mFsSession.PrivatePath(path ));
+    User::LeaveIfError(iFsSession.PrivatePath(path ));
     path.Append(KDbName);
     path.Insert(0, KDbDrive);
-    BaflUtils::EnsurePathExistsL(mFsSession, path);
-    BaflUtils::FileExists(mFsSession, path) ? OpenDbL(path) : CreateDbL(path);
+    BaflUtils::EnsurePathExistsL(iFsSession, path);
+    BaflUtils::FileExists(iFsSession, path) ? OpenDbL(path) : CreateDbL(path);
     CleanupStack::PopAndDestroy(&path);
-
-    mDatabaseCleaner = new (ELeave) CAfDatabaseCleaner(mActDb);
-
+    
+    iDatabaseCleaner = new (ELeave) CAfDatabaseCleaner(iActDb);
+    
     DeleteNonPersistentActivitiesL();
     RequestCleanup();
-}
+    }
 
 // -----------------------------------------------------------------------------
 /**
@@ -97,16 +97,16 @@
  * @param databaseFile - database file path
  */
 void CAfStorage::CreateDbL(const TDesC& databaseFile)
-{
-    mFileStore = CPermanentFileStore::ReplaceL(mFsSession,
+    {
+    iFileStore = CPermanentFileStore::ReplaceL(iFsSession,
                                                databaseFile,
                                                EFileRead|EFileWrite);
-    mFileStore->SetTypeL(mFileStore->Layout());// Set file store type
-    TStreamId id = mActDb.CreateL(mFileStore);// Create stream object
-    mFileStore->SetRootL(id);// Keep database id as root of store
-    mFileStore->CommitL();// Complete creation by commiting
+    iFileStore->SetTypeL(iFileStore->Layout());// Set file store type
+    TStreamId id = iActDb.CreateL(iFileStore);// Create stream object
+    iFileStore->SetRootL(id);// Keep database id as root of store
+    iFileStore->CommitL();// Complete creation by commiting
     CreateTableL();
-}
+    }
 
 // -----------------------------------------------------------------------------
 /**
@@ -114,52 +114,121 @@
  * @param databaseFile - database file path
  */
 void CAfStorage::OpenDbL(const TDesC& databaseFile)
+    {
+    TRAPD( errNo,
+           iFileStore = CPermanentFileStore::OpenL( iFsSession,
+                                                    databaseFile,
+                                                    EFileRead|EFileWrite );
+           iFileStore->SetTypeL( iFileStore->Layout() ); /* Set file store type*/
+           iActDb.OpenL( iFileStore, iFileStore->Root() );
+           VerifyTableL(); )
+    if( KErrNone != errNo )
+        {
+        //database is corrupted. recreate
+        iActDb.Close();
+        delete iFileStore;
+        iFileStore = 0;
+        CreateDbL( databaseFile );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Verify database structure
+ */
+void CAfStorage::VerifyDbL()
 {
-    mFileStore = CPermanentFileStore::OpenL(mFsSession,
-                                            databaseFile,
-                                            EFileRead|EFileWrite);
-    mFileStore->SetTypeL(mFileStore->Layout()); /* Set file store type*/
-    mActDb.OpenL(mFileStore,mFileStore->Root());
+    TInt errNo(KErrCorrupt);
+    CDbTableNames* tables = iActDb.TableNamesL();
+    CleanupStack::PushL( tables );
+    for( TInt iter(0); iter < tables->Count() && KErrNone != errNo; ++iter )
+        {
+        if( 0 == (*tables)[iter].Compare( KActivityTableName() ) )
+            {
+            VerifyTableL();
+            errNo = KErrNone;
+            }
+        }
+    CleanupStack::PopAndDestroy( tables );
+    User::LeaveIfError( errNo );
 }
 
 // -----------------------------------------------------------------------------
+CDbColSet* CAfStorage::ExpectedTableLC()
+    {
+    CDbColSet* actColSet = CDbColSet::NewLC();
+    
+    TDbCol appName(KApplicationColumnName, EDbColInt64);
+    appName.iAttributes = TDbCol::ENotNull;
+    actColSet->AddL( appName );
+    
+    TDbCol actName( KActivityColumnName, EDbColText16 );// Using default length
+    actName.iAttributes = TDbCol::ENotNull;
+    actColSet->AddL( actName );
+    
+    // custom name
+    actColSet->AddL( TDbCol( KCustomNameColumnName, EDbColText16 ) );
+    
+    TDbCol actFlags( KFlagsColumnName, EDbColInt32 );
+    actFlags.iAttributes = TDbCol::ENotNull;
+    actColSet->AddL(actFlags);
+    
+    TDbCol actTimestamp( KTimestampColumnName, EDbColDateTime );
+    actTimestamp.iAttributes = TDbCol::ENotNull;
+    actColSet->AddL(actTimestamp);
+    
+    actColSet->AddL( TDbCol( KDataColumnName, EDbColLongBinary ) );// Stream Data
+    
+    return actColSet;
+    }
+
+// -----------------------------------------------------------------------------
 /**
  * Create database structure
  */
 void CAfStorage::CreateTableL()
-{
-    // Add the columns to column set
-    CDbColSet* actColSet = CDbColSet::NewLC();
-
-    TDbCol appName(KApplicationColumnName, EDbColInt64);
-    appName.iAttributes = TDbCol::ENotNull;
-    actColSet->AddL(appName);
-
-    TDbCol actName(KActivityColumnName, EDbColText16);// Using default length
-    actName.iAttributes = TDbCol::ENotNull;
-    actColSet->AddL(actName);
+    {
+    CDbColSet* actColSet(ExpectedTableLC());
+    // Create the table
+    User::LeaveIfError(iActDb.CreateTable(KActivityTableName,
+                                         *actColSet));
+    CleanupStack::PopAndDestroy(actColSet);
+    }
 
-    TDbCol actFlags(KFlagsColumnName, EDbColInt32);
-    actFlags.iAttributes = TDbCol::ENotNull;
-    actColSet->AddL(actFlags);
-
-    actColSet->AddL(TDbCol(KDataColumnName, EDbColLongBinary));// Stream Data
-
-    // Create the table
-    User::LeaveIfError(mActDb.CreateTable(KActivityTableName,
-                                         *actColSet));
-
-    CleanupStack::PopAndDestroy(actColSet);
-}
-
+// -----------------------------------------------------------------------------
+/**
+ * Verify table structure
+ */
+void CAfStorage::VerifyTableL()
+    {
+    CDbColSet *currentTable(iActDb.ColSetL(KActivityTableName));
+    CleanupStack::PushL(currentTable);
+    CDbColSet *expectedTable(ExpectedTableLC());
+    for( TInt iter(1); iter <= expectedTable->Count(); ++iter )
+        {
+        const TDbCol& expectedColumn((*expectedTable)[iter]);
+        const TDbCol* currentColumn(currentTable->Col(expectedColumn.iName));
+        if( 0 == currentColumn ||
+            expectedColumn.iAttributes != currentColumn->iAttributes || 
+            expectedColumn.iMaxLength != currentColumn->iMaxLength || 
+            expectedColumn.iType != currentColumn->iType )
+            {
+            User::Leave(KErrCorrupt);
+            }
+        }
+    CleanupStack::PopAndDestroy( expectedTable );
+    CleanupStack::PopAndDestroy( currentTable );
+    }
 // -----------------------------------------------------------------------------
 /**
  * Delete non-persistent activities
  */
 void CAfStorage::DeleteNonPersistentActivitiesL()
-{
-    HBufC *query(BuildQueryLC(KDeleteNonPersistentActivities(), CAfEntry::Persistent, KNullDesC));
-    User::LeaveIfError(mActDb.Execute(*query));
+    {
+    HBufC *query(BuildQueryLC(KDeleteNonPersistentActivities(), 
+                              CAfEntry::Persistent, 
+                              KNullDesC));
+    User::LeaveIfError(iActDb.Execute(*query));
     RBuf privatePath;
     CleanupClosePushL(privatePath);
     privatePath.CreateL(KMaxPathLength);
@@ -169,7 +238,7 @@
     delete fileMan;
     CleanupStack::PopAndDestroy(&privatePath);
     CleanupStack::PopAndDestroy(query);
-}
+    }
 
 // -----------------------------------------------------------------------------
 /**
@@ -182,38 +251,46 @@
  * @param publicData - activity public data
  */
 void CAfStorage::AddActivityL(CAfEntry& entry)
-{
+    {
     //verify if row already exists
     TInt errNo(KErrNone);
     RDbView view;
     CleanupClosePushL(view);
     TRAP( errNo, GetActivityForUpdateL(view, entry.ApplicationId(), entry.ActivityId()));
-    if (KErrNone == errNo) {
+    if( KErrNone == errNo ) 
+        {
         User::Leave(KErrAlreadyExists);
-    }
+        }
     CleanupStack::PopAndDestroy(&view);
 
     //write table
     RDbTable table;
     CleanupClosePushL(table);
-    User::LeaveIfError(table.Open(mActDb, KActivityTableName, table.EUpdatable));
+    User::LeaveIfError(table.Open(iActDb, KActivityTableName, table.EUpdatable));
     CDbColSet *row = table.ColSetL();
     CleanupStack::PushL(row);
-
+    
+    TTime time;
+    time.UniversalTime();
+    
     table.InsertL();
     TRAP(errNo,
     table.SetColL(row->ColNo(KApplicationColumnName), TInt64(entry.ApplicationId()));
     table.SetColL(row->ColNo(KActivityColumnName), entry.ActivityId());
+    table.SetColL(row->ColNo(KCustomNameColumnName), entry.CustomActivityName());    
     table.SetColL(row->ColNo(KFlagsColumnName), entry.Flags());
-    ExternalizeDataL(table, entry, row->ColNo(KDataColumnName));
+    table.SetColL(row->ColNo(KTimestampColumnName), time.DateTime());
+    ExternalizeDataL(table, entry, row->ColNo(KDataColumnName) );
+    
     table.PutL();)
-    if (KErrNone != errNo) {
+    if( KErrNone != errNo )
+        {
         table.Cancel();
         User::Leave(errNo);
-    }
+        }
     CleanupStack::PopAndDestroy(row);
     CleanupStack::PopAndDestroy(&table);
-}
+    }
 
 // -----------------------------------------------------------------------------
 /**
@@ -221,7 +298,9 @@
  * @param entry - activity data
  */
 void CAfStorage::UpdateActivityL(CAfEntry& entry)
-{
+    {
+    TTime time;
+    time.UniversalTime();
     RDbView view;
     CleanupClosePushL(view);
     GetActivityForUpdateL(view, entry.ApplicationId(), entry.ActivityId());
@@ -231,17 +310,20 @@
     CleanupStack::PushL(colSet);
 
     view.SetColL(colSet->ColNo(KFlagsColumnName), entry.Flags());
+    view.SetColL(colSet->ColNo(KTimestampColumnName), time.DateTime());
+    view.SetColL(colSet->ColNo(KCustomNameColumnName), entry.CustomActivityName());    
     ExternalizeDataL(view, entry, colSet->ColNo(KDataColumnName));
 
     view.PutL();
     CleanupStack::PopAndDestroy(colSet);)
 
-    if (KErrNone != errNo) {
+    if(KErrNone != errNo)
+        {
         view.Cancel();
         User::Leave(errNo);
-    }
+        }
     CleanupStack::PopAndDestroy(&view);
-}
+    }
 
 // -----------------------------------------------------------------------------
 /**
@@ -250,13 +332,16 @@
  */
 void CAfStorage::SaveActivityL(CAfEntry &entry)
 {
+    TTime time;
+    time.UniversalTime();
     // @todo check if this can be tidied up
     //verify if row already exists
     TInt errNo(KErrNone);
     RDbView view;
     CleanupClosePushL(view);
     TRAP(errNo, GetActivityForUpdateL(view, entry.ApplicationId(), entry.ActivityId()));
-    if (KErrNone == errNo) {
+    if( KErrNone == errNo )
+        {
         // update
         view.UpdateL();
         TRAPD(errNo,
@@ -264,22 +349,27 @@
         CleanupStack::PushL(colSet);
 
         view.SetColL(colSet->ColNo(KFlagsColumnName), entry.Flags());
+        view.SetColL(colSet->ColNo(KTimestampColumnName), time.DateTime());
+        view.SetColL(colSet->ColNo(KCustomNameColumnName), entry.CustomActivityName());
         ExternalizeDataL(view, entry, colSet->ColNo(KDataColumnName));
 
         view.PutL();
         CleanupStack::PopAndDestroy(colSet);)
 
-        if (KErrNone != errNo) {
+        if (KErrNone != errNo) 
+            {
             view.Cancel();
             User::Leave(errNo);
+            }
         }
-    } else {
+    else
+        {
         // insert
 
         //write table
         RDbTable table;
         CleanupClosePushL(table);
-        User::LeaveIfError(table.Open(mActDb, KActivityTableName, table.EUpdatable));
+        User::LeaveIfError(table.Open(iActDb, KActivityTableName, table.EUpdatable));
         CDbColSet *row = table.ColSetL();
         CleanupStack::PushL(row);
 
@@ -287,7 +377,9 @@
         TRAP(errNo,
         table.SetColL(row->ColNo(KApplicationColumnName), TInt64(entry.ApplicationId()));
         table.SetColL(row->ColNo(KActivityColumnName), entry.ActivityId());
+        table.SetColL(row->ColNo(KCustomNameColumnName), entry.CustomActivityName());
         table.SetColL(row->ColNo(KFlagsColumnName), entry.Flags());
+        table.SetColL(row->ColNo(KTimestampColumnName), time.DateTime());
         ExternalizeDataL(table, entry, row->ColNo(KDataColumnName));
         table.PutL();)
         if (KErrNone != errNo) {
@@ -297,7 +389,6 @@
         CleanupStack::PopAndDestroy(row);
         CleanupStack::PopAndDestroy(&table);
     }
-            
     CleanupStack::PopAndDestroy(&view);
 }
 
@@ -308,20 +399,18 @@
  * @param actId - activity id
  */
 void CAfStorage::DeleteActivityL(CAfEntry& entry)
-{
+    {
     HBufC *query(DeleteRowLC(entry.ApplicationId(), entry.ActivityId()));
-    User::LeaveIfError(mActDb.Execute(*query));
+    User::LeaveIfError(iActDb.Execute(*query));
     CleanupStack::PopAndDestroy(query);
-}
+    }
 
 // -----------------------------------------------------------------------------
 //
-// -----------------------------------------------------------------------------
-//
 void CAfStorage::DeleteActivitiesL(CAfEntry& entry)
-{
+    {
     HBufC *query(DeleteRowsLC(entry.ApplicationId()));
-    User::LeaveIfError(mActDb.Execute(*query));
+    User::LeaveIfError(iActDb.Execute(*query));
     RBuf privatePath;
     CleanupClosePushL(privatePath);
     privatePath.CreateL(KMaxPathLength);
@@ -337,16 +426,16 @@
     CleanupStack::PopAndDestroy(fileMan);
     CleanupStack::PopAndDestroy(&privatePath);
     CleanupStack::PopAndDestroy(query);
-}
+    }
 
 // -----------------------------------------------------------------------------
 //
 // -----------------------------------------------------------------------------
 //
-void CAfStorage::ActivitiesL(RPointerArray<CAfEntry>& dst)
-{
-    ActivitiesL(dst, KSelectRows(), CAfEntry::Public);
-}
+void CAfStorage::AllActivitiesL(RPointerArray<CAfEntry>& dst, TInt aLimit)
+    {
+    ActivitiesL(dst, KSelectRows(), CAfEntry::Public, aLimit);
+    }
 
 // -----------------------------------------------------------------------------
 /**
@@ -355,11 +444,11 @@
  * @param appId - application id
  */
 void CAfStorage::ActivitiesL(RPointerArray<CAfEntry>& dst,TInt appId)
-{
+    {
     HBufC *query(SelectRowsLC(appId));
     ActivitiesL(dst, *query, CAfEntry::Private);
     CleanupStack::PopAndDestroy(query);
-}
+    }
 
 // -----------------------------------------------------------------------------
 /**
@@ -368,14 +457,15 @@
  * @param src - condition pattern
  */
 void CAfStorage::ActivityL(RPointerArray<CAfEntry> &dst, CAfEntry& src)
-{
+    {
     HBufC *query = SelectRowLC(src.ApplicationId(), src.ActivityId());
-    ActivitiesL(dst, *query, CAfEntry::Private, 1);
-    if (0 >= dst.Count()) {
+    ActivitiesL(dst, *query, CAfEntry::Private, 1, ETrue);
+    if( 0 >= dst.Count() )
+        {
         User::Leave(KErrNotFound);
-    }
+        }
     CleanupStack::PopAndDestroy(query);
-}
+    }
 
 // -----------------------------------------------------------------------------
 /**
@@ -383,9 +473,9 @@
  * @return file system session
  */
 RFs& CAfStorage::Fs()
-{
-    return mFsSession;
-}
+    {
+    return iFsSession;
+    }
 
 // -----------------------------------------------------------------------------
 /**
@@ -395,9 +485,9 @@
  * @return formated sql query
  */
 HBufC* CAfStorage::SelectRowLC(TInt appId, const TDesC& actId) const
-{
+    {
     return BuildQueryLC(KSelectRow(),appId, actId);
-}
+    }
 
 // -----------------------------------------------------------------------------
 /**
@@ -406,9 +496,9 @@
  * @return formated sql query
  */
 HBufC* CAfStorage::SelectRowsLC(TInt appId) const
-{
+    {
     return BuildQueryLC(KSelectAppRows(), appId, KNullDesC);
-}
+    }
 
 // -----------------------------------------------------------------------------
 /**
@@ -418,9 +508,9 @@
  * @return formated sql query
  */
 HBufC* CAfStorage::DeleteRowLC(TInt appId, const TDesC& actId) const
-{
+    {
     return BuildQueryLC(KDeleteRow(),appId, actId);
-}
+    }
 
 // -----------------------------------------------------------------------------
 /**
@@ -429,9 +519,9 @@
  * @return formated sql query
  */
 HBufC* CAfStorage::DeleteRowsLC(TInt appId) const
-{
+    {
     return BuildQueryLC(KDeleteRows(),appId, KNullDesC);
-}
+    }
 
 // -----------------------------------------------------------------------------
 /**
@@ -444,7 +534,7 @@
 HBufC* CAfStorage::BuildQueryLC(const TDesC& format,
                                       TInt appId,
                                       const TDesC& actId) const
-{
+    {
     TBuf<16> appName;
     appName.AppendNum(appId);
     RBuf actName;
@@ -458,7 +548,7 @@
     CleanupStack::PopAndDestroy(&actName);
     CleanupStack::PushL(query);
     return query;
-}
+    }
 
 // -----------------------------------------------------------------------------
 /**
@@ -466,15 +556,15 @@
  * @param dst - destination result buffer
  * @param query - sql activity query
  */
-void CAfStorage::ActivitiesL(RPointerArray<CAfEntry>& dst, const TDesC& query, CAfEntry::AccessRights rights, TInt limit)
-{
+void CAfStorage::ActivitiesL(RPointerArray<CAfEntry>& dst, const TDesC& query, CAfEntry::AccessRights rights, TInt limit, TBool deserializeAllData)
+    {
     RDbView view;// Create a view on the database
     CleanupClosePushL(view);
-    User::LeaveIfError(view.Prepare(mActDb, TDbQuery(query), view.EReadOnly));
+    User::LeaveIfError(view.Prepare(iActDb, TDbQuery(query), view.EReadOnly));
     User::LeaveIfError(view.EvaluateAll());
-    ActivitiesL(dst, view, rights, limit);
+    ActivitiesL(dst, view, rights, limit, deserializeAllData);
     CleanupStack::PopAndDestroy(&view);
-}
+    }
 
 // -----------------------------------------------------------------------------
 /**
@@ -483,48 +573,69 @@
  * @param query - view
  * @param rights - acess rights
  */
-void CAfStorage::ActivitiesL(RPointerArray<CAfEntry>& dst, RDbView& src, CAfEntry::AccessRights rights, TInt limit)
-{
+void CAfStorage::ActivitiesL(RPointerArray<CAfEntry>& dst, 
+                             RDbView& src, 
+                             CAfEntry::AccessRights rights, 
+                             TInt limit,
+                             TBool deserializeAllData)
+    {
     CDbColSet* row = src.ColSetL();
     CleanupStack::PushL(row);
 
     const TInt flagsOffset(row->ColNo(KFlagsColumnName)),
                applicationOffset(row->ColNo(KApplicationColumnName)),
                activityOffset(row->ColNo(KActivityColumnName)),
+               customNameOffset(row->ColNo(KCustomNameColumnName)),
                dataOffset(row->ColNo(KDataColumnName));
 
     RBuf activityName;
     CleanupClosePushL(activityName);
 
-    for (src.FirstL(); src.AtRow(); src.NextL()) {
-        if(0 < limit && dst.Count() >= limit) {
+    RBuf customName;
+    CleanupClosePushL(customName);
+    
+    
+    for (src.FirstL(); src.AtRow(); src.NextL()) 
+        {
+        if ( 0 < limit && dst.Count() >= limit )
+            {
             break;
-        }
+            }
         src.GetL();
         ReadDataL(activityName, src, activityOffset);
+        ReadDataL(customName, src, customNameOffset);
 
         CAfEntry *entry = CAfEntry::NewLC(src.ColInt32(flagsOffset),
                                           src.ColInt64(applicationOffset),
                                           activityName,
+                                          customName,
                                           KNullDesC,
                                           KNullDesC8,
                                           KNullDesC8);
-        if (CAfEntry::Public == rights && (entry->Flags() & CAfEntry::Invisible)) {
+        if( CAfEntry::Public == rights && 
+            (entry->Flags() & CAfEntry::Invisible) )
+            {
             CleanupStack::PopAndDestroy(entry);
             continue;
-        }
+            }
         InternalizeDataL(*entry, src, dataOffset);
         
-        if (CAfEntry::Public == rights || 0 >= limit) {
+        if (!deserializeAllData) {
+            entry->SetDataL(KNullDesC8(), CAfEntry::Public);
             entry->SetDataL(KNullDesC8(), CAfEntry::Private);
+        } else {
+            if (CAfEntry::Public == rights) {
+                entry->SetDataL(KNullDesC8(), CAfEntry::Private);
+            }
         }
+
         dst.AppendL(entry);
         CleanupStack::Pop(entry);
-    }
-
+        }
+    CleanupStack::PopAndDestroy(&customName);
     CleanupStack::PopAndDestroy(&activityName);
     CleanupStack::PopAndDestroy(row);
-}
+    }
 
 // -----------------------------------------------------------------------------
 /**
@@ -534,46 +645,47 @@
  * @param actId - activity id
  */
 void CAfStorage::GetActivityForUpdateL(RDbView& view, TInt appId, const TDesC& actId)
-{
+    {
     HBufC* query(SelectRowLC(appId, actId));
-    User::LeaveIfError(view.Prepare(mActDb, TDbQuery(*query), view.EUpdatable));
+    User::LeaveIfError(view.Prepare(iActDb, TDbQuery(*query), view.EUpdatable));
     CleanupStack::PopAndDestroy(query);
     User::LeaveIfError(view.EvaluateAll());
-    if (!view.FirstL()) {
+    if( !view.FirstL() )
+        {
         User::Leave(KErrNotFound);
-    }
+        }
 }
 
 // -----------------------------------------------------------------------------
 void CAfStorage::ReadDataL(RBuf& dst, RDbRowSet& src, TInt offset) const
-{
+    {
     const TInt length(src.ColLength(offset));
     CAfEntry::ReallocL(dst, length);
     RDbColReadStream srcStream;
     srcStream.OpenLC(src,offset);
     srcStream.ReadL(dst, src.ColLength(offset));
     CleanupStack::PopAndDestroy(&srcStream);
-}
+    }
 
 // -----------------------------------------------------------------------------
 void CAfStorage::ExternalizeDataL(RDbRowSet& dst,const CAfEntry &src, TInt offset) const
-{
+    {
     RDbColWriteStream dbStream;
     CleanupClosePushL(dbStream);
     dbStream.OpenL(dst, offset);
     src.ExternalizeDataOnlyL(dbStream);
     CleanupStack::PopAndDestroy(&dbStream);
-}
+    }
 
 // -----------------------------------------------------------------------------
 void CAfStorage::InternalizeDataL(CAfEntry & dst, RDbRowSet& src, TInt offset) const
-{
+    {
     RDbColReadStream dbStream;
     CleanupClosePushL(dbStream);
     dbStream.OpenL(src, offset);
     dst.InternalizeDataOnlyL(dbStream);
     CleanupStack::PopAndDestroy(&dbStream);
-}
+    }
 
 // -----------------------------------------------------------------------------
 //
@@ -582,19 +694,22 @@
 void CAfStorage::StoragePathL(RBuf &dst, 
                   RFs& fileSystem, 
                   TBool persistent)
-{
-    if (dst.MaxLength() < KMaxPathLength) {
+    {
+    if (dst.MaxLength() < KMaxPathLength) 
+        {
         dst.ReAllocL(KMaxPathLength);
-    } 
+        }
     dst.Zero();
     User::LeaveIfError(fileSystem.PrivatePath(dst));
-    if(persistent) {
+    if(persistent)
+        {
         dst.Append(KPersistent);
+        }
+    else
+        {
+        dst.Append(KNonPersistent);
+        }
     }
-    else {
-        dst.Append(KNonPersistent);
-    } 
-}
 
 // -----------------------------------------------------------------------------
 //
@@ -604,7 +719,7 @@
                      RFs& fileSystem,
                      TInt uid,
                      TBool persistent)
-{
+    {
     StoragePathL(dst, fileSystem, persistent);
     
     //Format activity path
@@ -648,7 +763,7 @@
 // -----------------------------------------------------------------------------
 //
 HBufC8* CAfStorage::Md5HexDigestL(const TDesC8 &string)
-{
+    {
     _LIT8(KMd5HexFormat, "%+02x");
     CMD5* md5 = CMD5::NewL();
     CleanupStack::PushL(md5);
@@ -663,7 +778,7 @@
     }
     CleanupStack::PopAndDestroy(md5);
     return buf;
-}
+    }
 
 // -----------------------------------------------------------------------------
 /**
@@ -671,20 +786,23 @@
  * @return ETrue if the database cleanup was in progress, EFalse otherwise
  */
 TBool CAfStorage::InterruptCleanup()
-{    
-    if (mDatabaseCleaner->IsActive()) {
-        mDatabaseCleaner->Cancel();
+    {
+    if( iDatabaseCleaner->IsActive() )
+        {
+        iDatabaseCleaner->Cancel();
         return ETrue;
-    } else {
+        } 
+    else
+        {
         return EFalse;
+        }
     }
-}
 
 // -----------------------------------------------------------------------------
 /**
  * Start database cleanup
  */
 void CAfStorage::RequestCleanup()
-{
-    mDatabaseCleaner->StartCleanup();
-}
+    {
+    iDatabaseCleaner->StartCleanup();
+    }
--- a/activityfw/storage/server/src/afstorageasynctask.cpp	Wed Aug 18 10:39:24 2010 +0300
+++ b/activityfw/storage/server/src/afstorageasynctask.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -108,7 +108,7 @@
 void CAfStorageAsyncTask::AllActivitiesL(CAfStorage& dataStorage, 
                                          const RMessage2& msg)
 {
-    dataStorage.ActivitiesL(mInternalizedData);
+    dataStorage.AllActivitiesL(mInternalizedData, msg.Int3());
     ExternalizeL();
     WriteResponseL(msg);
 }
--- a/activityfw/tsutils/bwins/tsutilsu.def	Wed Aug 18 10:39:24 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-EXPORTS
-	?WsSession@CTsResourceManager@@UAEAAVRWsSession@@XZ @ 1 NONAME ; class RWsSession & CTsResourceManager::WsSession(void)
-	?ApaSession@CTsResourceManager@@UAEAAVRApaLsSession@@XZ @ 2 NONAME ; class RApaLsSession & CTsResourceManager::ApaSession(void)
-	?BaseConstructL@CTsWindowGroupsObserver@@IAEXXZ @ 3 NONAME ; void CTsWindowGroupsObserver::BaseConstructL(void)
-	??1CTsWindowGroupsObserver@@UAE@XZ @ 4 NONAME ; CTsWindowGroupsObserver::~CTsWindowGroupsObserver(void)
-	??1CTsWindowGroupsMonitor@@UAE@XZ @ 5 NONAME ; CTsWindowGroupsMonitor::~CTsWindowGroupsMonitor(void)
-	?NewL@CTsGraphicFileScalingHandler@@SAPAV1@AAVMImageReadyCallBack@@AAVRFs@@ABVTDesC16@@ABVTDesC8@@ABVTSize@@W4TKindOfScaling@1@@Z @ 6 NONAME ; class CTsGraphicFileScalingHandler * CTsGraphicFileScalingHandler::NewL(class MImageReadyCallBack &, class RFs &, class TDesC16 const &, class TDesC8 const &, class TSize const &, enum CTsGraphicFileScalingHandler::TKindOfScaling)
-	?SubscribeL@CTsWindowGroupsMonitor@@UAEXAAVMTsWindowGroupsObserver@@@Z @ 7 NONAME ; void CTsWindowGroupsMonitor::SubscribeL(class MTsWindowGroupsObserver &)
-	?NewL@CTsWindowGroupsMonitor@@SAPAV1@AAVMTsResourceManager@@@Z @ 8 NONAME ; class CTsWindowGroupsMonitor * CTsWindowGroupsMonitor::NewL(class MTsResourceManager &)
-	??1CTsGraphicFileScalingHandler@@UAE@XZ @ 9 NONAME ; CTsGraphicFileScalingHandler::~CTsGraphicFileScalingHandler(void)
-	?NewLC@CTsGraphicFileScalingHandler@@SAPAV1@AAVMImageReadyCallBack@@ABVCFbsBitmap@@ABVTSize@@W4TKindOfScaling@1@@Z @ 10 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 @ 11 NONAME ; class CTsGraphicFileScalingHandler * CTsGraphicFileScalingHandler::NewL(class MImageReadyCallBack &, class CFbsBitmap const &, class TSize const &, enum CTsGraphicFileScalingHandler::TKindOfScaling)
-	?NewLC@CTsGraphicFileScalingHandler@@SAPAV1@AAVMImageReadyCallBack@@AAVRFs@@ABVTDesC16@@ABVTDesC8@@ABVTSize@@W4TKindOfScaling@1@@Z @ 12 NONAME ; class CTsGraphicFileScalingHandler * CTsGraphicFileScalingHandler::NewLC(class MImageReadyCallBack &, class RFs &, class TDesC16 const &, class TDesC8 const &, class TSize const &, enum CTsGraphicFileScalingHandler::TKindOfScaling)
-	??0CTsWindowGroupsObserver@@IAE@AAVMTsWindowGroupsMonitor@@@Z @ 13 NONAME ; CTsWindowGroupsObserver::CTsWindowGroupsObserver(class MTsWindowGroupsMonitor &)
-	?NewL@CTsResourceManager@@SAPAV1@XZ @ 14 NONAME ; class CTsResourceManager * CTsResourceManager::NewL(void)
-	?Cancel@CTsWindowGroupsMonitor@@UAEXAAVMTsWindowGroupsObserver@@@Z @ 15 NONAME ; void CTsWindowGroupsMonitor::Cancel(class MTsWindowGroupsObserver &)
-	??1CTsResourceManager@@UAE@XZ @ 16 NONAME ; CTsResourceManager::~CTsResourceManager(void)
-
--- a/activityfw/tsutils/eabi/tsutilsu.def	Wed Aug 18 10:39:24 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-EXPORTS
-	_ZN18CTsResourceManager10ApaSessionEv @ 1 NONAME
-	_ZN18CTsResourceManager4NewLEv @ 2 NONAME
-	_ZN18CTsResourceManager9WsSessionEv @ 3 NONAME
-	_ZN18CTsResourceManagerD0Ev @ 4 NONAME
-	_ZN18CTsResourceManagerD1Ev @ 5 NONAME
-	_ZN18CTsResourceManagerD2Ev @ 6 NONAME
-	_ZN22CTsWindowGroupsMonitor10SubscribeLER23MTsWindowGroupsObserver @ 7 NONAME
-	_ZN22CTsWindowGroupsMonitor4NewLER18MTsResourceManager @ 8 NONAME
-	_ZN22CTsWindowGroupsMonitor6CancelER23MTsWindowGroupsObserver @ 9 NONAME
-	_ZN22CTsWindowGroupsMonitorD0Ev @ 10 NONAME
-	_ZN22CTsWindowGroupsMonitorD1Ev @ 11 NONAME
-	_ZN22CTsWindowGroupsMonitorD2Ev @ 12 NONAME
-	_ZN23CTsWindowGroupsObserver14BaseConstructLEv @ 13 NONAME
-	_ZN23CTsWindowGroupsObserverC2ER22MTsWindowGroupsMonitor @ 14 NONAME
-	_ZN23CTsWindowGroupsObserverD0Ev @ 15 NONAME
-	_ZN23CTsWindowGroupsObserverD1Ev @ 16 NONAME
-	_ZN23CTsWindowGroupsObserverD2Ev @ 17 NONAME
-	_ZN28CTsGraphicFileScalingHandler4NewLER19MImageReadyCallBackR3RFsRK7TDesC16RK6TDesC8RK5TSizeNS_14TKindOfScalingE @ 18 NONAME
-	_ZN28CTsGraphicFileScalingHandler4NewLER19MImageReadyCallBackRK10CFbsBitmapRK5TSizeNS_14TKindOfScalingE @ 19 NONAME
-	_ZN28CTsGraphicFileScalingHandler5NewLCER19MImageReadyCallBackR3RFsRK7TDesC16RK6TDesC8RK5TSizeNS_14TKindOfScalingE @ 20 NONAME
-	_ZN28CTsGraphicFileScalingHandler5NewLCER19MImageReadyCallBackRK10CFbsBitmapRK5TSizeNS_14TKindOfScalingE @ 21 NONAME
-	_ZN28CTsGraphicFileScalingHandlerD0Ev @ 22 NONAME
-	_ZN28CTsGraphicFileScalingHandlerD1Ev @ 23 NONAME
-	_ZN28CTsGraphicFileScalingHandlerD2Ev @ 24 NONAME
-	_ZTI18CTsResourceManager @ 25 NONAME
-	_ZTI22CTsWindowGroupsMonitor @ 26 NONAME
-	_ZTI23CTsWindowGroupsObserver @ 27 NONAME
-	_ZTI28CTsGraphicFileScalingHandler @ 28 NONAME
-	_ZTV18CTsResourceManager @ 29 NONAME
-	_ZTV22CTsWindowGroupsMonitor @ 30 NONAME
-	_ZTV23CTsWindowGroupsObserver @ 31 NONAME
-	_ZTV28CTsGraphicFileScalingHandler @ 32 NONAME
-	_ZThn28_N22CTsWindowGroupsMonitor10SubscribeLER23MTsWindowGroupsObserver @ 33 NONAME
-	_ZThn28_N22CTsWindowGroupsMonitor6CancelER23MTsWindowGroupsObserver @ 34 NONAME
-	_ZThn4_N18CTsResourceManager10ApaSessionEv @ 35 NONAME
-	_ZThn4_N18CTsResourceManager9WsSessionEv @ 36 NONAME
-
--- a/activityfw/tsutils/group/bld.inf	Wed Aug 18 10:39:24 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +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:
-*
-*/
-PRJ_PLATFORMS
-DEFAULT
-
-PRJ_EXPORTS
-../inc/tsresourcemanager.h |../../../inc/tsresourcemanager.h
-../inc/tswindowgroupsobserver.h |../../../inc/tswindowgroupsobserver.h
-../inc/tsgraphicfilescalinghandler.h |../../../inc/tsgraphicfilescalinghandler.h
-
-PRJ_MMPFILES
-tsutils.mmp
--- a/activityfw/tsutils/group/tsutils.mmp	Wed Aug 18 10:39:24 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +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:
-*
-*/
-TARGET        tsutils.dll
-TARGETTYPE    dll
-UID           0x1000008d 0x20026782
-
-CAPABILITY    CAP_GENERAL_DLL
-
-MW_LAYER_SYSTEMINCLUDE
-
-USERINCLUDE   ../inc
-
-SOURCEPATH    ../src
-SOURCE        tsgraphicfilescalinghandler.cpp
-SOURCE        tswindowgroupsmonitor.cpp
-SOURCE        tswindowgroupsobserver.cpp
-SOURCE        tsresourcemanager.cpp
-
-LIBRARY      euser.lib
-LIBRARY      bitmaptransforms.lib
-LIBRARY      imageconversion.lib
-LIBRARY      fbscli.lib
-LIBRARY      efsrv.lib
-LIBRARY      ws32.lib
-LIBRARY      apgrfx.lib
-
-
-#ifdef ENABLE_ABIV2_MODE
-DEBUGGABLE_UDEBONLY
-#endif
--- a/activityfw/tsutils/inc/tsgraphicfilescalinghandler.h	Wed Aug 18 10:39:24 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,211 +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 TSGRAPHICFILESCALINGHANDLER_H
-#define TSGRAPHICFILESCALINGHANDLER_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;
-
-/**
- * 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;
-};
-
-/**
- * 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,
-    };
-
-private:
-    /**
-     * Active object current operation.
-     */
-    enum TCurrentOperation{
-        ENone = 0,
-        EConvertBitmapFromFile = 1,
-        EScale = 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,
-        const TDesC8& aMimeType,
-        const TSize &aNewSize,
-        TKindOfScaling aKindOfScaling = CTsGraphicFileScalingHandler::EIgnoreAspectRatio);
-    IMPORT_C static CTsGraphicFileScalingHandler* NewLC(MImageReadyCallBack &aNotify,
-        RFs &aFs,
-        const TDesC &aFileName,
-        const TDesC8& aMimeType,
-        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);
-    /**
-     * 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;
-    /**
-     * 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;
-};
-
-#endif // TSGRAPHICFILESCALINGHANDLER_H
--- a/activityfw/tsutils/inc/tsresourcemanager.h	Wed Aug 18 10:39:24 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +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 TSRESOURCEMANAGER_H
-#define TSRESOURCEMANAGER_H
-
-#ifndef __E32SVR_H__
-#define __E32SVR_H__
-#endif
-#include <e32base.h>
-#include <e32event.h>
-#include <w32std.h>
-#include <apgcli.h>
-
-/**
- * Interface decalre methods to access initialized OS resources
- */
-class MTsResourceManager
-{
-public:
-    /**
-     * Access to initialized window server session
-     */
-    virtual RWsSession& WsSession() =0;
-    
-    /**
-     * Access to initilaized APA session
-     */
-    virtual RApaLsSession& ApaSession() =0;
-};
-
-/**
- * Resource manager implemetatioin
- */
-class CTsResourceManager: public CBase,
-                          public MTsResourceManager
-{
-public:
-    /**
-     * Two phase constructor
-     */
-    IMPORT_C static CTsResourceManager* NewL();
-    
-    /**
-     * Destructor
-     */
-    IMPORT_C ~CTsResourceManager();
-    
-    /**
-     * @see MTsResourceManager::WsSession
-     */
-    IMPORT_C RWsSession& WsSession();
-    
-    /**
-     * @see MTsResourceManager::ApaSession
-     */
-    IMPORT_C RApaLsSession& ApaSession();
-
-private:
-    /**
-     * Second phase constructor
-     */
-    void ConstructL();
-
-private:
-   RWsSession mWsSession;
-   RApaLsSession mApaSeesion;
-};
-
-
-
-#endif // TSRESOURCEMANAGER_H
--- a/activityfw/tsutils/inc/tswindowgroupsobserver.h	Wed Aug 18 10:39:24 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,173 +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 TSWINDOWGROUPSOBSERVER_H
-#define TSWINDOWGROUPSOBSERVER_H
-
-#include "tsresourcemanager.h"
-
-/**
- * Interface declare mathods to notify about window server events
- */
-class MTsWindowGroupsObserver
-{
-public:
-    /**
-     * Method notidy about window group changes.
-     * @param rsc - resource manager
-     * @param wgs - list of window groups associated with running applications
-     */
-    virtual void HandleWindowGroupChanged(MTsResourceManager &rsc, 
-                                          const TArray<RWsSession::TWindowGroupChainInfo> & wgs) =0;
-};
-
-/**
- * Interface declare methods to subscribe windo server events
- */
-class MTsWindowGroupsMonitor
-{
-public:
-    /**
-     * Method make subscription for window server events
-     * @param observer - events observer
-     */
-    virtual void SubscribeL(MTsWindowGroupsObserver & observer) =0;
-    
-    /**
-     * Method cancel subscription for window server events
-     * @param observer - events observer
-     */
-    virtual void Cancel(MTsWindowGroupsObserver &) =0;
-};
-
-/**
- * Window server observer implementation. Class automaticly subscribe / cancel subscription
- * at construction / destruction level.
- * 
- */
-class CTsWindowGroupsObserver: public CBase,
-                               public MTsWindowGroupsObserver
-{
-public:
-    /**
-     * Destructor
-     * Function automaticly cancel subscrption to window server events
-     */
-    IMPORT_C ~CTsWindowGroupsObserver();
-    
-protected:
-    /**
-     * First phase constructor
-     */
-    IMPORT_C CTsWindowGroupsObserver(MTsWindowGroupsMonitor &);
-    
-    /**
-     * Second phase constructor.
-     * Function automaticly subscribe window server events
-     */
-    IMPORT_C void BaseConstructL();
-
-private:
-    MTsWindowGroupsMonitor & mMonitor;
-};
-
-/**
- * Window server monitor implementation.
- */
-class CTsWindowGroupsMonitor: public CActive, 
-                              public MTsWindowGroupsMonitor
-                              
-{
-public:
-    /**
-     * Two phase constructor
-     */
-    IMPORT_C static CTsWindowGroupsMonitor* NewL(MTsResourceManager &);
-    
-    /**
-     * Destructor
-     */
-    IMPORT_C ~CTsWindowGroupsMonitor();
-    
-    /**
-     * @see MTsWindowGroupsMonitor::SubscribeL
-     */
-    IMPORT_C void SubscribeL(MTsWindowGroupsObserver &);
-    
-    /**
-     * @see MTsWindowGroupsMonitor::Cancel
-     */
-    IMPORT_C void Cancel(MTsWindowGroupsObserver &);
-
-protected:
-    /**
-     * @see CActive::RunL
-     */
-    void RunL();
-    
-    /**
-     * @see CActive::DoCancel
-     */
-    void DoCancel();
-    
-    /**
-     * @see CActive::RunError
-     */
-    TInt RunError(TInt error);
-
-private:
-    /**
-     * First phase constructor
-     */
-    CTsWindowGroupsMonitor(MTsResourceManager &);
-    
-    /**
-     * Second phase constructor
-     */
-    void ConstructL();
-    
-    /**
-     * Function subscribe for event to window server and activate object
-     */
-    void Subscribe();
-    
-    /**
-     * Function provide window server event to observers
-     */
-    void ProvideEventL();
-    
-    /**
-     * Function provide window server event to observer
-     */
-    void ProvideEventL(TWsEvent, MTsWindowGroupsObserver &);
-
-private:
-    /**
-     * Registry of subscribed observers
-     */
-    RPointerArray<MTsWindowGroupsObserver> mObservers;
-    
-    /**
-     * Resources manager
-     */
-    MTsResourceManager &mResources;
-    
-    /**
-     * Monitor window group
-     */
-    RWindowGroup mWg;
-};
-#endif //TSWINDOWGROUPSOBSERVER_H
--- a/activityfw/tsutils/src/tsgraphicfilescalinghandler.cpp	Wed Aug 18 10:39:24 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,285 +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 "tsgraphicfilescalinghandler.h"
-#include <imageconversion.h>
-
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-//
-CTsGraphicFileScalingHandler::CTsGraphicFileScalingHandler(MImageReadyCallBack &aNotify,
-                                const TSize &aNewSize,
-                                TKindOfScaling aKindOfScaling
-                                /* = CTsGraphicFileScalingHandler::EIgnoreAspectRatio*/) :
-    CActive(EPriorityNormal),
-    mNotify(aNotify),
-    mNewSize(aNewSize),
-    mKindOfScaling(aKindOfScaling),
-    mCurrentOperation(ENone)
-{
-    CActiveScheduler::Add(this);
-}
-
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-//
-EXPORT_C CTsGraphicFileScalingHandler::~CTsGraphicFileScalingHandler()
-{
-    Cancel();
-    delete mInputBitmap;
-    delete mOutputBitmap;
-    delete mImageDecoder;
-    delete mBitmapScaler;
-}
-
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-//
-EXPORT_C CTsGraphicFileScalingHandler* CTsGraphicFileScalingHandler::NewL(MImageReadyCallBack &aNotify,
-                                                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);
-    CleanupStack::Pop();
-    return self;
-}
-
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-//
-EXPORT_C CTsGraphicFileScalingHandler* CTsGraphicFileScalingHandler::NewLC(MImageReadyCallBack &aNotify,
-                                                RFs &aFs,
-                                                const TDesC &aFileName,
-                                                const TDesC8& aMimeType,
-                                                const TSize &aNewSize,
-                                                TKindOfScaling aKindOfScaling
-                                                /* = CTsGraphicFileScalingHandler::EIgnoreAspectRatio*/)
-{
-    CTsGraphicFileScalingHandler *self = new (ELeave) CTsGraphicFileScalingHandler(aNotify,
-                                                                                aNewSize,
-                                                                                aKindOfScaling);
-
-    CleanupStack::PushL(self);
-    self->ConstructL(aFs, aFileName, aMimeType);
-    return self;
-}
-
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-//
-void CTsGraphicFileScalingHandler::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);
-    }
-
-    mInputBitmap = new(ELeave)CFbsBitmap();
-    DecodingOperationL(aFs, aFileName, aMimeType);
-    SetActive();
-}
-
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-//
-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;
-}
-
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-//
-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);
-
-    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();
-}
-
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-//
-void CTsGraphicFileScalingHandler::DoCancel()
-{
-    switch (mCurrentOperation) {
-    case EConvertBitmapFromFile:
-        mImageDecoder->Cancel();
-        break;
-    case EScale:
-        mBitmapScaler->Cancel();
-        break;
-    }
-    mNotify.ImageReadyCallBack(KErrCancel, 0);
-}
-
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-//
-void CTsGraphicFileScalingHandler::RunL()
-{
-    User::LeaveIfError(iStatus.Int());
-
-    switch (mCurrentOperation) {
-    case EConvertBitmapFromFile: {
-            delete mImageDecoder;
-            mImageDecoder = 0;
-
-            ScalingOperationL();
-            SetActive();
-            break;
-        }
-    case EScale: {
-            mCurrentOperation = ENone;
-
-            delete mBitmapScaler;
-            mBitmapScaler = 0;
-            
-            delete mInputBitmap;
-            mInputBitmap = 0;
-
-            if (mKindOfScaling == CTsGraphicFileScalingHandler::EKeepAspectRatioByExpanding) {
-                User::LeaveIfError(mOutputBitmap->Resize(mNewSize));
-            }
-
-            mNotify.ImageReadyCallBack(iStatus.Int(), mOutputBitmap);
-            break;
-        }
-    }
-}
-
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-//
-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()
-{
-    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;
-
-   TSize retSize(mNewSize);
-
-   if (mKindOfScaling == CTsGraphicFileScalingHandler::EKeepAspectRatio) {
-       retSize = (widthFactor < heightFactor) ?
-                 TSize(mNewSize.iWidth, widthFactor * originalSize.iHeight) :
-                 TSize(heightFactor * originalSize.iWidth, mNewSize.iHeight);
-   } else if (mKindOfScaling == CTsGraphicFileScalingHandler::EKeepAspectRatioByExpanding) {
-      retSize = (widthFactor < heightFactor) ?
-                TSize(heightFactor * originalSize.iWidth, mNewSize.iHeight) :
-                TSize(mNewSize.iWidth, widthFactor * originalSize.iHeight);
-   }
-   return retSize;
-}
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-//
-TInt CTsGraphicFileScalingHandler::RunError(TInt aError)
-{
-    mNotify.ImageReadyCallBack(aError, 0);
-    return KErrNone;
-}
--- a/activityfw/tsutils/src/tsresourcemanager.cpp	Wed Aug 18 10:39:24 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +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 "tswindowgroupsobserver.h"
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-EXPORT_C CTsResourceManager* CTsResourceManager::NewL()
-{
-    CTsResourceManager* self =new(ELeave) CTsResourceManager();
-    CleanupStack::PushL(self);
-    self->ConstructL();
-    CleanupStack::Pop(self);
-    return self;
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CTsResourceManager::ConstructL()
-{
-    User::LeaveIfError(mWsSession.Connect());
-    User::LeaveIfError(mApaSeesion.Connect());
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-EXPORT_C CTsResourceManager::~CTsResourceManager()
-{
-    mApaSeesion.Close();
-    mWsSession.Close();
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-EXPORT_C RWsSession& CTsResourceManager::WsSession()
-{
-    return mWsSession;
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-EXPORT_C RApaLsSession& CTsResourceManager::ApaSession()
-{
-    return mApaSeesion;
-}
--- a/activityfw/tsutils/src/tswindowgroupsmonitor.cpp	Wed Aug 18 10:39:24 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,176 +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 "tswindowgroupsobserver.h"
-#include <apgwgnam.h>
-
-const int KOrdinalPositionNoZOrder(-1);
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-EXPORT_C CTsWindowGroupsMonitor* CTsWindowGroupsMonitor::NewL(MTsResourceManager &resources)
-{
-    CTsWindowGroupsMonitor* self = new (ELeave) CTsWindowGroupsMonitor(resources);
-    CleanupStack::PushL(self);
-    self->ConstructL();
-    CleanupStack::Pop(self);
-    return self;
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-CTsWindowGroupsMonitor::CTsWindowGroupsMonitor(MTsResourceManager &resources)
-:
-    CActive(EPriorityStandard),
-    mResources(resources)
-{
-    CActiveScheduler::Add(this);
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CTsWindowGroupsMonitor::ConstructL()
-{
-    
-    // Initial window group
-    mWg = RWindowGroup (mResources.WsSession());
-    User::LeaveIfError (mWg.Construct ((TUint32)&mWg, EFalse));
-    mWg.SetOrdinalPosition (KOrdinalPositionNoZOrder);
-    mWg.EnableReceiptOfFocus (EFalse);
-    
-    // Hide window
-    CApaWindowGroupName* wn = CApaWindowGroupName::NewLC(mResources.WsSession());
-    wn->SetHidden (ETrue);
-    wn->SetWindowGroupName (mWg);
-    CleanupStack::PopAndDestroy (wn);
-    
-    // Window group change event
-    User::LeaveIfError (mWg.EnableGroupListChangeEvents());
-    Subscribe();
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-EXPORT_C CTsWindowGroupsMonitor::~CTsWindowGroupsMonitor()
-{
-    CActive::Cancel();
-    mWg.Close();
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-EXPORT_C void CTsWindowGroupsMonitor::SubscribeL(MTsWindowGroupsObserver &observer)
-{
-    const TInt offset(mObservers.Find(&observer));
-    KErrNotFound == offset ? mObservers.InsertL(&observer, 0) : 
-                             User::Leave(KErrAlreadyExists);
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-EXPORT_C void CTsWindowGroupsMonitor::Cancel(MTsWindowGroupsObserver & observer)
-{
-    const TInt offset(mObservers.Find(&observer));
-    if (KErrNotFound != offset) {
-        mObservers.Remove(offset);
-    }
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CTsWindowGroupsMonitor::RunL()
-{
-    User::LeaveIfError(iStatus.Int());
-    ProvideEventL();
-    Subscribe();
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CTsWindowGroupsMonitor::DoCancel()
-{
-    if (IsActive()) {
-        mResources.WsSession().EventReadyCancel();
-    }
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-TInt CTsWindowGroupsMonitor::RunError(TInt error)
-{
-    if (!IsActive() && KErrCancel != error) {
-        Subscribe();
-    }
-    return KErrNone;
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CTsWindowGroupsMonitor::Subscribe()
-{
-    mResources.WsSession().EventReady( &iStatus );
-    SetActive();
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CTsWindowGroupsMonitor::ProvideEventL()
-{
-    TWsEvent wsEvent;
-    mResources.WsSession().GetEvent(wsEvent);
-    for (TInt iter(0); iter < mObservers.Count(); ++iter) {
-        ProvideEventL(wsEvent, *mObservers[iter]);
-    }
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CTsWindowGroupsMonitor::ProvideEventL(TWsEvent event, 
-                                          MTsWindowGroupsObserver &observer)
-{
-    RArray<RWsSession::TWindowGroupChainInfo> wgInfo;
-    CleanupClosePushL(wgInfo);
-    switch(event.Type()) {
-    case EEventWindowGroupListChanged:
-        User::LeaveIfError(mResources.WsSession().WindowGroupList(0, &wgInfo));
-        observer.HandleWindowGroupChanged(mResources, wgInfo.Array());
-        break;
-    }
-    CleanupStack::PopAndDestroy(&wgInfo);
-}
--- a/activityfw/tsutils/src/tswindowgroupsobserver.cpp	Wed Aug 18 10:39:24 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +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 "tswindowgroupsobserver.h"
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-EXPORT_C CTsWindowGroupsObserver::CTsWindowGroupsObserver(MTsWindowGroupsMonitor & monitor)
-:
-    mMonitor(monitor)
-{}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-EXPORT_C void CTsWindowGroupsObserver::BaseConstructL()
-{
-    mMonitor.SubscribeL(*this);
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-EXPORT_C CTsWindowGroupsObserver::~CTsWindowGroupsObserver()
-{
-    mMonitor.Cancel(*this);
-}
--- a/activityfw/tsutils/tsutils.pro	Wed Aug 18 10:39:24 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +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:
-#
-TEMPLATE = subdirs
-
-BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include \"group/bld.inf\""
--- a/contentstorage/caclient/bwins/caclientu.def	Wed Aug 18 10:39:24 2010 +0300
+++ b/contentstorage/caclient/bwins/caclientu.def	Mon Sep 13 13:26:33 2010 +0300
@@ -19,164 +19,164 @@
 	?setDescription@CaEntry@@QAEXABVQString@@_N@Z @ 18 NONAME ; void CaEntry::setDescription(class QString const &, bool)
 	??0CaQuery@@QAE@XZ @ 19 NONAME ; CaQuery::CaQuery(void)
 	?setIconSize@CaItemModel@@QAEXABVQSizeF@@@Z @ 20 NONAME ; void CaItemModel::setIconSize(class QSizeF const &)
-	?flagsOff@CaQuery@@QBE?AV?$QFlags@W4EntryFlag@@@@XZ @ 21 NONAME ; class QFlags<enum EntryFlag> CaQuery::flagsOff(void) const
-	?skinId@CaIconDescription@@QBE?AVQString@@XZ @ 22 NONAME ; class QString CaIconDescription::skinId(void) const
-	?setParentId@CaQuery@@QAEXH@Z @ 23 NONAME ; void CaQuery::setParentId(int)
-	?removeEntriesFromGroup@CaService@@QBE_NABVCaEntry@@ABV?$QList@V?$QSharedPointer@VCaEntry@@@@@@@Z @ 24 NONAME ; bool CaService::removeEntriesFromGroup(class CaEntry const &, class QList<class QSharedPointer<class CaEntry> > const &) const
-	?qt_metacall@CaClientNotifierProxy@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 25 NONAME ; int CaClientNotifierProxy::qt_metacall(enum QMetaObject::Call, int, void * *)
-	??_ECaItemModel@@UAE@I@Z @ 26 NONAME ; CaItemModel::~CaItemModel(unsigned int)
-	?setSecondLineVisibility@CaItemModel@@QAEX_N@Z @ 27 NONAME ; void CaItemModel::setSecondLineVisibility(bool)
-	?secondLineVisibility@CaItemModel@@QBE_NXZ @ 28 NONAME ; bool CaItemModel::secondLineVisibility(void) const
-	?instance@CaService@@SA?AV?$QSharedPointer@VCaService@@@@XZ @ 29 NONAME ; class QSharedPointer<class CaService> CaService::instance(void)
-	??1CaIconDescription@@QAE@XZ @ 30 NONAME ; CaIconDescription::~CaIconDescription(void)
-	??_ECaNotifier@@UAE@I@Z @ 31 NONAME ; CaNotifier::~CaNotifier(unsigned int)
-	?removeEntriesFromGroup@CaService@@QBE_NHABV?$QList@H@@@Z @ 32 NONAME ; bool CaService::removeEntriesFromGroup(int, class QList<int> const &) const
-	?appendEntriesToGroup@CaService@@QBE_NHABV?$QList@H@@@Z @ 33 NONAME ; bool CaService::appendEntriesToGroup(int, class QList<int> const &) const
-	?createNotifier@CaService@@QBEPAVCaNotifier@@ABVCaNotifierFilter@@@Z @ 34 NONAME ; class CaNotifier * CaService::createNotifier(class CaNotifierFilter const &) const
-	?setSkinId@CaIconDescription@@QAEXABVQString@@@Z @ 35 NONAME ; void CaIconDescription::setSkinId(class QString const &)
-	?metaObject@CaClientNotifierProxy@@UBEPBUQMetaObject@@XZ @ 36 NONAME ; struct QMetaObject const * CaClientNotifierProxy::metaObject(void) const
-	?m_instance@CaService@@0V?$QWeakPointer@VCaService@@@@A @ 37 NONAME ; class QWeakPointer<class CaService> CaService::m_instance
-	?getEntryRole@CaNotifierFilter@@QBE?AV?$QFlags@W4EntryRole@@@@XZ @ 38 NONAME ; class QFlags<enum EntryRole> CaNotifierFilter::getEntryRole(void) const
-	?root@CaItemModel@@QBE?AVQModelIndex@@XZ @ 39 NONAME ; class QModelIndex CaItemModel::root(void) const
-	?prependEntryToGroup@CaService@@QBE_NABVCaEntry@@0@Z @ 40 NONAME ; bool CaService::prependEntryToGroup(class CaEntry const &, class CaEntry const &) const
-	??1CaQuery@@QAE@XZ @ 41 NONAME ; CaQuery::~CaQuery(void)
-	?setCount@CaQuery@@QAEXI@Z @ 42 NONAME ; void CaQuery::setCount(unsigned int)
-	?id@CaIconDescription@@QBEHXZ @ 43 NONAME ; int CaIconDescription::id(void) const
-	?getEntries@CaService@@QBE?AV?$QList@V?$QSharedPointer@VCaEntry@@@@@@ABVCaQuery@@@Z @ 44 NONAME ; class QList<class QSharedPointer<class CaEntry> > CaService::getEntries(class CaQuery const &) const
-	?trUtf8@CaNotifier@@SA?AVQString@@PBD0@Z @ 45 NONAME ; class QString CaNotifier::trUtf8(char const *, char const *)
-	??0CaNotifier@@QAE@PAVCaNotifierPrivate@@@Z @ 46 NONAME ; CaNotifier::CaNotifier(class CaNotifierPrivate *)
-	?trUtf8@CaNotifier@@SA?AVQString@@PBD0H@Z @ 47 NONAME ; class QString CaNotifier::trUtf8(char const *, char const *, int)
-	?getStaticMetaObject@CaItemModel@@SAABUQMetaObject@@XZ @ 48 NONAME ; struct QMetaObject const & CaItemModel::getStaticMetaObject(void)
-	?trUtf8@CaItemModel@@SA?AVQString@@PBD0@Z @ 49 NONAME ; class QString CaItemModel::trUtf8(char const *, char const *)
-	?newSession@CaClientNotifierProxy@@AAEPAVRCaClientNotifierSession@@AAH@Z @ 50 NONAME ; class RCaClientNotifierSession * CaClientNotifierProxy::newSession(int &)
-	?entryChanged@CaNotifier@@IAEXABVCaEntry@@W4ChangeType@@@Z @ 51 NONAME ; void CaNotifier::entryChanged(class CaEntry const &, enum ChangeType)
-	?attribute@CaEntry@@QBE?AVQString@@ABV2@@Z @ 52 NONAME ; class QString CaEntry::attribute(class QString const &) const
-	?metaObject@CaService@@UBEPBUQMetaObject@@XZ @ 53 NONAME ; struct QMetaObject const * CaService::metaObject(void) const
-	?entryChanged@CaNotifier@@IAEXHW4ChangeType@@@Z @ 54 NONAME ; void CaNotifier::entryChanged(int, enum ChangeType)
-	?getStaticMetaObject@CaClientNotifierProxy@@SAABUQMetaObject@@XZ @ 55 NONAME ; struct QMetaObject const & CaClientNotifierProxy::getStaticMetaObject(void)
-	?registerNotifier@CaClientNotifierProxy@@QAEHPBVCaNotifierFilter@@W4NotifierType@CaNotifierPrivate@@PBVIDataObserver@@@Z @ 56 NONAME ; int CaClientNotifierProxy::registerNotifier(class CaNotifierFilter const *, enum CaNotifierPrivate::NotifierType, class IDataObserver const *)
-	??_ECaClientNotifierProxy@@UAE@I@Z @ 57 NONAME ; CaClientNotifierProxy::~CaClientNotifierProxy(unsigned int)
-	??0CaNotifierFilter@@QAE@XZ @ 58 NONAME ; CaNotifierFilter::CaNotifierFilter(void)
-	?childId@CaQuery@@QBEHXZ @ 59 NONAME ; int CaQuery::childId(void) const
-	?removeEntries@CaService@@QBE_NABV?$QList@H@@@Z @ 60 NONAME ; bool CaService::removeEntries(class QList<int> const &) const
-	?entryTouched@CaNotifier@@IAEXH@Z @ 61 NONAME ; void CaNotifier::entryTouched(int)
-	?customSort@CaService@@QBE_NHAAV?$QList@H@@@Z @ 62 NONAME ; bool CaService::customSort(int, class QList<int> &) const
-	?groupContentChanged@CaNotifier@@IAEXH@Z @ 63 NONAME ; void CaNotifier::groupContentChanged(int)
-	?tr@CaNotifier@@SA?AVQString@@PBD0@Z @ 64 NONAME ; class QString CaNotifier::tr(char const *, char const *)
-	?setChildId@CaQuery@@QAEXH@Z @ 65 NONAME ; void CaQuery::setChildId(int)
-	?findSession@CaClientNotifierProxy@@AAEPAVRCaClientNotifierSession@@XZ @ 66 NONAME ; class RCaClientNotifierSession * CaClientNotifierProxy::findSession(void)
-	??1CaItemModel@@UAE@XZ @ 67 NONAME ; CaItemModel::~CaItemModel(void)
-	?attributes@CaEntry@@QBE?AV?$QMap@VQString@@V1@@@XZ @ 68 NONAME ; class QMap<class QString, class QString> CaEntry::attributes(void) const
-	?connectNotify@CaNotifier@@MAEXPBD@Z @ 69 NONAME ; void CaNotifier::connectNotify(char const *)
-	?setEntryRole@CaNotifierFilter@@QAEXV?$QFlags@W4EntryRole@@@@@Z @ 70 NONAME ; void CaNotifierFilter::setEntryRole(class QFlags<enum EntryRole>)
-	??1CaClientNotifierProxy@@UAE@XZ @ 71 NONAME ; CaClientNotifierProxy::~CaClientNotifierProxy(void)
-	?staticMetaObject@CaItemModel@@2UQMetaObject@@B @ 72 NONAME ; struct QMetaObject const CaItemModel::staticMetaObject
-	?role@CaEntry@@QBE?AW4EntryRole@@XZ @ 73 NONAME ; enum EntryRole CaEntry::role(void) const
-	?qt_metacast@CaNotifier@@UAEPAXPBD@Z @ 74 NONAME ; void * CaNotifier::qt_metacast(char const *)
-	?text@CaEntry@@QBE?AVQString@@XZ @ 75 NONAME ; class QString CaEntry::text(void) const
-	?tr@CaClientNotifierProxy@@SA?AVQString@@PBD0@Z @ 76 NONAME ; class QString CaClientNotifierProxy::tr(char const *, char const *)
-	?getUninstallingEntriesIds@CaItemModel@@QAE?AV?$QList@H@@H@Z @ 77 NONAME ; class QList<int> CaItemModel::getUninstallingEntriesIds(int)
-	?columnCount@CaItemModel@@UBEHABVQModelIndex@@@Z @ 78 NONAME ; int CaItemModel::columnCount(class QModelIndex const &) const
-	?entryChanged@CaService@@IAEXABVCaEntry@@W4ChangeType@@@Z @ 79 NONAME ; void CaService::entryChanged(class CaEntry const &, enum ChangeType)
-	?scrollTo@CaItemModel@@IAEXHW4ScrollHint@QAbstractItemView@@@Z @ 80 NONAME ; void CaItemModel::scrollTo(int, enum QAbstractItemView::ScrollHint)
-	??0CaIconDescription@@QAE@XZ @ 81 NONAME ; CaIconDescription::CaIconDescription(void)
-	?attribute@CaQuery@@QBE?AVQString@@ABV2@@Z @ 82 NONAME ; class QString CaQuery::attribute(class QString const &) const
-	?staticMetaObject@CaClientNotifierProxy@@2UQMetaObject@@B @ 83 NONAME ; struct QMetaObject const CaClientNotifierProxy::staticMetaObject
-	??_ECaNotifierFilter@@UAE@I@Z @ 84 NONAME ; CaNotifierFilter::~CaNotifierFilter(unsigned int)
-	?trUtf8@CaClientNotifierProxy@@SA?AVQString@@PBD0@Z @ 85 NONAME ; class QString CaClientNotifierProxy::trUtf8(char const *, char const *)
-	?getStaticMetaObject@CaService@@SAABUQMetaObject@@XZ @ 86 NONAME ; struct QMetaObject const & CaService::getStaticMetaObject(void)
-	?touch@CaService@@QBE_NABVCaEntry@@@Z @ 87 NONAME ; bool CaService::touch(class CaEntry const &) const
-	?getEntries@CaService@@QBE?AV?$QList@V?$QSharedPointer@VCaEntry@@@@@@ABV?$QList@H@@@Z @ 88 NONAME ; class QList<class QSharedPointer<class CaEntry> > CaService::getEntries(class QList<int> const &) const
-	??0CaNotifierFilter@@QAE@ABV0@@Z @ 89 NONAME ; CaNotifierFilter::CaNotifierFilter(class CaNotifierFilter const &)
-	?getTypeNames@CaNotifierFilter@@QBE?AVQStringList@@XZ @ 90 NONAME ; class QStringList CaNotifierFilter::getTypeNames(void) const
-	?entryTouched@CaService@@IAEXH@Z @ 91 NONAME ; void CaService::entryTouched(int)
-	?disconnectNotify@CaNotifier@@MAEXPBD@Z @ 92 NONAME ; void CaNotifier::disconnectNotify(char const *)
-	?removeEntryFromGroup@CaService@@QBE_NABVCaEntry@@0@Z @ 93 NONAME ; bool CaService::removeEntryFromGroup(class CaEntry const &, class CaEntry const &) const
-	?setId@CaIconDescription@@AAEXH@Z @ 94 NONAME ; void CaIconDescription::setId(int)
-	?setFilename@CaIconDescription@@QAEXABVQString@@@Z @ 95 NONAME ; void CaIconDescription::setFilename(class QString const &)
-	?setEntryTypeName@CaEntry@@QAEXABVQString@@@Z @ 96 NONAME ; void CaEntry::setEntryTypeName(class QString const &)
-	??4CaQuery@@QAEAAV0@ABV0@@Z @ 97 NONAME ; class CaQuery & CaQuery::operator=(class CaQuery const &)
-	??1CaNotifierFilter@@UAE@XZ @ 98 NONAME ; CaNotifierFilter::~CaNotifierFilter(void)
-	?entryTypeName@CaEntry@@QBE?AVQString@@XZ @ 99 NONAME ; class QString CaEntry::entryTypeName(void) const
-	?trUtf8@CaService@@SA?AVQString@@PBD0@Z @ 100 NONAME ; class QString CaService::trUtf8(char const *, char const *)
-	?groupContentChanged@CaService@@IAEXH@Z @ 101 NONAME ; void CaService::groupContentChanged(int)
-	?connectSessions@CaClientNotifierProxy@@QAEXXZ @ 102 NONAME ; void CaClientNotifierProxy::connectSessions(void)
-	?insertEntriesIntoGroup@CaService@@QBE_NABVCaEntry@@ABV?$QList@V?$QSharedPointer@VCaEntry@@@@@@H@Z @ 103 NONAME ; bool CaService::insertEntriesIntoGroup(class CaEntry const &, class QList<class QSharedPointer<class CaEntry> > const &, int) const
-	??4CaIconDescription@@QAEAAV0@ABV0@@Z @ 104 NONAME ; class CaIconDescription & CaIconDescription::operator=(class CaIconDescription const &)
-	?count@CaQuery@@QBEIXZ @ 105 NONAME ; unsigned int CaQuery::count(void) const
-	?appendEntriesToGroup@CaService@@QBE_NABVCaEntry@@ABV?$QList@V?$QSharedPointer@VCaEntry@@@@@@@Z @ 106 NONAME ; bool CaService::appendEntriesToGroup(class CaEntry const &, class QList<class QSharedPointer<class CaEntry> > const &) const
-	?id@CaEntry@@QBEHXZ @ 107 NONAME ; int CaEntry::id(void) const
-	?removeEntries@CaService@@QBE_NABV?$QList@V?$QSharedPointer@VCaEntry@@@@@@@Z @ 108 NONAME ; bool CaService::removeEntries(class QList<class QSharedPointer<class CaEntry> > const &) const
-	?updateModel@CaItemModel@@QAEXXZ @ 109 NONAME ; void CaItemModel::updateModel(void)
-	?setFlags@CaEntry@@QAEXV?$QFlags@W4EntryFlag@@@@@Z @ 110 NONAME ; void CaEntry::setFlags(class QFlags<enum EntryFlag>)
-	?insertEntryIntoGroup@CaService@@QBE_NHHH@Z @ 111 NONAME ; bool CaService::insertEntryIntoGroup(int, int, int) const
-	?qt_metacast@CaService@@UAEPAXPBD@Z @ 112 NONAME ; void * CaService::qt_metacast(char const *)
-	?setFlagsOn@CaItemModel@@QAEXABV?$QFlags@W4EntryFlag@@@@@Z @ 113 NONAME ; void CaItemModel::setFlagsOn(class QFlags<enum EntryFlag> const &)
-	??0CaQuery@@QAE@ABV0@@Z @ 114 NONAME ; CaQuery::CaQuery(class CaQuery const &)
-	?iconDescription@CaEntry@@QBE?AVCaIconDescription@@XZ @ 115 NONAME ; class CaIconDescription CaEntry::iconDescription(void) const
-	?trUtf8@CaService@@SA?AVQString@@PBD0H@Z @ 116 NONAME ; class QString CaService::trUtf8(char const *, char const *, int)
-	?createEntry@CaService@@QBE?AV?$QSharedPointer@VCaEntry@@@@ABVCaEntry@@@Z @ 117 NONAME ; class QSharedPointer<class CaEntry> CaService::createEntry(class CaEntry const &) const
-	??0CaNotifierFilter@@QAE@ABVCaQuery@@@Z @ 118 NONAME ; CaNotifierFilter::CaNotifierFilter(class CaQuery const &)
-	?setEntryTypeNames@CaQuery@@QAEXABVQStringList@@@Z @ 119 NONAME ; void CaQuery::setEntryTypeNames(class QStringList const &)
-	?updateProgress@CaItemModel@@QAEXHH@Z @ 120 NONAME ; void CaItemModel::updateProgress(int, int)
-	?qt_metacall@CaItemModel@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 121 NONAME ; int CaItemModel::qt_metacall(enum QMetaObject::Call, int, void * *)
-	?setText@CaEntry@@QAEXABVQString@@_N@Z @ 122 NONAME ; void CaEntry::setText(class QString const &, bool)
-	?removeAttribute@CaQuery@@QAEXABVQString@@@Z @ 123 NONAME ; void CaQuery::removeAttribute(class QString const &)
-	?insertEntryIntoGroup@CaService@@QBE_NABVCaEntry@@0H@Z @ 124 NONAME ; bool CaService::insertEntryIntoGroup(class CaEntry const &, class CaEntry const &, int) const
-	?setApplicationId@CaIconDescription@@QAEXABVQString@@@Z @ 125 NONAME ; void CaIconDescription::setApplicationId(class QString const &)
-	?appendEntryToGroup@CaService@@QBE_NABVCaEntry@@0@Z @ 126 NONAME ; bool CaService::appendEntryToGroup(class CaEntry const &, class CaEntry const &) const
-	?executeCommand@CaService@@QBEHHABVQString@@@Z @ 127 NONAME ; int CaService::executeCommand(int, class QString const &) const
-	?setAttribute@CaQuery@@QAEXABVQString@@0@Z @ 128 NONAME ; void CaQuery::setAttribute(class QString const &, class QString const &)
-	?attributes@CaQuery@@QBE?AV?$QMap@VQString@@V1@@@XZ @ 129 NONAME ; class QMap<class QString, class QString> CaQuery::attributes(void) const
-	?updateEntry@CaService@@QBE_NABVCaEntry@@@Z @ 130 NONAME ; bool CaService::updateEntry(class CaEntry const &) const
-	?setAttribute@CaEntry@@QAEXABVQString@@0@Z @ 131 NONAME ; void CaEntry::setAttribute(class QString const &, class QString const &)
-	?unregisterNotifier@CaClientNotifierProxy@@QAEXABVCaNotifierFilter@@W4NotifierType@CaNotifierPrivate@@@Z @ 132 NONAME ; void CaClientNotifierProxy::unregisterNotifier(class CaNotifierFilter const &, enum CaNotifierPrivate::NotifierType)
-	?setParentId@CaItemModel@@QAEXH@Z @ 133 NONAME ; void CaItemModel::setParentId(int)
-	?countChange@CaItemModel@@IAEXXZ @ 134 NONAME ; void CaItemModel::countChange(void)
-	?metaObject@CaItemModel@@UBEPBUQMetaObject@@XZ @ 135 NONAME ; struct QMetaObject const * CaItemModel::metaObject(void) const
-	?makeIcon@CaEntry@@QBE?AVHbIcon@@ABVQSizeF@@@Z @ 136 NONAME ; class HbIcon CaEntry::makeIcon(class QSizeF const &) const
-	?tr@CaItemModel@@SA?AVQString@@PBD0H@Z @ 137 NONAME ; class QString CaItemModel::tr(char const *, char const *, int)
-	?setFlagsOff@CaQuery@@QAEXABV?$QFlags@W4EntryFlag@@@@@Z @ 138 NONAME ; void CaQuery::setFlagsOff(class QFlags<enum EntryFlag> const &)
-	?getEntry@CaService@@QBE?AV?$QSharedPointer@VCaEntry@@@@H@Z @ 139 NONAME ; class QSharedPointer<class CaEntry> CaService::getEntry(int) const
-	??0CaEntry@@QAE@ABV0@@Z @ 140 NONAME ; CaEntry::CaEntry(class CaEntry const &)
-	?rowCount@CaItemModel@@UBEHABVQModelIndex@@@Z @ 141 NONAME ; int CaItemModel::rowCount(class QModelIndex const &) const
-	?clear@CaQuery@@QAEXXZ @ 142 NONAME ; void CaQuery::clear(void)
-	?prependEntryToGroup@CaService@@QBE_NHH@Z @ 143 NONAME ; bool CaService::prependEntryToGroup(int, int) const
-	?qt_metacast@CaClientNotifierProxy@@UAEPAXPBD@Z @ 144 NONAME ; void * CaClientNotifierProxy::qt_metacast(char const *)
-	?getEntryIcon@CaMenuIconUtility@@SA?AVHbIcon@@ABVCaEntry@@ABVQSizeF@@@Z @ 145 NONAME ; class HbIcon CaMenuIconUtility::getEntryIcon(class CaEntry const &, class QSizeF const &)
-	?tr@CaService@@SA?AVQString@@PBD0H@Z @ 146 NONAME ; class QString CaService::tr(char const *, char const *, int)
-	?entryRoles@CaQuery@@QBE?AV?$QFlags@W4EntryRole@@@@XZ @ 147 NONAME ; class QFlags<enum EntryRole> CaQuery::entryRoles(void) const
-	?qt_metacall@CaService@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 148 NONAME ; int CaService::qt_metacall(enum QMetaObject::Call, int, void * *)
-	??4CaNotifierFilter@@QAEAAV0@ABV0@@Z @ 149 NONAME ; class CaNotifierFilter & CaNotifierFilter::operator=(class CaNotifierFilter const &)
-	??0CaItemModel@@QAE@ABVCaQuery@@PAVQObject@@@Z @ 150 NONAME ; CaItemModel::CaItemModel(class CaQuery const &, class QObject *)
-	?setFlagsOff@CaItemModel@@QAEXABV?$QFlags@W4EntryFlag@@@@@Z @ 151 NONAME ; void CaItemModel::setFlagsOff(class QFlags<enum EntryFlag> const &)
-	?getSort@CaQuery@@QBEXAAW4SortAttribute@@AAW4SortOrder@Qt@@@Z @ 152 NONAME ; void CaQuery::getSort(enum SortAttribute &, enum Qt::SortOrder &) const
-	?parentId@CaQuery@@QBEHXZ @ 153 NONAME ; int CaQuery::parentId(void) const
-	?setEntryRoles@CaQuery@@QAEXV?$QFlags@W4EntryRole@@@@@Z @ 154 NONAME ; void CaQuery::setEntryRoles(class QFlags<enum EntryRole>)
-	??_ECaEntry@@UAE@I@Z @ 155 NONAME ; CaEntry::~CaEntry(unsigned int)
-	??0CaService@@AAE@PAVQObject@@@Z @ 156 NONAME ; CaService::CaService(class QObject *)
-	??1CaService@@EAE@XZ @ 157 NONAME ; CaService::~CaService(void)
-	?flagsOn@CaQuery@@QBE?AV?$QFlags@W4EntryFlag@@@@XZ @ 158 NONAME ; class QFlags<enum EntryFlag> CaQuery::flagsOn(void) const
-	?description@CaEntry@@QBE?AVQString@@XZ @ 159 NONAME ; class QString CaEntry::description(void) const
-	?metaObject@CaNotifier@@UBEPBUQMetaObject@@XZ @ 160 NONAME ; struct QMetaObject const * CaNotifier::metaObject(void) const
-	?data@CaItemModel@@UBE?AVQVariant@@ABVQModelIndex@@H@Z @ 161 NONAME ; class QVariant CaItemModel::data(class QModelIndex const &, int) const
-	??0CaIconDescription@@QAE@ABV0@@Z @ 162 NONAME ; CaIconDescription::CaIconDescription(class CaIconDescription const &)
-	?staticMetaObject@CaService@@2UQMetaObject@@B @ 163 NONAME ; struct QMetaObject const CaService::staticMetaObject
-	?removeEntry@CaService@@QBE_NH@Z @ 164 NONAME ; bool CaService::removeEntry(int) const
-	?addEntryTypeName@CaQuery@@QAEXABVQString@@@Z @ 165 NONAME ; void CaQuery::addEntryTypeName(class QString const &)
-	?isAutoUpdate@CaItemModel@@QBE_NXZ @ 166 NONAME ; bool CaItemModel::isAutoUpdate(void) const
-	??1CaEntry@@UAE@XZ @ 167 NONAME ; CaEntry::~CaEntry(void)
-	?prependEntriesToGroup@CaService@@QBE_NABVCaEntry@@ABV?$QList@V?$QSharedPointer@VCaEntry@@@@@@@Z @ 168 NONAME ; bool CaService::prependEntriesToGroup(class CaEntry const &, class QList<class QSharedPointer<class CaEntry> > const &) const
-	?qt_metacall@CaNotifier@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 169 NONAME ; int CaNotifier::qt_metacall(enum QMetaObject::Call, int, void * *)
-	?setSort@CaItemModel@@QAEXW4SortAttribute@@W4SortOrder@Qt@@@Z @ 170 NONAME ; void CaItemModel::setSort(enum SortAttribute, enum Qt::SortOrder)
-	?removeEntry@CaService@@QBE_NABVCaEntry@@@Z @ 171 NONAME ; bool CaService::removeEntry(class CaEntry const &) const
-	?setId@CaEntry@@AAEXH@Z @ 172 NONAME ; void CaEntry::setId(int)
-	?staticMetaObject@CaNotifier@@2UQMetaObject@@B @ 173 NONAME ; struct QMetaObject const CaNotifier::staticMetaObject
-	?applicationId@CaIconDescription@@QBE?AVQString@@XZ @ 174 NONAME ; class QString CaIconDescription::applicationId(void) const
-	?getIds@CaNotifierFilter@@QBE?AV?$QList@H@@XZ @ 175 NONAME ; class QList<int> CaNotifierFilter::getIds(void) const
-	?setIds@CaNotifierFilter@@QAEXABV?$QList@H@@@Z @ 176 NONAME ; void CaNotifierFilter::setIds(class QList<int> const &)
-	??0CaEntry@@QAE@W4EntryRole@@@Z @ 177 NONAME ; CaEntry::CaEntry(enum EntryRole)
-	?executeCommand@CaService@@QBEHABVCaEntry@@ABVQString@@@Z @ 178 NONAME ; int CaService::executeCommand(class CaEntry const &, class QString const &) const
+	?executeCommand@CaService@@QBEHHABVQString@@PAVQObject@@PBD@Z @ 21 NONAME ; int CaService::executeCommand(int, class QString const &, class QObject *, char const *) const
+	?flagsOff@CaQuery@@QBE?AV?$QFlags@W4EntryFlag@@@@XZ @ 22 NONAME ; class QFlags<enum EntryFlag> CaQuery::flagsOff(void) const
+	?skinId@CaIconDescription@@QBE?AVQString@@XZ @ 23 NONAME ; class QString CaIconDescription::skinId(void) const
+	?setParentId@CaQuery@@QAEXH@Z @ 24 NONAME ; void CaQuery::setParentId(int)
+	?removeEntriesFromGroup@CaService@@QBE_NABVCaEntry@@ABV?$QList@V?$QSharedPointer@VCaEntry@@@@@@@Z @ 25 NONAME ; bool CaService::removeEntriesFromGroup(class CaEntry const &, class QList<class QSharedPointer<class CaEntry> > const &) const
+	?qt_metacall@CaClientNotifierProxy@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 26 NONAME ; int CaClientNotifierProxy::qt_metacall(enum QMetaObject::Call, int, void * *)
+	??_ECaItemModel@@UAE@I@Z @ 27 NONAME ; CaItemModel::~CaItemModel(unsigned int)
+	?setSecondLineVisibility@CaItemModel@@QAEX_N@Z @ 28 NONAME ; void CaItemModel::setSecondLineVisibility(bool)
+	?secondLineVisibility@CaItemModel@@QBE_NXZ @ 29 NONAME ; bool CaItemModel::secondLineVisibility(void) const
+	?instance@CaService@@SA?AV?$QSharedPointer@VCaService@@@@XZ @ 30 NONAME ; class QSharedPointer<class CaService> CaService::instance(void)
+	??1CaIconDescription@@QAE@XZ @ 31 NONAME ; CaIconDescription::~CaIconDescription(void)
+	??_ECaNotifier@@UAE@I@Z @ 32 NONAME ; CaNotifier::~CaNotifier(unsigned int)
+	?removeEntriesFromGroup@CaService@@QBE_NHABV?$QList@H@@@Z @ 33 NONAME ; bool CaService::removeEntriesFromGroup(int, class QList<int> const &) const
+	?appendEntriesToGroup@CaService@@QBE_NHABV?$QList@H@@@Z @ 34 NONAME ; bool CaService::appendEntriesToGroup(int, class QList<int> const &) const
+	?createNotifier@CaService@@QBEPAVCaNotifier@@ABVCaNotifierFilter@@@Z @ 35 NONAME ; class CaNotifier * CaService::createNotifier(class CaNotifierFilter const &) const
+	?setSkinId@CaIconDescription@@QAEXABVQString@@@Z @ 36 NONAME ; void CaIconDescription::setSkinId(class QString const &)
+	?metaObject@CaClientNotifierProxy@@UBEPBUQMetaObject@@XZ @ 37 NONAME ; struct QMetaObject const * CaClientNotifierProxy::metaObject(void) const
+	?m_instance@CaService@@0V?$QWeakPointer@VCaService@@@@A @ 38 NONAME ; class QWeakPointer<class CaService> CaService::m_instance
+	?getEntryRole@CaNotifierFilter@@QBE?AV?$QFlags@W4EntryRole@@@@XZ @ 39 NONAME ; class QFlags<enum EntryRole> CaNotifierFilter::getEntryRole(void) const
+	?root@CaItemModel@@QBE?AVQModelIndex@@XZ @ 40 NONAME ; class QModelIndex CaItemModel::root(void) const
+	?prependEntryToGroup@CaService@@QBE_NABVCaEntry@@0@Z @ 41 NONAME ; bool CaService::prependEntryToGroup(class CaEntry const &, class CaEntry const &) const
+	??1CaQuery@@QAE@XZ @ 42 NONAME ; CaQuery::~CaQuery(void)
+	?setCount@CaQuery@@QAEXI@Z @ 43 NONAME ; void CaQuery::setCount(unsigned int)
+	?id@CaIconDescription@@QBEHXZ @ 44 NONAME ; int CaIconDescription::id(void) const
+	?getEntries@CaService@@QBE?AV?$QList@V?$QSharedPointer@VCaEntry@@@@@@ABVCaQuery@@@Z @ 45 NONAME ; class QList<class QSharedPointer<class CaEntry> > CaService::getEntries(class CaQuery const &) const
+	?trUtf8@CaNotifier@@SA?AVQString@@PBD0@Z @ 46 NONAME ; class QString CaNotifier::trUtf8(char const *, char const *)
+	??0CaNotifier@@QAE@PAVCaNotifierPrivate@@@Z @ 47 NONAME ; CaNotifier::CaNotifier(class CaNotifierPrivate *)
+	?trUtf8@CaNotifier@@SA?AVQString@@PBD0H@Z @ 48 NONAME ; class QString CaNotifier::trUtf8(char const *, char const *, int)
+	?getStaticMetaObject@CaItemModel@@SAABUQMetaObject@@XZ @ 49 NONAME ; struct QMetaObject const & CaItemModel::getStaticMetaObject(void)
+	?trUtf8@CaItemModel@@SA?AVQString@@PBD0@Z @ 50 NONAME ; class QString CaItemModel::trUtf8(char const *, char const *)
+	?newSession@CaClientNotifierProxy@@AAEPAVRCaClientNotifierSession@@AAH@Z @ 51 NONAME ; class RCaClientNotifierSession * CaClientNotifierProxy::newSession(int &)
+	?entryChanged@CaNotifier@@IAEXABVCaEntry@@W4ChangeType@@@Z @ 52 NONAME ; void CaNotifier::entryChanged(class CaEntry const &, enum ChangeType)
+	?attribute@CaEntry@@QBE?AVQString@@ABV2@@Z @ 53 NONAME ; class QString CaEntry::attribute(class QString const &) const
+	?metaObject@CaService@@UBEPBUQMetaObject@@XZ @ 54 NONAME ; struct QMetaObject const * CaService::metaObject(void) const
+	?entryChanged@CaNotifier@@IAEXHW4ChangeType@@@Z @ 55 NONAME ; void CaNotifier::entryChanged(int, enum ChangeType)
+	?getStaticMetaObject@CaClientNotifierProxy@@SAABUQMetaObject@@XZ @ 56 NONAME ; struct QMetaObject const & CaClientNotifierProxy::getStaticMetaObject(void)
+	?registerNotifier@CaClientNotifierProxy@@QAEHPBVCaNotifierFilter@@W4NotifierType@CaNotifierPrivate@@PBVIDataObserver@@@Z @ 57 NONAME ; int CaClientNotifierProxy::registerNotifier(class CaNotifierFilter const *, enum CaNotifierPrivate::NotifierType, class IDataObserver const *)
+	??_ECaClientNotifierProxy@@UAE@I@Z @ 58 NONAME ; CaClientNotifierProxy::~CaClientNotifierProxy(unsigned int)
+	??0CaNotifierFilter@@QAE@XZ @ 59 NONAME ; CaNotifierFilter::CaNotifierFilter(void)
+	?childId@CaQuery@@QBEHXZ @ 60 NONAME ; int CaQuery::childId(void) const
+	?removeEntries@CaService@@QBE_NABV?$QList@H@@@Z @ 61 NONAME ; bool CaService::removeEntries(class QList<int> const &) const
+	?entryTouched@CaNotifier@@IAEXH@Z @ 62 NONAME ; void CaNotifier::entryTouched(int)
+	?customSort@CaService@@QBE_NHAAV?$QList@H@@@Z @ 63 NONAME ; bool CaService::customSort(int, class QList<int> &) const
+	?groupContentChanged@CaNotifier@@IAEXH@Z @ 64 NONAME ; void CaNotifier::groupContentChanged(int)
+	?tr@CaNotifier@@SA?AVQString@@PBD0@Z @ 65 NONAME ; class QString CaNotifier::tr(char const *, char const *)
+	?setChildId@CaQuery@@QAEXH@Z @ 66 NONAME ; void CaQuery::setChildId(int)
+	?findSession@CaClientNotifierProxy@@AAEPAVRCaClientNotifierSession@@XZ @ 67 NONAME ; class RCaClientNotifierSession * CaClientNotifierProxy::findSession(void)
+	??1CaItemModel@@UAE@XZ @ 68 NONAME ; CaItemModel::~CaItemModel(void)
+	?attributes@CaEntry@@QBE?AV?$QMap@VQString@@V1@@@XZ @ 69 NONAME ; class QMap<class QString, class QString> CaEntry::attributes(void) const
+	?connectNotify@CaNotifier@@MAEXPBD@Z @ 70 NONAME ; void CaNotifier::connectNotify(char const *)
+	?setEntryRole@CaNotifierFilter@@QAEXV?$QFlags@W4EntryRole@@@@@Z @ 71 NONAME ; void CaNotifierFilter::setEntryRole(class QFlags<enum EntryRole>)
+	??1CaClientNotifierProxy@@UAE@XZ @ 72 NONAME ; CaClientNotifierProxy::~CaClientNotifierProxy(void)
+	?staticMetaObject@CaItemModel@@2UQMetaObject@@B @ 73 NONAME ; struct QMetaObject const CaItemModel::staticMetaObject
+	?role@CaEntry@@QBE?AW4EntryRole@@XZ @ 74 NONAME ; enum EntryRole CaEntry::role(void) const
+	?qt_metacast@CaNotifier@@UAEPAXPBD@Z @ 75 NONAME ; void * CaNotifier::qt_metacast(char const *)
+	?text@CaEntry@@QBE?AVQString@@XZ @ 76 NONAME ; class QString CaEntry::text(void) const
+	?tr@CaClientNotifierProxy@@SA?AVQString@@PBD0@Z @ 77 NONAME ; class QString CaClientNotifierProxy::tr(char const *, char const *)
+	?getUninstallingEntriesIds@CaItemModel@@QAE?AV?$QList@H@@H@Z @ 78 NONAME ; class QList<int> CaItemModel::getUninstallingEntriesIds(int)
+	?columnCount@CaItemModel@@UBEHABVQModelIndex@@@Z @ 79 NONAME ; int CaItemModel::columnCount(class QModelIndex const &) const
+	?entryChanged@CaService@@IAEXABVCaEntry@@W4ChangeType@@@Z @ 80 NONAME ; void CaService::entryChanged(class CaEntry const &, enum ChangeType)
+	?scrollTo@CaItemModel@@IAEXHW4ScrollHint@QAbstractItemView@@@Z @ 81 NONAME ; void CaItemModel::scrollTo(int, enum QAbstractItemView::ScrollHint)
+	??0CaIconDescription@@QAE@XZ @ 82 NONAME ; CaIconDescription::CaIconDescription(void)
+	?attribute@CaQuery@@QBE?AVQString@@ABV2@@Z @ 83 NONAME ; class QString CaQuery::attribute(class QString const &) const
+	?staticMetaObject@CaClientNotifierProxy@@2UQMetaObject@@B @ 84 NONAME ; struct QMetaObject const CaClientNotifierProxy::staticMetaObject
+	??_ECaNotifierFilter@@UAE@I@Z @ 85 NONAME ; CaNotifierFilter::~CaNotifierFilter(unsigned int)
+	?trUtf8@CaClientNotifierProxy@@SA?AVQString@@PBD0@Z @ 86 NONAME ; class QString CaClientNotifierProxy::trUtf8(char const *, char const *)
+	?getStaticMetaObject@CaService@@SAABUQMetaObject@@XZ @ 87 NONAME ; struct QMetaObject const & CaService::getStaticMetaObject(void)
+	?touch@CaService@@QBE_NABVCaEntry@@@Z @ 88 NONAME ; bool CaService::touch(class CaEntry const &) const
+	?getEntries@CaService@@QBE?AV?$QList@V?$QSharedPointer@VCaEntry@@@@@@ABV?$QList@H@@@Z @ 89 NONAME ; class QList<class QSharedPointer<class CaEntry> > CaService::getEntries(class QList<int> const &) const
+	??0CaNotifierFilter@@QAE@ABV0@@Z @ 90 NONAME ; CaNotifierFilter::CaNotifierFilter(class CaNotifierFilter const &)
+	?getTypeNames@CaNotifierFilter@@QBE?AVQStringList@@XZ @ 91 NONAME ; class QStringList CaNotifierFilter::getTypeNames(void) const
+	?entryTouched@CaService@@IAEXH@Z @ 92 NONAME ; void CaService::entryTouched(int)
+	?disconnectNotify@CaNotifier@@MAEXPBD@Z @ 93 NONAME ; void CaNotifier::disconnectNotify(char const *)
+	?removeEntryFromGroup@CaService@@QBE_NABVCaEntry@@0@Z @ 94 NONAME ; bool CaService::removeEntryFromGroup(class CaEntry const &, class CaEntry const &) const
+	?setId@CaIconDescription@@AAEXH@Z @ 95 NONAME ; void CaIconDescription::setId(int)
+	?setFilename@CaIconDescription@@QAEXABVQString@@@Z @ 96 NONAME ; void CaIconDescription::setFilename(class QString const &)
+	?setEntryTypeName@CaEntry@@QAEXABVQString@@@Z @ 97 NONAME ; void CaEntry::setEntryTypeName(class QString const &)
+	??4CaQuery@@QAEAAV0@ABV0@@Z @ 98 NONAME ; class CaQuery & CaQuery::operator=(class CaQuery const &)
+	??1CaNotifierFilter@@UAE@XZ @ 99 NONAME ; CaNotifierFilter::~CaNotifierFilter(void)
+	?entryTypeName@CaEntry@@QBE?AVQString@@XZ @ 100 NONAME ; class QString CaEntry::entryTypeName(void) const
+	?trUtf8@CaService@@SA?AVQString@@PBD0@Z @ 101 NONAME ; class QString CaService::trUtf8(char const *, char const *)
+	?groupContentChanged@CaService@@IAEXH@Z @ 102 NONAME ; void CaService::groupContentChanged(int)
+	?connectSessions@CaClientNotifierProxy@@QAEXXZ @ 103 NONAME ; void CaClientNotifierProxy::connectSessions(void)
+	?insertEntriesIntoGroup@CaService@@QBE_NABVCaEntry@@ABV?$QList@V?$QSharedPointer@VCaEntry@@@@@@H@Z @ 104 NONAME ; bool CaService::insertEntriesIntoGroup(class CaEntry const &, class QList<class QSharedPointer<class CaEntry> > const &, int) const
+	??4CaIconDescription@@QAEAAV0@ABV0@@Z @ 105 NONAME ; class CaIconDescription & CaIconDescription::operator=(class CaIconDescription const &)
+	?count@CaQuery@@QBEIXZ @ 106 NONAME ; unsigned int CaQuery::count(void) const
+	?appendEntriesToGroup@CaService@@QBE_NABVCaEntry@@ABV?$QList@V?$QSharedPointer@VCaEntry@@@@@@@Z @ 107 NONAME ; bool CaService::appendEntriesToGroup(class CaEntry const &, class QList<class QSharedPointer<class CaEntry> > const &) const
+	?id@CaEntry@@QBEHXZ @ 108 NONAME ; int CaEntry::id(void) const
+	?removeEntries@CaService@@QBE_NABV?$QList@V?$QSharedPointer@VCaEntry@@@@@@@Z @ 109 NONAME ; bool CaService::removeEntries(class QList<class QSharedPointer<class CaEntry> > const &) const
+	?updateModel@CaItemModel@@QAEXXZ @ 110 NONAME ; void CaItemModel::updateModel(void)
+	?setFlags@CaEntry@@QAEXV?$QFlags@W4EntryFlag@@@@@Z @ 111 NONAME ; void CaEntry::setFlags(class QFlags<enum EntryFlag>)
+	?insertEntryIntoGroup@CaService@@QBE_NHHH@Z @ 112 NONAME ; bool CaService::insertEntryIntoGroup(int, int, int) const
+	?qt_metacast@CaService@@UAEPAXPBD@Z @ 113 NONAME ; void * CaService::qt_metacast(char const *)
+	?executeCommand@CaService@@QBEHABVCaEntry@@ABVQString@@PAVQObject@@PBD@Z @ 114 NONAME ; int CaService::executeCommand(class CaEntry const &, class QString const &, class QObject *, char const *) const
+	?setFlagsOn@CaItemModel@@QAEXABV?$QFlags@W4EntryFlag@@@@@Z @ 115 NONAME ; void CaItemModel::setFlagsOn(class QFlags<enum EntryFlag> const &)
+	??0CaQuery@@QAE@ABV0@@Z @ 116 NONAME ; CaQuery::CaQuery(class CaQuery const &)
+	?iconDescription@CaEntry@@QBE?AVCaIconDescription@@XZ @ 117 NONAME ; class CaIconDescription CaEntry::iconDescription(void) const
+	?trUtf8@CaService@@SA?AVQString@@PBD0H@Z @ 118 NONAME ; class QString CaService::trUtf8(char const *, char const *, int)
+	?createEntry@CaService@@QBE?AV?$QSharedPointer@VCaEntry@@@@ABVCaEntry@@@Z @ 119 NONAME ; class QSharedPointer<class CaEntry> CaService::createEntry(class CaEntry const &) const
+	??0CaNotifierFilter@@QAE@ABVCaQuery@@@Z @ 120 NONAME ; CaNotifierFilter::CaNotifierFilter(class CaQuery const &)
+	?setEntryTypeNames@CaQuery@@QAEXABVQStringList@@@Z @ 121 NONAME ; void CaQuery::setEntryTypeNames(class QStringList const &)
+	?updateProgress@CaItemModel@@QAEXHH@Z @ 122 NONAME ; void CaItemModel::updateProgress(int, int)
+	?qt_metacall@CaItemModel@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 123 NONAME ; int CaItemModel::qt_metacall(enum QMetaObject::Call, int, void * *)
+	?setText@CaEntry@@QAEXABVQString@@_N@Z @ 124 NONAME ; void CaEntry::setText(class QString const &, bool)
+	?removeAttribute@CaQuery@@QAEXABVQString@@@Z @ 125 NONAME ; void CaQuery::removeAttribute(class QString const &)
+	?insertEntryIntoGroup@CaService@@QBE_NABVCaEntry@@0H@Z @ 126 NONAME ; bool CaService::insertEntryIntoGroup(class CaEntry const &, class CaEntry const &, int) const
+	?setApplicationId@CaIconDescription@@QAEXABVQString@@@Z @ 127 NONAME ; void CaIconDescription::setApplicationId(class QString const &)
+	?appendEntryToGroup@CaService@@QBE_NABVCaEntry@@0@Z @ 128 NONAME ; bool CaService::appendEntryToGroup(class CaEntry const &, class CaEntry const &) const
+	?setAttribute@CaQuery@@QAEXABVQString@@0@Z @ 129 NONAME ; void CaQuery::setAttribute(class QString const &, class QString const &)
+	?attributes@CaQuery@@QBE?AV?$QMap@VQString@@V1@@@XZ @ 130 NONAME ; class QMap<class QString, class QString> CaQuery::attributes(void) const
+	?updateEntry@CaService@@QBE_NABVCaEntry@@@Z @ 131 NONAME ; bool CaService::updateEntry(class CaEntry const &) const
+	?setAttribute@CaEntry@@QAEXABVQString@@0@Z @ 132 NONAME ; void CaEntry::setAttribute(class QString const &, class QString const &)
+	?unregisterNotifier@CaClientNotifierProxy@@QAEXABVCaNotifierFilter@@W4NotifierType@CaNotifierPrivate@@@Z @ 133 NONAME ; void CaClientNotifierProxy::unregisterNotifier(class CaNotifierFilter const &, enum CaNotifierPrivate::NotifierType)
+	?setParentId@CaItemModel@@QAEXH@Z @ 134 NONAME ; void CaItemModel::setParentId(int)
+	?countChange@CaItemModel@@IAEXXZ @ 135 NONAME ; void CaItemModel::countChange(void)
+	?metaObject@CaItemModel@@UBEPBUQMetaObject@@XZ @ 136 NONAME ; struct QMetaObject const * CaItemModel::metaObject(void) const
+	?makeIcon@CaEntry@@QBE?AVHbIcon@@ABVQSizeF@@@Z @ 137 NONAME ; class HbIcon CaEntry::makeIcon(class QSizeF const &) const
+	?tr@CaItemModel@@SA?AVQString@@PBD0H@Z @ 138 NONAME ; class QString CaItemModel::tr(char const *, char const *, int)
+	?setFlagsOff@CaQuery@@QAEXABV?$QFlags@W4EntryFlag@@@@@Z @ 139 NONAME ; void CaQuery::setFlagsOff(class QFlags<enum EntryFlag> const &)
+	?getEntry@CaService@@QBE?AV?$QSharedPointer@VCaEntry@@@@H@Z @ 140 NONAME ; class QSharedPointer<class CaEntry> CaService::getEntry(int) const
+	??0CaEntry@@QAE@ABV0@@Z @ 141 NONAME ; CaEntry::CaEntry(class CaEntry const &)
+	?rowCount@CaItemModel@@UBEHABVQModelIndex@@@Z @ 142 NONAME ; int CaItemModel::rowCount(class QModelIndex const &) const
+	?clear@CaQuery@@QAEXXZ @ 143 NONAME ; void CaQuery::clear(void)
+	?prependEntryToGroup@CaService@@QBE_NHH@Z @ 144 NONAME ; bool CaService::prependEntryToGroup(int, int) const
+	?qt_metacast@CaClientNotifierProxy@@UAEPAXPBD@Z @ 145 NONAME ; void * CaClientNotifierProxy::qt_metacast(char const *)
+	?getEntryIcon@CaMenuIconUtility@@SA?AVHbIcon@@ABVCaEntry@@ABVQSizeF@@@Z @ 146 NONAME ; class HbIcon CaMenuIconUtility::getEntryIcon(class CaEntry const &, class QSizeF const &)
+	?tr@CaService@@SA?AVQString@@PBD0H@Z @ 147 NONAME ; class QString CaService::tr(char const *, char const *, int)
+	?entryRoles@CaQuery@@QBE?AV?$QFlags@W4EntryRole@@@@XZ @ 148 NONAME ; class QFlags<enum EntryRole> CaQuery::entryRoles(void) const
+	?qt_metacall@CaService@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 149 NONAME ; int CaService::qt_metacall(enum QMetaObject::Call, int, void * *)
+	??4CaNotifierFilter@@QAEAAV0@ABV0@@Z @ 150 NONAME ; class CaNotifierFilter & CaNotifierFilter::operator=(class CaNotifierFilter const &)
+	??0CaItemModel@@QAE@ABVCaQuery@@PAVQObject@@@Z @ 151 NONAME ; CaItemModel::CaItemModel(class CaQuery const &, class QObject *)
+	?setFlagsOff@CaItemModel@@QAEXABV?$QFlags@W4EntryFlag@@@@@Z @ 152 NONAME ; void CaItemModel::setFlagsOff(class QFlags<enum EntryFlag> const &)
+	?getSort@CaQuery@@QBEXAAW4SortAttribute@@AAW4SortOrder@Qt@@@Z @ 153 NONAME ; void CaQuery::getSort(enum SortAttribute &, enum Qt::SortOrder &) const
+	?parentId@CaQuery@@QBEHXZ @ 154 NONAME ; int CaQuery::parentId(void) const
+	?setEntryRoles@CaQuery@@QAEXV?$QFlags@W4EntryRole@@@@@Z @ 155 NONAME ; void CaQuery::setEntryRoles(class QFlags<enum EntryRole>)
+	??_ECaEntry@@UAE@I@Z @ 156 NONAME ; CaEntry::~CaEntry(unsigned int)
+	??0CaService@@AAE@PAVQObject@@@Z @ 157 NONAME ; CaService::CaService(class QObject *)
+	??1CaService@@EAE@XZ @ 158 NONAME ; CaService::~CaService(void)
+	?flagsOn@CaQuery@@QBE?AV?$QFlags@W4EntryFlag@@@@XZ @ 159 NONAME ; class QFlags<enum EntryFlag> CaQuery::flagsOn(void) const
+	?description@CaEntry@@QBE?AVQString@@XZ @ 160 NONAME ; class QString CaEntry::description(void) const
+	?metaObject@CaNotifier@@UBEPBUQMetaObject@@XZ @ 161 NONAME ; struct QMetaObject const * CaNotifier::metaObject(void) const
+	?data@CaItemModel@@UBE?AVQVariant@@ABVQModelIndex@@H@Z @ 162 NONAME ; class QVariant CaItemModel::data(class QModelIndex const &, int) const
+	??0CaIconDescription@@QAE@ABV0@@Z @ 163 NONAME ; CaIconDescription::CaIconDescription(class CaIconDescription const &)
+	?staticMetaObject@CaService@@2UQMetaObject@@B @ 164 NONAME ; struct QMetaObject const CaService::staticMetaObject
+	?removeEntry@CaService@@QBE_NH@Z @ 165 NONAME ; bool CaService::removeEntry(int) const
+	?addEntryTypeName@CaQuery@@QAEXABVQString@@@Z @ 166 NONAME ; void CaQuery::addEntryTypeName(class QString const &)
+	?isAutoUpdate@CaItemModel@@QBE_NXZ @ 167 NONAME ; bool CaItemModel::isAutoUpdate(void) const
+	??1CaEntry@@UAE@XZ @ 168 NONAME ; CaEntry::~CaEntry(void)
+	?prependEntriesToGroup@CaService@@QBE_NABVCaEntry@@ABV?$QList@V?$QSharedPointer@VCaEntry@@@@@@@Z @ 169 NONAME ; bool CaService::prependEntriesToGroup(class CaEntry const &, class QList<class QSharedPointer<class CaEntry> > const &) const
+	?qt_metacall@CaNotifier@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 170 NONAME ; int CaNotifier::qt_metacall(enum QMetaObject::Call, int, void * *)
+	?setSort@CaItemModel@@QAEXW4SortAttribute@@W4SortOrder@Qt@@@Z @ 171 NONAME ; void CaItemModel::setSort(enum SortAttribute, enum Qt::SortOrder)
+	?removeEntry@CaService@@QBE_NABVCaEntry@@@Z @ 172 NONAME ; bool CaService::removeEntry(class CaEntry const &) const
+	?setId@CaEntry@@AAEXH@Z @ 173 NONAME ; void CaEntry::setId(int)
+	?staticMetaObject@CaNotifier@@2UQMetaObject@@B @ 174 NONAME ; struct QMetaObject const CaNotifier::staticMetaObject
+	?applicationId@CaIconDescription@@QBE?AVQString@@XZ @ 175 NONAME ; class QString CaIconDescription::applicationId(void) const
+	?getIds@CaNotifierFilter@@QBE?AV?$QList@H@@XZ @ 176 NONAME ; class QList<int> CaNotifierFilter::getIds(void) const
+	?setIds@CaNotifierFilter@@QAEXABV?$QList@H@@@Z @ 177 NONAME ; void CaNotifierFilter::setIds(class QList<int> const &)
+	??0CaEntry@@QAE@W4EntryRole@@@Z @ 178 NONAME ; CaEntry::CaEntry(enum EntryRole)
 	?qt_metacast@CaItemModel@@UAEPAXPBD@Z @ 179 NONAME ; void * CaItemModel::qt_metacast(char const *)
 	?trUtf8@CaClientNotifierProxy@@SA?AVQString@@PBD0H@Z @ 180 NONAME ; class QString CaClientNotifierProxy::trUtf8(char const *, char const *, int)
 	?lastError@CaService@@QBE?AW4ErrorCode@@XZ @ 181 NONAME ; enum ErrorCode CaService::lastError(void) const
--- a/contentstorage/caclient/eabi/caclientu.def	Wed Aug 18 10:39:24 2010 +0300
+++ b/contentstorage/caclient/eabi/caclientu.def	Mon Sep 13 13:26:33 2010 +0300
@@ -181,8 +181,8 @@
 	_ZNK9CaService13removeEntriesERK5QListI14QSharedPointerI7CaEntryEE @ 180 NONAME
 	_ZNK9CaService13removeEntriesERK5QListIiE @ 181 NONAME
 	_ZNK9CaService14createNotifierERK16CaNotifierFilter @ 182 NONAME
-	_ZNK9CaService14executeCommandERK7CaEntryRK7QString @ 183 NONAME
-	_ZNK9CaService14executeCommandEiRK7QString @ 184 NONAME
+	_ZNK9CaService14executeCommandERK7CaEntryRK7QStringP7QObjectPKc @ 183 NONAME
+	_ZNK9CaService14executeCommandEiRK7QStringP7QObjectPKc @ 184 NONAME
 	_ZNK9CaService18appendEntryToGroupERK7CaEntryS2_ @ 185 NONAME
 	_ZNK9CaService18appendEntryToGroupEii @ 186 NONAME
 	_ZNK9CaService19prependEntryToGroupERK7CaEntryS2_ @ 187 NONAME
--- a/contentstorage/caclient/inc/cahandler.h	Wed Aug 18 10:39:24 2010 +0300
+++ b/contentstorage/caclient/inc/cahandler.h	Mon Sep 13 13:26:33 2010 +0300
@@ -29,7 +29,9 @@
 public:
     virtual ~CaHandler() {}
     virtual int execute(const CaEntry &entry,
-                        const QString &commandName) = 0;
+                        const QString &commandName,
+                        QObject* receiver = NULL,
+                        const char* member = NULL) = 0;
 };
 
 Q_DECLARE_INTERFACE(CaHandler, "com.nokia.homescreen.ICommandHandler")
--- a/contentstorage/caclient/inc/cahandlerproxy.h	Wed Aug 18 10:39:24 2010 +0300
+++ b/contentstorage/caclient/inc/cahandlerproxy.h	Mon Sep 13 13:26:33 2010 +0300
@@ -36,7 +36,8 @@
 
     explicit CaHandlerProxy(const QSharedPointer<CaHandlerLoader> &loader);
 
-    int execute(const CaEntry &entry, const QString &commandName);
+    int execute(const CaEntry &entry, const QString &commandName, 
+            QObject* receiver = NULL, const char* member = NULL);
 
 private:
     CaHandler *getHandler(const CaEntry &entry,
--- a/contentstorage/caclient/inc/caservice_p.h	Wed Aug 18 10:39:24 2010 +0300
+++ b/contentstorage/caclient/inc/caservice_p.h	Mon Sep 13 13:26:33 2010 +0300
@@ -58,7 +58,8 @@
 
     bool prependEntriesToGroup(int groupId, const QList<int> &entryIdList);
 
-    int executeCommand(const CaEntry &entry, const QString &command);
+    int executeCommand(const CaEntry &entry, const QString &command, 
+            QObject* receiver = NULL, const char* member = NULL);
 
     CaNotifier *createNotifier(const CaNotifierFilter &filter);
 
--- a/contentstorage/caclient/s60/src/camenuiconutility.cpp	Wed Aug 18 10:39:24 2010 +0300
+++ b/contentstorage/caclient/s60/src/camenuiconutility.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -167,7 +167,16 @@
         icon = HbIcon("qtg_large_application");
     } else if (entry.entryTypeName() ==
         XQConversions::s60DescToQString(KCaTypePackage)) {
-        icon = HbIcon("qtg_large_application");
+        QString type = entry.attribute(XQConversions::s60DescToQString(KCaAttrAppType));
+        if (type == 
+                XQConversions::s60DescToQString(KCaAttrAppTypeValueJava)) {
+            icon = HbIcon("qtg_large_java");
+        } else if (type == 
+                XQConversions::s60DescToQString(KCaAttrAppTypeValueCWRT)) {
+            icon = HbIcon("qtg_large_widget");
+        } else {
+            icon = HbIcon("qtg_large_sisx");
+        }        
     }
     
     return icon;
--- a/contentstorage/caclient/src/cahandlerproxy.cpp	Wed Aug 18 10:39:24 2010 +0300
+++ b/contentstorage/caclient/src/cahandlerproxy.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -52,16 +52,19 @@
   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.
+  \param receiver QObject class with slot.
+  \param member Slot from QObject class.
   \retval KErrNone on succes, error code otherwise.
   \sa e32err.h for KErrNone definition.
 */
-int CaHandlerProxy::execute(const CaEntry &entry, const QString &commandName)
+int CaHandlerProxy::execute(const CaEntry &entry, const QString &commandName,
+        QObject* receiver, const char* member)
 {
     CaHandler *const handler = getHandler(entry, commandName);
     int result = -1;
 
     if (handler) {
-            result = handler->execute(entry, commandName);
+            result = handler->execute(entry, commandName, receiver, member);
     }
     return result;
 }
--- a/contentstorage/caclient/src/caquery.cpp	Wed Aug 18 10:39:24 2010 +0300
+++ b/contentstorage/caclient/src/caquery.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -39,7 +39,7 @@
  CaQuery query;
  query.setEntryRoles( ItemEntryRole | GroupEntryRole );
  query.setSort( MostUsedSortAttribute, Qt::DescendingOrder );
- query.setFlagsOn( UsedEntryFlag | RemovableEntryFlag | RunningEntryFlag );
+ query.setFlagsOn( UsedEntryFlag | RemovableEntryFlag );
  query.setFlagsOff( SystemEntryFlag | VisibleEntryFlag );
  // using CaQuery to get data from DB
  QList<CaEntry *> entries = CaService::instance()->getEntries( query );
--- a/contentstorage/caclient/src/caservice.cpp	Wed Aug 18 10:39:24 2010 +0300
+++ b/contentstorage/caclient/src/caservice.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -83,6 +83,10 @@
  Proxy to client notifier.
  */
 
+namespace Hs {
+    const char packageTypeName[] = "package";
+}
+
 // Initialization of a static member variable.
 QWeakPointer<CaService> CaService::m_instance = QWeakPointer<CaService>();
 /*!
@@ -365,7 +369,14 @@
  */
 bool CaService::touch(const CaEntry &entry) const
 {
-    return m_d->touch(entry);
+    if (entry.flags() & RemovableEntryFlag &&
+        (entry.flags() & UsedEntryFlag) == 0 &&
+        entry.role() == ItemEntryRole &&
+        entry.entryTypeName() != QString(Hs::packageTypeName)) {
+        return m_d->touch(entry);
+    } else {
+    	return true;
+    }
 }
 
 /*!
@@ -827,6 +838,8 @@
  Execute command.
  \param entryId id of an entry.
  \param command command.
+ \param receiver QObject class with slot.
+ \param member Slot from QObject class.
  \retval 0 if operation was successful.
 
  \example
@@ -843,14 +856,15 @@
  result == 0
  \endcode
  */
-int CaService::executeCommand(int entryId, const QString &command) const
+int CaService::executeCommand(int entryId, const QString &command, 
+        QObject* receiver, const char* member) const
 {
     int result = -19;
     
     const QSharedPointer<CaEntry> temporaryEntry = getEntry(entryId);
     
     if (!temporaryEntry.isNull()) {
-        result = executeCommand(*temporaryEntry, command);
+        result = executeCommand(*temporaryEntry, command, receiver, member);
     }
     return result;
 }
@@ -859,6 +873,8 @@
  Execute command.
  \param entry entry.
  \param command command.
+ \param receiver QObject class with slot.
+ \param member Slot from QObject class.
  \retval 0 if operation was successful.
 
  \example
@@ -875,9 +891,10 @@
  result == 0
  \endcode
  */
-int CaService::executeCommand(const CaEntry &entry, const QString &command) const
+int CaService::executeCommand(const CaEntry &entry, const QString &command, 
+        QObject* receiver, const char* member) const
 {
-    return m_d->executeCommand(entry, command);
+    return m_d->executeCommand(entry, command, receiver, member);
 }
 
 /*!
@@ -1333,10 +1350,14 @@
  Executes command on entry (fe. "open", "remove")
  \param const reference to an entry on which command will be issued
  \param string containing a command
+ \param receiver QObject with slot
+ \param member slot from QObject
  \retval int which is used as an error code return value, 0 means no errors
  */
 int CaServicePrivate::executeCommand(const CaEntry &entry,
-                                      const QString &command)
+                                      const QString &command,
+                                      QObject* receiver, 
+                                      const char* member)
 {
     qDebug() << "CaServicePrivate::executeCommand"
              << "entry id:" << entry.id() << "command:" << command;
@@ -1351,7 +1372,8 @@
         touch(entry);
     }
 
-    int errorCode = mCommandHandler->execute(entry, command);
+    int errorCode = mCommandHandler->execute(entry, 
+            command, receiver, member);
     mErrorCode = CaObjectAdapter::convertErrorCode(errorCode);
     
 
--- a/contentstorage/caclient/stub/src/caclientproxy.cpp	Wed Aug 18 10:39:24 2010 +0300
+++ b/contentstorage/caclient/stub/src/caclientproxy.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -241,13 +241,13 @@
         qDebug() << query.executedQuery();
     }
 
-    // Add attribute widget:traslation_file
+    // Add attribute widget:translation_file
     if (!translationFileName.isEmpty()) {
         QString queryAddWidgetTranslationFile =
             "INSERT INTO CA_ATTRIBUTE " \
             "(AT_ENTRY_ID, AT_NAME, AT_VALUE) " \
             "VALUES " \
-            "(?, 'widget:traslation_file', ?)";
+            "(?, 'widget:translation_file', ?)";
 
         query.prepare(queryAddWidgetTranslationFile);
         query.addBindValue(widgetId);
--- a/contentstorage/cahandler/app/inc/caapphandler.h	Wed Aug 18 10:39:24 2010 +0300
+++ b/contentstorage/cahandler/app/inc/caapphandler.h	Mon Sep 13 13:26:33 2010 +0300
@@ -21,12 +21,13 @@
 #include <QObject>
 
 #include "cahandler.h"
+#include "cauninstallerobserver.h"
 
 class CEikonEnv;
 class CCaUsifUninstallOperation;
 class CaEntry;
 
-class CaAppHandler: public QObject, public CaHandler
+class CaAppHandler: public QObject, public CaHandler, public CaUninstallerObserver
 {
     Q_OBJECT
     Q_INTERFACES(CaHandler)
@@ -39,7 +40,14 @@
 
 public:
 
-    int execute(const CaEntry &entry, const QString &command);
+    int execute(const CaEntry &entry, const QString &command, 
+            QObject* receiver = NULL, const char* member = NULL);
+    
+    void uninstallError(int error); // from CaUninstallerObserver
+    
+signals:
+
+    void uninstallFailed(int errorCode);
 
 private:
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contentstorage/cahandler/app/inc/cauninstallerobserver.h	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  ?Description
+ *
+ */
+
+#ifndef CAUNINSTALLEROBSERVER_H_
+#define CAUNINSTALLEROBSERVER_H_
+
+class CaUninstallerObserver
+{
+public:
+    virtual void uninstallError(int error) = 0;
+};
+
+#endif /* CAUNINSTALLEROBSERVER_H_ */
--- a/contentstorage/cahandler/app/inc/causifuninstalloperation.h	Wed Aug 18 10:39:24 2010 +0300
+++ b/contentstorage/cahandler/app/inc/causifuninstalloperation.h	Mon Sep 13 13:26:33 2010 +0300
@@ -21,6 +21,8 @@
 #include <e32base.h>
 #include <usif/sif/sif.h>
 
+class CaUninstallerObserver;
+
 using namespace Usif;
 
 /**
@@ -48,6 +50,8 @@
      */
     static CCaUsifUninstallOperation *NewL(TComponentId, TInt aPriority =
             CActive::EPriorityStandard);
+    
+    void AddObserver(CaUninstallerObserver* aCaUninstallerObserver);
 
 private:
     // construction
@@ -81,6 +85,8 @@
     COpaqueNamedParams* iResults;
 
     RSoftwareInstall iUninstaller;
+    
+    CaUninstallerObserver* iCaUninstallerObserver; // not owned
 };
 
 #endif // C_CAUSIFUNINSTALLOPERATION_H
--- a/contentstorage/cahandler/app/src/caapphandler.cpp	Wed Aug 18 10:39:24 2010 +0300
+++ b/contentstorage/cahandler/app/src/caapphandler.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -28,6 +28,7 @@
 
 #include <usif/usifcommon.h>
 #include <usif/scr/scr.h>
+#include <usif/usiferror.h>
 
 #include <cadefs.h>
 #include <caentry.h>
@@ -78,10 +79,17 @@
  * Execute a given command.
  * \param entry a reference to a CaEntry instance.
  * \param command a given command.
+ * \param receiver a QObject class with slot to invoke.
+ * \param member a slot to invoke.
  * \retval an error code.
  */
-int CaAppHandler::execute(const CaEntry &entry, const QString &command)
+int CaAppHandler::execute(const CaEntry &entry, const QString &command,
+        QObject* receiver, const char* member)
 {
+    if ( receiver && member ) {
+        connect( this, SIGNAL(uninstallFailed(int)), receiver, member, Qt::UniqueConnection );
+    }
+    
     int result(KErrGeneral);
     if (command == caCmdOpen && entry.entryTypeName() == caTypeApp) {
         QString viewIdValue = entry.attribute(caAttrView);
@@ -179,7 +187,7 @@
 int CaAppHandler::closeApplication(const EntryFlags &flags, int windowGroupId)
 {
     int result(KErrNone);
-    if (flags.testFlag(RunningEntryFlag) && windowGroupId > 0) {
+    if (windowGroupId > 0) {
         RWsSession wsSession;
         result = wsSession.Connect();
         if (result==KErrNone) {
@@ -237,10 +245,29 @@
 void CaAppHandler::startUsifUninstallL(TInt componentId)
 {
     if (iUsifUninstallOperation && iUsifUninstallOperation->IsActive()) {
-        User::Leave( KErrInUse );
+        uninstallError(Usif::EInstallerBusy);
+    } else {
+        delete iUsifUninstallOperation;
+        iUsifUninstallOperation = NULL;
+        iUsifUninstallOperation = CCaUsifUninstallOperation::NewL(componentId);
+        iUsifUninstallOperation->AddObserver(this);
     }
-    delete iUsifUninstallOperation;
-    iUsifUninstallOperation = NULL;
-    iUsifUninstallOperation = CCaUsifUninstallOperation::NewL(componentId);
 }
 
+#ifdef COVERAGE_MEASUREMENT
+#pragma CTC SKIP
+#endif //COVERAGE_MEASUREMENT 
+/*!
+ * Show information message about unninstall error.
+ * \param error uninstall error.
+ * \retval void.
+ */
+void CaAppHandler::uninstallError(int error)
+{
+   	emit uninstallFailed(error);
+}
+#ifdef COVERAGE_MEASUREMENT
+#pragma CTC ENDSKIP
+#endif //COVERAGE_MEASUREMENT
+
+
--- a/contentstorage/cahandler/app/src/causifuninstalloperation.cpp	Wed Aug 18 10:39:24 2010 +0300
+++ b/contentstorage/cahandler/app/src/causifuninstalloperation.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -20,6 +20,7 @@
 #include "cadef.h"
 #include "cainnerentry.h"
 #include "causifuninstalloperation.h"
+#include "cauninstallerobserver.h"
 
 // ================= MEMBER FUNCTIONS =======================
 
@@ -55,7 +56,7 @@
 // ---------------------------------------------------------------------------
 //
 CCaUsifUninstallOperation::CCaUsifUninstallOperation( TInt aPriority ) :
-    CActive(aPriority), iUninstaller()
+    CActive(aPriority), iUninstaller(), iCaUninstallerObserver(NULL)
     {
     CActiveScheduler::Add(this);
     }
@@ -81,6 +82,15 @@
 //
 void CCaUsifUninstallOperation::RunL()
     {
+    if( iStatus != KErrNone )
+        {
+        int error = iStatus.Int();
+        // notify about error
+        if( iCaUninstallerObserver )
+            {
+            iCaUninstallerObserver->uninstallError( error );
+            }
+        }
     iUninstaller.Close();
     }
 
@@ -108,3 +118,12 @@
 #pragma CTC ENDSKIP
 #endif //COVERAGE_MEASUREMENT
 
+// ---------------------------------------------------------------------------
+// CCaUsifUninstallOperation::AddObserver
+// ---------------------------------------------------------------------------
+//
+void CCaUsifUninstallOperation::AddObserver(CaUninstallerObserver* aCaUninstallerObserver)
+    {
+    iCaUninstallerObserver = aCaUninstallerObserver;
+    }
+
--- a/contentstorage/cahandler/tapp/inc/catapphandler.h	Wed Aug 18 10:39:24 2010 +0300
+++ b/contentstorage/cahandler/tapp/inc/catapphandler.h	Mon Sep 13 13:26:33 2010 +0300
@@ -35,7 +35,8 @@
     ~CaTappHandler();
 
     Q_INVOKABLE
-    int execute(const CaEntry &entry, const QString &command);
+    int execute(const CaEntry &entry, const QString &command, 
+            QObject* receiver = NULL, const char* member = NULL);
 
 private:
     XQApplicationManager *mAiwMgr;
--- a/contentstorage/cahandler/tapp/src/catapphandler.cpp	Wed Aug 18 10:39:24 2010 +0300
+++ b/contentstorage/cahandler/tapp/src/catapphandler.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -58,10 +58,15 @@
  Uses XQApplicationManager
  \param entry Subject of the \a command.
  \param command Description of the command.
+ \param receiver a QObject class with slot to invoke.
+ \param member a slot to invoke.
  \retval Error code described in QSERVICEMANAGER.H
  */
-int CaTappHandler::execute(const CaEntry& entry, const QString& command)
+int CaTappHandler::execute(const CaEntry& entry, const QString& command, 
+        QObject* receiver, const char* member)
 {
+	Q_UNUSED(receiver);
+	Q_UNUSED(member);
     // this returns Error enum from QSERVICEMANAGER.H
     int error = 0;
     if (command == caCmdOpen) {
--- a/contentstorage/cahandler/url/inc/caurlhandler.h	Wed Aug 18 10:39:24 2010 +0300
+++ b/contentstorage/cahandler/url/inc/caurlhandler.h	Mon Sep 13 13:26:33 2010 +0300
@@ -33,7 +33,8 @@
 
     virtual ~CaUrlHandler();
 
-    int execute(const CaEntry &entry, const QString &command);
+    int execute(const CaEntry &entry, const QString &command, 
+            QObject* receiver = NULL, const char* member = NULL);
 
 };
 
--- a/contentstorage/cahandler/url/src/caurlhandler.cpp	Wed Aug 18 10:39:24 2010 +0300
+++ b/contentstorage/cahandler/url/src/caurlhandler.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -43,10 +43,16 @@
  * Execute a given command.
  * \param entry a reference to CaEntry instance.
  * \param command a given command.
+ * \param receiver a QObject class with slot to invoke.
+ * \param member a slot to invoke.
  * \retval an error code.
  */
-int CaUrlHandler::execute(const CaEntry &entry, const QString &command)
+int CaUrlHandler::execute(const CaEntry &entry, const QString &command,
+        QObject* receiver, const char* member)
 {
+	Q_UNUSED(receiver);
+	Q_UNUSED(member);
+	
     int err(KErrGeneral);
     if (command == caCmdOpen) {
         QString attribute = entry.attribute(caAttrUrl);
--- a/contentstorage/casoftwareregistry/s60/inc/caprogresscanner.h	Wed Aug 18 10:39:24 2010 +0300
+++ b/contentstorage/casoftwareregistry/s60/inc/caprogresscanner.h	Mon Sep 13 13:26:33 2010 +0300
@@ -88,9 +88,6 @@
     /**
      * USIF notifier
      * Own.
-     *
-     * Commented out since USIF notifications do not
-     * work on MCL wk20
      */
     CSifOperationsNotifier* iNotifier;
 
--- a/contentstorage/casoftwareregistry/s60/src/caprogresscanner.cpp	Wed Aug 18 10:39:24 2010 +0300
+++ b/contentstorage/casoftwareregistry/s60/src/caprogresscanner.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -76,7 +76,8 @@
     {
     //TODO: temporary solution. Some error in scr was found
     if( aStartData.OperationPhase() == EUninstalling 
-            || aStartData.OperationPhase() == EInstalling )
+            || aStartData.OperationPhase() == EInstalling 
+            || aStartData.OperationPhase() == 0)
         {
         TRAP_IGNORE(
                 iComponentId = iSoftwareRegistry.GetComponentIdL(
@@ -135,7 +136,7 @@
     {
     if( aError == KErrNone )
         {
-        iObserver->progressChange( iComponentId, 100 );
+        iObserver->progressChange( iComponentId, 101 );
         }
     else
         {
--- a/contentstorage/casoftwareregistry/s60/src/casoftwareregistry_p.cpp	Wed Aug 18 10:39:24 2010 +0300
+++ b/contentstorage/casoftwareregistry/s60/src/casoftwareregistry_p.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -34,11 +34,11 @@
 #include "caarraycleanup.inl"
 
 using namespace Usif;
-
 _LIT(KConfirmMessageKey, "MIDlet-Delete-Confirm");
 _LIT(KCaScrPropertyDomainCategory, "Domain-Category");
 _LIT(KCaScrPropertyMidletDescryption, "MIDlet-Description");
-const int maxLogsCount = 20;  // should be 50 - workaround for 
+_LIT(KNotNamedMmc, "NO NAME");
+const int maxLogsCount = 20;  // should be 50 - workaround for
 // ou1cimx1#476143 Dialog crash when label contains big amount of lines
 
 /*!
@@ -56,7 +56,7 @@
  */
 CaSoftwareRegistryPrivate::~CaSoftwareRegistryPrivate()
 {
-    
+
 }
 
 /*!
@@ -290,19 +290,19 @@
                 drives = drives.append(",");
             }
             drv = QString(QChar('A'+ i)).append(":");
-            if(DriveInfo::GetDefaultDrive(
+            if (DriveInfo::GetDefaultDrive(
                     DriveInfo::EDefaultPhoneMemory, drive ) == KErrNone
                     && QChar('A'+ i) == QChar(drive)) {
                 drives = drives.append(HbParameterLengthLimiter(
                         "txt_applib_dialog_1_device_memory").arg(
                                 QString(QChar('A'+ i))));
-            } else if(DriveInfo::GetDefaultDrive(
+            } else if (DriveInfo::GetDefaultDrive(
                     DriveInfo::EDefaultMassStorage, drive ) == KErrNone
                     && QChar('A'+ i) == QChar(drive)) {
                 drives = drives.append(HbParameterLengthLimiter(
                         "txt_applib_dialog_1_mass_storage").arg(
                                 QString(QChar('A'+ i))));
-                } else if(DriveInfo::GetDefaultDrive(
+                } else if (DriveInfo::GetDefaultDrive(
                     DriveInfo::EDefaultRemovableMassStorage, drive ) == KErrNone
                     && QChar('A'+ i) == QChar(drive)) {
                 RFs fs;
@@ -314,7 +314,8 @@
                             DriveInfo::EDefaultRemovableMassStorage,
                             driveNumber );
                     User::LeaveIfError(fs.Volume(tv, driveNumber));
-                    if(tv.iName.Length()) {
+                    if (tv.iName.Length()
+                            && tv.iName.Compare(KNotNamedMmc) != KErrNone) {
                         drives = drives.append(HbParameterLengthLimiter(
                                 "txt_applib_dialog_1_2").arg(
                                         QString(QChar('A'+ i))).arg(
--- a/contentstorage/casoftwareregistry/stub/src/cauninstallnotifier_p.cpp	Wed Aug 18 10:39:24 2010 +0300
+++ b/contentstorage/casoftwareregistry/stub/src/cauninstallnotifier_p.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -42,6 +42,5 @@
 
 void CaUninstallNotifierPrivate::makeConnect()
 {
-    connect(mUninstallObserver, SIGNAL(signalprogressChange(int, int)), 
-            m_q, SIGNAL(progressChange(int, int)));
+
 }
--- a/contentstorage/casrv/carunningappmonitor/bwins/carunningappmonitoru.def	Wed Aug 18 10:39:24 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-EXPORTS
-	?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 1 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &)
-
--- a/contentstorage/casrv/carunningappmonitor/data/carunningappmonitor.rss	Wed Aug 18 10:39:24 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +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: carunningappmonitor.rss
-*
-*/
-
-#include <ecom/registryinfo.rh>
-#include "casrvpluginuids.hrh"
-
-RESOURCE REGISTRY_INFO theInfo
-    {
-    // UID for the DLL
-    dll_uid = 0x200267B5;
-    // Declare array of interface info
-    interfaces =
-        {
-        INTERFACE_INFO
-            {
-            // UID of interface that is implemented
-            interface_uid = KCaSrvPluginInterfaceUid;
-            implementations =
-                {
-                // Info for Drm Scanner
-                IMPLEMENTATION_INFO
-                    {
-                    implementation_uid = 0x200267B5;
-                    version_no         = 1;
-                    display_name       = "Running Application Monitor";
-                    default_data       = "";
-                    opaque_data        = "";
-                    }
-                };
-            }
-        };
-    }
-
--- a/contentstorage/casrv/carunningappmonitor/eabi/carunningappmonitoru.def	Wed Aug 18 10:39:24 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-EXPORTS
-	_Z24ImplementationGroupProxyRi @ 1 NONAME
-
--- a/contentstorage/casrv/carunningappmonitor/group/bld.inf	Wed Aug 18 10:39:24 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +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: bld.inf
-*
-*/
-
-PRJ_PLATFORMS
-// specify the platforms your component needs to be built for here
-// defaults to WINS ARMI ARM4 THUMB so you can ignore this if you just build these
-
-PRJ_EXPORTS
-
-
-PRJ_MMPFILES
-// Specify the .mmp files required for building the important component
-// releasables. Note that you should specify any .mmp files for test
-// programs further down the file.
-carunningappmonitor.mmp
-
-PRJ_TESTMMPFILES
--- a/contentstorage/casrv/carunningappmonitor/group/carunningappmonitor.mmp	Wed Aug 18 10:39:24 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +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: carunningappmonitor.mmp
-*
-*/
-
-// To get the system includes definitions
-#include <platform_paths.hrh>
-
-TARGET carunningappmonitor.dll
-TARGETTYPE PLUGIN
-
-// ECom Dll recognition UID followed by the unique UID for this dll
-UID 0x10009D8D 0x200267B5
-SECUREID 0x200267B5
-CAPABILITY CAP_ECOM_PLUGIN
-
-DEFFILE         carunningappmonitor.def
-
-SOURCEPATH      ../src
-SOURCE          proxy.cpp
-SOURCE          castoragetask.cpp
-SOURCE          carunningapphandler.cpp
-SOURCE          carunningappmonitor.cpp
-
-USERINCLUDE     ../inc
-USERINCLUDE     ../../casrvmgr/inc
-USERINCLUDE     ../../../inc
-USERINCLUDE     ../../../srvinc
-USERINCLUDE     ../../../cautils/inc
-
-MW_LAYER_SYSTEMINCLUDE
-
-SOURCEPATH      ../data
-START RESOURCE  carunningappmonitor.rss
-    LANG    sc
-    TARGET  carunningappmonitor.rsc
-END
-
-LIBRARY         euser.lib
-LIBRARY         ecom.lib
-LIBRARY         ws32.lib
-LIBRARY         apgrfx.lib
-LIBRARY         cautils.lib
-LIBRARY         camenu.lib
-
--- a/contentstorage/casrv/carunningappmonitor/inc/carunningapphandler.h	Wed Aug 18 10:39:24 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +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: carunnningapphandler.h
-*
-*/
-
-#ifndef C_CARUNNINGAPPHANDLER_H
-#define C_CARUNNINGAPPHANDLER_H
-
-#include "carunningtaskhandler.h"
-#include "casrvplugin.h"
-#include <e32cmn.h>
-
-class CCaStorageProxy;
-/**
- * Class implement task handler and content storage plugin. 
- */
-NONSHARABLE_CLASS( CCaRunningAppHandler ): public CCaSrvPlugin,
-                                           public MCaRunningTaskHandler
-    {
-public:
-    /**
-     * Factory function. Create and initialize handler instance. 
-     */
-    static CCaRunningAppHandler* NewL( TPluginParams* aParams );
-    
-    /**
-     * Destructor
-     */
-    ~CCaRunningAppHandler();
-
-private:
-    /**
-     * First step construction.
-     */
-    CCaRunningAppHandler();
-    
-    /**
-     * Second step construction. 
-     */
-    void ConstructL( CCaStorageProxy& aStorage );
-
-private: //form MCaRunningTaskHandler
-    /**
-     * @see MCaRunningTaskHandler
-     */
-    void RegisterTaskL( CBase* aTask );
-    
-    /**
-     * @see MCaRunningTaskHandler
-     */
-    void UnregisterTask( CBase* aTask );
-
-private:
-    /**
-     * List of running tasks.
-     * Own.
-     */
-    RPointerArray<CBase> iRunningTasks;
-    };
-#endif //C_CARUNNINGAPPHANDLER_H
--- a/contentstorage/casrv/carunningappmonitor/inc/carunningappmonitor.h	Wed Aug 18 10:39:24 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +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: ccarunningappmonitor.h
-*
-*/
-#ifndef C_CARUNNINGTASKHANDLER_H
-#define C_CARUNNINGTASKHANDLER_H
-
-#include "carunningtaskhandler.h"
-#include <e32base.h>
-#include <w32std.h>
-#include <e32hashtab.h>
-
-class CApaWindowGroupName;
-class CCaStorageProxy;
-NONSHARABLE_CLASS( CCaRunningAppMonitor ): public CActive
-    {
-public:
-    /**
-     * Function create monitor instance and initialize observation process.
-     * Monitor instance will be registered on task handler.
-     * @param aTaskHandler - task handler instance
-     * @param aStorage - content storage proxy instance
-     */
-    static void ExecuteL( MCaRunningTaskHandler& aTaskHandler, 
-                          CCaStorageProxy& aStorage );
-    
-    /**
-     * Destructor
-     */
-    ~CCaRunningAppMonitor();
-
-private:
-    /**
-     * First step constructor.
-     */
-    CCaRunningAppMonitor( MCaRunningTaskHandler& aTaskHandler,
-                          CCaStorageProxy& aStorage );
-    
-    /**
-     * Second step constructor
-     */
-    void ConstructL();
-    
-    /**
-     * Function update content storage with running applications list
-     */
-    void UpdateRunningAppStorageL();
-    
-    /**
-     * Function subscribe monitor to window server events
-     */
-    void Subscribe();
-    
-    /**
-     * Function create window group to observe window server events
-     */
-    void ConstractObserverL();
-    
-    /**
-     * Function mark all storage entries as "not running"
-     */
-    void ResetStorageL();
-
-private: //from CActive
-    /**
-     * @see CActive
-     */
-    void RunL();
-    
-    /**
-     * @see CActive
-     */
-    TInt RunError( TInt aError );
-    
-    /**
-     * @see CActive
-     */
-    void DoCancel();
-
-private:
-    //members
-    
-    /**
-     * Reference to task handler.
-     */
-    MCaRunningTaskHandler& iTaskHandler;
-    
-    /**
-     * Reference to constent storage proxy 
-     */
-    CCaStorageProxy& iStorage;
-    
-    /**
-     * IPC session to window server
-     */
-    RWsSession iSession;
-    
-    /**
-     * Window group.
-     */
-    RWindowGroup iWg;
-    
-    /**
-     * Running apps hash map
-     * key - application window group id
-     * value - application uid
-     */
-    RHashMap<TInt, TUid> iRunningTasks;
-    };
-
-#endif //C_CARUNNINGTASKHANDLER_H
--- a/contentstorage/casrv/carunningappmonitor/inc/carunningtaskhandler.h	Wed Aug 18 10:39:24 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +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: carunningtaskhandler.h
-*
-*/
-
-#ifndef M_CARUNNINGTASKHANDLER_H
-#define M_CARUNNINGTASKHANDLER_H
-
-#include <e32base.h>
-
-/**
- * Running task handler.
- * Interface declaration.
- */
-NONSHARABLE_CLASS( MCaRunningTaskHandler )
-    {
-public:
-    /**
-     * Function register running task on handler.
-     * Ownership is transfered to handler
-     * @param aTask - running task
-     */
-    virtual void RegisterTaskL( CBase* aTask )=0;
-    
-    /**
-     * Function unregister running task on handler.
-     * Ownership is transfered to caller.
-     * @param aTask - running task
-     */
-    virtual void UnregisterTask( CBase* aTask )=0;
-    };
-
-#endif //M_CARUNNINGTASKHANDLER_H
-
--- a/contentstorage/casrv/carunningappmonitor/inc/castoragetask.h	Wed Aug 18 10:39:24 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,143 +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: castoragetask.h
-*
-*/
-
-#ifndef C_CASTORAGETASK_H
-#define C_CASTORAGETASK_H
-
-//includes
-#include <e32base.h>
-
-class CCaStorageProxy;
-class CCaInnerEntry;
-class MCaRunningTaskHandler;
-
-/**
- * Class update entry with window group id of running process
- */
-NONSHARABLE_CLASS( CCaStorageTask): public CActive
-    {
-public:
-    /**
-     * Function execute task. Ownership is transfered to task handler.
-     * Task take ownership over window group name.
-     * @param aTaskHandler - running tasks storage
-     * @param aStorage - applications storage
-     * @param aUid - application UID
-     * @param aWgId - application window group id
-     */
-    static void ExecuteL( MCaRunningTaskHandler& aTaskHandler,
-                          CCaStorageProxy& aStorage,
-                          TUid aUid, 
-                          TInt aWgId );
-    
-    /**
-     * Destructor
-     */
-    ~CCaStorageTask();
-private:
-    /**
-     * First step constructor
-     * @param aTaskHandler - running tasks storage
-     * @param aStorage - applications storage
-     * @param aUid - application UID
-     * @param aWgId - application window group id
-     */
-    CCaStorageTask( MCaRunningTaskHandler& aTaskHandler, 
-                    CCaStorageProxy& aStorage, 
-                    TUid aUid, 
-                    TInt aWgId );
-    
-    /**
-     * Second step constructor
-     */
-    void ConstructL();
-    
-    /**
-     * Function unregister task form task handler and release resources allocated for task
-     */
-    void UnregisterD();
-    
-    /**
-     * Function retrive all entry for application.
-     * @param aArray - destination set of application entry
-     */
-    void GetEntriesL( RPointerArray<CCaInnerEntry>& aArray );
-    
-    /**
-     * Function find and update application entry with window group id. 
-     */
-    TInt UpdateEntryL();
-    
-    /**
-     * Functioin update application entry with window group id.
-     * @param aEntry - application entry
-     */
-    TInt UpdateEntryL( CCaInnerEntry& aEntry );
-
-private: //from CActive
-    /**
-     * @see CActive
-     */
-    void RunL();
-    
-    
-    /**
-     * @see CActive
-     */
-    TInt RunError(TInt aError);
-    
-    /**
-     * @see CActive
-     */
-    void DoCancel();
-
-private:
-    //members
-    
-    /**
-     * Reference to task handler instance 
-     */
-    MCaRunningTaskHandler& iTaskHandler;
-    
-    /**
-     * Reference to content storage proxy. 
-     */
-    CCaStorageProxy& iStorage;
-    
-    /**
-     * Application UID
-     */
-    const TUid iUid;
-    
-    /**
-     * Applicaion window group id
-     */
-    const TInt iWgId;
-    
-    /**
-     * Timer to re-activate task if try fail
-     */
-    RTimer iTimer;
-    
-    /**
-     * Task execution counter 
-     */
-    TInt iCount;
-    };
-
-#endif //C_CASTORAGETASK_H
-
--- a/contentstorage/casrv/carunningappmonitor/src/carunningapphandler.cpp	Wed Aug 18 10:39:24 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +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: carunningapphandler.cpp
-*
-*/
-#include "carunningapphandler.h"
-
-#include "cadef.h"
-#include "carunningappmonitor.h"
-
-// -----------------------------------------------------------------------------
-// CCaRunningAppHandler
-// -----------------------------------------------------------------------------
-//
-CCaRunningAppHandler* CCaRunningAppHandler::NewL( TPluginParams* aParams )
-    {
-    if( aParams == 0 || aParams->storageProxy == 0 )
-        {
-        User::Leave(KErrCorrupt);
-        }
-    CCaRunningAppHandler* self = new (ELeave)CCaRunningAppHandler();
-    CleanupStack::PushL( self );
-    self->ConstructL( *aParams->storageProxy );
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-// -----------------------------------------------------------------------------
-// CCaRunningAppHandler
-// -----------------------------------------------------------------------------
-//
-CCaRunningAppHandler::~CCaRunningAppHandler()
-    {
-    iRunningTasks.ResetAndDestroy();
-    }
-
-// -----------------------------------------------------------------------------
-// CCaRunningAppHandler
-// -----------------------------------------------------------------------------
-//
-CCaRunningAppHandler::CCaRunningAppHandler()
-:
-iRunningTasks( KDefaultGranularity )
-    {
-    //no implementation required
-    }
-
-// -----------------------------------------------------------------------------
-// ConstructL
-// -----------------------------------------------------------------------------
-//
-void CCaRunningAppHandler::ConstructL( CCaStorageProxy& aStorage )
-    {
-    CCaRunningAppMonitor::ExecuteL( *this, aStorage );
-    }
-
-// -----------------------------------------------------------------------------
-// RegisterTaskL
-// -----------------------------------------------------------------------------
-//
-void CCaRunningAppHandler::RegisterTaskL( CBase* aTask )
-    {
-    iRunningTasks.AppendL( aTask );
-    }
-
-// -----------------------------------------------------------------------------
-// UnregisterTask
-// -----------------------------------------------------------------------------
-//
-void CCaRunningAppHandler::UnregisterTask( CBase* aTask )
-    {
-    const TInt index( iRunningTasks.FindReverse( aTask ) );
-    if( index != KErrNotFound )
-        {
-        iRunningTasks.Remove( index );
-        }
-    }
--- a/contentstorage/casrv/carunningappmonitor/src/carunningappmonitor.cpp	Wed Aug 18 10:39:24 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,240 +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: cadrmscanner.mmp
-*
-*/
-
-#include <apgwgnam.h>
-
-#include "carunningappmonitor.h"
-#include "cadef.h"
-#include "castoragetask.h"
-#include "cainnerquery.h"
-#include "cainnerentry.h"
-#include "caarraycleanup.inl"
-#include "castorageproxy.h"
-
-const TInt KRunningAppGranularity(10);
-// -----------------------------------------------------------------------------
-// ExecuteL
-// -----------------------------------------------------------------------------
-//
-void CCaRunningAppMonitor::ExecuteL( MCaRunningTaskHandler& aTaskHandler,
-                                     CCaStorageProxy& aStorage )
-    {
-    CCaRunningAppMonitor* self = 
-        new (ELeave)CCaRunningAppMonitor( aTaskHandler, aStorage );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop( self );
-    }
-
-// -----------------------------------------------------------------------------
-// ~CCaRunningAppMonitor
-// -----------------------------------------------------------------------------
-//
-CCaRunningAppMonitor::~CCaRunningAppMonitor()
-    {
-    Cancel();
-    iWg.Close();
-    iSession.Close();
-    iRunningTasks.Close();
-    }
-
-// -----------------------------------------------------------------------------
-// CCaRunningAppMonitor
-// -----------------------------------------------------------------------------
-//
-CCaRunningAppMonitor::CCaRunningAppMonitor( MCaRunningTaskHandler& aTaskHandler, 
-                                            CCaStorageProxy& aStorage )
-:
-CActive( EPriorityStandard ),
-iTaskHandler( aTaskHandler ),
-iStorage( aStorage )
-    {
-    CActiveScheduler::Add( this );
-    }
-
-// -----------------------------------------------------------------------------
-// ConstructL
-// -----------------------------------------------------------------------------
-//
-void CCaRunningAppMonitor::ConstructL()
-    {
-    //Create window server observer
-    ConstractObserverL();
-    
-    //start listen
-    Subscribe();
-    
-    //At plugin start mark all entry as "not running"
-    ResetStorageL();
-    
-    iTaskHandler.RegisterTaskL(this);//this operation has to be as a last one
-    }
-
-// -----------------------------------------------------------------------------
-// UpdateRunningAppStorageL
-// -----------------------------------------------------------------------------
-//
-void CCaRunningAppMonitor::UpdateRunningAppStorageL()
-    {
-    RArray<RWsSession::TWindowGroupChainInfo> 
-        windowGroupIds(KRunningAppGranularity, 
-                       _FOFF( RWsSession::TWindowGroupChainInfo, iId ));
-    CleanupClosePushL( windowGroupIds );
-    User::LeaveIfError( iSession.WindowGroupList( 0, &windowGroupIds ) );
-    TInt itemIndex( KErrNotFound );
-    
-    //Verify what apps has stopped
-    THashMapIter<TInt, TUid> iterator( iRunningTasks );
-    RWsSession::TWindowGroupChainInfo item = { KErrNotFound, KErrNotFound };
-    while( 0 != iterator.NextKey() )
-        {
-        item.iId = *iterator.CurrentKey();
-        itemIndex = windowGroupIds.Find(item);
-        if(KErrNotFound == itemIndex)
-            {
-            //push new task to register application update in storage
-            CCaStorageTask::ExecuteL( iTaskHandler,
-                                      iStorage,
-                                      *iterator.CurrentValue(),
-                                      KErrNotFound );
-            iterator.RemoveCurrent();
-            }
-        else
-            {
-            //application is already registered.
-            //remove entry to skip its processing
-            windowGroupIds.Remove( itemIndex );
-            }
-        }
-    
-    //Verify what apps has started
-    const TInt count(windowGroupIds.Count());
-    for(TInt iter(0); iter < count; ++iter)
-        {
-        if( 0 >= windowGroupIds[iter].iParentId )
-            {
-            //push new task to register application update in storage and
-            //register it running task list 
-            CApaWindowGroupName* name = 
-                CApaWindowGroupName::NewLC( iSession, windowGroupIds[iter].iId);
-            if( 0 != name->AppUid().iUid )
-                {
-                CCaStorageTask::ExecuteL( iTaskHandler,
-                                          iStorage,
-                                          name->AppUid(),
-                                          windowGroupIds[iter].iId );
-                iRunningTasks.Insert( windowGroupIds[iter].iId,
-                                      name->AppUid() );
-                }
-            CleanupStack::PopAndDestroy( name );
-            }
-        }
-    CleanupStack::PopAndDestroy( &windowGroupIds );
-    }
-
-// -----------------------------------------------------------------------------
-// Subscribe
-// -----------------------------------------------------------------------------
-//
-void CCaRunningAppMonitor::Subscribe()
-    {
-    if( !IsActive() )
-        {
-        iSession.EventReady( &iStatus );
-        SetActive();
-        }
-    }
-
-// -----------------------------------------------------------------------------
-// ConstractObserverL
-// -----------------------------------------------------------------------------
-//
-void CCaRunningAppMonitor::ConstractObserverL()
-{
-    User::LeaveIfError( iSession.Connect() );
-    iWg = RWindowGroup( iSession );
-    User::LeaveIfError( iWg.Construct( 
-                        reinterpret_cast<TUint32>( &iWg ) ) );
-    iWg.DisableFocusChangeEvents();
-    iWg.DisableModifierChangedEvents();
-    iWg.DisableOnEvents();
-    iWg.DisableScreenChangeEvents();
-
-    //enable notifications about group lists
-    User::LeaveIfError( iWg.EnableGroupListChangeEvents() );
-}
-
-// -----------------------------------------------------------------------------
-// ResetStorageL
-// -----------------------------------------------------------------------------
-//
-void CCaRunningAppMonitor::ResetStorageL()
-{
-    CCaInnerQuery* allAppQuery = CCaInnerQuery::NewLC();
-    allAppQuery->SetFlagsOn( ERunning );
-    RPointerArray<CCaInnerEntry> entries;
-    CleanupResetAndDestroyPushL( entries );
-    iStorage.GetEntriesL( allAppQuery, entries );
-    for( TInt i(0); i < entries.Count(); ++i )
-        {
-        CCaStorageTask::ExecuteL( iTaskHandler,
-                                  iStorage,
-                                  TUid::Uid(entries[i]->GetUid()),
-                                  KErrNotFound );
-        }
-    CleanupStack::PopAndDestroy(&entries);
-    CleanupStack::PopAndDestroy(allAppQuery);
-}
-
-// -----------------------------------------------------------------------------
-// RunL
-// -----------------------------------------------------------------------------
-//
-void CCaRunningAppMonitor::RunL()
-    {
-    User::LeaveIfError( iStatus.Int() );
-    TWsEvent event;
-    iSession.GetEvent( event );
-    Subscribe();//new subscribtion has to be called after picking event
-    if( EEventWindowGroupListChanged == event.Type() )
-        {
-        UpdateRunningAppStorageL();
-        }
-    }
-
-// -----------------------------------------------------------------------------
-// RunError
-// -----------------------------------------------------------------------------
-//
-TInt CCaRunningAppMonitor::RunError( TInt /*aError*/ )
-    {
-    //ignore error
-    Subscribe();
-    return KErrNone;
-    }
-
-// -----------------------------------------------------------------------------
-// DoCancel
-// -----------------------------------------------------------------------------
-//
-void CCaRunningAppMonitor::DoCancel()
-    {
-    if( IsActive() )
-        {
-        iSession.EventReadyCancel();
-        }
-    }
--- a/contentstorage/casrv/carunningappmonitor/src/castoragetask.cpp	Wed Aug 18 10:39:24 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,196 +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: castoragetask.cpp
-*
-*/
-#include <apgwgnam.h>
-#include <s32strm.h>
-
-#include "castoragetask.h"
-#include "cadef.h"
-#include "cainnerquery.h"
-#include "cainnerentry.h"
-#include "castorageproxy.h"
-#include "carunningtaskhandler.h"
-#include "caarraycleanup.inl"
-#include "cadef.h"
-
-const TInt KDelayTaskRetry(10000);
-const TInt KMaxTaskRetry(1);
-
-// -----------------------------------------------------------------------------
-// ExecuteL
-// -----------------------------------------------------------------------------
-//
-void CCaStorageTask::ExecuteL( MCaRunningTaskHandler& aTaskHandler,
-                               CCaStorageProxy& aStorage,
-                               TUid aUid,
-                               TInt aWgi )
-    {
-    CCaStorageTask* self = 
-        new (ELeave)CCaStorageTask( aTaskHandler, aStorage, aUid, aWgi );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    //task instance is registered on task handler. shouldn't be deleted here
-    CleanupStack::Pop( self );
-    }
-
-// -----------------------------------------------------------------------------
-// ~CCaStorageTask
-// -----------------------------------------------------------------------------
-//
-CCaStorageTask::~CCaStorageTask()
-    {
-    Cancel();
-    iTimer.Close();
-    }
-
-// -----------------------------------------------------------------------------
-// CCaStorageTask
-// -----------------------------------------------------------------------------
-//
-CCaStorageTask::CCaStorageTask( MCaRunningTaskHandler& aTaskHandler,
-                                CCaStorageProxy& aStorage,
-                                TUid aUid,
-                                TInt aWgId )
-:
-CActive( EPriorityLow ),
-iTaskHandler( aTaskHandler ),
-iStorage( aStorage ),
-iUid( aUid ),
-iWgId( aWgId )
-    {
-    CActiveScheduler::Add( this );
-    }
-
-// -----------------------------------------------------------------------------
-// ConstructL
-// -----------------------------------------------------------------------------
-//
-void CCaStorageTask::ConstructL()
-    {
-    User::LeaveIfError( iTimer.CreateLocal() );
-    iStatus = KRequestPending;
-    TRequestStatus* status = &iStatus;
-    User::RequestComplete( status, KErrNone );
-    SetActive();
-    iTaskHandler.RegisterTaskL( this );
-    }
-
-// -----------------------------------------------------------------------------
-// UnregisterD
-// -----------------------------------------------------------------------------
-//
-void CCaStorageTask::UnregisterD()
-    {
-    iTaskHandler.UnregisterTask( this );
-    delete this;
-    }
-
-// -----------------------------------------------------------------------------
-// GetEntriesL
-// -----------------------------------------------------------------------------
-//
-void CCaStorageTask::GetEntriesL( RPointerArray<CCaInnerEntry>& aArray )
-    {
-    CCaInnerQuery* allAppQuery = CCaInnerQuery::NewLC();
-    allAppQuery->SetUid( static_cast<TUint>( iUid.iUid ) );
-    iStorage.GetEntriesL( allAppQuery, aArray );
-    CleanupStack::PopAndDestroy( allAppQuery );
-    }
-
-// -----------------------------------------------------------------------------
-// UpdateEntryL
-// -----------------------------------------------------------------------------
-//
-TInt CCaStorageTask::UpdateEntryL()
-    {
-    TInt retVal( KErrNone );
-    RPointerArray<CCaInnerEntry> entries;
-    CleanupResetAndDestroyPushL( entries );
-    GetEntriesL( entries );
-    //update only first found entry. othere are just ignored
-    retVal = (0 < entries.Count()) ? UpdateEntryL( *entries[0] ) : KErrNotFound;
-    CleanupStack::PopAndDestroy( &entries );
-    return retVal;
-    }
-
-// -----------------------------------------------------------------------------
-// UpdateEntryL
-// -----------------------------------------------------------------------------
-//
-TInt CCaStorageTask::UpdateEntryL( CCaInnerEntry& aEntry )
-    {
-    if(KErrNotFound == iWgId)
-        {
-        aEntry.SetFlags( aEntry.GetFlags() & ~ERunning );
-        RBuf currValue;//temporary variable required to verify if attr exists
-        CleanupClosePushL( currValue );
-        currValue.CreateL( KCaMaxAttrValueLen );
-        if( aEntry.FindAttribute( KCaAttrWindowGroupId, currValue ) )
-            {
-            aEntry.RemoveAttributeL( KCaAttrWindowGroupId );
-            }
-        CleanupStack::PopAndDestroy( &currValue );
-        }
-    else
-        {
-        aEntry.SetFlags(aEntry.GetFlags() | ERunning);
-        RBuf newValue;
-        CleanupClosePushL(newValue);
-        newValue.CreateL(KCaMaxAttrValueLen);
-        newValue.Num(iWgId);
-        aEntry.AddAttributeL( KCaAttrWindowGroupId, newValue );
-        CleanupStack::PopAndDestroy( &newValue );
-        }
-    iStorage.AddL( &aEntry );
-    return KErrNone;
-    }
-
-// -----------------------------------------------------------------------------
-// RunL
-// -----------------------------------------------------------------------------
-//
-void CCaStorageTask::RunL()
-    {
-    User::LeaveIfError( iStatus.Int() );
-    if( KErrNone == UpdateEntryL() ||  KMaxTaskRetry <= iCount++ )
-        {
-        UnregisterD();
-        }
-    else
-        {
-        iTimer.After( iStatus, TTimeIntervalMicroSeconds32( KDelayTaskRetry ) );
-        SetActive();
-        }
-    }
-
-// -----------------------------------------------------------------------------
-// RunError
-// -----------------------------------------------------------------------------
-//
-TInt CCaStorageTask::RunError( TInt /*aError*/ )
-    {
-    UnregisterD();
-    return KErrNone;
-    }
-
-// -----------------------------------------------------------------------------
-// DoCancel
-// -----------------------------------------------------------------------------
-//
-void CCaStorageTask::DoCancel()
-    {
-    iTimer.Cancel();
-    }
--- a/contentstorage/casrv/carunningappmonitor/src/proxy.cpp	Wed Aug 18 10:39:24 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +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: proxy.cpp
-*
-*/
-#include <e32std.h>
-#include <ecom/implementationproxy.h>
-#include "carunningapphandler.h"
-
-// Provides a key value pair table, this is used to identify
-// the correct construction function for the requested interface.
-const TImplementationProxy ImplementationTable[] =
-    {
-    IMPLEMENTATION_PROXY_ENTRY( 0x200267B5, CCaRunningAppHandler::NewL )
-    };
-
-// Function used to return an instance of the proxy table.
-EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
-        TInt& aTableCount )
-    {
-    aTableCount = sizeof( ImplementationTable )
-            / sizeof(TImplementationProxy);
-    return ImplementationTable;
-    }
--- a/contentstorage/casrv/causifscanner/src/causifscanner.cpp	Wed Aug 18 10:39:24 2010 +0300
+++ b/contentstorage/casrv/causifscanner/src/causifscanner.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -156,6 +156,10 @@
         {
         aCaEntry->AddAttributeL( KCaAttrAppType, KCaAttrAppTypeValueJava );
         }
+    else if( !aEntry->SoftwareType().Compare( KSoftwareTypeWidget ) )
+        {
+        aCaEntry->AddAttributeL( KCaAttrAppType, KCaAttrAppTypeValueCWRT );
+        } 
     if( aEntry->Name().Compare( KNullDesC ) )
         {
         aCaEntry->SetTextL( aEntry->Name() );
--- a/contentstorage/castorage/conf/CI_castoragedb.confml	Wed Aug 18 10:39:24 2010 +0300
+++ b/contentstorage/castorage/conf/CI_castoragedb.confml	Mon Sep 13 13:26:33 2010 +0300
@@ -28,18 +28,18 @@
 				<desc>Icon Theme id. </desc>
 			</setting>
 		</setting>
-		<setting ref="OperatorURLs"	 name="Operator URLs"  minOccurs="0" type="sequence" mapKey="OperatorURLTitle" mapValue="OperatorURLTitle">
-			<setting ref="OperatorURLTitle" name="Operator URL Title" type="string">
+		<setting ref="OperatorURLs"	 name="Operator URLs"  minOccurs="0" type="sequence" mapKey="URLTitle" mapValue="URLTitle">
+			<setting ref="URLTitle" name="Operator URL Title" type="string" required="true">
 				<desc>Title of the Operator URL</desc>
 			</setting>	 
-			<setting ref="OperatorURLShortTitle" name="Operator URL Short Title" type="string" required="true">
+			<setting ref="URLShortTitle" name="Operator URL Short Title" type="string">
 				<desc>Short Title of the Operator URL. Optional. Displayed when shortcut to Url is added to Homescreen</desc>
 			</setting>	 			
-			<setting ref="OperatorURL" name="Operator URL" type="string" required="true">
+			<setting ref="URL" name="Operator URL" type="string" required="true">
 				<desc>URL</desc>
 				<xs:pattern value="(http(|s)://([\w-]+\.)+[\w-]+(:[0-9]{1,5})?(/[\w- ./?%&amp;=]*)?|)"/>
 			</setting>
-			<setting ref="OperatorURLIcon" name="Operator URL Icon" type="file">
+			<setting ref="URLIcon" name="Operator URL Icon" type="file">
 				<desc>Icon for the Operator URL.</desc>
 				<property name="type" value="image/svg" unit="mime"/>
 				<localPath></localPath>
@@ -58,7 +58,7 @@
 			</setting>
 			<setting ref="Application" name="Application" type="string" relevant="Type='1'" required="true">
 				<desc>Application item for Operator collection.</desc>
-				<xs:pattern value="^[-+]?[0-9]{10}"/>
+				<xs:pattern value="^[-+]?[0-9]{1,10}"/>
 				<!-- option map="DFSFeatures/Application"/>
 				<option map="CIA_PreinstalledContent/PreInstalledJavaRom"/>
 				<option map="CIA_PreinstalledContent/PreInstalledSymbianROM"/>
@@ -70,7 +70,7 @@
 				<!-- option map="HomescreenWidgets/Widgets"/>
 				<option map="CIA_PreinstalledWidgetUDA/PreInstalledWidgetUDA" /-->
 			</setting>
-			<setting ref="OperatorURL" name="Operator URL" type="selection" relevant="Type='3'" required="true">		
+			<setting ref="URL" name="Operator URL" type="selection" relevant="Type='3'" required="true">		
 				<option map="CaStorageDbSetting/OperatorURLs"/>
 			</setting>
 		</setting>
@@ -94,8 +94,8 @@
         <setting ref="GroupName" name="Collection Group Name" type="string">
             <desc>Group name. Not localized name. Identify collection where application with predefined group name should be added after installation.</desc>
         </setting>
-        <setting ref="Locked" name="Lock Operator Collection and content" type="boolean">
-            <desc>Lock operator collection and content - user can not delete operator collection, prevent renaming collection and even content. Not possible by user to add new content to defined collection</desc>
+        <setting ref="Locked" name="Lock Collection and content" type="boolean">
+            <desc>Lock collection and content - user cannot delete collection, prevent renaming collection and even content. Not possible by user to add new content to defined collection</desc>
         </setting>
         <setting ref="Icon" name="Collection Icon" type="file" >
             <desc>Icon.</desc>
@@ -139,7 +139,7 @@
 			</setting>
 			<setting ref="Application" name="Application" type="string" relevant="Type='1'" required="true">
 				<desc>Application item for Operator collection.</desc>
-				<xs:pattern value="^[-+]?[0-9]{10}"/>
+				<xs:pattern value="^[-+]?[0-9]{1,10}"/>
 				<!-- option map="DFSFeatures/Application"/>
 				<option map="CIA_PreinstalledContent/PreInstalledJavaRom"/>
 				<option map="CIA_PreinstalledContent/PreInstalledSymbianROM"/>
--- a/contentstorage/castorage/conf/castoragedb.confml	Wed Aug 18 10:39:24 2010 +0300
+++ b/contentstorage/castorage/conf/castoragedb.confml	Mon Sep 13 13:26:33 2010 +0300
@@ -18,11 +18,11 @@
             </URLs>
             
             <OperatorURLs template="true">
-                 <OperatorURLIcon><localPath>dummy</localPath></OperatorURLIcon>
+                 <URLIcon><localPath>dummy</localPath></URLIcon>
             </OperatorURLs>
             
             <Collections extensionPolicy="append"><LocalizeNames>true</LocalizeNames><TranslationFile>contentstorage</TranslationFile><Name>txt_applib_dblist_essentials</Name>
-                <ShortName/><TitleName>txt_applib_subtitle_essentials</TitleName><GroupName>Favorites</GroupName><Locked>true</Locked>
+                <ShortName/><TitleName>txt_applib_subtitle_essentials</TitleName><GroupName>Favorites</GroupName><Locked>false</Locked>
                 <Icon><localPath>dummy</localPath></Icon><IconSkinId/>
             </Collections>
             
@@ -32,24 +32,26 @@
                 <Comments>Camera</Comments></confml:Items>
             <confml:Items><confml:Type>1</confml:Type><confml:Application>537014009</confml:Application><ColName map="CaStorageDbSetting/Collections[@key='txt_applib_dblist_essentials']"></ColName>
                 <Comments>Contacts</Comments></confml:Items>
+            <confml:Items><confml:Type>1</confml:Type><confml:Application>537026521</confml:Application><ColName map="CaStorageDbSetting/Collections[@key='txt_applib_dblist_essentials']"></ColName>
+                <Comments>Control panel</Comments></confml:Items>
             <confml:Items><confml:Type>1</confml:Type><confml:Application>537023930</confml:Application><ColName map="CaStorageDbSetting/Collections[@key='txt_applib_dblist_essentials']"></ColName>
                 <Comments>Email</Comments></confml:Items>
-            <confml:Items><confml:Type>1</confml:Type><confml:Application>270530934</confml:Application><ColName map="CaStorageDbSetting/Collections[@key='txt_applib_dblist_essentials']"></ColName>
+            <confml:Items><confml:Type>1</confml:Type><confml:Application>537067342</confml:Application><ColName map="CaStorageDbSetting/Collections[@key='txt_applib_dblist_essentials']"></ColName>
                 <Comments>FM Radio</Comments></confml:Items>
-            <confml:Items><confml:Type>1</confml:Type><confml:Application>222242222</confml:Application><ColName map="CaStorageDbSetting/Collections[@key='txt_applib_dblist_essentials']"></ColName>
-                <Comments></Comments></confml:Items>
-            <confml:Items><confml:Type>1</confml:Type><confml:Application>222332222</confml:Application><ColName map="CaStorageDbSetting/Collections[@key='txt_applib_dblist_essentials']"></ColName>
-                <Comments></Comments></confml:Items>
+            <confml:Items><confml:Type>1</confml:Type><confml:Application>536878947</confml:Application><ColName map="CaStorageDbSetting/Collections[@key='txt_applib_dblist_essentials']"></ColName>
+                <Comments>Maps</Comments></confml:Items>
             <confml:Items><confml:Type>1</confml:Type><confml:Application>537001593</confml:Application><ColName map="CaStorageDbSetting/Collections[@key='txt_applib_dblist_essentials']"></ColName>
                 <Comments>Messaging</Comments></confml:Items>
             <confml:Items><confml:Type>1</confml:Type><confml:Application>270564450</confml:Application><ColName map="CaStorageDbSetting/Collections[@key='txt_applib_dblist_essentials']"></ColName>
                 <Comments>Music</Comments></confml:Items>
-            <confml:Items><confml:Type>1</confml:Type><confml:Application>536913858</confml:Application><ColName map="CaStorageDbSetting/Collections[@key='txt_applib_dblist_essentials']"></ColName>
-                <Comments>Photos</Comments></confml:Items>
-            <confml:Items><confml:Type>1</confml:Type><confml:Application>268458220</confml:Application><ColName map="CaStorageDbSetting/Collections[@key='txt_applib_dblist_essentials']"></ColName>
-                <Comments>Settings</Comments></confml:Items>
-            <confml:Items><confml:Type>1</confml:Type><confml:Application>222111222</confml:Application><ColName map="CaStorageDbSetting/Collections[@key='txt_applib_dblist_essentials']"></ColName>
-                <Comments></Comments></confml:Items>
+            <confml:Items><confml:Type>1</confml:Type><confml:Application>536873492</confml:Application><ColName map="CaStorageDbSetting/Collections[@key='txt_applib_dblist_essentials']"></ColName>
+                <Comments>Photos</Comments></confml:Items>                
+            <confml:Items><confml:Type>1</confml:Type><confml:Application>537006590</confml:Application><ColName map="CaStorageDbSetting/Collections[@key='txt_applib_dblist_essentials']"></ColName>
+                <Comments>Videos</Comments></confml:Items>
+            <confml:Items><confml:Type>1</confml:Type><confml:Application>268471609</confml:Application><ColName map="CaStorageDbSetting/Collections[@key='txt_applib_dblist_essentials']"></ColName>
+                <Comments>NokiaBrowser</Comments></confml:Items>
+            <confml:Items><confml:Type>1</confml:Type><confml:Application>537055359</confml:Application><ColName map="CaStorageDbSetting/Collections[@key='txt_applib_dblist_essentials']"></ColName>
+                <Comments>OVI</Comments></confml:Items>
         </confml:CaStorageDbSetting>
     </confml:data>
 
--- a/contentstorage/castorage/conf/castoragedb.implml	Wed Aug 18 10:39:24 2010 +0300
+++ b/contentstorage/castorage/conf/castoragedb.implml	Mon Sep 13 13:26:33 2010 +0300
@@ -52,7 +52,7 @@
             <include files="${CaStorageDbSetting.OperatorCollections.Icon.localPath}"/>
         </input>
         <input>
-            <include files="${CaStorageDbSetting.OperatorURLs.OperatorURLIcon.localPath}"/>
+            <include files="${CaStorageDbSetting.OperatorURLs.URLIcon.localPath}"/>
         </input>
         </output>
     </content>
--- a/contentstorage/castorage/conf/castoragedb_templates/castoragedb_variant.sql	Wed Aug 18 10:39:24 2010 +0300
+++ b/contentstorage/castorage/conf/castoragedb_templates/castoragedb_variant.sql	Mon Sep 13 13:26:33 2010 +0300
@@ -1,99 +1,101 @@
 SELECT "------------------------------------" AS " ";
 SELECT "castoragedb_variant - BEGIN" AS " ";
 
-{% for col in range(feat_tree.CaStorageDbSetting.OperatorCollections._value|length) -%}
-    {%- set Name = feat_tree.CaStorageDbSetting.OperatorCollections.Name._value[col] or '' -%}
-    {%- set ShortName = feat_tree.CaStorageDbSetting.OperatorCollections.ShortName._value[col] or '' -%}
-    {%- set TitleName = feat_tree.CaStorageDbSetting.OperatorCollections.TitleName._value[col] or '' -%}
-    {%- set GroupName = feat_tree.CaStorageDbSetting.OperatorCollections.GroupName._value[col] or '' -%}
-    {%- set Locked = feat_tree.CaStorageDbSetting.OperatorCollections.Locked._value[col] or false -%}
-    {%- set IconFileName = ( feat_tree.CaStorageDbSetting.OperatorCollections.Icon.localPath._value[col] or '' ) -%}
-    {%- set IconSkinId = feat_tree.CaStorageDbSetting.OperatorCollections.IconSkinId._value[col] or '' -%}
-    {% if IconSkinId == "" and IconFileName != "" and IconFileName != "dummy" -%}
-        {% set IconFileName = "z:\\private\\20022F35\\customsvg\\" + IconFileName %}
-    {% endif %}
-INSERT INTO COLLECTION (COLLECTION_NAME, COL_APP_GROUP_NAME, FLAGS {% if TitleName -%},  COL_TITLE_NAME{%- endif %} {% if ShortName -%}, COL_SHORT_NAME{%- endif %}, ICON_FILENAME, ICON_SKIN_ID) 
-VALUES ( '{{Name}}', '{{GroupName}}', {% if Locked -%} 12 {% else %} 8 {%- endif %} {% if TitleName -%}, "{{TitleName}}"{%- endif %} {% if ShortName -%}, "{{ShortName}}"{%- endif %}, "{{IconFileName}}", "{{IconSkinId}}");
-{% endfor %}
+{%- macro stripPath(IconPath) %}
+    {%- set cont = true -%}
+    {%- set Icon = '' -%}
+    {%- for c in IconPath|reverse|list -%}
+        {%- if c == '\\' or c == '/' -%}
+            {%- set cont = false -%}
+        {%- endif %}
+        {%- if cont %}
+            {%- set Icon = c ~ Icon %}
+        {%- endif %}
+        {%- if loop.last -%}
+            {{ "z:\\private\\20022F35\\customsvg\\" ~ Icon }}
+        {%- endif %}
+    {%- endfor %}
+{%- endmacro %}
 
-{% for i in range(feat_tree.CaStorageDbSetting.OperatorURLs._value|length) -%}
-    {% set URLTitle = feat_tree.CaStorageDbSetting.OperatorURLs.OperatorURLTitle._value[i] %}
-    {%- set URLShortTitle = feat_tree.CaStorageDbSetting.OperatorURLs.OperatorURLShortTitle._value[i] or '' -%}
-    {%- set URL = feat_tree.CaStorageDbSetting.OperatorURLs.OperatorURL._value[i] or '' -%}
-    {%- set URLIcon = feat_tree.CaStorageDbSetting.OperatorURLs.OperatorURLIcon.localPath._value[i] or '' -%}
-    {%- set IconSkinId = feat_tree.CaStorageDbSetting.OperatorURLs.IconSkinId._value[i] or '' -%}
-    {% if IconSkinId == "" and URLIcon != "" and URLIcon != "dummy" -%}
-        {% set URLIcon = "z:\\private\\20022F35\\customsvg\\" + URLIcon %}
-    {% endif %}
-    INSERT INTO URL ( URL_TITLE {% if URLShortTitle -%}, URL_SHORT_TITLE{%- endif %}, URL_DEST, ICON_FILENAME, ICON_SKIN_ID )
-    VALUES ('{{URLTitle}}' {% if URLShortTitle -%}, "{{URLShortTitle}}"{%- endif %}, "{{URL}}", "{{URLIcon}}", "{{IconSkinId}}" );
-{% endfor %}
-
-{% for index in range(feat_tree.CaStorageDbSetting.OperatorCollectionItems._value|length) -%}
-    {% set Collection = feat_tree.CaStorageDbSetting.OperatorCollections.Name._value[0] %}
-    {%- set Type = feat_tree.CaStorageDbSetting.OperatorCollectionItems.Type._value[index] or '' -%}
-    {%- set Application = feat_tree.CaStorageDbSetting.OperatorCollectionItems.Application._value[index] or '' -%}
-    {%- set OperatorURLTitle = feat_tree.CaStorageDbSetting.OperatorCollectionItems.OperatorURL._value[index] or '' -%}
-    {%- set HomescreenWidget = feat_tree.CaStorageDbSetting.OperatorCollectionItems.HomescreenWidget._value[index] or '' -%}
-{% if Type == "1" -%} INSERT INTO ITEM_TO_COLLECTION (ITEM_TYPE, ITEM_NAME, ITEM_DEST, COLLECTION_NAME) 
-  VALUES ("application", '', {{Application}},  '{{Collection}}' );{%- endif %}
-{% if Type == "3" -%}
-  {% for i in range(feat_tree.CaStorageDbSetting.OperatorURLs._value|length) if OperatorURLTitle == feat_tree.CaStorageDbSetting.OperatorURLs.OperatorURLTitle._value[i] -%}
-    INSERT INTO ITEM_TO_COLLECTION (ITEM_TYPE, ITEM_NAME, COLLECTION_NAME)
-    VALUES ( "url", '{{OperatorURLTitle}}',  '{{Collection}}' );
-  {% endfor %}
-{%- endif %}
-{% if Type == "2" -%} INSERT INTO WIDGET_TO_COLLECTION (ITEM_TYPE, ITEM_NAME, ICON_FILENAME, ICON_SKIN_ID, URI, COLLECTION_NAME ) 
-  VALUES ("widget", '', '', '', "{{HomescreenWidget}}", '{{Collection}}' ); {%- endif %}
-{% endfor %}
+{%- macro processURLs(URLs) %}
+    {%- for i in range(feat_tree.CaStorageDbSetting[URLs]._value|length) -%}
+        {%- set URLTitle = feat_tree.CaStorageDbSetting[URLs].URLTitle._value[i] -%}
+        {%- set URLShortTitle = feat_tree.CaStorageDbSetting[URLs].URLShortTitle._value[i] or '' -%}
+        {%- set URL = feat_tree.CaStorageDbSetting[URLs].URL._value[i] or '' -%}
+        {%- set URLIcon = feat_tree.CaStorageDbSetting[URLs].URLIcon.localPath._value[i] or '' -%}
+        {%- set IconSkinId = feat_tree.CaStorageDbSetting[URLs].IconSkinId._value[i] or '' -%}
+        {%- if IconSkinId == "" and URLIcon != "" and URLIcon != "dummy" -%}
+            {%- set URLIcon = stripPath(URLIcon) -%}
+        {%- endif %}
+        INSERT INTO URL ( URL_TITLE, URL_SHORT_TITLE, URL_DEST, ICON_FILENAME, ICON_SKIN_ID ) 
+        VALUES ( '{{URLTitle}}', "{{URLShortTitle}}", "{{URL}}", "{{URLIcon}}", "{{IconSkinId}}" );
+    {%- endfor %}
+{%- endmacro %}
 
-{% for col in range(feat_tree.CaStorageDbSetting.Collections._value|length) -%}
-    {%- set Name = feat_tree.CaStorageDbSetting.Collections.Name._value[col] or '' -%}
-    {% set LocalizeNames = feat_tree.CaStorageDbSetting.Collections.LocalizeNames._value[col] or false -%}
-    {%- set ShortName = feat_tree.CaStorageDbSetting.Collections.ShortName._value[col] or '' -%}
-    {%- set TitleName = feat_tree.CaStorageDbSetting.Collections.TitleName._value[col] or '' -%}
-    {%- set GroupName = feat_tree.CaStorageDbSetting.Collections.GroupName._value[col] or '' -%}
-    {%- set Locked = feat_tree.CaStorageDbSetting.Collections.Locked._value[col] or false -%}
-    {%- set TranslationFile = feat_tree.CaStorageDbSetting.Collections.TranslationFile._value[col]|string|reverse|replace('_','',1)|reverse+'_' or ''-%}
-    {%- set IconFileName = feat_tree.CaStorageDbSetting.Collections.Icon.localPath._value[col] or '' -%}
-    {%- set IconSkinId = feat_tree.CaStorageDbSetting.Collections.IconSkinId._value[col] or '' -%}
-    {% if IconSkinId == "" and IconFileName != "" and IconFileName != "dummy" -%}
-        {% set IconFileName = "z:\\private\\20022F35\\customsvg\\" + IconFileName %}
-    {% endif %}
-INSERT INTO COLLECTION (COLLECTION_NAME, COL_APP_GROUP_NAME, FLAGS {% if TitleName -%},  COL_TITLE_NAME{%- endif %}{% if LocalizeNames -%},  TRANSLATION_FILE{%- endif %}{% if ShortName -%}, COL_SHORT_NAME{%- endif %}, ICON_FILENAME, ICON_SKIN_ID) 
-VALUES ( '{{Name}}', '{{GroupName}}', {% if Locked -%} 12 {% else %} 8 {%- endif %} {% if TitleName -%}, "{{TitleName}}"{%- endif %}{% if LocalizeNames -%}, "{{TranslationFile}}"{%- endif %}{% if ShortName -%}, "{{ShortName}}"{%- endif %}, "{{IconFileName}}", "{{IconSkinId}}");
-{% endfor %}
+{% macro processCollections(Collections) -%}
+    {%- for col in range(feat_tree.CaStorageDbSetting[Collections]._value|length) -%}
+        {%- set Name = feat_tree.CaStorageDbSetting[Collections].Name._value[col] or '' -%}
+        {%- set ShortName = feat_tree.CaStorageDbSetting[Collections].ShortName._value[col] or '' -%}
+        {%- set TitleName = feat_tree.CaStorageDbSetting[Collections].TitleName._value[col] or '' -%}
+        {%- set GroupName = feat_tree.CaStorageDbSetting[Collections].GroupName._value[col] or '' -%}
+        {%- set Locked = feat_tree.CaStorageDbSetting[Collections].Locked._value[col] or false -%}
+        {%- set LocalizeNames = false -%}
+        {%- if Collections == "Collections" -%}
+            {%- set LocalizeNames = feat_tree.CaStorageDbSetting[Collections].LocalizeNames._value[col] or false -%}
+            {%- set TranslationFile = feat_tree.CaStorageDbSetting[Collections].TranslationFile._value[col]|string|reverse|replace('_','',1)|reverse~'_' or ''-%}
+        {%- endif %}
+        {%- set IconFileName = feat_tree.CaStorageDbSetting[Collections].Icon.localPath._value[col] or '' -%}
+        {%- set IconSkinId = feat_tree.CaStorageDbSetting[Collections].IconSkinId._value[col] or '' -%}
+        {%- if IconSkinId == "" and IconFileName != "" and IconFileName != "dummy" -%}
+            {%- set IconFileName = stripPath(IconFileName) -%}
+        {%- endif %}
+    INSERT INTO COLLECTION (COLLECTION_NAME, COL_APP_GROUP_NAME, FLAGS,  COL_TITLE_NAME {% if LocalizeNames -%}, TRANSLATION_FILE{%- endif %}, COL_SHORT_NAME, ICON_FILENAME, ICON_SKIN_ID) 
+    VALUES ( '{{Name}}', '{{GroupName}}', {% if Locked -%} 0 {% else %} 4 {%- endif %}, "{{TitleName}}"{% if LocalizeNames -%}, "{{TranslationFile}}"{%- endif %}, "{{ShortName}}", "{{IconFileName}}", "{{IconSkinId}}");
+    {% endfor %}
+{%- endmacro %}
 
-{% for i in range(feat_tree.CaStorageDbSetting.URLs._value|length) -%}
-    {% set URLTitle = feat_tree.CaStorageDbSetting.URLs.URLTitle._value[i] %}
-    {%- set URLShortTitle = feat_tree.CaStorageDbSetting.URLs.URLShortTitle._value[i] or '' -%}
-    {%- set URL = feat_tree.CaStorageDbSetting.URLs.URL._value[i] or '' -%}
-    {%- set URLIcon = feat_tree.CaStorageDbSetting.URLs.URLIcon.localPath._value[i] or '' -%}
-    {%- set IconSkinId = feat_tree.CaStorageDbSetting.URLs.IconSkinId._value[i] or '' -%}
-    {% if IconSkinId == "" and URLIcon != "" and URLIcon != "dummy" -%}
-        {% set URLIcon = "z:\\private\\20022F35\\customsvg\\" + URLIcon %}
-    {% endif %}
-    INSERT INTO URL ( URL_TITLE {% if URLShortTitle -%}, URL_SHORT_TITLE{%- endif %}, URL_DEST, ICON_FILENAME, ICON_SKIN_ID ) 
-    VALUES ( '{{URLTitle}}' {% if URLShortTitle -%}, "{{URLShortTitle}}"{%- endif %}, "{{URL}}", "{{URLIcon}}", "{{IconSkinId}}" );
-{% endfor %}
+{% macro processItems(Items) -%}
+    {%- for index in range(feat_tree.CaStorageDbSetting[Items]._value|length) -%}
+        {%- set Type = feat_tree.CaStorageDbSetting[Items].Type._value[index] or '' -%}
+        {%- set Application = feat_tree.CaStorageDbSetting[Items].Application._value[index] or '' -%}
+        {%- set URLTitle = feat_tree.CaStorageDbSetting[Items].URL._value[index] or '' -%}
+        {%- set HomescreenWidget = feat_tree.CaStorageDbSetting[Items].HomescreenWidget._value[index] or '' -%}
+        
+        {%- if Items == "Items" %}
+            {%- set Collection = feat_tree.CaStorageDbSetting[Items].ColName._value[index] or '' -%}
+            {%- set URLs = 'URLs' -%}
+        {%- else %} {# Items == "OperatorCollectionItems" #}
+            {%- set Collection = feat_tree.CaStorageDbSetting.OperatorCollections.Name._value[0] %}
+            {%- set URLs = 'OperatorURLs' -%}
+        {%- endif %}
+        
+        {% if Type == "1" -%} INSERT INTO ITEM_TO_COLLECTION (ITEM_TYPE, ITEM_NAME, ITEM_DEST, COLLECTION_NAME) 
+          VALUES ("application", '', {{Application}},  '{{Collection}}' );{%- endif %}
+          
+        {% if Type == "2" -%} INSERT INTO WIDGET_TO_COLLECTION (ITEM_TYPE, ITEM_NAME, URI, COLLECTION_NAME ) 
+          VALUES ("widget", '{{HomescreenWidget}}', "{{HomescreenWidget}}", '{{Collection}}' ); {%- endif %}
+          
+        {% if Type == "3" -%}
+          {% for i in range(feat_tree.CaStorageDbSetting[URLs]._value|length) if URLTitle == feat_tree.CaStorageDbSetting[URLs].URLTitle._value[i] -%}
+            INSERT INTO ITEM_TO_COLLECTION (ITEM_TYPE, ITEM_NAME, COLLECTION_NAME)
+            VALUES ( "url", '{{URLTitle}}', '{{Collection}}' );
+          {% endfor %}
+        {%- endif %}
+        
+    {%- endfor %}
+{%- endmacro %}
 
-{% for index in range(feat_tree.CaStorageDbSetting.Items._value|length) -%}
-    {%- set Type = feat_tree.CaStorageDbSetting.Items.Type._value[index] or '' -%}
-    {%- set Application = feat_tree.CaStorageDbSetting.Items.Application._value[index] or '' -%}
-    {%- set URLTitle = feat_tree.CaStorageDbSetting.Items.URL._value[index] or '' -%}
-    {%- set HomescreenWidget = feat_tree.CaStorageDbSetting.Items.HomescreenWidget._value[index] or '' -%}
-    {%- set Collection = feat_tree.CaStorageDbSetting.Items.ColName._value[index] or '' -%}
-{% if Type == "1" -%} INSERT INTO ITEM_TO_COLLECTION (ITEM_TYPE, ITEM_NAME, ITEM_DEST, COLLECTION_NAME) 
-  VALUES ("application", '', {{Application}},  '{{Collection}}' );{%- endif %}
-{% if Type == "3" -%}
-  {% for i in range(feat_tree.CaStorageDbSetting.URLs._value|length) if URLTitle == feat_tree.CaStorageDbSetting.URLs.URLTitle._value[i] -%}
-    INSERT INTO ITEM_TO_COLLECTION (ITEM_TYPE, ITEM_NAME, COLLECTION_NAME)
-    VALUES ( "url", '{{URLTitle}}',  '{{Collection}}' );
-  {% endfor %}
-{%- endif %}
-{% if Type == "2" -%} INSERT INTO WIDGET_TO_COLLECTION (ITEM_TYPE, ITEM_NAME, ICON_FILENAME, ICON_SKIN_ID, URI, COLLECTION_NAME ) 
-  VALUES ("widget", '{{HomescreenWidget}}', '', '', "{{HomescreenWidget}}", '{{Collection}}' ); {%- endif %}
-{% endfor %}
+{{ processCollections('OperatorCollections') }}
+
+{{ processURLs('OperatorURLs') }}
+
+{{ processItems('OperatorCollectionItems') }}
+
+{{ processCollections('Collections') }}
+
+{{ processURLs('URLs') }}
+
+{{ processItems('Items') }}
 
 SELECT "castoragedb_variant - END" AS " ";
 SELECT "------------------------------------" AS " ";
Binary file contentstorage/castorage/data/castorage.db has changed
--- a/contentstorage/group/group.pro	Wed Aug 18 10:39:24 2010 +0300
+++ b/contentstorage/group/group.pro	Mon Sep 13 13:26:33 2010 +0300
@@ -39,7 +39,6 @@
     "../casrv/caappscanner/group/caappscanner.mmp" \
     "../casrv/casatmonitor/group/casatmonitor.mmp" \
     "../casrv/cawidgetscanner/group/cawidgetscanner.mmp" \
-    "../casrv/carunningappmonitor/group/carunningappmonitor.mmp" \
     "../casrv/causifscanner/group/causifscanner.mmp" \
     
 tests_krakow {
--- a/contentstorage/inc/cadef.h	Wed Aug 18 10:39:24 2010 +0300
+++ b/contentstorage/inc/cadef.h	Mon Sep 13 13:26:33 2010 +0300
@@ -12,7 +12,7 @@
  * Contributors:
  *
  * Description:  Definition of different constants
- *  Version     : %version: 10.1.26 % << Don't touch! Updated by Synergy at check-out.
+ *  Version     : %version: 10.1.27 % << Don't touch! Updated by Synergy at check-out.
  *
  */
 
@@ -52,7 +52,7 @@
     EUninstall = 2,
     ERemovable = 4,
     EVisible = 8,
-    ERunning = 16,
+    EReserved = 16, //flag is unused, stays for compatibility
     ENative = 32,
     EMissing = 64
     };
--- a/homescreensrv.pro	Wed Aug 18 10:39:24 2010 +0300
+++ b/homescreensrv.pro	Mon Sep 13 13:26:33 2010 +0300
@@ -16,17 +16,18 @@
 
 TEMPLATE = subdirs
 
-SUBDIRS  += hswidgetmodel \
-            contentstorage \
-            homescreensrv_plat
-            
-exists(tsrc/tsrc.pro): SUBDIRS  += tsrc
-            
+SUBDIRS  += homescreensrv_plat \
+            hswidgetmodel \
+            contentstorage
+                       
+symbian:SUBDIRS += utils
 symbian:SUBDIRS += activityfw
 symbian:SUBDIRS += taskswitcher
 symbian:SUBDIRS += hsappkeyhandler
 symbian:SUBDIRS += tsdevicedialog
 
+exists(tsrc/tsrc.pro): SUBDIRS  += tsrc
+
 CONFIG += ordered
 
 symbian:include(homescreensrv_exports_to_rom.pri)
--- a/homescreensrv_plat/contentstorage_api/cadefs.h	Wed Aug 18 10:39:24 2010 +0300
+++ b/homescreensrv_plat/contentstorage_api/cadefs.h	Mon Sep 13 13:26:33 2010 +0300
@@ -52,7 +52,7 @@
     UninstallEntryFlag = 2,
     RemovableEntryFlag = 4,
     VisibleEntryFlag = 8,
-    RunningEntryFlag = 16,
+    ReservedEntryFlag = 16, //flag is unused, stays for compatibility
     NativeEntryFlag = 32,
     MissingEntryFlag = 64
 };
--- a/homescreensrv_plat/contentstorage_api/caservice.h	Wed Aug 18 10:39:24 2010 +0300
+++ b/homescreensrv_plat/contentstorage_api/caservice.h	Mon Sep 13 13:26:33 2010 +0300
@@ -93,9 +93,9 @@
         const QList< QSharedPointer<CaEntry> > &entryList) const;
 
     int executeCommand(int entryId, const QString &command = 
-        caCmdOpen) const;
+        caCmdOpen, QObject* receiver = NULL, const char* member = NULL) const;
     int executeCommand(const CaEntry &entry, const QString &command =
-        caCmdOpen) const;
+        caCmdOpen, QObject* receiver = NULL, const char* member = NULL) const;
 
     CaNotifier * createNotifier(const CaNotifierFilter &filter) const;
 
--- a/homescreensrv_plat/homescreen_information_api/inc/homescreendomainpskeys.h	Wed Aug 18 10:39:24 2010 +0300
+++ b/homescreensrv_plat/homescreen_information_api/inc/homescreendomainpskeys.h	Mon Sep 13 13:26:33 2010 +0300
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * 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"
@@ -31,9 +31,9 @@
 
 /*!
     P&S Key sub path to represent the state of the Home Screen. This property is updated when
-    Home screen state is changed. Valid values are defined by the enum EPSHsState.
+    Home screen state is changed. Valid values are defined by the enum EPSHomescreenState.
     
-    @see EPSHsState
+    \see EPSHomescreenState
 */
 const char HsStatePSKeySubPath[] = "state";
 
@@ -46,13 +46,56 @@
 /*!
     P&S Key to represent the state of the Home Screen for pure Symbian usage.
     This property is updated when Home screen state is changed. Valid values
-    are defined by the enum EPSHsState.
+    are defined by the enum EPSHomescreenState.
 */
 const TUint KHsCategoryStateKey = 0x1;
 #endif //SYMBIAN
+    
+/*!
+    Home screen state.
+    As Homescreen and Application Library are in the same process
+    EHomeScreenApplicationBackground and EHomeScreenApplicationForeground
+    information considers both of them simultaneously.
+*/
+enum EPSHomescreenState
+     {
+     /**
+     Invalid state. P&S key not initialized.
+     */
+     EHomeScreenInvalid = 0x0,
+     /**
+     Home Screen Application in background. 
+     */
+     EHomeScreenApplicationBackground = 0x1,
+     /**
+     Home Screen Application in foreground.
+     */
+     EHomeScreenApplicationForeground = 0x2,
+     /**
+     Home Screen in widget view.
+     */
+     EHomeScreenWidgetViewActive = 0x4,
+     /**
+     Home Screen in application library view.
+     */
+     EHomeScreenApplicationLibraryViewActive = 0x8,
+     /**
+     Home Screen in widget view in foreground.
+     */
+     EHomeScreenWidgetViewForeground = EHomeScreenApplicationForeground | EHomeScreenWidgetViewActive,
+     /**
+     Home Screen in application library view in foreground.
+     */
+     EHomeScreenApplicationLibraryViewForeground = EHomeScreenApplicationForeground | EHomeScreenApplicationLibraryViewActive 
+     };      
 
 /*!
     Home screen state.
+
+    \deprecated EPSHsState
+        is deprecated. Please use EPSHomescreenState instead.
+
+    \see EPSHomescreenState
 */
 enum EPSHsState
      {
--- a/hsappkeyhandler/inc/hsappkeyplugin.h	Wed Aug 18 10:39:24 2010 +0300
+++ b/hsappkeyhandler/inc/hsappkeyplugin.h	Mon Sep 13 13:26:33 2010 +0300
@@ -12,10 +12,9 @@
 * Contributors:
 *
 * Description:  Main plugin class
- *
+*
 */
 
-
 #ifndef HSAPPKEYPLUGIN_H
 #define HSAPPKEYPLUGIN_H
 
@@ -23,7 +22,6 @@
 #include <hb/hbcore/hbdevicedialogsymbian.h>
 
 class CEikonEnv;
-class CHbDeviceDialogSymbian;
 
 /**
 *  CAppKeyPlugin
@@ -36,65 +34,61 @@
 class CHsAppKeyPlugin : public CSysapKeyHandlerPlugin,
                         public MHbDeviceDialogObserver
     {
-    public: // Constructors and destructor
-        /**
-        * Two-phased constructor.
-        */
-        static CHsAppKeyPlugin* NewL();
-        
-        /**
-        * Destructor.
-        */
-        virtual ~CHsAppKeyPlugin();
-    public: //MHbDeviceDialogObserver interfaces
-        void DataReceived(CHbSymbianVariantMap& aData);
-        
-        void DeviceDialogClosed(TInt aCompletionCode);
-    
-    public: // New functions
-        /**
-        * HandleKeyEventL
-        * @since Series 60 Series60_version 3.0
-        * @param const TKeyEvent& aKeyEvent, TEventCode aType
-        * @return TKeyResponse If key was consumed. Generally it should be, since the KEF calls the plugins only with the right key.
-        */
-        virtual TKeyResponse HandleKeyEventL( const TKeyEvent& aKeyEvent, 
-                                              TEventCode aType );
+public: // Constructors and destructor
+    /**
+    * Two-phased constructor.
+    */
+    static CHsAppKeyPlugin* NewL();
+
+    /**
+    * Destructor.
+    */
+    virtual ~CHsAppKeyPlugin();
+
+public: //MHbDeviceDialogObserver interfaces
+    void DataReceived( CHbSymbianVariantMap& aData );
+    void DeviceDialogClosed( TInt aCompletionCode );
+
+public: // New functions
+    /**
+    * HandleKeyEventL
+    * @since Series 60 Series60_version 3.0
+    * @param const TKeyEvent& aKeyEvent, TEventCode aType
+    * @return TKeyResponse If key was consumed. Generally it should be, since the KEF calls the plugins only with the right key.
+    */
+    virtual TKeyResponse HandleKeyEventL( const TKeyEvent& aKeyEvent,
+                                          TEventCode aType );
 
-        /**
-        * Provides the key events that the plugin wants to listen to.
-        * Plugins should overload this method if they are of version 2 or higher.
-        * iCode, iScanCode and iModifiers MUST be defined in each TKeyEvent.
-        *
-        * @since S60 5.1
-        * @return array of key events
-        */
-        void ProvideKeyEventsL( RArray<TKeyEvent>& aKeyEventArray );
-    private: // Constructors
-        /**
-        * C++ default constructor.
-        */
-        CHsAppKeyPlugin();
+    /**
+    * Provides the key events that the plugin wants to listen to.
+    * Plugins should overload this method if they are of version 2 or higher.
+    * iCode, iScanCode and iModifiers MUST be defined in each TKeyEvent.
+    *
+    * @since S60 5.1
+    * @return array of key events
+    */
+    void ProvideKeyEventsL( RArray<TKeyEvent>& aKeyEventArray );
 
-        /**
-        * By default Symbian 2nd phase constructor is private.
-        */
-        void ConstructL();
-        
-        void HandleShortPressL();
-        
-        void HandleLongPressL();
+private: // Constructors
+    /**
+    * C++ default constructor.
+    */
+    CHsAppKeyPlugin();
 
-    private: //data
-        /** Cached pointer to the CEikonEnv singelton instance */
-        CEikonEnv* iEikEnv;
-        TBool iSecondEvent;
-        CHbDeviceDialogSymbian* mDialog;
+    /**
+    * By default Symbian 2nd phase constructor is private.
+    */
+    void ConstructL();
+
+private: // helper methods
+    void HandleShortPressL();
+    void HandleLongPressL();
+    void DismissTaskSwitcher();
+
+private: //data
+    CEikonEnv* iEikEnv;
+    TBool iSecondEvent;
+    CHbDeviceDialogSymbian* iDialog;
     };
 
 #endif // HSAPPKEYPLUGIN_H
-
-// End of File
-
-
-
--- a/hsappkeyhandler/src/hsappkeyplugin.cpp	Wed Aug 18 10:39:24 2010 +0300
+++ b/hsappkeyhandler/src/hsappkeyplugin.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -12,186 +12,207 @@
 * Contributors:
 *
 * Description:  Main plugin class
- *
+*
 */
 
-
 #include <w32std.h>
 #include <eikenv.h>
 #include <apgtask.h>
 #include <apgcli.h>
 #include <e32property.h>
 #include <hb/hbcore/hbdevicedialogsymbian.h>
-#include <hb/hbcore/hbsymbianvariant.h> 
+#include <hb/hbcore/hbsymbianvariant.h>
 #include <tspropertydefs.h>
 #include <afactivitylauncher.h>
 #include <homescreendomainpskeys.h>
 #include "hsappkeyplugin.h"
 
-_LIT(KHsActivactionUri, "appto://20022F35?activityname=HsIdleView");
-_LIT(KAppLibActivactionUri, "appto://20022F35?activityname=AppLibMainView");
-_LIT(KTsPluginName, "com.nokia.taskswitcher.tsdevicedialogplugin/1.0");
+_LIT( KHsActivactionUri, "appto://20022F35?activityname=HsIdleView" );
+_LIT( KAppLibActivactionUri, "appto://20022F35?activityname=AppLibMainView" );
+_LIT( KTsPluginName, "com.nokia.taskswitcher.tsdevicedialogplugin/1.0" );
 
 
 // ======== MEMBER FUNCTIONS ========
 
 // ---------------------------------------------------------------------------
-// 
+//
 // ---------------------------------------------------------------------------
 //
 CHsAppKeyPlugin::CHsAppKeyPlugin()
-: iEikEnv( CEikonEnv::Static() )
-{
-}
+    : iEikEnv( CEikonEnv::Static() ) // codescanner::eikonenvstatic
+    {
+    }
 
 // ---------------------------------------------------------------------------
 // Two-phased constructor.
 // ---------------------------------------------------------------------------
 //
 CHsAppKeyPlugin* CHsAppKeyPlugin::NewL()
-{
-    CHsAppKeyPlugin* self = new (ELeave) CHsAppKeyPlugin;
+    {
+    CHsAppKeyPlugin* self = new ( ELeave ) CHsAppKeyPlugin;
     return self;
-}
-    
+    }
+
 // ---------------------------------------------------------------------------
 // C++ Destructor
 // ---------------------------------------------------------------------------
 //
 CHsAppKeyPlugin::~CHsAppKeyPlugin()
-{
-    delete mDialog;
-}
+    {
+    delete iDialog;
+    }
 
 // ---------------------------------------------------------------------------
 // From MHbDeviceDialogObserver
-// 
+//
 // ---------------------------------------------------------------------------
 //
-void CHsAppKeyPlugin::DataReceived(CHbSymbianVariantMap& /*aData*/)
-{
+void CHsAppKeyPlugin::DataReceived( CHbSymbianVariantMap& /*aData*/ )
+    {
     //no implementation required
-}
+    }
 
 // ---------------------------------------------------------------------------
 // From MHbDeviceDialogObserver
-// 
+//
 // ---------------------------------------------------------------------------
 //
-void CHsAppKeyPlugin::DeviceDialogClosed(TInt /*aCompletionCode*/)
-{
-    delete mDialog;
-    mDialog = 0;
-}
+void CHsAppKeyPlugin::DeviceDialogClosed( TInt /*aCompletionCode*/ )
+    {
+    delete iDialog;
+    iDialog = 0;
+    }
 
 // ---------------------------------------------------------------------------
 // From CSysapKeyHandlerPlugin
-// 
+//
 // ---------------------------------------------------------------------------
 //
-TKeyResponse CHsAppKeyPlugin::HandleKeyEventL(const TKeyEvent &aKeyEvent, 
-                                              TEventCode /*aType*/)
-{
-    TKeyResponse retVal(EKeyWasNotConsumed);
-    if (aKeyEvent.iCode == EKeyApplication0) {
-        if (iSecondEvent) {
-            if (aKeyEvent.iRepeats > 0)
-                HandleLongPressL();
-            else 
-                HandleShortPressL();
-            retVal = EKeyWasConsumed;
+TKeyResponse CHsAppKeyPlugin::HandleKeyEventL( const TKeyEvent& aKeyEvent,  
+                                               TEventCode /*aType*/ )
+    {
+    TKeyResponse retVal( EKeyWasNotConsumed );
+    if ( aKeyEvent.iCode == EKeyApplication0 )
+        {
+        if ( aKeyEvent.iRepeats > 0 )
+            {
+            HandleLongPressL();
+            }
+        else
+            {
+            HandleShortPressL();
+            }
+        retVal = EKeyWasConsumed;
         }
-        iSecondEvent = !iSecondEvent; 
+    return retVal;
     }
-    return retVal;
-}
 
 // ---------------------------------------------------------------------------
 // From CSysapKeyHandlerPlugin
-// 
+//
 // ---------------------------------------------------------------------------
 //
-void CHsAppKeyPlugin::ProvideKeyEventsL(RArray<TKeyEvent>& aKeyEventArray) 
-{
+void CHsAppKeyPlugin::ProvideKeyEventsL( RArray<TKeyEvent>& aKeyEventArray ) // codescanner::LFunctionCantLeave
+    {
     TKeyEvent key;
     key.iCode = EKeyApplication0;
     key.iScanCode = EStdKeyApplication0;
     key.iModifiers = 0;
     key.iRepeats = 0;
-    aKeyEventArray.Append(key);
-    
+    aKeyEventArray.Append( key );
+
     TKeyEvent longkey;
     longkey.iCode = EKeyApplication0;
     longkey.iScanCode = EStdKeyApplication0;
     longkey.iModifiers = 0;
     longkey.iRepeats = 1;
-    aKeyEventArray.Append(longkey);
-
-}
+    aKeyEventArray.Append( longkey );
+    }
 
 // ---------------------------------------------------------------------------
-// 
+//
 // ---------------------------------------------------------------------------
 //
 void CHsAppKeyPlugin::HandleShortPressL()
-{   
-    TInt value(0);
-    RProperty::Get(TsProperty::KCategory, TsProperty::KVisibilityKey, value);
-    if (value) {
+    {
+    TInt value( 0 );
+    RProperty::Get( TsProperty::KCategory, TsProperty::KVisibilityKey, value );
+    if ( value )
+        {
         // when Task Switcher dialog is visible, Appkey is used to dismiss it
-    
-        // @todo: remove notification through property when SharedDialog flag
-        // is implemented in Orbit.
-        if (!mDialog) {
-            // dismiss dialog launched from HomeScreen
-            User::LeaveIfError(RProperty::Set(TsProperty::KCategory, TsProperty::KDismissRequestKey, 1));
-        } else {
-            // dismiss dialog launched by this plugin
-            delete mDialog;
-            mDialog = 0;
+        DismissTaskSwitcher();
         }
-    } else {
+    else
+        {
         // when there is no Task Switcher dialog, Appkey is used to switch between Applib and HomeScreen
         RApaLsSession apaLsSession;
-        CleanupClosePushL(apaLsSession);
-        User::LeaveIfError(apaLsSession.Connect());
-        CAfActivityLauncher *activityEnabler = 
-            CAfActivityLauncher::NewLC(apaLsSession, 
-                                       iEikEnv->WsSession());
-        TInt state(0);
-        RProperty::Get(KHsCategoryUid, KHsCategoryStateKey, state);
-        if (state == EHomeScreenIdleState) {
-            activityEnabler->launchActivityL(KAppLibActivactionUri);
-        } else {
-            activityEnabler->launchActivityL(KHsActivactionUri);
-        }    
-        CleanupStack::PopAndDestroy(activityEnabler);
-        CleanupStack::PopAndDestroy(&apaLsSession);
+        CleanupClosePushL( apaLsSession );
+        User::LeaveIfError( apaLsSession.Connect() );
+        CAfActivityLauncher* activityEnabler =
+            CAfActivityLauncher::NewLC( apaLsSession,
+                                        iEikEnv->WsSession() );
+        TInt state( 0 );
+        RProperty::Get( KHsCategoryUid, KHsCategoryStateKey, state );
+        if ( state == EHomeScreenWidgetViewForeground )
+            {
+            activityEnabler->launchActivityL( KAppLibActivactionUri );
+            }
+        else
+            {
+            activityEnabler->launchActivityL( KHsActivactionUri );
+            }
+        CleanupStack::PopAndDestroy( activityEnabler );
+        CleanupStack::PopAndDestroy( &apaLsSession );
+        }
     }
-}
 
 // ---------------------------------------------------------------------------
-// 
+//
 // ---------------------------------------------------------------------------
 //
 void CHsAppKeyPlugin::HandleLongPressL()
-{
-    if( !mDialog ) {
-        TInt value( 0 );
-        RProperty::Get( TsProperty::KCategory, 
+    {
+    TInt tsVisible( 0 );
+    RProperty::Get( TsProperty::KCategory,
                     TsProperty::KVisibilityKey,
-                    value );
-        if(!value) {
-            mDialog = CHbDeviceDialogSymbian::NewL();    
+                    tsVisible );
+    if ( tsVisible ) 
+        {
+        DismissTaskSwitcher();
+        } 
+    else 
+        {
+        if ( !iDialog )
+            {
+            iDialog = CHbDeviceDialogSymbian::NewL();
             CHbSymbianVariantMap* params = CHbSymbianVariantMap::NewL();
-            if(KErrNone != mDialog->Show(KTsPluginName,*params,this)) {
-                delete mDialog;
-                mDialog = 0;
+            if ( KErrNone != iDialog->Show( KTsPluginName, *params, this ) )
+                {
+                delete iDialog;
+                iDialog = 0;
+                }
+            delete params;
             }
-            delete params;
         }
     }
-}
-//  End of File
 
-
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CHsAppKeyPlugin::DismissTaskSwitcher()
+    {
+    // @todo: remove notification through property when SharedDialog flag
+    // is implemented in Orbit.
+    if ( !iDialog )
+        {
+        // dismiss dialog launched from HomeScreen
+        User::LeaveIfError( RProperty::Set( TsProperty::KCategory, TsProperty::KDismissRequestKey, 1 ) );
+        }
+    else
+        {
+        // dismiss dialog launched by this plugin
+        delete iDialog;
+        iDialog = 0;
+        }
+    }
--- a/hsappkeyhandler/src/hsappkeypluginproxy.cpp	Wed Aug 18 10:39:24 2010 +0300
+++ b/hsappkeyhandler/src/hsappkeypluginproxy.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -24,16 +24,16 @@
 
 const TImplementationProxy AppkeyPluginImplementationTable[] =
     {
-	IMPLEMENTATION_PROXY_ENTRY(KUIDAPPKEYPLUGINIMPL1, CHsAppKeyPlugin::NewL)
+    IMPLEMENTATION_PROXY_ENTRY( KUIDAPPKEYPLUGINIMPL1, CHsAppKeyPlugin::NewL )
     };
 
 // ---------------------------------------------------------------------------
-// 
+//
 // ---------------------------------------------------------------------------
 //
-EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
     {
-    aTableCount = sizeof(AppkeyPluginImplementationTable) / sizeof(TImplementationProxy);
+    aTableCount = sizeof( AppkeyPluginImplementationTable ) / sizeof( TImplementationProxy );
 
     return AppkeyPluginImplementationTable;
     }
--- a/rom/homescreensrv_core.iby	Wed Aug 18 10:39:24 2010 +0300
+++ b/rom/homescreensrv_core.iby	Mon Sep 13 13:26:33 2010 +0300
@@ -50,7 +50,6 @@
 ECOM_PLUGIN( caappscanner.dll, caappscanner.rsc )
 ECOM_PLUGIN( cawidgetscanner.dll, cawidgetscanner.rsc )
 ECOM_PLUGIN( calocalizerscanner.dll, calocalizerscanner.rsc )
-ECOM_PLUGIN( carunningappmonitor.dll, carunningappmonitor.rsc )
 ECOM_PLUGIN( causifscanner.dll, causifscanner.rsc )
 
 data=ZPRIVATE\20022F90\castorage.db          private\20022F90\castorage.db
--- a/sis/homescreensrv.pkg	Wed Aug 18 10:39:24 2010 +0300
+++ b/sis/homescreensrv.pkg	Mon Sep 13 13:26:33 2010 +0300
@@ -124,8 +124,6 @@
 "/epoc32/data/z/resource/plugins/casatmonitor.rsc"-"c:/resource/plugins/casatmonitor.rsc"
 "/epoc32/release/armv5/urel/caappscanner.dll" - "c:/sys/bin/caappscanner.dll"
 "/epoc32/data/z/resource/plugins/caappscanner.rsc"-"c:/resource/plugins/caappscanner.rsc"
-"/epoc32/release/armv5/urel/carunningappmonitor.dll" - "c:/sys/bin/carunningappmonitor.dll"
-"/epoc32/data/z/resource/plugins/carunningappmonitor.rsc"-"c:/resource/plugins/carunningappmonitor.rsc"
 "/epoc32/release/armv5/urel/cawidgetscanner.dll" - "c:/sys/bin/cawidgetscanner.dll"
 "/epoc32/data/z/resource/plugins/cawidgetscanner.rsc"-"c:/resource/plugins/cawidgetscanner.rsc"
 "/epoc32/release/armv5/urel/calocalizerscanner.dll" - "c:/sys/bin/calocalizerscanner.dll"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/backstepping/backstepping.pro	Mon Sep 13 13:26:33 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/taskswitcher/backstepping/bwins/tsbacksteppingu.def	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,4 @@
+EXPORTS
+	??1CTsBacksteppingActivation@@UAE@XZ @ 1 NONAME ; CTsBacksteppingActivation::~CTsBacksteppingActivation(void)
+	?NewL@CTsBacksteppingActivation@@SAPAV1@AAVMTsWindowGroupsMonitor@@@Z @ 2 NONAME ; class CTsBacksteppingActivation * CTsBacksteppingActivation::NewL(class MTsWindowGroupsMonitor &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/backstepping/eabi/tsbacksteppingu.def	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,8 @@
+EXPORTS
+	_ZN25CTsBacksteppingActivation4NewLER22MTsWindowGroupsMonitor @ 1 NONAME
+	_ZN25CTsBacksteppingActivationD0Ev @ 2 NONAME
+	_ZN25CTsBacksteppingActivationD1Ev @ 3 NONAME
+	_ZN25CTsBacksteppingActivationD2Ev @ 4 NONAME
+	_ZTI25CTsBacksteppingActivation @ 5 NONAME
+	_ZTV25CTsBacksteppingActivation @ 6 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/backstepping/group/bld.inf	Mon Sep 13 13:26:33 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/taskswitcher/backstepping/group/tsbackstepping.mmp	Mon Sep 13 13:26:33 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:
+*
+*/
+
+TARGET         tsbackstepping.dll
+TARGETTYPE     dll
+UID            0x1000008d  0x200267AD
+SECUREID       0x200267AD
+CAPABILITY     ALL -TCB
+
+EPOCHEAPSIZE   0x100000 0x600000 // 1MB - 6MB
+
+MW_LAYER_SYSTEMINCLUDE
+
+USERINCLUDE    ../inc
+USERINCLUDE     ../../../inc
+USERINCLUDE     ../../utils/inc
+
+SOURCEPATH     ../src
+SOURCE         tsbackstepping.cpp
+SOURCE         tsbacksteppingfilter.cpp
+SOURCE         tsbacksteppingactivation.cpp
+
+SOURCEPATH     ../../utils/src
+SOURCE        tswindowgroupsmonitor.cpp
+SOURCE        tswindowgroupsobserver.cpp
+SOURCE        tsresourcemanager.cpp
+
+LIBRARY        euser.lib 
+LIBRARY        ws32.lib // for RWsSession
+LIBRARY        apgrfx.lib // for TApaTask / TApaTasksList
+LIBRARY        afactivitylauncher.lib
+
+DEBUGLIBRARY    flogger.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/backstepping/inc/tsbackstepping.h	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* 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>
+#include <tswindowgroupsobserver.h>
+
+class CTsBacksteppingFilter;
+
+NONSHARABLE_CLASS(CTsBackstepping) : public CTsWindowGroupsObserver
+{
+public:
+    static CTsBackstepping* NewL( MTsWindowGroupsMonitor& );
+    static CTsBackstepping* NewLC( MTsWindowGroupsMonitor& );
+    virtual ~CTsBackstepping();
+
+private:
+    CTsBackstepping( MTsWindowGroupsMonitor& );
+    void ConstructL();
+    void HandleWindowGroupChanged( 
+                            MTsResourceManager&, 
+                            const TArray<RWsSession::TWindowGroupChainInfo>& );
+    void HandleWindowGroupChangedL( 
+                        MTsResourceManager&, 
+                        const TArray<RWsSession::TWindowGroupChainInfo>& );
+    TInt HomescreenOffsetL( 
+                        MTsResourceManager&, 
+                        const TArray<RWsSession::TWindowGroupChainInfo>& )const;
+    TInt ParentOffsetL( TInt, 
+                        const TArray<RWsSession::TWindowGroupChainInfo>& )const;
+    inline TBool IsEmbededApp( const RWsSession::TWindowGroupChainInfo& ) const;
+    TUid GetUidFromWindowGroupL(MTsResourceManager &aResources, TInt aWindowGroupId) const;
+
+private:
+    CTsBacksteppingFilter *iFilter;
+
+};
+
+#endif // __CBACKSTEPPING_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/backstepping/inc/tsbacksteppingactivation.h	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef CTSBACKSTEPPINGACTIVACTION_H
+#define CTSBACKSTEPPINGACTIVACTION_H
+
+#include <e32base.h>
+#include <e32property.h>
+
+class MTsWindowGroupsMonitor;
+
+
+class CTsBacksteppingActivation : public CActive
+    {
+public:
+    IMPORT_C static CTsBacksteppingActivation* NewL(
+                                            MTsWindowGroupsMonitor &aMonitor);
+    IMPORT_C virtual ~CTsBacksteppingActivation();
+
+protected:
+    void RunL();
+    TInt RunError(TInt);
+    void DoCancel();  
+
+private:
+    CTsBacksteppingActivation(MTsWindowGroupsMonitor &aMonitor);
+    void ConstructL();
+    void Subscribe();
+
+private:
+    MTsWindowGroupsMonitor &iMonitor;
+    RProperty iProperty;
+    CBase* iEngine;
+    };
+
+#endif /* CTSBACKSTEPPINGACTIVACTION_H*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/backstepping/inc/tsbacksteppingfilter.h	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,41 @@
+/*
+* 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 TSBACKSTEPPINGFILTER_H
+#define TSBACKSTEPPINGFILTER_H
+
+#include <w32std.h>
+#include <tswindowgroupsobserver.h>
+
+
+NONSHARABLE_CLASS(CTsBacksteppingFilter) : public CBase
+    {
+public:
+    static CTsBacksteppingFilter* NewL();
+    ~CTsBacksteppingFilter();
+    TBool isBlocked( TUid aApplicationUid ) const;
+
+private:
+    CTsBacksteppingFilter();
+    void ConstructL();
+
+private:
+    RArray<TUid> iBlockedApps;
+
+    };
+
+#endif // TSBACKSTEPPINGFILTER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/backstepping/src/tsbackstepping.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,242 @@
+/*
+* 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 "tsbackstepping.h"
+
+#include <w32std.h>// key event
+#include <apgwgnam.h>// for CApaWindowGroupName
+#include <apgtask.h>
+#include <coedef.h>
+#include <e32property.h>
+#include <e32debug.h>
+
+#include <homescreendomainpskeys.h>
+#include <afactivitylauncher.h>
+
+#include "tsbacksteppingfilter.h"
+
+_LIT(KHsActivactionUri, "appto://20022F35?activityname=HsIdleView&activityinbackground=true");
+
+// -----------------------------------------------------------------------------
+/** 
+ *  CTsBackstepping::NewL
+ *  two phase constructor
+ */
+CTsBackstepping* CTsBackstepping::NewL( MTsWindowGroupsMonitor& aMonitor )
+    {
+    CTsBackstepping* self = CTsBackstepping::NewLC( aMonitor );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+/** 
+ *  CTsBackstepping::NewLC
+ *  two phase constructor
+ */
+CTsBackstepping* CTsBackstepping::NewLC( MTsWindowGroupsMonitor& aMonitor )
+    { 
+    CTsBackstepping* self = new (ELeave) CTsBackstepping( aMonitor );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+/** 
+ * CTsBackstepping::CTsBackstepping
+ * constructor
+ */
+CTsBackstepping::CTsBackstepping( MTsWindowGroupsMonitor &aMonitor )
+:
+CTsWindowGroupsObserver( aMonitor )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+/** 
+ *  CTsBackstepping::~CTsBackstepping
+ *  deconstructor
+ */
+CTsBackstepping::~CTsBackstepping()
+    {
+    delete iFilter;
+    }
+
+// -----------------------------------------------------------------------------
+/** 
+ *  CTsBackstepping::ConstructL
+ *  two phase constructor
+ */
+void CTsBackstepping::ConstructL ()
+    {
+    BaseConstructL();
+    iFilter = CTsBacksteppingFilter::NewL();
+    }
+
+// -----------------------------------------------------------------------------
+/** 
+ * CTsBackstepping::AnalyseWindowStackL
+ * Analyzes window stack and move homescreen to proper position
+ */
+void CTsBackstepping::HandleWindowGroupChanged( 
+               MTsResourceManager &aResource, 
+               const TArray<RWsSession::TWindowGroupChainInfo> &aWindowGroups )
+    {
+    RDebug::Print(_L("[Backstepping] started"));
+    TRAP_IGNORE( HandleWindowGroupChangedL( aResource, aWindowGroups ) );
+    RDebug::Print(_L("[Backstepping] finished"));
+    }
+
+// -----------------------------------------------------------------------------
+/** 
+ * CTsBackstepping::AnalyseWindowStackL
+ * Analyzes window stack and move homescreen to proper position
+ */
+void CTsBackstepping::HandleWindowGroupChangedL( 
+                MTsResourceManager& aResource,
+                const TArray<RWsSession::TWindowGroupChainInfo>& aWindowGroups )
+    {
+    // calculate the desired position of Homescreen
+    const TInt currentHsOffset( HomescreenOffsetL( aResource, aWindowGroups ) );
+    TInt optimalOffset(1);
+    TInt targetHsOffset(currentHsOffset);
+    for( TInt offset(0); offset < currentHsOffset; ++offset ) 
+        {
+        TUid uid = GetUidFromWindowGroupL( aResource, 
+                                           aWindowGroups[offset].iId );
+        RDebug::Print(_L("[Backstepping] application: %d"), uid.iUid);
+                                           
+        if( TUid::Null() != uid )
+            {
+            if( IsEmbededApp( aWindowGroups[offset] ) )
+                {
+                targetHsOffset = ParentOffsetL( offset, aWindowGroups ) + 1;
+                } 
+            else if (!iFilter->isBlocked(uid))
+                {
+                if(offset + 1 < currentHsOffset && 
+                   GetUidFromWindowGroupL( aResource, aWindowGroups[offset+1].iId) == TUid::Null() ) 
+                    {
+                    ++optimalOffset;
+                    }
+                targetHsOffset = optimalOffset;
+                }
+            break;
+            } 
+        else
+            {
+            ++optimalOffset;
+            }
+        }
+
+    // switch Homescreen to Idle state if Homescreen is not in foreground and is in different state
+    if( 0 != targetHsOffset)
+        {
+        TInt hsState( EHomeScreenIdleState );
+        User::LeaveIfError(RProperty::Get( KHsCategoryUid, 
+                                           KHsCategoryStateKey, 
+                                           hsState ) );
+        if(!(hsState & EHomeScreenWidgetViewActive ) )
+            {
+            RDebug::Print(_L("[Backstepping] about to switch HS activity"));
+            
+            CAfActivityLauncher *activityEnabler = 
+                CAfActivityLauncher::NewLC( aResource.ApaSession(), 
+                                            aResource.WsSession() );
+            activityEnabler->launchActivityL( KHsActivactionUri );
+            CleanupStack::PopAndDestroy( activityEnabler );
+            }
+        }
+    // change windows order if necessary
+    if(targetHsOffset != currentHsOffset)
+        {
+        RDebug::Print(_L("[Backstepping] about to change window groups order"));
+        
+        const TInt hsWindowGroup( aWindowGroups[currentHsOffset].iId );
+        aResource.WsSession().SetWindowGroupOrdinalPosition( hsWindowGroup, 
+                                                             targetHsOffset );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+/** 
+ * CTsBackstepping::HomescreenOffsetL
+ */
+TInt CTsBackstepping::HomescreenOffsetL( 
+        MTsResourceManager& aResource,
+        const TArray<RWsSession::TWindowGroupChainInfo>& aWindowGroups ) const 
+    {
+    TInt offset( KErrNotFound );
+    for( TInt iter(0); KErrNotFound == offset && iter < aWindowGroups.Count(); ++iter )
+        {
+        if( KHsCategoryUid == GetUidFromWindowGroupL( aResource, aWindowGroups[iter].iId ) )
+            {
+            offset = iter;
+            }
+        }
+    User::LeaveIfError( offset );
+    return offset;
+    }
+
+// -----------------------------------------------------------------------------
+/** 
+ * CTsBackstepping::ParentOffsetL
+ */
+TInt CTsBackstepping::ParentOffsetL( 
+        TInt aOffset,
+        const TArray<RWsSession::TWindowGroupChainInfo>& aWindowGroups )const 
+    {
+    for( TInt iter(aOffset + 1); iter < aWindowGroups.Count(); ++iter )
+        {
+        if(aWindowGroups[iter].iId == aWindowGroups[aOffset].iParentId)
+            {
+            return IsEmbededApp( aWindowGroups[iter] ) ? 
+                   ParentOffsetL( iter, aWindowGroups ) : iter; 
+            }
+        }
+    User::Leave( KErrNotFound) ;
+    return KErrNotFound;
+    }
+
+// -----------------------------------------------------------------------------
+/** 
+ * CTsBackstepping::IsEmbededApp
+ */
+TBool CTsBackstepping::IsEmbededApp( 
+            const RWsSession::TWindowGroupChainInfo &aWindowGroupInfo ) const 
+    {
+    return 0 < aWindowGroupInfo.iParentId;
+    }
+
+// -----------------------------------------------------------------------------
+/** 
+ * CTsBackstepping::GetUidFromWindowGroupL
+ */
+TUid CTsBackstepping::GetUidFromWindowGroupL( MTsResourceManager &aResource, 
+                                              TInt aWindowGroupId ) const
+    {
+    TUid retVal(TUid::Null());
+    CApaWindowGroupName *windowGroupName = 
+            CApaWindowGroupName::NewLC( aResource.WsSession() );
+    windowGroupName->ConstructFromWgIdL( aWindowGroupId );
+    retVal = windowGroupName->AppUid();
+    CleanupStack::PopAndDestroy( windowGroupName );
+    return retVal;
+    }
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/backstepping/src/tsbacksteppingactivation.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,138 @@
+/*
+* 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 <startupdomainpskeys.h>
+#include <flogger.h>
+#include <w32std.h>
+
+#include "tsbacksteppingactivation.h"
+#include "tsbackstepping.h"
+
+ // ============================ MEMBER FUNCTIONS ===============================
+// -----------------------------------------------------------------------------
+// CBacksteppingActivation::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CTsBacksteppingActivation* CTsBacksteppingActivation::NewL( 
+                                            MTsWindowGroupsMonitor &aMonitor )
+{
+    CTsBacksteppingActivation* self = 
+        new( ELeave ) CTsBacksteppingActivation( aMonitor );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+// CTsBacksteppingActivation::CTsBacksteppingActivation
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CTsBacksteppingActivation::CTsBacksteppingActivation( 
+                                            MTsWindowGroupsMonitor &aMonitor ) 
+:
+    CActive( EPriorityLow ),
+    iMonitor( aMonitor )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CTsBacksteppingActivation::ConstructL()
+// -----------------------------------------------------------------------------
+//
+void CTsBacksteppingActivation::ConstructL() 
+    {
+    User::LeaveIfError( iProperty.Attach( KPSUidStartup, KPSIdlePhase1Ok ) );
+    iStatus = KRequestPending;
+    SetActive();
+    TRequestStatus* status( &iStatus );
+    User::RequestComplete( status, KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CTsBacksteppingActivation::~CTsBacksteppingActivation
+// Destructor
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CTsBacksteppingActivation::~CTsBacksteppingActivation()
+    {
+    Cancel();
+    delete iEngine;
+    iProperty.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CBacksteppingActivation::DoCancel
+// 
+// -----------------------------------------------------------------------------
+//
+void CTsBacksteppingActivation::DoCancel()
+    {
+    if( IsActive() && iProperty.Handle() ) 
+        {
+        iProperty.Cancel();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * @see CActive.
+ */
+void CTsBacksteppingActivation::RunL()
+{
+    User::LeaveIfError( iStatus.Int() );
+    TInt state( ~EIdlePhase1Ok );
+    User::LeaveIfError( iProperty.Get( state ) );
+    if( EIdlePhase1Ok == state )
+        {
+        if( 0 == iEngine )
+            {
+            iEngine = CTsBackstepping::NewL( iMonitor );
+            }
+        } 
+    else
+        {
+        delete iEngine;
+        iEngine = 0;
+        }
+    Subscribe();
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * @see CActive::RunError(TInt)
+ */
+TInt CTsBacksteppingActivation::RunError( TInt aError )
+    {
+    if (KErrCancel != aError) 
+        {
+        Subscribe();
+        }
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+void CTsBacksteppingActivation::Subscribe()
+    {
+    iProperty.Subscribe( iStatus );
+    SetActive();
+    }
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/backstepping/src/tsbacksteppingfilter.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,73 @@
+/*
+* 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 "tsbacksteppingfilter.h"
+
+const TInt KBlockedApps [] = {0x100058b3/* <-- phoneui.exe */,
+                              0x2001843A/* <-- javainstaller */};
+
+// -----------------------------------------------------------------------------
+/** 
+ * CTsBacksteppingFilter::NewL
+ */
+CTsBacksteppingFilter* CTsBacksteppingFilter::NewL()
+    {
+    CTsBacksteppingFilter *self = new(ELeave)CTsBacksteppingFilter();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+/** 
+ * CTsBacksteppingFilter::~CTsBacksteppingFilter
+ */
+CTsBacksteppingFilter::~CTsBacksteppingFilter()
+    {
+    iBlockedApps.Close();
+    }
+
+// -----------------------------------------------------------------------------
+/** 
+ * CTsBacksteppingFilter::isBlocked
+ */
+TBool CTsBacksteppingFilter::isBlocked( TUid aApplicationUid ) const
+    {
+    return KErrNotFound != iBlockedApps.Find( aApplicationUid );
+    }
+
+// -----------------------------------------------------------------------------
+/** 
+ * CTsBacksteppingFilter::CTsBacksteppingFilter
+ */
+CTsBacksteppingFilter::CTsBacksteppingFilter()
+    {
+    //No implementation required
+    }
+
+// -----------------------------------------------------------------------------
+/** 
+ * CTsBacksteppingFilter::ConstructL
+ */
+void CTsBacksteppingFilter::ConstructL()
+    {
+    const TInt count(sizeof( KBlockedApps ) / sizeof(TInt)); 
+    for( TInt offset(0);offset < count; ++offset )
+        {
+        iBlockedApps.AppendL(TUid::Uid(KBlockedApps[offset]));
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/client/bwins/tstaskmonitorclientu.def	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,38 @@
+EXPORTS
+	?taskListChanged@TsTaskMonitor@@IAEXXZ @ 1 NONAME ; void TsTaskMonitor::taskListChanged(void)
+	?close@TsTask@@QAEXXZ @ 2 NONAME ; void TsTask::close(void)
+	?SetVisibility@CTsScreenshotClient@@QAEHHW4Visibility@@@Z @ 3 NONAME ; int CTsScreenshotClient::SetVisibility(int, enum Visibility)
+	?tr@TsTaskMonitor@@SA?AVQString@@PBD0@Z @ 4 NONAME ; class QString TsTaskMonitor::tr(char const *, char const *)
+	?oldOffset@TsTaskChangeInfo@@QBEHXZ @ 5 NONAME ; int TsTaskChangeInfo::oldOffset(void) const
+	?name@TsTask@@QBE?AVQString@@XZ @ 6 NONAME ; class QString TsTask::name(void) const
+	?isClosable@TsTask@@QBE_NXZ @ 7 NONAME ; bool TsTask::isClosable(void) const
+	?changeType@TsTaskChangeInfo@@QBE?AW4ChangeType@1@XZ @ 8 NONAME ; enum TsTaskChangeInfo::ChangeType TsTaskChangeInfo::changeType(void) const
+	??0TsTaskMonitor@@QAE@PAVQObject@@@Z @ 9 NONAME ; TsTaskMonitor::TsTaskMonitor(class QObject *)
+	?qt_metacall@TsTaskMonitor@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 10 NONAME ; int TsTaskMonitor::qt_metacall(enum QMetaObject::Call, int, void * *)
+	?trUtf8@TsTaskMonitor@@SA?AVQString@@PBD0@Z @ 11 NONAME ; class QString TsTaskMonitor::trUtf8(char const *, char const *)
+	?staticMetaObject@TsTaskMonitor@@2UQMetaObject@@B @ 12 NONAME ; struct QMetaObject const TsTaskMonitor::staticMetaObject
+	?RegisterScreenshot@CTsScreenshotClient@@QAEHPAVCFbsBitmap@@HW4UpdatePriority@@@Z @ 13 NONAME ; int CTsScreenshotClient::RegisterScreenshot(class CFbsBitmap *, int, enum UpdatePriority)
+	?UnregisterScreenshot@CTsScreenshotClient@@QAEHH@Z @ 14 NONAME ; int CTsScreenshotClient::UnregisterScreenshot(int)
+	?changeList@TsTaskMonitor@@QAE?AV?$QList@U?$QPair@VTsTaskChangeInfo@@V?$QSharedPointer@VTsTask@@@@@@@@_N@Z @ 15 NONAME ; class QList<struct QPair<class TsTaskChangeInfo, class QSharedPointer<class TsTask> > > TsTaskMonitor::changeList(bool)
+	??1CTsScreenshotClient@@UAE@XZ @ 16 NONAME ; CTsScreenshotClient::~CTsScreenshotClient(void)
+	?NewLC@CTsScreenshotClient@@SAPAV1@XZ @ 17 NONAME ; class CTsScreenshotClient * CTsScreenshotClient::NewLC(void)
+	??_ETsTaskMonitor@@UAE@I@Z @ 18 NONAME ; TsTaskMonitor::~TsTaskMonitor(unsigned int)
+	?getStaticMetaObject@TsTaskMonitor@@SAABUQMetaObject@@XZ @ 19 NONAME ; struct QMetaObject const & TsTaskMonitor::getStaticMetaObject(void)
+	?metaObject@TsTaskMonitor@@UBEPBUQMetaObject@@XZ @ 20 NONAME ; struct QMetaObject const * TsTaskMonitor::metaObject(void) const
+	?registerScreenshot@TsTaskSettings@@QAE_NABVQPixmap@@@Z @ 21 NONAME ; bool TsTaskSettings::registerScreenshot(class QPixmap const &)
+	?NewL@CTsScreenshotClient@@SAPAV1@XZ @ 22 NONAME ; class CTsScreenshotClient * CTsScreenshotClient::NewL(void)
+	??1TsTaskSettings@@QAE@XZ @ 23 NONAME ; TsTaskSettings::~TsTaskSettings(void)
+	?qt_metacast@TsTaskMonitor@@UAEPAXPBD@Z @ 24 NONAME ; void * TsTaskMonitor::qt_metacast(char const *)
+	?open@TsTask@@QAEXXZ @ 25 NONAME ; void TsTask::open(void)
+	?trUtf8@TsTaskMonitor@@SA?AVQString@@PBD0H@Z @ 26 NONAME ; class QString TsTaskMonitor::trUtf8(char const *, char const *, int)
+	??1TsTaskMonitor@@UAE@XZ @ 27 NONAME ; TsTaskMonitor::~TsTaskMonitor(void)
+	??0TsTaskChangeInfo@@QAE@HH@Z @ 28 NONAME ; TsTaskChangeInfo::TsTaskChangeInfo(int, int)
+	??0TsTaskSettings@@QAE@XZ @ 29 NONAME ; TsTaskSettings::TsTaskSettings(void)
+	?screenshot@TsTask@@QBE?AVQPixmap@@XZ @ 30 NONAME ; class QPixmap TsTask::screenshot(void) const
+	?newOffset@TsTaskChangeInfo@@QBEHXZ @ 31 NONAME ; int TsTaskChangeInfo::newOffset(void) const
+	?unregisterScreenshot@TsTaskSettings@@QAE_NXZ @ 32 NONAME ; bool TsTaskSettings::unregisterScreenshot(void)
+	?isActive@TsTask@@QBE_NXZ @ 33 NONAME ; bool TsTask::isActive(void) const
+	??1TsTask@@QAE@XZ @ 34 NONAME ; TsTask::~TsTask(void)
+	?setVisibility@TsTaskSettings@@QAE_N_N@Z @ 35 NONAME ; bool TsTaskSettings::setVisibility(bool)
+	?tr@TsTaskMonitor@@SA?AVQString@@PBD0H@Z @ 36 NONAME ; class QString TsTaskMonitor::tr(char const *, char const *, int)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/client/client.pri	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,86 @@
+#
+# 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:
+#
+
+INCLUDEPATH +=  $$PWD/inc
+
+HEADERS +=  $$PWD/inc/tstaskmonitor.h \
+            $$PWD/inc/tstask.h \
+            $$PWD/inc/tstasklauncher.h \
+            $$PWD/inc/tstaskcontent.h \
+            $$PWD/inc/tstaskchangeinfo.h 
+            
+SOURCES +=  $$PWD/src/tstaskmonitor.cpp \
+            $$PWD/src/tstask.cpp \
+            $$PWD/src/tstaskchangeinfo.cpp \
+     
+symbian {
+    INCLUDEPATH +=  $$PWD/s60/inc \
+                    $$PWD/../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/tssession.h \
+                $$PWD/../utils/inc/tsentry.h \
+                $$PWD/../utils/inc/tsentrykey.h \
+                $$PWD/../utils/inc/tsutils.h \
+                $$PWD/../utils/inc/tsscreenshotmsg.h \
+                $$PWD/../utils/inc/tsunregscreenshotmsg.h \
+                $$PWD/../utils/inc/tsvisibilitymsg.h \
+                $$PWD/s60/inc/tstaskmonitor_p.h \
+                $$PWD/s60/inc/tstaskmonitorhistory.h \
+                $$PWD/s60/inc/tsscreenshotclient.h \
+                $$PWD/s60/inc/tsscreenshotclientimpl.h \
+                $$PWD/s60/inc/tstasksettings_p.h \
+                $$PWD/../../homescreensrv_plat/taskswitcher_api/tstasksettings.h \
+                
+    SOURCES +=  $$PWD/s60/src/tstaskmonitorclient.cpp \
+                $$PWD/s60/src/tstaskmonitorclientimpl.cpp \
+                $$PWD/s60/src/tssession.cpp \
+                $$PWD/../utils/src/tsentry.cpp \
+                $$PWD/../utils/src/tsentrykey.cpp \
+                $$PWD/../utils/src/tsscreenshotmsg.cpp \
+                $$PWD/../utils/src/tsunregscreenshotmsg.cpp \
+                $$PWD/../utils/src/tsvisibilitymsg.cpp \
+                $$PWD/s60/src/tstaskmonitor_p.cpp \
+                $$PWD/s60/src/tstaskmonitorhistory.cpp \
+                $$PWD/s60/src/tsscreenshotclient.cpp \
+                $$PWD/s60/src/tsscreenshotclientimpl.cpp \
+                $$PWD/src/tstasksettings.cpp \
+                $$PWD/s60/src/tstasksettings_p.cpp \
+
+    LIBS    +=  -lxqutils \
+                -lestor \
+                -lfbscli \
+                
+    # tsimageutils and its dependencies
+    LIBS    +=  -ltsimageutils.lib \
+                -lbitmaptransforms \
+                -limageconversion \
+                -lefsrv \
+
+} else {
+    INCLUDEPATH +=  $$PWD/stub/inc \
+
+    HEADERS +=  $$PWD/stub/inc/tstaskmonitor_p.h \
+                $$PWD/stub/inc/tstasksettings_p.h \
+                
+    SOURCES +=  $$PWD/stub/src/tstaskmonitor_p.cpp \
+                $$PWD/stub/src/tstasksettings_p.cpp \
+                
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/client/client.pro	Mon Sep 13 13:26:33 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: 
+#
+
+TEMPLATE = lib
+TARGET = tstaskmonitorclient
+
+CONFIG += dll
+    
+DEFINES += TSTASKMONITOR_LIB
+            
+symbian {
+    dll.sources = tstaskmonitorclient.dll
+    dll.path = $$SHARED_LIB_DIR
+    DEPLOYMENT += dll
+    LIBS += -lws32 -lapgrfx -lcone
+
+    BLD_INF_RULES.prj_exports +=    "inc/tstaskmonitor.h    |../../inc/tstaskmonitor.h" \
+                                    "inc/tstask.h           |../../inc/tstask.h" \
+                                    "inc/tstaskchangeinfo.h           |../../inc/tstaskchangeinfo.h" \
+
+    TARGET.UID3 = 0x200267AF    
+    TARGET.CAPABILITY = ALL -TCB
+    TARGET.EPOCALLOWDLLDATA = 1    
+    
+}
+
+include(client.pri)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/client/eabi/tstaskmonitorclientu.def	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,44 @@
+EXPORTS
+	_ZN13TsTaskMonitor10changeListEb @ 1 NONAME
+	_ZN13TsTaskMonitor11qt_metacallEN11QMetaObject4CallEiPPv @ 2 NONAME
+	_ZN13TsTaskMonitor11qt_metacastEPKc @ 3 NONAME
+	_ZN13TsTaskMonitor15taskListChangedEv @ 4 NONAME
+	_ZN13TsTaskMonitor16staticMetaObjectE @ 5 NONAME DATA 16
+	_ZN13TsTaskMonitor19getStaticMetaObjectEv @ 6 NONAME
+	_ZN13TsTaskMonitorC1EP7QObject @ 7 NONAME
+	_ZN13TsTaskMonitorC2EP7QObject @ 8 NONAME
+	_ZN13TsTaskMonitorD0Ev @ 9 NONAME
+	_ZN13TsTaskMonitorD1Ev @ 10 NONAME
+	_ZN13TsTaskMonitorD2Ev @ 11 NONAME
+	_ZN14TsTaskSettings13setVisibilityEb @ 12 NONAME
+	_ZN14TsTaskSettings18registerScreenshotERK7QPixmap @ 13 NONAME
+	_ZN14TsTaskSettings20unregisterScreenshotEv @ 14 NONAME
+	_ZN14TsTaskSettingsC1Ev @ 15 NONAME
+	_ZN14TsTaskSettingsC2Ev @ 16 NONAME
+	_ZN14TsTaskSettingsD1Ev @ 17 NONAME
+	_ZN14TsTaskSettingsD2Ev @ 18 NONAME
+	_ZN16TsTaskChangeInfoC1Eii @ 19 NONAME
+	_ZN16TsTaskChangeInfoC2Eii @ 20 NONAME
+	_ZN19CTsScreenshotClient13SetVisibilityEi10Visibility @ 21 NONAME
+	_ZN19CTsScreenshotClient18RegisterScreenshotEP10CFbsBitmapi14UpdatePriority @ 22 NONAME
+	_ZN19CTsScreenshotClient20UnregisterScreenshotEi @ 23 NONAME
+	_ZN19CTsScreenshotClient4NewLEv @ 24 NONAME
+	_ZN19CTsScreenshotClient5NewLCEv @ 25 NONAME
+	_ZN19CTsScreenshotClientD0Ev @ 26 NONAME
+	_ZN19CTsScreenshotClientD1Ev @ 27 NONAME
+	_ZN19CTsScreenshotClientD2Ev @ 28 NONAME
+	_ZN6TsTask4openEv @ 29 NONAME
+	_ZN6TsTask5closeEv @ 30 NONAME
+	_ZN6TsTaskD1Ev @ 31 NONAME
+	_ZN6TsTaskD2Ev @ 32 NONAME
+	_ZNK13TsTaskMonitor10metaObjectEv @ 33 NONAME
+	_ZNK16TsTaskChangeInfo10changeTypeEv @ 34 NONAME
+	_ZNK16TsTaskChangeInfo9newOffsetEv @ 35 NONAME
+	_ZNK16TsTaskChangeInfo9oldOffsetEv @ 36 NONAME
+	_ZNK6TsTask10isClosableEv @ 37 NONAME
+	_ZNK6TsTask10screenshotEv @ 38 NONAME
+	_ZNK6TsTask4nameEv @ 39 NONAME
+	_ZNK6TsTask8isActiveEv @ 40 NONAME
+	_ZTI13TsTaskMonitor @ 41 NONAME
+	_ZTV13TsTaskMonitor @ 42 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/client/inc/tstask.h	Mon Sep 13 13:26:33 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 TSTASK_H
+#define TSTASK_H
+
+#include <QPixmap>
+#include <QString>
+#include <QSharedPointer>
+
+#include "tstaskmonitor_global.h"
+
+class TsTaskContent;
+class TsTaskLauncher;
+
+class TsTask
+{
+    
+public:
+    TsTask(const QSharedPointer<TsTaskContent> &content, TsTaskLauncher &launcher);
+    TSTASKMONITOR_EXPORT ~TsTask();
+    
+    TSTASKMONITOR_EXPORT void open();
+    TSTASKMONITOR_EXPORT void close();
+    
+    TSTASKMONITOR_EXPORT bool isClosable() const;
+    TSTASKMONITOR_EXPORT bool isActive() const;
+    TSTASKMONITOR_EXPORT QPixmap screenshot() const;
+    TSTASKMONITOR_EXPORT QString name() const;
+    
+private:
+    Q_DISABLE_COPY(TsTask)
+    
+    QSharedPointer<TsTaskContent> mContent;
+    TsTaskLauncher &mLauncher;
+
+};
+
+#endif //TSTASK_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/client/inc/tstaskchangeinfo.h	Mon Sep 13 13:26:33 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 TSTASKCHANGEINFO_H
+#define TSTASKCHANGEINFO_H
+
+#include "tstaskmonitor_global.h"
+
+class TSTASKMONITOR_EXPORT TsTaskChangeInfo
+{
+public:
+    enum ChangeType{
+        EChangeInsert,
+        EChangeDelete,
+        EChangeMove,
+        EChangeUpdate,
+        EChangeCancel
+    };
+    static const int KInvalidOffset = -2;
+    
+    TsTaskChangeInfo(int newOffset = KInvalidOffset, int oldOffset = KInvalidOffset);
+    
+    int newOffset() const;
+    int oldOffset() const;
+    ChangeType changeType() const;
+     
+private:
+    int mNewOffset;
+    int mOldOffset; 
+    
+};
+
+#endif /* TSTASKCHANGEINFO_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/client/inc/tstaskcontent.h	Mon Sep 13 13:26:33 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 TSTASKCONTENT_H
+#define TSTASKCONTENT_H
+
+class TsTaskContent
+{
+    
+public:
+    bool mClosable;
+    bool mActive;
+    QPixmap mScreenshot;
+    QString mName;
+    QByteArray mKey;
+    
+};
+
+#endif //TSTASKCONTENT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/client/inc/tstasklauncher.h	Mon Sep 13 13:26:33 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 TSTASKLAUNCHER_H
+#define TSTASKLAUNCHER_H
+
+class QByteArray;
+
+class TsTaskLauncher {
+
+public:
+    virtual void openTask(const QByteArray &key) = 0;
+    virtual void closeTask(const QByteArray &key) = 0;
+};
+
+#endif //TSTASKLAUNCHER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/client/inc/tstaskmonitor.h	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,49 @@
+/*
+* 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 TSTASKMONITOR_H
+#define TSTASKMONITOR_H
+
+#include <QObject>
+#include <QSharedPointer>
+#include <QPair>
+
+#include "tstaskmonitor_global.h"
+#include "tstask.h"
+
+class TsTaskMonitorPrivate;
+class TsTaskChangeInfo;
+
+typedef QPair<TsTaskChangeInfo, QSharedPointer <TsTask> > TsTaskChange;
+
+class TSTASKMONITOR_EXPORT TsTaskMonitor : public QObject
+{
+    Q_OBJECT
+    
+public:
+    TsTaskMonitor(QObject *parent = 0);
+    ~TsTaskMonitor();
+    QList<TsTaskChange> changeList(bool fullList = false); //TODO merge these functions with bool
+
+signals:
+    void taskListChanged();
+    
+private:
+    TsTaskMonitorPrivate *d_ptr;   
+    friend class TsTaskMonitorPrivate;
+};
+
+#endif //TSTASKMONITOR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/client/s60/inc/tsscreenshotclient.h	Mon Sep 13 13:26:33 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 TInt UnregisterScreenshot(TInt wgId);
+    IMPORT_C TInt SetVisibility(TInt wgId, Visibility value);
+
+private:
+    CTsScreenshotClient();
+    void ConstructL();
+
+private:
+    CTsScreenshotClientImpl* iImpl;
+};
+
+#endif  // TSSCREENSHOTCLIENT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/client/s60/inc/tsscreenshotclientimpl.h	Mon Sep 13 13:26:33 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 TSSCREENSHOTCLIENTIMPL_H
+#define TSSCREENSHOTCLIENTIMPL_H
+
+#include <e32base.h>
+
+#include "tstaskmonitorglobals.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);
+    TInt UnregisterScreenshot(TInt wgId);
+    TInt SetVisibility(TInt wgId, Visibility value);
+
+private:
+    CTsScreenshotClientImpl();
+    void ConstructL();
+
+    RTsSession iSession;
+};
+
+#endif  // TSSCREENSHOTCLIENTIMPL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/client/s60/inc/tssession.h	Mon Sep 13 13:26:33 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 TSSESSION_H
+#define TSSESSION_H
+
+#include <e32base.h>
+
+#include "tstaskmonitorglobals.h"
+
+class CFbsBitmap;
+
+NONSHARABLE_CLASS( RTsSession ) : public RSessionBase
+{
+public:
+    TInt Connect();
+
+public: // task monitor API
+    HBufC8* TasksContentLC();
+    void Subscribe(TRequestStatus& aStatus);
+    void CancelSubscribe();
+    void OpenTask(const TDesC8 &key);
+    void CloseTask(const TDesC8 &key);  
+
+public: // screenshots API
+    TInt RegisterScreenshot(CFbsBitmap *screenshot, TInt wgId, UpdatePriority priority);
+    TInt UnregisterScreenshot(TInt wgId);
+    TInt SetVisibility(TInt wgId, Visibility value);
+    
+private:
+    void RegisterScreenshotL(CFbsBitmap *screenshot, TInt wgId, UpdatePriority priority);
+    void UnregisterScreenshotL(TInt wgId);
+    void SetVisibilityL(TInt wgId, Visibility value);
+    
+private:
+    TInt StartServer();
+};
+
+#endif  // TSSESSION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/client/s60/inc/tstaskmonitor_p.h	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,84 @@
+/*
+* 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 TSTASKMONITOR_P_H
+#define TSTASKMONITOR_P_H
+
+
+#include <w32std.h>
+
+#include <QList>
+#include <QSharedPointer>
+#include <QPair>
+#include <QDateTime>
+
+#include "tstaskmonitorobserver.h"
+#include "tstasklauncher.h"
+#include "tstaskmonitor.h"
+
+class RDesReadStream;
+class TsTask;
+class TsTaskContent;
+class CTsTaskMonitorClient;
+class TsTaskMonitorHistory;
+
+class TsTaskMonitorPrivate : public MTsTaskMonitorObserver, public TsTaskLauncher
+{
+public:
+    TsTaskMonitorPrivate(TsTaskMonitor *q);
+    virtual ~TsTaskMonitorPrivate();
+    
+public:
+    QList<TsTaskChange> changeList(bool fullList = false);
+
+public: // from MTsTaskMonitorObserver
+    virtual void HandleRunningAppChange();
+
+public: // from TsTaskLauncher
+    virtual void openTask(const QByteArray &key);
+    virtual void closeTask(const QByteArray &key);
+    
+private: // helper methods
+    TsTaskMonitorHistory internalizeContentL(RDesReadStream &dataStream,
+                             QSharedPointer<TsTaskContent> &content );
+    QDateTime dateTimeFromS60(const TTime &s60Time);
+    
+    //for comparing algorithm
+    int         findItemIndex(const QList<TsTaskMonitorHistory> &historyList,
+                              const TsTaskMonitorHistory &item );
+    QList<int>  findInserts(const QList<TsTaskMonitorHistory> &newHistory);
+    QList<int>  findDeletes(const QList<TsTaskMonitorHistory> &newHistory);
+    QList<TsTaskChange> getDeletesChangeset(const QList<int> &deleteList);
+    QList<TsTaskChange> getInsertsChangeset(const QList<int> &insertList,
+                                   const QList< QSharedPointer<TsTaskContent> > &taskList);
+    QList<TsTaskMonitorHistory> substractInsertsFromNew(
+                                          const QList<int> &insertList,
+                                          const QList<TsTaskMonitorHistory> &newHistory );
+    QList<TsTaskMonitorHistory> substractDeletesFromOld(
+                                          const QList<int> &deleteList);
+    QList<TsTaskChange> findMovesAndUpdates(
+                                   const QList<TsTaskMonitorHistory> &newMinusInserts,
+                                   const QList< QSharedPointer<TsTaskContent> > &taskList,
+                                   QList<TsTaskMonitorHistory> &workingList);
+    
+private:    
+    TsTaskMonitor *q_ptr;
+    CTsTaskMonitorClient *mClient;
+    RWsSession &mWsSession;
+    QList<TsTaskMonitorHistory> mTaskHistory;
+};
+
+#endif //TSTASKMONITOR_P_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/client/s60/inc/tstaskmonitorclient.h	Mon Sep 13 13:26:33 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 TSTASKMONITORCLIENT_H
+#define TSTASKMONITORCLIENT_H
+
+#include <e32base.h>
+
+class MTsTaskMonitorObserver;
+class CTsTaskMonitorClientImpl;
+
+NONSHARABLE_CLASS( CTsTaskMonitorClient ) : public CBase
+{
+public:
+    static CTsTaskMonitorClient* NewL();
+    static CTsTaskMonitorClient* NewLC();
+    ~CTsTaskMonitorClient();
+
+public:
+    HBufC8* TasksContentLC();
+    void Subscribe(MTsTaskMonitorObserver& aObserver);
+    void CancelSubscribe();
+    void OpenTask(const TDesC8 &key);
+    void CloseTask(const TDesC8 &key);
+
+private:
+    CTsTaskMonitorClient();
+    void ConstructL();
+
+private:
+    CTsTaskMonitorClientImpl* iImpl;
+};
+
+#endif  // TSTASKMONITORCLIENT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/client/s60/inc/tstaskmonitorclientimpl.h	Mon Sep 13 13:26:33 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 TSTASKMONITORCLIENTIMPL_H
+#define TSTASKMONITORCLIENTIMPL_H
+
+#include <e32base.h>
+
+#include "tssession.h"
+
+class MTsTaskMonitorObserver;
+
+NONSHARABLE_CLASS( CTsTaskMonitorClientImpl ) : public CActive
+{
+public:
+    static CTsTaskMonitorClientImpl* NewL();
+    static CTsTaskMonitorClientImpl* NewLC();
+    ~CTsTaskMonitorClientImpl();
+
+public:
+    HBufC8* TasksContentLC();
+    void Subscribe(MTsTaskMonitorObserver& aObserver);
+    void CancelSubscribe();
+    void OpenTask(const TDesC8 &key);
+    void CloseTask(const TDesC8 &key);
+
+private:
+    void RunL();
+    void DoCancel();
+
+private:
+    CTsTaskMonitorClientImpl();
+    void ConstructL();
+
+    RTsSession iSession;
+    MTsTaskMonitorObserver* iObserver; // not owned
+};
+
+#endif  // TSTASKMONITORCLIENTIMPL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/client/s60/inc/tstaskmonitorhistory.h	Mon Sep 13 13:26:33 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 TSTASKMONITORHISTORY_H_
+#define TSTASKMONITORHISTORY_H_
+
+#include <QByteArray>
+#include <QDateTime>
+
+class TsTaskMonitorHistory
+{
+public:
+    TsTaskMonitorHistory(const QByteArray &key, const QDateTime &updateTime);
+    bool isEqual(const TsTaskMonitorHistory &item) const;
+    bool isUpdated(const TsTaskMonitorHistory &item) const;
+    int offset() const;
+    void setOffset(int offset);
+private:
+    QByteArray mKey;
+    QDateTime mUpdateTime;
+    int mOffset;
+};
+
+#endif /* TSTASKMONITORHISTORY_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/client/s60/inc/tstaskmonitorobserver.h	Mon Sep 13 13:26:33 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:  Client API
+ *
+*/
+
+#ifndef TSTASKMONITOROBSERVER_H
+#define TSTASKMONITOROBSERVER_H
+
+#include <e32base.h>
+
+/**
+ * Observer interface for getting notifications about fast swap content changes.
+ */
+class MTsTaskMonitorObserver
+    {
+public:
+    /**
+     * Called when there is a change in the fast swap content.
+     * The data can be queried via CTsTaskMonitorClient::TaskListL
+     */
+    virtual void HandleRunningAppChange() = 0;
+    };
+
+#endif //TSTASKMONITOROBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/client/s60/inc/tstasksettings_p.h	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#ifndef TSTASKSETTINGS_P_H
+#define TSTASKSETTINGS_P_H
+
+#include <QPixmap>
+
+class CTsScreenshotClient;
+
+class TsTaskSettingsPrivate
+{
+public:
+    TsTaskSettingsPrivate();
+    ~TsTaskSettingsPrivate();
+
+public:
+    bool registerScreenshot(const QPixmap &screenshot);
+    bool unregisterScreenshot();
+    bool setVisibility(bool visibility);
+
+private:
+    int wgId();
+    
+private:
+    CTsScreenshotClient *mClient;   
+    
+};
+
+#endif //TSTASKSETTINGS_P_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/client/s60/src/tsscreenshotclient.cpp	Mon Sep 13 13:26:33 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 TInt CTsScreenshotClient::UnregisterScreenshot(TInt wgId)
+{
+    return iImpl->UnregisterScreenshot(wgId);
+}
+
+EXPORT_C TInt CTsScreenshotClient::SetVisibility(TInt wgId, Visibility value)
+{
+    return iImpl->SetVisibility(wgId, value);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/client/s60/src/tsscreenshotclientimpl.cpp	Mon Sep 13 13:26:33 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);
+}
+
+TInt CTsScreenshotClientImpl::UnregisterScreenshot(TInt wgId)
+{
+    return iSession.UnregisterScreenshot(wgId);
+}
+
+TInt CTsScreenshotClientImpl::SetVisibility(TInt wgId, Visibility value)
+{
+    return iSession.SetVisibility(wgId, value);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/client/s60/src/tssession.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,168 @@
+/*
+* 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"
+#include "tsscreenshotmsg.h"
+#include "tsunregscreenshotmsg.h"
+#include "tsvisibilitymsg.h"
+
+TInt RTsSession::Connect()
+{
+    TInt retry = 4;
+    TInt error(KErrNone);
+    do {
+        error = CreateSession(KRunningAppServerName, TVersion(0, 0, 0));
+        if (KErrNotFound == error || KErrServerTerminated == error) {
+            error = StartServer();
+            if (KErrNone == error || KErrAlreadyExists == error) {
+                retry = 0;
+                error = CreateSession(KRunningAppServerName, TVersion(0, 0, 0));
+            }
+        } else {
+            retry = 0;
+        }
+    } while (--retry > 0);
+    return error;
+}
+
+TInt RTsSession::StartServer()
+{
+    TInt error;
+
+    RSemaphore semaphore;
+    error = semaphore.CreateGlobal(KTsServerReadySemaphore, 0);
+    
+    if (KErrNone == error || KErrAlreadyExists == error) {
+        RProcess server;
+        error = server.Create(KRunningAppServerName, KNullDesC, TUidType(KNullUid, KNullUid, KRunningAppServerUid));
+        if (KErrNone == error) {
+            TRequestStatus status;
+            server.Rendezvous(status);
+            
+            if (status != KRequestPending) {
+                server.Kill(0);
+                User::WaitForRequest(status);
+            } else {
+                server.Resume();
+                User::WaitForRequest(status);
+
+                // wait for server
+                semaphore.Wait();
+            }
+
+            if (KErrCancel == status.Int()) {
+                error = KErrNone;
+            } else {
+                error = (EExitPanic == server.ExitType()) ? KErrGeneral : status.Int();
+            }
+        }
+        server.Close();
+    }
+    semaphore.Close();
+
+    return error;
+}
+
+
+HBufC8* RTsSession::TasksContentLC()
+{
+    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) {
+            return data;
+        } else if (err != KErrCorrupt) {
+            User::Leave(err);
+        }
+        CleanupStack::PopAndDestroy(data);
+        // 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);
+}
+
+void RTsSession::OpenTask(const TDesC8 &key)
+{
+    SendReceive(OpenTaskMessage, TIpcArgs(&key));
+}
+
+void RTsSession::CloseTask(const TDesC8 &key)
+{
+    SendReceive(CloseTaskMessage, TIpcArgs(&key));
+}
+
+TInt RTsSession::RegisterScreenshot(CFbsBitmap *screenshot, TInt wgId, UpdatePriority priority)
+{
+   TRAPD(errNo, RegisterScreenshotL(screenshot, wgId, priority));
+   return errNo;
+}
+
+TInt RTsSession::UnregisterScreenshot(TInt wgId)
+{
+    TRAPD(errNo, UnregisterScreenshotL(wgId));
+   return errNo;
+}
+
+TInt RTsSession::SetVisibility(TInt wgId, Visibility value)
+{
+    TRAPD(errNo, SetVisibilityL(wgId, value));
+    return errNo;
+}
+
+void RTsSession::RegisterScreenshotL(CFbsBitmap *screenshot, TInt wgId, UpdatePriority priority)
+{
+    CTsScreenshotMsg *message = CTsScreenshotMsg::NewLC(wgId, *screenshot, priority, 0);
+    HBufC8* serializedData = message->ExternalizeLC();
+    TIpcArgs arguments(serializedData);
+    User::LeaveIfError(SendReceive(RegisterScreenshotMessage, arguments));
+    CleanupStack::PopAndDestroy(serializedData);
+    CleanupStack::PopAndDestroy(message);
+}
+
+void RTsSession::UnregisterScreenshotL(TInt wgId)
+{
+    CTsUnregisterScreenshotMsg *message = CTsUnregisterScreenshotMsg::NewLC(wgId);
+    HBufC8* serializedData = message->ExternalizeLC();
+    TIpcArgs arguments(serializedData);
+    User::LeaveIfError(SendReceive(UnregisterScreenshotMessage, arguments));
+    CleanupStack::PopAndDestroy(serializedData);
+    CleanupStack::PopAndDestroy(message);
+}
+
+void RTsSession::SetVisibilityL(TInt wgId, Visibility value)
+{
+    CTsVisibilitMsg *message = CTsVisibilitMsg::NewLC(wgId, value);
+    HBufC8* serializedData = message->ExternalizeLC();
+    TIpcArgs arguments(serializedData);
+    User::LeaveIfError(SendReceive(VisibilityChange, arguments));
+    CleanupStack::PopAndDestroy(serializedData);
+    CleanupStack::PopAndDestroy(message);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/client/s60/src/tstaskmonitor_p.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,282 @@
+/*
+* 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 "tstaskmonitor_p.h"
+#include "tstaskmonitor.h"
+
+#include <eikenv.h>
+#include <fbs.h>
+#include <s32mem.h>
+
+#include <XQConversions>
+
+#include "tstaskmonitorclient.h"
+#include "tstask.h"
+#include "tstaskcontent.h"
+#include "tstaskchangeinfo.h"
+#include "tsutils.h"
+#include "tstaskmonitorhistory.h"
+using TaskSwitcher::CleanupResetAndDestroyPushL;
+
+TsTaskMonitorPrivate::TsTaskMonitorPrivate(TsTaskMonitor *q) : q_ptr(q), mClient(0), mWsSession(CEikonEnv::Static()->WsSession())
+{
+    QT_TRAP_THROWING(mClient = CTsTaskMonitorClient::NewL());
+    mClient->Subscribe(*this);
+}
+
+TsTaskMonitorPrivate::~TsTaskMonitorPrivate()
+{
+    mClient->CancelSubscribe();
+    delete mClient;
+}
+
+
+QList<TsTaskChange> TsTaskMonitorPrivate::changeList(bool fullList)
+{
+    QList<TsTaskChange> retVal;
+     
+    QT_TRAP_THROWING (
+
+        HBufC8 *data = mClient->TasksContentLC();
+        if (data->Size() == 0) {
+            CleanupStack::PopAndDestroy(data);
+            return retVal;
+        }
+        TPtr8 dataPointer(data->Des());
+        RDesReadStream dataStream(dataPointer);
+        CleanupClosePushL(dataStream);
+
+        int count = dataStream.ReadInt32L();
+
+        QT_TRYCATCH_LEAVING(
+            QList< QSharedPointer<TsTaskContent> > taskList;
+            QList<TsTaskMonitorHistory> newTaskHistory;
+            for (int iter(0); iter < count; iter++) {
+                QSharedPointer<TsTaskContent> content(new TsTaskContent);
+                TsTaskMonitorHistory newHistoryItem = internalizeContentL(dataStream, content);
+                newHistoryItem.setOffset(iter);
+                newTaskHistory.append(newHistoryItem);
+                taskList.append(content);
+            }
+            if (fullList) {
+                mTaskHistory.clear();
+            }
+            QList<int> insertsList = findInserts(newTaskHistory);
+            QList<int> deletesList = findDeletes(newTaskHistory);
+            QList<TsTaskMonitorHistory> newMinusInserts;
+            if (insertsList.count() > 0 ) {
+                newMinusInserts = substractInsertsFromNew(insertsList, newTaskHistory);
+            } else {
+                newMinusInserts = newTaskHistory;
+            }
+            QList<TsTaskMonitorHistory> interimList;
+            if (deletesList.count() > 0 ) {
+                retVal.append(getDeletesChangeset(deletesList));
+                interimList = substractDeletesFromOld(deletesList);
+            } else {
+                interimList = mTaskHistory;
+            }
+            retVal.append(findMovesAndUpdates(newMinusInserts, taskList, interimList));
+            if (mTaskHistory.isEmpty()) {
+                retVal.append(TsTaskChange(TsTaskChangeInfo(), QSharedPointer<TsTask>()));
+            }
+            retVal.append(getInsertsChangeset(insertsList, taskList));
+            mTaskHistory = newTaskHistory;
+        )//QT_TRYCATCH_LEAVING
+        CleanupStack::PopAndDestroy(&dataStream);
+        CleanupStack::PopAndDestroy(data);
+    );//QT_TRAP_THROWING
+       
+    return retVal;
+}
+
+TsTaskMonitorHistory TsTaskMonitorPrivate::internalizeContentL(RDesReadStream &  dataStream,
+                                    QSharedPointer<TsTaskContent> &content)
+{
+    // get name
+    TInt nameLength(dataStream.ReadInt32L());
+    if (0 < nameLength) {
+        HBufC* name = HBufC::NewLC(dataStream, nameLength);
+        content->mName = XQConversions::s60DescToQString(*name);
+        CleanupStack::PopAndDestroy(name);
+    }
+    TPckgBuf<TTime> updateTime;
+    dataStream.ReadL(updateTime);
+    QDateTime historyTime =  dateTimeFromS60(updateTime());
+    
+    // get screenshot
+    TInt screenshotHandle = dataStream.ReadInt32L();
+    CFbsBitmap *screenshot = new (ELeave) CFbsBitmap;
+    CleanupStack::PushL(screenshot);
+    if (KErrNone == screenshot->Duplicate(screenshotHandle)) {
+        content->mScreenshot = QPixmap::fromSymbianCFbsBitmap(screenshot);
+    }
+    CleanupStack::PopAndDestroy(screenshot);
+    // get key
+    TInt keyLength(dataStream.ReadInt32L());
+    if (0 < keyLength) {
+        HBufC8* key = HBufC8::NewLC(keyLength);
+        TPtr8 des(key->Des());
+        dataStream.ReadL(des, keyLength);
+        content->mKey = XQConversions::s60Desc8ToQByteArray(*key);
+        CleanupStack::PopAndDestroy(key);
+    }
+    // get other values
+    content->mActive = dataStream.ReadInt32L();
+    content->mClosable = dataStream.ReadInt32L();  
+    return TsTaskMonitorHistory(content->mKey, historyTime);
+}
+
+QDateTime TsTaskMonitorPrivate::dateTimeFromS60(const TTime &s60Time)
+{
+    TTime posixEpoch(_L("19700000:"));
+    TTimeIntervalSeconds secondsFrom;
+    TTimeIntervalMicroSeconds microSecondsFrom;
+    s60Time.SecondsFrom(posixEpoch, secondsFrom);
+    microSecondsFrom = s60Time.MicroSecondsFrom(posixEpoch);
+    QDateTime retVal = QDateTime::fromTime_t(secondsFrom.Int());
+    retVal = retVal.addMSecs((microSecondsFrom.Int64() % TInt64(1000000) ) / TInt64(1000));
+    return retVal;    
+}
+
+int TsTaskMonitorPrivate::findItemIndex(
+                          const QList<TsTaskMonitorHistory> &historyList,
+                          const TsTaskMonitorHistory &item )
+{
+    for (int iter(0); iter < historyList.count(); iter++) {
+        if(historyList[iter].isEqual(item)) {
+            return iter;
+        }
+    }
+    return -1;
+}
+
+QList<int>  TsTaskMonitorPrivate::findInserts(
+                                 const QList<TsTaskMonitorHistory> &newHistory)
+{
+    QList<int> retVal = QList<int>();
+    for (int iter(0); iter < newHistory.count(); iter++) {
+        if (findItemIndex(mTaskHistory, newHistory[iter]) == -1) {
+            retVal.append(iter);
+        }
+    }
+    return retVal;
+}
+
+QList<int> TsTaskMonitorPrivate::findDeletes(
+                                 const QList<TsTaskMonitorHistory> &newHistory)
+{
+    QList<int> retVal = QList<int>();
+    //iterate backwards to keep order during model operations
+    for (int iter(mTaskHistory.count() -1); iter >= 0 ; iter--) {
+        if (findItemIndex(newHistory, mTaskHistory[iter]) == -1) {
+            retVal.append(iter);
+        }
+    }
+    return retVal;    
+}
+
+QList<TsTaskChange> TsTaskMonitorPrivate::getDeletesChangeset(
+                                                      const QList<int> &deleteList)
+{
+    QList<TsTaskChange> retVal;
+    foreach (int index, deleteList) {
+        TsTaskChangeInfo deleteChange(TsTaskChangeInfo::KInvalidOffset,
+                                                                   index);
+        retVal.append(TsTaskChange(deleteChange, QSharedPointer<TsTask>()));
+    }
+    return retVal;
+}
+
+QList<TsTaskChange> TsTaskMonitorPrivate::getInsertsChangeset(const QList<int> &insertList,
+                                        const QList< QSharedPointer<TsTaskContent> > &taskList)
+{
+    QList<TsTaskChange> retVal;
+    foreach (int index, insertList) {
+        TsTaskChangeInfo insertChange(index,
+                                 TsTaskChangeInfo::KInvalidOffset);
+        retVal.append(TsTaskChange(
+                            insertChange,
+                            QSharedPointer<TsTask>(new TsTask(taskList[index], *this))));
+    }
+    return retVal;
+}
+
+QList<TsTaskMonitorHistory> TsTaskMonitorPrivate::substractInsertsFromNew(
+                                      const QList<int> &insertList,
+                                      const QList<TsTaskMonitorHistory> &newHistory )
+{
+    QList<TsTaskMonitorHistory> retVal(newHistory);
+    for ( int iter(insertList.count() - 1); iter >= 0 ; iter--) {
+        retVal.removeAt(insertList[iter]);
+    }
+    return retVal;
+}
+
+QList<TsTaskMonitorHistory> TsTaskMonitorPrivate::substractDeletesFromOld(
+                                      const QList<int> &deleteList)
+{
+    QList<TsTaskMonitorHistory> retVal(mTaskHistory);  
+    for (int iter(0); iter < deleteList.count() ; iter++) {
+        retVal.removeAt(deleteList[iter]);
+    }
+    return retVal;
+}
+
+QList<TsTaskChange> TsTaskMonitorPrivate::findMovesAndUpdates( 
+                                     const QList<TsTaskMonitorHistory> &newMinusInserts,
+                                     const QList< QSharedPointer<TsTaskContent> > &taskList,
+                                     QList<TsTaskMonitorHistory> &workingList)
+{
+    QList<TsTaskChange> retVal;
+    for (int newPos(0); newPos < newMinusInserts.count(); newPos++) {
+        //case 1 item has moved
+        int previousPos = findItemIndex(workingList, newMinusInserts[newPos]);
+        if (newPos != previousPos) {
+            TsTaskChangeInfo moveChange(newPos, previousPos);
+            retVal.append(
+                TsTaskChange(moveChange, QSharedPointer<TsTask>()));
+            workingList.move(previousPos, newPos);
+        }
+        // case 2 item has changed
+        if (newMinusInserts[newPos].isUpdated(workingList[newPos])) {
+            TsTaskChangeInfo updateChange(newPos, newPos);
+            int taskListOffset = newMinusInserts[newPos].offset();
+            retVal.append( TsTaskChange(
+                              updateChange,
+                              QSharedPointer<TsTask>(new TsTask(taskList[taskListOffset], *this)))); 
+        }
+    }
+    return retVal;
+}
+
+void TsTaskMonitorPrivate::HandleRunningAppChange()
+{
+    emit q_ptr->taskListChanged();
+}
+
+void TsTaskMonitorPrivate::openTask(const QByteArray &key)
+{
+    TPtrC8 desC(reinterpret_cast<const TUint8*>(key.constData()), key.length());
+    mClient->OpenTask(desC);
+    
+}
+
+void TsTaskMonitorPrivate::closeTask(const QByteArray &key)
+{
+    TPtrC8 desC(reinterpret_cast<const TUint8*>(key.constData()), key.length());
+    mClient->CloseTask(desC);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/client/s60/src/tstaskmonitorclient.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,75 @@
+/*
+* 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 "tstaskmonitorclient.h"
+#include "tstaskmonitorclientimpl.h"
+
+CTsTaskMonitorClient *CTsTaskMonitorClient::NewL()
+{
+    CTsTaskMonitorClient* self = NewLC();
+    CleanupStack::Pop(self);
+    return self;
+}
+
+CTsTaskMonitorClient *CTsTaskMonitorClient::NewLC()
+{
+    CTsTaskMonitorClient* self = new (ELeave) CTsTaskMonitorClient;
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+}
+
+void CTsTaskMonitorClient::ConstructL()
+{
+    iImpl = CTsTaskMonitorClientImpl::NewL();
+}
+
+CTsTaskMonitorClient::CTsTaskMonitorClient()
+{
+}
+
+CTsTaskMonitorClient::~CTsTaskMonitorClient()
+{
+    delete iImpl;
+}
+
+HBufC8* CTsTaskMonitorClient::TasksContentLC()
+{
+    return iImpl->TasksContentLC();
+}
+
+void CTsTaskMonitorClient::Subscribe(MTsTaskMonitorObserver& aObserver)
+{
+    iImpl->Subscribe(aObserver);
+}
+
+void CTsTaskMonitorClient::CancelSubscribe()
+{
+    iImpl->CancelSubscribe();
+}
+
+void CTsTaskMonitorClient::OpenTask(const TDesC8 &key)
+{
+    iImpl->OpenTask(key);
+}
+
+void CTsTaskMonitorClient::CloseTask(const TDesC8 &key)
+{
+    iImpl->CloseTask(key);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/client/s60/src/tstaskmonitorclientimpl.cpp	Mon Sep 13 13:26:33 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 <e32base.h>
+
+#include "tstaskmonitorclientimpl.h"
+#include "tstaskmonitorobserver.h"
+
+CTsTaskMonitorClientImpl* CTsTaskMonitorClientImpl::NewL()
+{
+    CTsTaskMonitorClientImpl* self = NewLC();
+    CleanupStack::Pop(self);
+    return self;
+}
+
+CTsTaskMonitorClientImpl* CTsTaskMonitorClientImpl::NewLC()
+{
+    CTsTaskMonitorClientImpl* self = new (ELeave) CTsTaskMonitorClientImpl;
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+}
+
+CTsTaskMonitorClientImpl::CTsTaskMonitorClientImpl() : CActive(CActive::EPriorityStandard)
+{
+    CActiveScheduler::Add(this);
+}
+
+CTsTaskMonitorClientImpl::~CTsTaskMonitorClientImpl()
+{
+    Cancel();
+    iSession.Close();
+}
+
+void CTsTaskMonitorClientImpl::ConstructL()
+{
+    User::LeaveIfError(iSession.Connect());
+}
+
+
+HBufC8* CTsTaskMonitorClientImpl::TasksContentLC()
+{
+    return iSession.TasksContentLC();
+}
+
+void CTsTaskMonitorClientImpl::Subscribe(MTsTaskMonitorObserver& aObserver)
+{
+    Cancel();
+    iObserver = &aObserver;
+    iSession.Subscribe(iStatus);
+    SetActive();
+}
+
+void CTsTaskMonitorClientImpl::CancelSubscribe()
+{
+    Cancel();
+}
+
+void CTsTaskMonitorClientImpl::OpenTask(const TDesC8 &key)
+{
+    iSession.OpenTask(key);
+}
+
+void CTsTaskMonitorClientImpl::CloseTask(const TDesC8 &key)
+{
+    iSession.CloseTask(key);
+}
+
+void CTsTaskMonitorClientImpl::RunL()
+{
+    if (iStatus == KErrNone && iObserver) {
+        iSession.Subscribe(iStatus);
+        SetActive();
+        iObserver->HandleRunningAppChange();
+    }
+}
+
+void CTsTaskMonitorClientImpl::DoCancel()
+{
+    iSession.CancelSubscribe();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/client/s60/src/tstaskmonitorhistory.cpp	Mon Sep 13 13:26:33 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: 
+*
+*/
+#include "tstaskmonitorhistory.h"
+
+TsTaskMonitorHistory::TsTaskMonitorHistory(const QByteArray &key, 
+                                           const QDateTime &updateTime) :
+mKey(key), mUpdateTime(updateTime)
+{
+    
+}
+
+void TsTaskMonitorHistory::setOffset(int offset)
+{
+    mOffset = offset;
+}
+
+int TsTaskMonitorHistory::offset() const
+{
+    return mOffset;
+}
+
+bool TsTaskMonitorHistory::isEqual(const TsTaskMonitorHistory &item) const
+{
+    if (mKey == item.mKey) {
+        return true;
+    }
+    return false;
+}
+
+bool TsTaskMonitorHistory::isUpdated(const TsTaskMonitorHistory &item) const
+{
+    Q_ASSERT(mKey == item.mKey);
+    if (mUpdateTime != item.mUpdateTime) {
+        return true;
+    }
+    return false;    
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/client/s60/src/tstasksettings_p.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,60 @@
+/*
+* 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 "tstasksettings_p.h"
+
+#include <fbs.h>
+#include <coecntrl.h>
+#include <QScopedPointer>
+#include <QApplication>
+#include <QDesktopWidget>
+
+#include "tsscreenshotclient.h"
+#include "tstaskmonitorglobals.h"
+
+TsTaskSettingsPrivate::TsTaskSettingsPrivate() : mClient(0)
+{
+    QT_TRAP_THROWING(mClient = CTsScreenshotClient::NewL());
+}
+
+TsTaskSettingsPrivate::~TsTaskSettingsPrivate()
+{
+    delete mClient;
+}
+
+bool TsTaskSettingsPrivate::registerScreenshot(const QPixmap &screenshot)
+{    
+    QScopedPointer<CFbsBitmap> bitmap(screenshot.toSymbianCFbsBitmap());
+    if (bitmap.isNull()) 
+        return false;
+
+    return KErrNone == mClient->RegisterScreenshot(bitmap.data(), wgId());
+}
+
+bool TsTaskSettingsPrivate::unregisterScreenshot()
+{
+    return KErrNone == mClient->UnregisterScreenshot(wgId());
+}
+
+bool TsTaskSettingsPrivate::setVisibility(bool visibility)
+{
+    return (KErrNone == mClient->SetVisibility(wgId(), visibility ? Visible : Invisible));
+}
+
+int TsTaskSettingsPrivate::wgId()
+{
+    return QApplication::desktop()->winId()->ControlEnv()->RootWin().WindowGroupId();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/client/src/tstask.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,92 @@
+/*
+* 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 "tstask.h"
+
+#include "tstaskcontent.h"
+#include "tstasklauncher.h"
+
+/*!
+    @class TsTask
+    @ingroup publicApi
+    @brief TsTask object represents a single task.
+    
+    This class represents one running task. It can be queried for task content
+    like screenshot or task name, or used to start or close task.
+*/
+
+/*!
+    @internal
+    Constructor. 
+*/
+TsTask::TsTask(const QSharedPointer<TsTaskContent> &content, TsTaskLauncher &launcher) : mContent(content), mLauncher(launcher)
+{
+}
+
+/*!
+    Destructor.
+*/
+TsTask::~TsTask()
+{
+}
+
+/*!
+    @return True if it's possible to close the task, false otherwise.
+*/
+bool TsTask::isClosable() const
+{
+    return mContent->mClosable;
+}
+
+/*!
+    @return True if the task is running, false otherwise.
+*/
+bool TsTask::isActive() const
+{
+    return mContent->mActive;
+}
+
+/*!
+    @return Screenshot of the task.
+*/
+QPixmap TsTask::screenshot() const
+{
+    return mContent->mScreenshot;
+}
+
+/*!
+    @return Name of the task.
+*/
+QString TsTask::name() const
+{
+    return mContent->mName;
+}
+
+/*!
+    Start or bring the task to foreground.
+*/
+void TsTask::open()
+{
+    mLauncher.openTask(mContent->mKey);
+}
+
+/*!
+    Close the task.
+*/
+void TsTask::close()
+{
+    mLauncher.closeTask(mContent->mKey);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/client/src/tstaskchangeinfo.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,49 @@
+/*
+* 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 "tstaskchangeinfo.h"
+
+TsTaskChangeInfo::TsTaskChangeInfo(int newOffset, int oldOffset) :
+    mNewOffset(newOffset), mOldOffset(oldOffset)
+{
+}
+ 
+int TsTaskChangeInfo::newOffset() const
+{
+    return mNewOffset;
+}
+
+int TsTaskChangeInfo::oldOffset() const
+{
+    return mOldOffset;
+}
+
+TsTaskChangeInfo::ChangeType TsTaskChangeInfo::changeType() const
+{
+    ChangeType retVal(EChangeInsert);
+    if (KInvalidOffset == mNewOffset) {
+        if (KInvalidOffset == mOldOffset) {
+            retVal = EChangeCancel;
+		} else {
+            retVal = EChangeDelete;
+		}
+    } else if (mOldOffset == mNewOffset) {
+        retVal = EChangeUpdate;
+    } else if(KInvalidOffset != mOldOffset) {
+        retVal = EChangeMove;
+    }
+    return retVal;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/client/src/tstaskmonitor.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,71 @@
+/*
+* 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 "tstaskmonitor.h"
+#include "tstaskmonitor_p.h"
+
+#include "tstask.h"
+
+/*!
+    @class TsTaskMonitor
+    @ingroup publicApi
+    @brief TsTaskMonitor gives access to list of running tasks.
+    
+    This class is one of the Qt interfaces for Task Monitor server. It can be
+    used to retrieve list of running tasks and receive notifications about the
+    changes of this list.
+*/
+
+/*!
+    Constructor.
+*/
+TsTaskMonitor::TsTaskMonitor(QObject *parent) : QObject(parent), d_ptr(0)
+{
+    d_ptr = new TsTaskMonitorPrivate(this);
+}
+
+/*!
+    Destructor.
+*/
+TsTaskMonitor::~TsTaskMonitor()
+{
+    delete d_ptr;
+}
+
+/*!
+    \return Current list of tasks from Task Monitor server.
+
+    \sa TsTask, taskListChanged()
+*/
+QList<TsTaskChange> TsTaskMonitor::changeList(bool fullList)
+{
+    return d_ptr->changeList(fullList);
+}
+
+/*!
+    @fn TsTaskMonitor::taskListChanged()
+
+    This signal is emitted when task list changes in any way:
+    - the new task is started
+    - running task is terminated
+    - parameters of one task change (for example image representing the task is updated)
+
+    No data is passed within this signal, user should retrieve task list
+    using taskList().
+
+    \sa taskList()
+*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/client/src/tstasksettings.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,73 @@
+/*
+* 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 "tstasksettings.h"
+#include "tstasksettings_p.h"
+
+/*!
+    @class TsTaskSettings
+    @ingroup publicApi
+    @brief TsTaskSettings allows application to alter the way it will be 
+    handled by TsTaskMonitor.
+    
+    This class is one of the Qt interfaces for Task Monitor server. It can be
+    used to set custom screenshot of the task, or to change the task visibility.
+*/
+
+/*!
+    Constructor.
+*/
+TsTaskSettings::TsTaskSettings() : d_ptr(new TsTaskSettingsPrivate())
+{
+}
+
+/*!
+    Destructor.
+*/
+TsTaskSettings::~TsTaskSettings()
+{
+    delete d_ptr;
+}
+
+/*!
+    Overwrites default screenshot of task with \a screenshot. If \a 
+    screenshot is null, this method will return false.
+    @return True if the screenshot is successfully saved, false otherwise.
+*/
+bool TsTaskSettings::registerScreenshot(const QPixmap &screenshot)
+{
+    return d_ptr->registerScreenshot(screenshot);
+}
+
+/*!
+    Removes custom screenshot saved with registerScreenshot(). If there was no
+    saved screenshot, this method will return false.
+    @return True if the screenshot is successfully removed, false otherwise.
+*/
+bool TsTaskSettings::unregisterScreenshot()
+{
+    return d_ptr->unregisterScreenshot();
+}
+
+/*!
+    Changes the \a visibilty of task. Hidden tasks are not present on the task
+    list returned by TsTaskMonitor::taskList().
+    @return True if the visibility is changed successfully, false otherwise.
+*/
+bool TsTaskSettings::setVisibility(bool visibility)
+{
+    return d_ptr->setVisibility(visibility);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/client/stub/inc/tstaskmonitor_p.h	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,39 @@
+/*
+* 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 TSTASKMONITOR_P_H
+#define TSTASKMONITOR_P_H
+
+#include <QList>
+#include <QSharedPointer>
+#include <QDateTime>
+
+#include "tstask.h"
+
+class TsTaskMonitor;
+
+class TsTaskMonitorPrivate
+{
+public:
+    TsTaskMonitorPrivate(TsTaskMonitor *q);
+    
+public:
+    QList< QSharedPointer<TsTask> > taskList();
+    
+private:
+ };
+
+#endif //TSTASKMONITOR_P_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/client/stub/inc/tstasksettings_p.h	Mon Sep 13 13:26:33 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 TSTASKSETTINGS_P_H
+#define TSTASKSETTINGS_P_H
+
+#include <QPixmap>
+
+class TsTaskSettingsPrivate
+{
+public:
+    bool registerScreenshot(const QPixmap &screenshot);
+    bool unregisterScreenshot();
+};
+
+#endif //TSTASKSETTINGS_P_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/client/stub/src/tstaskmonitor_p.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#include "tstaskmonitor_p.h"
+
+TsTaskMonitorPrivate::TsTaskMonitorPrivate(TsTaskMonitor *q)
+{
+    Q_UNUSED(q);
+}
+
+QList< QSharedPointer<TsTask> > TsTaskMonitorPrivate::taskList()
+{
+    return QList< QSharedPointer<TsTask> >();
+}
+
+QDateTime dateTimeFromS60(TTime s60Time)
+{
+    return QDateTime();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/client/stub/src/tstasksettings_p.cpp	Mon Sep 13 13:26:33 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 "tstasksettings_p.h"
+
+bool TsTaskSettingsPrivate::registerScreenshot(const QPixmap &screenshot)
+{
+    Q_UNUSED(screenshot);
+    return true;
+}
+
+bool TsTaskSettingsPrivate::unregisterScreenshot()
+{
+    return true;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/inc/tstaskmonitorglobals.h	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,61 @@
+/*
+* 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 RUNNINGAPPGLOBALS_H
+#define RUNNINGAPPGLOBALS_H
+
+#include <e32base.h>
+
+_LIT(KRunningAppServerName, "hsrunningappmonitor");
+_LIT(KTsServerReadySemaphore, "TaskSwitcherReadySemaphore");
+const TUid KRunningAppServerUid = {0x200267B0};
+const TInt KRequestDataSizeOffset(0); 
+const TInt KRequestDataBufferOffset(0);
+
+enum RunningAppCmd {
+    GetRunningAppInfo =0,
+    SubscribeRunningAppChanges,
+    UpdateScreenshot,
+    FlushData,
+    CancelSubscribeRunningAppChanges,
+    RegisterScreenshotMessage,
+    UnregisterScreenshotMessage,
+    VisibilityChange,
+    OpenTaskMessage,
+    CloseTaskMessage,
+    WindowGroupToBackgroundMessage,
+};
+
+enum UpdatePriority {
+    Low = 0,
+    Normal,
+    High
+};
+
+enum Visibility {
+    Invisible =0,
+    Visible
+};
+
+enum ScreenshotMessageOffsets {
+    ScreenshotHandle = 0,
+    WindowsGroup,
+    AdditionalParameters,
+    Priority
+};
+
+#endif  //RUNNINGAPPGLOBALS_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/rom.pri	Mon Sep 13 13:26:33 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:
+#
+
+BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include <platform_paths.hrh>"
+BLD_INF_RULES.prj_exports += "rom/tstaskmonitor_core.iby  CORE_APP_LAYER_IBY_EXPORT_PATH(tstaskmonitor_core.iby)"
+BLD_INF_RULES.prj_exports += "./sis/stubs/taskmonitor_stub.sis  /epoc32/release/winscw/udeb/z/system/install/taskmonitor_stub.sis"
+BLD_INF_RULES.prj_exports += "./sis/stubs/taskmonitor_stub.sis  /epoc32/data/z/system/install/taskmonitor_stub.sis"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/rom/tstaskmonitor_core.iby	Mon Sep 13 13:26:33 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 __TSTASKMONITOR_CORE_IBY__
+#define __TSTASKMONITOR_CORE_IBY__
+
+file=ABI_DIR\BUILD_DIR\tstaskmonitorclient.dll              SHARED_LIB_DIR\tstaskmonitorclient.dll
+file=ABI_DIR\BUILD_DIR\hsrunningappmonitor.exe      PROGRAMS_DIR\hsrunningappmonitor.exe
+data=\epoc32\data\z\resource\apps\hsrunningappmonitor.rsc      resource\apps\hsrunningappmonitor.rsc
+data=ZPRIVATE\10003a3f\import\apps\hsrunningappmonitor_reg.rsc      private\10003a3f\import\apps\hsrunningappmonitor_reg.rsc
+
+
+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
+
+#endif //__TSTASKMONITOR_CORE_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/screenshotplugin/group/bld.inf	Mon Sep 13 13:26:33 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/taskswitcher/screenshotplugin/group/tsscreenshotplugin.mmp	Mon Sep 13 13:26:33 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:
+*
+*/
+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
+USERINCLUDE     ../../utils/inc
+USERINCLUDE     ../../inc
+SYSTEMINCLUDE   /epoc32/include/stdapis
+SYSTEMINCLUDE   /epoc32/include/mw/qtcore
+
+SOURCEPATH      ../src
+SOURCE          tsscreenshotmain.cpp
+SOURCE          tsscreenshotplugin.cpp
+SOURCE          tsorientationmonitor.cpp
+SOURCE          ../../utils/src/tsscreenshotmsg.cpp
+
+RESOURCE        tsscreenshotplugin.rss
+
+LIBRARY         ecom.lib
+LIBRARY         euser.lib
+LIBRARY         efsrv.lib
+LIBRARY         wsgraphicdrawer.lib
+LIBRARY         fbscli.lib
+LIBRARY         estor.lib
+LIBRARY         gdi.lib 
+LIBRARY         tstaskmonitorclient.lib
+LIBRARY         SensrvClient.lib
+LIBRARY         sensrvutil.lib 
+LIBRARY         centralrepository.lib
+DEBUGLIBRARY    flogger.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/screenshotplugin/inc/tsorientationmonitor.h	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,60 @@
+/*
+* 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 TSORIENTATIONMONITOR_H
+#define TSORIENTATIONMONITOR_H
+#include <e32base.h>
+#include <sensrvdatalistener.h>
+#include "tsorientationobserver.h"
+
+class CRepository;
+
+class CTsOrientationMonitor: public CActive,
+                             public MSensrvDataListener
+    {
+public:
+    static CTsOrientationMonitor* NewL( MTsOrientationObserver& aObserver );
+    ~CTsOrientationMonitor();
+
+private:
+    CTsOrientationMonitor( MTsOrientationObserver& aObserver );
+    void ConstructL();
+    void SubscribeL();
+    void StartSensorMonitoringL();
+    void StopSensorMonitoring();
+
+private://from CActive
+    void DoCancel();
+    void RunL();
+    TInt RunError(TInt aError);
+    
+public:
+    void DataReceived( CSensrvChannel& aChannel, 
+                       TInt aCount, 
+                       TInt aDataLost );
+    
+    void DataError( CSensrvChannel& aChannel, 
+                    TSensrvErrorSeverity aError );
+    
+    void GetDataListenerInterfaceL( TUid aInterfaceUid, TAny*& aInterface );
+
+private:
+    MTsOrientationObserver& iObserver;
+    CRepository* iRepository;
+    CSensrvChannel* iChannel;
+
+    };
+#endif //TSORIENTATIONMONITOR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/screenshotplugin/inc/tsorientationobserver.h	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* 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 TSORIENTATIONOBSERVER_H
+#define TSORIENTATIONOBSERVER_H
+
+class MTsOrientationObserver
+    {
+public:
+    virtual void OrientationChanged( TInt aAngle ) =0; 
+    };
+
+#endif //TSORIENTATIONOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/screenshotplugin/inc/tsscreenshotplugin.h	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#ifndef TSSCREENSHOTPLUGIN_H
+#define TSSCREENSHOTPLUGIN_H
+
+#include <w32std.h>
+#include <graphics/wsgraphicdrawerinterface.h>
+#include <graphics/wsgraphicdrawer.h>
+
+#include "tsorientationobserver.h"
+
+class CTsOrientationMonitor;
+
+class CTsScreenshotPlugin: public CWsGraphicDrawer, 
+                           public MWsEventHandler,
+                           public MTsOrientationObserver
+{
+public:
+    static CTsScreenshotPlugin* NewL();
+    ~CTsScreenshotPlugin();
+
+private:
+    void DoDraw(MWsGc&, const TRect&, const TDesC8&) const;
+    void HandleMessage(const TDesC8&);
+    void HandleMessageL(const TDesC8&);
+    void ConstructL(MWsGraphicDrawerEnvironment& aEnv, 
+                    const TGraphicDrawerId& aId, 
+                    MWsClient& aOwner, 
+                    const TDesC8& aData);
+    void ConstructL();
+    void DoHandleEvent(const TWservCrEvent& aEvent);
+    void TakeScreenshot(TInt);
+    void TakeScreenshotL(TInt);
+    void NotifyWindowGroupToBackground(TInt aWindowGroupId);
+    void NotifyWindowGroupToBackgroundL(TInt aWindowGroupId);
+    TInt OrientationToAngle();
+    
+private://from MTsOrientationObserver
+    void OrientationChanged( TInt aAngle );
+    
+private:
+    RPointerArray<CFbsBitmap> iCache;
+    CTsOrientationMonitor* iMonitor;
+    TInt iWindowGroupId;
+    TInt iAngle;
+};
+
+#endif //TSSCREENSHOTPLUGIN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/screenshotplugin/screenshotplugin.pro	Mon Sep 13 13:26:33 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/taskswitcher/screenshotplugin/src/tsorientationmonitor.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,159 @@
+/*
+* 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 <centralrepository.h>
+#include <sensrvchannelfinder.h>
+#include <sensrvchannel.h>
+#include <sensrvorientationsensor.h>
+
+#include "tsorientationmonitor.h"
+const TUid KSensorCenrepUid  = {0x2002C384};
+const TUint32 KSensorCenrepKey  = 0x1;
+//------------------------------------------------------------------------------
+CTsOrientationMonitor* CTsOrientationMonitor::NewL( MTsOrientationObserver& aObserver )
+    {
+    CTsOrientationMonitor* self = new (ELeave) CTsOrientationMonitor(aObserver);
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+//------------------------------------------------------------------------------
+CTsOrientationMonitor::CTsOrientationMonitor( MTsOrientationObserver& aObserver )
+:
+    CActive(EPriorityStandard),
+    iObserver(aObserver)
+    {
+    CActiveScheduler::Add(this);
+    }
+
+//------------------------------------------------------------------------------
+void CTsOrientationMonitor::ConstructL()
+    {
+    iRepository = CRepository::NewL( KSensorCenrepUid );
+    SetActive();
+    TRequestStatus* status( &iStatus );
+    User::RequestComplete( status, KErrNone );
+    }
+
+//------------------------------------------------------------------------------
+CTsOrientationMonitor::~CTsOrientationMonitor()
+    {
+    Cancel();
+    delete iChannel;
+    delete iRepository;
+    }
+
+//------------------------------------------------------------------------------
+void CTsOrientationMonitor::SubscribeL()
+    {
+    User::LeaveIfError( iRepository->NotifyRequest(KSensorCenrepKey, iStatus) );
+    SetActive();
+    }
+
+//------------------------------------------------------------------------------
+void CTsOrientationMonitor::StartSensorMonitoringL()
+    {
+    CSensrvChannelFinder *sensrvChannelFinder = CSensrvChannelFinder::NewLC();
+
+    RSensrvChannelInfoList channelInfoList;
+    CleanupClosePushL(channelInfoList);
+
+    TSensrvChannelInfo mySearchConditions;
+
+    //Search only Orientation events.
+    mySearchConditions.iChannelType = KSensrvChannelTypeIdOrientationData;
+
+    sensrvChannelFinder->FindChannelsL(channelInfoList, mySearchConditions);
+    
+    if( channelInfoList.Count() )
+        {
+        iChannel = CSensrvChannel::NewL(channelInfoList[0]);
+        iChannel->OpenChannelL();
+        iChannel->StartDataListeningL(this, 1, 1, 0);
+        }
+
+    CleanupStack::Pop(&channelInfoList);
+    CleanupStack::PopAndDestroy(sensrvChannelFinder);
+    }
+
+//------------------------------------------------------------------------------
+void CTsOrientationMonitor::StopSensorMonitoring()
+    {
+    if(0 != iChannel)
+        {
+        iChannel->StopDataListening();
+        }
+    delete iChannel;
+    iChannel = 0;
+    }
+
+//------------------------------------------------------------------------------
+void CTsOrientationMonitor::DoCancel()
+    {
+    iRepository->NotifyCancel(KSensorCenrepKey);
+    }
+
+//------------------------------------------------------------------------------
+void CTsOrientationMonitor::RunL()
+    {
+    User::LeaveIfError( iStatus.Int() );
+    TInt sensorStatus;
+    User::LeaveIfError(iRepository->Get(KSensorCenrepKey, sensorStatus));
+    (0 != sensorStatus ) ? StartSensorMonitoringL() : StopSensorMonitoring();
+    SubscribeL();
+    }
+
+//------------------------------------------------------------------------------
+TInt CTsOrientationMonitor::RunError(TInt aError)
+    {
+    if( KErrCancel != aError )
+        {
+        TRAP_IGNORE(SubscribeL());
+        }
+    return KErrNone;
+    }
+
+//------------------------------------------------------------------------------
+void CTsOrientationMonitor::DataReceived( CSensrvChannel& aChannel, 
+                                          TInt aCount, 
+                                          TInt /*aDataLost*/ )
+    {
+    if (aChannel.GetChannelInfo().iChannelType == KSensrvChannelTypeIdOrientationData)
+        {
+        TPckgBuf<TSensrvOrientationData> dataBuf;
+        for(TInt i = 0; i < aCount; ++i) 
+            {
+            aChannel.GetData(dataBuf);
+            iObserver.OrientationChanged( TSensrvOrientationData::EOrientationDisplayRightUp == dataBuf().iDeviceOrientation ? 270 : 0);
+            }
+        }
+    }
+
+//------------------------------------------------------------------------------
+void CTsOrientationMonitor::DataError( CSensrvChannel& /*aChannel*/, 
+                                       TSensrvErrorSeverity /*aError*/ )
+    {
+    //No implementation required
+    }
+
+//------------------------------------------------------------------------------
+void CTsOrientationMonitor::GetDataListenerInterfaceL( TUid /*aInterfaceUid*/, 
+                                                       TAny*& /*aInterface*/ )
+    {
+    //No implementation required
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/screenshotplugin/src/tsscreenshotmain.cpp	Mon Sep 13 13:26:33 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/taskswitcher/screenshotplugin/src/tsscreenshotplugin.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,272 @@
+/*
+* 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 <graphics/wsscreendevice.h>
+#include <s32mem.h>
+#include <e32property.h>
+#include <wspublishandsubscribedata.h>
+#include <tstaskmonitorglobals.h>
+#include <stddef.h>
+#include <qnamespace.h>
+
+#include "tsscreenshotplugin.h"
+#include "tsorientationmonitor.h"
+#include "tsscreenshotmsg.h"
+
+const TInt KInvalidGroupId(~0);
+const TUid KHbPsHardwareCoarseOrientationCategoryUid = {0x20022E82};
+const TUint KHbPsHardwareCoarseWsOrientationKey = 0x4F726965;
+
+// -----------------------------------------------------------------------------
+/**
+ * Two phase constructor 
+ */
+CTsScreenshotPlugin* CTsScreenshotPlugin::NewL()
+    {
+    //no second step construction is required here
+    //window server will initialize plugin later
+    return new(ELeave)CTsScreenshotPlugin();
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * From CWsGraphicDrawer
+ * @see CWsGraphicDrawer::ConstructL(MWsGraphicDrawerEnvironment&, const TGraphicDrawerId& , MWsClient&, const TDesC8&)
+ */
+void CTsScreenshotPlugin::ConstructL( MWsGraphicDrawerEnvironment& aEnv, 
+                                      const TGraphicDrawerId& iId, 
+                                      MWsClient& aOwner, 
+                                      const TDesC8& /*data*/ )
+    {
+    BaseConstructL( aEnv, iId, aOwner );
+    aEnv.RegisterEventHandler(this, 
+                             this, 
+                             TWservCrEvent::EWindowGroupChanged |
+                             TWservCrEvent::EDeviceOrientationChanged);
+    iWindowGroupId = KInvalidGroupId;
+    TRAP_IGNORE( ConstructL() );
+    }
+
+// -----------------------------------------------------------------------------
+void CTsScreenshotPlugin::ConstructL()
+    {
+    iMonitor = CTsOrientationMonitor::NewL( *this );
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Destructor
+ */
+CTsScreenshotPlugin::~CTsScreenshotPlugin()
+    {
+    delete iMonitor;
+    Env().UnregisterEventHandler(this);
+    iCache.ResetAndDestroy();
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * From CWsGraphicDrawer.
+ * @see CWsGraphicDrawer::DoDraw(MWsGc&, const TRect&, const TDesC8&) const
+ */ 
+void CTsScreenshotPlugin::DoDraw(MWsGc&, const TRect&, const TDesC8&) const
+    {
+    //plugin is not a real drawer
+    //no implementation required
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * From CWsGraphicDrawer
+ * @see CWsGraphicDrawer::HandleMessage(const TDesC8&)
+ */
+void CTsScreenshotPlugin::HandleMessage( const TDesC8& aMsg )
+    {
+    TRAP_IGNORE( HandleMessageL( aMsg ) );
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+void CTsScreenshotPlugin::HandleMessageL( const TDesC8& aMsg )
+    {
+    RDesReadStream msgStream(aMsg);
+    CleanupClosePushL(msgStream);
+    TInt function = msgStream.ReadInt32L();
+    if(RegisterScreenshotMessage == function)
+        {
+        CTsScreenshotMsg *screenshotMsg = CTsScreenshotMsg::NewLC(msgStream);
+        for( TInt iter(0); iter < iCache.Count(); ++iter )
+            {
+            if(iCache[iter]->Handle() == screenshotMsg->Screenshot().Handle())
+                {
+                //bitmap is not needed no more
+                delete iCache[iter];
+                iCache.Remove(iter);
+                break;
+                }
+            }
+        CleanupStack::PopAndDestroy( screenshotMsg );
+        }
+    CleanupStack::PopAndDestroy( &msgStream );
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * From MWsEventHandler.
+ * @see MWsEventHandler::DoHandleEvent(const TWservCrEvent&)
+ */
+void CTsScreenshotPlugin::DoHandleEvent(const TWservCrEvent& aEvent)
+    {
+    switch (aEvent.Type()) {
+    case TWservCrEvent::EWindowGroupChanged:
+        if( KInvalidGroupId != iWindowGroupId )
+            {
+            NotifyWindowGroupToBackground( iWindowGroupId );
+            TakeScreenshot( iWindowGroupId );
+            }
+        iWindowGroupId = aEvent.WindowGroupIdentifier();
+        break;
+    case TWservCrEvent::EDeviceOrientationChanged:
+        TakeScreenshot( iWindowGroupId );
+        break;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// 
+/**
+ * Function take screenshot od current display
+ * @param screenshot identyfier
+ */
+void CTsScreenshotPlugin::TakeScreenshot( TInt aId )
+    {
+    TRAP_IGNORE( TakeScreenshotL( aId ); )
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Function take screenshot od current display
+ * @param screenshot identyfier
+ */
+void CTsScreenshotPlugin::TakeScreenshotL( TInt aId )
+    {
+    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
+    RBuf8 message;
+    CleanupClosePushL(message);
+    message.CreateL(CTsScreenshotMsg::Size() + sizeof(TInt));
+    RDesWriteStream stream(message);
+    CleanupClosePushL(stream);
+    stream.WriteInt32L(RegisterScreenshotMessage);
+    
+    CTsScreenshotMsg * screenshotMsg = 
+        CTsScreenshotMsg::NewLC(aId, 
+                                *bitmap, 
+                                Low, 
+                                OrientationToAngle());
+    stream << (*screenshotMsg);
+    CleanupStack::PopAndDestroy(screenshotMsg);
+    CleanupStack::PopAndDestroy(&stream);
+    User::LeaveIfError(SendMessage(message));
+    CleanupStack::PopAndDestroy(&message);
+    iCache.AppendL(bitmap);
+    CleanupStack::Pop(bitmap);
+    }
+
+// -----------------------------------------------------------------------------
+//
+TInt CTsScreenshotPlugin::OrientationToAngle()
+    {
+    TInt retVal(0), orientation(0), sensor(0);
+    RProperty::Get( KRenderOrientationCategory, 
+                    KRenderOrientationKey, 
+                    orientation );
+    
+    switch( orientation )
+        {
+        case EDisplayOrientation90CW: retVal = 270;break;
+        case EDisplayOrientation180: retVal = 180;break;
+        case EDisplayOrientation270CW: retVal = 90;break;
+        case EDisplayOrientationNormal:retVal = iAngle; break;
+        case EDisplayOrientationAuto:
+            {
+            RProperty::Get( KHbPsHardwareCoarseOrientationCategoryUid, 
+                            KHbPsHardwareCoarseWsOrientationKey, sensor );
+            retVal = ( sensor == Qt::Vertical ) ? 270 : 0;
+            break;
+            }
+            
+        }
+    return retVal;
+    }
+
+// -----------------------------------------------------------------------------
+void CTsScreenshotPlugin::OrientationChanged( TInt aAngle )
+    {
+    iAngle = aAngle;
+    }
+
+// -----------------------------------------------------------------------------
+void CTsScreenshotPlugin::NotifyWindowGroupToBackground( TInt windowGroupId )
+    {
+    TRAP_IGNORE( NotifyWindowGroupToBackgroundL(windowGroupId); )
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+void CTsScreenshotPlugin::NotifyWindowGroupToBackgroundL( TInt windowGroupId )
+    {
+    RBuf8 message;
+    CleanupClosePushL(message);    
+    message.CreateL(2 * sizeof(TInt));
+        {
+        RDesWriteStream stream(message);
+        CleanupClosePushL(stream);
+        stream.WriteInt32L(WindowGroupToBackgroundMessage);
+        stream.WriteInt32L(windowGroupId);
+        CleanupStack::PopAndDestroy(&stream);
+        }
+    User::LeaveIfError(SendMessage(message));
+    CleanupStack::PopAndDestroy(&message);
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/screenshotplugin/src/tsscreenshotplugin.rss	Mon Sep 13 13:26:33 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 = "";
+					}
+				};
+			}
+		};
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/server/inc/tsdatalist.h	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,95 @@
+/*
+* 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:  Non-closeable app list class
+ *
+*/
+
+
+#ifndef TSDATALIST_H
+#define TSDATALIST_H
+
+#include <e32base.h>
+
+#include <HbIcon>
+
+#include "tswindowgroupsobserver.h"
+#include "tsentry.h"
+#include "tsdatastorage.h"
+#include "tsdataobserver.h"
+
+class CApaWindowGroupName;
+class CFbsBitmap;
+
+NONSHARABLE_CLASS( CTsDataList ) : public CTsWindowGroupsObserver,
+                                   public MTsDataStorage
+    {
+public:
+    static CTsDataList* NewL( MTsResourceManager& aResources, 
+                              MTsWindowGroupsMonitor& aMonitor, 
+                              MTsDataObserver& aObserver );
+
+    ~CTsDataList();
+
+private:
+    CTsDataList( MTsResourceManager& aResources,
+                 MTsWindowGroupsMonitor& aMonitor, 
+                 MTsDataObserver& aObserver );
+
+    void ConstructL();
+
+public:
+    const RTsFswArray& Data() const;
+    void HandleWindowGroupChanged( MTsResourceManager &,
+                                   const TArray<RWsSession::TWindowGroupChainInfo> & );
+    TBool IsHiddenUid( TUid aUid );
+    TBool IsSupported(TInt aFunction) const;
+    void HandleDataL(TInt aFunction,RReadStream& aDataStream);
+
+private:
+    void CollectAppsL( RTsFswArray& aAppsList,
+                       const TArray<RWsSession::TWindowGroupChainInfo> &aWgList );
+    void AddEntryL( const TTsEntryKey& aKey, 
+                    const TUid& aAppUid,
+                    CApaWindowGroupName* aWgName,
+                    RTsFswArray& aNewList );
+    HBufC* FindAppNameLC( CApaWindowGroupName* aWindowName,
+                          const TUid& aAppUid,
+                          TInt aWgId );
+    TBool CheckIfExists( const CTsEntry& aEntry,
+                         const RTsFswArray& aNewList ) const;
+    void RegisterScreenshotL( RReadStream& aDataStream );
+    void UnregisterScreenshotL( RReadStream& aDataStream );
+    void ChangeVisibilityL( RReadStream& aDataStream );
+    void UpdateTaskTimestampL( RReadStream& aDataStream );
+    void FitDataToListL( RTsFswArray& aListToFit );
+    TBool ConsiderOldDataL( const TTsEntryKey& aKey );
+    CFbsBitmap* GetAppIconL( const TUid& aAppUid );
+    TInt FindEntry( const RTsFswArray& aList, const TTsEntryKey& aKey ) const;
+    TBool EstablishOrder( const RArray<TTsEntryKey>& aKeyList );
+    TTsEntryKey GenerateKeyL( TInt );
+    void HideEntryIfNotAllowed( CTsEntry* aEntry );
+    TBool UpdateEntryData(const RTsFswArray& aList);
+    void RebuildVisibleDataListL();
+    CFbsBitmap* HbIcon2CFbsBitmap( const HbIcon& aIcon );
+
+private:
+    MTsResourceManager& iResources;
+    MTsDataObserver &iObserver;
+    RTsFswArray iData; // current fsw content, i.e. the task list
+    RTsFswArray iVisibleData;
+    RArray<TUid> iHiddenUids/** list of hidden uids */;
+    CFbsBitmap* iDefaultIcon /** default icon*/;
+    };
+
+#endif //TSDATALIST_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/server/inc/tsdataobservertask.h	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,39 @@
+/*
+* 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 DATAOBSERVERTASK_H
+#define DATAOBSERVERTASK_H
+#include <e32base.h>
+#include "tsdataobserver.h"
+
+class CTsDataObserverTask: public CTsDataObserver
+{
+public:
+    ~CTsDataObserverTask();
+    static void ExecuteLD( MTsDataObserverStorage& aStorage, 
+                           const RMessage2& aMsg );
+
+private:
+    CTsDataObserverTask( MTsDataObserverStorage& aStorage, 
+                         const RMessage2& aMsg );
+    void DataChanged();
+
+private:
+    MTsDataObserverStorage& iStorage;
+    const RMessage2 iMsg;
+    TBool iDataChanged;
+};
+#endif //DATAOBSERVERTASK_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/server/inc/tsdataprovider.h	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* 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 DATAPROVIDER_H
+#define DATAPROVIDER_H
+
+#include <e32base.h>
+class MTsDataProvider 
+{
+public:
+    virtual const TDesC8& Data() const = 0;
+};
+
+#endif //DATAPROVIDR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/server/inc/tsdataprovidertask.h	Mon Sep 13 13:26:33 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 DATAPROVIDERTASK_H
+#define DATAPROVIDERTASK_H
+
+#include "tsdataprovider.h"
+
+class TsDataProviderTask 
+{
+public:
+    static void ExecuteL( const MTsDataProvider& aProvider, 
+                          const RMessage2& aMsg);
+};
+
+#endif //DATAPROVIDER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/server/inc/tsdatastorage.h	Mon Sep 13 13:26:33 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 DATASTORAGE_H
+#define DATASTORAGE_H
+
+#include <e32base.h>
+#include "tstaskmonitorglobals.h"
+
+class MTsDataStorage {
+public:
+    virtual TBool IsSupported(TInt aFunction) const =0;
+    virtual void HandleDataL(TInt aFunction, RReadStream& aDataStream) =0;
+};
+
+#endif //DATASTORAGE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/server/inc/tsdatatask.h	Mon Sep 13 13:26:33 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 TSDATATASK_H
+#define TSDATATASK_H
+#include "tstaskmonitorglobals.h"
+#include "tsdatastorage.h"
+class TsDataTask
+{
+public:
+    static void ExecuteL(const TArray<MTsDataStorage*> &dataStorages, 
+                         const RMessage2& msg);
+};
+
+#endif //TSDATATASK_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/server/inc/tsmodel.h	Mon Sep 13 13:26:33 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 TSMODEL_H
+#define TSMODEL_H
+
+#include <e32base.h>
+#include "tsmodelitem.h"
+
+class MTsModelObserver;
+class MTsModel 
+{
+public:
+    virtual TInt Count() const = 0;
+    TTsModelItem ItemL( TInt aOffset ) const;
+    virtual void SetObserver( MTsModelObserver *observer ) = 0;
+    
+protected: //data access. should be used by TModelItem
+    virtual const TDesC& DisplayNameL( TInt aOffset ) const = 0;
+    virtual TInt IconHandleL( TInt aOffset ) const = 0;
+    virtual TTime TimestampL( TInt aOffset ) const = 0;
+    virtual TTime TimestampUpdateL(TInt offset) const = 0;
+    virtual TTsModelItemKey KeyL( TInt aOffset ) const = 0;
+    virtual TBool IsActiveL( TInt aOffset ) const = 0;
+    virtual TBool IsClosableL( TInt aOffset ) const = 0;
+
+protected: //operations execution
+    virtual TBool CloseL( TTsModelItemKey aKey ) const = 0;
+    virtual TBool LaunchL( TTsModelItemKey aKey ) const = 0;
+
+    friend class TTsModelItem;
+};
+
+#endif //TSMODEL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/server/inc/tsmodelitem.h	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef TSMODELITEM_H
+#define TSMODELITEM_H
+
+#include <e32base.h>
+#include "tsmodelitemkey.h"
+
+class MTsModel;
+
+class TTsModelItem {
+public:
+    TTsModelItem( const MTsModel& aModel, TInt aOffset );
+    TTsModelItem( const TTsModelItem& aItem );
+    const TDesC& DisplayNameL() const;
+    TInt IconHandleL() const;
+    TTime TimestampL() const;
+    TTime TimestampUpdateL() const; 
+    TTsModelItemKey KeyL() const;
+    TBool IsActiveL() const;
+    TBool IsClosableL() const;
+    TBool CloseL() const;
+    TBool LaunchL() const;
+    
+public:
+    void ExternalizeL( RWriteStream& aStream ) const;
+    
+private:
+    void ValidateL() const;
+
+private:
+    const MTsModel& iModel;
+    const TInt iIndex;
+};
+
+#endif //TSMODELITEM_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/server/inc/tsmodelitemkey.h	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef TSMODELITEMKEY_H
+#define TSMODELITEMKEY_H
+
+#include <e32base.h>
+#include <s32strm.h>
+
+typedef TInt TTsKey;
+
+class TTsModelItemKey
+{
+public:
+    static TInt Size();
+    TTsModelItemKey();
+    TTsModelItemKey( TTsKey aKey, TInt aRoot );
+    TTsModelItemKey( const TTsModelItemKey &aKey );
+    TTsModelItemKey& operator =( const TTsModelItemKey& aKey );
+    TBool operator == ( const TTsModelItemKey aKey ) const;
+    TInt Key() const;
+    void ExternalizeL( RWriteStream& aStream ) const;
+    void InternalizeL( RReadStream& aStream );
+
+private:
+    TTsKey iKey;
+    TInt iRoot;
+};
+
+#endif //TSMODELITEMKEY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/server/inc/tsmodelitemkeymsg.h	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +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:  Task list entry
+*
+*/
+
+#ifndef TSMODELITEMKEYMSG_H
+#define TSMODELITEMKEYMSG_H
+#include <e32base.h>
+#include <s32strm.h>
+#include "tsmodelitemkey.h"
+
+class CTsModelItemKeyMsg: public CBase
+{
+public:
+    static CTsModelItemKeyMsg* NewLC( RReadStream& aStream );
+    static TInt Size();
+    ~CTsModelItemKeyMsg();
+    TTsModelItemKey Key() const;
+    void InternalizeL( RReadStream &aStream );
+
+private:
+    CTsModelItemKeyMsg();
+    void ConstructL( RReadStream &aStream );
+
+private:
+    TTsModelItemKey iKey;
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/server/inc/tsmodelobserver.h	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,31 @@
+/*
+* 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 TSMODELOBSERVER_H
+#define TSMODELOBSERVER_H
+
+#include <e32base.h>
+
+class MTsModel;
+class TTsModelItem;
+
+class MTsModelObserver 
+{
+public:
+    virtual void DataChanged( MTsModel &aModel ) = 0;
+};
+
+#endif //TSMODELOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/server/inc/tsrunningappmodel.h	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,83 @@
+/*
+* 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 TSRUNNINGAPPMODEL_H
+#define TSRUNNINGAPPMODEL_H
+
+#include "tsmodel.h"
+#include "tsdatastorage.h"
+#include "tsdataobserver.h"
+
+#include "tswindowgroupsobserver.h"
+
+class CTsDataList;
+class CTsScreenshotProvider;
+
+NONSHARABLE_CLASS(CTsRunningAppModel) : public CBase, 
+                                        public MTsModel, 
+                                        public MTsDataStorage, 
+                                        public MTsDataObserver
+{
+
+public:
+    static CTsRunningAppModel *NewL( MTsResourceManager &aResources, 
+                                     MTsWindowGroupsMonitor &aMonitor );
+    static CTsRunningAppModel *NewLC( MTsResourceManager &aResources, 
+                                      MTsWindowGroupsMonitor &aMonitor );
+    ~CTsRunningAppModel();
+    
+private:
+    CTsRunningAppModel( MTsResourceManager &aResources );
+    void ConstructL( MTsResourceManager &aResources, 
+                     MTsWindowGroupsMonitor &aMonitor );
+
+// MHsDataObserver interface implementation
+public:
+    virtual void DataChanged();
+    
+// MTsDataStorage interface implementation    
+public:
+    TBool IsSupported( TInt aFunction ) const;
+    void HandleDataL( TInt aFunction, RReadStream& aDataStream );
+    
+public:
+    virtual TInt Count() const;
+    virtual void SetObserver( MTsModelObserver *aObserver );
+
+public:
+    virtual const TDesC& DisplayNameL( TInt aOffset ) const;
+    virtual TInt IconHandleL( TInt aOffset ) const;
+    virtual TTime TimestampL( TInt aOffset ) const;
+    virtual TTime TimestampUpdateL(TInt offset) const; 
+    virtual TTsModelItemKey KeyL( TInt aOffset ) const;
+    virtual TBool IsActiveL( TInt aOffset ) const;
+    virtual TBool IsClosableL( TInt aOffset ) const;
+
+public:
+    virtual TBool CloseL( TTsModelItemKey aKey ) const;
+    virtual TBool LaunchL( TTsModelItemKey aKey ) const;
+    
+private: // owned
+    CTsDataList *iDataList;
+    
+private: // not owned
+    MTsModelObserver* iObserver;
+    CTsScreenshotProvider* iScreenshotProvider;
+    MTsResourceManager& iResources;
+
+};
+
+#endif //TSRUNNINGAPPMODEL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/server/inc/tsrunningappserver.h	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef RUNNINGAPPSERVER_H
+#define RUNNINGAPPSERVER_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <w32std.h>
+#include "tsdataobserver.h"
+
+class CTsResourceManager;
+class CTsWindowGroupsMonitor;
+class MTsModel;
+class CTsRunningAppModel;
+class CTsStorage;
+class CTsSerializedDataProvider;
+class CTsServiceProvider;
+
+/**
+ *  CRunningAppServer
+ * 
+ */
+class CTsRunningAppServer : public CServer2,
+                            public MTsDataObserver
+{
+public:
+    ~CTsRunningAppServer();
+
+    static CTsRunningAppServer* NewLC();
+    
+public: //MHsDataObserver
+    void DataChanged();
+
+private:
+    CTsRunningAppServer();
+    void ConstructL();
+    CSession2* NewSessionL(const TVersion& aVersion, const RMessage2& aMsg) const;
+    void addProviders( RPointerArray<MTsModel> &aDst, 
+                       const CTsServiceProvider& aServiceProvider);
+
+private:
+    CTsResourceManager* iResources;
+    CTsWindowGroupsMonitor* iMonitor;
+    CTsSerializedDataProvider* iSerializer;
+    CTsStorage* iStorage; 
+    CTsServiceProvider* iServiceProvider;
+    CTsRunningAppModel* iAppsModel;
+    CBase *iBacksteppingEngine;
+};
+
+#endif // RUNNINGAPPSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/server/inc/tsrunningappsession.h	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,59 @@
+/*
+* 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 RUNNINGAPPSESSION_H
+#define RUNNINGAPPSESSION_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include "tsdataobserver.h"
+#include "tsdataprovider.h"
+#include "tsdatastorage.h"
+
+class CTsRunningAppSession : public CSession2,
+                             public MTsDataObserver,
+                             public MTsDataObserverStorage
+{
+public:
+    ~CTsRunningAppSession();
+
+    static CTsRunningAppSession* NewL(
+                                const MTsDataProvider& aDataProvider,
+                                const TArray<MTsDataStorage*> &aDataStorages);
+
+private:
+    CTsRunningAppSession( const MTsDataProvider& aDataProvider );
+    void ConstructL( const TArray<MTsDataStorage*> &aDataStorages );
+
+public://from CSession2
+    void ServiceL( const RMessage2& aMessage );
+
+public://from MTsDataObserver
+    void DataChanged();
+
+public://from MTsDataObserverStorage
+    void PushL(CTsDataObserver* aObserver);
+    void Pop(CTsDataObserver* aObserver);
+
+private:
+    const MTsDataProvider& iDataProvider;
+    RPointerArray< MTsDataStorage > iDataStorages;
+    RPointerArray<CTsDataObserver> iObservers;
+    TBool iMissedDataUpdate;
+};
+
+#endif // RUNNINGAPPSESSION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/server/inc/tsscreenshotprovider.h	Mon Sep 13 13:26:33 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& iStorage;
+};
+
+#endif //TSSCREENSHOTTASK_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/server/inc/tsserializeddataprovider.h	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,48 @@
+/*
+* 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 SERIALIZEDDATAPROVIDER_H
+#define SERIALIZEDDATAPROVIDER_H
+
+#include "tsdataobserver.h"
+#include "tsdataprovider.h"
+#include "tsmodelobserver.h"
+
+class RWriteStream;
+
+class CTsSerializedDataProvider: public CBase,
+                                 public MTsModelObserver,
+                                 public MTsDataProvider
+{
+public:
+    static CTsSerializedDataProvider* NewL(MTsDataObserver& aObserver);
+    ~CTsSerializedDataProvider();
+    const TDesC8& Data() const;
+    void DataChanged(MTsModel &aModel);
+
+private:
+    CTsSerializedDataProvider(MTsDataObserver& aObserver);
+    void serializeModel(const MTsModel& aSrc);
+    void serializeModelL(const MTsModel& aSrc);
+    void serializeModelL(RWriteStream& aDst, const MTsModel& aSrc); 
+
+private:
+    MTsDataObserver& iObserver;
+    RBuf8 iData;
+
+};
+
+#endif //SERIALIZEDDATAPROVIDER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/server/inc/tsservice.h	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef TSSERVICE_H
+#define TSSERVICE_H
+
+#include <e32base.h>
+
+#include "tsmodel.h"
+#include "tsdataobserver.h"
+
+class QObject;
+class TsAbstractModel;
+
+class CTsService: public CBase,
+                  public MTsModel,
+                  public MTsDataObserver
+{
+public:
+    static CTsService* NewLC( QObject* model );
+    ~CTsService();
+
+public: //from MTsDataObserver
+    void DataChanged();
+
+public: //from MTsModel
+    TInt Count() const;
+    void SetObserver( MTsModelObserver *aObserver );
+    
+protected: //from MTsModel
+    const TDesC& DisplayNameL( TInt aOffset ) const;
+    TInt IconHandleL( TInt aOffset ) const;
+    TTime TimestampL( TInt aOffset ) const;
+    TTime TimestampUpdateL(TInt offset) const;
+    TTsModelItemKey KeyL( TInt aOffset ) const;
+    TBool IsActiveL( TInt aOffset ) const;
+    TBool IsClosableL( TInt aOffset ) const;
+    TBool CloseL( TTsModelItemKey aKey ) const;
+    TBool LaunchL( TTsModelItemKey aKey ) const;
+    
+private:
+    CTsService();
+    void ConstructL( QObject* aModel );
+    TInt IntValueL( TInt aOffset, const char* aKey ) const;
+    TTime TimeValueL( TInt aOffset, const char* aKey ) const;
+    const TDesC& StringValueL( TInt aOffset, const char* aKey ) const;
+private:
+    QObject *iModel;
+    QObject *iServiceObserver;
+    MTsModelObserver *iModelObserver;
+    HBufC *iBuffer;
+};
+#endif //TSSERVICE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/server/inc/tsserviceobserver.h	Mon Sep 13 13:26:33 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 TSSERVICEOBSERVER_H
+#define TSSERVICEOBSERVER_H
+#include <QObject>
+
+#include "tsdataobserver.h"
+class  TsServiceObserver: public QObject
+{
+    Q_OBJECT
+
+public:
+    TsServiceObserver(MTsDataObserver& observer);
+
+public slots:
+    void dataChanged();
+
+private:
+    MTsDataObserver &mObserver;
+};
+#endif //TSSERVICEOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/server/inc/tsservicesprovider.h	Mon Sep 13 13:26:33 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 TSSERVICESPROVIDER_H
+#define TSSERVICESPROVIDER_H
+
+#include "tsmodel.h"
+#include "tsservicesproviderconfig.h"
+
+class CTsService;
+
+class CTsServiceProvider: public CBase
+{
+public:
+    static CTsServiceProvider* NewL( const CTsServiceProviderConfig& aConfig );
+    ~CTsServiceProvider();
+    MTsModel& operator[]( TInt aOffset ) const;
+    TInt Count() const;
+
+private:
+    CTsServiceProvider();
+    void Construct( const CTsServiceProviderConfig& aConfig );
+
+private:
+    RPointerArray<CTsService> iServices;
+};
+#endif //TSSERVICESPROVIDER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/server/inc/tsservicesproviderconfig.h	Mon Sep 13 13:26:33 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 TSSERVICESPROVIDERCONFIG_H
+#define TSSERVICESPROVIDERCONFIG_H
+
+#include <e32base.h>
+class QObject;
+class CTsServiceProviderConfig: public CBase
+{
+public:
+    static CTsServiceProviderConfig* NewLC();
+    ~CTsServiceProviderConfig();
+
+    TInt Count() const;
+    QObject* LoadL(TInt aOffset)const;
+private:
+    CTsServiceProviderConfig();
+    void ConstructL();
+
+private:
+    RPointerArray<TAny> iServices;
+};
+
+#endif //TSSERVICESPROVIDERCONFIG_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/server/inc/tsstorage.h	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,77 @@
+/*
+* 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 TSSTORAGE_H
+#define TSSTORAGE_H
+#include <e32base.h>
+
+#include "tsmodel.h"
+#include "tsmodelobserver.h"
+#include "tsdataobserver.h"
+#include "tsdatastorage.h"
+
+class CTsStorage: public CBase,
+                  public MTsModel,
+                  public MTsModelObserver,
+                  public MTsDataObserver,
+                  public MTsDataStorage
+{
+public:
+    static CTsStorage* NewL(const TArray<MTsModel*> &aDataProviders);
+    ~CTsStorage();
+    
+private:
+    CTsStorage();
+    void ConstructL(const TArray<MTsModel*> &aDataProviders);
+    TInt ResetModel();
+    void ResetModelL();
+    void PullDataL(const MTsModel& aSrc);
+    void ReorderDataL();
+
+public://from MTsModelObserver
+    void DataChanged(MTsModel& aModel);
+
+public://from MTsModel
+    TInt Count() const;
+    void SetObserver(MTsModelObserver* aObserver);
+    
+private://from MTsModel
+    const TDesC& DisplayNameL( TInt aOffset ) const;
+    TInt IconHandleL( TInt aOffset ) const;
+    TTime TimestampL( TInt aOffset ) const;
+    TTime TimestampUpdateL(TInt offset) const;
+    TTsModelItemKey KeyL( TInt aOffset ) const;
+    TBool IsActiveL( TInt aOffset ) const;
+    TBool IsClosableL( TInt aOffset ) const;
+    TBool CloseL( TTsModelItemKey aKey ) const;
+    TBool LaunchL( TTsModelItemKey aKey ) const;
+    TTsModelItem FindL( TTsModelItemKey aKey ) const;
+
+public://from MTsDataObserver
+    void DataChanged();
+
+public://from MTsDataStorage
+    TBool IsSupported(TInt aFunction) const;
+    void HandleDataL(TInt aFunction, RReadStream& aDataStream);
+
+private:
+    RPointerArray<MTsModel> iDataProviders;
+    RArray<TTsModelItem> iData;
+    MTsModelObserver* iDataObserver;
+
+};
+
+#endif //TSSTORAGE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/server/server.pro	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,116 @@
+#
+# 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 = app
+TARGET = hsrunningappmonitor
+CONFIG += hb mobility
+MOBILITY = serviceframework
+
+myrssrules = \
+"hidden = KAppIsHidden;"
+RSS_RULES += myrssrules
+    
+INCLUDEPATH +=  inc \
+                ../inc \
+                ../../inc \
+                ../utils/inc \
+                ../backstepping/inc \
+                
+SOURCES +=  src/tsdataobservertask.cpp \
+            src/tsdataprovidertask.cpp \
+            src/tsrunningappserver.cpp \
+            src/tsrunningappsession.cpp \
+            src/main.cpp \
+            src/tsdatalist.cpp \
+            src/tsdatatask.cpp \
+            src/tsscreenshotprovider.cpp \
+            src/tsmodelitemkey.cpp \
+            src/tsmodelitem.cpp \
+            src/tsmodel.cpp \
+            src/tsrunningappmodel.cpp \
+            src/tsstorage.cpp \
+            src/tsserializeddataprovider.cpp \
+            src/tsservice.cpp \
+            src/tsservicesprovider.cpp \
+            src/tsservicesproviderconfig.cpp \
+            src/tsserviceobserver.cpp \
+            src/tsmodelitemkeymsg.cpp \
+            ../utils/src/tsentrykey.cpp \
+            ../utils/src/tsentrykeygenerator.cpp \
+            ../utils/src/tsentry.cpp \
+            ../utils/src/tsscreenshotmsg.cpp \
+            ../utils/src/tsunregscreenshotmsg.cpp \
+            ../utils/src/tsvisibilitymsg.cpp \
+            ../utils/src/tswindowgroupsmonitor.cpp \
+            ../utils/src/tswindowgroupsobserver.cpp \
+            ../utils/src/tsresourcemanager.cpp \
+            
+HEADERS +=  inc/tsdataobservertask.h \
+            inc/tsdataprovider.h \
+            inc/tsdataprovidertask.h \
+            inc/tsrunningappserver.h \
+            inc/tsrunningappsession.h \
+            inc/tsdatalist.h \
+            inc/tsdatastorage.h \
+            inc/tsdatatask.h \
+            inc/tsscreenshotprovider.h \            
+            inc/tsmodelobserver.h \
+            inc/tsmodelitemkey.h \
+            inc/tsmodelitem.h \
+            inc/tsmodel.h \
+            inc/tsrunningappmodel.h \
+            inc/tsstorage.h \
+            inc/tsserializeddataprovider.h \
+            inc/tsservice.h \
+            inc/tsservicesprovider.h \
+            inc/tsservicesproviderconfig.h \
+            inc/tsserviceobserver.h \
+            inc/tsmodelitemkeymsg.h \
+            ../utils/inc/tsdataobserver.h \
+            ../utils/inc/tsentry.h \
+            ../utils/inc/tsentrykey.h \
+            ../utils/inc/tsentrykeygenerator.h \
+            ../utils/inc/tsutils.h \
+            ../utils/inc/tsscreenshotmsg.h \
+            ../utils/inc/tsunregscreenshotmsg.h \
+            ../utils/inc/tsvisibilitymsg.h \
+            ../utils/inc/tsresourcemanager.h \
+            ../utils/inc/tswindowgroupsobserver.h \
+
+LIBS += -lxqutils \
+        -ltsbackstepping \
+        -laknicon \
+        -lfbscli \          #for CFbsBitmap
+        -lestor \           #for RDesReadStream
+        -lxqutils \
+        -lapgrfx \          #for CApaWindowGroupName
+        -lws32 \            #for CWsGraphic
+        -lapparc \          #for TApaAppInfo
+        -lcaclient \        #for getApplicationIcon
+        -lcone
+
+# tsimageutils and its dependencies
+LIBS += -ltsimageutils.lib \
+        -lbitmaptransforms \
+        -limageconversion \
+        -lefsrv \
+        
+        
+symbian {
+    TARGET.UID3 = 0x200267B0
+    TARGET.CAPABILITY = All -TCB
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/server/src/main.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,60 @@
+/*
+* 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 "tsrunningappserver.h"
+#include "tstaskmonitorglobals.h"
+#include <apgwgnam.h>
+#include <eikenv.h>
+
+#include <caservice.h>
+
+int main(int argc, char *argv[]) 
+{
+    QApplication app(argc, argv);
+    
+    // hide server from TaskSwitcher
+    CEikonEnv * env = CEikonEnv::Static();
+    if(env) {
+        env->RootWin().SetOrdinalPosition(0, ECoeWinPriorityNeverAtFront);
+
+        CApaWindowGroupName *wgName = CApaWindowGroupName::NewLC(env->WsSession());    
+        wgName->SetHidden(ETrue); // hides us from FSW and protects us from OOM FW etc.
+        wgName->SetSystem(ETrue); // Allow only application with PowerManagement cap to shut us down    
+        wgName->SetCaptionL(KRunningAppServerName);    
+        wgName->SetWindowGroupName(env->RootWin());
+        CleanupStack::PopAndDestroy(wgName);
+    }
+    
+    // maintain instance of caservice (needed for getting application icons)
+    QSharedPointer<CaService> service = CaService::instance();    
+    
+    CServer2* serverObject = CTsRunningAppServer::NewLC();    
+    CleanupStack::Pop(serverObject);
+    
+    RSemaphore semaphore;
+    if (KErrNone == semaphore.OpenGlobal(KTsServerReadySemaphore)) {
+        semaphore.Signal();
+    }
+    semaphore.Close();
+    
+    int result = app.exec();
+    
+    delete serverObject;
+    return result;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/server/src/tsdatalist.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,620 @@
+/*
+ * 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:
+#include <mmf/common/mmfcontrollerpluginresolver.h> // for CleanupResetAndDestroyPushL
+#include <e32debug.h>
+#include <apgwgnam.h>
+#include <bitstd.h>
+#include <AknIconUtils.h> // avkon
+#include <apgicnfl.h> // fbsbitmap
+#include <AknIconSrvClient.h> 
+#include <fbs.h>
+#include <apgwgnam.h>
+#include <QSizeF>
+#include <camenuiconutility.h>
+
+#include "tsdatalist.h"
+#include "tsentrykeygenerator.h"
+#include "tsscreenshotmsg.h"
+#include "tsunregscreenshotmsg.h"
+#include "tsvisibilitymsg.h"
+
+// size for the created app icons
+const TInt KAppIconWidth = 128;
+const TInt KAppIconHeight = 128;
+
+//uids to be hidden
+const TUid KHsApplicationUid = { 0x20022F35 };
+
+// ================= MEMBER FUNCTIONS =======================
+
+// --------------------------------------------------------------------------
+/**
+ * Two-phased constructor.
+ */
+CTsDataList* CTsDataList::NewL( MTsResourceManager& aResources,
+                                MTsWindowGroupsMonitor& aMonitor, 
+                                MTsDataObserver& aObserver )
+    {
+    CTsDataList* self = new (ELeave) CTsDataList( aResources, 
+                                                  aMonitor, 
+                                                  aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+/**
+ * Constructor.
+ */
+CTsDataList::CTsDataList(MTsResourceManager& aResources,
+                         MTsWindowGroupsMonitor &aMonitor, 
+                         MTsDataObserver& aObserver ) 
+:
+    CTsWindowGroupsObserver( aMonitor ),
+    iResources( aResources ),
+    iObserver( aObserver )
+    {
+    }
+
+// --------------------------------------------------------------------------
+/*
+ * Destructor
+ */
+CTsDataList::~CTsDataList()
+    {
+    iData.ResetAndDestroy();
+    iVisibleData.Close();
+    iHiddenUids.Close();
+    RFbsSession::Disconnect();
+    RAknIconSrvClient::Disconnect();
+    delete iDefaultIcon;
+    }
+
+// --------------------------------------------------------------------------
+/**
+ * Performs 2nd phase construction.
+ */
+void CTsDataList::ConstructL()
+    {
+    BaseConstructL();
+    iHiddenUids.AppendL( KHsApplicationUid );
+    User::LeaveIfError(RFbsSession::Connect());
+    RAknIconSrvClient::Connect();
+    QT_TRYCATCH_LEAVING(
+        iDefaultIcon = HbIcon2CFbsBitmap( HbIcon("qtg_large_application") );)
+    }
+
+// --------------------------------------------------------------------------
+/**
+ * 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& CTsDataList::Data() const
+    {
+    return iVisibleData;
+    }
+
+// --------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see MTsWindowGroupsObserver HandleWindowGroupChanged
+ */
+void CTsDataList::HandleWindowGroupChanged(
+                      MTsResourceManager &, 
+                      const TArray<RWsSession::TWindowGroupChainInfo>& aWgList)
+    {
+    TRAP_IGNORE(RDebug::Print(_L("[TaskSwitcher] processing started"));
+                RTsFswArray newAppsList;
+                CleanupResetAndDestroyPushL(newAppsList);
+                CollectAppsL(newAppsList, aWgList);
+                RDebug::Print(_L("[TaskSwitcher] gathered app info"));
+                FitDataToListL(newAppsList);
+                CleanupStack::PopAndDestroy(&newAppsList);
+                RDebug::Print(_L("[TaskSwitcher] processing finished"));
+                );
+    }
+
+// --------------------------------------------------------------------------
+/**
+ * Adds running apps to the list.
+ * @param aAppsList array to add to
+ */
+void CTsDataList::CollectAppsL(RTsFswArray& aAppsList, 
+                               const TArray<RWsSession::TWindowGroupChainInfo> &aWgList)
+    {
+    for( TInt i(0); i < aWgList.Count(); ++i )
+        {
+        TTsEntryKey key;
+        TInt err = TsEntryKeyGeneraror::Generate(key, aWgList[i].iId, aWgList);
+        //skip this entry if it is already on list or generate key failed
+        if( err!=KErrNone || FindEntry( aAppsList, key ) >= 0 ) 
+            {
+            continue;
+            }
+
+        // get window group name
+        CApaWindowGroupName* windowName = 
+            CApaWindowGroupName::NewLC( iResources.WsSession(), 
+                                        key.WindowGroupId() );
+        TUid appUid = windowName->AppUid();
+        
+         // get screen number (-1=console, 0=main screen, 1=cover ui)
+        TInt appScreen = 0;
+        TInt scrNumErr = 
+            iResources.ApaSession().GetDefaultScreenNumber( appScreen, 
+                                                            appUid );
+        
+        if( appUid.iUid && 
+            !windowName->Hidden() && 
+            (appScreen == 0 || appScreen == -1) && 
+            scrNumErr == KErrNone )
+            {
+            AddEntryL( key, appUid, windowName, aAppsList );
+            }
+
+        CleanupStack::PopAndDestroy( windowName );
+        }
+    }
+
+// --------------------------------------------------------------------------
+/**
+ * Called from CollectTasksL for each entry in the task list.
+ * @param   aKey       entry key
+ * @param   aAppUid    application uid
+ * @param   aWgName    window group name or NULL
+ * @param   aNewList   list to add to
+ */
+void CTsDataList::AddEntryL( const TTsEntryKey& aKey, 
+                             const TUid& aAppUid,
+                             CApaWindowGroupName* aWgName, 
+                             RTsFswArray& aNewList )
+    {
+    CTsEntry* entry = CTsEntry::NewLC( aKey, iObserver );
+    // check if present in old list and if yes then take some of the old data
+    TBool found = ConsiderOldDataL( aKey );
+    // if not present previously then find out app name
+    // and check if screenshot is already available
+    if( !found )
+        {
+        entry->SetAppUid(aAppUid);
+        HBufC* name = FindAppNameLC( aWgName, aAppUid, aKey.WindowGroupId() );
+        entry->SetAppNameL(*name);
+        CleanupStack::PopAndDestroy( name );
+        //transfer ownership to entry
+        entry->SetAppIcon( GetAppIconL( aAppUid ) );
+        }
+    if(aWgName)
+        {
+        entry->SetCloseableApp( !aWgName->IsSystem() );
+        }
+    // add to new list, ownership is transferred
+    aNewList.AppendL( entry );
+    CleanupStack::Pop( entry );
+    }
+
+// --------------------------------------------------------------------------
+/**
+ * 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.
+ * @param   aKey      new key in content list
+ * @return  ETrue if app was found
+ */
+TBool CTsDataList::ConsiderOldDataL( const TTsEntryKey& aKey )
+    {
+    for(TInt entryIdx = 0, oldCount = iData.Count(); entryIdx < oldCount; ++entryIdx) 
+        {
+        if (iData[entryIdx]->Key() == aKey) 
+            {
+            return ETrue;
+            }
+        }
+    return EFalse;
+    }
+
+// --------------------------------------------------------------------------
+/**
+ * Finds out the application name.
+ * @param   aWindowName window group name or NULL
+ * @param   aAppUId     application uid
+ * @param   aWgId       window group id
+ * @return  application name, ownership transferred to caller
+ */
+HBufC* CTsDataList::FindAppNameLC( CApaWindowGroupName* aWindowName, 
+                                   const TUid& aAppUid, 
+                                   TInt aWgId )
+    {
+    //Retrieve the app name
+    TApaAppInfo info;
+    iResources.ApaSession().GetAppInfo( info, aAppUid );
+    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().AllocLC();
+            }
+        else
+            {
+            TThreadId threadId;
+            if(KErrNone == iResources.WsSession().GetWindowGroupClientThreadId( aWgId, threadId ) ) 
+                {
+                RThread thread;
+                CleanupClosePushL( thread );
+                if( KErrNone == thread.Open( threadId ) )
+                    {
+                    tempName = thread.Name().AllocL(); // codescanner::forgottoputptroncleanupstack
+                    }
+                // tempName put on cleanupstack after the if
+                CleanupStack::PopAndDestroy( &thread );
+                if(tempName)
+                    {
+                    CleanupStack::PushL(tempName);
+                    }
+                }
+            }
+        }
+    else
+        {
+        tempName = caption.AllocLC();
+        }
+    if( 0 == tempName )
+        {
+        tempName = KNullDesC16().AllocLC();
+        }
+    return tempName;
+    }
+
+// --------------------------------------------------------------------------
+/**
+ * Fit existing class contained data list into give one.
+ * 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  
+ */
+void CTsDataList::FitDataToListL( RTsFswArray& aListToFit )
+    {
+    TBool changed = EFalse;
+    TInt dataCount = iData.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;
+            }
+        }
+    RArray<TTsEntryKey> allKeys;
+    
+    //add new items at start
+    for(TInt i = aListToFit.Count() - 1; i >= 0; --i)
+        {        
+        User::LeaveIfError( allKeys.Insert(aListToFit[i]->Key(), 0) );
+        if( !CheckIfExists( *aListToFit[i], iData ) ) 
+            {
+            HideEntryIfNotAllowed( aListToFit[i] );
+            User::LeaveIfError( iData.Insert( aListToFit[i], 0 ) );
+            TTime currentTimestamp;
+            currentTimestamp.UniversalTime();
+            iData[0]->SetTimestamp( currentTimestamp );
+            aListToFit[i] = 0;
+            changed = ETrue;
+            }
+        }
+    //establish order
+    TBool orderChanged = EstablishOrder( allKeys );
+    //update entries data
+    TBool dataChanged = UpdateEntryData( aListToFit );
+    RebuildVisibleDataListL();
+    if( changed || orderChanged || dataChanged )
+        {
+        iObserver.DataChanged();
+        }
+    allKeys.Close();
+    }
+
+// --------------------------------------------------------------------------
+/**
+ * Checks if there is an entry for same app in the given list.
+ * @param   aEntry      entry
+ * @param   aList    ref to list
+ * @return  ETrue if app was found
+ */
+
+TBool CTsDataList::CheckIfExists( const CTsEntry& aEntry, 
+                                  const RTsFswArray& aList ) const
+    {
+    return 0 <= FindEntry( aList, aEntry.Key() );
+    }
+
+// --------------------------------------------------------------------------
+/**
+ * Retrieves the bitmap for the icon of the given app.
+ * @param   aAppUid application uid
+ * @return  app CFbsBitmap
+ */
+CFbsBitmap* CTsDataList::GetAppIconL( const TUid& aAppUid )
+    {
+    
+    CFbsBitmap* iconBitmap(0);
+    TRAPD(errNo, 
+          QT_TRYCATCH_LEAVING(
+          const QSize size(KAppIconWidth, KAppIconHeight);
+          HbIcon icon = CaMenuIconUtility::getApplicationIcon( aAppUid.iUid, size);
+          iconBitmap = HbIcon2CFbsBitmap( icon );)
+          User::LeaveIfNull(iconBitmap); )
+    if( KErrNone != errNo )
+        {
+        iconBitmap = new(ELeave) CFbsBitmap;
+        CleanupStack::PushL(iconBitmap);
+        User::LeaveIfError( iconBitmap->Duplicate( iDefaultIcon->Handle() ) );
+        CleanupStack::Pop(iconBitmap);
+        }
+    return iconBitmap; 
+    }
+
+// --------------------------------------------------------------------------
+/**
+ * Converts HbIcon to CFbsBitmap
+ * @param   aIcon icon to be coverted
+ * @return  CFbsBitmap
+ */
+CFbsBitmap* CTsDataList::HbIcon2CFbsBitmap( const HbIcon& aIcon )
+    {
+    CFbsBitmap* retValue(0);
+    QIcon qicon = aIcon.qicon();
+    QPixmap pixmap = qicon.pixmap(QSize(KAppIconWidth, KAppIconHeight));
+    if( !pixmap.isNull() )
+        {
+        retValue = pixmap.toSymbianCFbsBitmap();
+        }
+    return retValue; 
+    }
+// --------------------------------------------------------------------------
+TBool CTsDataList::IsSupported( TInt aFunction ) const
+    {
+    return ( RegisterScreenshotMessage == aFunction ||
+             UnregisterScreenshotMessage == aFunction ||
+             VisibilityChange == aFunction || 
+             WindowGroupToBackgroundMessage == aFunction );
+    }
+
+// --------------------------------------------------------------------------
+void CTsDataList::HandleDataL( TInt aFunction, RReadStream& aDataStream )
+    {
+    switch( aFunction )
+        {
+        case RegisterScreenshotMessage:
+            RegisterScreenshotL( aDataStream );
+            break;
+        case UnregisterScreenshotMessage:
+            UnregisterScreenshotL( aDataStream );
+            break;
+        case VisibilityChange:
+            ChangeVisibilityL( aDataStream );
+            break;        
+        case WindowGroupToBackgroundMessage:
+            UpdateTaskTimestampL( aDataStream );
+            break;
+        }
+    }
+
+// --------------------------------------------------------------------------
+void CTsDataList::RegisterScreenshotL( RReadStream& aDataStream )
+    {
+    CTsScreenshotMsg* msg = CTsScreenshotMsg::NewLC( aDataStream );
+    const TInt pos = FindEntry( iData, GenerateKeyL(msg->WindowGroupId() ) );
+    User::LeaveIfError(pos);
+    iData[pos]->SetScreenshotL( msg->Screenshot(), msg->Priority(), msg->Rotation() );
+    CleanupStack::PopAndDestroy(msg);
+    }
+// --------------------------------------------------------------------------
+void CTsDataList::UnregisterScreenshotL(RReadStream& aDataStream)
+{
+    CTsUnregisterScreenshotMsg* msg = 
+        CTsUnregisterScreenshotMsg::NewLC(aDataStream);
+    const TInt pos = FindEntry( iData, GenerateKeyL(msg->windowGroupId() ) );
+    User::LeaveIfError(pos);
+    iData[pos]->RemoveScreenshotL();
+    CleanupStack::PopAndDestroy(msg);
+}
+// --------------------------------------------------------------------------
+void CTsDataList::ChangeVisibilityL( RReadStream& aDataStream )
+    {
+    CTsVisibilitMsg* msg = CTsVisibilitMsg::NewLC(aDataStream);
+    const TInt pos = FindEntry( iData, GenerateKeyL( msg->windowGroupId() ) );
+    User::LeaveIfError(pos);
+    
+    msg->visibility() == iData[pos]->GetVisibility() ? 
+    User::Leave( KErrInUse ) : 
+    iData[pos]->SetVisibility( msg->visibility() );
+    
+    CleanupStack::PopAndDestroy(msg);
+    RebuildVisibleDataListL();
+    iObserver.DataChanged();
+    }
+// --------------------------------------------------------------------------
+void CTsDataList::UpdateTaskTimestampL( RReadStream& aDataStream )
+    {
+    const TInt wgId = aDataStream.ReadInt32L();
+    const TInt pos = FindEntry( iData, GenerateKeyL( wgId ) );
+    User::LeaveIfError( pos );
+
+    TTime currentTimestamp;
+    currentTimestamp.UniversalTime();
+    iData[pos]->SetTimestamp( currentTimestamp );
+
+    iObserver.DataChanged();
+    }
+
+// --------------------------------------------------------------------------
+/**
+ * Checks if given uid is on hidden list
+ * @param   aUid uid to be checked
+ * @return  ETrue if uid is on hidden list
+ */
+TBool CTsDataList::IsHiddenUid( TUid aUid )
+    {
+    return 0 < iHiddenUids.Find( aUid );
+    }
+
+// --------------------------------------------------------------------------
+/**
+ * Finds entry in array
+ * @param   aList list to find
+ * @param   aKey finding key
+ * @return   position or KErrNotFound
+ */
+TInt CTsDataList::FindEntry( const RTsFswArray& aList, 
+                             const TTsEntryKey& aKey ) const
+    {
+    TInt pos(KErrNotFound);
+    for(TInt entryIdx = 0; 
+        entryIdx < aList.Count() && KErrNotFound == pos; 
+        ++entryIdx)
+        {
+        if (aList[entryIdx]->Key() == aKey)
+            {
+            pos = entryIdx;
+            }
+        }
+    return pos;
+    }
+
+// --------------------------------------------------------------------------
+/**
+ * Establish entry order accridung to aKeyList, all keys MUST be in iData
+ * @param   aKeyList reference key list
+ * @return   ETrue if changes occured
+ */
+TBool CTsDataList::EstablishOrder( const RArray<TTsEntryKey>& aKeyList )
+    {
+    TBool changed( EFalse );
+    TInt lastChangedItem( KErrNotFound );
+    __ASSERT_ALWAYS( iData.Count() == aKeyList.Count(), User::Panic(_L("EstablishOrder 1"), KErrBadHandle) );
+    for (TInt i = 0; i < aKeyList.Count(); i++)
+        {
+        const TTsEntryKey& currentdataKey = iData[i]->Key();
+        const TTsEntryKey& referenceKey = aKeyList[i];
+        if( !(currentdataKey == referenceKey) )
+            {
+            TInt foundPos = FindEntry( iData, referenceKey );
+            __ASSERT_ALWAYS(foundPos>=0,  User::Panic(_L("EstablishOrder 2"), KErrBadHandle));
+            CTsEntry* entry = iData[foundPos];
+            iData.Remove( foundPos );
+            iData.Insert( entry, i );
+            changed = ETrue;
+            lastChangedItem = i;
+            }
+        }
+    TTime currentTimestamp;
+    currentTimestamp.UniversalTime();
+    for (TInt i = lastChangedItem; i >= 0; --i)
+        {
+        iData[i]->SetTimestamp(currentTimestamp);
+        }
+    return changed;
+    }
+
+// --------------------------------------------------------------------------
+/**
+ * Updates entry data on mData according to list
+ * @param   aList reference entires list
+ * @return   ETrue if changes occured
+ */
+TBool CTsDataList::UpdateEntryData( const RTsFswArray& aList )
+{
+    __ASSERT_ALWAYS( iData.Count() == aList.Count(), 
+                     User::Panic(_L("UpdateEntryData 1"), KErrBadHandle) );
+    TBool changed( EFalse );
+    for( TInt i=0; i<aList.Count(); i++ )
+        {
+        if(aList[i]) 
+            {
+            __ASSERT_ALWAYS(iData[i]->Key() == aList[i]->Key(), 
+                            User::Panic(_L("UpdateEntryData 2"), KErrBadHandle));
+            if( iData[i]->CloseableApp() != aList[i]->CloseableApp() )
+                {
+                iData[i]->SetCloseableApp(aList[i]->CloseableApp());
+                changed = ETrue;
+                }
+            }
+        }
+    return changed;
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Function generate task key using window group id
+ * @param wgId - window group id of running application
+ * @param entry key 
+ */
+TTsEntryKey CTsDataList::GenerateKeyL( TInt aWgId )
+    {
+    RArray<RWsSession::TWindowGroupChainInfo> allWgIds;
+    CleanupClosePushL( allWgIds );
+    User::LeaveIfError( iResources.WsSession().WindowGroupList( 0, &allWgIds ) );
+    TTsEntryKey key;
+    User::LeaveIfError(TsEntryKeyGeneraror::Generate(key, aWgId, allWgIds.Array()));
+    CleanupStack::PopAndDestroy( &allWgIds );
+    return key;
+    }
+
+// --------------------------------------------------------------------------
+/**
+ * Hides entrie if exist on mHiddenUids
+ * @param   entry
+ */
+void CTsDataList::HideEntryIfNotAllowed( CTsEntry* aEntry )
+    {
+    if( iHiddenUids.Find( aEntry->AppUid() ) >= 0 )
+        {
+        aEntry->SetVisibility(Invisible);
+        }
+    }
+
+void CTsDataList::RebuildVisibleDataListL()
+    {
+    iVisibleData.Reset();
+    RArray<TInt> visibleItems(iData.Count() ? iData.Count() : 1);
+    CleanupClosePushL(visibleItems);
+    for( TInt iter = 0; iter < iData.Count(); ++iter )
+        {
+        if( Visible == iData[iter]->GetVisibility() )
+            {
+            visibleItems.AppendL(iter);
+            }
+        }
+    for( TInt iter = 0; iter < visibleItems.Count(); ++iter ) 
+        {
+        iVisibleData.AppendL( iData[visibleItems[iter]] );
+        }
+    CleanupStack::PopAndDestroy(&visibleItems);
+    }
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/server/src/tsdataobservertask.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,67 @@
+/*
+* 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 "tsdataobservertask.h"
+#include "tstaskmonitorglobals.h"
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CTsDataObserverTask::CTsDataObserverTask( MTsDataObserverStorage& aStorage, 
+                                          const RMessage2& aMsg )
+:
+    iStorage( aStorage ),
+    iMsg( aMsg )
+    {
+    // No implementation required
+    }
+
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CTsDataObserverTask::~CTsDataObserverTask()
+    {
+    if( EFalse == iMsg.IsNull() )
+        {
+        iMsg.Complete( iDataChanged ? KErrNone : KErrCancel );
+        }
+    }
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CTsDataObserverTask::ExecuteLD( MTsDataObserverStorage& aStorage,
+                                     const RMessage2& aMsg )
+    {
+    CTsDataObserver *self = new (ELeave)CTsDataObserverTask( aStorage, aMsg );
+    CleanupStack::PushL( self );
+    aStorage.PushL( self );
+    CleanupStack::Pop( self );
+    }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CTsDataObserverTask::DataChanged()
+    {
+    iDataChanged = ETrue;
+    iStorage.Pop( this );
+    delete this; 
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/server/src/tsdataprovidertask.cpp	Mon Sep 13 13:26:33 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:
+*
+*/
+#include "tsdataprovidertask.h"
+#include "tstaskmonitorglobals.h"
+
+// -----------------------------------------------------------------------------
+/**
+ * Task handle data reqest. Function analyse reqest parameters and generate valid response.
+ * @param aProvider - serialized data provider
+ * @param aMsg - request message
+ */
+void TsDataProviderTask::ExecuteL( const MTsDataProvider& aProvider, 
+                                   const RMessage2& aMsg )
+    {
+    switch( aMsg.Function() ) 
+        {
+    case GetRunningAppInfo:
+        aMsg.WriteL( KRequestDataSizeOffset, 
+                     TPckgBuf<TInt>( aProvider.Data().Length() ) );
+        aMsg.Complete( KErrNone );
+        break;
+    
+    case FlushData:
+        if ( aProvider.Data().Length() > aMsg.GetDesMaxLengthL(KRequestDataBufferOffset) )
+            {
+            User::Leave( KErrCorrupt );
+            }
+        aMsg.WriteL( KRequestDataBufferOffset, aProvider.Data() );
+        aMsg.Complete( KErrNone );
+        break;
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/server/src/tsdatatask.cpp	Mon Sep 13 13:26:33 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:
+*
+*/
+#include "tsdatatask.h"
+#include <s32mem.h>
+// -----------------------------------------------------------------------------
+void TsDataTask::ExecuteL(const TArray<MTsDataStorage*>& dataStorages, const RMessage2& msg)
+    {
+    TInt responseCode(KErrNotSupported);
+    for( TInt iter(0); iter < dataStorages.Count() && KErrNone != responseCode; ++iter )
+        {
+        if(dataStorages[iter]->IsSupported( msg.Function() ) ) 
+            {
+            HBufC8 *data = HBufC8::NewLC(msg.GetDesLength(0));
+            TPtr8 des(data->Des());
+            msg.ReadL(0, des);
+            RDesReadStream dataStream(*data);
+            CleanupClosePushL(dataStream);
+            dataStorages[iter]->HandleDataL(msg.Function(), dataStream);
+            CleanupStack::PopAndDestroy(&dataStream);
+            CleanupStack::PopAndDestroy(data);
+            responseCode = KErrNone;
+            }
+        }
+    User::LeaveIfError(responseCode);
+    msg.Complete(responseCode);
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/server/src/tsmodel.cpp	Mon Sep 13 13:26:33 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:
+*
+*/
+#include "tsmodel.h"
+
+// -----------------------------------------------------------------------------
+/**
+ * Create shallow copy of model item
+ * @param aOffset - index of requested item
+ * @return reference to item
+ */
+TTsModelItem MTsModel::ItemL( TInt aOffset ) const
+{
+    if( Count() <= aOffset )
+        {
+        User::Leave(KErrOverflow);
+        }
+    return TTsModelItem( *this, aOffset );
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/server/src/tsmodelitem.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,179 @@
+/*
+* 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 "tsmodel.h"
+// -----------------------------------------------------------------------------
+/**
+ * Constructor
+ * @param aModel - data owner
+ * @param aOffset - data index
+ */
+TTsModelItem::TTsModelItem( const MTsModel& aModel, TInt aOffset )
+:
+iModel( aModel ),
+iIndex( aOffset )
+
+    {
+    //No implementation required
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Copy constructor
+ * @param aItem - template item
+ */
+TTsModelItem::TTsModelItem( const TTsModelItem& aItem )
+:
+iModel( aItem.iModel ),
+iIndex( aItem.iIndex )
+    {
+    //No implementation required
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Validate item instance and retrieve display name data
+ * @return item display name
+ */
+const TDesC& TTsModelItem::DisplayNameL() const
+    {
+    ValidateL();
+    return iModel.DisplayNameL( iIndex );
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Validate item instance and retrieve icon handle ( CFbsBitmap handle )
+ * @return item icon handle
+ */
+TInt TTsModelItem::IconHandleL() const
+    {
+    ValidateL();
+    return iModel.IconHandleL( iIndex );
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Validate item instance and retrieve entry key
+ * @return item key
+ */
+TTsModelItemKey TTsModelItem::KeyL() const
+    {
+    ValidateL();
+    return iModel.KeyL( iIndex );
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Validate item instance and retrieve entry timestamp
+ * @return item timestamp
+ */
+TTime TTsModelItem::TimestampL() const
+    {
+    ValidateL();
+    return iModel.TimestampL( iIndex );
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Validate item instance and retrieve timestamp
+ * with latest update time
+ * @return item timestamp
+ */
+TTime TTsModelItem::TimestampUpdateL() const 
+{
+    ValidateL();
+    return iModel.TimestampUpdateL(iIndex);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Validate item instance and retrieve activity status 
+ * @return activity status
+ */
+TBool TTsModelItem::IsActiveL() const
+    {
+    ValidateL();
+    return iModel.IsActiveL( iIndex );
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Validate item instance and retrieve closable status 
+ * @return closable status
+ */
+TBool TTsModelItem::IsClosableL() const
+    {
+    ValidateL();
+    return iModel.IsClosableL( iIndex );
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Validate item instance and forward close request to its owner 
+ * @return EFalse on failure
+ */
+TBool TTsModelItem::CloseL() const
+    {
+    ValidateL();
+    return iModel.CloseL( KeyL() );
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Validate item instance and forward launch request to its owner 
+ * @return EFalse on failure
+ */
+TBool TTsModelItem::LaunchL() const
+    {
+    ValidateL();
+    return iModel.LaunchL( KeyL() );
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Validate item instance 
+ */
+void TTsModelItem::ValidateL() const
+    {
+    if(iModel.Count() <= iIndex )
+        {
+        User::Leave( KErrOverflow );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Serialize item into destination stream
+ * @param aStream - output stream 
+ */
+
+void TTsModelItem::ExternalizeL( RWriteStream& aStream ) const
+    {
+    aStream.WriteInt32L( DisplayNameL().Length() );
+    if( 0 < DisplayNameL().Length() )
+        {
+        aStream << DisplayNameL();
+        }
+    TPckgBuf<TTime> timestamp(TimestampUpdateL()); 
+    aStream.WriteL(timestamp);
+    aStream.WriteInt32L( IconHandleL() );
+    aStream.WriteInt32L( TTsModelItemKey::Size() );
+    aStream << KeyL();
+    aStream.WriteInt32L( IsActiveL() );
+    aStream.WriteInt32L( IsClosableL() );
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/server/src/tsmodelitemkey.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,119 @@
+/*
+* 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 "tsmodelitemkey.h"
+// -----------------------------------------------------------------------------
+/**
+ * @return amount of memory ( number of bytes ) required to store key.
+ */
+TInt TTsModelItemKey::Size()
+    {
+    return sizeof( TInt ) * 2;
+    }
+// -----------------------------------------------------------------------------
+/**
+ * Default constructor. Key members are initialized with 0
+ */
+TTsModelItemKey::TTsModelItemKey()
+:
+    iKey( 0 ),
+    iRoot( 0 )
+    {
+    //No implementation required
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Constructor. Initialize members with provided values.
+ * @param aKey - key value
+ * @param aRoot - root value
+ */
+TTsModelItemKey::TTsModelItemKey( TTsKey aKey, TInt aRoot )
+:
+    iKey( aKey ),
+    iRoot( aRoot )
+    {
+    //No implementation required
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Copy constructor
+ * @param aKey - key value that need to be duplicated
+ */
+TTsModelItemKey::TTsModelItemKey( const TTsModelItemKey& aKey )
+:
+    iKey( aKey.iKey ),
+    iRoot( aKey.iRoot )
+    {
+    //No implementation required
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Assignment operator. Initialize members with new values
+ * @param aKey - key value that need to be duplicated
+ * @return reference to key instance
+ */
+TTsModelItemKey& TTsModelItemKey::operator =( const TTsModelItemKey& aKey )
+    {
+    iKey = aKey.iKey;
+    iRoot = aKey.iRoot;
+    return (*this);
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Comparison operator
+ * @param aKey - compared value
+ * @return EFalse if values are not equal, other value if they match
+ */
+TBool TTsModelItemKey::operator == ( const TTsModelItemKey aKey ) const
+    {
+    return ( iKey == aKey.iKey && iRoot == aKey.iRoot );
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Enable access to key value
+ * @return key value
+ */
+TInt TTsModelItemKey::Key() const
+    {
+    return iKey;
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Serialize key into data stream
+ * @param aStream - destination binary stream
+ */
+void TTsModelItemKey::ExternalizeL( RWriteStream& aStream ) const
+    {
+    aStream.WriteInt32L( iKey );
+    aStream.WriteInt32L( iRoot );
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Deserialize key from data stream
+ * @param aStream - source binary stream
+ */
+void TTsModelItemKey::InternalizeL( RReadStream& aStream )
+    {
+    iKey = aStream.ReadInt32L();
+    iRoot = aStream.ReadInt32L();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/server/src/tsmodelitemkeymsg.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Task list entry
+*
+*/
+#include <s32mem.h>
+#include "tsmodelitemkeymsg.h"
+
+// -----------------------------------------------------------------------------
+CTsModelItemKeyMsg* CTsModelItemKeyMsg::NewLC( RReadStream& aStream )
+    {
+    CTsModelItemKeyMsg* self = new (ELeave)CTsModelItemKeyMsg();
+    CleanupStack::PushL( self );
+    self->ConstructL( aStream );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+CTsModelItemKeyMsg::~CTsModelItemKeyMsg()
+    {
+    //No implementation required
+    }
+
+// -----------------------------------------------------------------------------
+TTsModelItemKey CTsModelItemKeyMsg::Key() const
+{
+    return iKey;
+}
+
+// -----------------------------------------------------------------------------
+void CTsModelItemKeyMsg::InternalizeL( RReadStream& aStream )
+    {
+    aStream >> iKey;
+    }
+
+// -----------------------------------------------------------------------------
+CTsModelItemKeyMsg::CTsModelItemKeyMsg()
+    {
+    //No implementation required
+    }
+
+// -----------------------------------------------------------------------------
+void CTsModelItemKeyMsg::ConstructL( RReadStream& aStream )
+{
+    aStream >> ( *this );
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/server/src/tsrunningappmodel.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,170 @@
+/*
+* 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 "tsrunningappmodel.h"
+
+#include <AknDef.h>
+#include <apgwgnam.h>
+#include <apgtask.h>
+
+#include "tsdatalist.h"
+#include "tsmodelobserver.h"
+#include "tsscreenshotprovider.h"
+
+CTsRunningAppModel *CTsRunningAppModel::NewL( MTsResourceManager& aResources, 
+                                              MTsWindowGroupsMonitor& aMonitor )
+    {
+    CTsRunningAppModel *self = CTsRunningAppModel::NewLC( aResources, aMonitor );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+CTsRunningAppModel *CTsRunningAppModel::NewLC( MTsResourceManager& aResources, 
+                                               MTsWindowGroupsMonitor& aMonitor )
+    {
+    CTsRunningAppModel *self = new (ELeave) CTsRunningAppModel( aResources );
+    CleanupStack::PushL( self );
+    self->ConstructL( aResources, aMonitor );
+    return self;
+    }
+
+CTsRunningAppModel::~CTsRunningAppModel()
+    {
+    delete iDataList;
+    delete iScreenshotProvider;
+    }
+    
+CTsRunningAppModel::CTsRunningAppModel( MTsResourceManager& aResources ) 
+: 
+    iResources( aResources )
+    {
+    }
+
+void CTsRunningAppModel::ConstructL( MTsResourceManager& aResources, 
+                                     MTsWindowGroupsMonitor& aMonitor )
+    {
+    iDataList = CTsDataList::NewL( aResources, aMonitor, *this );
+    iScreenshotProvider = CTsScreenshotProvider::NewL( *iDataList );
+
+    RArray<RWsSession::TWindowGroupChainInfo> wgList;
+    CleanupClosePushL( wgList );
+    User::LeaveIfError( aResources.WsSession().WindowGroupList( 0, &wgList ) );
+    iDataList->HandleWindowGroupChanged( aResources, wgList.Array() );
+    CleanupStack::PopAndDestroy( &wgList );
+    }
+
+// --------------------------------------------------------------------------
+// MHsDataObserver interface implementation
+// --------------------------------------------------------------------------
+//
+void CTsRunningAppModel::DataChanged()
+    {
+    if (iObserver)
+        {
+        iObserver->DataChanged( *this );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// MTsTaskSettings interface implementation
+// --------------------------------------------------------------------------
+//
+TBool CTsRunningAppModel::IsSupported( TInt aFunction ) const
+    {
+    return iDataList->IsSupported( aFunction );
+    }
+
+void CTsRunningAppModel::HandleDataL( TInt aFunction, RReadStream& aDataStream )
+    {
+    iDataList->HandleDataL( aFunction, aDataStream );
+    }
+
+// --------------------------------------------------------------------------
+// MTsModel interface implementation
+// --------------------------------------------------------------------------
+//
+TInt CTsRunningAppModel::Count() const
+    {
+    return iDataList->Data().Count();
+    }
+
+void CTsRunningAppModel::SetObserver( MTsModelObserver* aObserver )
+    {
+    iObserver = aObserver;
+    }
+
+const TDesC& CTsRunningAppModel::DisplayNameL( TInt aOffset ) const
+    {
+    return iDataList->Data()[aOffset]->AppName();
+    }
+
+TInt CTsRunningAppModel::IconHandleL( TInt aOffset ) const
+    {
+    CFbsBitmap *bitmap = iDataList->Data()[aOffset]->Screenshot();
+    if( !bitmap )
+        {
+        bitmap = iDataList->Data()[aOffset]->AppIconBitmap();
+        }
+    return bitmap ? bitmap->Handle() : KErrNotFound;
+    }
+
+TTime CTsRunningAppModel::TimestampL( TInt aOffset ) const
+    {
+    return iDataList->Data()[aOffset]->Timestamp();
+    }
+
+TTime CTsRunningAppModel::TimestampUpdateL(TInt offset) const
+{
+    return iDataList->Data()[offset]->LastUpdateTimestamp();
+}
+
+TTsModelItemKey CTsRunningAppModel::KeyL( TInt aOffset ) const
+    {
+    return TTsModelItemKey(iDataList->Data()[aOffset]->Key().WindowGroupId(), 
+                           reinterpret_cast<TInt>(this));
+    }
+
+TBool CTsRunningAppModel::IsActiveL( TInt /*aOffset*/ ) const
+    {
+    return ETrue;
+    }
+
+TBool CTsRunningAppModel::IsClosableL( TInt aOffset ) const
+    {
+    return iDataList->Data()[aOffset]->CloseableApp();
+    }
+
+TBool CTsRunningAppModel::CloseL( TTsModelItemKey aKey ) const
+    {
+    TApaTask task( iResources.WsSession() );
+    task.SetWgId( aKey.Key() );
+    task.EndTask();
+    return ETrue;
+    }
+
+TBool CTsRunningAppModel::LaunchL( TTsModelItemKey aKey ) const 
+    {
+    // find uid by wgid from key
+    CApaWindowGroupName *windowGroupName = 
+        CApaWindowGroupName::NewLC( iResources.WsSession(), aKey.Key() );
+    TUid uid = windowGroupName->AppUid();
+    CleanupStack::PopAndDestroy( windowGroupName );
+
+    TApaTask task = TApaTaskList( iResources.WsSession() ).FindApp( uid );
+    task.BringToForeground();
+    return task.Exists();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/server/src/tsrunningappserver.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,143 @@
+/*
+* 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 <tswindowgroupsobserver.h>
+#include "tstaskmonitorglobals.h"
+#include "tsrunningappserver.h"
+#include "tsrunningappsession.h"
+#include "tsbacksteppingactivation.h"
+
+#include "tsmodel.h"
+#include "tsstorage.h"
+#include "tsservicesprovider.h"
+#include "tsserializeddataprovider.h"
+#include "tsrunningappmodel.h"
+
+// -----------------------------------------------------------------------------
+/**
+ * Constructor for performing 1st stage construction
+ */
+CTsRunningAppServer::CTsRunningAppServer()
+:
+CServer2(EPriorityStandard)
+    {
+    // No implementation required
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Destructor.
+ */
+CTsRunningAppServer::~CTsRunningAppServer()
+    {
+    delete iBacksteppingEngine;
+    delete iStorage;
+    delete iAppsModel;
+    delete iServiceProvider;
+    delete iSerializer;
+    delete iMonitor;
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Two-phased constructor.
+ */
+CTsRunningAppServer* CTsRunningAppServer::NewLC()
+    {
+    CTsRunningAppServer* self = new (ELeave) CTsRunningAppServer();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Default constructor for performing 2nd stage construction
+ */
+void CTsRunningAppServer::ConstructL()
+    {
+    StartL(KRunningAppServerName);
+    iResources = CTsResourceManager::NewL();
+    iMonitor = CTsWindowGroupsMonitor::NewL(*iResources);
+    
+    iSerializer = CTsSerializedDataProvider::NewL(*this);
+    
+    RPointerArray<MTsModel> providers;
+    CleanupClosePushL(providers);
+    
+    iAppsModel = CTsRunningAppModel::NewL(*iResources, *iMonitor);
+    providers.AppendL(iAppsModel);
+    
+    CTsServiceProviderConfig *cfg = CTsServiceProviderConfig::NewLC();
+    iServiceProvider = CTsServiceProvider::NewL(*cfg);
+    CleanupStack::PopAndDestroy(cfg);
+    addProviders(providers, *iServiceProvider);
+
+    iStorage = CTsStorage::NewL(providers.Array());
+    iStorage->SetObserver(iSerializer);
+    CleanupStack::PopAndDestroy(&providers);
+
+    // load initial data
+    iStorage->DataChanged();
+
+    TRAP_IGNORE(iBacksteppingEngine = CTsBacksteppingActivation::NewL(*iMonitor);)
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see CServer2::NewSessionL(const TVersion&, const RMessage2&)
+ */
+CSession2* CTsRunningAppServer::NewSessionL( const TVersion & /*aVersion*/, 
+                                             const RMessage2& /*aMsg*/) const
+    {
+    RPointerArray<MTsDataStorage> dataStorages;
+    CleanupClosePushL(dataStorages);
+    dataStorages.AppendL(const_cast<CTsRunningAppServer *>(this)->iAppsModel);
+    dataStorages.AppendL(const_cast<CTsRunningAppServer *>(this)->iStorage);
+    CSession2* retVal = 
+        CTsRunningAppSession::NewL( *const_cast<CTsRunningAppServer *>(this)->iSerializer,
+                                    dataStorages.Array());
+    CleanupStack::PopAndDestroy(&dataStorages);
+    return retVal;
+    }
+
+// -----------------------------------------------------------------------------
+void CTsRunningAppServer::DataChanged()
+    {
+    TAny* currentObserver(0);
+    TDblQueIter<CSession2> currentItem(iSessionIter);
+    currentItem.SetToFirst();
+    do
+        {
+        currentObserver = currentItem++;
+        if(currentObserver)
+            {
+            static_cast<CTsRunningAppSession*>(currentObserver)->DataChanged();
+            }
+        }
+    while(0 != currentObserver);
+    }
+
+// -----------------------------------------------------------------------------
+void CTsRunningAppServer::addProviders( RPointerArray<MTsModel> &dst, 
+                                        const CTsServiceProvider& serviceProvider)
+    {
+    for ( TInt offset(0); offset < serviceProvider.Count(); ++offset )
+        {
+        dst.Append(&serviceProvider[offset]);
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/server/src/tsrunningappsession.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,159 @@
+/*
+* 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 "tsrunningappsession.h"
+#include "tstaskmonitorglobals.h"
+
+#include "tsdataobservertask.h"
+#include "tsdataprovidertask.h"
+#include "tsdatatask.h"
+
+_LIT(KErrObserverExists, "Observer already exists");
+// -----------------------------------------------------------------------------
+/**
+ * Constructor for performing 1st stage construction
+ */
+CTsRunningAppSession::CTsRunningAppSession( 
+                                    const MTsDataProvider& aDataProvider )
+:
+    iDataProvider(aDataProvider)
+    {
+    // No implementation required
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Destructor.
+ */
+CTsRunningAppSession::~CTsRunningAppSession()
+    {
+    iDataStorages.Close();
+    iObservers.ResetAndDestroy();
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Two-phased constructor.
+ * @param aObserverStorage - observers storage
+ * @param aDataProvider - serialized data provider
+ * @param aDataStorages - data storages
+ */
+CTsRunningAppSession* CTsRunningAppSession::NewL(
+                                  const MTsDataProvider& aDataProvider,
+                                  const TArray<MTsDataStorage*> &aDataStorages )
+    {
+    CTsRunningAppSession* self = 
+        new (ELeave) CTsRunningAppSession( aDataProvider );
+    CleanupStack::PushL( self );
+    self->ConstructL( aDataStorages );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+/**
+* EPOC default constructor for performing 2nd stage construction
+*/
+void CTsRunningAppSession::ConstructL(
+                                 const TArray<MTsDataStorage*> &aDataStorages )
+    {
+    for( TInt iter(0); iter < aDataStorages.Count(); ++iter )
+        {
+        iDataStorages.AppendL( aDataStorages[iter] );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Implements interface
+ * @see void CSession2::ServiceL(const RMessage2&)
+ */
+void CTsRunningAppSession::ServiceL(const RMessage2& aMessage)
+    {
+    switch ( aMessage.Function() )
+        {
+        case SubscribeRunningAppChanges:
+            CTsDataObserverTask::ExecuteLD( *this, aMessage );
+            break;
+        
+        case CancelSubscribeRunningAppChanges:
+            iObservers.ResetAndDestroy();
+            aMessage.Complete(KErrNone);
+            break;
+        
+        case GetRunningAppInfo:
+        case FlushData:
+            TsDataProviderTask::ExecuteL( iDataProvider, aMessage );
+            break;
+        
+        case RegisterScreenshotMessage:
+        case UnregisterScreenshotMessage:
+        case VisibilityChange:
+        case OpenTaskMessage:
+        case CloseTaskMessage:
+            TsDataTask::ExecuteL( iDataStorages.Array(), aMessage );
+            break;
+        
+        default:
+            aMessage.Complete(CServer2::EBadMessageNumber);
+        }
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Implements interface
+ * @see void MTsDataObserver::DataChanged()
+ */
+void CTsRunningAppSession::DataChanged()
+    {
+    TInt iter(iObservers.Count()-1);
+    iMissedDataUpdate = ( iter < 0 );
+    for( ; iter >= 0; --iter )
+        {
+        iObservers[iter]->DataChanged();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Implements interface
+ * @see void MTsDataObserverStorage::PushL(CTsDataObserver*)
+ */
+void CTsRunningAppSession::PushL(CTsDataObserver* aObserver)
+    {
+    ( 0 <= iObservers.Find( aObserver ) ) ?
+            User::Panic( KErrObserverExists, KErrAlreadyExists ) :
+            iObservers.AppendL( aObserver );
+    if( iMissedDataUpdate )
+        {
+        aObserver->DataChanged();
+        iMissedDataUpdate = EFalse;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Implements interface
+ * @see void MTsDataObserverStorage::Pop(CTsDataObserver*)
+ */
+void CTsRunningAppSession::Pop(CTsDataObserver* aObserver)
+    {
+    const TInt offset( iObservers.Find( aObserver ) );
+    if( 0 <= offset )
+        {
+        iObservers.Remove(offset);
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/server/src/tsscreenshotprovider.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,109 @@
+/*
+* 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 "tsscreenshotprovider.h"
+#include "tstaskmonitorglobals.h"
+#include "tsscreenshotmsg.h"
+
+
+const TUid KPluginUID = {0x200267AE};
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CTsScreenshotProvider* CTsScreenshotProvider::NewL( MTsDataStorage& aStorage )
+    {
+    CTsScreenshotProvider *self = new (ELeave)CTsScreenshotProvider( aStorage );
+    CleanupStack::PushL( self );
+    self->BaseConstructL(KPluginUID, KNullDesC8);
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CTsScreenshotProvider::CTsScreenshotProvider( MTsDataStorage& aStorage )
+:
+    iStorage(aStorage)
+    {
+    //No implementation required
+    }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CTsScreenshotProvider::HandleMessage( const TDesC8& aMsg )
+    {
+    TRAP_IGNORE( HandleMessageL( aMsg ) );
+    }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CTsScreenshotProvider::HandleMessageL( const TDesC8& aMsg )
+    {
+    RDesReadStream msgStream( aMsg );
+    CleanupClosePushL( msgStream );
+    switch ( msgStream.ReadInt32L() ) 
+        {
+        case RegisterScreenshotMessage:
+            {
+            //parse msg to ACK provider ASAP and be sure that bitmap still exists
+            CTsScreenshotMsg* screenshotMsg = CTsScreenshotMsg::NewLC(msgStream); 
+            SendMessage(aMsg);
+            
+            //reset stream
+            msgStream.Close();
+            msgStream.Open(aMsg);
+            
+            //forward stream to storage
+            iStorage.HandleDataL(msgStream.ReadInt32L(), msgStream);
+            
+            CleanupStack::PopAndDestroy(screenshotMsg);            
+            break;
+            }
+            
+        case WindowGroupToBackgroundMessage:
+            {
+            //reset stream
+            msgStream.Close();
+            msgStream.Open(aMsg);
+            
+            //forward stream to storage
+            iStorage.HandleDataL(msgStream.ReadInt32L(), msgStream);
+            break;
+            }
+            
+        default: User::Leave(KErrNotSupported);        
+        }
+
+    CleanupStack::PopAndDestroy(&msgStream);
+    }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CTsScreenshotProvider::OnReplace()
+    {
+    //No implementation required
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/server/src/tsserializeddataprovider.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,117 @@
+/*
+* 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 "tsserializeddataprovider.h"
+#include "tsmodel.h"
+// -----------------------------------------------------------------------------
+/**
+ * Leaving constructor. 
+ * @param observer - data observer
+ */
+CTsSerializedDataProvider* CTsSerializedDataProvider::NewL(MTsDataObserver &observer)
+{
+    return new (ELeave) CTsSerializedDataProvider(observer);
+    
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Constructor
+ * @param observer - data observer
+ */
+CTsSerializedDataProvider::CTsSerializedDataProvider(MTsDataObserver& observer)
+:
+    iObserver(observer)
+{}
+
+// -----------------------------------------------------------------------------
+/**
+ * Destructor
+ */
+CTsSerializedDataProvider::~CTsSerializedDataProvider()
+{
+    iData.Close();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation.
+ * @see MTsDataProvider::Data()
+ */
+const TDesC8& CTsSerializedDataProvider::Data() const
+{
+    return iData;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation.
+ * @see MTsModelObserver::dataChanged(MTsModel &)
+ */
+void CTsSerializedDataProvider::DataChanged(MTsModel &model)
+{
+    serializeModel(model);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Serialize source model into internal data storage
+ * @param src - model
+ */
+void CTsSerializedDataProvider::serializeModel(const MTsModel &src)
+{
+    TRAPD(errNo, serializeModelL(src));
+    if(KErrNone == errNo ) {
+        iObserver.DataChanged();
+    }
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Serialize source model into internal data storage. Function can leave.
+ * @param src - source model
+ */
+void CTsSerializedDataProvider::serializeModelL(const MTsModel &src)
+{
+    const TInt KExpandSize = 256;
+    CBufFlat* buf = CBufFlat::NewL(KExpandSize);
+    CleanupStack::PushL(buf);
+    RBufWriteStream stream(*buf); 
+    CleanupClosePushL(stream);
+    
+    serializeModelL(stream, src);
+    
+    CleanupStack::PopAndDestroy(&stream);
+    iData.Close();
+    iData.CreateL(buf->Size());
+    buf->Read(0, iData, buf->Size());
+    CleanupStack::PopAndDestroy(buf);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Serialize source model into destination stream. Function can leave.
+ * @param dst - destination stream
+ * @param src - source model
+ */
+void CTsSerializedDataProvider::serializeModelL(RWriteStream& dst, const MTsModel &src)
+{
+    dst.WriteInt32L( src.Count() );
+    for (TInt iter(0); iter < src.Count(); ++iter) {
+        dst << src.ItemL( iter );
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/server/src/tsservice.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,195 @@
+/*
+* 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 <QObject>
+#include <QDateTime>
+#include <QVariantHash>
+
+#include <xqconversions.h>
+
+#include "tsservice.h"
+#include "tsmodelobserver.h"
+#include "tsserviceobserver.h"
+
+// -----------------------------------------------------------------------------
+LOCAL_C QVariantHash valueL( QObject *aModel, TInt aOffset )
+    {
+    QList<QVariantHash> items;
+    QMetaObject::invokeMethod( aModel, 
+                               "taskList", 
+                               Q_RETURN_ARG(QList<QVariantHash>, 
+                               items ) );
+    if( aOffset >= items.count() ) 
+        {
+        User::Leave(KErrCorrupt);
+        }
+    return items.at(aOffset);
+    }
+
+// -----------------------------------------------------------------------------
+CTsService* CTsService::NewLC(QObject* model)
+    {
+    CTsService *self = new (ELeave)CTsService();
+    CleanupStack::PushL(self);
+    self->ConstructL(model);
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+CTsService::CTsService()
+    {
+    //No implementation required
+    }
+
+// -----------------------------------------------------------------------------
+void CTsService::ConstructL( QObject* model )
+    {
+    iModel = model;
+    User::LeaveIfNull(iModel);
+    // @todo: add checking for all necessary methods
+    
+    iServiceObserver = new TsServiceObserver(*this);
+    User::LeaveIfNull(iServiceObserver);
+    QObject::connect(iModel, 
+                     SIGNAL(dataChanged()),
+                     iServiceObserver,
+                     SLOT(dataChanged()));
+    }
+
+// -----------------------------------------------------------------------------
+CTsService::~CTsService()
+    {
+    delete iModel;
+    delete iServiceObserver;
+    delete iBuffer;
+    }
+
+// -----------------------------------------------------------------------------
+void CTsService::DataChanged()
+    {
+    if(0 != iModelObserver) 
+        {
+        iModelObserver->DataChanged(*this);
+        }
+    }
+// -----------------------------------------------------------------------------
+TInt CTsService::Count() const
+    {
+    QList<QVariantHash> items;
+    QMetaObject::invokeMethod(iModel, 
+                              "taskList", 
+                              Q_RETURN_ARG(QList<QVariantHash>, items));
+    return items.count();
+    }
+
+// -----------------------------------------------------------------------------
+void CTsService::SetObserver( MTsModelObserver *aObserver )
+    {
+    iModelObserver = aObserver;
+    }
+
+// -----------------------------------------------------------------------------
+const TDesC& CTsService::DisplayNameL( TInt aOffset ) const
+    {
+    return StringValueL( aOffset, "TaskName" );
+    }
+
+// -----------------------------------------------------------------------------
+TInt CTsService::IconHandleL( TInt aOffset ) const
+    {
+    return IntValueL( aOffset, "TaskScreenshot" );
+    }
+
+// -----------------------------------------------------------------------------
+TTime CTsService::TimestampL( TInt aOffset ) const
+    {
+    return TimeValueL( aOffset, "TaskTimestamp" );
+    }
+
+// -----------------------------------------------------------------------------
+TTime CTsService::TimestampUpdateL(TInt offset) const
+{
+    return TimeValueL(offset, "TaskUpdateTimestamp");
+}
+
+TTsModelItemKey CTsService::KeyL( TInt aOffset ) const
+    {
+    return TTsModelItemKey( IntValueL( aOffset, "TaskId" ), 
+                            reinterpret_cast<TInt>( this ) );
+    }
+
+// -----------------------------------------------------------------------------
+TBool CTsService::IsActiveL( TInt aOffset ) const
+    {
+    return IntValueL( aOffset, "TaskIsRunning" );
+    }
+
+// -----------------------------------------------------------------------------
+TBool CTsService::IsClosableL( TInt aOffset ) const
+    {
+    return IntValueL( aOffset, "TaskCanBeClosed" );
+    }
+
+// -----------------------------------------------------------------------------
+TBool CTsService::CloseL( TTsModelItemKey aKey ) const
+    {
+    bool result(false);
+    QMetaObject::invokeMethod( iModel, 
+                               "closeTask", 
+                               Q_RETURN_ARG(bool, result), 
+                               Q_ARG(QVariant, aKey.Key() ) );
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+TBool CTsService::LaunchL( TTsModelItemKey aKey ) const
+    {
+    bool result(false);
+    QMetaObject::invokeMethod( iModel, 
+                               "openTask", 
+                               Q_RETURN_ARG(bool, result), 
+                               Q_ARG(QVariant, aKey.Key() ) );
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+TInt CTsService::IntValueL( TInt aOffset, const char* aKey) const
+    {
+    return valueL(iModel, aOffset).value( aKey ).toInt();
+    }
+
+// -----------------------------------------------------------------------------
+TTime CTsService::TimeValueL(TInt aOffset, const char* aKey) const
+    {
+    // Conversion between TTime which counts from year 0, and QDateTime which uses unix epoch (1st Jan 1970)
+    QDateTime timestamp = valueL( iModel, aOffset ).value( aKey ).toDateTime();
+    
+    return TTime( _L( "19700000:" ) ) + TTimeIntervalSeconds( timestamp.toTime_t() ) +
+                         TTimeIntervalMicroSeconds( timestamp.time().msec() * 1000 );
+    }
+
+// -----------------------------------------------------------------------------
+const TDesC& CTsService::StringValueL( TInt aOffset, const char* aKey ) const
+    {
+    delete iBuffer;
+    const_cast<CTsService *>(this)->iBuffer = 0;
+    
+    const QVariantHash item(valueL(iModel, aOffset));
+    QT_TRYCATCH_LEAVING(
+    const_cast<CTsService *>(this)->iBuffer = 
+    XQConversions::qStringToS60Desc(item.value(aKey).toString()));
+    return *iBuffer;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/server/src/tsserviceobserver.cpp	Mon Sep 13 13:26:33 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 "tsserviceobserver.h"
+// -----------------------------------------------------------------------------
+TsServiceObserver::TsServiceObserver(MTsDataObserver& observer)
+:
+    mObserver(observer)
+{}
+
+// -----------------------------------------------------------------------------
+void TsServiceObserver::dataChanged()
+{
+    mObserver.DataChanged();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/server/src/tsservicesprovider.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,87 @@
+/*
+* 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 "tsservicesprovider.h"
+#include "tsservice.h"
+// -----------------------------------------------------------------------------
+/**
+ * Symbian two phase constructor. Create and initialize services provider instance
+ * @param aConfig - services provider configurator
+ * @return address to initialized services provider instance 
+ */
+CTsServiceProvider* CTsServiceProvider::NewL( 
+                                       const CTsServiceProviderConfig& aConfig )
+    {
+    CTsServiceProvider* self = new (ELeave)CTsServiceProvider();
+    self->Construct( aConfig );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Constructor
+ */
+CTsServiceProvider::CTsServiceProvider()
+    {
+    //No implementation required
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Function initialzie services provider. Using configurator load serivces
+ * @param aConfig - serivces provider configurator
+ * 
+ */
+void CTsServiceProvider::Construct( const CTsServiceProviderConfig& aConfig )
+    {
+    CTsService* srvPtr(0);
+    for( TInt iter(0); iter < aConfig.Count(); ++iter ) 
+        {
+        TRAP_IGNORE( srvPtr = CTsService::NewLC( aConfig.LoadL( iter ) );
+                     iServices.AppendL( srvPtr );
+                     CleanupStack::Pop( srvPtr ); )
+        }
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Destructor. Release allocated resouces
+ */
+CTsServiceProvider::~CTsServiceProvider()
+    {
+    iServices.ResetAndDestroy();
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Operator enable access to initialized service
+ * @param aOffset - index of requested service
+ * @return reference to MTsModel interface
+ */
+MTsModel& CTsServiceProvider::operator[](TInt aOffset) const
+    {
+    return *( iServices[ aOffset ] );
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * @return number of available services
+ */
+TInt CTsServiceProvider::Count() const
+    {
+    return iServices.Count();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/server/src/tsservicesproviderconfig.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,85 @@
+/*
+* 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 <xqconversions.h>
+#include <qservicemanager.h>
+#include "tsservicesproviderconfig.h"
+
+const char ServicesInterface [] = "com.nokia.qt.taskswitcher.dataprovider";
+// -----------------------------------------------------------------------------
+CTsServiceProviderConfig* CTsServiceProviderConfig::NewLC()
+    {
+    CTsServiceProviderConfig *self = new (ELeave)CTsServiceProviderConfig();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+CTsServiceProviderConfig::CTsServiceProviderConfig()
+{
+    //No implementation required
+}
+
+// -----------------------------------------------------------------------------
+void CTsServiceProviderConfig::ConstructL()
+    {
+    QTM_NAMESPACE::QServiceInterfaceDescriptor *ptr(0);
+    QT_TRYCATCH_LEAVING(
+       QTM_NAMESPACE::QServiceManager serviceManager;
+       const QList<QTM_NAMESPACE::QServiceInterfaceDescriptor> serivces(serviceManager.findInterfaces(QTM_NAMESPACE::QServiceFilter(ServicesInterface)));
+       foreach(QTM_NAMESPACE::QServiceInterfaceDescriptor serviceImplementation, serivces)
+           {
+           ptr = new QTM_NAMESPACE::QServiceInterfaceDescriptor(serviceImplementation);
+           if( 0 != ptr ) 
+               {
+               if( KErrNone != iServices.Append( ptr ) )
+                   {
+                   delete ptr;
+                   }
+               }
+           }
+       )
+    }
+
+// -----------------------------------------------------------------------------
+CTsServiceProviderConfig::~CTsServiceProviderConfig()
+    {
+    for( TInt iter(0); iter < iServices.Count(); ++iter )
+        {
+        delete static_cast<QTM_NAMESPACE::QServiceInterfaceDescriptor *>(iServices[iter]);
+        }
+    iServices.Close();
+    }
+
+// -----------------------------------------------------------------------------
+TInt CTsServiceProviderConfig::Count() const
+    {
+    return iServices.Count();
+    }
+
+// -----------------------------------------------------------------------------
+QObject* CTsServiceProviderConfig::LoadL(TInt aOffset)const
+    {
+    const QTM_NAMESPACE::QServiceInterfaceDescriptor *service
+        = static_cast<QTM_NAMESPACE::QServiceInterfaceDescriptor *>(iServices[aOffset]);
+    QObject *retVal(0);
+    QT_TRYCATCH_LEAVING(
+    QTM_NAMESPACE::QServiceManager serviceManager;
+    retVal = serviceManager.loadInterface(*service); )
+    User::LeaveIfNull( retVal );
+    return retVal;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/server/src/tsstorage.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,295 @@
+/*
+* 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 <tstaskmonitorglobals.h>
+#include "tsstorage.h"
+#include "tsmodelitemkeymsg.h"
+// -----------------------------------------------------------------------------
+/**
+ * Two phase construction. Create and initialize storage instance.
+ * @param aDataProviders - list of data providers
+ * @return storage instane
+ */
+CTsStorage* CTsStorage::NewL(const TArray<MTsModel*> &aDataProviders)
+    {
+    CTsStorage* self = new(ELeave) CTsStorage();
+    CleanupStack::PushL( self );
+    self->ConstructL( aDataProviders );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Destructor. Function cancel subscribtion for data change notyfications
+ */
+CTsStorage::~CTsStorage()
+    {
+    for( TInt iter(0); iter < iDataProviders.Count(); ++iter )
+        {
+        iDataProviders[iter]->SetObserver( 0 );
+        }
+    iData.Close();
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * First phase construction.
+ */
+CTsStorage::CTsStorage()
+    {
+    //No implementation required
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Second phase construction. Function make subscribtion for data changes notifications
+ * @param aDataProviders - list of data providers
+ */
+void CTsStorage::ConstructL( const TArray<MTsModel*> &aDataProviders )
+    {
+    for (TInt iter(0); iter < aDataProviders.Count(); ++iter)
+        {
+        iDataProviders.AppendL( aDataProviders[iter] );
+        aDataProviders[iter]->SetObserver( this );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see MTsDataObserver::DataChanged()
+ */
+void CTsStorage::DataChanged()
+    {
+    ResetModel();
+    }
+
+// -----------------------------------------------------------------------------
+TBool CTsStorage::IsSupported( TInt aFunction ) const
+    {
+    return ( OpenTaskMessage == aFunction || CloseTaskMessage == aFunction );
+    }
+
+// -----------------------------------------------------------------------------
+void CTsStorage::HandleDataL( TInt aFunction, RReadStream& aDataStream )
+    {
+    if( !IsSupported(aFunction) ) 
+        {
+        User::Leave( KErrCorrupt );
+        }
+    CTsModelItemKeyMsg* msg = CTsModelItemKeyMsg::NewLC( aDataStream );
+    OpenTaskMessage == aFunction ? LaunchL( msg->Key() ) : CloseL( msg->Key() );
+    CleanupStack::PopAndDestroy( msg );
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see MTsModelObserver::dataChanged(MTsModel &)
+ */
+void CTsStorage::DataChanged(MTsModel &/*model*/)
+    {
+    ResetModel();
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see MTsModel::count()
+ */
+TInt CTsStorage::Count() const
+    {
+    return iData.Count();
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see MTsModel::SetObserver(MTsModelObserver *)
+ */
+void CTsStorage::SetObserver( MTsModelObserver* aObserver ) 
+    {
+    iDataObserver = aObserver;
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see MTsModel::DisplayNameL(TInt)
+ */
+const TDesC& CTsStorage::DisplayNameL( TInt aOffset ) const 
+    {
+    return iData[aOffset].DisplayNameL();
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see MTsModel::IconHandleL(TInt)
+ */
+TInt CTsStorage::IconHandleL( TInt aOffset ) const 
+    {
+    return iData[aOffset].IconHandleL();
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see MTsModel::TimestampL(TInt)
+ */
+TTime CTsStorage::TimestampL( TInt aOffset ) const 
+    {
+    return iData[aOffset].TimestampL();
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see MTsModel::TimestampUpdateL(TInt)
+ */
+TTime CTsStorage::TimestampUpdateL( TInt offset ) const 
+{
+    return iData[offset].TimestampUpdateL();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see MTsModel::KeyL(TInt)
+ */
+TTsModelItemKey CTsStorage::KeyL( TInt aoffset ) const 
+    {
+    return iData[aoffset].KeyL();
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see MTsModel::IsActiveL(TInt)
+ */
+TBool CTsStorage::IsActiveL( TInt aOffset ) const 
+    {
+    return iData[aOffset].IsActiveL();
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see MTsModel::IsClosableL(TInt)
+ */
+TBool CTsStorage::IsClosableL( TInt aOffset ) const 
+    {
+    return iData[aOffset].IsClosableL();
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see MTsModel::CloseL(TTsModelItemKey)
+ */
+TBool CTsStorage::CloseL( TTsModelItemKey aKey ) const 
+    {
+    return FindL(aKey).CloseL();
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see MTsModel::launchL(TTsModelItemKey)
+ */
+TBool CTsStorage::LaunchL(TTsModelItemKey aKey) const 
+    {
+    return FindL(aKey).LaunchL(); 
+    }
+
+// -----------------------------------------------------------------------------
+TTsModelItem CTsStorage::FindL( TTsModelItemKey aKey ) const
+    {
+    for( TInt offset(0); offset < iData.Count(); ++offset ) 
+        {
+        if( iData[offset].KeyL() == aKey )
+            {
+            return iData[offset];
+            }
+        }
+    User::Leave(KErrNotFound);
+    return ItemL(0);//just avoid compilation warnings
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Retrieve shallow copy of data from known data providers and sort entries
+ */
+TInt CTsStorage::ResetModel()
+    {
+    TRAPD(errNo, ResetModelL());
+    return errNo;
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Retrieve shallow copy of data from known data providers and sort entries
+ */
+void CTsStorage::ResetModelL() 
+    {
+    iData.Reset();
+    for(TInt iter(0); iter < iDataProviders.Count(); ++iter )
+        {
+        PullDataL(*(iDataProviders[iter]));
+        }
+    ReorderDataL();
+    if (0 != iDataObserver)
+        {
+        iDataObserver->DataChanged(*this);
+        }
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Retrieve shallow copy of data from source model
+ * @param aSrc - source model 
+ */
+void CTsStorage::PullDataL( const MTsModel& aSrc )
+    {
+    for( TInt iter(0); iter < aSrc.Count(); ++iter )
+        {
+        iData.AppendL(aSrc.ItemL(iter));
+        }
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Sort internal data model 
+ */
+void CTsStorage::ReorderDataL()
+    {
+    for( TInt prev(0); prev < iData.Count(); ++prev ) 
+        {
+        for( TInt next(prev + 1); next < iData.Count(); ++next )
+            {
+            const TTsModelItem prevItem(iData[prev]), nextItem(iData[next]);
+            if( prevItem.TimestampL() < nextItem.TimestampL() )
+                {
+                iData.Remove(prev);
+                iData.InsertL(nextItem, prev);
+                
+                iData.Remove(next);
+                iData.InsertL(prevItem, next);
+                }
+            }
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/sis/stubs/createstubs.bat	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,17 @@
+@rem
+@rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+@rem All rights reserved.
+@rem This component and the accompanying materials are made available
+@rem under the terms of "Eclipse Public License v1.0"
+@rem which accompanies this distribution, and is available
+@rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+@rem
+@rem Initial Contributors:
+@rem Nokia Corporation - initial contribution.
+@rem
+@rem Contributors:
+@rem
+@rem Description: 
+@rem
+
+for %%f in (*.pkg) do makesis -s %%f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/sis/stubs/taskmonitor_stub.pkg	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,39 @@
+;
+; 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: 
+;
+; ------------------------------------------------------------------------------
+; Taskswitcher stub SIS package file.
+; Used to enable Taskswitcher to be updated from ROM with a SIS package.
+; When you add new files into this stub, please remember to update
+; SIS stub with "makesis -s" command.
+; ------------------------------------------------------------------------------
+;
+;Language - standard language definitions
+&EN
+
+; standard SIS file header
+#{"taskmonitor"},(0x200267B0),1,0,0,TYPE=SA
+
+;Localized Vendor Name
+%{"Nokia"}
+
+;Unique Vendor name
+:"Nokia"
+
+"" - "Z:\sys\bin\tstaskmonitorclient.dll"
+"" - "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 taskswitcher/sis/stubs/taskmonitor_stub.sis has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/sis/taskmonitor.pkg	Mon Sep 13 13:26:33 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: 
+;
+
+;Language - standard language definitions
+&EN
+
+; standard SIS file header
+#{"taskmonitor"},(0x200267B0),1,0,0,TYPE=SA, RU
+
+;Localized Vendor Name
+%{"Nokia"}
+
+;Unique Vendor name
+:"Nokia"
+
+
+"/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"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/taskswitcher.pro	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,30 @@
+#
+# 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
+
+CONFIG += ordered
+SUBDIRS += client
+symbian {
+    SUBDIRS += backstepping \
+               server \
+               screenshotplugin
+               
+    BLD_INF_RULES.prj_exports +=    "inc/tstaskmonitorglobals.h |../inc/tstaskmonitorglobals.h"
+    
+}
+
+symbian:include(rom.pri)
\ No newline at end of file
--- a/taskswitcher/testapplications/tstestpluginmanager/tspluginmanager/resource/tspluginmanager.qcrml	Wed Aug 18 10:39:24 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<repository target="RProperty" uidValue="0xE1f7fe4d">
-    <key int="0xE1f7fe4d" ref="/TaskSwitcherTest/PluginSet"/>
-</repository>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/utils/inc/tsdataobserver.h	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,39 @@
+/*
+* 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 MTsDataObserver {
+public:
+    virtual void DataChanged() =0;
+};
+
+class CTsDataObserver: public CBase,
+                       public MTsDataObserver
+{
+};
+
+class MTsDataObserverStorage
+{
+public:
+    virtual void PushL(CTsDataObserver*) =0;
+    virtual void Pop(CTsDataObserver*) =0;
+};
+
+#endif //DATAOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/utils/inc/tsentry.h	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,92 @@
+/*
+* 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 TSENTRY_H
+#define TSENTRY_H
+
+#include <e32base.h>
+#include <e32cmn.h>
+#include <tsgraphicfilescalinghandler.h>
+
+#include "tsentrykey.h"
+#include "tstaskmonitorglobals.h"
+
+class CTsEntry;
+class CFbsBitmap;
+class MTsDataObserver;
+
+typedef RPointerArray<CTsEntry> RTsFswArray;
+
+/**
+ * An entry in the task list.
+ */
+NONSHARABLE_CLASS( CTsEntry ) : public CBase,
+                                private MImageReadyCallBack
+{
+public:
+    static CTsEntry *NewL(const TTsEntryKey &key, MTsDataObserver &observer);
+    static CTsEntry *NewLC(const TTsEntryKey &key, MTsDataObserver &observer);
+    ~CTsEntry();
+
+public:
+    TUid AppUid() const;
+    const TDesC &AppName() const;
+    TBool CloseableApp() const;
+    Visibility GetVisibility() const;    
+    CFbsBitmap *AppIconBitmap() const;
+    CFbsBitmap *Screenshot() const;
+    const TTsEntryKey &Key() const;
+    TTime Timestamp() const;    
+    TTime LastUpdateTimestamp() const;
+    
+    void SetAppUid(const TUid &uid);
+    void SetAppNameL(const TDesC &appName);
+    void SetCloseableApp(TBool value);   
+    void SetVisibility(Visibility visibility);
+    void SetAppIcon(CFbsBitmap *aBitmap);
+    void SetScreenshotL(const CFbsBitmap &bitmap, UpdatePriority priority, TInt angle);
+    void RemoveScreenshotL();
+    void SetTimestamp(const TTime &timestamp);
+    void RefreshUpdateTimestamp();
+
+private:
+    CTsEntry(const TTsEntryKey &aKey, MTsDataObserver &observer);    
+    
+public: // from MImageReadyCallBack
+    void ImageReadyCallBack(TInt error, const CFbsBitmap *bitmap);
+
+private:
+    TUid mAppUid;
+    HBufC* mAppName;
+    TBool mCloseableApp;
+    Visibility mVisibility;
+    CFbsBitmap* mAppIconBitmap;
+    CFbsBitmap* mScreenshot;
+    TTsEntryKey mKey;
+    UpdatePriority mPriority;
+    TTime mTimestamp;
+    TTime mUpdateTimestamp;
+    
+private:     
+    CTsGraphicFileScalingHandler *mImgTool;
+
+private:    
+    MTsDataObserver &mObserver;
+    
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/utils/inc/tsentrykey.h	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,35 @@
+/*
+* 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 TTsEntryKey
+{
+public:
+    TTsEntryKey(TInt parentId =0);
+    TBool operator ==(const TTsEntryKey& key) const;
+    TInt WindowGroupId() const;
+
+private:
+    TInt mParentId;
+};
+
+#endif //TSENTRYKEY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/utils/inc/tsentrykeygenerator.h	Mon Sep 13 13:26:33 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 TInt Generate(TTsEntryKey& returnKey, TInt windowGroupId, 
+                                 const TArray<RWsSession::TWindowGroupChainInfo>& groupChain);
+};
+
+#endif //TSENTRYKEYGENERATOR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/utils/inc/tsresourcemanager.h	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description :
+ *
+ */
+#ifndef TSRESOURCEMANAGER_H
+#define TSRESOURCEMANAGER_H
+
+#include <e32base.h>
+#include <e32event.h>
+#include <w32std.h>
+#include <apgcli.h>
+
+/**
+ * Interface decalre methods to access initialized OS resources
+ */
+class MTsResourceManager
+{
+public:
+    /**
+     * Access to initialized window server session
+     */
+    virtual RWsSession& WsSession() =0;
+    
+    /**
+     * Access to initilaized APA session
+     */
+    virtual RApaLsSession& ApaSession() =0;
+};
+
+/**
+ * Resource manager implemetatioin
+ */
+class CTsResourceManager: public CBase,
+                          public MTsResourceManager
+{
+public:
+    /**
+     * Two phase constructor
+     */
+    static CTsResourceManager* NewL();
+    
+    /**
+     * Destructor
+     */
+    ~CTsResourceManager();
+    
+    /**
+     * @see MTsResourceManager::WsSession
+     */
+    RWsSession& WsSession();
+    
+    /**
+     * @see MTsResourceManager::ApaSession
+     */
+    RApaLsSession& ApaSession();
+
+private:
+    /**
+     * Second phase constructor
+     */
+    void ConstructL();
+
+private:
+   RWsSession mWsSession;
+   RApaLsSession mApaSeesion;
+};
+
+
+
+#endif // TSRESOURCEMANAGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/utils/inc/tsscreenshotmsg.h	Mon Sep 13 13:26:33 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
+*
+*/
+
+#ifndef TSSCREENSHOTMSG_H
+#define TSSCREENSHOTMSG_H
+#include <e32base.h>
+#include <s32strm.h>
+#include "tstaskmonitorglobals.h"
+class CFbsBitmap;
+
+class CTsScreenshotMsg: public CBase
+{
+public:
+    static CTsScreenshotMsg* NewLC( RReadStream& aStream );
+    static CTsScreenshotMsg* NewLC( TInt aWindowGroupId, 
+                                    const CFbsBitmap& aBitmap, 
+                                    UpdatePriority aPrior,
+                                    TInt aRotation );
+    
+    static TInt Size();
+    ~CTsScreenshotMsg();
+    TInt WindowGroupId() const;
+    const CFbsBitmap& Screenshot() const;
+    UpdatePriority Priority() const;
+    TInt Rotation()const;
+    HBufC8* ExternalizeLC() const;
+    void ExternalizeL(RWriteStream &stream) const;
+    void InternalizeL(RReadStream &stream);
+
+private:
+    CTsScreenshotMsg();
+    void ConstructL(RReadStream &stream);
+    void ConstructL(TInt windowGroupId, const CFbsBitmap& bitmap, UpdatePriority prior, TInt aRotation);
+
+private:
+    TInt iWindowGroupId;
+    UpdatePriority iPriority;
+    CFbsBitmap* iBitmap;
+    TInt iRotation;
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/utils/inc/tsunregscreenshotmsg.h	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Task list entry
+*
+*/
+
+#ifndef TSUNREGISTERSCREENSHOTMSG_H
+#define TSUNREGISTERSCREENSHOTMSG_H
+#include <e32base.h>
+#include <s32strm.h>
+
+class CTsUnregisterScreenshotMsg: public CBase
+{
+public:
+    static CTsUnregisterScreenshotMsg* NewLC(RReadStream&);
+    static CTsUnregisterScreenshotMsg* NewLC(TInt windowGroupId);
+    
+    static TInt size();
+    ~CTsUnregisterScreenshotMsg();
+    TInt windowGroupId() const;
+    HBufC8* ExternalizeLC() const;
+    void ExternalizeL(RWriteStream &stream) const;
+    void InternalizeL(RReadStream &stream);
+
+private:
+    CTsUnregisterScreenshotMsg();
+    void ConstructL(RReadStream &stream);
+    void ConstructL(TInt windowGroupId);
+
+private:
+    TInt mWindowGroupId;
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/utils/inc/tsutils.h	Mon Sep 13 13:26:33 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: 
+*
+*/
+
+namespace TaskSwitcher {
+    template <class T>
+    void RPointerArrayCleanupMethod(TAny *aPtr)
+    {
+        static_cast< RPointerArray<T>* >(aPtr)->ResetAndDestroy();
+    }
+
+    template <class T>
+    void CleanupResetAndDestroyPushL(RPointerArray<T> &array) {
+        CleanupStack::PushL(TCleanupItem(&RPointerArrayCleanupMethod<T>, &array));            
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/utils/inc/tsvisibilitymsg.h	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Task list entry
+*
+*/
+
+#ifndef TSVISIBILITYMSG_H
+#define TSVISIBILITYMSG_H
+#include <e32base.h>
+#include <s32strm.h>
+
+#include "tstaskmonitorglobals.h"
+
+class CTsVisibilitMsg: public CBase
+{
+public:
+    static CTsVisibilitMsg* NewLC(RReadStream&);
+    static CTsVisibilitMsg* NewLC(TInt windowGroupId, Visibility visi);
+    
+    static TInt size();
+    ~CTsVisibilitMsg();
+    TInt windowGroupId() const;
+    Visibility visibility() const;
+    HBufC8* ExternalizeLC() const;
+    void ExternalizeL(RWriteStream &stream) const;
+    void InternalizeL(RReadStream &stream);
+
+private:
+    CTsVisibilitMsg();
+    void ConstructL(RReadStream &stream);
+    void ConstructL(TInt windowGroupId, Visibility visi);
+
+private:
+    TInt mWindowGroupId;
+    Visibility mVisibility;
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/utils/inc/tswindowgroupsobserver.h	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,173 @@
+/*
+ * 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 TSWINDOWGROUPSOBSERVER_H
+#define TSWINDOWGROUPSOBSERVER_H
+
+#include "tsresourcemanager.h"
+
+/**
+ * Interface declare mathods to notify about window server events
+ */
+class MTsWindowGroupsObserver
+{
+public:
+    /**
+     * Method notidy about window group changes.
+     * @param rsc - resource manager
+     * @param wgs - list of window groups associated with running applications
+     */
+    virtual void HandleWindowGroupChanged(MTsResourceManager &rsc, 
+                                          const TArray<RWsSession::TWindowGroupChainInfo> & wgs) =0;
+};
+
+/**
+ * Interface declare methods to subscribe windo server events
+ */
+class MTsWindowGroupsMonitor
+{
+public:
+    /**
+     * Method make subscription for window server events
+     * @param observer - events observer
+     */
+    virtual void SubscribeL(MTsWindowGroupsObserver & observer) =0;
+    
+    /**
+     * Method cancel subscription for window server events
+     * @param observer - events observer
+     */
+    virtual void Cancel(MTsWindowGroupsObserver &) =0;
+};
+
+/**
+ * Window server observer implementation. Class automaticly subscribe / cancel subscription
+ * at construction / destruction level.
+ * 
+ */
+class CTsWindowGroupsObserver: public CBase,
+                               public MTsWindowGroupsObserver
+{
+public:
+    /**
+     * Destructor
+     * Function automaticly cancel subscrption to window server events
+     */
+    ~CTsWindowGroupsObserver();
+    
+protected:
+    /**
+     * First phase constructor
+     */
+    CTsWindowGroupsObserver(MTsWindowGroupsMonitor &);
+    
+    /**
+     * Second phase constructor.
+     * Function automaticly subscribe window server events
+     */
+    void BaseConstructL();
+
+private:
+    MTsWindowGroupsMonitor & mMonitor;
+};
+
+/**
+ * Window server monitor implementation.
+ */
+class CTsWindowGroupsMonitor: public CActive, 
+                              public MTsWindowGroupsMonitor
+                              
+{
+public:
+    /**
+     * Two phase constructor
+     */
+    static CTsWindowGroupsMonitor* NewL(MTsResourceManager &);
+    
+    /**
+     * Destructor
+     */
+    ~CTsWindowGroupsMonitor();
+    
+    /**
+     * @see MTsWindowGroupsMonitor::SubscribeL
+     */
+    void SubscribeL(MTsWindowGroupsObserver &);
+    
+    /**
+     * @see MTsWindowGroupsMonitor::Cancel
+     */
+    void Cancel(MTsWindowGroupsObserver &);
+
+protected:
+    /**
+     * @see CActive::RunL
+     */
+    void RunL();
+    
+    /**
+     * @see CActive::DoCancel
+     */
+    void DoCancel();
+    
+    /**
+     * @see CActive::RunError
+     */
+    TInt RunError(TInt error);
+
+private:
+    /**
+     * First phase constructor
+     */
+    CTsWindowGroupsMonitor(MTsResourceManager &);
+    
+    /**
+     * Second phase constructor
+     */
+    void ConstructL();
+    
+    /**
+     * Function subscribe for event to window server and activate object
+     */
+    void Subscribe();
+    
+    /**
+     * Function provide window server event to observers
+     */
+    void ProvideEventL();
+    
+    /**
+     * Function provide window server event to observer
+     */
+    void ProvideEventL(TWsEvent, MTsWindowGroupsObserver &);
+
+private:
+    /**
+     * Registry of subscribed observers
+     */
+    RPointerArray<MTsWindowGroupsObserver> mObservers;
+    
+    /**
+     * Resources manager
+     */
+    MTsResourceManager &mResources;
+    
+    /**
+     * Monitor window group
+     */
+    RWindowGroup mWg;
+};
+#endif //TSWINDOWGROUPSOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/utils/src/tsentry.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,272 @@
+/*
+ * 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 <s32strm.h>
+#include <fbs.h>
+#include "tsentry.h"
+#include "tsdataobserver.h"
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::NewL
+// --------------------------------------------------------------------------
+//
+CTsEntry* CTsEntry::NewL(const TTsEntryKey &key, MTsDataObserver &observer)
+{
+    CTsEntry* self = NewLC(key, observer);
+    CleanupStack::Pop(self);
+    return self;
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::NewLC
+// --------------------------------------------------------------------------
+//
+CTsEntry* CTsEntry::NewLC(const TTsEntryKey &key, MTsDataObserver &observer)
+{
+    CTsEntry* self = new (ELeave) CTsEntry(key, observer);
+    CleanupStack::PushL(self);
+    return self;
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::~CTsFswEntry
+// --------------------------------------------------------------------------
+//
+CTsEntry::~CTsEntry()
+{
+    delete mAppName;
+    delete mAppIconBitmap;
+    delete mScreenshot;
+    delete mImgTool;
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::CTsFswEntry
+// --------------------------------------------------------------------------
+//
+CTsEntry::CTsEntry(const TTsEntryKey &key, MTsDataObserver &observer) 
+:
+    mVisibility(Visible),
+    mKey(key), 
+    mPriority(Low), 
+    mObserver(observer)
+{
+    RefreshUpdateTimestamp();
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::SetAppUid
+// --------------------------------------------------------------------------
+//
+void CTsEntry::SetAppUid(const TUid &uid)
+{
+    mAppUid = uid;
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::SetAppNameL
+// --------------------------------------------------------------------------
+//
+void CTsEntry::SetAppNameL(const TDesC &appName)
+{
+    delete mAppName;
+    mAppName = 0;
+    mAppName = appName.AllocL();
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::SetSystemApp
+// --------------------------------------------------------------------------
+//
+void CTsEntry::SetCloseableApp(TBool value)
+{
+    mCloseableApp = value;
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::SetAppIconHandles
+// --------------------------------------------------------------------------
+//
+void CTsEntry::SetAppIcon(CFbsBitmap * bitmap)
+{
+    mAppIconBitmap = bitmap;
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Application uid.
+ */
+TUid CTsEntry::AppUid() const
+{
+    return mAppUid;
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Application name.
+ */
+const TDesC& CTsEntry::AppName() const
+{
+    return mAppName ? *mAppName : KNullDesC();
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Retrieve entry visibilit status
+ */
+Visibility CTsEntry::GetVisibility() const
+{
+    return mVisibility;
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Change entry visibility status
+ * @param visibility - new visibility status
+ */
+void CTsEntry::SetVisibility(Visibility visibility)
+{
+    mVisibility = visibility;
+}
+
+// --------------------------------------------------------------------------
+/**
+ * ETrue if the application is closeable
+ */
+TBool CTsEntry::CloseableApp() const
+{
+    return mCloseableApp;
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Application icon bitmap
+ */
+CFbsBitmap *CTsEntry::AppIconBitmap() const
+{
+    return mAppIconBitmap;
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Entry's key
+ */
+const TTsEntryKey &CTsEntry::Key() const
+{
+    return mKey;
+}
+
+TTime CTsEntry::Timestamp() const
+{
+    return mTimestamp;
+}
+    
+// --------------------------------------------------------------------------
+/**
+ * Timestamp of last entry change 
+ */
+TTime CTsEntry::LastUpdateTimestamp() const
+{
+    return mUpdateTimestamp;
+}
+
+void CTsEntry::SetTimestamp(const TTime &timestamp)
+{
+    mTimestamp = timestamp;
+    RefreshUpdateTimestamp();
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Set new value of updates timestamp
+ */
+void CTsEntry::RefreshUpdateTimestamp()
+{
+    mUpdateTimestamp.UniversalTime();
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::SetScreenshot
+// --------------------------------------------------------------------------
+//
+void CTsEntry::SetScreenshotL(const CFbsBitmap &bitmapArg, UpdatePriority priority, TInt angle)
+{
+    TInt currentPriority = static_cast<TInt> (mPriority);
+    TInt newPriority = static_cast<TInt> (priority);
+    if(newPriority <currentPriority) {
+        User::Leave(KErrAccessDenied);
+    }
+    
+    CFbsBitmap* bitmap = new (ELeave) CFbsBitmap;
+    CleanupStack::PushL(bitmap);
+    User::LeaveIfError(bitmap->Duplicate(bitmapArg.Handle()));
+    CleanupStack::Pop(bitmap);
+
+    mPriority = priority;
+    delete mScreenshot;
+    mScreenshot = bitmap;
+    RefreshUpdateTimestamp();
+
+    delete mImgTool;
+    mImgTool = 0;
+
+    mImgTool = CTsGraphicFileScalingHandler::NewL(*this, *mScreenshot, TSize(128, 128),
+    CTsGraphicFileScalingHandler::EKeepAspectRatioByExpanding, angle);
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::RemoveScreenshot
+// --------------------------------------------------------------------------
+//
+void CTsEntry::RemoveScreenshotL()
+{
+    if (!mScreenshot) {
+        User::Leave(KErrNotFound);
+    }
+    delete mScreenshot;
+    mScreenshot = NULL;
+    mPriority = Low;
+    
+    mObserver.DataChanged();
+    RefreshUpdateTimestamp();
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Application screenshot.
+ */
+CFbsBitmap* CTsEntry::Screenshot() const
+{
+    return mScreenshot;
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::Priority
+// --------------------------------------------------------------------------
+//
+void CTsEntry::ImageReadyCallBack(TInt error, const CFbsBitmap *bitmap)
+{
+    if (KErrNone == error && 0 != bitmap) {
+        mScreenshot->Reset();
+        mScreenshot->Duplicate(bitmap->Handle());
+        RefreshUpdateTimestamp();
+        mObserver.DataChanged();
+    }
+}
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/utils/src/tsentrykey.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,46 @@
+/*
+* 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"
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+TTsEntryKey::TTsEntryKey(TInt parentId)
+:
+    mParentId(parentId)
+{}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+TBool TTsEntryKey::operator ==(const TTsEntryKey& key) const
+{
+    return (mParentId == key.mParentId);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+TInt TTsEntryKey::WindowGroupId() const
+{
+    return mParentId;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/utils/src/tsentrykeygenerator.cpp	Mon Sep 13 13:26:33 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:  Task list entry
+ *
+*/
+#include "tsentrykeygenerator.h"
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+TInt TsEntryKeyGeneraror::Generate(TTsEntryKey& returnKey, TInt windowGroupId, 
+    const TArray<RWsSession::TWindowGroupChainInfo>& groupChain)
+{
+    for (TInt iter(0); iter < groupChain.Count(); ++iter) {
+        if (groupChain[iter].iId == windowGroupId) {
+            returnKey = TTsEntryKey(windowGroupId);
+            if (groupChain[iter].iId == groupChain[iter].iParentId) {
+                return KErrBadHandle;
+            }
+            else if (0 >= groupChain[iter].iParentId) {
+                return KErrNone;
+            }
+            else {
+                return TsEntryKeyGeneraror::Generate(returnKey, groupChain[iter].iParentId, groupChain);
+            }
+        }
+    }
+    return KErrNotFound;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/utils/src/tsresourcemanager.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,67 @@
+/*
+ * 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 "tswindowgroupsobserver.h"
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CTsResourceManager* CTsResourceManager::NewL()
+{
+    CTsResourceManager* self =new(ELeave) CTsResourceManager();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CTsResourceManager::ConstructL()
+{
+    User::LeaveIfError(mWsSession.Connect());
+    User::LeaveIfError(mApaSeesion.Connect());
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CTsResourceManager::~CTsResourceManager()
+{
+    mApaSeesion.Close();
+    mWsSession.Close();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+RWsSession& CTsResourceManager::WsSession()
+{
+    return mWsSession;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+RApaLsSession& CTsResourceManager::ApaSession()
+{
+    return mApaSeesion;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/utils/src/tsscreenshotmsg.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,126 @@
+/*
+* 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 <s32mem.h>
+#include <fbs.h>
+
+#include "tsscreenshotmsg.h"
+
+// -----------------------------------------------------------------------------
+CTsScreenshotMsg* CTsScreenshotMsg::NewLC(RReadStream& aStream)
+    {
+    CTsScreenshotMsg *self = new(ELeave)CTsScreenshotMsg();
+    CleanupStack::PushL(self);
+    self->ConstructL(aStream);
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+CTsScreenshotMsg* CTsScreenshotMsg::NewLC( TInt aWindowGroupId, 
+                                           const CFbsBitmap& aBitmap, 
+                                           UpdatePriority aPrior, 
+                                           TInt aRotation )
+    {
+    CTsScreenshotMsg *self = new(ELeave)CTsScreenshotMsg();
+    CleanupStack::PushL(self);
+    self->ConstructL(aWindowGroupId, aBitmap, aPrior, aRotation);
+    return self;
+    }
+// -----------------------------------------------------------------------------
+TInt CTsScreenshotMsg::CTsScreenshotMsg::Size()
+    {
+    return sizeof(TInt) * 4;
+    }
+
+// -----------------------------------------------------------------------------
+CTsScreenshotMsg::~CTsScreenshotMsg()
+    {
+    delete iBitmap;
+    }
+
+// -----------------------------------------------------------------------------
+TInt CTsScreenshotMsg::WindowGroupId() const
+    {
+    return iWindowGroupId;
+    }
+
+// -----------------------------------------------------------------------------
+const CFbsBitmap& CTsScreenshotMsg::Screenshot() const
+    {
+    return *iBitmap;
+    }
+
+// -----------------------------------------------------------------------------
+UpdatePriority CTsScreenshotMsg::Priority() const
+    {
+    return iPriority;
+    }
+
+// -----------------------------------------------------------------------------
+TInt CTsScreenshotMsg::Rotation() const
+    {
+    return iRotation;
+    }
+
+// -----------------------------------------------------------------------------
+HBufC8* CTsScreenshotMsg::ExternalizeLC() const
+    {
+    HBufC8* retVal = HBufC8::NewLC(Size());
+    TPtr8 des(retVal->Des());
+    RDesWriteStream stream(des);
+    CleanupClosePushL(stream);
+    stream << (*this);
+    CleanupStack::PopAndDestroy(&stream);
+    return retVal;
+    }
+
+// -----------------------------------------------------------------------------
+void CTsScreenshotMsg::ExternalizeL(RWriteStream &stream) const
+    {
+    stream.WriteInt32L(iWindowGroupId);
+    stream.WriteInt32L(iBitmap->Handle());
+    stream.WriteInt32L(iPriority);
+    stream.WriteInt32L(iRotation);
+    }
+// -----------------------------------------------------------------------------
+void CTsScreenshotMsg::InternalizeL(RReadStream &stream)
+    {
+    iWindowGroupId = stream.ReadInt32L();
+    User::LeaveIfError(iBitmap->Duplicate(stream.ReadInt32L()));
+    iPriority = static_cast<UpdatePriority>(stream.ReadInt32L());
+    iRotation = stream.ReadInt32L();
+    }
+
+// -----------------------------------------------------------------------------
+CTsScreenshotMsg::CTsScreenshotMsg()
+    {
+    }
+// -----------------------------------------------------------------------------
+void CTsScreenshotMsg::ConstructL(RReadStream &stream)
+    {
+    iBitmap = new(ELeave)CFbsBitmap();
+    stream >> (*this);
+    }
+
+// -----------------------------------------------------------------------------
+void CTsScreenshotMsg::ConstructL(TInt windowGroupId, const CFbsBitmap& bitmap, UpdatePriority prior, TInt aRotation)
+    {
+    iBitmap = new(ELeave)CFbsBitmap();
+    User::LeaveIfError(iBitmap->Duplicate(bitmap.Handle()));
+    iWindowGroupId = windowGroupId;
+    iPriority = prior;
+    iRotation = aRotation;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/utils/src/tsunregscreenshotmsg.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,94 @@
+/*
+* 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 "tsunregscreenshotmsg.h"
+#include <s32mem.h>
+// -----------------------------------------------------------------------------
+CTsUnregisterScreenshotMsg* CTsUnregisterScreenshotMsg::NewLC(RReadStream& stream)
+{
+    CTsUnregisterScreenshotMsg* self = new(ELeave)CTsUnregisterScreenshotMsg();
+    CleanupStack::PushL(self);
+    self->ConstructL(stream);
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+CTsUnregisterScreenshotMsg* CTsUnregisterScreenshotMsg::NewLC(TInt windowGroupId)
+{
+    CTsUnregisterScreenshotMsg* self = new(ELeave)CTsUnregisterScreenshotMsg();
+    CleanupStack::PushL(self);
+    self->ConstructL(windowGroupId);
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+CTsUnregisterScreenshotMsg::CTsUnregisterScreenshotMsg()
+{
+    //No implementation required
+}
+// -----------------------------------------------------------------------------
+void CTsUnregisterScreenshotMsg::ConstructL(RReadStream &stream)
+{
+    stream >> (*this);
+}
+
+// -----------------------------------------------------------------------------
+void CTsUnregisterScreenshotMsg::ConstructL(TInt windowGroupId)
+{
+    mWindowGroupId = windowGroupId;
+}
+
+// -----------------------------------------------------------------------------
+TInt CTsUnregisterScreenshotMsg::size()
+{
+    return sizeof(TInt);
+}
+
+// -----------------------------------------------------------------------------
+CTsUnregisterScreenshotMsg::~CTsUnregisterScreenshotMsg()
+{
+    //No implementation required
+}
+
+// -----------------------------------------------------------------------------
+TInt CTsUnregisterScreenshotMsg::windowGroupId() const
+{
+    return mWindowGroupId;
+}
+
+// -----------------------------------------------------------------------------
+HBufC8* CTsUnregisterScreenshotMsg::ExternalizeLC() const
+{
+    HBufC8* retVal = HBufC8::NewLC(size());
+    TPtr8 des(retVal->Des());
+    RDesWriteStream stream(des);
+    CleanupClosePushL(stream);
+    stream << (*this);
+    CleanupStack::PopAndDestroy(&stream);
+    return retVal;
+}
+
+// -----------------------------------------------------------------------------
+void CTsUnregisterScreenshotMsg::ExternalizeL(RWriteStream &stream) const
+{
+    stream.WriteInt32L(mWindowGroupId);
+}
+
+// -----------------------------------------------------------------------------
+void CTsUnregisterScreenshotMsg::InternalizeL(RReadStream &stream)
+{
+    mWindowGroupId = stream.ReadInt32L();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/utils/src/tsvisibilitymsg.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,105 @@
+/*
+* 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 <s32mem.h>
+#include "tsvisibilitymsg.h"
+// -----------------------------------------------------------------------------
+CTsVisibilitMsg* CTsVisibilitMsg::NewLC(RReadStream& stream)
+{
+    CTsVisibilitMsg *self = new (ELeave)CTsVisibilitMsg();
+    CleanupStack::PushL(self);
+    self->ConstructL(stream);
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+CTsVisibilitMsg* CTsVisibilitMsg::NewLC(TInt windowGroupId, Visibility visi)
+{
+    CTsVisibilitMsg *self = new (ELeave)CTsVisibilitMsg();
+    CleanupStack::PushL(self);
+    self->ConstructL(windowGroupId, visi);
+    return self;
+}
+// -----------------------------------------------------------------------------
+TInt CTsVisibilitMsg::size()
+{
+    return sizeof(TInt) * 2;
+}
+
+// -----------------------------------------------------------------------------
+CTsVisibilitMsg::~CTsVisibilitMsg()
+{
+    //No implementation required
+}
+
+// -----------------------------------------------------------------------------
+TInt CTsVisibilitMsg::windowGroupId() const
+{
+    return mWindowGroupId;
+}
+
+// -----------------------------------------------------------------------------
+Visibility CTsVisibilitMsg::visibility() const
+{
+    return mVisibility;
+}
+
+// -----------------------------------------------------------------------------
+HBufC8* CTsVisibilitMsg::ExternalizeLC() const
+{
+    HBufC8* retVal = HBufC8::NewLC(size());
+    TPtr8 des(retVal->Des());
+    RDesWriteStream stream(des);
+    CleanupClosePushL(stream);
+    stream << (*this);
+    CleanupStack::PopAndDestroy(&stream);
+    return retVal;
+}
+
+// -----------------------------------------------------------------------------
+void CTsVisibilitMsg::ExternalizeL(RWriteStream &stream) const
+{
+    stream.WriteInt32L(mWindowGroupId);
+    stream.WriteInt32L(mVisibility);
+    
+}
+
+// -----------------------------------------------------------------------------
+void CTsVisibilitMsg::InternalizeL(RReadStream &stream)
+{
+    mWindowGroupId = stream.ReadInt32L();
+    mVisibility = static_cast<Visibility>(stream.ReadInt32L());
+}
+
+// -----------------------------------------------------------------------------
+CTsVisibilitMsg::CTsVisibilitMsg()
+{
+    //No implementaton required
+}
+
+// -----------------------------------------------------------------------------
+void CTsVisibilitMsg::ConstructL(RReadStream &stream)
+{
+    stream >> (*this);
+}
+
+// -----------------------------------------------------------------------------
+void CTsVisibilitMsg::ConstructL(TInt windowGroupId, Visibility visi)
+{
+    mWindowGroupId = windowGroupId;
+    mVisibility = visi;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/utils/src/tswindowgroupsmonitor.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,176 @@
+/*
+ * 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 "tswindowgroupsobserver.h"
+#include <apgwgnam.h>
+
+const int KOrdinalPositionNoZOrder(-1);
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CTsWindowGroupsMonitor* CTsWindowGroupsMonitor::NewL(MTsResourceManager &resources)
+{
+    CTsWindowGroupsMonitor* self = new (ELeave) CTsWindowGroupsMonitor(resources);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CTsWindowGroupsMonitor::CTsWindowGroupsMonitor(MTsResourceManager &resources)
+:
+    CActive(EPriorityStandard),
+    mResources(resources)
+{
+    CActiveScheduler::Add(this);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CTsWindowGroupsMonitor::ConstructL()
+{
+    
+    // Initial window group
+    mWg = RWindowGroup (mResources.WsSession());
+    User::LeaveIfError (mWg.Construct ((TUint32)&mWg, EFalse));
+    mWg.SetOrdinalPosition (KOrdinalPositionNoZOrder);
+    mWg.EnableReceiptOfFocus (EFalse);
+    
+    // Hide window
+    CApaWindowGroupName* wn = CApaWindowGroupName::NewLC(mResources.WsSession());
+    wn->SetHidden (ETrue);
+    wn->SetWindowGroupName (mWg);
+    CleanupStack::PopAndDestroy (wn);
+    
+    // Window group change event
+    User::LeaveIfError (mWg.EnableGroupListChangeEvents());
+    Subscribe();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CTsWindowGroupsMonitor::~CTsWindowGroupsMonitor()
+{
+    CActive::Cancel();
+    mWg.Close();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CTsWindowGroupsMonitor::SubscribeL(MTsWindowGroupsObserver &observer)
+{
+    const TInt offset(mObservers.Find(&observer));
+    KErrNotFound == offset ? mObservers.InsertL(&observer, 0) : 
+                             User::Leave(KErrAlreadyExists);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CTsWindowGroupsMonitor::Cancel(MTsWindowGroupsObserver & observer)
+{
+    const TInt offset(mObservers.Find(&observer));
+    if (KErrNotFound != offset) {
+        mObservers.Remove(offset);
+    }
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CTsWindowGroupsMonitor::RunL()
+{
+    User::LeaveIfError(iStatus.Int());
+    ProvideEventL();
+    Subscribe();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CTsWindowGroupsMonitor::DoCancel()
+{
+    if (IsActive()) {
+        mResources.WsSession().EventReadyCancel();
+    }
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+TInt CTsWindowGroupsMonitor::RunError(TInt error)
+{
+    if (!IsActive() && KErrCancel != error) {
+        Subscribe();
+    }
+    return KErrNone;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CTsWindowGroupsMonitor::Subscribe()
+{
+    mResources.WsSession().EventReady( &iStatus );
+    SetActive();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CTsWindowGroupsMonitor::ProvideEventL()
+{
+    TWsEvent wsEvent;
+    mResources.WsSession().GetEvent(wsEvent);
+    for (TInt iter(0); iter < mObservers.Count(); ++iter) {
+        ProvideEventL(wsEvent, *mObservers[iter]);
+    }
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CTsWindowGroupsMonitor::ProvideEventL(TWsEvent event, 
+                                          MTsWindowGroupsObserver &observer)
+{
+    RArray<RWsSession::TWindowGroupChainInfo> wgInfo;
+    CleanupClosePushL(wgInfo);
+    switch(event.Type()) {
+    case EEventWindowGroupListChanged:
+        User::LeaveIfError(mResources.WsSession().WindowGroupList(0, &wgInfo));
+        observer.HandleWindowGroupChanged(mResources, wgInfo.Array());
+        break;
+    }
+    CleanupStack::PopAndDestroy(&wgInfo);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/utils/src/tswindowgroupsobserver.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description :
+ *
+ */
+#include "tswindowgroupsobserver.h"
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CTsWindowGroupsObserver::CTsWindowGroupsObserver(MTsWindowGroupsMonitor & monitor)
+:
+    mMonitor(monitor)
+{}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CTsWindowGroupsObserver::BaseConstructL()
+{
+    mMonitor.SubscribeL(*this);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CTsWindowGroupsObserver::~CTsWindowGroupsObserver()
+{
+    mMonitor.Cancel(*this);
+}
--- a/tsdevicedialog/tsdevicedialog.pro	Wed Aug 18 10:39:24 2010 +0300
+++ b/tsdevicedialog/tsdevicedialog.pro	Mon Sep 13 13:26:33 2010 +0300
@@ -17,6 +17,8 @@
 TEMPLATE = subdirs
 
 coverage {
+    SUBDIRS += ../homescreensrv_plat
+    SUBDIRS += ../utils
     SUBDIRS += ../activityfw
     SUBDIRS += ../hsappkeyhandler
     SUBDIRS += ../taskswitcher
@@ -36,7 +38,7 @@
     SUBDIRS += ../taskswitcher/client/tsrc
     SUBDIRS += ../taskswitcher/server/tsrc
     SUBDIRS += ../taskswitcher/screenshotplugin/tsrc
-    SUBDIRS += ../activityfw/tsutils/tsrc
+    SUBDIRS += ../utils/tsimageutils/tsrc
     SUBDIRS += ../taskswitcher/utils/tsrc
     SUBDIRS += ../taskswitcher/backstepping/tsrc
 }
--- a/tsdevicedialog/tsdevicedialogplugin/inc/tsactivitymodelitem.h	Wed Aug 18 10:39:24 2010 +0300
+++ b/tsdevicedialog/tsdevicedialogplugin/inc/tsactivitymodelitem.h	Mon Sep 13 13:26:33 2010 +0300
@@ -32,8 +32,8 @@
 {
     Q_OBJECT
 public:
-    TsActivityModelItem(QAbstractListModel &model, 
-                        QObject &service, 
+    TsActivityModelItem(QAbstractListModel &model,
+                        QObject &service,
                         const QVariantHash &activity);
     ~TsActivityModelItem();
     QVariant data(int role) const;
@@ -57,7 +57,7 @@
     const QVariantHash mActivity;
     QIcon mIcon;
     mutable bool mRequestPending;
-    
+
     Q_DISABLE_COPY(TsActivityModelItem)
 
 };
--- a/tsdevicedialog/tsdevicedialogplugin/inc/tsdataroles.h	Wed Aug 18 10:39:24 2010 +0300
+++ b/tsdevicedialog/tsdevicedialogplugin/inc/tsdataroles.h	Mon Sep 13 13:26:33 2010 +0300
@@ -11,13 +11,14 @@
 *
 * Contributors:
 *
-* Description: 
+* Description:
 *
 */
 #ifndef TSDATAROLES_H
 #define TSDATAROLES_H
 
-namespace TsDataRoles {
+namespace TsDataRoles
+{
     enum EntryAttributes {
         Closable = Qt::UserRole + 1,
         Active,
--- a/tsdevicedialog/tsdevicedialogplugin/inc/tsdevicedialogcontainer.h	Wed Aug 18 10:39:24 2010 +0300
+++ b/tsdevicedialog/tsdevicedialogplugin/inc/tsdevicedialogcontainer.h	Mon Sep 13 13:26:33 2010 +0300
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description: 
+* Description:
 *
 */
 #ifndef TSDEVICEDIALOGCONTAINER_H
@@ -28,12 +28,12 @@
 
 class QAbstractListModel;
 
-class TsDeviceDialogContainer : public QObject, 
+class TsDeviceDialogContainer : public QObject,
                                 public HbDeviceDialogInterface
 {
-Q_OBJECT
+    Q_OBJECT
 public:
-    explicit TsDeviceDialogContainer(QAbstractListModel *model, 
+    explicit TsDeviceDialogContainer(QAbstractListModel *model,
                                      QObject *parent = 0);
     ~TsDeviceDialogContainer();
 
@@ -54,7 +54,7 @@
     void notifyDialogClosed();
     void switchViewOnModelChange();
     void handleDismissRequest();
-    
+
 private:
     TsDocumentLoader mLoader;
     QValueSpacePublisher mVisibilityPublisher;
--- a/tsdevicedialog/tsdevicedialogplugin/inc/tsdevicedialogplugin.h	Wed Aug 18 10:39:24 2010 +0300
+++ b/tsdevicedialog/tsdevicedialogplugin/inc/tsdevicedialogplugin.h	Mon Sep 13 13:26:33 2010 +0300
@@ -35,13 +35,13 @@
     TsDeviceDialogPlugin();
     ~TsDeviceDialogPlugin();
 
-    bool accessAllowed(const QString &deviceDialogType, 
-                       const QVariantMap &parameters, 
+    bool accessAllowed(const QString &deviceDialogType,
+                       const QVariantMap &parameters,
                        const QVariantMap &securityInfo) const;
-    HbDeviceDialogInterface *createDeviceDialog(const QString &deviceDialogType, 
+    HbDeviceDialogInterface *createDeviceDialog(const QString &deviceDialogType,
                                                 const QVariantMap &parameters);
-    bool deviceDialogInfo(const QString &deviceDialogType, 
-                          const QVariantMap &parameters, 
+    bool deviceDialogInfo(const QString &deviceDialogType,
+                          const QVariantMap &parameters,
                           DeviceDialogInfo *info) const;
     QStringList deviceDialogTypes() const;
     PluginFlags pluginFlags() const;
@@ -53,7 +53,7 @@
     TsTaskMonitor *mStorage;
 
     bool mTriedToLoadTranslation;
-    
+
     Q_DISABLE_COPY(TsDeviceDialogPlugin)
 };
 
--- a/tsdevicedialog/tsdevicedialogplugin/inc/tsdocumentloader.h	Wed Aug 18 10:39:24 2010 +0300
+++ b/tsdevicedialog/tsdevicedialogplugin/inc/tsdocumentloader.h	Mon Sep 13 13:26:33 2010 +0300
@@ -24,7 +24,7 @@
 {
 
 private:
-    virtual QObject *createObject(const QString &type, 
+    virtual QObject *createObject(const QString &type,
                                   const QString &name);
 
 };
--- a/tsdevicedialog/tsdevicedialogplugin/inc/tsmodel.h	Wed Aug 18 10:39:24 2010 +0300
+++ b/tsdevicedialog/tsdevicedialogplugin/inc/tsmodel.h	Mon Sep 13 13:26:33 2010 +0300
@@ -25,10 +25,6 @@
 
 #include <tstaskmonitor.h>
 
-#ifdef Q_OS_SYMBIAN
-#include <apgcli.h>
-#endif
-
 class CaNotifier;
 class TsModelItem;
 
@@ -43,19 +39,19 @@
     ~TsModel();
 
     int rowCount(const QModelIndex &parent = QModelIndex()) const;
-    QVariant data(const QModelIndex &index, 
+    QVariant data(const QModelIndex &index,
                   int role = Qt::DisplayRole) const;
     int maxRowCount()const;
     // from QAbstractModel
-    virtual bool insertRows(int row, int count, TsModelItem* item,
-                            const QModelIndex & parent = QModelIndex());
+    virtual bool insertRows(int row, int count, TsModelItem *item,
+                            const QModelIndex &parent = QModelIndex());
     virtual bool removeRows(int row, int count,
-                            const QModelIndex & parent = QModelIndex());
+                            const QModelIndex &parent = QModelIndex());
 
-    
+
     bool moveRows(int oldPosition, int newPosition,
-                  const QModelIndex & parent = QModelIndex());
-    bool updateRows(int row, TsModelItem* item);
+                  const QModelIndex &parent = QModelIndex());
+    bool updateRows(int row, TsModelItem *item);
     void fullUpdate();
 
 public slots:
@@ -67,9 +63,7 @@
 private:
     TsModelItem *entry(const QModelIndex &index) const;
     void getApplications();
-    void getActivities();
-    void prepareActivityEntry(QVariantHash &activity);
-    QString getApplicationName(int id);
+    void getActivities(bool fullUpdate = true);
 
 private:
     /*
@@ -83,16 +77,13 @@
      * Activity Service
      */
     QObject &mActivityService;
-    
-#ifdef Q_OS_SYMBIAN
-    RApaLsSession iAppArcSession;
-#endif
 
     /*
      * Maximum number of items (only for running apps + activities)
-     */ 
+     */
     int mMaxItems;
-    
+    int mActivitiesCount;
+
     Q_DISABLE_COPY(TsModel)
 };
 
--- a/tsdevicedialog/tsdevicedialogplugin/inc/tsnoitemslabel.h	Wed Aug 18 10:39:24 2010 +0300
+++ b/tsdevicedialog/tsdevicedialogplugin/inc/tsnoitemslabel.h	Mon Sep 13 13:26:33 2010 +0300
@@ -24,11 +24,11 @@
     Q_OBJECT
 
 public:
-    explicit TsNoItemsLabel(QGraphicsItem *parent = 0);  
-    
+    explicit TsNoItemsLabel(QGraphicsItem *parent = 0);
+
 private:
-    Q_DISABLE_COPY(TsNoItemsLabel)    
-    
+    Q_DISABLE_COPY(TsNoItemsLabel)
+
 };
 
 #endif //TSNOITEMSLABEL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/resource/hbdialog.css	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,13 @@
+HbDialog#tsdevicedialog::heading {
+    left: 0;
+    right: 0;
+    top: 0;
+    bottom: 0un;
+    fixed-height: expr(var(hb-param-text-height-primary)+2*var(hb-param-margin-gene-popup));
+}
+
+HbDialog#tsdevicedialog::content {
+    left: 0;
+    right: 0;
+    bottom: 0un;
+}
--- a/tsdevicedialog/tsdevicedialogplugin/resource/layout.docml	Wed Aug 18 10:39:24 2010 +0300
+++ b/tsdevicedialog/tsdevicedialogplugin/resource/layout.docml	Mon Sep 13 13:26:33 2010 +0300
@@ -35,6 +35,7 @@
         </widget>            
         <bool name="backgroundFaded" value="TRUE"/>
         <string name="dismissPolicy" value="TapOutside"/>
+        <string name="frameType" value="Weak"/>        
         <integer name="timeout" value="0"/>
         <sizepolicy horizontalPolicy="Preferred" horizontalStretch="0" verticalPolicy="Preferred" verticalStretch="0"/>
     </widget>
--- a/tsdevicedialog/tsdevicedialogplugin/resource/tstasksgriditem.css	Wed Aug 18 10:39:24 2010 +0300
+++ b/tsdevicedialog/tsdevicedialogplugin/resource/tstasksgriditem.css	Mon Sep 13 13:26:33 2010 +0300
@@ -7,6 +7,7 @@
     color: var(qtc_default_main_pane_normal);
     font-variant: secondary;
     text-height: var(hb-param-text-height-tiny);
+    text-wrap-mode: no-wrap;    
 }
 
 TsTasksGridItem > HbPushButton#closebadge {
--- a/tsdevicedialog/tsdevicedialogplugin/resource/tstasksgriditem.widgetml	Wed Aug 18 10:39:24 2010 +0300
+++ b/tsdevicedialog/tsdevicedialogplugin/resource/tstasksgriditem.widgetml	Mon Sep 13 13:26:33 2010 +0300
@@ -1,18 +1,18 @@
 <hbwidget version="0.1" type="TsTasksGridItem">
     <layout name="custom" type="mesh">
         <meshitem src="appname" srcEdge="TOP" dst="" dstEdge="TOP" spacing="-4un"/>
-        <meshitem src="appname" srcEdge="LEFT" dst="screenshot" dstEdge="LEFT"/>
-        <meshitem src="appname" srcEdge="RIGHT" dst="screenshot" dstEdge="RIGHT"/>
+        <meshitem src="appname" srcEdge="LEFT" dst="screenshotFrame" dstEdge="LEFT"/>
+        <meshitem src="appname" srcEdge="RIGHT" dst="screenshotFrame" dstEdge="RIGHT"/>
 
         <meshitem src="screenshot" srcEdge="TOP" dst="appname" dstEdge="BOTTOM" spacing="-1.5un"/>
         <meshitem src="screenshot" srcEdge="RIGHT" dst="" dstEdge="RIGHT" spacing="1.5un"/>
         <meshitem src="screenshot" srcEdge="LEFT" dst="" dstEdge="LEFT" spacing="-1.5un"/>
         <meshitem src="screenshot" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" spacing="4un"/>
         
-        <meshitem src="screenshotFrame" srcEdge="TOP" dst="screenshot" dstEdge="TOP" spacing="0.5un"/>
-        <meshitem src="screenshotFrame" srcEdge="RIGHT" dst="screenshot" dstEdge="RIGHT" spacing="-0.5un"/>
-        <meshitem src="screenshotFrame" srcEdge="LEFT" dst="screenshot" dstEdge="LEFT" spacing="0.5un"/>
-        <meshitem src="screenshotFrame" srcEdge="BOTTOM" dst="screenshot" dstEdge="BOTTOM" spacing="-0.5un"/>
+        <meshitem src="screenshotFrame" srcEdge="TOP" dst="screenshot" dstEdge="TOP" spacing="0.25un"/>
+        <meshitem src="screenshotFrame" srcEdge="RIGHT" dst="screenshot" dstEdge="RIGHT" spacing="-0.25un"/>
+        <meshitem src="screenshotFrame" srcEdge="LEFT" dst="screenshot" dstEdge="LEFT" spacing="0.25un"/>
+        <meshitem src="screenshotFrame" srcEdge="BOTTOM" dst="screenshot" dstEdge="BOTTOM" spacing="-0.25un"/>
         
         <meshitem src="applicationLabelFrame" srcEdge="TOP" dst="appname" dstEdge="TOP"/>
         <meshitem src="applicationLabelFrame" srcEdge="RIGHT" dst="appname" dstEdge="RIGHT"/>
@@ -22,9 +22,9 @@
         <meshitem src="closebadge" srcEdge="TOP" dst="screenshot" dstEdge="TOP"/>
         <meshitem src="closebadge" srcEdge="RIGHT" dst="screenshot" dstEdge="RIGHT"/>
         
-        <meshitem src="activeLabel" srcEdge="RIGHT" dst="screenshot" dstEdge="RIGHT"/>
-        <meshitem src="activeLabel" srcEdge="LEFT" dst="screenshot" dstEdge="LEFT"/>
-        <meshitem src="activeLabel" srcEdge="BOTTOM" dst="screenshot" dstEdge="BOTTOM"/>
+        <meshitem src="activeLabel" srcEdge="RIGHT" dst="screenshotFrame" dstEdge="RIGHT"/>
+        <meshitem src="activeLabel" srcEdge="LEFT" dst="screenshotFrame" dstEdge="LEFT"/>
+        <meshitem src="activeLabel" srcEdge="BOTTOM" dst="screenshotFrame" dstEdge="BOTTOM"/>
         
         <meshitem src="activeLabelFrame" srcEdge="TOP" dst="activeLabel" dstEdge="TOP"/>
         <meshitem src="activeLabelFrame" srcEdge="RIGHT" dst="activeLabel" dstEdge="RIGHT"/>
--- a/tsdevicedialog/tsdevicedialogplugin/src/tsactivitymodelitem.cpp	Wed Aug 18 10:39:24 2010 +0300
+++ b/tsdevicedialog/tsdevicedialogplugin/src/tsactivitymodelitem.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -37,8 +37,8 @@
     /param entry - Activity data
 */
 TsActivityModelItem::TsActivityModelItem(QAbstractListModel &model,
-                                         QObject& service, 
-                                         const QVariantHash & activity)
+                                         QObject &service,
+                                         const QVariantHash &activity)
     :
     mService(service),
     mActivity(activity),
--- a/tsdevicedialog/tsdevicedialogplugin/src/tsdevicedialogcontainer.cpp	Wed Aug 18 10:39:24 2010 +0300
+++ b/tsdevicedialog/tsdevicedialogplugin/src/tsdevicedialogcontainer.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -22,20 +22,24 @@
 #include <HbDialog>
 #include <HbMainWindow>
 #include <HbLabel>
+#include <HbFrameDrawer>
+#include <HbFrameItem>
+#include <HbStyleLoader>
 
 #include <tspropertydefs.h>
 
 #include "tstasksgrid.h"
 #include "tstasksgriditem.h"
 
-namespace {
+namespace
+{
     const char KDocmlPath[] = ":/resource/layout.docml";
 }
 
-TsDeviceDialogContainer::TsDeviceDialogContainer(QAbstractListModel *model, 
+TsDeviceDialogContainer::TsDeviceDialogContainer(QAbstractListModel *model,
                                                  QObject *parent)
-:
-    QObject(parent), 
+    :
+    QObject(parent),
     mVisibilityPublisher(TsProperty::KTsPath),
     mDismissRequestSubscriber(QString("%1/%2").arg(TsProperty::KTsPath).arg(TsProperty::KDismissRequestPath))
 {
@@ -43,13 +47,23 @@
     mLoader.load(KDocmlPath, &ok);
     Q_ASSERT(ok);
 
-    HbDialog *dialog = 
-        qobject_cast<HbDialog*>(mLoader.findWidget("tsdevicedialog"));
-    TsTasksGrid *grid = 
+    HbDialog *dialog =
+        qobject_cast<HbDialog *>(mLoader.findWidget("tsdevicedialog"));
+    TsTasksGrid *grid =
         qobject_cast<TsTasksGrid *>(mLoader.findWidget("taskgrid"));
     Q_ASSERT(dialog);
     Q_ASSERT(grid);
+    
+    bool cssLoaded = HbStyleLoader::registerFilePath(":/resource/hbdialog.css");
+    Q_ASSERT(cssLoaded);
+    {
+        HbLabel *dialogHeading = qobject_cast<HbLabel *>(dialog->headingWidget());
+        Q_ASSERT(dialogHeading);
+        HbFrameDrawer *headingFrame = new HbFrameDrawer(QLatin1String("qtg_fr_popup_heading"), HbFrameDrawer::ThreePiecesHorizontal);
+        dialogHeading->setBackgroundItem(new HbFrameItem(headingFrame));
+    }
 
+    grid->setEnabledAnimations(HbAbstractItemView::None);
     grid->setModel(model);
 
     changeOrientation(dialog->mainWindow()->orientation());
@@ -60,42 +74,41 @@
     qRegisterMetaType<QModelIndex>("QModelIndex");
 
     // connect the grid and model
-    connect(grid, 
-            SIGNAL(activated(QModelIndex)), 
-            model, 
+    connect(grid,
+            SIGNAL(activated(QModelIndex)),
+            model,
             SLOT(openApplication(QModelIndex)));
-    connect(grid, 
-            SIGNAL(activated(QModelIndex)), 
-            dialog, 
+    connect(grid,
+            SIGNAL(activated(QModelIndex)),
+            dialog,
             SLOT(close()));
-    connect(grid, 
-            SIGNAL(deleteButtonClicked(QModelIndex)), 
-            model, SLOT(closeApplication(QModelIndex)), 
+    connect(grid,
+            SIGNAL(deleteButtonClicked(QModelIndex)),
+            model, SLOT(closeApplication(QModelIndex)),
             Qt::QueuedConnection);
 
-    connect(dialog->mainWindow(), 
-            SIGNAL(orientationChanged(Qt::Orientation)), 
-            this, 
+    connect(dialog->mainWindow(),
+            SIGNAL(orientationChanged(Qt::Orientation)),
+            this,
             SLOT(changeOrientation(Qt::Orientation)));
-    connect(dialog, 
-            SIGNAL(aboutToClose()), 
-            this, 
+    connect(dialog,
+            SIGNAL(aboutToClose()),
+            this,
             SIGNAL(deviceDialogClosed()));
 
-    // note: connect to more signals when partial model updates are implemented
-    connect(model, 
-            SIGNAL(modelReset()), 
-            this, 
-            SLOT(switchViewOnModelChange()));
+    // switch between grid and "no items" label when model is updated
+    connect(model, SIGNAL(modelReset()), this, SLOT(switchViewOnModelChange()));
+    connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(switchViewOnModelChange()));
+    connect(model, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(switchViewOnModelChange()));
 
-    connect(this, 
-            SIGNAL(deviceDialogClosed()), 
-            this, 
+    connect(this,
+            SIGNAL(deviceDialogClosed()),
+            this,
             SLOT(notifyDialogClosed()));
-    mVisibilityPublisher.setValue(TsProperty::KVisibilityPath, 
+    mVisibilityPublisher.setValue(TsProperty::KVisibilityPath,
                                   static_cast<int>(true));
     mVisibilityPublisher.sync();
-    
+
     connect(&mDismissRequestSubscriber,
             SIGNAL(contentsChanged()),
             this,
@@ -108,7 +121,7 @@
 }
 
 bool TsDeviceDialogContainer::setDeviceDialogParameters(
-                                  const QVariantMap &parameters)
+    const QVariantMap &parameters)
 {
     Q_UNUSED(parameters);
     return false;
@@ -128,15 +141,15 @@
 
 HbPopup *TsDeviceDialogContainer::deviceDialogWidget() const
 {
-    HbDialog *widget = 
-        qobject_cast<HbDialog*>(mLoader.findWidget("tsdevicedialog"));
+    HbDialog *widget =
+        qobject_cast<HbDialog *>(mLoader.findWidget("tsdevicedialog"));
     Q_ASSERT(widget);
     return widget;
 }
 
 QObject *TsDeviceDialogContainer::signalSender() const
 {
-    return const_cast<TsDeviceDialogContainer*>(this);
+    return const_cast<TsDeviceDialogContainer *>(this);
 }
 
 void TsDeviceDialogContainer::changeOrientation(Qt::Orientation orientation)
@@ -152,21 +165,21 @@
 
 void TsDeviceDialogContainer::notifyDialogClosed()
 {
-    mVisibilityPublisher.setValue(TsProperty::KVisibilityPath, 
+    mVisibilityPublisher.setValue(TsProperty::KVisibilityPath,
                                   static_cast<int>(false));
     mVisibilityPublisher.sync();
 }
 
 void TsDeviceDialogContainer::switchViewOnModelChange()
 {
-    TsTasksGrid *grid = 
+    TsTasksGrid *grid =
         qobject_cast<TsTasksGrid *>(mLoader.findWidget("taskgrid"));
-    HbWidget *noItemsWidget = 
+    HbWidget *noItemsWidget =
         qobject_cast<HbWidget *>(mLoader.findWidget("noitemswidget"));
     Q_ASSERT(grid);
     Q_ASSERT(noItemsWidget);
 
-    if (grid->model()->rowCount()) {
+    if (grid->model() && grid->model()->rowCount()) {
         noItemsWidget->hide();
         grid->show();
     } else {
--- a/tsdevicedialog/tsdevicedialogplugin/src/tsdevicedialogplugin.cpp	Wed Aug 18 10:39:24 2010 +0300
+++ b/tsdevicedialog/tsdevicedialogplugin/src/tsdevicedialogplugin.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -49,16 +49,16 @@
     const char KTranslationPath[] = "resource/qt/translations";
     const char KTsDialogType[] = "com.nokia.taskswitcher.tsdevicedialogplugin/1.0";
     const char KActivityManaged [] = "com.nokia.qt.activities.ActivityManager";
-} 
- 
+}
+
 /*!
     Constructor.
  */
 TsDeviceDialogPlugin::TsDeviceDialogPlugin()
-: 
-mModel(0), 
-mStorage(0), 
-mTriedToLoadTranslation(false)
+    :
+    mModel(0),
+    mStorage(0),
+    mTriedToLoadTranslation(false)
 {
 }
 
@@ -69,8 +69,8 @@
 /*!
     \reimp
  */
-bool TsDeviceDialogPlugin::accessAllowed(const QString &deviceDialogType, 
-                                         const QVariantMap &parameters, 
+bool TsDeviceDialogPlugin::accessAllowed(const QString &deviceDialogType,
+                                         const QVariantMap &parameters,
                                          const QVariantMap &securityInfo) const
 {
     Q_UNUSED(deviceDialogType)
@@ -85,8 +85,8 @@
 /*!
     \reimp
  */
-HbDeviceDialogInterface * 
-TsDeviceDialogPlugin::createDeviceDialog(const QString &deviceDialogType, 
+HbDeviceDialogInterface *
+TsDeviceDialogPlugin::createDeviceDialog(const QString &deviceDialogType,
                                          const QVariantMap &parameters)
 {
     Q_UNUSED(parameters)
@@ -97,33 +97,33 @@
             mTriedToLoadTranslation = true;
 
             QTranslator *translator = new QTranslator(this);
-            QString translationFile = 
+            QString translationFile =
                 QString("taskswitcher_%1").arg(QLocale::system().name());
-    
+
             bool translationLoaded(false);
-            #ifdef Q_OS_SYMBIAN
-                translationLoaded = 
-                    translator->load(translationFile, 
-                                     QString("z:/") + KTranslationPath);
-                if (!translationLoaded) {
-                    translationLoaded = 
-                        translator->load(translationFile, 
-                                         QString("c:/") + KTranslationPath);
-                }
-            #else
-                translationLoaded = 
-                    translator->load(translationFile, 
-                                     QString(KTranslationPath));
-            #endif //Q_OS_SYMBIAN
+#ifdef Q_OS_SYMBIAN
+            translationLoaded =
+                translator->load(translationFile,
+                                 QString("z:/") + KTranslationPath);
+            if (!translationLoaded) {
+                translationLoaded =
+                    translator->load(translationFile,
+                                     QString("c:/") + KTranslationPath);
+            }
+#else
+            translationLoaded =
+                translator->load(translationFile,
+                                 QString(KTranslationPath));
+#endif //Q_OS_SYMBIAN
 
             Q_ASSERT(translationLoaded);
             qApp->installTranslator(translator);
         }
-    
+
         // lazy loading of model
         if (!mModel) {
             mStorage = new TsTaskMonitor(this);
-            
+
             QServiceManager serviceManager;
             QObject *activityManager(serviceManager.loadInterface(KActivityManaged));
             if (activityManager) {
@@ -134,14 +134,14 @@
             }
             mModel = new TsModel(*mStorage, *activityManager);
         }
-            
+
         // ensure the dismiss request property is set to false
 
         QValueSpacePublisher dismissRequestPublisher(TsProperty::KTsPath);
         dismissRequestPublisher.setValue(TsProperty::KDismissRequestPath, static_cast<int>(false));
         dismissRequestPublisher.sync();
 
-        
+
         // create device dialog
         dialogInterface = new TsDeviceDialogContainer(mModel);
     }
@@ -151,8 +151,8 @@
 /*!
     \reimp
  */
-bool TsDeviceDialogPlugin::deviceDialogInfo(const QString &deviceDialogType, 
-                                            const QVariantMap &parameters, 
+bool TsDeviceDialogPlugin::deviceDialogInfo(const QString &deviceDialogType,
+                                            const QVariantMap &parameters,
                                             DeviceDialogInfo *info) const
 {
     Q_UNUSED(parameters)
--- a/tsdevicedialog/tsdevicedialogplugin/src/tsdocumentloader.cpp	Wed Aug 18 10:39:24 2010 +0300
+++ b/tsdevicedialog/tsdevicedialogplugin/src/tsdocumentloader.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -28,7 +28,7 @@
     TS implementation of document loader. It is creating TS objects used in UI
 */
 
-QObject *TsDocumentLoader::createObject(const QString &type, 
+QObject *TsDocumentLoader::createObject(const QString &type,
                                         const QString &name)
 {
     if (type == TsTasksGrid::staticMetaObject.className()) {
--- a/tsdevicedialog/tsdevicedialogplugin/src/tsmodel.cpp	Wed Aug 18 10:39:24 2010 +0300
+++ b/tsdevicedialog/tsdevicedialogplugin/src/tsmodel.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -49,8 +49,8 @@
     \param query used to create model
     \param pointer to parent object
 */
-TsModel::TsModel(TsTaskMonitor &applicationSrv, 
-                 QObject &activitySrv, 
+TsModel::TsModel(TsTaskMonitor &applicationSrv,
+                 QObject &activitySrv,
                  QObject *parent) :
     QAbstractListModel(parent),
     mEntries(),
@@ -58,11 +58,11 @@
     mActivityService(activitySrv),
     mMaxItems(maxItems)
 {
-    
+
 #ifdef Q_OS_SYMBIAN
     XQSettingsManager *crManager = new XQSettingsManager;
     XQCentralRepositorySettingsKey itemsNumberKey(TSDeviceDialogUid, ItemsLimit);
-    QVariant itemsNumberVariant = 
+    QVariant itemsNumberVariant =
         crManager->readItemValue(itemsNumberKey, XQSettingsManager::TypeInt);
     if (!itemsNumberVariant.isNull()) {
         int number = itemsNumberVariant.toInt();
@@ -70,19 +70,18 @@
             mMaxItems = number;
         }
     }
-    iAppArcSession.Connect();
 #endif
 
     connect(&activitySrv,
-	SIGNAL(dataChanged()),
-			 this,
-			 SLOT(updateActivities()));
+            SIGNAL(dataChanged()),
+            this,
+            SLOT(updateActivities()));
     connect(&applicationSrv,
-	        SIGNAL(taskListChanged()),
-			this,
-			SLOT(updateApplications()));
+            SIGNAL(taskListChanged()),
+            this,
+            SLOT(updateApplications()));
 
-    fullUpdate();    
+    fullUpdate();
 }
 
 /*!
@@ -90,9 +89,6 @@
 */
 TsModel::~TsModel()
 {
-#ifdef Q_OS_SYMBIAN
-    iAppArcSession.Close();
-#endif
     qDeleteAll(mEntries);
 }
 
@@ -107,7 +103,7 @@
     return mEntries.count();
 }
 
-bool TsModel::insertRows(int row, int count, TsModelItem* item, const QModelIndex & parent)
+bool TsModel::insertRows(int row, int count, TsModelItem *item, const QModelIndex &parent)
 {
     beginInsertRows(parent, row, row+count-1);
     mEntries.insert(row, item);
@@ -115,25 +111,27 @@
     return true;
 }
 
-bool TsModel::removeRows(int row, int count, const QModelIndex & parent)
+bool TsModel::removeRows(int row, int count, const QModelIndex &parent)
 {
+    TsModelItem *oldItem = mEntries.at(row);
     beginRemoveRows(parent, row, row + count - 1);
     mEntries.removeAt(row);
+    delete oldItem;
     endRemoveRows();
     return true;
 }
 
 
-bool TsModel::moveRows(int oldPosition, int newPosition, const QModelIndex & parent)
+bool TsModel::moveRows(int oldPosition, int newPosition, const QModelIndex &parent)
 {
-   beginMoveRows(parent, oldPosition, oldPosition, parent, newPosition);
-   mEntries.move(oldPosition, newPosition);
-   endMoveRows();
-   return true;
+    beginMoveRows(parent, oldPosition, oldPosition, parent, newPosition);
+    mEntries.move(oldPosition, newPosition);
+    endMoveRows();
+    return true;
 }
 
 
-bool TsModel::updateRows(int row, TsModelItem* item)
+bool TsModel::updateRows(int row, TsModelItem *item)
 {
     TsModelItem *oldItem = mEntries.at(row);
     mEntries[row] = item;
@@ -181,8 +179,8 @@
 */
 void TsModel::closeApplication(const QModelIndex &index)
 {
-    if (!index.isValid() || 
-        !entry(index)->data(TsDataRoles::Closable).toBool()) {
+    if (!index.isValid() ||
+            !entry(index)->data(TsDataRoles::Closable).toBool()) {
         return;
     }
     entry(index)->close();
@@ -193,12 +191,9 @@
 */
 void TsModel::updateApplications()
 {
-    RDebug::Printf( "TsModel::updateApps \n");
-    RDebug::Printf(" from %d \n: ",this);
     QList<TsTaskChange>  changes(mApplicationService.changeList());
-    
-    if(changes.count() == 0)
-    {
+
+    if (changes.count() == 0) {
         //no applications - only activities on list
         return;
     }
@@ -211,20 +206,32 @@
         switch (changes[iter].first.changeType()) {
             case TsTaskChangeInfo::EChangeDelete :
                 removeRows(changes[iter].first.oldOffset(), 1);
-            break;
+                //we had max rows before delete - so there is possibility to add 
+                //one activity
+                if(mEntries.count() + 1 == maxRowCount()) {
+                    beginInsertRows(QModelIndex(), mEntries.count(), mEntries.count());
+                    getActivities(false);
+                    endInsertRows();
+                }
+                break;
             case TsTaskChangeInfo::EChangeInsert :
                 insertRows(changes[iter].first.newOffset(), 1,
-                    new TsEntryModelItem(changes[iter].second));
-            break;
+                           new TsEntryModelItem(changes[iter].second));
+                //we have too many items - delete some activities if we can
+                while(mEntries.count() > maxRowCount() && mActivitiesCount > 0) {
+                    removeRows(mEntries.count()-1, 1);
+                    mActivitiesCount--;
+                }
+                break;
             case TsTaskChangeInfo::EChangeMove :
                 moveRows(changes[iter].first.oldOffset(), changes[iter].first.newOffset());
-            break;            
+                break;
             case TsTaskChangeInfo::EChangeUpdate :
                 updateRows(changes[iter].first.oldOffset(),
                            new TsEntryModelItem(changes[iter].second));
-            break;
+                break;
             default:
-            break;
+                break;
         }
     }
 
@@ -246,8 +253,10 @@
 */
 void TsModel::fullUpdate()
 {
+    beginResetModel();
     qDeleteAll(mEntries);
     mEntries.clear();
+    mActivitiesCount = 0;
     getApplications();
     getActivities();
     endResetModel();
@@ -259,11 +268,10 @@
 */
 void TsModel::getApplications()
 {
-    RDebug::Printf( "CTsTaskMonitorClientImpl::RunL \n");
     //get all running applications and append to entries list
     TsModelItem *entry(0);
     QList< TsTaskChange> tasks(mApplicationService.changeList(true));
-    foreach (TsTaskChange taskData, tasks) {
+    foreach(TsTaskChange taskData, tasks) {
         if (!taskData.second.isNull()) {
             entry = new TsEntryModelItem(taskData.second);
             if (entry) {
@@ -276,56 +284,25 @@
 /*!
     Read current activities
 */
-void TsModel::getActivities()
+void TsModel::getActivities(bool fullUpdate)
 {
     //get activities
-    TsModelItem *entry(0);
-    QList<QVariantHash> activities;
-    QMetaObject::invokeMethod(&mActivityService, 
-                              "activitiesList", 
-                              Q_RETURN_ARG(QList<QVariantHash>, 
-                              activities));
-    foreach(QVariantHash activity, activities) {
-        prepareActivityEntry(activity);
-        entry = new TsActivityModelItem(*this, mActivityService, activity);
-        if (maxRowCount() <= mEntries.count()) {
-            delete entry;
-            break;
+    int maxActivitiesCount = maxRowCount() - mEntries.count() + mActivitiesCount;
+    if (maxActivitiesCount > 0) {
+        QList<QVariantHash> activities;
+        QMetaObject::invokeMethod(&mActivityService,
+                                  "activitiesList",
+                                  Q_RETURN_ARG(QList<QVariantHash>, activities),
+                                  Q_ARG(int, maxActivitiesCount));
+        int iterPos = fullUpdate ? 0 : mActivitiesCount;
+        for(int iter(iterPos); iter< activities.count(); iter++) {
+            mEntries.append(new TsActivityModelItem(*this, mActivityService, activities[iter]));
+            mActivitiesCount++;
         }
-        mEntries.append(entry);
     }
 }
 
 /*!
-    Modify activity entry replacing application id with name
-*/
-void TsModel::prepareActivityEntry(QVariantHash &activity)
-{
-    if (!activity.contains(TsActivityModelItem::applicationKeyword())) {
-        activity.insert(TsActivityModelItem::applicationKeyword(),
-                    activity.contains(ActivityApplicationKeyword) ?
-                    getApplicationName(activity[ActivityApplicationKeyword].toInt()) :
-                    QString::null);
-    }
-}
-
-/*!
-    Return application name
-    \param id - reqiested application identyfier
-*/
-QString TsModel::getApplicationName(int id)
-{
-    QString retVal;
-#ifdef Q_OS_SYMBIAN
-    TApaAppInfo info;
-    iAppArcSession.GetAppInfo( info, TUid::Uid(id));
-    retVal = QString::fromUtf16(info.iShortCaption.Ptr(),
-                                info.iShortCaption.Length());
-#endif
-    return retVal;
-}
-
-/*!
     Called when some item was changed
     \param itemPtr - address of updated item
 */
@@ -346,4 +323,3 @@
 {
     return mEntries.at(index.row());
 }
-
--- a/tsdevicedialog/tsdevicedialogplugin/src/tstasksgrid.cpp	Wed Aug 18 10:39:24 2010 +0300
+++ b/tsdevicedialog/tsdevicedialogplugin/src/tstasksgrid.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -20,7 +20,7 @@
 void TsTasksGrid::polish(HbStyleParameters &params)
 {
     HbGridView::polish(params);
-    
+
     // center second item when dialog is shown
     if (model()) {
         scrollTo(model()->index(1, 0), PositionAtCenter);
--- a/tsdevicedialog/tsdevicedialogplugin/src/tstasksgriditem.cpp	Wed Aug 18 10:39:24 2010 +0300
+++ b/tsdevicedialog/tsdevicedialogplugin/src/tstasksgriditem.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -31,20 +31,20 @@
     \brief Item that should be presented in grid.
 */
 
-TsTasksGridItem::TsTasksGridItem() 
-: 
-HbAbstractViewItem(), 
-mScreenshotLabel(0), 
-mApplicationNameLabel(0), 
-mDeleteButton(0), 
-mActiveLabelFrame(0), 
-mActiveLabel(0)
+TsTasksGridItem::TsTasksGridItem()
+    :
+    HbAbstractViewItem(),
+    mScreenshotLabel(0),
+    mApplicationNameLabel(0),
+    mDeleteButton(0),
+    mActiveLabelFrame(0),
+    mActiveLabel(0)
 {
     // Register the custom docml and css to provide our own style to the list items
-    bool widgetmlLoaded = 
+    bool widgetmlLoaded =
         HbStyleLoader::registerFilePath(":/resource/tstasksgriditem.widgetml");
     Q_ASSERT(widgetmlLoaded);
-    bool cssLoaded = 
+    bool cssLoaded =
         HbStyleLoader::registerFilePath(":/resource/tstasksgriditem.css");
     Q_ASSERT(cssLoaded);
 }
@@ -54,7 +54,7 @@
     mScreenshotLabel = new HbIconItem(this);
     mApplicationNameLabel = new HbTextItem(this);
     mDeleteButton = new HbPushButton(this);
-    HbFrameItem *screenshotFrame = new HbFrameItem(this);    
+    HbFrameItem *screenshotFrame = new HbFrameItem(this);
     screenshotFrame->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
     screenshotFrame->frameDrawer().setFrameGraphicsName("qtg_fr_multimedia_trans");
 
@@ -96,7 +96,7 @@
 {
     mScreenshotLabel->setIcon(modelIndex().data(Qt::DecorationRole).value<HbIcon>());
     mApplicationNameLabel->setText(modelIndex().data(Qt::DisplayRole).toString());
-    
+
     QVariant closableData(modelIndex().data(TsDataRoles::Closable));
     const bool isClosable(closableData.isValid() && closableData.toBool());
     if (isClosable) {
@@ -104,7 +104,7 @@
     } else {
         mDeleteButton->hide();
     }
-    
+
     QVariant activeData(modelIndex().data(TsDataRoles::Active));
     const bool isActive(activeData.isValid() && activeData.toBool());
     if (isActive) {
--- a/tsdevicedialog/tsdevicedialogplugin/tsdevicedialogplugin.pro	Wed Aug 18 10:39:24 2010 +0300
+++ b/tsdevicedialog/tsdevicedialogplugin/tsdevicedialogplugin.pro	Mon Sep 13 13:26:33 2010 +0300
@@ -59,7 +59,7 @@
     pluginstub.path = /resource/plugins/devicedialogs
     DEPLOYMENT += pluginstub
     
-    LIBS += -lxqsettingsmanager -lapparc -lapgrfx
+    LIBS += -lxqsettingsmanager
     
     BLD_INF_RULES.prj_exports += \
     "$${LITERAL_HASH}include <platform_paths.hrh>" \
--- a/tsdevicedialog/tsdevicedialogplugin/tsdevicedialogplugin.qrc	Wed Aug 18 10:39:24 2010 +0300
+++ b/tsdevicedialog/tsdevicedialogplugin/tsdevicedialogplugin.qrc	Mon Sep 13 13:26:33 2010 +0300
@@ -3,5 +3,6 @@
         <file>resource/layout.docml</file>
         <file>resource/tstasksgriditem.widgetml</file>
         <file>resource/tstasksgriditem.css</file>        
+        <file>resource/hbdialog.css</file>        
     </qresource>
 </RCC>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utils/tsimageutils/group/bld.inf	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,24 @@
+/*
+* 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_EXPORTS
+../inc/tsgraphicfilescalinghandler.h |../../../inc/tsgraphicfilescalinghandler.h
+
+PRJ_MMPFILES
+tsimageutils.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utils/tsimageutils/group/tsimageutils.mmp	Mon Sep 13 13:26:33 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:
+*
+*/
+TARGET        tsimageutils.lib
+TARGETTYPE    LIB
+
+MW_LAYER_SYSTEMINCLUDE
+
+USERINCLUDE   ../inc
+
+SOURCEPATH    ../src
+SOURCE        tsgraphicfilescalinghandler.cpp
+
+#ifdef ENABLE_ABIV2_MODE
+DEBUGGABLE_UDEBONLY
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utils/tsimageutils/inc/tsgraphicfilescalinghandler.h	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,166 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description :
+ *
+ */
+#ifndef TSGRAPHICFILESCALINGHANDLER_H
+#define TSGRAPHICFILESCALINGHANDLER_H
+
+#include <e32base.h>
+
+class RFs;
+class CImageDecoder;
+class CFbsBitmap;
+class CBitmapRotator;
+class CBitmapScaler;
+
+/**
+ * Interface to observer contain
+ * ImageReadyCallBack function return error code and scaled/resized bitmap.
+ */
+class MImageReadyCallBack
+    {
+public:
+    virtual void ImageReadyCallBack( TInt aError, const CFbsBitmap* aBitmap ) = 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,
+        };
+
+private:
+    /**
+     * Active object current operation.
+     */
+    enum TCurrentOperation{
+        ENone = 0,
+        EConvertBitmapFromFile,
+        ERotate,
+        EScale
+    };
+
+public:
+    ~CTsGraphicFileScalingHandler();
+
+    static CTsGraphicFileScalingHandler* NewL(MImageReadyCallBack &aNotify,
+        RFs &aFs,
+        const TDesC &aFileName,
+        const TDesC8& aMimeType,
+        const TSize &aNewSize,
+        TKindOfScaling aKindOfScaling = CTsGraphicFileScalingHandler::EIgnoreAspectRatio,
+        TInt aRotation = 0);
+    
+    static CTsGraphicFileScalingHandler* NewLC(MImageReadyCallBack &aNotify,
+        RFs &aFs,
+        const TDesC &aFileName,
+        const TDesC8& aMimeType,
+        const TSize &aNewSize,
+        TKindOfScaling aKindOfScaling = CTsGraphicFileScalingHandler::EIgnoreAspectRatio,
+        TInt aRotation = 0);
+
+    
+    static CTsGraphicFileScalingHandler* NewL(MImageReadyCallBack &aNotify,
+        const CFbsBitmap &aInputFbsBitmap,
+        const TSize &aNewSize,
+        TKindOfScaling aKindOfScaling = CTsGraphicFileScalingHandler::EIgnoreAspectRatio,
+        TInt aRotation = 0);
+     static CTsGraphicFileScalingHandler* NewLC(MImageReadyCallBack &aNotify,
+        const CFbsBitmap &aInputFbsBitmap,
+        const TSize &aNewSize,
+        TKindOfScaling aKindOfScaling = CTsGraphicFileScalingHandler::EIgnoreAspectRatio,
+        TInt aRotation = 0);
+
+protected:
+    void DoCancel();
+    void RunL();
+    TInt RunError(TInt);
+
+private:
+    void ConstructL( RFs& aFs, const TDesC& aFileName, const TDesC8& aMimeType );
+    void ConstructL( const CFbsBitmap& aInputFbsBitmap );
+    CTsGraphicFileScalingHandler( MImageReadyCallBack& aNotify,
+                                  const TSize& aNewSize,
+        TKindOfScaling aKindOfScaling = CTsGraphicFileScalingHandler::EIgnoreAspectRatio,
+        TInt aRotation = 0);
+    void DecodingOperationL( RFs& aFs, const TDesC& aFileName, const TDesC8& aMimeType );
+
+    void ScalingOperationL();
+
+    void RotationOperationL();
+    
+    TInt RotationMode()const;
+    
+    TBool IsSupportedRotationMode() const;
+    
+    TSize NewSizeToScalingOperation();
+
+    void FixForDisplayModeNotSupportedByScalingOperation();
+
+private:
+    /**
+     * Reference to observer implementation - return error code and output bitmap.
+     */
+    MImageReadyCallBack& iNotify;
+    /**
+     * Pointer to decoder used by decoding graphic file algorithm.
+     */
+    CImageDecoder* iImageDecoder;
+    /**
+     * Pointer to input bitmap - before decoding/scaling operation/s.
+     */
+    CFbsBitmap* iInputBitmap;
+    /**
+     * Pointer to output bitmap - returned in mNotify object.
+     */
+    CFbsBitmap* iOutputBitmap;
+    /**
+     * Pointer to CBitmapScaler calss used by scaling graphic file algorithm.
+     */
+    CBitmapScaler* iBitmapScaler;
+    
+    CBitmapRotator* iBitmapRotator;
+    /**
+     * New size of output graphic file.
+     */
+    TSize iNewSize;
+    /**
+     * Kind of graphic file scaling described above.
+     */
+    TBool iKindOfScaling;
+    
+    const TInt iRotation;
+    /**
+     * Active object current operation.
+     */
+    TCurrentOperation iCurrentOperation;
+    };
+
+#endif // TSGRAPHICFILESCALINGHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utils/tsimageutils/src/tsgraphicfilescalinghandler.cpp	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,413 @@
+/*
+ * 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 <bitmaptransforms.h>
+#include <imageconversion.h>
+
+#include "tsgraphicfilescalinghandler.h"
+// -----------------------------------------------------------------------------
+/**
+ * Private constructor.
+ * Parameters - the same meaning as in appropriate NewL/NewLC functions.
+ */
+CTsGraphicFileScalingHandler::CTsGraphicFileScalingHandler(
+                                MImageReadyCallBack &aNotify,
+                                const TSize &aNewSize,
+                                TKindOfScaling aKindOfScaling,
+                                TInt aRotation )
+:
+    CActive( EPriorityNormal ),
+    iNotify( aNotify ),
+    iNewSize( aNewSize ),
+    iKindOfScaling( aKindOfScaling ),
+    iRotation( aRotation ),
+    iCurrentOperation( ENone )
+    {
+    CActiveScheduler::Add(this);
+    }
+
+// -----------------------------------------------------------------------------
+/**
+* Destructor.
+*/
+CTsGraphicFileScalingHandler::~CTsGraphicFileScalingHandler()
+    {
+    Cancel();
+    delete iInputBitmap;
+    delete iOutputBitmap;
+    delete iImageDecoder;
+    delete iBitmapScaler;
+    delete iBitmapRotator;
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * 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.
+ * aRotation - requested rotation angle
+ */
+CTsGraphicFileScalingHandler* CTsGraphicFileScalingHandler::NewL(
+                                                MImageReadyCallBack &aNotify,
+                                                RFs &aFs,
+                                                const TDesC &aFileName,
+                                                const TDesC8& aMimeType,
+                                                const TSize &aNewSize,
+                                                TKindOfScaling aKindOfScaling,
+                                                TInt aRotation
+                                                )
+    {
+    CTsGraphicFileScalingHandler *self = 
+                            CTsGraphicFileScalingHandler::NewLC(aNotify,
+                                                                aFs,
+                                                                aFileName,
+                                                                aMimeType,
+                                                                aNewSize,
+                                                                aKindOfScaling,
+                                                                aRotation );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * 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.
+ * aRotation - requested rotation angle
+ */
+CTsGraphicFileScalingHandler* CTsGraphicFileScalingHandler::NewLC(
+                                                MImageReadyCallBack &aNotify,
+                                                RFs &aFs,
+                                                const TDesC &aFileName,
+                                                const TDesC8& aMimeType,
+                                                const TSize &aNewSize,
+                                                TKindOfScaling aKindOfScaling,
+                                                TInt aRotation )
+    {
+    CTsGraphicFileScalingHandler *self = 
+                    new (ELeave) CTsGraphicFileScalingHandler( aNotify,
+                                                               aNewSize,
+                                                               aKindOfScaling,
+                                                               aRotation );
+
+    CleanupStack::PushL( self );
+    self->ConstructL( aFs, aFileName, aMimeType );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Functions construct active objest instance and made asynchronous operation/s.
+ * Parameters - the same meaning as in appropriate NewL/NewLC functions.
+ */
+void CTsGraphicFileScalingHandler::ConstructL( RFs &aFs, 
+                                               const TDesC &aFileName, 
+                                               const TDesC8& aMimeType )
+    {
+    if( 0 == aFileName.Length()
+         || EFalse == aFs.IsValidName( aFileName ) )
+        {
+        User::Leave( KErrPathNotFound );
+        }
+
+    if( 0 == aMimeType.Length() )
+        {
+        User::Leave( KErrBadName );
+        }
+
+    if( 0 >= iNewSize.iWidth || 0 >= iNewSize.iHeight )
+        {
+        User::Leave(KErrCorrupt);
+        }
+    iInputBitmap = new(ELeave)CFbsBitmap();
+    DecodingOperationL( aFs, aFileName, aMimeType );
+    SetActive();
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Exported from dll constructors for activation graphic file scaling.
+ * aNotify         - reference to observer implementation.
+ * aInputFbsBitmap - reference to pattern CFbsBitmap.
+ * aNewSize        - new size of output graphic file.
+ * aKindOfScaling  - kind of graphic file scaling described above.
+ * aRotation - requested rotation angle
+ */
+CTsGraphicFileScalingHandler* CTsGraphicFileScalingHandler::NewL(
+                                        MImageReadyCallBack &aNotify,
+                                        const CFbsBitmap &aInputFbsBitmap,
+                                        const TSize &aNewSize,
+                                        TKindOfScaling aKindOfScaling,
+                                        TInt aRotation)
+
+{
+    CTsGraphicFileScalingHandler *self = 
+                            CTsGraphicFileScalingHandler::NewLC( aNotify,
+                                                                 aInputFbsBitmap,
+                                                                 aNewSize,
+                                                                 aKindOfScaling,
+                                                                aRotation );
+    CleanupStack::Pop( self );
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Exported from dll constructors for activation graphic file scaling.
+ * aNotify         - reference to observer implementation.
+ * aInputFbsBitmap - reference to pattern CFbsBitmap.
+ * aNewSize        - new size of output graphic file.
+ * aKindOfScaling  - kind of graphic file scaling described above.
+ * aRotation - requested rotation angle
+ */
+CTsGraphicFileScalingHandler* CTsGraphicFileScalingHandler::NewLC(
+                                            MImageReadyCallBack &aNotify,
+                                            const CFbsBitmap &aInputFbsBitmap,
+                                            const TSize &aNewSize,
+                                            TKindOfScaling aKindOfScaling,
+                                            TInt aRotation)
+    {
+    CTsGraphicFileScalingHandler *self = 
+                            new (ELeave) CTsGraphicFileScalingHandler(
+                                                               aNotify,
+                                                               aNewSize,
+                                                               aKindOfScaling,
+                                                               aRotation );
+    CleanupStack::PushL( self );
+    self->ConstructL( aInputFbsBitmap );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Functions construct active objest instance and made asynchronous operation/s.
+ * Parameters - the same meaning as in appropriate NewL/NewLC functions.
+ */
+void CTsGraphicFileScalingHandler::ConstructL( const CFbsBitmap &aInputFbsBitmap )
+    {
+    if( 0 >= iNewSize.iWidth || 0 >= iNewSize.iHeight)
+        {
+        User::Leave( KErrCorrupt );
+        }
+
+    iInputBitmap = new(ELeave)CFbsBitmap();
+    User::LeaveIfError( iInputBitmap->Duplicate( aInputFbsBitmap.Handle() ) );
+
+    IsSupportedRotationMode() ? RotationOperationL() : ScalingOperationL();
+    SetActive();
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Cancels the wait for completion of an outstanding request.
+ */
+void CTsGraphicFileScalingHandler::DoCancel()
+    {
+    switch(iCurrentOperation)
+        {
+    case EConvertBitmapFromFile:
+        iImageDecoder->Cancel();
+        break;
+    case EScale:
+        iBitmapScaler->Cancel();
+        break;
+        }
+    iNotify.ImageReadyCallBack( KErrCancel, 0 );
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Handles an active object’s request completion event.
+ */
+void CTsGraphicFileScalingHandler::RunL()
+    {
+    User::LeaveIfError(iStatus.Int());
+
+    switch (iCurrentOperation)
+        {
+    case EConvertBitmapFromFile:
+            delete iImageDecoder;
+            iImageDecoder = 0;
+            
+            IsSupportedRotationMode() ? RotationOperationL() : ScalingOperationL();
+            SetActive();
+            break;
+    
+    case ERotate:
+            delete iBitmapRotator;
+            iBitmapRotator = 0;
+            
+            ScalingOperationL();
+            SetActive();
+            break;
+    
+    case EScale:
+            iCurrentOperation = ENone;
+            delete iBitmapScaler;
+            iBitmapScaler = 0;
+            delete iInputBitmap;
+            iInputBitmap = 0;
+            if (iKindOfScaling == CTsGraphicFileScalingHandler::EKeepAspectRatioByExpanding) 
+                {
+                User::LeaveIfError(iOutputBitmap->Resize(iNewSize));
+                }
+            iNotify.ImageReadyCallBack(iStatus.Int(), iOutputBitmap);
+            break;
+        
+        }
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Action to made before decoding graphic file operation.
+ * Parameters - the same meaning as in appropriate NewL/NewLC functions.
+ */
+void CTsGraphicFileScalingHandler::DecodingOperationL( RFs &aFs, 
+                                                       const TDesC &aFileName, 
+                                                       const TDesC8& aMimeType )
+    {
+    // convert *.png to bitmap
+    iImageDecoder = CImageDecoder::FileNewL( aFs, aFileName, aMimeType );
+    const TFrameInfo frameInfo( iImageDecoder->FrameInfo( 0 ) );
+    iInputBitmap->Reset();
+    User::LeaveIfError( iInputBitmap->Create(frameInfo.iOverallSizeInPixels, 
+                                             frameInfo.iFrameDisplayMode ) );
+    iImageDecoder->Convert( &iStatus, *iInputBitmap, 0 );
+    iCurrentOperation = EConvertBitmapFromFile;
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Action to made before scaling graphic file operation.
+ */
+void CTsGraphicFileScalingHandler::ScalingOperationL()
+    {
+    iBitmapScaler = CBitmapScaler::NewL();
+    iBitmapScaler->SetQualityAlgorithm( CBitmapScaler::EMaximumQuality );
+    FixForDisplayModeNotSupportedByScalingOperation();
+    iOutputBitmap = new (ELeave)CFbsBitmap();
+    User::LeaveIfError(iOutputBitmap->Create( NewSizeToScalingOperation(), 
+                                              iInputBitmap->DisplayMode() ) );
+    iBitmapScaler->Scale( &iStatus, *iInputBitmap, *iOutputBitmap, EFalse );
+    iCurrentOperation = EScale;
+    }
+
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+//
+void CTsGraphicFileScalingHandler::RotationOperationL()
+    {
+    const CBitmapRotator::TRotationAngle rotation =
+        static_cast<CBitmapRotator::TRotationAngle>( RotationMode() );
+    iBitmapRotator = CBitmapRotator::NewL();
+    iBitmapRotator->Rotate( &iStatus, 
+                            *iInputBitmap, 
+                            rotation );
+    iCurrentOperation = ERotate;
+    }
+
+// -----------------------------------------------------------------------------
+//
+TInt CTsGraphicFileScalingHandler::RotationMode()const
+    {
+    const TInt rotation(iRotation%360);
+    TInt retVal(CBitmapRotator::EMirrorHorizontalAxis);
+    if( 270 <= rotation )
+        {
+        retVal = CBitmapRotator::ERotation270DegreesClockwise;
+        }
+    else if( 180 <= rotation )
+        {
+        retVal = CBitmapRotator::ERotation180DegreesClockwise;
+        }
+    else if( 90 <= rotation )
+        {
+        retVal = CBitmapRotator::ERotation90DegreesClockwise;
+        }
+    return retVal;
+    }
+
+// -----------------------------------------------------------------------------
+TBool CTsGraphicFileScalingHandler::IsSupportedRotationMode() const
+    {
+    TBool retVal(EFalse);
+    switch( RotationMode() )
+        {
+        case CBitmapRotator::ERotation90DegreesClockwise:
+        case CBitmapRotator::ERotation180DegreesClockwise:
+        case CBitmapRotator::ERotation270DegreesClockwise:
+            retVal = ETrue;
+            break;
+        }
+    return retVal;
+    }
+// -----------------------------------------------------------------------------
+/**
+ * Fix for TDisplayMode == EColor16MAP not supported by scaling operation!
+ * ! ! ! ADD OTHER NOT SUPPORTED DISPLAY MODES ! ! !
+ */
+void CTsGraphicFileScalingHandler::FixForDisplayModeNotSupportedByScalingOperation()
+    {
+    if (EColor16MAP == iInputBitmap->DisplayMode()) 
+        {
+        iInputBitmap->SetDisplayMode(EColor16MA);
+        }
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Algorithm to determine output bitmap (returned in ImageReadyCallBack) size
+ * after scaling operation.
+ */
+TSize CTsGraphicFileScalingHandler::NewSizeToScalingOperation()
+    {
+    TSize originalSize = iInputBitmap->SizeInPixels();
+    float widthFactor = iNewSize.iWidth / (float)originalSize.iWidth;
+    float heightFactor = iNewSize.iHeight / (float)originalSize.iHeight;
+    TSize retSize(iNewSize);
+
+    if(CTsGraphicFileScalingHandler::EKeepAspectRatio == iKindOfScaling) 
+       {
+       retSize = (widthFactor < heightFactor) ?
+                 TSize(iNewSize.iWidth, widthFactor * originalSize.iHeight) :
+                 TSize(heightFactor * originalSize.iWidth, iNewSize.iHeight);
+       } 
+    else if (CTsGraphicFileScalingHandler::EKeepAspectRatioByExpanding == iKindOfScaling) 
+       {
+       retSize = (widthFactor < heightFactor) ?
+                 TSize(heightFactor * originalSize.iWidth, iNewSize.iHeight) :
+                 TSize(iNewSize.iWidth, widthFactor * originalSize.iHeight);
+       }
+    return retSize;
+    }
+// -----------------------------------------------------------------------------
+/**
+ * Handles a leave occurring in the request completion event handler RunL().
+ */
+TInt CTsGraphicFileScalingHandler::RunError( TInt aError )
+    {
+    iNotify.ImageReadyCallBack( aError, 0 );
+    return KErrNone;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utils/tsimageutils/tsimageutils.pro	Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,18 @@
+#
+# 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/utils/utils.pro	Mon Sep 13 13:26:33 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: 
+#
+
+TEMPLATE = subdirs
+
+CONFIG += ordered
+
+SUBDIRS += tsimageutils