Revision: 201019
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 27 May 2010 13:11:12 +0300
changeset 80 397d00875918
parent 73 4bc7b118b3df
child 83 156f692b1687
Revision: 201019 Kit: 2010121
activityfw/activitydatabase/hsactivitydbclient/inc/hsactivitydbasyncrequestobserver.h
activityfw/activitydatabase/hsactivitydbclient/inc/hsactivitydbclient.h
activityfw/activitydatabase/hsactivitydbclient/s60/inc/hsactivitydbasyncrequest_p.h
activityfw/activitydatabase/hsactivitydbclient/s60/inc/hsactivitydbclient_p.h
activityfw/activitydatabase/hsactivitydbclient/s60/src/hsactivitydbasyncrequest_p.cpp
activityfw/activitydatabase/hsactivitydbclient/s60/src/hsactivitydbclient_p.cpp
activityfw/activitydatabase/hsactivitydbclient/src/hsactivitydbclient.cpp
activityfw/activitydatabase/hsactivitydbserver/inc/activitygraphicfilescaling.h
activityfw/activitydatabase/hsactivitydbserver/inc/activitystoragesynctask.h
activityfw/activitydatabase/hsactivitydbserver/src/activitybroadcasttask.cpp
activityfw/activitydatabase/hsactivitydbserver/src/activitydataprovidertask.cpp
activityfw/activitydatabase/hsactivitydbserver/src/activitygraphicfilescaling.cpp
activityfw/activitydatabase/hsactivitydbserver/src/activityobservertask.cpp
activityfw/activitydatabase/hsactivitydbserver/src/activitysession.cpp
activityfw/activitydatabase/hsactivitydbserver/src/activitystorageasynctask.cpp
activityfw/activitydatabase/hsactivitydbserver/src/activitystoragesynctask.cpp
activityfw/activitydatabase/hsactivitydbserver/src/activitythumbnailtask.cpp
activityfw/activitydatabase/inc/activitycmd.h
activityfw/activitydatabase/inc/hsactivitydbclientinterface.h
activityfw/activitydatabase/s60/inc/hsserializer.h
activityfw/activitydatabase/s60/src/hsserializer.cpp
activityfw/activityfw.pro
activityfw/activityserviceplugin/activityclient.cpp
activityfw/activityserviceplugin/activityclient.h
activityfw/activityserviceplugin/activityclient_p.cpp
activityfw/activityserviceplugin/activityclient_p.h
activityfw/activityserviceplugin/activitydatastorage.cpp
activityfw/activityserviceplugin/activitydatastorage.h
activityfw/activityserviceplugin/activitymanager.cpp
activityfw/activityserviceplugin/activitymanager.h
activityfw/activityserviceplugin/activitymanager_p.cpp
activityfw/activityserviceplugin/activitymanager_p.h
activityfw/activityserviceplugin/activityserviceplugin.cpp
activityfw/activityserviceplugin/activityserviceplugin.h
activityfw/activityserviceplugin/activityserviceplugin.pro
activityfw/activityserviceplugin/activityserviceplugin.xml
activityfw/activityserviceplugin/applicationlauncher.cpp
activityfw/activityserviceplugin/applicationlauncher.h
activityfw/activityserviceplugin/data/activityserviceplugin.xml
activityfw/activityserviceplugin/inc/activityclient.h
activityfw/activityserviceplugin/inc/activityclient_p.h
activityfw/activityserviceplugin/inc/activitydatastorage.h
activityfw/activityserviceplugin/inc/activitymanager.h
activityfw/activityserviceplugin/inc/activitymanager_p.h
activityfw/activityserviceplugin/inc/activityserviceplugin.h
activityfw/activityserviceplugin/inc/applicationlauncher.h
activityfw/activityserviceplugin/s60/activitydatabase_p.cpp
activityfw/activityserviceplugin/s60/activitydatabase_p.h
activityfw/activityserviceplugin/s60/activityserverclient_p.cpp
activityfw/activityserviceplugin/s60/activityserverclient_p.h
activityfw/activityserviceplugin/s60/applicationlauncher_p.cpp
activityfw/activityserviceplugin/s60/applicationlauncher_p.h
activityfw/activityserviceplugin/s60/inc/activitydatabase_p.h
activityfw/activityserviceplugin/s60/inc/activityserverclient_p.h
activityfw/activityserviceplugin/s60/inc/applicationlauncher_p.h
activityfw/activityserviceplugin/s60/src/activitydatabase_p.cpp
activityfw/activityserviceplugin/s60/src/activityserverclient_p.cpp
activityfw/activityserviceplugin/s60/src/applicationlauncher_p.cpp
activityfw/activityserviceplugin/src/activityclient.cpp
activityfw/activityserviceplugin/src/activityclient_p.cpp
activityfw/activityserviceplugin/src/activitydatastorage.cpp
activityfw/activityserviceplugin/src/activitymanager.cpp
activityfw/activityserviceplugin/src/activitymanager_p.cpp
activityfw/activityserviceplugin/src/activityserviceplugin.cpp
activityfw/activityserviceplugin/src/applicationlauncher.cpp
activityfw/activityserviceplugin/symbianinstaller/activityserviceinstaller/activityserviceinstaller.qrc
activityfw/activityserviceplugin/win/activitydatabase_p.cpp
activityfw/activityserviceplugin/win/activitydatabase_p.h
activityfw/activityserviceplugin/win/applicationlauncher_p.cpp
activityfw/activityserviceplugin/win/applicationlauncher_p.h
activityfw/activityserviceplugin/win/inc/activitydatabase_p.h
activityfw/activityserviceplugin/win/inc/applicationlauncher_p.h
activityfw/activityserviceplugin/win/src/activitydatabase_p.cpp
activityfw/activityserviceplugin/win/src/applicationlauncher_p.cpp
activityfw/orbitintegration/hbactivityplugin/hbactivityplugin.qrc
activityfw/orbitintegration/hbactivityplugin/hbactivityplugininterface_p.h
activityfw/rom/activitymanager_core.iby
activityfw/sis/activitymanager.pkg
activityfw/sis/stubs/activitymanager_stub.pkg
activityfw/sis/stubs/activitymanager_stub.sis
activityfw/tsutils/bwins/tsutilsu.def
activityfw/tsutils/eabi/tsutilsu.def
activityfw/tsutils/group/bld.inf
activityfw/tsutils/group/tsutils.mmp
activityfw/tsutils/inc/tsgraphicfilescalinghandler.h
activityfw/tsutils/src/tsgraphicfilescalinghandler.cpp
activityfw/tsutils/tsutils.pro
contentstorage/bwins/camenuu.def
contentstorage/bwins/cautilsu.def
contentstorage/caclient/caclient.pri
contentstorage/caclient/inc/canotifier_p.h
contentstorage/caclient/s60/src/camenuiconmifutility.cpp
contentstorage/caclient/s60/src/camenuiconutility.cpp
contentstorage/caclient/src/caicondescription.cpp
contentstorage/caclient/src/caitemmodel.cpp
contentstorage/caclient/src/canotifier.cpp
contentstorage/caclient/src/caservice.cpp
contentstorage/caclient/stub/inc/hswidgetcomponentparser.h
contentstorage/caclient/stub/src/hswidgetcomponentparser.cpp
contentstorage/cahandler/app/app.pro
contentstorage/cahandler/app/inc/caapphandler.h
contentstorage/cahandler/app/inc/cauninstalloperation.h
contentstorage/cahandler/app/src/caapphandler.cpp
contentstorage/cahandler/app/src/cauninstalloperation.cpp
contentstorage/cahandler/url/url.pro
contentstorage/casoftwareregistry/casoftwareregistry.pri
contentstorage/casoftwareregistry/casoftwareregistry.pro
contentstorage/casoftwareregistry/casoftwareregistry_s60.pri
contentstorage/casoftwareregistry/casoftwareregistry_stub.pri
contentstorage/casoftwareregistry/s60/inc/casoftwareregistry_p.h
contentstorage/casoftwareregistry/s60/src/casoftwareregistry_p.cpp
contentstorage/casoftwareregistry/src/casoftwareregistry.cpp
contentstorage/casoftwareregistry/stub/inc/casoftwareregistry_p.h
contentstorage/casoftwareregistry/stub/src/casoftwareregistry_p.cpp
contentstorage/casrv/caappscanner/group/caappscanner.mmp
contentstorage/casrv/caappscanner/inc/casrvappscanner.h
contentstorage/casrv/caappscanner/src/casrvappscanner.cpp
contentstorage/casrv/calocalizerscanner/inc/calocalizerscannerproxy.h
contentstorage/casrv/calocalizerscanner/src/calocalizerscannerproxy.cpp
contentstorage/casrv/casrvmgr/bwins/casrvmanageru.def
contentstorage/casrv/casrvmgr/eabi/casrvmanageru.def
contentstorage/casrv/casrvmgr/inc/casrvmanager.h
contentstorage/casrv/casrvmgr/src/casrvmanager.cpp
contentstorage/casrv/causifscanner/inc/causifscanner.h
contentstorage/casrv/causifscanner/src/causifscanner.cpp
contentstorage/casrv/cawidgetscanner/group/cawidgetscanner.mmp
contentstorage/casrv/cawidgetscanner/inc/cawidgetdescription.h
contentstorage/casrv/cawidgetscanner/inc/cawidgetstoragehandler.h
contentstorage/casrv/cawidgetscanner/src/cawidgetdescription.cpp
contentstorage/casrv/cawidgetscanner/src/cawidgetscannerparser.cpp
contentstorage/casrv/cawidgetscanner/src/cawidgetstoragehandler.cpp
contentstorage/castorage/conf/castoragedb.confml
contentstorage/castorage/conf/castoragedb_templates/castoragedb_variant.sql
contentstorage/castorage/data/castorage.db
contentstorage/castorage/data/castoragedb_create.sql
contentstorage/castorage/data/castoragedb_variant.sql
contentstorage/castorage/data/castoragedb_variant_test.bat
contentstorage/castorage/data/castoragedb_variant_test.sql
contentstorage/castorage/inc/casqlcommands.h
contentstorage/castorage/inc/casqlitestorage.h
contentstorage/castorage/inc/casqlquery.h
contentstorage/castorage/inc/casqlquerycreator.h
contentstorage/castorage/inc/castorage.h
contentstorage/castorage/src/casqlitestorage.cpp
contentstorage/castorage/src/casqlquery.cpp
contentstorage/castorage/src/casqlquerycreator.cpp
contentstorage/cautils/inc/calocalizationentry.h
contentstorage/cautils/src/calocalizationentry.cpp
contentstorage/contentstorage.pro
contentstorage/eabi/camenuu.def
contentstorage/eabi/cautilsu.def
contentstorage/extinc/casathandler.h
contentstorage/group/group.pro
contentstorage/inc/cadef.h
contentstorage/srvinc/casrvmmchistory.h
contentstorage/srvinc/castorageproxy.h
contentstorage/srvsrc/casrv.cpp
contentstorage/srvsrc/casrvmmchistory.cpp
contentstorage/srvsrc/castorageproxy.cpp
homescreensrv.pro
homescreensrv_plat/contentstorage_api/casoftwareregistry.h
homescreensrv_plat/contentstorage_api/contentstorage_api.pri
homescreensrv_plat/homescreen_information_api/inc/homescreendomainpskeys.h
rom/homescreensrv_core.iby
sis/homescreensrv.pkg
tstaskmonitor/client/client.pri
tstaskmonitor/client/client.pro
tstaskmonitor/client/inc/tstask.h
tstaskmonitor/client/inc/tstaskmonitor.h
tstaskmonitor/client/inc/tstaskmonitor_global.h
tstaskmonitor/client/s60/inc/tsapplicationtask.h
tstaskmonitor/client/s60/inc/tstaskmonitor_p.h
tstaskmonitor/client/s60/inc/tstaskmonitorclient.h
tstaskmonitor/client/s60/inc/tstaskmonitorclientimpl.h
tstaskmonitor/client/s60/inc/tstaskmonitorobserver.h
tstaskmonitor/client/s60/inc/tstaskmonitorsession.h
tstaskmonitor/client/s60/src/tsapplicationtask.cpp
tstaskmonitor/client/s60/src/tstask.cpp
tstaskmonitor/client/s60/src/tstaskmonitor_p.cpp
tstaskmonitor/client/s60/src/tstaskmonitorclient.cpp
tstaskmonitor/client/s60/src/tstaskmonitorclientimpl.cpp
tstaskmonitor/client/s60/src/tstaskmonitorsession.cpp
tstaskmonitor/client/src/tstaskmonitor.cpp
tstaskmonitor/client/stub/inc/tsfswentry.h
tstaskmonitor/client/stub/inc/tstaskmonitor_p.h
tstaskmonitor/client/stub/src/tsfswentry.cpp
tstaskmonitor/client/stub/src/tstask.cpp
tstaskmonitor/client/stub/src/tstaskmonitor_p.cpp
tstaskmonitor/inc/tstaskmonitorglobals.h
tstaskmonitor/rom.pri
tstaskmonitor/rom/tstaskmonitor_core.iby
tstaskmonitor/server/group/bld.inf
tstaskmonitor/server/group/hsrunningappmonitor.mmp
tstaskmonitor/server/inc/hsdataobserver.h
tstaskmonitor/server/inc/hsdataobservertask.h
tstaskmonitor/server/inc/hsdataprovider.h
tstaskmonitor/server/inc/hsdataprovidertask.h
tstaskmonitor/server/inc/hsrunningappserver.h
tstaskmonitor/server/inc/hsrunningappsession.h
tstaskmonitor/server/inc/tsfswdatalist.h
tstaskmonitor/server/inc/tsfswengine.h
tstaskmonitor/server/inc/tsfswmonitor.h
tstaskmonitor/server/inc/tsfswobservers.h
tstaskmonitor/server/inc/tsrunningappstorage.h
tstaskmonitor/server/server.pro
tstaskmonitor/server/src/hsdataobservertask.cpp
tstaskmonitor/server/src/hsdataprovidertask.cpp
tstaskmonitor/server/src/hsrunningappserver.cpp
tstaskmonitor/server/src/hsrunningappsession.cpp
tstaskmonitor/server/src/main.cpp
tstaskmonitor/server/src/tsfswdatalist.cpp
tstaskmonitor/server/src/tsfswengine.cpp
tstaskmonitor/server/src/tsfswmonitor.cpp
tstaskmonitor/server/src/tsrunningappstorage.cpp
tstaskmonitor/server/tsrc/tsrc.pro
tstaskmonitor/sis/stubs/createstubs.bat
tstaskmonitor/sis/stubs/taskmonitor_stub.pkg
tstaskmonitor/sis/stubs/taskmonitor_stub.sis
tstaskmonitor/sis/taskmonitor.SIS
tstaskmonitor/sis/taskmonitor.pkg
tstaskmonitor/tstaskmonitor.pro
tstaskmonitor/utils/inc/tsfswentry.h
tstaskmonitor/utils/inc/tsutils.h
tstaskmonitor/utils/src/tsfswentry.cpp
--- a/activityfw/activitydatabase/hsactivitydbclient/inc/hsactivitydbasyncrequestobserver.h	Fri May 14 16:10:06 2010 +0300
+++ b/activityfw/activitydatabase/hsactivitydbclient/inc/hsactivitydbasyncrequestobserver.h	Thu May 27 13:11:12 2010 +0300
@@ -43,5 +43,13 @@
                                         int requestType,
                                         const QPixmap& pixmap, 
                                         void* userData)=0;
+    
+    /**
+     * Function inform observer about asynchronous request results
+     * @param result - request result
+     * @param requestType - request type
+     */
+    virtual void asyncRequestCompleated(int result,
+                                        int requestType)=0;
 };
 #endif // HSACTIVITYDBASYNCREQUESTOBSERVER_H
--- a/activityfw/activitydatabase/hsactivitydbclient/inc/hsactivitydbclient.h	Fri May 14 16:10:06 2010 +0300
+++ b/activityfw/activitydatabase/hsactivitydbclient/inc/hsactivitydbclient.h	Thu May 27 13:11:12 2010 +0300
@@ -65,6 +65,14 @@
      * @see int HsActivityDbAsyncRequestObserver::asyncRequestCompleated(int, int, QPixmap&)
      */
     void asyncRequestCompleated(int, int, const QPixmap&, void*);
+    
+
+    /**
+     * Interface implementation.
+     * @see int HsActivityDbAsyncRequestObserver::asyncRequestCompleated(int, int)
+     */
+    void asyncRequestCompleated(int result,
+                                int requestType);
 
     /**
      * Interface implementation.
@@ -107,8 +115,8 @@
      * Interface implementation.
      * @see int HsActivityDbClientInterface::waitActivity(const QVariantHash &)
      */
-    int waitActivity(const QVariantHash &);
-
+    int waitActivity(const QVariantHash &activity);
+    
     /**
      * Interface implementation.
      * @see int HsActivityDbClientInterface::launchActivity(const QVariantHash &)
@@ -119,6 +127,8 @@
      */
     //getThumbnail(resolution, thumbnailPath, "image/png", data)
     int getThumbnail(QSize size, QString imagePath, QString mimeType, void* userDdata);
+    
+    int notifyDataChange();
 
 signals:
     /**
@@ -133,6 +143,8 @@
      */
     void thumbnailRequested(QPixmap thumbnailPixmap, void *userData);
     
+    void dataChanged();
+    
 private:
     /**
      * Private client implementation.
--- a/activityfw/activitydatabase/hsactivitydbclient/s60/inc/hsactivitydbasyncrequest_p.h	Fri May 14 16:10:06 2010 +0300
+++ b/activityfw/activitydatabase/hsactivitydbclient/s60/inc/hsactivitydbasyncrequest_p.h	Thu May 27 13:11:12 2010 +0300
@@ -34,32 +34,32 @@
     
     enum TAsyncRequest{
         EWaitActivity = WaitActivity,
-        EWaitGetThumbnail = GetThumbnail
+        EWaitGetThumbnail = GetThumbnail,
+        ENotifyDataChange = NotifyChange
     };
     
 private:
-    /**
-     * First step constructor
-     */
     static HsActivityDbAsyncRequestPrivate*
-    NewL(HsActivityDbAsyncRequestObserver &, 
-         HsActivityDbClientPrivate &,
-         TAsyncRequest,
-         void* userData = 0);
+    NewLC(HsActivityDbAsyncRequestObserver &, 
+          HsActivityDbClientPrivate &,
+          TAsyncRequest,
+          void* userData = 0);
     
 public:
     
-    static HsActivityDbAsyncRequestPrivate*
-    newWaitActivityL(HsActivityDbAsyncRequestObserver &, 
-            HsActivityDbClientPrivate &);
+    static void waitActivityLD(HsActivityDbAsyncRequestObserver &, 
+                               HsActivityDbClientPrivate &,
+                               const QVariantHash &);
+    
+    static void notifyDataChangeLD(HsActivityDbAsyncRequestObserver &, 
+                                   HsActivityDbClientPrivate &);
     
-    static void
-    getThumbnailLD(HsActivityDbAsyncRequestObserver &observer,
-         HsActivityDbClientPrivate &session, 
-         QSize size, 
-         QString imagePath, 
-         QString  mimeType, 
-         void *userDdata);
+    static void getThumbnailLD(HsActivityDbAsyncRequestObserver &,
+                               HsActivityDbClientPrivate &, 
+                               QSize, 
+                               const QString&, 
+                               const QString&, 
+                               void *);
     
 
     /**
@@ -67,20 +67,18 @@
      */
     ~HsActivityDbAsyncRequestPrivate();
 
+private:
     /**
      * Function create subscription to current ativity changes
      * @param condition - activity filetering rules
      */
     void waitActivity(const QVariantHash &condition);
-private:
+    
     /**
      */
     void getThumbnail(QSize size, QString imagePath, QString  mimeType);
-
-    /**
-     */
-    QPixmap copyPixmap(CFbsBitmap* bitmap);
     
+    void notifyDataChange();
 protected:
     /**
      * Interface implementation.
--- a/activityfw/activitydatabase/hsactivitydbclient/s60/inc/hsactivitydbclient_p.h	Fri May 14 16:10:06 2010 +0300
+++ b/activityfw/activitydatabase/hsactivitydbclient/s60/inc/hsactivitydbclient_p.h	Thu May 27 13:11:12 2010 +0300
@@ -89,6 +89,8 @@
     int waitActivity(const QVariantHash &activity);
     
     int getThumbnail(QSize size, QString imagePath, QString  mimeType, void *userDdata);
+    
+    int notifyDataChange();
 
     /**
      * Interface implementation.
@@ -102,6 +104,8 @@
      */
     int cancelWaitActivity();
     
+    int cancelNotifyDataChange();
+    
 public:
     /**
      * Function get cached data from server
@@ -174,11 +178,6 @@
     
     void getThumbnailL(QSize size, QString imagePath, QString  mimeType, void *userDdata);
 private:
-    /**
-     * Async request handler
-     * Own
-     */
-    HsActivityDbAsyncRequestPrivate *mAsyncDataHandler;
     RPointerArray<HsActivityDbAsyncRequestPrivate> mAsyncTasks;
     HsActivityDbAsyncRequestObserver& mObserver;
 };
--- a/activityfw/activitydatabase/hsactivitydbclient/s60/src/hsactivitydbasyncrequest_p.cpp	Fri May 14 16:10:06 2010 +0300
+++ b/activityfw/activitydatabase/hsactivitydbclient/s60/src/hsactivitydbasyncrequest_p.cpp	Thu May 27 13:11:12 2010 +0300
@@ -19,7 +19,7 @@
 #include "hsactivitydbclient_p.h"
 #include "hsactivitydbclient.h"
 #include <fbs.h>
-#include <xqconversions>
+#include <XQConversions>
 
 
 // -----------------------------------------------------------------------------
@@ -27,7 +27,7 @@
 // -----------------------------------------------------------------------------
 //
 HsActivityDbAsyncRequestPrivate*
-HsActivityDbAsyncRequestPrivate::NewL(HsActivityDbAsyncRequestObserver &observer,
+HsActivityDbAsyncRequestPrivate::NewLC(HsActivityDbAsyncRequestObserver &observer,
                                       HsActivityDbClientPrivate &session, 
                                       TAsyncRequest requestType,
                                       void* userData)
@@ -36,7 +36,6 @@
     new(ELeave)HsActivityDbAsyncRequestPrivate(observer, session, requestType, userData);
     CleanupStack::PushL(self);
     self->mDataBuf.CreateL(64);
-    CleanupStack::Pop(self);
     return self;
 }
 
@@ -44,12 +43,36 @@
 //
 // -----------------------------------------------------------------------------
 //
-HsActivityDbAsyncRequestPrivate*
-HsActivityDbAsyncRequestPrivate::newWaitActivityL(HsActivityDbAsyncRequestObserver & observer, 
-            HsActivityDbClientPrivate & session)
-    {
-    return HsActivityDbAsyncRequestPrivate::NewL(observer, session, EWaitActivity);
-    }
+void HsActivityDbAsyncRequestPrivate::waitActivityLD(
+                                HsActivityDbAsyncRequestObserver & observer, 
+                                HsActivityDbClientPrivate & session, 
+                                const QVariantHash &activity)
+{
+    HsActivityDbAsyncRequestPrivate *self =
+        HsActivityDbAsyncRequestPrivate::NewLC(observer, 
+                                               session, 
+                                               EWaitActivity);
+    self->mSession.PushL(self);
+    CleanupStack::Pop(self);
+    self->waitActivity(activity);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void HsActivityDbAsyncRequestPrivate::notifyDataChangeLD(
+                                   HsActivityDbAsyncRequestObserver &observer, 
+                                   HsActivityDbClientPrivate &session)
+{
+    HsActivityDbAsyncRequestPrivate *self = 
+        HsActivityDbAsyncRequestPrivate::NewLC(observer, 
+                                              session,
+                                              ENotifyDataChange);
+    self->mSession.PushL(self);
+    CleanupStack::Pop(self);
+    self->notifyDataChange();
+}
 
 // -----------------------------------------------------------------------------
 //
@@ -58,12 +81,14 @@
 void HsActivityDbAsyncRequestPrivate::getThumbnailLD(HsActivityDbAsyncRequestObserver &observer,
                                       HsActivityDbClientPrivate &session, 
                                       QSize size, 
-                                      QString imagePath, 
-                                      QString  mimeType, 
+                                      const QString &imagePath, 
+                                      const QString &mimeType, 
                                       void *userDdata)
 {
     HsActivityDbAsyncRequestPrivate *instance = 
-        HsActivityDbAsyncRequestPrivate::NewL(observer, session, EWaitGetThumbnail, userDdata);
+        HsActivityDbAsyncRequestPrivate::NewLC(observer, session, EWaitGetThumbnail, userDdata);
+    session.PushL(instance);
+    CleanupStack::Pop(instance);
     instance->getThumbnail( size, imagePath, mimeType);
 }
 
@@ -104,7 +129,10 @@
 void HsActivityDbAsyncRequestPrivate::DoCancel()
 {
     if (IsActive()) {
-        mSession.cancelWaitActivity();
+        switch (mRequestType) {
+        case EWaitActivity: mSession.cancelWaitActivity(); break;
+        case ENotifyDataChange: mSession.cancelNotifyDataChange(); break;
+        };
     }
 }
 
@@ -114,35 +142,45 @@
 //
 void HsActivityDbAsyncRequestPrivate::RunL()
 {
-    int requestResult(iStatus.Int());
-    if (KErrNone == requestResult) {
-        switch (mRequestType){
-        case WaitActivity: {
+    switch (mRequestType) {
+    case WaitActivity: {
+        QString data;
+        if (KErrNone == iStatus.Int()) {
             RBuf8 buff;
             CleanupClosePushL(buff);
-            QString data;
             if (0 < mDataSize()) {
                 buff.CreateL(mDataSize());
             }
             mSession.getData(mTaskId(), buff);
             data = QString::fromAscii(reinterpret_cast<const char *>(buff.Ptr()),
                                       buff.Length());
-            buff.Close();
-            mObserver.asyncRequestCompleated(requestResult, mRequestType, data);
             CleanupStack::PopAndDestroy(&buff);
-            break;
-            }
-        case EWaitGetThumbnail: {
+        }
+        mObserver.asyncRequestCompleated(iStatus.Int(), mRequestType, data);
+        mSession.Pop(this);
+        delete this;
+        break;
+        }
+    case EWaitGetThumbnail: {
+        QPixmap pixmap;
+        if (KErrNone == iStatus.Int()) {
             CFbsBitmap* bitmap = new (ELeave) CFbsBitmap;
             CleanupStack::PushL(bitmap);
             User::LeaveIfError(bitmap->Duplicate(mBitmapId()));
             mSession.getData(mTaskId(), mDataBuf);//ACK Bitmap copy
-            mObserver.asyncRequestCompleated(requestResult, mRequestType, QPixmap::fromSymbianCFbsBitmap(bitmap), mUserData);
+            pixmap = QPixmap::fromSymbianCFbsBitmap(bitmap);
             CleanupStack::PopAndDestroy(bitmap);
-            break;
-            }
+        }
+        mObserver.asyncRequestCompleated(iStatus.Int(), mRequestType, pixmap, mUserData);
+        mSession.Pop(this);
+        delete this;
+        break;
         }
+    case ENotifyDataChange: {
+        mObserver.asyncRequestCompleated(iStatus.Int(),mRequestType);
         mSession.Pop(this);
+        delete this;
+        }
     }
 }
 
@@ -174,3 +212,14 @@
     mBitmapMimeType = XQConversions::qStringToS60Desc8(mimeType);
     mSession.sendDataAsync(mRequestType, TIpcArgs(&mBitmapId, &mTaskId, mBitmapPath, mBitmapMimeType), iStatus);
 }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void HsActivityDbAsyncRequestPrivate::notifyDataChange()
+{
+    iStatus = KRequestPending;
+    SetActive();
+    mSession.sendDataAsync(ENotifyDataChange, TIpcArgs(), iStatus);
+}
--- a/activityfw/activitydatabase/hsactivitydbclient/s60/src/hsactivitydbclient_p.cpp	Fri May 14 16:10:06 2010 +0300
+++ b/activityfw/activitydatabase/hsactivitydbclient/s60/src/hsactivitydbclient_p.cpp	Thu May 27 13:11:12 2010 +0300
@@ -20,7 +20,7 @@
 #include "hsactivityglobals.h"
 #include "hsserializer.h"
 #include <qvariant.h>
-#include <xqconversions>
+#include <XQConversions>
 
 
 // -----------------------------------------------------------------------------
@@ -30,8 +30,7 @@
 HsActivityDbClientPrivate::HsActivityDbClientPrivate(HsActivityDbAsyncRequestObserver &observer):
     mObserver(observer)
 {
-    mAsyncDataHandler = HsActivityDbAsyncRequestPrivate::newWaitActivityL(
-            observer, *this);
+    
 }
 
 // -----------------------------------------------------------------------------
@@ -41,7 +40,6 @@
 HsActivityDbClientPrivate::~HsActivityDbClientPrivate()
 {
     mAsyncTasks.ResetAndDestroy();
-    delete mAsyncDataHandler;
     Close();
 }
 
@@ -156,6 +154,16 @@
 //
 // -----------------------------------------------------------------------------
 //
+int HsActivityDbClientPrivate::notifyDataChange()
+{
+    TRAPD(errNo,HsActivityDbAsyncRequestPrivate::notifyDataChangeLD(mObserver, *this);)
+    return errNo;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
 int HsActivityDbClientPrivate::launchActivity(const QVariantHash &activity)
 {
     TRAPD(errNo, execSimpleRequestL(LaunchActivity, activity);)
@@ -175,6 +183,15 @@
 //
 // -----------------------------------------------------------------------------
 //
+int HsActivityDbClientPrivate::cancelNotifyDataChange()
+{
+    return SendReceive(CancelNotify, TIpcArgs());
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
 void HsActivityDbClientPrivate::startServerL()
 {
     RProcess server;
@@ -295,11 +312,7 @@
 //
 void HsActivityDbClientPrivate::waitActivityL(const QVariantHash &activity)
 {
-    if (mAsyncDataHandler->IsActive()) {
-        User::Leave(KErrServerBusy);
-    } else {
-        mAsyncDataHandler->waitActivity(activity);
-    }
+    HsActivityDbAsyncRequestPrivate::waitActivityLD(mObserver,*this, activity);
 }
 
 // -----------------------------------------------------------------------------
--- a/activityfw/activitydatabase/hsactivitydbclient/src/hsactivitydbclient.cpp	Fri May 14 16:10:06 2010 +0300
+++ b/activityfw/activitydatabase/hsactivitydbclient/src/hsactivitydbclient.cpp	Thu May 27 13:11:12 2010 +0300
@@ -57,9 +57,13 @@
 {
     switch (requestType) {
         case WaitActivity:
+            if(KErrCancel != result) {
+                waitActivity(QVariantHash());
+            }            
             if (KErrNone == result) {
                 emit activityRequested(data);
             }
+            
             break;
     }
 }
@@ -75,9 +79,8 @@
 {
     switch (requestType) {
         case GetThumbnail:
-            if (KErrNone == result) {
-                emit thumbnailRequested(pixmap, userData);
-            }
+            emit thumbnailRequested(0 == result ? pixmap : QPixmap(), 
+                                    userData);
             break;
     }
 }
@@ -86,6 +89,24 @@
 //
 // -----------------------------------------------------------------------------
 //
+void HsActivityDbClient::asyncRequestCompleated(int result,int requestType)
+{
+    switch(requestType) {
+    case NotifyChange:
+        if (KErrCancel != result) {
+            d_ptr->notifyDataChange();
+        }
+        if (KErrNone == result) {
+            emit dataChanged();
+        }
+        break;
+    }
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
 int HsActivityDbClient::addActivity(const QVariantHash &activity)
 {
     return d_ptr->addActivity(activity);
@@ -143,7 +164,11 @@
 //
 int HsActivityDbClient::waitActivity(const QVariantHash &activity)
 {
-    return d_ptr->waitActivity(activity);
+    QVariantHash condition(activity);
+    RProcess process;
+    condition.insert(ActivityApplicationKeyword, 
+                     static_cast<int>(process.SecureId().iId));
+    return d_ptr->waitActivity(condition);
 }
 
 // -----------------------------------------------------------------------------
@@ -159,8 +184,16 @@
 //
 // -----------------------------------------------------------------------------
 //
-//int HsActivityDbClient::getThumbnail(const QVariantHash &condition)
 int HsActivityDbClient::getThumbnail(QSize size, QString imagePath, QString mimeType, void* userDdata)
 {
     return d_ptr->getThumbnail(size, imagePath, mimeType, userDdata);
 }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+int HsActivityDbClient::notifyDataChange()
+{
+    return  d_ptr->notifyDataChange();
+}
--- a/activityfw/activitydatabase/hsactivitydbserver/inc/activitygraphicfilescaling.h	Fri May 14 16:10:06 2010 +0300
+++ b/activityfw/activitydatabase/hsactivitydbserver/inc/activitygraphicfilescaling.h	Thu May 27 13:11:12 2010 +0300
@@ -56,8 +56,18 @@
 
     ~CGraphicsSalingHandler();
 
-    static CGraphicsSalingHandler* NewL(MImageReadyCallBack &aNotify, RFs &aFs, const TDesC &aFileName, const TDesC8& aMimeType, const TSize &aNewSize, TKindOfScaling aKindOfScaling);
-    static CGraphicsSalingHandler* NewLC(MImageReadyCallBack &aNotify, RFs &aFs, const TDesC &aFileName, const TDesC8& aMimeType, const TSize &aNewSize, TKindOfScaling aKindOfScaling);
+    static CGraphicsSalingHandler* NewL(MImageReadyCallBack &aNotify,
+        RFs &aFs,
+        const TDesC &aFileName,
+        const TDesC8& aMimeType,
+        const TSize &aNewSize,
+        TKindOfScaling aKindOfScaling = CGraphicsSalingHandler::EIgnoreAspectRatio);
+    static CGraphicsSalingHandler* NewLC(MImageReadyCallBack &aNotify,
+        RFs &aFs,
+        const TDesC &aFileName,
+        const TDesC8& aMimeType,
+        const TSize &aNewSize,
+        TKindOfScaling aKindOfScaling = CGraphicsSalingHandler::EIgnoreAspectRatio);
 
 protected:
     void DoCancel();
@@ -66,7 +76,9 @@
 
 private:
     void ConstructL(RFs &aFs, const TDesC &aFileName, const TDesC8& aMimeType);
-    CGraphicsSalingHandler(MImageReadyCallBack &aNotify, const TSize &aNewSize, TKindOfScaling aKindOfScaling);
+    CGraphicsSalingHandler(MImageReadyCallBack &aNotify,
+        const TSize &aNewSize,
+        TKindOfScaling aKindOfScaling = CGraphicsSalingHandler::EIgnoreAspectRatio);
     TSize Scaling();
 
 private:
--- a/activityfw/activitydatabase/hsactivitydbserver/inc/activitystoragesynctask.h	Fri May 14 16:10:06 2010 +0300
+++ b/activityfw/activitydatabase/hsactivitydbserver/inc/activitystoragesynctask.h	Thu May 27 13:11:12 2010 +0300
@@ -23,6 +23,7 @@
 
 #include "activitytask.h"
 #include "activitystorage.h"
+#include "activitytaskstorage.h"
 
 /**
  *  CActivityStorageSyncTask
@@ -36,7 +37,8 @@
      * @param dataStorage - data storage
      * @param msg - request message
      */
-    static void ExecuteL(CActivityStorage& dataStorage, 
+    static void ExecuteL(MActivityTaskStorage& observers,
+                         CActivityStorage& dataStorage, 
                          const RMessage2& msg);
 
 private:
@@ -71,6 +73,9 @@
      */
     static void DeleteApplicationActivitiesL(CActivityStorage& dataStorage, 
                                              const RMessage2& msg);
+    
+    static void NotifyChangeL(MActivityTaskStorage& observers,
+                              const RMessage2& msg);
 
     };
 
--- a/activityfw/activitydatabase/hsactivitydbserver/src/activitybroadcasttask.cpp	Fri May 14 16:10:06 2010 +0300
+++ b/activityfw/activitydatabase/hsactivitydbserver/src/activitybroadcasttask.cpp	Thu May 27 13:11:12 2010 +0300
@@ -24,7 +24,7 @@
                                      const RMessage2& msg)
 {
     const RPointerArray<CActivityTask> &tasks(storage.StorageData());
-    for (TInt iter(0); iter < tasks.Count(); ++iter) {
+    for (TInt iter(tasks.Count() - 1); iter >= 0 ; --iter ) {
         (tasks[iter])->BroadcastReceivedL(msg);
     }
     msg.Complete(KErrNone);
--- a/activityfw/activitydatabase/hsactivitydbserver/src/activitydataprovidertask.cpp	Fri May 14 16:10:06 2010 +0300
+++ b/activityfw/activitydatabase/hsactivitydbserver/src/activitydataprovidertask.cpp	Thu May 27 13:11:12 2010 +0300
@@ -47,6 +47,8 @@
 void ActivityDataProviderTask::ProvideDataL(const RMessage2& msg, 
                                             const CActivityTask& src)
 {
-    msg.WriteL(KResponseDataOffset, src.Data());
-    msg.Complete(KErrNone);
+    if (EFalse ==msg.IsNull()) {
+        msg.WriteL(KResponseDataOffset, src.Data());
+        msg.Complete(KErrNone);
+    }
 }
--- a/activityfw/activitydatabase/hsactivitydbserver/src/activitygraphicfilescaling.cpp	Fri May 14 16:10:06 2010 +0300
+++ b/activityfw/activitydatabase/hsactivitydbserver/src/activitygraphicfilescaling.cpp	Thu May 27 13:11:12 2010 +0300
@@ -21,9 +21,10 @@
 // -----------------------------------------------------------------------------
 // -----------------------------------------------------------------------------
 //
-CGraphicsSalingHandler::CGraphicsSalingHandler(MImageReadyCallBack &aNotify, 
-                                               const TSize &aNewSize, 
-                                               TKindOfScaling aKindOfScaling):
+CGraphicsSalingHandler::CGraphicsSalingHandler(MImageReadyCallBack &aNotify,
+                            const TSize &aNewSize,
+                            TKindOfScaling aKindOfScaling
+                            /* = CGraphicsSalingHandler::EIgnoreAspectRatio*/) :
     CActive(EPriorityNormal),
     mNotify(aNotify),
     mNewSize(aNewSize),
@@ -48,17 +49,18 @@
 // -----------------------------------------------------------------------------
 //
 CGraphicsSalingHandler* CGraphicsSalingHandler::NewL(MImageReadyCallBack &aNotify,
-                                                     RFs &aFs,
-                                                     const TDesC &aFileName,
-                                                     const TDesC8& aMimeType,
-                                                     const TSize &aNewSize,
-                                                     TKindOfScaling aKindOfScaling)
+                                RFs &aFs,
+                                const TDesC &aFileName,
+                                const TDesC8& aMimeType,
+                                const TSize &aNewSize,
+                                TKindOfScaling aKindOfScaling
+                                /* = CGraphicsSalingHandler::EIgnoreAspectRatio*/)
 {
-    CGraphicsSalingHandler *self = CGraphicsSalingHandler::NewLC(aNotify, 
-                                                                 aFs, 
-                                                                 aFileName, 
-                                                                 aMimeType, 
-                                                                 aNewSize, 
+    CGraphicsSalingHandler *self = CGraphicsSalingHandler::NewLC(aNotify,
+                                                                 aFs,
+                                                                 aFileName,
+                                                                 aMimeType,
+                                                                 aNewSize,
                                                                  aKindOfScaling);
     CleanupStack::Pop();
     return self;
@@ -68,15 +70,19 @@
 // -----------------------------------------------------------------------------
 //
 CGraphicsSalingHandler* CGraphicsSalingHandler::NewLC(MImageReadyCallBack &aNotify,
-                                              RFs &aFs,
-                                              const TDesC &aFileName,
-                                              const TDesC8& aMimeType,
-                                              const TSize &aNewSize,
-                                              TKindOfScaling aKindOfScaling)
+                                RFs &aFs,
+                                const TDesC &aFileName,
+                                const TDesC8& aMimeType,
+                                const TSize &aNewSize,
+                                TKindOfScaling aKindOfScaling
+                                /* = CGraphicsSalingHandler::EIgnoreAspectRatio*/)
 {
-    CGraphicsSalingHandler *self = new (ELeave) CGraphicsSalingHandler(aNotify, 
-                                                                       aNewSize, 
+    CGraphicsSalingHandler *self = new (ELeave) CGraphicsSalingHandler(aNotify,
+                                                                       aNewSize,
                                                                        aKindOfScaling);
+
+    
+
     CleanupStack::PushL(self);
     self->ConstructL(aFs, aFileName, aMimeType);
     return self;
@@ -87,13 +93,21 @@
 //
 void CGraphicsSalingHandler::ConstructL(RFs &aFs, const TDesC &aFileName, const TDesC8& aMimeType)
 {
-    CActiveScheduler::Add(this);
-
     if (aFileName.Length() == 0
         || aFs.IsValidName(aFileName) == EFalse) {
         User::Leave(KErrPathNotFound);
     }
 
+    if (aMimeType.Length() == 0) {
+        User::Leave(KErrBadName);
+    }
+
+    if(0>=mNewSize.iWidth || 0>=mNewSize.iHeight) {
+       User::Leave(KErrCorrupt);
+    }
+
+    CActiveScheduler::Add(this);
+
     mBitmapScaler = CBitmapScaler::NewL();
     mBitmapScaler->SetQualityAlgorithm(CBitmapScaler::EMaximumQuality);
 
@@ -103,7 +117,7 @@
     const TFrameInfo frameInfo(mImageDecoder->FrameInfo(0));
     User::LeaveIfError(mBitmapFromFile->Create(frameInfo.iOverallSizeInPixels, 
                                                frameInfo.iFrameDisplayMode));
-    
+
     mImageDecoder->Convert(&iStatus, *mBitmapFromFile, 0);
     mCurrentOperation = EConvertBitmapFromFile;
     SetActive();
@@ -149,13 +163,17 @@
         }
     case EScale: {
             mCurrentOperation = ENone;
-            
+
             delete mBitmapScaler;
             mBitmapScaler = 0;
             
             delete mBitmapFromFile;
             mBitmapFromFile = 0;
-            
+
+            if (mKindOfScaling == CGraphicsSalingHandler::EKeepAspectRatioByExpanding) {
+                User::LeaveIfError(mBitmapOutput->Resize(mNewSize));
+            }
+
             mNotify.ImageReadyCallBack(iStatus.Int(), mBitmapOutput);
             break;
         }
@@ -170,7 +188,9 @@
    TSize originalSize = mBitmapFromFile->SizeInPixels();
    float widthFactor = mNewSize.iWidth / (float)originalSize.iWidth;
    float heightFactor = mNewSize.iHeight / (float)originalSize.iHeight;
+
    TSize retSize(mNewSize);
+
    if (mKindOfScaling == CGraphicsSalingHandler::EKeepAspectRatio) {
        retSize = (widthFactor < heightFactor) ?
                  TSize(mNewSize.iWidth, widthFactor * originalSize.iHeight) :
--- a/activityfw/activitydatabase/hsactivitydbserver/src/activityobservertask.cpp	Fri May 14 16:10:06 2010 +0300
+++ b/activityfw/activitydatabase/hsactivitydbserver/src/activityobservertask.cpp	Thu May 27 13:11:12 2010 +0300
@@ -72,10 +72,14 @@
 //
 void CActivityObserverTask::BroadcastReceivedL(const RMessage2& msg)
 {
-    if (WaitActivity == mMsg.Function() &&
-        LaunchActivity == msg.Function()) {
-        TPckgBuf<TInt> observerdId;
-        mMsg.ReadL(KRequestAppIdOffset, observerdId);
+    if(EFalse != mMsg.IsNull()) {
+        mGlobalStorage.Pop(this);//
+        mLocalStorage.Pop(this);
+        delete this;
+    } else if (WaitActivity == mMsg.Function() &&
+               LaunchActivity == msg.Function()) {
+               TPckgBuf<TInt> observerdId;
+               mMsg.ReadL(KRequestAppIdOffset, observerdId);
 
         TPckgBuf<TInt> requestedId;
         msg.ReadL(KRequestAppIdOffset, requestedId);
@@ -95,6 +99,20 @@
         mGlobalStorage.Pop(this);
         mMsg.Complete(KErrCancel);
         delete this;
+    } else if (NotifyChange == mMsg.Function() &&
+               CancelNotify == msg.Function() &&
+               mMsg.Session() == msg.Session()) {
+        mGlobalStorage.Pop(this);
+        mMsg.Complete(KErrCancel);
+        delete this;
+    } else if(NotifyChange == mMsg.Function() &&
+              (AddActivity == msg.Function() ||
+               UpdateActivity == msg.Function() ||
+               RemoveActivity == msg.Function() ||
+               RemoveApplicationActivities == msg.Function())){
+        mMsg.Complete(KErrNone);
+        mGlobalStorage.Pop(this);
+        delete this;
     }
 }
 
--- a/activityfw/activitydatabase/hsactivitydbserver/src/activitysession.cpp	Fri May 14 16:10:06 2010 +0300
+++ b/activityfw/activitydatabase/hsactivitydbserver/src/activitysession.cpp	Thu May 27 13:11:12 2010 +0300
@@ -87,7 +87,7 @@
     case UpdateActivity:
     case RemoveActivity:
     case RemoveApplicationActivities:
-        ActivityStorageSyncTask::ExecuteL(mStorage, message);
+        ActivityStorageSyncTask::ExecuteL(mTasksStorage, mStorage, message);
         break;
     
     case Activities:
@@ -96,6 +96,7 @@
         break;
     
     case WaitActivity:
+    case NotifyChange:
         CActivityObserverTask::ExecuteLD(mTasksStorage, *this, message);
         break;
     case GetThumbnail:
@@ -104,6 +105,7 @@
     
     case LaunchActivity:
     case CancelWait:
+    case CancelNotify:
         ActivityBroadcastTask::ExecuteL(mTasksStorage, message);
         break;
     
--- a/activityfw/activitydatabase/hsactivitydbserver/src/activitystorageasynctask.cpp	Fri May 14 16:10:06 2010 +0300
+++ b/activityfw/activitydatabase/hsactivitydbserver/src/activitystorageasynctask.cpp	Thu May 27 13:11:12 2010 +0300
@@ -121,6 +121,10 @@
 //
 void CActivityStorageAsyncTask::WriteResponseL(const RMessage2& msg)
 {
-    msg.WriteL(KResponseDataSizeOffset, TPckgBuf<TInt>(mData.Length()));//write data size
-    msg.WriteL(KResponseIdOffset, TPckgBuf<CBase*>(this));//task identyfier
+    if (EFalse == msg.IsNull()) {
+        msg.WriteL(KResponseDataSizeOffset, 
+                   TPckgBuf<TInt>(mData.Length()));//write data size
+        msg.WriteL(KResponseIdOffset, 
+                   TPckgBuf<CBase*>(this));//task identyfier
+    }
 }
--- a/activityfw/activitydatabase/hsactivitydbserver/src/activitystoragesynctask.cpp	Fri May 14 16:10:06 2010 +0300
+++ b/activityfw/activitydatabase/hsactivitydbserver/src/activitystoragesynctask.cpp	Thu May 27 13:11:12 2010 +0300
@@ -23,7 +23,9 @@
 //
 // -----------------------------------------------------------------------------
 //
-void ActivityStorageSyncTask::ExecuteL(CActivityStorage& dataStorage, const RMessage2& msg)
+void ActivityStorageSyncTask::ExecuteL(MActivityTaskStorage& observers,
+                                       CActivityStorage& dataStorage, 
+                                       const RMessage2& msg)
 {
     switch (msg.Function()) {
     case AddActivity: 
@@ -43,6 +45,7 @@
         User::Panic(KUnsupportedStorageSyncTask, KErrGeneral);
     };
     msg.Complete(KErrNone);
+    NotifyChangeL(observers, msg);
 }
 
 // -----------------------------------------------------------------------------
@@ -124,3 +127,16 @@
     msg.ReadL(KRequestAppIdOffset, appId);
     dataStorage.DeleteActivitiesL(appId());
 }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void ActivityStorageSyncTask::NotifyChangeL(MActivityTaskStorage& observers,
+                          const RMessage2& msg)
+{
+    const RPointerArray<CActivityTask> &table(observers.StorageData());
+    for (TInt iter(table.Count() - 1); 0 <= iter; --iter) {
+        table[iter]->BroadcastReceivedL(msg);
+    }
+}
--- a/activityfw/activitydatabase/hsactivitydbserver/src/activitythumbnailtask.cpp	Fri May 14 16:10:06 2010 +0300
+++ b/activityfw/activitydatabase/hsactivitydbserver/src/activitythumbnailtask.cpp	Thu May 27 13:11:12 2010 +0300
@@ -75,14 +75,7 @@
     mMsg.ReadL(2, path);
     mime.CreateL(mMsg.GetDesLengthL(3));
     mMsg.ReadL(3, mime);
-    if(0 >= width() || 
-       0 >=height() ||
-       0 >= path.Length() ||
-       0 >= mime.Length()
-       ) {
-       User::Leave(KErrCorrupt);
-    }
-    
+
     mService = CGraphicsSalingHandler::NewL(*this, 
                                             session, 
                                             path, 
@@ -100,12 +93,15 @@
 //
 void CActivityThumbnailTask::ImageReadyCallBack(TInt error,const CFbsBitmap *bitmap)
 {
-    if (KErrNone == error) {
+    if (EFalse == mMsg.IsNull() &&
+        KErrNone == error) {
         mMsg.Write(0, TPckgBuf<int>(const_cast<CFbsBitmap*>(bitmap)->Handle()));
         mMsg.Write(1, TPckgBuf<void *>(this));
         mMsg.Complete(error);
     } else {
-        mMsg.Complete(error);
+        if (EFalse == mMsg.IsNull()) {
+         mMsg.Complete(error);
+        }
         mStorage.Pop(this);
         delete this;
     }
@@ -124,7 +120,7 @@
 //
 // -----------------------------------------------------------------------------
 //
-void CActivityThumbnailTask::BroadcastReceivedL(const RMessage2& )
+void CActivityThumbnailTask::BroadcastReceivedL(const RMessage2&)
 {
 }
 
--- a/activityfw/activitydatabase/inc/activitycmd.h	Fri May 14 16:10:06 2010 +0300
+++ b/activityfw/activitydatabase/inc/activitycmd.h	Thu May 27 13:11:12 2010 +0300
@@ -38,7 +38,9 @@
     LaunchActivity,
     GetThumbnail,
     GetData,
-    CancelWait
+    NotifyChange,
+    CancelWait,
+    CancelNotify
 };
 
 #endif  //ACTIVITYCMD_H
--- a/activityfw/activitydatabase/inc/hsactivitydbclientinterface.h	Fri May 14 16:10:06 2010 +0300
+++ b/activityfw/activitydatabase/inc/hsactivitydbclientinterface.h	Thu May 27 13:11:12 2010 +0300
@@ -24,6 +24,7 @@
 
 const char ActivityApplicationKeyword [] = ":ApplicationId";
 const char ActivityActivityKeyword [] = ":ActivityName";
+const char ActivityParametersKeyword [] = ":ActivityParams";
 const char ActivityScreenshotKeyword [] = "screenshot";
 
 class HsActivityDbClientInterface
--- a/activityfw/activitydatabase/s60/inc/hsserializer.h	Fri May 14 16:10:06 2010 +0300
+++ b/activityfw/activitydatabase/s60/inc/hsserializer.h	Thu May 27 13:11:12 2010 +0300
@@ -18,15 +18,6 @@
 #define HSSERIALIZER_H
 #include <qvariant.h>
 #include <qpixmap.h>
-/**
- * Operator serialize QPixmap to RBuf8
- */
-RBuf8 &operator <<(RBuf8 &dst, const QPixmap &src);
-
-/**
- * Operator deserialize TDesc8 to QPixmap
- */
-QPixmap &operator <<(QPixmap &dst, const TDesC8 &src);
 
 /**
  * Operator serialize VarinatHash to RBuf8
@@ -39,11 +30,6 @@
 QVariantHash &operator <<(QVariantHash &dst, const TDesC8 &src);
 
 /**
- * Operator serialize QList<QVariantHash> to RBuf8
- */
-RBuf8 &operator <<(RBuf8 &dst, const QList<QVariantHash>& src);
-
-/**
  * Operator deserialize RBuf8 to QList<QVariantHash>
  */
 QList<QVariantHash>& operator <<(QList<QVariantHash>& dst, const TDesC8 &src);
--- a/activityfw/activitydatabase/s60/src/hsserializer.cpp	Fri May 14 16:10:06 2010 +0300
+++ b/activityfw/activitydatabase/s60/src/hsserializer.cpp	Thu May 27 13:11:12 2010 +0300
@@ -20,39 +20,6 @@
 //
 // -----------------------------------------------------------------------------
 //
-RBuf8 &operator <<(RBuf8 &dst, const QPixmap &src)
-{
-    QByteArray buffer;
-    QDataStream stream(&buffer, QIODevice::WriteOnly);
-
-    QT_TRYCATCH_LEAVING(stream << src);
-    const int dataLength(buffer.length());
-    const unsigned char *dataPtr(reinterpret_cast<const unsigned char *>(buffer.constData()));
-    if (dst.MaxLength() < dataLength) {
-        dst.ReAllocL(dataLength);
-    }
-    dst.Copy(dataPtr, dataLength);
-    return dst;
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-QPixmap &operator <<(QPixmap &dst, const TDesC8 &src)
-{
-    QByteArray buffer(QByteArray::fromRawData(reinterpret_cast<const char *>(src.Ptr()),
-                                              src.Length()) );
-
-    QDataStream stream(&buffer, QIODevice::ReadOnly);
-    QT_TRYCATCH_LEAVING(stream >> dst);
-    return dst;
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
 RBuf8 &operator <<(RBuf8 &dst, const QVariantHash &src)
 {
     QByteArray buffer;
@@ -86,24 +53,6 @@
 //
 // -----------------------------------------------------------------------------
 //
-RBuf8 &operator <<(RBuf8 &dst, const QList<QVariantHash>& src)
-{
-    QByteArray buffer;
-    QDataStream stream(&buffer, QIODevice::WriteOnly);
-
-    QT_TRYCATCH_LEAVING(stream << src);
-
-    if (dst.MaxLength() < buffer.length()) {
-        dst.ReAllocL(buffer.length());
-    }
-    dst.Copy(reinterpret_cast<const TUint8 *>(buffer.data()), buffer.length());
-    return dst;
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
 QList<QVariantHash>& operator <<(QList<QVariantHash>& dst, const TDesC8 &src)
 {
     dst.clear();
--- a/activityfw/activityfw.pro	Fri May 14 16:10:06 2010 +0300
+++ b/activityfw/activityfw.pro	Thu May 27 13:11:12 2010 +0300
@@ -18,14 +18,18 @@
 
 CONFIG += ordered
 
+SUBDIRS += tsutils
+
 symbian:SUBDIRS += activitydatabase
 
 SUBDIRS +=  activityserviceplugin \
-            orbitintegration/hbactivityplugin 
+            orbitintegration/hbactivityplugin \
             
+tests {
+    SUBDIRS +=  activityserviceplugin/tsrc \
+                tsutils/tsrc \
+}
 
-
-tests:SUBDIRS += activityserviceplugin/unittests
 symbian:SUBDIRS += activityserviceplugin/symbianinstaller
 
 symbian:include(rom.pri)
\ No newline at end of file
--- a/activityfw/activityserviceplugin/activityclient.cpp	Fri May 14 16:10:06 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +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 "activityclient.h"
-#include "activityclient_p.h"
-
-ActivityClient::ActivityClient(QObject *parent) : QObject(parent), d_ptr(new ActivityClientPrivate(this))
-{
-}
-
-ActivityClient::~ActivityClient()
-{
-}
-
-bool ActivityClient::addActivity(const QString &activityId, const QVariant &data, const QVariantHash &parameters)
-{
-    return d_ptr->addActivity(activityId, data, parameters);
-}
-
-bool ActivityClient::removeActivity(const QString &activityId)
-{
-    return d_ptr->removeActivity(activityId);
-}
-
-bool ActivityClient::updateActivity(const QString &activityId, const QVariant &data, const QVariantHash &parameters)
-{
-    return d_ptr->updateActivity(activityId, data, parameters);
-}
-
-QList<QVariantHash> ActivityClient::activities() const
-{
-    return d_ptr->activities();
-}
-
-QVariant ActivityClient::activityData(const QString &activityId) const
-{
-    return d_ptr->activityData(activityId);
-}
-
-bool ActivityClient::waitActivity()
-{
-    return d_ptr->waitActivity();
-}
-
-QVariantHash ActivityClient::parseCommandLine(const QStringList &commandLineParams) const
-{
-    return d_ptr->parseCommandLine(commandLineParams);
-}
--- a/activityfw/activityserviceplugin/activityclient.h	Fri May 14 16:10:06 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +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 ACTIVITYCLIENT_H
-#define ACTIVITYCLIENT_H
-
-#include <QObject>
-#include <QVariant>
-#include <QString>
-
-class ActivityClientPrivate;
-
-class ActivityClient : public QObject
-{
-
-    Q_OBJECT
-
-public:
-    ActivityClient(QObject *parent = 0);
-    ~ActivityClient();
-
-public slots:
-    bool addActivity(const QString &activityId, const QVariant &data, const QVariantHash &parameters);
-    bool removeActivity(const QString &activityId);
-    bool updateActivity(const QString &activityId, const QVariant &data, const QVariantHash &parameters);
-    QList<QVariantHash> activities() const;
-    QVariant activityData(const QString &activityId) const;
-    bool waitActivity();
-    QVariantHash parseCommandLine(const QStringList &commandLineParams) const;
-
-signals:
-    void activityRequested(const QString &activityId);
-
-private:
-    ActivityClientPrivate *d_ptr;
-    friend class ActivityClientPrivate;
-
-};
-
-#endif // ACTIVITYCLIENT_H
--- a/activityfw/activityserviceplugin/activityclient_p.cpp	Fri May 14 16:10:06 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,172 +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 "activityclient_p.h"
-#include "activityclient.h"
-#include "activitydatastorage.h"
-#include <hsactivitydbclient.h>
-
-#include <QCoreApplication>
-#include <QStringList>
-#include <QTimer>
-#include <QUrl>
-#include <QDebug>
-#include <QDir>
-
-ActivityClientPrivate::ActivityClientPrivate(ActivityClient *q) : QObject(q), mIsconnected(false)
-{
-    mDataStorage = new ActivityDataStorage();
-    mServerClient = new HsActivityDbClient();
-    mIsconnected = ( KErrNone == mServerClient->connect());
-    connect(mServerClient, SIGNAL(activityRequested(QString)), q, SIGNAL(activityRequested(QString)));
-}
-
-ActivityClientPrivate::~ActivityClientPrivate()
-{
-    delete mServerClient;
-    delete mDataStorage;
-}
-
-bool ActivityClientPrivate::addActivity(const QString &activityId, const QVariant &data, const QVariantHash &parameters)
-{
-    bool result(false);
-    if (mIsconnected) {
-        result = mDataStorage->addActivity(activityId, data);
-        if ( result ) {
-            QVariantHash activity(parameters);
-            RProcess process;
-            registerThumbnail(activityId, activity);
-            activity.insert(ActivityApplicationKeyword, static_cast<int>(process.SecureId().iId));
-            activity.insert(ActivityActivityKeyword, activityId);
-            int error = mServerClient->addActivity(activity);
-            result = error == KErrNone ? true : false;
-        }
-    }
-    // @todo make those operations atomic
-    return result;
-}
-
-bool ActivityClientPrivate::removeActivity(const QString &activityId)
-{
-    bool result(false);
-    if (mIsconnected) {
-        result = mDataStorage->removeActivity(activityId);
-        if ( result ) {            
-            QVariantHash activity;
-            RProcess process;
-            activity.insert(ActivityApplicationKeyword, static_cast<int>(process.SecureId().iId));
-            activity.insert(ActivityActivityKeyword, activityId);
-            int error = mServerClient->removeActivity(activity);
-            result = error == KErrNone ? true : false;
-            if (result) {
-                result = QFile::remove(thumbnailName(activityId));
-            }
-        }
-    }
-    // @todo make those operations atomic
-    return result;
-}
-
-bool ActivityClientPrivate::updateActivity(const QString &activityId, const QVariant &data, const QVariantHash &parameters)
-{
-    bool result(false);
-    if (mIsconnected) {
-        result = mDataStorage->updateActivity(activityId, data);
-        if ( result ) {
-            QVariantHash activity(parameters);
-            RProcess process;
-            registerThumbnail(activityId, activity);
-            activity.insert(ActivityApplicationKeyword, static_cast<int>(process.SecureId().iId));
-            activity.insert(ActivityActivityKeyword, activityId);
-            int error = mServerClient->updateActivity(activity);
-            result = error == KErrNone ? true : false;
-        }
-    }
-    // @todo make those operations atomic
-    return result;
-}
-
-QList<QVariantHash> ActivityClientPrivate::activities() const
-{
-    QList<QVariantHash> activities;
-    if (mIsconnected) {
-        QVariantHash activity;
-        RProcess process;
-        activity.insert(ActivityApplicationKeyword, static_cast<int>(process.SecureId().iId));
-        mServerClient->applicationActivities(activities, activity);
-    }
-    return activities;
-}
-
-QVariant ActivityClientPrivate::activityData(const QString &activityId) const
-{
-    return mIsconnected ? mDataStorage->activityData(activityId) : QVariant();
-}
-
-bool ActivityClientPrivate::waitActivity()
-{
-    bool retVal(mIsconnected);
-    if (mIsconnected) {
-        RProcess process;
-        QVariantHash activity;
-        activity.insert(ActivityApplicationKeyword, static_cast<int>(process.SecureId().iId));
-        retVal = !mServerClient->waitActivity(activity);
-    }
-    return retVal;
-}
-
-QVariantHash ActivityClientPrivate::parseCommandLine(const QStringList &commandLineParams) const
-{
-    QVariantHash activityParams;
-    int activityMarkerIndex = commandLineParams.indexOf("-activity");
-    if (activityMarkerIndex != -1 && commandLineParams.count() - 1 > activityMarkerIndex) {
-        QUrl activityUri(commandLineParams.at(activityMarkerIndex+1));
-        if (activityUri.scheme() == "appto") {
-            QList<QPair<QString, QString> > parameters = activityUri.queryItems();
-            for (QList<QPair<QString, QString> >::const_iterator i = parameters.constBegin(); i != parameters.constEnd(); ++i) {
-                activityParams.insert(i->first, i->second);
-            }
-
-            if (activityParams.contains("activityname") && !activityParams.value("activityname").toString().isEmpty()) {
-                return activityParams;
-            }
-        }
-    }
-    return QVariantHash();
-}
-
-void ActivityClientPrivate::registerThumbnail(const QString &name, QVariantHash &activity)
-{
-    QVariantHash::const_iterator findIterator(activity.constFind(ActivityScreenshotKeyword));
-    if (activity.constEnd() != findIterator   &&
-        findIterator.value().canConvert<QPixmap>()) {
-        const QString thumbnailManagerName = thumbnailName(name);
-        if (findIterator.value().value<QPixmap>().save(thumbnailManagerName)) {
-            activity.insert(ActivityScreenshotKeyword, thumbnailManagerName);
-        } else {
-            activity.remove(ActivityScreenshotKeyword);
-        }
-    }
-}
-
-QString ActivityClientPrivate::thumbnailName(const QString &activityId) const
-{
-    return QDir::toNativeSeparators(qApp->applicationDirPath() + 
-                                    "/" + 
-                                    QString::number(qHash(activityId), 16) + 
-                                    ".png");
-}
-
--- a/activityfw/activityserviceplugin/activityclient_p.h	Fri May 14 16:10:06 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:
-*
-*/
-#ifndef ACTIVITYCLIENT_P_H
-#define ACTIVITYCLIENT_P_H
-
-#include <QObject>
-#include <QVariant>
-#include <QString>
-#include <QPixmap>
-
-class ActivityClient;
-class ActivityDataStorage;
-class ActivityServerClient;
-class HsActivityDbClient;
-class ActivityClientPrivate : public QObject
-{
-
-    Q_OBJECT
-
-public:
-    ActivityClientPrivate(ActivityClient *q);
-    ~ActivityClientPrivate();
-
-public:
-    bool addActivity(const QString &activityId, const QVariant &data, const QVariantHash &parameters);
-    bool removeActivity(const QString &activityId);
-    bool updateActivity(const QString &activityId, const QVariant &data, const QVariantHash &parameters);
-    QList<QVariantHash> activities() const;
-    QVariant activityData(const QString &activityId) const;
-    bool waitActivity();
-    QVariantHash parseCommandLine(const QStringList &commandLineParams) const;
-
-private:
-    void registerThumbnail(const QString &, QVariantHash&);
-    QString thumbnailName(const QString &) const;
-
-private:
-    ActivityDataStorage *mDataStorage;
-    HsActivityDbClient *mServerClient;
-    bool mIsconnected;
-};
-
-#endif // ACTIVITYCLIENT_P_H
--- a/activityfw/activityserviceplugin/activitydatastorage.cpp	Fri May 14 16:10:06 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,171 +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 "activitydatastorage.h"
-
-#include <QSqlDatabase>
-#include <QSqlQuery>
-#include <QSqlError>
-#include <QStringList>
-
-const char KConnectionName[] = "ActivityDataStorage";
-
-ActivityDataStorage::ActivityDataStorage()
-{
-    QSqlDatabase database;
-    if (QSqlDatabase::contains(KConnectionName)) {
-        database = QSqlDatabase::database(KConnectionName);
-    } else {
-        database = QSqlDatabase::addDatabase("QSQLITE", KConnectionName);
-        database.setDatabaseName("activitydatastorage.db");
-        if (!database.open()) {
-            qFatal(qPrintable(database.lastError().text()));
-        }
-    }
-
-    if (!checkTables()) {
-        recreateTables();
-    }
-}
-
-ActivityDataStorage::~ActivityDataStorage()
-{
-    QSqlDatabase::database(KConnectionName).close();
-}
-
-bool ActivityDataStorage::addActivity(const QString &activityId, const QVariant &data)
-{
-    QSqlDatabase database = QSqlDatabase::database(KConnectionName);
-
-    QByteArray streamedData;
-    {
-        QDataStream stream(&streamedData, QIODevice::WriteOnly);
-        stream << data;
-    }
-
-    // insert data
-    QSqlQuery query(database);
-    if (!query.prepare("INSERT INTO Activities(Name, Data) VALUES(:Name, :Data)")) {
-        qCritical(qPrintable(query.lastError().text()));
-        return false;
-    }
-    query.bindValue(":Name", activityId);
-    query.bindValue(":Data", streamedData);
-    if (!query.exec()) {
-        qCritical(qPrintable(query.lastError().text()));
-        return false;
-    }
-
-    return true;
-}
-
-bool ActivityDataStorage::removeActivity(const QString &activityId)
-{
-    QString sqlCommand = QString("DELETE FROM Activities WHERE Name = '%1'").arg(activityId);
-    QSqlQuery query(QSqlDatabase::database(KConnectionName));
-    if (!query.exec(sqlCommand)) {
-        qCritical(qPrintable(query.lastError().text()));
-        return false;
-    }
-    return query.numRowsAffected() > 0;
-}
-
-bool ActivityDataStorage::updateActivity(const QString &activityId, const QVariant &data)
-{
-    QSqlDatabase database = QSqlDatabase::database(KConnectionName);
-
-    QByteArray streamedData;
-    {
-        QDataStream stream(&streamedData, QIODevice::WriteOnly);
-        stream << data;
-    }
-
-    // update data
-    QSqlQuery query(database);
-    if (!query.prepare("UPDATE Activities SET Data = :Data WHERE Name = :Name")) {
-        qCritical(qPrintable(query.lastError().text()));
-        return false;
-    }
-    query.bindValue(":Data", streamedData);
-    query.bindValue(":Name", activityId);
-    if (!query.exec()) {
-        qCritical(qPrintable(query.lastError().text()));
-        return false;
-    }
-
-    return query.numRowsAffected() > 0;
-}
-
-QVariant ActivityDataStorage::activityData(const QString &activityId) const
-{
-    QSqlDatabase database = QSqlDatabase::database(KConnectionName);
-    QSqlQuery query(database);
-    if (!query.exec(QString("SELECT Data FROM Activities WHERE Name = '%1'").arg(activityId))) {
-        qCritical(qPrintable(query.lastError().text()));
-        return QVariant();
-    }
-
-    QVariant result;
-    if (query.next()) {
-        QByteArray data(query.value(0).toByteArray());
-        QDataStream stream(&data, QIODevice::ReadOnly);
-        stream >> result;
-    }
-    return result;
-}
-
-bool ActivityDataStorage::checkTables()
-{
-    QStringList expectedTables("Activities");
-    QStringList actualTables = QSqlDatabase::database(KConnectionName).tables();
-    return (expectedTables == actualTables);
-}
-
-void ActivityDataStorage::recreateTables()
-{
-    QSqlDatabase database = QSqlDatabase::database(KConnectionName);
-
-    if (!database.transaction()) {
-        qFatal(qPrintable(database.lastError().text()));
-    }
-
-    // drop any existing tables
-    {
-        QSqlQuery dropQuery(database);
-        foreach(const QString &tableName, database.tables()) {
-            if (!dropQuery.exec(QString("DROP TABLE %1").arg(tableName))) {
-                qFatal(qPrintable(dropQuery.lastError().text()));
-            }
-        }
-    }
-
-    // create new table
-    {
-        QSqlQuery createQuery(database);
-        QString statement(
-            "CREATE TABLE Activities("
-            "Name TEXT NOT NULL PRIMARY KEY UNIQUE,"
-            "Data BLOB NOT NULL)");
-
-        if (!createQuery.exec(statement)) {
-            qFatal(qPrintable(createQuery.lastError().text()));
-        }
-    }
-
-    if (!database.commit()) {
-        qFatal(qPrintable(database.lastError().text()));
-    }
-}
--- a/activityfw/activityserviceplugin/activitydatastorage.h	Fri May 14 16:10:06 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-#ifndef ACTIVITYDATASTORAGE_H
-#define ACTIVITYDATASTORAGE_H
-
-#include <QVariant>
-#include <QString>
-
-class ActivityDataStorage
-{
-
-public:
-    ActivityDataStorage();
-    ~ActivityDataStorage();
-
-public:
-    bool addActivity(const QString &activityId, const QVariant &data);
-    bool removeActivity(const QString &activityId);
-    bool updateActivity(const QString &activityId, const QVariant &data);
-    QVariant activityData(const QString &activityId) const;
-
-private:
-    bool checkTables();
-    void recreateTables();
-
-};
-
-#endif // ACTIVITYDATASTORAGE_H
--- a/activityfw/activityserviceplugin/activitymanager.cpp	Fri May 14 16:10:06 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:
-*
-*/
-
-#include "activitymanager.h"
-#include "activitymanager_p.h"
-
-ActivityManager::ActivityManager(QObject *parent) : QObject(parent), d_ptr(new ActivityManagerPrivate(this))
-{
-}
-
-ActivityManager::~ActivityManager()
-{
-}
-
-QList<QVariantHash> ActivityManager::activitiesList()
-{
-    return d_ptr->activitiesList();
-}
-
-void ActivityManager::launchActivity(const QString &uri)
-{
-    d_ptr->launchActivity(uri);
-}
-
-void ActivityManager::launchActivity(int applicationId, const QString &activityId)
-{
-    d_ptr->launchActivity(applicationId, activityId);
-}
-
-void ActivityManager::getThumbnail(QSize resolution,const QString &thumbnailPath, void *data)
-{
-   d_ptr->getThumbnail(resolution, thumbnailPath, data);
-}
--- a/activityfw/activityserviceplugin/activitymanager.h	Fri May 14 16:10:06 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-#ifndef ACTIVITYMANAGER_H
-#define ACTIVITYMANAGER_H
-
-#include <QObject>
-#include <QVariant>
-#include <QList>
-#include <QPixmap>
-#include <QSize>
-
-class ActivityManagerPrivate;
-
-class ActivityManager : public QObject
-{
-
-    Q_OBJECT
-
-public:
-    ActivityManager(QObject *parent = 0);
-    ~ActivityManager();
-
-public slots:
-    QList<QVariantHash> activitiesList();
-    void launchActivity(const QString &uri);
-    void launchActivity(int applicationId, const QString &activityId);
-    void getThumbnail(QSize resolution,const QString &thumbnailPath, void *data =0);
-
-signals:
-    void thumbnailReady(QPixmap, void *);
-
-private:
-    ActivityManagerPrivate *d_ptr;
-
-    friend class ActivityManagerPrivate;
-};
-
-#endif // ACTIVITYMANAGER_H
--- a/activityfw/activityserviceplugin/activitymanager_p.cpp	Fri May 14 16:10:06 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +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 "activitymanager_p.h"
-#include "activitymanager.h"
-#include <hsactivitydbclient.h>
-
-#include <QRegExp>
-#include <QStringList>
-
-ActivityManagerPrivate::ActivityManagerPrivate(ActivityManager *q) : QObject(q), q_ptr(q)
-{
-    mServerClient = new HsActivityDbClient();
-    mServerClient->connect();
-    connect(mServerClient,
-            SIGNAL(thumbnailRequested(QPixmap, void *)),
-            q,
-            SIGNAL(thumbnailReady(QPixmap, void *)));
-}
-
-ActivityManagerPrivate::~ActivityManagerPrivate()
-{
-    delete mServerClient;
-}
-
-QList<QVariantHash> ActivityManagerPrivate::activitiesList()
-{
-    QList<QVariantHash> retVal;
-    mServerClient->activities(retVal);
-    return retVal;
-}
-
-void ActivityManagerPrivate::launchActivity(const QString &uri)
-{
-    // @todo use the same parser as in HbApplicationPrivate (if possible)
-    QRegExp uriMatcher("^appto://(.+)\\?activityname=(.+)$");
-    if (uriMatcher.indexIn(uri) != -1) {
-        QStringList list = uriMatcher.capturedTexts();
-        Q_ASSERT(list.count() == 3);
-        launchActivity(list.at(1).toUInt(0, 16), list.at(2));
-    } else {
-        qWarning("Activity URI parsing error");
-    }
-}
-
-void ActivityManagerPrivate::launchActivity(int applicationId, const QString &activityId)
-{
-    ApplicationLauncher applicationLauncher;
-    if (applicationLauncher.isRunning(applicationId)) {
-        QVariantHash activity;
-        activity.insert(ActivityApplicationKeyword, applicationId);
-        activity.insert(ActivityActivityKeyword, activityId);
-        mServerClient->launchActivity(activity);
-        applicationLauncher.bringToForeground(applicationId);
-    } else {
-        applicationLauncher.startApplication(applicationId, activityId);
-    }
-}
-
-void ActivityManagerPrivate::getThumbnail(QSize resolution,const QString &thumbnailPath, void *data)
-{
-    mServerClient->getThumbnail(resolution, thumbnailPath, "image/png", data);
-}
--- a/activityfw/activityserviceplugin/activitymanager_p.h	Fri May 14 16:10:06 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +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 ACTIVITYMANAGER_P_H
-#define ACTIVITYMANAGER_P_H
-
-#include <QObject>
-#include <QVariant>
-#include <QList>
-#include <QSize>
-#include "applicationlauncher.h"
-
-class ActivityManager;
-class HsActivityDbClient;
-
-class ActivityManagerPrivate : public QObject
-{
-
-    Q_OBJECT
-
-public:
-    ActivityManagerPrivate(ActivityManager *q);
-    ~ActivityManagerPrivate();
-
-public slots:
-    QList<QVariantHash> activitiesList();
-    void launchActivity(const QString &uri);
-    void launchActivity(int applicationId, const QString &activityId);
-    void getThumbnail(QSize resolution,const QString &thumbnailPath, void *data);
-
-private:
-    ActivityManager *q_ptr;
-    HsActivityDbClient *mServerClient;
-};
-
-#endif // ACTIVITYMANAGER_P_H
--- a/activityfw/activityserviceplugin/activityserviceplugin.cpp	Fri May 14 16:10:06 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +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 "activityserviceplugin.h"
-
-#include <qserviceinterfacedescriptor.h>
-#include <qabstractsecuritysession.h>
-#include <qservicecontext.h>
-
-#include "activityclient.h"
-#include "activitymanager.h"
-
-QObject *ActivityServicePlugin::createInstance(const QServiceInterfaceDescriptor &descriptor, QServiceContext *context, QAbstractSecuritySession *session)
-{
-    Q_UNUSED(context);
-    Q_UNUSED(session);
-
-    if (descriptor.interfaceName() == "com.nokia.qt.activities.ActivityClient") {
-        return new ActivityClient();
-    } else if (descriptor.interfaceName() == "com.nokia.qt.activities.ActivityManager") {
-        return new ActivityManager();
-    } else {
-        return NULL;
-    }
-}
-
-Q_EXPORT_PLUGIN2(activityserviceplugin, ActivityServicePlugin)
--- a/activityfw/activityserviceplugin/activityserviceplugin.h	Fri May 14 16:10:06 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:
-*
-*/
-#ifndef ACTIVITYSERVICEPLUGIN_H
-#define ACTIVITYSERVICEPLUGIN_H
-
-#include <QObject>
-#include <qserviceplugininterface.h>
-
-QTM_USE_NAMESPACE
-
-class ActivityServicePlugin : public QObject, public QServicePluginInterface
-{
-    Q_OBJECT
-    Q_INTERFACES(QtMobility::QServicePluginInterface)
-
-public:
-    QObject *createInstance(const QServiceInterfaceDescriptor &descriptor, QServiceContext *context, QAbstractSecuritySession *session);
-
-};
-
-#endif //ACTIVITYSERVICEPLUGIN_H
--- a/activityfw/activityserviceplugin/activityserviceplugin.pro	Fri May 14 16:10:06 2010 +0300
+++ b/activityfw/activityserviceplugin/activityserviceplugin.pro	Thu May 27 13:11:12 2010 +0300
@@ -20,27 +20,32 @@
 CONFIG += plugin 
 include(activityserviceplugin.pri)
 
-HEADERS +=  activityserviceplugin.h \
-            activitydatastorage.h \
-            activityclient.h \
-            activityclient_p.h \
-            activitymanager.h \
-            activitymanager_p.h \
-            applicationlauncher.h \
+INCLUDEPATH += ./inc \
+             #../cautils/inc \
+             #../extinc \
 
-SOURCES +=  activityserviceplugin.cpp \
-            activitydatastorage.cpp \
-            activityclient.cpp \
-            activityclient_p.cpp \
-            activitymanager.cpp \
-            activitymanager_p.cpp \
-            applicationlauncher.cpp \
+HEADERS +=  ./inc/activityserviceplugin.h \
+            ./inc/activitydatastorage.h \
+            ./inc/activityclient.h \
+            ./inc/activityclient_p.h \
+            ./inc/activitymanager.h \
+            ./inc/activitymanager_p.h \
+            ./inc/applicationlauncher.h \
+
+SOURCES +=  ./src/activityserviceplugin.cpp \
+            ./src/activitydatastorage.cpp \
+            ./src/activityclient.cpp \
+            ./src/activityclient_p.cpp \
+            ./src/activitymanager.cpp \
+            ./src/activitymanager_p.cpp \
+            ./src/applicationlauncher.cpp \
 
 symbian {
-    INCLUDEPATH += ./s60/
-    SOURCES += ./s60/applicationlauncher_p.cpp
+    INCLUDEPATH += ./s60/inc \
+
+    SOURCES += ./s60/src/applicationlauncher_p.cpp
     
-    HEADERS += ./s60/applicationlauncher_p.h
+    HEADERS += ./s60/src/applicationlauncher_p.h
 
     LIBS += -lapparc \
             -lapgrfx \
@@ -51,10 +56,11 @@
 }
 
 win32 {
-    INCLUDEPATH += ./win/
-    SOURCES += ./win/applicationlauncher_p.cpp
+    INCLUDEPATH += ./win/inc \
 
-    HEADERS += ./win/applicationlauncher_p.h
+    SOURCES += ./win/src/applicationlauncher_p.cpp
+
+    HEADERS += ./win/inc/applicationlauncher_p.h
 }            
             
 symbian {
@@ -63,7 +69,11 @@
     TARGET.CAPABILITY = ALL -TCB
     TARGET.UID3 = 0x200267B2
 
-
     plugin.sources = activityserviceplugin.dll
     plugin.path = $$QT_PLUGINS_BASE_DIR     
+    
+    xml.sources = ./data/activityserviceplugin.xml
+    xml.path = $$RESOURCE_FILES_DIR/activity
+    
+    DEPLOYMENT += xml
 }
--- a/activityfw/activityserviceplugin/activityserviceplugin.xml	Fri May 14 16:10:06 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<service>
-    <name>ActivityService</name>
-    <filepath>activityserviceplugin</filepath>
-    <description>Activities service</description>
-    <interface>
-        <name>com.nokia.qt.activities.ActivityClient</name>
-        <version>1.0</version>
-        <description>Implementation of ActivityClient</description>
-    </interface>
-    <interface>
-        <name>com.nokia.qt.activities.ActivityManager</name>
-        <version>1.0</version>
-        <description>Implementation of ActivityManager</description>
-    </interface>
-</service>
--- a/activityfw/activityserviceplugin/applicationlauncher.cpp	Fri May 14 16:10:06 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 "applicationlauncher.h"
-#include "applicationlauncher_p.h"
-
-ApplicationLauncher::ApplicationLauncher() : d_ptr(new ApplicationLauncherPrivate())
-{
-}
-
-ApplicationLauncher::~ApplicationLauncher()
-{
-    delete d_ptr;
-}
-
-bool ApplicationLauncher::isRunning(int applicationId)
-{
-    return d_ptr->isRunning(applicationId);
-}
-
-void ApplicationLauncher::startApplication(int applicationId, const QString &activityId)
-{
-    d_ptr->startApplication(applicationId, activityId);
-}
-
-void ApplicationLauncher::bringToForeground(int applicationId)
-{
-    d_ptr->bringToForeground(applicationId);
-}
--- a/activityfw/activityserviceplugin/applicationlauncher.h	Fri May 14 16:10:06 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +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 APPLICATIONLAUNCHER_H
-#define APPLICATIONLAUNCHER_H
-
-class ApplicationLauncherPrivate;
-
-#include <QString>
-
-class ApplicationLauncher
-{
-
-public:
-    ApplicationLauncher();
-    ~ApplicationLauncher();
-
-public:
-    bool isRunning(int applicationId);
-    void startApplication(int applicationId, const QString &activityId);
-    void bringToForeground(int applicationId);
-
-private:
-    ApplicationLauncherPrivate *d_ptr;
-
-};
-
-#endif // APPLICATIONLAUNCHER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activityserviceplugin/data/activityserviceplugin.xml	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<service>
+    <name>ActivityService</name>
+    <filepath>activityserviceplugin</filepath>
+    <description>Activities service</description>
+    <interface>
+        <name>com.nokia.qt.activities.ActivityClient</name>
+        <version>1.0</version>
+        <description>Implementation of ActivityClient</description>
+    </interface>
+    <interface>
+        <name>com.nokia.qt.activities.ActivityManager</name>
+        <version>1.0</version>
+        <description>Implementation of ActivityManager</description>
+    </interface>
+</service>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activityserviceplugin/inc/activityclient.h	Thu May 27 13:11:12 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 ACTIVITYCLIENT_H
+#define ACTIVITYCLIENT_H
+
+#include <QObject>
+#include <QVariant>
+#include <QString>
+
+class ActivityClientPrivate;
+
+class ActivityClient : public QObject
+{
+
+    Q_OBJECT
+
+public:
+    ActivityClient(QObject *parent = 0);
+    ~ActivityClient();
+
+public slots:
+    bool addActivity(const QString &activityId, const QVariant &data, const QVariantHash &parameters);
+    bool removeActivity(const QString &activityId);
+    bool updateActivity(const QString &activityId, const QVariant &data, const QVariantHash &parameters);
+    QList<QVariantHash> activities() const;
+    QVariant activityData(const QString &activityId) const;
+    QVariantHash parseCommandLine(const QStringList &commandLineParams) const;
+
+signals:
+    void activityRequested(const QString &activityId);
+
+private:
+    ActivityClientPrivate *d_ptr;
+    friend class ActivityClientPrivate;
+
+};
+
+#endif // ACTIVITYCLIENT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activityserviceplugin/inc/activityclient_p.h	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,56 @@
+/*
+* 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 ACTIVITYCLIENT_P_H
+#define ACTIVITYCLIENT_P_H
+
+#include <QObject>
+#include <QVariant>
+#include <QString>
+#include <QPixmap>
+
+class ActivityClient;
+class ActivityDataStorage;
+class ActivityServerClient;
+class HsActivityDbClient;
+class ActivityClientPrivate : public QObject
+{
+
+    Q_OBJECT
+
+public:
+    ActivityClientPrivate(ActivityClient *q);
+    ~ActivityClientPrivate();
+
+public:
+    bool addActivity(const QString &activityId, const QVariant &data, const QVariantHash &parameters);
+    bool removeActivity(const QString &activityId);
+    bool updateActivity(const QString &activityId, const QVariant &data, const QVariantHash &parameters);
+    QList<QVariantHash> activities() const;
+    QVariant activityData(const QString &activityId) const;
+    QVariantHash parseCommandLine(const QStringList &commandLineParams) const;
+
+private:
+    void registerThumbnail(const QString &, QVariantHash&);
+    QString thumbnailName(const QString &) const;
+
+private:
+    ActivityDataStorage *mDataStorage;
+    HsActivityDbClient *mServerClient;
+    bool mIsconnected;
+};
+
+#endif // ACTIVITYCLIENT_P_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activityserviceplugin/inc/activitydatastorage.h	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef ACTIVITYDATASTORAGE_H
+#define ACTIVITYDATASTORAGE_H
+
+#include <QVariant>
+#include <QString>
+
+class ActivityDataStorage
+{
+
+public:
+    ActivityDataStorage();
+    ~ActivityDataStorage();
+
+public:
+    bool addActivity(const QString &activityId, const QVariant &data);
+    bool removeActivity(const QString &activityId);
+    bool updateActivity(const QString &activityId, const QVariant &data);
+    QVariant activityData(const QString &activityId) const;
+
+private:
+    bool checkTables();
+    void recreateTables();
+
+};
+
+#endif // ACTIVITYDATASTORAGE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activityserviceplugin/inc/activitymanager.h	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef ACTIVITYMANAGER_H
+#define ACTIVITYMANAGER_H
+
+#include <QObject>
+#include <QVariant>
+#include <QList>
+#include <QPixmap>
+#include <QSize>
+
+class ActivityManagerPrivate;
+
+class ActivityManager : public QObject
+{
+
+    Q_OBJECT
+
+public:
+    ActivityManager(QObject *parent = 0);
+    ~ActivityManager();
+
+public slots:
+    QList<QVariantHash> activitiesList();
+    void launchActivity(const QString &uri);
+    void launchActivity(const QUrl &uri);
+    void launchActivity(int applicationId, const QString &activityId, const QVariantHash& parameters = QVariantHash());
+    void getThumbnail(QSize resolution,const QString &thumbnailPath, void *data =0);
+
+signals:
+    void thumbnailReady(QPixmap, void *);
+    void dataChanged();
+
+private:
+    ActivityManagerPrivate *d_ptr;
+
+    friend class ActivityManagerPrivate;
+};
+
+#endif // ACTIVITYMANAGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activityserviceplugin/inc/activitymanager_p.h	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef ACTIVITYMANAGER_P_H
+#define ACTIVITYMANAGER_P_H
+
+#include <QObject>
+#include <QVariant>
+#include <QList>
+#include <QSize>
+#include "applicationlauncher.h"
+
+class ActivityManager;
+class HsActivityDbClient;
+
+class ActivityManagerPrivate : public QObject
+{
+
+    Q_OBJECT
+
+public:
+    ActivityManagerPrivate(ActivityManager *q);
+    ~ActivityManagerPrivate();
+
+public slots:
+    QList<QVariantHash> activitiesList();
+    void launchActivity(const QUrl &uri);
+    void launchActivity(int applicationId, const QString &activityId, const QVariantHash& parameters);
+    void getThumbnail(QSize resolution,const QString &thumbnailPath, void *data);
+
+private:
+    void launchActivity(const QVariantHash& activity);
+    QUrl activityToUri(const QVariantHash& activity) const;
+    
+private:
+    ActivityManager *q_ptr;
+    HsActivityDbClient *mServerClient;
+};
+
+#endif // ACTIVITYMANAGER_P_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activityserviceplugin/inc/activityserviceplugin.h	Thu May 27 13:11:12 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 ACTIVITYSERVICEPLUGIN_H
+#define ACTIVITYSERVICEPLUGIN_H
+
+#include <QObject>
+#include <qserviceplugininterface.h>
+
+QTM_USE_NAMESPACE
+
+class ActivityServicePlugin : public QObject, public QServicePluginInterface
+{
+    Q_OBJECT
+    Q_INTERFACES(QtMobility::QServicePluginInterface)
+
+public:
+    QObject *createInstance(const QServiceInterfaceDescriptor &descriptor, QServiceContext *context, QAbstractSecuritySession *session);
+
+};
+
+#endif //ACTIVITYSERVICEPLUGIN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activityserviceplugin/inc/applicationlauncher.h	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef APPLICATIONLAUNCHER_H
+#define APPLICATIONLAUNCHER_H
+
+class ApplicationLauncherPrivate;
+
+#include <QString>
+#include <QUrl>
+
+class ApplicationLauncher
+{
+
+public:
+    ApplicationLauncher();
+    ~ApplicationLauncher();
+
+public:
+    bool isRunning(int applicationId);
+    void startApplication(int applicationId, const QUrl &uri);
+    void bringToForeground(int applicationId);
+
+private:
+    ApplicationLauncherPrivate *d_ptr;
+
+};
+
+#endif // APPLICATIONLAUNCHER_H
--- a/activityfw/activityserviceplugin/s60/activitydatabase_p.cpp	Fri May 14 16:10:06 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "activitydatabase_p.h"
-
-#include <QSqlDatabase>
-#include <QSqlQuery>
-#include <QSqlError>
-#include <QStringList>
-#include <QSettings>
-
-
-
-ActivityDatabasePrivate::ActivityDatabasePrivate()
-{
-    mClient.connect();
-}
-
-ActivityDatabasePrivate::~ActivityDatabasePrivate()
-{
-}
-
-void ActivityDatabasePrivate::saveActivity(const QString &applicationName, const QString &activityName, const QVariantHash &activityMetadata)
-{
-    QVariantHash request(activityMetadata);
-    request.insert(ActivityApplicationKeyword,applicationName);
-    request.insert(ActivityActivityKeyword,activityName);
-    mClient.saveActivity(request);
-
-}
-
-void ActivityDatabasePrivate::deleteActivity(const QString &applicationName, const QString &activityName)
-{
-    QVariantHash request;
-    request.insert(ActivityApplicationKeyword,applicationName);
-    request.insert(ActivityActivityKeyword,activityName);
-    mClient.deleteActivity(request);
-}
-
-void ActivityDatabasePrivate::deleteApplicationActivities(const QString &applicationName)
-{
-    QVariantHash request;
-    request.insert(ActivityApplicationKeyword,applicationName);
-    mClient.deleteApplicationActivities(request);
-}
-
-QList<QVariantHash> ActivityDatabasePrivate::allActivitiesList()
-{
-    QList<QVariantHash> retVal;
-    mClient.activities(retVal);
-    return retVal;
-}
-
-QList<QVariantHash> ActivityDatabasePrivate::applicationActivitiesList(const QString &applicationName)
-{
-    QList<QVariantHash> result;
-    QVariantHash request;
-    request.insert(ActivityApplicationKeyword,applicationName);
-    mClient.applicationActivities(result, request);
-    return result;
-}
-
-
-QString ActivityDatabasePrivate::requestedActivityName(const QString &applicationName)
-{
-    QString result;
-    QVariantHash request;
-    request.insert(ActivityApplicationKeyword,applicationName);
-    mClient.requestedActivityName(result, request);
-    return result;
-}
-
-void ActivityDatabasePrivate::setActivityRequestFlag(const QString &applicationName, const QString &activityName)
-{
-    QVariantHash request;
-    request.insert(ActivityApplicationKeyword,applicationName);
-    request.insert(ActivityActivityKeyword,activityName);
-    mClient.setActivityRequestFlag(request);
-}
-
-void ActivityDatabasePrivate::clearActivityRequestFlag(const QString &applicationName, const QString &activityName)
-{
-    QVariantHash request;
-    request.insert(ActivityApplicationKeyword,applicationName);
-    request.insert(ActivityActivityKeyword,activityName);
-    mClient.clearActivityRequestFlag(request);
-}
-
--- a/activityfw/activityserviceplugin/s60/activitydatabase_p.h	Fri May 14 16:10:06 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:
-*
-*/
-#ifndef ACTIVITYDATABASE_P_H
-#define ACTIVITYDATABASE_P_H
-
-#include <QVariant>
-#include <QList>
-#include <hsactivitydbclient.h>
-class ActivityDatabasePrivate
-{
-
-public:
-    ActivityDatabasePrivate();
-    ~ActivityDatabasePrivate();
-
-public:
-    void saveActivity(const QString &applicationName, const QString &activityName, const QVariantHash &activityMetadata);
-    void deleteActivity(const QString &applicationName, const QString &activityName);
-    void deleteApplicationActivities(const QString &applicationName);
-    QList<QVariantHash> allActivitiesList();
-    QList<QVariantHash> applicationActivitiesList(const QString &applicationName);
-    QString requestedActivityName(const QString &applicationName);
-    void setActivityRequestFlag(const QString &applicationName, const QString &activityName);
-    void clearActivityRequestFlag(const QString &applicationName, const QString &activityName);
-
-private:
-    HsActivityDbClient mClient;
-};
-
-#endif // ACTIVITYDATABASE_P_H
--- a/activityfw/activityserviceplugin/s60/activityserverclient_p.cpp	Fri May 14 16:10:06 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:
-*
-*/
-
-#include "activityserverclient_p.h"
-
-ActivityServerClientPrivate::ActivityServerClientPrivate()
-{
-}
-
-bool ActivityServerClientPrivate::addActivity(const QString &activityId, const QVariantHash &parameters)
-{
-    return true;
-}
-
-bool ActivityServerClientPrivate::removeActivity(const QString &activityId)
-{
-    return true;
-}
-
-bool ActivityServerClientPrivate::updateActivity(const QString &activityId, const QVariantHash &parameters)
-{
-    return true;
-}
-
-QList<QVariantHash> ActivityServerClientPrivate::applicationActivities()
-{
-    return QList<QVariantHash>();
-}
-
-bool ActivityServerClientPrivate::removeActivity(int applicationId, const QString &activityId)
-{
-    return true;
-}
-
-bool ActivityServerClientPrivate::removeApplicationActivities(int applicationId)
-{
-    return true;
-}
-
-QList<QVariantHash> ActivityServerClientPrivate::activities()
-{
-    return QList<QVariantHash>();
-}
--- a/activityfw/activityserviceplugin/s60/activityserverclient_p.h	Fri May 14 16:10:06 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:
-*
-*/
-#ifndef ACTIVITYSERVERCLIENT_P_H
-#define ACTIVITYSERVERCLIENT_P_H
-
-#include <QString>
-#include <QVariantHash>
-
-class ActivityServerClient;
-
-class ActivityServerClientPrivate
-{
-
-public:
-    ActivityServerClientPrivate();
-
-public: // API used by ActivityClient
-    bool addActivity(const QString &activityId, const QVariantHash &parameters);
-    bool removeActivity(const QString &activityId);
-    bool updateActivity(const QString &activityId, const QVariantHash &parameters);
-    QList<QVariantHash> applicationActivities();
-
-public: // API  used by ActivityManager
-    bool removeActivity(int applicationId, const QString &activityId);
-    bool removeApplicationActivities(int applicationId);
-    QList<QVariantHash> activities();
-
-public:
-    ActivityServerClient *q_ptr;
-
-};
-
-#endif // ACTIVITYSERVERCLIENT_P_H
--- a/activityfw/activityserviceplugin/s60/applicationlauncher_p.cpp	Fri May 14 16:10:06 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:
-*
-*/
-#include "applicationlauncher_p.h"
-
-#include <apgcli.h>
-#include <apacmdln.h>
-#include <apgtask.h>
-#include <eikenv.h>
-
-#include <XQConversions>
-
-bool ApplicationLauncherPrivate::isRunning(int applicationId)
-{
-    TApaTaskList taskList(CEikonEnv::Static()->WsSession());
-    TApaTask task = taskList.FindApp(TUid::Uid(applicationId));
-    return task.Exists();
-}
-
-void ApplicationLauncherPrivate::startApplication(int applicationId, const QString &activityId)
-{
-    QString actId = "\""+activityId+"\"";
-    QString uri = QString("-activity appto://%1?activityname=%2").arg(uint(applicationId), 8, 16, QChar('0')).arg(actId);
-
-    QT_TRAP_THROWING( {
-        HBufC *uriAsDescriptor = XQConversions::qStringToS60Desc(uri);
-        CleanupStack::PushL(uriAsDescriptor);
-
-        RApaLsSession apaLsSession;
-        User::LeaveIfError(apaLsSession.Connect());
-        CleanupClosePushL(apaLsSession);
-
-        TApaAppInfo appInfo;
-        TInt retVal = apaLsSession.GetAppInfo(appInfo, TUid::Uid(applicationId));
-
-        if (retVal == KErrNone) {
-            RProcess application;
-            User::LeaveIfError(application.Create(appInfo.iFullName, *uriAsDescriptor));
-            application.Resume();
-        } else {
-            // @todo
-        }
-
-        CleanupStack::PopAndDestroy(&apaLsSession);
-        CleanupStack::PopAndDestroy(uriAsDescriptor);
-    }
-                    );
-}
-
-void ApplicationLauncherPrivate::bringToForeground(int applicationId)
-{
-    TApaTaskList taskList(CEikonEnv::Static()->WsSession());
-    TApaTask task = taskList.FindApp(TUid::Uid(applicationId));
-    if (task.Exists()) {
-        task.BringToForeground();
-    } else {
-        qCritical("Cannot bring to forward task %08x", applicationId);
-    }
-}
--- a/activityfw/activityserviceplugin/s60/applicationlauncher_p.h	Fri May 14 16:10:06 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +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 APPLICATIONLAUNCHER_P_H
-#define APPLICATIONLAUNCHER_P_H
-
-#include <QString>
-
-class ApplicationLauncherPrivate
-{
-
-public:
-    bool isRunning(int applicationId);
-    void startApplication(int applicationId, const QString &activityId);
-    void bringToForeground(int applicationId);
-
-};
-
-#endif // APPLICATIONLAUNCHER_P_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activityserviceplugin/s60/inc/activitydatabase_p.h	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef ACTIVITYDATABASE_P_H
+#define ACTIVITYDATABASE_P_H
+
+#include <QVariant>
+#include <QList>
+#include <hsactivitydbclient.h>
+class ActivityDatabasePrivate
+{
+
+public:
+    ActivityDatabasePrivate();
+    ~ActivityDatabasePrivate();
+
+public:
+    void saveActivity(const QString &applicationName, const QString &activityName, const QVariantHash &activityMetadata);
+    void deleteActivity(const QString &applicationName, const QString &activityName);
+    void deleteApplicationActivities(const QString &applicationName);
+    QList<QVariantHash> allActivitiesList();
+    QList<QVariantHash> applicationActivitiesList(const QString &applicationName);
+    QString requestedActivityName(const QString &applicationName);
+    void setActivityRequestFlag(const QString &applicationName, const QString &activityName);
+    void clearActivityRequestFlag(const QString &applicationName, const QString &activityName);
+
+private:
+    HsActivityDbClient mClient;
+};
+
+#endif // ACTIVITYDATABASE_P_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activityserviceplugin/s60/inc/activityserverclient_p.h	Thu May 27 13:11:12 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 ACTIVITYSERVERCLIENT_P_H
+#define ACTIVITYSERVERCLIENT_P_H
+
+#include <QString>
+#include <QVariantHash>
+
+class ActivityServerClient;
+
+class ActivityServerClientPrivate
+{
+
+public:
+    ActivityServerClientPrivate();
+
+public: // API used by ActivityClient
+    bool addActivity(const QString &activityId, const QVariantHash &parameters);
+    bool removeActivity(const QString &activityId);
+    bool updateActivity(const QString &activityId, const QVariantHash &parameters);
+    QList<QVariantHash> applicationActivities();
+
+public: // API  used by ActivityManager
+    bool removeActivity(int applicationId, const QString &activityId);
+    bool removeApplicationActivities(int applicationId);
+    QList<QVariantHash> activities();
+
+public:
+    ActivityServerClient *q_ptr;
+
+};
+
+#endif // ACTIVITYSERVERCLIENT_P_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activityserviceplugin/s60/inc/applicationlauncher_p.h	Thu May 27 13:11:12 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:
+*
+*/
+#ifndef APPLICATIONLAUNCHER_P_H
+#define APPLICATIONLAUNCHER_P_H
+
+#include <QString>
+#include <QUrl>
+
+class ApplicationLauncherPrivate
+{
+
+public:
+    bool isRunning(int applicationId);
+    void startApplication(int applicationId, const QUrl &uri);
+    void bringToForeground(int applicationId);
+
+};
+
+#endif // APPLICATIONLAUNCHER_P_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activityserviceplugin/s60/src/activitydatabase_p.cpp	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,102 @@
+/*
+* 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 "activitydatabase_p.h"
+
+#include <QSqlDatabase>
+#include <QSqlQuery>
+#include <QSqlError>
+#include <QStringList>
+#include <QSettings>
+
+
+
+ActivityDatabasePrivate::ActivityDatabasePrivate()
+{
+    mClient.connect();
+}
+
+ActivityDatabasePrivate::~ActivityDatabasePrivate()
+{
+}
+
+void ActivityDatabasePrivate::saveActivity(const QString &applicationName, const QString &activityName, const QVariantHash &activityMetadata)
+{
+    QVariantHash request(activityMetadata);
+    request.insert(ActivityApplicationKeyword,applicationName);
+    request.insert(ActivityActivityKeyword,activityName);
+    mClient.saveActivity(request);
+
+}
+
+void ActivityDatabasePrivate::deleteActivity(const QString &applicationName, const QString &activityName)
+{
+    QVariantHash request;
+    request.insert(ActivityApplicationKeyword,applicationName);
+    request.insert(ActivityActivityKeyword,activityName);
+    mClient.deleteActivity(request);
+}
+
+void ActivityDatabasePrivate::deleteApplicationActivities(const QString &applicationName)
+{
+    QVariantHash request;
+    request.insert(ActivityApplicationKeyword,applicationName);
+    mClient.deleteApplicationActivities(request);
+}
+
+QList<QVariantHash> ActivityDatabasePrivate::allActivitiesList()
+{
+    QList<QVariantHash> retVal;
+    mClient.activities(retVal);
+    return retVal;
+}
+
+QList<QVariantHash> ActivityDatabasePrivate::applicationActivitiesList(const QString &applicationName)
+{
+    QList<QVariantHash> result;
+    QVariantHash request;
+    request.insert(ActivityApplicationKeyword,applicationName);
+    mClient.applicationActivities(result, request);
+    return result;
+}
+
+
+QString ActivityDatabasePrivate::requestedActivityName(const QString &applicationName)
+{
+    QString result;
+    QVariantHash request;
+    request.insert(ActivityApplicationKeyword,applicationName);
+    mClient.requestedActivityName(result, request);
+    return result;
+}
+
+void ActivityDatabasePrivate::setActivityRequestFlag(const QString &applicationName, const QString &activityName)
+{
+    QVariantHash request;
+    request.insert(ActivityApplicationKeyword,applicationName);
+    request.insert(ActivityActivityKeyword,activityName);
+    mClient.setActivityRequestFlag(request);
+}
+
+void ActivityDatabasePrivate::clearActivityRequestFlag(const QString &applicationName, const QString &activityName)
+{
+    QVariantHash request;
+    request.insert(ActivityApplicationKeyword,applicationName);
+    request.insert(ActivityActivityKeyword,activityName);
+    mClient.clearActivityRequestFlag(request);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activityserviceplugin/s60/src/activityserverclient_p.cpp	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,57 @@
+/*
+* 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 "activityserverclient_p.h"
+
+ActivityServerClientPrivate::ActivityServerClientPrivate()
+{
+}
+
+bool ActivityServerClientPrivate::addActivity(const QString &activityId, const QVariantHash &parameters)
+{
+    return true;
+}
+
+bool ActivityServerClientPrivate::removeActivity(const QString &activityId)
+{
+    return true;
+}
+
+bool ActivityServerClientPrivate::updateActivity(const QString &activityId, const QVariantHash &parameters)
+{
+    return true;
+}
+
+QList<QVariantHash> ActivityServerClientPrivate::applicationActivities()
+{
+    return QList<QVariantHash>();
+}
+
+bool ActivityServerClientPrivate::removeActivity(int applicationId, const QString &activityId)
+{
+    return true;
+}
+
+bool ActivityServerClientPrivate::removeApplicationActivities(int applicationId)
+{
+    return true;
+}
+
+QList<QVariantHash> ActivityServerClientPrivate::activities()
+{
+    return QList<QVariantHash>();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activityserviceplugin/s60/src/applicationlauncher_p.cpp	Thu May 27 13:11:12 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 "applicationlauncher_p.h"
+
+#include <apgcli.h>
+#include <apacmdln.h>
+#include <apgtask.h>
+#include <eikenv.h>
+
+#include <XQConversions>
+
+bool ApplicationLauncherPrivate::isRunning(int applicationId)
+{
+    TApaTaskList taskList(CEikonEnv::Static()->WsSession());
+    TApaTask task = taskList.FindApp(TUid::Uid(applicationId));
+    return task.Exists();
+}
+
+void ApplicationLauncherPrivate::startApplication(int applicationId, const QUrl &uri)
+{
+    QString commandLine = QString("-activity %1").arg(uri.toString());
+
+    QT_TRAP_THROWING( {
+        HBufC *commandLineAsDescriptor = XQConversions::qStringToS60Desc(commandLine);
+        CleanupStack::PushL(commandLineAsDescriptor);
+
+        RApaLsSession apaLsSession;
+        User::LeaveIfError(apaLsSession.Connect());
+        CleanupClosePushL(apaLsSession);
+
+        TApaAppInfo appInfo;
+        TInt retVal = apaLsSession.GetAppInfo(appInfo, TUid::Uid(applicationId));
+
+        if (retVal == KErrNone) {
+            RProcess application;
+            User::LeaveIfError(application.Create(appInfo.iFullName, *commandLineAsDescriptor));
+            application.Resume();
+        } else {
+            // @todo ?
+        }
+
+        CleanupStack::PopAndDestroy(&apaLsSession);
+        CleanupStack::PopAndDestroy(commandLineAsDescriptor);
+    }
+                    );
+}
+
+void ApplicationLauncherPrivate::bringToForeground(int applicationId)
+{
+    TApaTaskList taskList(CEikonEnv::Static()->WsSession());
+    TApaTask task = taskList.FindApp(TUid::Uid(applicationId));
+    if (task.Exists()) {
+        task.BringToForeground();
+    } else {
+        qCritical("Cannot bring to forward task %08x", applicationId);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activityserviceplugin/src/activityclient.cpp	Thu May 27 13:11:12 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 "activityclient.h"
+#include "activityclient_p.h"
+
+ActivityClient::ActivityClient(QObject *parent) : QObject(parent)
+{
+    qDebug("[JCH] activity client creation started");
+    d_ptr = new ActivityClientPrivate(this);
+    qDebug("[JCH] activity client creation stopped");
+}
+
+ActivityClient::~ActivityClient()
+{
+}
+
+bool ActivityClient::addActivity(const QString &activityId, const QVariant &data, const QVariantHash &parameters)
+{
+    return d_ptr->addActivity(activityId, data, parameters);
+}
+
+bool ActivityClient::removeActivity(const QString &activityId)
+{
+    return d_ptr->removeActivity(activityId);
+}
+
+bool ActivityClient::updateActivity(const QString &activityId, const QVariant &data, const QVariantHash &parameters)
+{
+    return d_ptr->updateActivity(activityId, data, parameters);
+}
+
+QList<QVariantHash> ActivityClient::activities() const
+{
+    return d_ptr->activities();
+}
+
+QVariant ActivityClient::activityData(const QString &activityId) const
+{
+    return d_ptr->activityData(activityId);
+}
+
+QVariantHash ActivityClient::parseCommandLine(const QStringList &commandLineParams) const
+{
+    return d_ptr->parseCommandLine(commandLineParams);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activityserviceplugin/src/activityclient_p.cpp	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,163 @@
+/*
+* 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 "activityclient_p.h"
+#include "activityclient.h"
+#include "activitydatastorage.h"
+#include <hsactivitydbclient.h>
+
+#include <QCoreApplication>
+#include <QStringList>
+#include <QTimer>
+#include <QUrl>
+#include <QDebug>
+#include <QDir>
+
+ActivityClientPrivate::ActivityClientPrivate(ActivityClient *q) : QObject(q), mIsconnected(false)
+{
+    mDataStorage = new ActivityDataStorage();
+    mServerClient = new HsActivityDbClient();
+    mIsconnected = ( KErrNone == mServerClient->connect());
+    if( mIsconnected) {
+        mServerClient->waitActivity(QVariantHash());
+    }
+    connect(mServerClient, SIGNAL(activityRequested(QString)), q, SIGNAL(activityRequested(QString)));
+}
+
+ActivityClientPrivate::~ActivityClientPrivate()
+{
+    delete mServerClient;
+    delete mDataStorage;
+}
+
+bool ActivityClientPrivate::addActivity(const QString &activityId, const QVariant &data, const QVariantHash &parameters)
+{
+    bool result(false);
+    if (mIsconnected) {
+        result = mDataStorage->addActivity(activityId, data);
+        if ( result ) {
+            QVariantHash activity(parameters);
+            RProcess process;
+            registerThumbnail(activityId, activity);
+            activity.insert(ActivityApplicationKeyword, static_cast<int>(process.SecureId().iId));
+            activity.insert(ActivityActivityKeyword, activityId);
+            int error = mServerClient->addActivity(activity);
+            result = error == KErrNone ? true : false;
+        }
+    }
+    // @todo make those operations atomic
+    return result;
+}
+
+bool ActivityClientPrivate::removeActivity(const QString &activityId)
+{
+    bool result(false);
+    if (mIsconnected) {
+        result = mDataStorage->removeActivity(activityId);
+        if ( result ) {            
+            QVariantHash activity;
+            RProcess process;
+            activity.insert(ActivityApplicationKeyword, static_cast<int>(process.SecureId().iId));
+            activity.insert(ActivityActivityKeyword, activityId);
+            int error = mServerClient->removeActivity(activity);
+            result = error == KErrNone ? true : false;
+            if (result) {
+                result = QFile::remove(thumbnailName(activityId));
+            }
+        }
+    }
+    // @todo make those operations atomic
+    return result;
+}
+
+bool ActivityClientPrivate::updateActivity(const QString &activityId, const QVariant &data, const QVariantHash &parameters)
+{
+    bool result(false);
+    if (mIsconnected) {
+        result = mDataStorage->updateActivity(activityId, data);
+        if ( result ) {
+            QVariantHash activity(parameters);
+            RProcess process;
+            registerThumbnail(activityId, activity);
+            activity.insert(ActivityApplicationKeyword, static_cast<int>(process.SecureId().iId));
+            activity.insert(ActivityActivityKeyword, activityId);
+            int error = mServerClient->updateActivity(activity);
+            result = error == KErrNone ? true : false;
+        }
+    }
+    // @todo make those operations atomic
+    return result;
+}
+
+QList<QVariantHash> ActivityClientPrivate::activities() const
+{
+    QList<QVariantHash> activities;
+    if (mIsconnected) {
+        QVariantHash activity;
+        RProcess process;
+        activity.insert(ActivityApplicationKeyword, static_cast<int>(process.SecureId().iId));
+        mServerClient->applicationActivities(activities, activity);
+    }
+    return activities;
+}
+
+QVariant ActivityClientPrivate::activityData(const QString &activityId) const
+{
+    return mIsconnected ? mDataStorage->activityData(activityId) : QVariant();
+}
+
+QVariantHash ActivityClientPrivate::parseCommandLine(const QStringList &commandLineParams) const
+{
+    QVariantHash activityParams;
+    int activityMarkerIndex = commandLineParams.indexOf("-activity");
+    if (activityMarkerIndex != -1 && commandLineParams.count() - 1 > activityMarkerIndex) {
+        QUrl activityUri(commandLineParams.at(activityMarkerIndex+1));
+        if (activityUri.scheme() == "appto") {
+            QList<QPair<QString, QString> > parameters = activityUri.queryItems();
+            for (QList<QPair<QString, QString> >::const_iterator i = parameters.constBegin(); i != parameters.constEnd(); ++i) {
+                activityParams.insert(i->first, i->second);
+            }
+
+            if (activityParams.contains("activityname") && !activityParams.value("activityname").toString().isEmpty()) {
+                return activityParams;
+            }
+        }
+    }
+    return QVariantHash();
+}
+
+void ActivityClientPrivate::registerThumbnail(const QString &name, QVariantHash &activity)
+{
+    QVariantHash::const_iterator findIterator(activity.constFind(ActivityScreenshotKeyword));
+    if (activity.constEnd() != findIterator   &&
+        findIterator.value().canConvert<QPixmap>()) {
+        const QString thumbnailManagerName = thumbnailName(name);
+        if (findIterator.value().value<QPixmap>().save(thumbnailManagerName)) {
+            activity.insert(ActivityScreenshotKeyword, thumbnailManagerName);
+        } else {
+            activity.remove(ActivityScreenshotKeyword);
+        }
+    }
+}
+
+QString ActivityClientPrivate::thumbnailName(const QString &activityId) const
+{
+    return QDir::toNativeSeparators(qApp->applicationDirPath() + 
+                                    "/" + 
+                                    QString::number(qHash(activityId), 16) + 
+                                    ".png");
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activityserviceplugin/src/activitydatastorage.cpp	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,171 @@
+/*
+* 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 "activitydatastorage.h"
+
+#include <QSqlDatabase>
+#include <QSqlQuery>
+#include <QSqlError>
+#include <QStringList>
+
+const char KConnectionName[] = "ActivityDataStorage";
+
+ActivityDataStorage::ActivityDataStorage()
+{
+    QSqlDatabase database;
+    if (QSqlDatabase::contains(KConnectionName)) {
+        database = QSqlDatabase::database(KConnectionName);
+    } else {
+        database = QSqlDatabase::addDatabase("QSQLITE", KConnectionName);
+        database.setDatabaseName("activitydatastorage.db");
+        if (!database.open()) {
+            qFatal(qPrintable(database.lastError().text()));
+        }
+    }
+
+    if (!checkTables()) {
+        recreateTables();
+    }
+}
+
+ActivityDataStorage::~ActivityDataStorage()
+{
+    QSqlDatabase::database(KConnectionName).close();
+}
+
+bool ActivityDataStorage::addActivity(const QString &activityId, const QVariant &data)
+{
+    QSqlDatabase database = QSqlDatabase::database(KConnectionName);
+
+    QByteArray streamedData;
+    {
+        QDataStream stream(&streamedData, QIODevice::WriteOnly);
+        stream << data;
+    }
+
+    // insert data
+    QSqlQuery query(database);
+    if (!query.prepare("INSERT INTO Activities(Name, Data) VALUES(:Name, :Data)")) {
+        qCritical(qPrintable(query.lastError().text()));
+        return false;
+    }
+    query.bindValue(":Name", activityId);
+    query.bindValue(":Data", streamedData);
+    if (!query.exec()) {
+        qCritical(qPrintable(query.lastError().text()));
+        return false;
+    }
+
+    return true;
+}
+
+bool ActivityDataStorage::removeActivity(const QString &activityId)
+{
+    QString sqlCommand = QString("DELETE FROM Activities WHERE Name = '%1'").arg(activityId);
+    QSqlQuery query(QSqlDatabase::database(KConnectionName));
+    if (!query.exec(sqlCommand)) {
+        qCritical(qPrintable(query.lastError().text()));
+        return false;
+    }
+    return query.numRowsAffected() > 0;
+}
+
+bool ActivityDataStorage::updateActivity(const QString &activityId, const QVariant &data)
+{
+    QSqlDatabase database = QSqlDatabase::database(KConnectionName);
+
+    QByteArray streamedData;
+    {
+        QDataStream stream(&streamedData, QIODevice::WriteOnly);
+        stream << data;
+    }
+
+    // update data
+    QSqlQuery query(database);
+    if (!query.prepare("UPDATE Activities SET Data = :Data WHERE Name = :Name")) {
+        qCritical(qPrintable(query.lastError().text()));
+        return false;
+    }
+    query.bindValue(":Data", streamedData);
+    query.bindValue(":Name", activityId);
+    if (!query.exec()) {
+        qCritical(qPrintable(query.lastError().text()));
+        return false;
+    }
+
+    return query.numRowsAffected() > 0;
+}
+
+QVariant ActivityDataStorage::activityData(const QString &activityId) const
+{
+    QSqlDatabase database = QSqlDatabase::database(KConnectionName);
+    QSqlQuery query(database);
+    if (!query.exec(QString("SELECT Data FROM Activities WHERE Name = '%1'").arg(activityId))) {
+        qCritical(qPrintable(query.lastError().text()));
+        return QVariant();
+    }
+
+    QVariant result;
+    if (query.next()) {
+        QByteArray data(query.value(0).toByteArray());
+        QDataStream stream(&data, QIODevice::ReadOnly);
+        stream >> result;
+    }
+    return result;
+}
+
+bool ActivityDataStorage::checkTables()
+{
+    QStringList expectedTables("Activities");
+    QStringList actualTables = QSqlDatabase::database(KConnectionName).tables();
+    return (expectedTables == actualTables);
+}
+
+void ActivityDataStorage::recreateTables()
+{
+    QSqlDatabase database = QSqlDatabase::database(KConnectionName);
+
+    if (!database.transaction()) {
+        qFatal(qPrintable(database.lastError().text()));
+    }
+
+    // drop any existing tables
+    {
+        QSqlQuery dropQuery(database);
+        foreach(const QString &tableName, database.tables()) {
+            if (!dropQuery.exec(QString("DROP TABLE %1").arg(tableName))) {
+                qFatal(qPrintable(dropQuery.lastError().text()));
+            }
+        }
+    }
+
+    // create new table
+    {
+        QSqlQuery createQuery(database);
+        QString statement(
+            "CREATE TABLE Activities("
+            "Name TEXT NOT NULL PRIMARY KEY UNIQUE,"
+            "Data BLOB NOT NULL)");
+
+        if (!createQuery.exec(statement)) {
+            qFatal(qPrintable(createQuery.lastError().text()));
+        }
+    }
+
+    if (!database.commit()) {
+        qFatal(qPrintable(database.lastError().text()));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activityserviceplugin/src/activitymanager.cpp	Thu May 27 13:11:12 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:
+*
+*/
+
+#include "activitymanager.h"
+#include "activitymanager_p.h"
+
+#include <QUrl>
+
+ActivityManager::ActivityManager(QObject *parent) : QObject(parent), d_ptr(new ActivityManagerPrivate(this))
+{
+}
+
+ActivityManager::~ActivityManager()
+{
+}
+
+QList<QVariantHash> ActivityManager::activitiesList()
+{
+    return d_ptr->activitiesList();
+}
+
+void ActivityManager::launchActivity(const QUrl &uri)
+{
+    d_ptr->launchActivity(uri);
+}
+
+void ActivityManager::launchActivity(const QString &uri)
+{
+    qWarning("ActivityManager::launchActivity(const QString &uri) is deprecated, use ActivityManager::launchActivity(const QUrl &uri) instead");
+    launchActivity(QUrl(uri));
+}
+
+void ActivityManager::launchActivity(int applicationId, const QString &activityId, const QVariantHash& parameters)
+{
+    d_ptr->launchActivity(applicationId, activityId, parameters);
+}
+
+void ActivityManager::getThumbnail(QSize resolution,const QString &thumbnailPath, void *data)
+{
+   d_ptr->getThumbnail(resolution, thumbnailPath, data);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activityserviceplugin/src/activitymanager_p.cpp	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,124 @@
+/*
+* 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 "activitymanager_p.h"
+#include "activitymanager.h"
+#include <hsactivitydbclient.h>
+
+#include <QStringList>
+#include <QUrl>
+
+ActivityManagerPrivate::ActivityManagerPrivate(ActivityManager *q) : QObject(q), q_ptr(q)
+{
+    mServerClient = new HsActivityDbClient();
+    if(0 == mServerClient->connect()){
+        mServerClient->notifyDataChange();
+    }
+    connect(mServerClient,
+            SIGNAL(thumbnailRequested(QPixmap, void *)),
+            q,
+            SIGNAL(thumbnailReady(QPixmap, void *)));
+    connect(mServerClient,
+            SIGNAL(dataChanged()),
+            q,
+            SIGNAL(dataChanged()));
+}
+
+ActivityManagerPrivate::~ActivityManagerPrivate()
+{
+    delete mServerClient;
+}
+
+QList<QVariantHash> ActivityManagerPrivate::activitiesList()
+{
+    QList<QVariantHash> retVal;
+    mServerClient->activities(retVal);
+    return retVal;
+}
+
+void ActivityManagerPrivate::launchActivity(const QUrl &uri)
+{
+    if (uri.scheme() != "appto")
+        return;
+
+    bool conversionOk(false);
+    int applicationId = uri.host().toUInt(&conversionOk, 16);   
+    if (!conversionOk)
+        return;
+        
+    QVariantHash activity;
+    activity.insert(ActivityApplicationKeyword, applicationId);
+    
+    QVariantHash parameters;
+    QList<QPair<QString, QString> > uriParams = uri.queryItems();
+    for (QList<QPair<QString, QString> >::const_iterator i = uriParams.constBegin(); i != uriParams.constEnd(); ++i) {
+        parameters.insert(i->first, i->second);
+    }
+
+    if (parameters.contains("activityname")) {
+        activity.insert(ActivityActivityKeyword, parameters.value("activityname").toString());
+        parameters.remove("activityname");
+    }
+    
+    activity.insert(ActivityParametersKeyword, parameters);
+    
+    launchActivity(activity);
+}
+
+void ActivityManagerPrivate::launchActivity(int applicationId, const QString &activityId, const QVariantHash& parameters)
+{
+    QVariantHash activity;
+    activity.insert(ActivityApplicationKeyword, applicationId);
+    activity.insert(ActivityActivityKeyword, activityId);
+    activity.insert(ActivityParametersKeyword, parameters);
+    
+    launchActivity(activity);
+}
+
+void ActivityManagerPrivate::launchActivity(const QVariantHash &activity)
+{
+    ApplicationLauncher applicationLauncher;
+    int applicationId = activity.value(ActivityApplicationKeyword).toInt();
+    
+    if (applicationLauncher.isRunning(applicationId)) {
+        mServerClient->launchActivity(activity);
+        applicationLauncher.bringToForeground(applicationId);
+    } else {
+        applicationLauncher.startApplication(applicationId, activityToUri(activity));
+    }
+}
+
+QUrl ActivityManagerPrivate::activityToUri(const QVariantHash &activity) const
+{
+    QUrl uri;
+    uri.setScheme("appto");
+    uri.setHost(QString("%1").arg(activity.value(ActivityApplicationKeyword).toUInt(), 8, 16, QChar('0')));
+    
+    if (activity.contains(ActivityActivityKeyword))
+        uri.addQueryItem("activityname", activity.value(ActivityActivityKeyword).toString());
+    
+    QVariantHash parameters = activity.value(ActivityParametersKeyword).toHash();
+    foreach(const QString &key, parameters.keys()) {
+        uri.addQueryItem(key, parameters.value(key).toString());
+    } 
+    
+    return uri;
+}
+
+void ActivityManagerPrivate::getThumbnail(QSize resolution,const QString &thumbnailPath, void *data)
+{
+    mServerClient->getThumbnail(resolution, thumbnailPath, "image/png", data);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activityserviceplugin/src/activityserviceplugin.cpp	Thu May 27 13:11:12 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:
+*
+*/
+
+#include "activityserviceplugin.h"
+
+#include <qserviceinterfacedescriptor.h>
+#include <qabstractsecuritysession.h>
+#include <qservicecontext.h>
+
+#include "activityclient.h"
+#include "activitymanager.h"
+
+QObject *ActivityServicePlugin::createInstance(const QServiceInterfaceDescriptor &descriptor, QServiceContext *context, QAbstractSecuritySession *session)
+{
+    Q_UNUSED(context);
+    Q_UNUSED(session);
+
+    if (descriptor.interfaceName() == "com.nokia.qt.activities.ActivityClient") {
+        return new ActivityClient();
+    } else if (descriptor.interfaceName() == "com.nokia.qt.activities.ActivityManager") {
+        return new ActivityManager();
+    } else {
+        return NULL;
+    }
+}
+
+Q_EXPORT_PLUGIN2(activityserviceplugin, ActivityServicePlugin)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activityserviceplugin/src/applicationlauncher.cpp	Thu May 27 13:11:12 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 "applicationlauncher.h"
+#include "applicationlauncher_p.h"
+
+ApplicationLauncher::ApplicationLauncher() : d_ptr(new ApplicationLauncherPrivate())
+{
+}
+
+ApplicationLauncher::~ApplicationLauncher()
+{
+    delete d_ptr;
+}
+
+bool ApplicationLauncher::isRunning(int applicationId)
+{
+    return d_ptr->isRunning(applicationId);
+}
+
+void ApplicationLauncher::startApplication(int applicationId, const QUrl &uri)
+{
+    d_ptr->startApplication(applicationId, uri);
+}
+
+void ApplicationLauncher::bringToForeground(int applicationId)
+{
+    d_ptr->bringToForeground(applicationId);
+}
--- a/activityfw/activityserviceplugin/symbianinstaller/activityserviceinstaller/activityserviceinstaller.qrc	Fri May 14 16:10:06 2010 +0300
+++ b/activityfw/activityserviceplugin/symbianinstaller/activityserviceinstaller/activityserviceinstaller.qrc	Thu May 27 13:11:12 2010 +0300
@@ -1,5 +1,5 @@
 <RCC>
     <qresource prefix="/" >
-        <file alias="activityserviceplugin.xml">../../activityserviceplugin.xml</file>
+        <file alias="activityserviceplugin.xml">../../data/activityserviceplugin.xml</file>
     </qresource>
 </RCC>
--- a/activityfw/activityserviceplugin/win/activitydatabase_p.cpp	Fri May 14 16:10:06 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,249 +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 "activitydatabase_p.h"
-
-#include <QSqlDatabase>
-#include <QSqlQuery>
-#include <QSqlError>
-#include <QStringList>
-#include <QSettings>
-
-#include <hsactivitydbclient.h>
-
-const char KConnectionName[] = "ActivityDatabase";
-
-ActivityDatabasePrivate::ActivityDatabasePrivate()
-{
-    // determine database localization
-    QSettings settings("nokia", "activities");
-    if (!settings.contains("activitydatabase")) {
-        settings.setValue("activitydatabase", "C:\\activitydatabase.db");
-    }
-    QString databaseFile = settings.value("activitydatabase").toString();
-
-    QSqlDatabase database;
-    if (QSqlDatabase::contains(KConnectionName)) {
-        database = QSqlDatabase::database(KConnectionName);
-    } else {
-        database = QSqlDatabase::addDatabase("QSQLITE", KConnectionName);
-        database.setDatabaseName(databaseFile);
-        if (!database.open()) {
-            qFatal(qPrintable(database.lastError().text()));
-        }
-    }
-
-    if (!checkTables()) {
-        recreateTables();
-    }
-}
-
-ActivityDatabasePrivate::~ActivityDatabasePrivate()
-{
-    QSqlDatabase::database(KConnectionName).close();
-}
-
-void ActivityDatabasePrivate::saveActivity(const QString &applicationName, const QString &activityName, const QVariantHash &activityMetadata)
-{
-    if (applicationName.isEmpty() || activityName.isEmpty() || activityMetadata.value("screenshot").isNull()) {
-        qWarning("Activity entry is invalid, aborting save");
-        return;
-    }
-
-    QVariantHash activityData(activityMetadata);
-    activityData.insert(ActivityApplicationKeyword, applicationName);
-    activityData.insert(ActivityActivityKeyword, activityName);
-
-    // stream whole entry to bytearray
-    QByteArray streamedData;
-    {
-        QDataStream stream(&streamedData, QIODevice::WriteOnly);
-        stream << activityData;
-    }
-
-    QSqlDatabase database = QSqlDatabase::database(KConnectionName);
-
-    if (!database.transaction()) {
-        qFatal(qPrintable(database.lastError().text()));
-    }
-
-    // update or insert data
-    {
-        QSqlQuery query(database);
-        if (!query.exec(QString("SELECT ApplicationName FROM Activities WHERE ApplicationName = '%1' AND ActivityName = '%2'").arg(applicationName).arg(activityName))) {
-            qFatal(qPrintable(query.lastError().text()));
-        }
-
-        if (query.next()) {
-            if (!query.prepare("UPDATE Activities SET Data = :Data WHERE ApplicationName = :ApplicationName AND ActivityName = :ActivityName")) {
-                qFatal(qPrintable(query.lastError().text()));
-            }
-            query.bindValue(":Data", streamedData);
-            query.bindValue(":ApplicationName", applicationName);
-            query.bindValue(":ActivityName", activityName);
-            if (!query.exec()) {
-                qFatal(qPrintable(query.lastError().text()));
-            }
-        } else {
-            if (!query.prepare("INSERT INTO Activities(ApplicationName, ActivityName, Data) VALUES(:ApplicationName, :ActivityName, :Data)")) {
-                qFatal(qPrintable(query.lastError().text()));
-            }
-            query.bindValue(":ApplicationName", applicationName);
-            query.bindValue(":ActivityName", activityName);
-            query.bindValue(":Data", streamedData);
-            if (!query.exec()) {
-                qFatal(qPrintable(query.lastError().text()));
-            }
-        }
-    }
-
-    if (!database.commit()) {
-        qFatal(qPrintable(database.lastError().text()));
-    }
-}
-
-void ActivityDatabasePrivate::deleteActivity(const QString &applicationName, const QString &activityName)
-{
-    QString sqlCommand = QString("DELETE FROM Activities WHERE ApplicationName = '%1' AND ActivityName = '%2'").arg(applicationName).arg(activityName);
-    QSqlQuery query(QSqlDatabase::database(KConnectionName));
-    if (!query.exec(sqlCommand)) {
-        qFatal(qPrintable(query.lastError().text()));
-    }
-}
-
-void ActivityDatabasePrivate::deleteApplicationActivities(const QString &applicationName)
-{
-    QString sqlCommand = QString("DELETE FROM Activities WHERE ApplicationName = '%1'").arg(applicationName);
-    QSqlQuery query(QSqlDatabase::database(KConnectionName));
-    if (!query.exec(sqlCommand)) {
-        qFatal(qPrintable(query.lastError().text()));
-    }
-}
-
-QList<QVariantHash> ActivityDatabasePrivate::allActivitiesList()
-{
-    return activitiesList("SELECT Data FROM Activities");
-}
-
-QList<QVariantHash> ActivityDatabasePrivate::applicationActivitiesList(const QString &applicationName)
-{
-    return activitiesList(QString("SELECT Data FROM Activities WHERE ApplicationName = '%1'").arg(applicationName));
-}
-
-QList<QVariantHash> ActivityDatabasePrivate::activitiesList(const QString &sqlCommand)
-{
-    QSqlQuery query(QSqlDatabase::database(KConnectionName));
-    if (!query.exec(sqlCommand)) {
-        qFatal(qPrintable(query.lastError().text()));
-    }
-
-    QList<QVariantHash> result;
-    while (query.next()) {
-        QVariantHash activityEntry;
-        {
-            QByteArray data(query.value(0).toByteArray());
-            QDataStream stream(&data, QIODevice::ReadOnly);
-            stream >> activityEntry;
-        }
-        result.append(activityEntry);
-    }
-    return result;
-}
-
-QString ActivityDatabasePrivate::requestedActivityName(const QString &applicationName)
-{
-    QSqlQuery query(QSqlDatabase::database(KConnectionName));
-    if (!query.exec(QString("SELECT ActivityName FROM Activities WHERE ApplicationName = '%1' AND RequestFlag").arg(applicationName))) {
-        qFatal(qPrintable(query.lastError().text()));
-    }
-
-    QString result;
-    if (query.next()) {
-        result = query.value(0).toString();
-    }
-    return result;
-}
-
-void ActivityDatabasePrivate::setActivityRequestFlag(const QString &applicationName, const QString &activityName)
-{
-    QSqlQuery query(QSqlDatabase::database(KConnectionName));
-
-    // clear old requests for given application
-    if (!query.exec(QString("UPDATE Activities SET RequestFlag=0 WHERE ApplicationName = '%1'").arg(applicationName))) {
-        qFatal(qPrintable(query.lastError().text()));
-    }
-
-    // set new request
-    if (!query.exec(QString("UPDATE Activities SET RequestFlag=1 WHERE ApplicationName = '%1' AND ActivityName = '%2'").arg(applicationName).arg(activityName))) {
-        qFatal(qPrintable(query.lastError().text()));
-    }
-}
-
-void ActivityDatabasePrivate::clearActivityRequestFlag(const QString &applicationName, const QString &activityName)
-{
-    QSqlQuery query(QSqlDatabase::database(KConnectionName));
-
-    // just clear the given request
-    if (!query.exec(QString("UPDATE Activities SET RequestFlag=0 WHERE ApplicationName = '%1' AND ActivityName = '%2'").arg(applicationName).arg(activityName))) {
-        qFatal(qPrintable(query.lastError().text()));
-    }
-}
-
-bool ActivityDatabasePrivate::checkTables()
-{
-    QStringList expectedTables("Activities");
-    QStringList actualTables = QSqlDatabase::database(KConnectionName).tables();
-    return (expectedTables == actualTables);
-}
-
-void ActivityDatabasePrivate::recreateTables()
-{
-    QSqlDatabase database = QSqlDatabase::database(KConnectionName);
-
-    if (!database.transaction()) {
-        qFatal(qPrintable(database.lastError().text()));
-    }
-
-    // drop any existing tables
-    {
-        QSqlQuery dropQuery(database);
-        foreach(const QString &tableName, database.tables()) {
-            if (!dropQuery.exec(QString("DROP TABLE %1").arg(tableName))) {
-                qFatal(qPrintable(dropQuery.lastError().text()));
-            }
-        }
-    }
-
-    // create new table
-    {
-        QSqlQuery createQuery(database);
-        QString statement(
-            "CREATE TABLE Activities("
-            "ApplicationName TEXT NOT NULL,"
-            "ActivityName TEXT NOT NULL,"
-            "RequestFlag BOOL NOT NULL DEFAULT FALSE,"
-            "Data BLOB NOT NULL,"
-            "PRIMARY KEY(ActivityName, ApplicationName))");
-
-        if (!createQuery.exec(statement)) {
-            qFatal(qPrintable(createQuery.lastError().text()));
-        }
-    }
-
-    if (!database.commit()) {
-        qFatal(qPrintable(database.lastError().text()));
-    }
-}
--- a/activityfw/activityserviceplugin/win/activitydatabase_p.h	Fri May 14 16:10:06 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +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 ACTIVITYDATABASE_P_H
-#define ACTIVITYDATABASE_P_H
-
-#include <QVariant>
-#include <QList>
-
-class ActivityDatabasePrivate
-{
-
-public:
-    ActivityDatabasePrivate();
-    ~ActivityDatabasePrivate();
-
-public:
-    void saveActivity(const QString &applicationName, const QString &activityName, const QVariantHash &activityMetadata);
-    void deleteActivity(const QString &applicationName, const QString &activityName);
-    void deleteApplicationActivities(const QString &applicationName);
-    QList<QVariantHash> allActivitiesList();
-    QList<QVariantHash> applicationActivitiesList(const QString &applicationName);
-    QString requestedActivityName(const QString &applicationName);
-    void setActivityRequestFlag(const QString &applicationName, const QString &activityName);
-    void clearActivityRequestFlag(const QString &applicationName, const QString &activityName);
-
-private:
-    QList<QVariantHash> activitiesList(const QString &sqlCommand);
-
-private:
-    bool checkTables();
-    void recreateTables();
-
-};
-
-#endif // ACTIVITYDATABASE_P_H
--- a/activityfw/activityserviceplugin/win/applicationlauncher_p.cpp	Fri May 14 16:10:06 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-#include "applicationlauncher_p.h"
-#include <QProcess>
-
-bool ApplicationLauncherPrivate::isRunning(int applicationId)
-{
-    // @todo
-    return true;
-}
-
-void ApplicationLauncherPrivate::startApplication(int applicationId, const QString &activityId)
-{
-    // @todo
-}
-
-void ApplicationLauncherPrivate::bringToForeground(int applicationId)
-{
-    // @todo
-}
--- a/activityfw/activityserviceplugin/win/applicationlauncher_p.h	Fri May 14 16:10:06 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +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 APPLICATIONLAUNCHER_P_H
-#define APPLICATIONLAUNCHER_P_H
-
-#include <QString>
-
-class ApplicationLauncherPrivate
-{
-
-public:
-    bool isRunning(int applicationId);
-    void startApplication(int applicationId, const QString &activityId);
-    void bringToForeground(int applicationId);
-
-};
-
-#endif // APPLICATIONLAUNCHER_P_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activityserviceplugin/win/inc/activitydatabase_p.h	Thu May 27 13:11:12 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 ACTIVITYDATABASE_P_H
+#define ACTIVITYDATABASE_P_H
+
+#include <QVariant>
+#include <QList>
+
+class ActivityDatabasePrivate
+{
+
+public:
+    ActivityDatabasePrivate();
+    ~ActivityDatabasePrivate();
+
+public:
+    void saveActivity(const QString &applicationName, const QString &activityName, const QVariantHash &activityMetadata);
+    void deleteActivity(const QString &applicationName, const QString &activityName);
+    void deleteApplicationActivities(const QString &applicationName);
+    QList<QVariantHash> allActivitiesList();
+    QList<QVariantHash> applicationActivitiesList(const QString &applicationName);
+    QString requestedActivityName(const QString &applicationName);
+    void setActivityRequestFlag(const QString &applicationName, const QString &activityName);
+    void clearActivityRequestFlag(const QString &applicationName, const QString &activityName);
+
+private:
+    QList<QVariantHash> activitiesList(const QString &sqlCommand);
+
+private:
+    bool checkTables();
+    void recreateTables();
+
+};
+
+#endif // ACTIVITYDATABASE_P_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activityserviceplugin/win/inc/applicationlauncher_p.h	Thu May 27 13:11:12 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 APPLICATIONLAUNCHER_P_H
+#define APPLICATIONLAUNCHER_P_H
+
+#include <QString>
+
+class ApplicationLauncherPrivate
+{
+
+public:
+    bool isRunning(int applicationId);
+    void startApplication(int applicationId, const QString &activityId);
+    void bringToForeground(int applicationId);
+
+};
+
+#endif // APPLICATIONLAUNCHER_P_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activityserviceplugin/win/src/activitydatabase_p.cpp	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,249 @@
+/*
+* 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 "activitydatabase_p.h"
+
+#include <QSqlDatabase>
+#include <QSqlQuery>
+#include <QSqlError>
+#include <QStringList>
+#include <QSettings>
+
+#include <hsactivitydbclient.h>
+
+const char KConnectionName[] = "ActivityDatabase";
+
+ActivityDatabasePrivate::ActivityDatabasePrivate()
+{
+    // determine database localization
+    QSettings settings("nokia", "activities");
+    if (!settings.contains("activitydatabase")) {
+        settings.setValue("activitydatabase", "C:\\activitydatabase.db");
+    }
+    QString databaseFile = settings.value("activitydatabase").toString();
+
+    QSqlDatabase database;
+    if (QSqlDatabase::contains(KConnectionName)) {
+        database = QSqlDatabase::database(KConnectionName);
+    } else {
+        database = QSqlDatabase::addDatabase("QSQLITE", KConnectionName);
+        database.setDatabaseName(databaseFile);
+        if (!database.open()) {
+            qFatal(qPrintable(database.lastError().text()));
+        }
+    }
+
+    if (!checkTables()) {
+        recreateTables();
+    }
+}
+
+ActivityDatabasePrivate::~ActivityDatabasePrivate()
+{
+    QSqlDatabase::database(KConnectionName).close();
+}
+
+void ActivityDatabasePrivate::saveActivity(const QString &applicationName, const QString &activityName, const QVariantHash &activityMetadata)
+{
+    if (applicationName.isEmpty() || activityName.isEmpty() || activityMetadata.value("screenshot").isNull()) {
+        qWarning("Activity entry is invalid, aborting save");
+        return;
+    }
+
+    QVariantHash activityData(activityMetadata);
+    activityData.insert(ActivityApplicationKeyword, applicationName);
+    activityData.insert(ActivityActivityKeyword, activityName);
+
+    // stream whole entry to bytearray
+    QByteArray streamedData;
+    {
+        QDataStream stream(&streamedData, QIODevice::WriteOnly);
+        stream << activityData;
+    }
+
+    QSqlDatabase database = QSqlDatabase::database(KConnectionName);
+
+    if (!database.transaction()) {
+        qFatal(qPrintable(database.lastError().text()));
+    }
+
+    // update or insert data
+    {
+        QSqlQuery query(database);
+        if (!query.exec(QString("SELECT ApplicationName FROM Activities WHERE ApplicationName = '%1' AND ActivityName = '%2'").arg(applicationName).arg(activityName))) {
+            qFatal(qPrintable(query.lastError().text()));
+        }
+
+        if (query.next()) {
+            if (!query.prepare("UPDATE Activities SET Data = :Data WHERE ApplicationName = :ApplicationName AND ActivityName = :ActivityName")) {
+                qFatal(qPrintable(query.lastError().text()));
+            }
+            query.bindValue(":Data", streamedData);
+            query.bindValue(":ApplicationName", applicationName);
+            query.bindValue(":ActivityName", activityName);
+            if (!query.exec()) {
+                qFatal(qPrintable(query.lastError().text()));
+            }
+        } else {
+            if (!query.prepare("INSERT INTO Activities(ApplicationName, ActivityName, Data) VALUES(:ApplicationName, :ActivityName, :Data)")) {
+                qFatal(qPrintable(query.lastError().text()));
+            }
+            query.bindValue(":ApplicationName", applicationName);
+            query.bindValue(":ActivityName", activityName);
+            query.bindValue(":Data", streamedData);
+            if (!query.exec()) {
+                qFatal(qPrintable(query.lastError().text()));
+            }
+        }
+    }
+
+    if (!database.commit()) {
+        qFatal(qPrintable(database.lastError().text()));
+    }
+}
+
+void ActivityDatabasePrivate::deleteActivity(const QString &applicationName, const QString &activityName)
+{
+    QString sqlCommand = QString("DELETE FROM Activities WHERE ApplicationName = '%1' AND ActivityName = '%2'").arg(applicationName).arg(activityName);
+    QSqlQuery query(QSqlDatabase::database(KConnectionName));
+    if (!query.exec(sqlCommand)) {
+        qFatal(qPrintable(query.lastError().text()));
+    }
+}
+
+void ActivityDatabasePrivate::deleteApplicationActivities(const QString &applicationName)
+{
+    QString sqlCommand = QString("DELETE FROM Activities WHERE ApplicationName = '%1'").arg(applicationName);
+    QSqlQuery query(QSqlDatabase::database(KConnectionName));
+    if (!query.exec(sqlCommand)) {
+        qFatal(qPrintable(query.lastError().text()));
+    }
+}
+
+QList<QVariantHash> ActivityDatabasePrivate::allActivitiesList()
+{
+    return activitiesList("SELECT Data FROM Activities");
+}
+
+QList<QVariantHash> ActivityDatabasePrivate::applicationActivitiesList(const QString &applicationName)
+{
+    return activitiesList(QString("SELECT Data FROM Activities WHERE ApplicationName = '%1'").arg(applicationName));
+}
+
+QList<QVariantHash> ActivityDatabasePrivate::activitiesList(const QString &sqlCommand)
+{
+    QSqlQuery query(QSqlDatabase::database(KConnectionName));
+    if (!query.exec(sqlCommand)) {
+        qFatal(qPrintable(query.lastError().text()));
+    }
+
+    QList<QVariantHash> result;
+    while (query.next()) {
+        QVariantHash activityEntry;
+        {
+            QByteArray data(query.value(0).toByteArray());
+            QDataStream stream(&data, QIODevice::ReadOnly);
+            stream >> activityEntry;
+        }
+        result.append(activityEntry);
+    }
+    return result;
+}
+
+QString ActivityDatabasePrivate::requestedActivityName(const QString &applicationName)
+{
+    QSqlQuery query(QSqlDatabase::database(KConnectionName));
+    if (!query.exec(QString("SELECT ActivityName FROM Activities WHERE ApplicationName = '%1' AND RequestFlag").arg(applicationName))) {
+        qFatal(qPrintable(query.lastError().text()));
+    }
+
+    QString result;
+    if (query.next()) {
+        result = query.value(0).toString();
+    }
+    return result;
+}
+
+void ActivityDatabasePrivate::setActivityRequestFlag(const QString &applicationName, const QString &activityName)
+{
+    QSqlQuery query(QSqlDatabase::database(KConnectionName));
+
+    // clear old requests for given application
+    if (!query.exec(QString("UPDATE Activities SET RequestFlag=0 WHERE ApplicationName = '%1'").arg(applicationName))) {
+        qFatal(qPrintable(query.lastError().text()));
+    }
+
+    // set new request
+    if (!query.exec(QString("UPDATE Activities SET RequestFlag=1 WHERE ApplicationName = '%1' AND ActivityName = '%2'").arg(applicationName).arg(activityName))) {
+        qFatal(qPrintable(query.lastError().text()));
+    }
+}
+
+void ActivityDatabasePrivate::clearActivityRequestFlag(const QString &applicationName, const QString &activityName)
+{
+    QSqlQuery query(QSqlDatabase::database(KConnectionName));
+
+    // just clear the given request
+    if (!query.exec(QString("UPDATE Activities SET RequestFlag=0 WHERE ApplicationName = '%1' AND ActivityName = '%2'").arg(applicationName).arg(activityName))) {
+        qFatal(qPrintable(query.lastError().text()));
+    }
+}
+
+bool ActivityDatabasePrivate::checkTables()
+{
+    QStringList expectedTables("Activities");
+    QStringList actualTables = QSqlDatabase::database(KConnectionName).tables();
+    return (expectedTables == actualTables);
+}
+
+void ActivityDatabasePrivate::recreateTables()
+{
+    QSqlDatabase database = QSqlDatabase::database(KConnectionName);
+
+    if (!database.transaction()) {
+        qFatal(qPrintable(database.lastError().text()));
+    }
+
+    // drop any existing tables
+    {
+        QSqlQuery dropQuery(database);
+        foreach(const QString &tableName, database.tables()) {
+            if (!dropQuery.exec(QString("DROP TABLE %1").arg(tableName))) {
+                qFatal(qPrintable(dropQuery.lastError().text()));
+            }
+        }
+    }
+
+    // create new table
+    {
+        QSqlQuery createQuery(database);
+        QString statement(
+            "CREATE TABLE Activities("
+            "ApplicationName TEXT NOT NULL,"
+            "ActivityName TEXT NOT NULL,"
+            "RequestFlag BOOL NOT NULL DEFAULT FALSE,"
+            "Data BLOB NOT NULL,"
+            "PRIMARY KEY(ActivityName, ApplicationName))");
+
+        if (!createQuery.exec(statement)) {
+            qFatal(qPrintable(createQuery.lastError().text()));
+        }
+    }
+
+    if (!database.commit()) {
+        qFatal(qPrintable(database.lastError().text()));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activityserviceplugin/win/src/applicationlauncher_p.cpp	Thu May 27 13:11:12 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:
+*
+*/
+#include "applicationlauncher_p.h"
+#include <QProcess>
+
+bool ApplicationLauncherPrivate::isRunning(int applicationId)
+{
+    // @todo
+    return true;
+}
+
+void ApplicationLauncherPrivate::startApplication(int applicationId, const QString &activityId)
+{
+    // @todo
+}
+
+void ApplicationLauncherPrivate::bringToForeground(int applicationId)
+{
+    // @todo
+}
--- a/activityfw/orbitintegration/hbactivityplugin/hbactivityplugin.qrc	Fri May 14 16:10:06 2010 +0300
+++ b/activityfw/orbitintegration/hbactivityplugin/hbactivityplugin.qrc	Thu May 27 13:11:12 2010 +0300
@@ -1,5 +1,5 @@
 <RCC>
     <qresource prefix="/" >
-        <file alias="activityserviceplugin.xml">../../activityserviceplugin/activityserviceplugin.xml</file>
+        <file alias="activityserviceplugin.xml">../../activityserviceplugin/data/activityserviceplugin.xml</file>
     </qresource>
 </RCC> 
\ No newline at end of file
--- a/activityfw/orbitintegration/hbactivityplugin/hbactivityplugininterface_p.h	Fri May 14 16:10:06 2010 +0300
+++ b/activityfw/orbitintegration/hbactivityplugin/hbactivityplugininterface_p.h	Thu May 27 13:11:12 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+* 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"
@@ -11,11 +11,10 @@
 *
 * Contributors:
 *
-* Description: 
+* Description:
 *
 */
 
-
 #ifndef HBACTIVITYPLUGININTERFACE_P_H
 #define HBACTIVITYPLUGININTERFACE_P_H
 
--- a/activityfw/rom/activitymanager_core.iby	Fri May 14 16:10:06 2010 +0300
+++ b/activityfw/rom/activitymanager_core.iby	Thu May 27 13:11:12 2010 +0300
@@ -17,19 +17,17 @@
 #ifndef __TSACTMAN_CORE_IBY__
 #define __TSACTMAN_CORE_IBY__
 
-//file=ABI_DIR\BUILD_DIR\activityserviceinstaller.exe                            PROGRAMS_DIR\activityserviceinstaller.exe
 file=ABI_DIR\BUILD_DIR\activityserviceplugin.dll					       SHARED_LIB_DIR\activityserviceplugin.dll
 data=\epoc32\data\z\resource\qt\plugins\activityserviceplugin.qtplugin    resource\qt\plugins\activityserviceplugin.qtplugin
 
 file=ABI_DIR\BUILD_DIR\hsactivitydbserver.exe                            PROGRAMS_DIR\hsactivitydbserver.exe
-data=ZPRIVATE\10003a3f\import\apps\hsactivitydbserver_reg.rsc            private\10003a3f\import\apps\hsactivitydbserver_reg.rsc
-data=\epoc32\data\z\resource\apps\hsactivitydbserver.rsc                 resource\apps\hsactivitydbserver.rsc
 
 file=ABI_DIR\BUILD_DIR\hsactivitydbclient.dll					       SHARED_LIB_DIR\hsactivitydbclient.dll
 
 file=ABI_DIR\BUILD_DIR\hbactivityplugin.dll					       SHARED_LIB_DIR\hbactivityplugin.dll
 data=\epoc32\data\z\resource\qt\plugins\hbactivityplugin.qtplugin    resource\qt\plugins\hbactivityplugin.qtplugin
 
+data=DATAZ_\resource\activity\activityserviceplugin.xml resource\activity\activityserviceplugin.xml
 
 // stub sis
 data=ZSYSTEM/install/activitymanager_stub.sis                  system/install/activitymanager_stub.sis
--- a/activityfw/sis/activitymanager.pkg	Fri May 14 16:10:06 2010 +0300
+++ b/activityfw/sis/activitymanager.pkg	Thu May 27 13:11:12 2010 +0300
@@ -26,14 +26,10 @@
 ;Unique Vendor name
 :"Nokia"
 
-
-;"/epoc32/release/armv5/urel/activityserviceinstaller.exe" - "!:\sys\bin\activityserviceinstaller.exe"
 "/epoc32/release/armv5/urel/activityserviceplugin.dll"-"!:\sys\bin\activityserviceplugin.dll"
 "/epoc32/data/z/resource/qt/plugins/activityserviceplugin.qtplugin"-"!:\resource\qt\plugins\activityserviceplugin.qtplugin"
 
 "/epoc32/release/armv5/urel/hsactivitydbserver.exe"    - "!:\sys\bin\hsactivitydbserver.exe"
-"/epoc32/data/z/resource/apps/hsactivitydbserver.rsc"    - "!:\resource\apps\hsactivitydbserver.rsc"
-"/epoc32/data/z/private/10003a3f/import/apps/hsactivitydbserver_reg.rsc"    - "!:\private\10003a3f\import\apps\hsactivitydbserver_reg.rsc"
 
 "/epoc32/release/armv5/urel/hsactivitydbclient.dll"    - "!:\sys\bin\hsactivitydbclient.dll"
 
--- a/activityfw/sis/stubs/activitymanager_stub.pkg	Fri May 14 16:10:06 2010 +0300
+++ b/activityfw/sis/stubs/activitymanager_stub.pkg	Thu May 27 13:11:12 2010 +0300
@@ -36,8 +36,6 @@
 "" - "Z:\resource\qt\plugins\activityserviceplugin.qtplugin"
 
 ""    - "Z:\sys\bin\hsactivitydbserver.exe"
-""    - "Z:\resource\apps\hsactivitydbserver.rsc"
-""    - "Z:\private\10003a3f\import\apps\hsactivitydbserver_reg.rsc"
 
 ""    - "Z:\sys\bin\hsactivitydbclient.dll"
 
Binary file activityfw/sis/stubs/activitymanager_stub.sis has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/tsutils/bwins/tsutilsu.def	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,5 @@
+EXPORTS
+	?NewLC@CTsGraphicFileScalingHandler@@SAPAV1@AAVMImageReadyCallBack@@AAVRFs@@ABVTDesC16@@ABVTDesC8@@ABVTSize@@W4TKindOfScaling@1@@Z @ 1 NONAME ; class CTsGraphicFileScalingHandler * CTsGraphicFileScalingHandler::NewLC(class MImageReadyCallBack &, class RFs &, class TDesC16 const &, class TDesC8 const &, class TSize const &, enum CTsGraphicFileScalingHandler::TKindOfScaling)
+	?NewL@CTsGraphicFileScalingHandler@@SAPAV1@AAVMImageReadyCallBack@@AAVRFs@@ABVTDesC16@@ABVTDesC8@@ABVTSize@@W4TKindOfScaling@1@@Z @ 2 NONAME ; class CTsGraphicFileScalingHandler * CTsGraphicFileScalingHandler::NewL(class MImageReadyCallBack &, class RFs &, class TDesC16 const &, class TDesC8 const &, class TSize const &, enum CTsGraphicFileScalingHandler::TKindOfScaling)
+	??1CTsGraphicFileScalingHandler@@UAE@XZ @ 3 NONAME ; CTsGraphicFileScalingHandler::~CTsGraphicFileScalingHandler(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/tsutils/eabi/tsutilsu.def	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,9 @@
+EXPORTS
+	_ZN28CTsGraphicFileScalingHandler4NewLER19MImageReadyCallBackR3RFsRK7TDesC16RK6TDesC8RK5TSizeNS_14TKindOfScalingE @ 1 NONAME
+	_ZN28CTsGraphicFileScalingHandler5NewLCER19MImageReadyCallBackR3RFsRK7TDesC16RK6TDesC8RK5TSizeNS_14TKindOfScalingE @ 2 NONAME
+	_ZN28CTsGraphicFileScalingHandlerD0Ev @ 3 NONAME
+	_ZN28CTsGraphicFileScalingHandlerD1Ev @ 4 NONAME
+	_ZN28CTsGraphicFileScalingHandlerD2Ev @ 5 NONAME
+	_ZTI28CTsGraphicFileScalingHandler @ 6 NONAME
+	_ZTV28CTsGraphicFileScalingHandler @ 7 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/tsutils/group/bld.inf	Thu May 27 13:11:12 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
+
+PRJ_MMPFILES
+tsutils.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/tsutils/group/tsutils.mmp	Thu May 27 13:11:12 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:
+*
+*/
+TARGET        tsutils.dll
+TARGETTYPE    dll
+UID           0x1000008d 0x20026782
+
+CAPABILITY    CAP_GENERAL_DLL
+
+USERINCLUDE   ../inc
+
+SOURCEPATH    ../src
+SOURCE        tsgraphicfilescalinghandler.cpp
+
+LIBRARY      euser.lib
+LIBRARY      bitmaptransforms.lib
+LIBRARY      imageconversion.lib
+LIBRARY      fbscli.lib
+LIBRARY      efsrv.lib
+
+//EXPORTUNFROZEN
+
+#ifdef ENABLE_ABIV2_MODE
+DEBUGGABLE_UDEBONLY
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/tsutils/inc/tsgraphicfilescalinghandler.h	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,96 @@
+/*
+ * 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;
+
+class MImageReadyCallBack
+{
+public:
+    virtual void ImageReadyCallBack(TInt error, const CFbsBitmap *bitmap ) = 0;
+};
+
+class CTsGraphicFileScalingHandler : public CActive
+{
+public:
+
+enum TCurrentOperation{
+        ENone = 0,
+        EConvertBitmapFromFile = 1,
+        EScale = 2
+    };
+
+enum TKindOfScaling
+{
+   EIgnoreAspectRatio = 0,
+   EKeepAspectRatio = 1,
+   EKeepAspectRatioByExpanding = 2,
+};
+
+    IMPORT_C ~CTsGraphicFileScalingHandler();
+
+    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);
+
+protected:
+    void DoCancel();
+    void RunL();
+    TInt RunError(TInt);
+
+private:
+    void ConstructL(RFs &aFs, const TDesC &aFileName, const TDesC8& aMimeType);
+    CTsGraphicFileScalingHandler(MImageReadyCallBack &aNotify,
+        const TSize &aNewSize,
+        TKindOfScaling aKindOfScaling = CTsGraphicFileScalingHandler::EIgnoreAspectRatio);
+    TSize Scaling();
+
+private:
+    MImageReadyCallBack &mNotify;
+    CImageDecoder *mImageDecoder;
+    CFbsBitmap *mBitmapFromFile;
+    CFbsBitmap *mBitmapOutput;
+    CBitmapScaler *mBitmapScaler;
+    TSize mNewSize;
+    TBool mKindOfScaling;
+
+    TCurrentOperation mCurrentOperation;
+};
+
+#endif // TSGRAPHICFILESCALINGHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/tsutils/src/tsgraphicfilescalinghandler.cpp	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,206 @@
+/*
+ * 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)
+{
+}
+
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CTsGraphicFileScalingHandler::~CTsGraphicFileScalingHandler()
+{
+    Cancel();
+    delete mBitmapFromFile;
+    delete mBitmapOutput;
+    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);
+    }
+
+    CActiveScheduler::Add(this);
+
+    mBitmapScaler = CBitmapScaler::NewL();
+    mBitmapScaler->SetQualityAlgorithm(CBitmapScaler::EMaximumQuality);
+
+    // convert *.png to bitmap
+    mImageDecoder = CImageDecoder::FileNewL(aFs, aFileName, aMimeType);
+    mBitmapFromFile = new(ELeave)CFbsBitmap();
+    const TFrameInfo frameInfo(mImageDecoder->FrameInfo(0));
+    User::LeaveIfError(mBitmapFromFile->Create(frameInfo.iOverallSizeInPixels, 
+                                               frameInfo.iFrameDisplayMode));
+
+    mImageDecoder->Convert(&iStatus, *mBitmapFromFile, 0);
+    mCurrentOperation = EConvertBitmapFromFile;
+    SetActive();
+}
+
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+//
+void 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;
+            
+            mBitmapOutput = new (ELeave)CFbsBitmap();
+            User::LeaveIfError(mBitmapOutput->Create(Scaling(), mBitmapFromFile->DisplayMode()));
+            mBitmapScaler->Scale(&iStatus, *mBitmapFromFile, *mBitmapOutput, EFalse);
+            mCurrentOperation = EScale;
+            SetActive();
+            break;
+        }
+    case EScale: {
+            mCurrentOperation = ENone;
+
+            delete mBitmapScaler;
+            mBitmapScaler = 0;
+            
+            delete mBitmapFromFile;
+            mBitmapFromFile = 0;
+
+            if (mKindOfScaling == CTsGraphicFileScalingHandler::EKeepAspectRatioByExpanding) {
+                User::LeaveIfError(mBitmapOutput->Resize(mNewSize));
+            }
+
+            mNotify.ImageReadyCallBack(iStatus.Int(), mBitmapOutput);
+            break;
+        }
+    }
+}
+
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+//
+TSize CTsGraphicFileScalingHandler::Scaling()
+{
+   TSize originalSize = mBitmapFromFile->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;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/tsutils/tsutils.pro	Thu May 27 13:11:12 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\""
--- a/contentstorage/bwins/camenuu.def	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/bwins/camenuu.def	Thu May 27 13:11:12 2010 +0300
@@ -21,4 +21,6 @@
 	?GetLocalizationsL@CCaStorageProxy@@QAEXAAV?$RPointerArray@VCCaLocalizationEntry@@@@@Z @ 20 NONAME ; void CCaStorageProxy::GetLocalizationsL(class RPointerArray<class CCaLocalizationEntry> &)
 	?RunCaServer@@YAHXZ @ 21 NONAME ; int RunCaServer(void)
 	?GetEntriesIdsL@CCaStorageProxy@@QAEXPBVCCaInnerQuery@@AAV?$RArray@H@@@Z @ 22 NONAME ; void CCaStorageProxy::GetEntriesIdsL(class CCaInnerQuery const *, class RArray<int> &)
+	?NewL@CCaSrvMmcHistory@@SAPAV1@XZ @ 23 NONAME ; class CCaSrvMmcHistory * CCaSrvMmcHistory::NewL(void)
+	?AddLocalizationL@CCaStorageProxy@@QAEXABVCCaLocalizationEntry@@@Z @ 24 NONAME ; void CCaStorageProxy::AddLocalizationL(class CCaLocalizationEntry const &)
 
--- a/contentstorage/bwins/cautilsu.def	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/bwins/cautilsu.def	Thu May 27 13:11:12 2010 +0300
@@ -96,4 +96,6 @@
 	?SetStringIdL@CCaLocalizationEntry@@QAEXABVTDesC16@@@Z @ 95 NONAME ; void CCaLocalizationEntry::SetStringIdL(class TDesC16 const &)
 	?SetTextId@CCaLocalizationEntry@@QAEXI@Z @ 96 NONAME ; void CCaLocalizationEntry::SetTextId(unsigned int)
 	?RemoveAttribute@RCaEntryAttrArray@@QAEXABVTDesC16@@@Z @ 97 NONAME ; void RCaEntryAttrArray::RemoveAttribute(class TDesC16 const &)
+	?GetQmFilename@CCaLocalizationEntry@@QBEABVRBuf16@@XZ @ 98 NONAME ; class RBuf16 const & CCaLocalizationEntry::GetQmFilename(void) const
+	?SetQmFilenameL@CCaLocalizationEntry@@QAEXABVTDesC16@@@Z @ 99 NONAME ; void CCaLocalizationEntry::SetQmFilenameL(class TDesC16 const &)
 
--- a/contentstorage/caclient/caclient.pri	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/caclient/caclient.pri	Thu May 27 13:11:12 2010 +0300
@@ -15,5 +15,15 @@
 #
 
 HEADERS += ./inc/*.h \
-    ../../homescreensrv_plat/contentstorage_api/*.h
+    ./../homescreensrv_plat/contentstorage_api/caclient_global.h \
+    ./../homescreensrv_plat/contentstorage_api/cadefs.h \
+    ./../homescreensrv_plat/contentstorage_api/caentry.h \
+    ./../homescreensrv_plat/contentstorage_api/caicondescription.h \
+    ./../homescreensrv_plat/contentstorage_api/caitemmodel.h \
+    ./../homescreensrv_plat/contentstorage_api/camenuiconutility.h \
+    ./../homescreensrv_plat/contentstorage_api/canotifier.h \
+    ./../homescreensrv_plat/contentstorage_api/canotifierfilter.h \
+    ./../homescreensrv_plat/contentstorage_api/caquery.h \
+    ./../homescreensrv_plat/contentstorage_api/caservice.h
+    
 SOURCES += ./src/*.cpp
--- a/contentstorage/caclient/inc/canotifier_p.h	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/caclient/inc/canotifier_p.h	Thu May 27 13:11:12 2010 +0300
@@ -18,10 +18,13 @@
 #ifndef CANOTIFIER_PRIVATE_H
 #define CANOTIFIER_PRIVATE_H
 
+#include <QSharedPointer>
+
 class CaClientNotifierProxy;
 class CaNotifier;
 class CaNotifierFilter;
 class CaObserver;
+class CaService;
 
 class CaNotifierPrivate
 {
@@ -53,6 +56,8 @@
 
     CaClientNotifierProxy *mNotifierProxy;
 
+    QSharedPointer<CaService> mCaService;
+
     friend class CaNotifier;
 
 };
--- a/contentstorage/caclient/s60/src/camenuiconmifutility.cpp	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/caclient/s60/src/camenuiconmifutility.cpp	Thu May 27 13:11:12 2010 +0300
@@ -20,7 +20,7 @@
 #include <QBitmap>
 #include <QDebug>
 #include <AknIconUtils.h> // avkon
-#include <APGICNFL.H> // fbsbitmap
+#include <apgicnfl.h> // fbsbitmap
 
 #include "cabitmapadapter.h"
 #include "camenuiconmifutility.h"
--- a/contentstorage/caclient/s60/src/camenuiconutility.cpp	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/caclient/s60/src/camenuiconutility.cpp	Thu May 27 13:11:12 2010 +0300
@@ -19,9 +19,14 @@
 #include <XQConversions>
 // apparc
 #include <apparc.h>
-#include <APGCLI.H>
+#include <apgcli.h>
+#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <apaidpartner.h>
+#else
+#include <apaid.h>
+#endif
 // cfbsbitmap
-#include <APGICNFL.H>
+#include <apgicnfl.h>
 
 #include <HbIcon>
 #include "camenuiconutility.h"
@@ -223,16 +228,19 @@
 {
     HbIcon icon;
     icon = getIconFromEntry(entry);
-
+ 
     if (icon.isNull() || !(icon.size().isValid())) {
         TRAP_IGNORE(icon = getIconFromApparcL(entry, size));
     }
-
+ 
     if (icon.isNull() || !(icon.size().isValid())) {
         icon = getDefaultIcon(entry);
     }
-    
+ 
+    if (entry.entryTypeName() == XQConversions::s60DescToQString(
+            KCaTypeWidget)) {
+        icon.addBadge(Qt::AlignBottom | Qt::AlignLeft,
+		    HbIcon("qtg_small_hs_widget"));
+    }
     return icon;
 }
-
-
--- a/contentstorage/caclient/src/caicondescription.cpp	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/caclient/src/caicondescription.cpp	Thu May 27 13:11:12 2010 +0300
@@ -190,7 +190,7 @@
 CaIconDescriptionPrivate::CaIconDescriptionPrivate(
     CaIconDescription *iconDescriptionPublic) :
     m_q(iconDescriptionPublic), mId(0), mFilename(), mSkinId(), 
-    mApplicationId(0)
+    mApplicationId()
 {
 }
 
--- a/contentstorage/caclient/src/caitemmodel.cpp	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/caclient/src/caitemmodel.cpp	Thu May 27 13:11:12 2010 +0300
@@ -712,10 +712,6 @@
            && ids.indexOf(id) == mEntries.indexOf(id)) {
         emit m_q->dataChanged(index(mEntries.indexOf(id)), index(
                                   mEntries.indexOf(id)));
-    } else if (ids.indexOf(id) < 0){
-        removeItem(id);
-    } else if (mEntries.indexOf(id) < 0){
-        addItem(id);
     } else if (mParentEntry && id == mParentEntry->id()) {
         updateParentEntry();
         m_q->reset();
@@ -737,9 +733,17 @@
     //we use beginInsertRows and endInsertRows to emit proper signal
     //(see Qt documentation of QAbstractItemModel)
     if (mEntries.indexOf(id) < 0 && row >= 0) {
-        m_q->beginInsertRows(QModelIndex(), row, row);
-        mEntries.insert(row, id);
+        if (row > mEntries.count()) {
+        	m_q->beginInsertRows(QModelIndex(), mEntries.count(), mEntries.count());
+        	mEntries.insert(mEntries.count(), id);
+        } else {
+			m_q->beginInsertRows(QModelIndex(), row , row);
+        	mEntries.insert(row, id);
+        }
         m_q->endInsertRows();
+    } else if (row == -1) {
+        //we udpade whole model because we do not know parent collecion for given item
+        updateModel();
     }
     CACLIENTTEST_FUNC_EXIT("CaItemModelPrivate::addItem");
 }
--- a/contentstorage/caclient/src/canotifier.cpp	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/caclient/src/canotifier.cpp	Thu May 27 13:11:12 2010 +0300
@@ -15,6 +15,8 @@
  *
  */
 
+#include <caservice.h>
+
 #include "canotifier.h"
 #include "canotifier_p.h"
 #include "canotifierfilter.h"
@@ -53,6 +55,10 @@
  CaNotifierFilter notifierFilter();
  CaNotifier * notifier = service->createNotifier(notifierfilter);
 
+CaService instance is a singleton and is deleted when nothing references
+it but CaNotifier contains a member referencing it,
+so, CaService instance is not deleted before notifier is deleted.
+
  // Connections cause that notifier is registered to server distributed
  // notifications while data changes.
  if( notifier )
@@ -221,7 +227,8 @@
     CaClientNotifierProxy *notifierProxy) :
     m_q(NULL),
     mNotifierFilter(NULL), 
-    mObserver(NULL)
+    mObserver(NULL),
+    mCaService(CaService::instance())
 {
     mNotifierProxy = notifierProxy;
     mNotifierFilter = new CaNotifierFilter(notifierFilter);
--- a/contentstorage/caclient/src/caservice.cpp	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/caclient/src/caservice.cpp	Thu May 27 13:11:12 2010 +0300
@@ -38,19 +38,25 @@
 /*!
 
  \class CaService.
- \brief This class operates on data, anable creating and inserting new entry
+ \brief This class operates on data, enables creating and inserting new entry
  to DB, removing entry from DB, update entry or get entry from DB, execute
- command on entry and create notifier to notify client about changes onto DB.
+ command on entry and create notifier to notify a client about changes onto DB.
 
  CaService class uses singleton design pattern, so that it contains static
  method called instance() to get instance of a class.
 
+ References to CaService instance are counted. When the number of references
+ drops to zero the instance is deleted to save memory.
+ CaNotifier class contains a member referencing to the CaService instance so
+ it is not deleted unless all CaNotifier instances are deleted (and there are
+ no variables referencing CaService).
+
  \code
  QSharedPointer<CaService> service = CaService::instance();
  \endcode
 
- For every operations on data is used always one instantiation of a class.
- Below are examples how to create data and work on those ones.
+ For every operations on data is used always one instantiation of the class.
+ Below, there are examples how to create data and work on those ones.
 
  */
 
--- a/contentstorage/caclient/stub/inc/hswidgetcomponentparser.h	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/caclient/stub/inc/hswidgetcomponentparser.h	Thu May 27 13:11:12 2010 +0300
@@ -1,19 +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: 
-*
-*/
+ * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
+
 #ifndef HSWIDGETCOMPONENTPARSER_H
 #define HSWIDGETCOMPONENTPARSER_H
 
--- a/contentstorage/caclient/stub/src/hswidgetcomponentparser.cpp	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/caclient/stub/src/hswidgetcomponentparser.cpp	Thu May 27 13:11:12 2010 +0300
@@ -1,19 +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: 
-*
-*/
+ * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
+
 #include "hswidgetcomponentparser.h"
 #include <QFile>
 
--- a/contentstorage/cahandler/app/app.pro	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/cahandler/app/app.pro	Thu May 27 13:11:12 2010 +0300
@@ -50,7 +50,7 @@
     -lscrclient \
     -lxqutils
 
-    exists($${EPOCROOT}epoc32/include/mw/XQSettingsManager):LIBS += -lxqsettingsmanager
+    exists($${EPOCROOT}epoc32/include/platform/mw/XQSettingsManager):LIBS += -lxqsettingsmanager
 }
 
 
--- a/contentstorage/cahandler/app/inc/caapphandler.h	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/cahandler/app/inc/caapphandler.h	Thu May 27 13:11:12 2010 +0300
@@ -23,7 +23,6 @@
 // forward declarations
 class CEikonEnv;
 class CCaInnerEntry;
-class CCaUninstallOperation;
 class CCaUsifUninstallOperation;
 
 /**
@@ -100,20 +99,11 @@
      * @param aComponentId component id
      */
     void StartUsifUninstallL( TInt aComponentId );
-
-    
-    /**
-     * Start uninstall operation via swi 
-     * @param aEntry the entry 
-     */
-    void StartSwiUninstallL(CCaInnerEntry &aEntry );
-
     
 private:
     // data
 
     CEikonEnv* iEikEnv;
-    CCaUninstallOperation* iUninstallOperation;
     CCaUsifUninstallOperation* iUsifUninstallOperation;
     };
 
--- a/contentstorage/cahandler/app/inc/cauninstalloperation.h	Fri May 14 16:10:06 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:  ?Description
- *
- */
-
-#ifndef C_CAUNINSTALLOPERATION_H
-#define C_CAUNINSTALLOPERATION_H
-
-#include <e32base.h>
-#include <SWInstApi.h>
-
-/**
- * Uninstall CMenuOperation
- * Encapsulates the functionality of uninstalling an application.
- *
- *  @lib caclient.lib
- */
-NONSHARABLE_CLASS(CCaUninstallOperation): public CActive {
-
-public:
-    /**
-    * Destructor
-    */
-    virtual ~CCaUninstallOperation();
-    
-    /**
-     * Two-phased constructor. Leaves on failure.
-     * Allocates memory for and constructs an uninstaller object. After that
-     * starts asynchronous uninnstallation of the requested entry
-     * @param aEntry entry to be uninstalled
-     * @param aPriority priority of the active scheduler responsible for handling
-     * asynchronous installation operation
-     * @return The constructed object.
-     */
-    static CCaUninstallOperation *NewL(CCaInnerEntry &aEntry,
-    TInt aPriority = CActive::EPriorityStandard);
-
-private:
-    // construction
-    /**
-     * Constructor.
-     * Starts active scheduler.
-     * @param aEntry entry to be uninstalle
-     * @param aPriority priority of the active scheduler responsible for handling
-     * asynchronous installation operation
-     */
-    CCaUninstallOperation(CCaInnerEntry &aEntry, TInt aPriority);
-    
-    /**
-     * Initializes the object and starts asynchronous uninstallation process.
-     * @param aEntry entry to be uninstalle
-     * asynchronous installation operation
-     */
-    void ConstructL(CCaInnerEntry &aEntry);
-    
-    /**
-     * Retrieves package information for requested application uid
-     * @param aAppUid application uid
-       @param aMimeType placeholder for resulting mime type of the package
-     * @param aPackageUid placeholder for resulting package uid of the application 
-     */
-    void AppInfoL(const TUid &aAppUid, TPtrC8 &aMimeType, TUid &aPackageUid);
-    
-    /**
-     * Retrieves package uid 
-     * @param aAppFullName application full name
-       @param aPackageUid placeholder for resulting package uid of the application
-       @return true if package uid was found
-     */
-    TBool GetInstallPkgUidL(const TDesC &aAppFullName, TUid &aPackageUid);
-
-private:
-    // from CActive
-
-    void RunL();
-    void DoCancel();
-    TInt RunError(TInt aError);
-
-private:
-
-    CCaInnerEntry &iEntry;
-    SwiUI::RSWInstLauncher iUninstaller;
-    TInt iId;
-};
-
-#endif // C_CAUNINSTALLOPERATION_H
--- a/contentstorage/cahandler/app/src/caapphandler.cpp	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/cahandler/app/src/caapphandler.cpp	Thu May 27 13:11:12 2010 +0300
@@ -29,7 +29,6 @@
 
 #include "caapphandler.h"
 #include "cainnerentry.h"
-#include "cauninstalloperation.h"
 #include "causifuninstalloperation.h"
 #include "catasklist.h"
 
@@ -45,7 +44,6 @@
 //
 CCaAppHandler::~CCaAppHandler()
 {
-    delete iUninstallOperation;
     delete iUsifUninstallOperation;
 }
 
@@ -69,7 +67,6 @@
 CCaAppHandler::CCaAppHandler()
 {
     iEikEnv = CEikonEnv::Static();
-    iUninstallOperation = NULL;
     iUsifUninstallOperation = NULL;
 }
 
@@ -226,31 +223,21 @@
 // ---------------------------------------------------------------------------
 //
 void CCaAppHandler::HandleRemoveL( CCaInnerEntry &aEntry )
-{
-    if (!( aEntry.GetFlags() & ERemovable ) )
+    {
+    if( !( aEntry.GetFlags() & ERemovable ) )
         {
         User::Leave( KErrAccessDenied );
         }
-    if ( aEntry.GetEntryTypeName() == KCaTypeApp() )
-        {
-        TComponentId componentId( GetComponentIdL( aEntry,KSoftwareTypeJava ) );
-        if ( componentId != KErrNotFound )
-            {
-            StartUsifUninstallL( componentId );
-            }
-        else
-            {
-            StartSwiUninstallL( aEntry );
-            }
-        }
-    else if ( aEntry.GetEntryTypeName() == KCaTypeWidget() )
-        {
-        StartSwiUninstallL( aEntry );
-        }
-    else if( aEntry.GetEntryTypeName() == KCaTypePackage() )
+    
+    const TPtrC entryTypeName(aEntry.GetEntryTypeName());
+    
+    if( entryTypeName == KCaTypeApp()  ||
+        entryTypeName == KCaTypePackage() ||
+        entryTypeName == KCaTypeWidget() )
         {
         TPtrC componentId;
-        if ( aEntry.FindAttribute( KCaAttrComponentId, componentId ) )
+        TBool result = aEntry.FindAttribute( KCaAttrComponentId, componentId );
+        if( result )
             {
             TInt32 id ;
             TLex idDesc;
@@ -258,12 +245,16 @@
             User::LeaveIfError( idDesc.Val( id ) );
             StartUsifUninstallL( id );
             }
+         else
+            {
+            User::Leave( KErrNotFound );
+            }
         }
     else
         {
         User::Leave( KErrNotSupported );
         }
-}
+    }
 
 // ---------------------------------------------------------------------------
 //
@@ -307,17 +298,3 @@
     iUsifUninstallOperation = CCaUsifUninstallOperation::NewL( aComponentId );
 }
 
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CCaAppHandler::StartSwiUninstallL(CCaInnerEntry &aEntry )
-{
-    if ( iUninstallOperation && iUninstallOperation->IsActive() )
-        {
-        User::Leave( KErrInUse );
-        }
-    delete iUninstallOperation;
-    iUninstallOperation = NULL;
-    iUninstallOperation = CCaUninstallOperation::NewL( aEntry );
-}
--- a/contentstorage/cahandler/app/src/cauninstalloperation.cpp	Fri May 14 16:10:06 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,208 +0,0 @@
-/*
- * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:  ?Description
- *
- */
-
-#include <apgcli.h>
-#include <swi/sisregistrysession.h>
-#include <swi/sisregistryentry.h>
-
-#include "cautils.h"
-#include "cadef.h"
-#include "cainnerentry.h"
-#include "cauninstalloperation.h"
-_LIT8(KAppMimeType, "x-epoc/x-sisx-app");
-
-// ================= MEMBER FUNCTIONS =======================
-
-// ---------------------------------------------------------------------------
-// CCaUninstallOperation::~CCaUninstallOperation
-// ---------------------------------------------------------------------------
-//
-CCaUninstallOperation::~CCaUninstallOperation()
-{
-    Cancel();
-    iUninstaller.Close();
-}
-
-// ---------------------------------------------------------------------------
-// CCaUninstallOperation::NewL
-// ---------------------------------------------------------------------------
-//
-CCaUninstallOperation *CCaUninstallOperation::NewL(CCaInnerEntry &aEntry,
-        TInt aPriority)
-{
-    CCaUninstallOperation *self;
-
-    self = new(ELeave) CCaUninstallOperation(aEntry, aPriority);
-    CleanupStack::PushL(self);
-    self->ConstructL(aEntry);
-    CleanupStack::Pop(self);
-    return self;
-}
-
-// ---------------------------------------------------------------------------
-// CCaUninstallOperation::CCaUninstallOperation
-// ---------------------------------------------------------------------------
-//
-CCaUninstallOperation::CCaUninstallOperation(CCaInnerEntry &aEntry,
-        TInt aPriority) :
-    CActive(aPriority), iEntry(aEntry), iUninstaller(), iId(0)
-{
-    CActiveScheduler::Add(this);
-}
-
-// ---------------------------------------------------------------------------
-// CCaUninstallOperation::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CCaUninstallOperation::ConstructL(CCaInnerEntry &aEntry)
-{
-    TUint uid = aEntry.GetUid();
-
-    TUid packageUid = KNullUid;
-    TPtrC8 mimeType;
-
-    if (!(aEntry.GetFlags() & ERemovable)) {
-        User::Leave(KErrAccessDenied);
-    }
-
-    User::LeaveIfError(iUninstaller.Connect());
-    iId = aEntry.GetId();
-    if (aEntry.GetEntryTypeName() == KCaTypeWidget()) {
-        TBuf<KMaxUidName> uidDesc;
-        aEntry.FindAttribute(KCaPackageUid, uidDesc);
-        TLex uidLex(uidDesc);
-        TUint32 uidValue;
-        User::LeaveIfError(uidLex.Val(uidValue, EHex));
-
-        packageUid.iUid = static_cast<TInt32>(uidValue);
-        mimeType.Set(KAppMimeType);
-    } else {
-        AppInfoL(TUid::Uid(uid), mimeType, packageUid);
-    }
-
-    // Commence the uninstallations
-    iUninstaller.Uninstall(iStatus, packageUid, mimeType);
-    SetActive();
-}
-
-// ---------------------------------------------------------------------------
-// CCaUninstallOperation::AppInfo
-// ---------------------------------------------------------------------------
-//
-void CCaUninstallOperation::AppInfoL(const TUid &aAppUid,
-                                     TPtrC8 &aMimeType, TUid &aPackageUid)
-{
-    RApaLsSession apaLsSession;
-
-    User::LeaveIfError(apaLsSession.Connect());
-    CleanupClosePushL(apaLsSession);
-    User::LeaveIfError(apaLsSession.GetAllApps());
-
-    // TApaAppInfo size is greater then 1024 bytes
-    // so its instances should not be created on the stack.
-    TApaAppInfo* appInfo = new(ELeave) TApaAppInfo();
-    CleanupStack::PushL(appInfo);
-    User::LeaveIfError(apaLsSession.GetAppInfo(*appInfo, aAppUid));
-    if (!GetInstallPkgUidL(appInfo->iFullName, aPackageUid)) {
-        aPackageUid = aAppUid;
-    }
-    CleanupStack::PopAndDestroy(appInfo);
-    aMimeType.Set(KAppMimeType);
-
-    CleanupStack::PopAndDestroy(&apaLsSession);
-}
-
-// ---------------------------------------------------------------------------
-// CCaUninstallOperation::GetInstallPkgUidL
-// ---------------------------------------------------------------------------
-//
-TBool CCaUninstallOperation::GetInstallPkgUidL(const TDesC &aAppFullName,
-        TUid &aPackageUid)
-{
-    // Search for the full name of the application amongst every file name in
-    // every installed packages.
-    TBool found = EFalse;
-    Swi::RSisRegistrySession iSisRegSession;
-
-    // Get the array of ids of every installed packages
-    if (KErrNone != iSisRegSession.Connect()) {
-        return found;
-    }
-    CleanupClosePushL(iSisRegSession);
-
-    RArray<TUid> packageIds;
-    CleanupClosePushL(packageIds);
-
-    iSisRegSession.InstalledUidsL(packageIds);
-
-    RPointerArray<HBufC> packageFiles;
-    CleanupClosePushL(packageFiles);
-
-    for (TInt i = 0; i < packageIds.Count() && !found; ++i) {
-        const TUid packageId = packageIds[i];
-        Swi::RSisRegistryEntry packageEntry;
-
-        // Get the array of file names in the current install package and look
-        // if there is one suggesting that the application was installed from
-        // the package.
-        if (KErrNone == packageEntry.Open(iSisRegSession, packageId)) {
-            CleanupClosePushL(packageEntry);
-            packageEntry.FilesL(packageFiles);
-            for (TInt pf = 0; pf < packageFiles.Count() && !found; ++pf) {
-                if (packageFiles[pf]->FindC(aAppFullName) == 0) {
-                    aPackageUid = packageId;
-                    found = ETrue;
-                }
-            }
-            packageFiles.ResetAndDestroy();
-            CleanupStack::PopAndDestroy(&packageEntry);
-        }
-    }
-
-    CleanupStack::PopAndDestroy(&packageFiles);
-    CleanupStack::PopAndDestroy(&packageIds);
-    CleanupStack::PopAndDestroy(&iSisRegSession);
-
-    return found;
-}
-
-// ---------------------------------------------------------------------------
-// CCaUninstallOperation::RunL
-// ---------------------------------------------------------------------------
-//
-void CCaUninstallOperation::RunL()
-{
-    iUninstaller.Close();
-}
-
-// ---------------------------------------------------------------------------
-// CCaUninstallOperation::DoCancel
-// ---------------------------------------------------------------------------
-//
-void CCaUninstallOperation::DoCancel()
-{
-    iUninstaller.CancelAsyncRequest(SwiUI::ERequestUninstall);
-}
-
-// ---------------------------------------------------------------------------
-// CCaUninstallOperation::RunError
-// ---------------------------------------------------------------------------
-//
-TInt CCaUninstallOperation::RunError(TInt /* aError */)
-{
-    return KErrNone;
-}
--- a/contentstorage/cahandler/url/url.pro	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/cahandler/url/url.pro	Thu May 27 13:11:12 2010 +0300
@@ -48,7 +48,7 @@
     -lefsrv \
     -lxqutils
 
-    exists($${EPOCROOT}epoc32/include/mw/XQSettingsManager):LIBS += -lxqsettingsmanager
+    exists($${EPOCROOT}epoc32/include/platform/mw/XQSettingsManager):LIBS += -lxqsettingsmanager
 }
 
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contentstorage/casoftwareregistry/casoftwareregistry.pri	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,18 @@
+#
+# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+HEADERS += ../../homescreensrv_plat/contentstorage_api/casoftwareregistry.h
+SOURCES += ./src/*.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contentstorage/casoftwareregistry/casoftwareregistry.pro	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,54 @@
+#
+# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+TEMPLATE = lib
+
+DEFINES += CACLIENT_LIB
+
+include(../../common.pri)
+include(casoftwareregistry.pri)
+
+DEPENDPATH += ./inc \
+              ./src
+INCLUDEPATH += ./inc \
+            ../inc
+            
+symbian: {
+
+TARGET.UID2 = 0x1000008D
+TARGET.UID3 = 0x2002DCF5
+
+TARGET.CAPABILITY = CAP_GENERAL_DLL
+TARGET.VENDORID = VID_DEFAULT
+
+INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE
+
+LIBS += -leuser \
+        -lbafl \
+        -lestor \
+        -lscrclient \
+        -lxqutils
+        
+include(casoftwareregistry_s60.pri)
+}
+
+win32: {
+DEPENDPATH += ./stub/inc \
+              ./stub/src
+INCLUDEPATH += ./stub/inc
+
+include(casoftwareregistry_stub.pri)
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contentstorage/casoftwareregistry/casoftwareregistry_s60.pri	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,24 @@
+#
+# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: 
+#
+
+DEPENDPATH += ./s60/inc \
+              ./s60/src
+
+INCLUDEPATH += ./s60/inc
+
+HEADERS += ./s60/inc/*.h
+
+SOURCES += ./s60/src/*.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contentstorage/casoftwareregistry/casoftwareregistry_stub.pri	Thu May 27 13:11:12 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:
+#
+DEPENDPATH += ./stub/inc \
+              ./stub/src
+INCLUDEPATH += ./stub/inc
+HEADERS += ./stub/inc/*.h
+SOURCES += ./stub/src/*.cpp
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contentstorage/casoftwareregistry/s60/inc/casoftwareregistry_p.h	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: casoftwareregistry_p.h
+ *
+ */
+
+#ifndef CA_SOFTWARE_REGISTRY_PRIVATE_H
+#define CA_SOFTWARE_REGISTRY_PRIVATE_H
+
+#include <QHash>
+#include <QString>
+
+class CaSoftwareRegistry;
+namespace Usif 
+{
+    class CComponentEntry;
+}
+
+class CaSoftwareRegistryPrivate
+{
+public:
+
+    typedef QHash<QString, QString> DetailMap;
+
+    explicit CaSoftwareRegistryPrivate(
+        CaSoftwareRegistry *softwareRegistryPublic);
+    ~CaSoftwareRegistryPrivate();
+
+    DetailMap entryDetails(int componentId) const;
+    
+    DetailMap entryDetails(
+        const Usif::CComponentEntry& entry) const;
+private:
+    CaSoftwareRegistry *const m_q;
+
+};
+
+#endif // CA_SOFTWARE_REGISTRY_PRIVATE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contentstorage/casoftwareregistry/s60/src/casoftwareregistry_p.cpp	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  ?Description
+ *
+ */
+#include <QtGlobal>
+#include <QMetaType>
+#include <QScopedPointer>
+#include <QString>
+
+#include <usif/scr/scr.h>
+#include <usif/scr/screntries.h>
+#include <xqconversions.h>
+
+#include "casoftwareregistry.h"
+#include "casoftwareregistry_p.h"
+
+using namespace Usif;
+
+template <typename RClass>
+struct RClassDeleter
+{
+    static inline void cleanup(RClass *ptr)
+    {
+        ptr->Close();
+    }
+};
+
+typedef QScopedPointer<RSoftwareComponentRegistry, 
+    RClassDeleter<RSoftwareComponentRegistry> > ScrScopedPointer;
+/*!
+ Constructor
+ \param servicePublic Pointer to object of the public class.
+ */
+CaSoftwareRegistryPrivate::CaSoftwareRegistryPrivate(
+    CaSoftwareRegistry *servicePublic):
+    m_q(servicePublic)
+{
+}
+
+/*!
+ Destructor.
+ */
+CaSoftwareRegistryPrivate::~CaSoftwareRegistryPrivate()
+{
+}
+
+/*!
+ \param componentId Component id of the entry which details are requested for.
+ \return Map of component details if component id was greater than 0 or
+ empty map otherwise. 
+ */
+CaSoftwareRegistryPrivate::DetailMap CaSoftwareRegistryPrivate::entryDetails(
+    int componentId) const
+{
+    CaSoftwareRegistry::DetailMap result;
+
+    if (componentId >= 1) {
+        ScrScopedPointer scr(new RSoftwareComponentRegistry);
+        QT_TRAP_THROWING(User::LeaveIfError(scr->Connect()));
+        
+        QScopedPointer<CComponentEntry> entry;
+        
+        QT_TRAP_THROWING(entry.reset(CComponentEntry::NewL()));
+        QT_TRAP_THROWING(scr->GetComponentL(componentId, *entry));
+        result = entryDetails(*entry);
+    }
+    
+    return result;
+}
+
+/*!
+ \param entry Software registry entry providing details.
+ \return Map with details for the component represented by \entry.
+ */
+CaSoftwareRegistryPrivate::DetailMap CaSoftwareRegistryPrivate::entryDetails(
+    const CComponentEntry& entry) const
+{
+    CaSoftwareRegistry::DetailMap detailMap;
+    
+    detailMap[CaSoftwareRegistry::componentNameKey()] = 
+        XQConversions::s60DescToQString(entry.Name());
+        
+    detailMap[CaSoftwareRegistry::componentVersionKey()] = 
+        XQConversions::s60DescToQString(entry.Version());
+    
+    detailMap[CaSoftwareRegistry::componentVendorKey()] = 
+        XQConversions::s60DescToQString(entry.Vendor());
+        
+    QString drives;
+    const TInt driveListLen(entry.InstalledDrives().Length());
+    for (TInt i( 0 ); i < driveListLen; ++i) {
+        if (entry.InstalledDrives()[i] != '\0') {
+            if (!drives.isEmpty()) {
+                drives = drives.append(",");
+             }
+            drives = drives.append(QChar('A'+ i)).append(":");
+        }
+    }
+    
+    detailMap[CaSoftwareRegistry::componentDriveInfoKey()] = drives;
+    detailMap[CaSoftwareRegistry::componentSizeKey()].setNum(
+        entry.ComponentSize() / 1024);
+    
+    detailMap[CaSoftwareRegistry::componentTypeKey()] = 
+        XQConversions::s60DescToQString(entry.SoftwareType());
+
+    return detailMap;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contentstorage/casoftwareregistry/src/casoftwareregistry.cpp	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,169 @@
+/*
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  ?Description
+ *
+ */
+#include <QtGlobal>
+#include <QMetaType>
+#include <QString>
+
+
+#include "casoftwareregistry.h"
+#include "casoftwareregistry_p.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+/*!
+
+ \class CaSoftwareRegistry.
+ \brief This class provides access to USIF provided data and converting
+ them from Symbian to Qt types.
+
+ CaSoftwareRegistry class provides a factory method which returns smart pointer
+ to CaSoftwareRegistry instnce to ensure
+ automatical memory cleanup once the reference count drops to 0.
+
+ \code
+ QSharedPointer<CaSoftwareRegistry> service = CaSoftwareRegistry::create();
+ \endcode
+
+ Subsequent calls to CaSoftwareRegistry::create() may return pointers to different
+ instances. It is a case when between the calls instance counter of the created
+ object dropped to 0 and it was deleted.
+ 
+ */
+
+/*! \typedef typedef QHash<QString, QString> DetailMap;
+ * Defines map type for component details.
+ * 
+ */
+
+/*!
+ \var CaSoftwareRegistryPrivate::m_q
+ Points to the CaSoftwareRegistry instance that uses this private implementation.
+ */
+
+
+// Initialization of a static member variable.
+QWeakPointer<CaSoftwareRegistry> CaSoftwareRegistry::m_instance = 
+    QWeakPointer<CaSoftwareRegistry>();
+
+
+/*!
+ Constructor.
+ \param parent pointer to a parent. It defaults to NULL.
+ */
+CaSoftwareRegistry::CaSoftwareRegistry(QObject *parent) :
+    QObject(parent), m_d(new CaSoftwareRegistryPrivate(this))
+{
+
+}
+
+/*!
+ Returns a pointer to an instance of the CaSoftwareRegistry class.
+ \retval A pointer to an instance of the CaSoftwareRegistry class.
+ */
+QSharedPointer<CaSoftwareRegistry> CaSoftwareRegistry::create()
+{
+    QSharedPointer<CaSoftwareRegistry> service(m_instance);
+    if (!service) {
+        service = QSharedPointer<CaSoftwareRegistry>(new CaSoftwareRegistry);
+        m_instance = service.toWeakRef();
+    }
+    return service;
+}
+
+/*!
+ Destructor.
+ */
+CaSoftwareRegistry::~CaSoftwareRegistry()
+{
+    delete m_d;
+}
+
+/*!
+ The method provides component details from USIF for a given component id.
+ \code
+ QSharedPointer<CaSoftwareRegistry> service = CaSoftwareRegistry::create();
+ CaSoftwareRegistry::DetailMap detailMap = service->entryDetails(5);
+ QString appName = detailMap[CaSoftwareRegistry::componentNameKey()];
+ \endcode
+ \param componentId Component id of the entry details are requested for.
+ \return Map of the component details if component id was greater than 0 or
+ empty map otherwise. 
+
+ */
+CaSoftwareRegistry::DetailMap CaSoftwareRegistry::entryDetails(
+    int componentId) const
+{
+    return m_d->entryDetails(componentId);
+}
+
+/*!
+ * \return Component name key in CaSoftwareRegistry::DetailMap.
+ */
+QString CaSoftwareRegistry::componentNameKey()
+{
+    static const QString key("name");
+    return key;
+}
+
+/*!
+ * \return Component version key in CaSoftwareRegistry::DetailMap.
+ */
+QString CaSoftwareRegistry::componentVersionKey()
+{
+    static const QString key("version");
+    return key;
+}
+
+/*!
+ * \return Component vendor key in CaSoftwareRegistry::DetailMap.
+ */
+QString CaSoftwareRegistry::componentVendorKey()
+{
+    static const QString key("vendor");
+    return key;
+}
+
+/*!
+ * \return Component drive info key in CaSoftwareRegistry::DetailMap.
+ */
+QString CaSoftwareRegistry::componentDriveInfoKey()
+{
+    static const QString key("driveInfo");
+    return key;
+}
+
+/*!
+ * \return Component size info key in CaSoftwareRegistry::DetailMap.
+ */
+QString CaSoftwareRegistry::componentSizeKey()
+{
+    static const QString key("size");
+    return key;
+}
+
+/*!
+ * \return Component type key in CaSoftwareRegistry::DetailMap.
+ */
+QString CaSoftwareRegistry::componentTypeKey()
+{
+    static const QString key("type");
+    return key;
+}
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contentstorage/casoftwareregistry/stub/inc/casoftwareregistry_p.h	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: casoftwareregistry_p.h
+ *
+ */
+
+#ifndef CA_SOFTWARE_REGISTRY_PRIVATE_H
+#define CA_SOFTWARE_REGISTRY_PRIVATE_H
+
+#include <QHash>
+#include <QString>
+
+class CaSoftwareRegistry;
+
+class CaSoftwareRegistryPrivate
+{
+public:
+    typedef QHash<QString, QString> DetailMap;
+    
+    explicit CaSoftwareRegistryPrivate(
+        CaSoftwareRegistry *softwareRegistryPublic);
+    ~CaSoftwareRegistryPrivate();
+
+    DetailMap entryDetails(int componentId) const;
+private:
+
+    CaSoftwareRegistry *const m_q;
+
+};
+
+#endif // CA_SOFTWARE_REGISTRY_PRIVATE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contentstorage/casoftwareregistry/stub/src/casoftwareregistry_p.cpp	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  ?Description
+ *
+ */
+#include <QtGlobal>
+#include <QMetaType>
+#include <QString>
+
+
+#include "casoftwareregistry.h"
+#include "casoftwareregistry_p.h"
+
+
+/*
+ Constructor
+ \param servicePublic Pointer to object of the public class.
+ */
+CaSoftwareRegistryPrivate::CaSoftwareRegistryPrivate(CaSoftwareRegistry *servicePublic) :
+    m_q(servicePublic)
+{
+}
+
+/*
+ Destructor.
+ */
+CaSoftwareRegistryPrivate::~CaSoftwareRegistryPrivate()
+{
+}
+
+/*
+ Stub for windows development.
+ \param Component id.
+ \return Map with dummy entries when component id is greater than 0, otherwise
+ empty map.
+ */
+CaSoftwareRegistryPrivate::DetailMap CaSoftwareRegistryPrivate::entryDetails(
+    int componentId) const
+{
+    CaSoftwareRegistry::DetailMap detailMap;
+    
+    if (componentId >=1) {
+        detailMap[CaSoftwareRegistry::componentNameKey()] = "no data";
+            
+        detailMap[CaSoftwareRegistry::componentVersionKey()] = "no data";
+        
+        detailMap[CaSoftwareRegistry::componentVendorKey()] = "no data";
+                
+        detailMap[CaSoftwareRegistry::componentDriveInfoKey()] = "no data";
+        
+        detailMap[CaSoftwareRegistry::componentSizeKey()] = "no data";
+        
+        detailMap[CaSoftwareRegistry::componentTypeKey()] = "no data";
+    }
+    return detailMap;    
+}
+
--- a/contentstorage/casrv/caappscanner/group/caappscanner.mmp	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/casrv/caappscanner/group/caappscanner.mmp	Thu May 27 13:11:12 2010 +0300
@@ -57,5 +57,6 @@
 LIBRARY         efsrv.lib
 LIBRARY         sisregistryclient.lib
 LIBRARY         platformenv.lib
+LIBRARY         scrclient.lib
 // temporary till cWRT will be in SCR
 LIBRARY         WidgetRegistryClient.lib
--- a/contentstorage/casrv/caappscanner/inc/casrvappscanner.h	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/casrv/caappscanner/inc/casrvappscanner.h	Thu May 27 13:11:12 2010 +0300
@@ -22,10 +22,10 @@
 #include <apgcli.h>
 #include <apgnotif.h>
 #include <driveinfo.h>
+#include <usif/scr/scr.h>
 #include "cainstallnotifier.h"
 #include "castorage_global.h"
 
-class TCaAppAtributes;
 class CCaSrvMmcHistory;
 class CCaInnerEntry;
 class CCaStorageProxy;
@@ -78,6 +78,16 @@
     static CCaSrvAppScanner* NewL( CCaStorageProxy& aCaStorageProxy,
             CCaSrvEngUtils& aUtils );
 
+public:
+    // from MCaInstallListener
+
+    /**
+     * Handle Install Event.
+     * @since S60 v5.0
+     * @param aUid installed/uninstalled app uid.
+     */
+    void HandleInstallNotifyL( TInt aUid );
+
 private:
     // Constructors and destructor
 
@@ -94,29 +104,19 @@
      */
     void ConstructL();
 
-public:
-    // from MCaInstallListener
-
-    /**
-     * Handle Install Event.
-     * @since S60 v5.0
-     * @param aUid installed/uninstalled app uid.
-     */
-    void HandleInstallNotifyL( TInt aUid );
-
 private:
 
     /**
-     * Notifies storage abaut change for aAppUid.
+     * Notifies storage about change for aAppUid.
      * @param aAppUid application uid.
      */
     void NotifyL( TInt aAppUid );
 
     /**
-     * Notifies storage abaut change for aPackageEntry related app.
+     * Notifies storage about change for aPackageEntry related app.
      * @param aPackageEntry application package entry.
      */
-    void NotifyL( Swi::RSisRegistryEntry & aPackageEntry );
+    void NotifyL( Swi::RSisRegistryEntry& aPackageEntry );
 
 private:
     // from CActive
@@ -133,7 +133,7 @@
 
     /**
      * Error handling: ignore error.
-     * @param aErr Error code.
+     * @param aError Error code.
      */
     TInt RunError( TInt aError );
 
@@ -142,46 +142,39 @@
 
     void HandleAppListEvent( TInt aEvent );
 
-public:
-    /**
-     * Schedule appscanner run.
-     * Self complete active object.
-     */
-    void ScheduleScan();
-
 private:
     // new methods
 
     /**
-     * Gets collectionId of download collection
-     * @result id of download collection
+     * Gets collectionId of download collection.
+     * @result id of download collection.
      */
     TInt GetCollectionDownloadIdL();
 
     /**
-     * Gets collectionId of all collection
-     * @result id of all collection
+     * Gets collectionId of all collection.
+     * @result id of all collection.
      */
     TInt GetAllCollectionIdL();
 
     /**
-     * Adds application entry to downloaded collection
+     * Adds application entry to downloaded collection.
      * @param aEntryId application entry id.
      */
     void AddEntryToDownloadedCollectionL( TInt aEntryId );
 
     /**
-     * Add application entry to predefined collection
+     * Add application entry to predefined collection.
      * @param aEntry application entry.
-     * @param aUpdate is entry updated by a client
+     * @param aUpdate is entry updated by a client.
      */
     void AddEntryToPredefinedCollectionL( CCaInnerEntry* aEntry,
             TBool aUpdate = EFalse );
 
     /**
-     * Create predefined collection
+     * Create predefined collection.
      * @param aGroupName group name.
-     * @result id of new created collection
+     * @result id of a newly created collection.
      */
     TInt CreatePredefinedCollectionL( const TDesC& aGroupName );
 
@@ -192,94 +185,95 @@
     void AddCollectionToAllCollectionL( TInt aCollectionId );
 
     /**
-     * Removes application entry from downloaded collection
+     * Removes application entry from downloaded collection.
      * @param aEntryId application entry id.
      */
     void RemoveEntryFromDownloadedL( TInt aEntryId );
 
-    TBool HandleLockDeleteFlagUpdateL( CCaInnerEntry* aItem );
+    /**
+     * Updates application's removable and visible flags.
+     * @param aItem menu item.
+     * @return ETrue if flags were updated.
+     */
+    TBool HandleRemovableVisibleFlagsUpdateL( CCaInnerEntry* aItem );
 
     /**
      * Updates application's missing and visible flags.
-     * Add new menu item referring to this application.
      * @param aItem menu item.
-     * @return ETrue if flags were updated
+     * @return ETrue if flags were updated.
      */
     TBool HandleMissingVisibleFlagsUpdate( CCaInnerEntry* aItem );
 
     /**
      * Updates visible flag.
      * @param aItem menu item.
-     * @param aUid Application's uid.
-     * @return ETrue if visible flag was updated
+     * @return ETrue if visible flag was updated.
      */
     TBool HandleVisibleFlagUpdate( CCaInnerEntry* aItem );
 
     /**
      * Updates used flag.
      * @param aItem menu item.
-     * @param aUid Application's uid.
-     * @return ETrue if used flag was updated
+     * @return ETrue if used flag was updated.
      */
     TBool HandleUsedFlagUpdate( CCaInnerEntry* aItem );
+
     /**
      * Updates mmc attribute.
      * @param aItem menu item.
-     * @param aUid Application's uid.
      * @param aMmcId MMC ID of currently inserted MMC, or 0.
-     * @return ETrue if mmc attribute was updated
+     * @return ETrue if mmc attribute was updated.
      */
     TBool HandleMmcAttrUpdateL( CCaInnerEntry* aItem, TUint aMmcId );
 
     /**
-     * Check if application is in rom
+     * Check if application is in rom.
      * Add new menu item referring to this application.
-     * @param aUid uid applications
-     * @return ETrue if app is in rom
+     * @return ETrue if app is in rom.
      */
     TBool IsInRomL( TInt aUid );
 
     /**
-     * Get applications from AppArc
-     * @param aArray RArray with applications
+     * Get applications from AppArc.
+     * @param aArray RArray with applications' uids.
      */
-    void GetApaItemsL( RArray<TCaAppAtributes>& aArray );
+    void GetApaItemsL( RArray<TUint>& aArray );
 
     /**
-     * Remove application from array (found in AppArc)
-     * @param aArray RArray with application
-     * @param aUid uid of application to remove
+     * Remove application from array (found in AppArc).
+     * @param aArray RArray with applications' uids.
+     * @param aUid uid of application to remove.
      */
-    void RemoveApp( RArray<TCaAppAtributes>& aArray, TInt32 aUid );
+    void RemoveApp( RArray<TUint>& aArray, TInt32 aUid );
 
     /**
-     * Get applications from CaStorage
-     * @param aArray RPointerArray with CCaInnerEntries
-     * contains applications
+     * Get applications from CaStorage.
+     * @param aArray RPointerArray with CCaInnerEntries.
+     * contains applications.
      */
     void GetCaAppEntriesL( RPointerArray<CCaInnerEntry>& aArray );
 
     /**
-     * Remove sat application from array(found in CaStorage)
+     * Remove sat application from array(found in CaStorage).
      * @param aArray RPointerArray with CCaInnerEntries
-     * contains applications
+     * contains applications.
      */
     void RemoveSatAppL( RPointerArray<CCaInnerEntry>& aArray );
 
     /**
-     * Ensure that HsApplicaiton is not visible: Add HsApplication
+     * Ensure that HsApplicaiton is not visible: Add HsApplication.
      * as hidden to CaStorage or remove HsApplication entry
      * from array (found in CaStorage).
      * @param aArray RPointerArray with CCaInnerEntries
-     * contains application
+     * contains application.
      */
     void HandleHsAppEntryL( RPointerArray<CCaInnerEntry>& aArray );
 
     /**
-     * Get application with specified uid from CaStorage
-     * @param aUid RPointerArray with CCaInnerEntries
+     * Get application with specified uid from CaStorage.
+     * @param aUid RPointerArray with CCaInnerEntries.
      * @param aArray RPointerArray with CCaInnerEntries
-     * contains application
+     * contains application.
      */
     void GetCaAppEntriesL( TInt aUid, RPointerArray<CCaInnerEntry>& aArray );
 
@@ -293,30 +287,22 @@
 
     /**
      * Removes given uid from iInstalledPackages.
-     * Add new menu item referring to this application.
-     * @param aUid Application capability.
+     * @param aUid Application uid.
      */
     void RemoveFromInstalledPackages( TUint aUid );
 
     /**
-     * Set information from TApaAppInfo to entry
+     * Set information from TApaAppInfo to entry.
      * @param aEntry CCaInnerEntry with application.
      * @return ETrue if app info was updatedd
      */
     TBool SetApaAppInfoL( CCaInnerEntry* aEntry );
 
     /**
-     * Find the default folder (folder having attribute 'default="1"').
-     * If not found, return 0.
-     * @param aFolderId Dedault folder or 0.
-     */
-    void DefaultFolderL( TInt& aFolderId );
-
-    /**
-     * Handle items are in the menu but no corresponding app is present:
-     * - Items that are on a recently used MMC are get "missing" flag but kept.
+     * Handle items which are in the menu but no corresponding app is present:
+     * - Items that are on a recently used MMC get "missing" flag but kept.
      * - Items that are not on MMC or the MMC is not recently used, are
-     *   removed form the menu.
+     *   removed from the menu.
      * @param aItems Missing items.
      */
     void HandleMissingItemsL( RPointerArray<CCaInnerEntry>& aCaEnties );
@@ -334,7 +320,7 @@
     void SetMissingFlagL( CCaInnerEntry* aEntry );
 
     /**
-     * Set "visible" flag.
+     * Clear "visible" flag (and also "missing" and "used").
      * @param aEntry entry.
      */
     void ClearVisibleFlagL( CCaInnerEntry* aEntry );
@@ -347,23 +333,24 @@
 
     /**
      * Get current MMC id. 0 if no MMC is inserted, or in case of any errors.
-     * @return Current MMC id, or 0.
+     * @return Current MMC id or 0.
      */
     TUint CurrentMmcId() const;
 
     /**
-     * Check if file is on given default drive type.
+     * Check if file is on a given default drive type.
      * @param aFileName File name.
-     * @return ETrue if aFileName is on given default drive type.
+     * @param aDefaultDrive default drive type
+     * @return ETrue if aFileName is on a given default drive type.
      */
     TBool IsFileInDrive( const TDesC& aFileName,
             const DriveInfo::TDefaultDrives& aDefaultDrive ) const;
 
     /**
-     * Check if application is installed on given drive type.
+     * Check if application is installed on a given drive type.
      * @param aUid app uid.
-     * @param aDefaultDrive drive type.
-     * @return ETrue if app is installed on given drive type.
+     * @param aDefaultDrive default drive type.
+     * @return ETrue if app is installed on a given drive type.
      */
     TBool IsAppInDriveL( const TUid aUid,
             const DriveInfo::TDefaultDrives& aDefaultDrive ) const;
@@ -390,29 +377,29 @@
     TBool IsDriveInUse( const DriveInfo::TDefaultDrives& aDefaultDrive );
 
     /**
-     * Add application to storage or update entry if necessary
-     * @param aCaEnties with applications from storage
-     * @param aApaItem application item with uid and hidden flag on or off
-     * @param aMmcId unique mmc id
+     * Add application to storage or update entry if necessary.
+     * @param aCaEnties with applications from storage.
+     * @param aAppUid application uid.
+     * @param aMmcId unique mmc id.
      */
     void UpdateApplicationEntryL( RPointerArray<CCaInnerEntry>& aCaEnties,
-            const TCaAppAtributes& aApaItem, TUint aMmcId );
+            TUint aAppUid, TUint aMmcId );
 
     /**
-     * Update entry from storage
-     * @param aEntry application entry
-     * @param aMmcId unique mmc id
+     * Update entry from storage.
+     * @param aEntry application entry.
+     * @param aMmcId unique mmc id.
      */
     void UpdateAppEntryL( CCaInnerEntry* aEntry, TUint aMmcId );
 
     /**
-     * Get all application from storage and visible from apparc
-     * and update if necessary
+     * Get all applications from storage and visible from apparc
+     * and update if necessary.
      */
     void UpdateApplicationEntriesL();
 
     /**
-     * Notifys storage abaut updated apps
+     * Notifys storage about updated apps.
      */
     void InstallationNotifyL();
 
@@ -423,22 +410,38 @@
 
     /**
      * Make collection visible if has visible entry.
-     * @param aEntry application entry
+     * @param aEntry application entry.
      */
     void MakeCollectionVisibleIfHasVisibleEntryL( CCaInnerEntry* aEntry );
+    
+    /**
+     * Adds or updates component id attribute in entry based on SCR provided data
+     * @param appInfo application data carrying full path name of application file.
+     * @param aEntry entry being updated with component id attribute.
+     * @return ETrue when component id attribute of the entry has been added or changed.
+     */
+    TBool UpdateComponentIdL( TApaAppInfo& appInfo, 
+        CCaInnerEntry& aEntry ) const;
+
+    /**
+     * Schedule appscanner run.
+     * Self complete active object.
+     */
+    void ScheduleScan();
 
 private:
     // data
 
     RApaLsSession iApaLsSession; ///< AppArc session. Own.
     CApaAppListNotifier* iNotifier; ///< Change notifier. Own.
-    CCaInstallNotifier* iInstallNotifier;///< Install notifier. Own.
+    CCaInstallNotifier* iInstallNotifier; ///< Install notifier. Own.
     CCaSrvMmcHistory* iMmcHistory; ///< MMC history. Own.
     RFs iFs; ///< File Server Session. Own.
+    Usif::RSoftwareComponentRegistry iSoftwareRegistry;
 
-    CCaStorageProxy& iCaStorageProxy;///< not own
-    CCaSrvEngUtils& iSrvEngUtils;//<not own
-    RArray<TInt> iInstalledPackages;
+    CCaStorageProxy& iCaStorageProxy; ///< Not own
+    CCaSrvEngUtils& iSrvEngUtils; ///< Not own
+    RArray<TInt> iInstalledPackages; ///< Own.
 
     TInt iCollectionDownloadId;
     TInt iAllCollectionId;
@@ -446,39 +449,4 @@
 
     };
 
-/**
- * Application atributes.
- * Object contains uid and hidden flag
- */
-class TCaAppAtributes
-    {
-
-public:
-    /**
-     * Constructor.
-     * @param aUid uid application.
-     */
-    TCaAppAtributes( TUint aUid );
-
-    /*
-     * Get uid
-     * @return application uid
-     */
-    TUint GetUid() const;
-
-    /*
-     * Match application items
-     * @param item1 first item to matching.
-     * @param item2 second item to matching.
-     */
-    static TBool MatchItems( const TCaAppAtributes& item1,
-            const TCaAppAtributes& item2 );
-
-private:
-    // data
-
-    TUint iUid;///< uid application
-
-    };
-
 #endif /* CASRVAPPSCANNER_H_ */
--- a/contentstorage/casrv/caappscanner/src/casrvappscanner.cpp	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/casrv/caappscanner/src/casrvappscanner.cpp	Thu May 27 13:11:12 2010 +0300
@@ -20,6 +20,7 @@
 #include <swi/sisregistrysession.h>
 #include <swi/sisregistryentry.h>
 #include <swi/sisregistrypackage.h>
+#include <usif/scr/screntries.h>
 #include <WidgetRegistryClient.h>
 
 #include "cadef.h"
@@ -33,7 +34,9 @@
 #include "caarraycleanup.inl"
 #include "castorageproxy.h"
 
+#include "caarraycleanup.inl"
 
+using namespace Usif;
 
 // ==================== LOCAL FUNCTIONS ====================
 
@@ -66,7 +69,7 @@
 // ==================== MEMBER FUNCTIONS ====================
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::NewL
+//
 // ---------------------------------------------------------
 //
 CCaSrvAppScanner* CCaSrvAppScanner::NewL( CCaStorageProxy& aCaStorageProxy,
@@ -81,12 +84,13 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::~CCaSrvAppScanner
+//
 // ---------------------------------------------------------
 //
 CCaSrvAppScanner::~CCaSrvAppScanner()
     {
     Cancel();
+    iSoftwareRegistry.Close();
     iApaLsSession.Close();
     iInstalledPackages.Close();
     delete iInstallNotifier;
@@ -96,7 +100,7 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::CCaSrvAppScanner
+//
 // ---------------------------------------------------------
 //
 CCaSrvAppScanner::CCaSrvAppScanner( CCaStorageProxy& aCaStorageProxy,
@@ -108,7 +112,7 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::ConstructL
+//
 // ---------------------------------------------------------
 //
 void CCaSrvAppScanner::ConstructL()
@@ -117,7 +121,7 @@
     TFileName path;
     User::LeaveIfError( iFs.PrivatePath( path ) );
     TUint attribute;
-    if( iFs.Att( path, attribute) == KErrNotFound )
+    if( iFs.Att( path, attribute ) == KErrNotFound )
         {
         TInt mdRes = iFs.MkDirAll( path );
         if ( mdRes != KErrNone )
@@ -125,10 +129,8 @@
             User::Leave( mdRes );
             }
         }
-    iMmcHistory = new (ELeave) CCaSrvMmcHistory();
+    iMmcHistory = CCaSrvMmcHistory::NewL();
     iMmcHistory->LoadL( iFs, KCaMmcHistoryFname() );
-    // The notifier has its own session to apparc, instead of taking
-    // it as argument... :(
     iNotifier = CApaAppListNotifier::NewL(
             this, CActive::EPriorityStandard );
     iInstallNotifier = CCaInstallNotifier::NewL(
@@ -136,6 +138,7 @@
 
     User::LeaveIfError( iApaLsSession.Connect() );
     User::LeaveIfError( iApaLsSession.GetAllApps() ); // This is async.
+    User::LeaveIfError( iSoftwareRegistry.Connect() );
     iApaLsSession.RegisterListPopulationCompleteObserver( iStatus );
     iCollectionDownloadId = 0;
     iAllCollectionId = 0;
@@ -143,12 +146,12 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::RunL
+//
 // ---------------------------------------------------------
 //
 void CCaSrvAppScanner::RunL()
     {
-    User::LeaveIfError( iStatus.Int() ); // Handle errors in RunL.
+    User::LeaveIfError( iStatus.Int() );
     // AppArc app scan complete, we have the app list.
     UpdateApplicationEntriesL();
     InstallationNotifyL();
@@ -156,7 +159,7 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::DoCancel
+//
 // ---------------------------------------------------------
 //
 void CCaSrvAppScanner::DoCancel()
@@ -165,43 +168,42 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::RunError
+//
 // ---------------------------------------------------------
 //
 TInt CCaSrvAppScanner::RunError( TInt /*aError*/)
     {
     // Ignore the error (what else could we do?).
-    // When next AppArc update occurs, we will run again.
+    // When next update occurs, we will run again.
     return KErrNone;
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::UpdateApplicationItemL
+//
 // ---------------------------------------------------------
 //
 void CCaSrvAppScanner::UpdateApplicationEntryL(
         RPointerArray<CCaInnerEntry>& aCaEntries,
-        const TCaAppAtributes& aApaItem, TUint aMmcId )
+        TUint aAppUid, TUint aMmcId )
     {
-    TInt appuid = aApaItem.GetUid();
     RPointerArray<CCaInnerEntry> resultArray;
     CleanupResetAndDestroyPushL( resultArray );
-    GetCaAppEntriesL( appuid, resultArray );
+    GetCaAppEntriesL( aAppUid, resultArray );
 
     // This app is not in the storage, add it now.
     // We don't add hidden items, there are too many of them!
     // do not display Menu app
     if( !resultArray.Count() )
         {
-        AddAppEntryL( appuid, aMmcId );
+        AddAppEntryL( aAppUid, aMmcId );
         }//if
 
     // "removable", "missing" and "visible"  flags update
     for( TInt j = 0; j < resultArray.Count(); j++ )
         {
-        //we need to handle first run of appscanner,
-        //there might be some incorrect data in content xml file
-        //if this will have impact on performance we may run this methods only at start up
+        //We need to handle first run of appscanner,
+        //there might be some incorrect data. If this will have impact
+        //on performance we may run this methods only at start up.
 
         UpdateAppEntryL( resultArray[j], aMmcId );
         TInt index = aCaEntries.Find( resultArray[j],
@@ -216,7 +218,7 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::UpdateAppEntryL
+//
 // ---------------------------------------------------------
 //
 void CCaSrvAppScanner::UpdateAppEntryL( CCaInnerEntry* aEntry, TUint aMmcId )
@@ -225,9 +227,9 @@
     TBool missingVisibleFlagChanged =
         HandleMissingVisibleFlagsUpdate( aEntry );
     toUpdate = missingVisibleFlagChanged || toUpdate;
-    toUpdate = HandleLockDeleteFlagUpdateL( aEntry ) || toUpdate;
+    toUpdate = HandleRemovableVisibleFlagsUpdateL( aEntry ) || toUpdate;
     toUpdate = SetApaAppInfoL( aEntry ) || toUpdate;
-    
+
     if( iInstalledPackages.Find( aEntry->GetUid() ) != KErrNotFound )
         {
         AddEntryToDownloadedCollectionL( aEntry->GetId() );
@@ -246,6 +248,142 @@
         RemoveFromInstalledPackages( aEntry->GetUid() );
         }
     }
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+TBool CCaSrvAppScanner::HandleMmcAttrUpdateL(
+        CCaInnerEntry* aItem, TUint aMmcId )
+    {
+    TBool toUpdate( ETrue );
+    if( IsInMmcL( TUid::Uid( aItem->GetUid() ) ) )
+        {
+        //app is instaled on mmc - KCaAttrMmcId attribute update
+        RBuf uidString;
+        uidString.CleanupClosePushL();
+        uidString.CreateL(KUidChars);
+        uidString.Format( KHexFormat, aMmcId );
+        aItem->AddAttributeL( KCaAttrMmcId, uidString );
+        CleanupStack::PopAndDestroy( &uidString );
+        }
+    else if ( IsInMassStorageL( TUid::Uid( aItem->GetUid() ) ) )
+        {
+        //its app installed on mass storage, we need to leave it
+        //in case of connecting usb in mass storage mode
+        aItem->AddAttributeL( KCaAttrMmcId, KCaMassStorage );
+        }
+    else
+        {
+        RBuf attrVal;
+        attrVal.CleanupClosePushL();
+        attrVal.CreateL( KCaMaxAttrValueLen );
+        if( aItem->FindAttribute( KCaAttrMmcId, attrVal ) )
+            {
+            aItem->RemoveAttributeL( KCaAttrMmcId );
+            }
+        else
+            {
+            toUpdate = EFalse;
+            }
+        CleanupStack::PopAndDestroy( &attrVal );
+        //its installed on c: drive - remove attribute
+        }
+    return toUpdate;
+    }
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+void CCaSrvAppScanner::InstallationNotifyL()
+    {
+    for( TInt i = iInstalledPackages.Count() - 1; i >= 0; i-- )
+        {
+        NotifyL( iInstalledPackages[i] );
+        iInstalledPackages.Remove( i );
+        }
+    }
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+void CCaSrvAppScanner::UpdateApplicationEntriesL()
+    {
+    TUint currentMmcId = UpdateMmcHistoryL();
+    // get all Content arsenal enties with type application
+    RPointerArray<CCaInnerEntry> resultArray;
+    CleanupResetAndDestroyPushL( resultArray );
+    GetCaAppEntriesL( resultArray );
+    HandleHsAppEntryL( resultArray );
+    RemoveSatAppL( resultArray );
+
+    RArray<TUint> appUids;
+    CleanupClosePushL( appUids );
+    GetApaItemsL( appUids );
+    RemoveApp( appUids, KSatUid.iUid );
+    RemoveApp( appUids, KHsAppUid.iUid );
+
+    //for every item in apaAndCrItems array
+    for( TInt i = 0; i < appUids.Count(); i++ )
+        {
+        // if there was leave for any item we ignore it
+        // and proceed to the next one
+        TRAP_IGNORE(UpdateApplicationEntryL(
+                resultArray, appUids[i], currentMmcId));
+        }
+    // Here the big list with items that refer to missing apps.
+    HandleMissingItemsL( resultArray );
+    CleanupStack::PopAndDestroy( &appUids );
+    CleanupStack::PopAndDestroy( &resultArray );
+    }
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+TBool CCaSrvAppScanner::HandleRemovableVisibleFlagsUpdateL(
+        CCaInnerEntry* aItem )
+    {
+    TBool toChange( EFalse );
+    if( ( aItem->GetFlags() & EVisible ) && IsInRomL( aItem->GetUid() ) )
+        {
+        if( ( aItem->GetFlags() & ERemovable ) != 0 )
+            {
+            aItem->SetFlags( aItem->GetFlags() & ~ERemovable );
+            toChange = ETrue;
+            }
+        }
+    else
+        {
+        if( ( aItem->GetFlags() & ERemovable ) == 0 )
+            {
+            aItem->SetFlags( aItem->GetFlags() | ERemovable );
+            toChange = ETrue;
+            }
+        }
+    return toChange;
+    }
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+TBool CCaSrvAppScanner::HandleMissingVisibleFlagsUpdate(
+        CCaInnerEntry* aItem )
+    {
+    TBool ret( EFalse );
+    if( aItem->GetFlags() & EMissing ||
+        !( aItem->GetFlags() & EVisible ) )
+        {
+        //application found so we unset "missing" and set "visible" flags
+        aItem->SetFlags( aItem->GetFlags() & ~EMissing | EVisible );
+        ret = ETrue;
+        }
+    return ret;
+    }
+
 // ---------------------------------------------------------
 //
 // ---------------------------------------------------------
@@ -277,144 +415,12 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::HandleMmcAttrUpdateL
-// ---------------------------------------------------------
 //
-TBool CCaSrvAppScanner::HandleMmcAttrUpdateL(
-        CCaInnerEntry* aItem, TUint aMmcId )
-    {
-    TBool toUpdate( ETrue );
-    if( IsInMmcL( TUid::Uid( aItem->GetUid() ) ) )
-        {
-        //app is instaled on mmc - KCaAttrMmcId attribute update
-        TBuf<KUidChars> uidString;
-        uidString.Format( KHexFormat, aMmcId );
-        aItem->AddAttributeL( KCaAttrMmcId, uidString );
-        }
-    else if ( IsInMassStorageL( TUid::Uid( aItem->GetUid() ) ) )
-        {
-        //its app installed on mass storage, we need to leave it
-        //in case of connecting usb in mass storage mode
-        aItem->AddAttributeL( KCaAttrMmcId, KCaMassStorage );
-        }
-    else
-        {
-        RBuf attrVal;
-        attrVal.CleanupClosePushL();
-        attrVal.CreateL( KCaMaxAttrValueLen );
-        if( aItem->FindAttribute( KCaAttrMmcId, attrVal ) )
-            {
-            aItem->RemoveAttributeL( KCaAttrMmcId );
-            }
-        else
-            {
-            toUpdate = EFalse;
-            }
-        CleanupStack::PopAndDestroy( &attrVal );
-        //its installed on c: drive - remove attribute
-        }
-    return toUpdate;
-    }
-
-// ---------------------------------------------------------
-// CCaSrvAppScanner::UpdateApplicationItemsL
-// ---------------------------------------------------------
-//
-void CCaSrvAppScanner::InstallationNotifyL()
-    {
-    for( TInt i = iInstalledPackages.Count() - 1; i >= 0; i-- )
-        {
-        NotifyL( iInstalledPackages[i] );
-        iInstalledPackages.Remove( i );
-        }
-    }
-
-// ---------------------------------------------------------
-// CCaSrvAppScanner::UpdateApplicationItemsL
 // ---------------------------------------------------------
 //
-void CCaSrvAppScanner::UpdateApplicationEntriesL()
-    {
-    TUint currentMmcId = UpdateMmcHistoryL();
-    // get all Content arsenal enties with type application
-    RPointerArray<CCaInnerEntry> resultArray;
-    CleanupResetAndDestroyPushL( resultArray );
-    GetCaAppEntriesL( resultArray );
-    HandleHsAppEntryL( resultArray );
-    RemoveSatAppL( resultArray );
-
-    RArray<TCaAppAtributes> apaItems;
-    CleanupClosePushL( apaItems );
-    GetApaItemsL( apaItems );
-    RemoveApp( apaItems, KSatUid.iUid );
-    RemoveApp( apaItems, KHsAppUid.iUid );
-
-    //for every item in apaAndCrItems array
-    for( TInt i = 0; i < apaItems.Count(); i++ )
-        {
-            // if there was leave for any item we ignore it
-            // and proceed to the next one
-            TRAP_IGNORE(UpdateApplicationEntryL(
-                            resultArray, apaItems[i], currentMmcId));
-        }
-    // Here the big list cwith items that refer to missing apps.
-    HandleMissingItemsL( resultArray );
-    CleanupStack::PopAndDestroy( &apaItems );
-    CleanupStack::PopAndDestroy( &resultArray );
-    }
-
-// ---------------------------------------------------------
-// CCaSrvAppScanner::HandleLockDeleteFlagUpdateL
-// ---------------------------------------------------------
-//
-TBool CCaSrvAppScanner::HandleLockDeleteFlagUpdateL( CCaInnerEntry* aItem )
+void CCaSrvAppScanner::RemoveApp( RArray<TUint>& aArray, TInt32 aUid )
     {
-    TBool toChange( EFalse );
-    TBool isVisible = ( ( aItem->GetFlags() & EVisible ) != 0 );
-    if( isVisible && IsInRomL( aItem->GetUid() ) )
-        {
-        if( ( aItem->GetFlags() & ERemovable ) != 0 )
-            {
-            aItem->SetFlags( aItem->GetFlags() & ~ERemovable );
-            toChange = ETrue;
-            }
-        }
-    else
-        {
-        if( ( aItem->GetFlags() & ERemovable ) == 0 )
-            {
-            aItem->SetFlags( aItem->GetFlags() | ERemovable );
-            toChange = ETrue;
-            }
-        }
-    return toChange;
-    }
-
-// ---------------------------------------------------------
-// CCaSrvAppScanner::HandleMissingFlagUpdateL
-// ---------------------------------------------------------
-//
-TBool CCaSrvAppScanner::HandleMissingVisibleFlagsUpdate( CCaInnerEntry* aItem )
-    {
-    TBool ret( EFalse );
-    if( aItem->GetFlags() & EMissing ||
-        !( aItem->GetFlags() & EVisible ) )
-        {
-        //application found so we unset "missing" and set "visible" flags
-        aItem->SetFlags( aItem->GetFlags() & ~EMissing | EVisible );
-        ret = ETrue;
-        }
-    return ret;
-    }
-
-// ---------------------------------------------------------
-// CCaSrvAppScanner::RemoveApp
-// ---------------------------------------------------------
-//
-void CCaSrvAppScanner::RemoveApp( RArray<TCaAppAtributes>& aArray, TInt32 aUid )
-    {
-    TCaAppAtributes app( aUid );
-    TInt id = aArray.Find( app, TCaAppAtributes::MatchItems );
+    TInt id = aArray.Find( aUid );
     if( id != KErrNotFound )
         {
         aArray.Remove( id );
@@ -422,7 +428,7 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::RemoveSatApp
+//
 // ---------------------------------------------------------
 //
 void CCaSrvAppScanner::RemoveSatAppL( RPointerArray<CCaInnerEntry>& aArray )
@@ -440,10 +446,11 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::HandleHsAppEntryL
+//
 // ---------------------------------------------------------
 //
-void CCaSrvAppScanner::HandleHsAppEntryL( RPointerArray<CCaInnerEntry>& aArray )
+void CCaSrvAppScanner::HandleHsAppEntryL(
+        RPointerArray<CCaInnerEntry>& aArray )
     {
     CCaInnerEntry* appEntry = CCaInnerEntry::NewLC();
     appEntry->SetUid( KHsAppUid.iUid );
@@ -476,12 +483,12 @@
 
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::GetApaItemsL
+//
 // ---------------------------------------------------------
 //
-void CCaSrvAppScanner::GetApaItemsL( RArray<TCaAppAtributes>& aArray )
+void CCaSrvAppScanner::GetApaItemsL( RArray<TUint>& aArray )
     {
-    TApaAppInfo* appInfo = new(ELeave) TApaAppInfo();
+    TApaAppInfo* appInfo = new ( ELeave ) TApaAppInfo();
     CleanupStack::PushL(appInfo);
     TApaAppCapabilityBuf appCap;
 
@@ -495,22 +502,22 @@
         // "Hidden" status according to AppArc.
         if( !appCap().iAppIsHidden )
             {
-            TCaAppAtributes appAtributes( appInfo->iUid.iUid );
-            aArray.AppendL( appAtributes );
+            aArray.AppendL( appInfo->iUid.iUid );
             }
         }
     CleanupStack::PopAndDestroy(appInfo);
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::GetMcsItemsL
+//
 // ---------------------------------------------------------
 //
 void CCaSrvAppScanner::GetCaAppEntriesL(
         RPointerArray<CCaInnerEntry>& aArray )
     {
     CCaInnerQuery* allAppQuery = CCaInnerQuery::NewLC();
-    CDesC16ArrayFlat* appType = new ( ELeave ) CDesC16ArrayFlat( 1 );
+    CDesC16ArrayFlat* appType =
+            new ( ELeave ) CDesC16ArrayFlat( KGranularityOne );
     CleanupStack::PushL( appType );
     appType->AppendL( KCaTypeApp );
     allAppQuery->SetEntryTypeNames( appType );
@@ -520,7 +527,7 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::GetMcsItemsL
+//
 // ---------------------------------------------------------
 //
 TInt CCaSrvAppScanner::GetCollectionDownloadIdL()
@@ -530,7 +537,8 @@
         RPointerArray<CCaInnerEntry> resultArray;
         CleanupResetAndDestroyPushL( resultArray );
         CCaInnerQuery* allAppQuery = CCaInnerQuery::NewLC();
-        CDesC16ArrayFlat* appType = new ( ELeave ) CDesC16ArrayFlat( 1 );
+        CDesC16ArrayFlat* appType =
+                new ( ELeave ) CDesC16ArrayFlat( KGranularityOne );
         CleanupStack::PushL( appType );
         appType->AppendL( KCaTypeCollectionDownload );
         allAppQuery->SetEntryTypeNames( appType );
@@ -547,7 +555,7 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::GetAllCollectionIdL
+//
 // ---------------------------------------------------------
 //
 TInt CCaSrvAppScanner::GetAllCollectionIdL()
@@ -556,7 +564,7 @@
         {
         CCaInnerQuery *getAllCollectionIdQuery = CCaInnerQuery::NewLC();
         CDesC16ArrayFlat *typenameArray = new(ELeave) CDesC16ArrayFlat(
-                KDefaultGranularity );
+                KGranularityOne );
         CleanupStack::PushL( typenameArray );
         typenameArray->AppendL( KCaTypeMenuCollections );
         getAllCollectionIdQuery->SetEntryTypeNames( typenameArray );
@@ -577,7 +585,7 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::GetMcsItemsL
+//
 // ---------------------------------------------------------
 //
 void CCaSrvAppScanner::GetCaAppEntriesL( TInt aUid,
@@ -590,7 +598,7 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::HandleAppListEvent
+//
 // ---------------------------------------------------------
 //
 void CCaSrvAppScanner::HandleAppListEvent( TInt /*aEvent*/)
@@ -604,7 +612,7 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::HandleInstallNotifyL
+//
 // ---------------------------------------------------------
 //
 void CCaSrvAppScanner::HandleInstallNotifyL( TInt aUid )
@@ -614,8 +622,8 @@
     CleanupClosePushL( uids );
 
     Swi::RSisRegistrySession iSisRegSession;
+    CleanupClosePushL( iSisRegSession );
     User::LeaveIfError( iSisRegSession.Connect() );
-    CleanupClosePushL( iSisRegSession );
 
     // Open sis package entry related to aUid
     Swi::RSisRegistryEntry packageEntry;
@@ -626,7 +634,7 @@
 
         // Get packageEntry's embedded sis'
         RPointerArray<Swi::CSisRegistryPackage> embedded;
-        CleanupClosePushL( embedded );
+        CleanupResetAndDestroyPushL( embedded );
         packageEntry.EmbeddedPackagesL( embedded );
         if( embedded.Count() )
             {
@@ -642,7 +650,6 @@
             // of changes in apps included in packageEntry
             NotifyL( packageEntry );
             }
-        embedded.ResetAndDestroy();
         CleanupStack::PopAndDestroy( &embedded );
         CleanupStack::PopAndDestroy( &packageEntry );
         }
@@ -651,7 +658,7 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::NotifyL
+//
 // ---------------------------------------------------------
 //
 void CCaSrvAppScanner::NotifyL( Swi::RSisRegistryEntry & aPackageEntry )
@@ -672,7 +679,7 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::NotifyL
+//
 // ---------------------------------------------------------
 //
 void CCaSrvAppScanner::NotifyL( TInt aAppUid )
@@ -682,20 +689,22 @@
     CleanupResetAndDestroyPushL( resultArray );
     GetCaAppEntriesL( aAppUid, resultArray );
     if( resultArray.Count() && ( resultArray[0]->GetFlags() & EVisible ) )
-        {//TODO: this only for icons. This functionality should be change 
+        {//TODO: this only for icons. This functionality should be change
         iCaStorageProxy.AddL( resultArray[0] );
         }
     CleanupStack::PopAndDestroy( &resultArray );
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::AddEntryToDownloadedCollectionL
+//
 // ---------------------------------------------------------
 //
 void CCaSrvAppScanner::AddEntryToDownloadedCollectionL( TInt aEntryId )
     {
-    TCaOperationParams params = { TCaOperationParams::EPrepend, GetCollectionDownloadIdL(), 0 // not used
-            };
+    TCaOperationParams params;
+    params.iOperationType = TCaOperationParams::EPrepend;
+    params.iGroupId = GetCollectionDownloadIdL();
+    params.iBeforeEntryId = 0; // Not used.
 
     RArray<TInt> entryIds;
     CleanupClosePushL( entryIds );
@@ -706,7 +715,7 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::AddEntryToPredefinedCollectionL
+//
 // ---------------------------------------------------------
 //
 void CCaSrvAppScanner::AddEntryToPredefinedCollectionL(
@@ -731,10 +740,10 @@
 
         RArray<TInt> entryIds;
         CleanupClosePushL( entryIds );
-        TInt entryId = aEntry->GetId();
-        entryIds.AppendL( entryId );
+        entryIds.AppendL( aEntry->GetId() );
         TCaOperationParams organizeParams;
         organizeParams.iBeforeEntryId = 0;
+        organizeParams.iOperationType = TCaOperationParams::EAppend;
 
         if( resultArrayItems.Count() )
             {
@@ -755,14 +764,12 @@
 
             if( aUpdate )
                 {
-                organizeParams.iOperationType = TCaOperationParams::EAppend;
                 iCaStorageProxy.OrganizeL( entryIds, organizeParams );
                 }
             }
 
         if( !aUpdate )
             {
-            organizeParams.iOperationType = TCaOperationParams::EAppend;
             iCaStorageProxy.OrganizeL( entryIds, organizeParams );
             }
 
@@ -773,7 +780,7 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::CreatePredefinedCollectionL
+//
 // ---------------------------------------------------------
 //
 TInt CCaSrvAppScanner::CreatePredefinedCollectionL( const TDesC& aGroupName )
@@ -783,9 +790,7 @@
     innerEntry->SetEntryTypeNameL( KCaTypeCollection );
     innerEntry->SetRole( CCaInnerQuery::Group );
     innerEntry->AddAttributeL( KCaAppGroupName, aGroupName );
-    innerEntry->SetFlags( EVisible );
-    innerEntry->SetFlags( innerEntry->GetFlags() | ERemovable );
-    _LIT( KCollectionIconFileName, "qtg_large_applications_user");
+    innerEntry->SetFlags( EVisible | ERemovable );
     innerEntry->SetIconDataL( KCollectionIconFileName,
             KNullDesC, KNullDesC );
     iCaStorageProxy.AddL( innerEntry );
@@ -797,7 +802,7 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::AddCollectionToAllCollectionL
+//
 // ---------------------------------------------------------
 //
 void CCaSrvAppScanner::AddCollectionToAllCollectionL( TInt aCollectionId )
@@ -817,13 +822,15 @@
 
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::RemoveToDownloadedCollectionL
+//
 // ---------------------------------------------------------
 //
 void CCaSrvAppScanner::RemoveEntryFromDownloadedL( TInt aEntryId )
     {
-    TCaOperationParams params = { TCaOperationParams::ERemove, GetCollectionDownloadIdL(), 0 // not used
-            };
+    TCaOperationParams params;
+    params.iOperationType = TCaOperationParams::ERemove;
+    params.iGroupId = GetCollectionDownloadIdL();
+    params.iBeforeEntryId = 0; // Not Used
 
     RArray<TInt> entryIds;
     CleanupClosePushL( entryIds );
@@ -834,7 +841,7 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::ScheduleScan
+//
 // ---------------------------------------------------------
 //
 void CCaSrvAppScanner::ScheduleScan()
@@ -849,7 +856,7 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::AddAppItemL
+//
 // ---------------------------------------------------------
 //
 void CCaSrvAppScanner::AddAppEntryL( TUint aUid, TUint aCurrentMmcId )
@@ -863,7 +870,7 @@
     appEntry->SetRole( EItemEntryRole );
 
     SetApaAppInfoL( appEntry );
-    HandleLockDeleteFlagUpdateL( appEntry );
+    HandleRemovableVisibleFlagsUpdateL( appEntry );
     HandleMmcAttrUpdateL( appEntry, aCurrentMmcId );
 
     iCaStorageProxy.AddL( appEntry );
@@ -873,14 +880,14 @@
     if( iInstalledPackages.Find( aUid ) != KErrNotFound )
         {
         AddEntryToDownloadedCollectionL( appEntry->GetId() );
+        RemoveFromInstalledPackages( aUid );
         }
-    RemoveFromInstalledPackages( aUid );
 
     CleanupStack::PopAndDestroy( appEntry );
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::RemoveFromInstalledPackages
+//
 // ---------------------------------------------------------
 //
 void CCaSrvAppScanner::RemoveFromInstalledPackages( TUint aUid )
@@ -893,58 +900,77 @@
     }
 
 // ---------------------------------------------------------------------------
-// CCaSrvAppScanner::IsMidletL
-// Checks if given app is midlet by reading the apptype uid (2nd uid)
+//
 // ---------------------------------------------------------------------------
 //
 TBool CCaSrvAppScanner::SetApaAppInfoL( CCaInnerEntry* aEntry )
     {
     TBool changed( EFalse );
-    TApaAppInfo info;
-    if( KErrNone == iSrvEngUtils.GetAppInfo( *aEntry, info ) )
+    TApaAppInfo* info = new ( ELeave ) TApaAppInfo();
+    CleanupStack::PushL(info);
+    if( KErrNone == iSrvEngUtils.GetAppInfo( *aEntry, *info ) )
         {
         RBuf attrVal;
         attrVal.CleanupClosePushL();
         attrVal.CreateL( KCaMaxAttrValueLen );
         aEntry->FindAttribute( KCaAttrLongName, attrVal );
-        if( attrVal.Compare( info.iCaption ) != KErrNone
-                || aEntry->GetText().Compare( info.iCaption )
+        if( attrVal.Compare( info->iCaption ) != KErrNone
+                || aEntry->GetText().Compare( info->iCaption )
                         != KErrNone )
             {
-            aEntry->SetTextL( info.iCaption );
-            aEntry->AddAttributeL( KCaAttrLongName, info.iCaption );
+            aEntry->SetTextL( info->iCaption );
+            aEntry->AddAttributeL( KCaAttrLongName, info->iCaption );
             changed = ETrue;
             }
+        
+        
+        if ( UpdateComponentIdL( *info, *aEntry ) )
+            {
+            changed = ETrue;
+            }
+        
         CleanupStack::PopAndDestroy( &attrVal );
-        // check if its java app and add attr for entrys
+        
+        // check if its java app and add attr for entries
         TUid appTypeUid;
-        if( KErrNone == iApaLsSession.GetAppType( appTypeUid, info.iUid ) )
+        if( KErrNone == iApaLsSession.GetAppType( appTypeUid, info->iUid ) )
             {
             if( appTypeUid == KMidletApplicationTypeUid )
                 {
-                aEntry->AddAttributeL( KCaAttrAppType, KCaAttrAppTypeValueJava );
-                aEntry->AddAttributeL( KCaAttrAppSettingsPlugin, KCaAttrJavaAppSettingsPluginValue );
+                aEntry->AddAttributeL(
+                        KCaAttrAppType,
+                        KCaAttrAppTypeValueJava );
+                aEntry->AddAttributeL(
+                        KCaAttrAppSettingsPlugin,
+                        KCaAttrJavaAppSettingsPluginValue );
                 }
             else if (appTypeUid == KCWRTApplicationTypeUid)
                 {
-                aEntry->AddAttributeL( KCaAttrAppType, KCaAttrAppTypeValueCWRT );
-                aEntry->AddAttributeL( KCaAttrAppWidgetUri, KCaAttrAppWidgetUriCWRTValue );
+                aEntry->AddAttributeL(
+                        KCaAttrAppType,
+                        KCaAttrAppTypeValueCWRT );
+                aEntry->AddAttributeL(
+                        KCaAttrAppWidgetUri,
+                        KCaAttrAppWidgetUriCWRTValue );
                 // web id should be taken from SCR when supported
                 RWidgetRegistryClientSession wrtSession;
                 CleanupClosePushL(wrtSession);
                 User::LeaveIfError( wrtSession.Connect());
                 TFileName bundleId;
-                wrtSession.GetWidgetBundleId(info.iUid, bundleId);
-                aEntry->AddAttributeL( KCaAttrAppWidgetParamWebAppId, bundleId );
+                wrtSession.GetWidgetBundleId(info->iUid, bundleId);
+                aEntry->AddAttributeL(
+                        KCaAttrAppWidgetParamWebAppId,
+                        bundleId );
                 CleanupStack::PopAndDestroy(&wrtSession);
                 }
             }
         }
+    CleanupStack::PopAndDestroy( info );
     return changed;
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::HandleMissingItemsL
+//
 // ---------------------------------------------------------
 //
 void CCaSrvAppScanner::HandleMissingItemsL(
@@ -952,7 +978,6 @@
     {
     for( TInt i = 0; i < aCaEntries.Count(); i++ )
         {
-        const TInt id = aCaEntries[i]->GetId();
         RBuf attrVal;
         attrVal.CleanupClosePushL();
         attrVal.CreateL( KCaMaxAttrValueLen );
@@ -985,7 +1010,7 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::RemoveAppL
+//
 // ---------------------------------------------------------
 //
 void CCaSrvAppScanner::RemoveAppL( CCaInnerEntry* aAppEntry )
@@ -1018,13 +1043,17 @@
     {
     if( aEntry->GetFlags() & EVisible )
         {
-        aEntry->SetFlags( aEntry->GetFlags() & ~EVisible & ~EMissing & ~EUsed );
+        aEntry->SetFlags(
+                aEntry->GetFlags() &
+                ~EVisible &
+                ~EMissing &
+                ~EUsed );
         iCaStorageProxy.AddL( aEntry, EFalse, EItemDisappeared );
         }
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::UpdateMmcHistoryL
+//
 // ---------------------------------------------------------
 //
 TUint CCaSrvAppScanner::UpdateMmcHistoryL()
@@ -1039,7 +1068,7 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::CurrentMmcId
+//
 // ---------------------------------------------------------
 //
 TUint CCaSrvAppScanner::CurrentMmcId() const
@@ -1047,8 +1076,7 @@
     // Get mmc id. Errors are ignored.
     TUint mmcId = 0;
     TInt mmcDrive;
-    TInt err;
-    err = DriveInfo::GetDefaultDrive(
+    TInt err = DriveInfo::GetDefaultDrive(
             DriveInfo::EDefaultRemovableMassStorage, mmcDrive );
     if( !err )
         {
@@ -1063,16 +1091,17 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::IsFileInDrive
+//
 // ---------------------------------------------------------
 //
 TBool CCaSrvAppScanner::IsFileInDrive(
-        const TDesC& aFileName,
-        const DriveInfo::TDefaultDrives& aDefaultDrive ) const
+    const TDesC& aFileName,
+    const DriveInfo::TDefaultDrives& aDefaultDrive ) const
+    {
+    TBool retVal( EFalse );
+    if ( aFileName.Length()>0 )
         {
-        if ( aFileName.Length() )
-            {
-            TInt mmcDrive;
+        TInt mmcDrive;
         TInt err = DriveInfo::GetDefaultDrive( aDefaultDrive, mmcDrive );
         if( !err )
             {
@@ -1080,15 +1109,15 @@
             err = RFs::CharToDrive( aFileName[0], fileDrive );
             if( !err && fileDrive == mmcDrive )
                 {
-                return ETrue;
+                retVal = ETrue;
                 }
             }
         }
-    return EFalse;
+    return retVal;
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::IsAppInDriveL
+//
 // ---------------------------------------------------------
 //
 TBool CCaSrvAppScanner::IsAppInDriveL(
@@ -1096,7 +1125,7 @@
         const DriveInfo::TDefaultDrives& aDefaultDrive ) const
     {
     TBool ret( EFalse );
-    TApaAppInfo* appInfo = new( ELeave ) TApaAppInfo();
+    TApaAppInfo* appInfo = new ( ELeave ) TApaAppInfo();
     TInt err = iApaLsSession.GetAppInfo( *appInfo, aUid );
     if( !err && IsFileInDrive( appInfo->iFullName, aDefaultDrive ) )
         {
@@ -1107,7 +1136,7 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::IsInMmcL
+//
 // ---------------------------------------------------------
 //
 TBool CCaSrvAppScanner::IsInMmcL( const TUid aUid ) const
@@ -1116,7 +1145,7 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::IsInMassStorageL
+//
 // ---------------------------------------------------------
 //
 TBool CCaSrvAppScanner::IsInMassStorageL( const TUid aUid ) const
@@ -1125,7 +1154,7 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::IsInRomL
+//
 // ---------------------------------------------------------
 //
 TBool CCaSrvAppScanner::IsInRomL( TInt aUid )
@@ -1134,7 +1163,7 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::IsDriveInUse
+//
 // ---------------------------------------------------------
 //
 TBool CCaSrvAppScanner::IsDriveInUse(
@@ -1157,6 +1186,10 @@
     return inUse;
     }
 
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
 void CCaSrvAppScanner::MakeNotEmptyCollectionsVisibleL()
     {
     RPointerArray<CCaInnerEntry> resultArray;
@@ -1182,6 +1215,10 @@
     CleanupStack::PopAndDestroy( &resultArray );
    }
 
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
 void CCaSrvAppScanner::MakeCollectionVisibleIfHasVisibleEntryL(
         CCaInnerEntry* aEntry )
     {
@@ -1205,34 +1242,60 @@
     CleanupStack::PopAndDestroy( &resultEntriesArray );
     }
 
-
-// ==================== MEMBER FUNCTIONS ====================
-
-// ---------------------------------------------------------
-// TAppAtributes::TAppAtributes
-// ---------------------------------------------------------
-//
-TCaAppAtributes::TCaAppAtributes( TUint aUid )
-    {
-    iUid = aUid;
-    }
-
-// ---------------------------------------------------------
-// TAppAtributes::GetUid
 // ---------------------------------------------------------
 //
-TUint TCaAppAtributes::GetUid() const
+// ---------------------------------------------------------//
+TBool CCaSrvAppScanner::UpdateComponentIdL( TApaAppInfo& appInfo, 
+    CCaInnerEntry& aEntry ) const
     {
-    return iUid;
-    }
+    TBool updated( EFalse );
+    
+    CComponentFilter* const fileNameFilter = CComponentFilter::NewLC();
+
+    fileNameFilter->SetFileL( appInfo.iFullName );
 
-// ---------------------------------------------------------
-// TAppAtributes::MatchItems
-// ---------------------------------------------------------
-//
-TBool TCaAppAtributes::MatchItems( const TCaAppAtributes& item1,
-        const TCaAppAtributes& item2 )
+    RArray<TComponentId> componentIds;
+    CleanupClosePushL( componentIds );
+    iSoftwareRegistry.GetComponentIdsL( componentIds, fileNameFilter );
+    
+    if ( componentIds.Count() == 0 )
     {
-    return item1.GetUid() == item2.GetUid();
+        CComponentFilter* const uidFilter = CComponentFilter::NewLC();
+        uidFilter->AddPropertyL(_L("Uid"), aEntry.GetUid());
+        iSoftwareRegistry.GetComponentIdsL( componentIds, uidFilter );
+        CleanupStack::PopAndDestroy( uidFilter );
     }
+    
+    if ( componentIds.Count() == 1 )
+        {
+        RBuf newComponentId;
+        newComponentId.CleanupClosePushL();
+        newComponentId.CreateL( sizeof(TComponentId) + 1 );
+        newComponentId.AppendNum( componentIds[0] );
+        
+        RBuf oldComponentId;
+        oldComponentId.CleanupClosePushL();
+        oldComponentId.CreateL( KCaMaxAttrValueLen );
+        
+        const TBool componentIdAttributeFound = 
+            aEntry.FindAttribute( KCaComponentId, oldComponentId );
+              
+        if ( !componentIdAttributeFound 
+            || oldComponentId.Compare( newComponentId ) != 0 )
+            {
+            // 'add' or 'update' the component id attribute value
+            aEntry.AddAttributeL( KCaComponentId, 
+                newComponentId );
+            
+            updated = ETrue;
+            }
+        
+        CleanupStack::PopAndDestroy( &oldComponentId );
+        CleanupStack::PopAndDestroy( &newComponentId );
+        }
 
+    CleanupStack::PopAndDestroy( &componentIds );
+    CleanupStack::PopAndDestroy( fileNameFilter );
+    
+    return updated;
+    }
--- a/contentstorage/casrv/calocalizerscanner/inc/calocalizerscannerproxy.h	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/casrv/calocalizerscanner/inc/calocalizerscannerproxy.h	Thu May 27 13:11:12 2010 +0300
@@ -21,6 +21,7 @@
 // INCLUDES
 #include <e32std.h>
 #include <e32base.h>
+
 #include "hbtextresolversymbian.h"
 
 #include "castorage_global.h"
@@ -36,11 +37,7 @@
  */
 class CCaLocalizerScannerProxy : public CBase
     {
-    
-
 public:
-    
-
     /**
      * Two-phased constructor.
      */
@@ -55,7 +52,11 @@
      * Destructor.
      */
     ~CCaLocalizerScannerProxy( );
-
+    
+    /**
+     * Get localization rows and updates database 
+     */
+    void UpdateLocalNamesL( );
    
 private:
 
@@ -69,30 +70,39 @@
      */
     void ConstructL( );
 
-private:
-    /**
-     * Get localization rows and updates database 
-     */
-    void UpdateLocalNamesL( );
-
     /**
      * Gets localization rows from database as table of CCaLocalizationEntries
      * @param aLocals pointers to localization entries
      */
     void GetLocalizationRowsL( RPointerArray<CCaLocalizationEntry>& aLocals );
     
+    /**
+     * Gets localized names from translation files
+     * @param aLocEntry localization entry
+     * @return localized name
+     */
+    HBufC* GetLocalizedNameLC( const CCaLocalizationEntry* aLocEntry );
+    
+    /**
+     * Gets entry text from the storage
+     * @param aEntries array containing entries
+     * @param aId entry id
+     * @return entry text
+     */
     const TDesC& GetEntryText(
-            RPointerArray<CCaInnerEntry> aEntries, TInt aId );
+            const RPointerArray<CCaInnerEntry>& aEntries, TInt aId );
+
+private:
+	
     /*
      * Not own
      */
     CCaStorageProxy* iStorageProxy;
 
     /*
-     * Owned
+     * Recent translation file name
      */
-    HbTextResolverSymbian* iResolver;
-
+    RBuf iRecentQmFile;
     };
 
 #endif // CALOCALSCANNERPROXY_H
--- a/contentstorage/casrv/calocalizerscanner/src/calocalizerscannerproxy.cpp	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/casrv/calocalizerscanner/src/calocalizerscannerproxy.cpp	Thu May 27 13:11:12 2010 +0300
@@ -67,13 +67,8 @@
 //
 void CCaLocalizerScannerProxy::ConstructL()
     {
-    TBuf<KCaMaxAttrNameLen> filenameDsc;
-    iStorageProxy->DbPropertyL( KCaDbPropQMfile, filenameDsc );
-    iResolver = new (ELeave) HbTextResolverSymbian;
-    iResolver->Init(filenameDsc, KPathLoc);
+	iRecentQmFile.CreateL( KCaMaxAttrLenght );
     UpdateLocalNamesL();
-    delete iResolver;
-    iResolver = NULL;
     }
 
 // ---------------------------------------------------------------------------
@@ -95,10 +90,7 @@
 //
 CCaLocalizerScannerProxy::~CCaLocalizerScannerProxy()
     {
-	if (iResolver)
-		{
-	    delete iResolver;
-		} 
+	iRecentQmFile.Close();
     }
 
 // ---------------------------------------------------------------------------
@@ -126,13 +118,12 @@
     CleanupResetAndDestroyPushL( entries );
     RArray<TInt> ids;
     CleanupClosePushL( ids );
-    
+    //gets all localizations
     GetLocalizationRowsL( locals );
-     
     TInt locCount = locals.Count();
-    for( TInt idx = 0; idx < locCount; idx++ )
+    for( TInt i = 0; i < locCount; i++ )
         {
-        ids.Append( locals[idx]->GetRowId() );
+        ids.Append( locals[i]->GetRowId() );
         }    
     CCaInnerQuery* query = CCaInnerQuery::NewLC();
     query->SetIdsL( ids );
@@ -142,19 +133,14 @@
     HBufC16* localizedName;
     for( TInt i = 0; i < locCount; i++ )
         {
-        localizedName = iResolver->LoadLC( locals[i]->GetStringId() );
+        localizedName = GetLocalizedNameLC( locals[i] );
+        
         if( localizedName->Compare(
             GetEntryText( entries, locals[i]->GetRowId() ) ) )
             // translation different than text
             {
             locals[i]->SetLocalizedStringL( *localizedName );
             iStorageProxy->LocalizeEntryL( *( locals[i] ) );
-            } 
-        else if( !localizedName->Compare(KNullDesC) ) 
-            // no translation, string id as text
-            {
-            locals[i]->SetLocalizedStringL( locals[i]->GetStringId() );
-            iStorageProxy->LocalizeEntryL( *( locals[i] ) );
             }
         CleanupStack::PopAndDestroy( localizedName );
         }
@@ -166,11 +152,29 @@
 
 
 // ---------------------------------------------------------------------------
-// CCaLocalizerScannerProxy::LocalGetEntryById
+// 
+// ---------------------------------------------------------------------------
+//
+HBufC* CCaLocalizerScannerProxy::GetLocalizedNameLC(
+		const CCaLocalizationEntry* aLocEntry)
+    {
+	if( iRecentQmFile.Compare( aLocEntry->GetQmFilename() ) )
+		{
+	    HbTextResolverSymbian::Init( aLocEntry->GetQmFilename(), KPathLoc );
+        // keeping last qm filename to avoid another initialization
+	    iRecentQmFile.Close();
+	    iRecentQmFile.Create( aLocEntry->GetQmFilename().Length() );
+	    iRecentQmFile.Copy( aLocEntry->GetQmFilename() );
+		}
+	return HbTextResolverSymbian::LoadLC( aLocEntry->GetStringId() );
+    }
+
+// ---------------------------------------------------------------------------
+//  
 // ---------------------------------------------------------------------------
 //
 const TDesC& CCaLocalizerScannerProxy::GetEntryText(
-        RPointerArray<CCaInnerEntry> aEntries, TInt aId )
+        const RPointerArray<CCaInnerEntry>& aEntries, TInt aId )
     {
     TInt entriesCount = aEntries.Count();
     for( TInt i=0; i < entriesCount; i++ )
--- a/contentstorage/casrv/casrvmgr/bwins/casrvmanageru.def	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/casrv/casrvmgr/bwins/casrvmanageru.def	Thu May 27 13:11:12 2010 +0300
@@ -1,3 +1,4 @@
 EXPORTS
 	?NewL@CCaSrvManager@@SAPAV1@AAVCCaStorageProxy@@PAVCCaSrvEngUtils@@@Z @ 1 NONAME ; class CCaSrvManager * CCaSrvManager::NewL(class CCaStorageProxy &, class CCaSrvEngUtils *)
+	?LoadOperationErrorCodeL@CCaSrvManager@@QAEHXZ @ 2 NONAME ; int CCaSrvManager::LoadOperationErrorCodeL(void)
 
--- a/contentstorage/casrv/casrvmgr/eabi/casrvmanageru.def	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/casrv/casrvmgr/eabi/casrvmanageru.def	Thu May 27 13:11:12 2010 +0300
@@ -1,3 +1,4 @@
 EXPORTS
 	_ZN13CCaSrvManager4NewLER15CCaStorageProxyP14CCaSrvEngUtils @ 1 NONAME
+	_ZN13CCaSrvManager23LoadOperationErrorCodeLEv @ 2 NONAME
 
--- a/contentstorage/casrv/casrvmgr/inc/casrvmanager.h	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/casrv/casrvmgr/inc/casrvmanager.h	Thu May 27 13:11:12 2010 +0300
@@ -59,6 +59,12 @@
     static CCaSrvManager* NewLC( CCaStorageProxy& aCaStorageProxy,
             CCaSrvEngUtils* aUtils = NULL );
 
+    /**
+     * Load operation error code
+     * @return error code for load plugins operation
+     */
+    IMPORT_C TInt LoadOperationErrorCodeL();
+    
 private:
 
     /**
@@ -93,6 +99,11 @@
      * Reference to the Storage Proxy, Storage Utils.
      */
     TPluginParams* iPluginParams;
+    
+    /**
+     * Error code for load plugins operation
+     */
+    TInt iErrorCode;
     };
 
 #endif // C_MM_EXTENSION_MANAGER_H
--- a/contentstorage/casrv/casrvmgr/src/casrvmanager.cpp	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/casrv/casrvmgr/src/casrvmanager.cpp	Thu May 27 13:11:12 2010 +0300
@@ -85,6 +85,15 @@
     }
 
 // ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCaSrvManager::LoadOperationErrorCodeL()
+    {
+    return iErrorCode;
+    }
+
+// ---------------------------------------------------------------------------
 // CASpaPluginManager::LoadPluginsL
 // Load plugins implementations
 // ---------------------------------------------------------------------------
@@ -106,7 +115,12 @@
         {
         // Slice off first sub-section in the data section
         TUid current_plugin = infoArray[i]->ImplementationUid();
-        plug = CCaSrvPlugin::NewL( current_plugin, iPluginParams );
+        TRAPD(err, plug = CCaSrvPlugin::NewL( current_plugin, iPluginParams ));
+        if( KErrNone==iErrorCode )
+        	{
+        	// remember error code only if it wasn't set yet
+        	iErrorCode = err;
+        	}
         CleanupStack::PushL( plug );
         TInt32 key = current_plugin.iUid;
         iPluginMap.InsertL( key, plug );
@@ -116,4 +130,5 @@
     CleanupStack::PopAndDestroy( &infoArray );
     }
 
+
 // End of file
--- a/contentstorage/casrv/causifscanner/inc/causifscanner.h	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/casrv/causifscanner/inc/causifscanner.h	Thu May 27 13:11:12 2010 +0300
@@ -19,7 +19,6 @@
 #define CAUSIFSCANNER_H
 
 #include <e32base.h>
-#include <e32std.h>
 #include <usif/sif/sifcommon.h>
 #include <usif/scr/scr.h>
 
@@ -29,6 +28,14 @@
 
 class CCaStorageProxy;
 class CCaInnerEntry;
+class CCaInstallNotifier;
+class CCaMmcWatcher;
+class TPluginParams;
+
+namespace Usif
+    {
+    class CComponentEntry;
+    }
 
 using namespace Usif;
 
@@ -55,14 +62,8 @@
      */
     ~CCaUsifScanner();
 
-    /**
-     * Installs application.
-     * @param aFileName File name to be installed.
-     */
-    //    void InstallL( const TDesC& aFileName );
-
 public:
-    // from MCaInstallListener
+    // From MCaInstallListener.
 
     /**
      * Handle Install/Uninstall Event.
@@ -71,6 +72,9 @@
      */
     void HandleInstallNotifyL( TInt aUid );
 
+public:
+    // From MMmcWatcherCallback.
+
     /**
      * MmcChangeL is called when the MMC is removed or inserted.
      */
@@ -90,17 +94,6 @@
     void ConstructL();
 
     /**
-     * Copy constructor.
-     */
-    CCaUsifScanner( const CCaUsifScanner & );
-
-    /**
-     * Operator "=". Assigns new object.
-     *
-     */
-    CCaUsifScanner& operator =( const CCaUsifScanner & );
-
-    /**
      * Creates AppLib's entry from Usif's entry
      * @param aEntry Usif entry obtained from Sif database.
      * @param aCaEntry AppLib entry to be filled from Usif entry.
@@ -136,7 +129,7 @@
      *  @param aEntry Entry data to be checked if exists.
      *  @retval Returns array index if exists, otherwise KErrNotFound.
      */
-    TInt PackageExistL( RPointerArray<CCaInnerEntry>& aArray,
+    TInt PackageExists( RPointerArray<CCaInnerEntry>& aArray,
             const CComponentEntry* aEntry );
 
     /**
--- a/contentstorage/casrv/causifscanner/src/causifscanner.cpp	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/casrv/causifscanner/src/causifscanner.cpp	Thu May 27 13:11:12 2010 +0300
@@ -18,9 +18,6 @@
 #include <e32property.h>
 #include <f32file.h>
 #include <badesca.h>
-#include <usif/sif/sif.h>
-#include <usif/scr/scr.h>
-#include <usif/sif/sifcommon.h>
 
 #include "causifscanner.h"
 #include "cainnerentry.h"
@@ -83,12 +80,12 @@
 //
 CCaUsifScanner::~CCaUsifScanner()
     {
+    iSoftwareRegistry.Close();
     delete iMmcWatcher;
-    delete iSystemInstallNotifier;
+    iFs.Close();
+    delete iJavaInstallNotifier;
     delete iUsifUninstallNotifier;
-    delete iJavaInstallNotifier;
-    iFs.Close();
-    iSoftwareRegistry.Close();
+    delete iSystemInstallNotifier;
     }
 
 // ---------------------------------------------------------------------------
@@ -198,12 +195,12 @@
     CleanupResetAndDestroyPushL( resultUsifArray );
     GetUsifPackageEntriesL( resultUsifArray );
 
-    for( TInt idx(0); idx < resultUsifArray.Count(); idx++ )
+    for( TInt i(0); i < resultUsifArray.Count(); i++ )
         {
-        if( PackageExistL( entries, resultUsifArray[idx] ) == KErrNotFound )
+        if( PackageExists( entries, resultUsifArray[i] ) == KErrNotFound )
             {
             CCaInnerEntry *caEntry = CCaInnerEntry::NewLC();
-            CreateCaEntryFromEntryL( resultUsifArray[idx], caEntry );
+            CreateCaEntryFromEntryL( resultUsifArray[i], caEntry );
             iStorageProxy.AddL( caEntry );
             CleanupStack::PopAndDestroy( caEntry );
             }
@@ -242,7 +239,8 @@
         RPointerArray<CCaInnerEntry>& aArray )
     {
     CCaInnerQuery* allAppQuery = CCaInnerQuery::NewLC();
-    CDesC16ArrayFlat* appType = new ( ELeave ) CDesC16ArrayFlat( 1 );
+    CDesC16ArrayFlat* appType =
+            new ( ELeave ) CDesC16ArrayFlat( KGranularityOne );
     CleanupStack::PushL( appType );
     appType->AppendL( KCaTypePackage );
     allAppQuery->SetEntryTypeNames( appType );
@@ -270,8 +268,7 @@
 
     // Iterate over the matching components
     //The ownership is transferred to the calling client.
-    CComponentEntry* entry = scrView.NextComponentL();
-    while( entry )
+    while( CComponentEntry* entry = scrView.NextComponentL() )
         {
         CleanupStack::PushL( entry );
         if( iSoftwareRegistry.IsComponentPresentL( entry->ComponentId() ) )
@@ -283,7 +280,6 @@
             {
             CleanupStack::PopAndDestroy( entry );
             }
-        entry = scrView.NextComponentL();
         }
     CleanupStack::PopAndDestroy( &scrView );
     CleanupStack::PopAndDestroy( filter );
@@ -293,24 +289,24 @@
 //
 // ---------------------------------------------------------------------------
 //
-TInt CCaUsifScanner::PackageExistL( RPointerArray<CCaInnerEntry>& aArray,
+TInt CCaUsifScanner::PackageExists( RPointerArray<CCaInnerEntry>& aArray,
         const CComponentEntry* aEntry )
     {
-    for( TInt idx( 0 ); idx < aArray.Count(); idx++ )
+    TInt retVal( KErrNotFound );
+    for( TInt i( 0 ); i < aArray.Count(); i++ )
         {
         TBuf<KMaxUnits> compIdDes;
-        if( aArray[idx]->FindAttribute( KCaAttrComponentId, compIdDes ) )
+        if( aArray[i]->FindAttribute( KCaAttrComponentId, compIdDes ) )
             {
             TLex lex( compIdDes );
             TUint uint( 0 );
-            User::LeaveIfError( lex.Val( uint ) );
-            if( aEntry->ComponentId() == uint )
+            if( lex.Val( uint ) == KErrNone && aEntry->ComponentId() == uint )
                 {
-                return idx;
+                retVal = i;
                 }
             }
         }
-    return KErrNotFound;
+    return retVal;
     }
 
 // ---------------------------------------------------------------------------
@@ -321,10 +317,10 @@
         RPointerArray<CCaInnerEntry>& aCaArray, const RPointerArray<
                 CComponentEntry>& aUsifArray )
     {
-    for( TInt idx( aCaArray.Count() - 1 ); idx >= 0; idx-- )
+    for( TInt i( aCaArray.Count() - 1 ); i >= 0; i-- )
         {
         TBuf<KMaxUnits> compIdDes;
-        if( aCaArray[idx]->FindAttribute( KCaAttrComponentId, compIdDes ) )
+        if( aCaArray[i]->FindAttribute( KCaAttrComponentId, compIdDes ) )
             {
             TLex lex( compIdDes );
             TUint uint( 0 );
@@ -335,8 +331,8 @@
                 if( aUsifArray[k]->ComponentId() == uint
                         && iSoftwareRegistry.IsComponentPresentL( uint ) )
                     {
-                    delete aCaArray[idx];
-                    aCaArray.Remove( idx );
+                    delete aCaArray[i];
+                    aCaArray.Remove( i );
                     break;
                     }
                 }
--- a/contentstorage/casrv/cawidgetscanner/group/cawidgetscanner.mmp	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/casrv/cawidgetscanner/group/cawidgetscanner.mmp	Thu May 27 13:11:12 2010 +0300
@@ -52,12 +52,13 @@
 
 LIBRARY         euser.lib
 LIBRARY         efsrv.lib
-LIBRARY			bafl.lib
+LIBRARY         bafl.lib
 LIBRARY         ecom.lib
 LIBRARY         cautils.lib
 LIBRARY         camenu.lib
 LIBRARY         platformenv.lib
 LIBRARY         charconv.lib
 LIBRARY         xmlengineDOM.lib
+LIBRARY         scrclient.lib
 
 // End of file
--- a/contentstorage/casrv/cawidgetscanner/inc/cawidgetdescription.h	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/casrv/cawidgetscanner/inc/cawidgetdescription.h	Thu May 27 13:11:12 2010 +0300
@@ -148,7 +148,7 @@
      * @return CA entry id
      */
     TPtrC GetMmcId( ) const;
-
+    
     /*
      * Library getter
      * @return widget library
@@ -230,7 +230,18 @@
      * @return Service xml filename
      */
     TPtrC GetServiceXml() const;
-
+    
+    /*
+     * Set manifest file path name.
+     * @param aServiceXml Manifest file path name.
+     */
+    void SetManifestFilePathNameL(const TDesC& aManifestFilePathName);
+    
+    /*
+     * Get manifest file path name.
+     * @return Manifest file path name.
+     */
+    TPtrC GetManifestFilePathName() const;
 private:
 
     /*
@@ -321,6 +332,10 @@
      * Service fw xml file
      */
     RBuf iServiceXml;
+    /*
+     * Manifest file path name.
+     */
+    RBuf iManifestFilePathName;
     };
 
 typedef RPointerArray<CCaWidgetDescription> RWidgetArray;
--- a/contentstorage/casrv/cawidgetscanner/inc/cawidgetstoragehandler.h	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/casrv/cawidgetscanner/inc/cawidgetstoragehandler.h	Thu May 27 13:11:12 2010 +0300
@@ -24,8 +24,10 @@
 
 //  INCLUDES
 #include <e32base.h>
+#include <usif/scr/scr.h>
 #include "cawidgetdescription.h"
 #include "castorage_global.h"
+
 // CONSTANTS
 
 // FORWARD DECLARATIONS
@@ -129,6 +131,16 @@
      */
     TBool MassStorageNotInUse();
 
+    /**
+     * Adds or updates component id attribute in entry based on SCR provided data
+     * @param aPackageUid uid of the package which the widget represented by aEntry
+     * is delivered with
+     * @param aEntry widget entry being updated with component id attribute.
+     */
+    void UpdateComponentIdL( const TDesC& aManifestFilePathName, 
+        CCaInnerEntry& aEntry ) const;
+
+
 private:
     // Data
 
@@ -151,8 +163,9 @@
      * Indexes updated during last add operation. Own.
      */
     RArray<TInt> iUpdatedIndexes;
+    
 
-
+    Usif::RSoftwareComponentRegistry iSoftwareRegistry;
     };
 
 #endif      // C_WIDGETSTORAGEHANDLER_H
--- a/contentstorage/casrv/cawidgetscanner/src/cawidgetdescription.cpp	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/casrv/cawidgetscanner/src/cawidgetdescription.cpp	Thu May 27 13:11:12 2010 +0300
@@ -142,6 +142,7 @@
     iModificationTime.Close();
     iMmcId.Close();
     iServiceXml.Close();
+    iManifestFilePathName.Close();
     }
 
 // ----------------------------------------------------------------------------
@@ -551,4 +552,24 @@
     {
     return iServiceXml;
     }
+
+/*
+ * Set manifest file path name
+ * @param aManifestFilePt
+ */
+void CCaWidgetDescription::SetManifestFilePathNameL( 
+    const TDesC& aManifestFilePathName )
+    {
+    iManifestFilePathName.Close();
+    iManifestFilePathName.CreateL( aManifestFilePathName );
+    }
+
+/*
+ * Get service fw xml filename
+ * @return Service xml filename
+ */
+TPtrC CCaWidgetDescription::GetManifestFilePathName() const
+    {
+    return iManifestFilePathName;
+    }
 //  End of File
--- a/contentstorage/casrv/cawidgetscanner/src/cawidgetscannerparser.cpp	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/casrv/cawidgetscanner/src/cawidgetscannerparser.cpp	Thu May 27 13:11:12 2010 +0300
@@ -230,7 +230,7 @@
         iWidgetDescriptor = CCaWidgetDescription::NewL();
         iWidgetDescriptor->SetPackageUidL(aPackageUid);
         iWidgetDescriptor->SetVisible(ETrue);
-
+        iWidgetDescriptor->SetManifestFilePathNameL( aFilePath );
 
         SetMmcIdL( iWidgetDescriptor );
 
@@ -323,6 +323,7 @@
     SetVisibilityL( aElement, widget );
     SetIconUriL( aElement, aPackageUid, widget);
     widget->SetPackageUidL( aPackageUid );
+    widget->SetManifestFilePathNameL( aFilePath );
     SetMmcIdL( widget );
 
     TTime modificationTime;
--- a/contentstorage/casrv/cawidgetscanner/src/cawidgetstoragehandler.cpp	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/casrv/cawidgetscanner/src/cawidgetstoragehandler.cpp	Thu May 27 13:11:12 2010 +0300
@@ -17,6 +17,7 @@
 // INCLUDE FILES
 
 #include <badesca.h>
+#include <usif/scr/screntries.h>
 #include "widgetscannerutils.h"
 #include "cawidgetstoragehandler.h"
 #include "cadef.h"
@@ -25,6 +26,8 @@
 #include "castorageproxy.h"
 #include "caarraycleanup.inl"
 
+using namespace Usif;
+
 // ============================ MEMBER FUNCTIONS ===============================
 
 // -----------------------------------------------------------------------------
@@ -47,6 +50,7 @@
 //
 void CCaWidgetStorageHandler::ConstructL()
     {
+    User::LeaveIfError( iSoftwareRegistry.Connect() );
     }
 
 // -----------------------------------------------------------------------------
@@ -83,6 +87,7 @@
 //
 CCaWidgetStorageHandler::~CCaWidgetStorageHandler()
     {
+    iSoftwareRegistry.Close();
     iWidgets.ResetAndDestroy();
     iUpdatedIndexes.Close();
     }
@@ -105,6 +110,7 @@
 void CCaWidgetStorageHandler::AddL( const CCaWidgetDescription* aWidget )
     {
     CCaInnerEntry* entry = aWidget->GetEntryLC();
+    UpdateComponentIdL( aWidget->GetManifestFilePathName(), *entry );
     iStorage->AddL( entry );
     if( entry->GetFlags() & ERemovable )
         {
@@ -121,6 +127,7 @@
         TUint aEntryId )
     {
     CCaInnerEntry* entry = aWidget->GetEntryLC();
+    UpdateComponentIdL( aWidget->GetManifestFilePathName(), *entry );
     entry->SetId( aEntryId );
     if( !aWidget->IsMissing() && aWidget->IsUsed() )
         {
@@ -331,4 +338,52 @@
     return massStorageNotInUse;
     }
 
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+
+void CCaWidgetStorageHandler::UpdateComponentIdL( 
+    const TDesC& aManifestFilePathName, 
+    CCaInnerEntry& aEntry ) const
+    {
+    RArray<TComponentId> componentIds;
+    CleanupClosePushL( componentIds );
+    
+    CComponentFilter* const fileNameFilter = CComponentFilter::NewLC();
+    fileNameFilter->SetFileL( aManifestFilePathName );
+    iSoftwareRegistry.GetComponentIdsL( componentIds, fileNameFilter );
+
+    CleanupStack::PopAndDestroy( fileNameFilter );
+    
+    if ( componentIds.Count() == 1 )
+        {
+        RBuf newComponentId;
+        newComponentId.CleanupClosePushL();
+        newComponentId.CreateL( sizeof(TComponentId) + 1 );
+        newComponentId.AppendNum( componentIds[0] );
+        
+        RBuf oldComponentId;
+        oldComponentId.CleanupClosePushL();
+        oldComponentId.CreateL( KCaMaxAttrValueLen );
+        
+        const TBool componentIdAttributeFound = 
+            aEntry.FindAttribute( KCaComponentId, oldComponentId );
+              
+        if ( !componentIdAttributeFound 
+            || oldComponentId.Compare( newComponentId ) != 0 )
+            {
+            // 'add' or 'update' the component id attribute value
+            aEntry.AddAttributeL( KCaComponentId, 
+                newComponentId );
+            }
+        
+        CleanupStack::PopAndDestroy( &oldComponentId );
+        CleanupStack::PopAndDestroy( &newComponentId );
+        }
+
+    CleanupStack::PopAndDestroy( &componentIds );
+    }
+
+
 //  End of File
--- a/contentstorage/castorage/conf/castoragedb.confml	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/castorage/conf/castoragedb.confml	Thu May 27 13:11:12 2010 +0300
@@ -1,56 +1,76 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<confml:configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:confml="http://www.s60.com/xml/confml/2" xsi:schemaLocation="http://www.s60.com/xml/confml/2 http://www.s60.com/xml/confml/1#//confml2" name="Content storage database settings">
-  <confml:feature ref="CaStorageDbSetting" name="Content storage database settings">
+<confml:configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:confml="http://www.s60.com/xml/confml/2" xsi:schemaLocation="http://www.s60.com/xml/confml/2 http://www.s60.com/xml/confml/1#//confml2" xmlns:xs="http://www.w3.org/2001/XMLSchema" name="Content storage database settings">
+  <confml:feature ref="CaStorageDbSetting" name="Application Library model">
     <confml:setting ref="Collections" mapKey="Name" mapValue="Name" name="Collections" type="sequence">
-      <confml:setting ref="Name" name="Name (English)" type="string"/>
-      <confml:setting ref="GroupName" name="Collection Group Name" type="string"/>
-      <confml:setting ref="Flags" name="Flags(0 to lock collection)" type="int"/>
-      <confml:setting ref="LocName" name="Localzied Name (from TS file)" type="string"/>
-      <confml:setting ref="Icon" name="Collection Icon" type="string"/>
+      <confml:setting ref="Name" name="Name" type="string">
+        <confml:desc>Collection name. It is only identifier. Localized name should be used too.</confml:desc>
+      </confml:setting>
+      <confml:setting ref="GroupName" name="Collection Group Name" type="string">
+        <confml:desc>Group name. Identify collection where application with predefined group name should be added after installation. Should be the same as not localized name.</confml:desc>
+      </confml:setting>
+      <confml:setting ref="Flags" name="Lock collection and content" type="selection">
+      	<confml: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 locked collection</confml:desc>
+      	<confml:option name="locked" value='0'/>
+      	<confml:option name="unlocked" value='4'/>
+      </confml:setting>
+      <confml:setting ref="LocName" name="Localzied Name" type="string">
+        <confml:desc>Localized Collection name. Localized names are taken from contentstorage_*.ts file( for example contentstorage_en_GB.ts ). If text hasn't been found in ts file this one wouldn't be translated. Leave empty field if collection name sholdn't be localized.</confml:desc>
+      </confml:setting>
+      <confml:setting ref="IconFileName" name="Icon filename" type="string">
+        <confml:desc>Collection Icon filename. Optional.</confml:desc>
+      </confml:setting>
+      <confml:setting ref="IconSkinId" name="Icon skin id" type="string">
+        <confml:desc>Collection Icon skin id. Optional.</confml:desc>
+      </confml:setting>
     </confml:setting>
     <confml:setting ref="Items"  name="Items" type="sequence" >
-      <confml:setting ref="Type" name="Item type" type="string">
+      <confml:setting ref="Type" name="Entry type" type="selection">
+      	<confml:desc>Type of entry. Must.</confml:desc>
       	<confml:option name="application" value="application"/>
       	<confml:option name="url" value="url"/>
-      	<confml:option name="widget" value="widget"/>
+      	<confml:option name="hs widget" value="widget"/>
+      </confml:setting>
+      <confml:setting ref="Name" name="Entry name" type="string">
+        <confml:desc>Name. In case of applications and homescreen widgets this is only information field( Names are taken from system ).</confml:desc>
+      </confml:setting>
+      <confml:setting ref="DestinationUid" name="Uid" type="string" relevant="Type=&quot;application&quot;">
+        <confml:desc>Application uid. Uid of application in decimal format. Must for application type.</confml:desc>
+        <xs:pattern value="^[-+]?[0-9]{9}"/>
       </confml:setting>
-      <confml:setting ref="Name" name="Item name" type="string"/>
-      <confml:setting ref="Destination" name="Url/Uid/Widget Uri" type="string"/>
-      <confml:setting ref="Icon" name="Item icon (skin or file)" type="string"/>
+      <confml:setting ref="DestinationUrl" name="Url" type="string" relevant="Type=&quot;url&quot;">
+        <confml:desc>Url. Must for url type.</confml:desc>
+        <xs:pattern value="(http(|s)://([\w-]+\.)+[\w-]+(:[0-9]{1,5})?(/[\w- ./?%&amp;=]*)?|)"/>
+      </confml:setting>
+      <confml:setting ref="DestinationWidgetUri" name="Homescreen widget Uri" type="string" relevant="Type=&quot;widget&quot;">
+        <confml:desc>HS Widget Uri. Must for hs widget type.</confml:desc>
+      </confml:setting>
+      <confml:setting ref="IconFileName" name="Icon filename" type="string">
+        <confml:desc>Icon filename. Optional.</confml:desc>
+      </confml:setting>
+      <confml:setting ref="IconSkinId" name="Icon skin Id" type="string">
+        <confml:desc>Icon skin id. Optional.</confml:desc>
+      </confml:setting>
       <confml:setting ref="Col_Name" name="In collection " type="selection">
+        <confml:desc>Collection where entry will be added.</confml:desc>
         <confml:option map="CaStorageDbSetting/Collections"/>
       </confml:setting>
-    </confml:setting>    
+    </confml:setting>
   </confml:feature>
    <confml:data>
     <confml:CaStorageDbSetting>
-      <confml:Collections extensionPolicy="replace"><confml:Name>Favorites</confml:Name><confml:GroupName>Favorites</confml:GroupName><confml:Flags>4</confml:Flags><confml:LocName></confml:LocName><confml:Icon>qtg_large_applications_user</confml:Icon></confml:Collections>
-      <confml:Collections><confml:Name>Office</confml:Name><confml:GroupName>Office</confml:GroupName><confml:Flags>4</confml:Flags><confml:LocName>txt_applib_dblist_office</confml:LocName><confml:Icon>qtg_large_applications_user</confml:Icon></confml:Collections>
-      <confml:Collections><confml:Name>Multimedia</confml:Name><confml:GroupName>Multimedia</confml:GroupName><confml:Flags>4</confml:Flags><confml:LocName></confml:LocName><confml:Icon>qtg_large_applications_user</confml:Icon></confml:Collections>
-      <confml:Collections><confml:Name>Utils</confml:Name><confml:GroupName>Utils</confml:GroupName><confml:Flags>4</confml:Flags><confml:LocName></confml:LocName><confml:Icon>qtg_large_applications_user</confml:Icon></confml:Collections>
-      <confml:Collections><confml:Name>Games</confml:Name><confml:GroupName>Games</confml:GroupName><confml:Flags>4</confml:Flags><confml:LocName>txt_applib_dblist_games</confml:LocName><confml:Icon>qtg_large_applications_user</confml:Icon></confml:Collections>
-      <confml:Items extensionPolicy="append"><confml:Type>application</confml:Type><confml:Name>calendar</confml:Name><confml:Destination>268458241</confml:Destination><confml:Icon></confml:Icon><confml:Col_Name map="CaStorageDbSetting/Collections[@key='Favorites']"></confml:Col_Name></confml:Items>
-      <confml:Items><confml:Type>application</confml:Type><confml:Name>Camera</confml:Name><confml:Destination>270501242</confml:Destination><confml:Icon></confml:Icon><confml:Col_Name map="CaStorageDbSetting/Collections[@key='Favorites']"></confml:Col_Name></confml:Items>
-      <confml:Items><confml:Type>application</confml:Type><confml:Name>Contacts</confml:Name><confml:Destination>537014009</confml:Destination><confml:Icon></confml:Icon><confml:Col_Name map="CaStorageDbSetting/Collections[@key='Favorites']"></confml:Col_Name></confml:Items>
-      <confml:Items><confml:Type>application</confml:Type><confml:Name>Email</confml:Name><confml:Destination>537023930</confml:Destination><confml:Icon></confml:Icon><confml:Col_Name map="CaStorageDbSetting/Collections[@key='Favorites']"></confml:Col_Name></confml:Items>
-      <confml:Items><confml:Type>application</confml:Type><confml:Name>FM Radio</confml:Name><confml:Destination>270530934</confml:Destination><confml:Icon></confml:Icon><confml:Col_Name map="CaStorageDbSetting/Collections[@key='Favorites']"></confml:Col_Name></confml:Items>
-      <confml:Items><confml:Type>application</confml:Type><confml:Name>Internet</confml:Name><confml:Destination>222222222</confml:Destination><confml:Icon></confml:Icon><confml:Col_Name map="CaStorageDbSetting/Collections[@key='Favorites']"></confml:Col_Name></confml:Items>
-      <confml:Items><confml:Type>application</confml:Type><confml:Name>Maps</confml:Name><confml:Destination>222222222</confml:Destination><confml:Icon></confml:Icon><confml:Col_Name map="CaStorageDbSetting/Collections[@key='Favorites']"></confml:Col_Name></confml:Items>
-      <confml:Items><confml:Type>application</confml:Type><confml:Name>Messaging</confml:Name><confml:Destination>537001593</confml:Destination><confml:Icon></confml:Icon><confml:Col_Name map="CaStorageDbSetting/Collections[@key='Favorites']"></confml:Col_Name></confml:Items>
-      <confml:Items><confml:Type>application</confml:Type><confml:Name>Music</confml:Name><confml:Destination>270564450</confml:Destination><confml:Icon></confml:Icon><confml:Col_Name map="CaStorageDbSetting/Collections[@key='Favorites']"></confml:Col_Name></confml:Items>
-      <confml:Items><confml:Type>application</confml:Type><confml:Name>Photos (camera)</confml:Name><confml:Destination>536913858</confml:Destination><confml:Icon></confml:Icon><confml:Col_Name map="CaStorageDbSetting/Collections[@key='Favorites']"></confml:Col_Name></confml:Items>
-      <confml:Items><confml:Type>application</confml:Type><confml:Name>Settings</confml:Name><confml:Destination>268458220</confml:Destination><confml:Icon></confml:Icon><confml:Col_Name map="CaStorageDbSetting/Collections[@key='Favorites']"></confml:Col_Name></confml:Items>
-      <confml:Items><confml:Type>application</confml:Type><confml:Name>Videos (video camera)</confml:Name><confml:Destination>222222222</confml:Destination><confml:Icon></confml:Icon><confml:Col_Name map="CaStorageDbSetting/Collections[@key='Favorites']"></confml:Col_Name></confml:Items>
-      <confml:Items><confml:Type>application</confml:Type><confml:Name>calendar</confml:Name><confml:Destination>268458241</confml:Destination><confml:Icon></confml:Icon><confml:Col_Name map="CaStorageDbSetting/Collections[@key='Office']"></confml:Col_Name></confml:Items>
-      <confml:Items><confml:Type>application</confml:Type><confml:Name>Phonebook</confml:Name><confml:Destination>537014009</confml:Destination><confml:Icon></confml:Icon><confml:Col_Name map="CaStorageDbSetting/Collections[@key='Office']"></confml:Col_Name></confml:Items>
-      <confml:Items><confml:Type>application</confml:Type><confml:Name>Themes</confml:Name><confml:Destination>268458546</confml:Destination><confml:Icon></confml:Icon><confml:Col_Name map="CaStorageDbSetting/Collections[@key='Multimedia']"></confml:Col_Name></confml:Items>
-      <confml:Items><confml:Type>application</confml:Type><confml:Name>Paint Cursor</confml:Name><confml:Destination>537001564</confml:Destination><confml:Icon></confml:Icon><confml:Col_Name map="CaStorageDbSetting/Collections[@key='Multimedia']"></confml:Col_Name></confml:Items>
-      <confml:Items><confml:Type>application</confml:Type><confml:Name>Videoplayer</confml:Name><confml:Destination>537006590</confml:Destination><confml:Icon></confml:Icon><confml:Col_Name map="CaStorageDbSetting/Collections[@key='Multimedia']"></confml:Col_Name></confml:Items>
-      <confml:Items><confml:Type>application</confml:Type><confml:Name>ControlPanel</confml:Name><confml:Destination>537026521</confml:Destination><confml:Icon></confml:Icon><confml:Col_Name map="CaStorageDbSetting/Collections[@key='Utils']"></confml:Col_Name></confml:Items>
-      <confml:Items><confml:Type>application</confml:Type><confml:Name>Bluetooth</confml:Name><confml:Destination>268458321</confml:Destination><confml:Icon></confml:Icon><confml:Col_Name map="CaStorageDbSetting/Collections[@key='Utils']"></confml:Col_Name></confml:Items>
-      <confml:Items><confml:Type>application</confml:Type><confml:Name>SW update</confml:Name><confml:Destination>537001519</confml:Destination><confml:Icon></confml:Icon><confml:Col_Name map="CaStorageDbSetting/Collections[@key='Utils']"></confml:Col_Name></confml:Items>
-      <confml:Items><confml:Type>application</confml:Type><confml:Name>eshell</confml:Name><confml:Destination>270498535</confml:Destination><confml:Icon></confml:Icon><confml:Col_Name map="CaStorageDbSetting/Collections[@key='Utils']"></confml:Col_Name></confml:Items>
-      <confml:Items><confml:Type>application</confml:Type><confml:Name>Conn. mgr.</confml:Name><confml:Destination>270501072</confml:Destination><confml:Icon></confml:Icon><confml:Col_Name map="CaStorageDbSetting/Collections[@key='Utils']"></confml:Col_Name></confml:Items>
+      <confml:Collections extensionPolicy="replace"><confml:Name>Favorites</confml:Name><confml:GroupName>Favorites</confml:GroupName><confml:Flags>4</confml:Flags><confml:LocName></confml:LocName><confml:IconFileName>qtg_large_applications_user</confml:IconFileName></confml:Collections>
+      <confml:Items extensionPolicy="append"><confml:Type>application</confml:Type><confml:Name>calendar</confml:Name><confml:DestinationUid>268458241</confml:DestinationUid><confml:IconFileName></confml:IconFileName><confml:Col_Name map="CaStorageDbSetting/Collections[@key='Favorites']"></confml:Col_Name></confml:Items>
+      <confml:Items><confml:Type>application</confml:Type><confml:Name>Camera</confml:Name><confml:DestinationUid>270501242</confml:DestinationUid><confml:IconFileName></confml:IconFileName><confml:Col_Name map="CaStorageDbSetting/Collections[@key='Favorites']"></confml:Col_Name></confml:Items>
+      <confml:Items><confml:Type>application</confml:Type><confml:Name>Contacts</confml:Name><confml:DestinationUid>537014009</confml:DestinationUid><confml:IconFileName></confml:IconFileName><confml:Col_Name map="CaStorageDbSetting/Collections[@key='Favorites']"></confml:Col_Name></confml:Items>
+      <confml:Items><confml:Type>application</confml:Type><confml:Name>Email</confml:Name><confml:DestinationUid>537023930</confml:DestinationUid><confml:IconFileName></confml:IconFileName><confml:Col_Name map="CaStorageDbSetting/Collections[@key='Favorites']"></confml:Col_Name></confml:Items>
+      <confml:Items><confml:Type>application</confml:Type><confml:Name>FM Radio</confml:Name><confml:DestinationUid>270530934</confml:DestinationUid><confml:IconFileName></confml:IconFileName><confml:Col_Name map="CaStorageDbSetting/Collections[@key='Favorites']"></confml:Col_Name></confml:Items>
+      <confml:Items><confml:Type>application</confml:Type><confml:Name>Internet</confml:Name><confml:DestinationUid>222222222</confml:DestinationUid><confml:IconFileName></confml:IconFileName><confml:Col_Name map="CaStorageDbSetting/Collections[@key='Favorites']"></confml:Col_Name></confml:Items>
+      <confml:Items><confml:Type>application</confml:Type><confml:Name>Maps</confml:Name><confml:DestinationUid>222222222</confml:DestinationUid><confml:IconFileName></confml:IconFileName><confml:Col_Name map="CaStorageDbSetting/Collections[@key='Favorites']"></confml:Col_Name></confml:Items>
+      <confml:Items><confml:Type>application</confml:Type><confml:Name>Messaging</confml:Name><confml:DestinationUid>537001593</confml:DestinationUid><confml:IconFileName></confml:IconFileName><confml:Col_Name map="CaStorageDbSetting/Collections[@key='Favorites']"></confml:Col_Name></confml:Items>
+      <confml:Items><confml:Type>application</confml:Type><confml:Name>Music</confml:Name><confml:DestinationUid>270564450</confml:DestinationUid><confml:IconFileName></confml:IconFileName><confml:Col_Name map="CaStorageDbSetting/Collections[@key='Favorites']"></confml:Col_Name></confml:Items>
+      <confml:Items><confml:Type>application</confml:Type><confml:Name>Photos (camera)</confml:Name><confml:DestinationUid>536913858</confml:DestinationUid><confml:IconFileName></confml:IconFileName><confml:Col_Name map="CaStorageDbSetting/Collections[@key='Favorites']"></confml:Col_Name></confml:Items>
+      <confml:Items><confml:Type>application</confml:Type><confml:Name>Settings</confml:Name><confml:DestinationUid>268458220</confml:DestinationUid><confml:IconFileName></confml:IconFileName><confml:Col_Name map="CaStorageDbSetting/Collections[@key='Favorites']"></confml:Col_Name></confml:Items>
+      <confml:Items><confml:Type>application</confml:Type><confml:Name>Videos (video camera)</confml:Name><confml:DestinationUid>222222222</confml:DestinationUid><confml:IconFileName></confml:IconFileName><confml:Col_Name map="CaStorageDbSetting/Collections[@key='Favorites']"></confml:Col_Name></confml:Items>
     </confml:CaStorageDbSetting>
   </confml:data>
 
--- a/contentstorage/castorage/conf/castoragedb_templates/castoragedb_variant.sql	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/castorage/conf/castoragedb_templates/castoragedb_variant.sql	Thu May 27 13:11:12 2010 +0300
@@ -6,24 +6,28 @@
     {%- set GroupName = feat_tree.CaStorageDbSetting.Collections.GroupName._value[col] or '' -%}
     {%- set Flags = feat_tree.CaStorageDbSetting.Collections.Flags._value[col] or '' -%}
     {%- set LocName = feat_tree.CaStorageDbSetting.Collections.LocName._value[col] or ''-%}
-    {%- set Icon = feat_tree.CaStorageDbSetting.Collections.Icon._value[col] or '' -%}
-INSERT INTO COLLECTION (COLLECTION_NAME, COL_APP_GROUP_NAME, FLAGS {% if LocName -%}, COL_LOCNAME{%- endif %}{% if Icon -%}, ICON{%- endif %}) 
-VALUES ( '{{Name}}', '{{GroupName}}', {{Flags}} {% if LocName -%},  "{{LocName}}"{%- endif %}{% if Icon -%}, "{{Icon}}"{%- endif %});
+    {%- set IconFileName = feat_tree.CaStorageDbSetting.Collections.IconFileName._value[col] or '' -%}
+    {%- set IconSkinId = feat_tree.CaStorageDbSetting.Collections.IconSkinId._value[col] or '' -%}
+INSERT INTO COLLECTION (COLLECTION_NAME, COL_APP_GROUP_NAME, FLAGS {% if LocName -%}, COL_LOCNAME{%- endif %}{% if IconFileName -%}, ICON_FILENAME{%- endif %}{% if IconSkinId -%}, ICON_SKIN_ID{%- endif %}) 
+VALUES ( '{{Name}}', '{{GroupName}}', {{Flags}} {% if LocName -%},  "{{LocName}}"{%- endif %}{% if IconFileName -%}, "{{IconFileName}}"{%- endif %}{% if IconSkinId -%}, "{{IconSkinId}}"{%- endif %});
 
 {% endfor %}
 
 {% for index in range(feat_tree.CaStorageDbSetting.Items._value|length) -%}
     {%- set Type = feat_tree.CaStorageDbSetting.Items.Type._value[index] or '' -%}
     {%- set Name = feat_tree.CaStorageDbSetting.Items.Name._value[index] or '' -%}
-    {%- set Icon = feat_tree.CaStorageDbSetting.Items.Icon._value[index] or '' -%}
-    {%- set Destination = feat_tree.CaStorageDbSetting.Items.Destination._value[index] or '' -%}
+    {%- set IconFileName = feat_tree.CaStorageDbSetting.Items.IconFileName._value[index] or '' -%}
+    {%- set IconSkinId = feat_tree.CaStorageDbSetting.Items.IconSkinId._value[index] or '' -%}
+    {%- set DestinationUid = feat_tree.CaStorageDbSetting.Items.DestinationUid._value[index] or '' -%}
+    {%- set DestinationUrl = feat_tree.CaStorageDbSetting.Items.DestinationUrl._value[index] or '' -%}
+    {%- set DestinationWidgetUri = feat_tree.CaStorageDbSetting.Items.DestinationWidgetUri._value[index] or '' -%}
     {%- set Collection = feat_tree.CaStorageDbSetting.Items.Col_Name._value[index] or '' -%}
-{% if Type == "application" -%} INSERT INTO ITEM_TO_COLLECTION (ITEM_TYPE,ITEM_NAME,ITEM_DEST, COLLECTION_NAME) 
-  VALUES ("{{Type}}", '{{Name}}', {{Destination}},  '{{Collection}}' );{%- endif %}
-{% if Type == "url" -%} INSERT INTO ITEM_TO_COLLECTION (ITEM_TYPE, ITEM_NAME, ITEM_DEST, ICON, COLLECTION_NAME) 
-  VALUES ("{{Type}}", '{{Name}}', "{{Destination}}", "{{Icon}}",  '{{Collection}}' ); {%- endif %}
-{% if Type == "widget" -%} INSERT INTO WIDGET_TO_COLLECTION (ITEM_TYPE, ITEM_NAME, ICON, URI, COLLECTION_NAME ) 
-  VALUES ("{{Type}}", '{{Name}}', "{{Icon}}", "{{Destination}}", '{{Collection}}' ); {%- endif %}
+{% if Type == "application" -%} INSERT INTO ITEM_TO_COLLECTION (ITEM_TYPE, ITEM_NAME, ITEM_DEST, COLLECTION_NAME) 
+  VALUES ("{{Type}}", '{{Name}}', {{DestinationUid}},  '{{Collection}}' );{%- endif %}
+{% if Type == "url" -%} INSERT INTO ITEM_TO_COLLECTION (ITEM_TYPE, ITEM_NAME, ITEM_DEST, ICON_FILENAME, ICON_SKIN_ID, COLLECTION_NAME) 
+  VALUES ("{{Type}}", '{{Name}}', "{{DestinationUrl}}", "{{IconFileName}}", "{{IconSkinId}}",  '{{Collection}}' ); {%- endif %}
+{% if Type == "widget" -%} INSERT INTO WIDGET_TO_COLLECTION (ITEM_TYPE, ITEM_NAME, ICON_FILENAME, ICON_SKIN_ID, URI, COLLECTION_NAME ) 
+  VALUES ("{{Type}}", '{{Name}}', "{{IconFileName}}", "{{IconSkinId}}", "{{DestinationWidgetUri}}", '{{Collection}}' ); {%- endif %}
 {% endfor %}
 
 SELECT "castoragedb_variant - END" AS " ";
Binary file contentstorage/castorage/data/castorage.db has changed
--- a/contentstorage/castorage/data/castoragedb_create.sql	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/castorage/data/castoragedb_create.sql	Thu May 27 13:11:12 2010 +0300
@@ -45,7 +45,7 @@
 CREATE TABLE CA_ICON( ICON_ID INTEGER PRIMARY KEY ,
                                   IC_FILENAME TEXT,
                                   IC_SKIN_ID TEXT,
-                                  IC_APP_ID TEXT,                                  
+                                  IC_APP_ID TEXT,
                                   UNIQUE( IC_FILENAME, IC_SKIN_ID, IC_APP_ID ) );
 
 SELECT "CREATE TABLE CA_LAUNCH" AS " ";
@@ -71,6 +71,7 @@
                                   LT_TABLE_NAME TEXT ,
                                   LT_ATTRIBUTE_NAME TEXT ,
                                   LT_STRING_ID TEXT ,
+                                  LT_QMFILENAME TEXT,
                                   LT_ROW_ID INTEGER );
                                   
 SELECT "CREATE TABLE CA_DB_PROPERTIES" AS " ";
@@ -80,6 +81,15 @@
                                   DB_VALUE TEXT );       
                                    
 
+SELECT "INSERT INITIAL DATA TO CA_DB_PROPERTIES" AS " ";
+
+SELECT "------------------------------------" AS " ";
+INSERT INTO CA_DB_PROPERTIES ( DB_PROPERTY, DB_VALUE ) 
+VALUES ( 'Version', '00001' );
+INSERT INTO CA_DB_PROPERTIES ( DB_PROPERTY, DB_VALUE ) 
+VALUES ( 'Language', '' );
+INSERT INTO CA_DB_PROPERTIES ( DB_PROPERTY, DB_VALUE ) 
+VALUES ( 'QMfile', 'contentstorage_' );
 
 -- CREATE VIEW COLLECTION
 SELECT "------------------------------------" AS " ";
@@ -90,24 +100,27 @@
     "" AS "COLLECTION_NAME",
     "" AS "COL_LOCNAME",
     "" AS "COL_APP_GROUP_NAME", 
-    "" AS "ICON",
+    "" AS "ICON_FILENAME",
+    "" AS "ICON_SKIN_ID",
     "" AS "FLAGS";
     
 SELECT "  CREATE TRIGGER collection_insert" AS " ";
 CREATE TRIGGER collection_insert INSTEAD OF INSERT ON COLLECTION 
 BEGIN  
   -- INSERT ICON
-  INSERT INTO CA_ICON (IC_FILENAME) 
-  VALUES ( new.ICON);
+  INSERT INTO CA_ICON (IC_FILENAME, IC_SKIN_ID) 
+  VALUES ( new.ICON_FILENAME, new.ICON_SKIN_ID);
   -- DELETE IF ICON IS NULL OR IF IT IS DUPLICATE
   DELETE FROM CA_ICON WHERE ICON_ID = last_insert_rowid() AND 
-      (IC_FILENAME IS NULL OR (SELECT ICON_ID FROM CA_ICON WHERE IC_FILENAME = new.ICON AND ICON_ID <> last_insert_rowid()) IS NOT NULL);   
+      ( (IC_FILENAME IS NULL AND IC_SKIN_ID IS NULL) OR 
+        (SELECT ICON_ID FROM CA_ICON WHERE IC_FILENAME = new.ICON_FILENAME AND ICON_ID <> last_insert_rowid()) IS NOT NULL OR 
+        (SELECT ICON_ID FROM CA_ICON WHERE IC_SKIN_ID = new.ICON_SKIN_ID AND ICON_ID <> last_insert_rowid()) IS NOT NULL);
   -- INSERT ENTRY
     INSERT INTO CA_ENTRY (EN_TEXT, EN_ROLE, EN_TYPE_NAME, EN_FLAGS, EN_ICON_ID ) 
-    VALUES ( new.COLLECTION_NAME , 2, "collection",  new.FLAGS, (SELECT ICON_ID FROM CA_ICON WHERE IC_FILENAME = new.ICON ));
+    VALUES ( new.COLLECTION_NAME , 2, "collection",  new.FLAGS, (SELECT ICON_ID FROM CA_ICON WHERE IC_FILENAME = new.ICON_FILENAME OR IC_SKIN_ID = new.ICON_SKIN_ID ));
     -- LOCALIZATION 
-    INSERT INTO CA_LOCALIZATION_TEXT ( LT_TABLE_NAME, LT_ATTRIBUTE_NAME, LT_STRING_ID, LT_ROW_ID ) 
-    VALUES ( 'CA_ENTRY', 'EN_TEXT', new.COL_LOCNAME, ( SELECT last_insert_rowid() ) );
+    INSERT INTO CA_LOCALIZATION_TEXT ( LT_TABLE_NAME, LT_ATTRIBUTE_NAME, LT_STRING_ID, LT_QMFILENAME, LT_ROW_ID ) 
+    VALUES ( 'CA_ENTRY', 'EN_TEXT', new.COL_LOCNAME, ( SELECT DB_VALUE FROM CA_DB_PROPERTIES WHERE DB_PROPERTY = "QMfile" ), ( SELECT last_insert_rowid() ) );
     DELETE FROM CA_LOCALIZATION_TEXT WHERE LT_STRING_ID IS NULL AND LOC_TEXT_ID = last_insert_rowid() ;
     -- RELATION TO MAIN COLLECTION (ADD TO GROUP: )
   INSERT INTO CA_GROUP_ENTRY (GE_GROUP_ID, GE_ENTRY_ID, GE_POSITION) 
@@ -127,7 +140,8 @@
   AS SELECT 
     "" AS "ITEM_TYPE",
     "" AS "ITEM_NAME",
-    "" AS "ICON",
+    "" AS "ICON_FILENAME",
+    "" AS "ICON_SKIN_ID",
     "" AS "ITEM_DEST",    
     "" AS "COLLECTION_NAME";
 
@@ -140,7 +154,7 @@
   -- RELATION TO MAIN COLLECTION (ADD TO GROUP: )
   INSERT INTO CA_GROUP_ENTRY (GE_GROUP_ID, GE_ENTRY_ID, GE_POSITION) 
   VALUES ( (SELECT ENTRY_ID FROM CA_ENTRY WHERE EN_TEXT = new.COLLECTION_NAME) , 
-          (SELECT ENTRY_ID FROM CA_ENTRY WHERE EN_TEXT = new.ITEM_NAME), 
+          (SELECT ENTRY_ID FROM CA_ENTRY WHERE EN_UID = new.ITEM_DEST), 
           (SELECT IFNULL(MAX(GE_POSITION)+1, 1) FROM CA_GROUP_ENTRY WHERE GE_GROUP_ID = (SELECT ENTRY_ID FROM CA_ENTRY WHERE EN_TEXT = new.COLLECTION_NAME)) );
 END;
 
@@ -148,19 +162,21 @@
 CREATE TRIGGER item_to_collection_insert_url INSTEAD OF INSERT ON ITEM_TO_COLLECTION WHEN new.ITEM_TYPE="url"
 BEGIN
   -- INSERT ICON
-  INSERT OR IGNORE INTO CA_ICON (IC_FILENAME) 
-  VALUES ( new.ICON);
+  INSERT OR IGNORE INTO CA_ICON (IC_FILENAME, IC_SKIN_ID) 
+  VALUES ( new.ICON_FILENAME, new.ICON_SKIN_ID);
   DELETE FROM CA_ICON WHERE ICON_ID = last_insert_rowid() AND 
-      (IC_FILENAME IS NULL OR (SELECT ICON_ID FROM CA_ICON WHERE IC_FILENAME = new.ICON AND ICON_ID <> last_insert_rowid()) IS NOT NULL);  
+      ( (IC_FILENAME IS NULL AND IC_SKIN_ID IS NULL) OR 
+        (SELECT ICON_ID FROM CA_ICON WHERE IC_FILENAME = new.ICON_FILENAME AND ICON_ID <> last_insert_rowid()) IS NOT NULL OR 
+        (SELECT ICON_ID FROM CA_ICON WHERE IC_SKIN_ID = new.ICON_SKIN_ID AND ICON_ID <> last_insert_rowid()) IS NOT NULL);  
   -- INSERT ENTRY
   INSERT OR IGNORE INTO CA_ENTRY (EN_TEXT, EN_ROLE, EN_TYPE_NAME, EN_ICON_ID ) 
-  VALUES ( new.ITEM_NAME, 1, "url", (SELECT ICON_ID FROM CA_ICON WHERE IC_FILENAME = new.ICON ));
+  VALUES ( new.ITEM_NAME, 1, "url", (SELECT ICON_ID FROM CA_ICON WHERE IC_FILENAME = new.ICON_FILENAME OR IC_SKIN_ID = new.ICON_SKIN_ID ));
   INSERT OR IGNORE INTO CA_ATTRIBUTE (AT_ENTRY_ID, AT_NAME, AT_VALUE )  
   VALUES ( ( SELECT last_insert_rowid() ) ,"url",new.ITEM_DEST);
   -- RELATION TO MAIN COLLECTION (ADD TO GROUP: )
   INSERT INTO CA_GROUP_ENTRY (GE_GROUP_ID, GE_ENTRY_ID, GE_POSITION) 
   VALUES ( (SELECT ENTRY_ID FROM CA_ENTRY WHERE EN_TEXT = new.COLLECTION_NAME) , 
-          (SELECT ENTRY_ID FROM CA_ENTRY WHERE EN_TEXT = new.ITEM_NAME), 
+          (SELECT ENTRY_ID FROM CA_ENTRY WHERE (EN_TEXT = new.ITEM_NAME AND EN_TYPE_NAME = new.ITEM_TYPE )),
           (SELECT IFNULL(MAX(GE_POSITION)+1, 1) FROM CA_GROUP_ENTRY WHERE GE_GROUP_ID = (SELECT ENTRY_ID FROM CA_ENTRY WHERE EN_TEXT = new.COLLECTION_NAME)) );
 END;
 
@@ -173,7 +189,8 @@
   AS SELECT 
     "" AS "ITEM_TYPE",
     "" AS "ITEM_NAME",
-    "" AS "ICON",
+    "" AS "ICON_FILENAME",
+    "" AS "ICON_SKIN_ID",
     "" AS "PACKAGE_UID",
     "" AS "LIBRARY",
     "" AS "LONG_NAME",
@@ -184,13 +201,15 @@
 CREATE TRIGGER item_to_collection_insert_widget INSTEAD OF INSERT ON WIDGET_TO_COLLECTION WHEN new.ITEM_TYPE="widget"
 BEGIN
   -- INSERT ICON
-  INSERT OR IGNORE INTO CA_ICON (IC_FILENAME) 
-  VALUES ( new.ICON);
+  INSERT OR IGNORE INTO CA_ICON (IC_FILENAME, IC_SKIN_ID) 
+  VALUES ( new.ICON_FILENAME, new.ICON_SKIN_ID);
   DELETE FROM CA_ICON WHERE ICON_ID = last_insert_rowid() AND 
-      (IC_FILENAME IS NULL OR (SELECT ICON_ID FROM CA_ICON WHERE IC_FILENAME = new.ICON AND ICON_ID <> last_insert_rowid()) IS NOT NULL);  
+      ( (IC_FILENAME IS NULL AND IC_SKIN_ID IS NULL) OR 
+        (SELECT ICON_ID FROM CA_ICON WHERE IC_FILENAME = new.ICON_FILENAME AND ICON_ID <> last_insert_rowid()) IS NOT NULL OR 
+        (SELECT ICON_ID FROM CA_ICON WHERE IC_SKIN_ID = new.ICON_SKIN_ID AND ICON_ID <> last_insert_rowid()) IS NOT NULL);
   -- INSERT ENTRY
   INSERT OR IGNORE INTO CA_ENTRY (EN_TEXT, EN_ROLE, EN_TYPE_NAME, EN_ICON_ID ) 
-  VALUES ( new.ITEM_NAME, 1, "widget", (SELECT ICON_ID FROM CA_ICON WHERE IC_FILENAME = new.ICON ));
+  VALUES ( new.ITEM_NAME, 1, "widget", (SELECT ICON_ID FROM CA_ICON WHERE IC_FILENAME = new.ICON_FILENAME OR IC_SKIN_ID = new.ICON_SKIN_ID ));
   -- INSERT ATTRIBUTES
   INSERT OR IGNORE INTO CA_ATTRIBUTE (AT_ENTRY_ID, AT_NAME, AT_VALUE )  
   VALUES ( ( SELECT ENTRY_ID FROM CA_ENTRY WHERE EN_TEXT = new.ITEM_NAME ) ,"packageuid",new.PACKAGE_UID);
@@ -203,19 +222,11 @@
   -- RELATION TO MAIN COLLECTION (ADD TO GROUP: )
   INSERT INTO CA_GROUP_ENTRY (GE_GROUP_ID, GE_ENTRY_ID, GE_POSITION) 
   VALUES ( (SELECT ENTRY_ID FROM CA_ENTRY WHERE EN_TEXT = new.COLLECTION_NAME) , 
-          (SELECT ENTRY_ID FROM CA_ENTRY WHERE EN_TEXT = new.ITEM_NAME), 
+          (SELECT ENTRY_ID FROM CA_ENTRY WHERE (EN_TEXT = new.ITEM_NAME AND EN_TYPE_NAME = new.ITEM_TYPE)), 
           (SELECT IFNULL(MAX(GE_POSITION)+1, 1) FROM CA_GROUP_ENTRY WHERE GE_GROUP_ID = (SELECT ENTRY_ID FROM CA_ENTRY WHERE EN_TEXT = new.COLLECTION_NAME)) );
 END;
 
-SELECT "INSERT INITIAL DATA TO CA_DB_PROPERTIES" AS " ";
 
-SELECT "------------------------------------" AS " ";
-INSERT INTO CA_DB_PROPERTIES ( DB_PROPERTY, DB_VALUE ) 
-VALUES ( 'Version', '00001' );
-INSERT INTO CA_DB_PROPERTIES ( DB_PROPERTY, DB_VALUE ) 
-VALUES ( 'Language', '' );
-INSERT INTO CA_DB_PROPERTIES ( DB_PROPERTY, DB_VALUE ) 
-VALUES ( 'QMfile', 'contentstorage_' );
 
 -- insert neccessary items
 SELECT "INSERT menucollections ENTRY" AS " ";
@@ -236,8 +247,8 @@
 INSERT OR IGNORE INTO CA_ATTRIBUTE (AT_ENTRY_ID, AT_NAME, AT_VALUE )  
 VALUES ( last_insert_rowid(), "appgroup_name", " Downloaded" );
 
-INSERT INTO CA_LOCALIZATION_TEXT ( LT_TABLE_NAME, LT_ATTRIBUTE_NAME, LT_STRING_ID, LT_ROW_ID ) 
-VALUES ( 'CA_ENTRY', 'EN_TEXT', "txt_applib_dblist_downloaded", ( SELECT last_insert_rowid() ) );
+INSERT INTO CA_LOCALIZATION_TEXT ( LT_TABLE_NAME, LT_ATTRIBUTE_NAME, LT_STRING_ID, LT_QMFILENAME, LT_ROW_ID ) 
+VALUES ( 'CA_ENTRY', 'EN_TEXT', "txt_applib_dblist_downloaded",( SELECT DB_VALUE FROM CA_DB_PROPERTIES WHERE DB_PROPERTY = "QMfile" ), ( SELECT last_insert_rowid() ) );
 
 INSERT INTO CA_GROUP_ENTRY (GE_GROUP_ID, GE_ENTRY_ID, GE_POSITION) 
 VALUES ( (SELECT ENTRY_ID FROM CA_ENTRY WHERE EN_TYPE_NAME = "menucollections") , 
--- a/contentstorage/castorage/data/castoragedb_variant.sql	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/castorage/data/castoragedb_variant.sql	Thu May 27 13:11:12 2010 +0300
@@ -4,33 +4,32 @@
 
 -- insert additional items
 
-INSERT INTO COLLECTION (COLLECTION_NAME, COL_LOCNAME, COL_APP_GROUP_NAME ,ICON, FLAGS) VALUES ( 'Office',  "txt_applib_dblist_office", 'Office', "qtg_large_applications_user", 4 );
-  INSERT INTO ITEM_TO_COLLECTION (ITEM_TYPE,ITEM_NAME,ITEM_DEST, COLLECTION_NAME) 
-  VALUES ("application", 'calendar', 268458241,  'Office' );
-  INSERT INTO ITEM_TO_COLLECTION (ITEM_TYPE,ITEM_NAME,ITEM_DEST, COLLECTION_NAME) 
-  VALUES ("application", 'Phonebook', 537014009,  'Office' );
-
-INSERT INTO COLLECTION (COLLECTION_NAME, COL_APP_GROUP_NAME ,ICON, FLAGS) VALUES ( 'Multimedia', 'Multimedia' , "qtg_large_applications_user", 4 );  
-  INSERT INTO ITEM_TO_COLLECTION (ITEM_TYPE,ITEM_NAME,ITEM_DEST, COLLECTION_NAME) 
-  VALUES ("application", 'Themes', 268458546,  'Multimedia' );
-  INSERT INTO ITEM_TO_COLLECTION (ITEM_TYPE,ITEM_NAME,ITEM_DEST, COLLECTION_NAME) 
-  VALUES ("application", 'Paint Cursor', 537001564,  'Multimedia' ); 
-  INSERT INTO ITEM_TO_COLLECTION (ITEM_TYPE,ITEM_NAME,ITEM_DEST, COLLECTION_NAME) 
-  VALUES ("application", 'Videoplayer', 537006590,  'Multimedia' );
+INSERT INTO COLLECTION (COLLECTION_NAME, COL_APP_GROUP_NAME, ICON_FILENAME, FLAGS) VALUES ( 'Favorites', 'Favorites', "qtg_large_applications_user", 4 );
+  INSERT INTO ITEM_TO_COLLECTION (ITEM_TYPE, ITEM_NAME, ITEM_DEST, COLLECTION_NAME) 
+  VALUES ("application", 'calendar', 268458241,  'Favorites' );
+  INSERT INTO ITEM_TO_COLLECTION (ITEM_TYPE, ITEM_NAME, ITEM_DEST, COLLECTION_NAME) 
+  VALUES ("application", 'Camera', 270501242,  'Favorites' );
+  INSERT INTO ITEM_TO_COLLECTION (ITEM_TYPE, ITEM_NAME, ITEM_DEST, COLLECTION_NAME) 
+  VALUES ("application", 'Contacts', 537014009,  'Favorites' );
+  INSERT INTO ITEM_TO_COLLECTION (ITEM_TYPE, ITEM_NAME, ITEM_DEST, COLLECTION_NAME) 
+  VALUES ("application", 'Email', 537023930,  'Favorites' );
+  INSERT INTO ITEM_TO_COLLECTION (ITEM_TYPE, ITEM_NAME, ITEM_DEST, COLLECTION_NAME) 
+  VALUES ("application", 'FM Radio', 270530934,  'Favorites' );
+  INSERT INTO ITEM_TO_COLLECTION (ITEM_TYPE, ITEM_NAME, ITEM_DEST, COLLECTION_NAME) 
+  VALUES ("application", 'Internet', 222222222,  'Favorites' );
+  INSERT INTO ITEM_TO_COLLECTION (ITEM_TYPE, ITEM_NAME, ITEM_DEST, COLLECTION_NAME) 
+  VALUES ("application", 'Maps', 222222222,  'Favorites' );
+  INSERT INTO ITEM_TO_COLLECTION (ITEM_TYPE, ITEM_NAME, ITEM_DEST, COLLECTION_NAME) 
+  VALUES ("application", 'Messaging', 537001593,  'Favorites' );
+  INSERT INTO ITEM_TO_COLLECTION (ITEM_TYPE, ITEM_NAME, ITEM_DEST, COLLECTION_NAME) 
+  VALUES ("application", 'Music', 270564450,  'Favorites' );
+  INSERT INTO ITEM_TO_COLLECTION (ITEM_TYPE, ITEM_NAME, ITEM_DEST, COLLECTION_NAME) 
+  VALUES ("application", 'Photos (camera)', 536913858,  'Favorites' );
+  INSERT INTO ITEM_TO_COLLECTION (ITEM_TYPE, ITEM_NAME, ITEM_DEST, COLLECTION_NAME) 
+  VALUES ("application", 'Settings', 268458220,  'Favorites' );
+  INSERT INTO ITEM_TO_COLLECTION (ITEM_TYPE, ITEM_NAME, ITEM_DEST, COLLECTION_NAME) 
+  VALUES ("application", 'Videos (video camera)', 222222222,  'Favorites' );
 
-INSERT INTO COLLECTION (COLLECTION_NAME, COL_APP_GROUP_NAME ,ICON, FLAGS) VALUES ( 'Utils', 'Utils', "qtg_large_applications_user", 4 );  
-  INSERT INTO ITEM_TO_COLLECTION (ITEM_TYPE,ITEM_NAME,ITEM_DEST, COLLECTION_NAME) 
-  VALUES ("application", 'ControlPanel', 537026521,  'Utils' );
-  INSERT INTO ITEM_TO_COLLECTION (ITEM_TYPE,ITEM_NAME,ITEM_DEST, COLLECTION_NAME) 
-  VALUES ("application", 'Bluetooth', 268458321,  'Utils' );
-  INSERT INTO ITEM_TO_COLLECTION (ITEM_TYPE,ITEM_NAME,ITEM_DEST, COLLECTION_NAME) 
-  VALUES ("application", 'SW update', 537001519,  'Utils' );
-  INSERT INTO ITEM_TO_COLLECTION (ITEM_TYPE,ITEM_NAME,ITEM_DEST, COLLECTION_NAME) 
-  VALUES ("application", 'eshell', 270498535,  'Utils' );
-  INSERT INTO ITEM_TO_COLLECTION (ITEM_TYPE,ITEM_NAME,ITEM_DEST, COLLECTION_NAME) 
-  VALUES ("application", 'Conn. mgr.', 270501072,  'Utils' );
-  
-INSERT INTO COLLECTION (COLLECTION_NAME, COL_LOCNAME, COL_APP_GROUP_NAME ,ICON) VALUES ( 'Games', "txt_applib_dblist_games", 'Games',"qtg_large_applications_user", 4 );
 
 SELECT "castoragedb_variant - END" AS " ";
 SELECT "------------------------------------" AS " ";
--- a/contentstorage/castorage/data/castoragedb_variant_test.bat	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/castorage/data/castoragedb_variant_test.bat	Thu May 27 13:11:12 2010 +0300
@@ -18,4 +18,5 @@
 del castorage.db
 sqlite3 castorage.db ".read castoragedb_create.sql"
 sqlite3 castorage.db ".genfkey --exec"
+sqlite3 castorage.db ".read castoragedb_variant.sql"
 sqlite3 castorage.db ".read castoragedb_variant_test.sql"
--- a/contentstorage/castorage/data/castoragedb_variant_test.sql	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/castorage/data/castoragedb_variant_test.sql	Thu May 27 13:11:12 2010 +0300
@@ -1,21 +1,22 @@
 -- ONLY IF YOU SURE THAT WANT DEFAULT CONTENT
-.read castoragedb_variant.sql
+
 
-SELECT "castoragedb_variant test - BEGIN" AS " ";
+SELECT "castoragedb_variant_test - BEGIN" AS " ";
 
 
 -- insert collection
-INSERT INTO COLLECTION (COLLECTION_NAME, ICON) VALUES ( 'Test Apps', "qtg_large_applications_user" );
+INSERT INTO COLLECTION (COLLECTION_NAME, COL_APP_GROUP_NAME, ICON_FILENAME, FLAGS) VALUES ( 'Test Apps', 'Test Apps', "qtg_large_applications_user", 4 );
 
 -- insert example urls
-  INSERT INTO ITEM_TO_COLLECTION (ITEM_TYPE, ITEM_NAME, ICON, ITEM_DEST, COLLECTION_NAME) 
+  INSERT INTO ITEM_TO_COLLECTION (ITEM_TYPE, ITEM_NAME, ICON_FILENAME, ITEM_DEST, COLLECTION_NAME) 
   VALUES ("url", 'Facebook', 'c:\data\Images\kqticaicons\facebook.png', "http://www.facebook.com/", 'Test Apps' );
-  INSERT INTO ITEM_TO_COLLECTION (ITEM_TYPE, ITEM_NAME, ICON,ITEM_DEST, COLLECTION_NAME) 
-  VALUES ("url", 'Google', 'c:\data\Images\kqticaicons\google.png', "http://www.google.com/", 'Test Apps' );
+  INSERT INTO ITEM_TO_COLLECTION (ITEM_TYPE, ITEM_NAME, ICON_FILENAME, ITEM_DEST, COLLECTION_NAME, ICON_SKIN_ID) 
+  VALUES ("url", 'Google', 'c:\data\Images\kqticaicons\google.png', "http://www.google.com/", 'Test Apps', '4' );
 
 -- insert example widgets
-  INSERT INTO WIDGET_TO_COLLECTION (ITEM_TYPE, ITEM_NAME,ICON, PACKAGE_UID, LIBRARY, LONG_NAME, URI, COLLECTION_NAME) 
-  VALUES ("widget", 'Clock', 'Z:\private\20022F35\import\widgetregistry\20022F6C\tclock.png', '20022f6c', 'Z:\private\20022F35\import\widgetregistry\20022F6C\hsclockwidgetplugin', 'Clock', 'hsclockwidgetplugin', 'Test Apps' ); 
+  INSERT INTO WIDGET_TO_COLLECTION (ITEM_TYPE, ITEM_NAME, ICON_FILENAME, ICON_SKIN_ID, PACKAGE_UID, LIBRARY, LONG_NAME, URI, COLLECTION_NAME) 
+  VALUES ("widget", 'Clock', 'Z:\private\20022F35\import\widgetregistry\20022F6C\tclock.png', '4' , '20022f6c', 'Z:\private\20022F35\import\widgetregistry\20022F6C\hsclockwidgetplugin', 'Clock', 'hsclockwidgetplugin', 'Test Apps' ); 
 
 
-SELECT "castoragedb_variant test - END" AS " ";
\ No newline at end of file
+SELECT "castoragedb_variant_test - END" AS " ";
+
--- a/contentstorage/castorage/inc/casqlcommands.h	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/castorage/inc/casqlcommands.h	Thu May 27 13:11:12 2010 +0300
@@ -60,6 +60,9 @@
 (AT_ENTRY_ID, AT_NAME,AT_VALUE) \
 VALUES ( :AT_ENTRY_ID, :AT_NAME, :AT_VALUE )" );
 
+_LIT( KSQLAddLocalization, "INSERT INTO CA_LOCALIZATION_TEXT \
+(LT_TABLE_NAME, LT_ATTRIBUTE_NAME, LT_STRING_ID, LT_QMFILENAME, LT_ROW_ID) \
+VALUES ( :LT_TABLE, :LT_ATTRIBUTE, :LT_STRING, :LT_QMFILENAME, :LT_ROW_ID )" );
 
 //update Data
 _LIT( KSQLUpdateEntry, "UPDATE CA_ENTRY SET " );
@@ -107,6 +110,12 @@
 _LIT( KSQLUpdateProperty, "UPDATE CA_DB_PROPERTIES \
 SET DB_VALUE = :DB_VALUE WHERE DB_PROPERTY = :DB_PROPERTY ");
 
+// Update localization table entry
+
+_LIT( KSQLUpdateLocalization, "UPDATE CA_LOCALIZATION_TEXT SET \
+ LT_STRING_ID = :LT_STRING , LT_QMFILENAME = :LT_QMFILENAME \
+ WHERE LT_TABLE_NAME = :LT_TABLE AND LT_ATTRIBUTE_NAME = :LT_ATTRIBUTE \
+ AND LT_ROW_ID = :LT_ROW_ID" );
 
 //Delete Data
 _LIT( KSQLDeleteLaunch, "DELETE FROM CA_LAUNCH \
@@ -128,13 +137,17 @@
 
 //Get Data
 
+_LIT( KSQLGetLocalizations, "SELECT LOC_TEXT_ID, LT_TABLE_NAME, \
+LT_ATTRIBUTE_NAME, LT_STRING_ID, LT_QMFILENAME, LT_ROW_ID \
+FROM CA_LOCALIZATION_TEXT ORDER BY LT_QMFILENAME" );
+
+_LIT( KSQLGetLocalization, "SELECT LOC_TEXT_ID, LT_TABLE_NAME, \
+LT_ATTRIBUTE_NAME, LT_STRING_ID, LT_QMFILENAME, LT_ROW_ID \
+FROM CA_LOCALIZATION_TEXT WHERE LT_TABLE_NAME = :LT_TABLE \
+AND LT_ATTRIBUTE_NAME = :LT_ATTRIBUTE AND LT_ROW_ID = :LT_ROW_ID" );
+
 //Get all entries from group by Parent_Id
 // %S string of where for flags;
-
-_LIT( KSQLGetLocalizations, "SELECT LOC_TEXT_ID, LT_TABLE_NAME, \
-LT_ATTRIBUTE_NAME, LT_STRING_ID, LT_ROW_ID \
-FROM CA_LOCALIZATION_TEXT" );
-
 _LIT( KSQLGetListByEntryIds, "SELECT ENTRY_ID, EN_TEXT, EN_DESCRIPTION, \
 EN_ROLE, EN_TYPE_NAME, EN_ICON_ID, EN_CREATION_TIME, EN_UID, EN_FLAGS, \
 IC_FILENAME,IC_SKIN_ID,IC_APP_ID \
@@ -312,6 +325,7 @@
 _LIT( KSQLLocTable, ":LT_TABLE" );
 _LIT( KSQLLocAttribute, ":LT_ATTRIBUTE" );
 _LIT( KSQLLocString, ":LT_STRING" );
+_LIT( KSQLLocQmFilename, ":LT_QMFILENAME" );
 _LIT( KSQLLocRowId, ":LT_ROW_ID" );
 
 // columns
@@ -348,6 +362,8 @@
 _LIT( KColumnLocTableName, "LT_TABLE_NAME" );
 _LIT( KColumnLocAttrName,    "LT_ATTRIBUTE_NAME" );
 _LIT( KColumnLocStringId,   "LT_STRING_ID" );
+_LIT( KColumnQmFile,     "LT_QMFILENAME" );
+
 _LIT( KColumnLocRowId,   "LT_ROW_ID" );
 
 _LIT( KColumnDbProperty, "DB_PROPERTY" );
--- a/contentstorage/castorage/inc/casqlitestorage.h	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/castorage/inc/casqlitestorage.h	Thu May 27 13:11:12 2010 +0300
@@ -75,6 +75,29 @@
     void LocalizeEntryL( CCaLocalizationEntry& aLocalization );
 
     /**
+     * Adds or updates localization row in the localization table
+     *
+     * @param aLocalization localization information about entry.
+     */
+    void AddLocalizationL( const CCaLocalizationEntry& aLocalization );
+    
+    /**
+     * Checks if entry already exists in localization table
+     *
+     * @param aLocalization localization information about entry.
+     */
+    TBool LocalizationEntryPresentL(const CCaLocalizationEntry& aLocalization);
+
+    /**
+     * Updates localization row in the localization table
+     *
+     * @param aLocalization localization information about entry.
+     * @param aStatement SQL statement
+     */
+    void ExecuteLocalizationStatementL(const CCaLocalizationEntry& aLocalization, 
+            const TDesC& aStatement);
+   
+    /**
      * Fetches data from database.
      *
      * @param aMap Filtering and sorting criteria
--- a/contentstorage/castorage/inc/casqlquery.h	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/castorage/inc/casqlquery.h	Thu May 27 13:11:12 2010 +0300
@@ -141,6 +141,22 @@
     void BindValuesForAddL( const CCaInnerEntry* aEntry );
 
     /**
+     * Binds values for an get localization entry
+     *
+     * @param aLocalization The entry from which to get data for bindings.
+     */
+    void BindValuesForGetLocalizationEntryL(
+        const CCaLocalizationEntry& aLocalization);
+    
+    /**
+     * Binds values for an add and update localization entry
+     *
+     * @param aLocalization The entry from which to get data for bindings.
+     */
+    void BindValuesForLocalizationEntryL(
+            const CCaLocalizationEntry& aLocalization);
+    
+    /**
      * Binds values for an add operation.
      *
      * @param aQuery The query from which to get data for bindings.
@@ -271,6 +287,13 @@
     /**
      * Executes a statement.
      *
+     * @return ETrue if any data was found
+     */
+    TBool ExecuteEntryPresentL( );
+    
+    /**
+     * Executes a statement.
+     *
      * @param[out] aId id of single data the query statement queries for.
      * @return Entry count.
      */
--- a/contentstorage/castorage/inc/casqlquerycreator.h	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/castorage/inc/casqlquerycreator.h	Thu May 27 13:11:12 2010 +0300
@@ -24,6 +24,7 @@
 
 // CLASS DECLARATION
 
+class CCaLocalizationEntry; 
 class CCaSqlQuery;
 class CCaInnerEntry;
 class CCaInnerQuery;
@@ -144,18 +145,13 @@
             CCaSqlQuery* aQuery, const TDesC& aSqlQueryText );
     
     /**
-     * Creates an sql query to get a list of of localizations entries.
+     * Creates an sql query to add, update or get data from localization table.
      *
-     * @param aQuery The result query.
+     * @param aSqlQuery The result query.
+     * @param aStatement statement
      */
-    static void CreateGetLocalizationsQueryL( CCaSqlQuery* aQuery );
-
-    /**
-     * Creates an sql query to update db entry with localization.
-     *
-     * @param aQuery The result query.
-     */
-    static void CreateLocalizeEntryQueryL( CCaSqlQuery* aQuery );
+    static void CreateLocalizationTableQueryL(CCaSqlQuery* aSqlQuery,
+            const TDesC& aStatement);
     
     /**
      * Creates an sql query to custom sort order.
--- a/contentstorage/castorage/inc/castorage.h	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/castorage/inc/castorage.h	Thu May 27 13:11:12 2010 +0300
@@ -40,6 +40,13 @@
     virtual void LocalizeEntryL( CCaLocalizationEntry& aLocalization ) = 0;
 
     /**
+     * Adds localization row to the localization table
+     *
+     * @param aLocalization localization information about entry.
+     */
+    virtual void AddLocalizationL( const CCaLocalizationEntry& aLocalization ) = 0;
+    
+    /**
      * Fetches data from database
      *
      * @param aResultContainer container for localizations information.
--- a/contentstorage/castorage/src/casqlitestorage.cpp	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/castorage/src/casqlitestorage.cpp	Thu May 27 13:11:12 2010 +0300
@@ -207,23 +207,81 @@
         }
     }
 
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
 void CCaSqLiteStorage::LocalizeEntryL( CCaLocalizationEntry& aLocalization )
     {
     CCaSqlQuery* sqlLocalizeEntryQuery = CCaSqlQuery::NewLC( iSqlDb );
-    CaSqlQueryCreator::CreateLocalizeEntryQueryL( sqlLocalizeEntryQuery );
+    CaSqlQueryCreator::CreateLocalizationTableQueryL(sqlLocalizeEntryQuery,
+            KSQLLocalizeEntry);
     sqlLocalizeEntryQuery->PrepareL();
     sqlLocalizeEntryQuery->BindValuesForLocalizeL( aLocalization );
     sqlLocalizeEntryQuery->ExecuteL( );
     CleanupStack::PopAndDestroy( sqlLocalizeEntryQuery );
     }
 
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CCaSqLiteStorage::AddLocalizationL(
+        const CCaLocalizationEntry& aLocalization)
+    {
+    if (LocalizationEntryPresentL(aLocalization))
+        {
+        ExecuteLocalizationStatementL(aLocalization, KSQLUpdateLocalization);
+        }
+    else
+        {
+        ExecuteLocalizationStatementL(aLocalization, KSQLAddLocalization);
+        }
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TBool CCaSqLiteStorage::LocalizationEntryPresentL(
+        const CCaLocalizationEntry& aLocalization)
+    {
+    TBool result(EFalse);
+    CCaSqlQuery* sqlQuery = CCaSqlQuery::NewLC( iSqlDb );
+    CaSqlQueryCreator::CreateLocalizationTableQueryL(sqlQuery,
+            KSQLGetLocalization);
+    sqlQuery->PrepareL();
+    sqlQuery->BindValuesForGetLocalizationEntryL( aLocalization );
+    result = sqlQuery->ExecuteEntryPresentL( );
+    CleanupStack::PopAndDestroy( sqlQuery );
+    return result;
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CCaSqLiteStorage::ExecuteLocalizationStatementL(
+        const CCaLocalizationEntry& aLocalization, const TDesC& aStatement)
+    {
+    CCaSqlQuery* sqlQuery = CCaSqlQuery::NewLC( iSqlDb );
+    CaSqlQueryCreator::CreateLocalizationTableQueryL(sqlQuery,aStatement );
+    sqlQuery->PrepareL();
+    sqlQuery->BindValuesForLocalizationEntryL( aLocalization );
+    sqlQuery->ExecuteL( );
+    CleanupStack::PopAndDestroy( sqlQuery );
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
 void CCaSqLiteStorage::GetLocalizationsL(
         RPointerArray<CCaLocalizationEntry>& aResultContainer )
     {
     CCaSqlQuery* sqlGetLocalizationsQuery = CCaSqlQuery::NewLC( iSqlDb );
-    CaSqlQueryCreator::CreateGetLocalizationsQueryL(
-            sqlGetLocalizationsQuery );
-
+    CaSqlQueryCreator::CreateLocalizationTableQueryL(
+            sqlGetLocalizationsQuery, KSQLGetLocalizations );
     sqlGetLocalizationsQuery->PrepareL();
     sqlGetLocalizationsQuery->ExecuteLocalizationsL( aResultContainer );
     CleanupStack::PopAndDestroy( sqlGetLocalizationsQuery );
@@ -245,7 +303,6 @@
     sqlGetEntriesIdsQuery->ExecuteL( aResultIdArray,
             CCaSqlQuery::EEntryTable );
     CleanupStack::PopAndDestroy( sqlGetEntriesIdsQuery );
-
     }
 
 // ---------------------------------------------------------------------------
--- a/contentstorage/castorage/src/casqlquery.cpp	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/castorage/src/casqlquery.cpp	Thu May 27 13:11:12 2010 +0300
@@ -413,6 +413,41 @@
 //
 // ---------------------------------------------------------------------------
 //
+void CCaSqlQuery::BindValuesForGetLocalizationEntryL(
+        const CCaLocalizationEntry& aLocalization)
+    {
+    BindIntL( iStatement.ParameterIndex( KSQLLocRowId ),
+            aLocalization.GetRowId() );
+    BindTextL( iStatement.ParameterIndex( KSQLLocTable ),
+            aLocalization.GetTableName() );
+    BindTextL( iStatement.ParameterIndex( KSQLLocAttribute ),
+            aLocalization.GetAttributeName() );
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CCaSqlQuery::BindValuesForLocalizationEntryL(
+        const CCaLocalizationEntry& aLocalization)
+    {
+    BindIntL( iStatement.ParameterIndex( KSQLLocRowId ),
+            aLocalization.GetRowId() );
+    BindTextL( iStatement.ParameterIndex( KSQLLocTable ),
+            aLocalization.GetTableName() );
+    BindTextL( iStatement.ParameterIndex( KSQLLocAttribute ),
+            aLocalization.GetAttributeName() );
+    BindTextL( iStatement.ParameterIndex( KSQLLocQmFilename ),
+            aLocalization.GetQmFilename() );
+    BindTextL( iStatement.ParameterIndex( KSQLLocString ),
+            aLocalization.GetStringId() );
+    }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
 void CCaSqlQuery::BindValuesForGetEntriesL( const CCaInnerQuery* aQuery )
     {
     if( aQuery->GetIds().Count() > 0 )
@@ -609,6 +644,19 @@
 //
 // ---------------------------------------------------------------------------
 //
+TBool CCaSqlQuery::ExecuteEntryPresentL( )
+    {
+    if( iStatement.Next() == KSqlAtRow )
+        {
+        return ETrue;
+        }
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
 TInt CCaSqlQuery::ExecuteL( TInt& aId )
     {
     if( iStatement.Next() == KSqlAtRow )
@@ -743,6 +791,13 @@
                         tableName )
                         );
         
+        TPtrC qmFilename;
+        User::LeaveIfError(
+                iStatement.ColumnText(
+                        ColumnIndexL( iStatement, KColumnQmFile ),
+                        qmFilename )
+                        );
+        
         TPtrC attribute;
         User::LeaveIfError(
                 iStatement.ColumnText(
@@ -763,6 +818,7 @@
         result->SetStringIdL( stringId );
         result->SetRowId( rowId );
         result->SetTableNameL( tableName );
+        result->SetQmFilenameL( qmFilename );
         
         aResultInput.AppendL( result );
         CleanupStack::Pop( result );
--- a/contentstorage/castorage/src/casqlquerycreator.cpp	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/castorage/src/casqlquerycreator.cpp	Thu May 27 13:11:12 2010 +0300
@@ -574,31 +574,14 @@
 //
 // ---------------------------------------------------------------------------
 //
-void CaSqlQueryCreator::CreateLocalizeEntryQueryL( CCaSqlQuery* aSqlQuery )
+void CaSqlQueryCreator::CreateLocalizationTableQueryL( CCaSqlQuery* aSqlQuery,
+        const TDesC& aStatement)
     {
-    DEBUG(("_CA_:CASqlQueryCreator::CreateLocalizeEntryQueryL"));
-    RBuf query;
-    
-    query.CleanupClosePushL();
-    query.CreateL( KSQLLocalizeEntry().Length() );
-    query.Append( KSQLLocalizeEntry );
-    
-    aSqlQuery->SetQueryL( query );
-    CleanupStack::PopAndDestroy( &query );
-    }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CaSqlQueryCreator::CreateGetLocalizationsQueryL( CCaSqlQuery* aSqlQuery )
-    {
-    DEBUG(("_CA_:CASqlQueryCreator::CreateGetLocalizationsQueryL"));
+    DEBUG(("_CA_:CASqlQueryCreator::CreateLocalizationTableQueryL"));
     RBuf query;
     query.CleanupClosePushL();
-    query.CreateL( KSQLGetLocalizations().Length() );
-    query.Append( KSQLGetLocalizations );
-    
+    query.CreateL( aStatement.Length() );
+    query.Append( aStatement );
     aSqlQuery->SetQueryL( query );
     CleanupStack::PopAndDestroy( &query );
     }
--- a/contentstorage/cautils/inc/calocalizationentry.h	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/cautils/inc/calocalizationentry.h	Thu May 27 13:11:12 2010 +0300
@@ -80,9 +80,20 @@
      * Gets LocalizedString
      * @return LocalizedString
      */
-    IMPORT_C const RBuf& GetLocalizedString( ) const;
+    IMPORT_C const RBuf& GetLocalizedString() const;
     
+    /**
+     * Gets GetQmFilename
+     * @return GetQmFilename
+     */
+    IMPORT_C const RBuf& GetQmFilename() const;
+
     // SETTERS
+
+    /**
+    */
+    IMPORT_C void SetQmFilenameL( const TDesC& aQmFilename );
+    
     /**
 
      */
@@ -119,6 +130,7 @@
     IMPORT_C void SetLocalizedStringL( const TDesC& aLocalName );
     
     
+    
 /*    *
      * Externalizes object to the stream
      * @param aStream a write stream
@@ -183,6 +195,12 @@
      * Own.
      */
     RBuf iLocalName;
+    
+    /*
+     * Translated string.
+     * Own.
+     */
+    RBuf iQmFilename;
 
      };
 
--- a/contentstorage/cautils/src/calocalizationentry.cpp	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/cautils/src/calocalizationentry.cpp	Thu May 27 13:11:12 2010 +0300
@@ -27,10 +27,11 @@
 
 CCaLocalizationEntry::~CCaLocalizationEntry( )
     {
-    iTableName.Close( );
-    iAttribName.Close( );
-    iStringId.Close( );
-    iLocalName.Close( );
+    iTableName.Close();
+    iAttribName.Close();
+    iStringId.Close();
+    iLocalName.Close();
+    iQmFilename.Close();
     }
 
 // ---------------------------------------------------------------------------
@@ -188,6 +189,24 @@
 //
 // ---------------------------------------------------------------------------
 //
+EXPORT_C const RBuf& CCaLocalizationEntry::GetQmFilename( ) const
+    {
+    return iQmFilename;
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCaLocalizationEntry::SetQmFilenameL( const TDesC& aQmFilename )
+    {
+	iQmFilename.Close( );
+	iQmFilename.CreateL( aQmFilename );
+    }
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
 EXPORT_C const RBuf& CCaLocalizationEntry::GetLocalizedString( ) const
     {
     return iLocalName;
--- a/contentstorage/contentstorage.pro	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/contentstorage.pro	Thu May 27 13:11:12 2010 +0300
@@ -23,4 +23,5 @@
 SUBDIRS  += cahandler
 }
 SUBDIRS  += caclient
+SUBDIRS  += casoftwareregistry
 CONFIG  += ordered
--- a/contentstorage/eabi/camenuu.def	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/eabi/camenuu.def	Thu May 27 13:11:12 2010 +0300
@@ -23,4 +23,6 @@
 	_ZNK14CCaSrvEngUtils13GetApaAppInfoE4TUidR11TApaAppInfo @ 22 NONAME
 	_ZTI15CCaStorageProxy @ 23 NONAME
 	_ZTV15CCaStorageProxy @ 24 NONAME
+	_ZN16CCaSrvMmcHistory4NewLEv @ 25 NONAME
+	_ZN15CCaStorageProxy16AddLocalizationLERK20CCaLocalizationEntry @ 26 NONAME
 
--- a/contentstorage/eabi/cautilsu.def	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/eabi/cautilsu.def	Thu May 27 13:11:12 2010 +0300
@@ -96,4 +96,6 @@
 	_ZNK22CCaInnerNotifierFilter12GetTypeNamesEv @ 95 NONAME
 	_ZNK22CCaInnerNotifierFilter15GetNotifierTypeEv @ 96 NONAME
 	_ZNK22CCaInnerNotifierFilter6GetIdsEv @ 97 NONAME
+	_ZN20CCaLocalizationEntry14SetQmFilenameLERK7TDesC16 @ 98 NONAME
+	_ZNK20CCaLocalizationEntry13GetQmFilenameEv @ 99 NONAME
 
--- a/contentstorage/extinc/casathandler.h	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/extinc/casathandler.h	Thu May 27 13:11:12 2010 +0300
@@ -20,7 +20,7 @@
 
 #include <AknIconUtils.h>
 
-#include <RSatSession.h>
+#include <rsatsession.h>
 #include <tsaticoninfo.h>
 #ifdef SIM_ATK_SERVICE_API_V1
 #include <rsatservice.h>// MCL
--- a/contentstorage/group/group.pro	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/group/group.pro	Thu May 27 13:11:12 2010 +0300
@@ -20,8 +20,8 @@
 BLD_INF_RULES.prj_exports += \
      "../castorage/conf/castoragedb.confml APP_LAYER_CONFML(castoragedb.confml)" \
      "../castorage/conf/castoragedb.implml APP_LAYER_CONFML(castoragedb.implml)" \
-     "../castorage/data/castoragedb_create.sql APP_LAYER_CONFML(castoragedb_templates/castoragedb_create.sql)" \
-     "../castorage/conf/castoragedb_templates/castoragedb_variant.sql APP_LAYER_CONFML(castoragedb_templates/castoragedb_variant.sql)" \
+     "../castorage/data/castoragedb_create.sql APP_LAYER_CONFML(../implml/castoragedb_templates/castoragedb_create.sql)" \
+     "../castorage/conf/castoragedb_templates/castoragedb_variant.sql APP_LAYER_CONFML(../implml/castoragedb_templates/castoragedb_variant.sql)" \
      "$${LITERAL_HASH}ifndef CONTENT_ARSENAL_STORAGE_UT" \
      "../castorage/data/castorage.db z:/private/20022F90/castorage.db" \
      "$${LITERAL_HASH}else " \
--- a/contentstorage/inc/cadef.h	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/inc/cadef.h	Thu May 27 13:11:12 2010 +0300
@@ -12,7 +12,7 @@
  * Contributors:
  *
  * Description:  Definition of different constants
- *  Version     : %version: ou1s60ui#10.1.14 % << Don't touch! Updated by Synergy at check-out.
+ *  Version     : %version: 10.1.16 % << Don't touch! Updated by Synergy at check-out.
  *
  */
 
@@ -97,6 +97,8 @@
 
 _LIT( KCaAppGroupName, "appgroup_name" );
 
+_LIT( KCollectionIconFileName, "qtg_large_applications_user");
+
 const TInt KGranularityOne = 1;
 const TInt KUidChars = 10;
 const TInt KDefaultGranularity = 5;
@@ -146,6 +148,7 @@
 // Menu clients always need to check that the necessary attributes are present.
 //
 _LIT( KCaAttrLongName, "long_name" ); ///< Long name.
+_LIT( KCaComponentId, "component_id" ); ///< Long name.
 
 // Built-in types and attributes.
 //
--- a/contentstorage/srvinc/casrvmmchistory.h	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/srvinc/casrvmmchistory.h	Thu May 27 13:11:12 2010 +0300
@@ -36,19 +36,15 @@
     // construction
 
     /**
+     * Creates an instance of CCaSrvMmcHistory.
+     * @return a pointer to CCaSrvMmcHistory insctance.
+     */
+    IMPORT_C static CCaSrvMmcHistory* NewL();
+
+    /**
      * Destructor.
      */
-    virtual ~CCaSrvMmcHistory()
-        {
-        iMmcList.Close();
-        }
-
-    /**
-     * Constructor.
-     */
-    CCaSrvMmcHistory()
-        {
-        }
+    virtual ~CCaSrvMmcHistory();
 
 public:
     // new methods
@@ -84,6 +80,17 @@
     IMPORT_C TInt Find( TUint aMmc ); // Find mmc in history.
 
 private:
+    /**
+     * Constructor.
+     */
+    CCaSrvMmcHistory();
+
+    /**
+     * Second phase symbian constructor.
+     */
+    void ConstructL();
+
+private:
     // data
 
     RArray<TUint> iMmcList; ///< ID history list. Own.
--- a/contentstorage/srvinc/castorageproxy.h	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/srvinc/castorageproxy.h	Thu May 27 13:11:12 2010 +0300
@@ -60,6 +60,13 @@
     IMPORT_C void LocalizeEntryL( CCaLocalizationEntry& aLocalization );
 
     /**
+     * Add localization row to the storage
+     *
+     * @param aLocalization entry containing localization row to be added
+     */
+    IMPORT_C void AddLocalizationL(const CCaLocalizationEntry& aLocalization);
+    
+    /**
      * Fetches localization data from database
      *
      * @param aResultContainer Target for results.
--- a/contentstorage/srvsrc/casrv.cpp	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/srvsrc/casrv.cpp	Thu May 27 13:11:12 2010 +0300
@@ -154,12 +154,14 @@
     iSessionCount = 0;
     iStorageProxy = CCaStorageProxy::NewL();
     iSrvEngUtils = CCaSrvEngUtils::NewL();
-    TRAPD( err, iSrvManager = CCaSrvManager::NewL(
-            *iStorageProxy, iSrvEngUtils ) );
-    if( KSqlErrNotDb <= err && err <= KSqlErrGeneral )
+    iSrvManager = CCaSrvManager::NewL(*iStorageProxy, iSrvEngUtils);
+    TInt errCode = iSrvManager->LoadOperationErrorCodeL();
+    if( KSqlErrNotDb <= errCode && errCode <= KSqlErrGeneral )
         {
         //problem in loading one of plugins, probably data base is corrupted
         //lets load it from ROM and try again
+        delete iSrvManager;
+        iSrvManager = NULL;
         iStorageProxy->LoadDataBaseFromRomL();
         iSrvManager = CCaSrvManager::NewL( *iStorageProxy, iSrvEngUtils );
         }
--- a/contentstorage/srvsrc/casrvmmchistory.cpp	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/srvsrc/casrvmmchistory.cpp	Thu May 27 13:11:12 2010 +0300
@@ -26,7 +26,45 @@
 // ==================== MEMBER FUNCTIONS ====================
 
 // ---------------------------------------------------------
-// CMenuSrvMmcHistory::LoadL
+//
+// ---------------------------------------------------------
+//
+CCaSrvMmcHistory::CCaSrvMmcHistory()
+	{
+	}
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+void CCaSrvMmcHistory::ConstructL()
+	{
+	}
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+EXPORT_C CCaSrvMmcHistory* CCaSrvMmcHistory::NewL()
+     {
+     CCaSrvMmcHistory* self = new (ELeave) CCaSrvMmcHistory();
+     CleanupStack::PushL( self );
+     self->ConstructL();
+     CleanupStack::Pop( self );
+     return self;
+     }
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+CCaSrvMmcHistory::~CCaSrvMmcHistory()
+    {
+    iMmcList.Close();
+    }
+
+// ---------------------------------------------------------
+//
 // ---------------------------------------------------------
 //
 EXPORT_C void CCaSrvMmcHistory::LoadL( RFs& aFs, const TDesC& aFname )
--- a/contentstorage/srvsrc/castorageproxy.cpp	Fri May 14 16:10:06 2010 +0300
+++ b/contentstorage/srvsrc/castorageproxy.cpp	Thu May 27 13:11:12 2010 +0300
@@ -272,6 +272,16 @@
 //
 // ---------------------------------------------------------------------------
 //
+EXPORT_C void CCaStorageProxy::AddLocalizationL(
+		const CCaLocalizationEntry& aLocalization)
+	{
+	iStorage->AddLocalizationL(aLocalization);
+	}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
 EXPORT_C void CCaStorageProxy::DbPropertyL( const TDesC& aProperty,
         TDes& aPropertyValue )
     {
--- a/homescreensrv.pro	Fri May 14 16:10:06 2010 +0300
+++ b/homescreensrv.pro	Thu May 27 13:11:12 2010 +0300
@@ -22,6 +22,7 @@
             homescreensrv_plat \
             tsrc
 symbian:SUBDIRS += activityfw
+symbian:SUBDIRS += tstaskmonitor
 symbian:SUBDIRS += hsappkeyhandler
 
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homescreensrv_plat/contentstorage_api/casoftwareregistry.h	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  ?Description
+ *
+ */
+
+#ifndef CA_SOFTWARE_REGISTRY_H
+#define CA_SOFTWARE_REGISTRY_H
+
+#include <QHash>
+#include <QObject>
+#include <QSharedPointer>
+#include <QString>
+
+#include "caclient_global.h"
+
+//FORWARD DECLARATIONS
+class CaSoftwareRegistryPrivate;
+
+/**
+ * Class provides Usif specific services
+ */
+class CACLIENT_EXPORT CaSoftwareRegistry: public QObject
+{
+    
+Q_OBJECT    
+
+    explicit CaSoftwareRegistry(QObject *parent = 0);
+
+    ~CaSoftwareRegistry();
+    
+public:
+    
+    static QSharedPointer<CaSoftwareRegistry> create();
+    
+    typedef QHash<QString, QString> DetailMap;
+    
+    DetailMap entryDetails(int componentId) const;
+    
+    static QString componentNameKey();
+    static QString componentVersionKey();
+    static QString componentVendorKey();
+    static QString componentDriveInfoKey();
+    static QString componentSizeKey();
+    static QString componentTypeKey();
+private:
+    /**
+     * Pointer to a private implementation.
+     */
+    CaSoftwareRegistryPrivate *const m_d;
+
+    /**
+     * The static pointer to the instance of CaSoftwareRegistry.
+     */
+    static QWeakPointer<CaSoftwareRegistry> m_instance;
+
+    friend class CaSoftwareRegistryPrivate;
+    friend class QtSharedPointer::ExternalRefCount<CaSoftwareRegistry>;
+
+    Q_DISABLE_COPY(CaSoftwareRegistry)
+    
+};
+
+#endif // CA_SOFTWARE_REGISTRY_H
--- a/homescreensrv_plat/contentstorage_api/contentstorage_api.pri	Fri May 14 16:10:06 2010 +0300
+++ b/homescreensrv_plat/contentstorage_api/contentstorage_api.pri	Thu May 27 13:11:12 2010 +0300
@@ -24,4 +24,5 @@
                       contentstorage_api/caquery.h \
                       contentstorage_api/caservice.h \
                       contentstorage_api/caitemmodel.h \
-                      contentstorage_api/camenuiconutility.h
\ No newline at end of file
+                      contentstorage_api/camenuiconutility.h \
+                      contentstorage_api/casoftwareregistry.h
\ No newline at end of file
--- a/homescreensrv_plat/homescreen_information_api/inc/homescreendomainpskeys.h	Fri May 14 16:10:06 2010 +0300
+++ b/homescreensrv_plat/homescreen_information_api/inc/homescreendomainpskeys.h	Thu May 27 13:11:12 2010 +0300
@@ -31,6 +31,7 @@
  */
 const char HsStatePSKeySubPath[] = "state";
 
+#ifdef Q_OS_SYMBIAN
 /**
  * Home Screen P&S category Uid for pure Symbian usage.
  */
@@ -38,10 +39,11 @@
 
 /**
  * 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 
+ * This property is updated when Home screen state is changed. Valid values
  * are defined by the enum EPSHsState.
  */
 const TUint KHsCategoryStateKey = 0x1;
+#endif //Q_OS_SYMBIAN
 
 /**
  * Home screen state.
--- a/rom/homescreensrv_core.iby	Fri May 14 16:10:06 2010 +0300
+++ b/rom/homescreensrv_core.iby	Thu May 27 13:11:12 2010 +0300
@@ -42,6 +42,7 @@
 file=ABI_DIR\BUILD_DIR\castorage.dll     SHARED_LIB_DIR\castorage.dll
 file=ABI_DIR\BUILD_DIR\MenuInterface.dll     SHARED_LIB_DIR\MenuInterface.dll
 file=ABI_DIR\BUILD_DIR\casrvmanager.dll     SHARED_LIB_DIR\casrvmanager.dll
+file=ABI_DIR\BUILD_DIR\casoftwareregistry.dll     SHARED_LIB_DIR\casoftwareregistry.dll
 ECOM_PLUGIN( casatmonitor.dll, casatmonitor.rsc )
 ECOM_PLUGIN( caappscanner.dll, caappscanner.rsc )
 ECOM_PLUGIN( cawidgetscanner.dll, cawidgetscanner.rsc )
--- a/sis/homescreensrv.pkg	Fri May 14 16:10:06 2010 +0300
+++ b/sis/homescreensrv.pkg	Thu May 27 13:11:12 2010 +0300
@@ -138,6 +138,7 @@
 "/epoc32/release/armv5/urel/caextendedmenu.dll" - "c:/sys/bin/caextendedmenu.dll"
 "/epoc32/release/armv5/urel/casathandler.dll" - "c:/sys/bin/casathandler.dll"
 "/epoc32/release/armv5/urel/castorage.dll" - "c:/sys/bin/castorage.dll"
+"/epoc32/release/armv5/urel/casoftwareregistry.dll" - "c:/sys/bin/casoftwareregistry.dll"
 "/epoc32/release/armv5/urel/castockhandlerplugins.dll" - "c:/sys/bin/castockhandlerplugins.dll"
 "/epoc32/data/z/private/20022F90/castorage.db" - "c:/private/20022F90/castorage.db"
 "/epoc32/data/z/resource/plugins/castockhandlerplugins.rsc"-"c:/resource/plugins/castockhandlerplugins.rsc"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/client.pri	Thu May 27 13:11:12 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:
+#
+
+INCLUDEPATH +=  $$PWD/inc
+
+HEADERS +=  $$PWD/inc/tstaskmonitor_global.h \
+            $$PWD/inc/tstaskmonitor.h \
+            $$PWD/inc/tstask.h \
+            
+SOURCES +=  $$PWD/src/tstaskmonitor.cpp \
+            
+symbian {
+    INCLUDEPATH +=  $$PWD/s60/inc \
+                    $$PWD/../inc \
+                    $$PWD/../utils/inc \     
+
+    HEADERS +=  $$PWD/s60/inc/tstaskmonitorobserver.h \
+                $$PWD/s60/inc/tstaskmonitorclient.h \
+                $$PWD/s60/inc/tstaskmonitorclientimpl.h \
+                $$PWD/s60/inc/tstaskmonitorsession.h \
+                $$PWD/../utils/inc/tsfswentry.h \
+                $$PWD/../utils/inc/tsutils.h \
+                $$PWD/s60/inc/tstaskmonitor_p.h \
+                $$PWD/s60/inc/tsapplicationtask.h \
+                
+    SOURCES +=  $$PWD/s60/src/tstaskmonitorclient.cpp \
+                $$PWD/s60/src/tstaskmonitorclientimpl.cpp \
+                $$PWD/s60/src/tstaskmonitorsession.cpp \
+                $$PWD/../utils/src/tsfswentry.cpp \
+                $$PWD/s60/src/tstaskmonitor_p.cpp \
+                $$PWD/s60/src/tstask.cpp \
+                $$PWD/s60/src/tsapplicationtask.cpp \
+
+    LIBS    +=  -lxqutils \
+                -lestor \
+                -lfbscli
+
+} else {
+    INCLUDEPATH +=  $$PWD/stub/inc \
+
+    HEADERS +=  $$PWD/stub/inc/tstaskmonitor_p.h \
+                $$PWD/stub/inc/tsfswentry.h \
+                
+    SOURCES +=  $$PWD/stub/src/tstaskmonitor_p.cpp \
+                $$PWD/stub/src/tstask.cpp \
+                $$PWD/stub/src/tsfswentry.cpp \
+                
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/client.pro	Thu May 27 13:11:12 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: 
+#
+
+TEMPLATE = lib
+TARGET = tstaskmonitorclient
+
+CONFIG += dll
+    
+DEFINES += TSTASKMONITOR_LIB
+            
+symbian {
+    dll.sources = tstaskmonitorclient.dll
+    dll.path = $$SHARED_LIB_DIR
+    DEPLOYMENT += dll
+
+    BLD_INF_RULES.prj_exports +=    "s60\inc\tstaskmonitorclient.h" \
+                                    "s60\inc\tstaskmonitorobserver.h" \
+                                    "inc\tstaskmonitor.h" \
+                                    "inc\tstask.h" \
+                                    "inc\tstaskmonitor_global.h" \
+
+    TARGET.UID3 = 0x200267AF    
+    TARGET.CAPABILITY = ALL -TCB
+    TARGET.EPOCALLOWDLLDATA = 1    
+    
+    # temporary, remove when API is stable enough
+    MMP_RULES += EXPORTUNFROZEN
+}
+
+include(client.pri)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/inc/tstask.h	Thu May 27 13:11:12 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 TSTASK_H
+#define TSTASK_H
+
+#include <QPixmap>
+#include <QString>
+
+#include "tstaskmonitor_global.h"
+
+class CTsFswEntry;
+
+class TsTask
+{
+    
+public:
+    TsTask(CTsFswEntry* entry);
+    TSTASKMONITOR_EXPORT virtual ~TsTask();
+    
+    TSTASKMONITOR_EXPORT virtual void open() = 0;
+    TSTASKMONITOR_EXPORT virtual void close() = 0;
+    
+    TSTASKMONITOR_EXPORT bool isClosable() const;
+    TSTASKMONITOR_EXPORT QPixmap icon() const;
+    TSTASKMONITOR_EXPORT QString name() const;
+    
+protected:
+    CTsFswEntry* mEntry;
+
+};
+
+#endif //TSTASK_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/inc/tstaskmonitor.h	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#ifndef TSTASKMONITOR_H
+#define TSTASKMONITOR_H
+
+#include <QObject>
+#include <QSharedPointer>
+
+#include "tstaskmonitor_global.h"
+#include "tstask.h"
+
+class TsTaskMonitorPrivate;
+
+class TSTASKMONITOR_EXPORT TsTaskMonitor : public QObject
+{
+    Q_OBJECT
+    
+public:
+    TsTaskMonitor(QObject *parent = 0);
+    ~TsTaskMonitor();
+    QList< QSharedPointer<TsTask> > taskList();
+
+signals:
+    void taskListChanged();
+    
+private:
+    TsTaskMonitorPrivate *d_ptr;   
+    friend class TsTaskMonitorPrivate;
+};
+
+#endif //TSTASKMONITOR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/inc/tstaskmonitor_global.h	Thu May 27 13:11:12 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 TSTASKMONITOR_GLOBAL_H
+#define TSTASKMONITOR_GLOBAL_H
+
+#include <qglobal.h>
+
+#ifdef TSTASKMONITOR_LIB
+    #define TSTASKMONITOR_EXPORT Q_DECL_EXPORT
+#else
+    #ifdef TSTASKMONITOR_TEST
+        #define TSTASKMONITOR_EXPORT
+    #else
+        #define TSTASKMONITOR_EXPORT Q_DECL_IMPORT
+    #endif
+#endif
+
+#endif //TSTASKMONITOR_GLOBAL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/s60/inc/tsapplicationtask.h	Thu May 27 13:11:12 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: 
+*
+*/
+#ifndef TSAPPLICATIONTASK_H
+#define TSAPPLICATIONTASK_H
+
+#include "tstask.h"
+
+class TsApplicationTask : public TsTask
+{
+    
+public:
+    TsApplicationTask(CTsFswEntry* entry);
+    
+    virtual void open();
+    virtual void close();
+
+};
+
+#endif //TSAPPLICATIONTASK_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/s60/inc/tstaskmonitor_p.h	Thu May 27 13:11:12 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 TSTASKMONITOR_P_H
+#define TSTASKMONITOR_P_H
+
+#include "tstaskmonitorobserver.h"
+
+#include <QList>
+#include <QSharedPointer>
+
+class TsTask;
+class TsTaskMonitor;
+class CTsTaskMonitorClient;
+
+class TsTaskMonitorPrivate : public MTsTaskMonitorObserver
+{
+public:
+    TsTaskMonitorPrivate(TsTaskMonitor *q);
+    virtual ~TsTaskMonitorPrivate();
+    
+public:
+    QList< QSharedPointer<TsTask> > taskList();
+
+public:
+    virtual void HandleRunningAppChange();
+
+private:
+    TsTaskMonitor *q_ptr;
+    CTsTaskMonitorClient *mClient;
+    
+};
+
+#endif //TSTASKMONITOR_P_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/s60/inc/tstaskmonitorclient.h	Thu May 27 13:11:12 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>
+
+#include "tsfswentry.h"
+
+class MTsTaskMonitorObserver;
+class CTsTaskMonitorClientImpl;
+
+NONSHARABLE_CLASS( CTsTaskMonitorClient ) : public CBase
+{
+public:
+    IMPORT_C static CTsTaskMonitorClient* NewL();
+    IMPORT_C static CTsTaskMonitorClient* NewLC();
+    IMPORT_C ~CTsTaskMonitorClient();
+
+public:
+    void TaskListL(RTsFswArray& tasks);
+    void Subscribe(MTsTaskMonitorObserver& aObserver);
+    void CancelSubscribe();
+
+private:
+    CTsTaskMonitorClient();
+    void ConstructL();
+
+private:
+    CTsTaskMonitorClientImpl* iImpl;
+};
+
+#endif  // TSTASKMONITORCLIENT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/s60/inc/tstaskmonitorclientimpl.h	Thu May 27 13:11:12 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 "tsfswentry.h"
+#include "tstaskmonitorsession.h"
+
+class MTsTaskMonitorObserver;
+
+NONSHARABLE_CLASS( CTsTaskMonitorClientImpl ) : public CActive
+{
+public:
+    static CTsTaskMonitorClientImpl* NewL();
+    static CTsTaskMonitorClientImpl* NewLC();
+    ~CTsTaskMonitorClientImpl();
+
+public:
+    void TaskListL(RTsFswArray& tasks);
+
+    void Subscribe(MTsTaskMonitorObserver& aObserver);
+    void CancelSubscribe();
+
+private:
+    void RunL();
+    void DoCancel();
+
+private:
+    CTsTaskMonitorClientImpl();
+    void ConstructL();
+
+    RTsTaskMonitorSession iSession;
+    MTsTaskMonitorObserver* iObserver; // not owned
+};
+
+#endif  // TSTASKMONITORCLIENTIMPL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/s60/inc/tstaskmonitorobserver.h	Thu May 27 13:11:12 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/tstaskmonitor/client/s60/inc/tstaskmonitorsession.h	Thu May 27 13:11:12 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 TSTASKMONITORSESSION_H
+#define TSTASKMONITORSESSION_H
+
+#include <e32base.h>
+
+#include "tsfswentry.h"
+
+NONSHARABLE_CLASS( RTsTaskMonitorSession ) : public RSessionBase
+{
+public:
+    TInt Connect();
+
+    void TaskListL(RTsFswArray& tasks);
+    void Subscribe(TRequestStatus& aStatus);
+    void CancelSubscribe();
+
+private:
+    TInt StartServer();
+};
+
+#endif  // TSTASKMONITORSESSION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/s60/src/tsapplicationtask.cpp	Thu May 27 13:11:12 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: 
+*
+*/
+
+#include "tsapplicationtask.h"
+
+#include <apgtask.h>
+#include <eikenv.h>
+#include <akndef.h>
+
+#include "tsfswentry.h"
+
+TsApplicationTask::TsApplicationTask(CTsFswEntry* entry) : TsTask(entry)
+{
+}
+
+void TsApplicationTask::open()
+{
+    TApaTaskList taskList(CEikonEnv::Static()->WsSession());
+    TApaTask task = taskList.FindApp(mEntry->AppUid());
+    task.BringToForeground();
+}
+
+void TsApplicationTask::close()
+{
+    RWsSession wsSession;
+    if (wsSession.Connect() == KErrNone) {
+        CleanupClosePushL<RWsSession>(wsSession);
+    
+        TWsEvent event;
+        event.SetTimeNow();
+        event.SetType(KAknShutOrHideApp);
+        wsSession.SendEventToWindowGroup(mEntry->WgId(), event);
+
+        CleanupStack::PopAndDestroy(&wsSession);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/s60/src/tstask.cpp	Thu May 27 13:11:12 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 "tstask.h"
+
+#include <xqconversions>
+
+#include "tsfswentry.h"
+
+TsTask::TsTask(CTsFswEntry* entry) : mEntry(entry)
+{
+}
+
+TsTask::~TsTask()
+{
+    delete mEntry;
+}
+
+bool TsTask::isClosable() const
+{
+    return mEntry->CloseableApp();
+}
+
+QPixmap TsTask::icon() const
+{
+    QPixmap pixmap = QPixmap::fromSymbianCFbsBitmap(mEntry->AppIconBitmap());
+    QPixmap mask = QPixmap::fromSymbianCFbsBitmap(mEntry->AppIconMask());
+    // @todo QPixmap::setAlphaChannel() is deprecated, change to code using QPainter
+    pixmap.setAlphaChannel(mask);
+    return pixmap;
+}
+
+QString TsTask::name() const
+{
+    return XQConversions::s60DescToQString(mEntry->AppName());
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/s60/src/tstaskmonitor_p.cpp	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,70 @@
+/*
+* 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 "tstaskmonitorclient.h"
+#include "tsapplicationtask.h"
+
+#include "tsutils.h"
+using TaskSwitcher::CleanupResetAndDestroyPushL;
+
+TsTaskMonitorPrivate::TsTaskMonitorPrivate(TsTaskMonitor *q) : q_ptr(q), mClient(0)
+{
+    QT_TRAP_THROWING(mClient = CTsTaskMonitorClient::NewL());
+    mClient->Subscribe(*this);
+}
+
+TsTaskMonitorPrivate::~TsTaskMonitorPrivate()
+{
+    mClient->CancelSubscribe();
+}
+
+QList< QSharedPointer<TsTask> > TsTaskMonitorPrivate::taskList()
+{
+    QList< QSharedPointer<TsTask> > tasks;
+
+    QT_TRAP_THROWING (    
+        RPointerArray<CTsFswEntry> entries;   
+        CleanupResetAndDestroyPushL<CTsFswEntry>(entries);
+        mClient->TaskListL(entries);
+        
+        // TsTask claims ownership of CTsFswEntry, so we have to remove entries from 
+        // entries array after adding task to tasks array to prevent double delete of
+        // CTsFswEntry objects in case of leave (for example due to OOM) in the middle 
+        // of the loop below.
+        while (entries.Count()) {
+            CTsFswEntry *firstEntry = entries[0];
+            CleanupStack::PushL(firstEntry);
+            entries.Remove(0);
+            
+            // @todo switch by entry type
+            QT_TRYCATCH_LEAVING(tasks.append(QSharedPointer<TsTask>(new TsApplicationTask(firstEntry))));
+            
+            CleanupStack::Pop(firstEntry);
+        }
+        
+        CleanupStack::PopAndDestroy(&entries);    
+    );
+    
+    return tasks;
+}
+
+void TsTaskMonitorPrivate::HandleRunningAppChange()
+{
+    emit q_ptr->taskListChanged();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/s60/src/tstaskmonitorclient.cpp	Thu May 27 13:11:12 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 "tstaskmonitorclient.h"
+#include "tstaskmonitorclientimpl.h"
+
+EXPORT_C CTsTaskMonitorClient *CTsTaskMonitorClient::NewL()
+{
+    CTsTaskMonitorClient* self = NewLC();
+    CleanupStack::Pop(self);
+    return self;
+}
+
+EXPORT_C CTsTaskMonitorClient *CTsTaskMonitorClient::NewLC()
+{
+    CTsTaskMonitorClient* self = new (ELeave) CTsTaskMonitorClient;
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+}
+
+void CTsTaskMonitorClient::ConstructL()
+{
+    iImpl = CTsTaskMonitorClientImpl::NewL();
+}
+
+CTsTaskMonitorClient::CTsTaskMonitorClient()
+{
+}
+
+EXPORT_C CTsTaskMonitorClient::~CTsTaskMonitorClient()
+{
+    delete iImpl;
+}
+
+void CTsTaskMonitorClient::TaskListL(RTsFswArray& tasks)
+{
+    iImpl->TaskListL(tasks);
+}
+
+void CTsTaskMonitorClient::Subscribe(MTsTaskMonitorObserver& aObserver)
+{
+    iImpl->Subscribe(aObserver);
+}
+
+void CTsTaskMonitorClient::CancelSubscribe()
+{
+    iImpl->CancelSubscribe();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/s60/src/tstaskmonitorclientimpl.cpp	Thu May 27 13:11:12 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 <e32base.h>
+
+#include "tsfswentry.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());
+}
+
+void CTsTaskMonitorClientImpl::TaskListL(RTsFswArray& tasks)
+{
+    iSession.TaskListL(tasks);
+}
+
+void CTsTaskMonitorClientImpl::Subscribe(MTsTaskMonitorObserver& aObserver)
+{
+    Cancel();
+    iObserver = &aObserver;
+    iSession.Subscribe(iStatus);
+    SetActive();
+}
+
+void CTsTaskMonitorClientImpl::CancelSubscribe()
+{
+    Cancel();
+}
+
+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/tstaskmonitor/client/s60/src/tstaskmonitorsession.cpp	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,99 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#include <s32mem.h>
+
+#include "tstaskmonitorsession.h"
+#include "tstaskmonitorglobals.h"
+
+void RTsTaskMonitorSession::TaskListL(RTsFswArray& tasks)
+{
+    for (;;) {
+        TPckgBuf<TInt> dataSize;
+        User::LeaveIfError(SendReceive(GetRunningAppInfo, TIpcArgs(&dataSize)));
+        HBufC8* data = HBufC8::NewLC(dataSize());
+        TPtr8 dataPointer(data->Des());
+        TInt err = SendReceive(FlushData, TIpcArgs(&dataPointer, dataSize()));
+        if (err == KErrNone) {
+            RDesReadStream dataStream(dataPointer);
+            CleanupClosePushL(dataStream);
+            CTsFswEntry::InternalizeArrayL(dataStream, tasks);
+            CleanupStack::PopAndDestroy(&dataStream);
+        } else if (err != KErrCorrupt) {
+            User::Leave(err);
+        }
+        CleanupStack::PopAndDestroy(data);
+        if (err == KErrNone) {
+            break;
+        }
+        // If result was KErrCorrupt then the size received from GetRunningAppInfo is
+        // not valid anymore so restart the whole procedure.
+    }
+}
+
+TInt RTsTaskMonitorSession::StartServer()
+{
+    RProcess server;
+    if (TInt error = server.Create(KRunningAppServerName, KNullDesC, TUidType(KNullUid, KNullUid, KRunningAppServerUid))) {
+        return error;
+    }
+
+    TRequestStatus status;
+    server.Rendezvous(status);
+    if (status != KRequestPending) {
+        server.Kill(0);
+    } else {
+        server.Resume();
+    }
+
+    User::WaitForRequest(status);
+    TInt error = (EExitPanic == server.ExitType()) ? KErrGeneral : status.Int();
+    if (KErrCancel == error) {
+        error = KErrNone;
+    }
+    server.Close();
+
+    return error;
+}
+
+TInt RTsTaskMonitorSession::Connect()
+{
+    TInt retry = 4;
+    TInt error(KErrNone);
+    do {
+        error = CreateSession(KRunningAppServerName, TVersion(0, 0, 0));
+        if (KErrNotFound != error && KErrServerTerminated != error) {
+            retry = 0;
+        } else {
+            error = StartServer();
+            if (KErrNone != error && KErrAlreadyExists != error) {
+                retry = 0;
+                error = CreateSession(KRunningAppServerName, TVersion(0, 0, 0));
+            }
+        }
+    } while (--retry > 0);
+    return error;
+}
+
+void RTsTaskMonitorSession::Subscribe(TRequestStatus& aStatus)
+{
+    SendReceive(SubscribeRunningAppChanges, aStatus);
+}
+
+void RTsTaskMonitorSession::CancelSubscribe()
+{
+    SendReceive(CancelSubscribeRunningAppChanges);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/src/tstaskmonitor.cpp	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#include "tstaskmonitor.h"
+#include "tstaskmonitor_p.h"
+
+#include "tstask.h"
+
+TsTaskMonitor::TsTaskMonitor(QObject *parent) : QObject(parent), d_ptr(0)
+{
+    d_ptr = new TsTaskMonitorPrivate(this);
+}
+
+TsTaskMonitor::~TsTaskMonitor()
+{
+    delete d_ptr;
+}
+
+QList< QSharedPointer<TsTask> > TsTaskMonitor::taskList()
+{
+    return d_ptr->taskList();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/stub/inc/tsfswentry.h	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#ifndef TSFSWENTRY_H
+#define TSFSWENTRY_H
+
+class CTsFswEntry
+{
+public:
+    CTsFswEntry();
+};
+
+#endif //TSFSWENTRY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/stub/inc/tstaskmonitor_p.h	Thu May 27 13:11:12 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 TSTASKMONITOR_P_H
+#define TSTASKMONITOR_P_H
+
+#include <QList>
+#include <QSharedPointer>
+
+#include "tstask.h"
+
+class TsTaskMonitor;
+
+class TsTaskMonitorPrivate
+{
+public:
+    TsTaskMonitorPrivate(TsTaskMonitor *q);
+    
+public:
+    QList< QSharedPointer<TsTask> > taskList();
+    
+};
+
+#endif //TSTASKMONITOR_P_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/stub/src/tsfswentry.cpp	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,22 @@
+/*
+* 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 "tsfswentry.h"
+
+CTsFswEntry::CTsFswEntry()
+{
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/stub/src/tstask.cpp	Thu May 27 13:11:12 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 "tstask.h"
+#include "tsfswentry.h"
+
+TsTask::TsTask(CTsFswEntry* entry) : mEntry(entry)
+{
+}
+
+TsTask::~TsTask()
+{
+    delete mEntry;
+}
+
+bool TsTask::isClosable() const
+{
+    return false;
+}
+
+QPixmap TsTask::icon() const
+{
+    return QPixmap();
+}
+
+QString TsTask::name() const
+{
+    return QString();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/stub/src/tstaskmonitor_p.cpp	Thu May 27 13:11:12 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 "tstaskmonitor_p.h"
+
+TsTaskMonitorPrivate::TsTaskMonitorPrivate(TsTaskMonitor *q)
+{
+    Q_UNUSED(q);
+}
+
+QList< QSharedPointer<TsTask> > TsTaskMonitorPrivate::taskList()
+{
+    return QList< QSharedPointer<TsTask> >();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/inc/tstaskmonitorglobals.h	Thu May 27 13:11:12 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 RUNNINGAPPGLOBALS_H
+#define RUNNINGAPPGLOBALS_H
+
+#include <e32base.h>
+
+_LIT(KRunningAppServerName, "hsrunningappmonitor");
+const TUid KRunningAppServerUid = {0x200267B0};
+const TInt KRequestDataSizeOffset(0); 
+const TInt KRequestDataBufferOffset(0);
+
+enum RunningAppCmd {
+    GetRunningAppInfo =0,
+    SubscribeRunningAppChanges,
+    UpdateScreenshot,
+    FlushData,
+    CancelSubscribeRunningAppChanges,
+};
+
+enum UpdatePriority {
+    Low = 0,
+    Normal,
+    High
+};
+#endif  //RUNNINGAPPGLOBALS_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/rom.pri	Thu May 27 13:11:12 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/tstaskmonitor/rom/tstaskmonitor_core.iby	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#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
+
+// 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/tstaskmonitor/server/group/bld.inf	Thu May 27 13:11:12 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
+hsrunningappmonitor.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/server/group/hsrunningappmonitor.mmp	Thu May 27 13:11:12 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:
+*
+*/
+TARGET          hsrunningappmonitor.exe
+TARGETTYPE      exe
+UID             0 0x200267B0
+
+SYSTEMINCLUDE   /epoc32/include
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../inc
+USERINCLUDE     ../../utils/inc
+SYSTEMINCLUDE   /epoc32/include
+SYSTEMINCLUDE   /epoc32/include/mw
+SYSTEMINCLUDE   /epoc32/include/platform/mw
+SYSTEMINCLUDE   /epoc32/include/platform 
+
+SOURCEPATH      ../src
+SOURCE          main.cpp
+SOURCE          hsrunningappserver.cpp
+SOURCE          hsrunningappsession.cpp
+SOURCE          hsdataobservertask.cpp
+SOURCE          hsdataprovidertask.cpp
+
+SOURCE          tsrunningappstorage.cpp
+SOURCE          tsfswdatalist.cpp
+SOURCE          tsfswengine.cpp
+SOURCE          tsfswmonitor.cpp
+
+SOURCEPATH      ../../utils/src
+SOURCE          tsfswentry.cpp
+
+
+LIBRARY        euser.lib 
+LIBRARY        estor.lib
+LIBRARY eikcore.lib
+LIBRARY cone.lib
+LIBRARY ws32.lib
+LIBRARY        efsrv.lib
+LIBRARY        fbscli.lib
+LIBRARY avkon.lib
+LIBRARY apgrfx.lib
+LIBRARY flogger.lib
+
+LIBRARY apparc.lib
+LIBRARY ws32.lib
+LIBRARY apgrfx.lib
+LIBRARY fbscli.lib
+LIBRARY bitgdi.lib
+LIBRARY aknicon.lib
+LIBRARY aknskins.lib
+LIBRARY egul.lib
+LIBRARY featmgr.lib
+LIBRARY bitmaptransforms.lib
+CAPABILITY     ALL -TCB
+EPOCHEAPSIZE   0x100000 0x600000 // 1MB - 6MB
+
+#ifdef ENABLE_ABIV2_MODE
+DEBUGGABLE_UDEBONLY
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/server/inc/hsdataobserver.h	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef DATAOBSERVER_H
+#define DATAOBSERVER_H
+
+#include <e32base.h>
+
+class MHsDataObserver {
+public:
+    virtual void DataChanged() =0;
+};
+
+class CHsDataObserver: public CBase,
+                       public MHsDataObserver
+{
+public:
+    virtual void Cancel(const RMessage2& reason) =0;
+};
+
+class MHsDataObserverStorage
+{
+public:
+    virtual void PushL(CHsDataObserver*) =0;
+    virtual void Pop(CHsDataObserver*) =0;
+    virtual void Cancel(const RMessage2& reason) =0;
+};
+
+#endif //DATAOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/server/inc/hsdataobservertask.h	Thu May 27 13:11:12 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 DATAOBSERVERTASK_H
+#define DATAOBSERVERTASK_H
+#include "hsdataobserver.h"
+#include <e32base.h>
+class CHsDataObserverTask: public CHsDataObserver
+{
+public:
+    ~CHsDataObserverTask();
+    static void ExecuteLD(MHsDataObserverStorage& storage,const RMessage2& msg);
+
+private:
+    CHsDataObserverTask(MHsDataObserverStorage& storage, const RMessage2& msg);
+    void DataChanged();
+    void Cancel(const RMessage2& reason);
+
+private:
+    MHsDataObserverStorage& mStorage;
+    const RMessage2 mMsg;
+    TBool mDataChanged;
+};
+#endif //DATAOBSERVERTASK_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/server/inc/hsdataprovider.h	Thu May 27 13:11:12 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 DATAPROVIDR_H
+#define DATAPROVIDR_H
+
+#include <e32base.h>
+
+class MHsDataProvider {
+public:
+    virtual const TDesC8& Data() const = 0;
+};
+
+#endif //DATAPROVIDR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/server/inc/hsdataprovidertask.h	Thu May 27 13:11:12 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 "hsdataprovider.h"
+
+class HsDataProviderTask {
+public:
+    static void ExecuteL(const MHsDataProvider& provider, const RMessage2& msg);
+};
+
+#endif //DATAPROVIDER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/server/inc/hsrunningappserver.h	Thu May 27 13:11:12 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:
+*
+*/
+#ifndef RUNNINGAPPSERVER_H
+#define RUNNINGAPPSERVER_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+#include "hsdataobserver.h"
+
+class CRunningAppStorage;
+/**
+ *  CRunningAppServer
+ * 
+ */
+class CRunningAppServer : public CServer2,
+                          public MHsDataObserver,
+                          public MHsDataObserverStorage
+{
+public:
+    /**
+     * Destructor.
+     */
+    ~CRunningAppServer();
+
+    /**
+     * Two-phased constructor.
+     */
+    static CRunningAppServer* NewLC();
+    
+public: //MHsDataObserver
+    void DataChanged();
+    
+public: //MHsDataObserverStorage
+    void PushL(CHsDataObserver*);
+    void Pop(CHsDataObserver*);
+    void Cancel(const RMessage2&);
+
+private:
+    /**
+     * Constructor for performing 1st stage construction
+     */
+    CRunningAppServer();
+
+    /**
+     * Default constructor for performing 2nd stage construction
+     */
+    void ConstructL();
+
+    /**
+     * Interface implementation
+     * @see CServer2::NewSessionL(const TVersion&, const RMessage2&)
+     */
+    CSession2* NewSessionL(const TVersion& version, const RMessage2& message) const;
+private:
+    RPointerArray<CHsDataObserver> mObservers;
+    CRunningAppStorage* mStorage;
+};
+
+#endif // RUNNINGAPPSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/server/inc/hsrunningappsession.h	Thu May 27 13:11:12 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:
+*
+*/
+#ifndef RUNNINGAPPSESSION_H
+#define RUNNINGAPPSESSION_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include "hsdataobserver.h"
+#include "hsdataprovider.h"
+/**
+ *  CActivitySession
+ * 
+ */
+class CRunningAppSession : public CSession2
+{
+public:
+    // Constructors and destructor
+
+    /**
+     * Destructor.
+     */
+    ~CRunningAppSession();
+
+    /**
+     * Two-phased constructor.
+     * @param fileSession - initialized file system session
+     * @param taskStorage - global observers storage
+     * @param storage - data storage
+     */
+    static CRunningAppSession* NewL(MHsDataObserverStorage& observerStorage, 
+                                    const MHsDataProvider& dataProvider);
+
+private:
+
+    /**
+     * Constructor for performing 1st stage construction
+     */
+    CRunningAppSession(MHsDataObserverStorage& observerStorage, 
+                       const MHsDataProvider& dataProvider);
+
+    /**
+     * EPOC default constructor for performing 2nd stage construction
+     */
+    void ConstructL();
+
+private:
+    /**
+     * Implements interface
+     * @see void CSession2::ServiceL(const RMessage2&)
+     */
+    void ServiceL(const RMessage2& message);
+
+private:
+    MHsDataObserverStorage& mObserverStorage;
+    const MHsDataProvider& mDataProvider;
+};
+
+#endif // RUNNINGAPPSESSION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/server/inc/tsfswdatalist.h	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,256 @@
+/*
+* 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 TSFSWDATALIST_H
+#define TSFSWDATALIST_H
+
+#define __E32SVR_H__
+#include <e32event.h>
+#include <f32file.h>
+
+#include <e32base.h>
+#include <e32hashtab.h>
+#include <fbs.h>
+#include <apgcli.h>
+#include <w32std.h>
+#include "tsfswentry.h"
+#include "tsfswobservers.h"
+
+class CTsFswEngine;
+class CTsFswIconCache;
+class CApaWindowGroupName;
+class CFbsBitmap;
+
+/**
+ * Engine's data list.
+ */
+NONSHARABLE_CLASS( CTsFswDataList ) : public CBase
+    {
+public:
+    /**
+     * Two-phased constructor.
+     *
+     * @param aParent
+     */
+    static CTsFswDataList* NewL( CTsFswEngine& aEngine );
+
+    /*
+     * Destructor
+     */
+    ~CTsFswDataList();
+
+private:
+    /**
+     * Constructor.
+     */
+    CTsFswDataList( CTsFswEngine& aEngine );
+
+    /**
+     * Performs 2nd phase construction.
+     */
+    void ConstructL();
+
+public:
+    /**
+     * Returns a reference to the current content.
+     * Also performs sanity checks, e.g. associates application icons
+     * when no screenshot has been received.
+     * @return  ref to content array
+     */
+    const RTsFswArray& FswDataL();
+
+    /**
+     * Gets the window group list and reconstructs the fsw content.
+     * @return   TBool   ETrue if the content iData has been modified
+     */
+    TBool CollectTasksL();
+
+
+    /**
+     * Set flag iTaskListDirty;
+     */
+    void SetDirty();
+
+    /**
+     * Set flag iAppDataRefreshNeeded
+     */
+    void SetAppDataRefreshNeeded();
+
+
+    /**
+     * Moves entry on given window app/widget id to 
+     * the first position on conten data list
+     */
+    void MoveEntryAtStart( TInt aAppId, TBool aWidget );
+    
+    
+    /**
+     * Finds out the app uid for the given window group id.
+     * @param   aWgId   a valid window group id
+     * @param   aUid   	requested uid
+     * @return  error code
+     */
+    TInt AppUidForWgId( TInt aWgId, TUid& aUid );
+    
+    /**
+     * Finds out the app uid for the given window group id.
+     * @param   aWgId   a valid window group id
+     * @return  application uid
+     */
+    TUid AppUidForWgIdL( TInt aWgId );
+    
+    /**
+     * Checks if given uid is on hidden list
+     * @param   aUid uid to be checked
+     * @return  ETrue if aUid is on hidden list
+     */    
+    TBool IsHiddenUid( TUid aUid );
+
+private:
+    /**
+     * Adds running apps to the list.
+     * @param   aAppsList    array to add to
+     */
+    void CollectAppsL( RTsFswArray& aAppsList );
+
+    /**
+     * Called from CollectTasksL for each entry in the task list.
+     * @param   aWgId       window group id
+     * @param   aAppUid     application uid
+     * @param   aWgName     window group name or NULL
+     * @param   aNewList    list to add to
+     * @param   aIsWidget   true if the entry corresponds to a web widget
+     * @return  TBool   ETrue if it was really a new entry in the list
+     */
+    TBool AddEntryL( TInt aWgId, 
+			const TUid& aAppUid,
+            CApaWindowGroupName* aWgName,
+			RTsFswArray& aNewList,
+            TBool aIsWidget );
+
+    /**
+     * Checks if there is an entry for same app in the content list.
+     * If yes then it takes some of the data for the entry that
+     * will correspond to the same app in the refreshed content list.
+     * In case of widget, update window group field in content list.
+     * @param   aEntry      new entry in content list
+     * @param   aAppUid     application uid
+     * @param   aChanged    ref to change-flag, set to ETrue if it is sure
+     * that the new content list will be different from the previous one
+     * @param   aNewList    ref to new content list
+     * @return  ETrue if app was found
+     */
+    TBool ConsiderOldDataL( CTsFswEntry& aEntry,
+        const TUid& aAppUid,
+        TBool& aChanged,
+        RTsFswArray& aNewList );
+
+    /**
+     * Adds running widgets to the list.
+     * @param   aWidgetsList    array to add to
+     */
+    void CollectWidgetsL( RTsFswArray& aWidgetsList );
+
+    /**
+     * Returns the parent's wg id or KErrNotFound.
+     * @param   aWgId   a valid window group id
+     * @return parent wg id or KErrNotFound if there is no parent
+     */
+    TInt FindParentWgId( TInt aWgId );
+
+    /**
+     * Returns the most top parent's wg id or KErrNotFound.
+     * @param   aWgId   a valid window group id
+     * @return parent wg id or KErrNotFound if there is no parent
+     */
+    TInt FindMostTopParentWgId( TInt aWgId );
+
+    /**
+     * 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* FindAppNameLC( CApaWindowGroupName* aWindowName,
+            	const TUid& aAppUid,
+				TInt aWgId );
+
+
+    /**
+     * 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 
+     * @param   aConsiderWidgets    application type 
+     * @return  ETrue if change occours on data list, EFalse otherwise   
+     */
+    TBool FitDataToListL( RTsFswArray& aListToFit, TBool aConsiderWidgets );
+
+    /**
+     * Checks if there is an entry for same app in the given list.
+     * @param   aEntry      entry
+     * @param   aNewList    ref to list
+     * @return  ETrue if app was found
+     */
+    TBool CheckIfExists( const CTsFswEntry& aEntry,
+            const RTsFswArray& aNewList ) const;
+            
+    /**
+     * Retrieves the bitmap/mask for the icon of the given app.
+     * @param   aAppUid application uid
+     * @param   aBitmap bitmap ptr, ownership transferred to caller, or NULL
+     * @param   aMask   mask ptr, ownership transferred to caller, or NULL
+     */
+    void GetAppIconL( const TUid& aAppUid,
+        CFbsBitmap*& aBitmap, CFbsBitmap*& aMask );            
+    
+
+private:
+    CTsFswEngine& iEngine;
+
+    RTsFswArray iData; // current fsw content, i.e. the task list
+
+    // window server session
+    RWsSession iWsSession;
+
+    // apparc session
+    RApaLsSession iAppArcSession;
+
+
+
+
+    // when true CollectTasksL will call GetAllApps etc.
+    // which is slow and need not be done normally, except
+    // during startup and perhaps when new applications are installed
+    TBool iAppDataRefreshNeeded;
+
+    // Dirty flag, indicates that iData is not up-to-date because
+    // there were no subscribed clients during a previous possible
+    // change of the task list.
+    TBool iTaskListDirty;
+    
+    // if ETrue application order has been changed
+    TBool iOrderChanged;
+    
+    // list of hidden uids
+    RArray<TUid> iHiddenUids;
+    };
+
+#endif //TSFSWDATALIST_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/server/inc/tsfswengine.h	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,178 @@
+/*
+* 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 monitor engine
+ *
+*/
+
+
+#ifndef TSFSWENGINE_H
+#define TSFSWENGINE_H
+
+#define __E32SVR_H__
+
+#include <e32event.h>
+
+#include <e32base.h>
+#include <e32cmn.h>
+#include <s32strm.h>
+#include <fbs.h>
+#include <eikenv.h>
+#include <w32std.h>
+#include <e32hashtab.h>
+#include <apgcli.h>
+#include <e32property.h>
+#include "tsfswentry.h"
+#include "tsfswobservers.h"
+#include "hsdataprovider.h"
+#include "hsdataobserver.h"
+
+class MTsFswEngineObserver;
+class CTsFastSwapPreviewProvider;
+class CApaWindowGroupName;
+class CBitmapRotator;
+class CTsRotationTask;
+class CTSCpsNotifier;
+
+class CTsFswDataList;
+
+// descriptor big enough to store hex repr of 32-bit integer plus 0x prefix
+typedef TBuf<10> TAppUidHexString;
+
+/**
+ * Engine for fast swap server.
+ * Performs task monitoring, notifications about wg changes are
+ * received from the appui.
+ */
+NONSHARABLE_CLASS( CTsFswEngine ) : public CBase,
+        public MTsFswTaskListObserver
+
+    {
+    enum TTsFswFgAppType
+        {
+        /**
+         * Means that even when the foreground app has another app embedded
+         * into it the uid of the container application will be returned.
+         */
+        EUseStandaloneUid,
+        /**
+         * Means that if the foreground app has another app embedded
+         * into it then the returned uid will be the uid of the embedded
+         * app.
+         */
+        EUseEmbeddedUid
+        };
+    
+public:
+    /**
+     * Creates a new instance.
+     * @param   aObserver   ref to observer
+     */
+    static CTsFswEngine* NewL( MHsDataObserver& aObserver );
+
+    /**
+     * @copydoc NewL
+     */
+    static CTsFswEngine* NewLC( MHsDataObserver& aObserver );
+
+    /**
+     * Destructor.
+     */
+    ~CTsFswEngine();
+
+    /**
+     * Returns a reference to the current content.
+     * Also performs sanity checks, e.g. associates application icons
+     * when no screenshot has been received.
+     * @return  ref to content array
+     */
+    const RTsFswArray& FswDataL();
+
+
+
+
+private:
+
+    // from MTsFswTaskListObserver
+    void UpdateTaskList();
+
+
+
+private:
+    /**
+     * Constructor.
+     */
+    CTsFswEngine( MHsDataObserver& aObserver );
+
+    /**
+     * Performs 2nd phase construction.
+     */
+    void ConstructL();
+
+    /**
+     * Gets the window group list and reconstructs the fsw content.
+     * @return   TBool   ETrue if the list has been modified
+     */
+    TBool CollectTasksL();
+
+
+    /**
+     * Callback for the iUpdateStarter timer.
+     * Calls CollectTasksL and notifies the observer if the task list
+     * has really been modified.
+     */
+    static TInt UpdateStarterCallback( TAny* aParam );
+
+    /**
+     * Returns the uid of the foreground app or KNullUid.
+     * Will never return hidden apps, only those which can
+     * also be seen in the array returned by FswDataL.
+     *
+     * In case of embedded apps the behaviour is controlled
+     * by aType: it will return either the uid of the embedded
+     * application or the container app.
+     *
+     * @param   aType   @see CTsFswClient::TTsFswFgAppType
+     */
+    TUid ForegroundAppUidL( TInt aType );
+    
+    /**
+     * Gets and publishes the foreground app uid to CFW.
+     */
+    void PublishFgAppUidL();
+
+private:
+    // data    
+    MHsDataObserver& iObserver;
+
+    // window server session
+    RWsSession iWsSession;
+
+    // apparc session
+    RApaLsSession iAppArcSession;
+
+    // timer to defer content refresh
+    CPeriodic* iUpdateStarter;
+
+
+    // window group ids returned by last WindowGroupList call
+    RArray<TInt> iWgIds;
+  
+    TUid iFgAppUid;
+
+
+    CTsFswDataList* iDataList;//own
+
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/server/inc/tsfswmonitor.h	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,69 @@
+/*
+* 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:  Monitor for server
+ *
+*/
+
+
+#ifndef TSFSWMONITOR_H
+#define TSFSWMONITOR_H
+#define __E32SVR_H__
+
+#include <e32event.h>
+#include <e32debug.h>
+#include <w32std.h>
+
+class MTsFswTaskListObserver;
+class MTsFswResourceObserver;
+
+/**
+ * Monitor for the fsw server.
+ * Reimplements HandleWsEventL from base class to get notifications about
+ * window group changes.
+ */
+class CTsFswMonitor : public CActive
+    {
+public:
+    ~CTsFswMonitor();
+    
+    
+
+static CTsFswMonitor* NewL(MTsFswTaskListObserver& aTaskListObserver);
+static CTsFswMonitor* NewLC(MTsFswTaskListObserver& aTaskListObserver);
+
+protected:
+    CTsFswMonitor(MTsFswTaskListObserver& aTaskListObserver);
+    void ConstructL();
+    
+    // from CActive
+    void RunL();
+    TInt RunError( TInt aError );
+    void DoCancel();
+
+
+private:
+    void Subscribe();        
+    void ConstractObserverL();
+private:
+    MTsFswTaskListObserver* iTaskListObserver; // not own
+    
+    // window server session
+    RWsSession iWsSession;
+    /**
+       * Window group.
+       */
+   RWindowGroup iWg;
+    };
+
+#endif //TSFSWMONITOR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/server/inc/tsfswobservers.h	Thu May 27 13:11:12 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:  Observer interfaces to get notifications from appui and from engine
+ *
+*/
+
+
+#ifndef TSFSWOBSERVERS_H
+#define TSFSWOBSERVERS_H
+
+/**
+ * Interface to get notifications from appui when window groups
+ * have changed.
+ */
+class MTsFswTaskListObserver
+    {
+public:
+    /**
+     * Function called by AppUi to notify about possible
+     * changes in task list
+     */
+    virtual void UpdateTaskList() = 0;
+    };
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/server/inc/tsrunningappstorage.h	Thu May 27 13:11:12 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 RUNNINGAPPSTORAGE_H
+#define RUNNINGAPPSTORAGE_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+#include "hsdataobserver.h"
+#include "hsdataprovider.h"
+
+class CTsFswEngine;
+class CTsFswMonitor;
+/**
+ *  CRunningAppServer
+ * 
+ */
+class CRunningAppStorage : public CBase,
+                           public MHsDataProvider, 
+                           public MHsDataObserver
+                          
+{
+public:
+    /**
+     * Destructor.
+     */
+    ~CRunningAppStorage();
+
+    /**
+     * Two-phased constructor.
+     */
+    static CRunningAppStorage* NewL(MHsDataObserver& observer);
+    
+public: //MHsDataObserver
+    const TDesC8& Data() const; 
+    
+    //MHsDataChangeProvider
+    void DataChanged();
+
+private:
+    /**
+     * Constructor for performing 1st stage construction
+     */
+    CRunningAppStorage(MHsDataObserver& observer);
+
+    /**
+     * Default constructor for performing 2nd stage construction
+     */
+    void ConstructL();
+    
+    void DataChangedL();
+
+private:
+    MHsDataObserver& mObserver;
+    RBuf8 mData;
+    
+    CTsFswEngine* mEngine;
+    CTsFswMonitor* mMonitor;
+
+};
+
+#endif // RUNNINGAPPSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/server/server.pro	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,20 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+TEMPLATE = subdirs
+
+BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include \"group/bld.inf\""
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/server/src/hsdataobservertask.cpp	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,78 @@
+/*
+* 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 "hsdataobservertask.h"
+#include "tstaskmonitorglobals.h"
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CHsDataObserverTask::CHsDataObserverTask(MHsDataObserverStorage& storage, 
+                                         const RMessage2& msg)
+:
+    mStorage(storage),
+    mMsg(msg)
+{
+    // No implementation required
+}
+
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CHsDataObserverTask::~CHsDataObserverTask()
+{
+    if (EFalse == mMsg.IsNull()) {
+        mMsg.Complete(mDataChanged ? KErrNone : KErrCancel);
+    }
+}
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CHsDataObserverTask::ExecuteLD(MHsDataObserverStorage& storage,const RMessage2& msg)
+{
+    CHsDataObserver *self = new (ELeave)CHsDataObserverTask(storage, msg);
+    CleanupStack::PushL(self);
+    storage.PushL(self);
+    CleanupStack::Pop(self);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CHsDataObserverTask::DataChanged()
+{
+    mDataChanged = ETrue;
+    mStorage.Pop(this);
+    delete this; 
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CHsDataObserverTask::Cancel(const RMessage2& reason)
+{
+    if (CancelSubscribeRunningAppChanges == reason.Function() &&
+        mMsg.Session() == reason.Session()) {
+        mStorage.Pop(this);
+        delete this;
+   }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/server/src/hsdataprovidertask.cpp	Thu May 27 13:11:12 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 "hsdataprovidertask.h"
+#include "tstaskmonitorglobals.h"
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void HsDataProviderTask::ExecuteL(const MHsDataProvider& provider, const RMessage2& msg)
+{
+    switch (msg.Function()) {
+    case GetRunningAppInfo:
+        msg.WriteL(KRequestDataSizeOffset, TPckgBuf<TInt>(provider.Data().Length()));
+        msg.Complete(KErrNone);
+        break;
+    
+    case FlushData:
+        if (provider.Data().Length() > msg.GetDesMaxLengthL(KRequestDataBufferOffset)) {
+            User::Leave(KErrCorrupt);
+        }
+        msg.WriteL(KRequestDataBufferOffset, provider.Data());
+        msg.Complete(KErrNone);
+        break;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/server/src/hsrunningappserver.cpp	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,120 @@
+/*
+* 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 "hsrunningappserver.h"
+#include "hsrunningappsession.h"
+#include "tsrunningappstorage.h"
+
+_LIT(KErrObserverExists, "Observer already exists");
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CRunningAppServer::CRunningAppServer()
+:
+CServer2(EPriorityStandard)
+{
+    // No implementation required
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CRunningAppServer::~CRunningAppServer()
+{
+    delete mStorage;
+    mObservers.ResetAndDestroy();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CRunningAppServer* CRunningAppServer::NewLC()
+{
+    CRunningAppServer* self = new (ELeave) CRunningAppServer();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CRunningAppServer::ConstructL()
+{
+    StartL(KRunningAppServerName);
+    mStorage = CRunningAppStorage::NewL(*this);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CSession2* CRunningAppServer::NewSessionL(const TVersion &, const RMessage2&) const
+{
+    return CRunningAppSession::NewL(*const_cast<CRunningAppServer *>(this),
+                                    *const_cast<CRunningAppServer *>(this)->mStorage);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CRunningAppServer::DataChanged()
+{
+    while (0 < mObservers.Count()) {
+        mObservers[0]->DataChanged();
+    }
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CRunningAppServer::PushL(CHsDataObserver* observer)
+{
+    ( 0 <= mObservers.Find(observer)) ?
+    User::Panic(KErrObserverExists, KErrAlreadyExists) :
+    mObservers.AppendL(observer);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CRunningAppServer::Pop(CHsDataObserver* observer)
+{
+    const TInt offset(mObservers.Find(observer));
+    if(0 <= offset) {
+        mObservers.Remove(offset);
+    }
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CRunningAppServer::Cancel(const RMessage2& reason)
+{
+    for (TInt iter(mObservers.Count() - 1); 0 <= iter; --iter) {
+        mObservers[iter]->Cancel(reason);
+    }
+    reason.Complete(KErrNone);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/server/src/hsrunningappsession.cpp	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,89 @@
+/*
+* 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 "hsrunningappsession.h"
+#include "tstaskmonitorglobals.h"
+
+#include "hsdataobservertask.h"
+#include "hsdataprovidertask.h"
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CRunningAppSession::CRunningAppSession(MHsDataObserverStorage& observerStorage,
+                                       const MHsDataProvider& dataProvider)
+:
+    mObserverStorage(observerStorage),
+    mDataProvider(dataProvider)
+{
+    // No implementation required
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CRunningAppSession::~CRunningAppSession()
+{
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CRunningAppSession* CRunningAppSession::NewL(MHsDataObserverStorage& observerStorage, 
+                                             const MHsDataProvider& dataProvider)
+{
+    CRunningAppSession* self = new (ELeave) CRunningAppSession(observerStorage, dataProvider);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CRunningAppSession::ConstructL()
+{
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CRunningAppSession::ServiceL(const RMessage2& message)
+{
+    switch (message.Function()) {
+    case SubscribeRunningAppChanges:
+        CHsDataObserverTask::ExecuteLD(mObserverStorage, message);
+        break;
+    
+    case CancelSubscribeRunningAppChanges:
+        mObserverStorage.Cancel(message);
+        break;
+    
+    case GetRunningAppInfo:
+    case FlushData:
+        HsDataProviderTask::ExecuteL(mDataProvider, message);
+        break;
+    
+    default:
+        message.Complete(CServer2::EBadMessageNumber);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/server/src/main.cpp	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "hsrunningappserver.h"
+#include <e32base.h>
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LOCAL_C void StartRunningAppServerL()
+{
+    CActiveScheduler* activeScheduler = new( ELeave ) CActiveScheduler;
+    CleanupStack::PushL( activeScheduler );
+    CActiveScheduler::Install( activeScheduler );
+    CServer2* serverObject = CRunningAppServer::NewLC();
+    RProcess::Rendezvous( KErrNone );
+    CActiveScheduler::Start();
+    CleanupStack::PopAndDestroy( serverObject );
+    CleanupStack::PopAndDestroy( activeScheduler );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LOCAL_C TInt StartRunningAppServer()
+{
+    __UHEAP_MARK;
+    TInt errNo(KErrNoMemory);
+    CTrapCleanup* cleanupStack = CTrapCleanup::New();
+    if (cleanupStack) {
+        TRAP(errNo, StartRunningAppServerL());
+        delete cleanupStack;
+    }
+    __UHEAP_MARKEND;
+    if (KErrNone != errNo) {
+        RProcess::Rendezvous(errNo);
+    }
+    return errNo;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+TInt E32Main()
+{
+    return StartRunningAppServer();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/server/src/tsfswdatalist.cpp	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,570 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  File containing application list classes
+ *
+*/
+
+
+//INCLUDES:
+#define __E32SVR_H__
+#include "tsfswdatalist.h"
+#include "tsfswengine.h"
+#include <mmf/common/mmfcontrollerpluginresolver.h> // for CleanupResetAndDestroyPushL
+#include <featmgr.h>
+#include <apgwgnam.h>
+#include <AknsUtils.h>
+#include <gulicon.h>
+#include <e32debug.h>
+#include <bitstd.h>
+#include <AknIconUtils.h> // avkon
+#include <APGICNFL.H> // fbsbitmap
+#include <akniconsrvclient.h> 
+
+// size for the created app icons
+const TInt KAppIconWidth = 128;
+const TInt KAppIconHeight = 128;
+
+//uids to be hidden
+const TUid KHsApplicationUid = {0x20022F35};
+const TUid KTelephoneUid = {0x100058B3};
+
+// ================= MEMBER FUNCTIONS =======================
+
+// --------------------------------------------------------------------------
+// CTsFswDataList::NewL
+// --------------------------------------------------------------------------
+//
+CTsFswDataList* CTsFswDataList::NewL(CTsFswEngine& aEngine)
+    {
+    CTsFswDataList* self = new (ELeave) CTsFswDataList(aEngine);
+    CleanupStack::PushL (self );
+    self->ConstructL ( );
+    CleanupStack::Pop ( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswDataList::CTsFswDataList
+// --------------------------------------------------------------------------
+//
+CTsFswDataList::CTsFswDataList(CTsFswEngine& aEngine) :
+    iEngine(aEngine)
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswDataList::~CTsFswDataList
+// --------------------------------------------------------------------------
+//
+CTsFswDataList::~CTsFswDataList( )
+    {
+    iData.ResetAndDestroy();
+    iAppArcSession.Close();
+    iWsSession.Close();
+    iHiddenUids.Close();
+    RFbsSession::Disconnect();
+    RAknIconSrvClient::Disconnect();
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswDataList::ConstructL
+// --------------------------------------------------------------------------
+//
+void CTsFswDataList::ConstructL( )
+    {
+    User::LeaveIfError( iWsSession.Connect() );
+    User::LeaveIfError( iAppArcSession.Connect() );
+    iHiddenUids.AppendL( KHsApplicationUid );
+    iHiddenUids.AppendL( KTelephoneUid );
+    User::LeaveIfError(RFbsSession::Connect());
+    RAknIconSrvClient::Connect();
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswDataList::FswDataL
+// --------------------------------------------------------------------------
+//
+const RTsFswArray& CTsFswDataList::FswDataL()
+    {
+    // check the dirty flag and refresh if needed
+    if ( iTaskListDirty )
+        {
+        CollectTasksL();
+        // dirty flag is cleared in the above call
+        }
+
+    return iData;
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswDataList::CollectTasksL
+// --------------------------------------------------------------------------
+//
+TBool CTsFswDataList::CollectTasksL()
+    {
+    // clear dirty flag
+    iTaskListDirty = EFalse;
+    TBool changed = EFalse;
+    
+    RTsFswArray newAppsList;
+    
+    CleanupResetAndDestroyPushL(newAppsList);
+    
+    CollectAppsL(newAppsList);
+    
+    changed |= FitDataToListL(newAppsList, EFalse);
+    
+    CleanupStack::PopAndDestroy( &newAppsList );
+    
+    return changed;
+    }
+
+
+// --------------------------------------------------------------------------
+// CTsFswDataList::SetDirty()
+// --------------------------------------------------------------------------
+//
+void CTsFswDataList::SetDirty()
+    {
+    iTaskListDirty = ETrue;
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswDataList::SetAppDataRefreshNeeded()
+// --------------------------------------------------------------------------
+//
+void CTsFswDataList::SetAppDataRefreshNeeded()
+    {
+    iAppDataRefreshNeeded = ETrue;
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswDataList::MoveEntryAtStart
+// --------------------------------------------------------------------------
+//
+void CTsFswDataList::MoveEntryAtStart(TInt aAppId, TBool /*aWidget*/)
+    {
+    TInt appId(0);
+    //check embeded case
+
+    TInt wgId(0);
+    CApaWindowGroupName::FindByAppUid(TUid::Uid(aAppId), iWsSession, wgId);
+    TInt parentWgId = FindMostTopParentWgId( wgId );
+    if( parentWgId != KErrNotFound )
+        {
+        TUid appUid = TUid::Uid(0);
+        AppUidForWgId(parentWgId, appUid); 
+        appId = appUid.iUid;
+        }
+
+    
+    if( !appId )
+    	{
+		appId = aAppId;
+    	}
+    
+    for ( TInt i = 0; i < iData.Count(); ++i )
+       {
+       if( iData[i]->AppUid().iUid == appId )
+           {
+           CTsFswEntry* entry = iData[i];
+           iData.Remove(i);
+           iData.Insert(entry, 0);
+           iOrderChanged = ETrue;
+           break;
+           }
+       }
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswDataList::
+// --------------------------------------------------------------------------
+//
+void CTsFswDataList::CollectAppsL(RTsFswArray& aAppsList)
+    {
+
+    
+    // update app data if needed
+    // (usually on startup and when new apps might have been installed)
+    if ( iAppDataRefreshNeeded )
+        {
+
+        iAppArcSession.GetAllApps();
+        iAppDataRefreshNeeded = EFalse;
+        }
+
+    // get all window groups
+    RArray<RWsSession::TWindowGroupChainInfo> allWgIds;
+    CleanupClosePushL( allWgIds );
+    User::LeaveIfError( iWsSession.WindowGroupList( 0, &allWgIds ) );
+
+    TInt count = allWgIds.Count();
+    for ( TInt i = 0; i < count; ++i )
+        {
+        // ignore uninteresting entries (e.g. embedded apps)
+        if ( allWgIds[i].iParentId > 0 )
+            {
+            continue;
+            }
+        
+        // get window group name
+        TInt wgId = allWgIds[i].iId;
+        CApaWindowGroupName* windowName =
+            CApaWindowGroupName::NewLC( iWsSession, wgId );
+        TUid appUid = windowName->AppUid();
+        
+        // ignore entries with null uid
+        if ( !appUid.iUid )
+            {
+            CleanupStack::PopAndDestroy( windowName );
+            continue;
+            }
+
+        // add item to task list if it is not hidden
+        if ( !windowName->Hidden() && !IsHiddenUid(appUid) )
+            {
+            AddEntryL(wgId, appUid, windowName, aAppsList, EFalse);
+            }
+        CleanupStack::PopAndDestroy( windowName );
+        }
+    CleanupStack::PopAndDestroy( &allWgIds );
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswDataList::AddEntryL
+// --------------------------------------------------------------------------
+//
+TBool CTsFswDataList::AddEntryL( TInt aWgId, const TUid& aAppUid,
+        CApaWindowGroupName* aWgName, RTsFswArray& aNewList,
+        TBool /*aIsWidget*/ )
+    {
+    TBool changed = EFalse;
+    CTsFswEntry* entry = CTsFswEntry::NewLC();
+    entry->SetWgId( aWgId );
+    entry->SetAppUid( aAppUid );
+
+    // check if present in old list and if yes then take some of the old data
+    TBool found = ConsiderOldDataL( *entry, aAppUid, changed, aNewList );
+
+    // if not present previously then find out app name
+    // and check if screenshot is already available
+    if ( !found )
+        {
+        // when adding a new entry to the list it is changed for sure
+        changed = ETrue;
+        HBufC* name = FindAppNameLC( aWgName, aAppUid, aWgId );
+        if ( name )
+            {
+            entry->SetAppNameL( *name );
+            }
+        CleanupStack::PopAndDestroy( name );
+
+        if ( aWgName )
+            {
+            entry->SetCloseableApp( !aWgName->IsSystem() );
+            }
+        CFbsBitmap* iconBitmap = NULL;
+        CFbsBitmap* iconMask = NULL;
+        GetAppIconL(aAppUid, iconBitmap, iconMask);    
+        //transfer ownership to entry
+        entry->SetAppIcon( iconBitmap, iconMask );        
+        }        
+
+    // add to new list, ownership is transferred
+    aNewList.AppendL( entry );
+    CleanupStack::Pop( entry );
+    return changed;
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswDataList::ConsiderOldDataL
+// --------------------------------------------------------------------------
+//
+TBool CTsFswDataList::ConsiderOldDataL( CTsFswEntry& aEntry,
+        const TUid& aAppUid,
+        TBool& aChanged,
+        RTsFswArray& aNewList )
+    {
+    for ( TInt entryIdx = 0, oldCount = iData.Count();
+            entryIdx < oldCount; ++entryIdx )
+        {
+        // Enough to check appuid, no need to bother with wgid as the
+        // screenshot handle is up-to-date or will be updated later anyway.
+        if ( iData[entryIdx]->AppUid() == aAppUid )
+            {
+            iData[entryIdx]->SetWgId( aEntry.WgId());
+            // if positions do not match then the list is different than before
+            if ( entryIdx != aNewList.Count() )
+                {
+                aChanged = ETrue;
+                }
+            CTsFswEntry* oldEntry = iData[entryIdx];
+            aEntry.SetAppNameL( oldEntry->AppName() );            
+            aEntry.SetCloseableApp( oldEntry->CloseableApp() );
+            return ETrue;
+            }
+        }
+    return EFalse;
+    }
+
+
+// --------------------------------------------------------------------------
+// CTsFswDataList::FindParentWgId
+// --------------------------------------------------------------------------
+//
+TInt CTsFswDataList::FindParentWgId( TInt aWgId )
+    {
+    TInt parent( KErrNotFound );
+    RArray<RWsSession::TWindowGroupChainInfo> allWgIds;
+    // Ask for window group list from RWsSession
+    TInt error = iWsSession.WindowGroupList( 0, &allWgIds );
+    if ( !error )
+        {
+        TInt count( allWgIds.Count() );
+        for ( TInt i( 0 ); i < count; i++ )
+            {
+            RWsSession::TWindowGroupChainInfo info = allWgIds[i];
+            if ( info.iId == aWgId && info.iParentId > 0)
+                {
+                parent = info.iParentId;
+                break;
+                }
+            }
+        }
+    allWgIds.Close();
+    return parent;
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswDataList::FindMostTopParentWgId
+// --------------------------------------------------------------------------
+//
+TInt CTsFswDataList::FindMostTopParentWgId( TInt aWgId )
+    {
+    TInt parent( KErrNotFound );
+    parent = FindParentWgId( aWgId );
+    if( parent != KErrNotFound)
+        {
+        TInt topParent = FindMostTopParentWgId(parent);
+        if( topParent != KErrNotFound )
+            {
+            parent = topParent;
+            }
+        }
+    return parent;
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswDataList::FindAppNameLC
+// --------------------------------------------------------------------------
+//
+HBufC* CTsFswDataList::FindAppNameLC( CApaWindowGroupName* aWindowName,
+                                  const TUid& aAppUid,
+                                  TInt aWgId )
+    {
+    //Retrieve the app name
+    TApaAppInfo info;
+    iAppArcSession.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().AllocL();
+            //put on cleanupstack after the if
+            }
+        else
+            {
+            TThreadId threadId;
+            TInt err = iWsSession.GetWindowGroupClientThreadId(
+                    aWgId, threadId );
+            if ( err == KErrNone )
+                {
+                RThread thread;
+                CleanupClosePushL( thread );
+                err = thread.Open ( threadId );
+                if ( err==KErrNone )
+                    {
+                    tempName = thread.Name().AllocL(); // codescanner::forgottoputptroncleanupstack
+                    // tempName put on cleanupstack after the if
+                    }
+                CleanupStack::PopAndDestroy( &thread );
+                }
+            }
+        }
+    else
+        {
+        tempName = caption.AllocL();
+        //put on cleanupstack after the if
+        }
+    CleanupStack::PushL( tempName );
+    return tempName;
+    }
+
+
+// --------------------------------------------------------------------------
+// CTsFswDataList::FitDataToListL
+// --------------------------------------------------------------------------
+//
+TBool CTsFswDataList::FitDataToListL(RTsFswArray& aListToFit,
+        TBool /*aConsiderWidgets*/)
+    {
+    TBool changed = EFalse;
+    TInt listCount = aListToFit.Count();
+    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;
+              }
+          }
+      
+    //add new item at start
+    //for (TInt i = 0; i < aListToFit.Count(); ++i)
+    for (TInt i = aListToFit.Count()-1; i >= 0; --i)
+        {
+        if (!CheckIfExists(*aListToFit[i], iData))
+            {
+            iData.Insert(aListToFit[i], 0);
+            aListToFit[i] = 0;
+            changed = ETrue;
+            }
+        }
+    changed = changed || iOrderChanged;
+    iOrderChanged = EFalse;
+    return changed;
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswDataList::CheckIfExists
+// --------------------------------------------------------------------------
+//
+TBool CTsFswDataList::CheckIfExists(const CTsFswEntry& aEntry,
+        const RTsFswArray& aList) const
+    {
+    TBool exists(EFalse);
+    TInt dataCount = aList.Count();
+    for (TInt entryIdx = 0; entryIdx < dataCount; ++entryIdx)
+        {
+        if (aList[entryIdx]->AppUid() == aEntry.AppUid())
+            {
+            exists = ETrue;
+            break;
+            }
+        }
+    return exists;
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswDataList::AppUidForWgId
+// --------------------------------------------------------------------------
+//
+TInt CTsFswDataList::AppUidForWgId( TInt aWgId, TUid& aUid )
+    {
+	TRAPD(err, aUid = AppUidForWgIdL( aWgId ) );
+	return err;
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswDataList::AppUidForWgIdL
+// --------------------------------------------------------------------------
+//
+TUid CTsFswDataList::AppUidForWgIdL( TInt aWgId )
+    {
+    CApaWindowGroupName* windowName =
+        CApaWindowGroupName::NewLC( iWsSession, aWgId );
+    TUid appUid = windowName->AppUid();
+    CleanupStack::PopAndDestroy( windowName );
+    return appUid;
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswDataList::GetAppIconL
+// --------------------------------------------------------------------------
+//
+void CTsFswDataList::GetAppIconL( const TUid& aAppUid,
+        CFbsBitmap*& aBitmap, CFbsBitmap*& aMask )
+    {
+    aBitmap = aMask = NULL;
+
+    TSize size( KAppIconWidth, KAppIconHeight );
+    CApaMaskedBitmap* apaMaskedBitmap = CApaMaskedBitmap::NewLC();
+    TInt err = iAppArcSession.GetAppIcon( aAppUid, size, *apaMaskedBitmap );
+    TInt iconsCount(0);
+    if ( err == KErrNone )
+        {
+        err = iAppArcSession.NumberOfOwnDefinedIcons(aAppUid, iconsCount);
+        }
+    
+    if ( (err == KErrNone) && (iconsCount>0) )
+        {
+        aBitmap = static_cast<CFbsBitmap*>(apaMaskedBitmap);
+        TInt maskHandle = apaMaskedBitmap->Mask()->Handle();
+        aMask = new (ELeave) CFbsBitmap;
+        aMask->Duplicate( maskHandle );
+        CleanupStack::Pop( apaMaskedBitmap );
+        }
+    else
+        {
+        CleanupStack::PopAndDestroy( apaMaskedBitmap );
+        HBufC* fileNameFromApparc = NULL;
+        TInt err = iAppArcSession.GetAppIcon(aAppUid,fileNameFromApparc);        
+        if ( err == KErrNone ) 
+            {
+            CleanupStack::PushL(fileNameFromApparc);
+            CFbsBitmap *bitamp(0);
+            CFbsBitmap *mask(0);
+            TInt bitmapIndex = 0;
+            TInt maskIndex = 1;    
+            // it will change bitmap ids if it is mif (checking inside)
+            AknIconUtils::ValidateLogicalAppIconId( *fileNameFromApparc, bitmapIndex, maskIndex );
+            AknIconUtils::CreateIconLC( bitamp, mask, fileNameFromApparc->Des(), bitmapIndex, maskIndex );
+
+            if (AknIconUtils::IsMifFile(*fileNameFromApparc)) \
+                {
+                AknIconUtils::DisableCompression(bitamp);
+                AknIconUtils::SetSize(bitamp, TSize(KAppIconWidth, KAppIconHeight), EAspectRatioPreservedAndUnusedSpaceRemoved);                                
+                // bitmap and icon, AknsUtils::CreateIconLC doesn't specify the order
+                CleanupStack::Pop(2);                  
+                aBitmap = bitamp;
+                aMask = mask;
+                }
+            else
+                {
+                CleanupStack::PopAndDestroy(2);                       
+                }
+            CleanupStack::PopAndDestroy(fileNameFromApparc);
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswDataList::GetAppIconL
+// --------------------------------------------------------------------------
+//
+TBool CTsFswDataList::IsHiddenUid( TUid aUid )
+    {
+    TInt result = iHiddenUids.Find( aUid );
+    return result >= 0 ? ETrue : EFalse;
+    }
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/server/src/tsfswengine.cpp	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,221 @@
+/*
+* 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 monitor engine
+ *
+*/
+
+
+#include "tsfswengine.h"
+
+#include "tsfswdatalist.h"
+
+
+
+
+#include <apgtask.h>
+#include <AknDef.h>
+#include <apgwgnam.h>
+#include <mmf/common/mmfcontrollerpluginresolver.h> // for CleanupResetAndDestroyPushL
+#include <featmgr.h>
+#include <swi/swispubsubdefs.h>
+#include <s32mem.h>
+#include <bitmaptransforms.h>
+
+// time to wait before refreshing content
+const TInt KContentRefreshDelay = 50000; // 0.05 sec
+
+
+// --------------------------------------------------------------------------
+// CTsFswEngine::NewL
+// --------------------------------------------------------------------------
+//
+CTsFswEngine* CTsFswEngine::NewL( MHsDataObserver& aObserver )
+    {
+    CTsFswEngine* self = NewLC( aObserver );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswEngine::NewLC
+// --------------------------------------------------------------------------
+//
+CTsFswEngine* CTsFswEngine::NewLC( MHsDataObserver& aObserver )
+    {
+    CTsFswEngine* self = new ( ELeave ) CTsFswEngine( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswEngine::CTsFswEngine
+// --------------------------------------------------------------------------
+//
+CTsFswEngine::CTsFswEngine( MHsDataObserver& aObserver )
+        :iObserver( aObserver )
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswEngine::ConstructL
+// --------------------------------------------------------------------------
+//
+void CTsFswEngine::ConstructL()
+    {
+    User::LeaveIfError( iWsSession.Connect() );
+    User::LeaveIfError( iAppArcSession.Connect() );
+
+    iDataList = CTsFswDataList::NewL(*this);    
+
+    // get an initial list of tasks
+    iDataList->SetAppDataRefreshNeeded();
+    CollectTasksL();
+
+    iUpdateStarter = CPeriodic::NewL( CActive::EPriorityStandard );   
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswEngine::~CTsFswEngine
+// --------------------------------------------------------------------------
+//
+CTsFswEngine::~CTsFswEngine()
+    {
+
+    delete iUpdateStarter;
+
+    iWgIds.Close();
+
+    iAppArcSession.Close();
+    iWsSession.Close();
+
+    delete iDataList;
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswEngine::FswDataL
+// --------------------------------------------------------------------------
+//
+const RTsFswArray& CTsFswEngine::FswDataL()
+    {
+    return iDataList->FswDataL();
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswEngine::UpdateTaskList
+// Callback from appui
+// --------------------------------------------------------------------------
+//
+void CTsFswEngine::UpdateTaskList()
+    {
+    // There can be many calls in a row, use a timer to prevent degrading
+    // device performance.
+    iDataList->SetDirty();
+    if ( !iUpdateStarter->IsActive() )
+        {
+        iUpdateStarter->Start( KContentRefreshDelay, 0,
+                TCallBack( UpdateStarterCallback, this ) );
+        }    
+    // get the foreground app uid and publish it to CFW if different than before
+    TRAP_IGNORE( PublishFgAppUidL() );
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswEngine::UpdateStarterCallback
+// Callback for the timer
+// --------------------------------------------------------------------------
+//
+TInt CTsFswEngine::UpdateStarterCallback( TAny* aParam )
+    {
+    CTsFswEngine* self = static_cast<CTsFswEngine*>( aParam );
+    self->iUpdateStarter->Cancel();
+    // get list of tasks and notify observer if there is a change in the list
+    TBool changed = EFalse;
+    TRAPD( err, changed = self->CollectTasksL() );
+    if ( err == KErrNone && changed )
+        {
+        self->iObserver.DataChanged();
+        }
+    return 0;
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswEngine::CollectTasksL
+// --------------------------------------------------------------------------
+//
+TBool CTsFswEngine::CollectTasksL()
+    {
+    TBool changed = iDataList->CollectTasksL();
+    return changed;
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswEngine::ForegroundAppUidL
+// --------------------------------------------------------------------------
+//
+TUid CTsFswEngine::ForegroundAppUidL( TInt aType )
+    {
+    // Do not use GetFocusWindowGroup or others.
+    // We want to see only "real" application uids in FgApp,
+    // i.e. stuff that would also be shown in the task swapper
+    // area of Taskswitcher.
+
+    TUid result = KNullUid;
+    RArray<RWsSession::TWindowGroupChainInfo> allWgIds;
+    CleanupClosePushL( allWgIds );
+    User::LeaveIfError( iWsSession.WindowGroupList( 0, &allWgIds ) );
+    TInt count = allWgIds.Count();
+    for ( TInt i = 0; i < count; ++i )
+        {
+        // Depending on aType we may not need to bother with iParentId here.
+        // If aType == EUseEmbeddedUid => embedded apps are treated as others.
+        // If aType == EUseStandaloneUid => embedded apps must be ignored.
+        if ( allWgIds[i].iParentId > 0
+                && aType == CTsFswEngine::EUseStandaloneUid )
+            {
+            continue;
+            }
+
+        CApaWindowGroupName* wgn = CApaWindowGroupName::NewLC(
+            iWsSession, allWgIds[i].iId );
+        TUid newUid = wgn->AppUid();
+        TBool hidden = wgn->Hidden();
+        CleanupStack::PopAndDestroy( wgn );
+
+        if ( !hidden && newUid.iUid && !iDataList->IsHiddenUid(newUid) )
+            {
+            result = newUid;
+            break;
+            }
+        }
+    CleanupStack::PopAndDestroy( &allWgIds );
+    
+    return result;
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswEngine::PublishFgAppUidL
+// --------------------------------------------------------------------------
+//
+void CTsFswEngine::PublishFgAppUidL()
+    {
+    TUid newUid = ForegroundAppUidL( CTsFswEngine::EUseEmbeddedUid );
+    if ( iFgAppUid != newUid && newUid.iUid )
+        {
+        iFgAppUid = newUid;
+        iDataList->MoveEntryAtStart(newUid.iUid, EFalse);
+        }
+    }
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/server/src/tsfswmonitor.cpp	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,139 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ws monitor implementation
+ *
+*/
+
+
+#include "tsfswmonitor.h"
+#include "tsfswobservers.h"
+
+// --------------------------------------------------------------------------
+// CTsFswMonitor::~CTsFswMonitor
+// --------------------------------------------------------------------------
+//
+CTsFswMonitor::~CTsFswMonitor()
+    {
+    Cancel();
+    iWg.Close();
+    iWsSession.Close();
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswMonitor::CTsFswMonitor
+// --------------------------------------------------------------------------
+//
+CTsFswMonitor::CTsFswMonitor(MTsFswTaskListObserver& aTaskListObserver) : CActive( EPriorityStandard ),
+    iTaskListObserver(&aTaskListObserver)
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswMonitor::NewL
+// --------------------------------------------------------------------------
+//        
+CTsFswMonitor* CTsFswMonitor::NewL(MTsFswTaskListObserver& aTaskListObserver)
+    {
+    CTsFswMonitor* self = NewLC(aTaskListObserver);
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswMonitor::NewLC
+// --------------------------------------------------------------------------
+//
+CTsFswMonitor* CTsFswMonitor::NewLC(MTsFswTaskListObserver& aTaskListObserver)
+    {
+    CTsFswMonitor* self = new ( ELeave ) CTsFswMonitor(aTaskListObserver);
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+    
+// --------------------------------------------------------------------------
+// CTsFswMonitor::ConstructL
+// --------------------------------------------------------------------------
+//
+void CTsFswMonitor::ConstructL()
+    {
+    CActiveScheduler::Add( this );
+    //Create window server observer
+    ConstractObserverL();
+    Subscribe();
+    }
+
+
+// -----------------------------------------------------------------------------
+// Subscribe
+// -----------------------------------------------------------------------------
+//
+void CTsFswMonitor::Subscribe()
+    {
+    if( !IsActive() )
+        {
+        iWsSession.EventReady( &iStatus );
+        SetActive();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// ConstractObserverL
+// -----------------------------------------------------------------------------
+//
+void CTsFswMonitor::ConstractObserverL()
+{
+    User::LeaveIfError( iWsSession.Connect() );
+    iWg = RWindowGroup( iWsSession );
+    User::LeaveIfError( iWg.Construct( 
+                        reinterpret_cast<TUint32>( &iWg ) ) );
+    iWg.DisableFocusChangeEvents();
+    iWg.DisableModifierChangedEvents();
+    iWg.DisableOnEvents();
+    iWg.DisableScreenChangeEvents();
+
+    //enable notifications about group lists
+    User::LeaveIfError( iWg.EnableGroupListChangeEvents() );
+}
+
+void CTsFswMonitor::RunL()
+{
+    User::LeaveIfError( iStatus.Int() );
+    TWsEvent event;
+    iWsSession.GetEvent( event );
+    Subscribe();//new subscribtion has to be called after picking event
+    if( EEventWindowGroupListChanged == event.Type() /*|| EEventFocusGroupChanged == event.Type()*/ )
+        {
+        if ( iTaskListObserver )
+            {
+            iTaskListObserver->UpdateTaskList(); 
+            }
+        }
+}
+
+TInt CTsFswMonitor::RunError( TInt /*aError*/ )
+{
+    Subscribe();
+    return KErrNone;
+}
+
+void CTsFswMonitor::DoCancel()
+{
+    if( IsActive() )
+        {
+        iWsSession.EventReadyCancel();
+        }
+}
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/server/src/tsrunningappstorage.cpp	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,115 @@
+/*
+* 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 "tsrunningappstorage.h"
+#include "tsfswengine.h"
+#include "tsfswmonitor.h"
+#include "tsfswentry.h"
+#include <s32strm.h>
+#include <S32MEM.H>
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CRunningAppStorage::CRunningAppStorage(MHsDataObserver& observer)
+: mObserver(observer)
+{
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CRunningAppStorage::~CRunningAppStorage()
+{
+    mData.Close();
+    delete mEngine;
+    delete mMonitor;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CRunningAppStorage* CRunningAppStorage::NewL(MHsDataObserver& observer)
+{
+    CRunningAppStorage * self = new (ELeave)CRunningAppStorage(observer);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CRunningAppStorage::ConstructL()
+{
+    mEngine = CTsFswEngine::NewL(*this) ;
+    mMonitor = CTsFswMonitor::NewL(*mEngine);
+    DataChangedL();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+const TDesC8& CRunningAppStorage::Data() const
+{
+    return mData;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CRunningAppStorage::DataChanged() 
+{
+    TRAPD( err, DataChangedL() );
+    if ( err == KErrNone)
+    {
+        mObserver.DataChanged();
+    }
+    
+    int a=8;
+    if( a==9)
+    {
+        CActiveScheduler::Stop();
+    }
+}
+void CRunningAppStorage::DataChangedL()
+{
+    RTsFswArray taskList = mEngine->FswDataL();
+    CTsFswEntry* entry = CTsFswEntry::NewLC();
+    // Create a dynamic flat buffer to hold this object’s member data
+    
+    const TInt KExpandSize = 256; // "Granularity" of dynamic buffer
+    CBufFlat* buf = CBufFlat::NewL(KExpandSize);
+    CleanupStack::PushL(buf);
+    RBufWriteStream stream(*buf); 
+    CleanupClosePushL(stream);
+    entry->ExternalizeArrayL(stream, taskList);
+    CleanupStack::PopAndDestroy(&stream);
+    mData.Close();
+    mData.CreateL( buf->Size() );
+    buf->Read(0, mData, buf->Size());
+    
+
+    CleanupStack::PopAndDestroy(buf);
+    CleanupStack::PopAndDestroy(entry); 
+ 
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/server/tsrc/tsrc.pro	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,22 @@
+#
+# 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 +=  testapp
+SUBDIRS +=  t_tsrunningappstorage
+           
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/sis/stubs/createstubs.bat	Thu May 27 13:11:12 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/tstaskmonitor/sis/stubs/taskmonitor_stub.pkg	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,36 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description: 
+;
+; ------------------------------------------------------------------------------
+; 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"
Binary file tstaskmonitor/sis/stubs/taskmonitor_stub.sis has changed
Binary file tstaskmonitor/sis/taskmonitor.SIS has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/sis/taskmonitor.pkg	Thu May 27 13:11:12 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: 
+;
+
+;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"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/tstaskmonitor.pro	Thu May 27 13:11:12 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: 
+#
+
+TEMPLATE = subdirs
+
+CONFIG += ordered
+
+symbian {
+    SUBDIRS += server
+}
+
+SUBDIRS += client
+
+symbian:include(rom.pri)
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/utils/inc/tsfswentry.h	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,112 @@
+/*
+* 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 TSFSWENTRY_H
+#define TSFSWENTRY_H
+
+#include <e32base.h>
+#include <e32cmn.h>
+
+class CTsFswEntry;
+class RReadStream;
+class RWriteStream;
+class CFbsBitmap;
+
+typedef RPointerArray<CTsFswEntry> RTsFswArray;
+
+enum TAppType
+{
+    EApp = 0,
+    EWidget,
+    EJava    
+};
+
+/**
+ * An entry in the task list.
+ */
+NONSHARABLE_CLASS( CTsFswEntry ) : public CBase
+    {
+public:
+    static CTsFswEntry* NewL();
+    static CTsFswEntry* NewLC();
+    ~CTsFswEntry();
+
+    /**
+     * Window group id.
+     * In case of wrt widgets this is negative and is not a valid window group id.
+     * Use this when calling CloseApp or SwitchToApp. (these work with widgets too)
+     */
+    TInt WgId() const;
+    
+    /**
+     * Application uid.
+     */
+    TUid AppUid() const;
+    
+    /**
+     * Application type.
+     */
+    TAppType Type() const;
+    
+    /**
+     * Application name.
+     */
+    const TDesC& AppName() const;    
+    
+    /**
+     * ETrue if the application is closeable
+     */
+    TBool CloseableApp() const;
+    
+    /**
+     * Application icon bitmap
+     */
+    CFbsBitmap* AppIconBitmap() const;
+    
+    /**
+     * Application icon mask.
+     * @see AppIconBitmapHandle
+     */
+    CFbsBitmap* AppIconMask() const;
+
+
+    void SetWgId( TInt aWgId );
+    void SetAppUid( const TUid& aUid );
+    void SetAppNameL( const TDesC& aAppName );
+    void SetCloseableApp( TBool aValue );
+    
+    // takes ownership of bitmaps
+    void SetAppIcon( CFbsBitmap* aBitmap, CFbsBitmap* aMask );
+    void ExternalizeL( RWriteStream& aStream );
+    void InternalizeL( RReadStream& aStream );
+
+    static void ExternalizeArrayL( RWriteStream& aStream,
+        const RTsFswArray& aArray );
+    static void InternalizeArrayL( RReadStream& aStream,
+        RTsFswArray& aArray );
+
+private:
+    TInt iWgId;
+    TUid iAppUid;
+    HBufC* iAppName;
+    TBool iCloseableApp;
+    CFbsBitmap* iAppIconBitmap;
+    CFbsBitmap* iAppIconMask;  
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/utils/inc/tsutils.h	Thu May 27 13:11:12 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/tstaskmonitor/utils/src/tsfswentry.cpp	Thu May 27 13:11:12 2010 +0300
@@ -0,0 +1,251 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Task list entry
+ *
+*/
+
+#define __E32SVR_H__
+#include "tsfswentry.h"
+#include <s32strm.h>
+#include <fbs.h>
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::NewL
+// --------------------------------------------------------------------------
+//
+CTsFswEntry* CTsFswEntry::NewL()
+    {
+    CTsFswEntry* self = NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::NewLC
+// --------------------------------------------------------------------------
+//
+CTsFswEntry* CTsFswEntry::NewLC()
+    {
+    CTsFswEntry* self = new ( ELeave ) CTsFswEntry;
+    CleanupStack::PushL( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::~CTsFswEntry
+// --------------------------------------------------------------------------
+//
+CTsFswEntry::~CTsFswEntry()
+    {
+    delete iAppName;
+    delete iAppIconBitmap;
+    delete iAppIconMask;
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::SetWgId
+// --------------------------------------------------------------------------
+//
+void CTsFswEntry::SetWgId( TInt aWgId )
+    {
+    iWgId = aWgId;
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::SetAppUid
+// --------------------------------------------------------------------------
+//
+void CTsFswEntry::SetAppUid( const TUid& aUid )
+    {
+    iAppUid = aUid;
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::SetAppNameL
+// --------------------------------------------------------------------------
+//
+void CTsFswEntry::SetAppNameL( const TDesC& aAppName )
+    {
+    delete iAppName; iAppName = 0;
+    iAppName = aAppName.AllocL();
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::SetSystemApp
+// --------------------------------------------------------------------------
+//
+void CTsFswEntry::SetCloseableApp( TBool aValue )
+    {
+    iCloseableApp = aValue;
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::SetAppIconHandles
+// --------------------------------------------------------------------------
+//
+void CTsFswEntry::SetAppIcon( CFbsBitmap* aBitmap, CFbsBitmap* aMask )
+    {
+    iAppIconBitmap = aBitmap;
+    iAppIconMask = aMask;
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::WgId
+// --------------------------------------------------------------------------
+//
+TInt CTsFswEntry::WgId() const
+    {
+    return iWgId;
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::AppUid
+// --------------------------------------------------------------------------
+//
+TUid CTsFswEntry::AppUid() const
+    {
+    return iAppUid;
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::AppName
+// --------------------------------------------------------------------------
+//
+const TDesC& CTsFswEntry::AppName() const
+    {
+    return iAppName ? *iAppName : KNullDesC();
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::SystemApp
+// --------------------------------------------------------------------------
+//
+TBool CTsFswEntry::CloseableApp() const
+    {
+    return iCloseableApp;
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::AppIconBitmapHandle
+// --------------------------------------------------------------------------
+//
+CFbsBitmap* CTsFswEntry::AppIconBitmap() const
+    {
+    return iAppIconBitmap;
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::AppIconMaskHandle
+// --------------------------------------------------------------------------
+//
+CFbsBitmap* CTsFswEntry::AppIconMask() const
+    {
+    return iAppIconMask;
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::ExternalizeL
+// --------------------------------------------------------------------------
+//
+void CTsFswEntry::ExternalizeL( RWriteStream& aStream )
+    {
+    aStream.WriteInt32L( iWgId );
+    aStream.WriteInt32L( iAppUid.iUid );
+    aStream << AppName();
+    aStream.WriteInt32L( iCloseableApp );
+    if ( iAppIconBitmap )
+        {
+        aStream.WriteInt32L( iAppIconBitmap->Handle() );
+        }
+    else
+        {
+        aStream.WriteInt32L( KErrNotFound );
+        }
+    
+   if ( iAppIconMask )
+        {
+        aStream.WriteInt32L( iAppIconMask->Handle() );
+        }
+    else
+        {
+        aStream.WriteInt32L( KErrNotFound );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::InternalizeL
+// --------------------------------------------------------------------------
+//
+void CTsFswEntry::InternalizeL( RReadStream& aStream )
+    {
+    iWgId = aStream.ReadInt32L();
+    iAppUid = TUid::Uid( aStream.ReadInt32L() );
+    delete iAppName; iAppName = NULL;
+    iAppName = HBufC::NewL( aStream, KMaxTInt );
+    iCloseableApp = aStream.ReadInt32L();
+    TInt appIconBitmapHandle = aStream.ReadInt32L();
+    TInt appIconMaskHandle = aStream.ReadInt32L();
+    if ( appIconBitmapHandle != KErrNotFound )
+        {
+        iAppIconBitmap = new (ELeave) CFbsBitmap;
+        iAppIconBitmap->Duplicate( appIconBitmapHandle );  
+        }
+    if ( appIconMaskHandle != KErrNotFound )    
+        {
+        iAppIconMask = new (ELeave) CFbsBitmap;
+        iAppIconMask->Duplicate( appIconMaskHandle );  
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::ExternalizeArrayL
+// --------------------------------------------------------------------------
+//
+void CTsFswEntry::ExternalizeArrayL( RWriteStream& aStream,
+        const RTsFswArray& aArray )
+    {
+    TInt count = aArray.Count();
+    aStream.WriteInt32L( count );
+    for ( TInt i = 0; i < count; ++i )
+        {
+        aArray[i]->ExternalizeL( aStream );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::InternalizeArrayL
+// --------------------------------------------------------------------------
+//
+void CTsFswEntry::InternalizeArrayL( RReadStream& aStream,
+        RTsFswArray& aArray )
+    {
+    aArray.ResetAndDestroy();
+    TInt count = aStream.ReadInt32L();    for ( TInt i = 0; i < count; ++i )
+        {
+        CTsFswEntry* entry = CTsFswEntry::NewLC();
+        entry->InternalizeL( aStream );
+        aArray.AppendL( entry );
+        CleanupStack::Pop( entry );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::Type
+// --------------------------------------------------------------------------
+//
+TAppType CTsFswEntry::Type() const
+    {
+    return EApp;
+    }
+// end of file