Catchup to latest Symbian^4 GCC_SURGE
authorWilliam Roberts <williamr@symbian.org>
Thu, 22 Jul 2010 16:37:03 +0100
branchGCC_SURGE
changeset 105 e7325f632549
parent 81 5ef31a21fdd5 (current diff)
parent 104 9b022b1f357c (diff)
Catchup to latest Symbian^4
activityfw/activitydatabase/hsactivitydbserver/inc/activitybroadcasttask.h
activityfw/activitydatabase/hsactivitydbserver/inc/activitydataprovidertask.h
activityfw/activitydatabase/hsactivitydbserver/inc/activitygraphicfilescaling.h
activityfw/activitydatabase/hsactivitydbserver/inc/activityobservertask.h
activityfw/activitydatabase/hsactivitydbserver/inc/activityqueries.h
activityfw/activitydatabase/hsactivitydbserver/inc/activityserver.h
activityfw/activitydatabase/hsactivitydbserver/inc/activitysession.h
activityfw/activitydatabase/hsactivitydbserver/inc/activitystorage.h
activityfw/activitydatabase/hsactivitydbserver/inc/activitystorageasynctask.h
activityfw/activitydatabase/hsactivitydbserver/inc/activitystoragesynctask.h
activityfw/activitydatabase/hsactivitydbserver/inc/activitytask.h
activityfw/activitydatabase/hsactivitydbserver/inc/activitytaskstorage.h
activityfw/activitydatabase/hsactivitydbserver/inc/activitythumbnailtask.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/activityserver.cpp
activityfw/activitydatabase/hsactivitydbserver/src/activitysession.cpp
activityfw/activitydatabase/hsactivitydbserver/src/activitystorage.cpp
activityfw/activitydatabase/hsactivitydbserver/src/activitystorageasynctask.cpp
activityfw/activitydatabase/hsactivitydbserver/src/activitystoragesynctask.cpp
activityfw/activitydatabase/hsactivitydbserver/src/activitythumbnailtask.cpp
activityfw/activitylauncher/activitylauncher.pro
activityfw/activitylauncher/activitylauncherview.cpp
activityfw/activitylauncher/activitylauncherview.h
activityfw/activitylauncher/main.cpp
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.xml
activityfw/activityserviceplugin/applicationlauncher.cpp
activityfw/activityserviceplugin/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/win/activitydatabase_p.cpp
activityfw/activityserviceplugin/win/activitydatabase_p.h
activityfw/activityserviceplugin/win/applicationlauncher_p.cpp
activityfw/activityserviceplugin/win/applicationlauncher_p.h
appfoundation/appfoundation.pro
appfoundation/appfoundation_tests.pri
appfoundation/appruntimemodel/appruntimemodel.pri
appfoundation/appruntimemodel/appruntimemodel.pro
appfoundation/appruntimemodel/inc/hsruntimefactory_p.h
appfoundation/appruntimemodel/inc/hsruntimeprovidermanifest.h
appfoundation/appruntimemodel/inc/hsruntimeprovidermanifest_p.h
appfoundation/appruntimemodel/src/hsruntimefactory.cpp
appfoundation/appruntimemodel/src/hsruntimeprovidermanifest.cpp
appfoundation/statemodel/inc/hsstatefactory_p.h
appfoundation/statemodel/inc/hsstateprovidermanifest.h
appfoundation/statemodel/inc/hsstateprovidermanifest_p.h
appfoundation/statemodel/src/hsstatefactory.cpp
appfoundation/statemodel/src/hsstateprovidermanifest.cpp
appfoundation/statemodel/statemodel.pri
appfoundation/statemodel/statemodel.pro
contentstorage/caclient/s60/inc/cahandler.h
contentstorage/caclient/s60/inc/cahandlerloader.h
contentstorage/caclient/s60/inc/cahandlerproxy.h
contentstorage/caclient/s60/inc/caqtsfhandlerloader.h
contentstorage/caclient/s60/src/cahandlerloader.cpp
contentstorage/caclient/s60/src/cahandlerproxy.cpp
contentstorage/caclient/s60/src/caqtsfhandlerloader.cpp
contentstorage/cahandler/app/inc/cas60apphandleradapter.h
contentstorage/cahandler/app/inc/cauninstalloperation.h
contentstorage/cahandler/app/src/cas60apphandleradapter.cpp
contentstorage/cahandler/app/src/cauninstalloperation.cpp
contentstorage/cahandler/url/inc/cas60urlhandleradapter.h
contentstorage/cahandler/url/src/cas60urlhandleradapter.cpp
contentstorage/casrv/calocalizerscanner/bwins/calocalizerscanneru.def
contentstorage/casrv/calocalizerscanner/eabi/calocalizerscanneru.def
contentstorage/castorage/bwins/castorageu.def
contentstorage/castorage/eabi/castorageu.def
contentstorage/castorage/inc/castorage_global.h
homescreensrv_plat/appruntimemodel_api/appruntimemodel_api.pri
homescreensrv_plat/appruntimemodel_api/hsiruntimeprovider.h
homescreensrv_plat/appruntimemodel_api/hsruntime.h
homescreensrv_plat/appruntimemodel_api/hsruntimefactory.h
homescreensrv_plat/appruntimemodel_api/hsruntimemodel_global.h
homescreensrv_plat/statemodel_api/hsistateprovider.h
homescreensrv_plat/statemodel_api/hsstatefactory.h
homescreensrv_plat/statemodel_api/hsstatemodel_global.h
homescreensrv_plat/statemodel_api/statemodel_api.pri
--- a/activityfw/activitydatabase/bwins/hsactivitydbclientu.def	Fri Jun 11 16:25:06 2010 +0100
+++ b/activityfw/activitydatabase/bwins/hsactivitydbclientu.def	Thu Jul 22 16:37:03 2010 +0100
@@ -5,24 +5,28 @@
 	?trUtf8@HsActivityDbClient@@SA?AVQString@@PBD0@Z @ 4 NONAME ; class QString HsActivityDbClient::trUtf8(char const *, char const *)
 	?applicationActivities@HsActivityDbClient@@UAEHAAV?$QList@V?$QHash@VQString@@VQVariant@@@@@@ABV?$QHash@VQString@@VQVariant@@@@@Z @ 5 NONAME ; int HsActivityDbClient::applicationActivities(class QList<class QHash<class QString, class QVariant> > &, class QHash<class QString, class QVariant> const &)
 	?getThumbnail@HsActivityDbClient@@QAEHVQSize@@VQString@@1PAX@Z @ 6 NONAME ; int HsActivityDbClient::getThumbnail(class QSize, class QString, class QString, void *)
-	?qt_metacast@HsActivityDbClient@@UAEPAXPBD@Z @ 7 NONAME ; void * HsActivityDbClient::qt_metacast(char const *)
-	?qt_metacall@HsActivityDbClient@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 8 NONAME ; int HsActivityDbClient::qt_metacall(enum QMetaObject::Call, int, void * *)
-	?waitActivity@HsActivityDbClient@@UAEHABV?$QHash@VQString@@VQVariant@@@@@Z @ 9 NONAME ; int HsActivityDbClient::waitActivity(class QHash<class QString, class QVariant> const &)
-	?activities@HsActivityDbClient@@UAEHAAV?$QList@V?$QHash@VQString@@VQVariant@@@@@@@Z @ 10 NONAME ; int HsActivityDbClient::activities(class QList<class QHash<class QString, class QVariant> > &)
-	?trUtf8@HsActivityDbClient@@SA?AVQString@@PBD0H@Z @ 11 NONAME ; class QString HsActivityDbClient::trUtf8(char const *, char const *, int)
-	??0HsActivityDbClient@@QAE@PAVQObject@@@Z @ 12 NONAME ; HsActivityDbClient::HsActivityDbClient(class QObject *)
-	?tr@HsActivityDbClient@@SA?AVQString@@PBD0@Z @ 13 NONAME ; class QString HsActivityDbClient::tr(char const *, char const *)
-	?getStaticMetaObject@HsActivityDbClient@@SAABUQMetaObject@@XZ @ 14 NONAME ; struct QMetaObject const & HsActivityDbClient::getStaticMetaObject(void)
-	??_EHsActivityDbClient@@UAE@I@Z @ 15 NONAME ; HsActivityDbClient::~HsActivityDbClient(unsigned int)
-	?removeApplicationActivities@HsActivityDbClient@@UAEHABV?$QHash@VQString@@VQVariant@@@@@Z @ 16 NONAME ; int HsActivityDbClient::removeApplicationActivities(class QHash<class QString, class QVariant> const &)
-	?metaObject@HsActivityDbClient@@UBEPBUQMetaObject@@XZ @ 17 NONAME ; struct QMetaObject const * HsActivityDbClient::metaObject(void) const
-	?tr@HsActivityDbClient@@SA?AVQString@@PBD0H@Z @ 18 NONAME ; class QString HsActivityDbClient::tr(char const *, char const *, int)
-	?addActivity@HsActivityDbClient@@UAEHABV?$QHash@VQString@@VQVariant@@@@@Z @ 19 NONAME ; int HsActivityDbClient::addActivity(class QHash<class QString, class QVariant> const &)
-	?asyncRequestCompleated@HsActivityDbClient@@UAEXHHABVQPixmap@@PAX@Z @ 20 NONAME ; void HsActivityDbClient::asyncRequestCompleated(int, int, class QPixmap const &, void *)
-	?staticMetaObject@HsActivityDbClient@@2UQMetaObject@@B @ 21 NONAME ; struct QMetaObject const HsActivityDbClient::staticMetaObject
-	??1HsActivityDbClient@@UAE@XZ @ 22 NONAME ; HsActivityDbClient::~HsActivityDbClient(void)
-	?thumbnailRequested@HsActivityDbClient@@IAEXVQPixmap@@PAX@Z @ 23 NONAME ; void HsActivityDbClient::thumbnailRequested(class QPixmap, void *)
-	?activityRequested@HsActivityDbClient@@IAEXABVQString@@@Z @ 24 NONAME ; void HsActivityDbClient::activityRequested(class QString const &)
-	?updateActivity@HsActivityDbClient@@UAEHABV?$QHash@VQString@@VQVariant@@@@@Z @ 25 NONAME ; int HsActivityDbClient::updateActivity(class QHash<class QString, class QVariant> const &)
-	?removeActivity@HsActivityDbClient@@UAEHABV?$QHash@VQString@@VQVariant@@@@@Z @ 26 NONAME ; int HsActivityDbClient::removeActivity(class QHash<class QString, class QVariant> const &)
+	?dataChanged@HsActivityDbClient@@IAEXXZ @ 7 NONAME ; void HsActivityDbClient::dataChanged(void)
+	?qt_metacast@HsActivityDbClient@@UAEPAXPBD@Z @ 8 NONAME ; void * HsActivityDbClient::qt_metacast(char const *)
+	?qt_metacall@HsActivityDbClient@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 9 NONAME ; int HsActivityDbClient::qt_metacall(enum QMetaObject::Call, int, void * *)
+	?waitActivity@HsActivityDbClient@@UAEHABV?$QHash@VQString@@VQVariant@@@@@Z @ 10 NONAME ; int HsActivityDbClient::waitActivity(class QHash<class QString, class QVariant> const &)
+	?activities@HsActivityDbClient@@UAEHAAV?$QList@V?$QHash@VQString@@VQVariant@@@@@@@Z @ 11 NONAME ; int HsActivityDbClient::activities(class QList<class QHash<class QString, class QVariant> > &)
+	?notifyDataChange@HsActivityDbClient@@QAEHXZ @ 12 NONAME ; int HsActivityDbClient::notifyDataChange(void)
+	?trUtf8@HsActivityDbClient@@SA?AVQString@@PBD0H@Z @ 13 NONAME ; class QString HsActivityDbClient::trUtf8(char const *, char const *, int)
+	?asyncRequestCompleated@HsActivityDbClient@@UAEXHH@Z @ 14 NONAME ; void HsActivityDbClient::asyncRequestCompleated(int, int)
+	??0HsActivityDbClient@@QAE@PAVQObject@@@Z @ 15 NONAME ; HsActivityDbClient::HsActivityDbClient(class QObject *)
+	?tr@HsActivityDbClient@@SA?AVQString@@PBD0@Z @ 16 NONAME ; class QString HsActivityDbClient::tr(char const *, char const *)
+	?getStaticMetaObject@HsActivityDbClient@@SAABUQMetaObject@@XZ @ 17 NONAME ; struct QMetaObject const & HsActivityDbClient::getStaticMetaObject(void)
+	??_EHsActivityDbClient@@UAE@I@Z @ 18 NONAME ; HsActivityDbClient::~HsActivityDbClient(unsigned int)
+	?removeApplicationActivities@HsActivityDbClient@@UAEHABV?$QHash@VQString@@VQVariant@@@@@Z @ 19 NONAME ; int HsActivityDbClient::removeApplicationActivities(class QHash<class QString, class QVariant> const &)
+	?metaObject@HsActivityDbClient@@UBEPBUQMetaObject@@XZ @ 20 NONAME ; struct QMetaObject const * HsActivityDbClient::metaObject(void) const
+	?tr@HsActivityDbClient@@SA?AVQString@@PBD0H@Z @ 21 NONAME ; class QString HsActivityDbClient::tr(char const *, char const *, int)
+	?addActivity@HsActivityDbClient@@UAEHABV?$QHash@VQString@@VQVariant@@@@0@Z @ 22 NONAME ; int HsActivityDbClient::addActivity(class QHash<class QString, class QVariant> const &, class QHash<class QString, class QVariant> const &)
+	?asyncRequestCompleated@HsActivityDbClient@@UAEXHHABVQPixmap@@PAX@Z @ 23 NONAME ; void HsActivityDbClient::asyncRequestCompleated(int, int, class QPixmap const &, void *)
+	?staticMetaObject@HsActivityDbClient@@2UQMetaObject@@B @ 24 NONAME ; struct QMetaObject const HsActivityDbClient::staticMetaObject
+	?updateActivity@HsActivityDbClient@@UAEHABV?$QHash@VQString@@VQVariant@@@@0@Z @ 25 NONAME ; int HsActivityDbClient::updateActivity(class QHash<class QString, class QVariant> const &, class QHash<class QString, class QVariant> const &)
+	??1HsActivityDbClient@@UAE@XZ @ 26 NONAME ; HsActivityDbClient::~HsActivityDbClient(void)
+	?thumbnailRequested@HsActivityDbClient@@IAEXVQPixmap@@PAX@Z @ 27 NONAME ; void HsActivityDbClient::thumbnailRequested(class QPixmap, void *)
+	?activityRequested@HsActivityDbClient@@IAEXABVQString@@@Z @ 28 NONAME ; void HsActivityDbClient::activityRequested(class QString const &)
+	?removeActivity@HsActivityDbClient@@UAEHABV?$QHash@VQString@@VQVariant@@@@@Z @ 29 NONAME ; int HsActivityDbClient::removeActivity(class QHash<class QString, class QVariant> const &)
+	?activityData@HsActivityDbClient@@UAEHAAVQVariant@@ABV?$QHash@VQString@@VQVariant@@@@@Z @ 30 NONAME ; int HsActivityDbClient::activityData(class QVariant &, class QHash<class QString, class QVariant> const &)
 
--- a/activityfw/activitydatabase/eabi/hsactivitydbclientu.def	Fri Jun 11 16:25:06 2010 +0100
+++ b/activityfw/activitydatabase/eabi/hsactivitydbclientu.def	Thu Jul 22 16:37:03 2010 +0100
@@ -1,38 +1,44 @@
 EXPORTS
 	_ZN18HsActivityDbClient10activitiesER5QListI5QHashI7QString8QVariantEE @ 1 NONAME
-	_ZN18HsActivityDbClient11addActivityERK5QHashI7QString8QVariantE @ 2 NONAME
-	_ZN18HsActivityDbClient11qt_metacallEN11QMetaObject4CallEiPPv @ 3 NONAME
-	_ZN18HsActivityDbClient11qt_metacastEPKc @ 4 NONAME
-	_ZN18HsActivityDbClient12getThumbnailE5QSize7QStringS1_Pv @ 5 NONAME
-	_ZN18HsActivityDbClient12waitActivityERK5QHashI7QString8QVariantE @ 6 NONAME
-	_ZN18HsActivityDbClient14launchActivityERK5QHashI7QString8QVariantE @ 7 NONAME
-	_ZN18HsActivityDbClient14removeActivityERK5QHashI7QString8QVariantE @ 8 NONAME
-	_ZN18HsActivityDbClient14updateActivityERK5QHashI7QString8QVariantE @ 9 NONAME
-	_ZN18HsActivityDbClient16staticMetaObjectE @ 10 NONAME DATA 16
-	_ZN18HsActivityDbClient17activityRequestedERK7QString @ 11 NONAME
-	_ZN18HsActivityDbClient18thumbnailRequestedE7QPixmapPv @ 12 NONAME
-	_ZN18HsActivityDbClient19getStaticMetaObjectEv @ 13 NONAME
-	_ZN18HsActivityDbClient21applicationActivitiesER5QListI5QHashI7QString8QVariantEERKS4_ @ 14 NONAME
-	_ZN18HsActivityDbClient22asyncRequestCompleatedEiiRK7QPixmapPv @ 15 NONAME
-	_ZN18HsActivityDbClient22asyncRequestCompleatedEiiRK7QString @ 16 NONAME
-	_ZN18HsActivityDbClient27removeApplicationActivitiesERK5QHashI7QString8QVariantE @ 17 NONAME
-	_ZN18HsActivityDbClient7connectEv @ 18 NONAME
-	_ZN18HsActivityDbClientC1EP7QObject @ 19 NONAME
-	_ZN18HsActivityDbClientC2EP7QObject @ 20 NONAME
-	_ZN18HsActivityDbClientD0Ev @ 21 NONAME
-	_ZN18HsActivityDbClientD1Ev @ 22 NONAME
-	_ZN18HsActivityDbClientD2Ev @ 23 NONAME
-	_ZNK18HsActivityDbClient10metaObjectEv @ 24 NONAME
-	_ZTI18HsActivityDbClient @ 25 NONAME
-	_ZTV18HsActivityDbClient @ 26 NONAME
-	_ZThn12_N18HsActivityDbClient22asyncRequestCompleatedEiiRK7QPixmapPv @ 27 NONAME
-	_ZThn12_N18HsActivityDbClient22asyncRequestCompleatedEiiRK7QString @ 28 NONAME
-	_ZThn8_N18HsActivityDbClient10activitiesER5QListI5QHashI7QString8QVariantEE @ 29 NONAME
-	_ZThn8_N18HsActivityDbClient11addActivityERK5QHashI7QString8QVariantE @ 30 NONAME
-	_ZThn8_N18HsActivityDbClient12waitActivityERK5QHashI7QString8QVariantE @ 31 NONAME
-	_ZThn8_N18HsActivityDbClient14launchActivityERK5QHashI7QString8QVariantE @ 32 NONAME
-	_ZThn8_N18HsActivityDbClient14removeActivityERK5QHashI7QString8QVariantE @ 33 NONAME
-	_ZThn8_N18HsActivityDbClient14updateActivityERK5QHashI7QString8QVariantE @ 34 NONAME
-	_ZThn8_N18HsActivityDbClient21applicationActivitiesER5QListI5QHashI7QString8QVariantEERKS4_ @ 35 NONAME
-	_ZThn8_N18HsActivityDbClient27removeApplicationActivitiesERK5QHashI7QString8QVariantE @ 36 NONAME
+	_ZN18HsActivityDbClient11addActivityERK5QHashI7QString8QVariantES5_ @ 2 NONAME
+	_ZN18HsActivityDbClient11dataChangedEv @ 3 NONAME
+	_ZN18HsActivityDbClient11qt_metacallEN11QMetaObject4CallEiPPv @ 4 NONAME
+	_ZN18HsActivityDbClient11qt_metacastEPKc @ 5 NONAME
+	_ZN18HsActivityDbClient12getThumbnailE5QSize7QStringS1_Pv @ 6 NONAME
+	_ZN18HsActivityDbClient12waitActivityERK5QHashI7QString8QVariantE @ 7 NONAME
+	_ZN18HsActivityDbClient14launchActivityERK5QHashI7QString8QVariantE @ 8 NONAME
+	_ZN18HsActivityDbClient14removeActivityERK5QHashI7QString8QVariantE @ 9 NONAME
+	_ZN18HsActivityDbClient14updateActivityERK5QHashI7QString8QVariantES5_ @ 10 NONAME
+	_ZN18HsActivityDbClient16notifyDataChangeEv @ 11 NONAME
+	_ZN18HsActivityDbClient16staticMetaObjectE @ 12 NONAME DATA 16
+	_ZN18HsActivityDbClient17activityRequestedERK7QString @ 13 NONAME
+	_ZN18HsActivityDbClient18thumbnailRequestedE7QPixmapPv @ 14 NONAME
+	_ZN18HsActivityDbClient19getStaticMetaObjectEv @ 15 NONAME
+	_ZN18HsActivityDbClient21applicationActivitiesER5QListI5QHashI7QString8QVariantEERKS4_ @ 16 NONAME
+	_ZN18HsActivityDbClient22asyncRequestCompleatedEii @ 17 NONAME
+	_ZN18HsActivityDbClient22asyncRequestCompleatedEiiRK7QPixmapPv @ 18 NONAME
+	_ZN18HsActivityDbClient22asyncRequestCompleatedEiiRK7QString @ 19 NONAME
+	_ZN18HsActivityDbClient27removeApplicationActivitiesERK5QHashI7QString8QVariantE @ 20 NONAME
+	_ZN18HsActivityDbClient7connectEv @ 21 NONAME
+	_ZN18HsActivityDbClientC1EP7QObject @ 22 NONAME
+	_ZN18HsActivityDbClientC2EP7QObject @ 23 NONAME
+	_ZN18HsActivityDbClientD0Ev @ 24 NONAME
+	_ZN18HsActivityDbClientD1Ev @ 25 NONAME
+	_ZN18HsActivityDbClientD2Ev @ 26 NONAME
+	_ZNK18HsActivityDbClient10metaObjectEv @ 27 NONAME
+	_ZTI18HsActivityDbClient @ 28 NONAME
+	_ZTV18HsActivityDbClient @ 29 NONAME
+	_ZThn12_N18HsActivityDbClient22asyncRequestCompleatedEii @ 30 NONAME
+	_ZThn12_N18HsActivityDbClient22asyncRequestCompleatedEiiRK7QPixmapPv @ 31 NONAME
+	_ZThn12_N18HsActivityDbClient22asyncRequestCompleatedEiiRK7QString @ 32 NONAME
+	_ZThn8_N18HsActivityDbClient10activitiesER5QListI5QHashI7QString8QVariantEE @ 33 NONAME
+	_ZThn8_N18HsActivityDbClient11addActivityERK5QHashI7QString8QVariantES5_ @ 34 NONAME
+	_ZThn8_N18HsActivityDbClient12waitActivityERK5QHashI7QString8QVariantE @ 35 NONAME
+	_ZThn8_N18HsActivityDbClient14launchActivityERK5QHashI7QString8QVariantE @ 36 NONAME
+	_ZThn8_N18HsActivityDbClient14removeActivityERK5QHashI7QString8QVariantE @ 37 NONAME
+	_ZThn8_N18HsActivityDbClient14updateActivityERK5QHashI7QString8QVariantES5_ @ 38 NONAME
+	_ZThn8_N18HsActivityDbClient21applicationActivitiesER5QListI5QHashI7QString8QVariantEERKS4_ @ 39 NONAME
+	_ZThn8_N18HsActivityDbClient27removeApplicationActivitiesERK5QHashI7QString8QVariantE @ 40 NONAME
+	_ZN18HsActivityDbClient12activityDataER8QVariantRK5QHashI7QStringS0_E @ 41 NONAME
+	_ZThn8_N18HsActivityDbClient12activityDataER8QVariantRK5QHashI7QStringS0_E @ 42 NONAME
 
--- a/activityfw/activitydatabase/hsactivitydbclient/hsactivitydbclient.pro	Fri Jun 11 16:25:06 2010 +0100
+++ b/activityfw/activitydatabase/hsactivitydbclient/hsactivitydbclient.pro	Thu Jul 22 16:37:03 2010 +0100
@@ -29,11 +29,13 @@
 symbian{
 TARGET.UID3 = 0xE467C21E
 
-HEADERS   += ../s60/inc/hsserializer.h \
+HEADERS   += ../s60/inc/afentry.h \
+             ../s60/inc/hsserializer.h \
              s60/inc/hsactivitydbclient_p.h \
 			 s60/inc/hsactivitydbasyncrequest_p.h
 
-SOURCES   += ../s60/src/hsserializer.cpp \
+SOURCES   += ../s60/src/afentry.cpp \
+             ../s60/src/hsserializer.cpp \
              s60/src/hsactivitydbclient_p.cpp \
 			 s60/src/hsactivitydbasyncrequest_p.cpp
 
--- a/activityfw/activitydatabase/hsactivitydbclient/inc/hsactivitydbasyncrequestobserver.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/activityfw/activitydatabase/hsactivitydbclient/inc/hsactivitydbasyncrequestobserver.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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 Jun 11 16:25:06 2010 +0100
+++ b/activityfw/activitydatabase/hsactivitydbclient/inc/hsactivitydbclient.h	Thu Jul 22 16:37:03 2010 +0100
@@ -65,18 +65,18 @@
      * @see int HsActivityDbAsyncRequestObserver::asyncRequestCompleated(int, int, QPixmap&)
      */
     void asyncRequestCompleated(int, int, const QPixmap&, void*);
+    
 
     /**
      * Interface implementation.
-     * @see int HsActivityDbClientInterface::saveActivity(const QVariantHash&)
+     * @see int HsActivityDbAsyncRequestObserver::asyncRequestCompleated(int, int)
      */
-    int addActivity(const QVariantHash &);
+    void asyncRequestCompleated(int result,
+                                int requestType);
 
-    /**
-     * Interface implementation.
-     * @see int HsActivityDbClientInterface::updateActivity(const QVariantHash&)
-     */
-    int updateActivity(const QVariantHash &);
+    int addActivity(const QVariantHash &, const QVariantHash &);
+
+    int updateActivity(const QVariantHash &, const QVariantHash &);
 
     /**
      * Interface implementation.
@@ -105,10 +105,16 @@
 
     /**
      * Interface implementation.
+     * @see int HsActivityDbClientInterface::activityData(QVariant &, const QVariantHash &)
+     */
+    int activityData(QVariant &result, const QVariantHash &activity);
+                              
+    /**
+     * 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 +125,8 @@
      */
     //getThumbnail(resolution, thumbnailPath, "image/png", data)
     int getThumbnail(QSize size, QString imagePath, QString mimeType, void* userDdata);
+    
+    int notifyDataChange();
 
 signals:
     /**
@@ -133,6 +141,8 @@
      */
     void thumbnailRequested(QPixmap thumbnailPixmap, void *userData);
     
+    void dataChanged();
+    
 private:
     /**
      * Private client implementation.
--- a/activityfw/activitydatabase/hsactivitydbclient/s60/inc/hsactivitydbasyncrequest_p.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/activityfw/activitydatabase/hsactivitydbclient/s60/inc/hsactivitydbasyncrequest_p.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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 Jun 11 16:25:06 2010 +0100
+++ b/activityfw/activitydatabase/hsactivitydbclient/s60/inc/hsactivitydbclient_p.h	Thu Jul 22 16:37:03 2010 +0100
@@ -30,155 +30,78 @@
                                   public HsActivityDbClientInterface
 {
 public:
-    /**
-     * Constructor
-     */
     HsActivityDbClientPrivate(HsActivityDbAsyncRequestObserver &);
 
-    /**
-     * Destructor
-     */
     ~HsActivityDbClientPrivate();
 
-    /**
-     * Function establish connection to activity server
-     * @return 0 on succees, error code otherwise
-     */
     int connect();
 
-    /**
-     * Interface implementation.
-     * @see int HsActivityDbClientInterface::addActivity(const QVariantHash &)
-     */
-    int addActivity(const QVariantHash &);
+    int addActivity(const QVariantHash &privateData, 
+                    const QVariantHash &publicData);
 
-    /**
-     * Interface implementation.
-     * @see int HsActivityDbClientInterface::updateActivity(const QVariantHash &)
-     */
-    int updateActivity(const QVariantHash &);
+    int updateActivity(const QVariantHash &privateData, 
+                       const QVariantHash &publicData);
 
-    /**
-     * Interface implementation.
-     * @see int HsActivityDbClientInterface::removeActivity(const QVariantHash &)
-     */
     int removeActivity(const QVariantHash &activity);
 
-    /**
-     * Interface implementation.
-     * @see int HsActivityDbClientInterface::removeApplicationActivities(const QVariantHash &)
-    */
     int removeApplicationActivities(const QVariantHash &activity);
 
-    /**
-     * Interface implementation.
-     * @see int HsActivityDbClientInterface::activities(QList<QVariantHash> &);
-     */
     int activities(QList<QVariantHash> &);
 
-    /**
-     * Interface implementation.
-     * @see int HsActivityDbClientInterface::applicationActivities(QList<QVariantHash> &, const QVariantHash &)
-     */
     int applicationActivities(QList<QVariantHash>&, const QVariantHash &);
 
-    /**
-     * Interface implementation.
-     * @see int HsActivityDbClientInterface::waitActivity(const QVariantHash &)
-     */
+    int activityData(QVariant &result, const QVariantHash &activity);
+    
     int waitActivity(const QVariantHash &activity);
     
     int getThumbnail(QSize size, QString imagePath, QString  mimeType, void *userDdata);
+    
+    int notifyDataChange();
 
-    /**
-     * Interface implementation.
-     * @see int HsActivityDbClientInterface::launchActivity(const QVariantHash &)
-     */
     int launchActivity(const QVariantHash &);
 
-    /**
-     * Interface implementation.
-     * @see int HsActivityDbClientInterface::cancelWaitActivity()
-     */
     int cancelWaitActivity();
-    
+
+    int cancelNotifyDataChange();
+
 public:
-    /**
-     * Function get cached data from server
-     * @param taskId - request task id
-     * @param dst - destination, preallocated buffer
-     */
     void getData(int taskId, RBuf8 &dst);
 
-    /**
-     * Function initialize aync request
-     * @param func - requested function
-     * @param data - request data
-     * @param status - request status
-     */
     void sendDataAsync(int func,const TIpcArgs &data, TRequestStatus &status);
-    
-//    void emitActivityRequested();
-//    void emitThumbnailRequested();
-    
+
 public:
     void PushL(HsActivityDbAsyncRequestPrivate * task);
+
     void Pop(HsActivityDbAsyncRequestPrivate *task);
 
 private:
-    /**
-     * Function start activity server process.
-     * Function can leave on failure.
-     */
     void startServerL();
 
-    /**
-     * Function establish connection to activity server.
-     * Function can leave on failure
-     */
     void connectL();
 
-    /**
-     * Function execute remote call request.
-     * @param function - remote function identyfier
-     * @param activity - remote function parameters
-     */
-    void execSimpleRequestL(int function, const QVariantHash &activity);
+    void execSimpleRequestL(int function, 
+                            const QVariantHash &privateData, 
+                            const QVariantHash &publicData);
 
-    /**
-     * Function retrieve current activity name for application.
-     * Function can leave on failure
-     * @param  result - activity name
-     * @param activity - request filtering rules
-     */
-    void requestedActivityNameL(QString &result,
-                                const QVariantHash &activity);
 
-    /**
-     * Function retrieve all stored activity
-     * Function can leave on failure
-     * @param result - list of activity
-     */
     void activitiesL(QList<QVariantHash>& result);
 
-    /**
-     * Function retrieve all stored activity
-     * Function can leave on failure
-     * @param result - list of activity
-     * @param cond - request conditions
-     */
     void applicationActivitiesL(QList<QVariantHash>& result,
                                 const QVariantHash &cond);
 
-    void waitActivityL(const QVariantHash &activity);
-    
+    void activityDataL(QVariant &result, const QVariantHash &activity);
+
+    void launchActivityL(const QVariantHash &activity);
+
     void getThumbnailL(QSize size, QString imagePath, QString  mimeType, void *userDdata);
+
+    int checkDataConstraint(int func, const QVariantHash &data);
+
+    int execute(int func, const QVariantHash &privateData, const QVariantHash &publicData);
+
+    int execute(int func, QList<QVariantHash>&dst, const QVariantHash &src);
+
 private:
-    /**
-     * Async request handler
-     * Own
-     */
-    HsActivityDbAsyncRequestPrivate *mAsyncDataHandler;
     RPointerArray<HsActivityDbAsyncRequestPrivate> mAsyncTasks;
     HsActivityDbAsyncRequestObserver& mObserver;
 };
--- a/activityfw/activitydatabase/hsactivitydbclient/s60/src/hsactivitydbasyncrequest_p.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/activityfw/activitydatabase/hsactivitydbclient/s60/src/hsactivitydbasyncrequest_p.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -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 Jun 11 16:25:06 2010 +0100
+++ b/activityfw/activitydatabase/hsactivitydbclient/s60/src/hsactivitydbclient_p.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -14,41 +14,45 @@
 * Description:
 *
 */
+#include <fbs.h>
+#include <s32mem.h>
+
+#include <qvariant.h>
+#include <XQConversions>
 
 #include "hsactivitydbclient_p.h"
 #include "hsactivitydbasyncrequest_p.h"
 #include "hsactivityglobals.h"
 #include "hsserializer.h"
-#include <qvariant.h>
-#include <xqconversions>
+#include "afentry.h"
+
 
 
 // -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
+/**
+ * Constructor
+ */
 HsActivityDbClientPrivate::HsActivityDbClientPrivate(HsActivityDbAsyncRequestObserver &observer):
     mObserver(observer)
 {
-    mAsyncDataHandler = HsActivityDbAsyncRequestPrivate::newWaitActivityL(
-            observer, *this);
+
 }
 
 // -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
+/**
+ * Destructor
+ */
 HsActivityDbClientPrivate::~HsActivityDbClientPrivate()
 {
     mAsyncTasks.ResetAndDestroy();
-    delete mAsyncDataHandler;
     Close();
 }
 
 // -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
+/**
+ * Function establish connection to activity server
+ * @return 0 on succees, error code otherwise
+ */
 int HsActivityDbClientPrivate::connect()
 {
     TRAPD(errNo, connectL());
@@ -56,90 +60,91 @@
 }
 
 // -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-int HsActivityDbClientPrivate::addActivity(const QVariantHash &activity)
+/**
+ * Interface implementation.
+ * @see int HsActivityDbClientInterface::addActivity(const QVariantHash &)
+ */
+int HsActivityDbClientPrivate::addActivity(const QVariantHash &privateData,
+                                           const QVariantHash &publicData)
 {
-    int errNo(KErrCorrupt);
-    if (activity.end() != activity.find(ActivityApplicationKeyword) &&
-        activity.end() != activity.find(ActivityActivityKeyword)) {
-        TRAP(errNo, execSimpleRequestL(AddActivity, activity);)
-    }
-    return errNo;
+    return execute(AddActivity, privateData, publicData);
+    
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation.
+ * @see int HsActivityDbClientInterface::updateActivity(const QVariantHash &)
+ */
+int HsActivityDbClientPrivate::updateActivity(const QVariantHash &privateData,
+                                              const QVariantHash &publicData)
+{
+    return execute(UpdateActivity, privateData, publicData);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation.
+ * @see int HsActivityDbClientInterface::removeActivity(const QVariantHash &)
+ */
+int HsActivityDbClientPrivate::removeActivity(const QVariantHash &activity)
+{
+    return execute(RemoveActivity, QVariantHash(), activity);
 }
 
 // -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-int HsActivityDbClientPrivate::updateActivity(const QVariantHash &activity)
+/**
+ * Interface implementation.
+ * @see int HsActivityDbClientInterface::removeApplicationActivities(const QVariantHash &)
+*/
+
+int HsActivityDbClientPrivate::removeApplicationActivities(const QVariantHash &activity)
 {
-    int errNo(KErrCorrupt);
-    if (activity.end() != activity.find(ActivityApplicationKeyword) &&
-        activity.end() != activity.find(ActivityActivityKeyword)) {
-        TRAP(errNo, execSimpleRequestL(UpdateActivity, activity);)
-    }
-    return errNo;
+    return execute(RemoveApplicationActivities, QVariantHash(), activity);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation.
+ * @see int HsActivityDbClientInterface::activities(QList<QVariantHash> &);
+ */
+int HsActivityDbClientPrivate::activities(QList<QVariantHash>& result)
+{
+    return execute(Activities, result, QVariantHash());
 }
 
 // -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-int HsActivityDbClientPrivate::removeActivity(const QVariantHash &activity)
+/**
+ * Interface implementation.
+ * @see int HsActivityDbClientInterface::applicationActivities(QList<QVariantHash> &, const QVariantHash &)
+ */
+int HsActivityDbClientPrivate::applicationActivities(QList<QVariantHash>& result,
+        const QVariantHash &condition)
 {
-    int errNo(KErrCorrupt);
-    if (activity.end() != activity.find(ActivityApplicationKeyword) &&
-        activity.end() != activity.find(ActivityActivityKeyword)) {
-        TRAP(errNo, execSimpleRequestL(RemoveActivity, activity);)
-    }
+    return execute(ApplicationActivities, result, condition);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation.
+ * @see int HsActivityDbClientInterface::activityData(QVariant &, const QVariantHash &)
+ */
+int HsActivityDbClientPrivate::activityData(QVariant &result, const QVariantHash &activity)
+{
+    TRAPD(errNo,
+    User::LeaveIfError(checkDataConstraint(ApplicationActivity, activity));
+    activityDataL(result, activity);)
     return errNo;
 }
 
 // -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-int HsActivityDbClientPrivate::removeApplicationActivities(const QVariantHash &activity)
-{
-    int errNo(KErrCorrupt);
-    if (activity.end() != activity.find(ActivityApplicationKeyword)) {
-        TRAP(errNo, execSimpleRequestL(RemoveApplicationActivities, activity);)
-    }
-    return errNo;
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-int HsActivityDbClientPrivate::activities(QList<QVariantHash>& result)
-{
-    TRAPD(errNo, activitiesL(result));
-    return errNo;
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-int HsActivityDbClientPrivate::applicationActivities(QList<QVariantHash>& result,
-        const QVariantHash &condition)
-{
-    TRAPD(errNo, applicationActivitiesL(result, condition));
-    return errNo;
-}
-
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
+/**
+ * Interface implementation.
+ * @see int HsActivityDbClientInterface::waitActivity(const QVariantHash &)
+ */
 int HsActivityDbClientPrivate::waitActivity(const QVariantHash &activity)
 {
-    TRAPD(errNo, waitActivityL(activity);)
-    return errNo;
+    return execute(WaitActivity, QVariantHash(), activity);
 }
 
 // -----------------------------------------------------------------------------
@@ -156,16 +161,26 @@
 //
 // -----------------------------------------------------------------------------
 //
-int HsActivityDbClientPrivate::launchActivity(const QVariantHash &activity)
+int HsActivityDbClientPrivate::notifyDataChange()
 {
-    TRAPD(errNo, execSimpleRequestL(LaunchActivity, activity);)
-    return errNo;
+    return execute(NotifyChange, QVariantHash(), QVariantHash());
 }
 
 // -----------------------------------------------------------------------------
-//
+/**
+ * Interface implementation.
+ * @see int HsActivityDbClientInterface::launchActivity(const QVariantHash &)
+ */
+int HsActivityDbClientPrivate::launchActivity(const QVariantHash &activity)
+{
+    return execute(LaunchActivity, QVariantHash(), activity);
+}
+
 // -----------------------------------------------------------------------------
-//
+/**
+ * Interface implementation.
+ * @see int HsActivityDbClientInterface::cancelWaitActivity()
+ */
 int HsActivityDbClientPrivate::cancelWaitActivity()
 {
     return SendReceive(CancelWait, TIpcArgs());
@@ -175,6 +190,16 @@
 //
 // -----------------------------------------------------------------------------
 //
+int HsActivityDbClientPrivate::cancelNotifyDataChange()
+{
+    return SendReceive(CancelNotify, TIpcArgs());
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function start activity server process.
+ * Function can leave on failure.
+ */
 void HsActivityDbClientPrivate::startServerL()
 {
     RProcess server;
@@ -198,9 +223,10 @@
 }
 
 // -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
+/**
+ * Function establish connection to activity server.
+ * Function can leave on failure
+ */
 void HsActivityDbClientPrivate::connectL()
 {
     const int asyncMessageSlots(12);
@@ -224,82 +250,248 @@
 }
 
 // -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void HsActivityDbClientPrivate::execSimpleRequestL(int function, const QVariantHash &activity)
+/**
+ * Function execute remote call request.
+ * @param function - remote function identyfier
+ * @param activity - remote function parameters
+ */
+void HsActivityDbClientPrivate::execSimpleRequestL(int function,
+                                                   const QVariantHash &privateData,
+                                                   const QVariantHash &publicData)
 {
-    TPckgBuf<TInt> appId( activity.find(ActivityApplicationKeyword).value().toInt() );
-    HBufC8 *actId = XQConversions::qStringToS60Desc8(activity.find(ActivityActivityKeyword).value().toString());
+
+    TPckgBuf<TInt> bitmapHdl(0);
+    int flags(0);
+    if(publicData.end() != publicData.find(ActivityPersistence) &&
+       publicData[ActivityPersistence].toBool()) {
+        flags |= CAfEntry::Persistent;
+    }
+    if(publicData.end() != publicData.find(ActivityVisibility) &&
+       !publicData[ActivityVisibility].toBool()) {
+        flags |= CAfEntry::Invisible;
+    }
+    CFbsBitmap* bitmap(0);
+    if (publicData.end() != publicData.find(ActivityScreenshotKeyword)) {
+        bitmap = publicData[ActivityScreenshotKeyword].value<QPixmap>().toSymbianCFbsBitmap();
+        if (bitmap) {
+            CleanupStack::PushL(bitmap);
+            bitmapHdl = bitmap->Handle();
+        }
+        
+        
+    }
+
+    RBuf8 prvBuffer, pubBuffer, data;
+    CleanupClosePushL(data);
+    CleanupClosePushL(prvBuffer);
+    CleanupClosePushL(pubBuffer);
+
+    prvBuffer << privateData;
+    if (publicData.end() != publicData.find(ActivityScreenshotKeyword)) {
+        QVariantHash localData(publicData);
+        localData.remove(ActivityScreenshotKeyword);
+        pubBuffer << localData;
+    } else {
+        pubBuffer << publicData;
+    }
+    
+    HBufC *actId = XQConversions::qStringToS60Desc(publicData[ActivityActivityKeyword].toString());
     CleanupStack::PushL(actId);
-    TPckgBuf<TInt> taskId(0);
-    RBuf8 data;
-    CleanupClosePushL(data);
-    data.CreateL(256);
-    data << activity;
-    User::LeaveIfError(SendReceive(function, TIpcArgs(&appId, actId, &data, &taskId)));
+    CAfEntry *entry = CAfEntry::NewL(flags,
+                                     publicData[ActivityApplicationKeyword].toInt(),
+                                     *actId,
+                                     KNullDesC,
+                                     prvBuffer,
+                                     pubBuffer);
+    CleanupStack::PopAndDestroy(actId);
+    CleanupStack::PopAndDestroy(&pubBuffer);
+    CleanupStack::PopAndDestroy(&prvBuffer);
+
+    CleanupStack::PushL(entry);
+    data.CreateL(entry->Size());
+    RDesWriteStream stream(data);
+    CleanupClosePushL(stream);
+    stream << (*entry);
+    CleanupStack::PopAndDestroy(&stream);
+    CleanupStack::PopAndDestroy(entry);
+    User::LeaveIfError(SendReceive(function, TIpcArgs(&data, &bitmapHdl)));
+    
     CleanupStack::PopAndDestroy(&data);
-    CleanupStack::PopAndDestroy(actId);
+    if (0 != bitmap) {
+        CleanupStack::PopAndDestroy(bitmap);
+    }
+
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function retrieve all stored activity
+ * Function can leave on failure
+ * @param result - list of activity
+ */
+void HsActivityDbClientPrivate::activitiesL(QList<QVariantHash>& result)
+{
+    result.clear();
+
+    RBuf8 buffer;
+    CleanupClosePushL(buffer);
+
+    TPckgBuf<int> emptyFilter(0), length(0), taskId(0);
+    User::LeaveIfError(SendReceive(Activities,
+                                   TIpcArgs(&emptyFilter, &length, &taskId)));
+
+    CAfEntry::ReallocL(buffer, length());
+
+    User::LeaveIfError(SendReceive(GetData, TIpcArgs(&taskId, &buffer)));
+
+    RPointerArray<CAfEntry> entries;
+    CleanupClosePushL(entries);
+
+    entries << buffer;
+    buffer.Close();//release unneeded resources
+
+
+    while(entries.Count()) {
+        QVariantHash publicData;
+        publicData << entries[0]->Data(CAfEntry::Public);
+        publicData.insert(ActivityScreenshotKeyword,
+                          QString::fromUtf16(entries[0]->ImageSrc().Ptr(),
+                                             entries[0]->ImageSrc().Length()));
+        result.append(publicData);
+        entries.Remove(0);
+    }
+    CleanupStack::PopAndDestroy(&entries);
+    CleanupStack::PopAndDestroy(&buffer);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function retrieve all stored activity
+ * Function can leave on failure
+ * @param result - list of activity
+ * @param cond - request conditions
+ */
+void HsActivityDbClientPrivate::applicationActivitiesL(QList<QVariantHash>& result,
+                                                     const QVariantHash & condition)
+{
+    result.clear();
+
+    RBuf8 buffer;
+    CleanupClosePushL(buffer);
+    CAfEntry *entry = CAfEntry::NewLC(0,
+                                      condition[ActivityApplicationKeyword].toInt(),
+                                      KNullDesC,
+                                      KNullDesC,
+                                      KNullDesC8,
+                                      KNullDesC8);//filtering using application id only
+    CAfEntry::ReallocL(buffer, entry->Size());
+    RDesWriteStream writer(buffer);
+    CleanupClosePushL(writer);
+    writer << (*entry);
+    CleanupStack::PopAndDestroy(&writer);
+    CleanupStack::PopAndDestroy(entry);
+
+    TPckgBuf<int> length(0), taskId(0);
+    User::LeaveIfError(SendReceive(ApplicationActivities,
+                                   TIpcArgs(&buffer, &length, &taskId)));
+
+    CAfEntry::ReallocL(buffer, length());
+
+    User::LeaveIfError(SendReceive(GetData, TIpcArgs(&taskId, &buffer)));
+
+    RPointerArray<CAfEntry> entries;
+    CleanupClosePushL(entries);
+
+    entries << buffer;
+    buffer.Close();//release unneeded resources
+
+
+    while(entries.Count()) {
+        QVariantHash publicData;
+        publicData << entries[0]->Data(CAfEntry::Public);
+        publicData.insert(ActivityScreenshotKeyword,
+                          QString::fromUtf16(entries[0]->ImageSrc().Ptr(),
+                                             entries[0]->ImageSrc().Length()));
+        result.append(publicData);
+        entries.Remove(0);
+    }
+    CleanupStack::PopAndDestroy(&entries);
+    CleanupStack::PopAndDestroy(&buffer);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function retrieve private data of stored activity
+ * Function can leave on failure
+ * @param result - list of activity
+ * @param activity - request conditions
+ */
+void HsActivityDbClientPrivate::activityDataL(QVariant &result, const QVariantHash &activity)
+{
+    result.clear();
+
+    RBuf8 buffer;
+    CleanupClosePushL(buffer);
+
+    {   // prepare entry to send
+        HBufC *activityId = XQConversions::qStringToS60Desc(activity[ActivityActivityKeyword].toString());
+        CleanupStack::PushL(activityId);
+
+        CAfEntry *entry = CAfEntry::NewLC(0,
+                                          activity[ActivityApplicationKeyword].toInt(),
+                                          *activityId,
+                                          KNullDesC,
+                                          KNullDesC8,
+                                          KNullDesC8);//filtering using application id only
+        CAfEntry::ReallocL(buffer, entry->Size());
+        RDesWriteStream writer(buffer);
+        CleanupClosePushL(writer);
+        writer << (*entry);
+        CleanupStack::PopAndDestroy(&writer);
+        CleanupStack::PopAndDestroy(entry);
+        CleanupStack::PopAndDestroy(activityId);
+    }
+
+    {   // get data
+        TPckgBuf<int> length(0), taskId(0);
+        User::LeaveIfError(SendReceive(ApplicationActivity, TIpcArgs(&buffer, &length, &taskId)));
+
+        CAfEntry::ReallocL(buffer, length());
+        User::LeaveIfError(SendReceive(GetData, TIpcArgs(&taskId, &buffer)));
+    }
+
+    {   // read data to Qt structure
+        CAfEntry *entry = CAfEntry::NewLC();
+        RDesReadStream reader(buffer);
+        CleanupClosePushL(reader);
+        entry->InternalizeL(reader);
+        CleanupStack::PopAndDestroy(&reader);
+
+        buffer.Close(); //release unneeded resources
+
+        QVariantHash privateData;
+        privateData << entry->Data(CAfEntry::Private);
+        result = privateData.value(ActivityDataKeyword);
+
+        CleanupStack::PopAndDestroy(entry);
+    }
+    CleanupStack::PopAndDestroy(&buffer);
 }
 
 // -----------------------------------------------------------------------------
 //
 // -----------------------------------------------------------------------------
 //
-void HsActivityDbClientPrivate::activitiesL(QList<QVariantHash>& result)
-{
-    TPckgBuf<TInt> appId(0);
-    TPtrC8 actId(KNullDesC8);
-    TPtrC8 desc(KNullDesC8);
-    TPckgBuf<TInt> taskId(0);
-    User::LeaveIfError(SendReceive(Activities, 
-                       TIpcArgs(&appId, &actId, &desc, &taskId)));
-
-    int sizeBuf(appId());
-    RBuf8 data;
-    CleanupClosePushL(data);
-    data.Create(sizeBuf);
-    User::LeaveIfError(SendReceive(GetData, TIpcArgs(&taskId, &data)));
-    
-    result << data;
-    CleanupStack::PopAndDestroy(&data);
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void HsActivityDbClientPrivate::applicationActivitiesL(QList<QVariantHash>& result,
-                                                     const QVariantHash & condition)
+void HsActivityDbClientPrivate::launchActivityL(const QVariantHash &activity)
 {
-    TPckgBuf<TInt> appId = condition.find(ActivityApplicationKeyword).value().toInt();
-    TPtrC8 actId(KNullDesC8);
-    TPtrC8 desc(KNullDesC8);
-    TPckgBuf<TInt> taskId(0);
-    User::LeaveIfError(SendReceive(ApplicationActivities, 
-                       TIpcArgs(&appId, &actId, &desc, &taskId)));
+    TPckgC<TInt> applicationId(activity[ActivityApplicationKeyword].toInt());
+    HBufC8 *activityId = XQConversions::qStringToS60Desc8(activity[ActivityActivityKeyword].toString());
+    CleanupStack::PushL(activityId);
+    TPtrC8 empty(KNullDesC8);
+    User::LeaveIfError(SendReceive(LaunchActivity,
+                                   TIpcArgs(&applicationId, activityId, &empty, &empty)));
+    CleanupStack::PopAndDestroy(activityId);
 
-    int sizeBuf(appId());
-    RBuf8 data;
-    CleanupClosePushL(data);
-    data.Create(sizeBuf);
-    User::LeaveIfError(SendReceive(GetData, TIpcArgs(&taskId, &data)));
-    
-    result << data;
-    CleanupStack::PopAndDestroy(&data);
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void HsActivityDbClientPrivate::waitActivityL(const QVariantHash &activity)
-{
-    if (mAsyncDataHandler->IsActive()) {
-        User::Leave(KErrServerBusy);
-    } else {
-        mAsyncDataHandler->waitActivity(activity);
-    }
 }
 
 // -----------------------------------------------------------------------------
@@ -313,9 +505,11 @@
 }
 
 // -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
+/**
+ * Function get cached data from server
+ * @param taskId - request task id
+ * @param dst - destination, preallocated buffer
+ */
 void HsActivityDbClientPrivate::getData(int taskId, RBuf8 &data)
 {
     TPckgBuf<int> requestId(taskId);
@@ -323,11 +517,14 @@
 }
 
 // -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
+/**
+ * Function initialize aync request
+ * @param func - requested function
+ * @param data - request data
+ * @param status - request status
+ */
 void HsActivityDbClientPrivate::sendDataAsync(int func,
-                                              const TIpcArgs &data, 
+                                              const TIpcArgs &data,
                                               TRequestStatus& status)
 {
     SendReceive(func, data, status);
@@ -355,3 +552,92 @@
         mAsyncTasks.Remove(offset);
     }
 }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+int HsActivityDbClientPrivate::execute(int func, const QVariantHash &privateData, const QVariantHash &publicData)
+{
+    TRAPD(errNo,
+    User::LeaveIfError(checkDataConstraint(func, publicData));
+    switch (func) {
+    case AddActivity:
+    case UpdateActivity:
+    case RemoveActivity:
+    case RemoveApplicationActivities:
+        execSimpleRequestL(func, privateData, publicData);
+        break;
+    
+    case LaunchActivity:
+        launchActivityL(publicData);
+        break;
+    
+    case NotifyChange:
+        HsActivityDbAsyncRequestPrivate::notifyDataChangeLD(mObserver, *this);
+        break;
+    
+    case WaitActivity:
+        HsActivityDbAsyncRequestPrivate::waitActivityLD(mObserver,*this, publicData);
+        break;
+    
+    }
+    
+    )
+    return errNo;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+int HsActivityDbClientPrivate::execute(int func, 
+                                       QList<QVariantHash>&dst, 
+                                       const QVariantHash &src)
+{
+    TRAPD(errNo,
+    User::LeaveIfError(checkDataConstraint(func, src));
+    switch (func) {
+    case Activities: activitiesL(dst);break;
+    case ApplicationActivities: applicationActivitiesL(dst, src); break;
+    }
+    )
+    return errNo;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+int HsActivityDbClientPrivate::checkDataConstraint(int func, const QVariantHash &data)
+{
+    int retVal(KErrNone);
+    QStringList constraints;
+    switch(func) {
+    case AddActivity:
+    case UpdateActivity:
+        constraints << ActivityApplicationKeyword 
+                    << ActivityActivityKeyword 
+                    << ActivityScreenshotKeyword;
+        break;
+    
+    case ApplicationActivity:
+    case LaunchActivity:
+    case RemoveActivity:
+        constraints << ActivityApplicationKeyword
+                    << ActivityActivityKeyword;
+                    break;
+    
+    case WaitActivity:
+    case RemoveApplicationActivities:
+        constraints << ActivityApplicationKeyword;
+        break;
+    }
+    foreach (QString constraint, constraints) {
+        if (data.end() == data.find(constraint)) {
+            retVal = KErrCorrupt;
+            break;
+        }
+    }
+    return retVal;
+}
--- a/activityfw/activitydatabase/hsactivitydbclient/src/hsactivitydbclient.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/activityfw/activitydatabase/hsactivitydbclient/src/hsactivitydbclient.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -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,18 +89,40 @@
 //
 // -----------------------------------------------------------------------------
 //
-int HsActivityDbClient::addActivity(const QVariantHash &activity)
+void HsActivityDbClient::asyncRequestCompleated(int result,int requestType)
 {
-    return d_ptr->addActivity(activity);
+    switch(requestType) {
+    case NotifyChange:
+        if (KErrCancel != result) {
+            d_ptr->notifyDataChange();
+        }
+        if (KErrNone == result) {
+            emit dataChanged();
+        }
+        break;
+    }
 }
 
 // -----------------------------------------------------------------------------
-//
+/**
+ * Interface implementation.
+ * @see int HsActivityDbClientInterface::addActivity(const QVariantHash&)
+ */
+int HsActivityDbClient::addActivity(const QVariantHash &privateData, 
+                                    const QVariantHash &publicData)
+{
+    return d_ptr->addActivity(privateData, publicData);
+}
+
 // -----------------------------------------------------------------------------
-//
-int HsActivityDbClient::updateActivity(const QVariantHash &activity)
+/**
+ * Interface implementation.
+ * @see int HsActivityDbClientInterface::updateActivity(const QVariantHash&)
+ */
+int HsActivityDbClient::updateActivity(const QVariantHash &privateData, 
+                                       const QVariantHash &publicData)
 {
-    return d_ptr->updateActivity(activity);
+    return d_ptr->updateActivity(privateData, publicData);
 }
 
 // -----------------------------------------------------------------------------
@@ -141,9 +166,22 @@
 //
 // -----------------------------------------------------------------------------
 //
+int HsActivityDbClient::activityData(QVariant &result, const QVariantHash &activity)
+{
+    return d_ptr->activityData(result, activity);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
 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 +197,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/group/hsactivitydbserver.mmp	Fri Jun 11 16:25:06 2010 +0100
+++ b/activityfw/activitydatabase/hsactivitydbserver/group/hsactivitydbserver.mmp	Thu Jul 22 16:37:03 2010 +0100
@@ -18,23 +18,27 @@
 TARGETTYPE      exe
 UID             0 0x200267B4
 
-SYSTEMINCLUDE   /epoc32/include
+MW_LAYER_SYSTEMINCLUDE 
 
 USERINCLUDE     ../inc
 USERINCLUDE     ../../inc
+USERINCLUDE     ../../s60/inc
+USERINCLUDE     ../../../../inc
 
 SOURCEPATH      ../src
 SOURCE          main.cpp
-SOURCE          activityserver.cpp
-SOURCE          activitysession.cpp
-SOURCE          activitystorage.cpp
-SOURCE          activitydataprovidertask.cpp
-SOURCE          activitybroadcasttask.cpp
-SOURCE          activitystoragesynctask.cpp
-SOURCE          activitystorageasynctask.cpp
-SOURCE          activityobservertask.cpp
-SOURCE          activitygraphicfilescaling.cpp
-SOURCE          activitythumbnailtask.cpp
+SOURCE          afserver.cpp
+SOURCE          afsession.cpp
+SOURCE          afstorage.cpp
+SOURCE          afdataprovidertask.cpp
+SOURCE          afbroadcasttask.cpp
+SOURCE          afstoragesynctask.cpp
+SOURCE          afstorageasynctask.cpp
+SOURCE          afobservertask.cpp
+SOURCE          afthumbnailtask.cpp
+
+SOURCEPATH      ../../s60/src
+SOURCE          afentry.cpp
 
 LIBRARY        euser.lib 
 LIBRARY        estor.lib
@@ -42,8 +46,10 @@
 LIBRARY        efsrv.lib
 LIBRARY        bafl.lib
 LIBRARY        fbscli.lib
+LIBRARY        hash.lib 
 LIBRARY        bitmaptransforms.lib
 LIBRARY        imageconversion.lib
+LIBRARY        tsutils.lib
 
 CAPABILITY     ALL -TCB
 EPOCHEAPSIZE   0x100000 0x600000 // 1MB - 6MB
--- a/activityfw/activitydatabase/hsactivitydbserver/inc/activitybroadcasttask.h	Fri Jun 11 16:25:06 2010 +0100
+++ /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:
-*
-*/
-#ifndef ACTIVITYBROADCASTTASK_H
-#define ACTIVITYBROADCASTTASK_H
-
-// INCLUDES
-#include <e32std.h>
-#include <e32base.h>
-
-#include "activitytaskstorage.h"
-#include "activitytask.h"
-// CLASS DECLARATION
-
-/**
- *  CActivityBroadcastTask
- * 
- */
-class ActivityBroadcastTask
-{
-public:
-    /**
-     * Handle broadccast message request
-     * @param storage - observer tasks storage
-     * @param msg - request message that will be provided to observers
-     */
-    static void ExecuteL(MActivityTaskStorage& storage, const RMessage2& msg);
-};
-
-#endif // ACTIVITYBROADCASTTASK_H
--- a/activityfw/activitydatabase/hsactivitydbserver/inc/activitydataprovidertask.h	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +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 ACTIVITYDATAPROVIDERTASK_H
-#define ACTIVITYDATAPROVIDERTASK_H
-
-// INCLUDES
-#include <e32std.h>
-#include <e32base.h>
-
-#include "activitytaskstorage.h"
-#include "activitytask.h"
-
-/**
- *  CActivityDataProviderTask
- * 
- */
-class ActivityDataProviderTask
-{
-public:
-    /**
-     * Handle data request. Deliver data stored in other task.
-     * @param storage - data tasks storage
-     * @param msg - request message
-     */
-    static void ExecuteL(MActivityTaskStorage& storage, const RMessage2& msg);
-
-private:
-    /**
-     * Write response data to request message
-     * @param msg - destination message
-     * @param src - data source
-     */
-    static void ProvideDataL(const RMessage2& msg, const CActivityTask& src);
-
-};
-
-#endif // ACTIVITYDATAPROVIDERTASK_H
--- a/activityfw/activitydatabase/hsactivitydbserver/inc/activitygraphicfilescaling.h	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description :
- *
- */
-#ifndef ACTIVITYGRAPHICFILESSCALING_H
-#define ACTIVITYGRAPHICFILESSCALING_H
-
-#ifndef __E32SVR_H__
-#define __E32SVR_H__
-#endif
-
-
-#ifndef SYMBIAN_ENABLE_PUBLIC_PLATFORM_HEADER_SPLIT
-#define SYMBIAN_ENABLE_PUBLIC_PLATFORM_HEADER_SPLIT
-#endif
-
-#include <bitmaptransforms.h>
-
-class CImageDecoder;
-class CFbsBitmap;
-
-class MImageReadyCallBack
-{
-public:
-    virtual void ImageReadyCallBack(TInt error, const CFbsBitmap *bitmap ) = 0;
-};
-
-class CGraphicsSalingHandler : public CActive
-{
-public:
-
-enum TCurrentOperation{
-        ENone = 0,
-        EConvertBitmapFromFile = 1,
-        EScale = 2
-    };
-
-enum TKindOfScaling
-{
-   EIgnoreAspectRatio = 0,
-   EKeepAspectRatio = 1,
-   EKeepAspectRatioByExpanding = 2,
-};
-
-    ~CGraphicsSalingHandler();
-
-    static CGraphicsSalingHandler* NewL(MImageReadyCallBack &aNotify, RFs &aFs, const TDesC &aFileName, const TDesC8& aMimeType, const TSize &aNewSize, TKindOfScaling aKindOfScaling);
-    static CGraphicsSalingHandler* NewLC(MImageReadyCallBack &aNotify, RFs &aFs, const TDesC &aFileName, const TDesC8& aMimeType, const TSize &aNewSize, TKindOfScaling aKindOfScaling);
-
-protected:
-    void DoCancel();
-    void RunL();
-    TInt RunError(TInt);
-
-private:
-    void ConstructL(RFs &aFs, const TDesC &aFileName, const TDesC8& aMimeType);
-    CGraphicsSalingHandler(MImageReadyCallBack &aNotify, const TSize &aNewSize, TKindOfScaling aKindOfScaling);
-    TSize Scaling();
-
-private:
-    MImageReadyCallBack &mNotify;
-    CImageDecoder *mImageDecoder;
-    CFbsBitmap *mBitmapFromFile;
-    CFbsBitmap *mBitmapOutput;
-    CBitmapScaler *mBitmapScaler;
-    TSize mNewSize;
-    TBool mKindOfScaling;
-
-    TCurrentOperation mCurrentOperation;
-};
-
-#endif // ACTIVITYGRAPHICFILESSCALING_H
--- a/activityfw/activitydatabase/hsactivitydbserver/inc/activityobservertask.h	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-#ifndef ACTIVITYOBSERVERTASK_H
-#define ACTIVITYOBSERVERTASK_H
-
-// INCLUDES
-#include <e32std.h>
-#include <e32base.h>
-
-#include "activitytask.h"
-#include "activitytaskstorage.h"
-
-/**
- *  CActivityObserverTask
- * 
- */
-class CActivityObserverTask : public CActivityTask
-{
-public:
-    /**
-     * Destructor.
-     */
-    ~CActivityObserverTask();
-
-    /**
-     * Handle observer request. 
-     * @param globalStorage - global observers storage
-     * @param localStorage - local observers storage
-     * @param msg - request message
-     */
-    static void ExecuteLD(MActivityTaskStorage& globalStorage, 
-                          MActivityTaskStorage& localStorage,
-                          const RMessage2& msg);
-
-    /**
-     * Interface implementation
-     * @see CActivityTask::Data()
-     */
-    const TDesC8& Data() const;
-
-    /**
-     * Interface implementation
-     * @see CActivityTask::BroadcastReceivedL(const RMessage2&)
-     */
-    void BroadcastReceivedL(const RMessage2& );
-
-private:
-
-    /**
-     * Constructor for performing 1st stage construction
-     * @param globalStorage - global observers storage
-     * @param localStorage - local observers storage
-     * @param msg - request message
-     */
-    CActivityObserverTask(MActivityTaskStorage& globalStorage, 
-                          MActivityTaskStorage& localStorage,
-                          const RMessage2& msg);
-    
-    /**
-     * Write response data to requested message 
-     */
-    void WriteResponseL();
-
-private:
-    MActivityTaskStorage& mGlobalStorage;
-    MActivityTaskStorage& mLocalStorage;
-    const RMessage2 mMsg;
-    RBuf8 mData;
-};
-
-#endif // ACTIVITYOBSERVERTASK_H
--- a/activityfw/activitydatabase/hsactivitydbserver/inc/activityqueries.h	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-#ifndef ACTIVITYQUERIES_H
-#define ACTIVITYQUERIES_H
-
-
-#include <e32base.h>
-
-_LIT( KSelectRow, "SELECT * FROM Activities WHERE ApplicationId=%S AND ActivityName='%S'");
-_LIT( KSelectRows, "SELECT Data FROM Activities");
-_LIT( KSelectAppRows, "SELECT Data FROM Activities WHERE ApplicationId=%S");
-_LIT( KDeleteRow, "DELETE FROM Activities WHERE ApplicationId=%S AND ActivityName='%S'");
-_LIT( KDeleteRows, "DELETE FROM Activities WHERE ApplicationId=%S");
-
-_LIT(KApplicationColumnName, "ApplicationId");
-_LIT(KActivityColumnName, "ActivityName");
-_LIT(KDataColumnName, "Data");
-
-_LIT(KActivityTableName, "Activities");
-_LIT(KActivityIndexName, "ActivitiesKey");
-#endif  // ACTIVITYQUERIES_H
-
--- a/activityfw/activitydatabase/hsactivitydbserver/inc/activityserver.h	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +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 ACTIVITYSERVER_H
-#define ACTIVITYSERVER_H
-
-#define __E32SVR_H__
-
-// INCLUDES
-#include <e32std.h>
-#include <e32base.h>
-#include <f32file.h>    // RFs
-
-#include "activitytaskstorage.h"
-
-class CActivityStorage;
-/**
- *  CActivityServer
- * 
- */
-class CActivityServer : public CServer2,
-                        public MActivityTaskStorage
-{
-public:
-    /**
-     * Destructor.
-     */
-    ~CActivityServer();
-
-    /**
-     * Two-phased constructor.
-     */
-    static CActivityServer* NewLC();
-
-public:
-    /**
-     * Interface implementation
-     * @see MActivityTaskStorage::PushL(CActivityTask *)
-     */
-    void PushL(CActivityTask *);
-    
-    /**
-     * Interface implementation
-     * @see MActivityTaskStorage::Pop(CActivityTask *)
-     */
-    void Pop(CActivityTask *);
-    
-    /**
-     * Interface implementation
-     * @see MActivityTaskStorage::StorageData()
-     */
-    const RPointerArray<CActivityTask>& StorageData() const;
-
-private:
-
-    /**
-     * Constructor for performing 1st stage construction
-     */
-    CActivityServer();
-
-    /**
-     * 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:
-    RFs mFsSession;
-    CActivityStorage* mStorage;
-    RPointerArray<CActivityTask> mObservers;
-};
-
-#endif // ACTIVITYSERVER_H
--- a/activityfw/activitydatabase/hsactivitydbserver/inc/activitysession.h	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +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 ACTIVITYSESSION_H
-#define ACTIVITYSESSION_H
-
-#ifndef __E32SVR_H__
-#define __E32SVR_H__
-#endif 
-// INCLUDES
-#include <e32std.h>
-#include <e32base.h>
-#include <f32file.h>
-
-#include "activitytaskstorage.h"
-
-class CActivityStorage;
-/**
- *  CActivitySession
- * 
- */
-class CActivitySession : public CSession2,
-                         public MActivityTaskStorage
-{
-public:
-    // Constructors and destructor
-
-    /**
-     * Destructor.
-     */
-    ~CActivitySession();
-
-    /**
-     * Two-phased constructor.
-     * @param fileSession - initialized file system session
-     * @param taskStorage - global observers storage
-     * @param storage - data storage
-     */
-    static CActivitySession* NewL(RFs& fileSession,
-                                  MActivityTaskStorage& taskStorage, 
-                                  CActivityStorage&storage);
-
-public:
-    /**
-     * Interface implementation
-     * @see MActivityTaskStorage::PushL(CActivityTask *)
-     */
-    void PushL(CActivityTask *);
-    
-    /**
-     * Interface implementation
-     * @see MActivityTaskStorage::Pop(CActivityTask *)
-     */
-    void Pop(CActivityTask *);
-    
-    /**
-     * Interface implementation
-     * @see MActivityTaskStorage::StorageData()
-     */
-    const RPointerArray<CActivityTask>& StorageData() const;
-private:
-
-    /**
-     * Constructor for performing 1st stage construction
-     * @param fileSession - initialized file system session
-     * @param taskStorage - global observers storage
-     * @param storage - data storage
-     */
-    CActivitySession(RFs& fileSession,
-                     MActivityTaskStorage& taskStorage, 
-                     CActivityStorage& storage);
-
-    /**
-     * 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:
-    RFs& mFileSession; 
-    MActivityTaskStorage& mTasksStorage;
-    CActivityStorage& mStorage;
-    RPointerArray<CActivityTask> mRunningTasks;
-};
-
-#endif // ACTIVITYSESSION_H
--- a/activityfw/activitydatabase/hsactivitydbserver/inc/activitystorage.h	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,196 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-#ifndef ACTIVITYSTORAGE_H
-#define ACTIVITYSTORAGE_H
-
-#define __E32SVR_H__
-
-#include <e32std.h>
-#include <e32base.h>
-#include <d32dbms.h>    // RDbStoreDatabase
-#include <s32file.h>    // CFileStore & CPermanentFileStore
-
-/**
- *  CActivityStorage
- * 
- */
-class CActivityStorage : public CBase
-    {
-public:
-    /**
-     * Destructor.
-     */
-    ~CActivityStorage();
-
-    /**
-     * Two-phased constructor.
-     * @param session - initialized session to file system
-     */
-    static CActivityStorage* NewL(RFs& session);
-
-    /**
-     * Register new activity
-     * @param appId - application id
-     * @param actId - activity id
-     * @param data - activity data
-     */
-    void AddActivityL(TInt appId,const TDesC8& actId, const TDesC8& data);
-
-    /**
-     * Update activity
-     * @param appId - application id
-     * @param actId - activity id
-     * @param data - activity data
-     */
-    void UpdateActivityL(TInt appId,const TDesC8& actId, const TDesC8& data);
-
-    /**
-     * Delete activity
-     * @param appId - application id
-     * @param actId - activity id
-     */
-    void DeleteActivityL(TInt appId,const TDesC8& actId);
-
-    /**
-     * Delete activity
-     * @param appId - application id
-     */
-    void DeleteActivitiesL(TInt appId);
-
-    /**
-     * Serialize all activity into the buffer
-     * @param dst - destination buffer
-     */
-    void ActivitiesL(RBuf8 &dst);
-
-    /**
-     * Serialize application activity into the buffer
-     * @param dst - destination buffer
-     * @param appId - application id
-     */
-    void ActivitiesL(RBuf8 &dst, TInt appId);
-
-private:
-    /**
-     * Constructor for performing 1st stage construction
-     * @param session - initialized session to file system
-     */
-    CActivityStorage(RFs& session);
-
-    /**
-     * EPOC default constructor for performing 2nd stage construction
-     */
-    void ConstructL();
-
-    /**
-     * Create database and its structure
-     * @param databaseFile - database file path
-     */
-    void CreateDbL(const TDesC& databaseFile);
-
-    /**
-     * Open database
-     * @param databaseFile - database file path
-     */
-    void OpenDbL(const TDesC& databaseFile);
-
-    /**
-     * Create database structure
-     */
-    void CreateTableL();
-
-    /**
-     * Serialize activity into buffer
-     * @param dst - destination buffer
-     */
-    void GetActivitiesL(const TDesC& dst);
-
-    /**
-     * Format query to select activity row
-     * @param appId - application id
-     * @param actId - activity id
-     * @return formated sql query
-     */
-    HBufC* SelectRowLC(TInt appId, const TDesC8& actId) const;
-    
-    /**
-     * Format query to select activities for application
-     * @param appId - application id
-     * @return formated sql query
-     */
-    HBufC* SelectRowsLC(TInt appId) const;
-
-    /**
-     * Format query to delete activity
-     * @param appId - application id
-     * @param actId - activity id
-     * @return formated sql query
-     */
-    HBufC* DeleteRowLC(TInt appId, const TDesC8& actId) const;
-    
-    /**
-     * Format query to delete activities for application
-     * @param appId - application id
-     * @return formated sql query
-     */
-    HBufC* DeleteRowsLC(TInt appId) const;
-
-    /**
-     * Format sql query
-     * @format - sql format string
-     * @param appId - application id
-     * @param actId - activity id
-     * @return formated sql query
-     */
-    HBufC* BuildQueryLC(const TDesC& format, TInt appId, const TDesC8& actId) const;
-
-    /**
-     * Count require buffer size to serialize activity query result
-     * @param data - sql query result
-     * @return reuired buffer size to seriazlie activity
-     */
-    TInt DataSizeL(RDbRowSet& data)const;
-
-    /**
-     * Serialize activity query result to preallocated buffer
-     * @param dst - preallocated buffer
-     * @param view - sql query result
-     */
-    void ExternalizeL(TDes8& dst, RDbRowSet& view)const;
-
-    /**
-     * Execute sql query and result serialize into buffer
-     * @param dst - destination result buffer
-     * @param query - sql activity query 
-     */
-    void ActivitiesL(RBuf8& dst, const TDesC& query);
-
-    /**
-     * Get activity for update
-     * @param query - destination query result
-     * @param appId - application id
-     * @param actId - activity id
-     */
-    void GetActivityForUpdateL(RDbView& query, TInt appId, const TDesC8& actId);
-
-private:
-    RFs& mFsSession;
-    RDbStoreDatabase mActDb;/* For database operations                 */
-    CFileStore* mFileStore;  /* For creating and opening database files */
-};
-
-#endif // ACTIVITYSTORAGE_H
--- a/activityfw/activitydatabase/hsactivitydbserver/inc/activitystorageasynctask.h	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +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 ACTIVITYSTORAGEASYNCTASK_H
-#define ACTIVITYSTORAGEASYNCTASK_H
-
-// INCLUDES
-#include <e32std.h>
-#include <e32base.h>
-
-#include "activitytask.h"
-#include "activitytaskstorage.h"
-#include "activitystorage.h"
-
-/**
- *  CActivityStorageAsyncTask
- * 
- */
-class CActivityStorageAsyncTask : public CActivityTask
-{
-public:
-    // Constructors and destructor
-
-    /**
-     * Destructor.
-     */
-    ~CActivityStorageAsyncTask();
-
-    /**
-     * Handle asynchronous data storage requests
-     * @param taskStorage - data tasks storage
-     * @param dataStorage - data storage
-     * @param msg - request message
-     */
-    static void ExecuteLD(MActivityTaskStorage& taskStorage, 
-                          CActivityStorage& dataStorage, 
-                          const RMessage2& msg);
-
-    /**
-     * Interface implementation
-     * @see CActivityTask::Data()
-     */
-    const TDesC8& Data() const;
-
-    /**
-     * Interface implementation
-     * @see CActivityTask::BroadcastReceivedL(const RMessage2 &)
-     */
-    void BroadcastReceivedL(const RMessage2 &);
-
-private:
-
-    
-    /**
-     * Constructor for performing 1st stage construction
-     */
-    CActivityStorageAsyncTask();
-
-    /**
-     * Handle asynchronous data storage requests
-     * @param dataStorage - data storage
-     * @param msg - request message
-     */
-    void ExecuteL(CActivityStorage& dataStorage, const RMessage2& msg);
-    
-    /**
-     * Handle getting all activities request
-     * @param dataStorage - data storage
-     * @param msg - requested message
-     */
-    void AllActivitiesL(CActivityStorage& dataStorage, const RMessage2& msg);
-
-    /**
-     * Handle getting application activities request
-     * @param dataStorage - data storage
-     * @param msg - requested message
-     */
-    void ApplicationActivitiesL(CActivityStorage& dataStorage, const RMessage2& msg);
-
-    /**
-     * Write response data into request message
-     * @param msg - destination message
-     */
-    void WriteResponseL(const RMessage2& msg);
-
-private:
-    RBuf8 mData;
-};
-
-#endif // ACTIVITYSTORAGEASYNCTASK_H
--- a/activityfw/activitydatabase/hsactivitydbserver/inc/activitystoragesynctask.h	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +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 ACTIVITYSTORAGESYNCTASK_H
-#define ACTIVITYSTORAGESYNCTASK_H
-
-// INCLUDES
-#include <e32std.h>
-#include <e32base.h>
-
-#include "activitytask.h"
-#include "activitystorage.h"
-
-/**
- *  CActivityStorageSyncTask
- * 
- */
-class ActivityStorageSyncTask
-    {
-public:
-    /**
-     * Handle synchronous data storage requests
-     * @param dataStorage - data storage
-     * @param msg - request message
-     */
-    static void ExecuteL(CActivityStorage& dataStorage, 
-                         const RMessage2& msg);
-
-private:
-    /**
-     * Handle adding new activity.
-     * @param dataStorage - data storage
-     * @param msg - request message
-     */
-    static void AddActivityL(CActivityStorage& dataStorage, 
-                             const RMessage2& msg);
-
-    /**
-     * Handle updating existing activiy
-     * @param dataStorage - data storage
-     * @param msg - request message
-     */
-    static void UpdateActivityL(CActivityStorage& dataStorage, 
-                                const RMessage2& msg);
-
-    /**
-     * Handle removing activity.
-     * @param dataStorage - data storage
-     * @param msg - request message
-     */
-    static void DeleteActivityL(CActivityStorage& dataStorage, 
-                                const RMessage2& msg);
-
-    /**
-     * Handle removing all application activities.
-     * @param dataStorage - data storage
-     * @param msg - request message
-     */
-    static void DeleteApplicationActivitiesL(CActivityStorage& dataStorage, 
-                                             const RMessage2& msg);
-
-    };
-
-#endif // ACTIVITYSTORAGESYNCTASK_H
--- a/activityfw/activitydatabase/hsactivitydbserver/inc/activitytask.h	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-#ifndef ACTIVITYTASK_H
-#define ACTIVITYTASK_H
-
-class CActivityTask: public CBase
-{
-public:
-    /**
-     * Return task data 
-     */
-    virtual const TDesC8& Data() const =0;
-    
-    /**
-     * Notify instance about incoming broadcast message.
-     * @param msg - broadcast message
-     */
-    virtual void BroadcastReceivedL(const RMessage2& msg) =0;
-};
-
-#endif  //ACTIVITYTASK_H
-
--- a/activityfw/activitydatabase/hsactivitydbserver/inc/activitytaskstorage.h	Fri Jun 11 16:25:06 2010 +0100
+++ /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:
-*
-*/
-#ifndef ACTIVITYTASKSTORAGE_H
-#define ACTIVITYTASKSTORAGE_H
-#include <e32base.h>
-class CActivityTask;
-class MActivityTaskStorage
-{
-public:
-    /**
-     * Register new task instance in storage. Ownership is transfered to storage.
-     * @param task - instance that need to be registered
-     */
-    virtual void PushL(CActivityTask * task)=0;
-    
-    /**
-     * Unregister task instance from storage. Ownership is transfered to caller.
-     * @param task - instance that need to be unregistered
-     */
-    virtual void Pop(CActivityTask *)=0;
-    
-    /**
-     * List of registered tasks
-     */
-    virtual const RPointerArray<CActivityTask>& StorageData() const =0;
-};
-
-#endif  //ACTIVITYTASKSTORAGE_H
-
--- a/activityfw/activitydatabase/hsactivitydbserver/inc/activitythumbnailtask.h	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +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 ACTIVITYTHUMBNAILTASK_H
-#define ACTIVITYTHUMBNAILTASK_H
-
-#ifndef __E32SVR_H__
-#define __E32SVR_H__
-#endif
-
-#include <e32std.h>
-#include <e32base.h>
-#include <f32file.h>
-
-#include "activitytask.h"
-#include "activitytaskstorage.h"
-#include "activitygraphicfilescaling.h"
-
-class CFbsBitmap;
-
-/**
- *  CActivityThumbnailTask
- * 
- */
-class CActivityThumbnailTask : public CActivityTask,
-                               public MImageReadyCallBack
-    {
-public:
-    /**
-     * Destructor.
-     */
-    ~CActivityThumbnailTask();
-
-    static void ExecuteLD(RFs& session,
-                          MActivityTaskStorage& taskStorage,
-                          const RMessage2& message);
-
-private:
-    /**
-     * Constructor for performing 1st stage construction
-     */
-    CActivityThumbnailTask(MActivityTaskStorage& storage, const RMessage2 msg);
-
-    /**
-     * EPOC default constructor for performing 2nd stage construction
-     */
-    void ConstructL(RFs& session);
-
-    /**
-     * 
-     */
-    void ImageReadyCallBack(TInt error, const CFbsBitmap *bitmap );
-
-    const TDesC8& Data()const;
-
-    void BroadcastReceivedL(const RMessage2& );
-
-private:
-    MActivityTaskStorage& mStorage; 
-    const RMessage2 mMsg;
-    CBase* mService;
-    };
-
-#endif // ACTIVITYTHUMBNAILTASK_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activitydatabase/hsactivitydbserver/inc/afbroadcasttask.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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 AFBROADCASTTASK_H
+#define AFBROADCASTTASK_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+#include "aftaskstorage.h"
+#include "aftask.h"
+
+class AfBroadcastTask
+{
+public:
+    static void ExecuteL(MAfTaskStorage& storage, const RMessage2& msg);
+};
+
+#endif // AFBROADCASTTASK_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activitydatabase/hsactivitydbserver/inc/afdataprovidertask.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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 AFDATAPROVIDERTASK_H
+#define AFDATAPROVIDERTASK_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+#include "aftaskstorage.h"
+#include "aftask.h"
+
+class AfDataProviderTask
+{
+public:
+    static void ExecuteL(MAfTaskStorage& storage, const RMessage2& msg);
+
+private:
+    static void ProvideDataL(const RMessage2& msg, const CAfTask& src);
+
+};
+
+#endif // AFDATAPROVIDERTASK_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activitydatabase/hsactivitydbserver/inc/afobservertask.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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 AFOBSERVERTASK_H
+#define AFOBSERVERTASK_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+#include "aftask.h"
+#include "aftaskstorage.h"
+
+class CAfObserverTask : public CAfTask
+{
+public:
+    ~CAfObserverTask();
+
+    static void ExecuteLD(MAfTaskStorage& globalStorage, 
+                          MAfTaskStorage& localStorage,
+                          const RMessage2& msg);
+
+    const TDesC8& Data() const;
+
+    void BroadcastReceivedL(const RMessage2& );
+
+private:
+    CAfObserverTask(MAfTaskStorage& globalStorage, 
+                    MAfTaskStorage& localStorage,
+                    const RMessage2& msg);
+
+    void WriteResponseL();
+
+    TBool IsSessionTask(const CSession2* session);
+
+private:
+    MAfTaskStorage& mGlobalStorage;
+    MAfTaskStorage& mLocalStorage;
+    const RMessage2 mMsg;
+    RBuf8 mData;
+};
+
+#endif // AFOBSERVERTASK_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activitydatabase/hsactivitydbserver/inc/afqueries.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef AFQUERIES_H
+#define AFQUERIES_H
+
+
+#include <e32base.h>
+
+_LIT( KSelectRow, "SELECT * FROM Activities WHERE ApplicationId=%S AND ActivityName='%S'");
+_LIT( KSelectRows, "SELECT * FROM Activities");
+_LIT( KSelectAppRows, "SELECT * FROM Activities WHERE ApplicationId=%S");
+_LIT( KDeleteRow, "DELETE FROM Activities WHERE ApplicationId=%S AND ActivityName='%S'");
+_LIT( KDeleteRows, "DELETE FROM Activities WHERE ApplicationId=%S");
+_LIT( KDeleteNonPersistentActivities, "DELETE FROM Activities WHERE Flags<%S");
+
+_LIT(KApplicationColumnName, "ApplicationId");
+_LIT(KActivityColumnName, "ActivityName");
+_LIT(KFlagsColumnName, "Flags");
+_LIT(KDataColumnName, "Data");
+
+_LIT(KActivityTableName, "Activities");
+_LIT(KActivityIndexName, "ActivitiesKey");
+#endif  // AFQUERIES_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activitydatabase/hsactivitydbserver/inc/afserver.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef AFSERVER_H
+#define AFSERVER_H
+
+#define __E32SVR_H__
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <f32file.h>    // RFs
+
+#include "aftaskstorage.h"
+
+class CAfStorage;
+
+class CAfServer : public CServer2,
+                  public MAfTaskStorage
+{
+public:
+    ~CAfServer();
+
+    static CAfServer* NewLC();
+
+public:
+    void PushL(CAfTask *);
+    
+    void Pop(CAfTask *);
+    
+    const RPointerArray<CAfTask>& StorageData() const;
+    
+
+private:
+    CAfServer();
+
+    void ConstructL();
+
+    CSession2* NewSessionL(const TVersion& version, const RMessage2& message) const;
+
+    void RemoveNotValidTasks(const CSession2* session);
+
+private:
+    RFs mFsSession;
+    CAfStorage* mStorage;
+    RPointerArray<CAfTask> mObservers;
+};
+
+#endif // AFSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activitydatabase/hsactivitydbserver/inc/afsession.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 AFSESSION_H
+#define AFSESSION_H
+
+#ifndef __E32SVR_H__
+#define __E32SVR_H__
+#endif 
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <f32file.h>
+
+#include "aftaskstorage.h"
+
+class CAfStorage;
+
+class CAfSession : public CSession2,
+                   public MAfTaskStorage
+{
+public:
+    ~CAfSession();
+
+    static CAfSession* NewL(RFs& fileSession,
+                            MAfTaskStorage& taskStorage, 
+                            CAfStorage&storage);
+
+public:
+    void PushL(CAfTask *);
+
+    void Pop(CAfTask *);
+
+    const RPointerArray<CAfTask>& StorageData() const;
+
+    void RemoveNotValidTasks(const CSession2* session);
+
+private:
+    CAfSession(RFs& fileSession,
+               MAfTaskStorage& taskStorage, 
+               CAfStorage& storage);
+
+    void ConstructL();
+
+private:
+    void ServiceL(const RMessage2& message);
+
+private:
+    RFs& mFileSession; 
+    MAfTaskStorage& mTasksStorage;
+    CAfStorage& mStorage;
+    RPointerArray<CAfTask> mRunningTasks;
+};
+
+#endif // AFSESSION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activitydatabase/hsactivitydbserver/inc/afstorage.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,100 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 AFSTORAGE_H
+#define AFSTORAGE_H
+
+#define __E32SVR_H__
+
+#include <e32std.h>
+#include <e32base.h>
+#include <d32dbms.h>    // RDbStoreDatabase
+#include <s32file.h>    // CFileStore & CPermanentFileStore
+#include "afentry.h"
+
+class CAfStorage : public CBase
+    {
+public:
+    ~CAfStorage();
+
+    static CAfStorage* NewL(RFs& session);
+
+    void AddActivityL(CAfEntry &entry);
+    
+    void UpdateActivityL(CAfEntry &entry);
+
+    void DeleteActivityL(CAfEntry &entry);
+
+    void DeleteActivitiesL(CAfEntry &entry);
+
+    void ActivitiesL(RPointerArray<CAfEntry> &dst);
+
+    void ActivitiesL(RPointerArray<CAfEntry> &dst, TInt appId);
+    
+    void ActivityL(CAfEntry *&dst, CAfEntry &src);
+
+    RFs& Fs();
+
+private:
+    CAfStorage(RFs& session);
+
+    void ConstructL();
+
+    void CreateDbL(const TDesC& databaseFile);
+
+    void OpenDbL(const TDesC& databaseFile);
+
+    void CreateTableL();
+
+    void DeleteNonPersistentActivitiesL();
+
+    void GetActivitiesL(const TDesC& dst);
+
+    HBufC* SelectRowLC(TInt appId, const TDesC& actId) const;
+
+    HBufC* SelectRowsLC(TInt appId) const;
+
+    HBufC* DeleteRowLC(TInt appId, const TDesC& actId) const;
+    
+    HBufC* DeleteRowsLC(TInt appId) const;
+
+    HBufC* BuildQueryLC(const TDesC& format, TInt appId, const TDesC& actId) const;
+    
+    void ActivitiesL(RPointerArray<CAfEntry>& dst, 
+                     const TDesC& query, 
+                     CAfEntry::AccessRights rights,
+                     TInt limit = 0);
+
+    void ActivitiesL(RPointerArray<CAfEntry>& dst, 
+                     RDbView& query, 
+                     CAfEntry::AccessRights rights,
+                     TInt limit = 0);
+
+    void GetActivityForUpdateL(RDbView& query, TInt appId, const TDesC& actId);
+
+    void ReadDataL(RBuf& dst, RDbRowSet& src, TInt offset) const;
+
+    void ExternalizeDataL(RDbRowSet &dst,const CAfEntry & src, TInt offset) const;
+
+    void InternalizeDataL(CAfEntry &dst, RDbRowSet& src, TInt offset) const;
+
+private:
+    RFs& mFsSession;
+    RDbStoreDatabase mActDb;/* For database operations                 */
+    CFileStore* mFileStore;  /* For creating and opening database files */
+};
+
+#endif //AFSTORAGE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activitydatabase/hsactivitydbserver/inc/afstorageasynctask.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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:
+*
+*/
+#ifndef AFSTORAGEASYNCTASK_H
+#define AFSTORAGEASYNCTASK_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+#include "aftask.h"
+#include "aftaskstorage.h"
+#include "afstorage.h"
+
+class CAfStorageAsyncTask : public CAfTask
+{
+public:
+    ~CAfStorageAsyncTask();
+
+    static void ExecuteLD(MAfTaskStorage& taskStorage, 
+                          CAfStorage& dataStorage, 
+                          const RMessage2& msg);
+
+    const TDesC8& Data() const;
+
+    void BroadcastReceivedL(const RMessage2 &);
+
+private:
+    CAfStorageAsyncTask();
+
+    void ExecuteL(CAfStorage& dataStorage, const RMessage2& msg);
+
+    void AllActivitiesL(CAfStorage& dataStorage, const RMessage2& msg);
+
+    void ApplicationActivitiesL(CAfStorage& dataStorage, const RMessage2& msg);
+
+    void ApplicationActivityL(CAfStorage& dataStorage, const RMessage2& msg);
+
+    void WriteResponseL(const RMessage2& msg);
+
+    TBool IsSessionTask(const CSession2* session);
+
+    void ExternalizeL();
+    
+    void ExternalizeL(const CAfEntry &entry);
+
+private:
+    RBuf8 mExternalizedData;
+    RPointerArray<CAfEntry> mInternalizedData;
+};
+
+#endif // AFSTORAGEASYNCTASK_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activitydatabase/hsactivitydbserver/inc/afstoragesynctask.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,69 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 AFSTORAGESYNCTASK_H
+#define AFSTORAGESYNCTASK_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+#include "aftask.h"
+#include "afstorage.h"
+#include "aftaskstorage.h"
+
+class CAfEntry;
+/**
+ *  CActivityStorageSyncTask
+ * 
+ */
+class AfStorageSyncTask
+    {
+public:
+    static void ExecuteL(MAfTaskStorage& observers,
+                         CAfStorage& dataStorage, 
+                         const RMessage2& msg);
+
+private:
+    static void AddActivityL(CAfStorage& dataStorage, 
+                             const RMessage2& msg);
+
+    static void UpdateActivityL(CAfStorage& dataStorage, 
+                                const RMessage2& msg);
+
+    static void DeleteActivityL(CAfStorage& dataStorage, 
+                                const RMessage2& msg);
+
+    static void DeleteApplicationActivitiesL(CAfStorage& dataStorage, 
+                                             const RMessage2& msg);
+
+    static void NotifyChangeL(MAfTaskStorage& observers,
+                              const RMessage2& msg);
+
+    static void ReadEntryL(CAfEntry& entry, const RMessage2& msg);
+
+    static void CreateThumbnailL(const TDesC &path, TInt hdl);
+
+    static void ThumbnailPathL(RBuf &dst, 
+                               RFs& fileSystem, 
+                               TInt uid, 
+                               const TDesC &activityName);
+
+    static HBufC8* Md5HexDigestL(const TDes8 &string);
+
+    };
+
+#endif // AFSTORAGESYNCTASK_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activitydatabase/hsactivitydbserver/inc/aftask.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef AFTASK_H
+#define AFTASK_H
+
+#include <e32base.h>
+
+class CAfTask: public CBase
+{
+public:
+    /**
+     * Return task data 
+     */
+    virtual const TDesC8& Data() const =0;
+    
+    /**
+     * Notify instance about incoming broadcast message.
+     * @param msg - broadcast message
+     */
+    virtual void BroadcastReceivedL(const RMessage2& msg) =0;
+    
+    /**
+     * Returns ETrue if task is related with session argument
+     */
+    virtual TBool IsSessionTask(const CSession2* session) =0;
+};
+
+#endif  //AFTASK_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activitydatabase/hsactivitydbserver/inc/aftaskstorage.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef AFTASKSTORAGE_H
+#define AFTASKSTORAGE_H
+#include <e32base.h>
+class CAfTask;
+class MAfTaskStorage
+{
+public:
+    /**
+     * Register new task instance in storage. Ownership is transfered to storage.
+     * @param task - instance that need to be registered
+     */
+    virtual void PushL(CAfTask * task)=0;
+    
+    /**
+     * Unregister task instance from storage. Ownership is transfered to caller.
+     * @param task - instance that need to be unregistered
+     */
+    virtual void Pop(CAfTask *)=0;
+    
+    /**
+     * List of registered tasks
+     */
+    virtual const RPointerArray<CAfTask>& StorageData() const =0;
+
+    /**
+     * Removes not valid task
+     */
+    virtual void RemoveNotValidTasks(const CSession2* session) =0;
+};
+
+#endif  //AFTASKSTORAGE_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activitydatabase/hsactivitydbserver/inc/afthumbnailtask.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef AFTHUMBNAILTASK_H
+#define AFTHUMBNAILTASK_H
+
+#ifndef __E32SVR_H__
+#define __E32SVR_H__
+#endif
+
+#include <e32std.h>
+#include <e32base.h>
+#include <f32file.h>
+
+#include "aftask.h"
+#include "aftaskstorage.h"
+#include "tsgraphicfilescalinghandler.h"
+
+class CFbsBitmap;
+
+class CAfThumbnailTask : public CAfTask,
+                         public MImageReadyCallBack
+{
+public:
+    ~CAfThumbnailTask();
+
+    static void ExecuteLD(MAfTaskStorage& taskStorage,
+                          const RMessage2& message);
+
+private:
+    CAfThumbnailTask(MAfTaskStorage& storage, const RMessage2 msg);
+
+    void ConstructL();
+
+    void ImageReadyCallBack(TInt error, const CFbsBitmap *bitmap );
+
+    const TDesC8& Data()const;
+
+    void BroadcastReceivedL(const RMessage2& );
+
+    TBool IsSessionTask(const CSession2* session);
+
+private:
+    MAfTaskStorage& mStorage; 
+    const RMessage2 mMsg;
+    CBase* mService;
+};
+
+#endif // AFTHUMBNAILTASK_H
--- a/activityfw/activitydatabase/hsactivitydbserver/src/activitybroadcasttask.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-#include "activitybroadcasttask.h"
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void ActivityBroadcastTask::ExecuteL(MActivityTaskStorage& storage, 
-                                     const RMessage2& msg)
-{
-    const RPointerArray<CActivityTask> &tasks(storage.StorageData());
-    for (TInt iter(0); iter < tasks.Count(); ++iter) {
-        (tasks[iter])->BroadcastReceivedL(msg);
-    }
-    msg.Complete(KErrNone);
-}
--- a/activityfw/activitydatabase/hsactivitydbserver/src/activitydataprovidertask.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ /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:
-*
-*/
-#include "activitydataprovidertask.h"
-#include "activitycmd.h"
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void ActivityDataProviderTask::ExecuteL(MActivityTaskStorage& storage, 
-                                       const RMessage2& msg)
-{
-    TPckgBuf<void*> requestId;
-    CActivityTask* taskPtr(0);
-    msg.Read(KRequestIdOffset, requestId);
-    
-    for (TInt iter(0);iter <storage.StorageData().Count();++iter) {
-        taskPtr = storage.StorageData()[iter];
-        if (taskPtr == requestId()) {//compare requested task address with storage objects
-            ProvideDataL(msg, *taskPtr);
-            storage.Pop(taskPtr);
-            delete taskPtr;
-            return;
-        }
-    }
-    User::Leave(KErrNotFound);
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void ActivityDataProviderTask::ProvideDataL(const RMessage2& msg, 
-                                            const CActivityTask& src)
-{
-    msg.WriteL(KResponseDataOffset, src.Data());
-    msg.Complete(KErrNone);
-}
--- a/activityfw/activitydatabase/hsactivitydbserver/src/activitygraphicfilescaling.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,192 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description :
- *
- */
-#include "activitygraphicfilescaling.h"
-#include <imageconversion.h>
-
-
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-//
-CGraphicsSalingHandler::CGraphicsSalingHandler(MImageReadyCallBack &aNotify, 
-                                               const TSize &aNewSize, 
-                                               TKindOfScaling aKindOfScaling):
-    CActive(EPriorityNormal),
-    mNotify(aNotify),
-    mNewSize(aNewSize),
-    mKindOfScaling(aKindOfScaling),
-    mCurrentOperation(ENone)
-{
-}
-
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-//
-CGraphicsSalingHandler::~CGraphicsSalingHandler()
-{
-    Cancel();
-    delete mBitmapFromFile;
-    delete mBitmapOutput;
-    delete mImageDecoder;
-    delete mBitmapScaler;
-}
-
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-//
-CGraphicsSalingHandler* CGraphicsSalingHandler::NewL(MImageReadyCallBack &aNotify,
-                                                     RFs &aFs,
-                                                     const TDesC &aFileName,
-                                                     const TDesC8& aMimeType,
-                                                     const TSize &aNewSize,
-                                                     TKindOfScaling aKindOfScaling)
-{
-    CGraphicsSalingHandler *self = CGraphicsSalingHandler::NewLC(aNotify, 
-                                                                 aFs, 
-                                                                 aFileName, 
-                                                                 aMimeType, 
-                                                                 aNewSize, 
-                                                                 aKindOfScaling);
-    CleanupStack::Pop();
-    return self;
-}
-
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-//
-CGraphicsSalingHandler* CGraphicsSalingHandler::NewLC(MImageReadyCallBack &aNotify,
-                                              RFs &aFs,
-                                              const TDesC &aFileName,
-                                              const TDesC8& aMimeType,
-                                              const TSize &aNewSize,
-                                              TKindOfScaling aKindOfScaling)
-{
-    CGraphicsSalingHandler *self = new (ELeave) CGraphicsSalingHandler(aNotify, 
-                                                                       aNewSize, 
-                                                                       aKindOfScaling);
-    CleanupStack::PushL(self);
-    self->ConstructL(aFs, aFileName, aMimeType);
-    return self;
-}
-
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-//
-void CGraphicsSalingHandler::ConstructL(RFs &aFs, const TDesC &aFileName, const TDesC8& aMimeType)
-{
-    CActiveScheduler::Add(this);
-
-    if (aFileName.Length() == 0
-        || aFs.IsValidName(aFileName) == EFalse) {
-        User::Leave(KErrPathNotFound);
-    }
-
-    mBitmapScaler = CBitmapScaler::NewL();
-    mBitmapScaler->SetQualityAlgorithm(CBitmapScaler::EMaximumQuality);
-
-    // convert *.png to bitmap
-    mImageDecoder = CImageDecoder::FileNewL(aFs, aFileName, aMimeType);
-    mBitmapFromFile = new(ELeave)CFbsBitmap();
-    const TFrameInfo frameInfo(mImageDecoder->FrameInfo(0));
-    User::LeaveIfError(mBitmapFromFile->Create(frameInfo.iOverallSizeInPixels, 
-                                               frameInfo.iFrameDisplayMode));
-    
-    mImageDecoder->Convert(&iStatus, *mBitmapFromFile, 0);
-    mCurrentOperation = EConvertBitmapFromFile;
-    SetActive();
-}
-
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-//
-void CGraphicsSalingHandler::DoCancel()
-{
-    switch (mCurrentOperation) {
-    case EConvertBitmapFromFile:
-        mImageDecoder->Cancel();
-        break;
-    case EScale:
-        mBitmapScaler->Cancel();
-        break;
-    }
-    mNotify.ImageReadyCallBack(KErrCancel, 0);
-}
-
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-//
-void CGraphicsSalingHandler::RunL()
-{
-    if(iStatus.Int()){
-        mNotify.ImageReadyCallBack(iStatus.Int(), 0);
-        return;
-    }
-
-    switch (mCurrentOperation) {
-    case EConvertBitmapFromFile: {
-            delete mImageDecoder;
-            mImageDecoder = 0;
-            
-            mBitmapOutput = new (ELeave)CFbsBitmap();
-            User::LeaveIfError(mBitmapOutput->Create(Scaling(), mBitmapFromFile->DisplayMode()));
-            mBitmapScaler->Scale(&iStatus, *mBitmapFromFile, *mBitmapOutput, EFalse);
-            mCurrentOperation = EScale;
-            SetActive();
-            break;
-        }
-    case EScale: {
-            mCurrentOperation = ENone;
-            
-            delete mBitmapScaler;
-            mBitmapScaler = 0;
-            
-            delete mBitmapFromFile;
-            mBitmapFromFile = 0;
-            
-            mNotify.ImageReadyCallBack(iStatus.Int(), mBitmapOutput);
-            break;
-        }
-    }
-}
-
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-//
-TSize CGraphicsSalingHandler::Scaling()
-{
-   TSize originalSize = mBitmapFromFile->SizeInPixels();
-   float widthFactor = mNewSize.iWidth / (float)originalSize.iWidth;
-   float heightFactor = mNewSize.iHeight / (float)originalSize.iHeight;
-   TSize retSize(mNewSize);
-   if (mKindOfScaling == CGraphicsSalingHandler::EKeepAspectRatio) {
-       retSize = (widthFactor < heightFactor) ?
-                 TSize(mNewSize.iWidth, widthFactor * originalSize.iHeight) :
-                 TSize(heightFactor * originalSize.iWidth, mNewSize.iHeight);
-   } else if (mKindOfScaling == CGraphicsSalingHandler::EKeepAspectRatioByExpanding) {
-      retSize = (widthFactor < heightFactor) ?
-                TSize(heightFactor * originalSize.iWidth, mNewSize.iHeight) :
-                TSize(mNewSize.iWidth, widthFactor * originalSize.iHeight);
-   }
-   return retSize;
-}
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-//
-TInt CGraphicsSalingHandler::RunError(TInt aError)
-{
-    mNotify.ImageReadyCallBack(aError, 0);
-    return KErrNone;
-}
--- a/activityfw/activitydatabase/hsactivitydbserver/src/activityobservertask.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +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 "activityobservertask.h"
-#include "activitycmd.h"
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-CActivityObserverTask::CActivityObserverTask(MActivityTaskStorage& globalStorage, 
-                                             MActivityTaskStorage& localStorage, 
-                                             const RMessage2& msg)
-:
-    mGlobalStorage(globalStorage),
-    mLocalStorage(localStorage),
-    mMsg(msg)
-{
-    // No implementation required
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-CActivityObserverTask::~CActivityObserverTask()
-{
-    mData.Close();
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CActivityObserverTask::ExecuteLD(MActivityTaskStorage& globalStorage, 
-                                      MActivityTaskStorage& localStorage, 
-                                      const RMessage2& msg)
-{
-    CActivityObserverTask *self = new(ELeave)CActivityObserverTask(globalStorage, 
-                                                                   localStorage, 
-                                                                   msg);
-    CleanupStack::PushL(self);
-    globalStorage.PushL(self);
-    CleanupStack::Pop(self);
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-const TDesC8& CActivityObserverTask::Data() const
-{
-    return mData;
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CActivityObserverTask::BroadcastReceivedL(const RMessage2& msg)
-{
-    if (WaitActivity == mMsg.Function() &&
-        LaunchActivity == msg.Function()) {
-        TPckgBuf<TInt> observerdId;
-        mMsg.ReadL(KRequestAppIdOffset, observerdId);
-
-        TPckgBuf<TInt> requestedId;
-        msg.ReadL(KRequestAppIdOffset, requestedId);
-        if (observerdId() == requestedId()) {
-            if (msg.GetDesLength(KRequestActOffset) > mData.MaxLength()) {
-                mData.ReAllocL(msg.GetDesLength(1));
-            }
-            msg.ReadL(KRequestActOffset, mData, 0);
-            WriteResponseL();
-            mLocalStorage.PushL(this);
-            mGlobalStorage.Pop(this);
-            mMsg.Complete(KErrNone);
-        }
-    } else if (WaitActivity == mMsg.Function() &&
-               CancelWait == msg.Function() &&
-               mMsg.Session() == msg.Session()) {
-        mGlobalStorage.Pop(this);
-        mMsg.Complete(KErrCancel);
-        delete this;
-    }
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CActivityObserverTask::WriteResponseL()
-{
-    mMsg.WriteL(KResponseDataSizeOffset, TPckgBuf<TInt>(mData.Length()));//write data size
-    mMsg.WriteL(KResponseIdOffset, TPckgBuf<CBase*>(this));//task identyfier
-}
--- a/activityfw/activitydatabase/hsactivitydbserver/src/activityserver.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,116 +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 "activityserver.h"
-#include "activitysession.h"
-#include "activitystorage.h"
-#include "activitytask.h"
-
-#include <fbs.h>
-
-_LIT( KActivityServerName, "hsactivitydbserver" );
-_LIT(KObserverAlreadyExists, "Observer task exists");
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-CActivityServer::CActivityServer()
-:
-CServer2( EPriorityStandard )
-{
-    // No implementation required
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-CActivityServer::~CActivityServer()
-{
-    delete mStorage;
-    mFsSession.Close();
-    mObservers.ResetAndDestroy();
-    RFbsSession::Disconnect();
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-CActivityServer* CActivityServer::NewLC()
-{
-    CActivityServer* self = new (ELeave) CActivityServer();
-    CleanupStack::PushL(self);
-    self->ConstructL();
-    return self;
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CActivityServer::ConstructL()
-{
-    StartL(KActivityServerName);
-    User::LeaveIfError(mFsSession.Connect());
-    User::LeaveIfError(RFbsSession::Connect(mFsSession));
-    mStorage = CActivityStorage::NewL(mFsSession);
-    mObservers.Array();
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-CSession2* CActivityServer::NewSessionL(const TVersion &, const RMessage2&) const
-{
-    return CActivitySession::NewL(const_cast<CActivityServer*>(this)->mFsSession, 
-                                  *const_cast<CActivityServer*>(this), 
-                                  *mStorage);
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CActivityServer::PushL(CActivityTask * task)
-{
-    (KErrNotFound == mObservers.Find(task)) ?
-     mObservers.AppendL(task) :
-     User::Panic(KObserverAlreadyExists, KErrAlreadyExists);
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CActivityServer::Pop(CActivityTask *task)
-{
-    const TInt offset(mObservers.Find(task));
-    if (KErrNotFound != offset) {
-        mObservers.Remove(offset);
-    }
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-const RPointerArray<CActivityTask>& CActivityServer::StorageData() const
-{
-    return mObservers;
-}
--- a/activityfw/activitydatabase/hsactivitydbserver/src/activitysession.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,150 +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 "activitysession.h"
-#include "activitytask.h"
-#include "activitycmd.h"
-
-#include "activitystorageasynctask.h"
-#include "activitystoragesynctask.h"
-#include "activityobservertask.h"
-#include "activitybroadcasttask.h"
-#include "activitydataprovidertask.h"
-#include "activitythumbnailtask.h"
-
-_LIT(KTaskAlreadyExists, "Activity task exists");
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-CActivitySession::CActivitySession(RFs& fileSession, 
-                                   MActivityTaskStorage& taskStorage, 
-                                   CActivityStorage& storage)
-:
-mFileSession(fileSession),
-mTasksStorage(taskStorage),
-mStorage(storage)
-{
-    // No implementation required
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-CActivitySession::~CActivitySession()
-{
-    mRunningTasks.ResetAndDestroy();
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-CActivitySession* CActivitySession::NewL(RFs& fileSession,
-                                         MActivityTaskStorage& taskStorage,
-                                         CActivityStorage& storage)
-{
-    CActivitySession* self = new (ELeave) CActivitySession(fileSession, 
-                                                           taskStorage, 
-                                                           storage);
-    CleanupStack::PushL(self);
-    self->ConstructL();
-    CleanupStack::Pop(self);
-    return self;
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CActivitySession::ConstructL()
-{
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CActivitySession::ServiceL(const RMessage2& message)
-{
-    switch (message.Function()) {
-    case AddActivity:
-    case UpdateActivity:
-    case RemoveActivity:
-    case RemoveApplicationActivities:
-        ActivityStorageSyncTask::ExecuteL(mStorage, message);
-        break;
-    
-    case Activities:
-    case ApplicationActivities:
-        CActivityStorageAsyncTask::ExecuteLD(*this, mStorage, message);
-        break;
-    
-    case WaitActivity:
-        CActivityObserverTask::ExecuteLD(mTasksStorage, *this, message);
-        break;
-    case GetThumbnail:
-        CActivityThumbnailTask::ExecuteLD(mFileSession, *this, message);
-        break;
-    
-    case LaunchActivity:
-    case CancelWait:
-        ActivityBroadcastTask::ExecuteL(mTasksStorage, message);
-        break;
-    
-    case GetData:
-        ActivityDataProviderTask::ExecuteL(*this,message);
-        break;
-    
-    default:
-        message.Complete(CServer2::EBadMessageNumber);
-        break;
-    }
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CActivitySession::PushL(CActivityTask * task)
-{
-    (KErrNotFound == mRunningTasks.Find(task)) ?
-     mRunningTasks.AppendL(task) :
-     User::Panic(KTaskAlreadyExists, KErrAlreadyExists);
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CActivitySession::Pop(CActivityTask *task)
-{
-    const TInt offset(mRunningTasks.Find(task));
-    if (KErrNotFound != offset) {
-        mRunningTasks.Remove(offset);
-    }
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-const RPointerArray<CActivityTask>& CActivitySession::StorageData() const
-{
-    return mRunningTasks;
-}
--- a/activityfw/activitydatabase/hsactivitydbserver/src/activitystorage.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,399 +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 "activitystorage.h"
-#include "activityqueries.h"
-#include <bautils.h>
-#include <s32mem.h>
-
-_LIT(KDbName, "activity.db");
-_LIT(KDbDrive, "c:");
-const TInt KMaxPathLength = 256;
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-CActivityStorage::CActivityStorage(RFs& session)
-:
-mFsSession(session)
-{
-    // No implementation required
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-CActivityStorage::~CActivityStorage()
-{
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-CActivityStorage* CActivityStorage::NewL(RFs& session)
-{
-    CActivityStorage* self = new (ELeave) CActivityStorage(session);
-    CleanupStack::PushL(self);
-    self->ConstructL();
-    CleanupStack::Pop(); // self;
-    return self;
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CActivityStorage::ConstructL()
-{
-    RBuf path;
-    CleanupClosePushL( path );
-    path.CreateL(KMaxPathLength);
-    User::LeaveIfError(mFsSession.PrivatePath(path ));
-    path.Append(KDbName);
-    path.Insert(0, KDbDrive);
-    BaflUtils::EnsurePathExistsL(mFsSession, path);
-    BaflUtils::FileExists(mFsSession, path) ? OpenDbL(path) : CreateDbL(path);
-    CleanupStack::PopAndDestroy(&path);
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CActivityStorage::CreateDbL(const TDesC& databaseFile)
-{
-    mFileStore = CPermanentFileStore::ReplaceL(mFsSession, 
-                                               databaseFile, 
-                                               EFileRead|EFileWrite);
-    mFileStore->SetTypeL(mFileStore->Layout());// Set file store type
-    TStreamId id = mActDb.CreateL(mFileStore);// Create stream object
-    mFileStore->SetRootL(id);// Keep database id as root of store
-    mFileStore->CommitL();// Complete creation by commiting
-    CreateTableL();
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CActivityStorage::OpenDbL(const TDesC& databaseFile)
-{
-    mFileStore = CPermanentFileStore::OpenL(mFsSession, 
-                                            databaseFile, 
-                                            EFileRead|EFileWrite);
-    mFileStore->SetTypeL(mFileStore->Layout()); /* Set file store type*/
-    mActDb.OpenL(mFileStore,mFileStore->Root());
-    CDbTableNames* tables = mActDb.TableNamesL();
-    CleanupStack::PushL(tables);
-    if (0 == tables->Count()) {
-        CreateTableL();
-    }
-    CleanupStack::PopAndDestroy(tables);
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CActivityStorage::CreateTableL()
-{
-   // Add the columns to column set
-   CDbColSet* actColSet = CDbColSet::NewLC();
-   
-   TDbCol appName(KApplicationColumnName, EDbColInt64);// Using default length
-   appName.iAttributes = TDbCol::ENotNull;
-   actColSet->AddL(appName);
-   
-   TDbCol actName(KActivityColumnName, EDbColText8);// Using default length
-   actName.iAttributes = TDbCol::ENotNull;
-   actColSet->AddL(actName);
-   
-   actColSet->AddL(TDbCol(KDataColumnName, EDbColLongText8));// Stream Data
-   
-   // Add the columns to index definition
-   CDbKey* primaryKey = CDbKey::NewLC();
-   primaryKey->AddL(TDbKeyCol(KApplicationColumnName));
-   primaryKey->AddL(TDbKeyCol(KActivityColumnName));
-   primaryKey->MakePrimary();
-
-   // Create the table
-   /*User::LeaveIfError(mActDb.CreateTable(KActivityTableName, 
-                                         *actColSet, 
-                                         *primaryKey));*/
-   User::LeaveIfError(mActDb.CreateTable(KActivityTableName, 
-                                            *actColSet));
-   /*User::LeaveIfError(mActDb.CreateIndex(KActivityIndexName, 
-                                         KActivityTableName, 
-                                         *primaryKey));*/
-   CleanupStack::PopAndDestroy(primaryKey);
-   CleanupStack::PopAndDestroy(actColSet);
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CActivityStorage::AddActivityL(TInt appId, 
-                                    const TDesC8& actId, 
-                                    const TDesC8& data)
-{
-    //verify if row already exists
-    RDbView view;
-    CleanupClosePushL(view);
-    TRAPD( errNo, GetActivityForUpdateL(view, appId, actId));
-    if (KErrNone == errNo) {
-        User::Leave(KErrAlreadyExists);
-    }
-    CleanupStack::PopAndDestroy(&view);
-    
-    //write table
-    RDbTable table;
-    CleanupClosePushL(table);
-    User::LeaveIfError(table.Open(mActDb, KActivityTableName, table.EUpdatable));
-    CDbColSet *row = table.ColSetL();
-    CleanupStack::PushL(row);
-    
-    table.InsertL();
-    table.SetColL(row->ColNo(KApplicationColumnName), TInt64(appId));
-    table.SetColL(row->ColNo(KActivityColumnName), actId);
-    
-    //write blob data
-    RDbColWriteStream stream;
-    CleanupClosePushL(stream);
-    stream.OpenL(table, row->ColNo(KDataColumnName));
-    stream.WriteL(data);
-    CleanupStack::PopAndDestroy(&stream);
-    
-    table.PutL();
-    CleanupStack::PopAndDestroy(row);
-    CleanupStack::PopAndDestroy(&table);
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CActivityStorage::UpdateActivityL(TInt appId, 
-                                       const TDesC8& actId, 
-                                       const TDesC8& data)
-{
-    RDbView view;
-    CleanupClosePushL(view);
-    GetActivityForUpdateL(view, appId, actId);
-    view.UpdateL();
-    CDbColSet* colSet = view.ColSetL();
-    CleanupStack::PushL(colSet);
-    RDbColWriteStream writeStream;
-    CleanupClosePushL(writeStream);
-    writeStream.OpenL(view, colSet->ColNo(KDataColumnName));
-    writeStream.WriteL(data);
-    CleanupStack::PopAndDestroy(&writeStream);
-    view.PutL();
-    CleanupStack::PopAndDestroy(colSet);
-    CleanupStack::PopAndDestroy(&view);
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CActivityStorage::DeleteActivityL(TInt appId,const TDesC8& actId) 
-{
-    HBufC *query(DeleteRowLC(appId, actId));
-    User::LeaveIfError(mActDb.Execute(*query));
-    CleanupStack::PopAndDestroy(query);
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CActivityStorage::DeleteActivitiesL(TInt appId)
-{
-    HBufC *query(DeleteRowsLC(appId));
-    User::LeaveIfError(mActDb.Execute(*query));
-    CleanupStack::PopAndDestroy(query);
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CActivityStorage::ActivitiesL(RBuf8 &dst)
-{
-    ActivitiesL(dst, KSelectRows() );
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CActivityStorage::ActivitiesL(RBuf8 &dst,TInt appId)
-{
-    HBufC *query(SelectRowsLC(appId));
-    ActivitiesL(dst, *query);
-    CleanupStack::PopAndDestroy(query);
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-HBufC* CActivityStorage::SelectRowLC(TInt appId, const TDesC8& actId) const 
-{
-    return BuildQueryLC(KSelectRow(),appId, actId);
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-HBufC* CActivityStorage::SelectRowsLC(TInt appId) const
-{
-    return BuildQueryLC(KSelectAppRows(), appId, KNullDesC8);
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-HBufC* CActivityStorage::DeleteRowLC(TInt appId, const TDesC8& actId) const
-{
-    return BuildQueryLC(KDeleteRow(),appId, actId);
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-HBufC* CActivityStorage::DeleteRowsLC(TInt appId) const
-{
-    return BuildQueryLC(KDeleteRows(),appId, KNullDesC8);
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-HBufC* CActivityStorage::BuildQueryLC(const TDesC& format, 
-                                      TInt appId, 
-                                      const TDesC8& actId) const
-{
-    TBuf<16> appName;
-    appName.AppendNum(appId);
-    RBuf actName;
-    CleanupClosePushL(actName);
-    actName.CreateL(actId.Length());
-    actName.Copy(actId);
-    HBufC* query = HBufC::NewL(format.Length() + 
-                               appName.Length() + 
-                               actName.Length() );
-    query->Des().AppendFormat(format, &appName, &actName);
-    CleanupStack::PopAndDestroy(&actName);
-    CleanupStack::PushL(query);
-    return query;
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-TInt CActivityStorage::DataSizeL(RDbRowSet& data)const
-{
-    TInt dataSize(sizeof(TInt));
-    CDbColSet* row = data.ColSetL();
-    CleanupStack::PushL(row);
-    const TInt dataOffset(row->ColNo(KDataColumnName));
-    for (data.FirstL(); data.AtRow(); data.NextL()) {
-        data.GetL();
-        dataSize += (sizeof(TInt) + 
-                     data.ColLength(dataOffset));
-    }
-    CleanupStack::PopAndDestroy(row);
-    return dataSize;
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CActivityStorage::ExternalizeL(TDes8& dst, RDbRowSet& src)const
-{
-    RDesWriteStream dstStream(dst);
-    CleanupClosePushL(dstStream);
-    dstStream.WriteInt32L(src.CountL());
-    RBuf8 data;
-    CleanupClosePushL(data);
-    CDbColSet* row = src.ColSetL();
-    CleanupStack::PushL(row);
-    const TInt dataOffset(row->ColNo(KDataColumnName));
-    RDbColReadStream srcStream;
-    CleanupClosePushL(srcStream);
-    for (src.FirstL(); src.AtRow(); src.NextL()) {
-        src.GetL();
-        if (data.MaxLength() < src.ColLength(dataOffset)) {
-            data.ReAllocL(src.ColLength(dataOffset));
-        }
-        data.SetLength(0);
-        srcStream.OpenL(src,dataOffset);
-        srcStream.ReadL(data, src.ColLength(dataOffset));
-        srcStream.Close();
-        dstStream.WriteInt32L(src.ColLength(dataOffset));
-        if (0 < src.ColLength(dataOffset)) {
-            dstStream.WriteL(data, src.ColLength(dataOffset));
-        }
-    }
-    CleanupStack::PopAndDestroy(&srcStream);
-    CleanupStack::PopAndDestroy(row);
-    CleanupStack::PopAndDestroy(&data);
-    CleanupStack::PopAndDestroy(&dstStream);
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CActivityStorage::ActivitiesL(RBuf8& dst, const TDesC& query)
-{
-    RDbView view;// Create a view on the database
-    CleanupClosePushL(view);
-    User::LeaveIfError(view.Prepare(mActDb, TDbQuery(query), view.EReadOnly));
-    User::LeaveIfError(view.EvaluateAll());
-    const TInt dataSize(DataSizeL(view));
-    if(dst.MaxLength() < dataSize) {
-        dst.ReAllocL(dataSize);
-    }
-    ExternalizeL(dst, view);
-    CleanupStack::PopAndDestroy(&view);
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CActivityStorage::GetActivityForUpdateL(RDbView& view, TInt appId, const TDesC8& actId)
-{
-    HBufC* query(SelectRowLC(appId, actId));
-    User::LeaveIfError(view.Prepare(mActDb, TDbQuery(*query), view.EUpdatable));
-    CleanupStack::PopAndDestroy(query);
-    User::LeaveIfError(view.EvaluateAll());
-    if (!view.FirstL()) {
-        User::Leave(KErrNotFound);
-    }
-}
--- a/activityfw/activitydatabase/hsactivitydbserver/src/activitystorageasynctask.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,126 +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 "activitystorageasynctask.h"
-#include "activitycmd.h"
-
-_LIT(KUnsupportedStorageAsyncTask, "Unsupported async storage task");
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-CActivityStorageAsyncTask::CActivityStorageAsyncTask()
-{
-    // No implementation required
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-CActivityStorageAsyncTask::~CActivityStorageAsyncTask()
-{
-    mData.Close();
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CActivityStorageAsyncTask::ExecuteLD(MActivityTaskStorage& taskStorage, 
-                                          CActivityStorage& dataStorage, 
-                                          const RMessage2& msg)
-{
-    CActivityStorageAsyncTask* self = new (ELeave) CActivityStorageAsyncTask();
-    CleanupStack::PushL(self);
-    self->ExecuteL(dataStorage, msg);
-    taskStorage.PushL(self);
-    CleanupStack::Pop(self);
-    msg.Complete(KErrNone);
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-const TDesC8& CActivityStorageAsyncTask::CActivityStorageAsyncTask::Data() const
-{
-    return mData;
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CActivityStorageAsyncTask::BroadcastReceivedL(const RMessage2& )
-{
-    // No implementation required
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CActivityStorageAsyncTask::ExecuteL(CActivityStorage& dataStorage, 
-                                         const RMessage2& msg)
-{
-    switch (msg.Function()) {
-    case Activities:
-        AllActivitiesL(dataStorage, msg);
-        break;
-    case ApplicationActivities:
-        ApplicationActivitiesL(dataStorage, msg);
-        break;
-    default:
-        //this code shouldn't be called. fatal error: means wrong session implementation 
-        User::Panic(KUnsupportedStorageAsyncTask, KErrGeneral);
-    };
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CActivityStorageAsyncTask::AllActivitiesL(CActivityStorage& dataStorage, 
-                                               const RMessage2& msg)
-{
-    dataStorage.ActivitiesL(mData);
-    WriteResponseL(msg);
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CActivityStorageAsyncTask::ApplicationActivitiesL(CActivityStorage& dataStorage, 
-                                                       const RMessage2& msg)
-{
-    TPckgBuf<TInt> appId;
-    msg.ReadL(KRequestAppIdOffset, appId);
-    dataStorage.ActivitiesL(mData, appId());
-    WriteResponseL(msg);
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CActivityStorageAsyncTask::WriteResponseL(const RMessage2& msg)
-{
-    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 Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,126 +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 "activitystoragesynctask.h"
-#include "activitycmd.h"
-
-_LIT(KUnsupportedStorageSyncTask, "Unsupported sync storage task");
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void ActivityStorageSyncTask::ExecuteL(CActivityStorage& dataStorage, const RMessage2& msg)
-{
-    switch (msg.Function()) {
-    case AddActivity: 
-        AddActivityL(dataStorage, msg);
-        break;
-    case UpdateActivity:
-        UpdateActivityL(dataStorage, msg);
-        break;
-    case RemoveActivity:
-        DeleteActivityL(dataStorage, msg);
-        break;
-    case RemoveApplicationActivities:
-        DeleteApplicationActivitiesL(dataStorage, msg);
-        break;
-    default:
-        //this code shouldn't be called. fatal error: means wrong session implementation 
-        User::Panic(KUnsupportedStorageSyncTask, KErrGeneral);
-    };
-    msg.Complete(KErrNone);
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void ActivityStorageSyncTask::AddActivityL(CActivityStorage& dataStorage, const RMessage2& msg)
-{
-    TPckgBuf<TInt> appId;
-    msg.ReadL(KRequestAppIdOffset, appId);
-    
-    RBuf8 actId;
-    CleanupClosePushL(actId);
-    actId.CreateL(msg.GetDesLengthL(KRequestActOffset));
-    msg.ReadL(KRequestActOffset, actId, 0);
-    
-    RBuf8 data;
-    CleanupClosePushL(data);
-    data.CreateL(msg.GetDesLengthL(KRequestData));
-    msg.ReadL(KRequestData, data, 0);
-    
-    dataStorage.AddActivityL(appId(), actId, data);
-    
-    CleanupStack::PopAndDestroy(&data);
-    CleanupStack::PopAndDestroy(&actId);
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void ActivityStorageSyncTask::UpdateActivityL(CActivityStorage& dataStorage, const RMessage2& msg)
-{
-    TPckgBuf<TInt> appId;
-    msg.ReadL(KRequestAppIdOffset, appId);
-    
-    RBuf8 actId;
-    CleanupClosePushL(actId);
-    actId.CreateL(msg.GetDesLengthL(KRequestActOffset));
-    msg.ReadL(KRequestActOffset, actId, 0);
-    
-    RBuf8 data;
-    CleanupClosePushL(data);
-    data.CreateL(msg.GetDesLengthL(KRequestData));
-    msg.ReadL(KRequestData, data, 0);
-    
-    dataStorage.UpdateActivityL(appId(), actId, data);
-    
-    CleanupStack::PopAndDestroy(&data);
-    CleanupStack::PopAndDestroy(&actId);
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void ActivityStorageSyncTask::DeleteActivityL(CActivityStorage& dataStorage, const RMessage2& msg)
-{
-    TPckgBuf<TInt> appId;
-    msg.ReadL(KRequestAppIdOffset, appId);
-    
-    RBuf8 actId;
-    CleanupClosePushL(actId);
-    actId.CreateL(msg.GetDesLengthL(KRequestActOffset));
-    msg.ReadL(KRequestActOffset, actId, 0);
-    
-    dataStorage.DeleteActivityL(appId(), actId);
-    
-    CleanupStack::PopAndDestroy(&actId);
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void ActivityStorageSyncTask::DeleteApplicationActivitiesL(CActivityStorage& dataStorage, const RMessage2& msg)
-{
-    TPckgBuf<TInt> appId;
-    msg.ReadL(KRequestAppIdOffset, appId);
-    dataStorage.DeleteActivitiesL(appId());
-}
--- a/activityfw/activitydatabase/hsactivitydbserver/src/activitythumbnailtask.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,130 +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 "activitythumbnailtask.h"
-#include "activitycmd.h"
-
-#include <fbs.h>
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-CActivityThumbnailTask::CActivityThumbnailTask(MActivityTaskStorage& storage, 
-                                               const RMessage2 msg)
-:
-    mStorage(storage), 
-    mMsg(msg)
-{
-    // No implementation required
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-CActivityThumbnailTask::~CActivityThumbnailTask()
-{
-    delete mService;
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CActivityThumbnailTask::ExecuteLD(RFs& session,
-                                       MActivityTaskStorage& taskStorage,
-                                       const RMessage2& message)
-{
-    CActivityThumbnailTask *self = new (ELeave)CActivityThumbnailTask(taskStorage, 
-                                                                      message);
-    CleanupStack::PushL(self);
-    self->ConstructL(session);
-    taskStorage.PushL(self);
-    CleanupStack::Pop(self);
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CActivityThumbnailTask::ConstructL(RFs& session)
-{
-    TPckgBuf<int> width(0), height(0);
-    RBuf path;
-    RBuf8 mime;
-    CleanupClosePushL(path);
-    CleanupClosePushL(mime);
-    mMsg.ReadL(0, width);
-    mMsg.ReadL(1, height);
-    path.CreateL(mMsg.GetDesLengthL(2));
-    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, 
-                                            mime, 
-                                            TSize(width(), height()), 
-                                            CGraphicsSalingHandler::EKeepAspectRatio);
-    
-    CleanupStack::PopAndDestroy(&mime);
-    CleanupStack::PopAndDestroy(&path);
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CActivityThumbnailTask::ImageReadyCallBack(TInt error,const CFbsBitmap *bitmap)
-{
-    if (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);
-        mStorage.Pop(this);
-        delete this;
-    }
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-const TDesC8& CActivityThumbnailTask::Data() const
-{
-    return KNullDesC8();
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CActivityThumbnailTask::BroadcastReceivedL(const RMessage2& )
-{
-}
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activitydatabase/hsactivitydbserver/src/afbroadcasttask.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "afbroadcasttask.h"
+
+// -----------------------------------------------------------------------------
+/**
+ * Handle broadccast message request
+ * @param storage - observer tasks storage
+ * @param msg - request message that will be provided to observers
+ */
+void AfBroadcastTask::ExecuteL(MAfTaskStorage& storage, 
+                               const RMessage2& msg)
+{
+    const RPointerArray<CAfTask> &tasks(storage.StorageData());
+    for (TInt iter(tasks.Count() - 1); iter >= 0 ; --iter ) {
+        if(EFalse == msg.IsNull()) {
+            (tasks[iter])->BroadcastReceivedL(msg);
+        }
+    }
+    if(EFalse == msg.IsNull()) {
+        msg.Complete(KErrNone);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activitydatabase/hsactivitydbserver/src/afdataprovidertask.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "afdataprovidertask.h"
+#include "activitycmd.h"
+
+// -----------------------------------------------------------------------------
+/**
+ * Handle data request. Deliver data stored in other task.
+ * @param storage - data tasks storage
+ * @param msg - request message
+ */
+void AfDataProviderTask::ExecuteL(MAfTaskStorage& storage, 
+                                  const RMessage2& msg)
+{
+    TPckgBuf<void*> requestId;
+    CAfTask* taskPtr(0);
+    msg.Read(KRequestIdOffset, requestId);
+    
+    for (TInt iter(0);iter <storage.StorageData().Count();++iter) {
+        taskPtr = storage.StorageData()[iter];
+        if (taskPtr == requestId()) {//compare requested task address with storage objects
+            ProvideDataL(msg, *taskPtr);
+            storage.Pop(taskPtr);
+            delete taskPtr;
+            return;
+        }
+    }
+    User::Leave(KErrNotFound);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Write response data to request message
+ * @param msg - destination message
+ * @param src - data source
+ */
+void AfDataProviderTask::ProvideDataL(const RMessage2& msg, 
+                                      const CAfTask& src)
+{
+    if (EFalse ==msg.IsNull()) {
+        msg.WriteL(KResponseDataOffset, src.Data());
+        msg.Complete(KErrNone);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activitydatabase/hsactivitydbserver/src/afobservertask.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,145 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "afobservertask.h"
+#include "activitycmd.h"
+
+// -----------------------------------------------------------------------------
+/**
+ * Constructor for performing 1st stage construction
+ * @param globalStorage - global observers storage
+ * @param localStorage - local observers storage
+ * @param msg - request message
+ */
+CAfObserverTask::CAfObserverTask(MAfTaskStorage& globalStorage, 
+                                 MAfTaskStorage& localStorage, 
+                                 const RMessage2& msg)
+:
+    mGlobalStorage(globalStorage),
+    mLocalStorage(localStorage),
+    mMsg(msg)
+{
+    // No implementation required
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Destructor.
+ */
+CAfObserverTask::~CAfObserverTask()
+{
+    mData.Close();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Handle observer request. 
+ * @param globalStorage - global observers storage
+ * @param localStorage - local observers storage
+ * @param msg - request message
+ */
+
+void CAfObserverTask::ExecuteLD(MAfTaskStorage& globalStorage, 
+                                MAfTaskStorage& localStorage, 
+                                const RMessage2& msg)
+{
+    CAfObserverTask *self = new(ELeave)CAfObserverTask(globalStorage, 
+                                                       localStorage, 
+                                                       msg);
+    CleanupStack::PushL(self);
+    globalStorage.PushL(self);
+    CleanupStack::Pop(self);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see CActivityTask::Data()
+ */
+const TDesC8& CAfObserverTask::Data() const
+{
+    return mData;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see CActivityTask::BroadcastReceivedL(const RMessage2&)
+ */
+void CAfObserverTask::BroadcastReceivedL(const RMessage2& msg)
+{
+    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);
+        if (observerdId() == requestedId()) {
+            if (msg.GetDesLength(KRequestActOffset) > mData.MaxLength()) {
+                mData.ReAllocL(msg.GetDesLength(1));
+            }
+            msg.ReadL(KRequestActOffset, mData, 0);
+            WriteResponseL();
+            mLocalStorage.PushL(this);
+            mGlobalStorage.Pop(this);
+            mMsg.Complete(KErrNone);
+        }
+    } else if (WaitActivity == mMsg.Function() &&
+               CancelWait == msg.Function() &&
+               mMsg.Session() == msg.Session()) {
+        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;
+    }
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Write response data to requested message 
+ */
+void CAfObserverTask::WriteResponseL()
+{
+    mMsg.WriteL(KResponseDataSizeOffset, TPckgBuf<TInt>(mData.Length()));//write data size
+    mMsg.WriteL(KResponseIdOffset, TPckgBuf<CBase*>(this));//task identyfier
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Returns ETrue if task is related with session argument
+ */
+TBool CAfObserverTask::IsSessionTask(const CSession2* session)
+{
+    return mMsg.Session() == session ? ETrue : EFalse;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activitydatabase/hsactivitydbserver/src/afserver.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,134 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include <fbs.h>
+
+#include "afserver.h"
+#include "afsession.h"
+#include "afstorage.h"
+#include "aftask.h"
+
+_LIT( KActivityServerName, "hsactivitydbserver" );
+_LIT(KObserverAlreadyExists, "Observer task exists");
+
+// -----------------------------------------------------------------------------
+/**
+ * Constructor for performing 1st stage construction
+ */
+CAfServer::CAfServer()
+:
+CServer2( EPriorityStandard )
+{
+    // No implementation required
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Destructor.
+ */
+CAfServer::~CAfServer()
+{
+    delete mStorage;
+    mFsSession.Close();
+    mObservers.ResetAndDestroy();
+    RFbsSession::Disconnect();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Two-phased constructor.
+ */
+CAfServer* CAfServer::NewLC()
+{
+    CAfServer* self = new (ELeave) CAfServer();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Default constructor for performing 2nd stage construction
+ */
+void CAfServer::ConstructL()
+{
+    StartL(KActivityServerName);
+    User::LeaveIfError(mFsSession.Connect());
+    User::LeaveIfError(RFbsSession::Connect(mFsSession));
+    mStorage = CAfStorage::NewL(mFsSession);
+    mObservers.Array();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see CServer2::NewSessionL(const TVersion&, const RMessage2&)
+ */
+CSession2* CAfServer::NewSessionL(const TVersion &, const RMessage2&) const
+{
+    return CAfSession::NewL(const_cast<CAfServer*>(this)->mFsSession, 
+                            *const_cast<CAfServer*>(this), 
+                            *mStorage);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see MAfTaskStorage::PushL(CAfTask *)
+ */
+void CAfServer::PushL(CAfTask * task)
+{
+    (KErrNotFound == mObservers.Find(task)) ?
+     mObservers.AppendL(task) :
+     User::Panic(KObserverAlreadyExists, KErrAlreadyExists);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see MAfTaskStorage::Pop(CActivityTask *)
+ */
+void CAfServer::Pop(CAfTask *task)
+{
+    const TInt offset(mObservers.Find(task));
+    if (KErrNotFound != offset) {
+        mObservers.Remove(offset);
+    }
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see MAfTaskStorage::StorageData()
+ */
+const RPointerArray<CAfTask>& CAfServer::StorageData() const
+{
+    return mObservers;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Removes not valid task
+ */
+void CAfServer::RemoveNotValidTasks(const CSession2* session)
+{
+    for (TInt i=mObservers.Count()-1; i>=0; --i) {
+        if( mObservers[i]->IsSessionTask(session) ) {
+            delete mObservers[i];
+            mObservers.Remove(i);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activitydatabase/hsactivitydbserver/src/afsession.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,177 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "afsession.h"
+#include "aftask.h"
+#include "activitycmd.h"
+
+#include "afstorageasynctask.h"
+#include "afstoragesynctask.h"
+#include "afobservertask.h"
+#include "afbroadcasttask.h"
+#include "afdataprovidertask.h"
+#include "afthumbnailtask.h"
+
+_LIT(KTaskAlreadyExists, "Activity task exists");
+
+// -----------------------------------------------------------------------------
+/**
+ * Constructor for performing 1st stage construction
+ * @param fileSession - initialized file system session
+ * @param taskStorage - global observers storage
+ * @param storage - data storage
+ */
+
+CAfSession::CAfSession(RFs& fileSession, 
+                       MAfTaskStorage& taskStorage, 
+                       CAfStorage& storage)
+:
+mFileSession(fileSession),
+mTasksStorage(taskStorage),
+mStorage(storage)
+{
+    // No implementation required
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Destructor.
+ */
+CAfSession::~CAfSession()
+{
+    RemoveNotValidTasks(this);
+    mTasksStorage.RemoveNotValidTasks(this);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Two-phased constructor.
+ * @param fileSession - initialized file system session
+ * @param taskStorage - global observers storage
+ * @param storage - data storage
+ */
+CAfSession* CAfSession::NewL(RFs& fileSession,
+                             MAfTaskStorage& taskStorage,
+                             CAfStorage& storage)
+{
+    CAfSession* self = new (ELeave) CAfSession(fileSession, 
+                                               taskStorage, 
+                                               storage);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * EPOC default constructor for performing 2nd stage construction
+ */
+void CAfSession::ConstructL()
+{
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Implements interface
+ * @see void CSession2::ServiceL(const RMessage2&)
+ */
+void CAfSession::ServiceL(const RMessage2& message)
+{
+    switch (message.Function()) {
+    case AddActivity:
+    case UpdateActivity:
+    case RemoveActivity:
+    case RemoveApplicationActivities:
+        AfStorageSyncTask::ExecuteL(mTasksStorage, mStorage, message);
+        break;
+    
+    case ApplicationActivity:
+    case Activities:
+    case ApplicationActivities:
+        CAfStorageAsyncTask::ExecuteLD(*this, mStorage, message);
+        break;
+    
+    case WaitActivity:
+    case NotifyChange:
+        CAfObserverTask::ExecuteLD(mTasksStorage, *this, message);
+        break;
+    
+    case GetThumbnail:
+        CAfThumbnailTask::ExecuteLD(*this, message);
+        break;
+    
+    case LaunchActivity:
+    case CancelWait:
+    case CancelNotify:
+        AfBroadcastTask::ExecuteL(mTasksStorage, message);
+        break;
+    
+    case GetData:
+        AfDataProviderTask::ExecuteL(*this,message);
+        break;
+    
+    default:
+        message.Complete(CServer2::EBadMessageNumber);
+        break;
+    }
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see MAfTaskStorage::PushL(CAfTask *)
+ */
+void CAfSession::PushL(CAfTask * task)
+{
+    (KErrNotFound == mRunningTasks.Find(task)) ?
+     mRunningTasks.AppendL(task) :
+     User::Panic(KTaskAlreadyExists, KErrAlreadyExists);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see MAfTaskStorage::Pop(CAfTask *)
+ */
+void CAfSession::Pop(CAfTask *task)
+{
+    const TInt offset(mRunningTasks.Find(task));
+    if (KErrNotFound != offset) {
+        mRunningTasks.Remove(offset);
+    }
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see MAfTaskStorage::StorageData()
+ */
+const RPointerArray<CAfTask>& CAfSession::StorageData() const
+{
+    return mRunningTasks;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Removes not valid task
+ */
+void CAfSession::RemoveNotValidTasks(const CSession2* session)
+{
+    if (session == this) {
+        mRunningTasks.ResetAndDestroy();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activitydatabase/hsactivitydbserver/src/afstorage.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,505 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "afstorage.h"
+#include "afqueries.h"
+#include "afentry.h"
+#include <bautils.h>
+#include <s32mem.h>
+
+_LIT(KDbName, "activity.db");
+_LIT(KDbDrive, "c:");
+const TInt KMaxPathLength = 256;
+
+// -----------------------------------------------------------------------------
+LOCAL_C void CleanupResetAndDestroy(TAny*  item)
+{
+    RPointerArray<CAfEntry> *array = static_cast< RPointerArray<CAfEntry>* >(item);
+    array->ResetAndDestroy();
+    array->Close();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Constructor for performing 1st stage construction
+ * @param session - initialized session to file system
+ */
+CAfStorage::CAfStorage(RFs& session)
+:
+mFsSession(session)
+{
+    // No implementation required
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Destructor.
+ */
+CAfStorage::~CAfStorage()
+{
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Two-phased constructor.
+ * @param session - initialized session to file system
+ */
+CAfStorage* CAfStorage::NewL(RFs& session)
+{
+    CAfStorage* self = new (ELeave) CAfStorage(session);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(); // self;
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * EPOC default constructor for performing 2nd stage construction
+ */
+void CAfStorage::ConstructL()
+{
+    RBuf path;
+    CleanupClosePushL( path );
+    path.CreateL(KMaxPathLength);
+    User::LeaveIfError(mFsSession.PrivatePath(path ));
+    path.Append(KDbName);
+    path.Insert(0, KDbDrive);
+    BaflUtils::EnsurePathExistsL(mFsSession, path);
+    BaflUtils::FileExists(mFsSession, path) ? OpenDbL(path) : CreateDbL(path);
+    CleanupStack::PopAndDestroy(&path);
+
+    DeleteNonPersistentActivitiesL();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Create database and its structure
+ * @param databaseFile - database file path
+ */
+void CAfStorage::CreateDbL(const TDesC& databaseFile)
+{
+    mFileStore = CPermanentFileStore::ReplaceL(mFsSession,
+                                               databaseFile,
+                                               EFileRead|EFileWrite);
+    mFileStore->SetTypeL(mFileStore->Layout());// Set file store type
+    TStreamId id = mActDb.CreateL(mFileStore);// Create stream object
+    mFileStore->SetRootL(id);// Keep database id as root of store
+    mFileStore->CommitL();// Complete creation by commiting
+    CreateTableL();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Open database
+ * @param databaseFile - database file path
+ */
+void CAfStorage::OpenDbL(const TDesC& databaseFile)
+{
+    mFileStore = CPermanentFileStore::OpenL(mFsSession,
+                                            databaseFile,
+                                            EFileRead|EFileWrite);
+    mFileStore->SetTypeL(mFileStore->Layout()); /* Set file store type*/
+    mActDb.OpenL(mFileStore,mFileStore->Root());
+    CDbTableNames* tables = mActDb.TableNamesL();
+    CleanupStack::PushL(tables);
+    if (0 == tables->Count()) {
+        CreateTableL();
+    }
+    CleanupStack::PopAndDestroy(tables);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Create database structure
+ */
+void CAfStorage::CreateTableL()
+{
+    // Add the columns to column set
+    CDbColSet* actColSet = CDbColSet::NewLC();
+
+    TDbCol appName(KApplicationColumnName, EDbColInt64);
+    appName.iAttributes = TDbCol::ENotNull;
+    actColSet->AddL(appName);
+
+    TDbCol actName(KActivityColumnName, EDbColText16);// Using default length
+    actName.iAttributes = TDbCol::ENotNull;
+    actColSet->AddL(actName);
+
+    TDbCol actFlags(KFlagsColumnName, EDbColInt32);
+    actFlags.iAttributes = TDbCol::ENotNull;
+    actColSet->AddL(actFlags);
+
+    actColSet->AddL(TDbCol(KDataColumnName, EDbColLongBinary));// Stream Data
+
+    // Create the table
+    User::LeaveIfError(mActDb.CreateTable(KActivityTableName,
+                                         *actColSet));
+
+    CleanupStack::PopAndDestroy(actColSet);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Delete non-persistent activities
+ */
+void CAfStorage::DeleteNonPersistentActivitiesL()
+{
+    HBufC *query(BuildQueryLC(KDeleteNonPersistentActivities(), CAfEntry::Persistent, KNullDesC));
+    User::LeaveIfError(mActDb.Execute(*query));
+    CleanupStack::PopAndDestroy(query);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Register new activity
+ * @param appId - application id
+ * @param actId - activity id
+ * @param flags - activity flags
+ * @param imgSrc - activity thumbnail source
+ * @param privateData - activity private data
+ * @param publicData - activity public data
+ */
+void CAfStorage::AddActivityL(CAfEntry& entry)
+{
+    //verify if row already exists
+    TInt errNo(KErrNone);
+    RDbView view;
+    CleanupClosePushL(view);
+    TRAP( errNo, GetActivityForUpdateL(view, entry.ApplicationId(), entry.ActivityId()));
+    if (KErrNone == errNo) {
+        User::Leave(KErrAlreadyExists);
+    }
+    CleanupStack::PopAndDestroy(&view);
+
+    //write table
+    RDbTable table;
+    CleanupClosePushL(table);
+    User::LeaveIfError(table.Open(mActDb, KActivityTableName, table.EUpdatable));
+    CDbColSet *row = table.ColSetL();
+    CleanupStack::PushL(row);
+
+    table.InsertL();
+    TRAP(errNo,
+    table.SetColL(row->ColNo(KApplicationColumnName), TInt64(entry.ApplicationId()));
+    table.SetColL(row->ColNo(KActivityColumnName), entry.ActivityId());
+    table.SetColL(row->ColNo(KFlagsColumnName), entry.Flags());
+    ExternalizeDataL(table, entry, row->ColNo(KDataColumnName));
+    table.PutL();)
+    if (KErrNone != errNo) {
+        table.Cancel();
+        User::Leave(errNo);
+    }
+    CleanupStack::PopAndDestroy(row);
+    CleanupStack::PopAndDestroy(&table);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Update activity
+ * @param entry - activity data
+ */
+void CAfStorage::UpdateActivityL(CAfEntry& entry)
+{
+    RDbView view;
+    CleanupClosePushL(view);
+    GetActivityForUpdateL(view, entry.ApplicationId(), entry.ActivityId());
+    view.UpdateL();
+    TRAPD(errNo,
+    CDbColSet* colSet = view.ColSetL();
+    CleanupStack::PushL(colSet);
+
+    view.SetColL(colSet->ColNo(KFlagsColumnName), entry.Flags());
+    ExternalizeDataL(view, entry, colSet->ColNo(KDataColumnName));
+
+    view.PutL();
+    if (KErrNone != errNo) {
+        view.Cancel();
+        User::Leave(errNo);
+    }
+    CleanupStack::PopAndDestroy(colSet);)
+
+    if (KErrNone != errNo) {
+        view.Cancel();
+        User::Leave(errNo);
+    }
+    CleanupStack::PopAndDestroy(&view);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Delete activity
+ * @param appId - application id
+ * @param actId - activity id
+ */
+void CAfStorage::DeleteActivityL(CAfEntry& entry)
+{
+    HBufC *query(DeleteRowLC(entry.ApplicationId(), entry.ActivityId()));
+    User::LeaveIfError(mActDb.Execute(*query));
+    CleanupStack::PopAndDestroy(query);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CAfStorage::DeleteActivitiesL(CAfEntry& entry)
+{
+    HBufC *query(DeleteRowsLC(entry.ApplicationId()));
+    User::LeaveIfError(mActDb.Execute(*query));
+    CleanupStack::PopAndDestroy(query);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CAfStorage::ActivitiesL(RPointerArray<CAfEntry>& dst)
+{
+    ActivitiesL(dst, KSelectRows(), CAfEntry::Public);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Serialize application activity into the buffer
+ * @param dst - destination buffer
+ * @param appId - application id
+ */
+void CAfStorage::ActivitiesL(RPointerArray<CAfEntry>& dst,TInt appId)
+{
+    HBufC *query(SelectRowsLC(appId));
+    ActivitiesL(dst, *query, CAfEntry::Private);
+    CleanupStack::PopAndDestroy(query);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Serialize application activity into the buffer
+ * @param dst - destination entry
+ * @param src - condition pattern
+ */
+void CAfStorage::ActivityL(CAfEntry *&dst, CAfEntry& src)
+{
+    HBufC *query = SelectRowLC(src.ApplicationId(), src.ActivityId());
+    RPointerArray<CAfEntry> array;
+    CleanupStack::PushL(TCleanupItem(CleanupResetAndDestroy,&array));
+    ActivitiesL(array, *query, CAfEntry::Private, 1);
+    if (0 >= array.Count()) {
+        User::Leave(KErrNotFound);
+    }
+    dst = array[0];
+    array.Remove(0);
+    CleanupStack::PopAndDestroy(&array);
+    CleanupStack::PopAndDestroy(query);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Provide initialized file system session
+ * @return file system session
+ */
+RFs& CAfStorage::Fs()
+{
+    return mFsSession;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Format query to select activity row
+ * @param appId - application id
+ * @param actId - activity id
+ * @return formated sql query
+ */
+HBufC* CAfStorage::SelectRowLC(TInt appId, const TDesC& actId) const
+{
+    return BuildQueryLC(KSelectRow(),appId, actId);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Format query to select activities for application
+ * @param appId - application id
+ * @return formated sql query
+ */
+HBufC* CAfStorage::SelectRowsLC(TInt appId) const
+{
+    return BuildQueryLC(KSelectAppRows(), appId, KNullDesC);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Format query to delete activity
+ * @param appId - application id
+ * @param actId - activity id
+ * @return formated sql query
+ */
+HBufC* CAfStorage::DeleteRowLC(TInt appId, const TDesC& actId) const
+{
+    return BuildQueryLC(KDeleteRow(),appId, actId);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Format query to delete activities for application
+ * @param appId - application id
+ * @return formated sql query
+ */
+HBufC* CAfStorage::DeleteRowsLC(TInt appId) const
+{
+    return BuildQueryLC(KDeleteRows(),appId, KNullDesC);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Format sql query
+ * @format - sql format string
+ * @param appId - application id
+ * @param actId - activity id
+ * @return formated sql query
+ */
+HBufC* CAfStorage::BuildQueryLC(const TDesC& format,
+                                      TInt appId,
+                                      const TDesC& actId) const
+{
+    TBuf<16> appName;
+    appName.AppendNum(appId);
+    RBuf actName;
+    CleanupClosePushL(actName);
+    actName.CreateL(actId.Length());
+    actName.Copy(actId);
+    HBufC* query = HBufC::NewL(format.Length() +
+                               appName.Length() +
+                               actName.Length() );
+    query->Des().AppendFormat(format, &appName, &actName);
+    CleanupStack::PopAndDestroy(&actName);
+    CleanupStack::PushL(query);
+    return query;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Execute sql query and result serialize into buffer
+ * @param dst - destination result buffer
+ * @param query - sql activity query
+ */
+void CAfStorage::ActivitiesL(RPointerArray<CAfEntry>& dst, const TDesC& query, CAfEntry::AccessRights rights, TInt limit)
+{
+    RDbView view;// Create a view on the database
+    CleanupClosePushL(view);
+    User::LeaveIfError(view.Prepare(mActDb, TDbQuery(query), view.EReadOnly));
+    User::LeaveIfError(view.EvaluateAll());
+    ActivitiesL(dst, view, rights, limit);
+    CleanupStack::PopAndDestroy(&view);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Return view deserialisd into entries array
+ * @param dst - destination result
+ * @param query - view
+ * @param rights - acess rights
+ */
+void CAfStorage::ActivitiesL(RPointerArray<CAfEntry>& dst, RDbView& src, CAfEntry::AccessRights rights, TInt limit)
+{
+    CDbColSet* row = src.ColSetL();
+    CleanupStack::PushL(row);
+
+    const TInt flagsOffset(row->ColNo(KFlagsColumnName)),
+               applicationOffset(row->ColNo(KApplicationColumnName)),
+               activityOffset(row->ColNo(KActivityColumnName)),
+               dataOffset(row->ColNo(KDataColumnName));
+
+    RBuf activityName;
+    CleanupClosePushL(activityName);
+
+    for (src.FirstL(); src.AtRow(); src.NextL()) {
+        if(0 < limit && dst.Count() >= limit) {
+            break;
+        }
+        src.GetL();
+        ReadDataL(activityName, src, activityOffset);
+
+        CAfEntry *entry = CAfEntry::NewLC(src.ColInt32(flagsOffset),
+                                          src.ColInt64(applicationOffset),
+                                          activityName,
+                                          KNullDesC,
+                                          KNullDesC8,
+                                          KNullDesC8);
+        if (CAfEntry::Public == rights && (entry->Flags() & CAfEntry::Invisible)) {
+            CleanupStack::PopAndDestroy(entry);
+            continue;
+        }
+        InternalizeDataL(*entry, src, dataOffset);
+        
+        if (CAfEntry::Public == rights || 0 >= limit) {
+            entry->SetDataL(KNullDesC8(), CAfEntry::Private);
+        }
+        dst.AppendL(entry);
+        CleanupStack::Pop(entry);
+    }
+
+    CleanupStack::PopAndDestroy(&activityName);
+    CleanupStack::PopAndDestroy(row);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Get activity for update
+ * @param query - destination query result
+ * @param appId - application id
+ * @param actId - activity id
+ */
+void CAfStorage::GetActivityForUpdateL(RDbView& view, TInt appId, const TDesC& actId)
+{
+    HBufC* query(SelectRowLC(appId, actId));
+    User::LeaveIfError(view.Prepare(mActDb, TDbQuery(*query), view.EUpdatable));
+    CleanupStack::PopAndDestroy(query);
+    User::LeaveIfError(view.EvaluateAll());
+    if (!view.FirstL()) {
+        User::Leave(KErrNotFound);
+    }
+}
+
+// -----------------------------------------------------------------------------
+void CAfStorage::ReadDataL(RBuf& dst, RDbRowSet& src, TInt offset) const
+{
+    const TInt length(src.ColLength(offset));
+    CAfEntry::ReallocL(dst, length);
+    RDbColReadStream srcStream;
+    srcStream.OpenLC(src,offset);
+    srcStream.ReadL(dst, src.ColLength(offset));
+    CleanupStack::PopAndDestroy(&srcStream);
+}
+
+// -----------------------------------------------------------------------------
+void CAfStorage::ExternalizeDataL(RDbRowSet& dst,const CAfEntry &src, TInt offset) const
+{
+    RDbColWriteStream dbStream;
+    CleanupClosePushL(dbStream);
+    dbStream.OpenL(dst, offset);
+    src.ExternalizeDataOnlyL(dbStream);
+    CleanupStack::PopAndDestroy(&dbStream);
+}
+
+// -----------------------------------------------------------------------------
+void CAfStorage::InternalizeDataL(CAfEntry & dst, RDbRowSet& src, TInt offset) const
+{
+    RDbColReadStream dbStream;
+    CleanupClosePushL(dbStream);
+    dbStream.OpenL(src, offset);
+    dst.InternalizeDataOnlyL(dbStream);
+    CleanupStack::PopAndDestroy(&dbStream);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activitydatabase/hsactivitydbserver/src/afstorageasynctask.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,221 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "afstorageasynctask.h"
+#include "activitycmd.h"
+
+_LIT(KUnsupportedStorageAsyncTask, "Unsupported async storage task");
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LOCAL_C void ReadEntryL(CAfEntry& entry, const RMessage2& msg)
+{
+    RBuf8 serializedEntry;
+    CleanupClosePushL(serializedEntry);
+    serializedEntry.CreateL(msg.GetDesLengthL(0));
+    msg.ReadL(0, serializedEntry);
+    RDesReadStream reader(serializedEntry);
+    CleanupClosePushL(reader);
+    
+    reader >> entry;
+    
+    CleanupStack::PopAndDestroy(&reader);
+    CleanupStack::PopAndDestroy(&serializedEntry);
+}
+// -----------------------------------------------------------------------------
+/**
+ * Constructor for performing 1st stage construction
+ */
+CAfStorageAsyncTask::CAfStorageAsyncTask()
+{
+    // No implementation required
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Destructor.
+ */
+CAfStorageAsyncTask::~CAfStorageAsyncTask()
+{
+    mExternalizedData.Close();
+    mInternalizedData.ResetAndDestroy();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Handle asynchronous data storage requests
+ * @param taskStorage - data tasks storage
+ * @param dataStorage - data storage
+ * @param msg - request message
+ */
+void CAfStorageAsyncTask::ExecuteLD(MAfTaskStorage& taskStorage, 
+                                    CAfStorage& dataStorage, 
+                                    const RMessage2& msg)
+{
+    CAfStorageAsyncTask* self = new (ELeave) CAfStorageAsyncTask();
+    CleanupStack::PushL(self);
+    self->ExecuteL(dataStorage, msg);
+    taskStorage.PushL(self);
+    CleanupStack::Pop(self);
+    if (EFalse == msg.IsNull()) {
+        msg.Complete(KErrNone);
+    }
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see CActivityTask::Data()
+ */
+const TDesC8& CAfStorageAsyncTask::CAfStorageAsyncTask::Data() const
+{
+    return mExternalizedData;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see CActivityTask::BroadcastReceivedL(const RMessage2 &)
+ */
+void CAfStorageAsyncTask::BroadcastReceivedL(const RMessage2& )
+{
+    // No implementation required
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Handle asynchronous data storage requests
+ * @param dataStorage - data storage
+ * @param msg - request message
+ */
+void CAfStorageAsyncTask::ExecuteL(CAfStorage& dataStorage, 
+                                   const RMessage2& msg)
+{
+    switch (msg.Function()) {
+    case Activities:
+        AllActivitiesL(dataStorage, msg);
+        break;
+    case ApplicationActivities:
+        ApplicationActivitiesL(dataStorage, msg);
+        break;
+    case ApplicationActivity:
+        ApplicationActivityL(dataStorage, msg);
+        break;
+    default:
+        //this code shouldn't be called. fatal error: means wrong session implementation 
+        User::Panic(KUnsupportedStorageAsyncTask, KErrGeneral);
+    };
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Handle getting all activities request
+ * @param dataStorage - data storage
+ * @param msg - requested message
+ */
+void CAfStorageAsyncTask::AllActivitiesL(CAfStorage& dataStorage, 
+                                         const RMessage2& msg)
+{
+    dataStorage.ActivitiesL(mInternalizedData);
+    ExternalizeL();
+    WriteResponseL(msg);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Handle getting application activities request
+ * @param dataStorage - data storage
+ * @param msg - requested message
+ */
+void CAfStorageAsyncTask::ApplicationActivitiesL(CAfStorage& dataStorage, 
+                                                 const RMessage2& msg)
+{
+    CAfEntry *entry = CAfEntry::NewLC();
+    ReadEntryL(*entry, msg);
+    dataStorage.ActivitiesL(mInternalizedData, entry->ApplicationId());
+    CleanupStack::PopAndDestroy(entry);
+    ExternalizeL();
+    WriteResponseL(msg);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Handle getting application activity request
+ * @param dataStorage - data storage
+ * @param msg - requested message
+ */
+void CAfStorageAsyncTask::ApplicationActivityL(CAfStorage& dataStorage, 
+                                               const RMessage2& msg)
+{
+    CAfEntry *src(CAfEntry::NewLC()) , *dst(0);
+    ReadEntryL(*src, msg);
+    dataStorage.ActivityL(dst, *src);
+    CleanupStack::PushL(dst);
+    ExternalizeL(*dst);
+    CleanupStack::PopAndDestroy(dst);
+    CleanupStack::PopAndDestroy(src);
+    WriteResponseL(msg);
+}
+
+// -----------------------------------------------------------------------------
+void CAfStorageAsyncTask::ExternalizeL()
+{
+    mExternalizedData << mInternalizedData;
+    mInternalizedData.ResetAndDestroy();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Externalzie entry into output buffer
+ * @param entry - source entry
+ */
+void CAfStorageAsyncTask::ExternalizeL(const CAfEntry &entry)
+{
+    CAfEntry::ReallocL(mExternalizedData, entry.Size());
+    RDesWriteStream writer(mExternalizedData);
+    CleanupClosePushL(writer);
+    writer << entry;
+    CleanupStack::PopAndDestroy(&writer);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Write response data into request message
+ * @param msg - destination message
+ */
+void CAfStorageAsyncTask::WriteResponseL(const RMessage2& msg)
+{
+    if (EFalse == msg.IsNull()) {
+        msg.WriteL(1, 
+                   TPckgBuf<TInt>(mExternalizedData.Length()));//write data size
+        msg.WriteL(2, 
+                   TPckgBuf<CBase*>(this));//task identyfier
+    }
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Returns ETrue if task is related with session argument
+ */
+
+TBool CAfStorageAsyncTask::IsSessionTask(const CSession2* /*session*/)
+{
+	return EFalse;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activitydatabase/hsactivitydbserver/src/afstoragesynctask.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,260 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 <hash.h>
+#include <fbs.h>
+#include <bautils.h>
+
+#include "afstoragesynctask.h"
+#include "activitycmd.h"
+#include "afentry.h"
+const TInt KMaxPathLength = 256;
+
+_LIT(KUnsupportedStorageSyncTask, "Unsupported sync storage task");
+
+// -----------------------------------------------------------------------------
+/**
+ * Handle synchronous data storage requests
+ * @param dataStorage - data storage
+ * @param msg - request message
+ */
+void AfStorageSyncTask::ExecuteL(MAfTaskStorage& observers,
+                                 CAfStorage& dataStorage, 
+                                 const RMessage2& msg)
+{
+    switch (msg.Function()) {
+    case AddActivity: 
+        AddActivityL(dataStorage, msg);
+        break;
+    case UpdateActivity:
+        UpdateActivityL(dataStorage, msg);
+        break;
+    case RemoveActivity:
+        DeleteActivityL(dataStorage, msg);
+        break;
+    case RemoveApplicationActivities:
+        DeleteApplicationActivitiesL(dataStorage, msg);
+        break;
+    default:
+        //this code shouldn't be called. fatal error: means wrong session implementation 
+        User::Panic(KUnsupportedStorageSyncTask, KErrGeneral);
+    };
+    msg.Complete(KErrNone);
+    NotifyChangeL(observers, msg);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Handle adding new activity.
+ * @param dataStorage - data storage
+ * @param msg - request message
+ */
+void AfStorageSyncTask::AddActivityL(CAfStorage& dataStorage, 
+                                     const RMessage2& msg)
+{
+    //Read message and bitmap handle
+    TPckgBuf<TInt> bitmapHdl(0);
+    CAfEntry *entry = CAfEntry::NewLC();
+    ReadEntryL(*entry, msg);
+    msg.ReadL(1, bitmapHdl);
+    
+    RBuf thumbnailPath;
+    CleanupClosePushL(thumbnailPath);
+    ThumbnailPathL(thumbnailPath, 
+                   dataStorage.Fs(), 
+                   entry->ApplicationId(), 
+                   entry->ActivityId());
+    CreateThumbnailL(thumbnailPath, bitmapHdl());
+    entry->SetImageSrcL(thumbnailPath);
+    dataStorage.AddActivityL(*entry);
+    CleanupStack::PopAndDestroy(&thumbnailPath);
+    
+    CleanupStack::PopAndDestroy(entry);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Handle updating existing activiy
+ * @param dataStorage - data storage
+ * @param msg - request message
+ */
+void AfStorageSyncTask::UpdateActivityL(CAfStorage& dataStorage, 
+                                        const RMessage2& msg)
+{
+    TPckgBuf<TInt> bitmapHdl(0);
+    CAfEntry *entry = CAfEntry::NewLC();
+    ReadEntryL(*entry, msg);
+    msg.ReadL(1, bitmapHdl);
+        
+    RBuf thumbnailPath;
+    CleanupClosePushL(thumbnailPath);
+    ThumbnailPathL(thumbnailPath, 
+                   dataStorage.Fs(), 
+                   entry->ApplicationId(), 
+                   entry->ActivityId());
+    CreateThumbnailL(thumbnailPath, bitmapHdl());
+    entry->SetImageSrcL(thumbnailPath);
+    dataStorage.UpdateActivityL(*entry);
+    CleanupStack::PopAndDestroy(&thumbnailPath);
+    CleanupStack::PopAndDestroy(entry);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Handle removing activity.
+ * @param dataStorage - data storage
+ * @param msg - request message
+ */
+void AfStorageSyncTask::DeleteActivityL(CAfStorage& dataStorage, 
+                                        const RMessage2& msg)
+{
+    CAfEntry *entry = CAfEntry::NewLC();
+    ReadEntryL(*entry, msg);
+    dataStorage.DeleteActivityL(*entry);
+    CleanupStack::PopAndDestroy(entry);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Handle removing all application activities.
+ * @param dataStorage - data storage
+ * @param msg - request message
+ */
+void AfStorageSyncTask::DeleteApplicationActivitiesL(CAfStorage& dataStorage, 
+                                                     const RMessage2& msg)
+{
+    CAfEntry *entry = CAfEntry::NewLC();
+    ReadEntryL(*entry, msg);
+    dataStorage.DeleteActivitiesL(*entry);
+    CleanupStack::PopAndDestroy(entry);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void AfStorageSyncTask::NotifyChangeL(MAfTaskStorage& observers,
+                                      const RMessage2& msg)
+{
+    const RPointerArray<CAfTask> &table(observers.StorageData());
+    for (TInt iter(table.Count() - 1); 0 <= iter; --iter) {
+        table[iter]->BroadcastReceivedL(msg);
+    }
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void AfStorageSyncTask::ReadEntryL(CAfEntry& entry, const RMessage2& msg)
+{
+    RBuf8 serializedEntry;
+    CleanupClosePushL(serializedEntry);
+    serializedEntry.CreateL(msg.GetDesLengthL(0));
+    msg.ReadL(0, serializedEntry);
+    RDesReadStream reader(serializedEntry);
+    CleanupClosePushL(reader);
+    
+    reader >> entry;
+    
+    CleanupStack::PopAndDestroy(&reader);
+    CleanupStack::PopAndDestroy(&serializedEntry);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void AfStorageSyncTask::CreateThumbnailL(const TDesC &path, TInt hdl)
+{
+    if (0 >= hdl) {
+        User::Leave(KErrCorrupt);
+    }
+    CFbsBitmap *bitmap = new (ELeave) CFbsBitmap;
+    CleanupStack::PushL(bitmap);
+    User::LeaveIfError(bitmap->Duplicate(hdl));
+    User::LeaveIfError(bitmap->Save(path));
+    CleanupStack::PopAndDestroy(bitmap);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void AfStorageSyncTask::ThumbnailPathL(RBuf &dst, 
+                                       RFs& fileSystem, 
+                                       TInt uid, 
+                                       const TDesC &activityName)
+{
+    _LIT(KUidFormat, "%+08x\\");
+    _LIT(KExtFormat, ".mbm");
+    //Generate activity hash
+    RBuf8 buff8;
+    CleanupClosePushL(buff8);
+    buff8.CreateL(activityName.Length());
+    buff8.Copy(activityName);
+    HBufC8 *activityHash = Md5HexDigestL(buff8);
+    CleanupStack::PopAndDestroy(&buff8);
+    CleanupStack::PushL(activityHash);
+    
+    //Get private path
+    RBuf privatePath;
+    CleanupClosePushL(privatePath);
+    privatePath.CreateL(KMaxPathLength);
+    User::LeaveIfError(fileSystem.PrivatePath(privatePath));
+    
+    //Format activity path
+    privatePath.AppendFormat( KUidFormat, uid);
+    
+    const TInt requiredSize(privatePath.Length() + 
+                            activityHash->Length() + 
+                            KExtFormat().Length());
+    CAfEntry::ReallocL(dst, requiredSize);
+    
+    //Copy path
+    dst.Copy(privatePath);
+    privatePath.Copy(*activityHash);//reuse already allocated buffer to convert 8 -> 16
+    dst.Append(privatePath);
+    dst.Append(KExtFormat());
+    
+    CleanupStack::PopAndDestroy(&privatePath);
+    CleanupStack::PopAndDestroy(activityHash);
+    
+    BaflUtils::EnsurePathExistsL(fileSystem, dst);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+HBufC8* AfStorageSyncTask::Md5HexDigestL(const TDes8 &string)
+{
+    _LIT8(KMd5HexFormat, "%+02x");
+    CMD5* md5 = CMD5::NewL();
+    CleanupStack::PushL(md5);
+    
+    TPtrC8 hashedSig(md5->Hash(string));
+    
+    HBufC8* buf = HBufC8::NewL(hashedSig.Length() * 2);
+    TPtr8 bufPtr = buf->Des();
+    
+    for(TInt i(0); i< hashedSig.Length(); ++i) {
+        bufPtr.AppendFormat(KMd5HexFormat,hashedSig[i]);
+    }
+    CleanupStack::PopAndDestroy(md5);
+    return buf;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activitydatabase/hsactivitydbserver/src/afthumbnailtask.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,135 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "afthumbnailtask.h"
+#include "activitycmd.h"
+
+#include <fbs.h>
+
+// -----------------------------------------------------------------------------
+/**
+ * Constructor for performing 1st stage construction
+ */
+CAfThumbnailTask::CAfThumbnailTask(MAfTaskStorage& storage, 
+                                   const RMessage2 msg)
+:
+    mStorage(storage), 
+    mMsg(msg)
+{
+    // No implementation required
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Destructor.
+ */
+CAfThumbnailTask::~CAfThumbnailTask()
+{
+    delete mService;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CAfThumbnailTask::ExecuteLD(MAfTaskStorage& taskStorage,
+                                 const RMessage2& message)
+{
+    CAfThumbnailTask *self = new (ELeave)CAfThumbnailTask(taskStorage, 
+                                                                      message);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    taskStorage.PushL(self);
+    CleanupStack::Pop(self);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * EPOC default constructor for performing 2nd stage construction
+ */
+void CAfThumbnailTask::ConstructL()
+{
+    TPckgBuf<int> width(0), height(0);
+    RBuf path;
+    RBuf8 mime;
+    CleanupClosePushL(path);
+    CleanupClosePushL(mime);
+    mMsg.ReadL(0, width);
+    mMsg.ReadL(1, height);
+    path.CreateL(mMsg.GetDesLengthL(2));
+    mMsg.ReadL(2, path);
+    mime.CreateL(mMsg.GetDesLengthL(3));
+    mMsg.ReadL(3, mime);
+    
+    CFbsBitmap *bitmap = new (ELeave) CFbsBitmap();
+    CleanupStack::PushL(bitmap);
+    User::LeaveIfError(bitmap->Load(path));
+    mService = CTsGraphicFileScalingHandler::NewL(*this, 
+                                                  *bitmap, 
+                                                  TSize(width(), height()), 
+                                                  CTsGraphicFileScalingHandler::EKeepAspectRatioByExpanding);
+    CleanupStack::PopAndDestroy(bitmap);
+
+    CleanupStack::PopAndDestroy(&mime);
+    CleanupStack::PopAndDestroy(&path);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CAfThumbnailTask::ImageReadyCallBack(TInt error,const CFbsBitmap *bitmap)
+{
+    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 {
+        if (EFalse == mMsg.IsNull()) {
+         mMsg.Complete(error);
+        }
+        mStorage.Pop(this);
+        delete this;
+    }
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+const TDesC8& CAfThumbnailTask::Data() const
+{
+    return KNullDesC8();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CAfThumbnailTask::BroadcastReceivedL(const RMessage2&)
+{
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Returns ETrue if task is related with session argument
+ */
+TBool CAfThumbnailTask::IsSessionTask(const CSession2* session)
+{
+    return mMsg.Session() == session ? ETrue : EFalse;
+}
--- a/activityfw/activitydatabase/hsactivitydbserver/src/main.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/activityfw/activitydatabase/hsactivitydbserver/src/main.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -14,7 +14,7 @@
 * Description:
 *
 */
-#include "activityserver.h"
+#include "afserver.h"
 #include <e32base.h>
 
 // -----------------------------------------------------------------------------
@@ -26,7 +26,7 @@
     CActiveScheduler* activeScheduler = new( ELeave ) CActiveScheduler;
     CleanupStack::PushL( activeScheduler );
     CActiveScheduler::Install( activeScheduler );
-    CActivityServer* serverObject = CActivityServer::NewLC();
+    CAfServer* serverObject = CAfServer::NewLC();
     RProcess::Rendezvous( KErrNone );
     CActiveScheduler::Start();
     CleanupStack::PopAndDestroy( serverObject );
--- a/activityfw/activitydatabase/inc/activitycmd.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/activityfw/activitydatabase/inc/activitycmd.h	Thu Jul 22 16:37:03 2010 +0100
@@ -34,11 +34,14 @@
     RemoveApplicationActivities,
     Activities,
     ApplicationActivities,
+    ApplicationActivity,
     WaitActivity,
     LaunchActivity,
     GetThumbnail,
     GetData,
-    CancelWait
+    NotifyChange,
+    CancelWait,
+    CancelNotify
 };
 
 #endif  //ACTIVITYCMD_H
--- a/activityfw/activitydatabase/inc/hsactivitydbclientinterface.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/activityfw/activitydatabase/inc/hsactivitydbclientinterface.h	Thu Jul 22 16:37:03 2010 +0100
@@ -24,7 +24,12 @@
 
 const char ActivityApplicationKeyword [] = ":ApplicationId";
 const char ActivityActivityKeyword [] = ":ActivityName";
+const char ActivityParametersKeyword [] = ":ActivityParams";
+const char ActivityPersistence [] = ":ActivityPersistence";
+const char ActivityVisibility [] = ":ActivityVisibility";
 const char ActivityScreenshotKeyword [] = "screenshot";
+const char ActivityDataKeyword [] = ":ActivityData";
+const char ActivityApplicationName[] = ":ApplicationName";
 
 class HsActivityDbClientInterface
 {
@@ -35,14 +40,16 @@
      * @param activity - activity to store
      * @return 0 on succees, error code otherwise
      */
-    virtual int addActivity(const QVariantHash &activity) =0;
+    virtual int addActivity(const QVariantHash &privateData,
+                            const QVariantHash &publicData) =0;
 
     /**
      * Function update exiting activity
      * @param activity - filtering rules
      * @return 0 on succees, error code otherwise
      */
-    virtual int updateActivity(const QVariantHash &activity) =0;
+    virtual int updateActivity(const QVariantHash &privateData,
+                               const QVariantHash &publicData) =0;
 
     /**
      * Function delete activity
@@ -75,6 +82,14 @@
                                       const QVariantHash &activity) =0;
 
     /**
+     * Function returns data for activity
+     * @param result - activity data
+     * @param activity - filtering rules
+     * @return 0 on succees, error code otherwise
+     */
+    virtual int activityData(QVariant &result, const QVariantHash &activity) = 0;
+                                      
+    /**
      * Function subscribe to activity
      * @param  activity - filtering rules
      * @return 0 on succees, error code otherwise
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activitydatabase/s60/inc/afentry.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,130 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 AFENTRYDATA_H
+#define AFENTRYDATA_H
+
+#include <e32base.h>
+#include <s32strm.h>
+class RDbColWriteStream;
+class RDbColReadStream;
+const TInt KAfMask(0x0001);
+
+#ifdef AF_ADD_MASK
+#undef AF_ADD_MASK
+#endif
+#define AF_ADD_MASK(n) (KAfMask << n)
+
+class CAfEntry: public CBase
+{
+public:
+    enum AccessRights {
+    Private =0,
+    Public
+    };
+
+    enum Flags {
+    Invisible = KAfMask,
+    Persistent = 0x40000000,
+    };
+
+public:
+    static CAfEntry* NewL();
+
+    static CAfEntry* NewLC();
+
+    static CAfEntry* NewL(TInt flags,
+                          TInt applicationId,
+                          const TDesC &activityId,
+                          const TDesC &imgSrc,
+                          const TDesC8 &privateData,
+                          const TDesC8 &publicData);
+
+    static CAfEntry* NewLC(TInt flags,
+                           TInt applicationId,
+                           const TDesC &activityId,
+                           const TDesC &imgSrc,
+                           const TDesC8 &privateData,
+                           const TDesC8 &publicData);
+
+    ~CAfEntry();
+
+    TInt Size() const;
+
+    TInt DataSize() const;
+
+    void ExternalizeL(RWriteStream &stream) const;
+
+    void InternalizeL(RReadStream &stream);
+
+    void ExternalizeDataOnlyL(RWriteStream &stream) const;
+
+    void InternalizeDataOnlyL(RReadStream &stream);
+
+    TInt Flags() const;
+
+    TInt ApplicationId() const;
+
+    const TDesC& ActivityId() const;
+
+    const TDesC& ImageSrc() const;
+
+    void SetImageSrcL(const TDesC& src);
+
+    const TDesC8& Data(CAfEntry::AccessRights rights) const;
+
+    void SetDataL(const TDesC8& src, CAfEntry::AccessRights rights);
+
+    static void ReallocL(RBuf8 &dst,TInt length);
+
+    static void ReallocL(RBuf &dst,TInt length);
+
+    static void CopyL(RBuf8 &dst,const TDesC8 &src);
+
+    static void CopyL(RBuf &dst,const TDesC &src);
+
+private:
+    CAfEntry();
+
+    void ConstructL(TInt flags,
+                    TInt applicationId,
+                    const TDesC &activityId,
+                    const TDesC &imgSrc,
+                    const TDesC8 &privateData,
+                    const TDesC8 &publicData);
+
+    static void InternalizeL(RBuf8 &dst, RReadStream &src);
+
+    static void InternalizeL(RBuf &dst, RReadStream &src);
+
+    static void ExternalizeL(RWriteStream &dst,const TDesC8 & src);
+
+    static void ExternalizeL(RWriteStream &dst,const TDesC& src);
+private:
+    TInt mFlags;
+    TInt mAppId;
+    RBuf mActivityId;
+    RBuf mImgSrc;
+    RBuf8 mPrivateData;
+    RBuf8 mPublicData;
+
+};
+
+RPointerArray<CAfEntry>& operator <<(RPointerArray<CAfEntry>& dst, const TDesC8 &src);
+
+RBuf8& operator << (RBuf8 &dst, const RPointerArray<CAfEntry>& src);
+
+#endif
--- a/activityfw/activitydatabase/s60/inc/hsserializer.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/activityfw/activitydatabase/s60/inc/hsserializer.h	Thu Jul 22 16:37:03 2010 +0100
@@ -16,17 +16,8 @@
 */
 #ifndef HSSERIALIZER_H
 #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
@@ -38,13 +29,4 @@
  */
 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);
 #endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activitydatabase/s60/src/afentry.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,446 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "afentry.h"
+#include <s32mem.h>
+
+// -----------------------------------------------------------------------------
+/**
+ * Two-phase constructor. Create and initialize instance
+ * @return entry instance
+ */
+CAfEntry* CAfEntry::NewL()
+{
+    CAfEntry *self = CAfEntry::NewLC();
+    CleanupStack::Pop(self);
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Two-phase constructor. Create, initialize and push instance into cleanup stack
+ * @return entry instance
+ */
+CAfEntry* CAfEntry::NewLC()
+{
+    CAfEntry *self = new (ELeave)CAfEntry();
+    CleanupStack::PushL(self);
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Two-phase constructor. Create and initialize instance
+ * @param flags - entry flags
+ * @param applicationId - application unique identifier
+ * @param activityId - activity unique identifier
+ * @param imgSrc - thumbanail source
+ * @param privateData - privated application data
+ * @param publicData - public activity data
+ * @return entry instance
+ */
+CAfEntry* CAfEntry::NewL(TInt flags,
+                         TInt applicationId,
+                         const TDesC &activityId,
+                         const TDesC &imgSrc,
+                         const TDesC8 &privateData,
+                         const TDesC8 &publicData)
+{
+    CAfEntry* self = CAfEntry::NewLC(flags, 
+                                     applicationId, 
+                                     activityId, 
+                                     imgSrc, 
+                                     privateData, 
+                                     publicData);
+    CleanupStack::Pop(self);
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Two-phase constructor. Create, initialize and push instance into cleanup stack
+ * @param flags - entry flags
+ * @param applicationId - application unique identifier
+ * @param activityId - activity unique identifier
+ * @param imgSrc - thumbanail source
+ * @param privateData - privated application data
+ * @param publicData - public activity data
+ * @return entry instance
+ */
+CAfEntry* CAfEntry::NewLC(TInt flags,
+                          TInt applicationId,
+                          const TDesC &activityId,
+                          const TDesC &imgSrc,
+                          const TDesC8 &privateData,
+                          const TDesC8 &publicData)
+{
+    CAfEntry *self = CAfEntry::NewLC();
+    self->ConstructL(flags, 
+                     applicationId, 
+                     activityId, 
+                     imgSrc, 
+                     privateData, 
+                     publicData);
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * First phase constructor
+ */
+CAfEntry::CAfEntry()
+{
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Second phase constructor. Initialize instance
+ * @param flags - entry flags
+ * @param applicationId - application unique identifier
+ * @param activityId - activity unique identifier
+ * @param imgSrc - thumbanail source
+ * @param privateData - privated application data
+ * @param publicData - public activity data 
+ */
+void CAfEntry::ConstructL(TInt flags,
+                          TInt applicationId,
+                          const TDesC &activityId,
+                          const TDesC &imgSrc,
+                          const TDesC8 &privateData,
+                          const TDesC8 &publicData)
+{
+    mFlags = flags;
+    mAppId = applicationId;
+    CopyL(mActivityId, activityId);
+    CopyL(mImgSrc, imgSrc);
+    CopyL(mPrivateData, privateData);
+    CopyL(mPublicData, publicData);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Destructor. Release allocated resources 
+ */
+CAfEntry::~CAfEntry()
+{
+    mActivityId.Close();
+    mPrivateData.Close();
+    mPublicData.Close();
+    mImgSrc.Close();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Provide size of serialized entry
+ * @return size of serialized entry instance
+ */
+TInt CAfEntry::Size() const
+{
+    return (sizeof(TInt) * 3) + //flags + appId + actId size info 
+           mActivityId.Size() + //actId content size
+           DataSize(); //data size
+           
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Provide size of serialized entry
+ * @return size of serialized entry instance
+ */
+TInt CAfEntry::DataSize() const
+{
+    return (sizeof(TInt) * 3) + //privData size info + pubData size info + imgSrc size info
+            mImgSrc.Size() + //imgSize content size
+            mPrivateData.Size() + //privData content size
+            mPublicData.Size(); //pubData content size 
+}
+// -----------------------------------------------------------------------------
+/**
+ * Serialize entry content into output stream.
+ * @param stream - output stream
+ */
+void CAfEntry::ExternalizeL(RWriteStream &stream) const
+{
+    stream.WriteInt32L(mFlags);
+    stream.WriteInt32L(mAppId);
+    ExternalizeL(stream, mActivityId);
+    ExternalizeDataOnlyL(stream);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Deserialize entry content from input stream
+ * @param stream - input stream
+ */
+void CAfEntry::InternalizeL(RReadStream &stream)
+{
+    mFlags = stream.ReadInt32L();
+    mAppId = stream.ReadInt32L();
+    InternalizeL(mActivityId, stream);
+    InternalizeDataOnlyL(stream);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Serialize entry content into output stream.
+ * @param stream - output stream
+ */
+void CAfEntry::ExternalizeDataOnlyL(RWriteStream &stream) const
+{
+    ExternalizeL(stream, mImgSrc);
+    ExternalizeL(stream, mPrivateData);
+    ExternalizeL(stream, mPublicData);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Deserialize entry content from input stream
+ * @param stream - input stream
+ */
+void CAfEntry::InternalizeDataOnlyL(RReadStream &stream)
+{
+    
+    InternalizeL(mImgSrc, stream);
+    InternalizeL(mPrivateData, stream);
+    InternalizeL(mPublicData, stream);
+    
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Provide access to activity flags
+ * @return activity flags 
+ */
+TInt CAfEntry::Flags() const
+{
+    return mFlags;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Provide access to activity identifier.
+ * @return activity identifier
+ */
+TInt CAfEntry::ApplicationId() const
+{
+    return mAppId;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Provide access to activity identifier.
+ * @return activity identifier
+ */
+const TDesC& CAfEntry::ActivityId() const
+{
+    return mActivityId;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Provide access to activity data.
+ * @param rights - type of requested data
+ * @return activity data
+ */
+const TDesC8& CAfEntry::Data(CAfEntry::AccessRights rights) const
+{
+    return Private == rights ? mPrivateData : mPublicData;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Provide access to activity data.
+ * @param rights - type of requested data
+ * @return activity data
+ */
+void CAfEntry::SetDataL(const TDesC8& src, CAfEntry::AccessRights rights)
+{
+    CopyL(Private == rights ? mPrivateData : mPublicData, src);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Provide access to activity thumbail path
+ * @return path to activity thumbnail 
+ */
+const TDesC& CAfEntry::ImageSrc() const
+{
+    return mImgSrc;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Set new value of image source
+ */
+void CAfEntry::SetImageSrcL(const TDesC& src)
+{
+    CopyL(mImgSrc, src);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Reallocate blob buffer to requested size
+ * @param dst - destination buffer
+ * @param length - requested length
+ */
+void CAfEntry::ReallocL(RBuf8 &dst,TInt length)
+{
+    if (0 < length) {
+        if (dst.MaxLength() < length) {
+            dst.ReAllocL(length);
+        }
+    } else {
+        dst.Close();
+    }
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Reallocate text buffer to requested size
+ * @param dst - destination buffer
+ * @param length - requested length
+ */
+void CAfEntry::ReallocL(RBuf &dst,TInt length)
+{
+    if (0 < length) {
+        if (dst.MaxLength() < length) {
+            dst.ReAllocL(length);
+        }
+    } else {
+        dst.Close();
+    }
+}
+// -----------------------------------------------------------------------------
+/**
+ * Copy blob content from input stream
+ * @param dst - destination buffer
+ * @param src - source buffer
+ */
+void CAfEntry::CopyL(RBuf8 &dst,const TDesC8 &src)
+{
+    ReallocL(dst, src.Length());
+    if(0 < src.Length()) {
+        dst.Copy(src);
+    }
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Copy text content from input buffer
+ * @param dst - destination buffer
+ * @param src - source buffer
+ */
+void CAfEntry::CopyL(RBuf &dst,const TDesC &src)
+{
+    ReallocL(dst, src.Length());
+    if(0 < src.Length()) {
+        dst.Copy(src);
+    }
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Deserialize blob content from input stream
+ * @param dst - destination buffer
+ * @param src - input stream
+ */
+void CAfEntry::InternalizeL(RBuf8 &dst, RReadStream &src)
+{
+    const TInt length(src.ReadInt32L());
+    ReallocL(dst, length);
+    if (0 < length) {
+        src.ReadL(dst, length);
+    }
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Deserialize text content from input stream
+ * @param dst - destination buffer
+ * @param src - input stream
+ */
+void CAfEntry::InternalizeL(RBuf &dst, RReadStream &src)
+{
+    const TInt length(src.ReadInt32L());
+    ReallocL(dst, length);
+    if (0 < length) {
+        src.ReadL(dst, length);
+    }
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Serialize blob content into output stream
+ * @param dst - destination stream
+ * @param src - input buffer
+ */
+void CAfEntry::ExternalizeL(RWriteStream &dst,const TDesC8 & src)
+{
+    dst.WriteInt32L(src.Length());
+    if (src.Length()) {
+        dst.WriteL(src, src.Length());
+    }
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Serialize text content into output stream
+ * @param dst - destination stream
+ * @param src - input buffer
+ */
+void CAfEntry::ExternalizeL(RWriteStream &dst,const TDesC& src)
+{
+    dst.WriteInt32L(src.Length());
+    if (src.Length()) {
+        dst.WriteL(src, src.Length());
+    }
+}
+
+// -----------------------------------------------------------------------------
+RPointerArray<CAfEntry>& operator <<(RPointerArray<CAfEntry>& dst, const TDesC8 &src)
+{
+    dst.ResetAndDestroy();
+    RDesReadStream srcStream(src);
+    CleanupClosePushL(srcStream);
+    int numOfItems(srcStream.ReadInt32L());
+    for (int i(0); i < numOfItems; ++i) {
+        CAfEntry *entry = CAfEntry::NewLC();
+        srcStream >> (*entry);
+        dst.AppendL(entry);
+        CleanupStack::Pop(entry);
+    }
+    CleanupStack::PopAndDestroy(&srcStream);
+    return dst;
+}
+
+// -----------------------------------------------------------------------------
+RBuf8& operator <<(RBuf8 &dst, const RPointerArray<CAfEntry>& src)
+{
+    int iter(0), 
+        requiredSize(sizeof(int));
+    for(iter =0; iter< src.Count(); ++iter) {
+        requiredSize += src[iter]->Size();
+    }
+    CAfEntry::ReallocL(dst, requiredSize);
+    RDesWriteStream dstStream(dst);
+    CleanupClosePushL(dstStream);
+    dstStream.WriteInt32L(src.Count());
+    for (iter =0; iter < src.Count(); ++iter) {
+        dstStream << *(src[iter]);
+    }
+    CleanupStack::PopAndDestroy(&dstStream);
+    return dst;
+}
--- a/activityfw/activitydatabase/s60/src/hsserializer.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/activityfw/activitydatabase/s60/src/hsserializer.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -14,41 +14,8 @@
 * Description:
 *
 */
+#include <s32mem.h>
 #include "hsserializer.h"
-#include <s32mem.h>
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-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;
-}
-
 // -----------------------------------------------------------------------------
 //
 // -----------------------------------------------------------------------------
@@ -81,53 +48,3 @@
     QT_TRYCATCH_LEAVING(stream >> dst);
     return dst;
 }
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-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();
-    
-    QVariantHash item;
-    TRAP_IGNORE(
-    RDesReadStream srcStream(src);
-    int numOfItems(srcStream.ReadInt32L());
-    int bufferSize;
-    
-    RBuf8 tmpBuff;
-    CleanupClosePushL(tmpBuff);
-    for (int iter(0); iter < numOfItems; ++iter) {
-        bufferSize = srcStream.ReadInt32L();
-        if (tmpBuff.MaxLength() < bufferSize) {
-            tmpBuff.ReAllocL(bufferSize);
-        }
-        item.clear();
-        if (0 < bufferSize) {
-            srcStream.ReadL(tmpBuff, bufferSize);
-            item << tmpBuff;
-        }
-        dst.append(item);
-    }
-    CleanupStack::PopAndDestroy(&tmpBuff));
-    return dst;
-}
--- a/activityfw/activityfw.pro	Fri Jun 11 16:25:06 2010 +0100
+++ b/activityfw/activityfw.pro	Thu Jul 22 16:37:03 2010 +0100
@@ -18,14 +18,18 @@
 
 CONFIG += ordered
 
-symbian:SUBDIRS += activitydatabase
+SUBDIRS += tsutils
+
+symbian:SUBDIRS += storage
 
 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/activitylauncher/activitylauncher.pro	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
-
-TEMPLATE = app
-
-TARGET = activitylauncher
-
-CONFIG += hb console mobility
-MOBILITY = serviceframework
-
-SOURCES =   main.cpp \
-            activitylauncherview.cpp \
-
-HEADERS =   activitylauncherview.h \
-
-symbian {
-    TARGET.EPOCHEAPSIZE = 0x20000 0x1000000 // 128kB - 16MB
-}
\ No newline at end of file
--- a/activityfw/activitylauncher/activitylauncherview.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,107 +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 "activitylauncherview.h"
-
-#include <QGraphicsLinearLayout>
-#include <QStandardItemModel>
-#include <QProcess>
-
-#include <qservicemanager.h>
-
-#include <hblabel.h>
-#include <hbapplication.h>
-#include <hbpushbutton.h>
-#include <hbgridview.h>
-
-#include <hsactivitydbclientinterface.h>
-
-QTM_USE_NAMESPACE
-
-ActivityLauncherView::ActivityLauncherView(QGraphicsItem *parent) : HbView(parent), mModel(NULL), mActivityManager(NULL)
-{
-    QServiceManager serviceManager;
-    mActivityManager = serviceManager.loadInterface("com.nokia.qt.activities.ActivityManager");
-
-    if (!mActivityManager) {
-        qFatal("Cannot initialize critical com.nokia.qt.activities.ActivityManager service");
-    }
-
-    // create UI
-    setTitle(tr("Activity launcher"));
-    QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical);
-    QGraphicsLinearLayout *statusLayout = new QGraphicsLinearLayout(Qt::Horizontal);
-    mStatusLabel = new HbLabel(this);
-    mStatusLabel->setAlignment(Qt::AlignLeft);
-    statusLayout->setMaximumHeight(15);
-
-    HbLabel *statusHeader = new HbLabel("Status: ");
-    statusHeader->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
-    statusLayout->addItem(statusHeader);
-    statusLayout->addItem(mStatusLabel);
-
-    HbGridView *activities = new HbGridView();
-    connect(activities, SIGNAL(activated(QModelIndex)), this, SLOT(itemPressed(QModelIndex)));
-    activities->setRowCount(1);
-    activities->setColumnCount(1);
-
-    activities->setScrollDirections(Qt::Horizontal);
-
-    mModel = new QStandardItemModel(this);
-    activities->setModel(mModel);
-
-    layout->addItem(statusLayout);
-    layout->addItem(activities);
-
-    setLayout(layout);
-    qApp->installEventFilter(this);
-    getActivitiesList();
-}
-
-ActivityLauncherView::~ActivityLauncherView()
-{
-    delete mActivityManager;
-}
-
-void ActivityLauncherView::getActivitiesList()
-{
-    mStatusLabel->setPlainText("Fetching activities");
-    mCurrentActivities.clear();
-    QMetaObject::invokeMethod(mActivityManager, "activitiesList", Q_RETURN_ARG(QList<QVariantHash>, mCurrentActivities));
-    mModel->clear();
-
-    foreach(const QVariantHash& activityEntry, mCurrentActivities) {
-        QStandardItem *newItem = new QStandardItem(QIcon(activityEntry.value("screenshot").value<QPixmap>()), QString("%1").arg(activityEntry.value(ActivityActivityKeyword).toInt()));
-        mModel->invisibleRootItem()->appendRow(newItem);
-    }
-    mStatusLabel->setPlainText(QString("Ready (%1 activities)").arg(mCurrentActivities.count()));
-}
-
-bool ActivityLauncherView::eventFilter(QObject *obj, QEvent *event)
-{
-    if (event->type() == QEvent::ApplicationActivate) {
-        getActivitiesList();
-    }
-    return QObject::eventFilter(obj, event);
-}
-
-void ActivityLauncherView::itemPressed(const QModelIndex &index)
-{
-    QVariantHash activity = mCurrentActivities.at(index.row());
-    int applicationId = activity.value(ActivityApplicationKeyword).toInt();
-    QString activityName = activity.value(ActivityActivityKeyword).toString();
-    QMetaObject::invokeMethod(mActivityManager, "launchActivity", Q_ARG(int, applicationId), Q_ARG(QString, activityName));
-}
--- a/activityfw/activitylauncher/activitylauncherview.h	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +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 ACTIVITYLAUNCHERVIEW_H
-#define ACTIVITYLAUNCHERVIEW_H
-
-#include <hbview.h>
-#include <QVariant>
-
-class HbLabel;
-class QStandardItemModel;
-
-class ActivityLauncherView : public HbView
-{
-    Q_OBJECT
-
-public:
-    ActivityLauncherView(QGraphicsItem *parent = 0);
-    ~ActivityLauncherView();
-
-private slots:
-    void itemPressed(const QModelIndex &index);
-
-protected:
-    bool eventFilter(QObject *obj, QEvent *event);
-
-private:
-    void getActivitiesList();
-
-private:
-    QStandardItemModel *mModel;
-    QList<QVariantHash> mCurrentActivities;
-    HbLabel *mStatusLabel;
-
-    QObject *mActivityManager;
-};
-
-#endif // ACTIVITYLAUNCHERVIEW_H
--- a/activityfw/activitylauncher/main.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ /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:
-*
-*/
-
-#include <QCoreApplication>
-
-#include <hbapplication.h>
-#include <hbmainwindow.h>
-
-#include "activitylauncherview.h"
-
-int main(int argc, char *argv[])
-{
-    HbApplication app(argc, argv);
-
-    HbMainWindow mainWindow;
-    ActivityLauncherView mainView;
-    mainWindow.addView(&mainView);
-    mainWindow.show();
-
-    return app.exec();
-}
--- a/activityfw/activityserviceplugin/activityclient.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ /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 Jun 11 16:25:06 2010 +0100
+++ /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 Jun 11 16:25:06 2010 +0100
+++ /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 Jun 11 16:25:06 2010 +0100
+++ /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 Jun 11 16:25:06 2010 +0100
+++ /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 Jun 11 16:25:06 2010 +0100
+++ /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 Jun 11 16:25:06 2010 +0100
+++ /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 Jun 11 16:25:06 2010 +0100
+++ /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 Jun 11 16:25:06 2010 +0100
+++ /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 Jun 11 16:25:06 2010 +0100
+++ /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 Jun 11 16:25:06 2010 +0100
+++ /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 Jun 11 16:25:06 2010 +0100
+++ /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 Jun 11 16:25:06 2010 +0100
+++ b/activityfw/activityserviceplugin/activityserviceplugin.pro	Thu Jul 22 16:37:03 2010 +0100
@@ -20,41 +20,40 @@
 CONFIG += plugin 
 include(activityserviceplugin.pri)
 
-HEADERS +=  activityserviceplugin.h \
-            activitydatastorage.h \
-            activityclient.h \
-            activityclient_p.h \
-            activitymanager.h \
-            activitymanager_p.h \
-            applicationlauncher.h \
+INCLUDEPATH += ./inc \
+               ../../inc
 
-SOURCES +=  activityserviceplugin.cpp \
-            activitydatastorage.cpp \
-            activityclient.cpp \
-            activityclient_p.cpp \
-            activitymanager.cpp \
-            activitymanager_p.cpp \
-            applicationlauncher.cpp \
+HEADERS +=  ./inc/activityserviceplugin.h \
+            ./inc/afactivityclient.h \
+            ./inc/afactivitymanager.h \
+            ./inc/applicationlauncher.h \
+
+SOURCES +=  ./src/activityserviceplugin.cpp \
+            ./src/afactivityclient.cpp \
+            ./src/afactivitymanager.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/inc/applicationlauncher_p.h
 
     LIBS += -lapparc \
             -lapgrfx \
             -lcone \
-            -lhsactivitydbclient \
+            -lafstorageclient \
             -lxqutils
  
 }
 
 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 +62,15 @@
     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
+
+    #temporary workaround
+    BLD_INF_RULES.prj_exports += "data/activityserviceplugin.xml z:/resource/activity/activityserviceplugin.xml"
+    
 }
--- a/activityfw/activityserviceplugin/activityserviceplugin.xml	Fri Jun 11 16:25:06 2010 +0100
+++ /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 Jun 11 16:25:06 2010 +0100
+++ /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 Jun 11 16:25:06 2010 +0100
+++ /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 Jul 22 16:37:03 2010 +0100
@@ -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/activityserviceplugin.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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/afactivityclient.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef AFACTIVITYCLIENT_H
+#define AFACTIVITYCLIENT_H
+
+#include <QObject>
+#include <QVariant>
+#include <QString>
+
+#include <afstorageclient.h>
+
+class ActivityClient : public QObject
+{
+
+    Q_OBJECT
+
+public:
+    ActivityClient(const QSharedPointer<AfStorageClient> &serviceProvider,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:
+    QSharedPointer<AfStorageClient> mServiceProvider;
+    bool mIsconnected;
+};
+
+#endif // AFACTIVITYCLIENT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activityserviceplugin/inc/afactivitymanager.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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 AFACTIVITYMANAGER_H
+#define AFACTIVITYMANAGER_H
+
+#include <QObject>
+#include <QVariant>
+#include <QList>
+#include <QPixmap>
+#include <QSize>
+
+#include <afstorageclient.h>
+
+class ActivityManager : public QObject
+{
+
+    Q_OBJECT
+
+public:
+    ActivityManager(const QSharedPointer<AfStorageClient> &serviceProvider, 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:
+    void launchActivity(const QVariantHash& activity);
+    QUrl activityToUri(const QVariantHash& activity) const;
+
+private:
+    QSharedPointer<AfStorageClient> mServiceProvider;
+};
+
+#endif // AFACTIVITYMANAGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activityserviceplugin/inc/applicationlauncher.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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 Jun 11 16:25:06 2010 +0100
+++ /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 Jun 11 16:25:06 2010 +0100
+++ /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 Jun 11 16:25:06 2010 +0100
+++ /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 Jun 11 16:25:06 2010 +0100
+++ /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 Jun 11 16:25:06 2010 +0100
+++ /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 Jun 11 16:25:06 2010 +0100
+++ /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/applicationlauncher_p.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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/applicationlauncher_p.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -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(QString(uri.toEncoded()));
+
+    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/activityserviceplugin.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -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 "afactivityclient.h"
+#include "afactivitymanager.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(QSharedPointer<AfStorageClient>(new AfStorageClient()));
+    } else if (descriptor.interfaceName() == "com.nokia.qt.activities.ActivityManager") {
+        return new ActivityManager(QSharedPointer<AfStorageClient>(new AfStorageClient()));
+    } else {
+        return NULL;
+    }
+}
+
+Q_EXPORT_PLUGIN2(activityserviceplugin, ActivityServicePlugin)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activityserviceplugin/src/afactivityclient.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,138 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include <QCoreApplication>
+#include <QStringList>
+#include <QTimer>
+#include <QUrl>
+#include <QDebug>
+#include <QDir>
+
+#include <afstorageentry.h>
+#include <afstorageglobals.h>
+
+#include "afactivityclient.h"
+ActivityClient::ActivityClient(const QSharedPointer<AfStorageClient> &serviceProvider, QObject *parent) 
+: 
+    QObject(parent),
+    mServiceProvider(serviceProvider),
+    mIsconnected(false)
+{
+    mIsconnected = ( KErrNone == mServiceProvider->connect());
+    if( mIsconnected) {
+        mServiceProvider->waitActivity();
+    }
+    connect(mServiceProvider.data(), SIGNAL(activityRequested(QString)), this, SIGNAL(activityRequested(QString)));
+}
+
+ActivityClient::~ActivityClient()
+{
+}
+
+bool ActivityClient::addActivity(const QString &activityId, const QVariant &data, const QVariantHash &parameters)
+{
+    bool result(mIsconnected);
+    if (result) {
+        QVariantHash publicData(parameters);
+        
+        QPixmap screenshot(publicData[ActivityScreenshotKeyword].value<QPixmap>());
+        publicData.remove(ActivityScreenshotKeyword);
+        
+        RProcess process;
+        publicData.insert(ActivityApplicationKeyword, static_cast<int>(process.SecureId().iId));
+        publicData.insert(ActivityActivityKeyword, activityId);
+        AfStorageEntry entry(process.SecureId().iId, activityId, data, publicData);
+        result = (KErrNone == mServiceProvider->addActivity(entry, screenshot));
+    }
+    return result;
+}
+
+bool ActivityClient::removeActivity(const QString &activityId)
+{
+    bool result(mIsconnected);
+    if (result) {
+        RProcess process;
+        AfStorageEntry entry(process.SecureId().iId, activityId);
+        result = (KErrNone == mServiceProvider->removeActivity(entry));
+    }
+    return result;
+}
+
+bool ActivityClient::updateActivity(const QString &activityId, const QVariant &data, const QVariantHash &parameters)
+{
+    bool result(mIsconnected);
+    if (result) {
+        QVariantHash publicData(parameters);
+        QPixmap screenshot(publicData[ActivityScreenshotKeyword].value<QPixmap>());
+        publicData.remove(ActivityScreenshotKeyword);
+        RProcess process;
+        publicData.insert(ActivityApplicationKeyword, static_cast<int>(process.SecureId().iId));
+        publicData.insert(ActivityActivityKeyword, activityId);
+        AfStorageEntry entry(process.SecureId().iId, activityId, data, publicData);
+        result = (KErrNone == mServiceProvider->updateActivity(entry, screenshot));
+    }
+    return result;
+}
+
+QList<QVariantHash> ActivityClient::activities() const
+{
+    QList<QVariantHash> retVal;
+    if (mIsconnected) {
+        RProcess process;
+        AfStorageEntry entry(process.SecureId().iId);
+        QList<AfStorageEntry> activities;
+        mServiceProvider->applicationActivities(activities, entry);
+        
+        QList<AfStorageEntry>::iterator iter(activities.begin());
+        for (; activities.end() != iter; iter = activities.erase(iter)) {
+            retVal.append((*iter).publicData());
+        }
+    }
+    return retVal;
+}
+
+QVariant ActivityClient::activityData(const QString &activityId) const
+{
+    QVariant data;
+    if (mIsconnected) {
+        RProcess process;
+        AfStorageEntry entry(static_cast<int>(process.SecureId().iId), activityId), result;
+        if (0 == mServiceProvider->activityData(result, entry)) {
+            data = result.privateData();
+        }
+    }
+    return data;
+}
+
+QVariantHash ActivityClient::parseCommandLine(const QStringList &commandLineParams) const
+{
+     QVariantHash activityParams;
+    int activityMarkerIndex = commandLineParams.indexOf("-activity");
+    if (activityMarkerIndex != -1 && commandLineParams.count() - 1 > activityMarkerIndex) {
+        QUrl activityUri = QUrl::fromEncoded(commandLineParams.at(activityMarkerIndex+1).toAscii());
+        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();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activityserviceplugin/src/afactivitymanager.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,142 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 <QStringList>
+#include <QUrl>
+
+#include <afstorageclient.h>
+#include <afstorageentry.h>
+#include <afstorageglobals.h>
+
+#include "afactivitymanager.h"
+#include "applicationlauncher.h"
+
+ActivityManager::ActivityManager(const QSharedPointer<AfStorageClient> &serviceProvider, 
+                                 QObject *parent) 
+: 
+    QObject(parent), 
+    mServiceProvider(serviceProvider)
+{
+    if(0 == mServiceProvider->connect()){
+        mServiceProvider->notifyDataChange();
+    }
+    connect(mServiceProvider.data(),
+            SIGNAL(thumbnailRequested(QPixmap, void *)),
+            this,
+            SIGNAL(thumbnailReady(QPixmap, void *)));
+    connect(mServiceProvider.data(),
+            SIGNAL(dataChanged()),
+            this,
+            SIGNAL(dataChanged()));
+}
+
+ActivityManager::~ActivityManager()
+{
+}
+
+QList<QVariantHash> ActivityManager::activitiesList()
+{
+    QList<AfStorageEntry> results;
+    mServiceProvider->activities(results);
+    
+    QList<QVariantHash> retVal;
+    QList<AfStorageEntry>::iterator iter(results.begin());
+    for (; iter != results.end(); iter = results.erase(iter)) {
+        retVal.append((*iter).publicData());
+    }
+    return retVal;
+}
+
+void ActivityManager::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 ActivityManager::launchActivity(const QString &uri)
+{
+    qWarning("AfActivityManager::launchActivity(const QString &uri) is deprecated, use AfActivityManager::launchActivity(const QUrl &uri) instead");
+    launchActivity(QUrl(uri));
+}
+
+void ActivityManager::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 ActivityManager::getThumbnail(QSize resolution,const QString &thumbnailPath, void *data)
+{
+    mServiceProvider->getThumbnail(resolution, thumbnailPath, data);
+}
+
+void ActivityManager::launchActivity(const QVariantHash& activity)
+{
+    ApplicationLauncher applicationLauncher;
+    int applicationId = activity.value(ActivityApplicationKeyword).toInt();
+    AfStorageEntry entry(applicationId, 
+                         activity[ActivityActivityKeyword].toString());
+    if (applicationLauncher.isRunning(applicationId)) {
+        mServiceProvider->launchActivity(entry);
+        applicationLauncher.bringToForeground(applicationId);
+    } else {
+        applicationLauncher.startApplication(applicationId, activityToUri(activity));
+    }
+}
+
+QUrl ActivityManager::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;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activityserviceplugin/src/applicationlauncher.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -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 Jun 11 16:25:06 2010 +0100
+++ b/activityfw/activityserviceplugin/symbianinstaller/activityserviceinstaller/activityserviceinstaller.qrc	Thu Jul 22 16:37:03 2010 +0100
@@ -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 Jun 11 16:25:06 2010 +0100
+++ /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 Jun 11 16:25:06 2010 +0100
+++ /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 Jun 11 16:25:06 2010 +0100
+++ /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 Jun 11 16:25:06 2010 +0100
+++ /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/applicationlauncher_p.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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/applicationlauncher_p.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -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 Jun 11 16:25:06 2010 +0100
+++ b/activityfw/orbitintegration/hbactivityplugin/hbactivityplugin.qrc	Thu Jul 22 16:37:03 2010 +0100
@@ -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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/orbitintegration/hbactivityplugin/hbactivityplugininterface.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef HBACTIVITYPLUGININTERFACE_H
+#define HBACTIVITYPLUGININTERFACE_H
+
+#include <QtPlugin>
+#include <QObject>
+#include <QVariant>
+#include <QString>
+#include <QList>
+#include <QVariantHash>
+
+class HbActivityPluginInterface : public QObject
+{
+    Q_OBJECT
+
+public:
+    HbActivityPluginInterface(QObject *parent = 0) : QObject(parent) {}
+
+public:
+    virtual bool addActivity(const QString &activityId, const QVariant &data, const QVariantHash &parameters) = 0;
+    virtual bool removeActivity(const QString &activityId) = 0;
+    virtual bool updateActivity(const QString &activityId, const QVariant &data, const QVariantHash &parameters) = 0;
+    virtual QList<QVariantHash> activities() = 0;
+    virtual QVariant activityData(const QString &activityId) = 0;
+    virtual bool waitActivity() = 0;
+    virtual QVariantHash parseCommandLine(const QStringList &commandLineParams) = 0;
+
+signals:
+    void activityRequested(const QString &activityId);
+
+};
+
+Q_DECLARE_INTERFACE(HbActivityPluginInterface, "HbActivityPluginInterface/1.0")
+
+#endif // HBACTIVITYPLUGININTERFACE_H
--- a/activityfw/orbitintegration/hbactivityplugin/hbactivityplugininterface_p.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/activityfw/orbitintegration/hbactivityplugin/hbactivityplugininterface_p.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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 Jun 11 16:25:06 2010 +0100
+++ b/activityfw/rom/activitymanager_core.iby	Thu Jul 22 16:37:03 2010 +0100
@@ -17,19 +17,18 @@
 #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\afstorageclient.dll					       SHARED_LIB_DIR\afstorageclient.dll
+file=ABI_DIR\BUILD_DIR\tsutils.dll			    		       SHARED_LIB_DIR\tsutils.dll
 
 file=ABI_DIR\BUILD_DIR\hbactivityplugin.dll					       SHARED_LIB_DIR\hbactivityplugin.dll
 data=\epoc32\data\z\resource\qt\plugins\hbactivityplugin.qtplugin    resource\qt\plugins\hbactivityplugin.qtplugin
 
+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 Jun 11 16:25:06 2010 +0100
+++ b/activityfw/sis/activitymanager.pkg	Thu Jul 22 16:37:03 2010 +0100
@@ -26,16 +26,13 @@
 ;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"
+"/epoc32/release/armv5/urel/afstorageclient.dll"    - "!:\sys\bin\afstorageclient.dll"
+"/epoc32/release/armv5/urel/tsutils.dll"    - "!:\sys\bin\tsutils.dll"
 
 "/epoc32/release/armv5/urel/hbactivityplugin.dll"    - "!:\sys\bin\hbactivityplugin.dll"
 "/epoc32/data/z/resource/qt/plugins/hbactivityplugin.qtplugin"-"!:\resource\qt\plugins\hbactivityplugin.qtplugin"
--- a/activityfw/sis/stubs/activitymanager_stub.pkg	Fri Jun 11 16:25:06 2010 +0100
+++ b/activityfw/sis/stubs/activitymanager_stub.pkg	Thu Jul 22 16:37:03 2010 +0100
@@ -36,10 +36,9 @@
 "" - "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"
+""    - "Z:\sys\bin\afstorageclient.dll"
+""    - "Z:\sys\bin\tsutils.dll"
 
 ""    - "Z:\sys\bin\hbactivityplugin.dll"
 "" -  "Z:\resource\qt\plugins\hbactivityplugin.qtplugin"
\ No newline at end of file
Binary file activityfw/sis/stubs/activitymanager_stub.sis has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/bwins/afstorageclientu.def	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,44 @@
+EXPORTS
+	?updateActivity@AfStorageClient@@QAEHABVAfStorageEntry@@ABVQPixmap@@@Z @ 1 NONAME ; int AfStorageClient::updateActivity(class AfStorageEntry const &, class QPixmap const &)
+	?tr@AfStorageClient@@SA?AVQString@@PBD0H@Z @ 2 NONAME ; class QString AfStorageClient::tr(char const *, char const *, int)
+	?asyncRequestCompleated@AfStorageClient@@EAEXHHABVQString@@@Z @ 3 NONAME ; void AfStorageClient::asyncRequestCompleated(int, int, class QString const &)
+	??_EAfStorageClient@@UAE@I@Z @ 4 NONAME ; AfStorageClient::~AfStorageClient(unsigned int)
+	?dataChanged@AfStorageClient@@IAEXXZ @ 5 NONAME ; void AfStorageClient::dataChanged(void)
+	?waitActivity@AfStorageClient@@QAEHXZ @ 6 NONAME ; int AfStorageClient::waitActivity(void)
+	?asyncRequestCompleated@AfStorageClient@@EAEXHH@Z @ 7 NONAME ; void AfStorageClient::asyncRequestCompleated(int, int)
+	?applicationId@AfStorageEntry@@QBEHXZ @ 8 NONAME ; int AfStorageEntry::applicationId(void) const
+	?removeActivity@AfStorageClient@@QAEHABVAfStorageEntry@@@Z @ 9 NONAME ; int AfStorageClient::removeActivity(class AfStorageEntry const &)
+	?qt_metacall@AfStorageClient@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 10 NONAME ; int AfStorageClient::qt_metacall(enum QMetaObject::Call, int, void * *)
+	??_EAfStorageEntry@@QAE@I@Z @ 11 NONAME ; AfStorageEntry::~AfStorageEntry(unsigned int)
+	?data@AfStorageEntry@@QBEPBVCAfEntry@@XZ @ 12 NONAME ; class CAfEntry const * AfStorageEntry::data(void) const
+	?getStaticMetaObject@AfStorageClient@@SAABUQMetaObject@@XZ @ 13 NONAME ; struct QMetaObject const & AfStorageClient::getStaticMetaObject(void)
+	?activityData@AfStorageClient@@QAEHAAVAfStorageEntry@@ABV2@@Z @ 14 NONAME ; int AfStorageClient::activityData(class AfStorageEntry &, class AfStorageEntry const &)
+	?activityRequested@AfStorageClient@@IAEXABVQString@@@Z @ 15 NONAME ; void AfStorageClient::activityRequested(class QString const &)
+	?getThumbnail@AfStorageClient@@QAEHVQSize@@VQString@@PAX@Z @ 16 NONAME ; int AfStorageClient::getThumbnail(class QSize, class QString, void *)
+	?metaObject@AfStorageClient@@UBEPBUQMetaObject@@XZ @ 17 NONAME ; struct QMetaObject const * AfStorageClient::metaObject(void) const
+	??0AfStorageEntry@@QAE@V?$QSharedPointer@VCAfEntry@@@@@Z @ 18 NONAME ; AfStorageEntry::AfStorageEntry(class QSharedPointer<class CAfEntry>)
+	??0AfStorageClient@@QAE@PAVQObject@@@Z @ 19 NONAME ; AfStorageClient::AfStorageClient(class QObject *)
+	?thumbnailRequested@AfStorageClient@@IAEXVQPixmap@@PAX@Z @ 20 NONAME ; void AfStorageClient::thumbnailRequested(class QPixmap, void *)
+	?staticMetaObject@AfStorageClient@@2UQMetaObject@@B @ 21 NONAME ; struct QMetaObject const AfStorageClient::staticMetaObject
+	?activities@AfStorageClient@@QAEHAAV?$QList@VAfStorageEntry@@@@@Z @ 22 NONAME ; int AfStorageClient::activities(class QList<class AfStorageEntry> &)
+	?publicData@AfStorageEntry@@QBE?AV?$QHash@VQString@@VQVariant@@@@XZ @ 23 NONAME ; class QHash<class QString, class QVariant> AfStorageEntry::publicData(void) const
+	??1AfStorageEntry@@QAE@XZ @ 24 NONAME ; AfStorageEntry::~AfStorageEntry(void)
+	??0AfStorageEntry@@QAE@ABV0@@Z @ 25 NONAME ; AfStorageEntry::AfStorageEntry(class AfStorageEntry const &)
+	?launchActivity@AfStorageClient@@QAEHABVAfStorageEntry@@@Z @ 26 NONAME ; int AfStorageClient::launchActivity(class AfStorageEntry const &)
+	?trUtf8@AfStorageClient@@SA?AVQString@@PBD0H@Z @ 27 NONAME ; class QString AfStorageClient::trUtf8(char const *, char const *, int)
+	?removeApplicationActivities@AfStorageClient@@QAEHABVAfStorageEntry@@@Z @ 28 NONAME ; int AfStorageClient::removeApplicationActivities(class AfStorageEntry const &)
+	?trUtf8@AfStorageClient@@SA?AVQString@@PBD0@Z @ 29 NONAME ; class QString AfStorageClient::trUtf8(char const *, char const *)
+	?applicationActivities@AfStorageClient@@QAEHAAV?$QList@VAfStorageEntry@@@@ABVAfStorageEntry@@@Z @ 30 NONAME ; int AfStorageClient::applicationActivities(class QList<class AfStorageEntry> &, class AfStorageEntry const &)
+	?connect@AfStorageClient@@QAEHXZ @ 31 NONAME ; int AfStorageClient::connect(void)
+	?tr@AfStorageClient@@SA?AVQString@@PBD0@Z @ 32 NONAME ; class QString AfStorageClient::tr(char const *, char const *)
+	?notifyDataChange@AfStorageClient@@QAEHXZ @ 33 NONAME ; int AfStorageClient::notifyDataChange(void)
+	?imageSrc@AfStorageEntry@@QBE?AVQString@@XZ @ 34 NONAME ; class QString AfStorageEntry::imageSrc(void) const
+	?asyncRequestCompleated@AfStorageClient@@EAEXHHABVQPixmap@@PAX@Z @ 35 NONAME ; void AfStorageClient::asyncRequestCompleated(int, int, class QPixmap const &, void *)
+	??0AfStorageEntry@@QAE@HABVQString@@ABVQVariant@@ABV?$QHash@VQString@@VQVariant@@@@@Z @ 36 NONAME ; AfStorageEntry::AfStorageEntry(int, class QString const &, class QVariant const &, class QHash<class QString, class QVariant> const &)
+	?addActivity@AfStorageClient@@QAEHABVAfStorageEntry@@ABVQPixmap@@@Z @ 37 NONAME ; int AfStorageClient::addActivity(class AfStorageEntry const &, class QPixmap const &)
+	?privateData@AfStorageEntry@@QBE?AVQVariant@@XZ @ 38 NONAME ; class QVariant AfStorageEntry::privateData(void) const
+	??1AfStorageClient@@UAE@XZ @ 39 NONAME ; AfStorageClient::~AfStorageClient(void)
+	?activityId@AfStorageEntry@@QBE?AVQString@@XZ @ 40 NONAME ; class QString AfStorageEntry::activityId(void) const
+	?flags@AfStorageEntry@@QBEHXZ @ 41 NONAME ; int AfStorageEntry::flags(void) const
+	?qt_metacast@AfStorageClient@@UAEPAXPBD@Z @ 42 NONAME ; void * AfStorageClient::qt_metacast(char const *)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/client/client.pro	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,66 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: 
+#
+
+TEMPLATE = lib
+TARGET = afstorageclient
+
+QT        += core \
+             sql
+
+HEADERS   += inc/afstorageclient.h \
+             inc/afstorageentry.h
+
+SOURCES   += src/afstorageclient.cpp \
+             src/afstorageentry.cpp
+
+DEFINES += ACTIVITY_LIB
+
+symbian{
+TARGET.UID3 = 0xE467C21E
+
+HEADERS   += ../s60/inc/afentry.h \
+             ../s60/inc/afserializer.h \
+             s60/inc/afstorageclient_p.h \
+             s60/inc/afstorageclientimp.h \
+			 s60/inc/afasyncrequest_p.h \
+             s60/inc/afthumbnailrequest_p.h
+
+SOURCES   += ../s60/src/afentry.cpp \
+             ../s60/src/afserializer.cpp \
+             s60/src/afstorageclient_p.cpp \
+             s60/src/afstorageclientimp.cpp \
+			 s60/src/afasyncrequest_p.cpp \
+             s60/src/afthumbnailrequest_p.cpp
+
+LIBS      += -lxqutils \
+             -lestor \
+             -lfbscli
+
+afstorageclientdll.sources = afstorageclient.dll
+afstorageclientdll.path = $$SHARED_LIB_DIR
+DEPLOYMENT += afstorageclientdll
+
+BLD_INF_RULES.prj_exports += "../inc/afstorageglobals.h /epoc32/include/afstorageglobals.h" \
+                             "../inc/afcmd.h /epoc32/include/afcmd.h" \
+                             "inc/afstorageclient.h |../../../inc/afstorageclient.h" \
+                             "inc/afstorageentry.h |../../../inc/afstorageentry.h" \
+							 "inc/afasyncrequestobserver.h |../../../inc/afasyncrequestobserver.h"
+DEPLOYMENT += api
+TARGET.CAPABILITY = ALL -TCB
+TARGET.EPOCALLOWDLLDATA = 1
+TARGET.UID3 = 0x200267B3
+MMP_RULES += EXPORTUNFROZEN
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/client/inc/afasyncrequestobserver.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef AFASYNCREQUESTOBSERVER_H
+#define AFASYNCREQUESTOBSERVER_H
+#include <QString>
+#include <QPixmap>
+
+class MAfAsyncRequestObserver
+{
+public:
+    /**
+     * Function inform observer about asynchronous request results
+     * @param result - request result
+     * @param requestType - request type
+     * @param data - respons data
+     */
+    virtual void asyncRequestCompleated(int result,
+                                        int requestType,
+                                        const QString &data)=0;
+
+    /**
+     * Function inform observer about asynchronous request results
+     * @param result - request result
+     * @param requestType - request type
+     * @param pixmap - pixmap respons
+     */
+    virtual void asyncRequestCompleated(int result,
+                                        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 // AFASYNCREQUESTOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/client/inc/afstorageclient.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef AFSTORAGECLIENT_H
+#define AFSTORAGECLIENT_H
+#include <QObject>
+#include <afasyncrequestobserver.h>
+
+#ifdef ACTIVITY_LIB
+    #define ACTIVITY_EXPORT Q_DECL_EXPORT
+#else
+    #define ACTIVITY_EXPORT Q_DECL_IMPORT
+#endif
+
+class AfStorageClientPrivate;
+class AfStorageEntry;
+
+class ACTIVITY_EXPORT AfStorageClient: public QObject,
+                                       public MAfAsyncRequestObserver
+{
+    Q_OBJECT
+public:
+    AfStorageClient(QObject* =0);
+
+    ~AfStorageClient();
+
+    int connect();
+
+    int addActivity(const AfStorageEntry &entry, const QPixmap& imageSource = QPixmap());
+
+    int updateActivity(const AfStorageEntry &entry, const QPixmap& imageSource = QPixmap());
+
+    int removeActivity(const AfStorageEntry &entry);
+
+    int removeApplicationActivities(const AfStorageEntry &entry);
+
+    int activities(QList<AfStorageEntry> &dst);
+
+    int applicationActivities(QList<AfStorageEntry> &dst, 
+                              const AfStorageEntry &entry);
+
+    int activityData(AfStorageEntry &dst, const AfStorageEntry &entry);
+
+    int waitActivity();
+    
+    int launchActivity(const AfStorageEntry &entry);
+    
+    int getThumbnail(QSize size, QString imagePath, void* userDdata);
+    
+    int notifyDataChange();
+
+private:
+    void asyncRequestCompleated(int, int, const QString &);
+
+    void asyncRequestCompleated(int, int, const QPixmap&, void*);
+
+    void asyncRequestCompleated(int result,
+                                int requestType);
+
+signals:
+    void activityRequested(const QString &activityId);
+
+    void thumbnailRequested(QPixmap thumbnailPixmap, void *userData);
+    
+    void dataChanged();
+    
+private:
+    /**
+     * Private client implementation.
+     * Own.
+     */
+    AfStorageClientPrivate *d_ptr;
+    
+    friend class AfStorageClientPrivate;
+};
+
+#endif //AFSTORAGECLIENT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/client/inc/afstorageentry.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef AFSTORAGEENTRY_H
+#define AFSTORAGEENTRY_H
+
+#include <qvariant.h>
+#include <qsharedpointer.h>
+
+class CAfEntry;
+
+#ifdef ACTIVITY_LIB
+    #define ACTIVITY_EXPORT Q_DECL_EXPORT
+#else
+    #define ACTIVITY_EXPORT Q_DECL_IMPORT
+#endif
+
+class ACTIVITY_EXPORT AfStorageEntry
+{
+public:
+    AfStorageEntry(QSharedPointer<CAfEntry> data = QSharedPointer<CAfEntry>(0));
+
+    AfStorageEntry(const AfStorageEntry &templateEntry);
+    
+    AfStorageEntry(int appId, 
+                   const QString &actId = QString(), 
+                   const QVariant &privateData = QVariant(), 
+                   const QVariantHash& publicData = QVariantHash());
+
+    const CAfEntry* data() const;
+
+    int flags() const;
+
+    int applicationId() const;
+
+    QString activityId() const;
+
+    QString imageSrc() const;
+    
+    QVariantHash publicData() const;
+    
+    QVariant privateData() const;
+    
+private:
+    QSharedPointer<CAfEntry> mData;
+
+};
+
+#endif //AFSTORAGEENTRY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/client/s60/inc/afasyncrequest_p.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef AFASYNCREQUESTPRIVATE_H
+#define AFASYNCREQUESTPRIVATE_H
+#include <e32base.h>
+#include <QVariant>
+#include <QPixmap>
+#include "afasyncrequestobserver.h"
+#include "afstorageclientimp.h"
+#include "afcmd.h"
+
+class CAfAsyncRequestPrivate : public CActive
+
+{
+public:
+    static void NewLD(MAfAsyncRequestObserver &observer, 
+                      RAfStorageClientImplementation & session,
+                      ActivityCmd cmd);
+
+    ~CAfAsyncRequestPrivate();
+
+protected:
+    void DoCancel();
+
+    void RunL();
+
+    TInt RunError(TInt error);
+
+private:
+    CAfAsyncRequestPrivate(MAfAsyncRequestObserver &, 
+                           RAfStorageClientImplementation &,
+                           ActivityCmd);
+    void ConstructL();
+
+private:
+    MAfAsyncRequestObserver &mObserver;
+    RAfStorageClientImplementation &mSession;
+    const ActivityCmd mCmd;
+    TPckgBuf<TInt> mIds[4];
+};
+#endif // AFASYNCREQUESTPRIVATE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/client/s60/inc/afstorageclient_p.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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:
+*
+*/
+
+#ifndef AFSTORAGECLIENTPRIVATE_H
+#define AFSTORAGECLIENTPRIVATE_H
+
+#include <e32base.h>
+#include "afstorageglobals.h"
+#include "afstorageclientimp.h"
+
+class AfStorageEntry;
+class AfAsyncRequestPrivate;
+
+class AfStorageClientPrivate
+{
+public:
+    AfStorageClientPrivate(MAfAsyncRequestObserver & observer);
+
+    ~AfStorageClientPrivate();
+
+    int connect();
+
+    int addActivity(const AfStorageEntry &sourceEntry, const QPixmap& sourceImage);
+
+    int updateActivity(const AfStorageEntry &sourceEntry, const QPixmap& sourceImage);
+
+    int removeActivity(const AfStorageEntry &templateEntry);
+
+    int removeApplicationActivities(const AfStorageEntry &templateEntry);
+
+    int activities(QList<AfStorageEntry> &dst);
+
+    int applicationActivities(QList<AfStorageEntry> &dst, 
+                              const AfStorageEntry &entry);
+
+    int activityData(AfStorageEntry &resultEntry, const AfStorageEntry &templateEntry);
+    
+    int waitActivity();
+    
+    int getThumbnail(QSize size, QString imagePath , void *userDdata);
+    
+    int notifyDataChange();
+
+    int launchActivity(const AfStorageEntry &templateEntry);
+
+    int cancelWaitActivity();
+
+    int cancelNotifyDataChange();
+
+private:
+    int execute(int function, const AfStorageEntry &sourceEntry, const QPixmap& sourceImage);
+    int execute(int function, QList<AfStorageEntry>& resultsList,const AfStorageEntry& templateEntry);
+
+private:
+    RAfStorageClientImplementation mImplementation;
+};
+#endif // AFSTORAGECLIENTPRIVATE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/client/s60/inc/afstorageclientimp.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef AFSTORAGECLIENTIMPLEMENTATION_H
+#define AFSTORAGECLIENTIMPLEMENTATION_H
+#include <e32base.h>
+#include "afasyncrequestobserver.h"
+
+class CAfEntry;
+class CFbsBitmap;
+
+class RAfStorageClientImplementation: protected RSessionBase
+{
+public:
+    RAfStorageClientImplementation(MAfAsyncRequestObserver &observer);
+
+    ~RAfStorageClientImplementation();
+
+    void Close();
+
+    void executeL(int function);
+
+    void executeL(int function, 
+                  const CAfEntry &sourceEntry,
+                  int userData =0);
+
+    void executeL(int function, 
+                  RPointerArray<CAfEntry> &resultsList, 
+                  const CAfEntry& templateEntry);
+    
+    void getThumbnailL(TSize size, 
+                      const TDesC& source,
+                      TAny *userData );
+
+    void connectL();
+
+public:
+    void PushL(CBase* asyncTask);
+
+    void Pop(CBase* asyncTask);
+
+    void sendAsync(int function, const TIpcArgs &args, TRequestStatus& status);
+
+    void getDataL(int id, TDes8& buffer);
+
+private:
+    void startServerL();
+
+private:
+    RPointerArray<CBase> mAsyncTasks;
+    MAfAsyncRequestObserver &mObserver;
+};
+
+#endif //AFSTORAGECLIENTIMPLEMENTATION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/client/s60/inc/afthumbnailrequest_p.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 AFTHUMBNAILREQUESTPRIVATE_H
+#define AFTHUMBNAILREQUESTPRIVATE_H
+#include <e32base.h>
+#include <QVariant>
+#include <QPixmap>
+#include "afasyncrequestobserver.h"
+#include "afstorageclientimp.h"
+
+class CAfThumbnailRequestPrivate : public CActive
+
+{
+public:
+    static void NewLD(MAfAsyncRequestObserver &observer, 
+                      RAfStorageClientImplementation & session,
+                      TSize resolution,
+                      const TDesC& source,
+                      TAny* userData);
+
+    ~CAfThumbnailRequestPrivate();
+
+protected:
+    void DoCancel();
+
+    void RunL();
+
+    TInt RunError(TInt error);
+
+private:
+    CAfThumbnailRequestPrivate(MAfAsyncRequestObserver &, 
+                               RAfStorageClientImplementation &, 
+                               TAny*);
+
+    void ConstructL(TSize resolution, const TDesC& source);
+
+private:
+    MAfAsyncRequestObserver &mObserver;
+    RAfStorageClientImplementation &mSession;
+    TPckgBuf<TInt> mIds[4]; 
+    RBuf mImgSrc;
+    TAny* mUserData;
+};
+#endif // AFTHUMBNAILREQUESTPRIVATE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/client/s60/src/afasyncrequest_p.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,139 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "afasyncrequest_p.h"
+#include "afstorageclient_p.h"
+#include "afstorageclient.h"
+#include "afentry.h"
+#include <fbs.h>
+#include <XQConversions>
+
+// -----------------------------------------------------------------------------
+/**
+ * Create and initialize handler for anyc. activity requests
+ * @param observer - request completion observer
+ * @param session - activity client implementation
+ * @param cmd - requested functionality
+ */
+void CAfAsyncRequestPrivate::NewLD(MAfAsyncRequestObserver &observer, 
+                                   RAfStorageClientImplementation & session,
+                                   ActivityCmd cmd)
+{
+    CAfAsyncRequestPrivate* self = new(ELeave)CAfAsyncRequestPrivate(observer, session, cmd);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    session.PushL(self);
+    CleanupStack::Pop(self);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * First phase construction
+ * @param observer - request completion observer
+ * @param session - activity client implementation
+ * @param cmd - requested functionality
+ */
+CAfAsyncRequestPrivate::CAfAsyncRequestPrivate(MAfAsyncRequestObserver & observer, 
+                                               RAfStorageClientImplementation & session,
+                                               ActivityCmd cmd)
+:
+CActive(EPriorityStandard),
+mObserver(observer),
+mSession(session),
+mCmd(cmd)
+{
+    CActiveScheduler::Add(this);
+    RProcess process;
+    mIds[0] = static_cast<TInt>(process.SecureId().iId);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Second phase construction
+ */
+void CAfAsyncRequestPrivate::ConstructL()
+{
+    mSession.sendAsync(mCmd, 
+                       TIpcArgs(&mIds[0],&mIds[1], &mIds[2], &mIds[3]),
+                       iStatus);
+    SetActive();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Destructor
+ */
+CAfAsyncRequestPrivate::~CAfAsyncRequestPrivate()
+{
+    Cancel();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Cancel pending requst
+ */
+void CAfAsyncRequestPrivate::DoCancel()
+{
+    TRAP_IGNORE(
+    switch (mCmd) {
+    case WaitActivity: mSession.executeL(CancelWait); break;
+    case NotifyChange: mSession.executeL(CancelNotify); break;
+    }
+    )
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function handle request completion, copy data, forward information and destroy handler 
+ */
+void CAfAsyncRequestPrivate::RunL()
+{
+    User::LeaveIfError(iStatus.Int());
+    switch (mCmd) {
+    case WaitActivity:
+        {
+        RBuf8 data;
+        CleanupClosePushL(data);
+        CAfEntry::ReallocL(data, (mIds[0])());
+        mSession.getDataL((mIds[3])(), data);
+        mObserver.asyncRequestCompleated(iStatus.Int(), mCmd, XQConversions::s60Desc8ToQString(data));
+        CleanupStack::PopAndDestroy(&data);
+        break;
+        }
+    case NotifyChange:
+        mObserver.asyncRequestCompleated(iStatus.Int(), mCmd);
+        break;
+    }
+    mSession.Pop(this);
+    delete this;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function handle request processing errors
+ * @param error - error code 
+ */
+TInt CAfAsyncRequestPrivate::RunError(TInt error)
+{
+    (WaitActivity == mCmd) ? mObserver.asyncRequestCompleated(error, mCmd, QString::null) :
+                             mObserver.asyncRequestCompleated(error, mCmd);
+    mSession.Pop(this);
+    delete this;
+    return KErrNone;
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/client/s60/src/afstorageclient_p.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,282 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include <fbs.h>
+#include <s32mem.h>
+
+#include <qvariant.h>
+#include <XQConversions>
+
+#include "afstorageclient_p.h"
+#include "afasyncrequest_p.h"
+#include "afstorageglobals.h"
+#include "afserializer.h"
+#include "afentry.h"
+#include "afstorageentry.h"
+
+
+// -----------------------------------------------------------------------------
+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));
+} 
+// -----------------------------------------------------------------------------
+/**
+ * Constructor
+ */
+AfStorageClientPrivate::AfStorageClientPrivate(MAfAsyncRequestObserver & observer)
+:
+mImplementation(observer)
+{
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Destructor
+ */
+AfStorageClientPrivate::~AfStorageClientPrivate()
+{
+    mImplementation.Close();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function implementation
+ * @see AfStorageClient::connect
+ */
+int AfStorageClientPrivate::connect()
+{
+    TRAPD(errNo, mImplementation.connectL());
+    return errNo;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function implementation
+ * @see AfStorageClient::addActivity(const AfStorageEntry &,const QPixmap&)
+ */
+int AfStorageClientPrivate::addActivity(const AfStorageEntry &entry, 
+                                        const QPixmap& imageSrc)
+{
+    return execute(AddActivity, entry, imageSrc);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function implementation
+ * @see AfStorageClient::updateActivity(const AfStorageEntry &,const QPixmap&)
+ */
+int AfStorageClientPrivate::updateActivity(const AfStorageEntry &entry, 
+                                           const QPixmap& imageSrc)
+{
+    return execute(UpdateActivity, entry, imageSrc);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function implementation
+ * @see AfStorageClient::removeActivity(const AfStorageEntry &)
+ */
+int AfStorageClientPrivate::removeActivity(const AfStorageEntry &entry)
+{
+    return execute(RemoveActivity, entry, QPixmap());
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function implementation
+ * @see AfStorageClient::removeApplicationActivities(const AfStorageEntry &)
+ */
+int AfStorageClientPrivate::removeApplicationActivities(const AfStorageEntry &entry)
+{
+    return execute(RemoveApplicationActivities, entry, QPixmap());
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function implementation
+ * @see AfStorageClient::activities(QList<AfStorageEntry> &)
+ */
+int AfStorageClientPrivate::activities(QList<AfStorageEntry> &results)
+{
+    return execute(Activities, results, AfStorageEntry());
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function implementation
+ * @see AfStorageClient::applicationActivities(QList<AfStorageEntry> &, const AfStorageEntry &)
+ */
+int AfStorageClientPrivate::applicationActivities(QList<AfStorageEntry> &results,
+                                                  const AfStorageEntry &templateEntry)
+{
+    return execute(ApplicationActivities, results, templateEntry);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function implementation
+ * @see AfStorageClient::activityData(AfStorageEntry &, const AfStorageEntry &)
+ */
+int AfStorageClientPrivate::activityData(AfStorageEntry &resultEntry, 
+                                         const AfStorageEntry &templateEntry)
+{
+    
+    QList<AfStorageEntry> results;
+    int errNo(execute(ApplicationActivity, results, templateEntry));
+    if (0 == errNo) {
+        resultEntry = results.first();
+    }
+    return errNo;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function implementation
+ * @see AfStorageClient::waitActivity()
+ */
+int AfStorageClientPrivate::waitActivity()
+{
+    return execute(WaitActivity, AfStorageEntry(), QPixmap());
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function implementation
+ * @see AfStorageClient::getThumbnail(QSize, QString, void *)
+ */
+int AfStorageClientPrivate::getThumbnail(QSize size, QString imagePath, void *userData)
+{
+    HBufC *source = XQConversions::qStringToS60Desc(imagePath);
+    TRAPD(errNo, mImplementation.getThumbnailL(TSize(size.width(), size.height()), *source, userData);)
+    delete source;
+    return errNo;
+    
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function implementation
+ * @see AfStorageClient::notifyDataChange()
+ */
+int AfStorageClientPrivate::notifyDataChange()
+{
+    return execute(NotifyChange, AfStorageEntry(), QPixmap());
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function implementation
+ * @see AfStorageClient::launchActivity(const AfStorageEntry &)
+ */
+int AfStorageClientPrivate::launchActivity(const AfStorageEntry &templateEntry)
+{
+    return execute(LaunchActivity, templateEntry, QPixmap());
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function implementation
+ * @see AfStorageClient::cancelWaitActivity()
+ */
+int AfStorageClientPrivate::cancelWaitActivity()
+{
+    return execute(CancelWait, AfStorageEntry(), QPixmap());
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function implementation
+ * @see AfStorageClient::cancelNotifyDataChange()
+ */
+int AfStorageClientPrivate::cancelNotifyDataChange()
+{
+    return execute(CancelNotify, AfStorageEntry(), QPixmap());
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function execute activity framework functinality and return results 
+ */
+int AfStorageClientPrivate::execute(int function, const AfStorageEntry &sourceEntry, const QPixmap& sourceImage)
+{
+    TRAPD(errNo,
+    const CAfEntry *entry(sourceEntry.data());
+    int userData(-1);
+    CFbsBitmap* bitmap(sourceImage.toSymbianCFbsBitmap());
+    if(0 != bitmap) {
+        CleanupStack::PushL(bitmap);
+        userData = bitmap->Handle();
+    }
+    switch (function) {
+    case AddActivity:
+    case UpdateActivity:
+    case RemoveActivity:
+    case RemoveApplicationActivities:
+    case LaunchActivity:
+        User::LeaveIfNull(entry);
+        mImplementation.executeL(function, *entry, userData);
+        break;
+    
+    case CancelNotify:
+    case CancelWait:
+    case WaitActivity:
+    case NotifyChange:
+        mImplementation.executeL(function);
+        break;
+    }
+    if(0 != bitmap) {
+        CleanupStack::PopAndDestroy(bitmap);
+    }
+    )
+    return errNo;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function execute activity framework functinality and return results 
+ */
+int AfStorageClientPrivate::execute(int function, QList<AfStorageEntry>& resultsList,const AfStorageEntry& templateEntry)
+{
+    TRAPD(errNo,
+    RPointerArray<CAfEntry> results;
+    CleanupResetAndDestroyPushL<CAfEntry>(results);
+    
+    CAfEntry *entry(const_cast<CAfEntry *>(templateEntry.data()));
+    if(0 == entry) {
+        entry = CAfEntry::NewLC();
+    }
+    mImplementation.executeL(function, results, *entry);
+    if(templateEntry.data() != entry) {
+        CleanupStack::PopAndDestroy(entry);
+    }
+    
+    //copy data
+    while (results.Count()) {
+        resultsList.append(AfStorageEntry(QSharedPointer<CAfEntry>(results[0])));
+        results.Remove(0);
+    }
+    CleanupStack::PopAndDestroy(&results);
+    )
+    return errNo;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/client/s60/src/afstorageclientimp.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,190 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include <fbs.h>
+#include <s32mem.h>
+#include "afstorageclientimp.h"
+#include "afstorageglobals.h"
+#include "afglobals.h"
+#include "afentry.h"
+#include "afasyncrequest_p.h"
+#include "afthumbnailrequest_p.h"
+
+// -----------------------------------------------------------------------------
+/**
+ * Furst phase constructor 
+ */
+RAfStorageClientImplementation::RAfStorageClientImplementation(MAfAsyncRequestObserver &observer)
+:
+mObserver(observer)
+{}
+
+// -----------------------------------------------------------------------------
+/**
+ * Destructor
+ */
+RAfStorageClientImplementation::~RAfStorageClientImplementation()
+{
+    Close();
+}
+
+// -----------------------------------------------------------------------------
+void RAfStorageClientImplementation::Close()
+{
+    mAsyncTasks.ResetAndDestroy();
+    RSessionBase::Close();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function establish connection to activity server
+  */
+void RAfStorageClientImplementation::connectL()
+{
+    const int asyncMessageSlots(12);
+    const int maxRetry(4);
+    TInt retry = maxRetry;
+    TInt errNo(KErrNone);
+    do {
+        errNo = CreateSession(KActivityServerName, 
+                              TVersion(0, 0, 0), 
+                              asyncMessageSlots);
+        if (KErrNotFound != errNo && KErrServerTerminated != errNo) {
+            retry =0;
+        } else {
+            TRAP(errNo, startServerL());
+            if (KErrNone != errNo && KErrAlreadyExists != errNo) {
+                retry =0;
+                errNo = CreateSession(KActivityServerName, 
+                                      TVersion(0, 0, 0), 
+                                      asyncMessageSlots);
+            }
+        }
+    } while (--retry > 0);
+    User::LeaveIfError(errNo);
+}
+
+// -----------------------------------------------------------------------------
+void RAfStorageClientImplementation::startServerL()
+{
+    RProcess server;
+    const TUidType uid(KNullUid, KNullUid, KActivityServerUid);
+    User::LeaveIfError(server.Create(KActivityServerName, KNullDesC, uid));
+    TRequestStatus stat;
+    server.Rendezvous(stat);
+    if (stat != KRequestPending) {
+        server.Kill(0);
+    } else {
+        server.Resume();
+    }
+    User::WaitForRequest(stat);
+    int errNo = (EExitPanic == server.ExitType()) ?
+                KErrGeneral : stat.Int();
+    if (KErrCancel == errNo) {
+        errNo = KErrNone;
+    }
+    server.Close();
+    User::LeaveIfError(errNo);
+}
+
+// -----------------------------------------------------------------------------
+void RAfStorageClientImplementation::executeL(int function)
+{
+    switch (function) {
+    case WaitActivity:
+    case NotifyChange:
+        CAfAsyncRequestPrivate::NewLD(mObserver, *this, static_cast<ActivityCmd>(function));
+        break;
+    default:
+        User::LeaveIfError(SendReceive(function, TIpcArgs()));
+    }
+}
+
+// -----------------------------------------------------------------------------
+void RAfStorageClientImplementation::executeL(int function, 
+                                              const CAfEntry &entry,
+                                              int userData)
+{
+    TPckgBuf<TInt> data(userData);
+    RBuf8 serializedEntry;
+    CleanupClosePushL(serializedEntry);
+    serializedEntry.CreateL(entry.Size());
+    RDesWriteStream stream(serializedEntry);
+    CleanupClosePushL(stream);
+    stream << entry;
+    CleanupStack::PopAndDestroy(&stream);
+    User::LeaveIfError(SendReceive(function, TIpcArgs(&serializedEntry, &data)));
+    CleanupStack::PopAndDestroy(&serializedEntry);
+}
+
+// -----------------------------------------------------------------------------
+void RAfStorageClientImplementation::executeL(int function, RPointerArray<CAfEntry> &resultsList, const CAfEntry& templateEntry)
+{
+    resultsList.ResetAndDestroy();
+    RBuf8 buffer;
+    CleanupClosePushL(buffer);
+    CAfEntry::ReallocL(buffer, templateEntry.Size());
+    RDesWriteStream writer(buffer);
+    CleanupClosePushL(writer);
+    writer << templateEntry;
+    CleanupStack::PopAndDestroy(&writer);
+    TPckgBuf<int> length(0), taskId(0);
+    User::LeaveIfError(SendReceive(function,
+                                   TIpcArgs(&buffer, &length, &taskId)));
+    CAfEntry::ReallocL(buffer, length());
+    User::LeaveIfError(SendReceive(GetData, TIpcArgs(&taskId, &buffer)));
+    resultsList << buffer;
+    CleanupStack::PopAndDestroy(&buffer);
+}
+
+// -----------------------------------------------------------------------------
+void RAfStorageClientImplementation::getThumbnailL(TSize size, 
+                                                   const TDesC& source, 
+                                                   TAny *userData )
+{
+    CAfThumbnailRequestPrivate::NewLD(mObserver, *this, size, source, userData);
+}
+
+// -----------------------------------------------------------------------------
+void RAfStorageClientImplementation::PushL(CBase* asyncTask)
+{
+    const TInt offset(mAsyncTasks.Find(asyncTask));
+    (KErrNotFound == offset) ? mAsyncTasks.AppendL(asyncTask) : User::Leave(KErrAlreadyExists);
+}
+
+// -----------------------------------------------------------------------------
+void RAfStorageClientImplementation::Pop(CBase* asyncTask)
+{
+    const TInt offset(mAsyncTasks.Find(asyncTask));
+    if (KErrNotFound != offset) {
+        mAsyncTasks.Remove(offset);
+    }
+}
+
+// -----------------------------------------------------------------------------
+void RAfStorageClientImplementation::sendAsync(int function, 
+                                              const TIpcArgs& args, 
+                                              TRequestStatus& status)
+{
+    SendReceive(function, args, status);
+}
+
+// -----------------------------------------------------------------------------
+void RAfStorageClientImplementation::getDataL(int id, TDes8& buffer)
+{
+    TPckgBuf<int> requestId(id);
+    SendReceive(GetData, TIpcArgs(&requestId, &buffer));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/client/s60/src/afthumbnailrequest_p.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,132 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include <fbs.h>
+#include <XQConversions>
+
+#include "afthumbnailrequest_p.h"
+#include "afstorageclient_p.h"
+#include "afstorageclient.h"
+#include "afentry.h"
+
+// -----------------------------------------------------------------------------
+/**
+ * Create and initialize handler for activity thumbnail request
+ * @param observer - request completion observer
+ * @param session - activity client implementation
+ * @param source - thumbnail source location
+ * @param userData - rsponse user data
+ */
+void CAfThumbnailRequestPrivate::NewLD(MAfAsyncRequestObserver &observer, 
+                                       RAfStorageClientImplementation & session,
+                                       TSize resolution, 
+                                       const TDesC& source,
+                                       TAny* userData)
+{
+    CAfThumbnailRequestPrivate* self = new(ELeave)CAfThumbnailRequestPrivate(observer, session, userData);
+    CleanupStack::PushL(self);
+    self->ConstructL(resolution, source);
+    session.PushL(self);
+    CleanupStack::Pop(self);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Constructor
+ * @param observer - request completion observer
+ * @param session - activity client implementation
+ * @param userData - rsponse user data
+ */
+CAfThumbnailRequestPrivate::CAfThumbnailRequestPrivate(MAfAsyncRequestObserver & observer, 
+                                                       RAfStorageClientImplementation & session,
+                                                       TAny* userData)
+:
+CActive(EPriorityStandard),
+mObserver(observer),
+mSession(session),
+mUserData(userData)
+{
+    CActiveScheduler::Add(this);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Second phase constructor
+ * @param resolution - requested thumbnail resolution
+ * @param source - thumbnail source location
+ */
+void CAfThumbnailRequestPrivate::ConstructL(TSize resolution, const TDesC& source)
+{
+    mIds[0] = resolution.iWidth;
+    mIds[1] = resolution.iHeight;
+    CAfEntry::CopyL(mImgSrc, source);
+    mSession.sendAsync(GetThumbnail, 
+                       TIpcArgs(&mIds[0],&mIds[1], &mImgSrc),
+                       iStatus);
+    SetActive();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Destuctor
+ */
+CAfThumbnailRequestPrivate::~CAfThumbnailRequestPrivate()
+{
+    Cancel();
+    mImgSrc.Close();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Cancel pending requst
+ */
+void CAfThumbnailRequestPrivate::DoCancel()
+{
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function handle request completion, copy data, forward information and destroy handler 
+ */
+void CAfThumbnailRequestPrivate::RunL()
+{
+    User::LeaveIfError(iStatus.Int());
+    CFbsBitmap* bitmap = new (ELeave) CFbsBitmap();
+    CleanupStack::PushL(bitmap);
+    User::LeaveIfError(bitmap->Duplicate(mIds[0]()));
+    mObserver.asyncRequestCompleated(iStatus.Int(), 
+                                     GetThumbnail, 
+                                     QPixmap::fromSymbianCFbsBitmap(bitmap), 
+                                     mUserData);
+    CleanupStack::PopAndDestroy(bitmap);
+    mSession.Pop(this);
+    delete this;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function handle request processing errors
+ * @param error - error code 
+ */
+TInt CAfThumbnailRequestPrivate::RunError(TInt error)
+{
+    mObserver.asyncRequestCompleated(error, GetThumbnail, QPixmap(), mUserData);
+    mSession.Pop(this);
+    delete this;
+    return KErrNone;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/client/src/afstorageclient.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,228 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "afstorageclient.h"
+#include "afstorageclient_p.h"
+
+// -----------------------------------------------------------------------------
+/**
+ * Constructor
+ */
+AfStorageClient::AfStorageClient(QObject *obj)
+:
+QObject(obj),
+d_ptr(0)
+{
+    d_ptr = new AfStorageClientPrivate(*this);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Destructor
+ */
+AfStorageClient::~AfStorageClient()
+{
+    delete d_ptr;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Establish connection with activity server
+ * @return 0 on succees, error code otherwise
+ */
+int AfStorageClient::connect()
+{
+    return d_ptr->connect();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation.
+ * @see int MAfAsyncRequestObserver::asyncRequestCompleated(int, int, const QString&)
+ */
+void AfStorageClient::asyncRequestCompleated(int result,
+                                             int requestType, 
+                                             const QString& data)
+{
+    switch (requestType) {
+    case WaitActivity:
+        if (KErrCancel != result) {
+            waitActivity();
+        }            
+        if (KErrNone == result) {
+            emit activityRequested(data);
+        }
+        
+        break;
+    }
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation.
+ * @see int MAfAsyncRequestObserver::asyncRequestCompleated(int, int, QPixmap&, void*)
+ */
+void AfStorageClient::asyncRequestCompleated(int result,
+                                             int requestType, 
+                                             const QPixmap& pixmap,
+                                             void* userData)
+{
+    switch (requestType) {
+    case GetThumbnail:
+        emit thumbnailRequested(0 == result ? pixmap : QPixmap(), 
+                                userData);
+        break;
+    }
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation.
+ * @see int MAfAsyncRequestObserver::asyncRequestCompleated(int, int)
+ */
+void AfStorageClient::asyncRequestCompleated(int result,int requestType)
+{
+    switch(requestType) {
+    case NotifyChange:
+        if (KErrCancel != result) {
+            notifyDataChange();
+        }
+        if (KErrNone == result) {
+            emit dataChanged();
+        }
+        break;
+    }
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function add new activity
+ * @param entry - activity entry data structure
+ * @param imageSource - source for activity thumbnail
+ * @return 0 on success, error code otherwise
+ */
+int AfStorageClient::addActivity(const AfStorageEntry &entry, const QPixmap &imageSource)
+{
+    return d_ptr->addActivity(entry, imageSource);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function update existing activity
+ * @param entry - activity entry data structure
+ * @param imageSource - source for activity thumbnail
+ * @return 0 on success, error code otherwise
+ */
+int AfStorageClient::updateActivity(const AfStorageEntry &entry, 
+                                    const QPixmap &imageSource)
+{
+    return d_ptr->updateActivity(entry, imageSource);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function remove existing activity
+ * @param entry - activity entry template
+  * @return 0 on success, error code otherwise
+ */
+int AfStorageClient::removeActivity(const AfStorageEntry &entry)
+{
+    return d_ptr->removeActivity(entry);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function remove existing activities for application
+ * @param entry - activity entry template
+  * @return 0 on success, error code otherwise
+ */
+int AfStorageClient::removeApplicationActivities(const AfStorageEntry &entry)
+{
+    return d_ptr->removeApplicationActivities(entry);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function retreive public data for all activities
+ * @param dst - list of results
+ * @return 0 on success, error code otherwise 
+ */
+int AfStorageClient::activities(QList<AfStorageEntry> &dst)
+{
+    return d_ptr->activities(dst);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function retreive public data for all application activities
+ * @param dst - list of results
+ * @param entry - activity template
+ * @return 0 on success, error code otherwise 
+ */
+int AfStorageClient::applicationActivities(QList<AfStorageEntry> &dst, 
+                                           const AfStorageEntry &entry)
+{
+    return d_ptr->applicationActivities(dst, entry);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function retreive all data for requested activity
+ * @param dst - activity entry
+ * @param entry - activity template
+ * @return 0 on success, error code otherwise 
+ */
+int AfStorageClient::activityData(AfStorageEntry &dst, const AfStorageEntry &entry)
+{
+    return d_ptr->activityData(dst, entry);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function subscribe application for notyfication about requested activity changes
+ * @return 0 on success, error code otherwise 
+ */
+int AfStorageClient::waitActivity()
+{
+    return d_ptr->waitActivity();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function request activity change
+ * @param entry - activity template 
+ * @return 0 on success, error code otherwise 
+ */
+int AfStorageClient::launchActivity(const AfStorageEntry &entry)
+{
+    return d_ptr->launchActivity(entry);
+}
+
+// -----------------------------------------------------------------------------
+int AfStorageClient::getThumbnail(QSize size, QString imagePath, void* userDdata)
+{
+    return d_ptr->getThumbnail(size, imagePath, userDdata);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function subscribe launcher for data model changes
+ * @return 0 on success, error code otherwise 
+ */
+int AfStorageClient::notifyDataChange()
+{
+    return  d_ptr->notifyDataChange();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/client/src/afstorageentry.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -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 <xqconversions.h>
+
+#include "afstorageentry.h"
+#include "afentry.h"
+#include "afserializer.h"
+#include "afstorageglobals.h"
+// -----------------------------------------------------------------------------
+/**
+ * Constructor. 
+ * Initialize object with preallocated symbian specyfic data structure. Function doesn't copy content
+ * @param data - pointer to symbian specyfic data structure
+ */
+AfStorageEntry::AfStorageEntry(QSharedPointer<CAfEntry> data)
+:
+mData(data)
+{}
+
+// -----------------------------------------------------------------------------
+/**
+* Constructor
+* Initialize object with preallocated data structure. Function doesn't copy content
+* @param data - activity data structure
+*/
+AfStorageEntry::AfStorageEntry(const AfStorageEntry &data)
+:
+    mData(data.mData)
+{}
+
+// -----------------------------------------------------------------------------
+/**
+ * Constructor
+ * Initialize object with data. Function do deep copy of data
+ * @param appId - unique application identifier
+ * @param actId - activity identifier
+ * @param privateData - private part of activity data
+ * @param publicData - public part of activity data
+ */
+AfStorageEntry::AfStorageEntry(int appId, 
+                               const QString &actId, 
+                               const QVariant &privateData, 
+                               const QVariantHash& publicData)
+:
+    mData(0)
+{
+    int flags(0);
+    QVariantHash privData;
+    privData.insert(ActivityDataKeyword, privateData);
+    RBuf8 privateBuff, publicBuff;
+    CleanupClosePushL(privateBuff);
+    CleanupClosePushL(publicBuff);
+    privateBuff << privData;
+    publicBuff << publicData;
+    
+    if (publicData.end() != publicData.find(ActivityPersistence) && 
+        publicData[ActivityPersistence].toBool()) {
+        flags |= CAfEntry::Persistent;
+    }
+    
+    if (publicData.end() != publicData.find(ActivityVisibility) && 
+        !publicData[ActivityVisibility].toBool()) {
+        flags |= CAfEntry::Invisible;
+    }
+    
+    HBufC *actBuff = XQConversions::qStringToS60Desc(actId);
+    CleanupStack::PushL(actBuff);
+    mData = QSharedPointer<CAfEntry>(CAfEntry::NewL(flags, 
+                                                    appId, 
+                                                    *actBuff, 
+                                                    KNullDesC, 
+                                                    privateBuff, 
+                                                    publicBuff));
+    CleanupStack::PopAndDestroy(actBuff);
+    CleanupStack::PopAndDestroy(&publicBuff);
+    CleanupStack::PopAndDestroy(&privateBuff);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Retrieve S60 structure representation
+ */
+const CAfEntry* AfStorageEntry::data() const
+{
+    return mData.data();
+}
+ 
+
+// -----------------------------------------------------------------------------
+/**
+ * Retrieve activity flags
+ * @return activity flags
+ */
+int AfStorageEntry::flags() const
+{
+    return mData->Flags();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Retrieve application unique identifier
+ * @return application identifier
+ */
+int AfStorageEntry::applicationId() const
+{
+    return mData->ApplicationId();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Retrieve activity identifier. Identyfier is unique for each application 
+ * @return activity identifier
+ */
+QString AfStorageEntry::activityId() const
+{
+    return XQConversions::s60DescToQString(mData->ActivityId());
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Retrieve path to activity thumbanil path 
+ * @return thumbail loacation path
+ */
+QString AfStorageEntry::imageSrc() const
+{
+    return XQConversions::s60DescToQString(mData->ImageSrc());
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Retrieve public part of activity data 
+ * @return public activity data
+ */
+QVariantHash AfStorageEntry::publicData() const
+{
+    QVariantHash deserializedData;
+    deserializedData << mData->Data(CAfEntry::Public);
+    deserializedData.insert(ActivityApplicationKeyword, applicationId());
+    deserializedData.insert(ActivityActivityKeyword, activityId());
+    deserializedData.insert(ActivityScreenshotKeyword, imageSrc());
+    deserializedData.insert(ActivityPersistence, (flags() & CAfEntry::Persistent) ? true : false);
+    deserializedData.insert(ActivityVisibility, (flags() & CAfEntry::Invisible) ? false : true);
+    return deserializedData;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Retrieve private part of activity data 
+ * @return private activity data
+ */
+QVariant AfStorageEntry::privateData() const
+{
+    QVariantHash deserializedData;
+    deserializedData << mData->Data(CAfEntry::Private);
+    return deserializedData[ActivityDataKeyword];
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/eabi/afstorageclientu.def	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,48 @@
+EXPORTS
+	_ZN14AfStorageEntryC1E14QSharedPointerI8CAfEntryE @ 1 NONAME
+	_ZN14AfStorageEntryC1ERKS_ @ 2 NONAME
+	_ZN14AfStorageEntryC1EiRK7QStringRK8QVariantRK5QHashIS0_S3_E @ 3 NONAME
+	_ZN14AfStorageEntryC2E14QSharedPointerI8CAfEntryE @ 4 NONAME
+	_ZN14AfStorageEntryC2ERKS_ @ 5 NONAME
+	_ZN14AfStorageEntryC2EiRK7QStringRK8QVariantRK5QHashIS0_S3_E @ 6 NONAME
+	_ZN15AfStorageClient10activitiesER5QListI14AfStorageEntryE @ 7 NONAME
+	_ZN15AfStorageClient11addActivityERK14AfStorageEntryRK7QPixmap @ 8 NONAME
+	_ZN15AfStorageClient11dataChangedEv @ 9 NONAME
+	_ZN15AfStorageClient11qt_metacallEN11QMetaObject4CallEiPPv @ 10 NONAME
+	_ZN15AfStorageClient11qt_metacastEPKc @ 11 NONAME
+	_ZN15AfStorageClient12activityDataER14AfStorageEntryRKS0_ @ 12 NONAME
+	_ZN15AfStorageClient12getThumbnailE5QSize7QStringPv @ 13 NONAME
+	_ZN15AfStorageClient12waitActivityEv @ 14 NONAME
+	_ZN15AfStorageClient14launchActivityERK14AfStorageEntry @ 15 NONAME
+	_ZN15AfStorageClient14removeActivityERK14AfStorageEntry @ 16 NONAME
+	_ZN15AfStorageClient14updateActivityERK14AfStorageEntryRK7QPixmap @ 17 NONAME
+	_ZN15AfStorageClient16notifyDataChangeEv @ 18 NONAME
+	_ZN15AfStorageClient16staticMetaObjectE @ 19 NONAME DATA 16
+	_ZN15AfStorageClient17activityRequestedERK7QString @ 20 NONAME
+	_ZN15AfStorageClient18thumbnailRequestedE7QPixmapPv @ 21 NONAME
+	_ZN15AfStorageClient19getStaticMetaObjectEv @ 22 NONAME
+	_ZN15AfStorageClient21applicationActivitiesER5QListI14AfStorageEntryERKS1_ @ 23 NONAME
+	_ZN15AfStorageClient22asyncRequestCompleatedEii @ 24 NONAME
+	_ZN15AfStorageClient22asyncRequestCompleatedEiiRK7QPixmapPv @ 25 NONAME
+	_ZN15AfStorageClient22asyncRequestCompleatedEiiRK7QString @ 26 NONAME
+	_ZN15AfStorageClient27removeApplicationActivitiesERK14AfStorageEntry @ 27 NONAME
+	_ZN15AfStorageClient7connectEv @ 28 NONAME
+	_ZN15AfStorageClientC1EP7QObject @ 29 NONAME
+	_ZN15AfStorageClientC2EP7QObject @ 30 NONAME
+	_ZN15AfStorageClientD0Ev @ 31 NONAME
+	_ZN15AfStorageClientD1Ev @ 32 NONAME
+	_ZN15AfStorageClientD2Ev @ 33 NONAME
+	_ZNK14AfStorageEntry10activityIdEv @ 34 NONAME
+	_ZNK14AfStorageEntry10publicDataEv @ 35 NONAME
+	_ZNK14AfStorageEntry11privateDataEv @ 36 NONAME
+	_ZNK14AfStorageEntry13applicationIdEv @ 37 NONAME
+	_ZNK14AfStorageEntry4dataEv @ 38 NONAME
+	_ZNK14AfStorageEntry5flagsEv @ 39 NONAME
+	_ZNK14AfStorageEntry8imageSrcEv @ 40 NONAME
+	_ZNK15AfStorageClient10metaObjectEv @ 41 NONAME
+	_ZTI15AfStorageClient @ 42 NONAME
+	_ZTV15AfStorageClient @ 43 NONAME
+	_ZThn8_N15AfStorageClient22asyncRequestCompleatedEii @ 44 NONAME
+	_ZThn8_N15AfStorageClient22asyncRequestCompleatedEiiRK7QPixmapPv @ 45 NONAME
+	_ZThn8_N15AfStorageClient22asyncRequestCompleatedEiiRK7QString @ 46 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/inc/afcmd.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#ifndef AFCMD_H
+#define AFCMD_H
+
+const TInt KRequestAppIdOffset(0);
+const TInt KRequestActOffset(1);
+const TInt KRequestData(2);
+const TInt KRequestIdOffset(0);
+
+const TInt KResponseDataSizeOffset(0);
+const TInt KResponseIdOffset(3);
+const TInt KResponseDataOffset(1);
+
+
+enum ActivityCmd {
+    AddActivity =0,
+    UpdateActivity,
+    RemoveActivity,
+    RemoveApplicationActivities,
+    Activities,
+    ApplicationActivities,
+    ApplicationActivity,
+    WaitActivity,
+    LaunchActivity,
+    GetThumbnail,
+    GetData,
+    NotifyChange,
+    CancelWait,
+    CancelNotify
+};
+
+#endif  //AFCMD_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/inc/afstorageglobals.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef AFSTORAGEGLOBALS_H
+#define AFSTORAGEGLOBALS_H
+#include <qvariant.h>
+#include <afcmd.h>
+/**
+ * Enumerate supported functions
+ */
+
+const char ActivityApplicationKeyword [] = ":ApplicationId";
+const char ActivityActivityKeyword [] = ":ActivityName";
+const char ActivityParametersKeyword [] = ":ActivityParams";
+const char ActivityPersistence [] = ":ActivityPersistence";
+const char ActivityVisibility [] = ":ActivityVisibility";
+const char ActivityScreenshotKeyword [] = "screenshot";
+const char ActivityDataKeyword [] = ":ActivityData";
+const char ActivityApplicationName[] = ":ApplicationName";
+
+#endif //AFSTORAGEGLOBALS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/s60/inc/afentry.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,133 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 AFENTRYDATA_H
+#define AFENTRYDATA_H
+
+#include <e32base.h>
+#include <s32strm.h>
+class RDbColWriteStream;
+class RDbColReadStream;
+const TInt KAfMask(0x0001);
+
+#ifdef AF_ADD_MASK
+#undef AF_ADD_MASK
+#endif
+#define AF_ADD_MASK(n) (KAfMask << n)
+
+class CAfEntry: public CBase
+{
+public:
+    enum AccessRights {
+    Private =0,
+    Public
+    };
+
+    enum Flags {
+    Invisible = KAfMask,
+    Persistent = 0x40000000,
+    };
+
+public:
+    static CAfEntry* NewL();
+
+    static CAfEntry* NewLC();
+
+    static CAfEntry* NewL(TInt flags,
+                          TInt applicationId,
+                          const TDesC &activityId,
+                          const TDesC &imgSrc,
+                          const TDesC8 &privateData,
+                          const TDesC8 &publicData);
+
+    static CAfEntry* NewLC(TInt flags,
+                           TInt applicationId,
+                           const TDesC &activityId,
+                           const TDesC &imgSrc,
+                           const TDesC8 &privateData,
+                           const TDesC8 &publicData);
+    
+    static CAfEntry* NewLC(const RMessage2& msg,
+                           int offset =0);
+
+    ~CAfEntry();
+
+    TInt Size() const;
+
+    TInt DataSize() const;
+
+    void ExternalizeL(RWriteStream &stream) const;
+
+    void InternalizeL(RReadStream &stream);
+
+    void ExternalizeDataOnlyL(RWriteStream &stream) const;
+
+    void InternalizeDataOnlyL(RReadStream &stream);
+
+    TInt Flags() const;
+
+    TInt ApplicationId() const;
+
+    const TDesC& ActivityId() const;
+
+    const TDesC& ImageSrc() const;
+
+    void SetImageSrcL(const TDesC& src);
+
+    const TDesC8& Data(CAfEntry::AccessRights rights) const;
+
+    void SetDataL(const TDesC8& src, CAfEntry::AccessRights rights);
+
+    static void ReallocL(RBuf8 &dst,TInt length);
+
+    static void ReallocL(RBuf &dst,TInt length);
+
+    static void CopyL(RBuf8 &dst,const TDesC8 &src);
+
+    static void CopyL(RBuf &dst,const TDesC &src);
+
+private:
+    CAfEntry();
+
+    void ConstructL(TInt flags,
+                    TInt applicationId,
+                    const TDesC &activityId,
+                    const TDesC &imgSrc,
+                    const TDesC8 &privateData,
+                    const TDesC8 &publicData);
+
+    static void InternalizeL(RBuf8 &dst, RReadStream &src);
+
+    static void InternalizeL(RBuf &dst, RReadStream &src);
+
+    static void ExternalizeL(RWriteStream &dst,const TDesC8 & src);
+
+    static void ExternalizeL(RWriteStream &dst,const TDesC& src);
+private:
+    TInt mFlags;
+    TInt mAppId;
+    RBuf mActivityId;
+    RBuf mImgSrc;
+    RBuf8 mPrivateData;
+    RBuf8 mPublicData;
+
+};
+
+RPointerArray<CAfEntry>& operator <<(RPointerArray<CAfEntry>& dst, const TDesC8 &src);
+
+RBuf8& operator << (RBuf8 &dst, const RPointerArray<CAfEntry>& src);
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/s60/inc/afglobals.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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 AFGLOBALS_H
+#define AFGLOBALS_H
+
+#include <e32base.h>
+const TUid KActivityServerUid = {0x200267B4};
+_LIT(KActivityServerName, "hsactivitydbserver");
+_LIT(KErr400, "Bad Reqest");
+_LIT(KErr403, "Access denied");
+
+#endif //AFGLOBALS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/s60/inc/afserializer.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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 HSSERIALIZER_H
+#define HSSERIALIZER_H
+
+#include <qvariant.h>
+
+/**
+ * Operator serialize VarinatHash to RBuf8
+ */
+RBuf8 &operator <<(RBuf8 &dst, const QVariantHash &src);
+
+/**
+ * Operator deserialize RBuf8 to VarinatHash
+ */
+QVariantHash &operator <<(QVariantHash &dst, const TDesC8 &src);
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/s60/src/afentry.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,461 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "afentry.h"
+#include <s32mem.h>
+
+// -----------------------------------------------------------------------------
+/**
+ * Two-phase constructor. Create and initialize instance
+ * @return entry instance
+ */
+CAfEntry* CAfEntry::NewL()
+{
+    CAfEntry *self = CAfEntry::NewLC();
+    CleanupStack::Pop(self);
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Two-phase constructor. Create, initialize and push instance into cleanup stack
+ * @return entry instance
+ */
+CAfEntry* CAfEntry::NewLC()
+{
+    CAfEntry *self = new (ELeave)CAfEntry();
+    CleanupStack::PushL(self);
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Two-phase constructor. Create and initialize instance
+ * @param flags - entry flags
+ * @param applicationId - application unique identifier
+ * @param activityId - activity unique identifier
+ * @param imgSrc - thumbanail source
+ * @param privateData - privated application data
+ * @param publicData - public activity data
+ * @return entry instance
+ */
+CAfEntry* CAfEntry::NewL(TInt flags,
+                         TInt applicationId,
+                         const TDesC &activityId,
+                         const TDesC &imgSrc,
+                         const TDesC8 &privateData,
+                         const TDesC8 &publicData)
+{
+    CAfEntry* self = CAfEntry::NewLC(flags, 
+                                     applicationId, 
+                                     activityId, 
+                                     imgSrc, 
+                                     privateData, 
+                                     publicData);
+    CleanupStack::Pop(self);
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Two-phase constructor. Create, initialize and push instance into cleanup stack
+ * @param flags - entry flags
+ * @param applicationId - application unique identifier
+ * @param activityId - activity unique identifier
+ * @param imgSrc - thumbanail source
+ * @param privateData - privated application data
+ * @param publicData - public activity data
+ * @return entry instance
+ */
+CAfEntry* CAfEntry::NewLC(TInt flags,
+                          TInt applicationId,
+                          const TDesC &activityId,
+                          const TDesC &imgSrc,
+                          const TDesC8 &privateData,
+                          const TDesC8 &publicData)
+{
+    CAfEntry *self = CAfEntry::NewLC();
+    self->ConstructL(flags, 
+                     applicationId, 
+                     activityId, 
+                     imgSrc, 
+                     privateData, 
+                     publicData);
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+CAfEntry* CAfEntry::NewLC(const RMessage2& msg, int offset)
+{
+    CAfEntry* self = CAfEntry::NewLC();
+    RBuf8 serializedEntry;
+    CleanupClosePushL(serializedEntry);
+    ReallocL(serializedEntry, msg.GetDesMaxLength(offset));
+    msg.ReadL(offset, serializedEntry);
+    RDesReadStream entryReader(serializedEntry);
+    CleanupClosePushL(entryReader);
+    entryReader >> (*self);
+    CleanupStack::PopAndDestroy(&entryReader);
+    CleanupStack::PopAndDestroy(&serializedEntry);
+    return self;
+}
+// -----------------------------------------------------------------------------
+/**
+ * First phase constructor
+ */
+CAfEntry::CAfEntry()
+{
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Second phase constructor. Initialize instance
+ * @param flags - entry flags
+ * @param applicationId - application unique identifier
+ * @param activityId - activity unique identifier
+ * @param imgSrc - thumbanail source
+ * @param privateData - privated application data
+ * @param publicData - public activity data 
+ */
+void CAfEntry::ConstructL(TInt flags,
+                          TInt applicationId,
+                          const TDesC &activityId,
+                          const TDesC &imgSrc,
+                          const TDesC8 &privateData,
+                          const TDesC8 &publicData)
+{
+    mFlags = flags;
+    mAppId = applicationId;
+    CopyL(mActivityId, activityId);
+    CopyL(mImgSrc, imgSrc);
+    CopyL(mPrivateData, privateData);
+    CopyL(mPublicData, publicData);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Destructor. Release allocated resources 
+ */
+CAfEntry::~CAfEntry()
+{
+    mActivityId.Close();
+    mPrivateData.Close();
+    mPublicData.Close();
+    mImgSrc.Close();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Provide size of serialized entry
+ * @return size of serialized entry instance
+ */
+TInt CAfEntry::Size() const
+{
+    return (sizeof(TInt) * 3) + //flags + appId + actId size info 
+           mActivityId.Size() + //actId content size
+           DataSize(); //data size
+           
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Provide size of serialized entry
+ * @return size of serialized entry instance
+ */
+TInt CAfEntry::DataSize() const
+{
+    return (sizeof(TInt) * 3) + //privData size info + pubData size info + imgSrc size info
+            mImgSrc.Size() + //imgSize content size
+            mPrivateData.Size() + //privData content size
+            mPublicData.Size(); //pubData content size 
+}
+// -----------------------------------------------------------------------------
+/**
+ * Serialize entry content into output stream.
+ * @param stream - output stream
+ */
+void CAfEntry::ExternalizeL(RWriteStream &stream) const
+{
+    stream.WriteInt32L(mFlags);
+    stream.WriteInt32L(mAppId);
+    ExternalizeL(stream, mActivityId);
+    ExternalizeDataOnlyL(stream);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Deserialize entry content from input stream
+ * @param stream - input stream
+ */
+void CAfEntry::InternalizeL(RReadStream &stream)
+{
+    mFlags = stream.ReadInt32L();
+    mAppId = stream.ReadInt32L();
+    InternalizeL(mActivityId, stream);
+    InternalizeDataOnlyL(stream);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Serialize entry content into output stream.
+ * @param stream - output stream
+ */
+void CAfEntry::ExternalizeDataOnlyL(RWriteStream &stream) const
+{
+    ExternalizeL(stream, mImgSrc);
+    ExternalizeL(stream, mPrivateData);
+    ExternalizeL(stream, mPublicData);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Deserialize entry content from input stream
+ * @param stream - input stream
+ */
+void CAfEntry::InternalizeDataOnlyL(RReadStream &stream)
+{
+    
+    InternalizeL(mImgSrc, stream);
+    InternalizeL(mPrivateData, stream);
+    InternalizeL(mPublicData, stream);
+    
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Provide access to activity flags
+ * @return activity flags 
+ */
+TInt CAfEntry::Flags() const
+{
+    return mFlags;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Provide access to activity identifier.
+ * @return activity identifier
+ */
+TInt CAfEntry::ApplicationId() const
+{
+    return mAppId;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Provide access to activity identifier.
+ * @return activity identifier
+ */
+const TDesC& CAfEntry::ActivityId() const
+{
+    return mActivityId;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Provide access to activity data.
+ * @param rights - type of requested data
+ * @return activity data
+ */
+const TDesC8& CAfEntry::Data(CAfEntry::AccessRights rights) const
+{
+    return Private == rights ? mPrivateData : mPublicData;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Provide access to activity data.
+ * @param rights - type of requested data
+ * @return activity data
+ */
+void CAfEntry::SetDataL(const TDesC8& src, CAfEntry::AccessRights rights)
+{
+    CopyL(Private == rights ? mPrivateData : mPublicData, src);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Provide access to activity thumbail path
+ * @return path to activity thumbnail 
+ */
+const TDesC& CAfEntry::ImageSrc() const
+{
+    return mImgSrc;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Set new value of image source
+ */
+void CAfEntry::SetImageSrcL(const TDesC& src)
+{
+    CopyL(mImgSrc, src);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Reallocate blob buffer to requested size
+ * @param dst - destination buffer
+ * @param length - requested length
+ */
+void CAfEntry::ReallocL(RBuf8 &dst,TInt length)
+{
+    if (0 < length) {
+        if (dst.MaxLength() < length) {
+            dst.ReAllocL(length);
+        }
+    } else {
+        dst.Close();
+    }
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Reallocate text buffer to requested size
+ * @param dst - destination buffer
+ * @param length - requested length
+ */
+void CAfEntry::ReallocL(RBuf &dst,TInt length)
+{
+    if (0 < length) {
+        if (dst.MaxLength() < length) {
+            dst.ReAllocL(length);
+        }
+    } else {
+        dst.Close();
+    }
+}
+// -----------------------------------------------------------------------------
+/**
+ * Copy blob content from input stream
+ * @param dst - destination buffer
+ * @param src - source buffer
+ */
+void CAfEntry::CopyL(RBuf8 &dst,const TDesC8 &src)
+{
+    ReallocL(dst, src.Length());
+    if(0 < src.Length()) {
+        dst.Copy(src);
+    }
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Copy text content from input buffer
+ * @param dst - destination buffer
+ * @param src - source buffer
+ */
+void CAfEntry::CopyL(RBuf &dst,const TDesC &src)
+{
+    ReallocL(dst, src.Length());
+    if(0 < src.Length()) {
+        dst.Copy(src);
+    }
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Deserialize blob content from input stream
+ * @param dst - destination buffer
+ * @param src - input stream
+ */
+void CAfEntry::InternalizeL(RBuf8 &dst, RReadStream &src)
+{
+    const TInt length(src.ReadInt32L());
+    ReallocL(dst, length);
+    if (0 < length) {
+        src.ReadL(dst, length);
+    }
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Deserialize text content from input stream
+ * @param dst - destination buffer
+ * @param src - input stream
+ */
+void CAfEntry::InternalizeL(RBuf &dst, RReadStream &src)
+{
+    const TInt length(src.ReadInt32L());
+    ReallocL(dst, length);
+    if (0 < length) {
+        src.ReadL(dst, length);
+    }
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Serialize blob content into output stream
+ * @param dst - destination stream
+ * @param src - input buffer
+ */
+void CAfEntry::ExternalizeL(RWriteStream &dst,const TDesC8 & src)
+{
+    dst.WriteInt32L(src.Length());
+    if (src.Length()) {
+        dst.WriteL(src, src.Length());
+    }
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Serialize text content into output stream
+ * @param dst - destination stream
+ * @param src - input buffer
+ */
+void CAfEntry::ExternalizeL(RWriteStream &dst,const TDesC& src)
+{
+    dst.WriteInt32L(src.Length());
+    if (src.Length()) {
+        dst.WriteL(src, src.Length());
+    }
+}
+
+// -----------------------------------------------------------------------------
+RPointerArray<CAfEntry>& operator <<(RPointerArray<CAfEntry>& dst, const TDesC8 &src)
+{
+    dst.ResetAndDestroy();
+    RDesReadStream srcStream(src);
+    CleanupClosePushL(srcStream);
+    int numOfItems(srcStream.ReadInt32L());
+    for (int i(0); i < numOfItems; ++i) {
+        CAfEntry *entry = CAfEntry::NewLC();
+        srcStream >> (*entry);
+        dst.AppendL(entry);
+        CleanupStack::Pop(entry);
+    }
+    CleanupStack::PopAndDestroy(&srcStream);
+    return dst;
+}
+
+// -----------------------------------------------------------------------------
+RBuf8& operator <<(RBuf8 &dst, const RPointerArray<CAfEntry>& src)
+{
+    int iter(0), 
+        requiredSize(sizeof(int));
+    for(iter =0; iter< src.Count(); ++iter) {
+        requiredSize += src[iter]->Size();
+    }
+    CAfEntry::ReallocL(dst, requiredSize);
+    RDesWriteStream dstStream(dst);
+    CleanupClosePushL(dstStream);
+    dstStream.WriteInt32L(src.Count());
+    for (iter =0; iter < src.Count(); ++iter) {
+        dstStream << *(src[iter]);
+    }
+    CleanupStack::PopAndDestroy(&dstStream);
+    return dst;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/s60/src/afserializer.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -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 <s32mem.h>
+#include "afserializer.h"
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+RBuf8 &operator <<(RBuf8 &dst, const QVariantHash &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;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+QVariantHash &operator <<(QVariantHash &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;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/group/bld.inf	Thu Jul 22 16:37:03 2010 +0100
@@ -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
+server.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/group/server.mmp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+TARGET          hsactivitydbserver.exe
+TARGETTYPE      exe
+UID             0 0x200267B4
+
+MW_LAYER_SYSTEMINCLUDE 
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../inc
+USERINCLUDE     ../../s60/inc
+USERINCLUDE     ../../../../inc
+
+SOURCEPATH      ../src
+SOURCE          main.cpp
+SOURCE          afserver.cpp
+SOURCE          afsession.cpp
+SOURCE          afstorage.cpp
+SOURCE          afdataprovidertask.cpp
+SOURCE          afbroadcasttask.cpp
+SOURCE          afstoragesynctask.cpp
+SOURCE          afstorageasynctask.cpp
+SOURCE          afobservertask.cpp
+SOURCE          afthumbnailtask.cpp
+
+SOURCEPATH      ../../s60/src
+SOURCE          afentry.cpp
+
+LIBRARY        euser.lib 
+LIBRARY        estor.lib
+LIBRARY        edbms.lib  
+LIBRARY        efsrv.lib
+LIBRARY        bafl.lib
+LIBRARY        fbscli.lib
+LIBRARY        hash.lib 
+LIBRARY        bitmaptransforms.lib
+LIBRARY        imageconversion.lib
+LIBRARY        tsutils.lib
+
+CAPABILITY     ALL -TCB
+EPOCHEAPSIZE   0x100000 0x600000 // 1MB - 6MB
+
+#ifdef ENABLE_ABIV2_MODE
+DEBUGGABLE_UDEBONLY
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/inc/afbroadcasttask.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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 AFBROADCASTTASK_H
+#define AFBROADCASTTASK_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+#include "aftaskstorage.h"
+#include "aftask.h"
+
+class AfBroadcastTask
+{
+public:
+    static void ExecuteL(MAfTaskStorage& storage, const RMessage2& msg);
+};
+
+#endif // AFBROADCASTTASK_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/inc/afdataprovidertask.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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 AFDATAPROVIDERTASK_H
+#define AFDATAPROVIDERTASK_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+#include "aftaskstorage.h"
+#include "aftask.h"
+
+class AfDataProviderTask
+{
+public:
+    static void ExecuteL(MAfTaskStorage& storage, const RMessage2& msg);
+
+private:
+    static void ProvideDataL(const RMessage2& msg, const CAfTask& src);
+
+};
+
+#endif // AFDATAPROVIDERTASK_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/inc/afobservertask.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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 AFOBSERVERTASK_H
+#define AFOBSERVERTASK_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+#include "aftask.h"
+#include "aftaskstorage.h"
+
+class CAfObserverTask : public CAfTask
+{
+public:
+    ~CAfObserverTask();
+
+    static void ExecuteLD(MAfTaskStorage& globalStorage, 
+                          MAfTaskStorage& localStorage,
+                          const RMessage2& msg);
+
+    const TDesC8& Data() const;
+
+    void BroadcastReceivedL(const RMessage2& );
+
+private:
+    CAfObserverTask(MAfTaskStorage& globalStorage, 
+                    MAfTaskStorage& localStorage,
+                    const RMessage2& msg);
+
+    void WriteResponseL();
+
+    TBool IsSessionTask(const CSession2* session);
+
+private:
+    MAfTaskStorage& mGlobalStorage;
+    MAfTaskStorage& mLocalStorage;
+    const RMessage2 mMsg;
+    RBuf8 mData;
+};
+
+#endif // AFOBSERVERTASK_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/inc/afqueries.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef AFQUERIES_H
+#define AFQUERIES_H
+
+
+#include <e32base.h>
+
+_LIT( KSelectRow, "SELECT * FROM Activities WHERE ApplicationId=%S AND ActivityName='%S'");
+_LIT( KSelectRows, "SELECT * FROM Activities");
+_LIT( KSelectAppRows, "SELECT * FROM Activities WHERE ApplicationId=%S");
+_LIT( KDeleteRow, "DELETE FROM Activities WHERE ApplicationId=%S AND ActivityName='%S'");
+_LIT( KDeleteRows, "DELETE FROM Activities WHERE ApplicationId=%S");
+_LIT( KDeleteNonPersistentActivities, "DELETE FROM Activities WHERE Flags<%S");
+
+_LIT(KApplicationColumnName, "ApplicationId");
+_LIT(KActivityColumnName, "ActivityName");
+_LIT(KFlagsColumnName, "Flags");
+_LIT(KDataColumnName, "Data");
+
+_LIT(KActivityTableName, "Activities");
+_LIT(KActivityIndexName, "ActivitiesKey");
+#endif  // AFQUERIES_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/inc/afserver.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef AFSERVER_H
+#define AFSERVER_H
+
+#define __E32SVR_H__
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <f32file.h>    // RFs
+
+#include "aftaskstorage.h"
+
+class CAfStorage;
+
+class CAfServer : public CServer2,
+                  public MAfTaskStorage
+{
+public:
+    ~CAfServer();
+
+    static CAfServer* NewLC();
+
+public:
+    void PushL(CAfTask *);
+    
+    void Pop(CAfTask *);
+    
+    const RPointerArray<CAfTask>& StorageData() const;
+    
+
+private:
+    CAfServer();
+
+    void ConstructL();
+
+    CSession2* NewSessionL(const TVersion& version, const RMessage2& message) const;
+
+    void RemoveNotValidTasks(const CSession2* session);
+
+private:
+    RFs mFsSession;
+    CAfStorage* mStorage;
+    RPointerArray<CAfTask> mObservers;
+};
+
+#endif // AFSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/inc/afsession.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 AFSESSION_H
+#define AFSESSION_H
+
+#ifndef __E32SVR_H__
+#define __E32SVR_H__
+#endif 
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <f32file.h>
+
+#include "aftaskstorage.h"
+
+class CAfStorage;
+
+class CAfSession : public CSession2,
+                   public MAfTaskStorage
+{
+public:
+    ~CAfSession();
+
+    static CAfSession* NewL(RFs& fileSession,
+                            MAfTaskStorage& taskStorage, 
+                            CAfStorage&storage);
+
+public:
+    void PushL(CAfTask *);
+
+    void Pop(CAfTask *);
+
+    const RPointerArray<CAfTask>& StorageData() const;
+
+    void RemoveNotValidTasks(const CSession2* session);
+
+private:
+    CAfSession(RFs& fileSession,
+               MAfTaskStorage& taskStorage, 
+               CAfStorage& storage);
+
+    void ConstructL();
+
+private:
+    void ServiceL(const RMessage2& message);
+
+private:
+    RFs& mFileSession; 
+    MAfTaskStorage& mTasksStorage;
+    CAfStorage& mStorage;
+    RPointerArray<CAfTask> mRunningTasks;
+};
+
+#endif // AFSESSION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/inc/afstorage.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,116 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef AFSTORAGE_H
+#define AFSTORAGE_H
+
+#define __E32SVR_H__
+
+#include <e32std.h>
+#include <e32base.h>
+#include <d32dbms.h>    // RDbStoreDatabase
+#include <s32file.h>    // CFileStore & CPermanentFileStore
+#include "afentry.h"
+
+class CAfStorage : public CBase
+    {
+public:
+    ~CAfStorage();
+
+    static CAfStorage* NewL(RFs& session);
+
+    void AddActivityL(CAfEntry &entry);
+    
+    void UpdateActivityL(CAfEntry &entry);
+
+    void DeleteActivityL(CAfEntry &entry);
+
+    void DeleteActivitiesL(CAfEntry &entry);
+
+    void ActivitiesL(RPointerArray<CAfEntry> &dst);
+
+    void ActivitiesL(RPointerArray<CAfEntry> &dst, TInt appId);
+    
+    void ActivityL(RPointerArray<CAfEntry> &dst, CAfEntry &src);
+
+    RFs& Fs();
+
+    static void ThumbnailPathL(RBuf &dst, 
+                               RFs& fileSystem, 
+                               TInt uid, 
+                               const TDesC &activityName,
+                               TBool persistent);
+
+    static void StoragePathL(RBuf &dst, 
+                             RFs& fileSystem, 
+                             TBool persistent);
+    static void AppStoragePathL(RBuf &dst, 
+                                RFs& fileSystem,
+                                TInt uid,
+                                TBool persistent);
+private:
+    static HBufC8* Md5HexDigestL(const TDesC8 &string);
+    
+private:
+    CAfStorage(RFs& session);
+
+    void ConstructL();
+
+    void CreateDbL(const TDesC& databaseFile);
+
+    void OpenDbL(const TDesC& databaseFile);
+
+    void CreateTableL();
+
+    void DeleteNonPersistentActivitiesL();
+
+    void GetActivitiesL(const TDesC& dst);
+
+    HBufC* SelectRowLC(TInt appId, const TDesC& actId) const;
+
+    HBufC* SelectRowsLC(TInt appId) const;
+
+    HBufC* DeleteRowLC(TInt appId, const TDesC& actId) const;
+    
+    HBufC* DeleteRowsLC(TInt appId) const;
+
+    HBufC* BuildQueryLC(const TDesC& format, TInt appId, const TDesC& actId) const;
+    
+    void ActivitiesL(RPointerArray<CAfEntry>& dst, 
+                     const TDesC& query, 
+                     CAfEntry::AccessRights rights,
+                     TInt limit = 0);
+
+    void ActivitiesL(RPointerArray<CAfEntry>& dst, 
+                     RDbView& query, 
+                     CAfEntry::AccessRights rights,
+                     TInt limit = 0);
+
+    void GetActivityForUpdateL(RDbView& query, TInt appId, const TDesC& actId);
+
+    void ReadDataL(RBuf& dst, RDbRowSet& src, TInt offset) const;
+
+    void ExternalizeDataL(RDbRowSet &dst,const CAfEntry & src, TInt offset) const;
+
+    void InternalizeDataL(CAfEntry &dst, RDbRowSet& src, TInt offset) const;
+
+private:
+    RFs& mFsSession;
+    RDbStoreDatabase mActDb;/* For database operations                 */
+    CFileStore* mFileStore;  /* For creating and opening database files */
+};
+
+#endif //AFSTORAGE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/inc/afstorageasynctask.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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:
+*
+*/
+#ifndef AFSTORAGEASYNCTASK_H
+#define AFSTORAGEASYNCTASK_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+#include "aftask.h"
+#include "aftaskstorage.h"
+#include "afstorage.h"
+
+class CAfStorageAsyncTask : public CAfTask
+{
+public:
+    ~CAfStorageAsyncTask();
+
+    static void ExecuteLD(MAfTaskStorage& taskStorage, 
+                          CAfStorage& dataStorage, 
+                          const RMessage2& msg);
+
+    const TDesC8& Data() const;
+
+    void BroadcastReceivedL(const RMessage2 &);
+
+private:
+    CAfStorageAsyncTask();
+
+    void ExecuteL(CAfStorage& dataStorage, const RMessage2& msg);
+
+    void AllActivitiesL(CAfStorage& dataStorage, const RMessage2& msg);
+
+    void ApplicationActivitiesL(CAfStorage& dataStorage, const RMessage2& msg);
+
+    void ApplicationActivityL(CAfStorage& dataStorage, const RMessage2& msg);
+
+    void WriteResponseL(const RMessage2& msg);
+
+    TBool IsSessionTask(const CSession2* session);
+
+    void ExternalizeL();
+
+private:
+    RBuf8 mExternalizedData;
+    RPointerArray<CAfEntry> mInternalizedData;
+};
+
+#endif // AFSTORAGEASYNCTASK_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/inc/afstoragesynctask.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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:
+*
+*/
+#ifndef AFSTORAGESYNCTASK_H
+#define AFSTORAGESYNCTASK_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+#include "aftask.h"
+#include "afstorage.h"
+#include "aftaskstorage.h"
+
+class CAfEntry;
+/**
+ *  CActivityStorageSyncTask
+ * 
+ */
+class AfStorageSyncTask
+    {
+public:
+    static void ExecuteL(MAfTaskStorage& observers,
+                         CAfStorage& dataStorage, 
+                         const RMessage2& msg);
+
+private:
+    static void AddActivityL(CAfStorage& dataStorage, 
+                             const RMessage2& msg);
+
+    static void UpdateActivityL(CAfStorage& dataStorage, 
+                                const RMessage2& msg);
+
+    static void DeleteActivityL(CAfStorage& dataStorage, 
+                                const RMessage2& msg);
+
+    static void DeleteApplicationActivitiesL(CAfStorage& dataStorage, 
+                                             const RMessage2& msg);
+
+    static void NotifyChangeL(MAfTaskStorage& observers,
+                              const RMessage2& msg);
+
+    static void CreateThumbnailL(const TDesC &path, TInt hdl);
+                                
+    static void DeleteActivityScreenshotL(CAfStorage& dataStorage,
+                                TInt uid,
+                                const TDesC &activityName);
+    };
+
+#endif // AFSTORAGESYNCTASK_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/inc/aftask.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef AFTASK_H
+#define AFTASK_H
+
+#include <e32base.h>
+
+class CAfTask: public CBase
+{
+public:
+    /**
+     * Return task data 
+     */
+    virtual const TDesC8& Data() const =0;
+    
+    /**
+     * Notify instance about incoming broadcast message.
+     * @param msg - broadcast message
+     */
+    virtual void BroadcastReceivedL(const RMessage2& msg) =0;
+    
+    /**
+     * Returns ETrue if task is related with session argument
+     */
+    virtual TBool IsSessionTask(const CSession2* session) =0;
+};
+
+#endif  //AFTASK_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/inc/aftaskstorage.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef AFTASKSTORAGE_H
+#define AFTASKSTORAGE_H
+#include <e32base.h>
+class CAfTask;
+class MAfTaskStorage
+{
+public:
+    /**
+     * Register new task instance in storage. Ownership is transfered to storage.
+     * @param task - instance that need to be registered
+     */
+    virtual void PushL(CAfTask * task)=0;
+    
+    /**
+     * Unregister task instance from storage. Ownership is transfered to caller.
+     * @param task - instance that need to be unregistered
+     */
+    virtual void Pop(CAfTask *)=0;
+    
+    /**
+     * List of registered tasks
+     */
+    virtual const RPointerArray<CAfTask>& StorageData() const =0;
+
+    /**
+     * Removes not valid task
+     */
+    virtual void RemoveNotValidTasks(const CSession2* session) =0;
+};
+
+#endif  //AFTASKSTORAGE_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/inc/afthumbnailtask.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef AFTHUMBNAILTASK_H
+#define AFTHUMBNAILTASK_H
+
+#ifndef __E32SVR_H__
+#define __E32SVR_H__
+#endif
+
+#include <e32std.h>
+#include <e32base.h>
+#include <f32file.h>
+
+#include "aftask.h"
+#include "aftaskstorage.h"
+#include "tsgraphicfilescalinghandler.h"
+
+class CFbsBitmap;
+
+class CAfThumbnailTask : public CAfTask,
+                         public MImageReadyCallBack
+{
+public:
+    ~CAfThumbnailTask();
+
+    static void ExecuteLD(MAfTaskStorage& taskStorage,
+                          const RMessage2& message);
+
+private:
+    CAfThumbnailTask(MAfTaskStorage& storage, const RMessage2 msg);
+
+    void ConstructL();
+
+    void ImageReadyCallBack(TInt error, const CFbsBitmap *bitmap );
+
+    const TDesC8& Data()const;
+
+    void BroadcastReceivedL(const RMessage2& );
+
+    TBool IsSessionTask(const CSession2* session);
+
+private:
+    MAfTaskStorage& mStorage; 
+    const RMessage2 mMsg;
+    CBase* mService;
+};
+
+#endif // AFTHUMBNAILTASK_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/server.pro	Thu Jul 22 16:37:03 2010 +0100
@@ -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/activityfw/storage/server/src/afbroadcasttask.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "afbroadcasttask.h"
+
+// -----------------------------------------------------------------------------
+/**
+ * Handle broadccast message request
+ * @param storage - observer tasks storage
+ * @param msg - request message that will be provided to observers
+ */
+void AfBroadcastTask::ExecuteL(MAfTaskStorage& storage, 
+                               const RMessage2& msg)
+{
+    const RPointerArray<CAfTask> &tasks(storage.StorageData());
+    for (TInt iter(tasks.Count() - 1); iter >= 0 ; --iter ) {
+        if(EFalse == msg.IsNull()) {
+            (tasks[iter])->BroadcastReceivedL(msg);
+        }
+    }
+    if(EFalse == msg.IsNull()) {
+        msg.Complete(KErrNone);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/src/afdataprovidertask.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "afdataprovidertask.h"
+#include "afcmd.h"
+
+// -----------------------------------------------------------------------------
+/**
+ * Handle data request. Deliver data stored in other task.
+ * @param storage - data tasks storage
+ * @param msg - request message
+ */
+void AfDataProviderTask::ExecuteL(MAfTaskStorage& storage, 
+                                  const RMessage2& msg)
+{
+    TPckgBuf<void*> requestId;
+    CAfTask* taskPtr(0);
+    msg.Read(KRequestIdOffset, requestId);
+    
+    for (TInt iter(0);iter <storage.StorageData().Count();++iter) {
+        taskPtr = storage.StorageData()[iter];
+        if (taskPtr == requestId()) {//compare requested task address with storage objects
+            ProvideDataL(msg, *taskPtr);
+            storage.Pop(taskPtr);
+            delete taskPtr;
+            return;
+        }
+    }
+    User::Leave(KErrNotFound);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Write response data to request message
+ * @param msg - destination message
+ * @param src - data source
+ */
+void AfDataProviderTask::ProvideDataL(const RMessage2& msg, 
+                                      const CAfTask& src)
+{
+    if (EFalse ==msg.IsNull()) {
+        msg.WriteL(KResponseDataOffset, src.Data());
+        msg.Complete(KErrNone);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/src/afobservertask.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,144 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "afobservertask.h"
+#include "afcmd.h"
+#include "afentry.h"
+// -----------------------------------------------------------------------------
+/**
+ * Constructor for performing 1st stage construction
+ * @param globalStorage - global observers storage
+ * @param localStorage - local observers storage
+ * @param msg - request message
+ */
+CAfObserverTask::CAfObserverTask(MAfTaskStorage& globalStorage, 
+                                 MAfTaskStorage& localStorage, 
+                                 const RMessage2& msg)
+:
+    mGlobalStorage(globalStorage),
+    mLocalStorage(localStorage),
+    mMsg(msg)
+{
+    // No implementation required
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Destructor.
+ */
+CAfObserverTask::~CAfObserverTask()
+{
+    mData.Close();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Handle observer request. 
+ * @param globalStorage - global observers storage
+ * @param localStorage - local observers storage
+ * @param msg - request message
+ */
+
+void CAfObserverTask::ExecuteLD(MAfTaskStorage& globalStorage, 
+                                MAfTaskStorage& localStorage, 
+                                const RMessage2& msg)
+{
+    CAfObserverTask *self = new(ELeave)CAfObserverTask(globalStorage, 
+                                                       localStorage, 
+                                                       msg);
+    CleanupStack::PushL(self);
+    globalStorage.PushL(self);
+    CleanupStack::Pop(self);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see CActivityTask::Data()
+ */
+const TDesC8& CAfObserverTask::Data() const
+{
+    return mData;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see CActivityTask::BroadcastReceivedL(const RMessage2&)
+ */
+void CAfObserverTask::BroadcastReceivedL(const RMessage2& msg)
+{
+    if(EFalse != mMsg.IsNull()) {
+        mGlobalStorage.Pop(this);//
+        mLocalStorage.Pop(this);
+        delete this;
+    } else if (WaitActivity == mMsg.Function() &&
+               LaunchActivity == msg.Function()) {
+               
+        CAfEntry* entry = CAfEntry::NewLC(msg);
+        TPckgBuf<TInt> observerdId;
+        mMsg.ReadL(KRequestAppIdOffset, observerdId);
+        if (observerdId() == entry->ApplicationId()) {
+            CAfEntry::ReallocL(mData, entry->ActivityId().Length());
+            mData.Copy(entry->ActivityId());
+            WriteResponseL();
+            mLocalStorage.PushL(this);
+            mGlobalStorage.Pop(this);
+            mMsg.Complete(KErrNone);
+        }
+        CleanupStack::PopAndDestroy(entry);
+        
+    } else if (WaitActivity == mMsg.Function() &&
+               CancelWait == msg.Function() &&
+               mMsg.Session() == msg.Session()) {
+        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;
+    }
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Write response data to requested message 
+ */
+void CAfObserverTask::WriteResponseL()
+{
+    mMsg.WriteL(KResponseDataSizeOffset, TPckgBuf<TInt>(mData.Length()));//write data size
+    mMsg.WriteL(KResponseIdOffset, TPckgBuf<CBase*>(this));//task identyfier
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Returns ETrue if task is related with session argument
+ */
+TBool CAfObserverTask::IsSessionTask(const CSession2* session)
+{
+    return mMsg.Session() == session ? ETrue : EFalse;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/src/afserver.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,134 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include <fbs.h>
+
+#include "afserver.h"
+#include "afsession.h"
+#include "afstorage.h"
+#include "aftask.h"
+
+_LIT( KActivityServerName, "hsactivitydbserver" );
+_LIT(KObserverAlreadyExists, "Observer task exists");
+
+// -----------------------------------------------------------------------------
+/**
+ * Constructor for performing 1st stage construction
+ */
+CAfServer::CAfServer()
+:
+CServer2( EPriorityStandard )
+{
+    // No implementation required
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Destructor.
+ */
+CAfServer::~CAfServer()
+{
+    delete mStorage;
+    mFsSession.Close();
+    mObservers.ResetAndDestroy();
+    RFbsSession::Disconnect();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Two-phased constructor.
+ */
+CAfServer* CAfServer::NewLC()
+{
+    CAfServer* self = new (ELeave) CAfServer();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Default constructor for performing 2nd stage construction
+ */
+void CAfServer::ConstructL()
+{
+    StartL(KActivityServerName);
+    User::LeaveIfError(mFsSession.Connect());
+    User::LeaveIfError(RFbsSession::Connect(mFsSession));
+    mStorage = CAfStorage::NewL(mFsSession);
+    mObservers.Array();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see CServer2::NewSessionL(const TVersion&, const RMessage2&)
+ */
+CSession2* CAfServer::NewSessionL(const TVersion &, const RMessage2&) const
+{
+    return CAfSession::NewL(const_cast<CAfServer*>(this)->mFsSession, 
+                            *const_cast<CAfServer*>(this), 
+                            *mStorage);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see MAfTaskStorage::PushL(CAfTask *)
+ */
+void CAfServer::PushL(CAfTask * task)
+{
+    (KErrNotFound == mObservers.Find(task)) ?
+     mObservers.AppendL(task) :
+     User::Panic(KObserverAlreadyExists, KErrAlreadyExists);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see MAfTaskStorage::Pop(CActivityTask *)
+ */
+void CAfServer::Pop(CAfTask *task)
+{
+    const TInt offset(mObservers.Find(task));
+    if (KErrNotFound != offset) {
+        mObservers.Remove(offset);
+    }
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see MAfTaskStorage::StorageData()
+ */
+const RPointerArray<CAfTask>& CAfServer::StorageData() const
+{
+    return mObservers;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Removes not valid task
+ */
+void CAfServer::RemoveNotValidTasks(const CSession2* session)
+{
+    for (TInt i=mObservers.Count()-1; i>=0; --i) {
+        if( mObservers[i]->IsSessionTask(session) ) {
+            delete mObservers[i];
+            mObservers.Remove(i);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/src/afsession.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,177 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "afsession.h"
+#include "aftask.h"
+#include "afcmd.h"
+
+#include "afstorageasynctask.h"
+#include "afstoragesynctask.h"
+#include "afobservertask.h"
+#include "afbroadcasttask.h"
+#include "afdataprovidertask.h"
+#include "afthumbnailtask.h"
+
+_LIT(KTaskAlreadyExists, "Activity task exists");
+
+// -----------------------------------------------------------------------------
+/**
+ * Constructor for performing 1st stage construction
+ * @param fileSession - initialized file system session
+ * @param taskStorage - global observers storage
+ * @param storage - data storage
+ */
+
+CAfSession::CAfSession(RFs& fileSession, 
+                       MAfTaskStorage& taskStorage, 
+                       CAfStorage& storage)
+:
+mFileSession(fileSession),
+mTasksStorage(taskStorage),
+mStorage(storage)
+{
+    // No implementation required
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Destructor.
+ */
+CAfSession::~CAfSession()
+{
+    RemoveNotValidTasks(this);
+    mTasksStorage.RemoveNotValidTasks(this);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Two-phased constructor.
+ * @param fileSession - initialized file system session
+ * @param taskStorage - global observers storage
+ * @param storage - data storage
+ */
+CAfSession* CAfSession::NewL(RFs& fileSession,
+                             MAfTaskStorage& taskStorage,
+                             CAfStorage& storage)
+{
+    CAfSession* self = new (ELeave) CAfSession(fileSession, 
+                                               taskStorage, 
+                                               storage);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * EPOC default constructor for performing 2nd stage construction
+ */
+void CAfSession::ConstructL()
+{
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Implements interface
+ * @see void CSession2::ServiceL(const RMessage2&)
+ */
+void CAfSession::ServiceL(const RMessage2& message)
+{
+    switch (message.Function()) {
+    case AddActivity:
+    case UpdateActivity:
+    case RemoveActivity:
+    case RemoveApplicationActivities:
+        AfStorageSyncTask::ExecuteL(mTasksStorage, mStorage, message);
+        break;
+    
+    case ApplicationActivity:
+    case Activities:
+    case ApplicationActivities:
+        CAfStorageAsyncTask::ExecuteLD(*this, mStorage, message);
+        break;
+    
+    case WaitActivity:
+    case NotifyChange:
+        CAfObserverTask::ExecuteLD(mTasksStorage, *this, message);
+        break;
+    
+    case GetThumbnail:
+        CAfThumbnailTask::ExecuteLD(*this, message);
+        break;
+    
+    case LaunchActivity:
+    case CancelWait:
+    case CancelNotify:
+        AfBroadcastTask::ExecuteL(mTasksStorage, message);
+        break;
+    
+    case GetData:
+        AfDataProviderTask::ExecuteL(*this,message);
+        break;
+    
+    default:
+        message.Complete(CServer2::EBadMessageNumber);
+        break;
+    }
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see MAfTaskStorage::PushL(CAfTask *)
+ */
+void CAfSession::PushL(CAfTask * task)
+{
+    (KErrNotFound == mRunningTasks.Find(task)) ?
+     mRunningTasks.AppendL(task) :
+     User::Panic(KTaskAlreadyExists, KErrAlreadyExists);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see MAfTaskStorage::Pop(CAfTask *)
+ */
+void CAfSession::Pop(CAfTask *task)
+{
+    const TInt offset(mRunningTasks.Find(task));
+    if (KErrNotFound != offset) {
+        mRunningTasks.Remove(offset);
+    }
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see MAfTaskStorage::StorageData()
+ */
+const RPointerArray<CAfTask>& CAfSession::StorageData() const
+{
+    return mRunningTasks;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Removes not valid task
+ */
+void CAfSession::RemoveNotValidTasks(const CSession2* session)
+{
+    if (session == this) {
+        mRunningTasks.ResetAndDestroy();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/src/afstorage.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,611 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "afstorage.h"
+#include <bautils.h>
+#include <hash.h>
+#include <s32mem.h>
+
+#include "afqueries.h"
+#include "afentry.h"
+
+_LIT(KDbName, "activity.db");
+_LIT(KDbDrive, "c:");
+const TInt KMaxPathLength = 256;
+
+_LIT(KNonPersistent, "non_persistent\\");
+_LIT(KPersistent, "persistent\\");
+_LIT(KUidFormat, "%+08x\\");
+_LIT(KExtFormat, ".mbm");
+
+// -----------------------------------------------------------------------------
+/**
+ * Constructor for performing 1st stage construction
+ * @param session - initialized session to file system
+ */
+CAfStorage::CAfStorage(RFs& session)
+:
+mFsSession(session)
+{
+    // No implementation required
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Destructor.
+ */
+CAfStorage::~CAfStorage()
+{
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Two-phased constructor.
+ * @param session - initialized session to file system
+ */
+CAfStorage* CAfStorage::NewL(RFs& session)
+{
+    CAfStorage* self = new (ELeave) CAfStorage(session);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(); // self;
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * EPOC default constructor for performing 2nd stage construction
+ */
+void CAfStorage::ConstructL()
+{
+    RBuf path;
+    CleanupClosePushL( path );
+    path.CreateL(KMaxPathLength);
+    User::LeaveIfError(mFsSession.PrivatePath(path ));
+    path.Append(KDbName);
+    path.Insert(0, KDbDrive);
+    BaflUtils::EnsurePathExistsL(mFsSession, path);
+    BaflUtils::FileExists(mFsSession, path) ? OpenDbL(path) : CreateDbL(path);
+    CleanupStack::PopAndDestroy(&path);
+
+    DeleteNonPersistentActivitiesL();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Create database and its structure
+ * @param databaseFile - database file path
+ */
+void CAfStorage::CreateDbL(const TDesC& databaseFile)
+{
+    mFileStore = CPermanentFileStore::ReplaceL(mFsSession,
+                                               databaseFile,
+                                               EFileRead|EFileWrite);
+    mFileStore->SetTypeL(mFileStore->Layout());// Set file store type
+    TStreamId id = mActDb.CreateL(mFileStore);// Create stream object
+    mFileStore->SetRootL(id);// Keep database id as root of store
+    mFileStore->CommitL();// Complete creation by commiting
+    CreateTableL();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Open database
+ * @param databaseFile - database file path
+ */
+void CAfStorage::OpenDbL(const TDesC& databaseFile)
+{
+    mFileStore = CPermanentFileStore::OpenL(mFsSession,
+                                            databaseFile,
+                                            EFileRead|EFileWrite);
+    mFileStore->SetTypeL(mFileStore->Layout()); /* Set file store type*/
+    mActDb.OpenL(mFileStore,mFileStore->Root());
+    CDbTableNames* tables = mActDb.TableNamesL();
+    CleanupStack::PushL(tables);
+    if (0 == tables->Count()) {
+        CreateTableL();
+    }
+    CleanupStack::PopAndDestroy(tables);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Create database structure
+ */
+void CAfStorage::CreateTableL()
+{
+    // Add the columns to column set
+    CDbColSet* actColSet = CDbColSet::NewLC();
+
+    TDbCol appName(KApplicationColumnName, EDbColInt64);
+    appName.iAttributes = TDbCol::ENotNull;
+    actColSet->AddL(appName);
+
+    TDbCol actName(KActivityColumnName, EDbColText16);// Using default length
+    actName.iAttributes = TDbCol::ENotNull;
+    actColSet->AddL(actName);
+
+    TDbCol actFlags(KFlagsColumnName, EDbColInt32);
+    actFlags.iAttributes = TDbCol::ENotNull;
+    actColSet->AddL(actFlags);
+
+    actColSet->AddL(TDbCol(KDataColumnName, EDbColLongBinary));// Stream Data
+
+    // Create the table
+    User::LeaveIfError(mActDb.CreateTable(KActivityTableName,
+                                         *actColSet));
+
+    CleanupStack::PopAndDestroy(actColSet);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Delete non-persistent activities
+ */
+void CAfStorage::DeleteNonPersistentActivitiesL()
+{
+    HBufC *query(BuildQueryLC(KDeleteNonPersistentActivities(), CAfEntry::Persistent, KNullDesC));
+    User::LeaveIfError(mActDb.Execute(*query));
+    RBuf privatePath;
+    CleanupClosePushL(privatePath);
+    privatePath.CreateL(KMaxPathLength);
+    StoragePathL(privatePath, Fs(), FALSE);
+    CFileMan *fileMan = CFileMan::NewL(Fs());
+    TInt i = fileMan->RmDir(privatePath);
+    delete fileMan;
+    CleanupStack::PopAndDestroy(&privatePath);
+    CleanupStack::PopAndDestroy(query);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Register new activity
+ * @param appId - application id
+ * @param actId - activity id
+ * @param flags - activity flags
+ * @param imgSrc - activity thumbnail source
+ * @param privateData - activity private data
+ * @param publicData - activity public data
+ */
+void CAfStorage::AddActivityL(CAfEntry& entry)
+{
+    //verify if row already exists
+    TInt errNo(KErrNone);
+    RDbView view;
+    CleanupClosePushL(view);
+    TRAP( errNo, GetActivityForUpdateL(view, entry.ApplicationId(), entry.ActivityId()));
+    if (KErrNone == errNo) {
+        User::Leave(KErrAlreadyExists);
+    }
+    CleanupStack::PopAndDestroy(&view);
+
+    //write table
+    RDbTable table;
+    CleanupClosePushL(table);
+    User::LeaveIfError(table.Open(mActDb, KActivityTableName, table.EUpdatable));
+    CDbColSet *row = table.ColSetL();
+    CleanupStack::PushL(row);
+
+    table.InsertL();
+    TRAP(errNo,
+    table.SetColL(row->ColNo(KApplicationColumnName), TInt64(entry.ApplicationId()));
+    table.SetColL(row->ColNo(KActivityColumnName), entry.ActivityId());
+    table.SetColL(row->ColNo(KFlagsColumnName), entry.Flags());
+    ExternalizeDataL(table, entry, row->ColNo(KDataColumnName));
+    table.PutL();)
+    if (KErrNone != errNo) {
+        table.Cancel();
+        User::Leave(errNo);
+    }
+    CleanupStack::PopAndDestroy(row);
+    CleanupStack::PopAndDestroy(&table);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Update activity
+ * @param entry - activity data
+ */
+void CAfStorage::UpdateActivityL(CAfEntry& entry)
+{
+    RDbView view;
+    CleanupClosePushL(view);
+    GetActivityForUpdateL(view, entry.ApplicationId(), entry.ActivityId());
+    view.UpdateL();
+    TRAPD(errNo,
+    CDbColSet* colSet = view.ColSetL();
+    CleanupStack::PushL(colSet);
+
+    view.SetColL(colSet->ColNo(KFlagsColumnName), entry.Flags());
+    ExternalizeDataL(view, entry, colSet->ColNo(KDataColumnName));
+
+    view.PutL();
+    if (KErrNone != errNo) {
+        view.Cancel();
+        User::Leave(errNo);
+    }
+    CleanupStack::PopAndDestroy(colSet);)
+
+    if (KErrNone != errNo) {
+        view.Cancel();
+        User::Leave(errNo);
+    }
+    CleanupStack::PopAndDestroy(&view);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Delete activity
+ * @param appId - application id
+ * @param actId - activity id
+ */
+void CAfStorage::DeleteActivityL(CAfEntry& entry)
+{
+    HBufC *query(DeleteRowLC(entry.ApplicationId(), entry.ActivityId()));
+    User::LeaveIfError(mActDb.Execute(*query));
+    CleanupStack::PopAndDestroy(query);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CAfStorage::DeleteActivitiesL(CAfEntry& entry)
+{
+    HBufC *query(DeleteRowsLC(entry.ApplicationId()));
+    User::LeaveIfError(mActDb.Execute(*query));
+    RBuf privatePath;
+    CleanupClosePushL(privatePath);
+    privatePath.CreateL(KMaxPathLength);
+    AppStoragePathL(privatePath, Fs(), entry.ApplicationId(), FALSE);
+    CFileMan *fileMan = CFileMan::NewL(Fs());
+    CleanupStack::PushL(fileMan);
+    fileMan->RmDir(privatePath);
+    privatePath.Zero();
+    
+    AppStoragePathL(privatePath, Fs(), entry.ApplicationId(), TRUE);
+    fileMan->RmDir(privatePath);
+    
+    CleanupStack::PopAndDestroy(fileMan);
+    CleanupStack::PopAndDestroy(&privatePath);
+    CleanupStack::PopAndDestroy(query);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CAfStorage::ActivitiesL(RPointerArray<CAfEntry>& dst)
+{
+    ActivitiesL(dst, KSelectRows(), CAfEntry::Public);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Serialize application activity into the buffer
+ * @param dst - destination buffer
+ * @param appId - application id
+ */
+void CAfStorage::ActivitiesL(RPointerArray<CAfEntry>& dst,TInt appId)
+{
+    HBufC *query(SelectRowsLC(appId));
+    ActivitiesL(dst, *query, CAfEntry::Private);
+    CleanupStack::PopAndDestroy(query);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Serialize application activity into the buffer
+ * @param dst - destination entry
+ * @param src - condition pattern
+ */
+void CAfStorage::ActivityL(RPointerArray<CAfEntry> &dst, CAfEntry& src)
+{
+    HBufC *query = SelectRowLC(src.ApplicationId(), src.ActivityId());
+    ActivitiesL(dst, *query, CAfEntry::Private, 1);
+    if (0 >= dst.Count()) {
+        User::Leave(KErrNotFound);
+    }
+    CleanupStack::PopAndDestroy(query);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Provide initialized file system session
+ * @return file system session
+ */
+RFs& CAfStorage::Fs()
+{
+    return mFsSession;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Format query to select activity row
+ * @param appId - application id
+ * @param actId - activity id
+ * @return formated sql query
+ */
+HBufC* CAfStorage::SelectRowLC(TInt appId, const TDesC& actId) const
+{
+    return BuildQueryLC(KSelectRow(),appId, actId);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Format query to select activities for application
+ * @param appId - application id
+ * @return formated sql query
+ */
+HBufC* CAfStorage::SelectRowsLC(TInt appId) const
+{
+    return BuildQueryLC(KSelectAppRows(), appId, KNullDesC);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Format query to delete activity
+ * @param appId - application id
+ * @param actId - activity id
+ * @return formated sql query
+ */
+HBufC* CAfStorage::DeleteRowLC(TInt appId, const TDesC& actId) const
+{
+    return BuildQueryLC(KDeleteRow(),appId, actId);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Format query to delete activities for application
+ * @param appId - application id
+ * @return formated sql query
+ */
+HBufC* CAfStorage::DeleteRowsLC(TInt appId) const
+{
+    return BuildQueryLC(KDeleteRows(),appId, KNullDesC);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Format sql query
+ * @format - sql format string
+ * @param appId - application id
+ * @param actId - activity id
+ * @return formated sql query
+ */
+HBufC* CAfStorage::BuildQueryLC(const TDesC& format,
+                                      TInt appId,
+                                      const TDesC& actId) const
+{
+    TBuf<16> appName;
+    appName.AppendNum(appId);
+    RBuf actName;
+    CleanupClosePushL(actName);
+    actName.CreateL(actId.Length());
+    actName.Copy(actId);
+    HBufC* query = HBufC::NewL(format.Length() +
+                               appName.Length() +
+                               actName.Length() );
+    query->Des().AppendFormat(format, &appName, &actName);
+    CleanupStack::PopAndDestroy(&actName);
+    CleanupStack::PushL(query);
+    return query;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Execute sql query and result serialize into buffer
+ * @param dst - destination result buffer
+ * @param query - sql activity query
+ */
+void CAfStorage::ActivitiesL(RPointerArray<CAfEntry>& dst, const TDesC& query, CAfEntry::AccessRights rights, TInt limit)
+{
+    RDbView view;// Create a view on the database
+    CleanupClosePushL(view);
+    User::LeaveIfError(view.Prepare(mActDb, TDbQuery(query), view.EReadOnly));
+    User::LeaveIfError(view.EvaluateAll());
+    ActivitiesL(dst, view, rights, limit);
+    CleanupStack::PopAndDestroy(&view);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Return view deserialisd into entries array
+ * @param dst - destination result
+ * @param query - view
+ * @param rights - acess rights
+ */
+void CAfStorage::ActivitiesL(RPointerArray<CAfEntry>& dst, RDbView& src, CAfEntry::AccessRights rights, TInt limit)
+{
+    CDbColSet* row = src.ColSetL();
+    CleanupStack::PushL(row);
+
+    const TInt flagsOffset(row->ColNo(KFlagsColumnName)),
+               applicationOffset(row->ColNo(KApplicationColumnName)),
+               activityOffset(row->ColNo(KActivityColumnName)),
+               dataOffset(row->ColNo(KDataColumnName));
+
+    RBuf activityName;
+    CleanupClosePushL(activityName);
+
+    for (src.FirstL(); src.AtRow(); src.NextL()) {
+        if(0 < limit && dst.Count() >= limit) {
+            break;
+        }
+        src.GetL();
+        ReadDataL(activityName, src, activityOffset);
+
+        CAfEntry *entry = CAfEntry::NewLC(src.ColInt32(flagsOffset),
+                                          src.ColInt64(applicationOffset),
+                                          activityName,
+                                          KNullDesC,
+                                          KNullDesC8,
+                                          KNullDesC8);
+        if (CAfEntry::Public == rights && (entry->Flags() & CAfEntry::Invisible)) {
+            CleanupStack::PopAndDestroy(entry);
+            continue;
+        }
+        InternalizeDataL(*entry, src, dataOffset);
+        
+        if (CAfEntry::Public == rights || 0 >= limit) {
+            entry->SetDataL(KNullDesC8(), CAfEntry::Private);
+        }
+        dst.AppendL(entry);
+        CleanupStack::Pop(entry);
+    }
+
+    CleanupStack::PopAndDestroy(&activityName);
+    CleanupStack::PopAndDestroy(row);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Get activity for update
+ * @param query - destination query result
+ * @param appId - application id
+ * @param actId - activity id
+ */
+void CAfStorage::GetActivityForUpdateL(RDbView& view, TInt appId, const TDesC& actId)
+{
+    HBufC* query(SelectRowLC(appId, actId));
+    User::LeaveIfError(view.Prepare(mActDb, TDbQuery(*query), view.EUpdatable));
+    CleanupStack::PopAndDestroy(query);
+    User::LeaveIfError(view.EvaluateAll());
+    if (!view.FirstL()) {
+        User::Leave(KErrNotFound);
+    }
+}
+
+// -----------------------------------------------------------------------------
+void CAfStorage::ReadDataL(RBuf& dst, RDbRowSet& src, TInt offset) const
+{
+    const TInt length(src.ColLength(offset));
+    CAfEntry::ReallocL(dst, length);
+    RDbColReadStream srcStream;
+    srcStream.OpenLC(src,offset);
+    srcStream.ReadL(dst, src.ColLength(offset));
+    CleanupStack::PopAndDestroy(&srcStream);
+}
+
+// -----------------------------------------------------------------------------
+void CAfStorage::ExternalizeDataL(RDbRowSet& dst,const CAfEntry &src, TInt offset) const
+{
+    RDbColWriteStream dbStream;
+    CleanupClosePushL(dbStream);
+    dbStream.OpenL(dst, offset);
+    src.ExternalizeDataOnlyL(dbStream);
+    CleanupStack::PopAndDestroy(&dbStream);
+}
+
+// -----------------------------------------------------------------------------
+void CAfStorage::InternalizeDataL(CAfEntry & dst, RDbRowSet& src, TInt offset) const
+{
+    RDbColReadStream dbStream;
+    CleanupClosePushL(dbStream);
+    dbStream.OpenL(src, offset);
+    dst.InternalizeDataOnlyL(dbStream);
+    CleanupStack::PopAndDestroy(&dbStream);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CAfStorage::StoragePathL(RBuf &dst, 
+                  RFs& fileSystem, 
+                  TBool persistent)
+{
+    if (dst.MaxLength() < KMaxPathLength) {
+        dst.ReAllocL(KMaxPathLength);
+    } 
+    dst.Zero();
+    User::LeaveIfError(fileSystem.PrivatePath(dst));
+    if(persistent) {
+        dst.Append(KPersistent);
+    }
+    else {
+        dst.Append(KNonPersistent);
+    } 
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CAfStorage::AppStoragePathL(RBuf &dst, 
+                     RFs& fileSystem,
+                     TInt uid,
+                     TBool persistent)
+{
+    StoragePathL(dst, fileSystem, persistent);
+    
+    //Format activity path
+    dst.AppendFormat( KUidFormat, uid); 
+    }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CAfStorage::ThumbnailPathL(RBuf &dst, 
+                                RFs& fileSystem, 
+                                TInt uid, 
+                                const TDesC &activityName,
+                                TBool persistent)
+{
+    RBuf8 buff8;
+    CleanupClosePushL(buff8);
+    buff8.CreateL(activityName.Length());
+    buff8.Copy(activityName);
+    HBufC8 *activityHash = Md5HexDigestL(buff8);
+    CleanupStack::PopAndDestroy(&buff8);
+    CleanupStack::PushL(activityHash);
+    
+    AppStoragePathL(dst, fileSystem, uid, persistent);
+    
+    RBuf hash16;
+    CleanupClosePushL(hash16);
+    hash16.CreateL(KMaxPathLength);
+    hash16.Copy(*activityHash);
+    dst.Append(hash16);//reuse already allocated buffer to convert 8 -> 16
+    CleanupStack::PopAndDestroy(&hash16);
+    dst.Append(KExtFormat());
+    CleanupStack::PopAndDestroy(activityHash);
+       
+    BaflUtils::EnsurePathExistsL(fileSystem, dst);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+HBufC8* CAfStorage::Md5HexDigestL(const TDesC8 &string)
+{
+    _LIT8(KMd5HexFormat, "%+02x");
+    CMD5* md5 = CMD5::NewL();
+    CleanupStack::PushL(md5);
+    
+    TPtrC8 hashedSig(md5->Hash(string));
+    
+    HBufC8* buf = HBufC8::NewL(hashedSig.Length() * 2);
+    TPtr8 bufPtr = buf->Des();
+    
+    for(TInt i(0); i< hashedSig.Length(); ++i) {
+        bufPtr.AppendFormat(KMd5HexFormat,hashedSig[i]);
+    }
+    CleanupStack::PopAndDestroy(md5);
+    return buf;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/src/afstorageasynctask.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,185 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "afstorageasynctask.h"
+#include "afcmd.h"
+
+_LIT(KUnsupportedStorageAsyncTask, "Unsupported async storage task");
+
+// -----------------------------------------------------------------------------
+/**
+ * Constructor for performing 1st stage construction
+ */
+CAfStorageAsyncTask::CAfStorageAsyncTask()
+{
+    // No implementation required
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Destructor.
+ */
+CAfStorageAsyncTask::~CAfStorageAsyncTask()
+{
+    mExternalizedData.Close();
+    mInternalizedData.ResetAndDestroy();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Handle asynchronous data storage requests
+ * @param taskStorage - data tasks storage
+ * @param dataStorage - data storage
+ * @param msg - request message
+ */
+void CAfStorageAsyncTask::ExecuteLD(MAfTaskStorage& taskStorage, 
+                                    CAfStorage& dataStorage, 
+                                    const RMessage2& msg)
+{
+    CAfStorageAsyncTask* self = new (ELeave) CAfStorageAsyncTask();
+    CleanupStack::PushL(self);
+    self->ExecuteL(dataStorage, msg);
+    taskStorage.PushL(self);
+    CleanupStack::Pop(self);
+    if (EFalse == msg.IsNull()) {
+        msg.Complete(KErrNone);
+    }
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see CActivityTask::Data()
+ */
+const TDesC8& CAfStorageAsyncTask::CAfStorageAsyncTask::Data() const
+{
+    return mExternalizedData;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see CActivityTask::BroadcastReceivedL(const RMessage2 &)
+ */
+void CAfStorageAsyncTask::BroadcastReceivedL(const RMessage2& )
+{
+    // No implementation required
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Handle asynchronous data storage requests
+ * @param dataStorage - data storage
+ * @param msg - request message
+ */
+void CAfStorageAsyncTask::ExecuteL(CAfStorage& dataStorage, 
+                                   const RMessage2& msg)
+{
+    switch (msg.Function()) {
+    case Activities:
+        AllActivitiesL(dataStorage, msg);
+        break;
+    case ApplicationActivities:
+        ApplicationActivitiesL(dataStorage, msg);
+        break;
+    case ApplicationActivity:
+        ApplicationActivityL(dataStorage, msg);
+        break;
+    default:
+        //this code shouldn't be called. fatal error: means wrong session implementation 
+        User::Panic(KUnsupportedStorageAsyncTask, KErrGeneral);
+    };
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Handle getting all activities request
+ * @param dataStorage - data storage
+ * @param msg - requested message
+ */
+void CAfStorageAsyncTask::AllActivitiesL(CAfStorage& dataStorage, 
+                                         const RMessage2& msg)
+{
+    dataStorage.ActivitiesL(mInternalizedData);
+    ExternalizeL();
+    WriteResponseL(msg);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Handle getting application activities request
+ * @param dataStorage - data storage
+ * @param msg - requested message
+ */
+void CAfStorageAsyncTask::ApplicationActivitiesL(CAfStorage& dataStorage, 
+                                                 const RMessage2& msg)
+{
+    CAfEntry *entry = CAfEntry::NewLC(msg);
+    dataStorage.ActivitiesL(mInternalizedData, entry->ApplicationId());
+    CleanupStack::PopAndDestroy(entry);
+    ExternalizeL();
+    WriteResponseL(msg);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Handle getting application activity request
+ * @param dataStorage - data storage
+ * @param msg - requested message
+ */
+void CAfStorageAsyncTask::ApplicationActivityL(CAfStorage& dataStorage, 
+                                               const RMessage2& msg)
+{
+    CAfEntry *src(CAfEntry::NewLC(msg));
+    dataStorage.ActivityL(mInternalizedData, *src);
+    CleanupStack::PopAndDestroy(src);
+    ExternalizeL();
+    WriteResponseL(msg);
+}
+
+// -----------------------------------------------------------------------------
+void CAfStorageAsyncTask::ExternalizeL()
+{
+    mExternalizedData << mInternalizedData;
+    mInternalizedData.ResetAndDestroy();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Write response data into request message
+ * @param msg - destination message
+ */
+void CAfStorageAsyncTask::WriteResponseL(const RMessage2& msg)
+{
+    if (EFalse == msg.IsNull()) {
+        msg.WriteL(1, 
+                   TPckgBuf<TInt>(mExternalizedData.Length()));//write data size
+        msg.WriteL(2, 
+                   TPckgBuf<CBase*>(this));//task identyfier
+    }
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Returns ETrue if task is related with session argument
+ */
+
+TBool CAfStorageAsyncTask::IsSessionTask(const CSession2* /*session*/)
+{
+	return EFalse;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/src/afstoragesynctask.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,205 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include <s32mem.h>
+#include <fbs.h>
+#include <bautils.h>
+
+#include "afstoragesynctask.h"
+#include "afcmd.h"
+#include "afentry.h"
+
+_LIT(KUnsupportedStorageSyncTask, "Unsupported sync storage task");
+
+// -----------------------------------------------------------------------------
+/**
+ * Handle synchronous data storage requests
+ * @param dataStorage - data storage
+ * @param msg - request message
+ */
+void AfStorageSyncTask::ExecuteL(MAfTaskStorage& observers,
+                                 CAfStorage& dataStorage, 
+                                 const RMessage2& msg)
+{
+    switch (msg.Function()) {
+    case AddActivity: 
+        AddActivityL(dataStorage, msg);
+        break;
+    case UpdateActivity:
+        UpdateActivityL(dataStorage, msg);
+        break;
+    case RemoveActivity:
+        DeleteActivityL(dataStorage, msg);
+        break;
+    case RemoveApplicationActivities:
+        DeleteApplicationActivitiesL(dataStorage, msg);
+        break;
+    default:
+        //this code shouldn't be called. fatal error: means wrong session implementation 
+        User::Panic(KUnsupportedStorageSyncTask, KErrGeneral);
+    };
+    msg.Complete(KErrNone);
+    NotifyChangeL(observers, msg);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Handle adding new activity.
+ * @param dataStorage - data storage
+ * @param msg - request message
+ */
+void AfStorageSyncTask::AddActivityL(CAfStorage& dataStorage, 
+                                     const RMessage2& msg)
+{
+    //Read message and bitmap handle
+    TPckgBuf<TInt> bitmapHdl(0);
+    CAfEntry *entry = CAfEntry::NewLC(msg);
+    msg.ReadL(1, bitmapHdl);
+    
+    RBuf thumbnailPath;
+    CleanupClosePushL(thumbnailPath);
+    dataStorage.ThumbnailPathL(thumbnailPath, 
+                   dataStorage.Fs(), 
+                   entry->ApplicationId(), 
+                   entry->ActivityId(),
+                   entry->Flags() & CAfEntry::Persistent);
+    CreateThumbnailL(thumbnailPath, bitmapHdl());
+    entry->SetImageSrcL(thumbnailPath);
+    dataStorage.AddActivityL(*entry);
+    CleanupStack::PopAndDestroy(&thumbnailPath);
+    
+    CleanupStack::PopAndDestroy(entry);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Handle updating existing activiy
+ * @param dataStorage - data storage
+ * @param msg - request message
+ */
+void AfStorageSyncTask::UpdateActivityL(CAfStorage& dataStorage, 
+                                        const RMessage2& msg)
+{
+    TPckgBuf<TInt> bitmapHdl(0);
+    CAfEntry *entry = CAfEntry::NewLC(msg);
+    msg.ReadL(1, bitmapHdl);
+        
+    RBuf thumbnailPath;
+    CleanupClosePushL(thumbnailPath);
+    DeleteActivityScreenshotL(dataStorage, 
+                    entry->ApplicationId(), 
+                    entry->ActivityId());
+    
+    dataStorage.ThumbnailPathL(thumbnailPath, 
+                   dataStorage.Fs(), 
+                   entry->ApplicationId(), 
+                   entry->ActivityId(),
+                   entry->Flags() & CAfEntry::Persistent);
+    CreateThumbnailL(thumbnailPath, bitmapHdl());
+    entry->SetImageSrcL(thumbnailPath);
+    dataStorage.UpdateActivityL(*entry);
+    CleanupStack::PopAndDestroy(&thumbnailPath);
+    CleanupStack::PopAndDestroy(entry);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Handle removing activity.
+ * @param dataStorage - data storage
+ * @param msg - request message
+ */
+void AfStorageSyncTask::DeleteActivityL(CAfStorage& dataStorage, 
+                                        const RMessage2& msg)
+{
+    CAfEntry *entry = CAfEntry::NewLC(msg);
+    dataStorage.DeleteActivityL(*entry);
+    DeleteActivityScreenshotL(dataStorage, 
+                        entry->ApplicationId(), 
+                        entry->ActivityId());
+    CleanupStack::PopAndDestroy(entry);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Handle removing activity.
+ * @param dataStorage - data storage
+ * @param msg - request message
+ */
+void AfStorageSyncTask::DeleteActivityScreenshotL(CAfStorage& dataStorage,
+                                    TInt uid, 
+                                    const TDesC &activityName)
+{
+    RBuf thumbnailPath;
+    CleanupClosePushL(thumbnailPath);
+    dataStorage.ThumbnailPathL(thumbnailPath, 
+                   dataStorage.Fs(), 
+                   uid, 
+                   activityName,
+                   TRUE);
+    dataStorage.Fs().Delete(thumbnailPath);
+    thumbnailPath.Zero();
+    dataStorage.ThumbnailPathL(thumbnailPath, 
+                       dataStorage.Fs(), 
+                       uid, 
+                       activityName,
+                       FALSE);
+    dataStorage.Fs().Delete(thumbnailPath);
+    thumbnailPath.Zero(); 
+    CleanupStack::PopAndDestroy(&thumbnailPath);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Handle removing all application activities.
+ * @param dataStorage - data storage
+ * @param msg - request message
+ */
+void AfStorageSyncTask::DeleteApplicationActivitiesL(CAfStorage& dataStorage, 
+                                                     const RMessage2& msg)
+{
+    CAfEntry *entry = CAfEntry::NewLC(msg);
+    dataStorage.DeleteActivitiesL(*entry);
+    CleanupStack::PopAndDestroy(entry);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void AfStorageSyncTask::NotifyChangeL(MAfTaskStorage& observers,
+                                      const RMessage2& msg)
+{
+    const RPointerArray<CAfTask> &table(observers.StorageData());
+    for (TInt iter(table.Count() - 1); 0 <= iter; --iter) {
+        table[iter]->BroadcastReceivedL(msg);
+    }
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void AfStorageSyncTask::CreateThumbnailL(const TDesC &path, TInt hdl)
+{
+    if (0 >= hdl) {
+        User::Leave(KErrCorrupt);
+    }
+    CFbsBitmap *bitmap = new (ELeave) CFbsBitmap;
+    CleanupStack::PushL(bitmap);
+    User::LeaveIfError(bitmap->Duplicate(hdl));
+    User::LeaveIfError(bitmap->Save(path));
+    CleanupStack::PopAndDestroy(bitmap);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/src/afthumbnailtask.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,129 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "afthumbnailtask.h"
+#include "afcmd.h"
+
+#include <fbs.h>
+
+// -----------------------------------------------------------------------------
+/**
+ * Constructor for performing 1st stage construction
+ */
+CAfThumbnailTask::CAfThumbnailTask(MAfTaskStorage& storage, 
+                                   const RMessage2 msg)
+:
+    mStorage(storage), 
+    mMsg(msg)
+{
+    // No implementation required
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Destructor.
+ */
+CAfThumbnailTask::~CAfThumbnailTask()
+{
+    delete mService;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CAfThumbnailTask::ExecuteLD(MAfTaskStorage& taskStorage,
+                                 const RMessage2& message)
+{
+    CAfThumbnailTask *self = new (ELeave)CAfThumbnailTask(taskStorage, 
+                                                                      message);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    taskStorage.PushL(self);
+    CleanupStack::Pop(self);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * EPOC default constructor for performing 2nd stage construction
+ */
+void CAfThumbnailTask::ConstructL()
+{
+    TPckgBuf<int> width(0), height(0);
+    RBuf path;
+    CleanupClosePushL(path);
+    mMsg.ReadL(0, width);
+    mMsg.ReadL(1, height);
+    path.CreateL(mMsg.GetDesLengthL(2));
+    mMsg.ReadL(2, path);
+    
+    CFbsBitmap *bitmap = new (ELeave) CFbsBitmap();
+    CleanupStack::PushL(bitmap);
+    User::LeaveIfError(bitmap->Load(path));
+    mService = CTsGraphicFileScalingHandler::NewL(*this, 
+                                                  *bitmap, 
+                                                  TSize(width(), height()), 
+                                                  CTsGraphicFileScalingHandler::EKeepAspectRatioByExpanding);
+    CleanupStack::PopAndDestroy(bitmap);
+    CleanupStack::PopAndDestroy(&path);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CAfThumbnailTask::ImageReadyCallBack(TInt error,const CFbsBitmap *bitmap)
+{
+    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 {
+        if (EFalse == mMsg.IsNull()) {
+         mMsg.Complete(error);
+        }
+        mStorage.Pop(this);
+        delete this;
+    }
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+const TDesC8& CAfThumbnailTask::Data() const
+{
+    return KNullDesC8();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CAfThumbnailTask::BroadcastReceivedL(const RMessage2&)
+{
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Returns ETrue if task is related with session argument
+ */
+TBool CAfThumbnailTask::IsSessionTask(const CSession2* session)
+{
+    return mMsg.Session() == session ? ETrue : EFalse;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/src/main.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -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 "afserver.h"
+#include <e32base.h>
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LOCAL_C void StartActivityServerL()
+{
+    CActiveScheduler* activeScheduler = new( ELeave ) CActiveScheduler;
+    CleanupStack::PushL( activeScheduler );
+    CActiveScheduler::Install( activeScheduler );
+    CAfServer* serverObject = CAfServer::NewLC();
+    RProcess::Rendezvous( KErrNone );
+    CActiveScheduler::Start();
+    CleanupStack::PopAndDestroy( serverObject );
+    CleanupStack::PopAndDestroy( activeScheduler );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LOCAL_C TInt StartActivityServer()
+{
+    __UHEAP_MARK;
+    TInt errNo(KErrNoMemory);
+    CTrapCleanup* cleanupStack = CTrapCleanup::New();
+    if (cleanupStack) {
+        TRAP(errNo, StartActivityServerL());
+        delete cleanupStack;
+    }
+    __UHEAP_MARKEND;
+    if (KErrNone != errNo) {
+        RProcess::Rendezvous(errNo);
+    }
+    return errNo;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+TInt E32Main()
+{
+    return StartActivityServer();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/storage.pro	Thu Jul 22 16:37:03 2010 +0100
@@ -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
+
+SUBDIRS += client \
+           server
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/tsutils/bwins/tsutilsu.def	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,18 @@
+EXPORTS
+	?WsSession@CTsResourceManager@@UAEAAVRWsSession@@XZ @ 1 NONAME ; class RWsSession & CTsResourceManager::WsSession(void)
+	?ApaSession@CTsResourceManager@@UAEAAVRApaLsSession@@XZ @ 2 NONAME ; class RApaLsSession & CTsResourceManager::ApaSession(void)
+	?BaseConstructL@CTsWindowGroupsObserver@@IAEXXZ @ 3 NONAME ; void CTsWindowGroupsObserver::BaseConstructL(void)
+	??1CTsWindowGroupsObserver@@UAE@XZ @ 4 NONAME ; CTsWindowGroupsObserver::~CTsWindowGroupsObserver(void)
+	??1CTsWindowGroupsMonitor@@UAE@XZ @ 5 NONAME ; CTsWindowGroupsMonitor::~CTsWindowGroupsMonitor(void)
+	?NewL@CTsGraphicFileScalingHandler@@SAPAV1@AAVMImageReadyCallBack@@AAVRFs@@ABVTDesC16@@ABVTDesC8@@ABVTSize@@W4TKindOfScaling@1@@Z @ 6 NONAME ; class CTsGraphicFileScalingHandler * CTsGraphicFileScalingHandler::NewL(class MImageReadyCallBack &, class RFs &, class TDesC16 const &, class TDesC8 const &, class TSize const &, enum CTsGraphicFileScalingHandler::TKindOfScaling)
+	?SubscribeL@CTsWindowGroupsMonitor@@UAEXAAVMTsWindowGroupsObserver@@@Z @ 7 NONAME ; void CTsWindowGroupsMonitor::SubscribeL(class MTsWindowGroupsObserver &)
+	?NewL@CTsWindowGroupsMonitor@@SAPAV1@AAVMTsResourceManager@@@Z @ 8 NONAME ; class CTsWindowGroupsMonitor * CTsWindowGroupsMonitor::NewL(class MTsResourceManager &)
+	??1CTsGraphicFileScalingHandler@@UAE@XZ @ 9 NONAME ; CTsGraphicFileScalingHandler::~CTsGraphicFileScalingHandler(void)
+	?NewLC@CTsGraphicFileScalingHandler@@SAPAV1@AAVMImageReadyCallBack@@ABVCFbsBitmap@@ABVTSize@@W4TKindOfScaling@1@@Z @ 10 NONAME ; class CTsGraphicFileScalingHandler * CTsGraphicFileScalingHandler::NewLC(class MImageReadyCallBack &, class CFbsBitmap const &, class TSize const &, enum CTsGraphicFileScalingHandler::TKindOfScaling)
+	?NewL@CTsGraphicFileScalingHandler@@SAPAV1@AAVMImageReadyCallBack@@ABVCFbsBitmap@@ABVTSize@@W4TKindOfScaling@1@@Z @ 11 NONAME ; class CTsGraphicFileScalingHandler * CTsGraphicFileScalingHandler::NewL(class MImageReadyCallBack &, class CFbsBitmap const &, class TSize const &, enum CTsGraphicFileScalingHandler::TKindOfScaling)
+	?NewLC@CTsGraphicFileScalingHandler@@SAPAV1@AAVMImageReadyCallBack@@AAVRFs@@ABVTDesC16@@ABVTDesC8@@ABVTSize@@W4TKindOfScaling@1@@Z @ 12 NONAME ; class CTsGraphicFileScalingHandler * CTsGraphicFileScalingHandler::NewLC(class MImageReadyCallBack &, class RFs &, class TDesC16 const &, class TDesC8 const &, class TSize const &, enum CTsGraphicFileScalingHandler::TKindOfScaling)
+	??0CTsWindowGroupsObserver@@IAE@AAVMTsWindowGroupsMonitor@@@Z @ 13 NONAME ; CTsWindowGroupsObserver::CTsWindowGroupsObserver(class MTsWindowGroupsMonitor &)
+	?NewL@CTsResourceManager@@SAPAV1@XZ @ 14 NONAME ; class CTsResourceManager * CTsResourceManager::NewL(void)
+	?Cancel@CTsWindowGroupsMonitor@@UAEXAAVMTsWindowGroupsObserver@@@Z @ 15 NONAME ; void CTsWindowGroupsMonitor::Cancel(class MTsWindowGroupsObserver &)
+	??1CTsResourceManager@@UAE@XZ @ 16 NONAME ; CTsResourceManager::~CTsResourceManager(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/tsutils/eabi/tsutilsu.def	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,38 @@
+EXPORTS
+	_ZN18CTsResourceManager10ApaSessionEv @ 1 NONAME
+	_ZN18CTsResourceManager4NewLEv @ 2 NONAME
+	_ZN18CTsResourceManager9WsSessionEv @ 3 NONAME
+	_ZN18CTsResourceManagerD0Ev @ 4 NONAME
+	_ZN18CTsResourceManagerD1Ev @ 5 NONAME
+	_ZN18CTsResourceManagerD2Ev @ 6 NONAME
+	_ZN22CTsWindowGroupsMonitor10SubscribeLER23MTsWindowGroupsObserver @ 7 NONAME
+	_ZN22CTsWindowGroupsMonitor4NewLER18MTsResourceManager @ 8 NONAME
+	_ZN22CTsWindowGroupsMonitor6CancelER23MTsWindowGroupsObserver @ 9 NONAME
+	_ZN22CTsWindowGroupsMonitorD0Ev @ 10 NONAME
+	_ZN22CTsWindowGroupsMonitorD1Ev @ 11 NONAME
+	_ZN22CTsWindowGroupsMonitorD2Ev @ 12 NONAME
+	_ZN23CTsWindowGroupsObserver14BaseConstructLEv @ 13 NONAME
+	_ZN23CTsWindowGroupsObserverC2ER22MTsWindowGroupsMonitor @ 14 NONAME
+	_ZN23CTsWindowGroupsObserverD0Ev @ 15 NONAME
+	_ZN23CTsWindowGroupsObserverD1Ev @ 16 NONAME
+	_ZN23CTsWindowGroupsObserverD2Ev @ 17 NONAME
+	_ZN28CTsGraphicFileScalingHandler4NewLER19MImageReadyCallBackR3RFsRK7TDesC16RK6TDesC8RK5TSizeNS_14TKindOfScalingE @ 18 NONAME
+	_ZN28CTsGraphicFileScalingHandler4NewLER19MImageReadyCallBackRK10CFbsBitmapRK5TSizeNS_14TKindOfScalingE @ 19 NONAME
+	_ZN28CTsGraphicFileScalingHandler5NewLCER19MImageReadyCallBackR3RFsRK7TDesC16RK6TDesC8RK5TSizeNS_14TKindOfScalingE @ 20 NONAME
+	_ZN28CTsGraphicFileScalingHandler5NewLCER19MImageReadyCallBackRK10CFbsBitmapRK5TSizeNS_14TKindOfScalingE @ 21 NONAME
+	_ZN28CTsGraphicFileScalingHandlerD0Ev @ 22 NONAME
+	_ZN28CTsGraphicFileScalingHandlerD1Ev @ 23 NONAME
+	_ZN28CTsGraphicFileScalingHandlerD2Ev @ 24 NONAME
+	_ZTI18CTsResourceManager @ 25 NONAME
+	_ZTI22CTsWindowGroupsMonitor @ 26 NONAME
+	_ZTI23CTsWindowGroupsObserver @ 27 NONAME
+	_ZTI28CTsGraphicFileScalingHandler @ 28 NONAME
+	_ZTV18CTsResourceManager @ 29 NONAME
+	_ZTV22CTsWindowGroupsMonitor @ 30 NONAME
+	_ZTV23CTsWindowGroupsObserver @ 31 NONAME
+	_ZTV28CTsGraphicFileScalingHandler @ 32 NONAME
+	_ZThn28_N22CTsWindowGroupsMonitor10SubscribeLER23MTsWindowGroupsObserver @ 33 NONAME
+	_ZThn28_N22CTsWindowGroupsMonitor6CancelER23MTsWindowGroupsObserver @ 34 NONAME
+	_ZThn4_N18CTsResourceManager10ApaSessionEv @ 35 NONAME
+	_ZThn4_N18CTsResourceManager9WsSessionEv @ 36 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/tsutils/group/bld.inf	Thu Jul 22 16:37:03 2010 +0100
@@ -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:
+*
+*/
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../inc/tsresourcemanager.h |../../../inc/tsresourcemanager.h
+../inc/tswindowgroupsobserver.h |../../../inc/tswindowgroupsobserver.h
+../inc/tsgraphicfilescalinghandler.h |../../../inc/tsgraphicfilescalinghandler.h
+
+PRJ_MMPFILES
+tsutils.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/tsutils/group/tsutils.mmp	Thu Jul 22 16:37:03 2010 +0100
@@ -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:
+*
+*/
+TARGET        tsutils.dll
+TARGETTYPE    dll
+UID           0x1000008d 0x20026782
+
+CAPABILITY    CAP_GENERAL_DLL
+
+MW_LAYER_SYSTEMINCLUDE
+
+USERINCLUDE   ../inc
+
+SOURCEPATH    ../src
+SOURCE        tsgraphicfilescalinghandler.cpp
+SOURCE        tswindowgroupsmonitor.cpp
+SOURCE        tswindowgroupsobserver.cpp
+SOURCE        tsresourcemanager.cpp
+
+LIBRARY      euser.lib
+LIBRARY      bitmaptransforms.lib
+LIBRARY      imageconversion.lib
+LIBRARY      fbscli.lib
+LIBRARY      efsrv.lib
+LIBRARY      ws32.lib
+LIBRARY      apgrfx.lib
+
+//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 Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,211 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description :
+ *
+ */
+#ifndef TSGRAPHICFILESCALINGHANDLER_H
+#define TSGRAPHICFILESCALINGHANDLER_H
+
+#ifndef __E32SVR_H__
+#define __E32SVR_H__
+#endif
+
+
+#ifndef SYMBIAN_ENABLE_PUBLIC_PLATFORM_HEADER_SPLIT
+#define SYMBIAN_ENABLE_PUBLIC_PLATFORM_HEADER_SPLIT
+#endif
+
+#include <bitmaptransforms.h>
+
+class CImageDecoder;
+class CFbsBitmap;
+
+/**
+ * Interface to observer contain
+ * ImageReadyCallBack function return error code and scaled/resized bitmap.
+ */
+class MImageReadyCallBack
+{
+public:
+    virtual void ImageReadyCallBack(TInt error, const CFbsBitmap *bitmap) = 0;
+};
+
+/**
+ * Class to scaling graphic file/s.
+ */
+class CTsGraphicFileScalingHandler : public CActive
+{
+public:
+    /**
+     * Kind of graphic file scaling.
+     * EIgnoreAspectRatio          - the file is scaled to size, aspect ratio isn't preserving.
+     * EKeepAspectRatio            - the file is scaled to a rectangle as large as possible inside size
+     *                               preserving the aspect ratio.
+     * EKeepAspectRatioByExpanding - the file is scaled to a rectangle as small as possible outside size
+     *                               preserving the aspect ratio.
+     */
+    enum TKindOfScaling
+    {
+       EIgnoreAspectRatio = 0,
+       EKeepAspectRatio = 1,
+       EKeepAspectRatioByExpanding = 2,
+    };
+
+private:
+    /**
+     * Active object current operation.
+     */
+    enum TCurrentOperation{
+        ENone = 0,
+        EConvertBitmapFromFile = 1,
+        EScale = 2
+    };
+
+public:
+    /**
+    * Destructor.
+    */
+    IMPORT_C ~CTsGraphicFileScalingHandler();
+
+    /**
+     * All constructors initialise active object asynchronous operation
+     * by calling ConstructL function.
+     * 1st group - decoding and scaling.
+     * 2nd group - scaling.
+     */
+
+    /**
+     * 1st group.
+     * Exported from dll constructors for activation graphic file scaling.
+     * aNotify        - reference to observer implementation.
+     * aFs            - reference to file server session.
+     * aFileName      - path to graphic file.
+     * aMimeType      - mime type of graphic file.
+     * aNewSize       - new size of output graphic file.
+     * aKindOfScaling - kind of graphic file scaling described above.
+     */
+    IMPORT_C static CTsGraphicFileScalingHandler* NewL(MImageReadyCallBack &aNotify,
+        RFs &aFs,
+        const TDesC &aFileName,
+        const TDesC8& aMimeType,
+        const TSize &aNewSize,
+        TKindOfScaling aKindOfScaling = CTsGraphicFileScalingHandler::EIgnoreAspectRatio);
+    IMPORT_C static CTsGraphicFileScalingHandler* NewLC(MImageReadyCallBack &aNotify,
+        RFs &aFs,
+        const TDesC &aFileName,
+        const TDesC8& aMimeType,
+        const TSize &aNewSize,
+        TKindOfScaling aKindOfScaling = CTsGraphicFileScalingHandler::EIgnoreAspectRatio);
+
+    /**
+     * 2nd group.
+     * Exported from dll constructors for activation graphic file scaling.
+     * aNotify         - reference to observer implementation.
+     * aImputFbsBitmap - reference to pattern CFbsBitmap.
+     * aNewSize        - new size of output graphic file.
+     * aKindOfScaling  - kind of graphic file scaling described above.
+     */
+    IMPORT_C static CTsGraphicFileScalingHandler* NewL(MImageReadyCallBack &aNotify,
+        const CFbsBitmap &aImputFbsBitmap,
+        const TSize &aNewSize,
+        TKindOfScaling aKindOfScaling = CTsGraphicFileScalingHandler::EIgnoreAspectRatio);
+     IMPORT_C static CTsGraphicFileScalingHandler* NewLC(MImageReadyCallBack &aNotify,
+        const CFbsBitmap &aImputFbsBitmap,
+        const TSize &aNewSize,
+        TKindOfScaling aKindOfScaling = CTsGraphicFileScalingHandler::EIgnoreAspectRatio);
+
+protected:
+     /**
+      * Cancels the wait for completion of an outstanding request.
+      */
+    void DoCancel();
+    /**
+     * Handles an active object’s request completion event.
+     */
+    void RunL();
+    /**
+     * Handles a leave occurring in the request completion event handler RunL().
+     */
+    TInt RunError(TInt);
+
+private:
+    /**
+     * Functions construct active objest instance and made asynchronous operation/s.
+     * Parameters - the same meaning as in appropriate NewL/NewLC functions.
+     */
+    void ConstructL(RFs &aFs, const TDesC &aFileName, const TDesC8& aMimeType);
+    void ConstructL(const CFbsBitmap &aImputFbsBitmap);
+    /**
+     * Private constructor.
+     * Parameters - the same meaning as in appropriate NewL/NewLC functions.
+     */
+    CTsGraphicFileScalingHandler(MImageReadyCallBack &aNotify,
+        const TSize &aNewSize,
+        TKindOfScaling aKindOfScaling = CTsGraphicFileScalingHandler::EIgnoreAspectRatio);
+    /**
+     * Action to made before decoding graphic file operation.
+     * Parameters - the same meaning as in appropriate NewL/NewLC functions.
+     */
+    void DecodingOperationL(RFs &aFs, const TDesC &aFileName, const TDesC8& aMimeType);
+    /**
+     * Action to made before scaling graphic file operation.
+     */
+    void ScalingOperationL();
+    /**
+     * Algorithm to determine output bitmap (returned in ImageReadyCallBack) size
+     * after scaling operation.
+     */
+    TSize NewSizeToScalingOperation();
+    /**
+     * Fix for TDisplayMode == EColor16MAP not supported by scaling operation!
+     * ! ! ! ADD OTHER NOT SUPPORTED DISPLAY MODES ! ! !
+     */
+    void FixForDisplayModeNotSupportedByScalingOperation();
+
+private:
+    /**
+     * Reference to observer implementation - return error code and output bitmap.
+     */
+    MImageReadyCallBack &mNotify;
+    /**
+     * Pointer to decoder used by decoding graphic file algorithm.
+     */
+    CImageDecoder *mImageDecoder;
+    /**
+     * Pointer to input bitmap - before decoding/scaling operation/s.
+     */
+    CFbsBitmap *mInputBitmap;
+    /**
+     * Pointer to output bitmap - returned in mNotify object.
+     */
+    CFbsBitmap *mOutputBitmap;
+    /**
+     * Pointer to CBitmapScaler calss used by scaling graphic file algorithm.
+     */
+    CBitmapScaler *mBitmapScaler;
+    /**
+     * New size of output graphic file.
+     */
+    TSize mNewSize;
+    /**
+     * Kind of graphic file scaling described above.
+     */
+    TBool mKindOfScaling;
+    /**
+     * Active object current operation.
+     */
+    TCurrentOperation mCurrentOperation;
+};
+
+#endif // TSGRAPHICFILESCALINGHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/tsutils/inc/tsresourcemanager.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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 :
+ *
+ */
+#ifndef TSRESOURCEMANAGER_H
+#define TSRESOURCEMANAGER_H
+
+#ifndef __E32SVR_H__
+#define __E32SVR_H__
+#endif
+#include <e32base.h>
+#include <e32event.h>
+#include <w32std.h>
+#include <apgcli.h>
+
+/**
+ * Interface decalre methods to access initialized OS resources
+ */
+class MTsResourceManager
+{
+public:
+    /**
+     * Access to initialized window server session
+     */
+    virtual RWsSession& WsSession() =0;
+    
+    /**
+     * Access to initilaized APA session
+     */
+    virtual RApaLsSession& ApaSession() =0;
+};
+
+/**
+ * Resource manager implemetatioin
+ */
+class CTsResourceManager: public CBase,
+                          public MTsResourceManager
+{
+public:
+    /**
+     * Two phase constructor
+     */
+    IMPORT_C static CTsResourceManager* NewL();
+    
+    /**
+     * Destructor
+     */
+    IMPORT_C ~CTsResourceManager();
+    
+    /**
+     * @see MTsResourceManager::WsSession
+     */
+    IMPORT_C RWsSession& WsSession();
+    
+    /**
+     * @see MTsResourceManager::ApaSession
+     */
+    IMPORT_C RApaLsSession& ApaSession();
+
+private:
+    /**
+     * Second phase constructor
+     */
+    void ConstructL();
+
+private:
+   RWsSession mWsSession;
+   RApaLsSession mApaSeesion;
+};
+
+
+
+#endif // TSRESOURCEMANAGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/tsutils/inc/tswindowgroupsobserver.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,173 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description :
+ *
+ */
+#ifndef TSWINDOWGROUPSOBSERVER_H
+#define TSWINDOWGROUPSOBSERVER_H
+
+#include "tsresourcemanager.h"
+
+/**
+ * Interface declare mathods to notify about window server events
+ */
+class MTsWindowGroupsObserver
+{
+public:
+    /**
+     * Method notidy about window group changes.
+     * @param rsc - resource manager
+     * @param wgs - list of window groups associated with running applications
+     */
+    virtual void HandleWindowGroupChanged(MTsResourceManager &rsc, 
+                                          const TArray<RWsSession::TWindowGroupChainInfo> & wgs) =0;
+};
+
+/**
+ * Interface declare methods to subscribe windo server events
+ */
+class MTsWindowGroupsMonitor
+{
+public:
+    /**
+     * Method make subscription for window server events
+     * @param observer - events observer
+     */
+    virtual void SubscribeL(MTsWindowGroupsObserver & observer) =0;
+    
+    /**
+     * Method cancel subscription for window server events
+     * @param observer - events observer
+     */
+    virtual void Cancel(MTsWindowGroupsObserver &) =0;
+};
+
+/**
+ * Window server observer implementation. Class automaticly subscribe / cancel subscription
+ * at construction / destruction level.
+ * 
+ */
+class CTsWindowGroupsObserver: public CBase,
+                               public MTsWindowGroupsObserver
+{
+public:
+    /**
+     * Destructor
+     * Function automaticly cancel subscrption to window server events
+     */
+    IMPORT_C ~CTsWindowGroupsObserver();
+    
+protected:
+    /**
+     * First phase constructor
+     */
+    IMPORT_C CTsWindowGroupsObserver(MTsWindowGroupsMonitor &);
+    
+    /**
+     * Second phase constructor.
+     * Function automaticly subscribe window server events
+     */
+    IMPORT_C void BaseConstructL();
+
+private:
+    MTsWindowGroupsMonitor & mMonitor;
+};
+
+/**
+ * Window server monitor implementation.
+ */
+class CTsWindowGroupsMonitor: public CActive, 
+                              public MTsWindowGroupsMonitor
+                              
+{
+public:
+    /**
+     * Two phase constructor
+     */
+    IMPORT_C static CTsWindowGroupsMonitor* NewL(MTsResourceManager &);
+    
+    /**
+     * Destructor
+     */
+    IMPORT_C ~CTsWindowGroupsMonitor();
+    
+    /**
+     * @see MTsWindowGroupsMonitor::SubscribeL
+     */
+    IMPORT_C void SubscribeL(MTsWindowGroupsObserver &);
+    
+    /**
+     * @see MTsWindowGroupsMonitor::Cancel
+     */
+    IMPORT_C void Cancel(MTsWindowGroupsObserver &);
+
+protected:
+    /**
+     * @see CActive::RunL
+     */
+    void RunL();
+    
+    /**
+     * @see CActive::DoCancel
+     */
+    void DoCancel();
+    
+    /**
+     * @see CActive::RunError
+     */
+    TInt RunError(TInt error);
+
+private:
+    /**
+     * First phase constructor
+     */
+    CTsWindowGroupsMonitor(MTsResourceManager &);
+    
+    /**
+     * Second phase constructor
+     */
+    void ConstructL();
+    
+    /**
+     * Function subscribe for event to window server and activate object
+     */
+    void Subscribe();
+    
+    /**
+     * Function provide window server event to observers
+     */
+    void ProvideEventL();
+    
+    /**
+     * Function provide window server event to observer
+     */
+    void ProvideEventL(TWsEvent, MTsWindowGroupsObserver &);
+
+private:
+    /**
+     * Registry of subscribed observers
+     */
+    RPointerArray<MTsWindowGroupsObserver> mObservers;
+    
+    /**
+     * Resources manager
+     */
+    MTsResourceManager &mResources;
+    
+    /**
+     * Monitor window group
+     */
+    RWindowGroup mWg;
+};
+#endif //TSWINDOWGROUPSOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/tsutils/src/tsgraphicfilescalinghandler.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,285 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description :
+ *
+ */
+#include "tsgraphicfilescalinghandler.h"
+#include <imageconversion.h>
+
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+//
+CTsGraphicFileScalingHandler::CTsGraphicFileScalingHandler(MImageReadyCallBack &aNotify,
+                                const TSize &aNewSize,
+                                TKindOfScaling aKindOfScaling
+                                /* = CTsGraphicFileScalingHandler::EIgnoreAspectRatio*/) :
+    CActive(EPriorityNormal),
+    mNotify(aNotify),
+    mNewSize(aNewSize),
+    mKindOfScaling(aKindOfScaling),
+    mCurrentOperation(ENone)
+{
+    CActiveScheduler::Add(this);
+}
+
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CTsGraphicFileScalingHandler::~CTsGraphicFileScalingHandler()
+{
+    Cancel();
+    delete mInputBitmap;
+    delete mOutputBitmap;
+    delete mImageDecoder;
+    delete mBitmapScaler;
+}
+
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CTsGraphicFileScalingHandler* CTsGraphicFileScalingHandler::NewL(MImageReadyCallBack &aNotify,
+                                                RFs &aFs,
+                                                const TDesC &aFileName,
+                                                const TDesC8& aMimeType,
+                                                const TSize &aNewSize,
+                                                TKindOfScaling aKindOfScaling
+                                                /* = CTsGraphicFileScalingHandler::EIgnoreAspectRatio*/)
+{
+    CTsGraphicFileScalingHandler *self = CTsGraphicFileScalingHandler::NewLC(aNotify,
+                                                                        aFs,
+                                                                        aFileName,
+                                                                        aMimeType,
+                                                                        aNewSize,
+                                                                        aKindOfScaling);
+    CleanupStack::Pop();
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CTsGraphicFileScalingHandler* CTsGraphicFileScalingHandler::NewLC(MImageReadyCallBack &aNotify,
+                                                RFs &aFs,
+                                                const TDesC &aFileName,
+                                                const TDesC8& aMimeType,
+                                                const TSize &aNewSize,
+                                                TKindOfScaling aKindOfScaling
+                                                /* = CTsGraphicFileScalingHandler::EIgnoreAspectRatio*/)
+{
+    CTsGraphicFileScalingHandler *self = new (ELeave) CTsGraphicFileScalingHandler(aNotify,
+                                                                                aNewSize,
+                                                                                aKindOfScaling);
+
+    CleanupStack::PushL(self);
+    self->ConstructL(aFs, aFileName, aMimeType);
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+//
+void CTsGraphicFileScalingHandler::ConstructL(RFs &aFs, const TDesC &aFileName, const TDesC8& aMimeType)
+{
+    if (aFileName.Length() == 0
+        || aFs.IsValidName(aFileName) == EFalse) {
+        User::Leave(KErrPathNotFound);
+    }
+
+    if (aMimeType.Length() == 0) {
+        User::Leave(KErrBadName);
+    }
+
+    if (0>=mNewSize.iWidth || 0>=mNewSize.iHeight) {
+       User::Leave(KErrCorrupt);
+    }
+
+    mInputBitmap = new(ELeave)CFbsBitmap();
+    DecodingOperationL(aFs, aFileName, aMimeType);
+    SetActive();
+}
+
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CTsGraphicFileScalingHandler* CTsGraphicFileScalingHandler::NewL(MImageReadyCallBack &aNotify,
+                                        const CFbsBitmap &aImputFbsBitmap,
+                                        const TSize &aNewSize,
+                                        TKindOfScaling aKindOfScaling
+                                        /* = CTsGraphicFileScalingHandler::EIgnoreAspectRatio*/)
+{
+    CTsGraphicFileScalingHandler *self = CTsGraphicFileScalingHandler::NewLC(aNotify,
+                                                                        aImputFbsBitmap,
+                                                                        aNewSize,
+                                                                        aKindOfScaling);
+    CleanupStack::Pop();
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CTsGraphicFileScalingHandler* CTsGraphicFileScalingHandler::NewLC(MImageReadyCallBack &aNotify,
+                                                const CFbsBitmap &aImputFbsBitmap,
+                                                const TSize &aNewSize,
+                                                TKindOfScaling aKindOfScaling
+                                                /* = CTsGraphicFileScalingHandler::EIgnoreAspectRatio*/)
+{
+    CTsGraphicFileScalingHandler *self = new (ELeave) CTsGraphicFileScalingHandler(aNotify,
+                                                                                aNewSize,
+                                                                                aKindOfScaling);
+
+    CleanupStack::PushL(self);
+    self->ConstructL(aImputFbsBitmap);
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+//
+void CTsGraphicFileScalingHandler::ConstructL(const CFbsBitmap &aImputFbsBitmap)
+{
+    if (0>=mNewSize.iWidth || 0>=mNewSize.iHeight) {
+       User::Leave(KErrCorrupt);
+    }
+
+    mInputBitmap = new(ELeave)CFbsBitmap();
+    User::LeaveIfError(mInputBitmap->Duplicate(aImputFbsBitmap.Handle()));
+
+    ScalingOperationL();
+    SetActive();
+}
+
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+//
+void CTsGraphicFileScalingHandler::DoCancel()
+{
+    switch (mCurrentOperation) {
+    case EConvertBitmapFromFile:
+        mImageDecoder->Cancel();
+        break;
+    case EScale:
+        mBitmapScaler->Cancel();
+        break;
+    }
+    mNotify.ImageReadyCallBack(KErrCancel, 0);
+}
+
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+//
+void CTsGraphicFileScalingHandler::RunL()
+{
+    User::LeaveIfError(iStatus.Int());
+
+    switch (mCurrentOperation) {
+    case EConvertBitmapFromFile: {
+            delete mImageDecoder;
+            mImageDecoder = 0;
+
+            ScalingOperationL();
+            SetActive();
+            break;
+        }
+    case EScale: {
+            mCurrentOperation = ENone;
+
+            delete mBitmapScaler;
+            mBitmapScaler = 0;
+            
+            delete mInputBitmap;
+            mInputBitmap = 0;
+
+            if (mKindOfScaling == CTsGraphicFileScalingHandler::EKeepAspectRatioByExpanding) {
+                User::LeaveIfError(mOutputBitmap->Resize(mNewSize));
+            }
+
+            mNotify.ImageReadyCallBack(iStatus.Int(), mOutputBitmap);
+            break;
+        }
+    }
+}
+
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+//
+void CTsGraphicFileScalingHandler::DecodingOperationL(RFs &aFs, const TDesC &aFileName, const TDesC8& aMimeType)
+{
+    // convert *.png to bitmap
+    mImageDecoder = CImageDecoder::FileNewL(aFs, aFileName, aMimeType);
+    const TFrameInfo frameInfo(mImageDecoder->FrameInfo(0));
+    mInputBitmap->Reset();
+    User::LeaveIfError(mInputBitmap->Create(frameInfo.iOverallSizeInPixels, 
+                                               frameInfo.iFrameDisplayMode));
+
+    mImageDecoder->Convert(&iStatus, *mInputBitmap, 0);
+    mCurrentOperation = EConvertBitmapFromFile;
+}
+
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+//
+void CTsGraphicFileScalingHandler::ScalingOperationL()
+{
+    mBitmapScaler = CBitmapScaler::NewL();
+    mBitmapScaler->SetQualityAlgorithm(CBitmapScaler::EMaximumQuality);
+
+    FixForDisplayModeNotSupportedByScalingOperation();
+
+    mOutputBitmap = new (ELeave)CFbsBitmap();
+    User::LeaveIfError(mOutputBitmap->Create(NewSizeToScalingOperation(), mInputBitmap->DisplayMode()));
+    mBitmapScaler->Scale(&iStatus, *mInputBitmap, *mOutputBitmap, EFalse);
+    mCurrentOperation = EScale;
+}
+
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+//
+void CTsGraphicFileScalingHandler::FixForDisplayModeNotSupportedByScalingOperation()
+{
+    if (EColor16MAP == mInputBitmap->DisplayMode()) {
+        mInputBitmap->SetDisplayMode(EColor16MA);
+    }
+}
+
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+//
+TSize CTsGraphicFileScalingHandler::NewSizeToScalingOperation()
+{
+   TSize originalSize = mInputBitmap->SizeInPixels();
+   float widthFactor = mNewSize.iWidth / (float)originalSize.iWidth;
+   float heightFactor = mNewSize.iHeight / (float)originalSize.iHeight;
+
+   TSize retSize(mNewSize);
+
+   if (mKindOfScaling == CTsGraphicFileScalingHandler::EKeepAspectRatio) {
+       retSize = (widthFactor < heightFactor) ?
+                 TSize(mNewSize.iWidth, widthFactor * originalSize.iHeight) :
+                 TSize(heightFactor * originalSize.iWidth, mNewSize.iHeight);
+   } else if (mKindOfScaling == CTsGraphicFileScalingHandler::EKeepAspectRatioByExpanding) {
+      retSize = (widthFactor < heightFactor) ?
+                TSize(heightFactor * originalSize.iWidth, mNewSize.iHeight) :
+                TSize(mNewSize.iWidth, widthFactor * originalSize.iHeight);
+   }
+   return retSize;
+}
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+//
+TInt CTsGraphicFileScalingHandler::RunError(TInt aError)
+{
+    mNotify.ImageReadyCallBack(aError, 0);
+    return KErrNone;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/tsutils/src/tsresourcemanager.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description :
+ *
+ */
+#include "tswindowgroupsobserver.h"
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CTsResourceManager* CTsResourceManager::NewL()
+{
+    CTsResourceManager* self =new(ELeave) CTsResourceManager();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CTsResourceManager::ConstructL()
+{
+    User::LeaveIfError(mWsSession.Connect());
+    User::LeaveIfError(mApaSeesion.Connect());
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CTsResourceManager::~CTsResourceManager()
+{
+    mApaSeesion.Close();
+    mWsSession.Close();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+EXPORT_C RWsSession& CTsResourceManager::WsSession()
+{
+    return mWsSession;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+EXPORT_C RApaLsSession& CTsResourceManager::ApaSession()
+{
+    return mApaSeesion;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/tsutils/src/tswindowgroupsmonitor.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,176 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description :
+ *
+ */
+#include "tswindowgroupsobserver.h"
+#include <apgwgnam.h>
+
+const int KOrdinalPositionNoZOrder(-1);
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CTsWindowGroupsMonitor* CTsWindowGroupsMonitor::NewL(MTsResourceManager &resources)
+{
+    CTsWindowGroupsMonitor* self = new (ELeave) CTsWindowGroupsMonitor(resources);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CTsWindowGroupsMonitor::CTsWindowGroupsMonitor(MTsResourceManager &resources)
+:
+    CActive(EPriorityStandard),
+    mResources(resources)
+{
+    CActiveScheduler::Add(this);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CTsWindowGroupsMonitor::ConstructL()
+{
+    
+    // Initial window group
+    mWg = RWindowGroup (mResources.WsSession());
+    User::LeaveIfError (mWg.Construct ((TUint32)&mWg, EFalse));
+    mWg.SetOrdinalPosition (KOrdinalPositionNoZOrder);
+    mWg.EnableReceiptOfFocus (EFalse);
+    
+    // Hide window
+    CApaWindowGroupName* wn = CApaWindowGroupName::NewLC(mResources.WsSession());
+    wn->SetHidden (ETrue);
+    wn->SetWindowGroupName (mWg);
+    CleanupStack::PopAndDestroy (wn);
+    
+    // Window group change event
+    User::LeaveIfError (mWg.EnableGroupListChangeEvents());
+    Subscribe();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CTsWindowGroupsMonitor::~CTsWindowGroupsMonitor()
+{
+    CActive::Cancel();
+    mWg.Close();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CTsWindowGroupsMonitor::SubscribeL(MTsWindowGroupsObserver &observer)
+{
+    const TInt offset(mObservers.Find(&observer));
+    KErrNotFound == offset ? mObservers.AppendL(&observer) : 
+                             User::Leave(KErrAlreadyExists);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CTsWindowGroupsMonitor::Cancel(MTsWindowGroupsObserver & observer)
+{
+    const TInt offset(mObservers.Find(&observer));
+    if (KErrNotFound != offset) {
+        mObservers.Remove(offset);
+    }
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CTsWindowGroupsMonitor::RunL()
+{
+    User::LeaveIfError(iStatus.Int());
+    ProvideEventL();
+    Subscribe();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CTsWindowGroupsMonitor::DoCancel()
+{
+    if (IsActive()) {
+        mResources.WsSession().EventReadyCancel();
+    }
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+TInt CTsWindowGroupsMonitor::RunError(TInt error)
+{
+    if (!IsActive() && KErrCancel != error) {
+        Subscribe();
+    }
+    return KErrNone;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CTsWindowGroupsMonitor::Subscribe()
+{
+    mResources.WsSession().EventReady( &iStatus );
+    SetActive();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CTsWindowGroupsMonitor::ProvideEventL()
+{
+    TWsEvent wsEvent;
+    mResources.WsSession().GetEvent(wsEvent);
+    for (TInt iter(0); iter < mObservers.Count(); ++iter) {
+        ProvideEventL(wsEvent, *mObservers[iter]);
+    }
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CTsWindowGroupsMonitor::ProvideEventL(TWsEvent event, 
+                                          MTsWindowGroupsObserver &observer)
+{
+    RArray<RWsSession::TWindowGroupChainInfo> wgInfo;
+    CleanupClosePushL(wgInfo);
+    switch(event.Type()) {
+    case EEventWindowGroupListChanged:
+        User::LeaveIfError(mResources.WsSession().WindowGroupList(&wgInfo));
+        observer.HandleWindowGroupChanged(mResources, wgInfo.Array());
+        break;
+    }
+    CleanupStack::PopAndDestroy(&wgInfo);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/tsutils/src/tswindowgroupsobserver.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description :
+ *
+ */
+#include "tswindowgroupsobserver.h"
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CTsWindowGroupsObserver::CTsWindowGroupsObserver(MTsWindowGroupsMonitor & monitor)
+:
+    mMonitor(monitor)
+{}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CTsWindowGroupsObserver::BaseConstructL()
+{
+    mMonitor.SubscribeL(*this);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CTsWindowGroupsObserver::~CTsWindowGroupsObserver()
+{
+    mMonitor.Cancel(*this);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/tsutils/tsutils.pro	Thu Jul 22 16:37:03 2010 +0100
@@ -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/appfoundation/appfoundation.pro	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-
-TEMPLATE = subdirs
-
-SUBDIRS+=  statemodel \
-           appruntimemodel
-
-CONFIG += ordered
-
-tests:include(appfoundation_tests.pri)
--- a/appfoundation/appfoundation_tests.pri	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-
-SUBDIRS += ./appruntimemodel/tsrc \           
-           ./statemodel/tsrc
--- a/appfoundation/appruntimemodel/appruntimemodel.pri	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +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:
-#
-
-HEADERS += ./inc/*.h \
-                     ../../homescreensrv_plat/appruntimemodel_api/*.h
-
-SOURCES += ./src/*.cpp
-
--- a/appfoundation/appruntimemodel/appruntimemodel.pro	Fri Jun 11 16:25:06 2010 +0100
+++ /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:
-#
-
-TEMPLATE = lib
-DEPENDPATH += . \
-              inc \
-              src
-INCLUDEPATH += . \
-               inc 
-               
-symbian: {
-TARGET.UID3 = 0x20022F37
-}
-
-# Sources
-include(appruntimemodel.pri)
-include(../../common.pri)
-
-DEFINES += HSRUNTIMEMODEL_LIB
-
-QT += xml
-
--- a/appfoundation/appruntimemodel/inc/hsruntimefactory_p.h	Fri Jun 11 16:25:06 2010 +0100
+++ /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:  HsRuntime factory private implementation..
-*
-*/
-
-
-#ifndef HSRUNTIMEFACTORY_P_H
-#define HSRUNTIMEFACTORY_P_H
-
-#include "hsiruntimeprovider.h"
-
-class HsRuntimeFactory;
-class IHsRuntimeProvider;
-
-class HsRuntimeFactoryPrivate : public QObject
-{
-    Q_OBJECT
-    
-public:
-    HsRuntimeFactoryPrivate(HsRuntimeFactory* aPublic);
-    ~HsRuntimeFactoryPrivate();
-    
-    QList<HsRuntimeToken> runtimes();
-    HsRuntime* createRuntime(const HsRuntimeToken& aToken);
-    IHsRuntimeProvider* loadProviderFromPlugin(const QString& aPluginName);
-
-
-private:
-    Q_DISABLE_COPY(HsRuntimeFactoryPrivate)
-
-public:
-    HsRuntimeFactory* mQ;
-    QString mPluginManifestDirectory;
-    QString mPluginDirectory;
-};
-
-#endif
--- a/appfoundation/appruntimemodel/inc/hsruntimeprovidermanifest.h	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +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:  HsRuntime provider manifest.
-*
-*/
-
-
-#ifndef HSRUNTIMEPROVIDERMANIFEST_H
-#define HSRUNTIMEPROVIDERMANIFEST_H
-
-#include <QObject>
-
-#include "hsruntimemodel_global.h"
-#include "hsiruntimeprovider.h"
-
-class HsRuntimeProviderManifestPrivate;
-
-class HSRUNTIMEMODEL_EXPORT HsRuntimeProviderManifest : public QObject
-{
-    Q_OBJECT
-
-public:
-
-    HsRuntimeProviderManifest(QObject* aParent = 0);   
-    virtual ~HsRuntimeProviderManifest();
-
-    bool loadFromXml(const QString& aFileName) const;
-    QList<HsRuntimeToken> runtimes() const;
-    bool loadOnQuery() const;
-
-private:
-    Q_DISABLE_COPY(HsRuntimeProviderManifest)
-
-private:
-    HsRuntimeProviderManifestPrivate* mD;
-    friend class HsRuntimeProviderManifestPrivate;
-
-};
-
-#endif
--- a/appfoundation/appruntimemodel/inc/hsruntimeprovidermanifest_p.h	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +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:  HsRuntime provider manifest private implementation.
-*
-*/
-
-
-#ifndef HSRUNTIMEPROVIDERMANIFEST_P_H
-#define HSRUNTIMEPROVIDERMANIFEST_P_H
-
-#include <QDomElement>
-
-#include "hsiruntimeprovider.h"
-
-class HsRuntimeProviderManifest;
-
-class HsRuntimeProviderManifestPrivate : public QObject
-{
-    Q_OBJECT
-    
-public:
-    HsRuntimeProviderManifestPrivate(HsRuntimeProviderManifest* aPublic);
-    ~HsRuntimeProviderManifestPrivate();
-
-    QList<HsRuntimeToken> runtimes() const;
-    bool loadFromXml(const QString& aFileName);
-
-private:
-    QString parseAttribute(QDomElement& aElement, const QString& aAttributeName, bool aIsRequired = true) const;
-    Q_DISABLE_COPY(HsRuntimeProviderManifestPrivate)
-
-public:
-
-    HsRuntimeProviderManifest* mQ;
-    QList<HsRuntimeToken> mRuntimeTokens;
-    bool mLoadOnQuery;
-
-};
-
-#endif
--- a/appfoundation/appruntimemodel/src/hsruntimefactory.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,228 +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:  HsRuntime factory.
-*
-*/
-
-
-#include "hsruntimefactory.h"
-#include "hsruntimefactory_p.h"
-#include "hsruntimeprovidermanifest.h"
-#include "hstest_global.h"
-
-#include <QStringList>
-#include <QDir>
-#include <QPluginLoader>
-
-
-HsRuntimeFactoryPrivate::HsRuntimeFactoryPrivate(HsRuntimeFactory* aPublic)
-    : QObject(aPublic),
-      mQ(aPublic)
-{
-
-}
-
-
-HsRuntimeFactoryPrivate::~HsRuntimeFactoryPrivate()
-{
-
-}
-
-QList<HsRuntimeToken> HsRuntimeFactoryPrivate::runtimes()
-{
-    QStringList pluginPaths;
-
-    //Check plugin dirs from root of different drives
-    QFileInfoList drives = QDir::drives();
-    for(int i=0; i < drives.count(); i++)
-    {
-        QFileInfo drive = drives.at(i);
-        QString driveLetter = drive.absolutePath();
-        QString path = driveLetter + mPluginManifestDirectory;
-        if(QDir(path).exists())
-        {
-            pluginPaths << path;
-        }
-    }
-
-    //Check plugin dir relative to current dir
-    if(QDir(mPluginManifestDirectory).exists() && !pluginPaths.contains(QDir(mPluginManifestDirectory).absolutePath()))
-    {
-        pluginPaths << mPluginManifestDirectory;
-    }
-
-    QList<HsRuntimeToken> runtimes;
-
-    for(int h=0; h < pluginPaths.count(); h++)
-    {
-        QString path = pluginPaths.at(h);
-        QDir dir(path);
-        QStringList filters("*.manifest");
-
-        for(int i=0; i < dir.entryList(filters, QDir::Files).count(); ++i)
-        {
-            QString fileName = dir.entryList(filters, QDir::Files).at(i);
-
-            HsRuntimeProviderManifest manifest;
-            manifest.loadFromXml(dir.absoluteFilePath(fileName));
-
-            if(manifest.loadOnQuery())
-            {
-                QList<HsRuntimeToken> tokens = manifest.runtimes();
-                for(int j=0; j < tokens.count(); ++j)
-                {
-                    HsRuntimeToken token = tokens.at(j);
-                    IHsRuntimeProvider* provider = loadProviderFromPlugin(token.mLibrary);
-                    if(provider)
-                    {
-                        runtimes << provider->runtimes();
-                        delete provider;
-                    }
-                }
-            }
-            else
-            {
-                runtimes << manifest.runtimes();
-            }
-        }
-    }
-    return runtimes;
-}
-
-HsRuntime* HsRuntimeFactoryPrivate::createRuntime(const HsRuntimeToken& aToken)
-{
-    IHsRuntimeProvider* provider = loadProviderFromPlugin(aToken.mLibrary);
-    if(!provider)
-    {
-        HSDEBUG("Runtime creation failed - No provider.")
-        return 0;
-    }
-
-    HsRuntime* runtime = provider->createRuntime(aToken);
-    delete provider;
-    if(!runtime)
-    {
-        HSDEBUG("Runtime creation failed.")
-    }
-    return runtime;
-}
-
-IHsRuntimeProvider* HsRuntimeFactoryPrivate::loadProviderFromPlugin(const QString& aPluginName)
-{
-    QStringList pluginPaths;
-
-    //Check plugin dirs from root of different drives
-    QFileInfoList drives = QDir::drives();
-    for(int i=0; i < drives.count(); i++)
-    {
-        QFileInfo drive = drives.at(i);
-        QString driveLetter = drive.absolutePath();
-        QString path = driveLetter + mPluginDirectory;
-        if(QDir(path).exists())
-        {
-            pluginPaths << path;
-        }
-    }
-
-
-    //Check plugin dir relative to current dir
-    if(QDir(mPluginManifestDirectory).exists() && !pluginPaths.contains(QDir(mPluginDirectory).absolutePath()))
-    {
-        pluginPaths << mPluginDirectory;
-    }
-
-    IHsRuntimeProvider* provider = 0;
-    QPluginLoader loader;
-    QObject* plugin = 0;
-
-    for(int i=0; i < pluginPaths.count(); i++)
-    {
-        QString path = pluginPaths.at(i);
-        QString fileName = QDir(path).absoluteFilePath(aPluginName);
-
-        loader.setFileName(fileName);
-        plugin = loader.instance();
-        provider = qobject_cast<IHsRuntimeProvider*>(plugin);
-        if(provider)
-        {
-            return provider;
-        }
-
-        //Don't leak memory if provider not IHsRuntimeProvider
-        if(plugin)
-        {
-            HSDEBUG("Runtime provider load - !provider, deleting plugin.")
-            delete plugin;
-        }
-    }
-
-    HSDEBUG("Runtime provider load failed - Not found.")
-    return 0;
-}
-
-/*!
-    \class HsRuntimeFactory
-    \ingroup group_hsruntimemodel
-    \brief Finds and creates home screen runtimes.
-
-    HsRuntime factory finds home screen runtimes from HsRuntime provider 
-    plugins. The search is done based on given plugin manifest
-    and plugin binary directories. Found runtimes are returned as
-    a list of HsRuntime tokens. HsRuntime factory creates an instance of
-    a HsRuntime base on a HsRuntime token that is given to it.
-*/
-
-/*!
-    Constructor.
-    
-    \a aPluginManifestDirectory Directory that contains plugin manifests.
-    \a aPluginDirectory Directory that contains plugin binaries.
-    \a aParent Parent object.
-*/
-HsRuntimeFactory::HsRuntimeFactory(const QString& aPluginManifestDirectory,
-                               const QString& aPluginDirectory,
-                               QObject* aParent)
-    : QObject(aParent)
-{
-    mD = new HsRuntimeFactoryPrivate(this);
-    mD->mPluginManifestDirectory = aPluginManifestDirectory;
-    mD->mPluginDirectory = aPluginDirectory;
-}
-
-/*!
-    Destructor.    
-*/
-HsRuntimeFactory::~HsRuntimeFactory()
-{
-
-}
-
-/*!
-    Returns found runtimes as a list of HsRuntime tokens.    
-*/
-QList<HsRuntimeToken> HsRuntimeFactory::runtimes()
-{
-    return mD->runtimes();
-}
-
-/*!
-    Creates and returns a HsRuntime based on the given token.    
-    \a aToken Identifies the HsRuntime to be created.
-
-    Return The created HsRuntime.
-*/
-HsRuntime* HsRuntimeFactory::createRuntime(const HsRuntimeToken& aToken)
-{
-    return mD->createRuntime(aToken);
-}
--- a/appfoundation/appruntimemodel/src/hsruntimeprovidermanifest.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,174 +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:  HsRuntime provider manifest.
-*
-*/
-
-
-#include "hsruntimeprovidermanifest.h"
-#include "hsruntimeprovidermanifest_p.h"
-#include "hstest_global.h"
-
-#include <QDomDocument>
-#include <QFile>
-
-HsRuntimeProviderManifestPrivate::HsRuntimeProviderManifestPrivate(HsRuntimeProviderManifest* aPublic)
-    : QObject(aPublic),
-      mQ(aPublic),
-      mLoadOnQuery(false)
-{
-
-}
-
-HsRuntimeProviderManifestPrivate::~HsRuntimeProviderManifestPrivate()
-{
-
-}
-
-bool HsRuntimeProviderManifestPrivate::loadFromXml(const QString& aFileName)
-{
-    mRuntimeTokens.clear();
-
-    QFile file(aFileName);
-    if(!file.exists())
-    {
-        return false;
-    }
-
-    QDomDocument document;
-    if(!document.setContent(&file))
-    {
-        return false;
-    }
-
-    QDomElement element = document.documentElement();
-    if(element.tagName() != "runtimeprovider")
-    {
-        return false;
-    }
-
-    mLoadOnQuery = false;
-    QDomAttr attribute = element.attributeNode("loadonquery");
-	if(attribute.value().toLower() == "true")
-	{
-        mLoadOnQuery = true;
-	}
-
-    QList<HsRuntimeToken> tokens;
-    HsRuntimeToken token;
-
-    QDomNodeList runtimes = element.elementsByTagName("runtime");
-
-    for(int i = 0; i < runtimes.count(); ++i)
-    {
-        element = runtimes.at(i).toElement();
-        token.mLibrary = parseAttribute(element, "library");
-        token.mUri = parseAttribute(element, "uri");
-        tokens << token;
-    }
-
-    mRuntimeTokens = tokens;
-    return true;
-}
-
-QList<HsRuntimeToken> HsRuntimeProviderManifestPrivate::runtimes() const
-{
-    return mRuntimeTokens;
-}
-
-// ---------------------------------------------------------------------------
-// ---------------------------------------------------------------------------
-//
-QString HsRuntimeProviderManifestPrivate::parseAttribute(QDomElement& aElement, 
-                                                       const QString& aAttributeName, 
-                                                       bool aIsRequired) const
-{
-    QDomAttr attribute = aElement.attributeNode(aAttributeName);
-    if(attribute.isNull() || attribute.value().isEmpty())
-    {
-        if(aIsRequired)
-        {
-            HSDEBUG("Required attribute missing")
-        }
-        else
-        {
-            HSDEBUG("Attribute missing")
-        }
-
-        return QString();        
-    }
-
-    return attribute.value();
-}
-
-
-/*!
-    \class HsRuntimeProviderManifest
-    \ingroup group_hsruntimemodel
-    \brief Loads home screen HsRuntime tokens from an XML manifest file.
-    Used by the HsRuntimeFactory for loading HsRuntime tokens from an XML
-    manifest file.
-        
-*/
-
-/*!
-    Constructor. Loads runtimes as HsRuntime tokens from the given
-    manifest file.
-    \a aParent Parent object.
-*/
-HsRuntimeProviderManifest::HsRuntimeProviderManifest(QObject* aParent)
-    : QObject(aParent)
-{
-    mD = new HsRuntimeProviderManifestPrivate(this);
-}
-
-
-/*!
-    Destructor.    
-*/
-HsRuntimeProviderManifest::~HsRuntimeProviderManifest()
-{
-
-}
-
-/*!
-    return loaded runtimes as HsRuntime tokens.    
-*/
-QList<HsRuntimeToken> HsRuntimeProviderManifest::runtimes() const
-{
-    return mD->runtimes();
-}
-
-/*!
-    Tells if the HsRuntime tokens must be asked from plugin
-    instead of manifest file. 
-
-    return True if loading required, false otherwise.
-*/
-bool HsRuntimeProviderManifest::loadOnQuery() const
-{
-	return mD->mLoadOnQuery;
-}
-
-
-/*!
-    Loads runtimes as HsRuntime tokens from a manifest file.    
-    \a aFileName Manifest file name.
-
-    return true if load was succesfull, false otherwise
-*/
-bool HsRuntimeProviderManifest::loadFromXml(const QString& aFileName) const
-{
-	return mD->loadFromXml(aFileName);
-}
--- a/appfoundation/statemodel/inc/hsstatefactory_p.h	Fri Jun 11 16:25:06 2010 +0100
+++ /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:  State factory private implementation.
-*
-*/
-
-
-#ifndef HSSTATEFACTORY_P_H
-#define HSSTATEFACTORY_P_H
-
-#include "hsistateprovider.h"
-
-class QState;
-class HsStateFactory;
-class IHsStateProvider;
-
-class HsStateFactoryPrivate : public QObject
-{
-    Q_OBJECT
-
-public:
-
-    HsStateFactoryPrivate(HsStateFactory* aPublic);
-    ~HsStateFactoryPrivate();
-
-private:
-
-    Q_DISABLE_COPY(HsStateFactoryPrivate)
-
-public:
-    QList<HsStateToken> states();
-    QState* createState(const HsStateToken& aToken);
-    IHsStateProvider* loadProviderFromPlugin(const QString& aPluginName);
-
-public:
-    HsStateFactory* mQ;
-    QString mPluginManifestDirectory;
-    QString mPluginDirectory;
-
-};
-
-#endif
--- a/appfoundation/statemodel/inc/hsstateprovidermanifest.h	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +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:  State provider manifest.
-*
-*/
-
-
-#ifndef HSSTATEPROVIDERMANIFEST_H
-#define HSSTATEPROVIDERMANIFEST_H
-
-#include <QObject>
-
-#include "hsstatemodel_global.h"
-#include "hsistateprovider.h"
-
-class HsStateProviderManifestPrivate;
-
-class HSSTATEMODEL_EXPORT HsStateProviderManifest : public QObject
-{
-    Q_OBJECT
-
-public:
-    HsStateProviderManifest(QObject* aParent = 0);
-    virtual ~HsStateProviderManifest();
-
-    QList<HsStateToken> states() const;
-    bool loadOnQuery() const;
-    bool loadFromXml(const QString& aFileName);
-
-private:
-    Q_DISABLE_COPY(HsStateProviderManifest)
-
-private:
-    HsStateProviderManifestPrivate* mD;
-    friend class HsStateProviderManifestPrivate;
-
-};
-
-#endif
--- a/appfoundation/statemodel/inc/hsstateprovidermanifest_p.h	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +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:  State provider manifest private implementation.
-*
-*/
-
-
-#ifndef HSSTATEPROVIDERMANIFEST_P_H
-#define HSSTATEPROVIDERMANIFEST_P_H
-
-#include <QDomElement>
-
-#include "hsistateprovider.h"
-
-class HsStateProviderManifest;
-class HsStateProviderManifestPrivate : public QObject
-{
-    Q_OBJECT
-    
-public:
-    HsStateProviderManifestPrivate(HsStateProviderManifest* aPublic);
-    ~HsStateProviderManifestPrivate();
-
-    bool loadFromXml(const QString& aFileName);
-    QList<HsStateToken> states() const;
-    
-private:
-    QString parseAttribute(QDomElement& aElement, const QString& aAttributeName, bool aIsRequired = true) const;
-    Q_DISABLE_COPY(HsStateProviderManifestPrivate)
-
-public:
-    HsStateProviderManifest* mQ;
-    QList<HsStateToken> mStateTokens;
-    bool mLoadOnQuery;
-};
-
-#endif
--- a/appfoundation/statemodel/src/hsstatefactory.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,225 +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:  State factory.
-*
-*/
-
-#include <QStringList>
-#include <QDir>
-#include <QPluginLoader>
-#include <QState>
-
-#include "hsstatefactory.h"
-#include "hsstatefactory_p.h"
-#include "hsstateprovidermanifest.h"
-#include "hstest_global.h"
-
-HsStateFactoryPrivate::HsStateFactoryPrivate(HsStateFactory* aPublic)
-    : QObject(aPublic),
-      mQ(aPublic)
-{
-
-}
-
-HsStateFactoryPrivate::~HsStateFactoryPrivate()
-{
-
-}
-
-QList<HsStateToken> HsStateFactoryPrivate::states()
-{
-    QStringList pluginPaths;
-
-    //Check plugin dirs from root of different drives
-    QFileInfoList drives = QDir::drives();
-    for(int i=0; i < drives.count(); i++)
-    {
-        QFileInfo drive = drives.at(i);
-        QString driveLetter = drive.absolutePath();
-        QString path = driveLetter + mPluginManifestDirectory;
-        if(QDir(path).exists())
-        {
-            pluginPaths << path;
-        }
-    }
-
-    //Check plugin dir relative to current dir
-    if(QDir(mPluginManifestDirectory).exists() && !pluginPaths.contains(QDir(mPluginManifestDirectory).absolutePath()))
-    {
-        pluginPaths << mPluginManifestDirectory;
-    }
-
-    QList<HsStateToken> states;
-
-    for(int h=0; h < pluginPaths.count(); h++)
-    {
-        QString path = pluginPaths.at(h);
-        QDir dir(path);
-        QStringList filters("*.manifest");
-
-        for(int i=0; i < dir.entryList(filters, QDir::Files).count(); ++i)
-        {
-            QString fileName = dir.entryList(filters, QDir::Files).at(i);
-
-            HsStateProviderManifest manifest;
-            manifest.loadFromXml(dir.absoluteFilePath(fileName));
-
-            if(manifest.loadOnQuery())
-            {
-                QList<HsStateToken> tokens = manifest.states();
-                for(int j=0; j < tokens.count(); ++j)
-                {
-                    HsStateToken token = tokens.at(j);
-                    IHsStateProvider* provider = loadProviderFromPlugin(token.mLibrary);
-                    if(provider)
-                    {
-                        states << provider->states();
-                        delete provider;
-                    }
-                }
-            }
-            else
-            {
-                states << manifest.states();
-            }
-        }
-    }
-    return states;
-}
-
-QState* HsStateFactoryPrivate::createState(const HsStateToken& aToken)
-{
-    IHsStateProvider* provider = loadProviderFromPlugin(aToken.mLibrary);
-    if(!provider)
-    {
-        HSDEBUG("Widget creation failed - No provider.")
-        return 0;
-    }
-
-    QState* state = provider->createState(aToken);
-    delete provider;
-    if(!state)
-    {
-        HSDEBUG("State creation failed.")
-    }
-    return state;
-}
-
-IHsStateProvider* HsStateFactoryPrivate::loadProviderFromPlugin(const QString& aPluginName)
-{
-    QStringList pluginPaths;
-
-    //Check plugin dirs from root of different drives
-    QFileInfoList drives = QDir::drives();
-    for(int i=0; i < drives.count(); i++)
-    {
-        QFileInfo drive = drives.at(i);
-        QString driveLetter = drive.absolutePath();
-        QString path = driveLetter + mPluginDirectory;
-        if(QDir(path).exists())
-        {
-            pluginPaths << path;
-        }
-    }
-
-
-    //Check plugin dir relative to current dir
-    if(QDir(mPluginManifestDirectory).exists() && !pluginPaths.contains(QDir(mPluginDirectory).absolutePath()))
-    {
-        pluginPaths << mPluginDirectory;
-    }
-
-    IHsStateProvider* provider = 0;
-    QPluginLoader loader;
-    QObject* plugin = 0;
-
-    for(int i=0; i < pluginPaths.count(); i++)
-    {
-        QString path = pluginPaths.at(i);
-        QString fileName = QDir(path).absoluteFilePath(aPluginName);
-
-        loader.setFileName(fileName);
-        plugin = loader.instance();
-        provider = qobject_cast<IHsStateProvider*>(plugin);
-        if(provider)
-        {
-            return provider;
-        }
-
-        //Don't leak memory if provider not IHsStateProvider
-        if(plugin)
-        {
-            HSDEBUG("State provider load - !provider, deleting plugin.")
-            delete plugin;
-        }
-    }
-
-    HSDEBUG("State provider load failed - Not found.")
-    return 0;
-}
-
-/*!
-    \class HsStateFactory
-    \ingroup group_hsstatemodel
-    \brief Finds and creates home screen states.
-    State factory finds home screen states from state provider
-    plugins. The search is done based on given plugin manifest
-    and plugin binary directories. Found states are returned as
-    a list of state tokens. State factory creates an instance of
-    a state base on a state token that is given to it.
-*/
-
-/*!
-    Constructor.
-    \a aPluginManifestDirectory Directory that contains plugin manifests.
-    \a aPluginDirectory Directory that contains plugin binaries.
-    \a aParent Parent object.
-*/
-HsStateFactory::HsStateFactory(const QString& aPluginManifestDirectory,
-                           const QString& aPluginDirectory,
-                           QObject* aParent)
-    : QObject(aParent)
-{
-    mD = new HsStateFactoryPrivate(this);
-    mD->mPluginManifestDirectory = aPluginManifestDirectory;
-    mD->mPluginDirectory = aPluginDirectory;
-}
-
-
-/*!
-    Destructor.
-*/
-HsStateFactory::~HsStateFactory()
-{
-
-}
-
-/*!
-    Returns found states as a list of state tokens.
-*/
-QList<HsStateToken> HsStateFactory::states()
-{
-    return mD->states();
-}
-
-/*!
-    Creates and returns a state based on the given token.
-    \a aToken Identifies the state to be created.
-
-    Returns The created state.
-*/
-QState* HsStateFactory::createState(const HsStateToken& aToken)
-{
-    return mD->createState(aToken);
-}
--- a/appfoundation/statemodel/src/hsstateprovidermanifest.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,164 +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:  State provider manifest.
-*
-*/
-
-
-#include <QDomDocument>
-#include <QFile>
-
-#include "hsstateprovidermanifest.h"
-#include "hsstateprovidermanifest_p.h"
-#include "hstest_global.h"
-
-HsStateProviderManifestPrivate::HsStateProviderManifestPrivate(HsStateProviderManifest* aPublic)
-    : QObject(aPublic),
-      mQ(aPublic),
-      mLoadOnQuery(false)
-{
-}
-
-HsStateProviderManifestPrivate::~HsStateProviderManifestPrivate()
-{
-
-}
-
-bool HsStateProviderManifestPrivate::loadFromXml(const QString& aFileName)
-{
-    mStateTokens.clear();
-
-    QFile file(aFileName);
-    if(!file.exists())
-    {
-        return false;
-    }
-
-    QDomDocument document;
-    if(!document.setContent(&file))
-    {
-        return false;
-    }
-
-    QDomElement element = document.documentElement();
-    if(element.tagName() != "stateprovider")
-    {
-        return false;
-    }
-
-    mLoadOnQuery = false;
-    QDomAttr attribute = element.attributeNode("loadonquery");
-	if(attribute.value().toLower() == "true")
-	{
-        mLoadOnQuery = true;
-	}
-    
-    QList<HsStateToken> tokens;
-    HsStateToken token;
-
-    QDomNodeList states = element.elementsByTagName("state");
-
-    for(int i = 0; i < states.count(); ++i)
-    {
-        element = states.at(i).toElement();
-        token.mLibrary = parseAttribute(element, "library");
-        token.mUri = parseAttribute(element, "uri");
-        tokens << token;
-    }
-
-    mStateTokens = tokens;
-    return true;
-}
-
-QList<HsStateToken> HsStateProviderManifestPrivate::states() const
-{
-    return mStateTokens;
-}
-
-QString HsStateProviderManifestPrivate::parseAttribute(QDomElement& aElement, const QString& aAttributeName, bool aIsRequired) const
-{
-    QDomAttr attribute = aElement.attributeNode(aAttributeName);
-    if(attribute.isNull() || attribute.value().isEmpty())
-    {
-        if(aIsRequired)
-        {
-            HSDEBUG("Required attribute missing")            
-        }
-        else
-        {
-            HSDEBUG("Attribute missing")
-        }
-
-        return QString();
-    }
-
-    return attribute.value();
-}
-
-
-/*!
-    \class HsStateProviderManifest
-    \ingroup group_hsstatemodel
-    \brief Loads home screen state tokens from an XML manifest file.
-    Used by the HsStateFactory for loading state tokens from an XML
-    manifest file.
-*/
-
-/*!
-    Constructor. Loads states as state tokens from the given
-    manifest file.
-    \a aParent Parent object.
-*/
-HsStateProviderManifest::HsStateProviderManifest(QObject* aParent)
-    : QObject(aParent)
-{
-    mD = new HsStateProviderManifestPrivate(this);
-}
-
-/*!
-    Destructor.
-*/
-HsStateProviderManifest::~HsStateProviderManifest()
-{
-
-}
-
-/*!
-    Returns loaded states as state tokens.
-*/
-QList<HsStateToken> HsStateProviderManifest::states() const
-{
-    return mD->states();
-}
-
-/*!
-    Returns true if the state tokens must be asked from plugin
-    instead of manifest file.
-*/
-bool HsStateProviderManifest::loadOnQuery()const
-{
-	return mD->mLoadOnQuery;
-}
-
-/*!
-    Loads states as state tokens from a manifest file.
-    \a aFileName Manifest file name.
-
-    Returns true if load was succesfull, false otherwise
-*/
-bool HsStateProviderManifest::loadFromXml(const QString& aFileName)
-{
-    return mD->loadFromXml(aFileName);
-}
-
--- a/appfoundation/statemodel/statemodel.pri	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +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:
-#
-
-HEADERS += ./inc/*.h \
-                     ../../homescreensrv_plat/statemodel_api/*.h
-
-SOURCES += ./src/*.cpp
-
--- a/appfoundation/statemodel/statemodel.pro	Fri Jun 11 16:25:06 2010 +0100
+++ /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:
-#
-
-TEMPLATE = lib
-DEPENDPATH += . \
-              inc \
-              src
-INCLUDEPATH += . \
-               inc 
-               
-symbian: {
-TARGET.UID3 = 0x20022F3B
-}
-
-# Sources
-include(statemodel.pri)
-include(../../common.pri)
-
-DEFINES += HSSTATEMODEL_LIB
-
-QT += xml
--- a/common.pri	Fri Jun 11 16:25:06 2010 +0100
+++ b/common.pri	Thu Jul 22 16:37:03 2010 +0100
@@ -77,11 +77,9 @@
 
 win32 {
     # add platfrom API for windows
-    INCLUDEPATH += \
-                $$PWD/homescreensrv_plat/appruntimemodel_api \
+    INCLUDEPATH += \                
                 $$PWD/homescreensrv_plat/contentstorage_api \
-                $$PWD/homescreensrv_plat/hswidgetmodel_api \
-                $$PWD/homescreensrv_plat/statemodel_api \
+                $$PWD/homescreensrv_plat/hswidgetmodel_api \                
                 $$PWD/homescreensrv_plat/homescreen_information_api/inc
 }
 
--- a/contentstorage/bwins/camenuu.def	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/bwins/camenuu.def	Thu Jul 22 16:37:03 2010 +0100
@@ -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 Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/bwins/cautilsu.def	Thu Jul 22 16:37:03 2010 +0100
@@ -7,93 +7,98 @@
 	?SetIconId@CCaInnerEntry@@QAEXH@Z @ 6 NONAME ; void CCaInnerEntry::SetIconId(int)
 	?SetUid@CCaInnerEntry@@QAEXJ@Z @ 7 NONAME ; void CCaInnerEntry::SetUid(long)
 	?SetLocalizedStringL@CCaLocalizationEntry@@QAEXABVTDesC16@@@Z @ 8 NONAME ; void CCaLocalizationEntry::SetLocalizedStringL(class TDesC16 const &)
-	?GetText@CCaInnerEntry@@QBEABVRBuf16@@XZ @ 9 NONAME ; class RBuf16 const & CCaInnerEntry::GetText(void) const
-	?InternalizeL@RCaEntriesArray@@QAEXAAVRReadStream@@@Z @ 10 NONAME ; void RCaEntriesArray::InternalizeL(class RReadStream &)
-	?SetIdsL@CCaInnerNotifierFilter@@QAEXABV?$RArray@H@@@Z @ 11 NONAME ; void CCaInnerNotifierFilter::SetIdsL(class RArray<int> const &)
-	?GetTextId@CCaLocalizationEntry@@QBEHXZ @ 12 NONAME ; int CCaLocalizationEntry::GetTextId(void) const
-	?GetUid@CCaInnerEntry@@QBEJXZ @ 13 NONAME ; long CCaInnerEntry::GetUid(void) const
-	?SetId@CCaInnerEntry@@QAEXI@Z @ 14 NONAME ; void CCaInnerEntry::SetId(unsigned int)
-	?GetSort@CCaInnerQuery@@QBE?AW4TSortAttribute@1@XZ @ 15 NONAME ; enum CCaInnerQuery::TSortAttribute CCaInnerQuery::GetSort(void) const
-	?SetCount@CCaInnerQuery@@QAEXI@Z @ 16 NONAME ; void CCaInnerQuery::SetCount(unsigned int)
-	?ExternalizeL@CCaInnerNotifierFilter@@QBEXAAVRWriteStream@@@Z @ 17 NONAME ; void CCaInnerNotifierFilter::ExternalizeL(class RWriteStream &) const
-	?FindAttribute@CCaInnerEntry@@QAEHABVTDesC16@@AAVTDes16@@@Z @ 18 NONAME ; int CCaInnerEntry::FindAttribute(class TDesC16 const &, class TDes16 &)
-	?Find@RCaEntryAttrArray@@QAEHABVTDesC16@@AAVTDes16@@@Z @ 19 NONAME ; int RCaEntryAttrArray::Find(class TDesC16 const &, class TDes16 &)
-	?SetRowId@CCaLocalizationEntry@@QAEXI@Z @ 20 NONAME ; void CCaLocalizationEntry::SetRowId(unsigned int)
-	?GetUid@CCaInnerQuery@@QBEIXZ @ 21 NONAME ; unsigned int CCaInnerQuery::GetUid(void) const
-	?SetFlags@CCaInnerEntry@@QAEXI@Z @ 22 NONAME ; void CCaInnerEntry::SetFlags(unsigned int)
-	?SetAttributeNameL@CCaLocalizationEntry@@QAEXABVTDesC16@@@Z @ 23 NONAME ; void CCaLocalizationEntry::SetAttributeNameL(class TDesC16 const &)
-	?GetCount@CCaInnerQuery@@QBEIXZ @ 24 NONAME ; unsigned int CCaInnerQuery::GetCount(void) const
-	?GetParentId@CCaInnerNotifierFilter@@QBEHXZ @ 25 NONAME ; int CCaInnerNotifierFilter::GetParentId(void) const
-	?SetId@CCaInnerIconDescription@@QAEXH@Z @ 26 NONAME ; void CCaInnerIconDescription::SetId(int)
-	?GetStringId@CCaLocalizationEntry@@QBEABVRBuf16@@XZ @ 27 NONAME ; class RBuf16 const & CCaLocalizationEntry::GetStringId(void) const
-	?GetFlags@CCaInnerEntry@@QBEIXZ @ 28 NONAME ; unsigned int CCaInnerEntry::GetFlags(void) const
-	?NewL@CCaInnerIconDescription@@SAPAV1@XZ @ 29 NONAME ; class CCaInnerIconDescription * CCaInnerIconDescription::NewL(void)
-	?NewL@CCaEntryAttribute@@SAPAV1@ABVTDesC16@@@Z @ 30 NONAME ; class CCaEntryAttribute * CCaEntryAttribute::NewL(class TDesC16 const &)
-	?Find@RCaEntryAttrArray@@QAEHABVTDesC16@@AAVTPtrC16@@@Z @ 31 NONAME ; int RCaEntryAttrArray::Find(class TDesC16 const &, class TPtrC16 &)
-	?SetFileNameL@CCaInnerIconDescription@@QAEXABVTDesC16@@@Z @ 32 NONAME ; void CCaInnerIconDescription::SetFileNameL(class TDesC16 const &)
-	?SetParentId@CCaInnerNotifierFilter@@QAEXH@Z @ 33 NONAME ; void CCaInnerNotifierFilter::SetParentId(int)
-	?SetFlagsOn@CCaInnerQuery@@QAEXI@Z @ 34 NONAME ; void CCaInnerQuery::SetFlagsOn(unsigned int)
-	?SetTypeNames@CCaInnerNotifierFilter@@QAEXPAVCDesC16ArrayFlat@@@Z @ 35 NONAME ; void CCaInnerNotifierFilter::SetTypeNames(class CDesC16ArrayFlat *)
-	?NewLC@CCaLocalizationEntry@@SAPAV1@XZ @ 36 NONAME ; class CCaLocalizationEntry * CCaLocalizationEntry::NewLC(void)
-	?NewL@CCaInnerNotifierFilter@@SAPAV1@W4TNotifierType@1@@Z @ 37 NONAME ; class CCaInnerNotifierFilter * CCaInnerNotifierFilter::NewL(enum CCaInnerNotifierFilter::TNotifierType)
-	?GetTableName@CCaLocalizationEntry@@QBEABVRBuf16@@XZ @ 38 NONAME ; class RBuf16 const & CCaLocalizationEntry::GetTableName(void) const
-	?GetFlagsOff@CCaInnerQuery@@QBEIXZ @ 39 NONAME ; unsigned int CCaInnerQuery::GetFlagsOff(void) const
-	?InternalizeL@CCaInnerEntry@@QAEXAAVRReadStream@@@Z @ 40 NONAME ; void CCaInnerEntry::InternalizeL(class RReadStream &)
-	?GetAttributeName@CCaLocalizationEntry@@QBEABVRBuf16@@XZ @ 41 NONAME ; class RBuf16 const & CCaLocalizationEntry::GetAttributeName(void) const
-	?GetTUint@MenuUtils@@SAHABVTDesC16@@AAI@Z @ 42 NONAME ; int MenuUtils::GetTUint(class TDesC16 const &, unsigned int &)
-	?AddAttributeL@CCaInnerQuery@@QAEXABVTDesC16@@0@Z @ 43 NONAME ; void CCaInnerQuery::AddAttributeL(class TDesC16 const &, class TDesC16 const &)
-	?Exist@RCaEntryAttrArray@@QAEHABVTDesC16@@@Z @ 44 NONAME ; int RCaEntryAttrArray::Exist(class TDesC16 const &)
-	?AddAttributeL@CCaInnerEntry@@QAEXABVTDesC16@@0@Z @ 45 NONAME ; void CCaInnerEntry::AddAttributeL(class TDesC16 const &, class TDesC16 const &)
-	?GetParentId@CCaInnerQuery@@QBEHXZ @ 46 NONAME ; int CCaInnerQuery::GetParentId(void) const
-	?SetDescriptionL@CCaInnerEntry@@QAEXABVTDesC16@@@Z @ 47 NONAME ; void CCaInnerEntry::SetDescriptionL(class TDesC16 const &)
+	?GetQmFilename@CCaLocalizationEntry@@QBEABVRBuf16@@XZ @ 9 NONAME ; class RBuf16 const & CCaLocalizationEntry::GetQmFilename(void) const
+	?GetText@CCaInnerEntry@@QBEABVRBuf16@@XZ @ 10 NONAME ; class RBuf16 const & CCaInnerEntry::GetText(void) const
+	?InternalizeL@RCaEntriesArray@@QAEXAAVRReadStream@@@Z @ 11 NONAME ; void RCaEntriesArray::InternalizeL(class RReadStream &)
+	?SetIdsL@CCaInnerNotifierFilter@@QAEXABV?$RArray@H@@@Z @ 12 NONAME ; void CCaInnerNotifierFilter::SetIdsL(class RArray<int> const &)
+	?GetTextId@CCaLocalizationEntry@@QBEHXZ @ 13 NONAME ; int CCaLocalizationEntry::GetTextId(void) const
+	?GetUid@CCaInnerEntry@@QBEJXZ @ 14 NONAME ; long CCaInnerEntry::GetUid(void) const
+	?SetId@CCaInnerEntry@@QAEXI@Z @ 15 NONAME ; void CCaInnerEntry::SetId(unsigned int)
+	?GetSort@CCaInnerQuery@@QBE?AW4TSortAttribute@1@XZ @ 16 NONAME ; enum CCaInnerQuery::TSortAttribute CCaInnerQuery::GetSort(void) const
+	?SetCount@CCaInnerQuery@@QAEXI@Z @ 17 NONAME ; void CCaInnerQuery::SetCount(unsigned int)
+	?ExternalizeL@CCaInnerNotifierFilter@@QBEXAAVRWriteStream@@@Z @ 18 NONAME ; void CCaInnerNotifierFilter::ExternalizeL(class RWriteStream &) const
+	?FindAttribute@CCaInnerEntry@@QAEHABVTDesC16@@AAVTDes16@@@Z @ 19 NONAME ; int CCaInnerEntry::FindAttribute(class TDesC16 const &, class TDes16 &)
+	?Find@RCaEntryAttrArray@@QAEHABVTDesC16@@AAVTDes16@@@Z @ 20 NONAME ; int RCaEntryAttrArray::Find(class TDesC16 const &, class TDes16 &)
+	?SetRowId@CCaLocalizationEntry@@QAEXI@Z @ 21 NONAME ; void CCaLocalizationEntry::SetRowId(unsigned int)
+	?GetUid@CCaInnerQuery@@QBEIXZ @ 22 NONAME ; unsigned int CCaInnerQuery::GetUid(void) const
+	?SetFlags@CCaInnerEntry@@QAEXI@Z @ 23 NONAME ; void CCaInnerEntry::SetFlags(unsigned int)
+	?SetAttributeNameL@CCaLocalizationEntry@@QAEXABVTDesC16@@@Z @ 24 NONAME ; void CCaLocalizationEntry::SetAttributeNameL(class TDesC16 const &)
+	?GetCount@CCaInnerQuery@@QBEIXZ @ 25 NONAME ; unsigned int CCaInnerQuery::GetCount(void) const
+	?GetParentId@CCaInnerNotifierFilter@@QBEHXZ @ 26 NONAME ; int CCaInnerNotifierFilter::GetParentId(void) const
+	?SetId@CCaInnerIconDescription@@QAEXH@Z @ 27 NONAME ; void CCaInnerIconDescription::SetId(int)
+	?GetStringId@CCaLocalizationEntry@@QBEABVRBuf16@@XZ @ 28 NONAME ; class RBuf16 const & CCaLocalizationEntry::GetStringId(void) const
+	?GetFlags@CCaInnerEntry@@QBEIXZ @ 29 NONAME ; unsigned int CCaInnerEntry::GetFlags(void) const
+	?NewL@CCaInnerIconDescription@@SAPAV1@XZ @ 30 NONAME ; class CCaInnerIconDescription * CCaInnerIconDescription::NewL(void)
+	?NewL@CCaEntryAttribute@@SAPAV1@ABVTDesC16@@@Z @ 31 NONAME ; class CCaEntryAttribute * CCaEntryAttribute::NewL(class TDesC16 const &)
+	?Find@RCaEntryAttrArray@@QAEHABVTDesC16@@AAVTPtrC16@@@Z @ 32 NONAME ; int RCaEntryAttrArray::Find(class TDesC16 const &, class TPtrC16 &)
+	?SetFileNameL@CCaInnerIconDescription@@QAEXABVTDesC16@@@Z @ 33 NONAME ; void CCaInnerIconDescription::SetFileNameL(class TDesC16 const &)
+	?SetParentId@CCaInnerNotifierFilter@@QAEXH@Z @ 34 NONAME ; void CCaInnerNotifierFilter::SetParentId(int)
+	?SetFlagsOn@CCaInnerQuery@@QAEXI@Z @ 35 NONAME ; void CCaInnerQuery::SetFlagsOn(unsigned int)
+	?SetTypeNames@CCaInnerNotifierFilter@@QAEXPAVCDesC16ArrayFlat@@@Z @ 36 NONAME ; void CCaInnerNotifierFilter::SetTypeNames(class CDesC16ArrayFlat *)
+	?NewLC@CCaLocalizationEntry@@SAPAV1@XZ @ 37 NONAME ; class CCaLocalizationEntry * CCaLocalizationEntry::NewLC(void)
+	?NewL@CCaInnerNotifierFilter@@SAPAV1@W4TNotifierType@1@@Z @ 38 NONAME ; class CCaInnerNotifierFilter * CCaInnerNotifierFilter::NewL(enum CCaInnerNotifierFilter::TNotifierType)
+	?GetTableName@CCaLocalizationEntry@@QBEABVRBuf16@@XZ @ 39 NONAME ; class RBuf16 const & CCaLocalizationEntry::GetTableName(void) const
+	?GetFlagsOff@CCaInnerQuery@@QBEIXZ @ 40 NONAME ; unsigned int CCaInnerQuery::GetFlagsOff(void) const
+	?InternalizeL@CCaInnerEntry@@QAEXAAVRReadStream@@@Z @ 41 NONAME ; void CCaInnerEntry::InternalizeL(class RReadStream &)
+	?GetAttributeName@CCaLocalizationEntry@@QBEABVRBuf16@@XZ @ 42 NONAME ; class RBuf16 const & CCaLocalizationEntry::GetAttributeName(void) const
+	?GetTUint@MenuUtils@@SAHABVTDesC16@@AAI@Z @ 43 NONAME ; int MenuUtils::GetTUint(class TDesC16 const &, unsigned int &)
+	?AddAttributeL@CCaInnerQuery@@QAEXABVTDesC16@@0@Z @ 44 NONAME ; void CCaInnerQuery::AddAttributeL(class TDesC16 const &, class TDesC16 const &)
+	?Exist@RCaEntryAttrArray@@QAEHABVTDesC16@@@Z @ 45 NONAME ; int RCaEntryAttrArray::Exist(class TDesC16 const &)
+	?AddAttributeL@CCaInnerEntry@@QAEXABVTDesC16@@0@Z @ 46 NONAME ; void CCaInnerEntry::AddAttributeL(class TDesC16 const &, class TDesC16 const &)
+	?GetParentId@CCaInnerQuery@@QBEHXZ @ 47 NONAME ; int CCaInnerQuery::GetParentId(void) const
 	?SetEntryRole@CCaInnerNotifierFilter@@QAEXW4TEntryRole@@@Z @ 48 NONAME ; void CCaInnerNotifierFilter::SetEntryRole(enum TEntryRole)
 	?GetFlagsOn@CCaInnerQuery@@QBEIXZ @ 49 NONAME ; unsigned int CCaInnerQuery::GetFlagsOn(void) const
 	?GetIconId@CCaInnerEntry@@QBEHXZ @ 50 NONAME ; int CCaInnerEntry::GetIconId(void) const
 	?SetIconDataL@CCaInnerEntry@@QAEXABVTDesC16@@00@Z @ 51 NONAME ; void CCaInnerEntry::SetIconDataL(class TDesC16 const &, class TDesC16 const &, class TDesC16 const &)
 	?GetEntryRole@CCaInnerNotifierFilter@@QBE?AW4TEntryRole@@XZ @ 52 NONAME ; enum TEntryRole CCaInnerNotifierFilter::GetEntryRole(void) const
 	?GetId@CCaInnerEntry@@QBEHXZ @ 53 NONAME ; int CCaInnerEntry::GetId(void) const
-	?SetEntryTypeNames@CCaInnerQuery@@QAEXPAVCDesC16ArrayFlat@@@Z @ 54 NONAME ; void CCaInnerQuery::SetEntryTypeNames(class CDesC16ArrayFlat *)
-	?GetNotifierType@CCaInnerNotifierFilter@@QBE?AW4TNotifierType@1@XZ @ 55 NONAME ; enum CCaInnerNotifierFilter::TNotifierType CCaInnerNotifierFilter::GetNotifierType(void) const
-	?ExternalizeL@CCaInnerEntry@@QBEXAAVRWriteStream@@@Z @ 56 NONAME ; void CCaInnerEntry::ExternalizeL(class RWriteStream &) const
-	?SetRole@CCaInnerQuery@@QAEXH@Z @ 57 NONAME ; void CCaInnerQuery::SetRole(int)
-	?NewL@CCaLocalizationEntry@@SAPAV1@XZ @ 58 NONAME ; class CCaLocalizationEntry * CCaLocalizationEntry::NewL(void)
-	?InternalizeL@CCaInnerNotifierFilter@@QAEXAAVRReadStream@@@Z @ 59 NONAME ; void CCaInnerNotifierFilter::InternalizeL(class RReadStream &)
-	?InternalizeL@RCaIdsArray@@QAEXAAVRReadStream@@@Z @ 60 NONAME ; void RCaIdsArray::InternalizeL(class RReadStream &)
-	?MarshalDataLC@RCaIdsArray@@QBEPAVHBufC8@@XZ @ 61 NONAME ; class HBufC8 * RCaIdsArray::MarshalDataLC(void) const
-	?GetEntryTypeNames@CCaInnerQuery@@QBEPBVCDesC16ArrayFlat@@XZ @ 62 NONAME ; class CDesC16ArrayFlat const * CCaInnerQuery::GetEntryTypeNames(void) const
-	?SetValueL@CCaEntryAttribute@@QAEXABVTDesC16@@@Z @ 63 NONAME ; void CCaEntryAttribute::SetValueL(class TDesC16 const &)
-	?SetSkinIdL@CCaInnerIconDescription@@QAEXABVTDesC16@@@Z @ 64 NONAME ; void CCaInnerIconDescription::SetSkinIdL(class TDesC16 const &)
-	?ExternalizeL@CCaInnerQuery@@QBEXAAVRWriteStream@@@Z @ 65 NONAME ; void CCaInnerQuery::ExternalizeL(class RWriteStream &) const
-	?GetLocalizedString@CCaLocalizationEntry@@QBEABVRBuf16@@XZ @ 66 NONAME ; class RBuf16 const & CCaLocalizationEntry::GetLocalizedString(void) const
-	?InternalizeL@CCaInnerQuery@@QAEXAAVRReadStream@@@Z @ 67 NONAME ; void CCaInnerQuery::InternalizeL(class RReadStream &)
-	?NewLC@CCaEntryAttribute@@SAPAV1@ABVTDesC16@@@Z @ 68 NONAME ; class CCaEntryAttribute * CCaEntryAttribute::NewLC(class TDesC16 const &)
-	?GetTypeNames@CCaInnerNotifierFilter@@QBEPAVCDesC16ArrayFlat@@XZ @ 69 NONAME ; class CDesC16ArrayFlat * CCaInnerNotifierFilter::GetTypeNames(void) const
-	?NewL@CCaInnerEntry@@SAPAV1@XZ @ 70 NONAME ; class CCaInnerEntry * CCaInnerEntry::NewL(void)
-	?SetRole@CCaInnerEntry@@QAEXI@Z @ 71 NONAME ; void CCaInnerEntry::SetRole(unsigned int)
-	?NewLC@CCaInnerEntry@@SAPAV1@XZ @ 72 NONAME ; class CCaInnerEntry * CCaInnerEntry::NewLC(void)
-	?SetTableNameL@CCaLocalizationEntry@@QAEXABVTDesC16@@@Z @ 73 NONAME ; void CCaLocalizationEntry::SetTableNameL(class TDesC16 const &)
-	?GetAttributes@CCaInnerEntry@@QBEABVRCaEntryAttrArray@@XZ @ 74 NONAME ; class RCaEntryAttrArray const & CCaInnerEntry::GetAttributes(void) const
-	?GetRowId@CCaLocalizationEntry@@QBEHXZ @ 75 NONAME ; int CCaLocalizationEntry::GetRowId(void) const
-	?NewLC@CCaInnerIconDescription@@SAPAV1@XZ @ 76 NONAME ; class CCaInnerIconDescription * CCaInnerIconDescription::NewLC(void)
-	?SetIdsL@CCaInnerQuery@@QAEXABV?$RArray@H@@@Z @ 77 NONAME ; void CCaInnerQuery::SetIdsL(class RArray<int> const &)
-	?SetFlagsOff@CCaInnerQuery@@QAEXI@Z @ 78 NONAME ; void CCaInnerQuery::SetFlagsOff(unsigned int)
-	?Icon@CCaInnerEntry@@QBEPBVCCaInnerIconDescription@@XZ @ 79 NONAME ; class CCaInnerIconDescription const * CCaInnerEntry::Icon(void) const
-	?SetApplicationIdL@CCaInnerIconDescription@@QAEXABVTDesC16@@@Z @ 80 NONAME ; void CCaInnerIconDescription::SetApplicationIdL(class TDesC16 const &)
-	?FindAttribute@CCaInnerEntry@@QAEHABVTDesC16@@AAVTPtrC16@@@Z @ 81 NONAME ; int CCaInnerEntry::FindAttribute(class TDesC16 const &, class TPtrC16 &)
-	?RemoveAttributeL@CCaInnerEntry@@QAEXABVTDesC16@@@Z @ 82 NONAME ; void CCaInnerEntry::RemoveAttributeL(class TDesC16 const &)
-	?GetRole@CCaInnerEntry@@QBEIXZ @ 83 NONAME ; unsigned int CCaInnerEntry::GetRole(void) const
-	?GetIds@CCaInnerQuery@@QBEABV?$RArray@H@@XZ @ 84 NONAME ; class RArray<int> const & CCaInnerQuery::GetIds(void) const
-	?ExternalizeL@RCaEntriesArray@@QBEXAAVRWriteStream@@@Z @ 85 NONAME ; void RCaEntriesArray::ExternalizeL(class RWriteStream &) const
-	?NewL@CCaInnerQuery@@SAPAV1@XZ @ 86 NONAME ; class CCaInnerQuery * CCaInnerQuery::NewL(void)
-	?SetUid@CCaInnerQuery@@QAEXI@Z @ 87 NONAME ; void CCaInnerQuery::SetUid(unsigned int)
-	?GetDescription@CCaInnerEntry@@QBEABVRBuf16@@XZ @ 88 NONAME ; class RBuf16 const & CCaInnerEntry::GetDescription(void) const
-	?GetRole@CCaInnerQuery@@QBEHXZ @ 89 NONAME ; int CCaInnerQuery::GetRole(void) const
-	?GetEntryTypeName@CCaInnerEntry@@QBEABVRBuf16@@XZ @ 90 NONAME ; class RBuf16 const & CCaInnerEntry::GetEntryTypeName(void) const
-	?NewLC@CCaInnerQuery@@SAPAV1@XZ @ 91 NONAME ; class CCaInnerQuery * CCaInnerQuery::NewLC(void)
-	?SetTextL@CCaInnerEntry@@QAEXABVTDesC16@@@Z @ 92 NONAME ; void CCaInnerEntry::SetTextL(class TDesC16 const &)
-	?SetParentId@CCaInnerQuery@@QAEXH@Z @ 93 NONAME ; void CCaInnerQuery::SetParentId(int)
-	?GetIds@CCaInnerNotifierFilter@@QBE?AV?$RArray@H@@XZ @ 94 NONAME ; class RArray<int> CCaInnerNotifierFilter::GetIds(void) const
-	?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 &)
+	?SetDescriptionL@CCaInnerEntry@@QAEXABVTDesC16@@H@Z @ 54 NONAME ; void CCaInnerEntry::SetDescriptionL(class TDesC16 const &, int)
+	?SetEntryTypeNames@CCaInnerQuery@@QAEXPAVCDesC16ArrayFlat@@@Z @ 55 NONAME ; void CCaInnerQuery::SetEntryTypeNames(class CDesC16ArrayFlat *)
+	?GetNotifierType@CCaInnerNotifierFilter@@QBE?AW4TNotifierType@1@XZ @ 56 NONAME ; enum CCaInnerNotifierFilter::TNotifierType CCaInnerNotifierFilter::GetNotifierType(void) const
+	?SetTextL@CCaInnerEntry@@QAEXABVTDesC16@@H@Z @ 57 NONAME ; void CCaInnerEntry::SetTextL(class TDesC16 const &, int)
+	?ExternalizeL@CCaInnerEntry@@QBEXAAVRWriteStream@@@Z @ 58 NONAME ; void CCaInnerEntry::ExternalizeL(class RWriteStream &) const
+	?SetRole@CCaInnerQuery@@QAEXH@Z @ 59 NONAME ; void CCaInnerQuery::SetRole(int)
+	?NewL@CCaLocalizationEntry@@SAPAV1@XZ @ 60 NONAME ; class CCaLocalizationEntry * CCaLocalizationEntry::NewL(void)
+	?InternalizeL@CCaInnerNotifierFilter@@QAEXAAVRReadStream@@@Z @ 61 NONAME ; void CCaInnerNotifierFilter::InternalizeL(class RReadStream &)
+	?InternalizeL@RCaIdsArray@@QAEXAAVRReadStream@@@Z @ 62 NONAME ; void RCaIdsArray::InternalizeL(class RReadStream &)
+	?SetQmFilenameL@CCaLocalizationEntry@@QAEXABVTDesC16@@@Z @ 63 NONAME ; void CCaLocalizationEntry::SetQmFilenameL(class TDesC16 const &)
+	?MarshalDataLC@RCaIdsArray@@QBEPAVHBufC8@@XZ @ 64 NONAME ; class HBufC8 * RCaIdsArray::MarshalDataLC(void) const
+	?GetEntryTypeNames@CCaInnerQuery@@QBEPBVCDesC16ArrayFlat@@XZ @ 65 NONAME ; class CDesC16ArrayFlat const * CCaInnerQuery::GetEntryTypeNames(void) const
+	?SetValueL@CCaEntryAttribute@@QAEXABVTDesC16@@@Z @ 66 NONAME ; void CCaEntryAttribute::SetValueL(class TDesC16 const &)
+	?SetSkinIdL@CCaInnerIconDescription@@QAEXABVTDesC16@@@Z @ 67 NONAME ; void CCaInnerIconDescription::SetSkinIdL(class TDesC16 const &)
+	?ExternalizeL@CCaInnerQuery@@QBEXAAVRWriteStream@@@Z @ 68 NONAME ; void CCaInnerQuery::ExternalizeL(class RWriteStream &) const
+	?GetLocalizedString@CCaLocalizationEntry@@QBEABVRBuf16@@XZ @ 69 NONAME ; class RBuf16 const & CCaLocalizationEntry::GetLocalizedString(void) const
+	?InternalizeL@CCaInnerQuery@@QAEXAAVRReadStream@@@Z @ 70 NONAME ; void CCaInnerQuery::InternalizeL(class RReadStream &)
+	?NewLC@CCaEntryAttribute@@SAPAV1@ABVTDesC16@@@Z @ 71 NONAME ; class CCaEntryAttribute * CCaEntryAttribute::NewLC(class TDesC16 const &)
+	?GetTypeNames@CCaInnerNotifierFilter@@QBEPAVCDesC16ArrayFlat@@XZ @ 72 NONAME ; class CDesC16ArrayFlat * CCaInnerNotifierFilter::GetTypeNames(void) const
+	?NewL@CCaInnerEntry@@SAPAV1@XZ @ 73 NONAME ; class CCaInnerEntry * CCaInnerEntry::NewL(void)
+	?SetRole@CCaInnerEntry@@QAEXI@Z @ 74 NONAME ; void CCaInnerEntry::SetRole(unsigned int)
+	?NewLC@CCaInnerEntry@@SAPAV1@XZ @ 75 NONAME ; class CCaInnerEntry * CCaInnerEntry::NewLC(void)
+	?SetTableNameL@CCaLocalizationEntry@@QAEXABVTDesC16@@@Z @ 76 NONAME ; void CCaLocalizationEntry::SetTableNameL(class TDesC16 const &)
+	?GetAttributes@CCaInnerEntry@@QBEABVRCaEntryAttrArray@@XZ @ 77 NONAME ; class RCaEntryAttrArray const & CCaInnerEntry::GetAttributes(void) const
+	?GetRowId@CCaLocalizationEntry@@QBEHXZ @ 78 NONAME ; int CCaLocalizationEntry::GetRowId(void) const
+	?NewLC@CCaInnerIconDescription@@SAPAV1@XZ @ 79 NONAME ; class CCaInnerIconDescription * CCaInnerIconDescription::NewLC(void)
+	?SetIdsL@CCaInnerQuery@@QAEXABV?$RArray@H@@@Z @ 80 NONAME ; void CCaInnerQuery::SetIdsL(class RArray<int> const &)
+	?SetFlagsOff@CCaInnerQuery@@QAEXI@Z @ 81 NONAME ; void CCaInnerQuery::SetFlagsOff(unsigned int)
+	?Icon@CCaInnerEntry@@QBEPBVCCaInnerIconDescription@@XZ @ 82 NONAME ; class CCaInnerIconDescription const * CCaInnerEntry::Icon(void) const
+	?SetApplicationIdL@CCaInnerIconDescription@@QAEXABVTDesC16@@@Z @ 83 NONAME ; void CCaInnerIconDescription::SetApplicationIdL(class TDesC16 const &)
+	?FindAttribute@CCaInnerEntry@@QAEHABVTDesC16@@AAVTPtrC16@@@Z @ 84 NONAME ; int CCaInnerEntry::FindAttribute(class TDesC16 const &, class TPtrC16 &)
+	?RemoveAttributeL@CCaInnerEntry@@QAEXABVTDesC16@@@Z @ 85 NONAME ; void CCaInnerEntry::RemoveAttributeL(class TDesC16 const &)
+	?GetRole@CCaInnerEntry@@QBEIXZ @ 86 NONAME ; unsigned int CCaInnerEntry::GetRole(void) const
+	?GetIds@CCaInnerQuery@@QBEABV?$RArray@H@@XZ @ 87 NONAME ; class RArray<int> const & CCaInnerQuery::GetIds(void) const
+	?ExternalizeL@RCaEntriesArray@@QBEXAAVRWriteStream@@@Z @ 88 NONAME ; void RCaEntriesArray::ExternalizeL(class RWriteStream &) const
+	?NewL@CCaInnerQuery@@SAPAV1@XZ @ 89 NONAME ; class CCaInnerQuery * CCaInnerQuery::NewL(void)
+	?isLocalized@CCaInnerEntry@@QBEHW4TLocalizedType@1@@Z @ 90 NONAME ; int CCaInnerEntry::isLocalized(enum CCaInnerEntry::TLocalizedType) const
+	?SetUid@CCaInnerQuery@@QAEXI@Z @ 91 NONAME ; void CCaInnerQuery::SetUid(unsigned int)
+	?GetDescription@CCaInnerEntry@@QBEABVRBuf16@@XZ @ 92 NONAME ; class RBuf16 const & CCaInnerEntry::GetDescription(void) const
+	?GetRole@CCaInnerQuery@@QBEHXZ @ 93 NONAME ; int CCaInnerQuery::GetRole(void) const
+	?GetEntryTypeName@CCaInnerEntry@@QBEABVRBuf16@@XZ @ 94 NONAME ; class RBuf16 const & CCaInnerEntry::GetEntryTypeName(void) const
+	?NewLC@CCaInnerQuery@@SAPAV1@XZ @ 95 NONAME ; class CCaInnerQuery * CCaInnerQuery::NewLC(void)
+	?SetParentId@CCaInnerQuery@@QAEXH@Z @ 96 NONAME ; void CCaInnerQuery::SetParentId(int)
+	?GetIds@CCaInnerNotifierFilter@@QBE?AV?$RArray@H@@XZ @ 97 NONAME ; class RArray<int> CCaInnerNotifierFilter::GetIds(void) const
+	?SetStringIdL@CCaLocalizationEntry@@QAEXABVTDesC16@@@Z @ 98 NONAME ; void CCaLocalizationEntry::SetStringIdL(class TDesC16 const &)
+	?SetTextId@CCaLocalizationEntry@@QAEXI@Z @ 99 NONAME ; void CCaLocalizationEntry::SetTextId(unsigned int)
+	?RemoveAttribute@RCaEntryAttrArray@@QAEXABVTDesC16@@@Z @ 100 NONAME ; void RCaEntryAttrArray::RemoveAttribute(class TDesC16 const &)
+	?GetChildId@CCaInnerQuery@@QBEHXZ @ 101 NONAME ; int CCaInnerQuery::GetChildId(void) const
+	?SetChildId@CCaInnerQuery@@QAEXH@Z @ 102 NONAME ; void CCaInnerQuery::SetChildId(int)
 
--- a/contentstorage/caclient/caclient.pri	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/caclient/caclient.pri	Thu Jul 22 16:37:03 2010 +0100
@@ -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/caclient.pro	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/caclient/caclient.pro	Thu Jul 22 16:37:03 2010 +0100
@@ -53,7 +53,9 @@
         -lxqutils \
         -lsif \
         -lscrclient \
-        -laknicon
+        -laknicon \
+        -lapgrfx \
+        -lapparc
 
 include(caclient_s60.pri)
 }
@@ -63,8 +65,6 @@
               ./stub/src
 INCLUDEPATH += ./stub/inc
 
-LIBS += -lhswidgetmodel
-
 QT += sql
 
 include(caclient_stub.pri)
--- a/contentstorage/caclient/inc/caclient_defines.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/caclient/inc/caclient_defines.h	Thu Jul 22 16:37:03 2010 +0100
@@ -15,9 +15,15 @@
  *
  */
 
-const char APPLICATION_UID_ATTRIBUTE_NAME[]  = "application:uid";
+#ifndef CACLIENT_DEFINES_H
+#define CACLIENT_DEFINES_H
+
+const char APPLICATION_UID_ATTRIBUTE_NAME[] = "application:uid";
+const char UNINSTALL_PROGRESS_APPLICATION_ATTRIBUTE_NAME[] = "uninstall_progress";
 const char APPLICATION_ENTRY_TYPE_NAME[] = "application";
 const char WIDGET_ENTRY_TYPE_NAME[] = "widget";
 const char URL_ENTRY_TYPE_NAME[] = "url";
 const char PACKAGE_ENTRY_TYPE_NAME[] = "package";
 const char TEMPLATED_APPLICATION_ENTRY_TYPE_NAME[] = "templatedApplication";
+
+#endif //CACLIENT_DEFINES_H
--- a/contentstorage/caclient/inc/caentry_p.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/caclient/inc/caentry_p.h	Thu Jul 22 16:37:03 2010 +0100
@@ -43,10 +43,10 @@
     void setId(int id);
 
     QString text() const;
-    void setText(const QString &text);
+    void setText(const QString &text, bool localized = false);
 
     QString description() const;
-    void setDescription(const QString &text);
+    void setDescription(const QString &text, bool localized = false);
 
     CaIconDescription iconDescription() const;
     void setIconDescription(const CaIconDescription &iconDescription);
@@ -65,6 +65,8 @@
 
     EntryRole role() const;
     void setRole(const EntryRole &role);
+    
+    bool isLocalized(LocalizationType localized) const;
 
 private:
 
@@ -85,6 +87,10 @@
     QMap<QString, QString> mAttributes;
 
     EntryRole mEntryRole;
+    
+    bool mTextLocalized;
+    
+    bool mDescriptionLocalized;
 };
 
 #endif // CAENTRY_PRIVATE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contentstorage/caclient/inc/cahandler.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
+#ifndef CAHANDLER_H
+#define CAHANDLER_H
+
+#include <QObject>
+#include <cadefs.h>
+#include <caclient_global.h>
+
+class QString;
+class CaEntry;
+
+class CaHandler // move this header to caclient/inc
+{
+public:
+    virtual ~CaHandler() {}
+    virtual int execute(const CaEntry &entry,
+                        const QString &commandName) = 0;
+};
+
+Q_DECLARE_INTERFACE(CaHandler, "com.nokia.homescreen.ICommandHandler")
+
+#endif // CAHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contentstorage/caclient/inc/cahandlerloader.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
+
+#ifndef CAHANDLERLOADER_H
+#define CAHANDLERLOADER_H
+
+class QString;
+class CaHandler;
+
+class CaHandlerLoader
+{
+public:
+    virtual ~CaHandlerLoader();
+    virtual CaHandler *loadHandler(const QString &entryTypeName,
+                                   const QString &commandName) = 0;
+};
+
+#endif // CAHANDLERLOADER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contentstorage/caclient/inc/cahandlerproxy.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
+
+#ifndef CAHANDLERPROXY_H
+#define CAHANDLERPROXY_H
+
+#include <QMap>
+#include <QString>
+#include <QSharedPointer>
+
+#include <cadefs.h>
+
+#include "cahandlerloader.h"
+
+class CaEntry;
+
+class CaHandlerProxy
+{
+public:
+
+    ~CaHandlerProxy();
+
+    explicit CaHandlerProxy(const QSharedPointer<CaHandlerLoader> &loader);
+
+    int execute(const CaEntry &entry, const QString &commandName);
+
+private:
+    CaHandler *getHandler(const CaEntry &entry,
+                          const QString &commandName);
+
+    typedef QMap<QString, QSharedPointer<CaHandler> > ImplementationMap;
+    typedef ImplementationMap::iterator ImplementationMapIterator;
+
+    QSharedPointer<CaHandlerLoader> mLoader;
+    ImplementationMap mImplementationMap;
+};
+
+#endif // CAHANDLERPROXY_H
--- a/contentstorage/caclient/inc/caitemmodel_p.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/caclient/inc/caitemmodel_p.h	Thu Jul 22 16:37:03 2010 +0100
@@ -73,7 +73,7 @@
 
     // Function declarations
     void updateParentEntry();
-    void updateItemData(int id);
+    void updateItemData(const QSharedPointer<CaEntry> &entry);
     void addItem(int id);
     void addItemBlock(const QList<int> &itemsList);
     void handleAddItems(const QList<int> &itemsList);
@@ -84,11 +84,12 @@
     void connectSlots();
     void disconnectSlots();
     void reconnectSlots();
+    void emitEmpty(int previousCount);
 
 private slots:
 
     // Function declarations
-    void updateModelItem(int id, ChangeType changeType);
+    void updateModelItem(const CaEntry &entry, ChangeType changeType);
     void updateModelContent(int id);
 
 private:
--- a/contentstorage/caclient/inc/caitemmodellist.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/caclient/inc/caitemmodellist.h	Thu Jul 22 16:37:03 2010 +0100
@@ -43,7 +43,7 @@
     int count() const;
     QSharedPointer<CaEntry> at(int row) const;
     void reloadEntries(const CaQuery &query);
-    void updateEntry(int id);
+    void updateEntry(const QSharedPointer<CaEntry> &entry);
     void updateEntries(const CaQuery &query);
     int indexOf(const int &id) const;
     void insert(int row, int id);
--- a/contentstorage/caclient/inc/canotifier_p.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/caclient/inc/canotifier_p.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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;
 
 };
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contentstorage/caclient/inc/caqtsfhandlerloader.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
+
+#ifndef CA_QT_SF_HANDLER_LOADER_H
+#define CA_QT_SF_HANDLER_LOADER_H
+
+#include <QMap>
+#include <QString>
+#include <QScopedPointer>
+
+#include "cahandlerloader.h"
+
+class CaQtSfHandlerLoader:
+    public CaHandlerLoader
+{
+public:
+    CaQtSfHandlerLoader();
+    CaHandler *loadHandler(const QString &entryTypeName,
+                           const QString &commandName);
+protected:
+    void registerPlugins() const;
+};
+
+#endif
--- a/contentstorage/caclient/inc/caquery_p.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/caclient/inc/caquery_p.h	Thu Jul 22 16:37:03 2010 +0100
@@ -39,6 +39,9 @@
     int parentId() const;
     void setParentId(int id);
 
+    int childId() const;
+    void setChildId(int id);
+    
     QStringList entryTypeNames() const;
     void setEntryTypeNames(const QStringList &entryTypeNames);
 
@@ -71,6 +74,8 @@
     EntryRoles mEntryRoles;
 
     int mParentId;
+    
+    int mChildId;
 
     QStringList mEntryTypeNames;
 
--- a/contentstorage/caclient/inc/caservice_p.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/caclient/inc/caservice_p.h	Thu Jul 22 16:37:03 2010 +0100
@@ -27,6 +27,7 @@
 class CaService;
 class CaNotifier;
 class CaClientNotifierProxy;
+class CaHandlerProxy;
 
 class CaServicePrivate
 {
@@ -57,7 +58,7 @@
 
     bool prependEntriesToGroup(int groupId, const QList<int> &entryIdList);
 
-    bool executeCommand(const CaEntry &entry, const QString &command);
+    int executeCommand(const CaEntry &entry, const QString &command);
 
     CaNotifier *createNotifier(const CaNotifierFilter &filter);
 
@@ -69,6 +70,9 @@
 
     CaService *const m_q;
 
+    // Command handler.
+    QSharedPointer<CaHandlerProxy> mCommandHandler;
+
     CaClientProxy *mProxy;
  
     CaClientNotifierProxy *mNotifierProxy;
--- a/contentstorage/caclient/s60/inc/cabitmapadapter.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/caclient/s60/inc/cabitmapadapter.h	Thu Jul 22 16:37:03 2010 +0100
@@ -43,13 +43,6 @@
     static CFbsBitmap *copyBitmapLC(CFbsBitmap *input);
     
     /**
-     * Convert bitmap
-     * @param input bitmap.
-     * @return qPixmap.
-     */
-    static QPixmap fromSymbianCFbsBitmap(CFbsBitmap *aBitmap);
-    
-    /**
      * Convert from bitmap and mask to qpixmap
      * @param input bitmap.
      * @param pixmap to prepare.
--- a/contentstorage/caclient/s60/inc/caclientproxy.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/caclient/s60/inc/caclientproxy.h	Thu Jul 22 16:37:03 2010 +0100
@@ -130,16 +130,6 @@
                           QList<int> &sourceIdList);
 
     /**
-     * Method for executing command
-     *
-     * @param entry entry on wchich command will be executed
-     * @param command command to execute
-     * @return error code
-     */
-    ErrorCode executeCommand(const CaEntry &entry,
-                             const QString &command);
-
-    /**
      * Method for touching entry.
      *
      * @param aEntry entry to touch
@@ -235,9 +225,6 @@
     // Own.
     RCaClientSession mSession;
 
-    // Command handler.
-    QSharedPointer<CaHandlerProxy> mCommandHandler;
-
     // Mutex to serialize access to mSessions.
     QMutex mMutex;
 };
--- a/contentstorage/caclient/s60/inc/cahandler.h	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-#ifndef CA_HANDLER_H
-#define CA_HANDLER_H
-
-#include <QObject>
-#include <cadefs.h>
-#include <caclient_global.h>
-
-class CCaInnerEntry;
-class QString;
-
-class CaHandler
-{
-public:
-    virtual ~CaHandler() {}
-    virtual int execute(CCaInnerEntry &innerEntry,
-                        const QString &commandName) = 0;
-};
-
-Q_DECLARE_INTERFACE(CaHandler, "com.nokia.homescreen.ICommandHandler")
-
-#endif
--- a/contentstorage/caclient/s60/inc/cahandlerloader.h	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#ifndef CA_HANDLER_LOADER_H
-#define CA_HANDLER_LOADER_H
-
-#include <caclient_global.h>
-
-class QString;
-class CaHandler;
-
-class CaHandlerLoader
-{
-public:
-    virtual ~CaHandlerLoader();
-    virtual CaHandler *loadHandler(const QString &entryTypeName,
-                                   const QString &commandName) = 0;
-};
-
-#endif
--- a/contentstorage/caclient/s60/inc/cahandlerproxy.h	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#ifndef CA_HANDLER_PROXY_H
-#define CA_HANDLER_PROXY_H
-
-#include <e32def.h>
-#include <QMap>
-#include <QString>
-#include <QSharedPointer>
-#include <cadefs.h>
-
-#include "cahandlerloader.h"
-
-class CaEntry;
-
-class CaHandlerProxy
-{
-public:
-
-    ~CaHandlerProxy();
-
-    explicit CaHandlerProxy(CaHandlerLoader *loader);
-
-    TInt execute(const CaEntry &entry, const QString &commandName);
-
-private:
-    CaHandler *getHandler(const CaEntry &entry,
-                          const QString &commandName);
-
-    typedef QMap<QString, QSharedPointer<CaHandler> > ImplementationMap;
-    typedef ImplementationMap::iterator ImplementationMapIterator;
-
-    QSharedPointer<CaHandlerLoader> mLoader;
-    ImplementationMap mImplementationMap;
-};
-
-#endif
--- a/contentstorage/caclient/s60/inc/caqtsfhandlerloader.h	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#ifndef CA_QT_SF_HANDLER_LOADER_H
-#define CA_QT_SF_HANDLER_LOADER_H
-
-#include <QMap>
-#include <QString>
-#include <QScopedPointer>
-
-#include "cahandlerloader.h"
-
-class CaQtSfHandlerLoader:
-    public CaHandlerLoader
-{
-public:
-    CaQtSfHandlerLoader();
-    CaHandler *loadHandler(const QString &entryTypeName,
-                           const QString &commandName);
-protected:
-    void registerPlugins() const;
-};
-
-#endif
--- a/contentstorage/caclient/s60/src/cabitmapadapter.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/caclient/s60/src/cabitmapadapter.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -31,60 +31,6 @@
 #include "cadef.h"
 #include "cabitmapadapter.h"
 
-static QImage::Format TDisplayMode2Format(TDisplayMode mode)
-{
-    QImage::Format format;
-    switch (mode) {
-    case EGray2:
-        format = QImage::Format_MonoLSB;
-        break;
-    case EColor256:
-    case EGray256:
-        format = QImage::Format_Indexed8;
-        break;
-    case EColor4K:
-        format = QImage::Format_RGB444;
-        break;
-    case EColor64K:
-        format = QImage::Format_RGB16;
-        break;
-    case EColor16M:
-        format = QImage::Format_RGB888;
-        break;
-    case EColor16MU:
-        format = QImage::Format_RGB32;
-        break;
-    case EColor16MA:
-        format = QImage::Format_ARGB32;
-        break;
-    case EColor16MAP:
-        format = QImage::Format_ARGB32_Premultiplied;
-        break;
-    default:
-        format = QImage::Format_Invalid;
-        break;
-    }
-    return format;
-}
-
-QPixmap CaBitmapAdapter::fromSymbianCFbsBitmap(CFbsBitmap *aBitmap)
-{
-    aBitmap->BeginDataAccess();
-    uchar *data = (uchar *)aBitmap->DataAddress();
-    TSize size = aBitmap->SizeInPixels();
-    TDisplayMode displayMode = aBitmap->DisplayMode();
-
-    // QImage format must match to bitmap format
-    QImage image(data, size.iWidth, size.iHeight, TDisplayMode2Format(
-        displayMode));
-    aBitmap->EndDataAccess();
-
-    // No data copying happens because
-    // image format matches native OpenVG format.
-    // So QPixmap actually points to CFbsBitmap data.
-    return QPixmap::fromImage(image);
-}
-
 // -----------------------------------------------------------------------------
 // copying compressed bitmap
 //----------------------------------------------------------------------------
@@ -108,17 +54,19 @@
         CFbsBitmap* fbsMask, QPixmap& pixmap)
 {
     if (fbsBitmap->Header().iCompression == ENoBitmapCompression) {
-        pixmap = CaBitmapAdapter::fromSymbianCFbsBitmap(fbsBitmap);
-        QPixmap mask = CaBitmapAdapter::fromSymbianCFbsBitmap(fbsMask);
+        pixmap = pixmap.fromSymbianCFbsBitmap(fbsBitmap);
+        QPixmap mask;
+        mask = mask.fromSymbianCFbsBitmap(fbsMask);
         pixmap.setAlphaChannel(mask);
     } else { // we need special handling for icons in 9.2 (NGA)
         // let's hope that in future it will be in QT code
         CFbsBitmap *temp(NULL);
         temp = CaBitmapAdapter::copyBitmapLC(fbsBitmap);
-        pixmap = CaBitmapAdapter::fromSymbianCFbsBitmap(temp);
+        pixmap = pixmap.fromSymbianCFbsBitmap(temp);
         CleanupStack::PopAndDestroy();
         temp = CaBitmapAdapter::copyBitmapLC(fbsMask);
-        QPixmap mask = CaBitmapAdapter::fromSymbianCFbsBitmap(temp);
+        QPixmap mask;
+        mask = mask.fromSymbianCFbsBitmap(temp);
         CleanupStack::PopAndDestroy();
         pixmap.setAlphaChannel(mask);
     }
--- a/contentstorage/caclient/s60/src/caclientproxy.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/caclient/s60/src/caclientproxy.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -38,8 +38,7 @@
 //----------------------------------------------------------------------------
 //
 //----------------------------------------------------------------------------
-CaClientProxy::CaClientProxy():
-    mCommandHandler(new CaHandlerProxy(new CaQtSfHandlerLoader()))
+CaClientProxy::CaClientProxy()
 {
 }
 
@@ -169,20 +168,6 @@
 //----------------------------------------------------------------------------
 //
 //----------------------------------------------------------------------------
-ErrorCode CaClientProxy::executeCommand(const CaEntry &entry,
-                                        const QString &command)
-{
-    TInt error = mCommandHandler->execute(entry, command);
-
-    USE_QDEBUG_IF(error) << "CaClientProxy::executeCommand - Error ("
-                         << error << ")";
-
-    return CaObjectAdapter::convertErrorCode(error);
-}
-
-//----------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------
 ErrorCode CaClientProxy::touch(const CaEntry &aEntry)
 {
     TRAPD(error, touchL(aEntry));
--- a/contentstorage/caclient/s60/src/cahandlerloader.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#include <QString>
-#include "cahandlerloader.h"
-
-/*!
-    \class CaHandlerLoader
-    \ingroup 
-    \brief Interface for class of objects providing command handlers.
-
-    \sa CaHandlerLoader
-*/
-
-/*!
-    Destructor.
-*/
-CaHandlerLoader::~CaHandlerLoader()
-{
-}
-
-
--- a/contentstorage/caclient/s60/src/cahandlerproxy.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#include <caentry.h>
-#include "cahandler.h"
-#include "cahandlerproxy.h"
-#include "cahandlerloader.h"
-#include "cainnerentry.h"
-#include "caobjectadapter.h"
-
-/*!
-    \class CaHandlerProxy
-    \ingroup
-    \brief Forwards execute request to an implemenation provided by specific handler loader.
-
-    \sa CaHandlerLoader
-*/
-
-/*!
-  Destructor.
-*/
-CaHandlerProxy::~CaHandlerProxy()
-{
-}
-
-
-/*!
-  Constructs handler proxy.
-  \param loader Provides handler implementations. It has to be pointer to a valid object.
-*/
-CaHandlerProxy::CaHandlerProxy(CaHandlerLoader *loader):
-    mLoader(loader)
-{
-    Q_ASSERT(!mLoader.isNull());
-}
-
-/*!
-  Forwards execute request to an appropriate handler if found otherwise ignores the request.
-  \param entry Subject for the requested command.
-  \param commandName Name of the command to be executed.
-  \return KErrNone (i.e. 0) on succes, error code otherwise.
-  \sa e32err.h for KErrNone definition.
-*/
-TInt CaHandlerProxy::execute(const CaEntry &entry, const QString &commandName)
-{
-    CaHandler *const handler = getHandler(entry, commandName);
-
-    TInt result = KErrNotFound;
-
-    if (handler != NULL) {
-        QScopedPointer<CCaInnerEntry> innerEntry(NULL);
-        TRAP(result,
-            innerEntry.reset(CCaInnerEntry::NewL());
-            CaObjectAdapter::convertL(entry, *innerEntry);
-            )
-        if (result == KErrNone) {
-            result = handler->execute(*innerEntry, commandName);
-        }
-    }
-    return result;
-}
-
-/*!
-  Looks for handler implementation in local cache or if not found, request it from
-  handler loader.
-  \param entry The entry being a subject for the requested command.
-  \param commandName Name of the command to be executed.
-  \return Pointer to a handler instance if available, NULL otherwise.
-*/
-CaHandler *CaHandlerProxy::getHandler(const CaEntry &entry,
-                                      const QString &commandName)
-{
-    CaHandler *implementation(0);
-
-    const QString entryTypeName(entry.entryTypeName());
-
-    const ImplementationMapIterator it(
-        mImplementationMap.find(entryTypeName));
-
-    if (it != mImplementationMap.end()) {
-        implementation = it->data();
-    } else {
-        implementation = mLoader->loadHandler(entryTypeName, commandName);
-        mImplementationMap[entryTypeName] = QSharedPointer<CaHandler>(implementation);
-    }
-
-    return implementation;
-}
--- a/contentstorage/caclient/s60/src/camenuiconmifutility.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/caclient/s60/src/camenuiconmifutility.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -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 Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/caclient/s60/src/camenuiconutility.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -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"
@@ -50,20 +55,7 @@
     if (icon.isNull() || !(icon.size().isValid())) {
         QString fileName(entry.iconDescription().filename());
         if (!fileName.isEmpty()) {
-        
-            // TODO:
-            // work-around for HbIcon::size() method locking files if returns 
-            // default size, error id: ou1cimx1#279208 Case: mcl06HsDo07 - 
-            // "Cannot delete file" when trying to uninstall sisx file
-            
-            if (entry.entryTypeName() == XQConversions::s60DescToQString(
-                    KCaTypeWidget)) {
-                icon = QIcon(fileName);
-                qWarning("Widget icon created by QIcon, "
-                        "as work-around for HbIcon::size");
-            } else {
-                icon = HbIcon(fileName);
-            }
+            icon = HbIcon(fileName);
         }
     }
     return icon;
@@ -116,7 +108,7 @@
             pixmap = pixmap.scaled(size, Qt::KeepAspectRatioByExpanding);
             icon = HbIcon(QIcon(pixmap));
         } else {
-            HBufC* fileNameFromApparc;
+            HBufC* fileNameFromApparc = NULL;
             TInt err2 = apaLsSession.GetAppIcon(uid,fileNameFromApparc);
             CleanupStack::PushL(fileNameFromApparc);
             if (err2 == KErrNone) {
@@ -133,9 +125,8 @@
                     icon = HbIcon(fileName);
                 }
             }
-            CleanupStack::Pop(fileNameFromApparc);
+            CleanupStack::PopAndDestroy(fileNameFromApparc);
         }
-        
         CleanupStack::PopAndDestroy(apaMaskedBitmap);
     }
     CleanupStack::PopAndDestroy(&apaLsSession);
@@ -223,16 +214,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_homescreen"));
+    }
     return icon;
 }
-
-
--- a/contentstorage/caclient/s60/src/caobjectadapter.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/caclient/s60/src/caobjectadapter.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -48,12 +48,12 @@
     toEntry.SetId(fromEntry.id());
 
     toEntry.SetTextL(
-        XQConversions::qStringToS60Desc(fromEntry.text())->Des());
+        XQConversions::qStringToS60Desc(fromEntry.text())->Des(),
+        fromEntry.isLocalized(NameLocalized));
 
     toEntry.SetDescriptionL(
-        XQConversions::qStringToS60Desc(fromEntry.description())->Des());
-    toEntry.SetDescriptionL(
-        XQConversions::qStringToS60Desc(fromEntry.description())->Des());
+        XQConversions::qStringToS60Desc(fromEntry.description())->Des(),
+        fromEntry.isLocalized(DescriptionLocalized));
 
     toEntry.SetEntryTypeNameL(
         XQConversions::qStringToS60Desc(fromEntry.entryTypeName())->Des());
@@ -95,6 +95,8 @@
                                CCaInnerQuery &toQuery)
 {
     toQuery.SetParentId(fromQuery.parentId());
+    
+    toQuery.SetChildId(fromQuery.childId());
 
     toQuery.SetFlagsOn(static_cast<TUint>(fromQuery.flagsOn()));
 
@@ -148,10 +150,12 @@
 {
     toEntry.setId(fromEntry.GetId());
 
-    toEntry.setText(XQConversions::s60DescToQString(fromEntry.GetText()));
+    toEntry.setText(XQConversions::s60DescToQString(fromEntry.GetText()),
+            fromEntry.isLocalized(CCaInnerEntry::ENameLocalized));
 
     toEntry.setDescription(
-        XQConversions::s60DescToQString(fromEntry.GetDescription()));
+        XQConversions::s60DescToQString(fromEntry.GetDescription()),
+        fromEntry.isLocalized(CCaInnerEntry::EDescriptionLocalized));
     toEntry.setEntryTypeName(
         XQConversions::s60DescToQString(fromEntry.GetEntryTypeName()));
 
--- a/contentstorage/caclient/s60/src/caobserver.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/caclient/s60/src/caobserver.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -58,7 +58,8 @@
 {
     qDebug() << "CaClientProxy::entryChanged changeType:" << changeType;
 
-    CaEntry *caEntry = new CaEntry(static_cast<EntryRole>(entry.GetRole()));
+    QSharedPointer<CaEntry> caEntry(
+        new CaEntry(static_cast<EntryRole>(entry.GetRole())));
     ChangeType entryChangeType(AddChangeType);
     CaObjectAdapter::convert(entry, *caEntry);
     CaObjectAdapter::convert(changeType, entryChangeType);
--- a/contentstorage/caclient/s60/src/caqtsfhandlerloader.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#include <QApplication>
-#include <QDir>
-#include <QMap>
-#include <QScopedPointer>
-#include <QString>
-#include <qservice.h>
-#include <qstringlist.h>
-#include <qservicemanager.h>
-
-#include "cahandler.h"
-#include "caqtsfhandlerloader.h"
-#include "caclient_defines.h"
-
-QTM_USE_NAMESPACE
-
-/*!
-    \class CaQtSfHandlerLoader
-    \ingroup
-    \brief Loads handlers implementation
-
-    The purpose of the class is to find Qt SF plugins implementing command handlers.
-    Temporarily because of issues with Qt SF this is replaced by immediate object
-    creation.
-    \sa CaHandlerLoader
-*/
-
-/*!
-    Constructor.
-*/
-CaQtSfHandlerLoader::CaQtSfHandlerLoader()
-{
-    registerPlugins();
-}
-
-/*!
-    Load plugins for command handling.
-*/
-void CaQtSfHandlerLoader::registerPlugins() const
-{
-    const QString pluginPath("hsresources/plugins/commandhandler");
-    const QFileInfoList drives = QDir::drives();
-    
-    foreach(QFileInfo drive, drives) {
-        const QString driveLetter = drive.absolutePath();
-        const QString pluginAbsolutePath = driveLetter + pluginPath;
-        const QDir pluginDir(pluginAbsolutePath);
-        if(QDir(pluginDir).exists()) {
-            const QFileInfoList fileInfos = 
-                pluginDir.entryInfoList(QStringList("*.xml"));
-            
-            QApplication::addLibraryPath(pluginAbsolutePath);
-            
-            QServiceManager serviceManager;
-            foreach(QFileInfo fileInfo, fileInfos) {
-                serviceManager.addService(fileInfo.absoluteFilePath());
-            }
-        }
-    }
-}
-
-/*!
-    Loads handler implementations appropriate for the requested entry type name and command.
-
-    The caller takes ownership of the returned pointer.
-
-    \param entryTypeName Entry type name.
-    \param commandName Name of the command to be handled.
-    \return A pointer to handler serving the entry type and command if found, NULL otherwise.
-*/
-CaHandler *CaQtSfHandlerLoader::loadHandler(const QString &entryTypeName,
-        const QString &commandName)
-{
-    Q_UNUSED(commandName);
-
-    QString typeName(entryTypeName);
-    if (entryTypeName == WIDGET_ENTRY_TYPE_NAME
-        || entryTypeName == PACKAGE_ENTRY_TYPE_NAME) {
-        typeName = QString(APPLICATION_ENTRY_TYPE_NAME);
-    }
-
-    QServiceManager serviceManager;
-    QServiceFilter serviceFilter("com.nokia.homescreen.ICommandHandler");
-    serviceFilter.setCustomAttribute("entryTypeName", typeName);
-    QList<QServiceInterfaceDescriptor> serviceInterfaceDescriptorList =
-        serviceManager.findInterfaces(serviceFilter);
-    CaHandler *interfaceHandler = NULL;
-    if (!serviceInterfaceDescriptorList.isEmpty()) {
-        QServiceInterfaceDescriptor serviceInterfaceDescriptor =
-            serviceInterfaceDescriptorList[0];
-         QObject *handler =
-            serviceManager.loadInterface(serviceInterfaceDescriptor);
-         interfaceHandler = qobject_cast<CaHandler *>(handler);
-    }
-    return interfaceHandler;
-}
-
-
--- a/contentstorage/caclient/src/caentry.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/caclient/src/caentry.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -150,19 +150,20 @@
 }
 
 /*!
- Sets name of the item.
+ Sets localized name of the item.
  \param text new name of the item.
+ \param localized set to true if its localized
 
  \code
  ...
  QString entryText( QString("EntryText") );
- resultEntry->setText( entryText);
+ resultEntry->setText( entryText, true);
  ...
  \endcode
  */
-void CaEntry::setText(const QString &text)
+void CaEntry::setText(const QString &text, bool localized)
 {
-    m_d->setText(text);
+    m_d->setText(text, localized);
 }
 
 /*!
@@ -180,8 +181,9 @@
     return m_d->description();
 }
 
+
 /*!
-Sets description of the item.
+Sets localized description of the item.
 \param new description of the item.
 
 \code
@@ -191,9 +193,10 @@
 ...
 \endcode
 */
-void CaEntry::setDescription(const QString &description)
+void CaEntry::setDescription(const QString &description,
+        bool localized)
 {
-    m_d->setDescription(description);
+    m_d->setDescription(description, localized);
 }
 
 /*!
@@ -472,6 +475,11 @@
 }
 
 
+bool CaEntry::isLocalized(LocalizationType localized)  const
+{
+    return m_d->isLocalized(localized);  
+}
+
 /*
  Constructor
  \param entryPublic associated public entry
@@ -479,7 +487,8 @@
 CaEntryPrivate::CaEntryPrivate(CaEntry *entryPublic) :
     m_q(entryPublic), mId(0), mText(), mDescription(), mIconDescription(),
     mFlags(RemovableEntryFlag|VisibleEntryFlag),mEntryTypeName(),
-    mAttributes(), mEntryRole(ItemEntryRole)
+    mAttributes(), mEntryRole(ItemEntryRole), 
+    mTextLocalized(false), mDescriptionLocalized(false)
 {
 }
 /*!
@@ -497,6 +506,8 @@
     mEntryTypeName = entry.mEntryTypeName;
     mAttributes = entry.mAttributes;
     mEntryRole = entry.mEntryRole;
+    mTextLocalized = entry.mTextLocalized;
+    mDescriptionLocalized = entry.mDescriptionLocalized;
     return *this;
 }
 
@@ -524,12 +535,13 @@
 }
 
 /*!
- Sets name of the item.
+ Sets localized name of the item.
  \param text new name of the item.
  */
-void CaEntryPrivate::setText(const QString &text)
+void CaEntryPrivate::setText(const QString &text, bool localized)
 {
     mText = text;
+    mTextLocalized = localized;
 }
 
 /*!
@@ -544,9 +556,11 @@
 Sets description of the item.
 \param text new name of the item.
 */
-void CaEntryPrivate::setDescription(const QString &description)
+void CaEntryPrivate::setDescription(const QString &description,
+        bool localized)
 {
     mDescription = description;
+    mDescriptionLocalized = localized;
 }
 
 /*!
@@ -663,3 +677,18 @@
     mEntryRole = role;
 }
 
+bool CaEntryPrivate::isLocalized(LocalizationType localized)  const
+{
+    if(localized == NameLocalized)
+    {
+        return mTextLocalized;
+    }
+    if(localized == DescriptionLocalized)
+    {
+        return mDescriptionLocalized;
+    }
+    return false;
+    
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contentstorage/caclient/src/cahandler.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
+ 
+/*!
+    \class CaHandler
+    \ingroup
+    \brief Interface for command handlers
+*/
+
+/*!
+    \fn int CaHandler::execute(const CaEntry &entry, const QString &commandName) = 0
+    \param entry the entry for which the command is executed.
+    \param commandName the name of the command to execute.
+    \retval an error code.
+    \sa e32err.h for error code descriptions.
+*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contentstorage/caclient/src/cahandlerloader.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
+
+#include <QString>
+#include "cahandlerloader.h"
+
+/*!
+    \class CaHandlerLoader
+    \ingroup 
+    \brief Interface for class of objects providing command handlers.
+
+    \sa CaHandlerLoader
+*/
+
+/*!
+    Destructor.
+*/
+CaHandlerLoader::~CaHandlerLoader()
+{
+}
+
+/*!
+    \fn virtual CaHandler *loadHandler(const QString &entryTypeName,
+                                   const QString &commandName) = 0;
+    Loads handler implementations appropriate for the requested entry type name and command.
+
+    The caller takes ownership of the returned pointer.
+
+    \param entryTypeName an entry type name.
+    \param commandName a name of the command to be handled.
+    \retval a pointer to the handler serving the entry type and command if found, NULL otherwise.
+*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contentstorage/caclient/src/cahandlerproxy.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
+
+#include <caentry.h>
+
+#include "cahandler.h"
+#include "cahandlerproxy.h"
+#include "cahandlerloader.h"
+#include "caobjectadapter.h"
+
+/*!
+    \class CaHandlerProxy
+    \ingroup
+    \brief Forwards execute request to an implemenation provided by specific handler loader.
+
+    \sa CaHandlerLoader
+*/
+
+/*!
+  Destructor.
+*/
+CaHandlerProxy::~CaHandlerProxy()
+{
+}
+
+
+/*!
+  Constructs handler proxy.
+  \param loader Provides handler implementations. It has to be pointer to a valid object.
+*/
+CaHandlerProxy::CaHandlerProxy(const QSharedPointer<CaHandlerLoader> &loader):
+    mLoader(loader)
+{
+    Q_ASSERT(!mLoader.isNull());
+}
+
+/*!
+  Forwards execute request to an appropriate handler if found otherwise ignores the request.
+  \param entry Subject for the requested command.
+  \param commandName Name of the command to be executed.
+  \retval KErrNone on succes, error code otherwise.
+  \sa e32err.h for KErrNone definition.
+*/
+int CaHandlerProxy::execute(const CaEntry &entry, const QString &commandName)
+{
+    CaHandler *const handler = getHandler(entry, commandName);
+    int result = -1;
+
+    if (handler) {
+            result = handler->execute(entry, commandName);
+    }
+    return result;
+}
+
+/*!
+  Looks for handler implementation in local cache or if not found, request it from
+  handler loader.
+  \param entry The entry being a subject for the requested command.
+  \param commandName Name of the command to be executed.
+  \return Pointer to a handler instance if available, NULL otherwise.
+*/
+CaHandler *CaHandlerProxy::getHandler(const CaEntry &entry,
+                                      const QString &commandName)
+{
+    CaHandler *implementation(0);
+
+    const QString entryTypeName(entry.entryTypeName());
+
+    const ImplementationMapIterator it(
+        mImplementationMap.find(entryTypeName));
+
+    if (it != mImplementationMap.end()) {
+        implementation = it->data();
+    } else {
+        implementation = mLoader->loadHandler(entryTypeName, commandName);
+        mImplementationMap[entryTypeName] = QSharedPointer<CaHandler>(implementation);
+    }
+
+    return implementation;
+}
--- a/contentstorage/caclient/src/caiconcache.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/caclient/src/caiconcache.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -145,7 +145,7 @@
 void CaIconCache::remove(const CaEntry &entry, ChangeType changeType)
 {
     CACLIENTTEST_FUNC_ENTRY("CaIconCache::remove");
-    if (changeType != AddChangeType) {
+    if (changeType != AddChangeType && !(entry.flags() & UninstallEntryFlag)) {
         QString entryKey = key(entry);
         entryKey.append(separator);
         QList<QString> keys = mCache.keys();
@@ -169,6 +169,8 @@
     QString key;
     if (!entry.iconDescription().filename().isEmpty()) {
         key.append(entry.iconDescription().filename());
+        key.append(separator);
+        key.append(entry.entryTypeName());
     } else {
         key.append(separator);
         key.append(entry.id());
--- a/contentstorage/caclient/src/caicondescription.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/caclient/src/caicondescription.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -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 Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/caclient/src/caitemmodel.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -17,6 +17,7 @@
 
 #include <HbIcon>
 
+#include "caclient_defines.h"
 #include "caitemmodel.h"
 #include "caitemmodel_p.h"
 #include "canotifier.h"
@@ -469,6 +470,9 @@
             variant = QVariant(entry(modelIndex)->text() + QString(" ")
                 + entry(modelIndex)->description());
             break;
+        case CaItemModel::UninstalRole:
+      	    variant = QVariant(entry(modelIndex)->attribute(UNINSTALL_PROGRESS_APPLICATION_ATTRIBUTE_NAME).toInt());
+            break;
         default:
             variant = QVariant(QVariant::Invalid);
         }
@@ -699,26 +703,27 @@
 
 /*!
  Updates model item with fresh data
- \param id id of item to update
+ \param entry item to update
  */
-void CaItemModelPrivate::updateItemData(int id)
+void CaItemModelPrivate::updateItemData(const QSharedPointer<CaEntry> &entry)
 {
     CACLIENTTEST_FUNC_ENTRY("CaItemModelPrivate::updateItemData");
 
-    mEntries.updateEntry(id);
 
+    int id = entry->id();
     QList<int> ids = mService->getEntryIds(mQuery);
     if (mEntries.indexOf(id) >= 0
            && 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);
+        mEntries.updateEntry(entry);
+        emit m_q->dataChanged(
+            index(mEntries.indexOf(id)), index(mEntries.indexOf(id)));
     } else if (mParentEntry && id == mParentEntry->id()) {
         updateParentEntry();
         m_q->reset();
+    } else if (ids.indexOf(id) < 0) {
+        removeItem(id);
+    } else if (mEntries.indexOf(id) < 0) {
+        addItem(id);
     } else {
         updateModel();
     }
@@ -737,9 +742,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");
 }
@@ -907,8 +920,8 @@
 void CaItemModelPrivate::connectSlots()
 {
     CACLIENTTEST_FUNC_ENTRY("CaItemModelPrivate::connectSlots");
-    connect(mNotifier, SIGNAL(entryChanged(int,ChangeType)),
-            this, SLOT(updateModelItem(int,ChangeType)));
+    connect(mNotifier, SIGNAL(entryChanged(CaEntry ,ChangeType)),
+            this, SLOT(updateModelItem(CaEntry, ChangeType)));
 
     if (mQuery.parentId() > 0) {
         connect(mNotifier, SIGNAL(groupContentChanged(int)),
@@ -923,8 +936,8 @@
 void CaItemModelPrivate::disconnectSlots()
 {
     CACLIENTTEST_FUNC_ENTRY("CaItemModelPrivate::disconnectSlots");
-    disconnect(mNotifier, SIGNAL(entryChanged(int,ChangeType)),
-               this, SLOT(updateModelItem(int,ChangeType)));
+    disconnect(mNotifier, SIGNAL(entryChanged(CaEntry ,ChangeType)),
+            this, SLOT(updateModelItem(CaEntry, ChangeType)));
     if (mQuery.parentId() > 0) {
         disconnect(mNotifier, SIGNAL(groupContentChanged(int)),
                    this, SLOT(updateModelContent(int)));
@@ -948,20 +961,24 @@
  \param id of item to handle
  \param changeType change type
  */
-void CaItemModelPrivate::updateModelItem(int id, ChangeType changeType)
+void CaItemModelPrivate::updateModelItem(
+    const CaEntry &entry, ChangeType changeType)
 {
     CACLIENTTEST_FUNC_ENTRY("CaItemModelPrivate::updateModelItem");
+    QSharedPointer<CaEntry> sharedEntry(new CaEntry(entry));
+    int previousCount = rowCount();
     switch (changeType) {
-    case AddChangeType:
-        addItem(id);
-        break;
-    case RemoveChangeType:
-        removeItem(id);
-        break;
-    default:
-        updateItemData(id);
-        break;
+        case AddChangeType:
+            addItem(sharedEntry->id());
+            break;
+        case RemoveChangeType:
+            removeItem(sharedEntry->id());
+            break;
+        default:
+            updateItemData(sharedEntry);
+            break;
     }
+    emitEmpty(previousCount);
     CACLIENTTEST_FUNC_EXIT("CaItemModelPrivate::updateModelItem");
 }
 
@@ -972,6 +989,8 @@
 void CaItemModelPrivate::updateModelContent(int id)
 {
     Q_UNUSED(id);
+    int previousCount = rowCount();
+
     CACLIENTTEST_FUNC_ENTRY("CaItemModelPrivate::updateModelContent");
     QList<int> ids = mService->getEntryIds(mQuery);
 
@@ -980,5 +999,20 @@
     } else {
         removeItems(ids);
     }
+    emitEmpty(previousCount);
     CACLIENTTEST_FUNC_EXIT("CaItemModelPrivate::updateModelContent");
 }
+
+/*!
+ Emits empty signal if model state was changed
+ \param id of parent
+ */
+void CaItemModelPrivate::emitEmpty(int previousCount)
+{
+    if ( previousCount && !rowCount()) {
+        emit m_q->empty(true);
+    }
+    if ( !previousCount && rowCount()) {
+        emit m_q->empty(false);
+    }
+}
--- a/contentstorage/caclient/src/caitemmodellist.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/caclient/src/caitemmodellist.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -93,13 +93,13 @@
 
 /*!
  Updates entry with given id
- \param id of item in the list
+ \param entry of item in the list
  */
-void CaItemModelList::updateEntry(int id)
+void CaItemModelList::updateEntry(const QSharedPointer<CaEntry> &entry)
 {
     CACLIENTTEST_FUNC_ENTRY("CaItemModelList::updateEntry");
-    if (mEntriesHash.contains(id)) {
-        mEntriesHash.insert(id, mService->getEntry(id));
+    if (mEntriesHash.contains(entry->id())) {
+        mEntriesHash.insert(entry->id(), entry);
     }
     CACLIENTTEST_FUNC_EXIT("CaItemModelList::updateEntry");
 }
--- a/contentstorage/caclient/src/canotifier.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/caclient/src/canotifier.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -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);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contentstorage/caclient/src/caqtsfhandlerloader.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
+
+#include <QApplication>
+#include <QDir>
+#include <QMap>
+#include <QScopedPointer>
+#include <QString>
+#include <qservice.h>
+#include <qstringlist.h>
+#include <qservicemanager.h>
+
+#include "cahandler.h"
+#include "caqtsfhandlerloader.h"
+#include "caclient_defines.h"
+
+QTM_USE_NAMESPACE
+
+/*!
+    \class CaQtSfHandlerLoader
+    \ingroup
+    \brief Loads handlers implementation
+
+    The purpose of the class is to find Qt SF plugins implementing command handlers.
+    Temporarily because of issues with Qt SF this is replaced by immediate object
+    creation.
+    \sa CaHandlerLoader
+*/
+
+/*!
+    Constructor.
+*/
+CaQtSfHandlerLoader::CaQtSfHandlerLoader()
+{
+    registerPlugins();
+}
+
+/*!
+    Load plugins for command handling.
+*/
+void CaQtSfHandlerLoader::registerPlugins() const
+{
+    const QString pluginPath("hsresources/plugins/commandhandler");
+    const QFileInfoList drives = QDir::drives();
+    
+    foreach (QFileInfo drive, drives) {
+        const QString driveLetter = drive.absolutePath();
+        const QString pluginAbsolutePath = driveLetter + pluginPath;
+        const QDir pluginDir(pluginAbsolutePath);
+        if (QDir(pluginDir).exists()) {
+            const QFileInfoList fileInfos = 
+                pluginDir.entryInfoList(QStringList("*.xml"));
+            
+            QApplication::addLibraryPath(pluginAbsolutePath);
+            
+            QServiceManager serviceManager;
+            foreach(QFileInfo fileInfo, fileInfos) {
+                serviceManager.addService(fileInfo.absoluteFilePath());
+            }
+        }
+    }
+}
+
+/*!
+    Loads handler implementations appropriate for the requested entry type name and command.
+
+    The caller takes ownership of the returned pointer.
+
+    \param entryTypeName Entry type name.
+    \param commandName Name of the command to be handled.
+    \return A pointer to handler serving the entry type and command if found, NULL otherwise.
+*/
+CaHandler *CaQtSfHandlerLoader::loadHandler(const QString &entryTypeName,
+        const QString &commandName)
+{
+    Q_UNUSED(commandName);
+
+    QString typeName(entryTypeName);
+    if (entryTypeName == WIDGET_ENTRY_TYPE_NAME
+        || entryTypeName == PACKAGE_ENTRY_TYPE_NAME) {
+        typeName = QString(APPLICATION_ENTRY_TYPE_NAME);
+    }
+
+    QServiceManager serviceManager;
+    QServiceFilter serviceFilter("com.nokia.homescreen.ICommandHandler");
+    serviceFilter.setCustomAttribute("entryTypeName", typeName);
+    QList<QServiceInterfaceDescriptor> serviceInterfaceDescriptorList =
+        serviceManager.findInterfaces(serviceFilter);
+    CaHandler *interfaceHandler = NULL;
+    if (!serviceInterfaceDescriptorList.isEmpty()) {
+        QServiceInterfaceDescriptor serviceInterfaceDescriptor =
+            serviceInterfaceDescriptorList[0];
+         QObject *handler =
+            serviceManager.loadInterface(serviceInterfaceDescriptor);
+         interfaceHandler = qobject_cast<CaHandler *>(handler);
+    }
+    return interfaceHandler;
+}
+
+
--- a/contentstorage/caclient/src/caquery.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/caclient/src/caquery.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -135,6 +135,24 @@
 }
 
 /*!
+ Sets child id.
+ \param id id of the child.
+ */
+void CaQuery::setChildId(int id)
+{
+    m_d->setChildId(id);
+}
+
+/*!
+ Returns child id.
+ \retval child id.
+ */
+int CaQuery::childId() const
+{
+    return m_d->childId();
+}
+
+/*!
  Sets names of entry types.
  \param entryTypeNames list of entry type names (strings).
  */
@@ -288,7 +306,7 @@
  */
 CaQueryPrivate::CaQueryPrivate(CaQuery *queryPublic) :
     m_q(queryPublic), mEntryRoles(ItemEntryRole | GroupEntryRole),
-    mParentId(0), mEntryTypeNames(), mFlagsOn(), mFlagsOff(),
+    mParentId(0), mChildId(0), mEntryTypeNames(), mFlagsOn(), mFlagsOff(),
     mSortAttribute(DefaultSortAttribute),
     mSortOrder(Qt::AscendingOrder), mCount(0), mAttributes()
 {
@@ -306,6 +324,7 @@
     /*m_q is not changed*/
     mEntryRoles = queryPrivate.mEntryRoles;
     mParentId = queryPrivate.mParentId;
+    mChildId = queryPrivate.mChildId;
     mEntryTypeNames = queryPrivate.mEntryTypeNames;
     mFlagsOn = queryPrivate.mFlagsOn;
     mFlagsOff = queryPrivate.mFlagsOff;
@@ -361,6 +380,24 @@
 }
 
 /*!
+ Returns child id.
+ \retval child id.
+ */
+int CaQueryPrivate::childId() const
+{
+    return mChildId;
+}
+
+/*!
+ Sets child id.
+ \param id id of the child.
+ */
+void CaQueryPrivate::setChildId(int id)
+{
+    mChildId = id;
+}
+
+/*!
  Returns a list of entry type names.
  \retval list of names of entry types.
  */
@@ -508,6 +545,7 @@
 {
     mEntryRoles = ItemEntryRole | GroupEntryRole;
     mParentId = 0;
+    mChildId = 0;
     mEntryTypeNames = QStringList();
     mFlagsOn = EntryFlags();
     mFlagsOff = EntryFlags();
--- a/contentstorage/caclient/src/caservice.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/caclient/src/caservice.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -30,6 +30,8 @@
 
 #include "caclientproxy.h"
 #include "caclientnotifierproxy.h"
+#include "cahandlerproxy.h"
+#include "caqtsfhandlerloader.h"
 #include "caobjectadapter.h"
 #include "caclienttest_global.h"
 
@@ -38,19 +40,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.
 
  */
 
@@ -83,7 +91,6 @@
 CaService::CaService(QObject *parent) :
     QObject(parent), m_d(new CaServicePrivate(this))
 {
-
 }
 
 /*!
@@ -816,7 +823,7 @@
  Execute command.
  \param entryId id of an entry.
  \param command command.
- \retval true if operation was successful.
+ \retval 0 if operation was successful.
 
  \example
  \code
@@ -826,15 +833,15 @@
  itemExecute.setTypeName("application");
  itemExecute.setAttribute("application:uid", "0x12345678");
  CaEntry * entryExecute = service->createEntry(itemExecute->id());
- bool result = service->executeCommand(entryExecute->id(), "remove");
+ int result = service->executeCommand(entryExecute->id(), "remove");
  ...
  \b Output:
- result == true
+ result == 0
  \endcode
  */
-bool CaService::executeCommand(int entryId, const QString &command) const
+int CaService::executeCommand(int entryId, const QString &command) const
 {
-    bool result = false;
+    int result = -19;
     
     const QSharedPointer<CaEntry> temporaryEntry = getEntry(entryId);
     
@@ -848,7 +855,7 @@
  Execute command.
  \param entry entry.
  \param command command.
- \retval true if operation was successful.
+ \retval 0 if operation was successful.
 
  \example
  \code
@@ -858,13 +865,13 @@
  itemExecute.setTypeName("url");
  itemExecute.setAttribute("url", "http://www.nokia.com");
  CaEntry * entryExecute = service->createEntry(itemExecute->id());
- bool result = service->executeCommand(*entryExecute, "open");
+ int result = service->executeCommand(*entryExecute, "open");
  ...
  \b Output:
- result == true
+ result == 0
  \endcode
  */
-bool CaService::executeCommand(const CaEntry &entry, const QString &command) const
+int CaService::executeCommand(const CaEntry &entry, const QString &command) const
 {
     return m_d->executeCommand(entry, command);
 }
@@ -938,7 +945,10 @@
  \param servicePublic pointer to public service
  */
 CaServicePrivate::CaServicePrivate(CaService *servicePublic) :
-    m_q(servicePublic), mProxy(new CaClientProxy), 
+    m_q(servicePublic),
+    mCommandHandler(new CaHandlerProxy(QSharedPointer<CaHandlerLoader>
+        (new CaQtSfHandlerLoader()))),
+    mProxy(new CaClientProxy()),
     mNotifierProxy(NULL)
 {
     const ErrorCode connectionResult = mProxy->connect();
@@ -963,7 +973,8 @@
  \param entryIdList list of entry ids
  \retval list of entries (pointers)
  */
-QList< QSharedPointer<CaEntry> > CaServicePrivate::getEntries(const QList<int> &entryIdList) const
+QList< QSharedPointer<CaEntry> > CaServicePrivate::getEntries(
+    const QList<int> &entryIdList) const
 {
     qDebug() << "CaServicePrivate::getEntries"
              << "entryIdList:" << entryIdList;
@@ -1318,9 +1329,9 @@
  Executes command on entry (fe. "open", "remove")
  \param const reference to an entry on which command will be issued
  \param string containing a command
- \retval boolean which is used as an error code return value, true means positive result
+ \retval int which is used as an error code return value, 0 means no errors
  */
-bool CaServicePrivate::executeCommand(const CaEntry &entry,
+int CaServicePrivate::executeCommand(const CaEntry &entry,
                                       const QString &command)
 {
     qDebug() << "CaServicePrivate::executeCommand"
@@ -1328,18 +1339,24 @@
 
     CACLIENTTEST_FUNC_ENTRY("CaServicePrivate::executeCommand");
 
+    if (entry.flags() & UninstallEntryFlag) {
+        return 0;
+    }    
+    
     if (command == caCmdOpen) {
         touch(entry);
     }
 
-    mErrorCode = mProxy->executeCommand(entry, command);
+    int errorCode = mCommandHandler->execute(entry, command);
+    mErrorCode = CaObjectAdapter::convertErrorCode(errorCode);
+    
 
     qDebug() << "CaServicePrivate::executeCommand mErrorCode on return:"
              << mErrorCode;
 
     CACLIENTTEST_FUNC_EXIT("CaServicePrivate::executeCommand");
 
-    return (mErrorCode == NoErrorCode);
+    return errorCode;
 }
 
 /*!
--- a/contentstorage/caclient/stub/inc/caclientproxy.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/caclient/stub/inc/caclientproxy.h	Thu Jul 22 16:37:03 2010 +0100
@@ -25,7 +25,7 @@
 class CaClientNotifierProxy;
 class CaEntry;
 class CaQuery;
-class HsWidgetToken;
+class HsWidgetComponentDescriptor;
 
 /**
  *  CaClientProxy
@@ -131,16 +131,6 @@
                           QList<int>& sourceIdList);
 
     /**
-     * Method for executing command
-     *
-     * @param entry entry on wchich command will be executed
-     * @param command command to execute
-     * @return error code
-     */
-    ErrorCode executeCommand(const CaEntry &entry,
-                             const QString &command);
-
-    /**
      * Method for touching entry.
      *
      * @param entry entry to touch
@@ -166,8 +156,8 @@
                        QList<int> &parentIds);
 
 private:
-    bool hsWidgetExists(int uid);
-    void addWidgetEntry(const HsWidgetToken &widgetToken);
+    int hsWidgetId(int uid);
+    void addWidgetEntry(const HsWidgetComponentDescriptor &widgetToken, int widgetId);
 
     void modifyQueryForSortOrder(QString &queryString,
                                  const CaQuery &query, bool parent) const;
--- a/contentstorage/caclient/stub/inc/caobjectadapter.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/caclient/stub/inc/caobjectadapter.h	Thu Jul 22 16:37:03 2010 +0100
@@ -15,51 +15,31 @@
  *
  */
 
-#ifndef OBJECTADAPTER_H
-#define OBJECTADAPTER_H
+#ifndef CAOBJECTADAPTER_H
+#define CAOBJECTADAPTER_H
 
 // INCLUDES
 #include <QPixmap>
 
+#include <cadefs.h>
+
 class QSize;
 class CaEntry;
 class CaIconDescription;
 class HbIcon;
 
-/**
- *  CaObjectAdapter
- *
- */
 class CaObjectAdapter
 {
 public:
 
-    /**
-     * Create an icon.
-     * @param entry entry.
-     * @param size size of the icon
-     * @return QPixmap.
-     */
-    static HbIcon makeIcon(
-        const CaEntry &entry,
-        const QSize &size);
+    static HbIcon makeIcon(const CaEntry &entry, const QSize &size);
+
+    static void setId(CaEntry &entry, int id);
 
-    /**
-     * Set entry id.
-     * @param entry entry.
-     * @param id entry id.
-     */
-    static void setId(CaEntry &entry,
-                      int id);
-
-    /**
-     * Set icon description id.
-     * @param iconDescription icon description.
-     * @param id icon description id.
-     */
-    static void setId(CaIconDescription &iconDescription,
-                      int id);
+    static void setId(CaIconDescription &iconDescription, int id);
+                      
+    static ErrorCode convertErrorCode(int internalErrorCode);
 
 };
 
-#endif // OBJECTADAPTER_H
+#endif // CAOBJECTADAPTER_H
--- a/contentstorage/caclient/stub/inc/hswidgetcomponentdescriptor.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/caclient/stub/inc/hswidgetcomponentdescriptor.h	Thu Jul 22 16:37:03 2010 +0100
@@ -32,7 +32,11 @@
     QString iconUri;
     QString hidden;
     QString serviceXml;
-    QString version;
+    QString version;    
+    QString library;
+    QString translationFilename;
+    int uid;
+    QString previewImage;
     bool isValid();
 };
 
--- a/contentstorage/caclient/stub/inc/hswidgetcomponentparser.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/caclient/stub/inc/hswidgetcomponentparser.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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
 
@@ -43,6 +44,8 @@
     void parseDescription();
     void parseHidden();
     void parseServiceXml();
+    void parsePreviewImage();
+    void parseTranslationFileName();
     
    
     bool isWidgetTagValid();
--- a/contentstorage/caclient/stub/inc/hswidgetregistryservice.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/caclient/stub/inc/hswidgetregistryservice.h	Thu Jul 22 16:37:03 2010 +0100
@@ -21,7 +21,7 @@
 #include <QObject>
 #include <QSharedPointer>
 
-#include "hsiwidgetprovider.h"
+#include "hswidgetcomponentdescriptor.h"
 
 class HsWidgetRegistryServicePrivate;
 
@@ -37,11 +37,11 @@
 
     virtual ~HsWidgetRegistryService();
 
-    QList<HsWidgetToken> widgets();
+    QList<HsWidgetComponentDescriptor> widgets();
 
 signals:
 
-    void widgetAddedToRegistry(const QList<HsWidgetToken> &widgetTokenList);
+    void widgetAddedToRegistry(const QList<HsWidgetComponentDescriptor> &widgetTokenList);
 
     void widgetRemovedFromRegistry(int uid);
 
@@ -51,7 +51,7 @@
 
 private:
 
-    void emitWidgetAddedToRegistry(const QList<HsWidgetToken> &widgetsAdded);
+    void emitWidgetAddedToRegistry(const QList<HsWidgetComponentDescriptor> &widgetsAdded);
 
     void emitWidgetRemovedFromRegistry(int uid);
 
--- a/contentstorage/caclient/stub/inc/hswidgetregistryservice_p.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/caclient/stub/inc/hswidgetregistryservice_p.h	Thu Jul 22 16:37:03 2010 +0100
@@ -25,7 +25,7 @@
 #include <QMap>
 #include <QFileSystemWatcher>
 
-#include "hsiwidgetprovider.h"
+#include "hswidgetcomponentdescriptor.h"
 
 class HsWidgetRegistryService;
 
@@ -40,20 +40,20 @@
 
     ~HsWidgetRegistryServicePrivate();
 
-    QList<HsWidgetToken> widgets();
+    QList<HsWidgetComponentDescriptor> widgets();
 
 private:
 
     Q_DISABLE_COPY(HsWidgetRegistryServicePrivate)
 
-    IHsWidgetProvider *loadProviderFromPlugin(const QString &pluginName);
+//    IHsWidgetProvider *loadProviderFromPlugin(const QString &pluginName);
 
     QStringList readManifestDirectories(const QString &path);
 
     void doWidgetRemove(const QString &path, const QStringList &originalList,
                         const QStringList &currentList);
 
-    QList<HsWidgetToken> readManifestFile(const QString &path);
+    QList<HsWidgetComponentDescriptor> readManifestFile(const QString &path);
 
     void ensureWidgetRegistryPaths();
 
--- a/contentstorage/caclient/stub/src/caclientproxy.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/caclient/stub/src/caclientproxy.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -94,18 +94,13 @@
 
     HsWidgetRegistryService *rs =
         new HsWidgetRegistryService(mWidgetRegistryPath);
-    QList<HsWidgetToken> widgets = rs->widgets();
+    QList<HsWidgetComponentDescriptor> widgets = rs->widgets();
 
     // Read widgets in order to add synchronize the content of the widgets
     // registry with Content Storage database.
-    foreach(const HsWidgetToken &widgetToken, widgets) {
-        int uid = widgetToken.mUid;
-
-        if (!hsWidgetExists(uid)) {
-            // The given widget does not have a corresonding entry
-            // in the databse, so such an entry needs do be created.
-            addWidgetEntry(widgetToken);
-        }
+    foreach(const HsWidgetComponentDescriptor &widgetToken, widgets) {
+        int uid = widgetToken.uid;
+        addWidgetEntry(widgetToken, hsWidgetId(uid));        
     }
 
     delete rs;
@@ -115,51 +110,82 @@
 /*!
  Returns true if a widget with the given uid exists in the database.
  */
-void CaClientProxy::addWidgetEntry(const HsWidgetToken &widgetToken)
+void CaClientProxy::addWidgetEntry(const HsWidgetComponentDescriptor &widgetToken, 
+                                   int widgetId)
 {
-    QString description = widgetToken.mDescription;
-    QString iconUri = widgetToken.mIconUri;
-    QString library = widgetToken.mLibrary;
-    QString title = widgetToken.mTitle;
-    int uid = widgetToken.mUid;
-    QString uri = widgetToken.mUri;
+    QString description = widgetToken.description;
+    QString iconUri = widgetToken.iconUri;
+    QString library = widgetToken.library;
+    QString title = widgetToken.title;
+    int uid = widgetToken.uid;
+    QString uri = widgetToken.uri;
+    QString previewImage = widgetToken.previewImage;
+    QString translationFileName = widgetToken.translationFilename;
     QSqlDatabase db = dbConnection();
     QSqlQuery query(db);
     QString hexUid;
     hexUid.setNum(uid,16);
     QDir currentDir = QDir::current();
+    if (widgetId == -1) {
+        // Add icon.
+        QString queryAddIcon =
+            "INSERT INTO CA_ICON " \
+            "(IC_FILENAME) " \
+            "VALUES " \
+            "(?)";
 
-    // Add icon.
-    QString queryAddIcon =
-        "INSERT INTO CA_ICON " \
-        "(IC_FILENAME) " \
-        "VALUES " \
-        "(?)";
+        query.prepare(queryAddIcon);
+        query.addBindValue(iconUri);
+        query.exec();
+        qDebug() << query.executedQuery();
 
-    query.prepare(queryAddIcon);
-    query.addBindValue(iconUri);
-    query.exec();
-    qDebug() << query.executedQuery();
+        // Add entry.
+        QString queryAddEntry =
+            "INSERT INTO CA_ENTRY " \
+            "(EN_TEXT, EN_DESCRIPTION, EN_ROLE, EN_TYPE_NAME, EN_ICON_ID) " \
+            "VALUES " \
+            "(?, ?, 1, 'widget', last_insert_rowid())";
+
+        query.prepare(queryAddEntry);
+        query.addBindValue(title);
+        query.addBindValue(description);
+        query.exec();
+        qDebug() << query.executedQuery();
 
-    // Add entry.
-    QString queryAddEntry =
-        "INSERT INTO CA_ENTRY " \
-        "(EN_TEXT, EN_DESCRIPTION, EN_ROLE, EN_TYPE_NAME, EN_ICON_ID) " \
-        "VALUES " \
-        "(?, ?, 1, 'widget', last_insert_rowid())";
+        // Get last id
+        QString queryLastId = "SELECT last_insert_rowid() AS LAST_ID";
+        query.prepare(queryLastId);
+        query.exec();
+        query.next();
+        widgetId = query.value(query.record().indexOf("LAST_ID")).toInt();
+    } else {
+        // update entry.
+        QString queryUpdateEntry =
+            "UPDATE CA_ENTRY SET EN_TEXT = ?, EN_DESCRIPTION = ? WHERE ENTRY_ID = ?";
+            
+        query.prepare(queryUpdateEntry);
+        query.addBindValue(title);
+        query.addBindValue(description);
+        query.addBindValue(widgetId);
+        query.exec();
+        qDebug() << query.executedQuery();
 
-    query.prepare(queryAddEntry);
-    query.addBindValue(title);
-    query.addBindValue(description);
-    query.exec();
-    qDebug() << query.executedQuery();
+        QString queryUpdateIcon =
+            "UPDATE CA_ICON SET IC_FILENAME = ? WHERE" \
+            " ICON_ID = (SELECT EN_ICON_ID FROM CA_ENTRY WHERE ENTRY_ID = ?)";
+            
+        query.prepare(queryUpdateIcon);
+        query.addBindValue(iconUri);
+        query.addBindValue(widgetId);
+        query.exec();
+        qDebug() << query.executedQuery();
 
-    // Get last id
-    QString queryLastId = "SELECT last_insert_rowid() AS LAST_ID";
-    query.prepare(queryLastId);
-    query.exec();
-    query.next();
-    int lastId = query.value(query.record().indexOf("LAST_ID")).toInt();
+        // delete old attribute         
+        query.prepare("DELETE FROM CA_ATTRIBUTE WHERE AT_ENTRY_ID = ?");
+        query.addBindValue(widgetId);
+        query.exec();
+        qDebug() << query.executedQuery();
+    }
 
     // Add attribute packageuid
     QString queryAddAttribute1 =
@@ -169,7 +195,7 @@
         "(?, 'packageuid', ?)";
 
     query.prepare(queryAddAttribute1);
-    query.addBindValue(lastId);
+    query.addBindValue(widgetId);
     query.addBindValue(hexUid);
     query.exec();
     qDebug() << query.executedQuery();
@@ -182,7 +208,7 @@
         "(?, 'widget:uri', ?)";
 
     query.prepare(queryAddAttribute2);
-    query.addBindValue(lastId);
+    query.addBindValue(widgetId);
     query.addBindValue(uri);
     query.exec();
     qDebug() << query.executedQuery();
@@ -195,18 +221,48 @@
         "(?, 'widget:library', ?)";
 
     query.prepare(queryAddAttribute3);
-    query.addBindValue(lastId);
+    query.addBindValue(widgetId);
     query.addBindValue(library);
     query.exec();
     qDebug() << query.executedQuery();
+    
+    // Add attribute preview image
+    if (!previewImage.isEmpty()) {
+        QString queryAddPreviewImage =
+            "INSERT INTO CA_ATTRIBUTE " \
+            "(AT_ENTRY_ID, AT_NAME, AT_VALUE) " \
+            "VALUES " \
+            "(?, 'preview_image_name', ?)";
+
+        query.prepare(queryAddPreviewImage);
+        query.addBindValue(widgetId);
+        query.addBindValue(previewImage);
+        query.exec();
+        qDebug() << query.executedQuery();
+    }
+
+    // Add attribute widget:traslation_file
+    if (!translationFileName.isEmpty()) {
+        QString queryAddWidgetTranslationFile =
+            "INSERT INTO CA_ATTRIBUTE " \
+            "(AT_ENTRY_ID, AT_NAME, AT_VALUE) " \
+            "VALUES " \
+            "(?, 'widget:traslation_file', ?)";
+
+        query.prepare(queryAddWidgetTranslationFile);
+        query.addBindValue(widgetId);
+        query.addBindValue(translationFileName);
+        query.exec();
+        qDebug() << query.executedQuery();
+    }
 }
 
 /*!
  Returns true if a widget with the given uid exists in the database.
  */
-bool CaClientProxy::hsWidgetExists(int uid)
+int CaClientProxy::hsWidgetId(int uid)
 {
-    bool exists(false);
+    int result(-1);
     QSqlDatabase db = dbConnection();
     QSqlQuery query(db);
     QString hexUid;
@@ -223,17 +279,12 @@
     query.prepare(queryString);
     query.addBindValue(hexUid);
 
-    if (query.exec() && query.next()) {
-        // Query returned a non empty result.
-        exists = true;
-    } else {
-        // The widget with the given uid was not found.
-        exists = false;
-    }
-
+    if (query.exec() && query.next()) {        
+        result = query.value(query.record().indexOf("AT_ENTRY_ID")).toInt();
+    } 
     qDebug() << query.executedQuery();
 
-    return exists;
+    return result;
 }
 
 //----------------------------------------------------------------------------
@@ -705,22 +756,6 @@
 //----------------------------------------------------------------------------
 //
 //----------------------------------------------------------------------------
-ErrorCode CaClientProxy::executeCommand(const CaEntry &entry,
-                                        const QString &command)
-{
-    qDebug() << "CaClientProxy::executeCommand" << "entry id: "
-             << entry.id() << "command: " << command;
-
-    ErrorCode result = NoErrorCode;
-    if (command != caCmdOpen && command != QString("remove")) {
-        result = UnknownErrorCode;
-    }
-    return result;
-}
-
-//----------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------
 ErrorCode CaClientProxy::touch(const CaEntry &entry)
 {
     int id = entry.id();
--- a/contentstorage/caclient/stub/src/camenuiconutility.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/caclient/stub/src/camenuiconutility.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -53,6 +53,10 @@
     if (icon.isNull() || !(icon.size().isValid())) {
         icon = HbIcon(QDir(".").absoluteFilePath("resource/application.png"));
     }
+    if (entry.entryTypeName() == "widget") {
+        icon.addBadge(Qt::AlignBottom | Qt::AlignLeft,
+                    HbIcon("qtg_small_homescreen"));
+    }
     return icon;
 }
 
--- a/contentstorage/caclient/stub/src/caobjectadapter.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/caclient/stub/src/caobjectadapter.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -24,9 +24,12 @@
 #include "caicondescription.h"
 #include <cadefs.h>
 
-//----------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------
+/*!
+ * Create an icon.
+ * \param entry a CaEntry instance.
+ * \param size a size of the icon
+ * \retval a HbIcon instance.
+ */
 HbIcon CaObjectAdapter::makeIcon(const CaEntry &entry, const QSize &size)
 {
     HbIcon icon;
@@ -42,21 +45,42 @@
 }
 
 
-//----------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------
-void CaObjectAdapter::setId(CaEntry &entry,
-                            int id)
+/*!
+ * Set entry id.
+ * \param entry entry.
+ * \param id entry id.
+ */
+void CaObjectAdapter::setId(CaEntry &entry, int id)
 {
     entry.setId(id);
 }
 
-//----------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------
-void CaObjectAdapter::setId(CaIconDescription &iconDescription,
-                            int id)
+/*!
+ * Set icon description id.
+ * \param iconDescription icon description.
+ * \param id icon description id.
+ */
+void CaObjectAdapter::setId(CaIconDescription &iconDescription, int id)
 {
     iconDescription.setId(id);
 }
 
+/**
+ * Convert Symbian error code to error code (used in QT code).
+ * \param internalErrorCode Symbian error code.
+ * \retval converted error code (ErrorCode enum).
+ */
+ErrorCode CaObjectAdapter::convertErrorCode(int internalErrorCode)
+{
+    ErrorCode error(NoErrorCode);
+    switch (internalErrorCode) {
+    case 0:
+        error = NoErrorCode;
+        break;
+    default:
+        error = UnknownErrorCode;
+        break;
+    }
+    return error;
+}
+
--- a/contentstorage/caclient/stub/src/caobserver.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/caclient/stub/src/caobserver.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -52,7 +52,7 @@
         ChangeType changeType) const
 {
     qDebug() << "CaClientProxy::entryChanged changeType:" << changeType;
-    CaEntry *caEntry = new CaEntry(entry);
+    QSharedPointer<CaEntry> caEntry(new CaEntry(entry));
     emit signalEntryChanged(*caEntry, changeType);
 }
 
--- a/contentstorage/caclient/stub/src/hswidgetcomponentparser.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/caclient/stub/src/hswidgetcomponentparser.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -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>
 
@@ -28,8 +29,10 @@
 const char DESCRIPTION[] = "description";
 const char HIDDEN[] = "hidden";
 const char SERVICEXML[] = "servicexml";
+const char PREVIEWIAMGE[] = "previewimage";
 const char VERSION[] = "version";
 const char VERSION_1_0[] = "1.0";
+const char TRANSLATIONFILENAME[] = "translationfile";
 
 
 
@@ -146,8 +149,12 @@
             parseHidden();
         } else if (tag == SERVICEXML) {
             parseServiceXml();
-        } 
-	}
+        } else if (tag == PREVIEWIAMGE) {
+            parsePreviewImage();
+        } else if (tag == TRANSLATIONFILENAME) {
+            parseTranslationFileName();
+		}
+    }
 }
 
 
@@ -159,6 +166,7 @@
 	}
     mComponentDescriptor.uri = mParser.text().toString();
 }
+
 void HsWidgetComponentParser::parseIcon()
 {
     mParser.readNext();
@@ -167,6 +175,7 @@
 	}
     mComponentDescriptor.iconUri = mParser.text().toString();
 }
+
 void HsWidgetComponentParser::parseTitle()
 {
     mParser.readNext();
@@ -175,6 +184,7 @@
 	}
     mComponentDescriptor.title = mParser.text().toString();
 }
+
 void HsWidgetComponentParser::parseDescription()
 {
     mParser.readNext();
@@ -183,6 +193,7 @@
 	}
     mComponentDescriptor.description = mParser.text().toString();
 }
+
 void HsWidgetComponentParser::parseHidden()
 {
     mParser.readNext();
@@ -191,6 +202,7 @@
 	}
     mComponentDescriptor.hidden = mParser.text().toString();
 }
+
 void HsWidgetComponentParser::parseServiceXml()
 {
     mParser.readNext();
@@ -200,6 +212,24 @@
     mComponentDescriptor.serviceXml = mParser.text().toString();
 }
 
+void HsWidgetComponentParser::parsePreviewImage()
+{
+    mParser.readNext();
+    if(mParser.tokenType() != QXmlStreamReader::Characters) {
+		return;
+	}
+    mComponentDescriptor.previewImage = mParser.text().toString();
+}
+
+void HsWidgetComponentParser::parseTranslationFileName()
+{
+    mParser.readNext();
+    if (mParser.tokenType() != QXmlStreamReader::Characters) {
+		return;
+        }
+    mComponentDescriptor.translationFilename = mParser.text().toString();
+}
+
 bool HsWidgetComponentParser::isWidgetTagValid() 
 {
    return true;
--- a/contentstorage/caclient/stub/src/hswidgetregistryservice.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/caclient/stub/src/hswidgetregistryservice.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -67,9 +67,9 @@
 /*!
     ?Qt_style_documentation
 */
-QList<HsWidgetToken> HsWidgetRegistryServicePrivate::widgets()
+QList<HsWidgetComponentDescriptor> HsWidgetRegistryServicePrivate::widgets()
 {
-    QList<HsWidgetToken> widgets;
+    QList<HsWidgetComponentDescriptor> widgets;
     QMapIterator<QString, QStringList> i(mManifestDirectories);
 
     while (i.hasNext()) {
@@ -88,6 +88,7 @@
 /*!
     ?Qt_style_documentation
 */
+/*
 IHsWidgetProvider *HsWidgetRegistryServicePrivate::loadProviderFromPlugin(
     const QString &pluginName)
 {
@@ -109,6 +110,7 @@
     // qDebug("Widget provider load failed - Not found.")
     return 0;
 }
+*/
 
 /*!
     ?Qt_style_documentation
@@ -151,10 +153,10 @@
 /*!
     ?Qt_style_documentation
 */
-QList<HsWidgetToken> HsWidgetRegistryServicePrivate::readManifestFile(
+QList<HsWidgetComponentDescriptor> HsWidgetRegistryServicePrivate::readManifestFile(
     const QString &manifestFilePath)
 {
-    QList<HsWidgetToken> widgets;
+    QList<HsWidgetComponentDescriptor> widgets;
     QStringList filters("*.manifest");
     QDir dir(manifestFilePath);
     QStringList manifestDir = dir.entryList(filters, QDir::Files);
@@ -164,44 +166,22 @@
         QString fileName = manifestDir.first();
         HsWidgetComponentParser componentParser(dir.absoluteFilePath(fileName));
         if ( !componentParser.error() ) {
-            HsWidgetToken widgetToken;
-            HsWidgetComponentDescriptor widgetDescriptor = componentParser.widgetComponentDescriptor();
-            widgetToken.mUri = widgetDescriptor.uri;
-            widgetToken.mLibrary = manifestFilePath + "/" + widgetDescriptor.uri + ".dll";
-            widgetToken.mTitle = widgetDescriptor.title;
+            
+            HsWidgetComponentDescriptor widgetDescriptor = componentParser.widgetComponentDescriptor();            
+            widgetDescriptor.library = manifestFilePath + "/" + widgetDescriptor.uri + ".dll";
             if (widgetDescriptor.iconUri.length() > 0 ) {
-                widgetToken.mIconUri = manifestFilePath + "/" + widgetDescriptor.iconUri;
-            }
-            widgetToken.mDescription = widgetDescriptor.description;
+                widgetDescriptor.iconUri = manifestFilePath + "/" + widgetDescriptor.iconUri;
+            }            
+            if (widgetDescriptor.previewImage.length() > 0 ) {
+                widgetDescriptor.previewImage = manifestFilePath + "/" + widgetDescriptor.previewImage;
+            }            
+
             int widgetUid = dir.dirName().toUInt(0, 16);
-            widgetToken.mUid = widgetUid;
-            widgets << widgetToken;
+            widgetDescriptor.uid = widgetUid;
+            widgets << widgetDescriptor;
             qDebug() << "HsWidgetRegistryServicePrivate::readManifestFile - " \
                      "widget added: " << fileName;
         }
-#if 0
-
-        if (fileName != "hsposterwidgetprovider.manifest") {
-            // Directory differs from the poster widget's directory
-            // which is not supported for the time being.
-//            manifest.loadFromXml(dir.absoluteFilePath(fileName));
-//            widgets = manifest.widgets();
-            int widgetUid = dir.dirName().toUInt(0, 16);
-
-            // ?
-            for (int i=0; i<widgets.count(); i++) {
-                widgets[i].mUid = widgetUid;
-                widgets[i].mLibrary = manifestFilePath + "/" + widgets[i].mLibrary;
-                if (widgets[i].mIconUri != "") {
-                    // ?
-                    widgets[i].mIconUri = manifestFilePath + "/" + widgets[i].mIconUri;
-                }
-            }
-
-            qDebug() << "HsWidgetRegistryServicePrivate::readManifestFile - " \
-                     "widget added: " << fileName;
-        }
-#endif                
     }
     return widgets;
 }
@@ -219,8 +199,8 @@
     for(int i=0; i < pathList.count(); i++) {
         QDir registryDir(pathList.at(i));
 
-    	if(!registryDir.exists()) {
-    		// ?
+        if(!registryDir.exists()) {
+            // ?
             registryDir.mkpath(pathList.at(i));
         }
     }
@@ -266,7 +246,7 @@
     Q_UNUSED(newValue);
     /*
     if ((newValue & KSASwisOperationMask) == ESASwisNone) {
-    	// ?
+        // ?
         mInstallerObserver.unSubscribe();
         mInstallerObserver.disconnect();
         QStringList originalList = mManifestDirectories.value(mLatestChangedDirectory);
@@ -317,7 +297,7 @@
     Fetch available widgets information
     Return List of widget tokens.
 */
-QList<HsWidgetToken> HsWidgetRegistryService::widgets()
+QList<HsWidgetComponentDescriptor> HsWidgetRegistryService::widgets()
 {
     return mPrivate->widgets();
 }
@@ -345,7 +325,7 @@
     Emits the widgetAddedToRegistry() signal
     \a widgetsAdded Identifies the added widgets.
 */
-void HsWidgetRegistryService::emitWidgetAddedToRegistry(const QList<HsWidgetToken> &widgetsAdded)
+void HsWidgetRegistryService::emitWidgetAddedToRegistry(const QList<HsWidgetComponentDescriptor> &widgetsAdded)
 {
     emit widgetAddedToRegistry(widgetsAdded);
 }
--- a/contentstorage/cahandler/app/app.pro	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/cahandler/app/app.pro	Thu Jul 22 16:37:03 2010 +0100
@@ -37,7 +37,6 @@
     LIBS += \
     -leuser \
     -lecom \
-    -lswinstcli \
     -lcautils \
     -lapgrfx \
     -lws32 \
@@ -48,9 +47,10 @@
     -lefsrv \
     -lsif \
     -lscrclient \
-    -lxqutils
+    -lxqutils \
+    -lcaclient
 
-    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 Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/cahandler/app/inc/caapphandler.h	Thu Jul 22 16:37:03 2010 +0100
@@ -15,106 +15,47 @@
  *
  */
 
-#ifndef C_CAAPPHANDLER_H
-#define C_CAAPPHANDLER_H
-
-#include <e32base.h>
+#ifndef CAAPPHANDLER_H
+#define CAAPPHANDLER_H
 
-// forward declarations
-class CEikonEnv;
-class CCaInnerEntry;
-class CCaUninstallOperation;
-class CCaUsifUninstallOperation;
+#include <QObject>
+
+#include "cahandler.h"
 
-/**
- *  Command handler for application entries.
- *
- *  @lib caclient.lib
- */
-NONSHARABLE_CLASS( CCaAppHandler ): public CBase
-    {
+class CEikonEnv;
+class CCaUsifUninstallOperation;
+class CaEntry;
 
-public:
-    /**
-    * Allocates memory for and initializes CCaAppHandler object
-    */
-    static CCaAppHandler* NewL();
-
-    /**
-     * Destructor.
-     */
-    virtual ~CCaAppHandler();
-
-protected:
-
-    CCaAppHandler();
-
-    void ConstructL();
+class CaAppHandler: public QObject, public CaHandler
+{
+    Q_OBJECT
+    Q_INTERFACES(CaHandler)
 
 public:
 
-    /**
-     * Handle command.
-     * @param aItem Item of supported type.
-     * @param aCommand Command.
-     * @param aParams. Command parameters.
-     * @param aStatus Observer request status. When the operation completes,
-     * this status will be completed with the resulting error code.
-     * @return Asynchronous operation. Owned by the caller.
-     */
-    void HandleCommandL( CCaInnerEntry& aEntry, const TDesC8& aCommand );
+    explicit CaAppHandler(QObject *parent = 0);
+
+    virtual ~CaAppHandler();
+
+public:
+
+    int execute(const CaEntry &entry, const QString &command);
 
 private:
-    /**
-     * Launches application
-     * @param aUid UID of the application to launch
-     * @param aParam command parameters
-     * @param aViewId id of the view the application is to start in
-     */
-    void LaunchApplicationL( const TUid aUid, const TDesC8 &aParam,
-            TInt aViewId );
 
-    /**
-     * Closes application
-     * @param aEntry the entry represeting application to close
-     */
-    void CloseApplicationL( CCaInnerEntry& aEntry );
+    void launchApplicationL(const TUid uid, TInt viewId);
 
-    /**
-     * Uninstall application 
-     * @param aEntry the entry represeting application to uninstall
-     */
-    void HandleRemoveL( CCaInnerEntry &aEntry );
+    int closeApplication(const EntryFlags &flags, TInt windowGroupId);
 
-    /**
-     * Gets component id 
-     * @param aEntry the entry 
-     * @param aSoftwareType indicates software type
-     * @return component id
-     */
-    TInt GetComponentIdL( const CCaInnerEntry &aEntry,
-            const TDesC& aSoftwareType );
+    int handleRemove(const EntryFlags &flags,
+        const QString &typeName,
+        const QString &componentId);
     
-    /**
-     * Start uninstall operation via usif 
-     * @param aComponentId component id
-     */
-    void StartUsifUninstallL( TInt aComponentId );
-
-    
-    /**
-     * Start uninstall operation via swi 
-     * @param aEntry the entry 
-     */
-    void StartSwiUninstallL(CCaInnerEntry &aEntry );
-
+    void startUsifUninstallL(TInt componentId);
     
 private:
-    // data
+    CEikonEnv *iEikEnv;
+    CCaUsifUninstallOperation *iUsifUninstallOperation;
+};
 
-    CEikonEnv* iEikEnv;
-    CCaUninstallOperation* iUninstallOperation;
-    CCaUsifUninstallOperation* iUsifUninstallOperation;
-    };
-
-#endif // C_CAAPPHANDLER_H
+#endif // CAAPPHANDLER_H
--- a/contentstorage/cahandler/app/inc/caapphandlerplugin.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/cahandler/app/inc/caapphandlerplugin.h	Thu Jul 22 16:37:03 2010 +0100
@@ -15,8 +15,8 @@
  *
  */
 
-#ifndef CA_APP_HANDLER_PLUGIN_H
-#define CA_APP_HANDLER_PLUGIN_H
+#ifndef CAAPPHANDLERPLUGIN_H
+#define CAAPPHANDLERPLUGIN_H
 
 #include <QObject>
 #include <qserviceplugininterface.h>
@@ -34,4 +34,4 @@
                             QAbstractSecuritySession *session);
 };
 
-#endif
+#endif // CAAPPHANDLERPLUGIN_H
--- a/contentstorage/cahandler/app/inc/cas60apphandleradapter.h	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#ifndef CA_S60_APP_HANDLER_ADAPTER_H
-#define CA_S60_APP_HANDLER_ADAPTER_H
-
-#include <cadefs.h>
-#include <QString>
-
-#include "cahandler.h"
-
-class CCaInnerEntry;
-
-class CaS60AppHandlerAdapter: public QObject, public CaHandler
-{
-    Q_OBJECT
-    Q_INTERFACES(CaHandler)
-
-public:
-    int execute(CCaInnerEntry &innerEntry, const QString &commandName);
-
-};
-
-#endif // CA_S60_APP_HANDLER_ADAPTER_H
--- a/contentstorage/cahandler/app/inc/cauninstalloperation.h	Fri Jun 11 16:25:06 2010 +0100
+++ /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 Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/cahandler/app/src/caapphandler.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -15,6 +15,8 @@
  *
  */
 
+#include <QString>
+#include <e32base.h>
 #include <w32std.h>
 #include <apgtask.h>
 #include <apgcli.h>
@@ -27,297 +29,218 @@
 #include <usif/usifcommon.h>
 #include <usif/scr/scr.h>
 
+#include <cadefs.h>
+#include <caentry.h>
+
 #include "caapphandler.h"
 #include "cainnerentry.h"
-#include "cauninstalloperation.h"
 #include "causifuninstalloperation.h"
 #include "catasklist.h"
-
 #include "cautils.h"
+#include "caclient_defines.h"
 #include "cadef.h"
 
-// ======== MEMBER FUNCTIONS ========
 using namespace Usif;
 
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CCaAppHandler::~CCaAppHandler()
+static const char caTypeApp[] = "application";
+static const char caTypePackage[] = "package";
+static const char caTypeWidget[] = "widget";
+static const char caAttrView[] = "view";
+static const char caCmdClose[] = "close";
+static const char caAttrWindowGroupId[] = "window_group_id";
+static const char caAttrComponentId[] = "component_id";
+
+/*!
+ *  Command handler for application entries.
+ *
+ *  \lib caclient.lib
+ */
+
+/*!
+ * Constructor.
+ */
+CaAppHandler::CaAppHandler(QObject *parent):
+    iEikEnv(CEikonEnv::Static()),
+    iUsifUninstallOperation(NULL)
 {
-    delete iUninstallOperation;
+    Q_UNUSED(parent);
+}
+
+/*!
+ * Destructor.
+ */
+CaAppHandler::~CaAppHandler()
+{
     delete iUsifUninstallOperation;
 }
 
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CCaAppHandler *CCaAppHandler::NewL()
+/*!
+ * Execute a given command.
+ * \param entry a reference to a CaEntry instance.
+ * \param command a given command.
+ * \retval an error code.
+ */
+int CaAppHandler::execute(const CaEntry &entry, const QString &command)
 {
-    CCaAppHandler *handler = new(ELeave) CCaAppHandler();
-    CleanupStack::PushL( handler );
-    handler->ConstructL();
-    CleanupStack::Pop( handler );
-    return handler;
-}
+    int result(KErrGeneral);
+    if (command == caCmdOpen && entry.entryTypeName() == caTypeApp) {
+        QString viewIdValue = entry.attribute(caAttrView);
+        bool viewIdIsCorrect(true);
+        int viewId(-1);
+        if (!viewIdValue.isNull()) {
+            viewId = viewIdValue.toInt(&viewIdIsCorrect, 0);
+        }
+        if (viewIdIsCorrect) {
+            QString uidValue =
+                entry.attribute(APPLICATION_UID_ATTRIBUTE_NAME);
+            int uid = uidValue.toInt();
+            TRAP(result, launchApplicationL(TUid::Uid(uid), viewId));
+        }
+    } else if (command == caCmdClose && entry.entryTypeName() == caTypeApp ) {
+        QString windowGroupId = entry.attribute(caAttrWindowGroupId);
+        if (!windowGroupId.isNull()) {
+            result = closeApplication(entry.flags(), windowGroupId.toInt());
+        }
+    } else if (command == caCmdRemove) {
+        QString componentId(entry.attribute(caAttrComponentId));
+        result = handleRemove(entry.flags(),
+            entry.entryTypeName(),
+            componentId);
+    } else {
+        result = KErrNotSupported;
+    }
 
-// ---------------------------------------------------------
-// CCaAppHandler::CCaAppHandler
-// ---------------------------------------------------------
-//
-CCaAppHandler::CCaAppHandler()
-{
-    iEikEnv = CEikonEnv::Static();
-    iUninstallOperation = NULL;
-    iUsifUninstallOperation = NULL;
-}
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CCaAppHandler::ConstructL()
-{
+    return result;
 }
 
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CCaAppHandler::HandleCommandL(
-        CCaInnerEntry &aEntry, const TDesC8 &aCommand )
+/*!
+ * Launch application
+ * \param uid UID of the application to launch.
+ * \param viewId id of the view the application is to start in.
+ */
+void CaAppHandler::launchApplicationL(const TUid uid, TInt viewId)
 {
+    if (viewId > 0 && iEikEnv) {
+        TVwsViewId view(uid, TUid::Uid(viewId));
+        iEikEnv->EikAppUi()->ActivateViewL( view );
+    } else {
+        RWsSession wsSession;
+        User::LeaveIfError(wsSession.Connect());
+        CleanupClosePushL<RWsSession>(wsSession);
 
-    if( aCommand == KCaCmdOpen()
-            && aEntry.GetEntryTypeName() == KCaTypeApp() )
-        {
-        TInt viewId(-1);
-        TPtrC viewIdValue;
-        if( aEntry.FindAttribute( KCaAttrView(), viewIdValue ) )
-            {
-            if( MenuUtils::GetTUint( viewIdValue, (TUint &) viewId )
-                    != KErrNone )
-                {
-                User::Leave( KErrCorrupt );
-                }
-            }
-        LaunchApplicationL(
-                TUid::Uid( aEntry.GetUid() ), KNullDesC8(), viewId );
-        }
-    else if ( aCommand == KCaCmdClose()
-            && aEntry.GetEntryTypeName() == KCaTypeApp() )
-        {
-        CloseApplicationL( aEntry );
-        }
-    else if ( aCommand == KCaCmdRemove() )
-        {
-        HandleRemoveL(aEntry);
-        }
-    else
-        {
-        User::Leave( KErrNotSupported );
-        }
-}
+        CCaTaskList* taskList = CCaTaskList::NewLC(wsSession);
+        TApaTask task = taskList->FindRootApp(uid);
+        CleanupStack::PopAndDestroy(taskList);
 
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CCaAppHandler::LaunchApplicationL(
-        const TUid aUid, const TDesC8 &aParam, TInt aViewId )
-{
-    if( aViewId > 0 && iEikEnv )
-        {
-        TUid viewId = TUid::Uid( aViewId );
-        TVwsViewId view( aUid, viewId );
-        iEikEnv->EikAppUi()->ActivateViewL( view );
-        }
-    else
-        {
-        RWsSession wsSession;
-        User::LeaveIfError( wsSession.Connect() );
-        CleanupClosePushL<RWsSession>( wsSession );
-
-        CCaTaskList* taskList = CCaTaskList::NewLC( wsSession );
-        TApaTask task = taskList->FindRootApp( aUid );
-        CleanupStack::PopAndDestroy( taskList );
-
-        if( task.Exists() )
-            {
+        if (task.Exists()) {
             task.BringToForeground();
-            }
-        else
-            {
+        } else {
             // 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 );
+            TApaAppInfo* appInfo = new(ELeave) TApaAppInfo;
+            CleanupStack::PushL(appInfo);
             TApaAppCapabilityBuf capabilityBuf;
             RApaLsSession appArcSession;
-            User::LeaveIfError( appArcSession.Connect() );
-            CleanupClosePushL<RApaLsSession>( appArcSession );
+            User::LeaveIfError(appArcSession.Connect());
+            CleanupClosePushL<RApaLsSession>(appArcSession);
 
-            User::LeaveIfError( appArcSession.GetAppInfo( *appInfo, aUid ) );
-            User::LeaveIfError( appArcSession.GetAppCapability(
-                                   capabilityBuf, aUid ) );
+            User::LeaveIfError(appArcSession.GetAppInfo(*appInfo, uid));
+            User::LeaveIfError(appArcSession.GetAppCapability(
+               capabilityBuf, uid));
 
             TApaAppCapability &caps = capabilityBuf();
             CApaCommandLine *cmdLine = CApaCommandLine::NewLC();
-            cmdLine->SetExecutableNameL( appInfo->iFullName );
+            cmdLine->SetExecutableNameL(appInfo->iFullName);
+
+            if (caps.iLaunchInBackground) {
+                cmdLine->SetCommandL(EApaCommandBackground);
+            } else {
+                cmdLine->SetCommandL(EApaCommandRun);
+            }
 
-            if( caps.iLaunchInBackground )
-                {
-                cmdLine->SetCommandL( EApaCommandBackground );
-                }
-            else
-                {
-                cmdLine->SetCommandL( EApaCommandRun );
-                }
+            cmdLine->SetTailEndL(KNullDesC8);
+
+            User::LeaveIfError(appArcSession.StartApp(*cmdLine));
 
-            cmdLine->SetTailEndL( aParam );
-
-            User::LeaveIfError( appArcSession.StartApp( *cmdLine ) );
-
-            CleanupStack::PopAndDestroy( cmdLine );
-            CleanupStack::PopAndDestroy( &appArcSession );
-            CleanupStack::PopAndDestroy( appInfo );
+            CleanupStack::PopAndDestroy(cmdLine);
+            CleanupStack::PopAndDestroy(&appArcSession);
+            CleanupStack::PopAndDestroy(appInfo);
         }
         CleanupStack::PopAndDestroy( &wsSession );
     }
 }
 
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CCaAppHandler::CloseApplicationL( CCaInnerEntry &aEntry )
+/*!
+ * Closes application.
+ * \param flags an entry flags.
+ * \param windowGroupId window group id.
+ * \retval an error code.
+ */
+int CaAppHandler::closeApplication(const EntryFlags &flags, int windowGroupId)
 {
-    RWsSession wsSession;
-    User::LeaveIfError( wsSession.Connect() );
-    CleanupClosePushL<RWsSession>( wsSession );
-
-    if( ( aEntry.GetFlags() & ERunning )
-            && !( aEntry.GetFlags() & ESystem ) )
-        {
-        RBuf value;
-        CleanupClosePushL( value );
-        value.CreateL( KCaMaxAttrValueLen );
-        if( aEntry.FindAttribute( KCaAttrWindowGroupId, value ) )
-            {
-            TInt wgId( KErrNotFound );
-            TLex16 parser( value );
-            if( KErrNone == parser.Val( wgId ) && wgId > 0 )
-                {
-                TWsEvent event;
-                event.SetTimeNow();
-                event.SetType( KAknShutOrHideApp );
-                wsSession.SendEventToWindowGroup( wgId, event );
-                }
-            }
-        CleanupStack::PopAndDestroy( &value );
+    int result(KErrNone);
+    if (flags.testFlag(RunningEntryFlag) && windowGroupId > 0) {
+        RWsSession wsSession;
+        result = wsSession.Connect();
+        if (result==KErrNone) {
+            TWsEvent event;
+            event.SetTimeNow();
+            event.SetType(KAknShutOrHideApp);
+            wsSession.SendEventToWindowGroup(windowGroupId, event);
+        }
+        wsSession.Close();
     }
-
-    CleanupStack::PopAndDestroy( &wsSession );
+    return result;
 }
 
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CCaAppHandler::HandleRemoveL( CCaInnerEntry &aEntry )
+/*!
+ * Uninstall application.
+ * \param flags flags of the application which is to uninstall.
+ * \param typeName type name of the entry.
+ * \param componentId component id.
+ * \retval an error code.
+ */
+int CaAppHandler::handleRemove(const EntryFlags &flags,
+    const QString &typeName,
+    const QString &componentId)
 {
-    if (!( aEntry.GetFlags() & ERemovable ) )
-        {
-        User::Leave( KErrAccessDenied );
-        }
-    if ( aEntry.GetEntryTypeName() == KCaTypeApp() )
-        {
-        TComponentId componentId( GetComponentIdL( aEntry,KSoftwareTypeJava ) );
-        if ( componentId != KErrNotFound )
-            {
-            StartUsifUninstallL( componentId );
-            }
-        else
-            {
-            StartSwiUninstallL( aEntry );
+    int result(KErrNone);
+    if (flags.testFlag(RemovableEntryFlag)) {
+        if (typeName == caTypeApp
+            || typeName == caTypePackage
+            || typeName == caTypeWidget) {
+            if(componentId.isNull()) {
+                result = KErrNotFound;
+            } else {
+                bool convertStatus(false);
+                int id = componentId.toInt(&convertStatus);
+                if (convertStatus) {
+                    TRAP(result, startUsifUninstallL(id));
+                } else {
+                    result = KErrGeneral;
+                }
             }
         }
-    else if ( aEntry.GetEntryTypeName() == KCaTypeWidget() )
-        {
-        StartSwiUninstallL( aEntry );
+        else {
+            result = KErrNotSupported;
         }
-    else if( aEntry.GetEntryTypeName() == KCaTypePackage() )
-        {
-        TPtrC componentId;
-        if ( aEntry.FindAttribute( KCaAttrComponentId, componentId ) )
-            {
-            TInt32 id ;
-            TLex idDesc;
-            idDesc.Assign( componentId );
-            User::LeaveIfError( idDesc.Val( id ) );
-            StartUsifUninstallL( id );
-            }
-        }
-    else
-        {
-        User::Leave( KErrNotSupported );
-        }
+    } else {
+        result = KErrAccessDenied;
+    }
+    return result;
 }
 
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CCaAppHandler::GetComponentIdL( const CCaInnerEntry &aEntry,
-        const TDesC& aSoftwareType )
+/*!
+ * Start uninstall operation via usif.
+ * \param componentId component id.
+ */
+void CaAppHandler::startUsifUninstallL(TInt componentId)
 {
-    TInt id(KErrNotFound);
-    RSoftwareComponentRegistry scr;
-    CleanupClosePushL(scr);
-    User::LeaveIfError(scr.Connect());
-    CComponentFilter* compFilter = CComponentFilter::NewLC();
-    compFilter->AddPropertyL(_L("Uid"), aEntry.GetUid());
-    compFilter->SetSoftwareTypeL(aSoftwareType);
-    RArray<TComponentId> componentIdList;
-    CleanupClosePushL(componentIdList);
-    scr.GetComponentIdsL(componentIdList, compFilter);
-    if (componentIdList.Count() > 0)
-        {
-        id = componentIdList[0];
-        }
-    CleanupStack::PopAndDestroy(&componentIdList);
-    CleanupStack::PopAndDestroy(compFilter);
-    CleanupStack::PopAndDestroy(&scr);
-    return id;
+    if (iUsifUninstallOperation && iUsifUninstallOperation->IsActive()) {
+        User::Leave( KErrInUse );
+    }
+    delete iUsifUninstallOperation;
+    iUsifUninstallOperation = NULL;
+    iUsifUninstallOperation = CCaUsifUninstallOperation::NewL(componentId);
 }
 
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CCaAppHandler::StartUsifUninstallL( TInt aComponentId )
-{
-    if ( iUsifUninstallOperation && iUsifUninstallOperation->IsActive() )
-        {
-        User::Leave( KErrInUse );
-        }
-    delete iUsifUninstallOperation;
-    iUsifUninstallOperation = NULL;
-    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/caapphandlerplugin.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/cahandler/app/src/caapphandlerplugin.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -23,7 +23,6 @@
 #include "cahandlerloader.h"
 #include "caapphandler.h"
 #include "caapphandlerplugin.h"
-#include "cas60apphandleradapter.h"
 
 /*!
     \class CaAppHandlerPlugin
@@ -35,7 +34,7 @@
     \param descriptor Service descriptor.
     \param context Ignored.
     \param session Ignored.
-    \return An instance of the CaS60HandlerAdapter<CCaAppHandler> when descriptor interface name
+    \retval an instance of the CaAppHandler when descriptor interface name
     is "com.nokia.homescreen.ICommandHandler", NULL otherwise.
 */
 QObject *CaAppHandlerPlugin::createInstance(const QServiceInterfaceDescriptor &descriptor,
@@ -47,42 +46,19 @@
 
     if (descriptor.interfaceName() ==
             "com.nokia.homescreen.ICommandHandler") {
-        return new CaS60AppHandlerAdapter();
+        return new CaAppHandler();
     } else {
         return 0;
     }
 }
+
+#ifdef COVERAGE_MEASUREMENT
+#pragma CTC SKIP
+#endif //COVERAGE_MEASUREMENT (QT macro)
+
 Q_EXPORT_PLUGIN2(caapphandlerplugin, CaAppHandlerPlugin)
 
-
-/*!
-    \class CaHandler
-    \ingroup
-    \brief Interface for command handlers
-*/
-
-/*!
-    \fn int CaHandler::execute(const CaEntry &entry, const QString &commandName) = 0
-    \param entry Subject of the command.
-    \param commandName The name of the command to execute.
-    Returns 0 on success, error code otherwise.
-    \sa e32err.h for error code descriptions.
-*/
+#ifdef COVERAGE_MEASUREMENT
+#pragma CTC ENDSKIP
+#endif //COVERAGE_MEASUREMENT
 
-/*!
-    \class CaS60HandlerAdapter<typename Plugin>
-    \ingroup
-    \brief Adapter for S60 command handlers.
-
-    Adapts S60 command handlers to CaHandler interface
-
-    \sa CaHandler
-*/
-
-/*!
-    \fn int CaS60HandlerAdapter<typename Plugin>::execute(const CaEntry &entry, const QString &commandName)
-    \param entry Subject of the command.
-    \param commandName The name of the command to execute.
-    \return 0 on success, error code otherwise.
-    \sa e32err.h for error code descriptions.
-*/
--- a/contentstorage/cahandler/app/src/cas60apphandleradapter.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:  ?Description
- *
- */
-
-#include <XQConversions>
-#include <utf.h>
-#include <QScopedPointer>
-
-#include "cas60apphandleradapter.h"
-#include "caapphandler.h"
-#include "cainnerentry.h"
-
-int CaS60AppHandlerAdapter::execute(CCaInnerEntry &innerEntry, const QString &commandName)
-{
-    QScopedPointer<HBufC8> commandNameDesc8(XQConversions::qStringToS60Desc8(commandName));
-    TRAPD(result,
-        static QScopedPointer<CCaAppHandler> plugin(CCaAppHandler::NewL());
-        plugin->HandleCommandL(innerEntry, commandNameDesc8->Des());
-        );
-    return result;
-}
--- a/contentstorage/cahandler/app/src/cauninstalloperation.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ /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/app/src/causifuninstalloperation.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/cahandler/app/src/causifuninstalloperation.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -93,6 +93,9 @@
     iUninstaller.CancelOperation();
     }
 
+#ifdef COVERAGE_MEASUREMENT
+#pragma CTC SKIP
+#endif //COVERAGE_MEASUREMENT (error ignored)
 // ---------------------------------------------------------------------------
 // CCaUsifUninstallOperation::RunError
 // ---------------------------------------------------------------------------
@@ -101,3 +104,7 @@
     {
     return KErrNone;
     }
+#ifdef COVERAGE_MEASUREMENT
+#pragma CTC ENDSKIP
+#endif //COVERAGE_MEASUREMENT
+
--- a/contentstorage/cahandler/tapp/inc/catapphandler.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/cahandler/tapp/inc/catapphandler.h	Thu Jul 22 16:37:03 2010 +0100
@@ -35,11 +35,11 @@
     ~CaTappHandler();
 
     Q_INVOKABLE
-    int execute(CCaInnerEntry& innerEntry, const QString& command);
+    int execute(const CaEntry &entry, const QString &command);
 
 private:
-    XQApplicationManager* mAiwMgr;
+    XQApplicationManager *mAiwMgr;
 
 };
 
-#endif
+#endif // CATAPPHANDLER_H
--- a/contentstorage/cahandler/tapp/src/catapphandler.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/cahandler/tapp/src/catapphandler.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -23,10 +23,9 @@
 
 #include "caentry.h"
 #include "catapphandler.h"
-#include "cainnerentry.h"
 #include "caclient_defines.h"
 
-_LIT(hsitemLaunchUri, "item:launchuri");
+static const QString hsitemLaunchUri("item:launchuri");
 
 QTM_USE_NAMESPACE
 
@@ -59,24 +58,29 @@
  Uses XQApplicationManager
  \param entry Subject of the \a command.
  \param command Description of the command.
- \return Error code described in QSERVICEMANAGER.H
+ \retval Error code described in QSERVICEMANAGER.H
  */
-int CaTappHandler::execute(CCaInnerEntry& innerEntry, const QString& command)
+int CaTappHandler::execute(const CaEntry& entry, const QString& command)
 {
-    int error = 0; // this returns Error enum from QSERVICEMANAGER.H
+    // this returns Error enum from QSERVICEMANAGER.H
+    int error = 0;
     if (command == caCmdOpen) {
-        TPtrC attribute;
-        innerEntry.FindAttribute(hsitemLaunchUri, attribute);
-
-        // e.g. QUrl url ("application://101F7AE7?");
-        QUrl url(QString::fromUtf16(attribute.Ptr(), attribute.Length()));
-        QScopedPointer<XQAiwRequest> request(mAiwMgr->create(url, false));
-        if (!request.isNull()) {
-            bool res = request->send();
-            if (!res) {
-                error = request->lastError();
+        QString attribute = entry.attribute(hsitemLaunchUri);
+        if (!attribute.isNull()) {
+            // e.g. QUrl("appto://101F7AE7?");
+            QScopedPointer<XQAiwRequest> request(mAiwMgr->create(QUrl(attribute),
+                false));
+            if (!request.isNull()) {
+                bool res = request->send();
+                if (!res) {
+                    error = request->lastError();
+                }
             }
         }
+    } else {
+        // TODO: error code cleanning and an appropriate conversion (in other classes too).
+        static const int NotSupportedErrorCode = 100;
+        error = NotSupportedErrorCode;
     }
     return error;
 }
--- a/contentstorage/cahandler/tapp/src/catapphandlerplugin.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/cahandler/tapp/src/catapphandlerplugin.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -18,9 +18,6 @@
 #include "catapphandlerplugin.h"
 #include "catapphandler.h"
 
-#ifdef COVERAGE_MEASUREMENT
-#pragma CTC SKIP
-#endif //COVERAGE_MEASUREMENT
 /*!
     \class CaTappHandlerPlugin
     \ingroup
@@ -31,7 +28,7 @@
     \param descriptor service descriptor
     \param context ignored
     \param session ignored
-    \return An instance of the CaTapphandler object when descriptor interface name
+    \retval An instance of the CaTapphandler object when descriptor interface name
     is "com.nokia.homescreen.ICommandHandler", NULL otherwise.
 */
 QObject *CaTappHandlerPlugin::createInstance(const QServiceInterfaceDescriptor &descriptor,
@@ -48,6 +45,10 @@
     }
 }
 
+#ifdef COVERAGE_MEASUREMENT
+#pragma CTC SKIP
+#endif //COVERAGE_MEASUREMENT (QT macro)
+
 Q_EXPORT_PLUGIN2(catapphandlerplugin, CaTappHandlerPlugin)
 
 #ifdef COVERAGE_MEASUREMENT
--- a/contentstorage/cahandler/tapp/tapp.pro	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/cahandler/tapp/tapp.pro	Thu Jul 22 16:37:03 2010 +0100
@@ -40,8 +40,8 @@
 	
 	LIBS += -lxqservice \
             -lxqutils \
-            -lcautils
-#        -lhsutils
+            -lcautils \
+            -lcaclient
 
 }
 
--- a/contentstorage/cahandler/url/inc/cas60urlhandleradapter.h	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#ifndef CA_S60_URL_HANDLER_ADAPTER_H
-#define CA_S60_URL_HANDLER_ADAPTER_H
-
-#include <QString>
-
-#include "cahandler.h"
-
-class CCaInnerEntry;
-
-class CaS60UrlHandlerAdapter: public QObject, public CaHandler
-{
-    Q_OBJECT
-    Q_INTERFACES(CaHandler)
-
-public:
-    int execute(CCaInnerEntry &innerEntry, const QString &commandName);
-
-};
-
-#endif //CA_S60_URL_HANDLER_ADAPTER_H
--- a/contentstorage/cahandler/url/inc/caurlhandler.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/cahandler/url/inc/caurlhandler.h	Thu Jul 22 16:37:03 2010 +0100
@@ -15,75 +15,26 @@
  *
  */
 
-#ifndef __CCAURLHANDLER_H__
-#define __CCAURLHANDLER_H__
-
-#include <e32base.h>
-
-class CCaInnerEntry;
+#ifndef CAURLHANDLER_H
+#define CAURLHANDLER_H
 
-// Constants
-const TUid KUidBrowser =
-    {
-    0x10008D39
-    };
-_LIT( KBrowserPrefix, "4 " );
-
-/**
- *  Command handler for url entries.
- *
- *  @lib caclient.lib
- */
-NONSHARABLE_CLASS( CCaUrlHandler ): public CBase
-    {
-
-public:
-    // construction
+#include "cahandler.h"
 
-    /**
-     * Destructor.
-     */
-    virtual ~CCaUrlHandler();
-
-    /**
-     * Two-phased constructor. Leaves on failure.
-     * @return The constructed object.
-     */
-    static CCaUrlHandler* NewL();
+class QString;
 
-protected:
-    // construction
-
-    /**
-     * Constructor.
-     * @param aMenu Menu.
-     */
-    CCaUrlHandler();
-
-    /**
-     * Second-phase constructor.
-     */
-    void ConstructL();
+class CaUrlHandler: public QObject, public CaHandler
+{
+    Q_OBJECT
+    Q_INTERFACES(CaHandler)
 
 public:
 
+    explicit CaUrlHandler(QObject *parent = 0);
 
-    /**
-     * Handle command.
-     * @param aEntry The url entry to be processed.
-     * @param aCommand Command.
-     */
-    void HandleCommandL( CCaInnerEntry& aEntry, const TDesC8& aCommand );
+    virtual ~CaUrlHandler();
 
-private:
-    // internal
+    int execute(const CaEntry &entry, const QString &command);
 
-    /**
-     * Launches the url.
-     * @param aUrl The url to be launched.
-     */
-    void LaunchUrlL( const TDesC& aUrl );
+};
 
-    };
-
-#endif // __CCAURLHANDLER_H__
+#endif // CAURLHANDLER_H
--- a/contentstorage/cahandler/url/inc/caurlhandlerplugin.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/cahandler/url/inc/caurlhandlerplugin.h	Thu Jul 22 16:37:03 2010 +0100
@@ -11,12 +11,12 @@
  *
  * Contributors:
  *
- * Description:
+ * Description: Url handler plugin.
  *
  */
 
-#ifndef CA_URL_HANDLER_PLUGIN_H
-#define CA_URL_HANDLER_PLUGIN_H
+#ifndef CAURLHANDLERPLUGIN_H
+#define CAURLHANDLERPLUGIN_H
 
 #include <QObject>
 #include <qserviceplugininterface.h>
@@ -30,8 +30,8 @@
 
 public:
     QObject *createInstance(const QServiceInterfaceDescriptor &descriptor,
-                            QServiceContext *context,
-                            QAbstractSecuritySession *session);
+        QServiceContext *context,
+        QAbstractSecuritySession *session);
 };
 
-#endif
+#endif // CAURLHANDLERPLUGIN_H
--- a/contentstorage/cahandler/url/src/cas60urlhandleradapter.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:  ?Description
- *
- */
-
-#include <XQConversions>
-#include <utf.h>
-#include <QScopedPointer>
-
-#include "cas60urlhandleradapter.h"
-#include "caurlhandler.h"
-#include "cainnerentry.h"
-
-int CaS60UrlHandlerAdapter::execute(CCaInnerEntry &innerEntry, const QString &commandName)
-{
-    QScopedPointer<HBufC8> commandNameDesc8(XQConversions::qStringToS60Desc8(commandName));
-    TRAPD(result,
-        static QScopedPointer<CCaUrlHandler> plugin(CCaUrlHandler::NewL());
-        plugin->HandleCommandL(innerEntry, commandNameDesc8->Des());
-        );
-    return result;
-}
--- a/contentstorage/cahandler/url/src/caurlhandler.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/cahandler/url/src/caurlhandler.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -15,130 +15,45 @@
  *
  */
 
-#include <w32std.h>
-#include <apgtask.h>
-#include <apgcli.h>
-#include <AknTaskList.h>
+#include <QDesktopServices>
+#include <QUrl>
+
+#include <caentry.h>
 
 #include "caurlhandler.h"
-#include "cadef.h"
-#include "cainnerentry.h"
 
-// ================= MEMBER FUNCTIONS =======================
-
-// --------------------------------------------------------------------------
-// CCaUrlHandler::~CCaUrlHandler
-// --------------------------------------------------------------------------
-//
-CCaUrlHandler::~CCaUrlHandler()
-    {
-    }
+static const QString caAttrUrl("url");
 
-// --------------------------------------------------------------------------
-// CCaUrlHandler::NewL
-// --------------------------------------------------------------------------
-//
-CCaUrlHandler* CCaUrlHandler::NewL()
-    {
-    CCaUrlHandler* handler = new ( ELeave ) CCaUrlHandler();
-    CleanupStack::PushL( handler );
-    handler->ConstructL();
-    CleanupStack::Pop( handler );
-    return handler;
-    }
-
-// --------------------------------------------------------------------------
-// CCaUrlHandler::CCaUrlHandler
-// --------------------------------------------------------------------------
-//
-CCaUrlHandler::CCaUrlHandler()
-    {
-    }
+/*!
+ * Constructor.
+ */
+CaUrlHandler::CaUrlHandler(QObject *parent)
+{
+    Q_UNUSED(parent);
+}
 
-// --------------------------------------------------------------------------
-// CCaUrlHandler::ConstructL
-// --------------------------------------------------------------------------
-//
-void CCaUrlHandler::ConstructL()
-    {
-    }
-
-// --------------------------------------------------------------------------
-// CCaUrlHandler::HandleCommandL
-// --------------------------------------------------------------------------
-//
-void CCaUrlHandler::HandleCommandL( CCaInnerEntry& aEntry,
-        const TDesC8& aCommand )
-    {
+/*!
+ * Destructor.
+ */
+CaUrlHandler::~CaUrlHandler()
+{
+}
 
-    if( !aCommand.Compare( KCaCmdOpen() ) )
-        {
-        const RCaEntryAttrArray& attributes = aEntry.GetAttributes();
-        TInt attributesArrayCount = attributes.Count();
-        for( int i = 0; i < attributesArrayCount; ++i )
-            {
-            const CCaEntryAttribute * const attribute = attributes[i];
-            if( attribute->Name().Compare( KCaAttrUrl ) == 0 )
-                {
-                LaunchUrlL( attribute->Value() );
-                break;
-                }
-            }
-        }
-    else
-        {
-        User::Leave( KErrNotSupported );
+/*!
+ * Execute a given command.
+ * \param entry a reference to CaEntry instance.
+ * \param command a given command.
+ * \retval an error code.
+ */
+int CaUrlHandler::execute(const CaEntry &entry, const QString &command)
+{
+    int err(KErrGeneral);
+    if (command == caCmdOpen) {
+        QString attribute = entry.attribute(caAttrUrl);
+        if (!attribute.isNull() &&
+            QDesktopServices::openUrl(QUrl(attribute))) {
+            err = KErrNone;
         }
     }
-
-// --------------------------------------------------------------------------
-// CCaUrlHandler::LaunchUrlL
-// --------------------------------------------------------------------------
-//
-
-void CCaUrlHandler::LaunchUrlL( const TDesC& aUrl )
-    {
-    // Launches browser stand-alone.
-    // Browser is launched with a parameter 4 ("4 http://...."), which 
-    // Start/Continue the browser specifying a URL. 
-    // Other available parameters are described in the Browser API Specification
-    // Document.
-    TInt length = aUrl.Length() + KBrowserPrefix.iTypeLength;
-
-    RWsSession wsSession;
-    User::LeaveIfError( wsSession.Connect() );
-    CleanupClosePushL<RWsSession> ( wsSession );
-
-    CAknTaskList* taskList = CAknTaskList::NewL( wsSession );
-    TApaTask task = taskList->FindRootApp( KUidBrowser );
-    delete taskList;
-
-    if( task.Exists() )
-        {
-        HBufC8* param8 = HBufC8::NewLC( length );
-        TPtr8 ptr8 = param8->Des();
-        ptr8.Append( KBrowserPrefix );
-        ptr8.Append( aUrl );
-
-        // Sends message to existing Browser task.
-        task.SendMessage( TUid::Uid( 0 ), *param8 ); // Uid is not used
-        CleanupStack::PopAndDestroy( param8 );
-        }
-    else
-        {
-        HBufC* buf = HBufC::NewLC( length );
-        TPtr ptr = buf->Des();
-        ptr.Append( KBrowserPrefix );
-        ptr.Append( aUrl );
-
-        RApaLsSession appArcSession;
-        User::LeaveIfError( appArcSession.Connect() );
-        CleanupClosePushL<RApaLsSession> ( appArcSession );
-        TThreadId id;
-        appArcSession.StartDocument( *buf, KUidBrowser, id );
-        CleanupStack::PopAndDestroy( &appArcSession );
-        CleanupStack::PopAndDestroy( buf );
-        }
-
-    CleanupStack::PopAndDestroy( &wsSession );
-    }
+    return err;
+}
--- a/contentstorage/cahandler/url/src/caurlhandlerplugin.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/cahandler/url/src/caurlhandlerplugin.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -15,14 +15,12 @@
  *
  */
 
-#include <cadefs.h>
 #include <qserviceinterfacedescriptor.h>
 #include <qabstractsecuritysession.h>
 #include <qservicecontext.h>
+
 #include "cahandlerloader.h"
-
 #include "caurlhandlerplugin.h"
-#include "cas60urlhandleradapter.h"
 #include "caurlhandler.h"
 
 /*!
@@ -35,7 +33,7 @@
     \param descriptor Service descriptor.
     \param context Ignored.
     \param session Ignored.
-    \return An instance of the CaS60UrlHandlerAdapter<CCaUrlHandler> when descriptor interface name
+    \return An instance of the CaS60UrlHandlerAdapter<CaUrlHandler> when descriptor interface name
     is "com.nokia.homescreen.ICommandHandler", NULL otherwise.
 */
 QObject *CaUrlHandlerPlugin::createInstance(const QServiceInterfaceDescriptor &descriptor,
@@ -46,10 +44,19 @@
     Q_UNUSED(session);
 
     if (descriptor.interfaceName() ==
-            "com.nokia.homescreen.ICommandHandler") {
-        return new CaS60UrlHandlerAdapter();
+        QLatin1String("com.nokia.homescreen.ICommandHandler")) {
+        return new CaUrlHandler();
     } else {
         return 0;
     }
 }
+
+#ifdef COVERAGE_MEASUREMENT
+#pragma CTC SKIP
+#endif //COVERAGE_MEASUREMENT (QT macro)
+
 Q_EXPORT_PLUGIN2(caurlhandlerplugin, CaUrlHandlerPlugin)
+
+#ifdef COVERAGE_MEASUREMENT
+#pragma CTC ENDSKIP
+#endif //COVERAGE_MEASUREMENT
--- a/contentstorage/cahandler/url/url.pro	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/cahandler/url/url.pro	Thu Jul 22 16:37:03 2010 +0100
@@ -37,7 +37,6 @@
     LIBS += \
     -leuser \
     -lecom \
-    -lswinstcli \
     -lcautils \
     -lapgrfx \
     -lws32 \
@@ -46,9 +45,10 @@
     -leikcore \
     -lcone \
     -lefsrv \
-    -lxqutils
+    -lxqutils \
+    -lcaclient
 
-    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 Jul 22 16:37:03 2010 +0100
@@ -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 Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,56 @@
+#
+# 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
+CONFIG += hb
+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 \
+        -lPlatformEnv \
+        -lefsrv
+        
+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 Jul 22 16:37:03 2010 +0100
@@ -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 Jul 22 16:37:03 2010 +0100
@@ -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 Jul 22 16:37:03 2010 +0100
@@ -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: casoftwareregistry_p.h
+ *
+ */
+
+#ifndef CASOFTWAREREGISTRY_P_H
+#define CASOFTWAREREGISTRY_P_H
+
+#include <QHash>
+#include <QString>
+
+#include <usif/usifcommon.h>
+
+class QStringList;
+class CaSoftwareRegistry;
+
+namespace Usif 
+{
+    class CComponentEntry;
+}
+
+class CaSoftwareRegistryPrivate
+{
+public:
+
+    typedef QHash<QString, QString> DetailMap;
+
+    explicit CaSoftwareRegistryPrivate(
+        CaSoftwareRegistry *softwareRegistryPublic);
+    ~CaSoftwareRegistryPrivate();
+
+    bool getUninstallDetails(int componentId,
+        QString &componentName,
+        QStringList &applicationsUids,
+        QString &confirmationMessage);
+    
+    bool getApplicationsUids(int componentId,
+        QStringList &appUids);
+
+    DetailMap entryDetails(int componentId) const;
+    
+    DetailMap entryDetails(
+        const Usif::CComponentEntry& entry) const;
+private:
+    void getUninstallDetailsL(int componentId,
+        QString &componentName,
+        QStringList &appUids,
+        QString &confirmationMessage);
+    void getApplicationsUidsL(int componentId,
+        QStringList &appUids);
+private:
+    CaSoftwareRegistry *const m_q;
+
+};
+
+#endif // CASOFTWAREREGISTRY_P_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contentstorage/casoftwareregistry/s60/src/casoftwareregistry_p.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,326 @@
+/*
+ * 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 <HbParameterLengthLimiter>
+#include <QMetaType>
+#include <QScopedPointer>
+#include <QStringList>
+
+#include <usif/scr/scr.h>
+#include <usif/scr/screntries.h>
+#include <xqconversions.h>
+#include <driveinfo.h>
+
+#include "casoftwareregistry.h"
+#include "casoftwareregistry_p.h"
+
+using namespace Usif;
+
+_LIT(KConfirmMessageKey, "MIDlet-Delete-Confirm");
+
+template <typename RClass>
+struct RClassDeleter
+{
+    static inline void cleanup(RClass *ptr)
+    {
+        ptr->Close();
+    }
+};
+
+typedef QScopedPointer<RSoftwareComponentRegistry, 
+    RClassDeleter<RSoftwareComponentRegistry> > ScrScopedPointer;
+    
+typedef QScopedPointer<RFs, 
+    RClassDeleter<RFs> > RFSScopedPointer;
+/*!
+ Constructor
+ \param servicePublic Pointer to object of the public class.
+ */
+CaSoftwareRegistryPrivate::CaSoftwareRegistryPrivate(
+    CaSoftwareRegistry *servicePublic):
+    m_q(servicePublic)
+{
+}
+
+/*!
+ Destructor.
+ */
+CaSoftwareRegistryPrivate::~CaSoftwareRegistryPrivate()
+{
+}
+
+/*!
+ Provides details needed for uninstalling process of Java applications.
+ \param[in] componentId component id of an application to be uninstalled.
+ \param[out] componentName a name of the component.
+ \param[out] applicationsUids a list of uids of applications in the package
+      of the given component id.
+ \param[out] confirmationMessage optional deletion confirmation message,
+      null string means the lack of the message.
+ \retval true if there is no error.
+ */
+
+bool CaSoftwareRegistryPrivate::getUninstallDetails(int componentId,
+    QString &componentName,
+    QStringList &applicationsUids,
+    QString &confirmationMessage)
+{
+    TRAPD(error, getUninstallDetailsL(componentId,
+        componentName,
+        applicationsUids,
+        confirmationMessage)
+         );
+    return error == KErrNone;
+}
+
+/*!
+ Provides a list of uids of applications installed by the given package.
+ \param[in] componentId component id of an application to be uninstalled.
+ \param[out] applicationsUids a list of uids of applications in the package
+      of the given component id.
+ \retval true if there is no error.
+ */
+
+bool CaSoftwareRegistryPrivate::getApplicationsUids(int componentId,
+    QStringList &applicationsUids)
+{
+    TRAPD(error, getApplicationsUidsL(componentId, applicationsUids));
+    return error == KErrNone;
+}
+
+/*!
+ Provides details needed for uninstalling process of Java applications
+   (leaving version).
+ \param[in] componentId component id of an application to be uninstalled.
+ \param[out] componentName a name of the component.
+ \param[out] applicationsUids a list of uids of applications in the package
+      of the given component id.
+ \param[out] confirmationMessage optional deletion confirmation message,
+      null string means the lack of the message.
+ */
+void CaSoftwareRegistryPrivate::getUninstallDetailsL(int componentId,
+    QString &componentName,
+    QStringList &appUids,
+    QString &confirmationMessage)
+{
+    componentName.clear();
+    appUids.clear();
+    confirmationMessage.clear();
+
+    if (componentId >= 1) {
+        TComponentId componentIdValue(componentId);
+        RArray<TUid> appUidsArray;
+        CleanupClosePushL(appUidsArray);
+        CLocalizablePropertyEntry *confirmationMessageProperty = NULL;
+
+        RSoftwareComponentRegistry softwareComponentRegistry;
+        CleanupClosePushL(softwareComponentRegistry);
+        User::LeaveIfError(softwareComponentRegistry.Connect());
+
+        CComponentEntry *entry = CComponentEntry::NewLC();
+        softwareComponentRegistry.GetComponentL(componentId, *entry);
+        softwareComponentRegistry.GetAppUidsForComponentL(componentIdValue,
+            appUidsArray);
+
+        CPropertyEntry *confirmationProperty =
+            softwareComponentRegistry.GetComponentPropertyL(componentId,
+            KConfirmMessageKey);
+        if (confirmationProperty &&
+            confirmationProperty->PropertyType() ==
+                CPropertyEntry::ELocalizedProperty) {
+            confirmationMessageProperty =
+                static_cast<CLocalizablePropertyEntry *>(
+                    confirmationProperty);
+        } else {
+            delete confirmationProperty;
+            confirmationProperty = NULL;
+        }
+
+        QT_TRYCATCH_LEAVING(componentName =
+            XQConversions::s60DescToQString(entry->Name());
+            for (TInt i = 0; i<appUidsArray.Count(); i++) {
+                appUids.append(QString::number(appUidsArray[i].iUid));
+            }
+            if (confirmationMessageProperty) {
+                confirmationMessage = XQConversions::s60DescToQString(
+                    confirmationMessageProperty->StrValue());
+            }
+        );
+
+        CleanupStack::PopAndDestroy(3, &appUidsArray);
+    }
+}
+
+/*!
+ Provides details needed for uninstalling process of Java applications
+   (leaving version).
+ \param[in] componentId component id of an application to be uninstalled.
+ \param[out] applicationsUids a list of uids of applications in the package
+      of the given component id.
+ */
+void CaSoftwareRegistryPrivate::getApplicationsUidsL(int componentId,
+    QStringList &appUids)
+{
+    appUids.clear();
+    if (componentId >= 1) {
+        TComponentId componentIdValue(componentId);
+        RArray<TUid> appUidsArray;
+        CleanupClosePushL(appUidsArray);
+
+        RSoftwareComponentRegistry softwareComponentRegistry;
+        CleanupClosePushL(softwareComponentRegistry);
+        User::LeaveIfError(softwareComponentRegistry.Connect());
+
+        softwareComponentRegistry.GetAppUidsForComponentL(componentIdValue,
+            appUidsArray);
+
+        QT_TRYCATCH_LEAVING(
+            for (TInt i = 0; i<appUidsArray.Count(); i++) {
+                appUids.append(QString::number(appUidsArray[i].iUid));
+            }
+        );
+        CleanupStack::PopAndDestroy(2, &appUidsArray);
+    }
+}
+
+/*!
+ \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) {
+        RSoftwareComponentRegistry softwareComponentRegistry;
+        ScrScopedPointer scr(&softwareComponentRegistry);
+        if (scr->Connect() == KErrNone) {
+            
+            QScopedPointer<CComponentEntry> entry;
+            
+            QT_TRAP_THROWING(entry.reset(CComponentEntry::NewL()));
+            
+            TBool resultCode = EFalse;
+            TRAPD(leaveCode, resultCode = scr->GetComponentL(componentId, *entry));
+            if (leaveCode == KErrNone && resultCode) {
+                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;
+    QString drv;
+    TChar drive;    
+    
+    const TInt driveListLen(entry.InstalledDrives().Length());
+    for (TInt i( 0 ); i < driveListLen; ++i) {
+        if (entry.InstalledDrives()[i] != '\0') {
+            
+            if (!drives.isEmpty()) {
+                drives = drives.append(",");
+            }  
+            drv = QString(QChar('A'+ i)).append(":");
+            if(DriveInfo::GetDefaultDrive(
+                    DriveInfo::EDefaultPhoneMemory, drive ) == KErrNone 
+                    && QChar('A'+ i) == QChar(drive))
+                {
+                drives = drives.append(
+                        HbParameterLengthLimiter("txt_applib_dialog_1_device_memory").arg(
+                          QString(QChar('A'+ i))));
+                }
+            else if(DriveInfo::GetDefaultDrive(
+                    DriveInfo::EDefaultMassStorage, drive ) == KErrNone 
+                    && QChar('A'+ i) == QChar(drive))
+                {
+                drives = drives.append(
+                        HbParameterLengthLimiter("txt_applib_dialog_1_mass_storage").arg(
+                          QString(QChar('A'+ i))));
+                }
+            else if(DriveInfo::GetDefaultDrive(
+                    DriveInfo::EDefaultRemovableMassStorage, drive ) == KErrNone 
+                    && QChar('A'+ i) == QChar(drive))
+                {
+                RFs fs;
+                RFSScopedPointer fSPointer(&fs);
+                if (fs.Connect() == KErrNone) {
+                    TInt driveNumber;
+                    TVolumeInfo tv;
+                    DriveInfo::GetDefaultDrive(
+                            DriveInfo::EDefaultRemovableMassStorage, driveNumber );
+                    qt_symbian_throwIfError(fs.Volume(tv, driveNumber));
+                    if(tv.iName.Length()) { 
+                        drives = drives.append(
+                                HbParameterLengthLimiter("txt_applib_dialog_1_2").arg(
+                                   QString(QChar('A'+ i))).arg(
+                                           XQConversions::s60DescToQString(tv.iName)));                       
+                    }
+                    else {
+                        drives = drives.append(
+                            HbParameterLengthLimiter("txt_applib_dialog_1_memory_card").arg(
+                              QString(QChar('A'+ i))));           
+                    }
+                }
+            } else {
+                drives = drives.append(QChar('A'+ i)).append(":");   
+            }
+        }
+    }
+    
+    detailMap[CaSoftwareRegistry::componentDriveInfoKey()] = drives;
+    
+
+    static const TInt64 KKilo = 1024;
+    static const TInt64 KMega = KKilo * KKilo;
+    if(entry.ComponentSize() >= KMega) {
+        detailMap[CaSoftwareRegistry::componentSizeKey()] = 
+            HbParameterLengthLimiter("txt_applib_dialog_l1_mb").arg(
+                    static_cast<double>(entry.ComponentSize() / KMega));
+    }
+    else {
+        detailMap[CaSoftwareRegistry::componentSizeKey()] = 
+            HbParameterLengthLimiter("txt_applib_dialog_l1_kb").arg(
+                    static_cast<double>(entry.ComponentSize() / KKilo));
+    }
+
+    
+    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 Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,214 @@
+/*
+ * 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 <QString>
+#include <QStringList>
+
+
+#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;
+}
+
+/*!
+ Provides details needed for uninstalling process of Java applications.
+ \code
+ QSharedPointer<CaSoftwareRegistry> service = CaSoftwareRegistry::create();
+ int componentId(20);
+ QString &componentName,
+ QStringList applicationsUids;
+ QString confirmationMessage;
+ CaSoftwareRegistry::DetailMap detailMap = service->getUninstallDetails(
+    componentId,
+    componentName,
+    applicationsUids,
+    confirmationMessage);
+ \endcode
+ \param[in] componentId component id of an application to be uninstalled.
+ \param[out] componentName a name of the component.
+ \param[out] applicationsUids a list of uids of applications in the package
+      of the given component id.
+ \param[out] confirmationMessage optional deletion confirmation message,
+      null string means the lack of the message.
+ \retval true if there is no error.
+ */
+bool CaSoftwareRegistry::getUninstallDetails(int componentId,
+    QString &componentName,
+    QStringList &applicationsUids,
+    QString &confirmationMessage)
+{
+    return m_d->getUninstallDetails(componentId,
+        componentName,
+        applicationsUids,
+        confirmationMessage);
+}
+
+/*!
+ Provides a list of uids of applications installed by the given package.
+ \param[in] componentId component id of an application to be uninstalled.
+ \param[out] applicationsUids a list of uids of applications in the package
+      of the given component id.
+ \retval true if there is no error.
+ */
+
+bool CaSoftwareRegistry::getApplicationsUids(int componentId,
+    QStringList &applicationsUids)
+{
+    return m_d->getApplicationsUids(componentId, applicationsUids);
+}
+
+/*!
+ 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 Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,51 @@
+/*
+ * 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 CASOFTWAREREGISTRY_P_H
+#define CASOFTWAREREGISTRY_P_H
+
+#include <QHash>
+#include <QString>
+
+class QStringList;
+class CaSoftwareRegistry;
+
+class CaSoftwareRegistryPrivate
+{
+public:
+    typedef QHash<QString, QString> DetailMap;
+    
+    explicit CaSoftwareRegistryPrivate(
+        CaSoftwareRegistry *softwareRegistryPublic);
+    ~CaSoftwareRegistryPrivate();
+
+    bool getApplicationsUids(int componentId,
+        QStringList &applicationsUids);
+
+    bool getUninstallDetails(int componentId,
+        QString &componentName,
+        QStringList &applicationsUids,
+        QString &confirmationMessage);
+
+    DetailMap entryDetails(int componentId) const;
+private:
+
+    CaSoftwareRegistry *const m_q;
+
+};
+
+#endif // CASOFTWAREREGISTRY_P_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contentstorage/casoftwareregistry/stub/src/casoftwareregistry_p.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,107 @@
+/*
+ * 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 <QStringList>
+
+
+#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()
+{
+}
+
+/*!
+ Provides details needed for uninstalling process of Java applications
+ (windows stub).
+ \param[in] componentId component id of an application to be uninstalled.
+ \param[out] componentName a name of the component.
+ \param[out] applicationsUids a list of uids of applications in the package
+      of the given component id.
+ \param[out] confirmationMessage optional deletion confirmation message,
+      null string means the lack of the message.
+ \retval true if there is no error.
+ */
+bool CaSoftwareRegistryPrivate::getUninstallDetails(int componentId,
+    QString &componentName,
+    QStringList &applicationsUids,
+    QString &confirmationMessage)
+{
+    Q_UNUSED(componentId);
+    componentName.clear();
+    applicationsUids.clear();
+    confirmationMessage.clear();
+    return true;
+}
+
+/*!
+ Provides a list of uids of applications installed by the given package
+ (windows stub).
+ \param[in] componentId component id of an application to be uninstalled.
+ \param[out] applicationsUids a list of uids of applications in the package
+      of the given component id.
+ \retval true if there is no error.
+ */
+bool CaSoftwareRegistryPrivate::getApplicationsUids(int componentId,
+    QStringList &applicationsUids)
+{
+    Q_UNUSED(componentId);
+    applicationsUids.clear();
+    return true;
+}
+
+/*
+ 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 Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/casrv/caappscanner/group/caappscanner.mmp	Thu Jul 22 16:37:03 2010 +0100
@@ -36,7 +36,6 @@
 USERINCLUDE     ../../../inc
 USERINCLUDE     ../../../cautils/inc
 USERINCLUDE     ../../../srvinc
-USERINCLUDE     ../../../castorage/inc
 
 
 MW_LAYER_SYSTEMINCLUDE
@@ -55,7 +54,5 @@
 LIBRARY         apgrfx.lib
 LIBRARY         bafl.lib
 LIBRARY         efsrv.lib
-LIBRARY         sisregistryclient.lib
 LIBRARY         platformenv.lib
-// temporary till cWRT will be in SCR
-LIBRARY         WidgetRegistryClient.lib
+LIBRARY         scrclient.lib
--- a/contentstorage/casrv/caappscanner/inc/casrvappscanner.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/casrv/caappscanner/inc/casrvappscanner.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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;
@@ -56,10 +56,7 @@
  *   to date continuously.
  */
 
-NONSHARABLE_CLASS( CCaSrvAppScanner ):
-    public CActive,
-    public MCaInstallListener,
-    public MApaAppListServObserver
+NONSHARABLE_CLASS( CCaSrvAppScanner ) : public CActive
     {
 
 public:
@@ -94,30 +91,6 @@
      */
     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.
-     * @param aAppUid application uid.
-     */
-    void NotifyL( TInt aAppUid );
-
-    /**
-     * Notifies storage abaut change for aPackageEntry related app.
-     * @param aPackageEntry application package entry.
-     */
-    void NotifyL( Swi::RSisRegistryEntry & aPackageEntry );
-
 private:
     // from CActive
 
@@ -133,55 +106,43 @@
 
     /**
      * Error handling: ignore error.
-     * @param aErr Error code.
+     * @param aError Error code.
      */
     TInt RunError( TInt aError );
 
 private:
-    // from MApaAppListServObserver
-
-    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 +153,102 @@
     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 );
+
+    /**
+     * Removes application unninstall flag.
+     * @param aItem menu item.
+     * @return ETrue if flags were updated.
+     */
+    TBool RemoveUninstallFlagL( 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 );
 
@@ -288,53 +257,34 @@
      * Add new menu item referring to this application.
      * @param aUid Application capability.
      * @param aCurrentMmcId MMC ID of currently inserted MMC, or 0.
+     * @return added item id
      */
-    void AddAppEntryL( TUint aUid, TUint aCurrentMmcId );
+    TInt AddAppEntryL( TUint aUid, TUint aCurrentMmcId );
 
     /**
-     * Removes given uid from iInstalledPackages.
-     * Add new menu item referring to this application.
-     * @param aUid Application capability.
-     */
-    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 );
 
     /**
-     * Removes app from storage.
-     * @param aAppEntry app to remove.
-     */
-    void RemoveAppL( CCaInnerEntry* aAppEntry );
-
-    /**
      * Set "missing" flag.
      * @param aEntry entry.
      */
     void SetMissingFlagL( CCaInnerEntry* aEntry );
 
     /**
-     * Set "visible" flag.
+     * Clear "visible" flag (and also "missing" and "used").
      * @param aEntry entry.
      */
     void ClearVisibleFlagL( CCaInnerEntry* aEntry );
@@ -347,23 +297,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,95 +341,64 @@
     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.
+     * @param aAlwaysUpdate item always should be updated.
      */
-    void UpdateAppEntryL( CCaInnerEntry* aEntry, TUint aMmcId );
+    void UpdateAppEntryL( CCaInnerEntry* aEntry,
+            TUint aMmcId,
+            TBool aAlwaysUpdate = EFalse );
 
     /**
-     * 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
-     */
-    void InstallationNotifyL();
-
-    /**
      * Make not empty collections with not hidden apps visible.
      */
     void MakeNotEmptyCollectionsVisibleL();
 
     /**
      * 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 aEntry entry being updated with component id attribute.
+     * @return ETrue when component id attribute of the entry has been added or changed.
+     */
+    TBool UpdateComponentIdL( CCaInnerEntry& aEntry ) const;
+
 private:
     // data
 
     RApaLsSession iApaLsSession; ///< AppArc session. Own.
-    CApaAppListNotifier* iNotifier; ///< Change 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
 
     TInt iCollectionDownloadId;
     TInt iAllCollectionId;
+
 CA_STORAGE_TEST_FRIEND_CLASS    (T_casrvAppScaner)
 
     };
 
-/**
- * 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 Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/casrv/caappscanner/src/casrvappscanner.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -17,10 +17,7 @@
 
 #include <e32property.h>
 #include <bautils.h>
-#include <swi/sisregistrysession.h>
-#include <swi/sisregistryentry.h>
-#include <swi/sisregistrypackage.h>
-#include <WidgetRegistryClient.h>
+#include <usif/scr/screntries.h>
 
 #include "cadef.h"
 #include "casrvappscanner.h"
@@ -33,7 +30,9 @@
 #include "caarraycleanup.inl"
 #include "castorageproxy.h"
 
+#include "caarraycleanup.inl"
 
+using namespace Usif;
 
 // ==================== LOCAL FUNCTIONS ====================
 
@@ -66,7 +65,7 @@
 // ==================== MEMBER FUNCTIONS ====================
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::NewL
+//
 // ---------------------------------------------------------
 //
 CCaSrvAppScanner* CCaSrvAppScanner::NewL( CCaStorageProxy& aCaStorageProxy,
@@ -81,22 +80,20 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::~CCaSrvAppScanner
+//
 // ---------------------------------------------------------
 //
 CCaSrvAppScanner::~CCaSrvAppScanner()
     {
     Cancel();
+    iSoftwareRegistry.Close();
     iApaLsSession.Close();
-    iInstalledPackages.Close();
-    delete iInstallNotifier;
-    delete iNotifier;
     delete iMmcHistory;
     iFs.Close();
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::CCaSrvAppScanner
+//
 // ---------------------------------------------------------
 //
 CCaSrvAppScanner::CCaSrvAppScanner( CCaStorageProxy& aCaStorageProxy,
@@ -108,7 +105,7 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::ConstructL
+//
 // ---------------------------------------------------------
 //
 void CCaSrvAppScanner::ConstructL()
@@ -117,7 +114,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,83 +122,121 @@
             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(
-            *this, CCaInstallNotifier::ESisInstallNotification );
 
     User::LeaveIfError( iApaLsSession.Connect() );
-    User::LeaveIfError( iApaLsSession.GetAllApps() ); // This is async.
-    iApaLsSession.RegisterListPopulationCompleteObserver( iStatus );
+    User::LeaveIfError( iSoftwareRegistry.Connect() );
+    iApaLsSession.SetNotify( EFalse, iStatus );
     iCollectionDownloadId = 0;
     iAllCollectionId = 0;
+
+    UpdateApplicationEntriesL();
+    MakeNotEmptyCollectionsVisibleL();
+
     SetActive();
     }
 
 // ---------------------------------------------------------
-// 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();
-    MakeNotEmptyCollectionsVisibleL();
+    RArray<TApaAppUpdateInfo> updatedAppsInfo;
+    CleanupClosePushL( updatedAppsInfo );
+    iApaLsSession.UpdatedAppsInfoL( updatedAppsInfo );
+
+    for( TInt i = 0; i < updatedAppsInfo.Count(); i++ )
+    	{
+		TApaAppUpdateInfo::TApaAppAction action = updatedAppsInfo[i].iAction;
+        RPointerArray<CCaInnerEntry> resultArray;
+        CleanupResetAndDestroyPushL( resultArray );
+        GetCaAppEntriesL( updatedAppsInfo[i].iAppUid.iUid, resultArray );
+		if( action == TApaAppUpdateInfo::EAppPresent
+				|| action == TApaAppUpdateInfo::EAppInfoChanged )
+			{
+			TInt id;
+			if( !resultArray.Count() )
+				{
+                id = AddAppEntryL(
+                        updatedAppsInfo[i].iAppUid.iUid, UpdateMmcHistoryL() );
+				}
+			else
+			    {
+                ASSERT( resultArray.Count() == 1 );
+                id = resultArray[0]->GetId();
+                UpdateAppEntryL( resultArray[0], UpdateMmcHistoryL(), ETrue );
+                AddEntryToPredefinedCollectionL( resultArray[0], ETrue );
+			    }
+            AddEntryToDownloadedCollectionL( id );
+            MakeNotEmptyCollectionsVisibleL();
+			}
+		else if( action == TApaAppUpdateInfo::EAppNotPresent )
+			{
+			HandleMissingItemsL( resultArray );
+			}
+		else
+			{
+			User::Leave( KErrNotSupported );
+			}
+        CleanupStack::PopAndDestroy( &resultArray );
+    	}
+    CleanupStack::PopAndDestroy( &updatedAppsInfo );
+
+    iApaLsSession.SetNotify( EFalse, iStatus );
+    SetActive();
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::DoCancel
+//
 // ---------------------------------------------------------
 //
 void CCaSrvAppScanner::DoCancel()
     {
-    iApaLsSession.CancelListPopulationCompleteObserver();
+    iApaLsSession.CancelNotify();
     }
 
 // ---------------------------------------------------------
-// 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,36 +251,170 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::UpdateAppEntryL
+//
 // ---------------------------------------------------------
 //
-void CCaSrvAppScanner::UpdateAppEntryL( CCaInnerEntry* aEntry, TUint aMmcId )
+void CCaSrvAppScanner::UpdateAppEntryL(
+        CCaInnerEntry* aEntry, TUint aMmcId, TBool aAlwaysUpdate  )
     {
     TBool toUpdate = HandleMmcAttrUpdateL( aEntry, aMmcId );
     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() );
-        toUpdate = HandleUsedFlagUpdate( aEntry ) || toUpdate;
-        AddEntryToPredefinedCollectionL( aEntry, ETrue );
-        }
-    if( toUpdate )
+    toUpdate = RemoveUninstallFlagL( aEntry ) || toUpdate;
+
+    if( toUpdate || aAlwaysUpdate )
         {
         //update app in storage
+        HandleUsedFlagUpdate( aEntry );
         TItemAppearance itemAppearanceChange = EItemAppearanceNotChanged;
         if( missingVisibleFlagChanged )
             {
             itemAppearanceChange = EItemAppeared;
             }
         iCaStorageProxy.AddL( aEntry, EFalse, itemAppearanceChange );
-        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::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::RemoveUninstallFlagL( CCaInnerEntry* aItem )
+    {
+    TBool toChange( EFalse );
+    if( aItem->GetFlags() & EUninstall )
+        {
+		aItem->SetFlags( aItem->GetFlags() & ~EUninstall );
+		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 +446,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 +459,7 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::RemoveSatApp
+//
 // ---------------------------------------------------------
 //
 void CCaSrvAppScanner::RemoveSatAppL( RPointerArray<CCaInnerEntry>& aArray )
@@ -440,10 +477,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 +514,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 +533,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 +558,7 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::GetMcsItemsL
+//
 // ---------------------------------------------------------
 //
 TInt CCaSrvAppScanner::GetCollectionDownloadIdL()
@@ -530,7 +568,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 +586,7 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::GetAllCollectionIdL
+//
 // ---------------------------------------------------------
 //
 TInt CCaSrvAppScanner::GetAllCollectionIdL()
@@ -556,7 +595,7 @@
         {
         CCaInnerQuery *getAllCollectionIdQuery = CCaInnerQuery::NewLC();
         CDesC16ArrayFlat *typenameArray = new(ELeave) CDesC16ArrayFlat(
-                KDefaultGranularity );
+                KGranularityOne );
         CleanupStack::PushL( typenameArray );
         typenameArray->AppendL( KCaTypeMenuCollections );
         getAllCollectionIdQuery->SetEntryTypeNames( typenameArray );
@@ -577,7 +616,7 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::GetMcsItemsL
+//
 // ---------------------------------------------------------
 //
 void CCaSrvAppScanner::GetCaAppEntriesL( TInt aUid,
@@ -590,112 +629,15 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::HandleAppListEvent
-// ---------------------------------------------------------
 //
-void CCaSrvAppScanner::HandleAppListEvent( TInt /*aEvent*/)
-    {
-    // We only have one event, EAppListChanged.
-    // Call back RunL async, to requeue and initiate rescan.
-    if( !IsActive() )
-        {
-        ScheduleScan();
-        }
-    }
-
-// ---------------------------------------------------------
-// CCaSrvAppScanner::HandleInstallNotifyL
-// ---------------------------------------------------------
-//
-void CCaSrvAppScanner::HandleInstallNotifyL( TInt aUid )
-    {
-    NotifyL( aUid );
-    RArray<TUid> uids;
-    CleanupClosePushL( uids );
-
-    Swi::RSisRegistrySession iSisRegSession;
-    User::LeaveIfError( iSisRegSession.Connect() );
-    CleanupClosePushL( iSisRegSession );
-
-    // Open sis package entry related to aUid
-    Swi::RSisRegistryEntry packageEntry;
-    if( KErrNone
-            == packageEntry.Open( iSisRegSession, TUid::Uid( aUid ) ) )
-        {
-        CleanupClosePushL( packageEntry );
-
-        // Get packageEntry's embedded sis'
-        RPointerArray<Swi::CSisRegistryPackage> embedded;
-        CleanupClosePushL( embedded );
-        packageEntry.EmbeddedPackagesL( embedded );
-        if( embedded.Count() )
-            {
-            // For each embadded sis we notify storage - recursive call
-            for( TInt i = 0; i < embedded.Count(); ++i )
-                {
-                HandleInstallNotifyL( embedded[i]->Uid().iUid );
-                }
-            }
-        else
-            {
-            // There are no embaddes sis', so we can notify storage
-            // of changes in apps included in packageEntry
-            NotifyL( packageEntry );
-            }
-        embedded.ResetAndDestroy();
-        CleanupStack::PopAndDestroy( &embedded );
-        CleanupStack::PopAndDestroy( &packageEntry );
-        }
-    CleanupStack::PopAndDestroy( &iSisRegSession );
-    CleanupStack::PopAndDestroy( &uids );
-    }
-
-// ---------------------------------------------------------
-// CCaSrvAppScanner::NotifyL
-// ---------------------------------------------------------
-//
-void CCaSrvAppScanner::NotifyL( Swi::RSisRegistryEntry & aPackageEntry )
-    {
-    // Get sids ( == uids of exetucables included in aPackageEntry )
-    RArray<TUid> sids;
-    CleanupClosePushL( sids );
-    aPackageEntry.SidsL( sids );
-    if( sids.Count() )
-        {
-        // For each sid we notify storage
-        for( TInt i = 0; i < sids.Count(); ++i )
-            {
-            iInstalledPackages.Append( sids[i].iUid );
-            }
-        }
-    CleanupStack::PopAndDestroy( &sids );
-    }
-
-// ---------------------------------------------------------
-// CCaSrvAppScanner::NotifyL
-// ---------------------------------------------------------
-//
-void CCaSrvAppScanner::NotifyL( TInt aAppUid )
-    {
-    // Get entries for given aAppUid
-    RPointerArray<CCaInnerEntry> resultArray;
-    CleanupResetAndDestroyPushL( resultArray );
-    GetCaAppEntriesL( aAppUid, resultArray );
-    if( resultArray.Count() && ( resultArray[0]->GetFlags() & EVisible ) )
-        {//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 +648,7 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::AddEntryToPredefinedCollectionL
+//
 // ---------------------------------------------------------
 //
 void CCaSrvAppScanner::AddEntryToPredefinedCollectionL(
@@ -731,10 +673,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 +697,12 @@
 
             if( aUpdate )
                 {
-                organizeParams.iOperationType = TCaOperationParams::EAppend;
                 iCaStorageProxy.OrganizeL( entryIds, organizeParams );
                 }
             }
 
         if( !aUpdate )
             {
-            organizeParams.iOperationType = TCaOperationParams::EAppend;
             iCaStorageProxy.OrganizeL( entryIds, organizeParams );
             }
 
@@ -773,7 +713,7 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::CreatePredefinedCollectionL
+//
 // ---------------------------------------------------------
 //
 TInt CCaSrvAppScanner::CreatePredefinedCollectionL( const TDesC& aGroupName )
@@ -783,9 +723,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 +735,7 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::AddCollectionToAllCollectionL
+//
 // ---------------------------------------------------------
 //
 void CCaSrvAppScanner::AddCollectionToAllCollectionL( TInt aCollectionId )
@@ -817,13 +755,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,26 +774,12 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::ScheduleScan
+//
 // ---------------------------------------------------------
 //
-void CCaSrvAppScanner::ScheduleScan()
+TInt CCaSrvAppScanner::AddAppEntryL( TUint aUid, TUint aCurrentMmcId )
     {
-    if( !IsActive() )
-        {
-        TRequestStatus* ownStatus = &iStatus;
-        *ownStatus = KRequestPending;
-        SetActive();
-        User::RequestComplete( ownStatus, KErrNone );
-        }
-    }
-
-// ---------------------------------------------------------
-// CCaSrvAppScanner::AddAppItemL
-// ---------------------------------------------------------
-//
-void CCaSrvAppScanner::AddAppEntryL( TUint aUid, TUint aCurrentMmcId )
-    {
+    TInt id(KErrNotFound);
     // Now add the app entry.
     CCaInnerEntry* appEntry = CCaInnerEntry::NewLC();
 
@@ -863,88 +789,114 @@
     appEntry->SetRole( EItemEntryRole );
 
     SetApaAppInfoL( appEntry );
-    HandleLockDeleteFlagUpdateL( appEntry );
+    HandleRemovableVisibleFlagsUpdateL( appEntry );
     HandleMmcAttrUpdateL( appEntry, aCurrentMmcId );
 
     iCaStorageProxy.AddL( appEntry );
+    id = appEntry->GetId();
 
     AddEntryToPredefinedCollectionL( appEntry );
 
-    if( iInstalledPackages.Find( aUid ) != KErrNotFound )
-        {
-        AddEntryToDownloadedCollectionL( appEntry->GetId() );
-        }
-    RemoveFromInstalledPackages( aUid );
-
     CleanupStack::PopAndDestroy( appEntry );
-    }
-
-// ---------------------------------------------------------
-// CCaSrvAppScanner::RemoveFromInstalledPackages
-// ---------------------------------------------------------
-//
-void CCaSrvAppScanner::RemoveFromInstalledPackages( TUint aUid )
-    {
-    TInt appIndex = iInstalledPackages.Find( aUid );
-    if( appIndex != KErrNotFound )
-        {
-        iInstalledPackages.Remove( appIndex );
-        }
+    return id;
     }
 
 // ---------------------------------------------------------------------------
-// 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 )
+        aEntry->FindAttribute( KCaAttrShortName, attrVal );
+        if( attrVal.Compare( info->iShortCaption ) != KErrNone
+                || aEntry->GetText().Compare( info->iCaption )
                         != KErrNone )
             {
-            aEntry->SetTextL( info.iCaption );
-            aEntry->AddAttributeL( KCaAttrLongName, info.iCaption );
+            aEntry->SetTextL( info->iCaption );
+            aEntry->AddAttributeL( KCaAttrShortName, info->iShortCaption );
             changed = ETrue;
             }
+
+
+        if ( UpdateComponentIdL( *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 );
+
+                TComponentId compId =
+                        iSoftwareRegistry.GetComponentIdForAppL( info->iUid );
+                CPropertyEntry* propertyEntry =
+                    iSoftwareRegistry.GetComponentPropertyL( compId, KCaScrPropertyAppSettings );
+                CleanupStack::PushL( propertyEntry );
+                if ( propertyEntry &&
+                        propertyEntry->PropertyType() == CPropertyEntry::ELocalizedProperty )
+                    {
+                    aEntry->AddAttributeL(
+                            KCaAttrAppSettingsPlugin,
+                            static_cast<CLocalizablePropertyEntry*>(propertyEntry)->StrValue() );
+                    }
+                CleanupStack::PopAndDestroy( propertyEntry );
                 }
-            else if (appTypeUid == KCWRTApplicationTypeUid)
+            else if ( appTypeUid == KCWRTApplicationTypeUid )
                 {
-                aEntry->AddAttributeL( KCaAttrAppType, KCaAttrAppTypeValueCWRT );
-                aEntry->AddAttributeL( KCaAttrAppWidgetUri, KCaAttrAppWidgetUriCWRTValue );
-                // web id should be taken from SCR when supported
-                RWidgetRegistryClientSession wrtSession;
-                CleanupClosePushL(wrtSession);
-                User::LeaveIfError( wrtSession.Connect());
-                TFileName bundleId;
-                wrtSession.GetWidgetBundleId(info.iUid, bundleId);
-                aEntry->AddAttributeL( KCaAttrAppWidgetParamWebAppId, bundleId );
-                CleanupStack::PopAndDestroy(&wrtSession);
+                aEntry->AddAttributeL(
+                        KCaAttrAppType,
+                        KCaAttrAppTypeValueCWRT );
+                TComponentId compId =
+                        iSoftwareRegistry.GetComponentIdForAppL( info->iUid );
+                CPropertyEntry* isMiniview =
+                                        iSoftwareRegistry.GetComponentPropertyL( compId,
+                                                KCaScrPropertyIsMiniviewSupported );
+                CleanupStack::PushL( isMiniview );
+                // check first if we support mini view
+                if (isMiniview && isMiniview->PropertyType() == CPropertyEntry::EIntProperty &&
+                        static_cast<CIntPropertyEntry*>(isMiniview)->IntValue())
+                    {
+                    CPropertyEntry* appId =
+                        iSoftwareRegistry.GetComponentPropertyL( compId, KCaScrPropertyAppId );
+                    CleanupStack::PushL( appId );
+                    if ( appId &&
+                         appId->PropertyType() == CPropertyEntry::ELocalizedProperty )
+                        {
+                        aEntry->AddAttributeL(
+                                            KCaAttrAppWidgetUri,
+                                            KCaAttrAppWidgetUriCWRTValue );
+                        aEntry->AddAttributeL(
+                                            KCaAttrAppWidgetParamWebAppId,
+                                            static_cast<CLocalizablePropertyEntry*>(appId)->StrValue() );
+                        }
+                    CleanupStack::PopAndDestroy( appId );
+                    }
+                CleanupStack::PopAndDestroy( isMiniview );
                 }
             }
         }
+    CleanupStack::PopAndDestroy( info );
     return changed;
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::HandleMissingItemsL
+//
 // ---------------------------------------------------------
 //
 void CCaSrvAppScanner::HandleMissingItemsL(
@@ -952,7 +904,6 @@
     {
     for( TInt i = 0; i < aCaEntries.Count(); i++ )
         {
-        const TInt id = aCaEntries[i]->GetId();
         RBuf attrVal;
         attrVal.CleanupClosePushL();
         attrVal.CreateL( KCaMaxAttrValueLen );
@@ -961,9 +912,9 @@
             TUint mmcId = 0;
             MenuUtils::GetTUint( attrVal, mmcId );
             if( ( mmcId && KErrNotFound != iMmcHistory->Find( mmcId )
-                    && mmcId != CurrentMmcId() ) ||
-                    ( attrVal == KCaMassStorage() &&
-                    IsDriveInUse( DriveInfo::EDefaultMassStorage ) ) )
+                        && mmcId != CurrentMmcId() )
+                    || ( attrVal == KCaMassStorage()
+                        && IsDriveInUse( DriveInfo::EDefaultMassStorage ) ) )
                 {
                 // This item is on an MMC which is currently
                 // in the MMC history or on a mass storage in use.
@@ -972,7 +923,7 @@
                 }
             else
                 {
-                aCaEntries[i]->RemoveAttributeL(KCaAttrMmcId());
+                aCaEntries[i]->RemoveAttributeL( KCaAttrMmcId() );
                 ClearVisibleFlagL( aCaEntries[i] );
                 }
             }
@@ -985,19 +936,6 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::RemoveAppL
-// ---------------------------------------------------------
-//
-void CCaSrvAppScanner::RemoveAppL( CCaInnerEntry* aAppEntry )
-    {
-    RArray<TInt> idsToRemove;
-    CleanupClosePushL( idsToRemove );
-    idsToRemove.AppendL( aAppEntry->GetId() );
-    iCaStorageProxy.RemoveL( idsToRemove );
-    CleanupStack::PopAndDestroy( &idsToRemove );
-    }
-
-// ---------------------------------------------------------
 //
 // ---------------------------------------------------------
 //
@@ -1005,7 +943,7 @@
     {
     if( !( aEntry->GetFlags() & EMissing ) )
         {
-        aEntry->SetFlags( aEntry->GetFlags() | EMissing );
+        aEntry->SetFlags( ( aEntry->GetFlags() | EMissing ) & ~EUninstall );
         iCaStorageProxy.AddL( aEntry, EFalse, EItemDisappeared );
         }
     }
@@ -1018,13 +956,18 @@
     {
     if( aEntry->GetFlags() & EVisible )
         {
-        aEntry->SetFlags( aEntry->GetFlags() & ~EVisible & ~EMissing & ~EUsed );
+        aEntry->SetFlags(
+                aEntry->GetFlags() &
+                ~EUninstall &
+                ~EVisible &
+                ~EMissing &
+                ~EUsed );
         iCaStorageProxy.AddL( aEntry, EFalse, EItemDisappeared );
         }
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::UpdateMmcHistoryL
+//
 // ---------------------------------------------------------
 //
 TUint CCaSrvAppScanner::UpdateMmcHistoryL()
@@ -1039,7 +982,7 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::CurrentMmcId
+//
 // ---------------------------------------------------------
 //
 TUint CCaSrvAppScanner::CurrentMmcId() const
@@ -1047,8 +990,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 +1005,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 +1023,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 +1039,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 +1050,7 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::IsInMmcL
+//
 // ---------------------------------------------------------
 //
 TBool CCaSrvAppScanner::IsInMmcL( const TUid aUid ) const
@@ -1116,7 +1059,7 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::IsInMassStorageL
+//
 // ---------------------------------------------------------
 //
 TBool CCaSrvAppScanner::IsInMassStorageL( const TUid aUid ) const
@@ -1125,7 +1068,7 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::IsInRomL
+//
 // ---------------------------------------------------------
 //
 TBool CCaSrvAppScanner::IsInRomL( TInt aUid )
@@ -1134,7 +1077,7 @@
     }
 
 // ---------------------------------------------------------
-// CCaSrvAppScanner::IsDriveInUse
+//
 // ---------------------------------------------------------
 //
 TBool CCaSrvAppScanner::IsDriveInUse(
@@ -1157,6 +1100,10 @@
     return inUse;
     }
 
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
 void CCaSrvAppScanner::MakeNotEmptyCollectionsVisibleL()
     {
     RPointerArray<CCaInnerEntry> resultArray;
@@ -1182,6 +1129,10 @@
     CleanupStack::PopAndDestroy( &resultArray );
    }
 
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
 void CCaSrvAppScanner::MakeCollectionVisibleIfHasVisibleEntryL(
         CCaInnerEntry* aEntry )
     {
@@ -1205,34 +1156,46 @@
     CleanupStack::PopAndDestroy( &resultEntriesArray );
     }
 
-
-// ==================== MEMBER FUNCTIONS ====================
-
-// ---------------------------------------------------------
-// TAppAtributes::TAppAtributes
-// ---------------------------------------------------------
-//
-TCaAppAtributes::TCaAppAtributes( TUint aUid )
-    {
-    iUid = aUid;
-    }
-
-// ---------------------------------------------------------
-// TAppAtributes::GetUid
 // ---------------------------------------------------------
 //
-TUint TCaAppAtributes::GetUid() const
+// ---------------------------------------------------------//
+TBool CCaSrvAppScanner::UpdateComponentIdL( CCaInnerEntry& aEntry ) const
     {
-    return iUid;
-    }
+    TBool updated( EFalse );
+
+    TUid uid;
+    TInt err(KErrNone);
+    TComponentId componentId( 0 );
+    TRAP(err, componentId =
+            iSoftwareRegistry.GetComponentIdForAppL(
+            uid.Uid( aEntry.GetUid() ) ) )
+
+    if ( componentId > 0 && err == KErrNone )
+        {
+        RBuf newComponentId;
+        newComponentId.CleanupClosePushL();
+        newComponentId.CreateL( sizeof(TComponentId) + 1 );
+        newComponentId.AppendNum( componentId );
 
-// ---------------------------------------------------------
-// TAppAtributes::MatchItems
-// ---------------------------------------------------------
-//
-TBool TCaAppAtributes::MatchItems( const TCaAppAtributes& item1,
-        const TCaAppAtributes& item2 )
-    {
-    return item1.GetUid() == item2.GetUid();
+        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 );
+        }
+    return updated;
     }
-
--- a/contentstorage/casrv/caappscanner/src/proxy.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/casrv/caappscanner/src/proxy.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -26,6 +26,10 @@
     IMPLEMENTATION_PROXY_ENTRY(0x20026FAF, CCaAppScannerHandler::NewL)
     };
 
+#ifdef COVERAGE_MEASUREMENT
+#pragma CTC SKIP
+#endif //COVERAGE_MEASUREMENT (proxy for instantiation)
+
 // Function used to return an instance of the proxy table.
 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
         TInt& aTableCount )
@@ -34,3 +38,9 @@
             / sizeof(TImplementationProxy);
     return ImplementationTable;
     }
+
+#ifdef COVERAGE_MEASUREMENT
+#pragma CTC ENDSKIP
+#endif //COVERAGE_MEASUREMENT
+
+
--- a/contentstorage/casrv/calocalizerscanner/bwins/calocalizerscanneru.def	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-EXPORTS
-	?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 1 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &)
-
--- a/contentstorage/casrv/calocalizerscanner/calocalizerscanner.pro	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/casrv/calocalizerscanner/calocalizerscanner.pro	Thu Jul 22 16:37:03 2010 +0100
@@ -45,18 +45,13 @@
         " TARGET calocalizerscanner.rsc" \
         "END"
     MMP_RULES += rssResource
-    MMP_RULES -= EXPORTUNFROZEN
-    MMP_RULES += "$${LITERAL_HASH}if defined(WINSCW)" \
-        "DEFFILE ./bwins/calocalizerscanner.def" \
-        "$${LITERAL_HASH}else" \
-        "DEFFILE ./eabi/calocalizerscanner.def" \
-        "$${LITERAL_HASH}endif"
     HEADERS += ./inc/*.h
     SOURCES += ./src/*.cpp
     LIBS += -leuser \
         -lecom \
         -lcautils \
-        -lcamenu
+        -lcamenu \
+        -lefsrv
 }
 
 exportResources(./*.qm, resource/qt/translations)
--- a/contentstorage/casrv/calocalizerscanner/eabi/calocalizerscanneru.def	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-EXPORTS
-	_Z24ImplementationGroupProxyRi @ 1 NONAME
-
--- a/contentstorage/casrv/calocalizerscanner/inc/calocalizerscannerproxy.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/casrv/calocalizerscanner/inc/calocalizerscannerproxy.h	Thu Jul 22 16:37:03 2010 +0100
@@ -21,7 +21,6 @@
 // INCLUDES
 #include <e32std.h>
 #include <e32base.h>
-#include "hbtextresolversymbian.h"
 
 #include "castorage_global.h"
 
@@ -36,11 +35,7 @@
  */
 class CCaLocalizerScannerProxy : public CBase
     {
-    
-
 public:
-    
-
     /**
      * Two-phased constructor.
      */
@@ -55,7 +50,11 @@
      * Destructor.
      */
     ~CCaLocalizerScannerProxy( );
-
+    
+    /**
+     * Get localization rows and updates database 
+     */
+    void UpdateLocalNamesL( );
    
 private:
 
@@ -69,30 +68,42 @@
      */
     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 );
+    
+    const TDesC& GetEntryDescription(
+            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 Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/casrv/calocalizerscanner/src/calocalizerscannerproxy.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -20,6 +20,7 @@
 #include <qtranslator.h>
 #include <calocalizationentry.h>
 #include <QLocale>
+#include <hbtextresolversymbian.h>
 
 //#include "cainternaltypes.h"
 #include "caarraycleanup.inl"
@@ -28,8 +29,9 @@
 #include "cadef.h"
 #include "cainnerquery.h"
 #include "cainnerentry.h"
+#include "casqlcommands.h"
 
-_LIT(KPathLoc,"z:/resource/qt/translations");
+
 
 // ---------------------------------------------------------------------------
 // CCaLocalizerScannerProxy::NewL
@@ -67,13 +69,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 +92,7 @@
 //
 CCaLocalizerScannerProxy::~CCaLocalizerScannerProxy()
     {
-	if (iResolver)
-		{
-	    delete iResolver;
-		} 
+	iRecentQmFile.Close();
     }
 
 // ---------------------------------------------------------------------------
@@ -126,13 +120,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,22 +135,23 @@
     HBufC16* localizedName;
     for( TInt i = 0; i < locCount; i++ )
         {
-        localizedName = iResolver->LoadLC( locals[i]->GetStringId() );
-        if( localizedName->Compare(
-            GetEntryText( entries, locals[i]->GetRowId() ) ) )
-            // translation different than text
+        localizedName = GetLocalizedNameLC( locals[i] );
+        
+        if( locals[i]->GetAttributeName().Compare( KColumnEnText) == 0
+                && !localizedName->Compare(
+                    GetEntryText( entries, locals[i]->GetRowId() ) ) == 0 
+                ||
+            locals[i]->GetAttributeName().Compare( KColumnEnDescription) == 0
+                && !localizedName->Compare(
+                    GetEntryDescription( entries, locals[i]->GetRowId() ) ) == 0 )
+            // translations different than text
             {
             locals[i]->SetLocalizedStringL( *localizedName );
             iStorageProxy->LocalizeEntryL( *( locals[i] ) );
-            } 
-        else if( !localizedName->Compare(KNullDesC) ) 
-            // no translation, string id as text
-            {
-            locals[i]->SetLocalizedStringL( locals[i]->GetStringId() );
-            iStorageProxy->LocalizeEntryL( *( locals[i] ) );
             }
         CleanupStack::PopAndDestroy( localizedName );
         }
+    HbTextResolverSymbian::Init( _L(""), KLocalizationFilepathZ );
    
     CleanupStack::PopAndDestroy( &ids );
     CleanupStack::PopAndDestroy( &entries );
@@ -166,11 +160,64 @@
 
 
 // ---------------------------------------------------------------------------
-// CCaLocalizerScannerProxy::LocalGetEntryById
+// 
+// ---------------------------------------------------------------------------
+//
+HBufC* CCaLocalizerScannerProxy::GetLocalizedNameLC(
+		const CCaLocalizationEntry* aLocEntry)
+    {
+	if( iRecentQmFile.Compare( aLocEntry->GetQmFilename() ) )
+		{
+	    
+	       if( !HbTextResolverSymbian::Init( aLocEntry->GetQmFilename(), KLocalizationFilepathC ) )
+	          {
+	          if( !HbTextResolverSymbian::Init( aLocEntry->GetQmFilename(), KLocalizationFilepathZ ) )
+	              {
+	              // this should not be called too often 
+	              TChar currentDriveLetter;
+	              TDriveList driveList;
+	              RFs fs;
+	              User::LeaveIfError( fs.Connect() );
+	              User::LeaveIfError( fs.DriveList( driveList ) );
+
+	              RBuf path;
+	              path.Create( KLocalizationFilepath().Length() + 1 );
+	              CleanupClosePushL( path );
+	              
+	              for ( TInt driveNr=EDriveY; driveNr >= EDriveA; driveNr-- )
+	                  {
+	                  if ( driveList[driveNr] )
+	                      {
+	                      User::LeaveIfError( fs.DriveToChar( driveNr,
+	                              currentDriveLetter ) );
+	                      path.Append( currentDriveLetter );
+	                      path.Append( KLocalizationFilepath );
+	                      if( HbTextResolverSymbian::Init( aLocEntry->GetQmFilename(), path ) )
+	                          {
+	                          break;
+	                          }
+	                      }
+	                  path.Zero();
+	                  }
+	              CleanupStack::PopAndDestroy( &path );
+	              fs.Close();
+	              }
+	           }
+	    
+        // keeping last qm filename to avoid another initialization
+	    iRecentQmFile.Close();
+	    iRecentQmFile.Create( aLocEntry->GetQmFilename().Length() );
+	    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++ )
@@ -182,3 +229,21 @@
         }
     return KNullDesC();
     }
+
+// ---------------------------------------------------------------------------
+//  
+// ---------------------------------------------------------------------------
+//
+const TDesC& CCaLocalizerScannerProxy::GetEntryDescription(
+        const RPointerArray<CCaInnerEntry>& aEntries, TInt aId )
+    {
+    TInt entriesCount = aEntries.Count();
+    for( TInt i=0; i < entriesCount; i++ )
+        {
+        if( aEntries[i]->GetId() == aId )
+            {
+            return aEntries[i]->GetDescription();
+            }
+        }
+    return KNullDesC();
+    }
--- a/contentstorage/casrv/carunningappmonitor/group/carunningappmonitor.mmp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/casrv/carunningappmonitor/group/carunningappmonitor.mmp	Thu Jul 22 16:37:03 2010 +0100
@@ -40,7 +40,7 @@
 USERINCLUDE     ../../../srvinc
 USERINCLUDE     ../../../cautils/inc
 
-APP_LAYER_SYSTEMINCLUDE
+MW_LAYER_SYSTEMINCLUDE
 
 SOURCEPATH      ../data
 START RESOURCE  carunningappmonitor.rss
--- a/contentstorage/casrv/casatmonitor/src/casatmonitor.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/casrv/casatmonitor/src/casatmonitor.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -115,7 +115,7 @@
         resultArray[0]->SetRole( EItemEntryRole );
         resultArray[0]->SetEntryTypeNameL( KCaTypeApp );
         resultArray[0]->SetTextL( satName );
-        resultArray[0]->AddAttributeL( KCaAttrLongName, satName );
+        resultArray[0]->AddAttributeL( KCaAttrShortName, satName );
         resultArray[0]->SetFlags( resultArray[0]->GetFlags() | EVisible );
 
         iCaStorageProxy.AddL( resultArray[0] );
--- a/contentstorage/casrv/casatmonitor/src/casatnotifier.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/casrv/casatmonitor/src/casatnotifier.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -95,6 +95,9 @@
     iProperty.Cancel();
     }
 
+#ifdef COVERAGE_MEASUREMENT
+#pragma CTC SKIP
+#endif //COVERAGE_MEASUREMENT (error ignored)
 // ---------------------------------------------------------------------------
 // CCaSatNotifier::RunError
 // ---------------------------------------------------------------------------
@@ -103,6 +106,9 @@
     {
     return KErrNone;
     }
+#ifdef COVERAGE_MEASUREMENT
+#pragma CTC ENDSKIP
+#endif //COVERAGE_MEASUREMENT
 
 // ---------------------------------------------------------------------------
 // CCaSatNotifier::RunL
--- a/contentstorage/casrv/casrvmgr/bwins/casrvmanageru.def	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/casrv/casrvmgr/bwins/casrvmanageru.def	Thu Jul 22 16:37:03 2010 +0100
@@ -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 Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/casrv/casrvmgr/eabi/casrvmanageru.def	Thu Jul 22 16:37:03 2010 +0100
@@ -1,3 +1,4 @@
 EXPORTS
 	_ZN13CCaSrvManager4NewLER15CCaStorageProxyP14CCaSrvEngUtils @ 1 NONAME
+	_ZN13CCaSrvManager23LoadOperationErrorCodeLEv @ 2 NONAME
 
--- a/contentstorage/casrv/casrvmgr/group/casrvmanager.mmp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/casrv/casrvmgr/group/casrvmanager.mmp	Thu Jul 22 16:37:03 2010 +0100
@@ -15,7 +15,7 @@
 *
 */
 
-// To get the APP_LAYER_SYSTEMINCLUDE-definition
+// To get the MW_LAYER_SYSTEMINCLUDE-definition
 #include <platform_paths.hrh>
 
 TARGET        casrvmanager.dll
@@ -30,7 +30,7 @@
 
 USERINCLUDE   ../inc
 
-APP_LAYER_SYSTEMINCLUDE
+MW_LAYER_SYSTEMINCLUDE
 
 LIBRARY       euser.lib
 LIBRARY       ECom.lib
--- a/contentstorage/casrv/casrvmgr/inc/casrvmanager.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/casrv/casrvmgr/inc/casrvmanager.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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 Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/casrv/casrvmgr/src/casrvmanager.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -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 Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/casrv/causifscanner/inc/causifscanner.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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 Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/casrv/causifscanner/src/causifscanner.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -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;
     }
 
 // ---------------------------------------------------------------------------
@@ -164,7 +161,6 @@
     if( aEntry->Name().Compare( KNullDesC ) )
         {
         aCaEntry->SetTextL( aEntry->Name() );
-        aCaEntry->AddAttributeL( KCaAttrLongName, aEntry->Name() );
         }
     if( !aEntry->IsHidden() )
         {
@@ -198,12 +194,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 +238,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 +267,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 +279,6 @@
             {
             CleanupStack::PopAndDestroy( entry );
             }
-        entry = scrView.NextComponentL();
         }
     CleanupStack::PopAndDestroy( &scrView );
     CleanupStack::PopAndDestroy( filter );
@@ -293,24 +288,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 +316,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 +330,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/causifscanner/src/proxy.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/casrv/causifscanner/src/proxy.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -28,6 +28,10 @@
     IMPLEMENTATION_PROXY_ENTRY(KCaUsifScannerImplProxyUid, CCaUsifScanner::NewL)
     };
 
+#ifdef COVERAGE_MEASUREMENT
+#pragma CTC SKIP
+#endif //COVERAGE_MEASUREMENT (proxy for instantiation)
+
 // Function used to return an instance of the proxy table.
 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
         TInt& aTableCount )
@@ -35,3 +39,8 @@
     aTableCount = sizeof( ImplementationTable ) / sizeof(TImplementationProxy);
     return ImplementationTable;
     }
+
+#ifdef COVERAGE_MEASUREMENT
+#pragma CTC ENDSKIP
+#endif //COVERAGE_MEASUREMENT
+
--- a/contentstorage/casrv/cawidgetscanner/group/cawidgetscanner.mmp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/casrv/cawidgetscanner/group/cawidgetscanner.mmp	Thu Jul 22 16:37:03 2010 +0100
@@ -45,19 +45,26 @@
 USERINCLUDE     ../../casrvmgr/inc
 USERINCLUDE     ../../../cautils/inc
 USERINCLUDE     ../../../srvinc
-USERINCLUDE     ../../../castorage/inc
 USERINCLUDE     ../../../inc
 
 MW_LAYER_SYSTEMINCLUDE
 
 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
+
+
+// HB LIBRARIES
+SYSTEMINCLUDE		/epoc32/include/mw/hb/hbcore
+LIBRARY		HbCore.lib
+
+
 
 // End of file
--- a/contentstorage/casrv/cawidgetscanner/inc/cawidgetdescription.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/casrv/cawidgetscanner/inc/cawidgetdescription.h	Thu Jul 22 16:37:03 2010 +0100
@@ -1,19 +1,19 @@
 /*
-* 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:
-*
-*/
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
 #ifndef C_WIDGETDESCRIPTION_H
 #define C_WIDGETDESCRIPTION_H
 
@@ -49,13 +49,14 @@
 
     /**
      * Static method to compare two CCaWidgetDescription objects
+     * used in Find() method
      * @param aFirst first item to compare
      * @param aSecond second item to compare
-     * @return ETrue if iLibrary value is the same in both objects,
+     * @return ETrue if widget uri value is the same in both objects,
      * otherwise returns EFalse
      */
     static TBool Compare( const CCaWidgetDescription& aFirst,
-            const CCaWidgetDescription& aSecond);
+            const CCaWidgetDescription& aSecond );
 
     /**
      * Method to compare two CCaWidgetDescription objects
@@ -78,6 +79,12 @@
     void SetPackageUidL( const TDesC& aPackageUid );
 
     /*
+     * PackageUid getter
+     * @return iPackageUid - package UID
+     */
+    TUint GetPackageUidL();
+    
+    /*
      * Title setter
      * @param aTitle widget title
      */
@@ -94,6 +101,12 @@
      * @param aUri widget uri
      */
     void SetUriL( const TDesC& aUri );
+    
+    /*
+     * Translation file setter.
+     * @param aTranslationFileName widget translation file.
+     */
+    void SetTranslationFileNameL( const TDesC& aTranslationFileName );
 
     /*
      * Icon Uri setter
@@ -102,6 +115,12 @@
     void SetIconUriL( const TDesC& aIconUri );
 
     /*
+     * Preview image name setter.
+     * @param aPreview preview image name identifier.
+     */
+    void SetPreviewImageNameL( const TDesC& aPreviewName );
+    
+    /*
      * Library setter
      * @param aLibrary widget library
      */
@@ -118,91 +137,84 @@
      * @return widget library
      */
     TPtrC GetPath( ) const;
-
+    
     /*
-     * Missing flag setter
-     * @param aMissing flag
-     */
-    void SetMissing( TBool aMissing );
-
-    /*
-     * Visible flag setter
-     * @param aVisible flag
+     * Content storage entry id getter
+     * @return CS entry id
      */
-    void SetVisible( TBool aVisible );
-
-    /*
-     * Used flag setter
-     * @param aUsed flag
-     */
-    void SetUsed( TBool aUsed );
-
-    /*
-     * Content arsenal entry id getter
-     * @return CA entry id
-     */
-    TInt GetEntryId( ) const;
+    TInt GetEntryId() const;
 
     /*
      * MMC id getter
      * @return CA entry id
      */
-    TPtrC GetMmcId( ) const;
+    TPtrC GetMmcId() const;
 
     /*
      * Library getter
      * @return widget library
      */
-    TPtrC GetLibrary( ) const;
+    TPtrC GetLibrary() const;
 
     /*
      * Description getter
      * @return widget Description
      */
-    TPtrC GetDescription( ) const;
+    TPtrC GetDescription() const;
 
     /*
      * Uri getter
      * @return widget Uri
      */
-    TPtrC GetUri( ) const;
+    TPtrC GetUri() const;
+
+    /*
+     * Uri translation filename
+     * @return widget translation filename
+     */
+    TPtrC GetTranslationFileName() const;
 
     /*
      * IconUri getter
      * @return widget IconUri
      */
-    TPtrC GetIconUri( ) const;
+    TPtrC GetIconUri() const;
 
     /*
+     * Preview image name getter
+     * @return widget preview image name
+     */
+    TPtrC GetPreviewImageName( ) const;
+    
+    /*
      * Title getter
-     * @return widget IconUri
+     * @return widget title
      */
-    TPtrC GetTitle( ) const;
+    TPtrC GetTitle() const;
 
     /*
      * Missing flag
      * @return ETrue if flag missing is set
      */
-    TBool IsMissing( ) const;
+    TBool IsMissing() const;
 
     /*
      * Used flag
      * @return ETrue if flag used is set
      */
-    TBool IsUsed( ) const;
-    
+    TBool IsUsed() const;
 
     /*
      * Used flag
      * @return ETrue if flag visible is set
      */
-    TBool IsVisible( ) const;
+    TBool IsVisible() const;
 
     /*
      * Entry getter
      * @return entry representing widget
      */
-    CCaInnerEntry* GetEntryLC( ) const;
+    CCaInnerEntry* GetEntryLC() const;
 
     /*
      * Modification time setter
@@ -224,20 +236,54 @@
      * Set service fw xml filename
      * @param aServiceXml Service xml filename
      */
-    void SetServiceXmlL(const TDesC& aServiceXml);
+    void SetServiceXmlL( const TDesC& aServiceXml );
     /*
      * Get service fw xml filename
      * @return Service xml filename
      */
     TPtrC GetServiceXml() const;
 
-private:
+    /*
+     /*
+     * Localizes title and description, fill string id fields
+     */
+    void LocalizeTextsL();
+
+    /*
+     * StringIdDescription time getter
+     * @return StringIdDescription
+     */
+    TPtrC GetStringIdDescription() const;
+
+    /*
+     * StringIdTitle time getter
+     * @return widget StringIdTitle
+     */
+    TPtrC GetStringIdTitle() const;
 
     /*
-     * Library name getter
-     * @return libraru name
+     * 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 GetLibraryName( ) const;
+    TPtrC GetManifestFilePathName() const;
+
+    /*
+     * Set logical string for description.
+     * @param aStringIdDescription logical string for description.
+     */
+    void SetStringIdDescriptionL( const TDesC& aStringIdDescription );
+
+    /*
+     * Set logical string for title.
+     * @param aStringIdTitle logical string for title.
+     */
+    void SetStringidTitleL( const TDesC& aStringIdTitle );
 
     /*
      * Flag setter
@@ -246,7 +292,24 @@
      */
     void SetFlag( TInt aFlag, TBool aValue );
 
-private:
+    /*
+     * Valid setter
+     * @param aVal value
+     */ 
+    void SetValid(TBool aVal);
+    
+    /*
+     * Valid getter
+     * @return valid value
+     */ 
+    TBool CCaWidgetDescription::IsValid();
+
+    /*
+     * Library name getter
+     * @return libraru name
+     */
+    TPtrC GetLibraryName() const;
+
 
     /**
      * C++ default constructor.
@@ -256,17 +319,20 @@
     /**
      * By default Symbian 2nd phase constructor is private.
      */
-    void ConstructL( );
+    void ConstructL();
     void ConstructL( CCaInnerEntry* aEntry );
 
-
-private:
     // Data
 
     /*
      * Content Storage entry id
      */
     TInt iEntryId;
+    
+    /*
+     * Marks vidget as valid, used to remove widgets
+     */
+    TBool iValid;
 
     /*
      * Package UID
@@ -292,17 +358,27 @@
      * Widget uri. Own
      */
     RBuf iUri;
+    
+    /*
+     * Widget translation file name. Own
+     */
+    RBuf iTranslationFileName;
 
     /*
      * Widget icon uri. Own
      */
     RBuf iIconUri;
-
+    
+    /*
+     * Preview name. Own
+     */
+    RBuf iPreviewImageName;
+    
     /*
      * Widget library. Own
      */
     RBuf iPath;
-
+    
     /*
      * Widget library. Own
      */
@@ -321,6 +397,18 @@
      * Service fw xml file
      */
     RBuf iServiceXml;
+    /*
+     * Manifest file path name.
+     */
+    RBuf iManifestFilePathName;
+    /*
+     * Strign id of title
+     */
+    RBuf iStringIdTitle;
+    /*
+     * Strign id of description
+     */
+    RBuf iStringIdDescription;
     };
 
 typedef RPointerArray<CCaWidgetDescription> RWidgetArray;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contentstorage/casrv/cawidgetscanner/inc/cawidgetscannerdef.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Globals for Content Publisher  server
+ *
+*/
+
+
+#ifndef CA_WIDGETSCANNERDEF_H
+#define CA_WIDGETSCANNERDEF_H
+
+// CONSTANTS
+const TInt KChunkSize = 8192;
+const TInt KDriveLetterLength = 2;
+const TInt KModificationTimeLength = 17;
+const TInt KNoId = -1;
+
+const TInt KPackageUidPosition = 9; // position in path from end
+const TInt KPackageUidLength = 8;
+
+
+// LIT
+_LIT( KDoubleSlash, "\\" );
+_LIT( KWidgetScannerUnderline, "_" );
+
+
+_LIT( KManifest, ".manifest");
+_LIT( KColen, ":" );
+_LIT( KImportDir, "\\private\\20022F35\\import\\widgetregistry\\" );
+_LIT( KTrue, "true" );
+_LIT8(KWidget, "widget" );
+_LIT8(KUri, "uri" );
+_LIT8(KLibrary, "library" );
+_LIT8(KTitle, "title" );
+_LIT8(KDescription, "description" );
+_LIT8(KHidden, "hidden" );
+_LIT8(KIconUri, "iconuri" );
+_LIT8(KWidgetProvider, "widgetprovider");
+
+_LIT8(KWidgetManifest, "hswidgetmanifest");
+_LIT8(KIcon, "icon");
+_LIT8( KPreviewImageElementName, "previewimage" );
+_LIT8(KServiceXml, "servicexml");
+_LIT8( KTranslationFileName, "translationfile" );
+
+// CONSTANTS
+_LIT(KAttrWidgetPath, "widget:path");
+_LIT(KAttrWidgetLibrary, "widget:library");
+_LIT(KAttrWidgetUri, "widget:uri");
+_LIT(KAttrWidgetTranslationFileName, "widget:translation_file");
+_LIT(KAttrWidgetServiceXml, "widget:servicexml");
+_LIT(KSlash, "/");
+_LIT(KDllExt, ".dll");
+_LIT(KNoLibrary, "NoLibrary");
+
+#endif // CA_WIDGETSCANNERDEF_H
--- a/contentstorage/casrv/cawidgetscanner/inc/cawidgetscannerinstallnotifier.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/casrv/cawidgetscanner/inc/cawidgetscannerinstallnotifier.h	Thu Jul 22 16:37:03 2010 +0100
@@ -1,20 +1,19 @@
 /*
-* 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:  Sis package installation event listener
+ * 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:  Sis package installation event listener
+ *
+ */
 
 #ifndef C_CAWIDGETSCANNERINSTALLNOTIFIER_H
 #define C_CAWIDGETSCANNERINSTALLNOTIFIER_H
@@ -61,12 +60,12 @@
      * @param aKey Key for central repository.
      */
     static CCaWidgetScannerInstallNotifier* NewL(
-        CCaWidgetScannerPlugin* aCallback, TUid aCategory, TUint aKey );
+            CCaWidgetScannerPlugin* aCallback, TUid aCategory, TUint aKey );
 
     /**
      * Destructor.
      */
-    virtual ~CCaWidgetScannerInstallNotifier ();
+    virtual ~CCaWidgetScannerInstallNotifier();
 
 private:
     /**
@@ -76,7 +75,7 @@
      * @param aKey Key for central repository.
      */
     CCaWidgetScannerInstallNotifier( CCaWidgetScannerPlugin* aCallback,
-        TUid aCategory, TUint aKey );
+            TUid aCategory, TUint aKey );
 
     /**
      * Symbian 2nd phase constructor.
--- a/contentstorage/casrv/cawidgetscanner/inc/cawidgetscannerparser.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/casrv/cawidgetscanner/inc/cawidgetscannerparser.h	Thu Jul 22 16:37:03 2010 +0100
@@ -21,17 +21,19 @@
 
 //  INCLUDES
 #include <e32base.h>
-#include <xmlengdomimplementation.h>
-#include <xmlengelement.h>
+#include <xml/dom/xmlengdomimplementation.h>
 #include <badesca.h>
 #include <f32file.h>
 #include "cawidgetdescription.h"
+#include "castorage_global.h"
 
 // CONSTANTS
 
 // FORWARD DECLARATIONS
+
 class CDir;
-
+CA_STORAGE_TEST_CLASS( T_CaWidgetScanner )
+class TXmlEngElement;
 /**
  *  Widget Parser
  *
@@ -58,124 +60,8 @@
      * WidgetsL
      * @return array containing widgets description
      */
-    RWidgetArray& WidgetsScanL( );
-
-private:
-
-    /**
-     * Looks for manifests on a drive
-     * @param aDriveLetter drive letter
-     */
-    void ScanOnDriveL( );
-
-    /**
-     * Parses all manifest files in a directory
-     * @param aDriveLetter drive letter
-     * @param aDirectoryName directory name
-     */
-    void ParseDirectoryL( const TDesC& aDirectoryName );
-
-    /**
-    * Parse manifest file
-    * @param aFilePath full file path to manifest file
-    * @param aPackageUid descriptor containing package uid
-    */
-    void ParseManifestFileL( const TDesC& aFilePath,
-        const TDesC& aPackageUid);
-
-    /**
-    * Parse a widget, store parsed object in an internal array
-    * @param aFilePath full file path to manifest file
-    * @param aElement widget element
-    * @param aPackageUid descriptor containing package uid
-    */
-    void ParseWidgetL( const TDesC& aFilePath,
-            TXmlEngElement aElement, const TDesC& aPackageUid );
-
-    /**
-     * Gets all directories from import folder
-     * @param aDriveLetter drive letter
-     * @return directories
-     */
-    CDir* GetDirectoriesLC( );
-
-    /**
-     * Returns import path
-     * @param aDriveLetter drive letter
-     * @return import path
-     */
-    HBufC* FullPathLC( );
-
-    /**
-     * Returns manifest directory path
-     * @param aDriveLetter drive letter
-     * @param aDirectoryName directory name
-     * @return manifest directory path
-     */
-    HBufC* GetManifestDirectoryPathLC( const TDesC& aDirectoryName );
-
-    /**
-     * Sets widgets URI
-     * @param aElement xml element
-     * @param aWidget widget to set value
-     */
-    void SetUriL( TXmlEngElement & aElement, CCaWidgetDescription * aWidget );
-
-    /**
-     * Sets widgets library and path created from library
-     * @param aElement xml element
-     * @param aPackageUid package uid
-     * @param aWidget widget to set value
-     */
-    void SetLibraryL( TXmlEngElement & aElement, const TDesC & aPackageUid,
-            CCaWidgetDescription * aWidget );
-
-    /**
-     * Sets widgets title
-     * @param aElement xml element
-     * @param aWidget widget to set value
-     */
-    void SetTitleL( TXmlEngElement & aElement, 
-            CCaWidgetDescription * aWidget );
-
-    /**
-     * Sets widgets description
-     * @param aElement xml element
-     * @param aWidget widget to set value
-     */
-    void SetDescriptionL( TXmlEngElement & aElement,
-            CCaWidgetDescription * aWidget );
-
-    /**
-     * Sets widgets visibility
-     * @param aElement xml element
-     * @param aWidget widget to set value
-     */
-    void SetVisibilityL( TXmlEngElement & aElement,
-            CCaWidgetDescription * aWidget );
-
-    /**
-     * Sets icons URI
-     * @param aElement xml element
-     * @param aPackageUid package uid
-     * @param aWidget widget to set value
-     */
-    void SetIconUriL( TXmlEngElement & aElement, const TDesC & aPackageUid,
-            CCaWidgetDescription * aWidget );
-
-    /**
-     * Sets widgets mmc id
-     * @param aWidget widget to set value
-     */
-    void SetMmcIdL( CCaWidgetDescription * aWidget );
+    RWidgetArray& WidgetsScanL( const RWidgetArray& aWidgets  );
     
-    void ParseUriL(TXmlEngElement & aElement);
-    void ParseTitleL(TXmlEngElement & aElement);
-    void ParseIconL(TXmlEngElement & aElement,  const TDesC & aPackageUid);
-    void ParseDescriptionL(TXmlEngElement & aElement);
-    void ParseHiddenL(TXmlEngElement & aElement);
-    void ParseServiceXmlL(TXmlEngElement & aElement);
-
 private:
 
     /**
@@ -188,13 +74,172 @@
      */
     void ConstructL( );
 
-private:
-    // Data
+
+    /**
+     * Looks for manifests on a drive
+     * @param aDrive drive to use
+     */
+    void ScanOnDriveL( TChar& aDrive );
+
+    /**
+     * Parses all manifest files in a directory
+     * @param aDirectoryName directory name
+     * @param aDrive drive to use
+     */
+    void ParseDirectoryL( const TDesC& aDirectoryName, TChar& aDrive );
+
+    /**
+    * Parse manifest file
+    * @param aFilePath full file path to manifest file
+    * @param aPackageUid descriptor containing package uid
+    * @param aDrive drive to use
+    */
+    void ParseManifestFileL( const TDesC& aFilePath,
+        const TDesC& aPackageUid, TChar& aDrive );
+
+    /**
+    * Parse a widget, store parsed object in an internal array
+    * @param aFilePath full file path to manifest file
+    * @param aElement widget element
+    * @param aPackageUid descriptor containing package uid
+    * @param aDrive drive to use
+    */
+    void ParseWidgetL( const TDesC& aFilePath,
+            TXmlEngElement& aElement, const TDesC& aPackageUid,
+            TChar& aDrive );
+
+    /**
+     * Gets all directories from import folder
+     * @param aDriveLetter drive letter
+     * @return directories
+     */
+    CDir* GetDirectoriesLC( TChar& aDrive );
+
+    /**
+     * Returns import path
+     * @param aDriveLetter drive letter
+     * @return import path
+     */
+    HBufC* FullPathLC( TChar& aDrive ) const;
+
+    /**
+     * Returns manifest directory path
+     * @param aDriveLetter drive letter
+     * @param aDirectoryName directory name
+     * @param aDrive drive to use
+     * @return manifest directory path
+     */
+    HBufC* GetManifestDirectoryPathLC( const TDesC& aDirectoryName, TChar& aDrive ) const;
+
+    /**
+     * Sets widgets URI
+     * @param aElement xml element
+     * @param aWidget widget to set value
+     */
+    void SetUriL( TXmlEngElement& aElement, CCaWidgetDescription* aWidget );
+    
+    /**
+     * Sets translation filename
+     * @param aElement xml element
+     * @param aWidget widget to set value
+     */
+    void SetTranslationFileNameL( TXmlEngElement& aElement, CCaWidgetDescription* aWidget );
+
+    /**
+     * Sets widgets library and path created from library
+     * @param aElement xml element
+     * @param aPackageUid package uid
+     * @param aWidget widget to set value
+     */
+    void SetLibraryL( TXmlEngElement& aElement, const TDesC& aPackageUid,
+            CCaWidgetDescription* aWidget, TChar& aDrive );
 
-    /*
-     * Stores current drive letter
+    /**
+     * Sets widgets title
+     * @param aElement xml element
+     * @param aWidget widget to set value
+     */
+    void SetTitleL( TXmlEngElement& aElement, 
+            CCaWidgetDescription* aWidget );
+
+    /**
+     * Sets widgets description
+     * @param aElement xml element
+     * @param aWidget widget to set value
+     */
+    void SetDescriptionL( TXmlEngElement& aElement,
+            CCaWidgetDescription* aWidget );
+
+    /**
+     * Sets widgets visibility
+     * @param aElement xml element
+     * @param aWidget widget to set value
+     */
+    void SetVisibilityL( TXmlEngElement& aElement,
+            CCaWidgetDescription* aWidget );
+
+    /**
+     * Sets icons URI
+     * @param aElement xml element
+     * @param aPackageUid package uid
+     * @param aWidget widget to set value
+     */
+    void SetIconUriL( TXmlEngElement& aElement, const TDesC& aPackageUid,
+            CCaWidgetDescription* aWidget, TChar& aDrive );
+
+    /**
+     * Sets widgets mmc id
+     * @param aWidget widget to set value
      */
-    TChar iCurrentDriveLetter;
+    void SetMmcIdL( CCaWidgetDescription* aWidget, TChar& aDrive );
+    
+    void ParseUriL( TXmlEngElement& aElement,
+            CCaWidgetDescription* aWidgetDescriptor );
+    void ParseTitleL( TXmlEngElement& aElement,
+            CCaWidgetDescription* aWidgetDescriptor );
+    void ParseIconL( TXmlEngElement& aElement,  const TDesC& aPackageUid,
+            CCaWidgetDescription* aWidgetDescriptor, TChar& aDrive );
+    void ParseDescriptionL( TXmlEngElement& aElement,
+            CCaWidgetDescription* aWidgetDescriptor );
+    void ParseHiddenL( TXmlEngElement& aElement,
+            CCaWidgetDescription* aWidgetDescriptor );
+    void ParseServiceXmlL(TXmlEngElement & aElement,
+            CCaWidgetDescription* aWidgetDescriptor );
+    void SetModificationTimeL( const TDesC& aFilePath,
+            CCaWidgetDescription* aWidgetDescriptor );
+    
+    void ParsePreviewImageNameL( TXmlEngElement& aElement, 
+        const TDesC& aPackageUid,
+        CCaWidgetDescription* aWidgetDescriptor,
+        TChar& aDrive );
+    
+    void ParseTranslationFileNameL( TXmlEngElement& aElement,
+            CCaWidgetDescription* aWidgetDescriptor );
+
+    /**
+     * @param aElement xml document element.
+     * @return created descriptor with element's text value. Ownership
+     * of the descriptor is passed to the caller.
+     */
+    HBufC *CCaWidgetScannerParser::GetElementTextLC( 
+        const TXmlEngElement& aElement ) const;
+    
+    /**
+     * Parses graphics name value and if the name has a file extension
+     * adds widget root directory path to it.
+     * @param aElement xml document element.
+     * @return created descriptor with graphics name value. Ownership
+     * of the descriptor is passed to the caller.
+     */
+    HBufC* GetThemableGraphicsNameLC(
+            const TXmlEngElement & aElement,
+            const TDesC & aPackageUid,
+            TChar& aDrive ) const;
+
+
+
+private:
+    // Data  
 
     /*
      * File server session.Not Own
@@ -210,13 +255,19 @@
      * Widgets. Own.
      */
     RWidgetArray iWidgets;
+    
+    /*
+     * Widgets. Not own.
+     */
+    RWidgetArray iFetchedWidgets; 
     /*
      * Own.
      */
     RXmlEngDOMImplementation iDomImpl;
     
-    CCaWidgetDescription* iWidgetDescriptor;
-
+    
+    CA_STORAGE_TEST_FRIEND_CLASS( T_CaWidgetScanner )
+    
     };
 
 #endif      // C_WIDGETSCANNERPARSER_H
--- a/contentstorage/casrv/cawidgetscanner/inc/cawidgetscannerplugin.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/casrv/cawidgetscanner/inc/cawidgetscannerplugin.h	Thu Jul 22 16:37:03 2010 +0100
@@ -1,31 +1,28 @@
 /*
-* 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:  Ecom plugin
+ * 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:  Ecom plugin
+ *
+ */
 
 #ifndef C_CAWIDGETSCANNERPLUGIN_H
 #define C_CAWIDGETSCANNERPLUGIN_H
 
 #include <casrvplugin.h>
 #include <f32file.h>
-#include "cawidgetdescription.h"
 #include "cammcwatcher.h"
 
 class TPluginParams;
-class CCaWidgetScannerParser;
 class CCaWidgetScannerInstallNotifier;
 class CCaWidgetStorageHandler;
 
@@ -47,12 +44,12 @@
     ~CCaWidgetScannerPlugin();
 
     /**
-     * SynchronizeL
+     * SynchronizeL - synchronizes widgets on device with database
      */
     void SynchronizeL();
 
 private:
-//from MWidgetMmcWatcherCallback
+    //from MWidgetMmcWatcherCallback
 
     /**
      * MmcChangeL is called when the MMC is removed or inserted.
@@ -64,7 +61,7 @@
     /**
      * C++ default constructor.
      */
-    CCaWidgetScannerPlugin( );
+    CCaWidgetScannerPlugin();
 
     /**
      * By default Symbian 2nd phase constructor is private.
@@ -84,11 +81,6 @@
     CCaWidgetScannerInstallNotifier* iInstallNotifier;
 
     /**
-     * Pointer to a parser object. Own
-     */
-    CCaWidgetScannerParser* iParser;
-
-    /**
      * Content Storage Handler. Own.
      */
     CCaWidgetStorageHandler* iStorageHandler;
--- a/contentstorage/casrv/cawidgetscanner/inc/cawidgetstoragehandler.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/casrv/cawidgetscanner/inc/cawidgetstoragehandler.h	Thu Jul 22 16:37:03 2010 +0100
@@ -1,31 +1,33 @@
 /*
-* 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:
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
  *
-*/
-
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
 
 #ifndef C_WIDGETSTORAGEHANDLER_H
 #define C_WIDGETSTORAGEHANDLER_H
 
 class CCaStorageProxy;
 class CCaWidgetDescription;
+class CCaWidgetScannerParser;
 
 //  INCLUDES
 #include <e32base.h>
+#include <usif/scr/scr.h>
 #include "cawidgetdescription.h"
 #include "castorage_global.h"
+
 // CONSTANTS
 
 // FORWARD DECLARATIONS
@@ -38,7 +40,7 @@
 class CCaWidgetStorageHandler : public CBase
     {
 public:
-    CA_STORAGE_TEST_FRIEND_CLASS    (T_CaWidgetScanner)
+CA_STORAGE_TEST_FRIEND_CLASS (T_CaWidgetScanner)
 
 public:
     // Constructors and destructor
@@ -57,11 +59,9 @@
     virtual ~CCaWidgetStorageHandler();
 
     /**
-     * Synchronizes widgets
-     * @param aWidgets widgets to synchronize
+     * SynchronizeL - synchronizes widgets on device with database
      */
-    void SynchronizeL( const RWidgetArray& aWidgets );
-
+    void SynchronizeL();
 
 private:
 
@@ -74,6 +74,7 @@
     /**
      * Updates widget in storage.
      * @param aWidget widget to be updated
+     * @param aEntryId entry of widget in db
      */
     void UpdateL( const CCaWidgetDescription* aWidget, TUint aEntryId );
 
@@ -86,12 +87,12 @@
     /**
      * Removes widgets from DB
      */
-    void RemoveWidgetsL( ) ;
+    void RemoveWidgetsL();
 
     /**
      * Fetch widgets from content storage
      */
-    void FetchWidgetsL( );
+    void FetchWidgetsL();
 
     /**
      * Add widget to download collection
@@ -111,6 +112,13 @@
      */
     void ClearVisibleFlagL( const CCaWidgetDescription* aWidget );
 
+    /**
+     * Set localizations for widget in db
+     * @param aWidget widget.
+     * @param aEntryId of widget.
+     */
+    void SetLocalizationsL( const CCaWidgetDescription* aWidget, TInt aEntryId );
+
 private:
 
     /**
@@ -121,7 +129,7 @@
     /**
      * By default Symbian 2nd phase constructor is private.
      */
-    void ConstructL( );
+    void ConstructL();
 
     /**
      * Check if mass storage is not in use.
@@ -129,6 +137,15 @@
      */
     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
 
@@ -147,12 +164,12 @@
      */
     RWidgetArray iWidgets;
 
-    /*
-     * Indexes updated during last add operation. Own.
+    /**
+     * Pointer to a parser object. Own
      */
-    RArray<TInt> iUpdatedIndexes;
+    CCaWidgetScannerParser* iParser;
 
-
+    Usif::RSoftwareComponentRegistry iSoftwareRegistry;
     };
 
 #endif      // C_WIDGETSTORAGEHANDLER_H
--- a/contentstorage/casrv/cawidgetscanner/inc/widgetscannerutils.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/casrv/cawidgetscanner/inc/widgetscannerutils.h	Thu Jul 22 16:37:03 2010 +0100
@@ -1,20 +1,19 @@
 /*
-* 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:
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
  *
-*/
-
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
 
 #ifndef WIDGETSCANNERUTILS_H
 #define WIDGETSCANNERUTILS_H
@@ -22,15 +21,7 @@
 //  INCLUDES
 #include <e32base.h>
 #include <driveinfo.h>
-
-// CONSTANTS
-_LIT(KAttrWidgetPath, "widget:path");
-_LIT(KAttrWidgetLibrary, "widget:library");
-_LIT(KAttrWidgetUri, "widget:uri");
-_LIT(KAttrWidgetServiceXml, "widget:servicexml");
-_LIT(KSlash, "/");
-_LIT(KDllExt, ".dll");
-_LIT(KNoLibrary, "NoLibrary");
+#include "cawidgetscannerdef.h"
 
 // FORWARD DECLARATIONS
 class CCaInnerEntry;
@@ -49,8 +40,8 @@
      * @param aDriveLetter drive letter
      * @return ETrue if file is present, EFalse if not
      */
-    static TBool IsFileOnDrive(const TDesC& aFileName,
-        const DriveInfo::TDefaultDrives& aDefaultDrive);
+    static TBool IsFileOnDrive( const TDesC& aFileName,
+            const DriveInfo::TDefaultDrives& aDefaultDrive );
 
     /**
      * Returns current MMC id.
--- a/contentstorage/casrv/cawidgetscanner/src/cawidgetdescription.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/casrv/cawidgetscanner/src/cawidgetdescription.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -17,16 +17,13 @@
 
 
 // INCLUDE FILES
+#include <hbtextresolversymbian.h>
 
 #include "cadef.h"
 #include "cawidgetdescription.h"
 #include "cainnerentry.h"
 #include "widgetscannerutils.h"
-
-// CONST
-const TInt KNoId = -1;
-_LIT( KDoubleSlash, "\\" );
-
+#include "cawidgetscannerdef.h"
 // ============================ MEMBER FUNCTIONS ===============================
 
 // -----------------------------------------------------------------------------
@@ -36,7 +33,7 @@
 // -----------------------------------------------------------------------------
 //
 CCaWidgetDescription::CCaWidgetDescription() :
-    iEntryId(KNoId), iMmcId()
+    iEntryId( KNoId ), iValid ( EFalse )
     {
     }
 
@@ -67,7 +64,14 @@
         User::LeaveIfError( uidLex.Val( iPackageUid, EHex ));
         }
     iTitle.CreateL( aEntry->GetText() );
+    
     iIconUri.CreateL( aEntry->Icon()->FileName() );
+    
+    TPtrC attribute;
+    aEntry->FindAttribute( KPreviewImageAttrName, attribute );
+    iPreviewImageName.CreateL( attribute.Length() );
+    iPreviewImageName = attribute;
+
     //library
     iLibrary.CreateL( KCaMaxAttrValueLen );
     aEntry->FindAttribute( KAttrWidgetLibrary, iLibrary );
@@ -77,6 +81,9 @@
     //uri
     iUri.CreateL( KCaMaxAttrValueLen );
     aEntry->FindAttribute( KAttrWidgetUri, iUri );
+    //translation filename
+    iTranslationFileName.CreateL( KCaMaxAttrValueLen );
+    aEntry->FindAttribute( KAttrWidgetTranslationFileName, iTranslationFileName );
     //mmc id
     iMmcId.CreateL(KMassStorageIdLength);
     aEntry->FindAttribute( KCaAttrMmcId, iMmcId );
@@ -133,15 +140,21 @@
 //
 CCaWidgetDescription::~CCaWidgetDescription()
     {
+    iPath.Close();
+    iModificationTime.Close();
+    iServiceXml.Close();
+    iMmcId.Close();
+    iUri.Close();
+    iTranslationFileName.Close();
+    iLibrary.Close();
+    iPreviewImageName.Close();
+    iIconUri.Close();
     iTitle.Close();
     iDescription.Close();
-    iUri.Close();
-    iIconUri.Close();
-    iLibrary.Close();
-    iPath.Close();
-    iModificationTime.Close();
-    iMmcId.Close();
-    iServiceXml.Close();
+    iStringIdTitle.Close();
+    iStringIdDescription.Close();
+    iManifestFilePathName.Close();
+    
     }
 
 // ----------------------------------------------------------------------------
@@ -151,14 +164,16 @@
 TBool CCaWidgetDescription::Compare(
         const CCaWidgetDescription& aFirst,const CCaWidgetDescription& aSecond)
     {
+    TBool result = EFalse;
     if( aFirst.GetUri() == aSecond.GetUri() )
         {
-        return ETrue;
+        result = ETrue;
         }
     else
         {
-        return EFalse;
+        result = EFalse;
         }
+    return result;
     }
 
 // ----------------------------------------------------------------------------
@@ -167,24 +182,29 @@
 //
 TBool CCaWidgetDescription::Compare( const CCaWidgetDescription& aToCompare )
     {
+    TBool result = EFalse;
     if( aToCompare.GetLibrary() == GetLibrary() &&
             aToCompare.GetDescription() == GetDescription() &&
             aToCompare.GetUri() == GetUri() &&
             aToCompare.GetIconUri() == GetIconUri() &&
+            aToCompare.GetPreviewImageName() == GetPreviewImageName() &&
             aToCompare.GetTitle() == GetTitle() &&
+            aToCompare.GetTranslationFileName() == GetTranslationFileName() &&
             aToCompare.GetLibrary() != KNoLibrary &&
             aToCompare.GetModificationTime() == GetModificationTime() &&
             aToCompare.GetServiceXml() == GetServiceXml()
             )
         {
-        return ETrue;
+        result = ETrue;
         }
     else
         {
-        return EFalse;
+        result = EFalse;
         }
+    return result;
     }
 
+
 // -----------------------------------------------------------------------------
 //
 // -----------------------------------------------------------------------------
@@ -209,6 +229,15 @@
 //
 // -----------------------------------------------------------------------------
 //
+TUint CCaWidgetDescription::GetPackageUidL()
+    {
+    return iPackageUid;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
 void CCaWidgetDescription::SetTitleL( const TDesC& aTitle )
     {
     iTitle.Close();
@@ -234,6 +263,18 @@
     iUri.Close();
     iUri.CreateL(aUri);
     }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CCaWidgetDescription::SetTranslationFileNameL(
+        const TDesC& aTranslationFileName )
+    {
+    iTranslationFileName.Close();
+    iTranslationFileName.CreateL( aTranslationFileName );
+    }
+
 // -----------------------------------------------------------------------------
 //
 // -----------------------------------------------------------------------------
@@ -247,37 +288,19 @@
 //
 // -----------------------------------------------------------------------------
 //
-void CCaWidgetDescription::SetLibraryL( const TDesC& aLibrary )
+void CCaWidgetDescription::SetPreviewImageNameL( const TDesC& aPreviewName )
     {
-    iLibrary.Close();
-    iLibrary.CreateL(aLibrary);
+    iPreviewImageName.Close();
+    iPreviewImageName.CreateL( aPreviewName );
     }
-
 // -----------------------------------------------------------------------------
 //
 // -----------------------------------------------------------------------------
 //
-void CCaWidgetDescription::SetMissing( TBool aMissing )
-    {
-    SetFlag( EMissing, aMissing );
-    }
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CCaWidgetDescription::SetVisible( TBool aVisible )
+void CCaWidgetDescription::SetLibraryL( const TDesC& aLibrary )
     {
-    SetFlag( EVisible, aVisible );
-    }
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CCaWidgetDescription::SetUsed( TBool aUsed )
-    {
-    SetFlag( EUsed, aUsed );
+    iLibrary.Close();
+    iLibrary.CreateL(aLibrary);
     }
 
 // -----------------------------------------------------------------------------
@@ -310,6 +333,26 @@
 //
 // -----------------------------------------------------------------------------
 //
+void CCaWidgetDescription::SetStringIdDescriptionL( const TDesC& aStringIdDescription )
+    {
+    iStringIdDescription.Close();
+    iStringIdDescription.CreateL( aStringIdDescription );
+    }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CCaWidgetDescription::SetStringidTitleL( const TDesC& aStringIdTitle )
+    {
+    iStringIdTitle.Close();
+    iStringIdTitle.CreateL( aStringIdTitle );
+    }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
 TInt CCaWidgetDescription::GetEntryId( ) const
     {
     return iEntryId;
@@ -328,10 +371,29 @@
 //
 // -----------------------------------------------------------------------------
 //
+TPtrC CCaWidgetDescription::GetStringIdDescription() const
+    {
+    return iStringIdDescription;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+
+TPtrC CCaWidgetDescription::GetStringIdTitle() const
+    {
+    return iStringIdTitle;
+    }
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
 TPtrC CCaWidgetDescription::GetLibrary( ) const
     {
     return iLibrary;
     }
+
 // -----------------------------------------------------------------------------
 //
 // -----------------------------------------------------------------------------
@@ -349,6 +411,7 @@
 	iPath.Close();
 	iPath.CreateL(aPath);
     }
+
 // -----------------------------------------------------------------------------
 //
 // -----------------------------------------------------------------------------
@@ -371,6 +434,15 @@
 //
 // -----------------------------------------------------------------------------
 //
+TPtrC CCaWidgetDescription::GetTranslationFileName() const
+    {
+    return iTranslationFileName;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
 TPtrC CCaWidgetDescription::GetIconUri( ) const
     {
     return iIconUri;
@@ -380,16 +452,27 @@
 //
 // -----------------------------------------------------------------------------
 //
+TPtrC CCaWidgetDescription::GetPreviewImageName( ) const
+    {
+    return iPreviewImageName;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
 TPtrC CCaWidgetDescription::GetTitle( ) const
     {
+    TPtrC result ;
     if ( iTitle == KNullDesC )
         {
-        return GetLibraryName();
+        result.Set( GetLibraryName() );
         }
     else
         {
-        return iTitle;
+        result.Set( iTitle );
         }
+    return result;
     }
 
 // -----------------------------------------------------------------------------
@@ -472,13 +555,11 @@
     if ( iTitle != KNullDesC )
         {
         entry->SetTextL(iTitle);
-        entry->AddAttributeL(KCaAttrLongName, iTitle);
         }
     else
         {
         TPtrC libraryName( GetLibraryName() );
         entry->SetTextL( libraryName );
-        entry->AddAttributeL( KCaAttrLongName, libraryName );
         }
 
     if ( iDescription != KNullDesC )
@@ -492,9 +573,12 @@
     if ( iIconUri != KNullDesC)
         {
         // aSkinId and AppId not used for widgets - KNullDesC
-        entry->SetIconDataL(iIconUri, KNullDesC, KNullDesC);
+        entry->SetIconDataL( iIconUri, KNullDesC, KNullDesC );
         }
-
+    if ( iPreviewImageName != KNullDesC )
+        {
+        entry->AddAttributeL( KPreviewImageAttrName, iPreviewImageName );
+        }
     if( iModificationTime != KNullDesC )
         {
         entry->AddAttributeL( KCaAttrInstallationTime, iModificationTime );
@@ -503,6 +587,11 @@
         {
         entry->AddAttributeL( KAttrWidgetServiceXml, iServiceXml);
         }
+    if( iTranslationFileName != KNullDesC )
+        {
+        entry->AddAttributeL( KAttrWidgetTranslationFileName,
+                iTranslationFileName );
+        }
     return entry;
     }
 
@@ -551,4 +640,112 @@
     {
     return iServiceXml;
     }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CCaWidgetDescription::LocalizeTextsL()
+    {
+    if( iTranslationFileName.Length() )
+        {
+        RBuf translationFileName;
+        translationFileName.Create( iTranslationFileName.Length() + 1 );
+        CleanupClosePushL( translationFileName );
+        translationFileName.Copy( iTranslationFileName );
+        translationFileName.Append( KWidgetScannerUnderline );
+           
+        
+        if( !HbTextResolverSymbian::Init( translationFileName, KLocalizationFilepathC ) )
+          {
+          if( !HbTextResolverSymbian::Init( translationFileName, KLocalizationFilepathZ ) )
+              {
+              // this should not be called too often 
+              TChar currentDriveLetter;
+              TDriveList driveList;
+              RFs fs;
+              User::LeaveIfError( fs.Connect() );
+              User::LeaveIfError( fs.DriveList( driveList ) );
+
+              RBuf path;
+              path.Create( KLocalizationFilepath().Length() + 1 );
+              CleanupClosePushL( path );
+              
+              for( TInt driveNr=EDriveY; driveNr >= EDriveA; driveNr-- )
+                  {
+                  if( driveList[driveNr] )
+                      {
+                      User::LeaveIfError( fs.DriveToChar( driveNr,
+                              currentDriveLetter ) );
+                      path.Append( currentDriveLetter );
+                      path.Append( KLocalizationFilepath );
+                      if( HbTextResolverSymbian::Init( translationFileName, path ) )
+                          {
+                          break;
+                          }
+                      }
+                  path.Zero();
+                  }
+              CleanupStack::PopAndDestroy( &path );
+              fs.Close();
+              }
+           }
+        
+        HBufC* tmp;
+        
+        if( iTitle.Length() )
+            {
+            SetStringidTitleL( iTitle );
+            tmp = HbTextResolverSymbian::LoadLC( iTitle );
+            SetTitleL( *tmp );
+            CleanupStack::PopAndDestroy( tmp );
+            }
+        if( iDescription.Length() )
+            {
+            SetStringIdDescriptionL( iDescription );
+            tmp = HbTextResolverSymbian::LoadLC( iDescription );
+            SetDescriptionL( *tmp );
+            CleanupStack::PopAndDestroy( tmp );
+            }
+        CleanupStack::PopAndDestroy( &translationFileName );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+// 
+TBool CCaWidgetDescription::IsValid()
+    {
+    return iValid;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CCaWidgetDescription::SetValid(TBool aVal)
+    {
+    iValid = aVal;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CCaWidgetDescription::SetManifestFilePathNameL( 
+    const TDesC& aManifestFilePathName )
+    {
+    iManifestFilePathName.Close();
+    iManifestFilePathName.CreateL( aManifestFilePathName );
+    }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+TPtrC CCaWidgetDescription::GetManifestFilePathName() const
+    {
+    return iManifestFilePathName;
+    }
 //  End of File
--- a/contentstorage/casrv/cawidgetscanner/src/cawidgetscannerinstallnotifier.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/casrv/cawidgetscanner/src/cawidgetscannerinstallnotifier.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -1,20 +1,19 @@
 /*
-* 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:  Sis package installation event listener
+ * 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:  Sis package installation event listener
+ *
+ */
 
 #include <sacls.h>
 #include "cawidgetscannerinstallnotifier.h"
@@ -23,73 +22,73 @@
 // ============================ MEMBER FUNCTIONS =============================
 
 // -----------------------------------------------------------------------------
-// CCaWidgetScannerInstallNotifier::CCaWidgetScannerInstallNotifier
-// C++ default constructor
+//
 // -----------------------------------------------------------------------------
 //
 CCaWidgetScannerInstallNotifier::CCaWidgetScannerInstallNotifier(
-    CCaWidgetScannerPlugin* aCallback, TUid aCategory, TUint aKey ) :
-    CActive(EPriorityNormal)
+        CCaWidgetScannerPlugin* aCallback, TUid aCategory, TUint aKey ) :
+    CActive( EPriorityNormal )
     {
     CActiveScheduler::Add( this );
 
     iCallback = aCallback;
     iCategory = aCategory;
     iKey = aKey;
-    // Prepare automatically
     iProperty.Attach( iCategory, iKey );
-    SetActive( );
+    SetActive();
     iProperty.Subscribe( iStatus );
+    iHackFlag = EFalse;
     }
 
 // -----------------------------------------------------------------------------
-// CCaWidgetScannerInstallNotifier::ConstructL
-// S2nd phase constructor.
+//
 // -----------------------------------------------------------------------------
 //
 void CCaWidgetScannerInstallNotifier::ConstructL()
     {
-    iHackFlag = EFalse;
     }
 
 // ---------------------------------------------------------------------------
-// CCaWidgetScannerInstallNotifier::NewL
+//
 // ---------------------------------------------------------------------------
 //
 CCaWidgetScannerInstallNotifier* CCaWidgetScannerInstallNotifier::NewL(
-    CCaWidgetScannerPlugin* aCallback, TUid aCategory, TUint aKey )
+        CCaWidgetScannerPlugin* aCallback, TUid aCategory, TUint aKey )
     {
-    CCaWidgetScannerInstallNotifier* self = 
-            new (ELeave) CCaWidgetScannerInstallNotifier( aCallback,
-            aCategory, aKey );
+    CCaWidgetScannerInstallNotifier* self =
+            new ( ELeave ) CCaWidgetScannerInstallNotifier( aCallback,
+                    aCategory, aKey );
     CleanupStack::PushL( self );
-    self->ConstructL( );
+    self->ConstructL();
     CleanupStack::Pop( self );
 
     return self;
     }
 
 // ---------------------------------------------------------------------------
-// CCaWidgetScannerInstallNotifier::~CCaWidgetScannerInstallNotifier
+//
 // ---------------------------------------------------------------------------
 //
 CCaWidgetScannerInstallNotifier::~CCaWidgetScannerInstallNotifier()
     {
-    Cancel( );
-    iProperty.Close( );
+    Cancel();
+    iProperty.Close();
     }
 
 // ---------------------------------------------------------------------------
-// CCaWidgetScannerInstallNotifier::DoCancel
+//
 // ---------------------------------------------------------------------------
 //
 void CCaWidgetScannerInstallNotifier::DoCancel()
     {
-    iProperty.Cancel( );
+    iProperty.Cancel();
     }
 
+#ifdef COVERAGE_MEASUREMENT
+#pragma CTC SKIP
+#endif //COVERAGE_MEASUREMENT (error is ignored)
 // ---------------------------------------------------------------------------
-// CCaWidgetScannerInstallNotifier::RunError
+//
 // ---------------------------------------------------------------------------
 //
 TInt CCaWidgetScannerInstallNotifier::RunError( TInt /*aError*/)
@@ -97,27 +96,32 @@
     // No need to do anything      
     return KErrNone;
     }
+#ifdef COVERAGE_MEASUREMENT
+#pragma CTC ENDSKIP
+#endif //COVERAGE_MEASUREMENT
 
 // ---------------------------------------------------------------------------
-// CCaWidgetScannerInstallNotifier::RunL
+//
 // ---------------------------------------------------------------------------
 //
 void CCaWidgetScannerInstallNotifier::RunL()
     {
     // Re-issue request before notifying
-    SetActive( );
+    SetActive();
     iProperty.Subscribe( iStatus );
 
     TInt status;
     User::LeaveIfError( iProperty.Get( KUidSystemCategory,
-        KSAUidSoftwareInstallKeyValue, status ) );
-    
+            KSAUidSoftwareInstallKeyValue, status ) );
+
     if( iHackFlag )
         {
         iHackFlag = EFalse;
         iCallback->SynchronizeL();
         }
-    else if ( (status & EInstOpInstall )||(status & EInstOpUninstall ) )
+    else if( ( status & EInstOpStatusSuccess ) && (
+            ( status & EInstOpInstall ) || 
+            ( status & EInstOpUninstall ) ) )
         {
         iHackFlag = ETrue;
         }
--- a/contentstorage/casrv/cawidgetscanner/src/cawidgetscannerparser.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/casrv/cawidgetscanner/src/cawidgetscannerparser.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -1,87 +1,59 @@
 /*
-* 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:
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
  *
-*/
-
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
 
 // INCLUDE FILES
 
 #include <driveinfo.h>
-#include <xmlengnodelist.h>
-#include <xmlengdomparser.h>
-#include <xmlengdocument.h>
+#include <xml/dom/xmlengnodelist.h>
+#include <xml/dom/xmlengdomparser.h>
+#include <xml/dom/xmlengdocument.h>
+#include <xml/dom/xmlengelement.h>
 #include <utf.h>
+#include <e32base.h>
 
 #include "cadef.h"
 #include "cawidgetscannerparser.h"
 #include "widgetscannerutils.h"
-
-// CONSTANTS
-
-const TInt KChunkSize = 8192;
-const TInt KDriveLetterLength = 2;
-const TInt KModificationTimeLength = 17;
-
-_LIT( KManifest, ".manifest");
-_LIT( KColen, ":" );
-_LIT( KImportDir, "\\private\\20022F35\\import\\widgetregistry\\" );
-//_LIT( KImportDir, "import\\widgetregistry\\" );
-_LIT( KDoubleSlash, "\\" );
-_LIT( KTrue, "true" );
-_LIT8(KWidget, "widget" );
-_LIT8(KUri, "uri" );
-_LIT8(KLibrary, "library" );
-_LIT8(KTitle, "title" );
-_LIT8(KDescription, "description" );
-_LIT8(KHidden, "hidden" );
-_LIT8(KIconUri, "iconuri" );
-_LIT8(KWidgetProvider, "widgetprovider");
-
-_LIT8(KWidgetManifest, "hswidgetmanifest");
-_LIT8(KIcon, "icon");
-_LIT8(KServiceXml, "servicexml");
+#include "cawidgetscannerdef.h"
 
 // ============================ MEMBER FUNCTIONS ===============================
 
 // -----------------------------------------------------------------------------
-// CCaWidgetScannerParser::CCaWidgetScannerParser
-// C++ default constructor can NOT contain any code, that
-// might leave.
+//
 // -----------------------------------------------------------------------------
 //
-CCaWidgetScannerParser::CCaWidgetScannerParser( RFs& aFs ):
+CCaWidgetScannerParser::CCaWidgetScannerParser( RFs& aFs ) :
     iFs( aFs )
     {
     }
 
 // -----------------------------------------------------------------------------
-// CCaWidgetScannerParser::ConstructL
-// Symbian 2nd phase constructor can leave.
+// 
 // -----------------------------------------------------------------------------
 //
-void CCaWidgetScannerParser::ConstructL( )
+void CCaWidgetScannerParser::ConstructL()
     {
     iImportPath.CreateL( KMaxPath );
-    //iFs.PrivatePath( iImportPath );
     iImportPath.Append( KImportDir );
     iDomImpl.OpenL();
     }
 
 // -----------------------------------------------------------------------------
-// CCaWidgetScannerParser::NewL
-// Two-phased constructor.
+// 
 // -----------------------------------------------------------------------------
 //
 CCaWidgetScannerParser* CCaWidgetScannerParser::NewL( RFs& aFs )
@@ -92,25 +64,23 @@
     }
 
 // -----------------------------------------------------------------------------
-// CCaWidgetScannerParser::NewLC
-// Two-phased constructor.
+// 
 // -----------------------------------------------------------------------------
 //
 CCaWidgetScannerParser* CCaWidgetScannerParser::NewLC( RFs& aFs )
     {
-    CCaWidgetScannerParser* self = new( ELeave ) CCaWidgetScannerParser( aFs );
+    CCaWidgetScannerParser* self = new ( ELeave ) CCaWidgetScannerParser( aFs );
     CleanupStack::PushL( self );
-    self->ConstructL( );
+    self->ConstructL();
     return self;
     }
 
 // -----------------------------------------------------------------------------
-// Destructor
+// 
 // -----------------------------------------------------------------------------
 //
 CCaWidgetScannerParser::~CCaWidgetScannerParser()
     {
-    delete iWidgetDescriptor;
     iImportPath.Close();
     iWidgets.ResetAndDestroy();
     iDomImpl.Close();
@@ -120,39 +90,44 @@
 //
 // ----------------------------------------------------------------------------
 //
-RWidgetArray& CCaWidgetScannerParser::WidgetsScanL( )
+RWidgetArray& CCaWidgetScannerParser::WidgetsScanL(
+        const RWidgetArray& aWidgets )
     {
     TDriveList driveList;
+    TChar currentDriveLetter;
     User::LeaveIfError( iFs.DriveList( driveList ) );
     iWidgets.ResetAndDestroy();
 
-    for ( TInt driveNumber=EDriveZ; driveNumber >= EDriveA; driveNumber-- )
+    iFetchedWidgets = aWidgets;
+
+    for ( TInt driveNumber = EDriveZ; driveNumber >= EDriveA; driveNumber-- )
         {
         if ( driveList[driveNumber] )
             {
             User::LeaveIfError( iFs.DriveToChar( driveNumber,
-                    iCurrentDriveLetter ) );
-            ScanOnDriveL( );
+                    currentDriveLetter ) );
+            ScanOnDriveL( currentDriveLetter );
             }
         }
+    
+    
     return iWidgets;
     }
 
-
 // ----------------------------------------------------------------------------
 //
 // ----------------------------------------------------------------------------
 //
-void CCaWidgetScannerParser::ScanOnDriveL( )
+void CCaWidgetScannerParser::ScanOnDriveL( TChar& aDrive )
     {
-    CDir* directories = GetDirectoriesLC( );
+    CDir* directories = GetDirectoriesLC( aDrive );
     if ( directories )
         {
-        for ( TInt i(0); i<directories->Count( ); i++ )
+        for ( TInt i( 0 ); i < directories->Count(); i++ )
             {
-            if((*directories)[i].IsDir())
+            if ( ( *directories )[i].IsDir() )
                 {
-                ParseDirectoryL((*directories)[i].iName);
+                ParseDirectoryL( ( *directories )[i].iName, aDrive );
                 }
             }
         }
@@ -163,30 +138,66 @@
 //
 // ----------------------------------------------------------------------------
 //
-void CCaWidgetScannerParser::ParseDirectoryL( const TDesC& aDirectoryName )
+void CCaWidgetScannerParser::ParseDirectoryL( const TDesC& aDirectoryName,
+        TChar& aDrive )
     {
-    HBufC* manifestDirectoryPath =
-        GetManifestDirectoryPathLC( aDirectoryName );
+    HBufC* manifestDirectoryPath = GetManifestDirectoryPathLC( aDirectoryName,
+            aDrive );
 
     CDir* fileList = NULL;
 
     User::LeaveIfError( iFs.GetDir( *manifestDirectoryPath,
-                         KEntryAttMatchExclude|KEntryAttDir,
-                         ESortByDate, fileList ) );
+            KEntryAttMatchExclude | KEntryAttDir, ESortByDate, fileList ) );
     CleanupStack::PushL( fileList );
 
-    for ( TInt i = 0; i<fileList->Count( ); i++ )
+    for ( TInt i = 0; i < fileList->Count(); i++ )
         {
-        if( (*fileList)[i].iName.Find( KManifest ) != KErrNotFound )
+        if ( ( *fileList )[i].iName.Find( KManifest ) != KErrNotFound )
             {
             RBuf fullFilePath;
             CleanupClosePushL( fullFilePath );
-            fullFilePath.CreateL( manifestDirectoryPath->Length() +
-                    (*fileList)[i].iName.Length());
+            fullFilePath.CreateL( manifestDirectoryPath->Length()
+                    + ( *fileList )[i].iName.Length() );
             fullFilePath.Append( *manifestDirectoryPath );
-            fullFilePath.Append( (*fileList)[i].iName );
-            //if file is corrupted we go to the next one
-            TRAP_IGNORE(ParseManifestFileL( fullFilePath, aDirectoryName ));
+            fullFilePath.Append( ( *fileList )[i].iName );
+          
+            TPtrC packageUidPtr = manifestDirectoryPath->Mid(
+                    manifestDirectoryPath->Length() - KPackageUidPosition,
+                    KPackageUidLength); 
+            TUint packageUid;            
+            TLex lexer( packageUidPtr );
+            User::LeaveIfError( lexer.Val( packageUid, EHex ) );
+
+            CCaWidgetDescription* compareWidget = NULL;
+            for ( TInt j = 0; j < iFetchedWidgets.Count(); j++ )
+                {
+                if ( iFetchedWidgets[j]->GetPackageUidL() ==  packageUid )
+                    {
+                    compareWidget = iFetchedWidgets[j];
+                    compareWidget->SetValid( ETrue ); //do not remove from db
+                    break; // once found we dont iterate anymore
+                    }
+                }
+
+            if ( compareWidget )
+                {
+                TTime modificationTime = ( *fileList )[i].iModified;
+                TInt64 modificationIntTime = modificationTime.Int64();
+                TLex lex( compareWidget->GetModificationTime() );
+                TInt64 uintTimeDB( 0 );
+                User::LeaveIfError( lex.Val( uintTimeDB ) );
+
+                if ( uintTimeDB != modificationIntTime )
+                    {
+                    TRAP_IGNORE( ParseManifestFileL( fullFilePath,
+                                    aDirectoryName, aDrive ) );
+                    }
+                }
+            else
+                {
+                TRAP_IGNORE( ParseManifestFileL( fullFilePath, aDirectoryName,
+                                aDrive ) );
+                }
             CleanupStack::PopAndDestroy( &fullFilePath );
             }
         }
@@ -198,142 +209,136 @@
 //
 // ----------------------------------------------------------------------------
 //
-void CCaWidgetScannerParser::ParseManifestFileL(
-        const TDesC& aFilePath, const TDesC& aPackageUid )
+void CCaWidgetScannerParser::ParseManifestFileL( const TDesC& aFilePath,
+        const TDesC& aPackageUid, TChar& aDrive )
     {
     RXmlEngDOMParser parser;
-    CleanupClosePushL(parser);
-    User::LeaveIfError(parser.Open(iDomImpl));
-    RXmlEngDocument doc = parser.ParseFileL(aFilePath, KChunkSize);
-    CleanupClosePushL(doc);
+    CleanupClosePushL( parser );
+    User::LeaveIfError( parser.Open( iDomImpl ) );
+    RXmlEngDocument doc = parser.ParseFileL( aFilePath, KChunkSize );
+    CleanupClosePushL( doc );
     TXmlEngElement docElement = doc.DocumentElement();
 
-    if (docElement.Name() == KWidgetProvider) {
+    if ( docElement.Name() == KWidgetProvider )
+        {
         TXmlEngElement element;
         RXmlEngNodeList<TXmlEngElement> elementList;
-        CleanupClosePushL(elementList);
-        docElement.GetElementsByTagNameL(elementList, KWidget);
+        CleanupClosePushL( elementList );
+        docElement.GetElementsByTagNameL( elementList, KWidget );
 
-        while (elementList.HasNext())
+        while ( elementList.HasNext() )
             {
             element = elementList.Next();
             if ( element.HasAttributes() )
                 {
-                ParseWidgetL( aFilePath, element, aPackageUid );
+                ParseWidgetL( aFilePath, element, aPackageUid, aDrive );
                 }
             }
-        CleanupStack::PopAndDestroy(&elementList);
-    } else if (docElement.Name() == KWidgetManifest) {
+        CleanupStack::PopAndDestroy( &elementList );
+        }
+    else if ( docElement.Name() == KWidgetManifest )
+        {
+        CCaWidgetDescription* widgetDescriptor = CCaWidgetDescription::NewL();
+        widgetDescriptor->SetPackageUidL( aPackageUid );
+        widgetDescriptor->SetFlag( EVisible, ETrue );
+        widgetDescriptor->SetManifestFilePathNameL( aFilePath );
 
-        delete iWidgetDescriptor;
-        iWidgetDescriptor = NULL;
-        iWidgetDescriptor = CCaWidgetDescription::NewL();
-        iWidgetDescriptor->SetPackageUidL(aPackageUid);
-        iWidgetDescriptor->SetVisible(ETrue);
-
-
-        SetMmcIdL( iWidgetDescriptor );
+        SetMmcIdL( widgetDescriptor, aDrive );
 
         RXmlEngNodeList<TXmlEngElement> childElementList;
-        CleanupClosePushL(childElementList);
-        docElement.GetChildElements(childElementList);
+        CleanupClosePushL( childElementList );
+        docElement.GetChildElements( childElementList );
         TXmlEngElement element;
-        while (childElementList.HasNext())
-          {
-          element = childElementList.Next();
-          if (element.Name() == KUri)
-              {
-              ParseUriL(element);
-              }
-          else if (element.Name() == KTitle)
-              {
-              ParseTitleL(element);
-              }
-          else if (element.Name() == KIcon)
-              {
-              ParseIconL(element,aPackageUid);
-              }
-          else if (element.Name() == KDescription)
-              {
-              ParseDescriptionL(element);
-              }
-          else if (element.Name() == KHidden)
-              {
-              ParseHiddenL(element);
-              }
-          else if (element.Name() == KServiceXml)
-              {
-              ParseServiceXmlL(element);
-              }
-           }
-        CleanupStack::PopAndDestroy(&childElementList);
+        
+        while ( childElementList.HasNext() )
+            {
+            element = childElementList.Next();
+            if ( element.Name() == KUri )
+                {
+                ParseUriL( element, widgetDescriptor );
+                }
+            else if ( element.Name() == KTitle )
+                {
+                ParseTitleL( element, widgetDescriptor );
+                }
+            else if ( element.Name() == KIcon )
+                {
+                ParseIconL( element, aPackageUid, widgetDescriptor, aDrive );
+                }
+            else if ( element.Name() == KDescription )
+                {
+                ParseDescriptionL( element, widgetDescriptor );
+                }
+            else if ( element.Name() == KHidden )
+                {
+                ParseHiddenL( element, widgetDescriptor );
+                }
+            else if ( element.Name() == KServiceXml )
+                {
+                ParseServiceXmlL( element, widgetDescriptor );
+                }
+            else if ( element.Name() == KPreviewImageElementName )
+                {
+                ParsePreviewImageNameL( element, aPackageUid, widgetDescriptor, aDrive );
+                }
+            else if ( element.Name() == KTranslationFileName )
+                {
+                ParseTranslationFileNameL( element, widgetDescriptor );
+                }
+            }
+        CleanupStack::PopAndDestroy( &childElementList );
 
         //set path for hs to use, trim last 2 chars (doubleslash)
-        HBufC *libraryPath = GetManifestDirectoryPathLC( aPackageUid );
-        iWidgetDescriptor->SetPathL(libraryPath->Mid(0,libraryPath->Length()-1));
+        HBufC *libraryPath = GetManifestDirectoryPathLC( aPackageUid, aDrive );
+        widgetDescriptor->SetPathL(libraryPath->Mid(0,libraryPath->Length()-1));
         CleanupStack::PopAndDestroy(libraryPath);
-        
-        HBufC *libraryPath2 = GetManifestDirectoryPathLC( aPackageUid );
-        libraryPath2 = libraryPath2->ReAllocL(libraryPath2->Length() + iWidgetDescriptor->GetUri().Length());
-        CleanupStack::Pop(1);
-        CleanupStack::PushL(libraryPath2);
-        libraryPath2->Des().Append(iWidgetDescriptor->GetUri());
-        iWidgetDescriptor->SetLibraryL(*libraryPath2);
-        CleanupStack::PopAndDestroy(libraryPath2);
+
         
-                
-        TTime modificationTime;
-        iFs.Modified( aFilePath, modificationTime);
-        TInt64 modificationIntTime = modificationTime.Int64();
-        RBuf16 rBuf;
-        rBuf.CleanupClosePushL();
-        rBuf.CreateL( KModificationTimeLength );
-        rBuf.AppendNum( modificationIntTime );
-        iWidgetDescriptor->SetModificationTimeL( rBuf );
-        CleanupStack::PopAndDestroy( &rBuf );
+        HBufC *libraryPath2 = GetManifestDirectoryPathLC( aPackageUid, aDrive );
+        libraryPath2 = libraryPath2->ReAllocL( libraryPath2->Length()
+                + widgetDescriptor->GetUri().Length() );
+        libraryPath2->Des().Append( widgetDescriptor->GetUri() );
+        widgetDescriptor->SetLibraryL( *libraryPath2 );
+        CleanupStack::PopAndDestroy( libraryPath2 );
 
-        TInt index = iWidgets.Find( iWidgetDescriptor, CCaWidgetDescription::Compare );
+        SetModificationTimeL( aFilePath, widgetDescriptor );
+
+        TInt index = iWidgets.Find( widgetDescriptor,
+                CCaWidgetDescription::Compare );
         if ( index != KErrNotFound )
             {
             delete iWidgets[index];
             iWidgets.Remove( index );
             }
-        iWidgets.AppendL( iWidgetDescriptor );//ownership transfer
-        iWidgetDescriptor = NULL;
-    }
+        iWidgets.AppendL( widgetDescriptor );//ownership transfer
+        widgetDescriptor = NULL;
+        }
 
-    CleanupStack::PopAndDestroy(&doc);
-    CleanupStack::PopAndDestroy(&parser);
+    CleanupStack::PopAndDestroy( &doc );
+    CleanupStack::PopAndDestroy( &parser );
     }
 
 // ----------------------------------------------------------------------------
 //
 // ----------------------------------------------------------------------------
 //
-void CCaWidgetScannerParser::ParseWidgetL(
-        const TDesC& aFilePath, TXmlEngElement aElement,
-        const TDesC& aPackageUid )
+void CCaWidgetScannerParser::ParseWidgetL( const TDesC& aFilePath,
+        TXmlEngElement& aElement, const TDesC& aPackageUid, TChar& aDrive )
     {
     CCaWidgetDescription* widget = CCaWidgetDescription::NewLC();
 
     SetUriL( aElement, widget );
-    SetLibraryL( aElement, aPackageUid, widget);
+    SetLibraryL( aElement, aPackageUid, widget, aDrive );
     SetTitleL( aElement, widget );
     SetDescriptionL( aElement, widget );
     SetVisibilityL( aElement, widget );
-    SetIconUriL( aElement, aPackageUid, widget);
+    SetIconUriL( aElement, aPackageUid, widget, aDrive );
     widget->SetPackageUidL( aPackageUid );
-    SetMmcIdL( widget );
+    widget->SetManifestFilePathNameL( aFilePath );
+    SetMmcIdL( widget, aDrive );
+    SetTranslationFileNameL( aElement, widget );
 
-    TTime modificationTime;
-    iFs.Modified( aFilePath, modificationTime);
-    TInt64 modificationIntTime = modificationTime.Int64();
-    RBuf16 rBuf;
-    rBuf.CleanupClosePushL();
-    rBuf.CreateL( KModificationTimeLength );
-    rBuf.AppendNum( modificationIntTime );
-    widget->SetModificationTimeL( rBuf );
-    CleanupStack::PopAndDestroy( &rBuf );
+    SetModificationTimeL( aFilePath, widget );
 
     TInt index = iWidgets.Find( widget, CCaWidgetDescription::Compare );
     if ( index != KErrNotFound )
@@ -345,45 +350,62 @@
     CleanupStack::Pop( widget );
     }
 
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void CCaWidgetScannerParser::SetUriL( TXmlEngElement& aElement,
+        CCaWidgetDescription* aWidget )
+    {
+    HBufC *attributeValue = CnvUtfConverter::ConvertToUnicodeFromUtf8L(
+            aElement.AttributeValueL( KUri ) );
+    CleanupStack::PushL( attributeValue );
+
+    if ( attributeValue->Compare( KNullDesC ) != 0 )
+        {
+        aWidget->SetUriL( *attributeValue );
+        aWidget->SetTranslationFileNameL( *attributeValue );
+        }
+    CleanupStack::PopAndDestroy( attributeValue );
+    }
 
 // ----------------------------------------------------------------------------
 //
 // ----------------------------------------------------------------------------
 //
-void CCaWidgetScannerParser::SetUriL(
-    TXmlEngElement & aElement, CCaWidgetDescription * aWidget )
-{
+void CCaWidgetScannerParser::SetTranslationFileNameL( TXmlEngElement& aElement,
+        CCaWidgetDescription* aWidget )
+    {
     HBufC *attributeValue = CnvUtfConverter::ConvertToUnicodeFromUtf8L(
-        aElement.AttributeValueL( KUri ) );
+            aElement.AttributeValueL( KTranslationFileName ) );
     CleanupStack::PushL( attributeValue );
 
-    if( attributeValue->Compare( KNullDesC ) != 0 )
+    if ( attributeValue->Compare( KNullDesC ) != 0 )
         {
-        aWidget->SetUriL( *attributeValue );
+        aWidget->SetTranslationFileNameL( *attributeValue );
         }
     CleanupStack::PopAndDestroy( attributeValue );
-}
+    }
 
 // ----------------------------------------------------------------------------
-//    keep in mind that setLibrary also setsPath
+//   
 // ----------------------------------------------------------------------------
 //
-void CCaWidgetScannerParser::SetLibraryL( TXmlEngElement & aElement,
-    const TDesC & aPackageUid, CCaWidgetDescription * aWidget )
-{
+void CCaWidgetScannerParser::SetLibraryL( TXmlEngElement& aElement,
+        const TDesC& aPackageUid, CCaWidgetDescription* aWidget, TChar& aDrive )
+    {
     HBufC *attributeValue = CnvUtfConverter::ConvertToUnicodeFromUtf8L(
-        aElement.AttributeValueL( KLibrary ) );
+            aElement.AttributeValueL( KLibrary ) );
     CleanupStack::PushL( attributeValue );
 
-    if( attributeValue->Compare( KNullDesC ) != 0 )
+    if ( attributeValue->Compare( KNullDesC ) != 0 )
         {
-        HBufC *libraryPath = GetManifestDirectoryPathLC( aPackageUid );
+        HBufC *libraryPath = GetManifestDirectoryPathLC( aPackageUid, aDrive );
 
         //set path for hs to use, trim last 2 chars (doubleslash)
         aWidget->SetPathL(libraryPath->Mid(0,libraryPath->Length()-1));
 
-        libraryPath->ReAllocL(
-            libraryPath->Length() + attributeValue->Length());
+        libraryPath->ReAllocL( libraryPath->Length() + attributeValue->Length() );
 
         TPtr libraryPathModifier( libraryPath->Des() );
         libraryPathModifier.Append( *attributeValue );
@@ -396,82 +418,81 @@
         aWidget->SetLibraryL( KNoLibrary );
         }
     CleanupStack::PopAndDestroy( attributeValue );
-}
+    }
 
 // ----------------------------------------------------------------------------
 //
 // ----------------------------------------------------------------------------
 //
-void CCaWidgetScannerParser::SetTitleL(
-    TXmlEngElement & aElement, CCaWidgetDescription * aWidget )
-{
+void CCaWidgetScannerParser::SetTitleL( TXmlEngElement& aElement,
+        CCaWidgetDescription* aWidget )
+    {
     HBufC *attributeValue = CnvUtfConverter::ConvertToUnicodeFromUtf8L(
-                aElement.AttributeValueL( KTitle ) );
+            aElement.AttributeValueL( KTitle ) );
     CleanupStack::PushL( attributeValue );
 
-    if( attributeValue->Compare( KNullDesC ) != 0 )
+    if ( attributeValue->Compare( KNullDesC ) != 0 )
         {
         aWidget->SetTitleL( *attributeValue );
         }
     CleanupStack::PopAndDestroy( attributeValue );
-}
+    }
 
 // ----------------------------------------------------------------------------
 //
 // ----------------------------------------------------------------------------
 //
-void CCaWidgetScannerParser::SetDescriptionL(
-    TXmlEngElement & aElement, CCaWidgetDescription * aWidget )
-{
+void CCaWidgetScannerParser::SetDescriptionL( TXmlEngElement& aElement,
+        CCaWidgetDescription* aWidget )
+    {
     HBufC *attributeValue = CnvUtfConverter::ConvertToUnicodeFromUtf8L(
-                aElement.AttributeValueL( KDescription ) );
+            aElement.AttributeValueL( KDescription ) );
     CleanupStack::PushL( attributeValue );
 
-    if( attributeValue->Compare( KNullDesC ) != 0 )
+    if ( attributeValue->Compare( KNullDesC ) != 0 )
         {
         aWidget->SetDescriptionL( *attributeValue );
         }
     CleanupStack::PopAndDestroy( attributeValue );
-}
+    }
 
 // ----------------------------------------------------------------------------
 //
 // ----------------------------------------------------------------------------
 //
-void CCaWidgetScannerParser::SetVisibilityL(
-    TXmlEngElement & aElement, CCaWidgetDescription * aWidget )
-{
+void CCaWidgetScannerParser::SetVisibilityL( TXmlEngElement& aElement,
+        CCaWidgetDescription* aWidget )
+    {
     HBufC *hidden = CnvUtfConverter::ConvertToUnicodeFromUtf8L(
-                aElement.AttributeValueL( KHidden ) );
+            aElement.AttributeValueL( KHidden ) );
     CleanupStack::PushL( hidden );
 
-    if( hidden->Compare( KTrue ) == 0 )
+    if ( hidden->Compare( KTrue ) == 0 )
         {
-        aWidget->SetVisible( EFalse );
+        aWidget->SetFlag( EVisible, EFalse );
         }
     else
         {
-        aWidget->SetVisible( ETrue );
+        aWidget->SetFlag( EVisible, ETrue );
         }
     CleanupStack::PopAndDestroy( hidden );
-}
+    }
 
 // ----------------------------------------------------------------------------
 //
 // ----------------------------------------------------------------------------
 //
-void CCaWidgetScannerParser::SetIconUriL( TXmlEngElement & aElement,
-    const TDesC & aPackageUid, CCaWidgetDescription * aWidget )
-{
+void CCaWidgetScannerParser::SetIconUriL( TXmlEngElement& aElement,
+        const TDesC& aPackageUid, CCaWidgetDescription* aWidget, TChar& aDrive )
+    {
     HBufC *attributeValue = CnvUtfConverter::ConvertToUnicodeFromUtf8L(
-                aElement.AttributeValueL( KIconUri ) );
+            aElement.AttributeValueL( KIconUri ) );
     CleanupStack::PushL( attributeValue );
 
-    if( attributeValue->Compare( KNullDesC ) != 0 )
+    if ( attributeValue->Compare( KNullDesC ) != 0 )
         {
-        HBufC* iconUriPath = GetManifestDirectoryPathLC( aPackageUid );
-        iconUriPath->ReAllocL(
-            iconUriPath->Length() + attributeValue->Length() );
+        HBufC* iconUriPath = GetManifestDirectoryPathLC( aPackageUid, aDrive );
+        iconUriPath->ReAllocL( iconUriPath->Length() + attributeValue->Length() );
 
         TPtr iconUriPathModifier( iconUriPath->Des() );
         iconUriPathModifier.Append( *attributeValue );
@@ -480,44 +501,62 @@
         CleanupStack::PopAndDestroy( iconUriPath );
         }
     CleanupStack::PopAndDestroy( attributeValue );
-}
+    }
 
 // ----------------------------------------------------------------------------
 //
 // ----------------------------------------------------------------------------
 //
-void CCaWidgetScannerParser::SetMmcIdL( CCaWidgetDescription * widget )
-{
+void CCaWidgetScannerParser::SetMmcIdL( CCaWidgetDescription* aWidget,
+        TChar& aDrive )
+    {
     TChar removableDrive;
     User::LeaveIfError( DriveInfo::GetDefaultDrive(
-                DriveInfo::EDefaultRemovableMassStorage, removableDrive ) );
+            DriveInfo::EDefaultRemovableMassStorage, removableDrive ) );
 
     TChar massStorageDrive;
     User::LeaveIfError( DriveInfo::GetDefaultDrive(
-                DriveInfo::EDefaultMassStorage, massStorageDrive ) );
-    if( iCurrentDriveLetter == removableDrive )
+            DriveInfo::EDefaultMassStorage, massStorageDrive ) );
+    if ( aDrive == removableDrive )
         {
         RBuf mmcId;
-        mmcId.CreateL(KMassStorageIdLength);
         mmcId.CleanupClosePushL();
+        mmcId.CreateL( KMassStorageIdLength );
         WidgetScannerUtils::CurrentMmcId( iFs, mmcId );
-        widget->SetMmcIdL( mmcId );
+        aWidget->SetMmcIdL( mmcId );
         CleanupStack::PopAndDestroy( &mmcId );
         }
-    else if( iCurrentDriveLetter == massStorageDrive )
+    else if ( aDrive == massStorageDrive )
         {
-        widget->SetMmcIdL( KCaMassStorage );
+        aWidget->SetMmcIdL( KCaMassStorage );
         }
-}
+    }
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void CCaWidgetScannerParser::SetModificationTimeL( const TDesC& aFilePath,
+        CCaWidgetDescription* aWidgetDescriptor )
+    {
+    TTime modificationTime;
+    iFs.Modified( aFilePath, modificationTime );
+    TInt64 modificationIntTime = modificationTime.Int64();
+    RBuf16 rBuf;
+    rBuf.CleanupClosePushL();
+    rBuf.CreateL( KModificationTimeLength );
+    rBuf.AppendNum( modificationIntTime );
+    aWidgetDescriptor->SetModificationTimeL( rBuf );
+    CleanupStack::PopAndDestroy( &rBuf );
+    }
 
 // ----------------------------------------------------------------------------
 //
 // ----------------------------------------------------------------------------
 //
-CDir* CCaWidgetScannerParser::GetDirectoriesLC( )
+CDir* CCaWidgetScannerParser::GetDirectoriesLC( TChar& aDrive )
     {
     CDir* result = NULL;
-    HBufC* path = FullPathLC( );
+    HBufC* path = FullPathLC( aDrive );
     iFs.GetDir( *path, KEntryAttDir, ESortByName, result );
     CleanupStack::PopAndDestroy( path );
     CleanupStack::PushL( result );
@@ -528,12 +567,11 @@
 //
 // ----------------------------------------------------------------------------
 //
-HBufC* CCaWidgetScannerParser::FullPathLC( )
+HBufC* CCaWidgetScannerParser::FullPathLC( TChar& aDrive ) const
     {
-    HBufC* result =
-        HBufC16::NewLC( iImportPath.Length() + KDriveLetterLength );
+    HBufC* result = HBufC16::NewLC( iImportPath.Length() + KDriveLetterLength );
     TPtr modifier( result->Des() );
-    modifier.Append( iCurrentDriveLetter );
+    modifier.Append( aDrive );
     modifier.Append( KColen );
     modifier.Append( iImportPath );
     return result;
@@ -544,11 +582,11 @@
 // ----------------------------------------------------------------------------
 //
 HBufC* CCaWidgetScannerParser::GetManifestDirectoryPathLC(
-        const TDesC& aDirectoryName )
+        const TDesC& aDirectoryName, TChar& aDrive ) const
     {
     HBufC* result = HBufC16::NewLC( KMaxPath );
     TPtr modifier( result->Des() );
-    HBufC* path = FullPathLC( );
+    HBufC* path = FullPathLC( aDrive );
     modifier.Append( *path );
     CleanupStack::PopAndDestroy( path );
     modifier.Append( aDirectoryName );
@@ -556,79 +594,176 @@
     return result;
     }
 
-void CCaWidgetScannerParser::ParseUriL(TXmlEngElement & aElement)
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void CCaWidgetScannerParser::ParseUriL( TXmlEngElement& aElement,
+        CCaWidgetDescription* aWidgetDescriptor )
     {
-    if (aElement.Text().Length())
+    aWidgetDescriptor->SetUriL( *GetElementTextLC( aElement )  );
+    CleanupStack::PopAndDestroy();
+    
+    if( aWidgetDescriptor->GetTranslationFileName().Compare( KNullDesC ) == 0 )
         {
-        HBufC *utf16 =
-            CnvUtfConverter::ConvertToUnicodeFromUtf8L( aElement.Text() );
-        CleanupStack::PushL( utf16 );
-        iWidgetDescriptor->SetUriL( *utf16 );
-        CleanupStack::PopAndDestroy( utf16 );
-        }
-
-    }
-void CCaWidgetScannerParser::ParseTitleL(TXmlEngElement & aElement)
-    {
-    if (aElement.Text().Length())
-        {
-        HBufC *utf16 =
-            CnvUtfConverter::ConvertToUnicodeFromUtf8L( aElement.Text() );
-        CleanupStack::PushL( utf16 );
-        iWidgetDescriptor->SetTitleL( *utf16 );
-        CleanupStack::PopAndDestroy( utf16 );
+        ParseTranslationFileNameL( aElement, aWidgetDescriptor );
         }
     }
-void CCaWidgetScannerParser::ParseIconL(TXmlEngElement & aElement,
-    const TDesC & aPackageUid )
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void CCaWidgetScannerParser::ParseTitleL( TXmlEngElement& aElement,
+        CCaWidgetDescription* aWidgetDescriptor )
     {
-    HBufC *utf16 =
-        CnvUtfConverter::ConvertToUnicodeFromUtf8L( aElement.Text() );
-    CleanupStack::PushL( utf16 );
-    if ( utf16->Compare( KNullDesC ) )
-        {
-        HBufC* iconUriPath = GetManifestDirectoryPathLC( aPackageUid );
-        iconUriPath = iconUriPath->ReAllocL( iconUriPath->Length() + utf16->Length() );
-        CleanupStack::Pop(1);
-        CleanupStack::PushL(iconUriPath);
-        TPtr iconUriPathModifier( iconUriPath->Des() );
-        iconUriPathModifier.Append( *utf16 );
-        iWidgetDescriptor->SetIconUriL( *iconUriPath );
-        CleanupStack::PopAndDestroy( iconUriPath );
-        }
+    aWidgetDescriptor->SetTitleL( *GetElementTextLC( aElement ) );
+    CleanupStack::PopAndDestroy( );
+    }
 
-    CleanupStack::PopAndDestroy( utf16 );
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void CCaWidgetScannerParser::ParseIconL( TXmlEngElement& aElement,
+        const TDesC& aPackageUid, CCaWidgetDescription* aWidgetDescriptor,
+        TChar& aDrive )
+    {
+    aWidgetDescriptor->SetIconUriL( 
+        *GetThemableGraphicsNameLC(aElement, aPackageUid, aDrive ) );
+   
+    CleanupStack::PopAndDestroy( );
     }
 
-void CCaWidgetScannerParser::ParseDescriptionL(TXmlEngElement & aElement)
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void CCaWidgetScannerParser::ParsePreviewImageNameL(
+        TXmlEngElement & aElement,
+        const TDesC & aPackageUid,
+        CCaWidgetDescription* aWidgetDescriptor,
+        TChar& aDrive )
     {
-    HBufC *desc =
-        CnvUtfConverter::ConvertToUnicodeFromUtf8L( aElement.Text() );
-    CleanupStack::PushL( desc );
+    aWidgetDescriptor->SetPreviewImageNameL( 
+        *GetThemableGraphicsNameLC(aElement, aPackageUid, aDrive ) );
+    
+    CleanupStack::PopAndDestroy();
+    }
 
-    if( desc->Compare( KNullDesC ) != 0 )
-       {
-       iWidgetDescriptor->SetDescriptionL( *desc );
-       }
-    CleanupStack::PopAndDestroy( desc );
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void CCaWidgetScannerParser::ParseTranslationFileNameL(
+        TXmlEngElement& aElement, CCaWidgetDescription* aWidgetDescriptor )
+    {
+    aWidgetDescriptor->SetTranslationFileNameL( *GetElementTextLC( aElement ) );
+    CleanupStack::PopAndDestroy();
     }
-void CCaWidgetScannerParser::ParseHiddenL( TXmlEngElement& aElement )
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void CCaWidgetScannerParser::ParseDescriptionL( TXmlEngElement& aElement,
+        CCaWidgetDescription* aWidgetDescriptor )
+    {
+    aWidgetDescriptor->SetDescriptionL( *GetElementTextLC( aElement ) );
+    CleanupStack::PopAndDestroy();
+    }
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void CCaWidgetScannerParser::ParseHiddenL( TXmlEngElement& aElement,
+        CCaWidgetDescription* aWidgetDescriptor )
     {
     if( aElement.Text().Compare( _L8("true") ) == 0 )
         {
-        iWidgetDescriptor->SetVisible( EFalse );
+        aWidgetDescriptor->SetFlag( EVisible, EFalse );
         }
+    }
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void CCaWidgetScannerParser::ParseServiceXmlL( TXmlEngElement& aElement,
+        CCaWidgetDescription* aWidgetDescriptor )
+    {
+    aWidgetDescriptor->SetServiceXmlL( *GetElementTextLC( aElement ) );
+    CleanupStack::PopAndDestroy( );
+    }
 
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+HBufC* CCaWidgetScannerParser::GetElementTextLC( 
+    const TXmlEngElement& aElement ) const
+    {
+    HBufC* const elementText =
+        CnvUtfConverter::ConvertToUnicodeFromUtf8L( aElement.Text() );
+    CleanupStack::PushL( elementText );
+    return elementText;
     }
-void CCaWidgetScannerParser::ParseServiceXmlL( TXmlEngElement& aElement )
+
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+HBufC* CCaWidgetScannerParser::GetThemableGraphicsNameLC(
+        const TXmlEngElement& aElement,
+        const TDesC& aPackageUid,
+        TChar& aDrive ) const
     {
-    HBufC *serviceXml = CnvUtfConverter::ConvertToUnicodeFromUtf8L( aElement.Text() );
-    CleanupStack::PushL( serviceXml );
-       
-    if (serviceXml->Compare(KNullDesC) != 0)
+    RBuf graphicsName;
+    graphicsName.CleanupClosePushL();
+    HBufC* result; 
+
+    
+    if ( aElement.Text() != KNullDesC8 )
         {
-        iWidgetDescriptor->SetServiceXmlL( *serviceXml );
+        RBuf elementText;
+        elementText.CleanupClosePushL();
+        
+        elementText.Assign( 
+            CnvUtfConverter::ConvertToUnicodeFromUtf8L( aElement.Text() ) );
+        
+        if ( TParsePtrC(elementText).Ext() != KNullDesC )
+            {
+            HBufC* const manifestDirectoryPath( 
+                GetManifestDirectoryPathLC( aPackageUid, aDrive ) );
+            
+            graphicsName.CreateL( manifestDirectoryPath->Length() + 
+                elementText.Length() );
+            graphicsName.Append( *manifestDirectoryPath );
+            
+            CleanupStack::PopAndDestroy( manifestDirectoryPath );
+            }
+        else
+            {   
+            graphicsName.CreateL( elementText.Length() );
+            }
+        
+        graphicsName.Append( elementText );
+        result = HBufC::NewL( graphicsName.Length() ) ;
+        *result = graphicsName;
+        
+        CleanupStack::PopAndDestroy( &elementText );
         }
-    CleanupStack::PopAndDestroy( serviceXml );
+    else
+    	{
+        result = HBufC::NewL( 1 ) ;
+    	}
+        CleanupStack::PopAndDestroy( &graphicsName );
+        CleanupStack::PushL( result );
+        
+        return result;
     }
+
+
 //  End of File
--- a/contentstorage/casrv/cawidgetscanner/src/cawidgetscannerplugin.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/casrv/cawidgetscanner/src/cawidgetscannerplugin.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -1,19 +1,19 @@
 /*
-* 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:
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
  *
-*/
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
 
 // INCLUDE FILES
 
@@ -21,63 +21,60 @@
 #include <sacls.h>
 
 #include "cawidgetscannerplugin.h"
-#include "cawidgetscannerparser.h"
 #include "cawidgetstoragehandler.h"
 #include "cawidgetscannerinstallnotifier.h"
 
-
 // Function used to return an instance of the proxy table.
 const TImplementationProxy ImplementationTable[] =
     {
     IMPLEMENTATION_PROXY_ENTRY(0x20028707, CCaWidgetScannerPlugin::NewL)
     };
 
+#ifdef COVERAGE_MEASUREMENT
+#pragma CTC SKIP
+#endif //COVERAGE_MEASUREMENT (proxy for instantiation)
 // ----------------------------------------------------------------------------
-// ImplementationGroupProxy
-// Exported proxy for instantiation method resolution
+// 
 // ----------------------------------------------------------------------------
 //
 EXPORT_C const TImplementationProxy*
 ImplementationGroupProxy( TInt& aTableCount )
     {
-    aTableCount = sizeof( ImplementationTable ) /
-    sizeof( TImplementationProxy );
+    aTableCount = sizeof( ImplementationTable ) / sizeof(TImplementationProxy);
     return ImplementationTable;
     }
+#ifdef COVERAGE_MEASUREMENT
+#pragma CTC ENDSKIP
+#endif //COVERAGE_MEASUREMENT
 
 // ============================ MEMBER FUNCTIONS ===============================
 
-// -----------------------------------------------------------------------------
-// CCaWidgetScannerPlugin ::CCaWidgetScannerPlugin
-// C++ default constructor can NOT contain any code, that
-// might leave.
-// -----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// 
+// ----------------------------------------------------------------------------
 //
 CCaWidgetScannerPlugin::CCaWidgetScannerPlugin()
     {
     }
 
-// -----------------------------------------------------------------------------
-// CCaWidgetScannerPlugin ::ConstructL
-// Symbian 2nd phase constructor can leave.
-// -----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// 
+// ----------------------------------------------------------------------------
 //
 void CCaWidgetScannerPlugin::ConstructL( TPluginParams* aPluginParams )
     {
     User::LeaveIfError( iFs.Connect() );
     iMmcWatcher = CCaMmcWatcher::NewL( iFs, this );
     iInstallNotifier = CCaWidgetScannerInstallNotifier::NewL( this,
-        KUidSystemCategory, KSAUidSoftwareInstallKeyValue );
-    iParser = CCaWidgetScannerParser::NewL( iFs );
+            KUidSystemCategory, KSAUidSoftwareInstallKeyValue );
     iStorageHandler = CCaWidgetStorageHandler::NewL(
             aPluginParams->storageProxy, iFs );
     SynchronizeL();
     }
 
-// -----------------------------------------------------------------------------
-// CCaWidgetScannerPlugin ::NewL
-// Two-phased constructor.
-// -----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// 
+// ----------------------------------------------------------------------------
 //
 CCaWidgetScannerPlugin * CCaWidgetScannerPlugin::NewL(
         TPluginParams* aPluginParams )
@@ -87,29 +84,27 @@
     return self;
     }
 
-// -----------------------------------------------------------------------------
-// CCaWidgetScannerPlugin ::NewLC
-// Two-phased constructor.
-// -----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// 
+// ----------------------------------------------------------------------------
 //
 CCaWidgetScannerPlugin * CCaWidgetScannerPlugin::NewLC(
         TPluginParams* aPluginParams )
     {
-    CCaWidgetScannerPlugin * self = new( ELeave ) CCaWidgetScannerPlugin ( );
+    CCaWidgetScannerPlugin * self = new ( ELeave ) CCaWidgetScannerPlugin();
     CleanupStack::PushL( self );
     self->ConstructL( aPluginParams );
     return self;
     }
 
-// -----------------------------------------------------------------------------
-// Destructor
-// -----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// 
+// ----------------------------------------------------------------------------
 //
-CCaWidgetScannerPlugin::~CCaWidgetScannerPlugin ()
+CCaWidgetScannerPlugin::~CCaWidgetScannerPlugin()
     {
     delete iMmcWatcher;
     delete iInstallNotifier;
-    delete iParser;
     delete iStorageHandler;
     iFs.Close();
     }
@@ -120,7 +115,7 @@
 //
 void CCaWidgetScannerPlugin::SynchronizeL()
     {
-    iStorageHandler->SynchronizeL( iParser->WidgetsScanL() );
+    iStorageHandler->SynchronizeL();
     }
 
 // ----------------------------------------------------------------------------
--- a/contentstorage/casrv/cawidgetscanner/src/cawidgetstoragehandler.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/casrv/cawidgetscanner/src/cawidgetstoragehandler.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -17,6 +17,9 @@
 // INCLUDE FILES
 
 #include <badesca.h>
+#include <usif/scr/screntries.h>
+#include <hbtextresolversymbian.h>
+
 #include "widgetscannerutils.h"
 #include "cawidgetstoragehandler.h"
 #include "cadef.h"
@@ -24,34 +27,37 @@
 #include "cainnerquery.h"
 #include "castorageproxy.h"
 #include "caarraycleanup.inl"
+#include "calocalizationentry.h"
+#include "cawidgetscannerparser.h"
+#include "cawidgetscannerdef.h"
 
-// ============================ MEMBER FUNCTIONS ===============================
+using namespace Usif;
+
+// ============================ MEMBER FUNCTIONS ============================z===
 
 // -----------------------------------------------------------------------------
-// CCaWidgetStorageHandler::CCaWidgetStorageHandler
-// C++ default constructor can NOT contain any code, that
-// might leave.
+// 
 // -----------------------------------------------------------------------------
 //
-CCaWidgetStorageHandler::CCaWidgetStorageHandler(
-        CCaStorageProxy* aStorage, RFs& aFs )
+CCaWidgetStorageHandler::CCaWidgetStorageHandler( CCaStorageProxy* aStorage,
+        RFs& aFs )
     {
     iStorage = aStorage;
     iFs = aFs;
     }
 
 // -----------------------------------------------------------------------------
-// CCaWidgetStorageHandler::ConstructL
-// Symbian 2nd phase constructor can leave.
+// 
 // -----------------------------------------------------------------------------
 //
 void CCaWidgetStorageHandler::ConstructL()
     {
+    User::LeaveIfError( iSoftwareRegistry.Connect() );
+    iParser = CCaWidgetScannerParser::NewL( iFs );
     }
 
 // -----------------------------------------------------------------------------
-// CCaWidgetStorageHandler::NewL
-// Two-phased constructor.
+// 
 // -----------------------------------------------------------------------------
 //
 CCaWidgetStorageHandler* CCaWidgetStorageHandler::NewL(
@@ -63,8 +69,7 @@
     }
 
 // -----------------------------------------------------------------------------
-// CCaWidgetStorageHandler::NewLC
-// Two-phased constructor.
+// 
 // -----------------------------------------------------------------------------
 //
 CCaWidgetStorageHandler* CCaWidgetStorageHandler::NewLC(
@@ -78,23 +83,24 @@
     }
 
 // -----------------------------------------------------------------------------
-// Destructor
+// 
 // -----------------------------------------------------------------------------
 //
 CCaWidgetStorageHandler::~CCaWidgetStorageHandler()
     {
+    delete iParser;
+    iSoftwareRegistry.Close();
     iWidgets.ResetAndDestroy();
-    iUpdatedIndexes.Close();
     }
 
 // ----------------------------------------------------------------------------
 //
 // ----------------------------------------------------------------------------
 //
-void CCaWidgetStorageHandler::SynchronizeL( const RWidgetArray& aWidgets )
+void CCaWidgetStorageHandler::SynchronizeL()
     {
     FetchWidgetsL();
-    AddWidgetsL( aWidgets );
+    AddWidgetsL( iParser->WidgetsScanL( iWidgets ) );
     RemoveWidgetsL();
     }
 
@@ -105,8 +111,12 @@
 void CCaWidgetStorageHandler::AddL( const CCaWidgetDescription* aWidget )
     {
     CCaInnerEntry* entry = aWidget->GetEntryLC();
+    UpdateComponentIdL( aWidget->GetManifestFilePathName(), *entry );
     iStorage->AddL( entry );
-    if( entry->GetFlags() & ERemovable )
+
+    SetLocalizationsL( aWidget, entry->GetId() );
+
+    if ( entry->GetFlags() & ERemovable )
         {
         AddWidgetToDownloadCollectionL( entry );
         }
@@ -121,20 +131,23 @@
         TUint aEntryId )
     {
     CCaInnerEntry* entry = aWidget->GetEntryLC();
+    UpdateComponentIdL( aWidget->GetManifestFilePathName(), *entry );
     entry->SetId( aEntryId );
-    if( !aWidget->IsMissing() && aWidget->IsUsed() )
+    if ( !aWidget->IsMissing() && aWidget->IsUsed() )
         {
         entry->SetFlags( entry->GetFlags() & ~EUsed );
         }
     TItemAppearance itemAppearanceChange = EItemAppearanceNotChanged;
-    if( ( entry->GetFlags() & EMissing ) ||
-        !( entry->GetFlags() & EVisible ) )
+    if ( ( entry->GetFlags() & EMissing ) || !( entry->GetFlags() & EVisible ) )
         {
         itemAppearanceChange = EItemAppeared;
         }
     entry->SetFlags( entry->GetFlags() & ~EMissing | EVisible );
     iStorage->AddL( entry, EFalse, itemAppearanceChange );
-    if( !aWidget->IsMissing() )
+
+    SetLocalizationsL( aWidget, entry->GetId() );
+
+    if ( !aWidget->IsMissing() )
         {
         AddWidgetToDownloadCollectionL( entry );
         }
@@ -147,28 +160,28 @@
 //
 void CCaWidgetStorageHandler::AddWidgetsL( const RWidgetArray& aWidgets )
     {
-    iUpdatedIndexes.Reset();
-    for( TInt i = 0; i < aWidgets.Count(); i++ )
+    for ( TInt i = 0; i < aWidgets.Count(); i++ )
         {
-        TInt index = iWidgets.Find(
-                aWidgets[i], CCaWidgetDescription::Compare );
-        if( index != KErrNotFound )
+        aWidgets[i]->LocalizeTextsL();
+        TInt index = iWidgets.Find( aWidgets[i], CCaWidgetDescription::Compare );
+        if ( index != KErrNotFound )
             {
-            if( !iWidgets[index]->Compare( *aWidgets[i] ) ||
-                    iWidgets[index]->IsMissing() )
+            iWidgets[index]->SetValid( ETrue );
+            if ( !iWidgets[index]->Compare( *aWidgets[i] )
+                    || iWidgets[index]->IsMissing() )
                 {
-                aWidgets[i]->SetMissing( iWidgets[index]->IsMissing() );
-                aWidgets[i]->SetUsed( iWidgets[index]->IsUsed() );
-                aWidgets[i]->SetVisible( iWidgets[index]->IsVisible() );
+                aWidgets[i]->SetFlag( EMissing, iWidgets[index]->IsMissing() );
+                aWidgets[i]->SetFlag( EUsed, iWidgets[index]->IsUsed() );
+                aWidgets[i]->SetFlag( EVisible, iWidgets[index]->IsVisible() );
                 UpdateL( aWidgets[i], iWidgets[index]->GetEntryId() );
                 }
-            iUpdatedIndexes.AppendL( index );
             }
         else
             {
             AddL( aWidgets[i] );
             }
         }
+    HbTextResolverSymbian::Init( _L(""), KLocalizationFilepathZ );
     }
 
 // ----------------------------------------------------------------------------
@@ -177,11 +190,11 @@
 //
 void CCaWidgetStorageHandler::RemoveWidgetsL()
     {
-    for( TInt i = 0; i < iWidgets.Count(); i++ )
+    for ( TInt i = 0; i < iWidgets.Count(); i++ )
         {
-        if( iUpdatedIndexes.Find( i ) == KErrNotFound )
+        if ( !iWidgets[i]->IsValid() )
             {
-            if( iWidgets[i]->GetMmcId() != KNullDesC )
+            if ( iWidgets[i]->GetMmcId() != KNullDesC )
                 {
                 RBuf currentMmcId;
                 currentMmcId.CreateL( KMassStorageIdLength );
@@ -199,7 +212,7 @@
                     {
                     SetMissingFlagL( iWidgets[i] );
                     }
-                CleanupStack::PopAndDestroy(&currentMmcId);
+                CleanupStack::PopAndDestroy( &currentMmcId );
                 }
             else
                 {
@@ -262,11 +275,11 @@
     RPointerArray<CCaInnerEntry> entries;
     CleanupResetAndDestroyPushL( entries );
     iStorage->GetEntriesL( query, entries );
+
     iWidgets.ResetAndDestroy();
-    for( TInt i = 0; i < entries.Count(); i++ )
+    for ( TInt i = 0; i < entries.Count(); i++ )
         {
-        CCaWidgetDescription* widget = CCaWidgetDescription::NewLC(
-                entries[i] );
+        CCaWidgetDescription* widget = CCaWidgetDescription::NewLC( entries[i] );
         iWidgets.AppendL( widget ); //iWidgets takes ownership
         CleanupStack::Pop( widget );
         }
@@ -281,11 +294,11 @@
 void CCaWidgetStorageHandler::SetMissingFlagL(
         const CCaWidgetDescription* aWidget )
     {
-    if( !aWidget->IsMissing() )
+    if ( !aWidget->IsMissing() )
         {
         CCaInnerEntry* entry = aWidget->GetEntryLC();
-        entry->SetFlags( entry->GetFlags() | EMissing );
-        if( aWidget->IsUsed() )
+        entry->SetFlags( ( entry->GetFlags() | EMissing ) & ~EUninstall );
+        if ( aWidget->IsUsed() )
             {
             entry->SetFlags( entry->GetFlags() | EUsed );
             }
@@ -301,10 +314,14 @@
 void CCaWidgetStorageHandler::ClearVisibleFlagL(
         const CCaWidgetDescription* aWidget )
     {
-    if( aWidget->IsVisible() )
+    if ( aWidget->IsVisible() )
         {
         CCaInnerEntry* entry = aWidget->GetEntryLC();
-        entry->SetFlags( entry->GetFlags() & ~EVisible & ~EMissing & ~EUsed );
+        entry->SetFlags( entry->GetFlags()
+                & ~EUninstall
+                & ~EVisible 
+                & ~EMissing 
+                & ~EUsed );
         iStorage->AddL( entry, EFalse, EItemDisappeared );
         CleanupStack::PopAndDestroy( entry );
         }
@@ -330,5 +347,96 @@
         }
     return massStorageNotInUse;
     }
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+
+void CCaWidgetStorageHandler::SetLocalizationsL(
+        const CCaWidgetDescription* aWidget, TInt aEntryId )
+    {
+    RBuf filename;
+    filename.CreateL( aWidget->GetTranslationFileName().Length() + 1 ); //1 for _
+    CleanupClosePushL( filename );
+    filename.Copy( aWidget->GetTranslationFileName() );
+    filename.Append( KWidgetScannerUnderline );
+
+    // prepare localizations
+    if ( aWidget->GetTitle().Length() > 0 && aWidget->GetTitle().Compare(
+            aWidget->GetStringIdTitle() ) )
+    // lets do not add localization when key and value are identical
+        {
+        CCaLocalizationEntry* titleEntry = CCaLocalizationEntry::NewL();
+        CleanupStack::PushL( titleEntry );
+        titleEntry->SetTableNameL( KLocalizationCaEntry );
+        titleEntry->SetAttributeNameL( KLocalizationEnText );
+        titleEntry->SetStringIdL( aWidget->GetStringIdTitle() );
+        titleEntry->SetQmFilenameL( filename );
+        titleEntry->SetRowId( aEntryId );
+        iStorage->AddLocalizationL( *titleEntry );
+        CleanupStack::PopAndDestroy( titleEntry );
+        }
+    if ( aWidget->GetDescription().Length() > 0 &&
+            aWidget->GetDescription().Compare(
+                    aWidget->GetStringIdDescription() ) )
+    // lets do not add localization when key and value are identical
+        {
+        CCaLocalizationEntry* descEntry = CCaLocalizationEntry::NewL();
+        CleanupStack::PushL( descEntry );
+        descEntry->SetTableNameL( KLocalizationCaEntry );
+        descEntry->SetAttributeNameL( KLocalizationEnDescription );
+        descEntry->SetStringIdL( aWidget->GetStringIdDescription() );
+        descEntry->SetQmFilenameL( filename );
+        descEntry->SetRowId( aEntryId );
+        iStorage->AddLocalizationL( *descEntry );
+        CleanupStack::PopAndDestroy( descEntry );
+        }
+    CleanupStack::PopAndDestroy( &filename );
+    }
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+
+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/casrv/cawidgetscanner/src/widgetscannerutils.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/casrv/cawidgetscanner/src/widgetscannerutils.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -1,19 +1,19 @@
 /*
-* 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:
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
  *
-*/
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
 
 // INCLUDE FILES
 #include "widgetscannerutils.h"
@@ -24,23 +24,26 @@
 //
 // -----------------------------------------------------------------------------
 //
-TBool WidgetScannerUtils::IsFileOnDrive(const TDesC& aFileName,
-    const DriveInfo::TDefaultDrives& aDefaultDrive)
-{
-    if (aFileName.Length()) {
+TBool WidgetScannerUtils::IsFileOnDrive( const TDesC& aFileName,
+        const DriveInfo::TDefaultDrives& aDefaultDrive )
+    {
+    TBool result = EFalse;
+    if ( aFileName.Length() )
+        {
         TInt drive;
-        TInt err = DriveInfo::GetDefaultDrive(aDefaultDrive, drive);
-        if (!err) {
+        TInt err = DriveInfo::GetDefaultDrive( aDefaultDrive, drive );
+        if ( !err )
+            {
             TInt fileDrive;
-            err = RFs::CharToDrive(aFileName[0], fileDrive);
-            if (!err && fileDrive == drive) {
-                return ETrue;
+            err = RFs::CharToDrive( aFileName[0], fileDrive );
+            if ( !err && fileDrive == drive )
+                {
+                result = ETrue;
+                }
             }
         }
+    return result;
     }
-    return EFalse;
-}
-
 
 // -----------------------------------------------------------------------------
 //
@@ -49,11 +52,11 @@
 void WidgetScannerUtils::CurrentMmcId( const RFs& aFs, TDes& aMmcId )
     {
     TInt mmcDrive;
-    if ( DriveInfo::GetDefaultDrive(
-            DriveInfo::EDefaultRemovableMassStorage, mmcDrive ) == KErrNone )
+    if ( DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRemovableMassStorage,
+            mmcDrive ) == KErrNone )
         {
         TVolumeInfo volumeInfo;
-        if( aFs.Volume( volumeInfo, mmcDrive ) == KErrNone )
+        if ( aFs.Volume( volumeInfo, mmcDrive ) == KErrNone )
             {
             aMmcId.Zero();
             aMmcId.AppendNum( volumeInfo.iUniqueID );
--- a/contentstorage/castorage/bwins/castorageu.def	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-EXPORTS
-	?NewDatabaseL@CaStorageFactory@@SAPAVCCaStorage@@XZ @ 1 NONAME ; class CCaStorage * CaStorageFactory::NewDatabaseL(void)
-
--- a/contentstorage/castorage/conf/castoragedb.confml	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/castorage/conf/castoragedb.confml	Thu Jul 22 16:37:03 2010 +0100
@@ -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 Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/castorage/conf/castoragedb_templates/castoragedb_variant.sql	Thu Jul 22 16:37:03 2010 +0100
@@ -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 Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/castorage/data/castoragedb_create.sql	Thu Jul 22 16:37:03 2010 +0100
@@ -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,10 +189,10 @@
   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",
     "" AS "URI",
     "" AS "COLLECTION_NAME";
 
@@ -184,38 +200,30 @@
 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);
   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 ) ,"widget:library",new.LIBRARY);
   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 ) ,"long_name",new.LONG_NAME);
-  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 ) ,"widget:uri",new.URI);
   -- 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 +244,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 Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/castorage/data/castoragedb_variant.sql	Thu Jul 22 16:37:03 2010 +0100
@@ -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 Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/castorage/data/castoragedb_variant_test.bat	Thu Jul 22 16:37:03 2010 +0100
@@ -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 Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/castorage/data/castoragedb_variant_test.sql	Thu Jul 22 16:37:03 2010 +0100
@@ -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, URI, COLLECTION_NAME) 
+  VALUES ("widget", 'Clock', 'Z:\private\20022F35\import\widgetregistry\20022F6C\tclock.png', '4' , '20022f6c', 'Z:\private\20022F35\import\widgetregistry\20022F6C\hsclockwidgetplugin', 'hsclockwidgetplugin', 'Test Apps' ); 
 
 
-SELECT "castoragedb_variant test - END" AS " ";
\ No newline at end of file
+SELECT "castoragedb_variant_test - END" AS " ";
+
--- a/contentstorage/castorage/eabi/castorageu.def	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-EXPORTS
-	_ZN16CaStorageFactory12NewDatabaseLEv @ 1 NONAME
-
--- a/contentstorage/castorage/inc/casqlcommands.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/castorage/inc/casqlcommands.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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 " );
@@ -67,8 +70,10 @@
 _LIT( KSQLUpdateIcon, "UPDATE CA_ICON SET " );
 _LIT( KSQLUpdateEntryUsedFlag, "UPDATE CA_ENTRY SET \
 EN_FLAGS = EN_FLAGS | :EN_FLAGS WHERE ENTRY_ID = :LA_ENTRY_ID");
-_LIT( KSQLLocalizeEntry, "UPDATE CA_ENTRY SET \
+_LIT( KSQLLocalizeTextEntry, "UPDATE CA_ENTRY SET \
 EN_TEXT = :LT_STRING WHERE ENTRY_ID = :LT_ROW_ID"); // WHERE ENTRY_ID must be changed if an attribute
+_LIT( KSQLLocalizeDescriptionEntry, "UPDATE CA_ENTRY SET \
+EN_DESCRIPTION = :LT_STRING WHERE ENTRY_ID = :LT_ROW_ID"); // WHERE ENTRY_ID must be changed if an attribute
 
 _LIT( KSQLUpdatePositionInGroup, "UPDATE CA_GROUP_ENTRY SET \
 GE_POSITION = :GE_POSITION WHERE \
@@ -107,6 +112,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 +139,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 \
@@ -156,6 +171,9 @@
 _LIT( KSQLGetListByParentId2, "LEFT JOIN CA_ICON ON EN_ICON_ID = ICON_ID LEFT JOIN CA_GROUP_ENTRY ON \
 GE_ENTRY_ID = ENTRY_ID WHERE GE_GROUP_ID = :GE_GROUP_ID %S " );
 
+_LIT( KSQLGetListByChildId, "LEFT JOIN CA_ICON ON EN_ICON_ID = ICON_ID LEFT JOIN CA_GROUP_ENTRY ON \
+GE_GROUP_ID = ENTRY_ID WHERE GE_ENTRY_ID = :GE_ENTRY_ID %S " );
+
 //Get all attributes by entry id
 //:Entry_Id_List is a list of Integers seperated by commas.
 _LIT( KSQLGetAttributesByEntryId, "SELECT \
@@ -312,6 +330,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 +367,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 Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/castorage/inc/casqlitestorage.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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
@@ -106,9 +129,12 @@
      * @param aEntryIdArray List of enties ids.
      * @param aParentIdArray The result list of parents
      * ids for a specific select.
+     * @param aCheckParentsParent falg if set to true then 
+     * search also for parent of the parent 
      */
     void GetParentsIdsL( const RArray<TInt>& aEntryIdArray,
-            RArray<TInt>& aParentIdArray );
+            RArray<TInt>& aParentIdArray, 
+            TBool aCheckParentsParent = ETrue );
 
     /**
      * Adds or Updates data & action to database.
--- a/contentstorage/castorage/inc/casqlquery.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/castorage/inc/casqlquery.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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 Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/castorage/inc/casqlquerycreator.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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 Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/castorage/inc/castorage.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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.
@@ -72,9 +79,12 @@
      * @param aEntryIdArray list of enties ids.
      * @param aParentIdArray The result list of parents' ids
      * for a specific select.
+     * @param aCheckParentsParent flag if set to true then 
+     * search also for parent of the parent 
      */
     virtual void GetParentsIdsL( const RArray<TInt>& aEntryIdArray,
-            RArray<TInt>& aParentIdArray ) = 0;
+            RArray<TInt>& aParentIdArray, 
+            TBool aCheckParentsParent = ETrue ) = 0;
 
     /**
      * Adds or Updates data & action to the storage.
--- a/contentstorage/castorage/inc/castorage_global.h	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +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:
- *
- */
-
-#ifndef CA_STORAGE_GLOBAL
-#define CA_STORAGE_GLOBAL
-
-#ifndef CONTENT_ARSENAL_STORAGE_UT
-#define CA_STORAGE_TEST_CLASS(aClassName)
-#else
-#define CA_STORAGE_TEST_CLASS(aClassName) class aClassName;
-#endif
-
-#ifndef CONTENT_ARSENAL_STORAGE_UT
-#define CA_STORAGE_TEST_FRIEND_CLASS(aClassName)
-#else
-#define CA_STORAGE_TEST_FRIEND_CLASS(aClassName) friend class aClassName;
-#endif
-
-#endif // CA_STORAGE_GLOBAL
--- a/contentstorage/castorage/src/casqlitestorage.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/castorage/src/casqlitestorage.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -207,23 +207,90 @@
         }
     }
 
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
 void CCaSqLiteStorage::LocalizeEntryL( CCaLocalizationEntry& aLocalization )
     {
     CCaSqlQuery* sqlLocalizeEntryQuery = CCaSqlQuery::NewLC( iSqlDb );
-    CaSqlQueryCreator::CreateLocalizeEntryQueryL( sqlLocalizeEntryQuery );
+    if( aLocalization.GetAttributeName().Compare( KColumnEnText ) == 0 )
+        {
+        CaSqlQueryCreator::CreateLocalizationTableQueryL( sqlLocalizeEntryQuery,
+            KSQLLocalizeTextEntry );
+        }
+    else if ( aLocalization.GetAttributeName().Compare(
+            KColumnEnDescription ) == 0 )
+        {
+        CaSqlQueryCreator::CreateLocalizationTableQueryL( sqlLocalizeEntryQuery,
+            KSQLLocalizeDescriptionEntry );
+        }
     sqlLocalizeEntryQuery->PrepareL();
     sqlLocalizeEntryQuery->BindValuesForLocalizeL( aLocalization );
     sqlLocalizeEntryQuery->ExecuteL( );
     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 +312,6 @@
     sqlGetEntriesIdsQuery->ExecuteL( aResultIdArray,
             CCaSqlQuery::EEntryTable );
     CleanupStack::PopAndDestroy( sqlGetEntriesIdsQuery );
-
     }
 
 // ---------------------------------------------------------------------------
@@ -254,7 +320,7 @@
 // ---------------------------------------------------------------------------
 //
 void CCaSqLiteStorage::GetParentsIdsL( const RArray<TInt>& aEntryIdArray,
-        RArray<TInt>& aParentIdArray )
+        RArray<TInt>& aParentIdArray, TBool aCheckParentsParent )
     {
     CCaSqlQuery* sqlGetParentIdsQuery = CCaSqlQuery::NewLC( iSqlDb );
     CaSqlQueryCreator::CreateGetParentsIdsQueryL( aEntryIdArray,
@@ -268,7 +334,7 @@
     TInt parentCount = sqlGetParentIdsQuery->ExecuteL( aParentIdArray,
             CCaSqlQuery::EGroupTable );
     CleanupStack::PopAndDestroy( sqlGetParentIdsQuery );
-    if( parentCount > 0 )
+    if( aCheckParentsParent && parentCount > 0 )
         {
         GetParentsIdsL( aParentIdArray, aParentIdArray );
         }
@@ -844,3 +910,4 @@
         }
     }
 
+
--- a/contentstorage/castorage/src/casqlquery.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/castorage/src/casqlquery.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -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 )
@@ -445,6 +480,12 @@
             BindIntL( iStatement.ParameterIndex( KSQLGEIdGroup ),
                     aQuery->GetParentId() );
             }
+        if( aQuery->GetChildId() != -1 && iQuery.Find( KSQLGEEntryId )
+                != KErrNotFound )
+            {
+            BindIntL( iStatement.ParameterIndex( KSQLGEEntryId ),
+                    aQuery->GetChildId() );
+            }
         if( aQuery->GetUid() != 0 && iQuery.Find( KSQLEnUid )
                 != KErrNotFound )
             {
@@ -609,6 +650,19 @@
 //
 // ---------------------------------------------------------------------------
 //
+TBool CCaSqlQuery::ExecuteEntryPresentL( )
+    {
+    if( iStatement.Next() == KSqlAtRow )
+        {
+        return ETrue;
+        }
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
 TInt CCaSqlQuery::ExecuteL( TInt& aId )
     {
     if( iStatement.Next() == KSqlAtRow )
@@ -743,6 +797,13 @@
                         tableName )
                         );
         
+        TPtrC qmFilename;
+        User::LeaveIfError(
+                iStatement.ColumnText(
+                        ColumnIndexL( iStatement, KColumnQmFile ),
+                        qmFilename )
+                        );
+        
         TPtrC attribute;
         User::LeaveIfError(
                 iStatement.ColumnText(
@@ -763,6 +824,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 Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/castorage/src/casqlquerycreator.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -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 );
     }
@@ -835,6 +818,20 @@
         query.Append( getListByParentId2withWhere );
         CleanupStack::PopAndDestroy( &getListByParentId2withWhere );
         }
+    else if ( aQuery->GetChildId() > 0 )
+        {
+        RBuf getListByCildIdwithWhere;
+        getListByCildIdwithWhere.CleanupClosePushL();
+        getListByCildIdwithWhere.CreateL( KSQLGetListByChildId().Length() + whereStatement.Length() );
+        getListByCildIdwithWhere.AppendFormat( KSQLGetListByChildId, &whereStatement );
+        
+        query.ReAllocL( KSQLGetListByParentId1().Length() +  leftJoins.Length() +
+                getListByCildIdwithWhere.Length() );
+        query.Append( KSQLGetListByParentId1 );
+        query.Append( leftJoins );
+        query.Append( getListByCildIdwithWhere );
+        CleanupStack::PopAndDestroy( &getListByCildIdwithWhere );
+        }
     else
         {
         query.CreateL( KSQLGetList1().Length() );
--- a/contentstorage/cautils/cautils.pro	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/cautils/cautils.pro	Thu Jul 22 16:37:03 2010 +0100
@@ -16,6 +16,7 @@
 
 TEMPLATE = lib
 symbian:{
+defFilePath = ./..
 DEPENDPATH += ./inc \
 			./src
 INCLUDEPATH += ./inc \
--- a/contentstorage/cautils/inc/cainnerentry.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/cautils/inc/cainnerentry.h	Thu Jul 22 16:37:03 2010 +0100
@@ -30,6 +30,12 @@
     {
 public:
 
+
+    enum TLocalizedType
+        {
+        ENameLocalized = 0,
+        EDescriptionLocalized
+        };
     /**
      * Destructor.
      */
@@ -116,16 +122,17 @@
     IMPORT_C void SetId( TUint aId );
 
     /**
-     * Sets the entry text.
+     * Sets localized entry text.
      * @param aText Entry text.
      */
-    IMPORT_C void SetTextL( const TDesC& aText );
-
+    IMPORT_C void SetTextL( 
+            const TDesC& aText, TBool localized = false );    
     /**
-     * Sets the entry description.
+     * Sets localized entry description.
      * @param aText Entry description.
      */
-    IMPORT_C void SetDescriptionL( const TDesC& aText );
+    IMPORT_C void SetDescriptionL( 
+            const TDesC& aText, TBool localized = false );
 
     /**
      * Sets the entry typename.
@@ -206,6 +213,12 @@
      * @param aStream a read stream
      */
     IMPORT_C void InternalizeL( RReadStream& aStream );
+    
+    /**
+     * Gets if Description is localized.
+     * @return ETrue if entry desscription is localized.
+     */
+    IMPORT_C TBool isLocalized(TLocalizedType aLocalized) const;
 
 private:
 
@@ -270,6 +283,11 @@
      * Uid
      */
     TInt32 iUid;
+    
+    TBool iTextLocalized;
+    
+    TBool iDescriptionLocalized;
+    
 
     };
 
--- a/contentstorage/cautils/inc/cainnerquery.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/cautils/inc/cainnerquery.h	Thu Jul 22 16:37:03 2010 +0100
@@ -90,12 +90,25 @@
     IMPORT_C TInt GetParentId() const;
 
     /**
-     * Sets the parent id to be queried. This will cause returning only entries whose aprent ids are aId.
+     * Sets the parent id to be queried. This will cause returning only entries whose parent ids are aId.
      * @param aId The parent id to be set for the query.
      */
     IMPORT_C void SetParentId( TInt aId );
 
     /**
+     * Returns the child id set for the query.
+     * @return Id of entry's child.
+     */
+    IMPORT_C TInt GetChildId() const;
+
+    /**
+     * Sets the child id to be queried. This will cause returning parents of the entry with id aId
+     * @param aId The child id to be set for the query.
+     */
+    IMPORT_C void SetChildId( TInt aId );
+    
+    
+    /**
      * Gets the typenames filter set in the query.
      * @return Array of typenames set in this query. 
      */
@@ -231,6 +244,11 @@
     TInt iParentId;
 
     /*
+     * Unique identifier of the child entry.
+     */
+    TInt iChildId;
+
+    /*
      * Own.
      */
     CDesC16ArrayFlat* iEntryTypeNames;
--- a/contentstorage/cautils/inc/calocalizationentry.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/cautils/inc/calocalizationentry.h	Thu Jul 22 16:37:03 2010 +0100
@@ -80,16 +80,27 @@
      * 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 );
+    
     /**
 
      */
     IMPORT_C void SetRowId( TUint aRowId );
     
     /**
-
+      Sets localization id
      */
     IMPORT_C void SetTextId( TUint aId );
     
@@ -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;
+    
+    /*
+     * Qm filename.
+     * Own.
+     */
+    RBuf iQmFilename;
 
      };
 
--- a/contentstorage/cautils/src/caentryattribute.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/cautils/src/caentryattribute.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -32,6 +32,9 @@
     iValue.Close();
     }
 
+#ifdef COVERAGE_MEASUREMENT
+#pragma CTC SKIP
+#endif //COVERAGE_MEASUREMENT (only NewLC used in code)
 // ---------------------------------------------------------
 // CCaEntryAttribute::NewL
 // ---------------------------------------------------------
@@ -42,6 +45,9 @@
     CleanupStack::Pop( attr );
     return attr;
     }
+#ifdef COVERAGE_MEASUREMENT
+#pragma CTC ENDSKIP
+#endif //COVERAGE_MEASUREMENT
 
 // ---------------------------------------------------------
 // CCaEntryAttribute::NewLC
--- a/contentstorage/cautils/src/cainnerentry.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/cautils/src/cainnerentry.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -72,6 +72,8 @@
     aStream.WriteL( iDescription, iDescription.Length() );
     aStream.WriteUint32L( iEntryTypeName.Length() );
     aStream.WriteL( iEntryTypeName, iEntryTypeName.Length() );
+    aStream.WriteUint32L( iTextLocalized );
+    aStream.WriteUint32L( iDescriptionLocalized );
     iAttributes.ExternalizeL( aStream );
     iIcon->ExternalizeL( aStream );
     aStream.CommitL();
@@ -99,6 +101,8 @@
     iEntryTypeName.Close();
     iEntryTypeName.CreateL( length );
     aStream.ReadL( iEntryTypeName, length );
+    iTextLocalized = aStream.ReadUint32L();
+    iDescriptionLocalized = aStream.ReadUint32L();
     iAttributes.InternalizeL( aStream );
     iIcon->InternalizeL( aStream );
     }
@@ -110,6 +114,8 @@
 void CCaInnerEntry::ConstructL()
     {
     iIcon = CCaInnerIconDescription::NewL();
+    iTextLocalized = EFalse;
+    iDescriptionLocalized = EFalse;
     }
 
 // ---------------------------------------------------------------------------
@@ -224,20 +230,23 @@
 //
 // ---------------------------------------------------------------------------
 //
-EXPORT_C void CCaInnerEntry::SetTextL( const TDesC& aText )
+EXPORT_C void CCaInnerEntry::SetTextL( const TDesC& aText, TBool localized )
     {
     iText.Close();
     iText.CreateL( aText );
+    iTextLocalized = localized;
     }
 
 // ---------------------------------------------------------------------------
 //
 // ---------------------------------------------------------------------------
 //
-EXPORT_C void CCaInnerEntry::SetDescriptionL( const TDesC& aText )
+EXPORT_C void CCaInnerEntry::SetDescriptionL( 
+        const TDesC& aText, TBool localized )
     {
     iDescription.Close();
     iDescription.CreateL( aText );
+    iDescriptionLocalized = localized;
     }
 
 // ---------------------------------------------------------------------------
@@ -344,3 +353,23 @@
     {
     iIcon->SetId( aIconId );
     }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CCaInnerEntry::isLocalized(TLocalizedType aLocalized) const
+    {
+    if(aLocalized == EDescriptionLocalized)
+        {
+        return iDescriptionLocalized;
+        }
+    if(aLocalized == ENameLocalized)
+        {
+        return iTextLocalized;
+        }
+    else 
+        return EFalse;
+    }
+
+
--- a/contentstorage/cautils/src/cainnerquery.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/cautils/src/cainnerquery.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -63,6 +63,7 @@
 EXPORT_C void CCaInnerQuery::ExternalizeL( RWriteStream& aStream ) const
     {
     aStream.WriteInt32L( iParentId );
+    aStream.WriteInt32L( iChildId );
     aStream.WriteInt32L( iRole );
     aStream.WriteUint32L( iFlagsOn );
     aStream.WriteUint32L( iFlagsOff );
@@ -93,6 +94,7 @@
 EXPORT_C void CCaInnerQuery::InternalizeL( RReadStream& aStream )
     {
     iParentId = aStream.ReadInt32L();
+    iChildId = aStream.ReadInt32L();
     iRole = aStream.ReadInt32L();
     iFlagsOn = aStream.ReadUint32L();
     iFlagsOff = aStream.ReadUint32L();
@@ -128,6 +130,7 @@
     {
     iEntryTypeNames = new ( ELeave ) CDesC16ArrayFlat( KDefaultGranularity );
     iParentId = -1;
+    iChildId = -1;
     iRole = Item | Group;
     }
 
@@ -182,6 +185,25 @@
 //
 // ---------------------------------------------------------------------------
 //
+EXPORT_C TInt CCaInnerQuery::GetChildId() const
+    {
+    return iChildId;
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCaInnerQuery::SetChildId( TInt aId )
+    {
+    iChildId = aId;
+    }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
 EXPORT_C const CDesC16ArrayFlat* CCaInnerQuery::GetEntryTypeNames() const
     {
     return iEntryTypeNames;
--- a/contentstorage/cautils/src/calocalizationentry.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/cautils/src/calocalizationentry.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -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 Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/contentstorage.pro	Thu Jul 22 16:37:03 2010 +0100
@@ -23,4 +23,5 @@
 SUBDIRS  += cahandler
 }
 SUBDIRS  += caclient
+SUBDIRS  += casoftwareregistry
 CONFIG  += ordered
--- a/contentstorage/eabi/camenuu.def	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/eabi/camenuu.def	Thu Jul 22 16:37:03 2010 +0100
@@ -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 Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/eabi/cautilsu.def	Thu Jul 22 16:37:03 2010 +0100
@@ -5,7 +5,7 @@
 	_ZN13CCaInnerEntry13AddAttributeLERK7TDesC16S2_ @ 4 NONAME
 	_ZN13CCaInnerEntry13FindAttributeERK7TDesC16R6TDes16 @ 5 NONAME
 	_ZN13CCaInnerEntry13FindAttributeERK7TDesC16R7TPtrC16 @ 6 NONAME
-	_ZN13CCaInnerEntry15SetDescriptionLERK7TDesC16 @ 7 NONAME
+	_ZN13CCaInnerEntry15SetDescriptionLERK7TDesC16i @ 7 NONAME
 	_ZN13CCaInnerEntry16RemoveAttributeLERK7TDesC16 @ 8 NONAME
 	_ZN13CCaInnerEntry17SetEntryTypeNameLERK7TDesC16 @ 9 NONAME
 	_ZN13CCaInnerEntry4NewLEv @ 10 NONAME
@@ -14,7 +14,7 @@
 	_ZN13CCaInnerEntry6SetUidEl @ 13 NONAME
 	_ZN13CCaInnerEntry7SetRoleEj @ 14 NONAME
 	_ZN13CCaInnerEntry8SetFlagsEj @ 15 NONAME
-	_ZN13CCaInnerEntry8SetTextLERK7TDesC16 @ 16 NONAME
+	_ZN13CCaInnerEntry8SetTextLERK7TDesC16i @ 16 NONAME
 	_ZN13CCaInnerEntry9SetIconIdEi @ 17 NONAME
 	_ZN13CCaInnerQuery10SetFlagsOnEj @ 18 NONAME
 	_ZN13CCaInnerQuery11SetFlagsOffEj @ 19 NONAME
@@ -39,61 +39,66 @@
 	_ZN17RCaEntryAttrArray5ExistERK7TDesC16 @ 38 NONAME
 	_ZN20CCaLocalizationEntry12SetStringIdLERK7TDesC16 @ 39 NONAME
 	_ZN20CCaLocalizationEntry13SetTableNameLERK7TDesC16 @ 40 NONAME
-	_ZN20CCaLocalizationEntry17SetAttributeNameLERK7TDesC16 @ 41 NONAME
-	_ZN20CCaLocalizationEntry19SetLocalizedStringLERK7TDesC16 @ 42 NONAME
-	_ZN20CCaLocalizationEntry4NewLEv @ 43 NONAME
-	_ZN20CCaLocalizationEntry5NewLCEv @ 44 NONAME
-	_ZN20CCaLocalizationEntry8SetRowIdEj @ 45 NONAME
-	_ZN20CCaLocalizationEntry9SetTextIdEj @ 46 NONAME
-	_ZN22CCaInnerNotifierFilter11SetParentIdEi @ 47 NONAME
-	_ZN22CCaInnerNotifierFilter12InternalizeLER11RReadStream @ 48 NONAME
-	_ZN22CCaInnerNotifierFilter12SetEntryRoleE10TEntryRole @ 49 NONAME
-	_ZN22CCaInnerNotifierFilter12SetTypeNamesEP16CDesC16ArrayFlat @ 50 NONAME
-	_ZN22CCaInnerNotifierFilter4NewLENS_13TNotifierTypeE @ 51 NONAME
-	_ZN22CCaInnerNotifierFilter5NewLCENS_13TNotifierTypeE @ 52 NONAME
-	_ZN22CCaInnerNotifierFilter7SetIdsLERK6RArrayIiE @ 53 NONAME
-	_ZN23CCaInnerIconDescription10SetSkinIdLERK7TDesC16 @ 54 NONAME
-	_ZN23CCaInnerIconDescription12SetFileNameLERK7TDesC16 @ 55 NONAME
-	_ZN23CCaInnerIconDescription17SetApplicationIdLERK7TDesC16 @ 56 NONAME
-	_ZN23CCaInnerIconDescription4NewLEv @ 57 NONAME
-	_ZN23CCaInnerIconDescription5NewLCEv @ 58 NONAME
-	_ZN23CCaInnerIconDescription5SetIdEi @ 59 NONAME
-	_ZN9MenuUtils8GetTUintERK7TDesC16Rj @ 60 NONAME
-	_ZNK11RCaIdsArray12ExternalizeLER12RWriteStream @ 61 NONAME
-	_ZNK11RCaIdsArray13MarshalDataLCEv @ 62 NONAME
-	_ZNK13CCaInnerEntry12ExternalizeLER12RWriteStream @ 63 NONAME
-	_ZNK13CCaInnerEntry13GetAttributesEv @ 64 NONAME
-	_ZNK13CCaInnerEntry14GetDescriptionEv @ 65 NONAME
-	_ZNK13CCaInnerEntry16GetEntryTypeNameEv @ 66 NONAME
-	_ZNK13CCaInnerEntry4IconEv @ 67 NONAME
-	_ZNK13CCaInnerEntry5GetIdEv @ 68 NONAME
-	_ZNK13CCaInnerEntry6GetUidEv @ 69 NONAME
-	_ZNK13CCaInnerEntry7GetRoleEv @ 70 NONAME
-	_ZNK13CCaInnerEntry7GetTextEv @ 71 NONAME
-	_ZNK13CCaInnerEntry8GetFlagsEv @ 72 NONAME
-	_ZNK13CCaInnerEntry9GetIconIdEv @ 73 NONAME
-	_ZNK13CCaInnerQuery10GetFlagsOnEv @ 74 NONAME
-	_ZNK13CCaInnerQuery11GetFlagsOffEv @ 75 NONAME
-	_ZNK13CCaInnerQuery11GetParentIdEv @ 76 NONAME
-	_ZNK13CCaInnerQuery12ExternalizeLER12RWriteStream @ 77 NONAME
-	_ZNK13CCaInnerQuery13GetAttributesEv @ 78 NONAME
-	_ZNK13CCaInnerQuery17GetEntryTypeNamesEv @ 79 NONAME
-	_ZNK13CCaInnerQuery6GetIdsEv @ 80 NONAME
-	_ZNK13CCaInnerQuery6GetUidEv @ 81 NONAME
-	_ZNK13CCaInnerQuery7GetRoleEv @ 82 NONAME
-	_ZNK13CCaInnerQuery7GetSortEv @ 83 NONAME
-	_ZNK13CCaInnerQuery8GetCountEv @ 84 NONAME
-	_ZNK15RCaEntriesArray12ExternalizeLER12RWriteStream @ 85 NONAME
-	_ZNK20CCaLocalizationEntry11GetStringIdEv @ 86 NONAME
-	_ZNK20CCaLocalizationEntry12GetTableNameEv @ 87 NONAME
-	_ZNK20CCaLocalizationEntry16GetAttributeNameEv @ 88 NONAME
-	_ZNK20CCaLocalizationEntry18GetLocalizedStringEv @ 89 NONAME
-	_ZNK20CCaLocalizationEntry8GetRowIdEv @ 90 NONAME
-	_ZNK20CCaLocalizationEntry9GetTextIdEv @ 91 NONAME
-	_ZNK22CCaInnerNotifierFilter11GetParentIdEv @ 92 NONAME
-	_ZNK22CCaInnerNotifierFilter12ExternalizeLER12RWriteStream @ 93 NONAME
-	_ZNK22CCaInnerNotifierFilter12GetEntryRoleEv @ 94 NONAME
-	_ZNK22CCaInnerNotifierFilter12GetTypeNamesEv @ 95 NONAME
-	_ZNK22CCaInnerNotifierFilter15GetNotifierTypeEv @ 96 NONAME
-	_ZNK22CCaInnerNotifierFilter6GetIdsEv @ 97 NONAME
+	_ZN20CCaLocalizationEntry14SetQmFilenameLERK7TDesC16 @ 41 NONAME
+	_ZN20CCaLocalizationEntry17SetAttributeNameLERK7TDesC16 @ 42 NONAME
+	_ZN20CCaLocalizationEntry19SetLocalizedStringLERK7TDesC16 @ 43 NONAME
+	_ZN20CCaLocalizationEntry4NewLEv @ 44 NONAME
+	_ZN20CCaLocalizationEntry5NewLCEv @ 45 NONAME
+	_ZN20CCaLocalizationEntry8SetRowIdEj @ 46 NONAME
+	_ZN20CCaLocalizationEntry9SetTextIdEj @ 47 NONAME
+	_ZN22CCaInnerNotifierFilter11SetParentIdEi @ 48 NONAME
+	_ZN22CCaInnerNotifierFilter12InternalizeLER11RReadStream @ 49 NONAME
+	_ZN22CCaInnerNotifierFilter12SetEntryRoleE10TEntryRole @ 50 NONAME
+	_ZN22CCaInnerNotifierFilter12SetTypeNamesEP16CDesC16ArrayFlat @ 51 NONAME
+	_ZN22CCaInnerNotifierFilter4NewLENS_13TNotifierTypeE @ 52 NONAME
+	_ZN22CCaInnerNotifierFilter5NewLCENS_13TNotifierTypeE @ 53 NONAME
+	_ZN22CCaInnerNotifierFilter7SetIdsLERK6RArrayIiE @ 54 NONAME
+	_ZN23CCaInnerIconDescription10SetSkinIdLERK7TDesC16 @ 55 NONAME
+	_ZN23CCaInnerIconDescription12SetFileNameLERK7TDesC16 @ 56 NONAME
+	_ZN23CCaInnerIconDescription17SetApplicationIdLERK7TDesC16 @ 57 NONAME
+	_ZN23CCaInnerIconDescription4NewLEv @ 58 NONAME
+	_ZN23CCaInnerIconDescription5NewLCEv @ 59 NONAME
+	_ZN23CCaInnerIconDescription5SetIdEi @ 60 NONAME
+	_ZN9MenuUtils8GetTUintERK7TDesC16Rj @ 61 NONAME
+	_ZNK11RCaIdsArray12ExternalizeLER12RWriteStream @ 62 NONAME
+	_ZNK11RCaIdsArray13MarshalDataLCEv @ 63 NONAME
+	_ZNK13CCaInnerEntry11isLocalizedENS_14TLocalizedTypeE @ 64 NONAME
+	_ZNK13CCaInnerEntry12ExternalizeLER12RWriteStream @ 65 NONAME
+	_ZNK13CCaInnerEntry13GetAttributesEv @ 66 NONAME
+	_ZNK13CCaInnerEntry14GetDescriptionEv @ 67 NONAME
+	_ZNK13CCaInnerEntry16GetEntryTypeNameEv @ 68 NONAME
+	_ZNK13CCaInnerEntry4IconEv @ 69 NONAME
+	_ZNK13CCaInnerEntry5GetIdEv @ 70 NONAME
+	_ZNK13CCaInnerEntry6GetUidEv @ 71 NONAME
+	_ZNK13CCaInnerEntry7GetRoleEv @ 72 NONAME
+	_ZNK13CCaInnerEntry7GetTextEv @ 73 NONAME
+	_ZNK13CCaInnerEntry8GetFlagsEv @ 74 NONAME
+	_ZNK13CCaInnerEntry9GetIconIdEv @ 75 NONAME
+	_ZNK13CCaInnerQuery10GetFlagsOnEv @ 76 NONAME
+	_ZNK13CCaInnerQuery11GetFlagsOffEv @ 77 NONAME
+	_ZNK13CCaInnerQuery11GetParentIdEv @ 78 NONAME
+	_ZNK13CCaInnerQuery12ExternalizeLER12RWriteStream @ 79 NONAME
+	_ZNK13CCaInnerQuery13GetAttributesEv @ 80 NONAME
+	_ZNK13CCaInnerQuery17GetEntryTypeNamesEv @ 81 NONAME
+	_ZNK13CCaInnerQuery6GetIdsEv @ 82 NONAME
+	_ZNK13CCaInnerQuery6GetUidEv @ 83 NONAME
+	_ZNK13CCaInnerQuery7GetRoleEv @ 84 NONAME
+	_ZNK13CCaInnerQuery7GetSortEv @ 85 NONAME
+	_ZNK13CCaInnerQuery8GetCountEv @ 86 NONAME
+	_ZNK15RCaEntriesArray12ExternalizeLER12RWriteStream @ 87 NONAME
+	_ZNK20CCaLocalizationEntry11GetStringIdEv @ 88 NONAME
+	_ZNK20CCaLocalizationEntry12GetTableNameEv @ 89 NONAME
+	_ZNK20CCaLocalizationEntry13GetQmFilenameEv @ 90 NONAME
+	_ZNK20CCaLocalizationEntry16GetAttributeNameEv @ 91 NONAME
+	_ZNK20CCaLocalizationEntry18GetLocalizedStringEv @ 92 NONAME
+	_ZNK20CCaLocalizationEntry8GetRowIdEv @ 93 NONAME
+	_ZNK20CCaLocalizationEntry9GetTextIdEv @ 94 NONAME
+	_ZNK22CCaInnerNotifierFilter11GetParentIdEv @ 95 NONAME
+	_ZNK22CCaInnerNotifierFilter12ExternalizeLER12RWriteStream @ 96 NONAME
+	_ZNK22CCaInnerNotifierFilter12GetEntryRoleEv @ 97 NONAME
+	_ZNK22CCaInnerNotifierFilter12GetTypeNamesEv @ 98 NONAME
+	_ZNK22CCaInnerNotifierFilter15GetNotifierTypeEv @ 99 NONAME
+	_ZNK22CCaInnerNotifierFilter6GetIdsEv @ 100 NONAME
+	_ZN13CCaInnerQuery10SetChildIdEi @ 101 NONAME
+	_ZNK13CCaInnerQuery10GetChildIdEv @ 102 NONAME
 
--- a/contentstorage/extinc/casathandler.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/extinc/casathandler.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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/extsrc/casathandler.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/extsrc/casathandler.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -145,6 +145,9 @@
     iSatIcon.OpenL( iSatSession );
     }
 
+#ifdef COVERAGE_MEASUREMENT
+#pragma CTC SKIP
+#endif //COVERAGE_MEASUREMENT (Icon can be created only from SIM)
 // ---------------------------------------------------------------------------
 // CCaSatHandler::GetVisibility
 // ---------------------------------------------------------------------------
@@ -192,5 +195,8 @@
         return NULL;
         }
     }
+#ifdef COVERAGE_MEASUREMENT
+#pragma CTC ENDSKIP
+#endif //COVERAGE_MEASUREMENT
 
 //  End of File
--- a/contentstorage/group/camenu.mmp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/group/camenu.mmp	Thu Jul 22 16:37:03 2010 +0100
@@ -12,7 +12,7 @@
 * Contributors:
 *
 * Description:
-*  Version     : %version: 19.1.6 % << Don't touch! Updated by Synergy at check-out.
+*  Version     : %version: 19.1.9 % << Don't touch! Updated by Synergy at check-out.
 *
 */
 
@@ -39,6 +39,7 @@
 SOURCE          casrvengutils.cpp
 SOURCE			casrvnotifier.cpp
 SOURCE          castorageproxy.cpp
+SOURCE          caprogressnotifier.cpp
 
 
 USERINCLUDE     ../srvinc
@@ -48,7 +49,7 @@
 USERINCLUDE     ../casrv/casrvmgr/inc
 
 
-APP_LAYER_SYSTEMINCLUDE
+MW_LAYER_SYSTEMINCLUDE
 
 LIBRARY         euser.lib
 LIBRARY         efsrv.lib
@@ -64,4 +65,12 @@
 LIBRARY         bafl.lib
 LIBRARY         casrvmanager.lib
 
+LIBRARY         sifnotification.lib
+LIBRARY         sif.lib
+LIBRARY         scrclient.lib
 
+// HB LIBRARIES
+SYSTEMINCLUDE		/epoc32/include/mw/hb/hbcore
+LIBRARY		HbCore.lib
+
+
--- a/contentstorage/group/camenusrv.mmp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/group/camenusrv.mmp	Thu Jul 22 16:37:03 2010 +0100
@@ -24,7 +24,7 @@
 TARGET          camenuserver.exe
 TARGETTYPE      exe
 UID             0x1000008c CA_SRV_UID3
-CAPABILITY      AllFiles ProtServ ReadDeviceData ReadUserData 
+CAPABILITY      CAP_SERVER AllFiles 
 VENDORID        VID_DEFAULT
 
 EPOCSTACKSIZE   0x5000
--- a/contentstorage/group/group.pro	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/group/group.pro	Thu Jul 22 16:37:03 2010 +0100
@@ -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 Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/inc/cadef.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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.25 % << Don't touch! Updated by Synergy at check-out.
  *
  */
 
@@ -49,7 +49,7 @@
 enum TEntryFlag
     {
     EUsed = 1,
-    ESystem = 2,
+    EUninstall = 2,
     ERemovable = 4,
     EVisible = 8,
     ERunning = 16,
@@ -61,7 +61,8 @@
     {
     EItemAppearanceNotChanged,
     EItemDisappeared,
-    EItemAppeared
+    EItemAppeared,
+    EItemUninstallProgressChanged
     };
 
 // Ca - Application
@@ -86,16 +87,30 @@
 _LIT( KCaAttrAppTypeValueNative, "native");
 _LIT( KCaAttrComponentId, "component_id" );
 _LIT( KCaAttrAppSettingsPlugin, "app_settings_plugin");
-// app settings plugin for java apps
-_LIT( KCaAttrJavaAppSettingsPluginValue,
-        "/resource/qt/plugins/appsettings/javaapplicationsettingsview.qtplugin");
+_LIT( KCaScrPropertyAppSettings, "settingsName");
+_LIT( KPreviewImageAttrName, "preview_image_name" );
 _LIT( KCaAttrAppWidgetUri, "widget:uri");
 _LIT( KCaAttrAppWidgetServiceXml, "widget:servicexml");
 
 _LIT( KCaAttrAppWidgetUriCWRTValue, "wrtwidgetuiplugin");
 _LIT( KCaAttrAppWidgetParamWebAppId, "widgetparam:webAppId");
+_LIT( KCaScrPropertyAppId, "AppID");
+_LIT( KCaScrPropertyIsMiniviewSupported, "isMiniviewSupported");
 
 _LIT( KCaAppGroupName, "appgroup_name" );
+_LIT( KCaAppUninstallProgress, "uninstall_progress" );
+
+_LIT( KCollectionIconFileName, "qtg_large_applications_user");
+
+
+_LIT(KLocalizationFilepathZ, "z:/resource/qt/translations");
+_LIT(KLocalizationFilepathC, "c:/resource/qt/translations");
+_LIT(KLocalizationFilepath, ":/resource/qt/translations");
+_LIT( KLocalizationCaEntry, "CA_ENTRY" );
+_LIT( KLocalizationEnText, "EN_TEXT" );
+_LIT( KLocalizationEnDescription, "EN_DESCRIPTION" );
+const TInt charsToFilename= 6;  // <loc://> loc://email/qtn_gmail_mail_account
+
 
 const TInt KGranularityOne = 1;
 const TInt KUidChars = 10;
@@ -132,7 +147,7 @@
 
 const TUid KCWRTApplicationTypeUid =
     {
-    0x200267DC
+    0x10282821 
     };
 
 const TInt KCenRepBufferSize = 255;
@@ -145,7 +160,8 @@
 // Note, however, that none of these is guaranteed to be set, or be used by a menu UI.
 // Menu clients always need to check that the necessary attributes are present.
 //
-_LIT( KCaAttrLongName, "long_name" ); ///< Long name.
+_LIT( KCaAttrShortName, "short_name" ); ///< Short name.
+_LIT( KCaComponentId, "component_id" ); ///< Component Id.
 
 // Built-in types and attributes.
 //
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contentstorage/inc/castorage_global.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
+
+#ifndef CA_STORAGE_GLOBAL_H
+#define CA_STORAGE_GLOBAL_H
+
+#ifndef CONTENT_ARSENAL_STORAGE_UT
+#define CA_STORAGE_TEST_CLASS(aClassName)
+#else
+#define CA_STORAGE_TEST_CLASS(aClassName) class aClassName;
+#endif
+
+#ifndef CONTENT_ARSENAL_STORAGE_UT
+#define CA_STORAGE_TEST_FRIEND_CLASS(aClassName)
+#else
+#define CA_STORAGE_TEST_FRIEND_CLASS(aClassName) friend class aClassName;
+#endif
+
+#endif // CA_STORAGE_GLOBAL_H
--- a/contentstorage/srvinc/cainstallstrategy.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/srvinc/cainstallstrategy.h	Thu Jul 22 16:37:03 2010 +0100
@@ -156,9 +156,10 @@
 private:
 
     /**
-     * Contains uid of application that was started to uninstall.
+     * Contains uninstallation status of application 
+     * that was started to uninstall.
      */
-    TInt iAppUid;
+    TInt iUninstallStatus;
 
     };
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contentstorage/srvinc/caprogressnotifier.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,113 @@
+/*
+ * 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 CAPROGRESSNOTIFIER_H
+#define CAPROGRESSNOTIFIER_H
+
+#include <e32base.h>
+#include <usif/sif/sifnotification.h>
+#include <usif/usifcommon.h> 
+
+#include "castorage_global.h"
+using namespace Usif; 
+
+class CCaStorageProxy;
+class CCaInnerEntry;
+
+/**
+ *  Uninstall Progress notifier.
+ *
+ *  @since S60 v5.0
+ */
+NONSHARABLE_CLASS( CCaProgressNotifier ) : public CBase, 
+        public MSifOperationsHandler
+    {
+
+public:
+    /**
+     * Creates an instance of CCaProgressNotifier.
+     * @param aCaStorageProxy Reference to storage.
+     */
+IMPORT_C static CCaProgressNotifier* NewL( CCaStorageProxy& aCaStorageProxy);
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCaProgressNotifier();
+
+private:
+
+    /**
+     * Constructor.
+     */
+    CCaProgressNotifier( CCaStorageProxy& aCaStorageProxy );
+
+    /**
+     * Symbian 2nd phase constructor.
+     * @param aCaStorageProxy Reference to storage.
+     */
+    void ConstructL( );
+    
+    void UpdateProgressL( const CSifOperationProgressData& aProgressData );
+    void EndOperationL(TInt aError);
+    TComponentId ComponentIdL(const TDesC& aGlobalComponentId, const TDesC& aSwType);
+    void MarkEntrysForUnistallL(TUint aKey, TComponentId aComponentId);
+
+public:
+    /**
+     * From MSifOperationsHandler
+     */
+    void StartOperationHandler(TUint aKey, const CSifOperationStartData& aStartData);
+
+    /**
+     * From MSifOperationsHandler
+     */
+    void EndOperationHandler(const CSifOperationEndData& aEndData);
+
+    /**
+     * From MSifOperationsHandler
+     */
+    void ProgressOperationHandler(const CSifOperationProgressData& aProgressData);
+    
+private:
+
+    /**
+     * USIF notifier
+     * Own.
+     * 
+     * Commented out since USIF notifications do not
+     * work on MCL wk20
+     */
+    CSifOperationsNotifier* iNotifier;
+    
+    /**
+     * Not Own.
+     * Reference to the Storage Proxy.
+     */
+    CCaStorageProxy& iStorageProxy;
+    
+    RPointerArray<CCaInnerEntry> iResultArrayItems;
+    
+    TUint iKey;
+    
+    };
+
+
+#endif /* CAPROGRESSNOTIFIER_H */
+
+// End of File
+
--- a/contentstorage/srvinc/casrv.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/srvinc/casrv.h	Thu Jul 22 16:37:03 2010 +0100
@@ -25,6 +25,7 @@
 class CCaSrvEngUtils;
 class CCaSrvManager;
 class CCaStorageProxy;
+class CCaProgressNotifier;
 
 // GLOBAL FUNCTIONS
 /**
@@ -119,6 +120,11 @@
      */
     CCaSrvManager* iSrvManager;
 
+    /*
+     * Uninstall progress notifier
+     */
+    CCaProgressNotifier* iProgressNotifier;
+
     };
 
 #endif // CASRV_H
--- a/contentstorage/srvinc/casrvmmchistory.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/srvinc/casrvmmchistory.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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 Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/srvinc/castorageproxy.h	Thu Jul 22 16:37:03 2010 +0100
@@ -19,9 +19,11 @@
 #define CASTORAGEPROXY_H
 
 #include "cadef.h"
+#include "castorage_global.h"
 #include "caoperationparams.h"
 
 
+
 // FORWARD DECLARATIONS
 class CCaStorage;
 class CCaInnerQuery;
@@ -29,6 +31,8 @@
 class CCaLocalizationEntry;
 class MCaSessionNorifier;
 
+CA_STORAGE_TEST_CLASS( TestCaClient )
+
 /**
  * Interface for CA database implementations.
  *
@@ -60,6 +64,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.
@@ -173,6 +184,12 @@
      * C++ default constructor.
      */
     CCaStorageProxy();
+    
+    CCaLocalizationEntry* LocalizeTextL( CCaInnerEntry* aEntry );
+    
+    CCaLocalizationEntry* LocalizeDescriptionL( CCaInnerEntry* aEntry );
+    
+    TBool InitializeTranslatorL( TDesC& aQmFilename );
 
 private:
     //Data
@@ -186,6 +203,9 @@
      * Sessions using this engine. Own.
      */
     RPointerArray<MCaSessionNorifier> iHandlerNotifier;
+    
+    CA_STORAGE_TEST_FRIEND_CLASS( TestCaClient )
+    
     };
 
 #endif //CASTORAGEPROXY_H
--- a/contentstorage/srvsrc/cainstallstrategy.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/srvsrc/cainstallstrategy.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -16,7 +16,9 @@
  */
 #include <e32property.h>
 #include <SWInstallerInternalPSKeys.h>
-#include <javadomainpskeys.h>
+#include <app/javadomainpskeys.h>
+#include <swi/swispubsubdefs.h>
+
 #include "cainstallstrategy.h"
 
 // ---------------------------------------------------------------------------
@@ -140,16 +142,17 @@
 void CCaUsifUninstallStrategy::NotifyListenerL(
 		RProperty& aProperty, MCaInstallListener& aListener )
     {
-    TInt appUid;
-    User::LeaveIfError( aProperty.Get( KPSUidSWInstallerUiNotification,
-            KSWInstallerUninstallation, appUid ) );
-    // if there is some value!=0 in iAppUid and appUid==0 that means
-    // application with uid==iAppUid was uninstalled, so we notify aListener
-    if( iAppUid && !appUid )
+    TInt status;
+    // TODO: Temporary solution for incorrect USIF notifications     
+    User::LeaveIfError( aProperty.Get( KUidSystemCategory,
+            Swi::KUidSoftwareInstallKey, status ) );
+    //if( status == ( Swi::ESwisStatusSuccess | Swi::ESwisUninstall ) )
+    // notify subscribers on begenning and at the end of uninstallation
+    if( status == Swi::ESwisUninstall || iUninstallStatus == Swi::ESwisUninstall /*&& !status*/ )
         {
-        aListener.HandleInstallNotifyL( iAppUid );
-        }
-    iAppUid = appUid;
+        aListener.HandleInstallNotifyL( status );
+        }    
+    iUninstallStatus = status;
     }
 
 // ---------------------------------------------------------------------------
@@ -158,8 +161,7 @@
 //
 CCaUsifUninstallStrategy::CCaUsifUninstallStrategy( RProperty& aProperty )
     {
-	aProperty.Attach(
-			KPSUidSWInstallerUiNotification, KSWInstallerUninstallation );
+	aProperty.Attach( KUidSystemCategory, Swi::KUidSoftwareInstallKey );
     }
 
 // ---------------------------------------------------------------------------
--- a/contentstorage/srvsrc/cammcwatcher.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/srvsrc/cammcwatcher.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -107,6 +107,9 @@
     iFs.NotifyChangeCancel();
     }
 
+#ifdef COVERAGE_MEASUREMENT
+#pragma CTC SKIP
+#endif //COVERAGE_MEASUREMENT (error is ignored)
 // ---------------------------------------------------------------------------
 // CCaWidgetMmcWatcher::RunError
 // ---------------------------------------------------------------------------
@@ -116,7 +119,13 @@
     // No need to do anything
     return KErrNone;
     }
+#ifdef COVERAGE_MEASUREMENT
+#pragma CTC ENDSKIP
+#endif //COVERAGE_MEASUREMENT
 
+#ifdef COVERAGE_MEASUREMENT
+#pragma CTC SKIP
+#endif //COVERAGE_MEASUREMENT (memory card removal)
 // ---------------------------------------------------------
 // CCaWidgetMmcWatcher::RunL
 // ---------------------------------------------------------
@@ -130,4 +139,6 @@
         iObserver->MmcChangeL();
         }
     }
-
+#ifdef COVERAGE_MEASUREMENT
+#pragma CTC ENDSKIP
+#endif //COVERAGE_MEASUREMENT
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contentstorage/srvsrc/caprogressnotifier.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,208 @@
+/*
+ * 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 <s32mem.h>
+
+#include <usif/scr/scr.h>
+#include <usif/scr/screntries.h>
+
+#include "caprogressnotifier.h"
+#include "castorageproxy.h"
+#include "cainnerquery.h"
+#include "cainnerentry.h"
+#include "caarraycleanup.inl"
+
+using namespace Usif;
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCaProgressNotifier* CCaProgressNotifier::NewL(
+        CCaStorageProxy& aCaStorageProxy )
+    {
+    CCaProgressNotifier* self = new ( ELeave ) CCaProgressNotifier(
+            aCaStorageProxy );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CCaProgressNotifier::~CCaProgressNotifier()
+    {
+    delete iNotifier;
+    iResultArrayItems.ResetAndDestroy();
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CCaProgressNotifier::CCaProgressNotifier( CCaStorageProxy& aCaStorageProxy ) :
+    iStorageProxy( aCaStorageProxy )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CCaProgressNotifier::ConstructL()
+    {
+    iNotifier = CSifOperationsNotifier::NewL( *this );
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CCaProgressNotifier::StartOperationHandler( TUint aKey,
+        const CSifOperationStartData& aStartData )
+    {
+    TInt err( KErrNone );
+    TComponentId componentId;
+    iResultArrayItems.ResetAndDestroy();
+
+    TRAP(err, componentId = ComponentIdL( aStartData.GlobalComponentId(),
+                    aStartData.SoftwareType() ));
+    if ( !err )
+        TRAP(err, MarkEntrysForUnistallL(aKey, componentId));
+
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CCaProgressNotifier::EndOperationHandler(
+        const CSifOperationEndData& aEndData )
+    {
+    TInt err = KErrNone;
+    TRAP(err, EndOperationL(aEndData.ErrorCode()));
+    iResultArrayItems.ResetAndDestroy();
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CCaProgressNotifier::ProgressOperationHandler(
+        const CSifOperationProgressData& aProgressData )
+    {
+    TInt err = KErrNone;
+    TRAP(err, UpdateProgressL(aProgressData));
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CCaProgressNotifier::UpdateProgressL(
+        const CSifOperationProgressData& aProgressData )
+    {
+    RBuf totalProgressBuf;
+    totalProgressBuf.CleanupClosePushL();
+    totalProgressBuf.CreateL( sizeof(TComponentId) + 1 );
+    totalProgressBuf.AppendNum( aProgressData.CurrentProgess() );
+
+    if ( iResultArrayItems.Count() && aProgressData.Phase() == EUninstalling )
+        {
+        for ( int i = 0; i < iResultArrayItems.Count(); i++ )
+            {
+            iResultArrayItems[i]->AddAttributeL( KCaAppUninstallProgress,
+                    totalProgressBuf );
+            iStorageProxy.AddL( iResultArrayItems[i], ETrue,
+                    EItemUninstallProgressChanged );
+            }
+        }
+
+    CleanupStack::PopAndDestroy( &totalProgressBuf );
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CCaProgressNotifier::EndOperationL( TInt aError )
+    {
+    if ( aError )
+        {
+        for ( int i = 0; i < iResultArrayItems.Count(); i++ )
+            {
+            iResultArrayItems[i]->SetFlags( iResultArrayItems[i]->GetFlags()
+                    & ~EUninstall );
+            iStorageProxy.AddL( iResultArrayItems[i] );
+            }
+        }
+    iNotifier->CancelSubscribeL( iKey );
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TComponentId CCaProgressNotifier::ComponentIdL(
+        const TDesC& aGlobalComponentId, const TDesC& aSwType )
+    {
+    RSoftwareComponentRegistry registry;
+    User::LeaveIfError( registry.Connect() );
+    CleanupClosePushL( registry );
+    TComponentId componentId = registry.GetComponentIdL( aGlobalComponentId,
+            aSwType );
+    CleanupStack::PopAndDestroy( &registry ); // registry    
+    return componentId;
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CCaProgressNotifier::MarkEntrysForUnistallL( TUint aKey,
+        TComponentId aComponentId )
+    {
+    RBuf componentIdBuf;
+    componentIdBuf.CleanupClosePushL();
+    componentIdBuf.CreateL( sizeof(TComponentId) + 1 );
+    componentIdBuf.AppendNum( aComponentId );
+
+    // find entry by componentID
+    CCaInnerQuery *innerQuery = CCaInnerQuery::NewLC();
+    innerQuery->SetRole( CCaInnerQuery::Item );
+    innerQuery->AddAttributeL( KCaAttrComponentId, componentIdBuf );
+
+    iStorageProxy.GetEntriesL( innerQuery, iResultArrayItems );
+
+    if ( iResultArrayItems.Count() )
+        {
+        for ( int i = 0; i < iResultArrayItems.Count(); i++ )
+            {
+            iResultArrayItems[i]->SetFlags( iResultArrayItems[i]->GetFlags()
+                    | EUninstall );
+            iStorageProxy.AddL( iResultArrayItems[i] );
+            }
+        // subscribe for progress notifier
+        iKey = aKey;
+        iNotifier->SubscribeL( aKey, ETrue );
+        }
+    CleanupStack::PopAndDestroy( innerQuery );
+    CleanupStack::PopAndDestroy( &componentIdBuf );
+    }
--- a/contentstorage/srvsrc/casrv.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/srvsrc/casrv.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -24,6 +24,7 @@
 #include "casrvengutils.h"
 #include "castorageproxy.h"
 #include "casrvmanager.h"
+#include "caprogressnotifier.h"
 
 // ==================== LOCAL FUNCTIONS ====================
 
@@ -124,6 +125,7 @@
         }
     delete iSrvManager;
     delete iSrvEngUtils;
+    delete iProgressNotifier;
     delete iStorageProxy;
     }
 
@@ -154,12 +156,15 @@
     iSessionCount = 0;
     iStorageProxy = CCaStorageProxy::NewL();
     iSrvEngUtils = CCaSrvEngUtils::NewL();
-    TRAPD( err, iSrvManager = CCaSrvManager::NewL(
-            *iStorageProxy, iSrvEngUtils ) );
-    if( KSqlErrNotDb <= err && err <= KSqlErrGeneral )
+    iProgressNotifier = CCaProgressNotifier::NewL( *iStorageProxy );
+    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 Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/srvsrc/casrvmmchistory.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -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/casrvnotifier.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/srvsrc/casrvnotifier.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -38,6 +38,9 @@
     delete iFilter;
     }
 
+#ifdef COVERAGE_MEASUREMENT
+#pragma CTC SKIP
+#endif //COVERAGE_MEASUREMENT (only NewLC used in code)
 // -----------------------------------------------------------------------------
 // 
 // -----------------------------------------------------------------------------
@@ -48,6 +51,9 @@
     CleanupStack::Pop();
     return self;
     }
+#ifdef COVERAGE_MEASUREMENT
+#pragma CTC ENDSKIP
+#endif //COVERAGE_MEASUREMENT
 
 // -----------------------------------------------------------------------------
 // 
--- a/contentstorage/srvsrc/castorageproxy.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/contentstorage/srvsrc/castorageproxy.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -15,6 +15,9 @@
  *
  */
 
+#include <driveinfo.h>
+#include <hbtextresolversymbian.h>
+
 #include "castorage.h"
 #include "castorageproxy.h"
 #include "castoragefactory.h"
@@ -107,14 +110,23 @@
     TChangeType changeType = EAddChangeType;
     RArray<TInt> parentArray;
     CleanupClosePushL( parentArray );
-
+          
     if( aEntry->GetId() > 0 )
         {
         changeType = EUpdateChangeType;
         RArray<TInt> id;
         CleanupClosePushL( id );
         id.AppendL( aEntry->GetId() );
-        iStorage->GetParentsIdsL( id, parentArray );
+        if (aItemAppearanceChange == EItemUninstallProgressChanged)
+            {
+            // no need to search for parent parents for uninstall 
+            // progress change
+            iStorage->GetParentsIdsL( id, parentArray, EFalse );
+            }
+        else
+            {
+            iStorage->GetParentsIdsL( id, parentArray );
+            }
         CleanupStack::PopAndDestroy( &id );
         }
 
@@ -126,8 +138,47 @@
         {
         changeType = EAddChangeType;
         }
-
-    iStorage->AddL( aEntry, aUpdate );
+    
+    // do not update entry in db with uninstall progress
+    if (aItemAppearanceChange != EItemUninstallProgressChanged)
+        {
+        RPointerArray<CCaLocalizationEntry> localizations;
+	    CleanupResetAndDestroyPushL( localizations );
+        CCaLocalizationEntry* tempLocalization = NULL;
+        if( aEntry->isLocalized( CCaInnerEntry::ENameLocalized ) )		
+            {
+            tempLocalization = LocalizeTextL( aEntry );
+            if( tempLocalization )
+                {
+                localizations.Append( tempLocalization );
+                tempLocalization = NULL;
+                }
+            }
+        if( aEntry->isLocalized( CCaInnerEntry::EDescriptionLocalized ) )
+            {
+            tempLocalization = LocalizeDescriptionL( aEntry );
+            if (tempLocalization)
+                {
+                localizations.Append(tempLocalization);
+                tempLocalization = NULL;
+                }
+            }
+        
+        iStorage->AddL( aEntry, aUpdate );
+        
+        for( TInt j =0; j < localizations.Count(); j++ )
+            {
+            localizations[j]->SetRowId( aEntry->GetId() );
+            AddLocalizationL( *( localizations[j] ) );
+            }
+		if( localizations.Count() > 0 )
+            {
+            HbTextResolverSymbian::Init( _L(""), KLocalizationFilepathZ );
+            }
+		 CleanupStack::PopAndDestroy( &localizations );
+        }
+    
+        
     for( TInt i = 0; i < iHandlerNotifier.Count(); i++ )
         {
         iHandlerNotifier[i]->EntryChanged( aEntry, changeType, parentArray );
@@ -236,6 +287,8 @@
             iStorage->GetParentsIdsL( id, parentArray );
             for( TInt i = 0; i < iHandlerNotifier.Count(); i++ )
                 {
+                resultArray[0]->SetFlags( 
+                        resultArray[0]->GetFlags() | EUsed );
                 iHandlerNotifier[i]->EntryChanged( resultArray[0],
                         EUpdateChangeType,
                         parentArray );
@@ -272,6 +325,16 @@
 //
 // ---------------------------------------------------------------------------
 //
+EXPORT_C void CCaStorageProxy::AddLocalizationL(
+		const CCaLocalizationEntry& aLocalization)
+	{
+	iStorage->AddLocalizationL(aLocalization);
+	}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
 EXPORT_C void CCaStorageProxy::DbPropertyL( const TDesC& aProperty,
         TDes& aPropertyValue )
     {
@@ -307,6 +370,9 @@
     CleanupStack::PopAndDestroy( &parentArray );
     }
 
+#ifdef COVERAGE_MEASUREMENT
+#pragma CTC SKIP
+#endif //COVERAGE_MEASUREMENT (calls another method)
 // ---------------------------------------------------------------------------
 //
 // ---------------------------------------------------------------------------
@@ -315,6 +381,9 @@
     {
     iStorage->LoadDataBaseFromRomL();
     }
+#ifdef COVERAGE_MEASUREMENT
+#pragma CTC ENDSKIP
+#endif //COVERAGE_MEASUREMENT
 
 // ---------------------------------------------------------
 //
@@ -340,3 +409,150 @@
         iHandlerNotifier.Remove( i );
         }
     }
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+CCaLocalizationEntry* CCaStorageProxy::LocalizeTextL( CCaInnerEntry* aEntry )
+    {
+	CCaLocalizationEntry* result = NULL;
+	TInt textLength = aEntry->GetText().Length();
+	if (textLength > 0)
+		{
+		TChar delimiter = '/'; // cannot add it as global
+		RBuf title;
+		CleanupClosePushL( title );
+		title.CreateL( aEntry->GetText() );
+		TInt pos = title.LocateReverse( delimiter );
+		if ( pos > 0 && pos + 1 < textLength )   // 1 is for delimiters
+			{
+			TPtrC16 logString = title.Mid( pos + 1 ); 
+			TInt qmFileNameLength = textLength - charsToFilename - 1 - logString.Length();
+			TPtrC16 qmFile = title.Mid( charsToFilename, qmFileNameLength );
+			if ( InitializeTranslatorL( qmFile ) )
+				{
+			    result = CCaLocalizationEntry::NewLC();			
+				HBufC* translatedString = HbTextResolverSymbian::LoadLC( logString );
+				if ( translatedString->Compare( logString ) )
+					{
+					result->SetStringIdL( logString );
+					aEntry->SetTextL( *translatedString );
+					if( translatedString )
+						{
+					    CleanupStack::PopAndDestroy( translatedString );
+						}
+					result->SetTableNameL( KLocalizationCaEntry );
+					result->SetAttributeNameL( KLocalizationEnText );
+					result->SetQmFilenameL( qmFile );
+					result->SetRowId( aEntry->GetId() ? 0 : aEntry->GetId() ); // must be added when present
+					CleanupStack::Pop( result );
+					}
+				else 
+					{
+					CleanupStack::PopAndDestroy(translatedString);
+					CleanupStack::PopAndDestroy(result);
+					result = NULL;
+					}
+				}
+			}
+		CleanupStack::PopAndDestroy( &title );
+		}
+	return result;
+	}
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+CCaLocalizationEntry* CCaStorageProxy::LocalizeDescriptionL( CCaInnerEntry* aEntry )
+    {
+	CCaLocalizationEntry* result = NULL;
+	TInt dscLength = aEntry->GetDescription().Length();
+	if ( dscLength )
+		{
+		TChar delimiter = '/'; // cannot add it as global
+		RBuf description;
+		CleanupClosePushL( description );
+		description.CreateL( aEntry->GetDescription() );
+		TInt pos = description.LocateReverse( delimiter );
+		if ( pos > 0 && pos + 1 < dscLength )   // 1 is for delimiters
+			{
+			TPtrC16 logString = description.Mid(pos + 1);
+			TInt qmFileNameLength = dscLength - charsToFilename - 1 - logString.Length();
+			TPtrC16 qmFile = description.Mid(charsToFilename, qmFileNameLength);
+			if ( InitializeTranslatorL( qmFile ) )
+				{
+			    result = CCaLocalizationEntry::NewLC();
+				HBufC* translatedString = HbTextResolverSymbian::LoadLC( logString );
+				if ( translatedString->Compare( logString ) )
+					{
+					result->SetStringIdL( logString );
+					aEntry->SetDescriptionL( *translatedString );
+					CleanupStack::PopAndDestroy( translatedString );
+					result->SetTableNameL( KLocalizationCaEntry );
+					result->SetAttributeNameL( KLocalizationEnDescription );
+					result->SetQmFilenameL( qmFile );
+					result->SetRowId( aEntry->GetId() ? 0 : aEntry->GetId() ); // must be added when present
+					CleanupStack::Pop( result );
+					}
+				else 
+					{
+				    CleanupStack::PopAndDestroy( translatedString );
+				    CleanupStack::PopAndDestroy( result );
+				    result = NULL;
+					}
+				
+				}
+			}
+		CleanupStack::PopAndDestroy( &description );
+		}
+	
+	return result;
+	}
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+TBool CCaStorageProxy::InitializeTranslatorL( TDesC& aQmFilename )
+    {
+	TBool result = HbTextResolverSymbian::Init( aQmFilename, KLocalizationFilepathC );
+	if ( !result )
+		{
+		// this should not be called too often 
+		TChar currentDriveLetter;
+		TDriveList driveList;
+		RFs fs;
+		User::LeaveIfError( fs.Connect() );
+		User::LeaveIfError( fs.DriveList( driveList ) );
+
+		RBuf path;
+		CleanupClosePushL( path );
+		path.CreateL( KLocalizationFilepath().Length() + 1 );
+
+		for ( TInt driveNr = EDriveY; driveNr >= EDriveA; driveNr-- )
+			{
+			if ( driveList[driveNr] )
+				{
+				User::LeaveIfError(fs.DriveToChar( driveNr, currentDriveLetter ));
+				path.Append( currentDriveLetter );
+				path.Append( KLocalizationFilepath );
+				if (HbTextResolverSymbian::Init( aQmFilename, path ))
+					{
+				    result = ETrue;
+					break;
+					}
+				}
+			path.Zero();
+			}
+		CleanupStack::PopAndDestroy( &path );
+		fs.Close();
+		
+		if( !result )
+			{
+		    result = HbTextResolverSymbian::Init( aQmFilename, KLocalizationFilepathZ );
+			}
+		}
+	return result;
+	}
--- a/homescreensrv.pro	Fri Jun 11 16:25:06 2010 +0100
+++ b/homescreensrv.pro	Thu Jul 22 16:37:03 2010 +0100
@@ -16,14 +16,14 @@
 
 TEMPLATE = subdirs
 
-SUBDIRS  += appfoundation \
-            hswidgetmodel \
+SUBDIRS  += hswidgetmodel \
             contentstorage \
             homescreensrv_plat \
             tsrc
 symbian:SUBDIRS += activityfw
+symbian:SUBDIRS += tstaskmonitor
 symbian:SUBDIRS += hsappkeyhandler
-
+symbian:SUBDIRS += tsdevicedialog
 
 CONFIG += ordered
 
--- a/homescreensrv_plat/appruntimemodel_api/appruntimemodel_api.pri	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +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:
-#
-
-PLATFORM_HEADERS += \
-                    appruntimemodel_api/hsiruntimeprovider.h \
-                    appruntimemodel_api/hsruntime.h \
-                    appruntimemodel_api/hsruntimefactory.h \
-                    appruntimemodel_api/hsruntimemodel_global.h
\ No newline at end of file
--- a/homescreensrv_plat/appruntimemodel_api/hsiruntimeprovider.h	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +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:  HsRuntime provider interface.
-*
-*/
-
-
-#ifndef HSIRUNTIMEPROVIDER_H
-#define HSIRUNTIMEPROVIDER_H
-
-#include <QtPlugin>
-#include <QList>
-#include <QString>
-
-/*!
-    \class HsRuntimeToken
-    \ingroup group_hsruntimemodel
-    \brief Represents a home screen runtime that can be created. 
-
-    Home screen runtimes are located in runtime providers. Each provider
-    exposes its contained runtimes as runtime tokens. A token has all
-    the needed information for runtime selection and creation
-        
-*/
-class HsRuntimeToken
-{
-
-public:
-
-/*!
-    The name of the library/plugin that contains the runtime.
-*/
-    QString mLibrary;
-
-/*!
-    Uniquely identifies the runtime.
-*/
-    QString mUri;
-    
-};
-
-class HsRuntime;
-
-/*!
-    \class IHsRuntimeProvider
-    \ingroup group_hsruntimemodel
-    \brief Defines a mechanism for retrieving a home screen runtime.
-    Interface that defines a mechanism for retrieving a home screen
-    runtime. Each home screen runtime provider implements this interface. 
-        
-*/
-class IHsRuntimeProvider
-{
-
-public:
-
-/*!
-    Destructor.    
-*/
-    virtual ~IHsRuntimeProvider() {}
-
-public:
-
-/*!
-    Returns contained runtimes as a list of runtime tokens.    
-*/
-    virtual QList<HsRuntimeToken> runtimes() = 0;
-
-/*!
-    Creates and returns a runtime based on the given token.
-    
-    \a aToken Identifies the runtime to be created.
-
-    Returns The created runtime or null in failure cases.
-*/
-    virtual HsRuntime* createRuntime(const HsRuntimeToken& aToken) = 0;
-
-};
-
-Q_DECLARE_INTERFACE(IHsRuntimeProvider, "com.nokia.homescreen.iruntimeprovider/1.0")
-
-#endif
--- a/homescreensrv_plat/appruntimemodel_api/hsruntime.h	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +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:  Base class for all homescreen runtimes.
-*
-*/
-
-
-#ifndef HSRUNTIME_H
-#define HSRUNTIME_H
-
-#include <QObject>
-
-#include "hsruntimemodel_global.h"
-
-/*! 
-    \class HsRuntime
-    \ingroup group_hsruntimemodel
-    \brief Base class for all home screen runtimes.
-
-    Provides the common functionality for all home screen runtime
-    implementations.
-        
-*/
-class HSRUNTIMEMODEL_EXPORT HsRuntime : public QObject
-{
-    Q_OBJECT
-
-public:
-    HsRuntime(QObject* aParent = 0) : QObject(aParent) {}
-    virtual ~HsRuntime() {}
-
-
-signals:
-/*!
-    Emitted when the runtime has started.         
-*/
-    void started();
-
-/*!
-    Emitted when the runtime has stopped.         
-*/
-    void stopped();
-    
-/*!
-    Emitted when the runtime has faulted.         
-*/
-    void faulted();
-
-
-public slots:
-
-/*!
-    Starts the runtime.         
-*/
-    virtual void start() = 0;
-
-/*!
-    Stops the runtime.         
-*/
-    virtual void stop() = 0;
-
-
-
-private:
-
-    Q_DISABLE_COPY(HsRuntime)
-};
-
-#endif
--- a/homescreensrv_plat/appruntimemodel_api/hsruntimefactory.h	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +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:  HsRuntime factory.
-*
-*/
-
-
-#ifndef HSRUNTIMEFACTORY_H
-#define HSRUNTIMEFACTORY_H
-
-#include <QObject>
-
-#include "hsruntimemodel_global.h"
-#include "hsiruntimeprovider.h"
-
-class HsRuntimeFactoryPrivate;
-
-class HSRUNTIMEMODEL_EXPORT HsRuntimeFactory : public QObject
-{
-    Q_OBJECT
-
-public:
-    HsRuntimeFactory(const QString& aPluginManifestDirectory,
-                 const QString& aPluginDirectory,
-                 QObject* aParent = 0);
-    virtual ~HsRuntimeFactory();
-
-    QList<HsRuntimeToken> runtimes();
-    HsRuntime* createRuntime(const HsRuntimeToken& aToken);
-
-private:
-    Q_DISABLE_COPY(HsRuntimeFactory)
-
-private:
-    HsRuntimeFactoryPrivate* mD;
-    friend class HsRuntimeFactoryPrivate;
-
-};
-
-#endif
--- a/homescreensrv_plat/appruntimemodel_api/hsruntimemodel_global.h	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +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:  The dll header file.
-*
-*/
-
-
-#ifndef HSRUNTIMEMODEL_GLOBAL_H
-#define HSRUNTIMEMODEL_GLOBAL_H
-
-#include <Qt/qglobal.h>
-
-
-#ifdef HSRUNTIMEMODEL_LIB
-	#define HSRUNTIMEMODEL_EXPORT Q_DECL_EXPORT
-#else
-    #ifdef HSRUNTIMEMODEL_TEST
-        #define HSRUNTIMEMODEL_EXPORT
-    #else
-        #define HSRUNTIMEMODEL_EXPORT Q_DECL_IMPORT
-    #endif	
-#endif
-
-
-#endif // HSRUNTIMEMODEL_GLOBAL_H
--- a/homescreensrv_plat/contentstorage_api/cadefs.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/homescreensrv_plat/contentstorage_api/cadefs.h	Thu Jul 22 16:37:03 2010 +0100
@@ -49,13 +49,20 @@
 enum EntryFlag
 {
     UsedEntryFlag = 1,
-    SystemEntryFlag = 2,
+    UninstallEntryFlag = 2,
     RemovableEntryFlag = 4,
     VisibleEntryFlag = 8,
     RunningEntryFlag = 16,
     NativeEntryFlag = 32,
     MissingEntryFlag = 64
 };
+
+enum LocalizationType
+{
+    NameLocalized,
+    DescriptionLocalized
+};
+
 Q_DECLARE_FLAGS(EntryFlags, EntryFlag)
 Q_DECLARE_OPERATORS_FOR_FLAGS(EntryFlags)
 Q_DECLARE_METATYPE(EntryFlags)
@@ -70,7 +77,8 @@
     UnknownErrorCode
 };
 
-const QString caCmdOpen("open");
+static const QString caCmdOpen("open");
+static const QString caCmdRemove("remove");
 
 #ifndef QT_NO_DEBUG_OUTPUT
 #   define USE_QDEBUG_IF(predicate) if (!predicate) {} else qDebug()
--- a/homescreensrv_plat/contentstorage_api/caentry.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/homescreensrv_plat/contentstorage_api/caentry.h	Thu Jul 22 16:37:03 2010 +0100
@@ -47,10 +47,10 @@
     int id() const;
 
     QString text() const;
-    void setText(const QString &text);
+    void setText(const QString &text, bool localized = false);
 
     QString description() const;
-    void setDescription(const QString &text);
+    void setDescription(const QString &text, bool localized = false);
     
     CaIconDescription iconDescription() const;
     void setIconDescription(const CaIconDescription &iconDescription);
@@ -76,6 +76,7 @@
 private:
 
     void setId(int id);
+    bool isLocalized(LocalizationType localized) const; 
 
 private:
     /*!
--- a/homescreensrv_plat/contentstorage_api/caitemmodel.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/homescreensrv_plat/contentstorage_api/caitemmodel.h	Thu Jul 22 16:37:03 2010 +0100
@@ -48,7 +48,8 @@
         TypeRole,
         FlagsRole,
         TextRole,//contains title represented as QString,
-        FullTextRole //'title description' convinient for operations such as search
+        FullTextRole, //'title description' convinient for operations such as search
+        UninstalRole  //contains progress status as decimal number in QString
     };
 
     // Function declarations
@@ -81,6 +82,7 @@
 
     void scrollTo(int row, QAbstractItemView::ScrollHint hint =
         QAbstractItemView::EnsureVisible);
+    void empty(bool value);
 
 protected:
     // data
--- a/homescreensrv_plat/contentstorage_api/caquery.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/homescreensrv_plat/contentstorage_api/caquery.h	Thu Jul 22 16:37:03 2010 +0100
@@ -40,6 +40,9 @@
     void setParentId(int id);
     int parentId() const;
 
+    void setChildId(int id);
+    int childId() const;
+
     void setEntryTypeNames(const QStringList &entryTypeNames);
     QStringList entryTypeNames() const;
 
--- a/homescreensrv_plat/contentstorage_api/caservice.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/homescreensrv_plat/contentstorage_api/caservice.h	Thu Jul 22 16:37:03 2010 +0100
@@ -92,9 +92,9 @@
     bool prependEntriesToGroup(const CaEntry &group,
         const QList< QSharedPointer<CaEntry> > &entryList) const;
 
-    bool executeCommand(int entryId, const QString &command = 
+    int executeCommand(int entryId, const QString &command = 
         caCmdOpen) const;
-    bool executeCommand(const CaEntry &entry, const QString &command =
+    int executeCommand(const CaEntry &entry, const QString &command =
         caCmdOpen) const;
 
     CaNotifier * createNotifier(const CaNotifierFilter &filter) const;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homescreensrv_plat/contentstorage_api/casoftwareregistry.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,83 @@
+/*
+ * 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 QStringList;
+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;
+    
+    bool getUninstallDetails(int componentId,
+        QString &componentName,
+        QStringList &applicationsUids,
+        QString &confirmationMessage);
+    
+    bool getApplicationsUids(int componentId, QStringList &applicationsUids);
+    
+    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 Jun 11 16:25:06 2010 +0100
+++ b/homescreensrv_plat/contentstorage_api/contentstorage_api.pri	Thu Jul 22 16:37:03 2010 +0100
@@ -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 Jun 11 16:25:06 2010 +0100
+++ b/homescreensrv_plat/homescreen_information_api/inc/homescreendomainpskeys.h	Thu Jul 22 16:37:03 2010 +0100
@@ -18,34 +18,42 @@
 #ifndef HOMESCREEN_DOMAIN_PS_KEYS_H
 #define HOMESCREEN_DOMAIN_PS_KEYS_H
 
-/**
- * P&S Key path for all Home Screen information keys provided by this API.
- */
+
+/*!
+    \file homescreendomainpskeys.h
+    \brief 
+*/
+
+/*!
+    P&S Key path for all Home Screen information keys provided by this API.
+*/
 const char HsStatePSKeyPath[] = "/homescreen";
 
-/**
- * P&S Key sub path to represent the state of the Home Screen. This property is updated when
- * Home screen state is changed. Valid values are defined by the enum EPSHsState.
- *
- * @see EPSHsState
- */
+/*!
+    P&S Key sub path to represent the state of the Home Screen. This property is updated when
+    Home screen state is changed. Valid values are defined by the enum EPSHsState.
+    
+    @see EPSHsState
+*/
 const char HsStatePSKeySubPath[] = "state";
 
-/**
- * Home Screen P&S category Uid for pure Symbian usage.
- */
+#if defined(__SYMBIAN32__) || defined(SYMBIAN) 
+/*!
+    Home Screen P&S category Uid for pure Symbian usage.
+*/
 const TUid KHsCategoryUid = { 0x20022F35 };
 
-/**
- * P&S Key to represent the state of the Home Screen for pure Symbian usage.
- * This property is updated when Home screen state is changed. Valid values 
- * are defined by the enum EPSHsState.
- */
+/*!
+    P&S Key to represent the state of the Home Screen for pure Symbian usage.
+    This property is updated when Home screen state is changed. Valid values
+    are defined by the enum EPSHsState.
+*/
 const TUint KHsCategoryStateKey = 0x1;
+#endif //SYMBIAN
 
-/**
- * Home screen state.
- */
+/*!
+    Home screen state.
+*/
 enum EPSHsState
      {
      /**
--- a/homescreensrv_plat/homescreensrv_plat.pro	Fri Jun 11 16:25:06 2010 +0100
+++ b/homescreensrv_plat/homescreensrv_plat.pro	Thu Jul 22 16:37:03 2010 +0100
@@ -17,15 +17,12 @@
 TEMPLATE = subdirs
 BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include <platform_paths.hrh>"
 
-include(appruntimemodel_api/appruntimemodel_api.pri)
 include(contentstorage_api/contentstorage_api.pri)
 include(hswidgetmodel_api/hswidgetmodel_api.pri)
-include(statemodel_api/statemodel_api.pri)
 include(menu_sat_interface_api/menu_sat_interface_api.pri)
 include(homescreen_information_api/homescreen_information_api.pri)
+include(taskswitcher_api/taskswitcher_api.pri)
 
 for(filename,PLATFORM_HEADERS){
     BLD_INF_RULES.prj_exports *= "$$filename MW_LAYER_PLATFORM_EXPORT_PATH($$basename(filename))"
   }
-
-
--- a/homescreensrv_plat/hswidgetmodel_api/hsipreferencestore.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/homescreensrv_plat/hswidgetmodel_api/hsipreferencestore.h	Thu Jul 22 16:37:03 2010 +0100
@@ -18,11 +18,10 @@
 #ifndef HSIPREFERENCESTORE_H
 #define HSIPREFERENCESTORE_H
 
-
 class QString;
 
-/*!
-    \ingroup group_hscontentmodel group_widget_api_candidates
+
+/*DEPRECATED
     \class IHsPreferenceStore
     \brief Interface class for preference store.
 
@@ -74,7 +73,4 @@
 
 };
 
-
-
-
 #endif
--- a/homescreensrv_plat/hswidgetmodel_api/hsiwidgetprovider.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/homescreensrv_plat/hswidgetmodel_api/hsiwidgetprovider.h	Thu Jul 22 16:37:03 2010 +0100
@@ -25,15 +25,15 @@
 #include <QVariant>
 #include <QMetaType>
 
-/*!
+
+/*DEPRECATED
     \class HsWidgetToken
-    \ingroup group_hswidgetmodel group_widget_api_candidates
+    \ingroup group_hswidgetmodel_api
     \brief Represents a home screen widget that can be created. 
 
     Home screen widgets are located in widget providers. Each provider
     exposes its contained widgets as widget tokens. A token has all
     the needed information for widget selection and creation.
-
 */
 class HsWidgetToken
 {
@@ -82,7 +82,7 @@
 
 class HsWidget;
 
-/*!
+/*DEPRECATED
     \class IHsWidgetProvider
     \ingroup group_hswidgetmodel group_widget_api_candidates
     \brief Defines a mechanism for retrieving a home screen widget.
@@ -114,10 +114,7 @@
 
 };
 
-
-
 Q_DECLARE_METATYPE(HsWidgetToken)
 Q_DECLARE_INTERFACE(IHsWidgetProvider, "com.nokia.homescreen.iwidgetprovider/1.0")
 
-
 #endif
--- a/homescreensrv_plat/hswidgetmodel_api/ihswidgetpreferenceservice.h	Fri Jun 11 16:25:06 2010 +0100
+++ b/homescreensrv_plat/hswidgetmodel_api/ihswidgetpreferenceservice.h	Thu Jul 22 16:37:03 2010 +0100
@@ -22,7 +22,7 @@
 class QString;
 class HsWidget;
 
-/**
+/*DEPRECATED
  * @ingroup group_hswidgetmodel group_widget_api_candidates
  * @brief Preference store for widget.
  *
--- a/homescreensrv_plat/statemodel_api/hsistateprovider.h	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +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:  State provider interface.
-*
-*/
-
-
-#ifndef HSISTATEPROVIDER_H
-#define HSISTATEPROVIDER_H
-
-#include <QtPlugin>
-#include <QList>
-#include <QString>
-
-class QState;
-
-/*!
-    \class HsStateToken
-    \ingroup group_hsstatemodel
-    \brief Represents a home screen state that can be created.
-    Home screen states are located in state providers. Each provider
-    exposes its contained states as state tokens. A token has all
-    the needed information for state selection and creation.
-*/
-class HsStateToken
-{
-
-public:
-
-/*!
-    The name of the library/plugin that contains the state.
- */
-QString mLibrary;
-
-/*!
-    Uniquely identifies the state.
-*/
-    QString mUri;
-
-};
-
-/*!
-    \class IHsStateProvider
-    \ingroup group_hsstatemodel
-    \brief Defines a mechanism for retrieving a home screen state.
-    Interface that defines a mechanism for retrieving a home screen
-    state. Each home screen state provider implements this interface.
-*/
-class IHsStateProvider
-{
-
-public:
-
-/*!
-    Destructor.    
-*/
-    virtual ~IHsStateProvider() {}
-
-public:
-
-/*!
-    Returns contained states as a list of state tokens.    
-*/
-    virtual QList<HsStateToken> states() = 0;
-
-/*!
-    Creates and returns a state based on the given token.
-    \a aToken Identifies the state to be created.
-
-    Returns The created state or null in failure cases.
-*/
-    virtual QState* createState(const HsStateToken& aToken) = 0;
-
-};
-
-Q_DECLARE_INTERFACE(IHsStateProvider, "com.nokia.homescreen.istateprovider/1.0")
-
-#endif
--- a/homescreensrv_plat/statemodel_api/hsstatefactory.h	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +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:  State factory.
-*
-*/
-
-
-#ifndef HSSTATEFACTORY_H
-#define HSSTATEFACTORY_H
-
-#include <QObject>
-
-#include "hsstatemodel_global.h"
-#include "hsistateprovider.h"
-
-class QState;
-class HsStateFactoryPrivate;
-
-class HSSTATEMODEL_EXPORT HsStateFactory : public QObject
-{
-    Q_OBJECT
-
-public:
-    HsStateFactory(const QString& aPluginManifestDirectory,
-                 const QString& aPluginDirectory,
-                 QObject* aParent = 0);
-
-    virtual ~HsStateFactory();
-
-    QList<HsStateToken> states();
-    QState* createState(const HsStateToken& aToken);
-
-private:
-
-    Q_DISABLE_COPY(HsStateFactory)
-
-private:
-    HsStateFactoryPrivate* mD;
-    friend class HsStateFactoryPrivate;
-
-};
-
-#endif
--- a/homescreensrv_plat/statemodel_api/hsstatemodel_global.h	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +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:  The dll header file.
-*
-*/
-
-
-#ifndef HSSTATEMODEL_GLOBAL_H
-#define HSSTATEMODEL_GLOBAL_H
-
-#include <Qt/qglobal.h>
-
-
-#ifdef HSSTATEMODEL_LIB
-	#define HSSTATEMODEL_EXPORT Q_DECL_EXPORT
-#else
-    #ifdef HSSTATEMODEL_TEST
-        #define HSSTATEMODEL_EXPORT
-    #else
-        #define HSSTATEMODEL_EXPORT Q_DECL_IMPORT
-    #endif	
-#endif
-
-
-#endif // HSSTATEMODEL_GLOBAL_H
--- a/homescreensrv_plat/statemodel_api/statemodel_api.pri	Fri Jun 11 16:25:06 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +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:
-#
-
-PLATFORM_HEADERS += \
-                    statemodel_api/hsistateprovider.h \
-                    statemodel_api/hsstatefactory.h \
-                    statemodel_api/hsstatemodel_global.h
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homescreensrv_plat/taskswitcher_api/taskswitcher_api.pri	Thu Jul 22 16:37:03 2010 +0100
@@ -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:
+#
+
+PLATFORM_HEADERS += taskswitcher_api/tstasksettings.h \
+                    taskswitcher_api/tspropertydefs.h \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homescreensrv_plat/taskswitcher_api/tspropertydefs.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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 TSPROPERTYDEFS_H
+#define TSPROPERTYDEFS_H
+
+namespace TsProperty {
+
+#if defined(Q_OS_SYMBIAN)
+    const TUid KCategory = {0x20022fc5};
+    const TUint KVisibilityKey = 0x2002677F;
+#endif    
+    const char KTsPath[] = "/TaskSwitcher";
+    const char KVisibilityPath[] = "Visibility";
+
+}
+
+#endif // TSPROPERTYDEFS_H
+    
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homescreensrv_plat/taskswitcher_api/tstasksettings.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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 TSTASKSETTINGS_H
+#define TSTASKSETTINGS_H
+
+#include <QPixmap>
+
+#include "tstaskmonitor_global.h"
+
+class TsTaskSettingsPrivate;
+
+class TSTASKMONITOR_EXPORT TsTaskSettings
+{
+    
+public:
+    TsTaskSettings();
+    ~TsTaskSettings();
+    
+    bool registerScreenshot(const QPixmap &screenshot);
+    bool unregisterScreenshot();
+    bool setVisibility(bool);
+    
+private:
+    TsTaskSettingsPrivate *d_ptr;   
+};
+
+#endif //TSTASKSETTINGS_H
--- a/hsappkeyhandler/group/hsappkeyplugin.mmp	Fri Jun 11 16:25:06 2010 +0100
+++ b/hsappkeyhandler/group/hsappkeyplugin.mmp	Thu Jul 22 16:37:03 2010 +0100
@@ -34,7 +34,7 @@
 
 USERINCLUDE ../inc
 
-APP_LAYER_SYSTEMINCLUDE
+MW_LAYER_SYSTEMINCLUDE
 
 
 LIBRARY ecom.lib
--- a/hswidgetmodel/src/hswidget.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/hswidgetmodel/src/hswidget.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -20,7 +20,7 @@
 #include "hswidget_p.h"
 #include "ihswidgetpreferenceservice.h"
 
-/*!
+/*DEPRECATED
     \ingroup group_hswidgetmodel group_widget_api_candidates
     \class HsWidget
     \brief Base class for all home screen widgets.
--- a/hswidgetmodel/src/hswidgetfactory.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/hswidgetmodel/src/hswidgetfactory.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -28,7 +28,7 @@
 
 
 
-/*!
+/*DEPRECATED
     \class HsPluginUnloader
     \ingroup group_hswidgetmodel
     \brief Unloads plugin and deletes plugin loader.
@@ -63,7 +63,7 @@
     }
 }
 
-/*!
+/*DEPRECATED
     \class HsWidgetFactory 
     \ingroup group_hswidgetmodel
     \brief Finds and creates home screen widgets.
--- a/hswidgetmodel/src/hswidgetprovidermanifest.cpp	Fri Jun 11 16:25:06 2010 +0100
+++ b/hswidgetmodel/src/hswidgetprovidermanifest.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -23,7 +23,7 @@
 #include "hstest_global.h"
 
 
-/**
+/*DEPRECATED
     \class HsWidgetProviderManifest
     \ingroup group_hswidgetmodel
     \brief Loads home screen widget tokens from an XML manifest file.
--- a/rom/homescreensrv_core.iby	Fri Jun 11 16:25:06 2010 +0100
+++ b/rom/homescreensrv_core.iby	Thu Jul 22 16:37:03 2010 +0100
@@ -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 )
@@ -51,14 +52,6 @@
 
 data=ZPRIVATE\20022F90\castorage.db          private\20022F90\castorage.db
 
-// ---- appfoundation --------------------------------------------
-
-// -------- statemodel
-file=ABI_DIR\BUILD_DIR\statemodel.dll       SHARED_LIB_DIR\statemodel.dll
-
-// -------- appruntimemodel
-file=ABI_DIR\BUILD_DIR\appruntimemodel.dll  SHARED_LIB_DIR\appruntimemodel.dll
-
 // ----  hswidgetmodel --------------------------------------------
 file=ABI_DIR\BUILD_DIR\hswidgetmodel.dll    SHARED_LIB_DIR\hswidgetmodel.dll
 
--- a/sis/homescreensrv.pkg	Fri Jun 11 16:25:06 2010 +0100
+++ b/sis/homescreensrv.pkg	Thu Jul 22 16:37:03 2010 +0100
@@ -138,18 +138,11 @@
 "/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"
 
-; ---- appfoundation --------------------------------------------
-
-; -------- statemodel
-"/epoc32/release/armv5/urel/statemodel.dll" - "c:/sys/bin/statemodel.dll"
-
-; -------- appruntimemodel
-"/epoc32/release/armv5/urel/appruntimemodel.dll" - "c:/sys/bin/appruntimemodel.dll"
-
 ; ----  hswidgetmodel --------------------------------------------
 "/epoc32/release/armv5/urel/hswidgetmodel.dll" - "c:/sys/bin/hswidgetmodel.dll"
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/common.pri	Thu Jul 22 16:37:03 2010 +0100
@@ -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: taskswitcherapp project - common QMake settings
+#
+
+CONFIG += debug_and_release
+
+# On win32 and mac, debug and release libraries are named differently.
+# We must follow the debug and release settings Qt was compiled with:
+# build debug iff Qt built debug, build release iff Qt built release.
+win32|mac {
+    !contains(QT_CONFIG,debug)|!contains(QT_CONFIG,release) {
+        CONFIG -= debug_and_release debug release
+        contains(QT_CONFIG,debug):  CONFIG+=debug
+        contains(QT_CONFIG,release):CONFIG+=release
+    }
+}
+
+CONFIG(debug, debug|release) {
+    SUBDIRPART = debug
+} else {
+    SUBDIRPART = release
+}
+
+win32: OUTPUT_DIR = $$PWD/../../bin/$$SUBDIRPART
+symbian: OUTPUT_DIR = $$PWD/bin
+
+#test whether we have a unit test
+!testcase {
+    OBJECTS_DIR = $$OUTPUT_DIR/tmp/$$TARGET
+    DESTDIR = $$OUTPUT_DIR
+    MOC_DIR = $$OUTPUT_DIR/tmp/$$TARGET/moc
+    RCC_DIR = $$OUTPUT_DIR/tmp/$$TARGET/rcc
+    UI_DIR = $$OUTPUT_DIR/tmp/$$TARGET/ui
+} else { # test part is NOT DONE
+    QT *= testlib
+    CONFIG += console
+    CONFIG -= app_bundle
+    OBJECTS_DIR = $$OUTPUT_DIR/tests/tmp/$$TARGET
+    DESTDIR = $$OUTPUT_DIR
+    MOC_DIR = $$OUTPUT_DIR/tests/tmp/$$TARGET/moc
+    RCC_DIR = $$OUTPUT_DIR/tests/tmp/$$TARGET/rcc
+    UI_DIR = $$OUTPUT_DIR/tests/tmp/$$TARGET/ui
+    coverage {
+        DEFINES += COVERAGE_MEASUREMENT
+        DEFINES += QT_NO_DEBUG  # omit ASSERTS in coverage measurements
+    }    
+}
+
+# Add the output dirs to the link path too
+LIBS += -L$$DESTDIR
+
+#For some reason the default include path doesn't include MOC_DIR on symbian
+symbian {
+    INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+    INCLUDEPATH += $$MOC_DIR
+    TARGET.CAPABILITY = ALL -TCB
+    TARGET.EPOCALLOWDLLDATA=1
+}
+
+win32 {
+    # add platfrom API for windows
+    INCLUDEPATH += \
+                $$PWD/../../homescreensrv/homescreensrv_plat/contentstorage_api \
+                $$PWD/../../homescreensrv/homescreensrv_plat/hswidgetmodel_api \
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/rom.pri	Thu Jul 22 16:37:03 2010 +0100
@@ -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:
+#
+
+BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include <platform_paths.hrh>"
+BLD_INF_RULES.prj_exports += "rom/tsapplication_core.iby  CORE_APP_LAYER_IBY_EXPORT_PATH(tsapplication_core.iby)"
+BLD_INF_RULES.prj_exports += "rom/tsapplication_resources.iby  LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(tsapplication_resources.iby)"
+BLD_INF_RULES.prj_exports += "./sis/stubs/taskswitcher_stub.sis  /epoc32/release/winscw/udeb/z/system/install/taskswitcher_stub.sis"
+BLD_INF_RULES.prj_exports += "./sis/stubs/taskswitcher_stub.sis  /epoc32/data/z/system/install/taskswitcher_stub.sis"
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/rom/tsapplication_core.iby	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef __TSAPP_CORE_IBY__
+#define __TSAPP_CORE_IBY__
+
+file=ABI_DIR\BUILD_DIR\tsdevicedialogplugin.dll					       SHARED_LIB_DIR\tsdevicedialogplugin.dll
+data=\epoc32\data\z\resource\plugins\devicedialogs\tsdevicedialogplugin.qtplugin    resource\plugins\devicedialogs\tsdevicedialogplugin.qtplugin
+
+// stub sis
+data=ZSYSTEM/install/taskswitcher_stub.sis                  system/install/taskswitcher_stub.sis
+
+// qcrml
+data=\epoc32\data\z\resource\qt\crml\tsdevicedialog.qcrml   resource\qt\crml\tsdevicedialog.qcrml
+
+#endif //__TSAPP_CORE_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/rom/tsapplication_resources.iby	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef __TSAPP_LANGUAGE_IBY__
+#define __TSAPP_LANGUAGE_IBY__
+
+// -------- hsapplication
+data=DATAZ_\resource\qt\translations\taskswitcher.qm resource\qt\translations\taskswitcher.qm 
+
+#endif //__TSAPP_LANGUAGE_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/sis/buildSis.cmd	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,39 @@
+@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
+@echo off
+setlocal EnableDelayedExpansion
+set openpar=(
+set closepar=)
+
+if exist *.sis* ( del *.sis* )
+if exist tmp.pkg ( del tmp.pkg )
+
+copy /Y taskswitcher.pkg tmp.pkg > NUL
+
+echo Creating sis for each component:
+for /R .. %%i IN (*_template.pkg) DO set tmpname=%%~ni && set modulename=!tmpname:~0,-10!&& call createpackage %%i release-armv5 cert.cer key.pem > NUL && set sisname=%%~dpi!modulename!_release-armv5.sis && if exist !sisname! ( echo [SUCCEEDED] !modulename! [SUCCEEDED] && move !sisname! . && FOR /F "eol=( tokens=4 delims=({}" %%j IN (%%i) DO FOR /F "tokens=1 delims=)" %%k IN ("%%j") DO echo @"!modulename!_release-armv5.sis",!openpar!%%k!closepar! >> tmp.pkg ) else ( echo [FAILED] !modulename! [FAILED] )
+
+REM echo.
+
+echo Embedding all sis files into single sis
+makesis tmp.pkg taskswitcher.sis >NUL
+signsis taskswitcher.sis taskswitcher.sisx cert.cer key.pem >NUL
+
+echo Cleaning up
+del tmp.pkg
+del taskswitcher.sis
+del *_release-armv5.sis*
+pause
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/sis/edit_pkg.pl	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,225 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: 
+#
+#Options:
+# -version  -adds Qt version (4,6,0) intp pkg files
+# -target  -replaces $(PLATFORM)/$(TARGET) into armv5/urel
+# -module  -creates script for module tests sis
+# -module  -delete module tests pkg
+# default -version
+
+use strict;
+use File::Find;
+my $base = `cd`;
+$base =~ s/\\\w+\s+$//; #move one dir upper 
+my $modulebase = `cd`;
+$modulebase =~s/(\s+)$//; #remove linefeed from end
+print $base;;
+my $qtversion = "\, 4\, 6\, 0\,";
+my $target = "armv5\/urel";
+
+my $qtversionchnage = 0;
+my $qtversionarg = "-version";
+my $targetchnage = 0;
+my $targetarg = "-target";
+my $module = 0;
+my $modulearg = "-module";
+my $delmodule = 0;
+my $delmodulearg = "-delmodule";
+my $moduledir = "modulesis";
+my $modulepath = $base."\\".$moduledir;
+my $ccert = $modulebase."\\"."cert.cer";
+my $ckey = $modulebase."\\"."key.pem";
+my $modulebatpath = $modulebase."\\".$moduledir."\\createmodulesis.bat"; 
+
+checkCmdLine();
+
+if ( $qtversionchnage == 1 || $targetchnage == 1 )
+	{
+	find( \&edits, $base );
+	}
+if ( $module == 1 )
+	{
+	system "mkdir $moduledir";
+	if ( not ( open (FWM, ">$modulebatpath") ) )
+		{
+		print "\n***Error: Couldn't open $modulebatpath file to write\n";
+		return;
+		}
+	binmode FWM;
+	print FWM "del /S/Q *.SIS\r\n";
+	print FWM "del /S/Q *.SISX\r\n";
+	close FWM;	
+	find( \&moduleSis, $base );
+	}	
+if ( $delmodule == 1 )
+	{
+	find( \&delModuleSis, $base );
+	}	
+
+sub edits() 
+	{
+	my $file=$_;
+	my $winpath=$File::Find::name;
+	$winpath=~s/\//\\/g;
+	if( -f $file  && $file=~/(_template\.pkg)$/i ) 
+		{
+		print "$winpath ";
+		system "attrib -R $winpath";
+		if ( not ( open (FR, $winpath) ) )
+			{
+			print "Error: Couldn't open $winpath file to read\n";
+			return;
+			}
+		binmode FR;
+		my $buf="";
+		my $length = 0;
+		$length = -s $winpath;
+		read( FR, $buf, $length );
+		close FR;
+		if ( $qtversionchnage == 1 )
+			{
+			$buf =~s/\,\s*\,\s*\,\s*\,\s*\{\"Qt\"\}/$qtversion \{\"Qt\"\}/si;
+			}
+		if ( $targetchnage == 1 )
+			{
+			$buf =~s/\$\(PLATFORM\)\/\$\(TARGET\)/$target/si;
+			}
+	    
+	    if ( not ( open (FW, ">$winpath") ) )
+			{
+			print "\n***Error: Couldn't open $winpath file to write\n";
+			return;
+			}
+		binmode FW;		
+		print FW $buf;
+	    close FW;		
+		
+		print "\r\n";
+		}
+	}
+
+sub checkCmdLine()
+	{
+	my $numArgs = $#ARGV + 1;
+	if ( $numArgs == 0 )
+		{
+		$qtversionchnage = 1;
+		}
+	else
+		{
+		foreach my $argnum ( 0 .. $#ARGV ) 
+			{
+			my $argName = lc $ARGV[$argnum];
+			if ( $argName eq $qtversionarg )
+				{
+				$qtversionchnage = 1;
+				}
+			elsif ( $argName eq $targetarg )
+				{
+				$targetchnage = 1;
+				}
+			elsif ( $argName eq $modulearg )
+				{
+				$module = 1;
+				}
+			elsif ( $argName eq $delmodulearg )
+				{
+				$delmodule = 1;
+				}
+			else
+				{
+				die "\n***Error: Bad arguments\n";
+				}
+			}
+		}
+	}
+	
+sub moduleSis()
+	{
+	my $file=$_;
+	my $winpath=$File::Find::name;
+	$winpath=~s/\//\\/g;	
+
+	
+	if( -f $file  && $file=~/(_template\.pkg)$/i && ( $file=~/^(t_)/i || $file=~/test/i ) ) 
+		{
+		print "$winpath ";
+		system "attrib -R $winpath";
+		if ( not ( open (FR, $winpath) ) )
+			{
+			print "Error: Couldn't open $winpath file to read\n";
+			return;
+			}
+		binmode FR;
+		my $buf="";
+		my $length = 0;
+		$length = -s $winpath;
+		read( FR, $buf, $length );
+		close FR;
+		$buf =~s/\,\s*\,\s*\,\s*\,\s*\{\"Qt\"\}/$qtversion \{\"Qt\"\}/si;
+		$buf =~s/\$\(PLATFORM\)\/\$\(TARGET\)/$target/si;
+	    
+	    if ( not ( open (FW, ">$winpath") ) )
+			{
+			print "Error: Couldn't open $winpath file to write\n";
+			return;
+			}
+		binmode FW;		
+		print FW $buf;
+	    close FW;				
+		print "\r\n";
+		
+		my $pkgname = sisName( $winpath );
+		
+		if ( not ( open (FWM2, ">>$modulebatpath") ) )
+			{			
+			print "Error: Couldn't open $modulebatpath file to append\n";
+			return;
+			}
+		binmode FWM2;		
+		print FWM2 "makesis $winpath $pkgname\.SIS\r\n";
+		print FWM2 "signsis $pkgname\.SIS $pkgname\.SISX $ccert $ckey\r\n";
+		close FWM2;	
+		}	
+	}
+		
+sub sisName()
+	{
+	my $path = shift;
+	my $name = "";
+	if ( $path =~ /\\(\w+)\.pkg/i )
+		{
+		$name = $1;
+		}
+	return $name;
+	}
+	
+sub delModuleSis()
+	{
+	my $file=$_;
+	my $winpath=$File::Find::name;
+	$winpath=~s/\//\\/g;	
+
+	
+	if( -f $file  && $file=~/(_template\.pkg)$/i && ( $file=~/^(t_)/i || $file=~/test/i ) ) 
+		{
+		print "Deleting: ";
+		print "$winpath ";
+		system "attrib -R $winpath";
+		system "del /S/Q $winpath";
+		print "\r\n";
+		}	
+	}	
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/sis/stubs/createstubs.bat	Thu Jul 22 16:37:03 2010 +0100
@@ -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/tsdevicedialog/sis/stubs/taskswitcher_stub.pkg	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,39 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description: 
+;
+; ------------------------------------------------------------------------------
+; Taskswitcher stub SIS package file.
+; Used to enable Taskswitcher to be updated from ROM with a SIS package.
+; When you add new files into this stub, please remember to update
+; SIS stub with "makesis -s" command.
+; ------------------------------------------------------------------------------
+;
+;Language - standard language definitions
+&EN
+
+; standard SIS file header
+#{"taskswitcher"},(0x2002677F),1,0,0,TYPE=SA
+
+;Localized Vendor Name
+%{"Nokia"}
+
+;Unique Vendor name
+:"Nokia"
+
+""-"Z:\resource\qt\translations\taskswitcher.qm"
+""-"Z:\resource\qt\crml\tsexternalactivation.qcrml"
+
+""-"Z:\sys\bin\tsdevicedialogplugin.dll"
+""-"Z:\resource\plugins\devicedialogs\tsdevicedialogplugin.qtplugin"
Binary file tsdevicedialog/sis/stubs/taskswitcher_stub.sis has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/sis/taskswitcher.pkg	Thu Jul 22 16:37:03 2010 +0100
@@ -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: 
+;
+
+;Language - standard language definitions
+&EN
+
+; standard SIS file header
+#{"taskswitcher"},(0x2002677F),1,0,0,TYPE=SA, RU
+
+;Localized Vendor Name
+%{"Nokia"}
+
+;Unique Vendor name
+:"Nokia"
+
+"/epoc32/data/z/resource/qt/translations/taskswitcher.qm"-"!:\resource\qt\translations\taskswitcher.qm"
+"/epoc32/data/z/resource/qt/crml/tsexternalactivation.qcrml"-"!:\resource\qt\crml\tsexternalactivation.qcrml"
+
+"/epoc32/release/armv5/urel/tsdevicedialogplugin.dll"-"!:\sys\bin\tsdevicedialogplugin.dll"
+"/epoc32/data/z/resource/plugins/devicedialogs/tsdevicedialogplugin.qtplugin"-"!:\resource\plugins\devicedialogs\tsdevicedialogplugin.qtplugin"
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialog.pro	Thu Jul 22 16:37:03 2010 +0100
@@ -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 = subdirs
+
+coverage {
+    SUBDIRS += ../activityfw
+    SUBDIRS += ../hsappkeyhandler
+    SUBDIRS += ../tstaskmonitor
+}
+
+SUBDIRS += tsdevicedialogplugin
+
+tests {
+    SUBDIRS += internal/tstestrunner    
+    SUBDIRS += tsdevicedialogplugin/tsrc
+    SUBDIRS += ../activityfw/activityserviceplugin/tsrc
+    SUBDIRS += ../activityfw/storage/client/t_afstorageclient
+    SUBDIRS += ../hsappkeyhandler/tsrc/t_hsappkeyhandler
+    SUBDIRS += ../tstaskmonitor/client/tsrc
+    SUBDIRS += ../tstaskmonitor/server/tsrc
+    SUBDIRS += ../tstaskmonitor/screenshotplugin/tsrc
+    SUBDIRS += ../activityfw/tsutils/tsrc
+    SUBDIRS += ../tstaskmonitor/utils/tsrc
+    SUBDIRS += ../tstaskmonitor/backstepping/tsrc
+}
+
+symbian:include(rom.pri)
+
+CONFIG += ordered
Binary file tsdevicedialog/tsdevicedialogplugin/conf/tsdevicedialog.confml has changed
Binary file tsdevicedialog/tsdevicedialogplugin/conf/tsdevicedialog_2002677F.crml has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/inc/tsactivitymodelitem.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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: tsactivitymodelitem.h
+*
+*/
+
+#ifndef TSACTIVITYMODELITEM_H
+#define TSACTIVITYMODELITEM_H
+#include "tsmodelitem.h"
+#include <qvariant.h>
+#include <qicon.h>
+/*!
+    Implements model item which represents Activity entry
+*/
+class TsActivityModelItem : public TsModelItem
+{
+    Q_OBJECT
+public:
+    TsActivityModelItem(QAbstractListModel &model, QObject &service, const QVariantHash &activity);
+    ~TsActivityModelItem();
+    QVariant data(int role) const;
+    void close();
+    void open();
+    static QString applicationKeyword();
+    static QString visibilityKeyword();
+    static QString screenshotKeyword();
+
+private:
+    QVariant decorationRole() const;
+    QVariant displayRole() const;
+    QVariant visibilityRole() const;
+
+private slots:
+    void thumbnailReady(QPixmap, void *);
+signals:
+    void entryChanged(TsModelItem *);
+
+private:
+    QObject &mService;
+    const QVariantHash mActivity;
+    QIcon mIcon;
+    bool mRequestPending;
+};
+
+#endif // TSACTIVITYMODELITEM_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/inc/tsdataroles.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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 TSDATAROLES_H
+#define TSDATAROLES_H
+
+namespace TsDataRoles {
+    enum EntryAttributes {
+        Closable = Qt::UserRole + 1,
+    };
+}
+
+#endif // TSDATAROLES_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/inc/tsdevicedialogcontainer.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#ifndef TSDEVICEDIALOGCONTAINER_H
+#define TSDEVICEDIALOGCONTAINER_H
+
+#include <QObject>
+
+#include <HbDeviceDialogInterface>
+
+#include <qvaluespacepublisher.h>
+
+#include "tsdocumentloader.h"
+
+QTM_USE_NAMESPACE
+
+class QAbstractListModel;
+
+class TsDeviceDialogContainer : public QObject, public HbDeviceDialogInterface
+{
+Q_OBJECT
+public:
+    explicit TsDeviceDialogContainer(QAbstractListModel *model, QObject *parent = 0);
+    ~TsDeviceDialogContainer();
+
+public:
+    virtual bool setDeviceDialogParameters(const QVariantMap &parameters);
+    virtual int deviceDialogError() const;
+    virtual void closeDeviceDialog(bool byClient);
+    virtual HbPopup *deviceDialogWidget() const;
+    virtual QObject *signalSender() const;
+
+signals:
+    void deviceDialogClosed();
+
+public slots:
+    void changeOrientation(Qt::Orientation orientation);
+
+private slots:
+    void notifyDialogClosed();
+    
+private:
+    TsDocumentLoader mLoader;
+    QValueSpacePublisher mVisibilityPublisher;
+
+};
+
+#endif // TSDEVICEDIALOGCONTAINER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/inc/tsdevicedialogplugin.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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:
+*
+*/
+
+#ifndef TSDEVICEDIALOGPLUGIN_H
+#define TSDEVICEDIALOGPLUGIN_H
+
+#include <hbdevicedialogplugin.h>
+
+#include <QObject>
+#include <QVariantMap>
+#include <QSharedPointer>
+#include <qabstractitemmodel.h>
+
+#include "tsdocumentloader.h"
+
+class TsTaskMonitor;
+class TsDeviceDialogPlugin : public HbDeviceDialogPlugin
+{
+    Q_OBJECT
+
+public:
+    TsDeviceDialogPlugin();
+    ~TsDeviceDialogPlugin();
+
+    bool accessAllowed(const QString &deviceDialogType, const QVariantMap &parameters, const QVariantMap &securityInfo) const;
+    HbDeviceDialogInterface *createDeviceDialog(const QString &deviceDialogType, const QVariantMap &parameters);
+    bool deviceDialogInfo(const QString &deviceDialogType, const QVariantMap &parameters, DeviceDialogInfo *info) const;
+    QStringList deviceDialogTypes() const;
+    PluginFlags pluginFlags() const;
+    int error() const;
+
+private:
+    int mError;
+    TsDocumentLoader mLoader;
+    QAbstractListModel *mModel;
+    TsTaskMonitor *mStorage;
+
+    bool mTriedToLoadTranslation;
+    
+    Q_DISABLE_COPY(TsDeviceDialogPlugin)
+};
+
+#endif // TSDEVICEDIALOGPLUGIN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/inc/tsdocumentloader.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Screensaver custom document loader.
+*
+*/
+
+#ifndef TSDOCUMENTLOADER_H
+#define TSDOCUMENTLOADER_H
+
+#include <hbdocumentloader.h>
+
+class TsDocumentLoader : public HbDocumentLoader
+{
+
+private:
+    virtual QObject *createObject(const QString &type, const QString &name);
+
+};
+
+#endif // TSDOCUMENTLOADER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/inc/tsentrymodelitem.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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: tsentrymodelitem.h
+*
+*/
+
+#ifndef TSENTRYMODELITEM_H
+#define TSENTRYMODELITEM_H
+#include "tsmodelitem.h"
+
+#include <qsharedpointer.h>
+#include <qstring.h>
+
+class TsTask;
+
+/*!
+    Class implements model item which represents Content Arsenal entry
+*/
+class TsEntryModelItem : public TsModelItem
+{
+public:
+    TsEntryModelItem(QSharedPointer<TsTask> entry);
+    ~TsEntryModelItem();
+    QVariant data(int role) const;
+    void close();
+    void open();
+
+private:
+    const QSharedPointer<TsTask> mEntry;
+};
+
+#endif // TSMODEL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/inc/tsmodel.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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: tsmodel.h
+*
+*/
+
+#ifndef TSMODEL_H
+#define TSMODEL_H
+
+#include <QAbstractItemModel>
+#include <QList>
+#include <QSize>
+#include <QSharedPointer>
+#include <tstaskmonitor.h>
+#ifdef Q_OS_SYMBIAN
+#include <apgcli.h>
+#endif
+
+class TsTaskMonitor;
+class ActivityManager;
+class CaNotifier;
+class TsModelItem;
+
+class TsModel : public QAbstractListModel
+{
+    Q_OBJECT
+
+public:
+    explicit TsModel(TsTaskMonitor &applicationSrv,
+                     QObject &activitySrv,
+                     QObject *parent = 0);
+    ~TsModel();
+
+    int rowCount(const QModelIndex &parent = QModelIndex()) const;
+    QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+    int maxRowCount()const;
+
+public slots:
+    void openApplication(const QModelIndex &index);
+    void closeApplication(const QModelIndex &index);
+    void updateModel();
+    void entryChanged(TsModelItem *);
+private:
+    TsModelItem *entry(const QModelIndex &index) const;
+    void getApplications();
+    void getActivities();
+    void prepareActivityEntry(QVariantHash &activity);
+    QString getApplicationName(int id);
+
+private:
+    /*
+     * List containing result
+     */
+    QList<TsModelItem *> mEntries;
+
+    TsTaskMonitor &mApplicationService;
+
+    /*
+     * Activity Service
+     */
+    QObject &mActivityService;
+    
+#ifdef Q_OS_SYMBIAN
+    RApaLsSession iAppArcSession;
+#endif
+
+    /*
+     * Icon size in model
+     */
+    QSize mSize;
+    
+    /*
+     * Maximum number of items (only for running apps + activities)
+     */ 
+    int mMaxItems;
+};
+
+#endif // TSMODEL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/inc/tsmodelitem.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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: tsmodelitem.h
+*
+*/
+
+#ifndef TSMODELITEM_H
+#define TSMODELITEM_H
+#include <QVariant>
+#include <QModelIndex>
+/*!
+    Abstract class which define model item for taskswitcher
+*/
+class TsModelItem: public QObject
+{
+    Q_OBJECT
+
+public:
+    virtual QVariant data(int role) const =0;
+    virtual void close() =0;
+    virtual void open() =0;
+};
+
+#endif // TSMODELITEM_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/inc/tstasksgrid.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef TSTASKSGRID_H
+#define TSTASKSGRID_H
+
+#include <hbgridview.h>
+
+class TsTasksGrid : public HbGridView
+{
+    Q_OBJECT
+
+signals:
+    void deleteButtonClicked(const QModelIndex &index);
+
+protected:
+    virtual void polish(HbStyleParameters &params);
+
+};
+
+#endif // TSTASKSGRID_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/inc/tstasksgriditem.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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 TSTASKSGRIDITEM_H
+#define TSTASKSGRIDITEM_H
+
+#include <hbabstractviewitem.h>
+
+class HbTextItem;
+class HbIconItem;
+class HbFrameItem;
+class HbPushButton;
+
+class TsTasksGridItem : public HbAbstractViewItem
+{
+    Q_OBJECT
+
+public:
+    TsTasksGridItem();
+    TsTasksGridItem(const TsTasksGridItem &item);
+
+    HbAbstractViewItem *createItem();
+    void updateChildItems();
+
+private slots:
+    void handleDeleteClicked();
+
+signals:
+    void deleteClicked(const QModelIndex &index);
+
+private:
+    HbIconItem *mScreenshotLabel;
+    HbTextItem *mApplicationNameLabel;
+    HbPushButton *mDeleteButton;
+
+    HbFrameItem *mActiveLabelFrame;
+    HbTextItem *mActiveLabel;
+};
+
+#endif //TSTASKSGRIDITEM_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/resource/layout.docml	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<hbdocument version="0.10">
+    <widget name="tsdevicedialog" type="HbDialog">
+        <widget name="heading" role="HbDialog:headingWidget" type="HbLabel">
+            <string name="alignment" value="AlignVCenter|AlignHCenter" />
+            <string locid="txt_tsw_title_task_switcher" name="plainText" value="Task switcher" />
+        </widget>
+        <widget name="taskgrid" role="HbDialog:contentWidget" type="TsTasksGrid">
+            <widget name="item" role="HbAbstractView:prototype" type="TsTasksGridItem"/>
+            <bool name="longPressEnabled" value="FALSE"/>
+            <enums name="horizontalScrollBarPolicy" value="ScrollBarAlwaysOff"/>
+        </widget>            
+        <bool name="backgroundFaded" value="TRUE"/>
+        <string name="dismissPolicy" value="TapOutside"/>
+        <integer name="timeout" value="0"/>
+        <sizepolicy horizontalPolicy="Preferred" horizontalStretch="0" verticalPolicy="Preferred" verticalStretch="0"/>
+    </widget>
+    <section name="portrait">
+        <widget name="tsdevicedialog">
+            <sizehint type="PREFERRED" width="48un" height="40un"/>
+        </widget>
+        <widget name="taskgrid">
+            <string name="scrollDirections" value="Horizontal"/>
+            <integer name="rowCount" value="1"/>
+            <integer name="columnCount" value="2"/>
+        </widget>
+    </section>
+    <section name="landscape">
+        <widget name="tsdevicedialog">
+            <sizehint type="PREFERRED" width="60un" height="40un"/>
+        </widget>
+        <widget name="taskgrid">
+            <string name="scrollDirections" value="Horizontal"/>
+            <integer name="rowCount" value="2"/>
+            <integer name="columnCount" value="1"/>
+        </widget>
+    </section>
+</hbdocument>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/resource/tsdevicedialog.qcrml	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<repository target="RProperty" uidValue="0x20022fc5">
+    <key int="0x2002677F" ref="/TaskSwitcher/Visibility"/>
+</repository>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/resource/tstasksgriditem.css	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,52 @@
+TsTasksGridItem {
+    layout:custom;
+}
+
+TsTasksGridItem::appname {
+    text-align: center;
+    color: var(qtc_default_main_pane_normal);
+    font-variant: secondary;
+    text-height: var(hb-param-text-height-tiny);
+}
+
+TsTasksGridItem > HbPushButton#closebadge {
+    min-width: 7un;
+    min-height: 7un;
+}
+
+TsTasksGridItem::screenshotFrame {
+    zvalue: -1;
+}
+
+TsTasksGridItem::applicationLabelFrame {
+    zvalue: -1;
+}
+
+TsTasksGridItem > HbPushButton#closebadge::toucharea {
+    left: 1un;
+    right: -1un;
+    top: 1un;
+    bottom: -1un;
+}
+
+TsTasksGridItem > HbPushButton#closebadge::icon {
+    max-width: var(hb-param-graphic-size-primary-small);
+    max-height: var(hb-param-graphic-size-primary-small);
+}
+
+TsTasksGridItem::activeLabel  {
+    text-align: center;
+    color: var(qtc_default_main_pane_normal);
+    text-height: var(hb-param-text-height-tiny);
+    font-variant: secondary;
+    
+    zvalue: 2;
+    
+    /* workaround for mesh layout limitations */
+    max-height: 4un;
+    min-height: 4un;
+}
+
+TsTasksGridItem::activeLabelFrame {
+    zvalue: 1;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/resource/tstasksgriditem.widgetml	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,34 @@
+<hbwidget version="0.1" type="TsTasksGridItem">
+    <layout name="custom" type="mesh">
+        <meshitem src="appname" srcEdge="TOP" dst="" dstEdge="TOP" spacing="-4un"/>
+        <meshitem src="appname" srcEdge="LEFT" dst="screenshot" dstEdge="LEFT"/>
+        <meshitem src="appname" srcEdge="RIGHT" dst="screenshot" dstEdge="RIGHT"/>
+
+        <meshitem src="screenshot" srcEdge="TOP" dst="appname" dstEdge="BOTTOM" spacing="-1.5un"/>
+        <meshitem src="screenshot" srcEdge="RIGHT" dst="" dstEdge="RIGHT" spacing="1.5un"/>
+        <meshitem src="screenshot" srcEdge="LEFT" dst="" dstEdge="LEFT" spacing="-1.5un"/>
+        <meshitem src="screenshot" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" spacing="4un"/>
+        
+        <meshitem src="screenshotFrame" srcEdge="TOP" dst="screenshot" dstEdge="TOP" spacing="0.5un"/>
+        <meshitem src="screenshotFrame" srcEdge="RIGHT" dst="screenshot" dstEdge="RIGHT" spacing="-0.5un"/>
+        <meshitem src="screenshotFrame" srcEdge="LEFT" dst="screenshot" dstEdge="LEFT" spacing="0.5un"/>
+        <meshitem src="screenshotFrame" srcEdge="BOTTOM" dst="screenshot" dstEdge="BOTTOM" spacing="-0.5un"/>
+        
+        <meshitem src="applicationLabelFrame" srcEdge="TOP" dst="appname" dstEdge="TOP"/>
+        <meshitem src="applicationLabelFrame" srcEdge="RIGHT" dst="appname" dstEdge="RIGHT"/>
+        <meshitem src="applicationLabelFrame" srcEdge="LEFT" dst="appname" dstEdge="LEFT"/>
+        <meshitem src="applicationLabelFrame" srcEdge="BOTTOM" dst="appname" dstEdge="BOTTOM"/>
+
+        <meshitem src="closebadge" srcEdge="TOP" dst="screenshot" dstEdge="TOP"/>
+        <meshitem src="closebadge" srcEdge="RIGHT" dst="screenshot" dstEdge="RIGHT"/>
+        
+        <meshitem src="activeLabel" srcEdge="RIGHT" dst="screenshot" dstEdge="RIGHT"/>
+        <meshitem src="activeLabel" srcEdge="LEFT" dst="screenshot" dstEdge="LEFT"/>
+        <meshitem src="activeLabel" srcEdge="BOTTOM" dst="screenshot" dstEdge="BOTTOM"/>
+        
+        <meshitem src="activeLabelFrame" srcEdge="TOP" dst="activeLabel" dstEdge="TOP"/>
+        <meshitem src="activeLabelFrame" srcEdge="RIGHT" dst="activeLabel" dstEdge="RIGHT"/>
+        <meshitem src="activeLabelFrame" srcEdge="LEFT" dst="activeLabel" dstEdge="LEFT"/>
+        <meshitem src="activeLabelFrame" srcEdge="BOTTOM" dst="activeLabel" dstEdge="BOTTOM"/>        
+    </layout>
+</hbwidget>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/src/tsactivitymodelitem.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,173 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: tsactivitymodelitem.cpp
+*
+*/
+#include <hbicon.h>
+#include <afstorageglobals.h>
+
+#include "tsactivitymodelitem.h"
+#include "tsdataroles.h"
+
+/*!
+    \class TsActivityModelItem
+    \ingroup group_tsdevicedialogplugin
+    \brief Item presenting activity in the grid.
+*/
+
+/*!
+    Standard C++ constructor
+    /param model - reference to parent model
+    /param service - reference to initialized ActivityManager instance
+    /param entry - Activity data
+*/
+TsActivityModelItem::TsActivityModelItem(QAbstractListModel &model,
+                                         QObject& service, 
+                                         const QVariantHash & activity)
+    :
+    mService(service),
+    mActivity(activity),
+    mIcon(),
+    mRequestPending(false)
+{
+    connect(this,
+            SIGNAL(entryChanged(TsModelItem *)),
+            &model,
+            SLOT(entryChanged(TsModelItem *)));
+    connect(&mService,
+            SIGNAL(thumbnailReady(QPixmap, void *)),
+            this,
+            SLOT(thumbnailReady(QPixmap, void *)));
+}
+
+/*!
+    Standard C++ destructor
+    /param service - reference to initialized ActivityManager instance
+    /param entry - Activity data
+*/
+TsActivityModelItem::~TsActivityModelItem()
+{
+}
+
+/*!
+    Returns the data stored under the given role.
+    /param role - requested data role
+    /return data encapulated by QVariant
+*/
+QVariant TsActivityModelItem::data(int role) const
+{
+    switch (role) {
+        case Qt::DisplayRole:
+            return displayRole();
+        case Qt::DecorationRole:
+            return decorationRole();
+        case TsDataRoles::Closable:
+            return QVariant(false);
+        default:
+            return QVariant(QVariant::Invalid);
+    }
+}
+
+/*!
+    Empty interface implementation
+*/
+void TsActivityModelItem::close()
+{
+    //no implementation required
+}
+
+/*!
+    Open or move to foreground activity repesented by entry
+*/
+void TsActivityModelItem::open()
+{
+    QVariant application(mActivity.value(ActivityApplicationKeyword));
+    QVariant activity(mActivity.value(ActivityActivityKeyword));
+
+    if (application.isValid() && activity.isValid()) {
+        QMetaObject::invokeMethod(&mService,
+                                  "launchActivity",
+                                  Q_ARG(int, application.toInt()),
+                                  Q_ARG(QString, activity.toString()));
+    }
+}
+
+/*!
+    Return application name keyword
+*/
+QString TsActivityModelItem::applicationKeyword()
+{
+    static QString applicationName(ActivityApplicationName);
+    return applicationName;
+}
+
+/*!
+    Return activity visibility status keyword
+*/
+QString TsActivityModelItem::visibilityKeyword()
+{
+    static QString visibility("visible");
+    return visibility;
+}
+
+/*!
+    Return activity screenshot keyword
+*/
+QString TsActivityModelItem::screenshotKeyword()
+{
+    static QString screenshot(ActivityScreenshotKeyword);
+    return screenshot;
+}
+
+/*!
+    Returns the data stored under decoration role.
+    /return data encapulated by QVariant
+*/
+QVariant TsActivityModelItem::decorationRole() const
+{
+    if (!mRequestPending) {
+        const_cast<TsActivityModelItem *>(this)->mRequestPending = true;
+        QVariant screenshot = mActivity.value(screenshotKeyword());
+        if (screenshot.isValid()) {
+            QMetaObject::invokeMethod(&mService,
+                                      "getThumbnail",
+                                      Q_ARG(QSize, QSize(128, 128)),
+                                      Q_ARG(QString, screenshot.toString()),
+                                      Q_ARG(void *, const_cast<TsActivityModelItem *>(this)));
+        }
+    }
+    return QVariant::fromValue<HbIcon>(HbIcon(mIcon));
+}
+
+/*!
+    Returns the data stored under display role.
+    /return data encapulated by QVariant
+*/
+QVariant TsActivityModelItem::displayRole() const
+{
+    return mActivity.value(applicationKeyword());
+}
+
+/*!
+    Slot retrieve thumbnail form TM, update content and notify observers
+    /param pixmap - thumbnail content
+    /ptr - user data provided to request
+*/
+void TsActivityModelItem::thumbnailReady(QPixmap pixmap, void *ptr)
+{
+    if (ptr == this) {
+        mIcon = pixmap;
+        emit entryChanged(this);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/src/tsdevicedialogcontainer.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,119 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#include "tsdevicedialogcontainer.h"
+
+#include <QAbstractListModel>
+
+#include <HbDialog>
+#include <HbMainWindow>
+
+#include <tspropertydefs.h>
+
+#include "tstasksgrid.h"
+#include "tstasksgriditem.h"
+
+namespace {
+    const char KDocmlPath[] = ":/resource/layout.docml";
+}
+
+TsDeviceDialogContainer::TsDeviceDialogContainer(QAbstractListModel *model, QObject *parent) : QObject(parent), mVisibilityPublisher(TsProperty::KTsPath)
+{
+    bool ok(true);
+    mLoader.load(KDocmlPath, &ok);
+    Q_ASSERT(ok);
+
+    HbDialog *dialog = qobject_cast<HbDialog*>(mLoader.findWidget("tsdevicedialog"));
+    TsTasksGrid *grid = qobject_cast<TsTasksGrid *>(mLoader.findWidget("taskgrid"));
+    Q_ASSERT(dialog);
+    Q_ASSERT(grid);
+
+    changeOrientation(dialog->mainWindow()->orientation());
+
+    grid->setModel(model);
+
+    // needed because of Qt::QueuedConnection used below
+    // @todo: check if we actually need queued connections
+    qRegisterMetaType<QModelIndex>("QModelIndex");
+
+    // connect the grid and model
+    disconnect(grid, SIGNAL(activated(QModelIndex)), model, SLOT(openApplication(QModelIndex)));
+    disconnect(grid, SIGNAL(activated(QModelIndex)), dialog, SLOT(close()));
+    disconnect(grid, SIGNAL(deleteButtonClicked(QModelIndex)), model, SLOT(closeApplication(QModelIndex)));
+
+    connect(grid, SIGNAL(activated(QModelIndex)), model, SLOT(openApplication(QModelIndex)));
+    connect(grid, SIGNAL(activated(QModelIndex)), dialog, SLOT(close()));
+    connect(grid, SIGNAL(deleteButtonClicked(QModelIndex)), model, SLOT(closeApplication(QModelIndex)), Qt::QueuedConnection);
+
+    connect(dialog->mainWindow(), SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(changeOrientation(Qt::Orientation)));
+    connect(dialog, SIGNAL(aboutToClose()), this, SIGNAL(deviceDialogClosed()));
+    
+    connect(this, SIGNAL(deviceDialogClosed()), this, SLOT(notifyDialogClosed()));    
+    mVisibilityPublisher.setValue(TsProperty::KVisibilityPath, true);
+    mVisibilityPublisher.sync();
+}
+
+TsDeviceDialogContainer::~TsDeviceDialogContainer() 
+{ 
+    delete deviceDialogWidget();
+}
+
+bool TsDeviceDialogContainer::setDeviceDialogParameters(const QVariantMap &parameters)
+{
+    Q_UNUSED(parameters);
+    return false;
+}
+
+int TsDeviceDialogContainer::deviceDialogError() const
+{
+    return 0;
+}
+
+void TsDeviceDialogContainer::closeDeviceDialog(bool byClient)
+{
+    Q_UNUSED(byClient)
+    // @todo: should there be hide calls? deviceDialogWidget->hide();
+    emit deviceDialogClosed();
+}
+
+HbPopup *TsDeviceDialogContainer::deviceDialogWidget() const
+{
+    HbDialog *widget = qobject_cast<HbDialog*>(mLoader.findWidget("tsdevicedialog"));
+    Q_ASSERT(widget);
+    return widget;
+}
+
+QObject *TsDeviceDialogContainer::signalSender() const
+{
+    return const_cast<TsDeviceDialogContainer*>(this);
+}
+
+void TsDeviceDialogContainer::changeOrientation(Qt::Orientation orientation)
+{
+    bool ok(true);
+    if (orientation == Qt::Horizontal) {
+        mLoader.load(KDocmlPath, "landscape", &ok);
+    } else {
+        mLoader.load(KDocmlPath, "portrait", &ok);
+    }
+    Q_ASSERT(ok);
+}
+
+void TsDeviceDialogContainer::notifyDialogClosed()
+{
+    mVisibilityPublisher.setValue(TsProperty::KVisibilityPath, false);
+    mVisibilityPublisher.sync();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/src/tsdevicedialogplugin.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -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 <QTranslator>
+#include <QCoreApplication>
+#include <QLocale>
+#include <QtPlugin>
+
+#include <qservicemanager.h>
+
+#include <hbdevicedialog.h>
+#include <HbMainWindow>
+
+#include "tsdevicedialogplugin.h"
+#include "tsdevicedialogcontainer.h"
+#include "tstasksgrid.h"
+#include "tstasksgriditem.h"
+#include "tsdocumentloader.h"
+#include "tsmodel.h"
+
+/*!
+    \class TsDeviceDialogPlugin
+    \ingroup group_tsdevicedialogplugin
+    \brief TaskSwitcher Device Dialog Plug-in.
+ */
+
+namespace
+{
+    const char KTranslationPath[] = "resource/qt/translations";
+    const char KTsDialogType[] = "com.nokia.taskswitcher.tsdevicedialogplugin/1.0";
+} 
+ 
+/*!
+    Constructor.
+ */
+TsDeviceDialogPlugin::TsDeviceDialogPlugin() : mError(0), mModel(0), mStorage(0), mTriedToLoadTranslation(false)
+{
+}
+
+TsDeviceDialogPlugin::~TsDeviceDialogPlugin()
+{
+    delete mModel;
+}
+/*!
+    \reimp
+ */
+bool TsDeviceDialogPlugin::accessAllowed(const QString &deviceDialogType, const QVariantMap &parameters, const QVariantMap &securityInfo) const
+{
+    Q_UNUSED(deviceDialogType)
+    Q_UNUSED(parameters)
+    Q_UNUSED(securityInfo)
+
+    // This plugin doesn't perform operations that may compromise security.
+    // All clients are allowed to use it.
+    return true;
+}
+
+/*!
+    \reimp
+ */
+HbDeviceDialogInterface *TsDeviceDialogPlugin::createDeviceDialog(const QString &deviceDialogType, const QVariantMap &parameters)
+{
+    Q_UNUSED(parameters)
+    HbDeviceDialogInterface *dialogInterface(0);
+    if (deviceDialogType == QString(KTsDialogType)) {
+        // lazy loading of translation
+        if (!mTriedToLoadTranslation) {
+            mTriedToLoadTranslation = true;
+
+            QTranslator *translator = new QTranslator(this);
+            QString translationFile = QString("taskswitcher_%1").arg(QLocale::system().name());
+    
+            bool translationLoaded(false);
+            #ifdef Q_OS_SYMBIAN
+                translationLoaded = translator->load(translationFile, QString("z:/") + KTranslationPath);
+                if (!translationLoaded) {
+                    translationLoaded = translator->load(translationFile, QString("c:/") + KTranslationPath);
+                }
+            #else
+                translationLoaded = translator->load(translationFile, QString(KTranslationPath));
+            #endif //Q_OS_SYMBIAN
+
+            Q_ASSERT(translationLoaded);
+            qApp->installTranslator(translator);
+        }
+    
+        // lazy loading of model
+        if (0 == mModel) {
+            mStorage = new TsTaskMonitor(this);
+            if (0 == mStorage) {
+                return 0; // provider of running application list is critical
+            }
+            
+            QtMobility::QServiceManager serviceManager;
+            QObject *activityManager(serviceManager.loadInterface("com.nokia.qt.activities.ActivityManager"));
+            if (activityManager) {
+                activityManager->setParent(this); //make it autodestructed
+            } else {
+                activityManager = this; //activity plugin is not present. provide invalid instance because its not critical functionality.
+                //QMetaObject::invokeMethod is safe to use in such a case.
+            }
+            mModel = new TsModel(*mStorage, *activityManager);
+        }
+        
+        dialogInterface = new TsDeviceDialogContainer(mModel);
+    }
+    return dialogInterface;
+}
+
+/*!
+    \reimp
+ */
+bool TsDeviceDialogPlugin::deviceDialogInfo(const QString &deviceDialogType, const QVariantMap &parameters, DeviceDialogInfo *info) const
+{
+    Q_UNUSED(parameters)
+    Q_UNUSED(deviceDialogType)
+
+    info->group = GenericDeviceDialogGroup;
+    info->flags = NoDeviceDialogFlags;
+    info->priority = DefaultPriority;
+
+    return true;
+}
+
+/*!
+    \reimp
+ */
+QStringList TsDeviceDialogPlugin::deviceDialogTypes() const
+{
+    return QStringList(QString(KTsDialogType));
+}
+
+/*!
+    \reimp
+ */
+HbDeviceDialogPlugin::PluginFlags TsDeviceDialogPlugin::pluginFlags() const
+{
+    return PluginFlags(PreloadPlugin | KeepPluginLoaded);
+}
+
+/*!
+    \reimp
+ */
+int TsDeviceDialogPlugin::error() const
+{
+    return mError;
+}
+
+#ifdef COVERAGE_MEASUREMENT
+#pragma CTC SKIP
+#endif //COVERAGE_MEASUREMENT
+
+Q_EXPORT_PLUGIN2(tsdevicedialogplugin, TsDeviceDialogPlugin)
+
+#ifdef COVERAGE_MEASUREMENT
+#pragma CTC ENDSKIP
+#endif //COVERAGE_MEASUREMENT
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/src/tsdocumentloader.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -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: Screensaver custom document loader.
+*
+*/
+
+#include "tsdocumentloader.h"
+#include "tstasksgrid.h"
+#include "tstasksgriditem.h"
+
+/*!
+    \class TsDocumentLoader
+    \ingroup group_tsdevicedialogplugin
+    \brief Document loader.
+
+    TS implementation of document loader. It is creating TS objects used in UI
+*/
+
+QObject *TsDocumentLoader::createObject(const QString &type, const QString &name)
+{
+    if (type == TsTasksGrid::staticMetaObject.className()) {
+        QObject *object = new TsTasksGrid();
+        object->setObjectName(name);
+        return object;
+    } else if (type == TsTasksGridItem::staticMetaObject.className()) {
+        QObject *object = new TsTasksGridItem();
+        object->setObjectName(name);
+        return object;
+    }
+
+    return HbDocumentLoader::createObject(type, name);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/src/tsentrymodelitem.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: tsentrymodelitem.cpp
+*
+*/
+#include "tsentrymodelitem.h"
+#include "tsdataroles.h"
+
+#include <tstask.h>
+#include <HbIcon>
+
+/*!
+    \class TsEntryModelItem
+    \ingroup group_tsdevicedialogplugin
+    \brief Item presenting running apps in the grid.
+*/
+
+/*!
+    Standard C++ constructor
+    /param entry - Task Monitor data
+*/
+TsEntryModelItem::TsEntryModelItem(QSharedPointer<TsTask> entry)
+    :
+    mEntry(entry)
+{
+    //no implementation required
+}
+
+/*!
+    Standard C++ destructor
+*/
+TsEntryModelItem::~TsEntryModelItem()
+{
+}
+
+/*!
+    Returns the data stored under the given role.
+    /param role - requested data role
+    /return data encapulated by QVariant
+*/
+QVariant TsEntryModelItem::data(int role) const
+{
+    switch (role) {
+        case Qt::DisplayRole:
+            return QVariant(mEntry->name());
+        case Qt::DecorationRole:
+            {
+                QPixmap icon = mEntry->screenshot().isNull() ? 
+                               mEntry->icon() :
+                               mEntry->screenshot();
+                if (icon.isNull()) {
+                    return HbIcon("qtg_large_application");
+                } else {
+                    return QVariant::fromValue<HbIcon>(HbIcon(icon));
+                }
+            }
+        case TsDataRoles::Closable:
+            return QVariant(mEntry->isClosable());
+        default:
+            return QVariant(QVariant::Invalid);
+    }
+}
+
+/*!
+    Close running application repesented by entry
+*/
+void TsEntryModelItem::close()
+{
+    mEntry->close();
+}
+
+/*!
+    Open or move to foreground application repesented by entry
+*/
+void TsEntryModelItem::open()
+{
+    mEntry->open();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/src/tsmodel.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,244 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: tsmodel.cpp
+*
+*/
+#include "tsmodel.h"
+#include "tsmodelitem.h"
+#include "tsentrymodelitem.h"
+#include "tsactivitymodelitem.h"
+#include "tsdataroles.h"
+
+#include <HbIcon>
+#include <qvariant.h>
+#include <qlist.h>
+#include <afstorageglobals.h>
+
+#ifdef Q_OS_SYMBIAN
+#include <XQSettingsManager>
+#include <apaid.h>
+
+const int TSDeviceDialogUid = 0x2002677F;
+const int ItemsLimit = 0x00000001;
+#endif
+
+const int maxItems(10);
+/*!
+    \class TsModel
+    \ingroup group_tsdevicedialogplugin
+    \brief Model storing running application and activieties.
+*/
+
+/*!
+    Constructor
+    \param query used to create model
+    \param pointer to parent object
+*/
+TsModel::TsModel(TsTaskMonitor &applicationSrv, QObject &activitySrv, QObject *parent) :
+    QAbstractListModel(parent),
+    mEntries(),
+    mApplicationService(applicationSrv),
+    mActivityService(activitySrv),
+    mSize(240, 240),
+    mMaxItems(maxItems)
+{
+    
+#ifdef Q_OS_SYMBIAN
+    XQSettingsManager *crManager = new XQSettingsManager;
+    XQCentralRepositorySettingsKey itemsNumberKey(TSDeviceDialogUid, ItemsLimit);
+    QVariant itemsNumberVariant = crManager->readItemValue(itemsNumberKey, XQSettingsManager::TypeInt);
+    if (!itemsNumberVariant.isNull()) {
+        int number = itemsNumberVariant.toInt();
+        if (number > 0) {
+            mMaxItems = number;
+        }
+    }
+    iAppArcSession.Connect();
+#endif
+
+    connect(&activitySrv, SIGNAL(dataChanged()), this, SLOT(updateModel()));
+    connect(&applicationSrv, SIGNAL(taskListChanged()), this, SLOT(updateModel()));
+    updateModel();
+}
+
+/*!
+    Destructor
+*/
+TsModel::~TsModel()
+{
+#ifdef Q_OS_SYMBIAN
+    iAppArcSession.Close();
+#endif
+    qDeleteAll(mEntries);
+}
+
+/*!
+    Returns count of rows in model
+    \retval number of rows
+*/
+int TsModel::rowCount(
+    const QModelIndex &parent) const
+{
+    Q_UNUSED(parent);
+    return mEntries.count();
+}
+
+/*!
+    Returns appropiate model's data
+    \param index model index
+    \param role which data role to return
+    \retval models data
+*/
+QVariant TsModel::data(const QModelIndex &index,
+                       int role) const
+{
+    return index.isValid() ? entry(index)->data(role) : QVariant();
+}
+
+/*!
+    Returns maximum anount of data allowed for model
+    \retval maximum data count
+*/
+
+int TsModel::maxRowCount()const
+{
+    return mMaxItems;
+}
+
+/*!
+    Activate one of model entries
+*/
+void TsModel::openApplication(const QModelIndex &index)
+{
+    if (!index.isValid()) {
+        return;
+    }
+    entry(index)->open();
+}
+
+/*!
+    Close one of moder entries
+*/
+void TsModel::closeApplication(const QModelIndex &index)
+{
+    if (!index.isValid() || !entry(index)->data(TsDataRoles::Closable).toBool()) {
+        return;
+    }
+    entry(index)->close();
+}
+
+/*!
+    Updates model with fresh entries
+*/
+void TsModel::updateModel()
+{
+    //clear current data
+    qDeleteAll(mEntries);
+    mEntries.clear();
+
+    beginResetModel();
+    getApplications();
+    getActivities();
+    endResetModel();
+
+}
+
+/*!
+    Read list of running applications
+*/
+void TsModel::getApplications()
+{
+    //get running applications
+    TsModelItem *entry(0);
+    QList< QSharedPointer<TsTask> > tasks(mApplicationService.taskList());
+    foreach (QSharedPointer<TsTask> taskData, tasks) {
+        entry = new TsEntryModelItem(taskData);
+        if (0 != entry) {
+            mEntries.append(entry);
+        }
+    }
+}
+
+/*!
+    Read current activities
+*/
+void TsModel::getActivities()
+{
+    //get activities
+    TsModelItem *entry(0);
+    QList<QVariantHash> activities;
+    QMetaObject::invokeMethod(&mActivityService, "activitiesList", Q_RETURN_ARG(QList<QVariantHash>, activities));
+    foreach(QVariantHash activity, activities) {
+        prepareActivityEntry(activity);
+        entry = new TsActivityModelItem(*this, mActivityService, activity);
+        if (entry) {
+            if (maxRowCount() <= mEntries.count()) {
+                break;
+            }
+            mEntries.append(entry);
+        }
+    }
+}
+
+/*!
+    Modify activity entry replacing application id with name
+*/
+void TsModel::prepareActivityEntry(QVariantHash &activity)
+{
+    if (!activity.contains(TsActivityModelItem::applicationKeyword())) {
+        activity.insert(TsActivityModelItem::applicationKeyword(),
+                    activity.contains(ActivityApplicationKeyword) ?
+                    getApplicationName(activity[ActivityApplicationKeyword].toInt()) :
+                    QString::null);
+    }
+}
+
+/*!
+    Return application name
+    \param id - reqiested application identyfier
+*/
+QString TsModel::getApplicationName(int id)
+{
+    QString retVal;
+#ifdef Q_OS_SYMBIAN
+    TApaAppInfo info;
+    iAppArcSession.GetAppInfo( info, TUid::Uid(id));
+    retVal = QString::fromUtf16(info.iShortCaption.Ptr(),
+                                info.iShortCaption.Length());
+#endif
+    return retVal;
+}
+
+/*!
+    Called when some item was changed
+    \param itemPtr - address of updated item
+*/
+void TsModel::entryChanged(TsModelItem *itemPtr)
+{
+    const int itemIndex = mEntries.indexOf(itemPtr);
+    if (itemIndex != -1) {
+        emit dataChanged(index(itemIndex, 0), index(itemIndex, 0));
+    }
+}
+
+/*!
+    Returns an entry from model
+    \param index of entry in model
+    \retval pointer to an entry
+*/
+TsModelItem *TsModel::entry(const QModelIndex &index) const
+{
+    return mEntries.at(index.row());
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/src/tstasksgrid.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -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 "tstasksgrid.h"
+
+void TsTasksGrid::polish(HbStyleParameters &params)
+{
+    HbGridView::polish(params);
+    
+    // center second item when dialog is shown
+    if (model()) {
+        scrollTo(model()->index(1, 0), PositionAtCenter);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/src/tstasksgriditem.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -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 "tstasksgriditem.h"
+
+#include <HbPushButton>
+#include <HbAbstractItemView>
+#include <HbFrameItem>
+#include <HbTextItem>
+#include <HbIconItem>
+#include <HbStyleLoader>
+
+#include "tsdataroles.h"
+
+/*!
+    \class TsTasksGridItem
+    \ingroup group_tsdevicedialogplugin
+    \brief Item that should be presented in grid.
+*/
+
+
+TsTasksGridItem::TsTasksGridItem() : HbAbstractViewItem(), mScreenshotLabel(0), mApplicationNameLabel(0), mDeleteButton(0), mActiveLabelFrame(0), mActiveLabel(0)
+{
+    // Register the custom docml and css to provide our own style to the list items
+    bool widgetmlLoaded = HbStyleLoader::registerFilePath(":/resource/tstasksgriditem.widgetml");
+    Q_ASSERT(widgetmlLoaded);
+    bool cssLoaded = HbStyleLoader::registerFilePath(":/resource/tstasksgriditem.css");
+    Q_ASSERT(cssLoaded);
+}
+
+TsTasksGridItem::TsTasksGridItem(const TsTasksGridItem &item) : HbAbstractViewItem(item)
+{
+    mScreenshotLabel = new HbIconItem(this);
+    mApplicationNameLabel = new HbTextItem(this);
+    mDeleteButton = new HbPushButton(this);
+    HbFrameItem *screenshotFrame = new HbFrameItem(this);    
+    screenshotFrame->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
+    screenshotFrame->frameDrawer().setFrameGraphicsName("qtg_fr_multimedia_trans");
+
+    HbFrameItem *applicationLabelFrame = new HbFrameItem(this);
+    applicationLabelFrame->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
+    applicationLabelFrame->frameDrawer().setFrameGraphicsName("qtg_fr_multimedia_trans");
+
+    mActiveLabel = new HbTextItem(hbTrId("txt_tsw_label_active"), this);
+    mActiveLabelFrame = new HbFrameItem(this);
+    mActiveLabelFrame->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
+    mActiveLabelFrame->frameDrawer().setFrameGraphicsName("qtg_fr_multimedia_trans");
+
+    mDeleteButton->setIcon(HbIcon("qtg_mono_exit"));
+
+    HbStyle::setItemName(mScreenshotLabel, "screenshot");
+    HbStyle::setItemName(mApplicationNameLabel, "appname");
+    HbStyle::setItemName(mDeleteButton, "closebadge");
+    mDeleteButton->setObjectName("closebadge");
+    HbStyle::setItemName(screenshotFrame, "screenshotFrame");
+    HbStyle::setItemName(applicationLabelFrame, "applicationLabelFrame");
+    HbStyle::setItemName(mActiveLabel, "activeLabel");
+    HbStyle::setItemName(mActiveLabelFrame, "activeLabelFrame");
+    connect(mDeleteButton, SIGNAL(clicked()), this, SLOT(handleDeleteClicked()));
+}
+
+HbAbstractViewItem *TsTasksGridItem::createItem()
+{
+    TsTasksGridItem *newItem = new TsTasksGridItem(*this);
+    connect(newItem, SIGNAL(deleteClicked(QModelIndex)), itemView(), SIGNAL(deleteButtonClicked(QModelIndex)));
+    return newItem;
+}
+
+void TsTasksGridItem::handleDeleteClicked()
+{
+    emit deleteClicked(modelIndex());
+}
+
+void TsTasksGridItem::updateChildItems()
+{
+    mScreenshotLabel->setIcon(modelIndex().data(Qt::DecorationRole).value<HbIcon>());
+    mApplicationNameLabel->setText(modelIndex().data(Qt::DisplayRole).toString());
+    QVariant status(modelIndex().data(TsDataRoles::Closable));
+    const bool isClosable(status.isValid() && status.toBool());
+    if (isClosable) {
+        mDeleteButton->show();
+        mActiveLabel->show();
+        mActiveLabelFrame->show();
+    } else {
+        mDeleteButton->hide();
+        mActiveLabel->hide();
+        mActiveLabelFrame->hide();
+    }
+}
Binary file tsdevicedialog/tsdevicedialogplugin/taskswitcher.qm has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/taskswitcher.ts	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="3.0" language="en_GB" sourcelanguage="en_GB">
+<context>
+<message numerus="no" id="txt_tsw_title_task_switcher">
+    <comment>Task switcher popup title text. Application allows user to swap between running and recently used applications and to clear them from the list.</comment>        
+    <source>Task switcher</source>
+    <translation variants="no">Task switcher</translation>
+    <extra-loc-layout_id>cell_tport_appsw_pane_t1</extra-loc-layout_id>    
+    <extra-loc-viewid>tsw_01</extra-loc-viewid>
+    <extra-loc-positionid>title</extra-loc-positionid>
+    <extra-loc-feature>ts</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+</context>
+</TS>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/tsdevicedialogplugin.pro	Thu Jul 22 16:37:03 2010 +0100
@@ -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: tsdevicedialogplugin.pro
+#
+
+TEMPLATE = lib
+CONFIG += hb plugin mobility
+MOBILITY = serviceframework publishsubscribe
+
+include (../common.pri)
+
+HEADERS +=  inc/tsdevicedialogcontainer.h \
+            inc/tsdevicedialogplugin.h \
+            inc/tsmodel.h \
+            inc/tsmodelitem.h \
+            inc/tsentrymodelitem.h \
+            inc/tsactivitymodelitem.h \
+            inc/tstasksgrid.h \
+            inc/tstasksgriditem.h \
+            inc/tsdocumentloader.h \
+            inc/tsdataroles.h \
+
+SOURCES +=  src/tsdevicedialogcontainer.cpp \
+            src/tsdevicedialogplugin.cpp \
+            src/tsmodel.cpp \
+            src/tsentrymodelitem.cpp \
+            src/tsactivitymodelitem.cpp \
+            src/tstasksgrid.cpp \
+            src/tstasksgriditem.cpp \
+            src/tsdocumentloader.cpp \
+
+INCLUDEPATH += . \
+               ./inc \
+
+LIBS +=     -ltstaskmonitorclient
+            
+TRANSLATIONS = taskswitcher.ts
+
+RESOURCES += tsdevicedialogplugin.qrc
+               
+symbian {
+    TARGET.CAPABILITY = CAP_ECOM_PLUGIN
+    TARGET.UID3 = 0x2002677F
+    pluginstub.sources = tsdevicedialogplugin.dll
+    pluginstub.path = /resource/plugins/devicedialogs
+    
+    LIBS += -lxqsettingsmanager -lapparc -lapgrfx
+    
+    # ugly hack
+    translation.sources = ./*.qm
+    translation.path = $$QT_PLUGINS_BASE_DIR/../translations
+    
+    crml.sources = ./resource/*.qcrml
+    crml.path = /resource/qt/crml
+    
+    DEPLOYMENT += pluginstub translation crml
+    
+    BLD_INF_RULES.prj_exports += \
+    "$${LITERAL_HASH}include <platform_paths.hrh>" \
+    "conf/tsdevicedialog.confml APP_LAYER_CONFML(tsdevicedialog.confml)" \
+    "conf/tsdevicedialog_2002677F.crml APP_LAYER_CRML(tsdevicedialog_2002677F.crml)"
+}
+
+win32 {
+    include ($$[QMAKE_MKSPECS]/features/hb_install.prf)
+    DESTDIR = $$HB_PLUGINS_DIR/devicedialogs
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/tsdevicedialogplugin.qrc	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,7 @@
+<RCC>
+    <qresource prefix="/">
+        <file>resource/layout.docml</file>
+        <file>resource/tstasksgriditem.widgetml</file>
+        <file>resource/tstasksgriditem.css</file>        
+    </qresource>
+</RCC>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/backstepping/backstepping.pro	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,20 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+TEMPLATE = subdirs
+symbian {
+    BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include \"group/bld.inf\""
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/backstepping/bwins/tsbacksteppingu.def	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,5 @@
+EXPORTS
+	?NewL@CTsBackstepping@@SAPAV1@AAVMTsWindowGroupsMonitor@@@Z @ 1 NONAME ; class CTsBackstepping * CTsBackstepping::NewL(class MTsWindowGroupsMonitor &)
+	?NewLC@CTsBackstepping@@SAPAV1@AAVMTsWindowGroupsMonitor@@@Z @ 2 NONAME ; class CTsBackstepping * CTsBackstepping::NewLC(class MTsWindowGroupsMonitor &)
+	??1CTsBackstepping@@UAE@XZ @ 3 NONAME ; CTsBackstepping::~CTsBackstepping(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/backstepping/eabi/tsbacksteppingu.def	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,9 @@
+EXPORTS
+	_ZN15CTsBackstepping4NewLER22MTsWindowGroupsMonitor @ 1 NONAME
+	_ZN15CTsBackstepping5NewLCER22MTsWindowGroupsMonitor @ 2 NONAME
+	_ZN15CTsBacksteppingD0Ev @ 3 NONAME
+	_ZN15CTsBacksteppingD1Ev @ 4 NONAME
+	_ZN15CTsBacksteppingD2Ev @ 5 NONAME
+	_ZTI15CTsBackstepping @ 6 NONAME
+	_ZTV15CTsBackstepping @ 7 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/backstepping/group/bld.inf	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,21 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_MMPFILES
+tsbackstepping.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/backstepping/group/tsbackstepping.mmp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+TARGET         tsbackstepping.dll
+TARGETTYPE     dll
+UID            0x1000008d  0x200267AD
+SECUREID       0x200267AD
+CAPABILITY     ALL -TCB
+
+EPOCHEAPSIZE   0x100000 0x600000 // 1MB - 6MB
+
+MW_LAYER_SYSTEMINCLUDE
+
+USERINCLUDE    ../inc
+USERINCLUDE     ../../../inc
+
+SOURCEPATH     ../src
+SOURCE         tsbackstepping.cpp
+
+LIBRARY        euser.lib 
+LIBRARY        ws32.lib // for RWsSession
+LIBRARY        apgrfx.lib // for TApaTask / TApaTasksList
+LIBRARY        tsutils.lib
+
+DEBUGLIBRARY    flogger.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/backstepping/inc/tsbackstepping.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef __CBACKSTEPPING_H
+#define __CBACKSTEPPING_H
+
+#include <w32std.h>
+#include <tswindowgroupsobserver.h>
+
+
+class CTsBackstepping : public CTsWindowGroupsObserver
+{
+public:
+    IMPORT_C static CTsBackstepping* NewL(MTsWindowGroupsMonitor &);
+    IMPORT_C static CTsBackstepping* NewLC(MTsWindowGroupsMonitor &);
+    IMPORT_C virtual ~CTsBackstepping();
+
+private:
+    CTsBackstepping(MTsWindowGroupsMonitor &);
+    void ConstructL();
+
+    void HandleWindowGroupChanged(MTsResourceManager &, 
+                                  const TArray<RWsSession::TWindowGroupChainInfo> &);
+                                  
+    void HandleWindowGroupChangedL(MTsResourceManager &, 
+                                  const TArray<RWsSession::TWindowGroupChainInfo> &);
+};
+
+#endif // __CBACKSTEPPING_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/backstepping/inc/tsbacksteppingactivation.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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:
+*
+*/
+
+#ifndef CTSBACKSTEPPINGWAITINGDLE_H
+#define CTSBACKSTEPPINGWAITINGDLE_H
+
+#include <e32base.h>
+
+class RProperty;
+class MTsWindowGroupsMonitor;
+
+
+NONSHARABLE_CLASS(CTsBacksteppingActivation) : public CActive
+    {
+public:
+    /**
+    * Two-phased constructor.
+    * @param aPriority priority for the timer.
+    * @return new instance of CTeleWaitingIdle.
+    */
+    static CTsBacksteppingActivation* NewL(MTsWindowGroupsMonitor &monitor);
+    /**
+    * destructor
+    */
+    virtual ~CTsBacksteppingActivation();
+
+protected:
+    /**
+     * @see CActive.
+     */
+    void RunL();
+    
+    /**
+     * @see CActive::RunError(TInt)
+     */
+    TInt RunError(TInt);
+    
+    /**
+     * @see CActive.
+     */
+    void DoCancel();  
+
+private:
+    /**
+    * constructor.
+    * @return new instance of CTeleWaitingIdle.
+    */
+    CTsBacksteppingActivation(MTsWindowGroupsMonitor &monitor);
+    
+    void ConstructL();
+    
+    void Subscribe();
+
+private:
+    MTsWindowGroupsMonitor &mMonitor;
+    
+    // Central Repository.
+    RProperty mProperty;
+    
+    // Backstepping engine. Own
+    CBase* mEngine;
+    };
+
+#endif /* CTSBACKSTEPPINGWAITINGDLE_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/backstepping/src/tsbackstepping.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,140 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include <w32std.h>// key event
+#include <apgwgnam.h>// for CApaWindowGroupName
+#include <apgtask.h>
+#include <coedef.h>
+#include <f32file.h>
+#include <flogger.h>
+#include <e32property.h>
+#include <startupdomainpskeys.h>
+
+#include "tsbackstepping.h"
+
+const TUid KHSUid = {0x20022f35};
+
+
+/** 
+ *  CTsBackstepping::NewL
+ *  two phase constructor
+ */
+EXPORT_C CTsBackstepping* CTsBackstepping::NewL(MTsWindowGroupsMonitor &monitor)
+  {
+  RDebug::Print(_L("CTsBackstepping::NewL"));
+  CTsBackstepping* self = CTsBackstepping::NewLC(monitor);
+  CleanupStack::Pop(self);
+  return self;
+  }
+
+/** 
+ *  CTsBackstepping::NewLC
+ *  two phase constructor
+ */
+EXPORT_C CTsBackstepping* CTsBackstepping::NewLC(MTsWindowGroupsMonitor &monitor)
+{ 
+  CTsBackstepping* self = new (ELeave) CTsBackstepping(monitor);
+  CleanupStack::PushL(self);
+  self->ConstructL();
+  return self;
+}
+
+/** 
+ * CTsBackstepping::CTsBackstepping
+ * constructor
+ */
+CTsBackstepping::CTsBackstepping(MTsWindowGroupsMonitor &monitor)
+:
+CTsWindowGroupsObserver(monitor)
+{
+}
+
+
+/** 
+ *  CTsBackstepping::~CTsBackstepping
+ *  deconstructor
+ */
+EXPORT_C CTsBackstepping::~CTsBackstepping()
+{
+}
+
+/** 
+ *  CTsBackstepping::ConstructL
+ *  two phase constructor
+ */
+void CTsBackstepping::ConstructL ()
+{
+    RDebug::Print(_L("CTsBackstepping::ConstructL"));
+    BaseConstructL();
+}
+
+/** 
+ * CTsBackstepping::AnalyseWindowStackL
+ * Analyzes window stack and move homescreen to proper position
+ */
+void CTsBackstepping::HandleWindowGroupChanged(MTsResourceManager &resource, const TArray<RWsSession::TWindowGroupChainInfo> &windowGroups)
+{
+    TRAP_IGNORE(HandleWindowGroupChangedL(resource, windowGroups));
+}
+
+/** 
+ * CTsBackstepping::AnalyseWindowStackL
+ * Analyzes window stack and move homescreen to proper position
+ */
+void CTsBackstepping::HandleWindowGroupChangedL(MTsResourceManager &resource,
+                                                const TArray<RWsSession::TWindowGroupChainInfo> &windowGroups)
+{  
+    RDebug::Print(_L("CTsBackstepping::GetWindowCaption"));
+    
+    CApaWindowGroupName *windowGroupName = CApaWindowGroupName::NewLC(resource.WsSession());
+    
+    TInt count(windowGroups.Count());
+    TInt pos(0);
+    TInt whereToJump(1);
+    for (TInt i=0; i<count; i++) {//iterate through list and give debug info
+        windowGroupName->ConstructFromWgIdL(windowGroups[i].iId);
+        if (windowGroupName->AppUid() != TUid::Null()) {
+            // find the window group id and check that it has no parent
+            if ( windowGroups[i].iParentId <= 0 ) {
+                RDebug::Print( _L("CTsBackstepping::GetWindowCaption wgid:%d is standalone view"), windowGroups[i].iId);
+                //check if it is homescreen 
+                if (windowGroupName->AppUid() == KHSUid) {
+                    RDebug::Print(_L("CTsBackstepping::GetWindowCaption Homescreen position = %d ; list:%d/%d"), pos, i, count);
+                    if (pos <= 1) {// HS is in foreground or second in line - do nothing 
+                        RDebug::Print(_L("CTsBackstepping::nothing to be done - it will stop checking here"));
+                    } else {//we should move homescreen to be second (ommit embeded views) from top
+                        RDebug::Print(_L("CTsBackstepping::moving homescreen to be second from top"));
+                        RDebug::Print(_L("CTsBackstepping::whereToJump = %d"), whereToJump);
+                        resource.WsSession().SetWindowGroupOrdinalPosition(windowGroups[i].iId, whereToJump);
+                    }
+                    // and break
+                    break;
+                }
+                pos++;
+            } else {
+                // only embeded items for first standalone launch should be counted
+                if (!pos) {
+                    ++whereToJump;
+                }
+                RDebug::Print(_L("CTsBackstepping::GetWindowCaption wgid:%d is embedded view"), windowGroups[i].iId);
+            }
+        }
+    }
+    CleanupStack::PopAndDestroy(windowGroupName);
+}
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/backstepping/src/tsbacksteppingactivation.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,137 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 <e32property.h>
+#include <startupdomainpskeys.h>
+#include <flogger.h>
+#include <w32std.h>
+
+#include "tsbacksteppingactivation.h"
+#include "tsbackstepping.h"
+
+ // ============================ MEMBER FUNCTIONS ===============================
+// -----------------------------------------------------------------------------
+// CBacksteppingActivation::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CTsBacksteppingActivation* CTsBacksteppingActivation::NewL(MTsWindowGroupsMonitor &monitor)
+{
+    RDebug::Print(_L("CBacksteppingActivation::NewL"));
+    CTsBacksteppingActivation* self = new( ELeave ) CTsBacksteppingActivation(monitor);
+    self->ConstructL();
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+// CBacksteppingWaitingIdle::CBacksteppingWaitingIdle
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CTsBacksteppingActivation::CTsBacksteppingActivation(MTsWindowGroupsMonitor &monitor) 
+:
+    CActive(EPriorityLow),
+    mMonitor(monitor)
+{
+    CActiveScheduler::Add(this);
+}
+
+// -----------------------------------------------------------------------------
+// CBacksteppingActivation::ConstructL()
+// -----------------------------------------------------------------------------
+//
+void CTsBacksteppingActivation::ConstructL() 
+{
+    User::LeaveIfError(mProperty.Attach(KPSUidStartup, KPSIdlePhase1Ok));
+    iStatus = KRequestPending;
+    SetActive();
+    TRequestStatus* status(&iStatus);
+    User::RequestComplete(status);
+}
+
+// -----------------------------------------------------------------------------
+// CBacksteppingActivation::~CBacksteppingActivation
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CTsBacksteppingActivation::~CTsBacksteppingActivation()
+{
+    Cancel();
+    delete mEngine;
+    mProperty.Close();
+}
+
+// -----------------------------------------------------------------------------
+// CBacksteppingActivation::DoCancel
+// 
+// -----------------------------------------------------------------------------
+//
+void CTsBacksteppingActivation::DoCancel()
+{
+    if ( IsActive() && mProperty.Handle() ) {
+        mProperty.Cancel();
+    }
+}
+
+// -----------------------------------------------------------------------------
+// CBacksteppingActivation::RunL
+// 
+// -----------------------------------------------------------------------------
+//
+void CTsBacksteppingActivation::RunL()
+{
+    User::LeaveIfError(iStatus.Int());
+    
+    TInt state(~EIdlePhase1Ok);
+    User::LeaveIfError(mProperty.Get(state));
+    
+    if (EIdlePhase1Ok == state) {
+        if (0 == mEngine) {
+            mEngine = CTsBackstepping::NewL(mMonitor);
+        }
+    } else {
+        delete mEngine;
+        mEngine = 0;
+    }
+    Subscribe();
+}
+
+// -----------------------------------------------------------------------------
+// CBacksteppingActivation::RunError
+// 
+// -----------------------------------------------------------------------------
+//
+TInt CTsBacksteppingActivation::RunError(TInt error)
+{
+    if (KErrCancel != error) {
+        Subscribe();
+    }
+    return KErrNone;
+}
+
+// -----------------------------------------------------------------------------
+// CBacksteppingActivation::Subscribe
+// 
+// -----------------------------------------------------------------------------
+//
+void CTsBacksteppingActivation::Subscribe()
+{
+    mProperty.Subscribe(iStatus);
+    SetActive();
+}
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/client.pri	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,74 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+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 \   
+                    $$PWD/../../inc \   
+
+    HEADERS +=  $$PWD/s60/inc/tstaskmonitorobserver.h \
+                $$PWD/s60/inc/tstaskmonitorclient.h \
+                $$PWD/s60/inc/tstaskmonitorclientimpl.h \
+                $$PWD/s60/inc/tssession.h \
+                $$PWD/../utils/inc/tsentry.h \
+                $$PWD/../utils/inc/tsentrykey.h \
+                $$PWD/../utils/inc/tsutils.h \
+                $$PWD/s60/inc/tstaskmonitor_p.h \
+                $$PWD/s60/inc/tsapplicationtask.h \
+                $$PWD/s60/inc/tsscreenshotclient.h \
+                $$PWD/s60/inc/tsscreenshotclientimpl.h \
+                $$PWD/s60/inc/tstasksettings_p.h \
+                $$PWD/../../homescreensrv_plat/taskswitcher_api/tstasksettings.h \
+                
+    SOURCES +=  $$PWD/s60/src/tstaskmonitorclient.cpp \
+                $$PWD/s60/src/tstaskmonitorclientimpl.cpp \
+                $$PWD/s60/src/tssession.cpp \
+                $$PWD/../utils/src/tsentry.cpp \
+                $$PWD/../utils/src/tsentrykey.cpp \                              
+                $$PWD/s60/src/tstaskmonitor_p.cpp \
+                $$PWD/s60/src/tstask.cpp \
+                $$PWD/s60/src/tsapplicationtask.cpp \
+                $$PWD/s60/src/tsscreenshotclient.cpp \
+                $$PWD/s60/src/tsscreenshotclientimpl.cpp \
+                $$PWD/src/tstasksettings.cpp \
+                $$PWD/s60/src/tstasksettings_p.cpp \
+
+    LIBS    +=  -lxqutils \
+                -lestor \
+                -lfbscli
+
+} else {
+    INCLUDEPATH +=  $$PWD/stub/inc \
+
+    HEADERS +=  $$PWD/stub/inc/tstaskmonitor_p.h \
+                $$PWD/stub/inc/tsentry.h \
+                $$PWD/stub/inc/tstasksettings_p.h \
+                
+    SOURCES +=  $$PWD/stub/src/tstaskmonitor_p.cpp \
+                $$PWD/stub/src/tstask.cpp \
+                $$PWD/stub/src/tsentry.cpp \
+                $$PWD/stub/src/tstasksettings_p.cpp \
+                
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/client.pro	Thu Jul 22 16:37:03 2010 +0100
@@ -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: 
+#
+
+TEMPLATE = lib
+TARGET = tstaskmonitorclient
+
+CONFIG += dll
+    
+DEFINES += TSTASKMONITOR_LIB
+            
+symbian {
+    dll.sources = tstaskmonitorclient.dll
+    dll.path = $$SHARED_LIB_DIR
+    DEPLOYMENT += dll
+    LIBS += -ltsutils -lws32 -lapgrfx -lcone
+
+    BLD_INF_RULES.prj_exports +=    "s60\inc\tstaskmonitorclient.h" \
+                                    "s60\inc\tstaskmonitorobserver.h" \
+                                    "inc\tstaskmonitor.h" \
+                                    "inc\tstask.h" \
+                                    "inc\tstaskmonitor_global.h" \
+                                    "s60\inc\tsscreenshotclient.h" \
+
+    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 Jul 22 16:37:03 2010 +0100
@@ -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 TSTASK_H
+#define TSTASK_H
+
+#include <QPixmap>
+#include <QString>
+
+#include "tstaskmonitor_global.h"
+
+class CTsEntry;
+
+class TsTask
+{
+    
+public:
+    TsTask(CTsEntry* 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 QPixmap screenshot() const;
+    TSTASKMONITOR_EXPORT QString name() const;
+    
+protected:
+    CTsEntry* mEntry;
+
+};
+
+#endif //TSTASK_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/inc/tstaskmonitor.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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 Jul 22 16:37:03 2010 +0100
@@ -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 Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#ifndef TSAPPLICATIONTASK_H
+#define TSAPPLICATIONTASK_H
+
+#include "tstask.h"
+
+#include <w32std.h>
+
+class TsApplicationTask : public TsTask
+{
+    
+public:
+    TsApplicationTask(RWsSession &wsSession, CTsEntry* entry);
+    
+    virtual void open();
+    virtual void close();
+
+private:
+    RWsSession &mWsSession;
+    
+};
+
+#endif //TSAPPLICATIONTASK_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/s60/inc/tsscreenshotclient.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#ifndef TSSCREENSHOTCLIENT_H
+#define TSSCREENSHOTCLIENT_H
+
+#include <e32base.h>
+
+#include "tstaskmonitorglobals.h"
+
+class CFbsBitmap;
+class CTsScreenshotClientImpl;
+
+NONSHARABLE_CLASS( CTsScreenshotClient ) : public CBase
+{
+public:
+    IMPORT_C static CTsScreenshotClient* NewL();
+    IMPORT_C static CTsScreenshotClient* NewLC();
+    IMPORT_C ~CTsScreenshotClient();
+
+public:
+    IMPORT_C TInt RegisterScreenshot(CFbsBitmap *screenshot, TInt wgId, UpdatePriority priority = Normal);
+    IMPORT_C void RegisterScreenshot(TRequestStatus &status, CFbsBitmap *screenshot, TInt wgId, UpdatePriority priority = Normal);
+    IMPORT_C TInt UnregisterScreenshot(TInt wgId);
+    IMPORT_C TInt SetVisibility(TInt wgId, Visibility value);
+
+private:
+    CTsScreenshotClient();
+    void ConstructL();
+
+private:
+    CTsScreenshotClientImpl* iImpl;
+};
+
+#endif  // TSSCREENSHOTCLIENT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/s60/inc/tsscreenshotclientimpl.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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 TSSCREENSHOTCLIENTIMPL_H
+#define TSSCREENSHOTCLIENTIMPL_H
+
+#include <e32base.h>
+
+#include "tstaskmonitorglobals.h"
+#include "tssession.h"
+
+class CFbsBitmap;
+
+NONSHARABLE_CLASS( CTsScreenshotClientImpl ) : public CBase
+{
+public:
+    static CTsScreenshotClientImpl* NewL();
+    static CTsScreenshotClientImpl* NewLC();
+    ~CTsScreenshotClientImpl();
+
+public:
+    TInt RegisterScreenshot(CFbsBitmap *screenshot, TInt wgId, UpdatePriority priority);
+    void RegisterScreenshot(TRequestStatus &status, CFbsBitmap *screenshot, TInt wgId, UpdatePriority priority);
+    TInt UnregisterScreenshot(TInt wgId);
+    TInt SetVisibility(TInt wgId, Visibility value);
+
+private:
+    CTsScreenshotClientImpl();
+    void ConstructL();
+
+    RTsSession iSession;
+};
+
+#endif  // TSSCREENSHOTCLIENTIMPL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/s60/inc/tssession.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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 TSSESSION_H
+#define TSSESSION_H
+
+#include <e32base.h>
+
+#include "tstaskmonitorglobals.h"
+#include "tsentry.h"
+
+NONSHARABLE_CLASS( RTsSession ) : public RSessionBase
+{
+public:
+    TInt Connect();
+
+public: // task monitor API
+    void TaskListL(RTsFswArray& tasks);
+    void Subscribe(TRequestStatus& aStatus);
+    void CancelSubscribe();
+
+public: // screenshots API
+    TInt RegisterScreenshot(CFbsBitmap *screenshot, TInt wgId, UpdatePriority priority);
+    void RegisterScreenshot(TRequestStatus &status, CFbsBitmap *screenshot, TInt wgId, UpdatePriority priority);
+    TInt UnregisterScreenshot(TInt wgId);
+    TInt SetVisibility(TInt wgId, Visibility value);
+    
+private:
+    TInt StartServer();
+};
+
+#endif  // TSSESSION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/s60/inc/tstaskmonitor_p.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#ifndef TSTASKMONITOR_P_H
+#define TSTASKMONITOR_P_H
+
+#include "tstaskmonitorobserver.h"
+
+#include <w32std.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;
+    RWsSession &mWsSession;
+};
+
+#endif //TSTASKMONITOR_P_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/s60/inc/tstaskmonitorclient.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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 "tsentry.h"
+
+class MTsTaskMonitorObserver;
+class CTsTaskMonitorClientImpl;
+
+NONSHARABLE_CLASS( CTsTaskMonitorClient ) : public CBase
+{
+public:
+    static CTsTaskMonitorClient* NewL();
+    static CTsTaskMonitorClient* NewLC();
+    ~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 Jul 22 16:37:03 2010 +0100
@@ -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 "tsentry.h"
+#include "tssession.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();
+
+    RTsSession 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 Jul 22 16:37:03 2010 +0100
@@ -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/tstasksettings_p.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#ifndef TSTASKSETTINGS_P_H
+#define TSTASKSETTINGS_P_H
+
+#include <QPixmap>
+
+class CTsScreenshotClient;
+
+class TsTaskSettingsPrivate
+{
+public:
+    TsTaskSettingsPrivate();
+    ~TsTaskSettingsPrivate();
+
+public:
+    bool registerScreenshot(const QPixmap &screenshot);
+    bool unregisterScreenshot();
+    bool setVisibility(bool visibility);
+
+private:
+    int wgId();
+    
+private:
+    CTsScreenshotClient *mClient;   
+    
+};
+
+#endif //TSTASKSETTINGS_P_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/s60/src/tsapplicationtask.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -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 "tsapplicationtask.h"
+
+#include <apgtask.h>
+#include <eikenv.h>
+#include <AknDef.h>
+
+#include "tsentry.h"
+
+TsApplicationTask::TsApplicationTask(RWsSession &wsSession, CTsEntry* entry) : TsTask(entry), mWsSession(wsSession)
+{
+}
+
+void TsApplicationTask::open()
+{
+    TApaTaskList taskList(mWsSession);
+    TApaTask task = taskList.FindApp(mEntry->AppUid());
+    task.BringToForeground();
+}
+
+void TsApplicationTask::close()
+{
+    TWsEvent event;
+    event.SetTimeNow();
+    event.SetType(KAknShutOrHideApp);
+    mWsSession.SendEventToWindowGroup(mEntry->Key().WindowGroupId(), event);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/s60/src/tsscreenshotclient.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -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 <s32mem.h>
+
+#include "tsscreenshotclient.h"
+#include "tsscreenshotclientimpl.h"
+
+EXPORT_C CTsScreenshotClient *CTsScreenshotClient::NewL()
+{
+    CTsScreenshotClient* self = NewLC();
+    CleanupStack::Pop(self);
+    return self;
+}
+
+EXPORT_C CTsScreenshotClient *CTsScreenshotClient::NewLC()
+{
+    CTsScreenshotClient* self = new (ELeave) CTsScreenshotClient;
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+}
+
+void CTsScreenshotClient::ConstructL()
+{
+    iImpl = CTsScreenshotClientImpl::NewL();
+}
+
+CTsScreenshotClient::CTsScreenshotClient()
+{
+}
+
+EXPORT_C CTsScreenshotClient::~CTsScreenshotClient()
+{
+    delete iImpl;
+}
+
+EXPORT_C TInt CTsScreenshotClient::RegisterScreenshot(CFbsBitmap *screenshot, TInt wgId, UpdatePriority priority)
+{
+    return iImpl->RegisterScreenshot(screenshot, wgId, priority);
+}
+
+EXPORT_C void CTsScreenshotClient::RegisterScreenshot(TRequestStatus &status, CFbsBitmap *screenshot, TInt wgId, UpdatePriority priority)
+{
+    iImpl->RegisterScreenshot(status, screenshot, wgId, priority);
+}
+
+EXPORT_C TInt CTsScreenshotClient::UnregisterScreenshot(TInt wgId)
+{
+    return iImpl->UnregisterScreenshot(wgId);
+}
+
+EXPORT_C TInt CTsScreenshotClient::SetVisibility(TInt wgId, Visibility value)
+{
+    return iImpl->SetVisibility(wgId, value);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/s60/src/tsscreenshotclientimpl.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,69 @@
+    /*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#include <e32base.h>
+
+#include "tsscreenshotclientimpl.h"
+
+CTsScreenshotClientImpl* CTsScreenshotClientImpl::NewL()
+{
+    CTsScreenshotClientImpl* self = NewLC();
+    CleanupStack::Pop(self);
+    return self;
+}
+
+CTsScreenshotClientImpl* CTsScreenshotClientImpl::NewLC()
+{
+    CTsScreenshotClientImpl* self = new (ELeave) CTsScreenshotClientImpl;
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+}
+
+CTsScreenshotClientImpl::CTsScreenshotClientImpl()
+{
+}
+
+CTsScreenshotClientImpl::~CTsScreenshotClientImpl()
+{
+    iSession.Close();
+}
+
+void CTsScreenshotClientImpl::ConstructL()
+{
+    User::LeaveIfError(iSession.Connect());
+}
+
+TInt CTsScreenshotClientImpl::RegisterScreenshot(CFbsBitmap *screenshot, TInt wgId, UpdatePriority priority)
+{
+    return iSession.RegisterScreenshot(screenshot, wgId, priority);
+}
+
+void CTsScreenshotClientImpl::RegisterScreenshot(TRequestStatus &status, CFbsBitmap *screenshot, TInt wgId, UpdatePriority priority)
+{
+    iSession.RegisterScreenshot(status, screenshot, wgId, priority);
+}
+
+TInt CTsScreenshotClientImpl::UnregisterScreenshot(TInt wgId)
+{
+    return iSession.UnregisterScreenshot(wgId);
+}
+
+TInt CTsScreenshotClientImpl::SetVisibility(TInt wgId, Visibility value)
+{
+    return iSession.SetVisibility(wgId, value);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/s60/src/tssession.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,148 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include <s32mem.h>
+#include <fbs.h>
+
+#include "tssession.h"
+
+TInt RTsSession::Connect()
+{
+    TInt retry = 4;
+    TInt error(KErrNone);
+    do {
+        error = CreateSession(KRunningAppServerName, TVersion(0, 0, 0));
+        if (KErrNotFound != error && KErrServerTerminated != error) {
+            retry = 0;
+        } else {
+            error = StartServer();
+            if (KErrNone != error && KErrAlreadyExists != error) {
+                retry = 0;
+                error = CreateSession(KRunningAppServerName, TVersion(0, 0, 0));
+            }
+        }
+    } while (--retry > 0);
+    return error;
+}
+
+TInt RTsSession::StartServer()
+{
+    RProcess server;
+    if (TInt error = server.Create(KRunningAppServerName, KNullDesC, TUidType(KNullUid, KNullUid, KRunningAppServerUid))) {
+        return error;
+    }
+
+    TRequestStatus status;
+    server.Rendezvous(status);
+    if (status != KRequestPending) {
+        server.Kill(0);
+    } else {
+        server.Resume();
+    }
+
+    User::WaitForRequest(status);
+    TInt error = (EExitPanic == server.ExitType()) ? KErrGeneral : status.Int();
+    if (KErrCancel == error) {
+        error = KErrNone;
+    }
+    server.Close();
+
+    return error;
+}
+
+void RTsSession::TaskListL(RTsFswArray& tasks)
+{
+    for (;;) {
+        TPckgBuf<TInt> dataSize;
+        User::LeaveIfError(SendReceive(GetRunningAppInfo, TIpcArgs(&dataSize)));
+        HBufC8* data = HBufC8::NewLC(dataSize());
+        TPtr8 dataPointer(data->Des());
+        TInt err = SendReceive(FlushData, TIpcArgs(&dataPointer, dataSize()));
+        if (err == KErrNone) {
+            RDesReadStream dataStream(dataPointer);
+            CleanupClosePushL(dataStream);
+            CTsEntry::InternalizeArrayL(dataStream, tasks);
+            CleanupStack::PopAndDestroy(&dataStream);
+        } else if (err != KErrCorrupt) {
+            User::Leave(err);
+        }
+        CleanupStack::PopAndDestroy(data);
+        if (err == KErrNone) {
+            break;
+        }
+        // If result was KErrCorrupt then the size received from GetRunningAppInfo is
+        // not valid anymore so restart the whole procedure.
+    }
+}
+
+void RTsSession::Subscribe(TRequestStatus& aStatus)
+{
+    SendReceive(SubscribeRunningAppChanges, aStatus);
+}
+
+void RTsSession::CancelSubscribe()
+{
+    SendReceive(CancelSubscribeRunningAppChanges);
+}
+
+TInt RTsSession::RegisterScreenshot(CFbsBitmap *screenshot, TInt wgId, UpdatePriority priority)
+{
+    TPckgBuf<TInt> screenshotPackage(screenshot->Handle());
+    TPckgBuf<TInt> wgIdPackage(wgId);
+    TPckgBuf<TInt> priorityPackage(priority);
+
+    TIpcArgs arguments;
+    arguments.Set(ScreenshotHandle, &screenshotPackage);
+    arguments.Set(WindowsGroup, &wgIdPackage);
+    arguments.Set(AdditionalParameters, &KNullDesC8);
+    arguments.Set(Priority, &priorityPackage);
+
+    return SendReceive(RegisterScreenshotMessage, arguments);
+}
+
+void RTsSession::RegisterScreenshot(TRequestStatus &status, CFbsBitmap *screenshot, TInt wgId, UpdatePriority priority)
+{
+    TPckgBuf<TInt> screenshotPackage(screenshot->Handle());
+    TPckgBuf<TInt> wgIdPackage(wgId);
+    TPckgBuf<TInt> priorityPackage(priority);
+
+    TIpcArgs arguments;
+    arguments.Set(ScreenshotHandle, &screenshotPackage);
+    arguments.Set(WindowsGroup, &wgIdPackage);
+    arguments.Set(AdditionalParameters, &KNullDesC8);
+    arguments.Set(Priority, &priorityPackage);
+
+    SendReceive(RegisterScreenshotMessage, arguments, status);
+}
+
+TInt RTsSession::UnregisterScreenshot(TInt wgId)
+{
+    TPckgBuf<TInt> wgIdPackage(wgId);
+    
+    TIpcArgs arguments;
+    arguments.Set(WindowsGroup, &wgIdPackage);
+    arguments.Set(AdditionalParameters, &KNullDesC8);
+    
+    return SendReceive(UnregisterScreenshotMessage, arguments);
+}
+
+TInt RTsSession::SetVisibility(TInt wgId, Visibility value)
+{
+    TPckgBuf<TInt> windowGroup(wgId), visibilityValue(value);
+    
+    TIpcArgs arguments(&windowGroup, &visibilityValue);
+    return SendReceive(VisibilityChange, arguments);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/s60/src/tstask.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,93 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "tsentry.h"
+
+/*!
+    @class TsTask
+    @ingroup publicApi
+    @brief TsTask object represents a single task.
+    
+    This class is one of the Qt interfaces for Task Monitor server. It can be
+    used to set custom screenshot of the task, or to change the task visibility.
+*/
+
+/*!
+    @internal
+    Constructor. 
+    Takes ownership over @a entry.
+*/
+TsTask::TsTask(CTsEntry* entry) : mEntry(entry)
+{
+}
+
+/*!
+    Destructor.
+*/
+TsTask::~TsTask()
+{
+    delete mEntry;
+}
+
+/*!
+    @return True if it's possible to close the task, false otherwise.
+*/
+bool TsTask::isClosable() const
+{
+    return mEntry->CloseableApp();
+}
+
+/*!
+    @return Icon of the task.
+*/
+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;
+}
+
+/*!
+    @return Screenshot of the task.
+*/
+QPixmap TsTask::screenshot() const
+{
+    return QPixmap::fromSymbianCFbsBitmap(mEntry->Screenshot());
+}
+
+/*!
+    @return Name of the task.
+*/
+QString TsTask::name() const
+{
+    return XQConversions::s60DescToQString(mEntry->AppName());
+}
+
+/*!
+    @fn TsTask::open()
+    Start or bring the task to foreground.
+*/
+
+/*!
+    @fn TsTask::close()
+    Close the task.
+*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/s60/src/tstaskmonitor_p.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#include "tstaskmonitor_p.h"
+#include "tstaskmonitor.h"
+
+#include <eikenv.h>
+
+#include "tstaskmonitorclient.h"
+#include "tsapplicationtask.h"
+
+#include "tsutils.h"
+using TaskSwitcher::CleanupResetAndDestroyPushL;
+
+TsTaskMonitorPrivate::TsTaskMonitorPrivate(TsTaskMonitor *q) : q_ptr(q), mClient(0), mWsSession(CEikonEnv::Static()->WsSession())
+{
+    QT_TRAP_THROWING(mClient = CTsTaskMonitorClient::NewL());
+    mClient->Subscribe(*this);
+}
+
+TsTaskMonitorPrivate::~TsTaskMonitorPrivate()
+{
+    mClient->CancelSubscribe();
+    delete mClient;
+}
+
+QList< QSharedPointer<TsTask> > TsTaskMonitorPrivate::taskList()
+{
+    QList< QSharedPointer<TsTask> > tasks;
+
+    QT_TRAP_THROWING (    
+        RPointerArray<CTsEntry> entries;   
+        CleanupResetAndDestroyPushL<CTsEntry>(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()) {
+            CTsEntry *firstEntry = entries[0];
+            CleanupStack::PushL(firstEntry);
+            entries.Remove(0);
+            
+            // @todo switch by entry type
+            QT_TRYCATCH_LEAVING(tasks.append(QSharedPointer<TsTask>(new TsApplicationTask(mWsSession, 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 Jul 22 16:37:03 2010 +0100
@@ -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"
+
+CTsTaskMonitorClient *CTsTaskMonitorClient::NewL()
+{
+    CTsTaskMonitorClient* self = NewLC();
+    CleanupStack::Pop(self);
+    return self;
+}
+
+CTsTaskMonitorClient *CTsTaskMonitorClient::NewLC()
+{
+    CTsTaskMonitorClient* self = new (ELeave) CTsTaskMonitorClient;
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+}
+
+void CTsTaskMonitorClient::ConstructL()
+{
+    iImpl = CTsTaskMonitorClientImpl::NewL();
+}
+
+CTsTaskMonitorClient::CTsTaskMonitorClient()
+{
+}
+
+CTsTaskMonitorClient::~CTsTaskMonitorClient()
+{
+    delete iImpl;
+}
+
+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 Jul 22 16:37:03 2010 +0100
@@ -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 "tsentry.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/tstasksettings_p.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,60 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#include "tstasksettings_p.h"
+
+#include <fbs.h>
+#include <coecntrl.h>
+#include <QScopedPointer>
+#include <QApplication>
+#include <QDesktopWidget>
+
+#include "tsscreenshotclient.h"
+#include "tstaskmonitorglobals.h"
+
+TsTaskSettingsPrivate::TsTaskSettingsPrivate() : mClient(0)
+{
+    QT_TRAP_THROWING(mClient = CTsScreenshotClient::NewL());
+}
+
+TsTaskSettingsPrivate::~TsTaskSettingsPrivate()
+{
+    delete mClient;
+}
+
+bool TsTaskSettingsPrivate::registerScreenshot(const QPixmap &screenshot)
+{    
+    QScopedPointer<CFbsBitmap> bitmap(screenshot.toSymbianCFbsBitmap());
+    if (bitmap.isNull()) 
+        return false;
+
+    return KErrNone == mClient->RegisterScreenshot(bitmap.data(), wgId());
+}
+
+bool TsTaskSettingsPrivate::unregisterScreenshot()
+{
+    return KErrNone == mClient->UnregisterScreenshot(wgId());
+}
+
+bool TsTaskSettingsPrivate::setVisibility(bool visibility)
+{
+    return (KErrNone == mClient->SetVisibility(wgId(), visibility ? Visible : Invisible));
+}
+
+int TsTaskSettingsPrivate::wgId()
+{
+    return QApplication::desktop()->winId()->ControlEnv()->RootWin().WindowGroupId();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/src/tstaskmonitor.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#include "tstaskmonitor.h"
+#include "tstaskmonitor_p.h"
+
+#include "tstask.h"
+
+/*!
+    @class TsTaskMonitor
+    @ingroup publicApi
+    @brief TsTaskMonitor gives access to list of running tasks.
+    
+    This class is one of the Qt interfaces for Task Monitor server. It can be
+    used to retrieve list of running tasks and receive notifications about the
+    changes of this list.
+*/
+
+/*!
+    Constructor.
+*/
+TsTaskMonitor::TsTaskMonitor(QObject *parent) : QObject(parent), d_ptr(0)
+{
+    d_ptr = new TsTaskMonitorPrivate(this);
+}
+
+/*!
+    Destructor.
+*/
+TsTaskMonitor::~TsTaskMonitor()
+{
+    delete d_ptr;
+}
+
+/*!
+    \return Current list of tasks from Task Monitor server.
+
+    \sa TsTask, taskListChanged()
+*/
+QList< QSharedPointer<TsTask> > TsTaskMonitor::taskList()
+{
+    return d_ptr->taskList();
+}
+
+/*!
+    @fn TsTaskMonitor::taskListChanged()
+
+    This signal is emitted when task list changes in any way:
+    - the new task is started
+    - running task is terminated
+    - parameters of one task change (for example image representing the task is updated)
+
+    No data is passed within this signal, user should retrieve task list
+    using taskList().
+
+    \sa taskList()
+*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/src/tstasksettings.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#include "tstasksettings.h"
+#include "tstasksettings_p.h"
+
+/*!
+    @class TsTaskSettings
+    @ingroup publicApi
+    @brief TsTaskSettings allows application to alter the way it will be 
+    handled by TsTaskMonitor.
+    
+    This class is one of the Qt interfaces for Task Monitor server. It can be
+    used to set custom screenshot of the task, or to change the task visibility.
+*/
+
+/*!
+    Constructor.
+*/
+TsTaskSettings::TsTaskSettings() : d_ptr(new TsTaskSettingsPrivate())
+{
+}
+
+/*!
+    Destructor.
+*/
+TsTaskSettings::~TsTaskSettings()
+{
+    delete d_ptr;
+}
+
+/*!
+    Overwrites default screenshot of task with \a screenshot. If \a 
+    screenshot is null, this method will return false.
+    @return True if the screenshot is successfully saved, false otherwise.
+*/
+bool TsTaskSettings::registerScreenshot(const QPixmap &screenshot)
+{
+    return d_ptr->registerScreenshot(screenshot);
+}
+
+/*!
+    Removes custom screenshot saved with registerScreenshot(). If there was no
+    saved screenshot, this method will return false.
+    @return True if the screenshot is successfully removed, false otherwise.
+*/
+bool TsTaskSettings::unregisterScreenshot()
+{
+    return d_ptr->unregisterScreenshot();
+}
+
+/*!
+    Changes the \a visibilty of task. Hidden tasks are not present on the task
+    list returned by TsTaskMonitor::taskList().
+    @return True if the visibility is changed successfully, false otherwise.
+*/
+bool TsTaskSettings::setVisibility(bool visibility)
+{
+    return d_ptr->setVisibility(visibility);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/stub/inc/tsentry.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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 CTsEntry
+{
+public:
+    CTsEntry();
+};
+
+#endif //TSFSWENTRY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/stub/inc/tstaskmonitor_p.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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/inc/tstasksettings_p.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#ifndef TSTASKSETTINGS_P_H
+#define TSTASKSETTINGS_P_H
+
+#include <QPixmap>
+
+class TsTaskSettingsPrivate
+{
+public:
+    bool registerScreenshot(const QPixmap &screenshot);
+    bool unregisterScreenshot();
+};
+
+#endif //TSTASKSETTINGS_P_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/stub/src/tsentry.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -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 "tsentry.h"
+
+CTsEntry::CTsEntry()
+{
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/stub/src/tstask.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#include "tstask.h"
+#include "tsentry.h"
+
+TsTask::TsTask(CTsEntry* entry) : mEntry(entry)
+{
+}
+
+TsTask::~TsTask()
+{
+    delete mEntry;
+}
+
+bool TsTask::isClosable() const
+{
+    return false;
+}
+
+QPixmap TsTask::icon() const
+{
+    return QPixmap();
+}
+
+QPixmap TsTask::screenshot() 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 Jul 22 16:37:03 2010 +0100
@@ -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/client/stub/src/tstasksettings_p.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#include "tstasksettings_p.h"
+
+bool TsTaskSettingsPrivate::registerScreenshot(const QPixmap &screenshot)
+{
+    Q_UNUSED(screenshot);
+    return true;
+}
+
+bool TsTaskSettingsPrivate::unregisterScreenshot()
+{
+    return true;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/inc/tstaskmonitorglobals.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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: 
+*
+*/
+#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,
+    RegisterScreenshotMessage,
+    UnregisterScreenshotMessage,
+    VisibilityChange
+};
+
+enum UpdatePriority {
+    Low = 0,
+    Normal,
+    High
+};
+
+enum Visibility {
+    Invisible =0,
+    Visible
+};
+
+enum ScreenshotMessageOffsets {
+    ScreenshotHandle = 0,
+    WindowsGroup,
+    AdditionalParameters,
+    Priority
+};
+
+#endif  //RUNNINGAPPGLOBALS_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/rom.pri	Thu Jul 22 16:37:03 2010 +0100
@@ -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 Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef __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
+
+file=ABI_DIR\BUILD_DIR\tsbackstepping.dll                   SHARED_LIB_DIR\tsbackstepping.dll
+
+
+ECOM_PLUGIN( tsscreenshotplugin.dll, tsscreenshotplugin.rsc )
+
+// stub sis
+data=ZSYSTEM/install/taskmonitor_stub.sis                  system/install/taskmonitor_stub.sis
+
+#endif //__TSTASKMONITOR_CORE_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/screenshotplugin/group/bld.inf	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,21 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_MMPFILES
+tsscreenshotplugin.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/screenshotplugin/group/tsscreenshotplugin.mmp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+TARGET          tsscreenshotplugin.dll
+TARGETTYPE      PLUGIN 
+UID             0x10009D8D 0x200267AE
+CAPABILITY      CAP_ECOM_PLUGIN
+VENDORID        VID_DEFAULT
+
+OPTION_REPLACE  ARMCC --arm -O3 --cpu 6
+
+MW_LAYER_SYSTEMINCLUDE
+
+USERINCLUDE     ../inc
+
+SOURCEPATH      ../src
+SOURCE          tsscreenshotmain.cpp
+SOURCE          tsscreenshotplugin.cpp
+
+RESOURCE        tsscreenshotplugin.rss
+
+LIBRARY         ecom.lib
+LIBRARY         euser.lib
+LIBRARY         wsgraphicdrawer.lib
+LIBRARY         fbscli.lib
+LIBRARY         estor.lib
+LIBRARY         gdi.lib 
+LIBRARY         tstaskmonitorclient.lib
+DEBUGLIBRARY    flogger.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/screenshotplugin/inc/tsscreenshotplugin.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,87 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#ifndef TSSCREENSHOTPLUGIN_H
+#define TSSCREENSHOTPLUGIN_H
+
+#include <w32std.h>
+#include <graphics/wsgraphicdrawerinterface.h>
+#include <graphics/wsgraphicdrawer.h>
+
+class CTsScreenshotPlugin: public CWsGraphicDrawer, 
+                           public MWsEventHandler
+{
+public:
+    /**
+     * Two phase constructor 
+     */
+    
+    static CTsScreenshotPlugin* NewL();
+    
+    /**
+     * Destructor
+     */
+    ~CTsScreenshotPlugin();
+
+private:
+    /**
+     * From CWsGraphicDrawer.
+     * @see CWsGraphicDrawer::DoDraw(MWsGc&, const TRect&, const TDesC8&) const
+     */ 
+    void DoDraw(MWsGc&, const TRect&, const TDesC8&) const;
+    
+    /**
+     * From CWsGraphicDrawer
+     * @see CWsGraphicDrawer::HandleMessage(const TDesC8&)
+     */
+    void HandleMessage(const TDesC8&);
+    
+    void HandleMessageL(const TDesC8&);
+    
+    /**
+     * From CWsGraphicDrawer
+     * @see CWsGraphicDrawer::ConstructL(MWsGraphicDrawerEnvironment&, const TGraphicDrawerId& , MWsClient&, const TDesC8&)
+     */
+    void ConstructL(MWsGraphicDrawerEnvironment& env, 
+                    const TGraphicDrawerId& id, 
+                    MWsClient& owner, 
+                    const TDesC8& data);
+    
+    /**
+     * From MWsEventHandler.
+     * 
+     * @see MWsEventHandler::DoHandleEvent(const TWservCrEvent&)
+     */
+    void DoHandleEvent(const TWservCrEvent& event);
+    
+    /**
+     * Function take screenshot od current display
+     * @param screenshot identyfier
+     */
+    void TakeScreenshot(TInt);
+        
+    /**
+     * Function take screenshot od current display
+     * @param screenshot identyfier
+     */
+    void TakeScreenshotL(TInt);
+
+private:
+    RPointerArray<CFbsBitmap> mCache;
+    TInt mWindowGroupId;
+};
+
+#endif //TSSCREENSHOTPLUGIN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/screenshotplugin/screenshotplugin.pro	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,20 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+TEMPLATE = subdirs
+
+BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include \"group/bld.inf\""
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/screenshotplugin/src/tsscreenshotmain.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include <ecom/implementationproxy.h>
+#include "tsscreenshotplugin.h"
+
+const TInt KImpId( 0x200267AE );
+
+// --------------------------------------------------------------------------
+// KImplementationTable
+// --------------------------------------------------------------------------
+//    
+LOCAL_C const TImplementationProxy KImplementationTable[] = 
+{
+    IMPLEMENTATION_PROXY_ENTRY(KImpId, CTsScreenshotPlugin::NewL)
+};
+
+// --------------------------------------------------------------------------
+// ImplementationGroupProxy
+// --------------------------------------------------------------------------
+//    
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+{
+    aTableCount = (sizeof(KImplementationTable) / sizeof(TImplementationProxy));
+    return KImplementationTable;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/screenshotplugin/src/tsscreenshotplugin.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,176 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "tsscreenshotplugin.h"
+#include "tstaskmonitorglobals.h"
+#include <graphics/wsscreendevice.h>
+#include <s32mem.h>
+
+const TInt KMsgSize(5);
+const TInt KInvalidGroupId(~0);
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+CTsScreenshotPlugin* CTsScreenshotPlugin::NewL()
+{
+    //no second step construction is required here
+    //window server will initialize plugin later
+    return new(ELeave)CTsScreenshotPlugin();
+}
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+void CTsScreenshotPlugin::ConstructL(MWsGraphicDrawerEnvironment& env, 
+                                     const TGraphicDrawerId& id, 
+                                     MWsClient& owner, 
+                                     const TDesC8& /*data*/ )
+{
+    BaseConstructL(env, id, owner);
+    env.RegisterEventHandler(this, 
+                             this, 
+                             TWservCrEvent::EWindowGroupChanged |
+                             TWservCrEvent::EDeviceOrientationChanged);
+    mWindowGroupId = KInvalidGroupId;
+}
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+CTsScreenshotPlugin::~CTsScreenshotPlugin()
+{
+    Env().UnregisterEventHandler(this);
+    mCache.ResetAndDestroy();
+}
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+void CTsScreenshotPlugin::DoDraw(MWsGc&, const TRect&, const TDesC8&) const
+{
+    //plugin is not a real drawer
+    //no implementation required
+}
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+void CTsScreenshotPlugin::HandleMessage(const TDesC8& msg)
+{
+    TRAP_IGNORE(HandleMessageL(msg));
+}
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+void CTsScreenshotPlugin::HandleMessageL(const TDesC8& msg)
+{
+    TInt parsedMsg[KMsgSize];
+    RDesReadStream msgStream(msg);
+    for (TInt iter(0); iter < KMsgSize; ++iter) {
+        parsedMsg[iter] = msgStream.ReadInt32L(); 
+    }
+    
+    if (RegisterScreenshotMessage == parsedMsg[0]) { //Screenshot registeration ACK 
+        for(TInt iter(0); iter < mCache.Count(); ++iter) {
+            if (mCache[iter]->Handle() == parsedMsg[ScreenshotHandle + 1]) {
+                //bitmap is not needed no more
+                delete mCache[iter];
+                mCache.Remove(iter);
+                break;
+            }
+        }
+    }
+}
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+void CTsScreenshotPlugin::DoHandleEvent(const TWservCrEvent& event)
+{
+    switch (event.Type()) {
+    case TWservCrEvent::EWindowGroupChanged:
+        if (KInvalidGroupId != mWindowGroupId) {
+            TakeScreenshot(mWindowGroupId);
+        }
+        mWindowGroupId = event.WindowGroupIdentifier();
+        break;
+    case TWservCrEvent::EDeviceOrientationChanged:
+        TakeScreenshot(mWindowGroupId);
+        break;
+    }
+}
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+void CTsScreenshotPlugin::TakeScreenshot(TInt id)
+{
+    TRAP_IGNORE(TakeScreenshotL(id);)
+}
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+void CTsScreenshotPlugin::TakeScreenshotL(TInt id)
+{
+    if(0 >= Env().ScreenCount()) {
+        User::Leave(KErrCorrupt);
+    }
+    const TInt screenId(0); //use local variable in case of changing screen selection policy
+    const MWsScreenConfig* const screenConfig = 
+        Env().Screen(screenId)->ObjectInterface<MWsScreenConfig>();
+    const MWsScreenDevice* const screenDevice = 
+        static_cast<MWsScreenDevice*>(Env().Screen(screenId)->ResolveObjectInterface(MWsScreenDevice::EWsObjectInterfaceId));
+    
+    User::LeaveIfNull(screenConfig);
+    User::LeaveIfNull(screenDevice);
+    
+    //prepare destination bitmap
+    CFbsBitmap *bitmap = new (ELeave) CFbsBitmap();
+    CleanupStack::PushL(bitmap);
+    
+    
+    User::LeaveIfError(bitmap->Create(screenConfig->SizeInPixels(), 
+                                screenConfig->DisplayMode()));
+    
+    screenDevice->CopyScreenToBitmapL(bitmap, 
+                                      screenConfig->SizeInPixels());
+    
+    
+    //prepare and send message
+    TInt msg[KMsgSize] = {RegisterScreenshotMessage};
+    
+    msg[WindowsGroup + 1] = id;
+    msg[ScreenshotHandle + 1] = bitmap->Handle();
+    msg[Priority + 1] = Low;
+    msg[AdditionalParameters + 1] = 0; //unused
+    
+    const TPckgC<TInt[sizeof(msg) / sizeof(TInt)]> buf(msg);
+    
+    User::LeaveIfError(SendMessage(buf));
+    
+    mCache.AppendL(bitmap);
+    CleanupStack::Pop(bitmap);
+    
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/screenshotplugin/src/tsscreenshotplugin.rss	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ECOM registration file
+*
+*/
+
+
+#include <ecom/registryinfo.rh>
+
+RESOURCE REGISTRY_INFO theInfo
+	{
+	dll_uid = 0x200267AE;
+	interfaces =
+		{
+		INTERFACE_INFO
+			{
+			interface_uid = 0x10281924;
+			implementations =
+				{
+				IMPLEMENTATION_INFO
+					{
+					implementation_uid = 0x200267AE;
+					version_no = 1;
+					display_name = "tsscreenshotplugin";
+					default_data = "";
+					opaque_data = "";
+					}
+				};
+			}
+		};
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/server/group/bld.inf	Thu Jul 22 16:37:03 2010 +0100
@@ -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 Jul 22 16:37:03 2010 +0100
@@ -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:
+*
+*/
+TARGET          hsrunningappmonitor.exe
+TARGETTYPE      exe
+UID             0 0x200267B0
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../inc
+USERINCLUDE     ../../../inc
+USERINCLUDE     ../../utils/inc
+USERINCLUDE     ../../backstepping/inc
+
+MW_LAYER_SYSTEMINCLUDE 
+
+SOURCEPATH      ../src
+SOURCE          main.cpp
+SOURCE          hsrunningappserver.cpp
+SOURCE          hsrunningappsession.cpp
+SOURCE          hsdataobservertask.cpp
+SOURCE          hsdataprovidertask.cpp
+SOURCE          tsdatatask.cpp
+
+SOURCE          tsrunningappstorage.cpp
+SOURCE          tsdatalist.cpp
+SOURCE          tsscreenshotprovider.cpp
+
+SOURCEPATH      ../../utils/src
+SOURCE          tsentrykey.cpp
+SOURCE          tsentrykeygenerator.cpp
+SOURCE          tsentry.cpp
+
+
+LIBRARY         euser.lib 
+LIBRARY         estor.lib
+LIBRARY         apparc.lib
+LIBRARY         ws32.lib
+LIBRARY         apgrfx.lib
+LIBRARY         fbscli.lib
+LIBRARY         bitgdi.lib
+LIBRARY         aknicon.lib
+LIBRARY         tsutils.lib
+LIBRARY         tsbackstepping.lib
+
+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/hsdataobservertask.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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 "tsdataobserver.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 Jul 22 16:37:03 2010 +0100
@@ -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 DATAPROVIDER_H
+#define DATAPROVIDER_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 Jul 22 16:37:03 2010 +0100
@@ -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 DATAPROVIDERTASK_H
+#define DATAPROVIDERTASK_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 Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,83 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef RUNNINGAPPSERVER_H
+#define RUNNINGAPPSERVER_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <w32std.h>
+#include "tsdataobserver.h"
+
+class CRunningAppStorage;
+class CTsResourceManager;
+class CTsWindowGroupsMonitor;
+/**
+ *  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;
+    RWsSession mWsSession;
+    CTsResourceManager* mResources;
+    CTsWindowGroupsMonitor* mMonitor;
+    CRunningAppStorage* mStorage;
+    
+    CBase *mScreenshotProviderStarter;
+    CBase *mBacksteppingEngine;
+};
+
+#endif // RUNNINGAPPSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/server/inc/hsrunningappsession.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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 RUNNINGAPPSESSION_H
+#define RUNNINGAPPSESSION_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include "tsdataobserver.h"
+#include "hsdataprovider.h"
+#include "tsdatastorage.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,
+                                    MTsDataStorage& dataStorage);
+
+private:
+
+    /**
+     * Constructor for performing 1st stage construction
+     */
+    CRunningAppSession(MHsDataObserverStorage& observerStorage, 
+                       const MHsDataProvider& dataProvider,
+                       MTsDataStorage& dataStorage);
+
+    /**
+     * 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;
+    MTsDataStorage& mDataStorage;
+};
+
+#endif // RUNNINGAPPSESSION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/server/inc/tsdatalist.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,115 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Non-closeable app list class
+ *
+*/
+
+
+#ifndef TSDATALIST_H
+#define TSDATALIST_H
+
+#include <e32base.h>
+#include <tswindowgroupsobserver.h>
+#include "tsentry.h"
+#include "tsdatastorage.h"
+#include "tsdataobserver.h"
+
+class CApaWindowGroupName;
+class CFbsBitmap;
+
+NONSHARABLE_CLASS( CTsDataList ) : public CTsWindowGroupsObserver,
+                                   public MTsDataStorage
+    {
+public:
+    static CTsDataList* NewL(MTsResourceManager& resources, 
+                             MTsWindowGroupsMonitor &monitor, 
+                             MHsDataObserver& observer);
+
+    ~CTsDataList();
+
+private:
+    CTsDataList(MTsResourceManager& resources,
+                MTsWindowGroupsMonitor &monitor, 
+                MHsDataObserver& observer);
+
+    void ConstructL();
+
+public:
+    const RTsFswArray& Data() const;
+
+    void HandleWindowGroupChanged(MTsResourceManager &,
+                                  const TArray<RWsSession::TWindowGroupChainInfo> &);
+
+    TBool IsHiddenUid( TUid uid );
+
+    void UpdateL(TInt key,const CFbsBitmap& data, TInt param, TInt priority);
+    
+    void UpdateL(TInt key, const Visibility& data, TInt param);
+
+    void RemoveL(TInt key, TInt param);
+
+private:
+    void CollectAppsL(RTsFswArray& appsList,
+                      const TArray<RWsSession::TWindowGroupChainInfo> &wgList);
+
+    void AddEntryL(const TTsEntryKey& key, 
+                   const TUid& appUid,
+                   CApaWindowGroupName* wgName,
+                   RTsFswArray& newList );
+
+    TBool ConsiderOldDataL( const TTsEntryKey& key );
+
+    HBufC* FindAppNameLC(CApaWindowGroupName* windowName,
+                         const TUid& appUid,
+                         TInt wgId );
+
+    void FitDataToList( RTsFswArray& listToFit);
+
+    TBool CheckIfExists(const CTsEntry& entry,
+                        const RTsFswArray& newList) const;
+
+    void GetAppIconL(const TUid& appUid,
+                     CFbsBitmap*& bitmapArg, 
+                     CFbsBitmap*& maskArg);
+
+    TInt FindEntry(const RTsFswArray& list, const TTsEntryKey& key ) const;
+
+    TBool EstablishOrder(const RArray<TTsEntryKey>& keyList);
+
+    TBool VerifyApplicationL(TUid);
+
+    TTsEntryKey GenerateKeyL(TInt);
+
+    void CompressLookupTable(RArray<TUid> &array);
+
+    void UpdateLookupTableL(RArray<TUid> &array, TInt offset);
+
+private:
+    /**
+     * Resource manager. Not own
+     */
+    MTsResourceManager& mResources;
+    
+    MHsDataObserver &mObserver;
+    
+    RTsFswArray mData; // current fsw content, i.e. the task list
+
+    // list of hidden uids
+    RArray<TUid> mHiddenUids;
+    
+    // list of allowed uids
+    RArray<TUid> mAllowedUids;
+    };
+
+#endif //TSDATALIST_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/server/inc/tsdatastorage.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef DATASTORAGE_H
+#define DATASTORAGE_H
+
+#include <e32base.h>
+#include "tstaskmonitorglobals.h"
+class CFbsBitmap;
+class MTsDataStorage {
+public:
+    virtual void UpdateL(TInt key, const CFbsBitmap& data, TInt param, TInt priority) =0;
+    virtual void UpdateL(TInt key, const Visibility& data, TInt param) =0;
+    virtual void RemoveL(TInt key, TInt param) =0;
+};
+
+#endif //DATASTORAGE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/server/inc/tsdatatask.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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 TSDATATASK_H
+#define TSDATATASK_H
+#include "tstaskmonitorglobals.h"
+#include "tsdatastorage.h"
+class TsDataTask
+{
+public:
+    static void ExecuteL(MTsDataStorage& dataStorage, const RMessage2& msg);
+
+private:
+    static void RegisterScreenshotL(MTsDataStorage& dataStorage, 
+                                    const RMessage2& msg);
+    
+    static void UnregisterScreenshotL(MTsDataStorage& dataStorage, 
+                                      const RMessage2& msg);
+    
+    static void VisibilityChangeL(MTsDataStorage& dataStorage, 
+                                  const RMessage2& msg);
+};
+
+#endif //TSDATATASK_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/server/inc/tsrunningappstorage.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,86 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef RUNNINGAPPSTORAGE_H
+#define RUNNINGAPPSTORAGE_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+#include "tsdataobserver.h"
+#include "hsdataprovider.h"
+#include "tsdatastorage.h"
+
+class CTsDataList;
+class MTsResourceManager;
+class MTsWindowGroupsMonitor;
+
+/**
+ *  CRunningAppServer
+ * 
+ */
+class CRunningAppStorage : public CBase,
+                           public MHsDataProvider, 
+                           public MHsDataObserver,
+                           public MTsDataStorage 
+{
+public:
+    /**
+     * Destructor.
+     */
+    ~CRunningAppStorage();
+
+    /**
+     * Two-phased constructor.
+     */
+    static CRunningAppStorage* NewL(MHsDataObserver& observer,
+                                    MTsResourceManager& resources,
+                                    MTsWindowGroupsMonitor &wsMonitor);
+    
+public: //MHsDataObserver
+    const TDesC8& Data() const; 
+    
+    //MHsDataChangeProvider
+    void DataChanged();
+    
+    void UpdateL(TInt key,const CFbsBitmap& data, TInt param, TInt priority);
+    
+    void UpdateL(TInt key, const Visibility& data, TInt param);
+    
+    void RemoveL(TInt key, TInt param);
+
+private:
+    /**
+     * Constructor for performing 1st stage construction
+     */
+    CRunningAppStorage(MHsDataObserver& observer);
+
+    /**
+     * Default constructor for performing 2nd stage construction
+     */
+    void ConstructL(MTsResourceManager& resources,
+                    MTsWindowGroupsMonitor &wsMonitor);
+    
+    void DataChangedL();
+
+private:
+    MHsDataObserver& mObserver;
+    RBuf8 mData;
+    CTsDataList* mEngine;
+};
+
+#endif // RUNNINGAPPSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/server/inc/tsscreenshotprovider.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef TSSCREENSHOTPROVIDER_H
+#define TSSCREENSHOTPROVIDER_H
+#include "tsdatastorage.h"
+#include <w32std.h>
+
+class CTsScreenshotProvider: public CWsGraphic
+{
+public:
+    static CTsScreenshotProvider* NewL(MTsDataStorage&);
+private:
+    CTsScreenshotProvider(MTsDataStorage&);
+    void HandleMessage(const TDesC8&);
+    void HandleMessageL(const TDesC8&);
+    void OnReplace();
+private:
+    MTsDataStorage& mStorage;
+};
+
+#endif //TSSCREENSHOTTASK_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/server/server.pro	Thu Jul 22 16:37:03 2010 +0100
@@ -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 Jul 22 16:37:03 2010 +0100
@@ -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 Jul 22 16:37:03 2010 +0100
@@ -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 Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,132 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include <tswindowgroupsobserver.h>
+#include "tstaskmonitorglobals.h"
+#include "hsrunningappserver.h"
+#include "hsrunningappsession.h"
+#include "tsrunningappstorage.h"
+#include "tsscreenshotprovider.h"
+#include "tsbackstepping.h"
+
+_LIT(KErrObserverExists, "Observer already exists");
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CRunningAppServer::CRunningAppServer()
+:
+CServer2(EPriorityStandard)
+{
+    // No implementation required
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CRunningAppServer::~CRunningAppServer()
+{
+    delete mBacksteppingEngine;
+    delete mScreenshotProviderStarter;
+    delete mStorage;
+    delete mMonitor;
+    mObservers.ResetAndDestroy();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CRunningAppServer* CRunningAppServer::NewLC()
+{
+    CRunningAppServer* self = new (ELeave) CRunningAppServer();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CRunningAppServer::ConstructL()
+{
+    StartL(KRunningAppServerName);
+    User::LeaveIfError(mWsSession.Connect());
+    mResources = CTsResourceManager::NewL();
+    mMonitor = CTsWindowGroupsMonitor::NewL(*mResources);
+    mStorage = CRunningAppStorage::NewL(*this, *mResources, *mMonitor);
+    TRAP_IGNORE(mScreenshotProviderStarter = CTsScreenshotProvider::NewL(*mStorage);
+    mBacksteppingEngine = CTsBackstepping::NewL(*mMonitor);)
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CSession2* CRunningAppServer::NewSessionL(const TVersion &, const RMessage2&) const
+{
+    return CRunningAppSession::NewL(*const_cast<CRunningAppServer *>(this),
+                                    *const_cast<CRunningAppServer *>(this)->mStorage,
+                                    *const_cast<CRunningAppServer *>(this)->mStorage);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+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 Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,101 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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"
+#include "tsdatatask.h"
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CRunningAppSession::CRunningAppSession(MHsDataObserverStorage& observerStorage,
+                                       const MHsDataProvider& dataProvider,
+                                       MTsDataStorage& dataStorage)
+:
+    mObserverStorage(observerStorage),
+    mDataProvider(dataProvider),
+    mDataStorage(dataStorage)
+{
+    // No implementation required
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CRunningAppSession::~CRunningAppSession()
+{
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CRunningAppSession* CRunningAppSession::NewL(MHsDataObserverStorage& observerStorage, 
+                                             const MHsDataProvider& dataProvider,
+                                             MTsDataStorage& dataStorage)
+{
+    CRunningAppSession* self = new (ELeave) CRunningAppSession(observerStorage, 
+                                                               dataProvider,
+                                                               dataStorage);
+    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;
+        
+    case RegisterScreenshotMessage:
+    case UnregisterScreenshotMessage:
+    case VisibilityChange:
+        TsDataTask::ExecuteL(mDataStorage, message);
+        break;
+    
+    default:
+        message.Complete(CServer2::EBadMessageNumber);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/server/src/main.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -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/tsdatalist.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,541 @@
+/*
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  File containing application list classes
+ *
+ */
+
+//INCLUDES:
+
+#include "tsdatalist.h"
+#include "tsentrykeygenerator.h"
+#include <mmf/common/mmfcontrollerpluginresolver.h> // for CleanupResetAndDestroyPushL
+#include <apgwgnam.h>
+#include <bitstd.h>
+#include <AknIconUtils.h> // avkon
+#include <apgicnfl.h> // fbsbitmap
+#include <AknIconSrvClient.h> 
+#include <fbs.h>
+#include <apgwgnam.h>
+
+
+// size for the created app icons
+const TInt KAppIconWidth = 128;
+const TInt KAppIconHeight = 128;
+
+//uids to be hidden
+const TUid KHsApplicationUid = { 0x20022F35 };
+
+const TInt KMaxLookupSize(75);
+
+// ================= MEMBER FUNCTIONS =======================
+
+// --------------------------------------------------------------------------
+/**
+ * Two-phased constructor.
+ */
+CTsDataList* CTsDataList::NewL(MTsResourceManager& resources,
+                                     MTsWindowGroupsMonitor &monitor, 
+                                     MHsDataObserver& observer)
+{
+    CTsDataList* self = new (ELeave) CTsDataList(resources, monitor, observer);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Constructor.
+ */
+CTsDataList::CTsDataList(MTsResourceManager& resources,
+                         MTsWindowGroupsMonitor &monitor, 
+                         MHsDataObserver& observer) 
+:
+    CTsWindowGroupsObserver(monitor),
+    mResources(resources),
+    mObserver(observer)
+{
+}
+
+// --------------------------------------------------------------------------
+/*
+ * Destructor
+ */
+CTsDataList::~CTsDataList()
+{
+    mData.ResetAndDestroy();
+    mHiddenUids.Close();
+    mAllowedUids.Close();
+    RFbsSession::Disconnect();
+    RAknIconSrvClient::Disconnect();
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Performs 2nd phase construction.
+ */
+void CTsDataList::ConstructL()
+{
+    BaseConstructL();
+    mHiddenUids.AppendL(KHsApplicationUid);
+    User::LeaveIfError(RFbsSession::Connect());
+    RAknIconSrvClient::Connect();
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Returns a reference to the current content.
+ * Also performs sanity checks, e.g. associates application icons
+ * when no screenshot has been received.
+ * @return  ref to content array
+ */
+const RTsFswArray& CTsDataList::Data() const
+{
+    return mData;
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see MTsWindowGroupsObserver HandleWindowGroupChanged
+ */
+void CTsDataList::HandleWindowGroupChanged(MTsResourceManager &, 
+                                              const TArray<RWsSession::TWindowGroupChainInfo> &wgList)
+{
+    TRAP_IGNORE(RTsFswArray newAppsList;
+                CleanupResetAndDestroyPushL(newAppsList);
+                CollectAppsL(newAppsList, wgList);
+                FitDataToList(newAppsList);
+                CleanupStack::PopAndDestroy(&newAppsList));
+    
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Adds running apps to the list.
+ * @param   appsList    array to add to
+ */
+void CTsDataList::CollectAppsL(RTsFswArray& appsList, 
+                               const TArray<RWsSession::TWindowGroupChainInfo> &wgList)
+{
+    TInt offset(KErrNotFound);
+    for (TInt i = 0; i < wgList.Count(); ++i) {
+        TTsEntryKey key = TsEntryKeyGeneraror::GenerateL(wgList[i].iId, wgList);
+        //skip this entry if it is already on list
+        if (FindEntry(appsList, key) >= 0) {
+            continue;
+        }
+
+        // get window group name
+        CApaWindowGroupName* windowName = CApaWindowGroupName::NewLC(mResources.WsSession(), key.WindowGroupId());
+        TUid appUid = windowName->AppUid();
+        
+        //Check hidden applications
+        if (KErrNotFound != (offset = mHiddenUids.Find(appUid))) {
+            UpdateLookupTableL(mHiddenUids, offset);
+        } else if (KErrNotFound != (offset = mAllowedUids.Find(appUid))) {
+            UpdateLookupTableL(mAllowedUids, offset);
+            AddEntryL(key, appUid, windowName, appsList);
+        } else if(VerifyApplicationL(appUid)) {
+            AddEntryL(key, appUid, windowName, appsList);
+        }
+        CleanupStack::PopAndDestroy(windowName);
+    }
+    CompressLookupTable(mHiddenUids);
+    CompressLookupTable(mAllowedUids);
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Called from CollectTasksL for each entry in the task list.
+ * @param   key       entry key
+ * @param   appUid     application uid
+ * @param   wgName     window group name or NULL
+ * @param   newList    list to add to
+ */
+void CTsDataList::AddEntryL(const TTsEntryKey& key, const TUid& appUid,
+    CApaWindowGroupName* wgName, RTsFswArray& newList)
+{
+    CTsEntry* entry = CTsEntry::NewLC(key, &mObserver);
+
+    // check if present in old list and if yes then take some of the old data
+    TBool found = ConsiderOldDataL(key);
+
+    // if not present previously then find out app name
+    // and check if screenshot is already available
+    if (!found) {
+        entry->SetAppUid(appUid);
+        HBufC* name = FindAppNameLC(wgName, appUid, key.WindowGroupId());
+        if (name) {
+            entry->SetAppNameL(*name);
+        }
+        CleanupStack::PopAndDestroy(name);
+
+        if (wgName) {
+            entry->SetCloseableApp(!wgName->IsSystem());
+        }
+        CFbsBitmap* iconBitmap = NULL;
+        CFbsBitmap* iconMask = NULL;
+        GetAppIconL(appUid, iconBitmap, iconMask);
+        //transfer ownership to entry
+        entry->SetAppIcon(iconBitmap, iconMask);
+    }
+
+    // add to new list, ownership is transferred
+    newList.AppendL(entry);
+    CleanupStack::Pop(entry);
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Checks if there is an entry for same app in the content list.
+ * If yes then it takes some of the data for the entry that
+ * will correspond to the same app in the refreshed content list.
+ * @param   key      new key in content list
+ * @return  ETrue if app was found
+ */
+TBool CTsDataList::ConsiderOldDataL(const TTsEntryKey& key)
+{
+    for (TInt entryIdx = 0, oldCount = mData.Count(); entryIdx < oldCount; ++entryIdx) {
+        if (mData[entryIdx]->Key() == key) {
+            return ETrue;
+        }
+    }
+    return EFalse;
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Finds out the application name.
+ * @param   windowName window group name or NULL
+ * @param   appUId     application uid
+ * @param   wgId       window group id
+ * @return  application name, ownership transferred to caller
+ */
+HBufC* CTsDataList::FindAppNameLC(CApaWindowGroupName* windowName, const TUid& appUid, TInt wgId)
+{
+    //Retrieve the app name
+    TApaAppInfo info;
+    mResources.ApaSession().GetAppInfo(info, appUid);
+    TPtrC caption = info.iShortCaption;
+
+    HBufC* tempName = 0;
+    if (!caption.Length() && windowName) // if not set - use thread name instead
+    {
+        if (windowName->Caption().Length()) {
+            tempName = windowName->Caption().AllocL();
+            //put on cleanupstack after the if
+        }
+        else {
+            TThreadId threadId;
+            TInt err = mResources.WsSession().GetWindowGroupClientThreadId(wgId, 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;
+}
+
+// --------------------------------------------------------------------------
+/**
+ * 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   listToFit          list with actual data  
+ */
+void CTsDataList::FitDataToList(RTsFswArray& listToFit)
+{
+    TBool changed = EFalse;
+    TInt listCount = listToFit.Count();
+    TInt dataCount = mData.Count();
+
+    //remove items that dont't exists in newly collected list      
+    for (TInt i = dataCount - 1; i >= 0; --i) {
+        if (!CheckIfExists(*mData[i], listToFit)) {
+            delete mData[i];
+            mData.Remove(i);
+            changed = ETrue;
+        }
+    }
+    RArray<TTsEntryKey> allKeys;
+
+    //add new item at start
+    for (TInt i = listToFit.Count() - 1; i >= 0; --i) {
+        allKeys.Insert(listToFit[i]->Key(), 0);
+        if (!CheckIfExists(*listToFit[i], mData)) {
+            mData.Insert(listToFit[i], 0);
+            listToFit[i] = 0;
+            changed = ETrue;
+        }
+    }
+    //establish order
+    TBool orderChanged = EstablishOrder(allKeys);
+    if (changed || orderChanged) {
+        mObserver.DataChanged();
+    }
+    allKeys.Close();
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Checks if there is an entry for same app in the given list.
+ * @param   entry      entry
+ * @param   newList    ref to list
+ * @return  ETrue if app was found
+ */
+
+TBool CTsDataList::CheckIfExists(const CTsEntry& entry, const RTsFswArray& list) const
+{
+    TBool exists(EFalse);
+    TInt pos = FindEntry(list, entry.Key());
+    if (pos >= 0) {
+        exists = ETrue;
+    }
+    return exists;
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Retrieves the bitmap/mask for the icon of the given app.
+ * @param   appUid application uid
+ * @param   bitmapArg bitmap ptr, ownership transferred to caller, or NULL
+ * @param   maskArg   mask ptr, ownership transferred to caller, or NULL
+ */
+void CTsDataList::GetAppIconL(const TUid& aAppUid, CFbsBitmap*& bitmapArg, CFbsBitmap*& maskArg)
+{
+    bitmapArg = maskArg = NULL;
+
+    TSize size(KAppIconWidth, KAppIconHeight);
+    CApaMaskedBitmap* apaMaskedBitmap = CApaMaskedBitmap::NewLC();
+    TInt err = mResources.ApaSession().GetAppIcon(aAppUid, size, *apaMaskedBitmap);
+    TInt iconsCount(0);
+    if (err == KErrNone) {
+        err = mResources.ApaSession().NumberOfOwnDefinedIcons(aAppUid, iconsCount);
+    }
+
+    if ((err == KErrNone) && (iconsCount > 0)) {
+        bitmapArg = static_cast<CFbsBitmap*> (apaMaskedBitmap);
+        TInt maskHandle = apaMaskedBitmap->Mask()->Handle();
+        maskArg = new (ELeave) CFbsBitmap;
+        maskArg->Duplicate(maskHandle);
+        CleanupStack::Pop(apaMaskedBitmap);
+    }
+    else {
+        CleanupStack::PopAndDestroy(apaMaskedBitmap);
+        HBufC* fileNameFromApparc = NULL;
+        TInt err = mResources.ApaSession().GetAppIcon(aAppUid, fileNameFromApparc);
+        if (err == KErrNone) {
+            CleanupStack::PushL(fileNameFromApparc);
+            CFbsBitmap *bitamp(0);
+            CFbsBitmap *mask(0);
+            TInt bitmapIndex = 0;
+            TInt maskIndex = 1;
+            // it will change bitmap ids if it is mif (checking inside)
+            AknIconUtils::ValidateLogicalAppIconId(*fileNameFromApparc, bitmapIndex, maskIndex);
+            AknIconUtils::CreateIconLC(bitamp, mask, fileNameFromApparc->Des(), bitmapIndex,
+                maskIndex);
+
+            if (AknIconUtils::IsMifFile(*fileNameFromApparc)) {
+                AknIconUtils::DisableCompression(bitamp);
+                AknIconUtils::SetSize(bitamp, TSize(KAppIconWidth, KAppIconHeight),
+                    EAspectRatioPreservedAndUnusedSpaceRemoved);
+                // bitmap and icon, AknsUtils::CreateIconLC doesn't specify the order
+                CleanupStack::Pop(2);
+                bitmapArg = bitamp;
+                maskArg = mask;
+            }
+            else {
+                CleanupStack::PopAndDestroy(2);
+            }
+            CleanupStack::PopAndDestroy(fileNameFromApparc);
+        }
+    }
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Checks if given uid is on hidden list
+ * @param   aUid uid to be checked
+ * @return  ETrue if uid is on hidden list
+ */
+TBool CTsDataList::IsHiddenUid(TUid uid)
+{
+    return mHiddenUids.Find(uid) >= 0 ? ETrue : EFalse;
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Finds entry in array
+ * @param   list list to find
+ * @param   key finding key
+ * @return   position or KErrNotFound
+ */
+TInt CTsDataList::FindEntry(const RTsFswArray& list, const TTsEntryKey& key) const
+{
+    TInt pos(KErrNotFound);
+    for (TInt entryIdx = 0; entryIdx < list.Count(); ++entryIdx) {
+        if (list[entryIdx]->Key() == key) {
+            pos = entryIdx;
+            break;
+        }
+    }
+    return pos;
+}
+// --------------------------------------------------------------------------
+/**
+ * Set screenshot 
+ */
+void CTsDataList::UpdateL(TInt key, const CFbsBitmap& data, TInt /*param*/, TInt priority)
+{
+    const TInt pos = FindEntry(mData, GenerateKeyL(key));
+    User::LeaveIfError(pos);
+    mData[pos]->SetScreenshotL(data, static_cast<UpdatePriority>(priority));
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Change visibility status 
+ */
+void CTsDataList::UpdateL(TInt key, const Visibility& data, TInt /*param*/)
+{
+    const TInt pos = FindEntry(mData, GenerateKeyL(key));
+    User::LeaveIfError(pos);
+    data == mData[pos]->GetVisibility() ? User::Leave(KErrInUse) : 
+                                          mData[pos]->SetVisibility(data);
+    mObserver.DataChanged();
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Removes screenshot 
+ */
+void CTsDataList::RemoveL(TInt key, TInt /*param*/)
+{
+    TInt pos = FindEntry(mData, GenerateKeyL(key));
+    User::LeaveIfError(pos);
+    mData[pos]->RemoveScreenshotL();
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Establish entry order accridung to aKeyList, all keys MUST be in iData
+ * @param   keyList reference key list
+ * @return   ETrue if changes occured
+ */
+TBool CTsDataList::EstablishOrder(const RArray<TTsEntryKey>& keyList)
+{
+    TBool changed(EFalse);
+    __ASSERT_ALWAYS(mData.Count() == keyList.Count(), User::Panic(_L("EstablishOrder 1"), KErrBadHandle) );
+    for (TInt i = 0; i < keyList.Count(); i++) {
+        const TTsEntryKey& currentdataKey = mData[i]->Key();
+        const TTsEntryKey& referenceKey = keyList[i];
+        if (!(currentdataKey == referenceKey)) {
+            TInt foundPos = FindEntry(mData, referenceKey);
+            __ASSERT_ALWAYS(foundPos>=0, User::Panic(_L("EstablishOrder 2"), KErrBadHandle) );
+            CTsEntry* entry = mData[foundPos];
+            mData.Remove(foundPos);
+            mData.Insert(entry, i);
+            changed = ETrue;
+        }
+    }
+    return changed;
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Gets allowed uids, tries to filter non GUI application 
+ */
+TBool CTsDataList::VerifyApplicationL(TUid uid)
+{
+    TBool retVal(EFalse);
+    TApaAppInfo appInfo;
+    TApaAppCapabilityBuf appCap;
+
+    User::LeaveIfError(mResources.ApaSession().GetAllApps(0));
+    // for every application get uid, hidden and missing attribute
+    // and add to aArray.
+    while (KErrNone == mResources.ApaSession().GetNextApp(appInfo)) {
+        User::LeaveIfError(mResources.ApaSession().GetAppCapability(appCap, appInfo.iUid));
+        if(!appCap().iAppIsHidden) {
+            if (uid == appInfo.iUid) {
+                retVal = ETrue;
+                mAllowedUids.InsertL(appInfo.iUid, mAllowedUids.Count());
+            }
+        } else if(KErrNotFound == mHiddenUids.Find(appInfo.iUid)) {
+            mHiddenUids.InsertL(appInfo.iUid, mHiddenUids.Count());
+        }
+    }
+    if (EFalse == retVal && KErrNotFound == mHiddenUids.Find(uid)) {
+        mHiddenUids.InsertL(uid, mHiddenUids.Count());
+    }
+    return retVal;
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Function generate task key using window group id
+ * @param wgId - window group id of running application
+ * @param entry key 
+ */
+TTsEntryKey CTsDataList::GenerateKeyL(TInt wgId)
+{
+    RArray<RWsSession::TWindowGroupChainInfo> allWgIds;
+   CleanupClosePushL(allWgIds);
+   User::LeaveIfError(mResources.WsSession().WindowGroupList(0, &allWgIds));
+   const TTsEntryKey key(TsEntryKeyGeneraror::GenerateL(wgId, allWgIds.Array()));
+   CleanupStack::PopAndDestroy(&allWgIds);
+   return key;
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Analyse and compress lookup table id needed
+ * @param array - lookup table that has to be checked
+ * 
+ */
+void CTsDataList::CompressLookupTable(RArray<TUid> &array)
+{
+    while(KMaxLookupSize < array.Count()) {
+        array.Remove(0);
+    }
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Change priority of an item in the lookup table
+ * @param array - look up table
+ * @param offset - index of an item in the table
+ */
+void CTsDataList::UpdateLookupTableL(RArray<TUid> &array, TInt offset)
+{
+    const TUid uid(array[offset]);
+    array.Remove(offset);
+    array.InsertL(uid, array.Count());
+}
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/server/src/tsdatatask.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include <fbs.h>
+#include "tsdatatask.h"
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void TsDataTask::ExecuteL(MTsDataStorage& dataStorage, const RMessage2& msg)
+{
+    switch(msg.Function()) {
+    case RegisterScreenshotMessage:
+        TsDataTask::RegisterScreenshotL(dataStorage, msg);
+        break;
+    case UnregisterScreenshotMessage:
+        TsDataTask::UnregisterScreenshotL(dataStorage, msg);
+        break;
+    case VisibilityChange:
+        VisibilityChangeL(dataStorage, msg);
+        break;
+    }
+    
+    msg.Complete(KErrNone);
+}
+
+void TsDataTask::RegisterScreenshotL(MTsDataStorage& dataStorage, 
+                                           const RMessage2& msg)
+{
+    TPckgBuf<TInt> wgId, fbsHdl, param, priority;
+    
+    msg.ReadL(WindowsGroup, wgId);
+    msg.ReadL(ScreenshotHandle, fbsHdl);
+    msg.ReadL(AdditionalParameters, param);
+    msg.Read(Priority, priority);
+    
+    //convert and provide data
+    CFbsBitmap* bitmap = new(ELeave) CFbsBitmap();
+    CleanupStack::PushL(bitmap);
+    User::LeaveIfError(bitmap->Duplicate(fbsHdl()));
+    dataStorage.UpdateL(wgId(), *bitmap, param(), priority());
+    CleanupStack::PopAndDestroy(bitmap);
+}
+    
+void TsDataTask::UnregisterScreenshotL(MTsDataStorage& dataStorage, 
+                                       const RMessage2& msg)
+{
+    TPckgBuf<TInt> wgId, param;
+    
+    msg.ReadL(WindowsGroup, wgId);
+    msg.ReadL(AdditionalParameters, param);
+    
+    dataStorage.RemoveL(wgId(), param());
+}
+
+void TsDataTask::VisibilityChangeL(MTsDataStorage& dataStorage, 
+                                   const RMessage2& msg)
+{
+    TPckgBuf<TInt> wgId, visibility, param;
+    
+    msg.ReadL(0, wgId);
+    msg.ReadL(1, visibility);
+    
+    dataStorage.UpdateL(wgId(), static_cast<Visibility>(visibility()), 0);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/server/src/tsrunningappstorage.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,139 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "tsdatalist.h"
+#include "tsentry.h"
+#include <s32strm.h>
+#include <s32mem.h>
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CRunningAppStorage::CRunningAppStorage(MHsDataObserver& observer)
+: mObserver(observer)
+{
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CRunningAppStorage::~CRunningAppStorage()
+{
+    mData.Close();
+    delete mEngine;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CRunningAppStorage* CRunningAppStorage::NewL(MHsDataObserver& observer,
+                                             MTsResourceManager& resources,
+                                             MTsWindowGroupsMonitor &wsMonitor)
+{
+    CRunningAppStorage * self = new (ELeave)CRunningAppStorage(observer);
+    CleanupStack::PushL(self);
+    self->ConstructL(resources, wsMonitor);
+    CleanupStack::Pop(self);
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CRunningAppStorage::ConstructL(MTsResourceManager& resources, 
+                                    MTsWindowGroupsMonitor &wsMonitor)
+{
+    mEngine = CTsDataList::NewL(resources, wsMonitor, *this) ;
+    RArray<RWsSession::TWindowGroupChainInfo> wgList;
+    CleanupClosePushL(wgList);
+    User::LeaveIfError(resources.WsSession().WindowGroupList(&wgList));
+    mEngine->HandleWindowGroupChanged(resources, wgList.Array());
+    CleanupStack::PopAndDestroy(&wgList);
+    DataChangedL();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+const TDesC8& CRunningAppStorage::Data() const
+{
+    return mData;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CRunningAppStorage::DataChanged() 
+{
+    TRAPD( err, DataChangedL() );
+    if ( err == KErrNone)
+    {
+        mObserver.DataChanged();
+    }
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CRunningAppStorage::DataChangedL()
+{
+    const TInt KExpandSize = 256; // "Granularity" of dynamic buffer
+    CBufFlat* buf = CBufFlat::NewL(KExpandSize);
+    CleanupStack::PushL(buf);
+    RBufWriteStream stream(*buf); 
+    CleanupClosePushL(stream);
+    CTsEntry::ExternalizeArrayL(stream, mEngine->Data());
+    CleanupStack::PopAndDestroy(&stream);
+    mData.Close();
+    mData.CreateL( buf->Size() );
+    buf->Read(0, mData, buf->Size());
+    CleanupStack::PopAndDestroy(buf);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CRunningAppStorage::UpdateL(TInt key, const CFbsBitmap& data, TInt param, TInt priority)
+{
+    mEngine->UpdateL(key, data, param, priority);
+    
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CRunningAppStorage::UpdateL(TInt key, const Visibility& data, TInt param)
+{
+    mEngine->UpdateL(key, data, param);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CRunningAppStorage::RemoveL(TInt key, TInt param)
+{
+    mEngine->RemoveL(key, param);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/server/src/tsscreenshotprovider.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "tsscreenshotprovider.h"
+#include "tstaskmonitorglobals.h"
+#include <s32mem.h>
+
+const TUid KPluginUID = {0x200267AE};
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CTsScreenshotProvider* CTsScreenshotProvider::NewL(MTsDataStorage& storage)
+{
+    CTsScreenshotProvider *self = new (ELeave)CTsScreenshotProvider(storage);
+    CleanupStack::PushL(self);
+    self->BaseConstructL(KPluginUID, KNullDesC8);
+    CleanupStack::Pop(self);
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CTsScreenshotProvider::CTsScreenshotProvider(MTsDataStorage& storage)
+:
+mStorage(storage)
+{}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CTsScreenshotProvider::HandleMessage(const TDesC8& msg)
+{
+    TRAP_IGNORE(HandleMessageL(msg));
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CTsScreenshotProvider::HandleMessageL(const TDesC8& msg)
+{
+    const TInt KMsgSize(5); 
+    TInt parsedMsg[KMsgSize];
+    
+    RDesReadStream msgStream(msg);
+    for (TInt iter(0); iter < KMsgSize; ++iter) {
+        parsedMsg[iter] = msgStream.ReadInt32L();
+    }
+    
+    if (RegisterScreenshotMessage == parsedMsg[0]) {
+        CFbsBitmap *bitmap = new CFbsBitmap;
+        TInt errNo(KErrNoMemory);
+        if (0 != bitmap) {
+            CleanupStack::PushL(bitmap);
+            errNo = bitmap->Duplicate(parsedMsg[ScreenshotHandle + 1]);
+        }
+        const TPckgC<TInt[sizeof(parsedMsg) / sizeof(TInt)]> buf(parsedMsg);//ACK bitmap duplication
+        SendMessage(msg);
+        User::LeaveIfError(errNo);
+        
+        mStorage.UpdateL(parsedMsg[WindowsGroup +1 ], 
+                         *bitmap, 
+                         parsedMsg[AdditionalParameters + 1], 
+                         parsedMsg[Priority + 1]);
+       
+        CleanupStack::PopAndDestroy(bitmap);
+    }
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CTsScreenshotProvider::OnReplace()
+{
+    //no implementation required
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/sis/stubs/createstubs.bat	Thu Jul 22 16:37:03 2010 +0100
@@ -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 Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,39 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description: 
+;
+; ------------------------------------------------------------------------------
+; Taskswitcher stub SIS package file.
+; Used to enable Taskswitcher to be updated from ROM with a SIS package.
+; When you add new files into this stub, please remember to update
+; SIS stub with "makesis -s" command.
+; ------------------------------------------------------------------------------
+;
+;Language - standard language definitions
+&EN
+
+; standard SIS file header
+#{"taskmonitor"},(0x200267B0),1,0,0,TYPE=SA
+
+;Localized Vendor Name
+%{"Nokia"}
+
+;Unique Vendor name
+:"Nokia"
+
+"" - "Z:\sys\bin\tstaskmonitorclient.dll"
+"" - "Z:\sys\bin\hsrunningappmonitor.exe"
+"" - "Z:\sys\bin\tsscreenshotplugin.dll"
+"" - "Z:\resource\plugins\tsscreenshotplugin.rsc"
+"" - "Z:\sys\bin\tsbackstepping.dll"
\ No newline at end of file
Binary file tstaskmonitor/sis/stubs/taskmonitor_stub.sis has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/sis/taskmonitor.pkg	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,34 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description: 
+;
+
+;Language - standard language definitions
+&EN
+
+; standard SIS file header
+#{"taskmonitor"},(0x200267B0),1,0,0,TYPE=SA, RU
+
+;Localized Vendor Name
+%{"Nokia"}
+
+;Unique Vendor name
+:"Nokia"
+
+
+"/epoc32/release/armv5/urel/hsrunningappmonitor.exe" - "!:\sys\bin\hsrunningappmonitor.exe"
+"/epoc32/release/armv5/urel/tstaskmonitorclient.dll"-"!:\sys\bin\tstaskmonitorclient.dll"
+"/epoc32/release/armv5/urel/tsscreenshotplugin.dll"-"!:\sys\bin\tsscreenshotplugin.dll"
+"/epoc32/data/z/resource/plugins/tsscreenshotplugin.rsc"-"!:\resource\plugins\tsscreenshotplugin.rsc"
+"/epoc32/release/armv5/urel/tsbackstepping.dll"-"!:\sys\bin\tsbackstepping.dll"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/tstaskmonitor.pro	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,30 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: 
+#
+
+TEMPLATE = subdirs
+
+CONFIG += ordered
+SUBDIRS += client
+symbian {
+    SUBDIRS += backstepping \
+               server \
+               screenshotplugin
+               
+    BLD_INF_RULES.prj_exports +=    "inc\tstaskmonitorglobals.h"
+    
+}
+
+symbian:include(rom.pri)
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/utils/inc/tsdataobserver.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef DATAOBSERVER_H
+#define DATAOBSERVER_H
+
+#include <e32base.h>
+
+class MHsDataObserver {
+public:
+    virtual void DataChanged() =0;
+};
+
+class CHsDataObserver: public CBase,
+                       public MHsDataObserver
+{
+public:
+    virtual void Cancel(const RMessage2& reason) =0;
+};
+
+class MHsDataObserverStorage
+{
+public:
+    virtual void PushL(CHsDataObserver*) =0;
+    virtual void Pop(CHsDataObserver*) =0;
+    virtual void Cancel(const RMessage2& reason) =0;
+};
+
+#endif //DATAOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/utils/inc/tsentry.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,126 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Task list entry
+ *
+*/
+
+
+#ifndef TSENTRY_H
+#define TSENTRY_H
+
+#include <e32base.h>
+#include <e32cmn.h>
+#include <tsgraphicfilescalinghandler.h>
+
+#include "tsentrykey.h"
+#include "tstaskmonitorglobals.h"
+
+class CTsEntry;
+class RReadStream;
+class RWriteStream;
+class CFbsBitmap;
+class MHsDataObserver;
+
+typedef RPointerArray<CTsEntry> RTsFswArray;
+
+enum TAppType
+{
+    EApp = 0,
+    EWidget,
+    EJava
+};
+
+/**
+ * An entry in the task list.
+ */
+NONSHARABLE_CLASS( CTsEntry ) : public CBase,
+                                private MImageReadyCallBack
+    {
+public:
+    static CTsEntry* NewL();
+
+    static CTsEntry* NewLC();
+
+    static CTsEntry* NewL(const TTsEntryKey& key, MHsDataObserver* observer =0);
+
+    static CTsEntry* NewLC(const TTsEntryKey& key, MHsDataObserver* observer =0);
+
+    ~CTsEntry();
+
+    TUid AppUid() const;
+
+    TAppType Type() const;
+
+    const TDesC& AppName() const;
+
+    TBool CloseableApp() const;
+
+    Visibility GetVisibility() const;
+    
+    void SetVisibility(Visibility visibility);
+
+    CFbsBitmap* AppIconBitmap() const;
+
+    CFbsBitmap* AppIconMask() const;
+
+    CFbsBitmap* Screenshot() const;
+
+    UpdatePriority Priority() const;
+
+    const TTsEntryKey& Key() const;
+
+    void SetAppUid( const TUid& uid );
+
+    void SetAppNameL( const TDesC& appName );
+
+    void SetCloseableApp( TBool value );
+
+    void SetScreenshotL(const CFbsBitmap& bitmap, UpdatePriority priority);
+
+    void RemoveScreenshotL();
+
+    void SetAppIcon( CFbsBitmap* aBitmap, CFbsBitmap* aMask );
+
+    void ExternalizeL( RWriteStream& aStream ) const;
+
+    void InternalizeL( RReadStream& aStream );
+
+    static void ExternalizeArrayL( RWriteStream& stream,
+        const RTsFswArray& array );
+
+    static void InternalizeArrayL( RReadStream& stream,
+        RTsFswArray& array );
+
+private:
+    CTsEntry();
+
+    CTsEntry(const TTsEntryKey& aKey, MHsDataObserver* observer);
+
+    void ImageReadyCallBack(TInt error, const CFbsBitmap *bitmap );
+
+private:
+    TUid mAppUid;
+    HBufC* mAppName;
+    TBool mCloseableApp;
+    Visibility mVisibility;
+    CFbsBitmap* mAppIconBitmap;
+    CFbsBitmap* mAppIconMask;
+    CFbsBitmap* mScreenshot;
+    TTsEntryKey mKey;
+    UpdatePriority mPriority;
+    MHsDataObserver* mObserver;
+    CTsGraphicFileScalingHandler* mImgTool;
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/utils/inc/tsentrykey.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Task list entry
+ *
+*/
+
+
+#ifndef TSENTRYKEY_H
+#define TSENTRYKEY_H
+
+#include <e32base.h>
+class RReadStream;
+class RWriteStream;
+
+class TTsEntryKey
+{
+public:
+    TTsEntryKey(TInt parentId =0);
+    TBool operator ==(const TTsEntryKey& key) const;
+    void ExternalizeL(RWriteStream& output) const;
+    void InternalizeL(RReadStream& input);
+    TInt WindowGroupId() const;
+
+private:
+    TInt mParentId;
+};
+
+#endif //TSENTRYKEY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/utils/inc/tsentrykeygenerator.h	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Task list entry
+ *
+*/
+
+
+#ifndef TSENTRYKEYGENERATOR_H
+#define TSENTRYKEYGENERATOR_H
+
+#include <e32base.h>
+#include <e32cmn.h>
+#include <w32std.h>
+
+#include "tsentrykey.h"
+
+
+class TsEntryKeyGeneraror
+{
+public:
+    static TTsEntryKey GenerateL(TInt windowGroupId, 
+                                 const TArray<RWsSession::TWindowGroupChainInfo>& groupChain);
+};
+
+#endif //TSENTRYKEYGENERATOR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/utils/inc/tsutils.h	Thu Jul 22 16:37:03 2010 +0100
@@ -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/tsentry.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,409 @@
+/*
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  Task list entry
+ *
+ */
+
+#define __E32SVR_H__
+#include <s32strm.h>
+#include <fbs.h>
+#include "tsentry.h"
+#include "tsdataobserver.h"
+
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::NewL
+// --------------------------------------------------------------------------
+//
+CTsEntry* CTsEntry::NewL()
+{
+    CTsEntry* self = NewLC();
+    CleanupStack::Pop(self);
+    return self;
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::NewLC
+// --------------------------------------------------------------------------
+//
+CTsEntry* CTsEntry::NewLC()
+{
+    CTsEntry* self = new (ELeave) CTsEntry;
+    CleanupStack::PushL(self);
+    return self;
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::NewL
+// --------------------------------------------------------------------------
+//
+CTsEntry* CTsEntry::NewL(const TTsEntryKey& key, MHsDataObserver *observer)
+{
+    CTsEntry* self = NewLC(key, observer);
+    CleanupStack::Pop(self);
+    return self;
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::NewLC
+// --------------------------------------------------------------------------
+//
+CTsEntry* CTsEntry::NewLC(const TTsEntryKey& key, MHsDataObserver* observer)
+{
+    CTsEntry* self = new (ELeave) CTsEntry(key, observer);
+    CleanupStack::PushL(self);
+    return self;
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::~CTsFswEntry
+// --------------------------------------------------------------------------
+//
+CTsEntry::~CTsEntry()
+{
+    delete mAppName;
+    delete mAppIconBitmap;
+    delete mAppIconMask;
+    delete mScreenshot;
+    delete mImgTool;
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::CTsFswEntry
+// --------------------------------------------------------------------------
+//
+CTsEntry::CTsEntry() :
+    mVisibility(Visible),
+    mPriority(Low)
+{
+    mKey = TTsEntryKey();
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::CTsFswEntry
+// --------------------------------------------------------------------------
+//
+CTsEntry::CTsEntry(const TTsEntryKey& key, MHsDataObserver *observer) 
+:
+    mVisibility(Visible),
+    mKey(key), 
+    mPriority(Low), 
+    mObserver(observer)
+{
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::SetAppUid
+// --------------------------------------------------------------------------
+//
+void CTsEntry::SetAppUid(const TUid& uid)
+{
+    mAppUid = uid;
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::SetAppNameL
+// --------------------------------------------------------------------------
+//
+void CTsEntry::SetAppNameL(const TDesC& appName)
+{
+    delete mAppName;
+    mAppName = 0;
+    mAppName = appName.AllocL();
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::SetSystemApp
+// --------------------------------------------------------------------------
+//
+void CTsEntry::SetCloseableApp(TBool value)
+{
+    mCloseableApp = value;
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::SetAppIconHandles
+// --------------------------------------------------------------------------
+//
+void CTsEntry::SetAppIcon(CFbsBitmap* bitmap, CFbsBitmap* mask)
+{
+    mAppIconBitmap = bitmap;
+    mAppIconMask = mask;
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Application uid.
+ */
+TUid CTsEntry::AppUid() const
+{
+    return mAppUid;
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Application name.
+ */
+const TDesC& CTsEntry::AppName() const
+{
+    return mAppName ? *mAppName : KNullDesC();
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Retrieve entry visibilit status
+ */
+Visibility CTsEntry::GetVisibility() const
+{
+    return mVisibility;
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Change entry visibility status
+ * @param visibility - new visibility status
+ */
+void CTsEntry::SetVisibility(Visibility visibility)
+{
+    mVisibility = visibility;
+}
+
+// --------------------------------------------------------------------------
+/**
+ * ETrue if the application is closeable
+ */
+TBool CTsEntry::CloseableApp() const
+{
+    return mCloseableApp;
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Application icon bitmap
+ */
+CFbsBitmap* CTsEntry::AppIconBitmap() const
+{
+    return mAppIconBitmap;
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Application icon mask.
+ */
+CFbsBitmap* CTsEntry::AppIconMask() const
+{
+    return mAppIconMask;
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Entry's key
+ */
+const TTsEntryKey& CTsEntry::Key() const
+{
+    return mKey;
+}
+// --------------------------------------------------------------------------
+// CTsFswEntry::ExternalizeL
+// --------------------------------------------------------------------------
+//
+void CTsEntry::ExternalizeL(RWriteStream& stream) const
+{
+    stream.WriteInt32L(mAppUid.iUid);
+    stream << AppName();
+    stream.WriteInt32L(mCloseableApp);
+    if (mAppIconBitmap) {
+        stream.WriteInt32L(mAppIconBitmap->Handle());
+    }
+    else {
+        stream.WriteInt32L(KErrNotFound);
+    }
+
+    if (mAppIconMask) {
+        stream.WriteInt32L(mAppIconMask->Handle());
+    }
+    else {
+        stream.WriteInt32L(KErrNotFound);
+    }
+
+    if (mScreenshot) {
+        stream.WriteInt32L(mScreenshot->Handle());
+    }
+    else {
+        stream.WriteInt32L(KErrNotFound);
+    }
+
+    mKey.ExternalizeL(stream);
+    TInt currentPriority = static_cast<TInt> (mPriority);
+    stream.WriteInt32L(currentPriority);
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::InternalizeL
+// --------------------------------------------------------------------------
+//
+void CTsEntry::InternalizeL(RReadStream& stream)
+{
+    
+    mAppUid = TUid::Uid(stream.ReadInt32L());
+    delete mAppName;
+    mAppName = NULL;
+    mAppName = HBufC::NewL(stream, KMaxTInt);
+    mCloseableApp = stream.ReadInt32L();
+    TInt appIconBitmapHandle = stream.ReadInt32L();
+    TInt appIconMaskHandle = stream.ReadInt32L();
+    TInt screenshotHandle = stream.ReadInt32L();
+    if (appIconBitmapHandle != KErrNotFound) {
+        mAppIconBitmap = new (ELeave) CFbsBitmap;
+        mAppIconBitmap->Duplicate(appIconBitmapHandle);
+    }
+    if (appIconMaskHandle != KErrNotFound) {
+        mAppIconMask = new (ELeave) CFbsBitmap;
+        mAppIconMask->Duplicate(appIconMaskHandle);
+    }
+    if (screenshotHandle != KErrNotFound) {
+        mScreenshot = new (ELeave) CFbsBitmap;
+        mScreenshot->Duplicate(screenshotHandle);
+    }
+    mKey.InternalizeL(stream);
+    TInt currentPriority = stream.ReadInt32L();
+    mPriority = static_cast<UpdatePriority> (currentPriority);
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::ExternalizeArrayL
+// --------------------------------------------------------------------------
+//
+void CTsEntry::ExternalizeArrayL(RWriteStream& stream, const RTsFswArray& array)
+{
+    TInt iter(0);
+    RArray<TInt> visibleItems(array.Count() ? array.Count() : 1);
+    CleanupClosePushL(visibleItems);
+    for (iter = 0; iter < array.Count(); ++iter) {
+        if (Visible == array[iter]->GetVisibility()) {
+            visibleItems.AppendL(iter);
+        }
+    }
+    stream.WriteInt32L(visibleItems.Count());
+    for (iter = 0; iter < visibleItems.Count(); ++iter) {
+        array[visibleItems[iter]]->ExternalizeL(stream);
+    }
+    CleanupStack::PopAndDestroy(&visibleItems);
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::InternalizeArrayL
+// --------------------------------------------------------------------------
+//
+void CTsEntry::InternalizeArrayL(RReadStream& stream, RTsFswArray& array)
+{
+    array.ResetAndDestroy();
+    TInt count = stream.ReadInt32L();
+    for (TInt i = 0; i < count; ++i) {
+        CTsEntry* entry = CTsEntry::NewLC();
+        entry->InternalizeL(stream);
+        array.AppendL(entry);
+        CleanupStack::Pop(entry);
+    }
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Application type.
+ */
+TAppType CTsEntry::Type() const
+{
+    return EApp;
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::SetScreenshot
+// --------------------------------------------------------------------------
+//
+void CTsEntry::SetScreenshotL(const CFbsBitmap& bitmapArg, UpdatePriority priority)
+{
+    TInt currentPriority = static_cast<TInt> (mPriority);
+    TInt newPriority = static_cast<TInt> (priority);
+    if(newPriority <currentPriority) {
+        User::Leave(KErrAccessDenied);
+    }
+    
+    CFbsBitmap* bitmap = new (ELeave) CFbsBitmap;
+    CleanupStack::PushL(bitmap);
+    User::LeaveIfError(bitmap->Duplicate(bitmapArg.Handle()));
+    CleanupStack::Pop(bitmap);
+
+    mPriority = priority;
+    delete mScreenshot;
+    mScreenshot = bitmap;
+
+    delete mImgTool;
+    mImgTool = 0;
+
+    mImgTool = CTsGraphicFileScalingHandler::NewL(*this, *mScreenshot, TSize(128, 128),
+    CTsGraphicFileScalingHandler::EKeepAspectRatioByExpanding);
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::RemoveScreenshot
+// --------------------------------------------------------------------------
+//
+void CTsEntry::RemoveScreenshotL()
+{
+    if (!mScreenshot) {
+        User::Leave(KErrNotFound);
+    }
+    delete mScreenshot;
+    mScreenshot = NULL;
+    mPriority = Low;
+    if (mObserver) {
+        mObserver->DataChanged();
+    }
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Application screenshot.
+ */
+CFbsBitmap* CTsEntry::Screenshot() const
+{
+    return mScreenshot;
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Priority.
+ */
+UpdatePriority CTsEntry::Priority() const
+{
+    return mPriority;
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::Priority
+// --------------------------------------------------------------------------
+//
+void CTsEntry::ImageReadyCallBack(TInt error, const CFbsBitmap *bitmap)
+{
+    if (KErrNone == error && 0 != bitmap) {
+        mScreenshot->Reset();
+        mScreenshot->Duplicate(bitmap->Handle());
+
+        if (mObserver) {
+            mObserver->DataChanged();
+        }
+    }
+}
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/utils/src/tsentrykey.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Task list entry
+ *
+*/
+
+
+#include "tsentrykey.h"
+#include <s32strm.h>
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+TTsEntryKey::TTsEntryKey(TInt parentId)
+:
+    mParentId(parentId)
+{}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+TBool TTsEntryKey::operator ==(const TTsEntryKey& key) const
+{
+    return (mParentId == key.mParentId);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void TTsEntryKey::ExternalizeL(RWriteStream& output) const
+{
+    output.WriteInt32L(mParentId);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void TTsEntryKey::InternalizeL(RReadStream& input)
+{
+    mParentId = input.ReadInt32L();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+TInt TTsEntryKey::WindowGroupId() const
+{
+    return mParentId;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/utils/src/tsentrykeygenerator.cpp	Thu Jul 22 16:37:03 2010 +0100
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Task list entry
+ *
+*/
+#include "tsentrykeygenerator.h"
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+TTsEntryKey TsEntryKeyGeneraror::GenerateL(TInt windowGroupId, 
+                                           const TArray<RWsSession::TWindowGroupChainInfo>& groupChain) 
+{
+    for (TInt iter(0); iter < groupChain.Count(); ++iter) {
+        if (groupChain[iter].iId == windowGroupId) {
+            return 0 >= groupChain[iter].iParentId ?
+                   TTsEntryKey(windowGroupId) :
+                   TsEntryKeyGeneraror::GenerateL(groupChain[iter].iParentId, groupChain);
+        }
+    }
+    User::Leave(KErrNotFound);
+    // for avoid compile error
+    return TTsEntryKey(); 
+}
+