# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1273842606 -10800 # Node ID 4bc7b118b3dfea6f4da98b9f1dbdcd979d7adfda # Parent 32469d7d46ffe0235db975f2ac409f5ccc0aa238 Revision: 201017 Kit: 201019 diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/bwins/hsactivitydbclientu.def --- a/activityfw/activitydatabase/bwins/hsactivitydbclientu.def Mon May 03 12:48:45 2010 +0300 +++ b/activityfw/activitydatabase/bwins/hsactivitydbclientu.def Fri May 14 16:10:06 2010 +0300 @@ -4,22 +4,25 @@ ?asyncRequestCompleated@HsActivityDbClient@@UAEXHHABVQString@@@Z @ 3 NONAME ; void HsActivityDbClient::asyncRequestCompleated(int, int, class QString const &) ?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 const &) - ?qt_metacast@HsActivityDbClient@@UAEPAXPBD@Z @ 6 NONAME ; void * HsActivityDbClient::qt_metacast(char const *) - ?qt_metacall@HsActivityDbClient@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 7 NONAME ; int HsActivityDbClient::qt_metacall(enum QMetaObject::Call, int, void * *) - ?waitActivity@HsActivityDbClient@@UAEHABV?$QHash@VQString@@VQVariant@@@@@Z @ 8 NONAME ; int HsActivityDbClient::waitActivity(class QHash const &) - ?activities@HsActivityDbClient@@UAEHAAV?$QList@V?$QHash@VQString@@VQVariant@@@@@@@Z @ 9 NONAME ; int HsActivityDbClient::activities(class QList > &) - ?trUtf8@HsActivityDbClient@@SA?AVQString@@PBD0H@Z @ 10 NONAME ; class QString HsActivityDbClient::trUtf8(char const *, char const *, int) - ??0HsActivityDbClient@@QAE@PAVQObject@@@Z @ 11 NONAME ; HsActivityDbClient::HsActivityDbClient(class QObject *) - ?tr@HsActivityDbClient@@SA?AVQString@@PBD0@Z @ 12 NONAME ; class QString HsActivityDbClient::tr(char const *, char const *) - ?getStaticMetaObject@HsActivityDbClient@@SAABUQMetaObject@@XZ @ 13 NONAME ; struct QMetaObject const & HsActivityDbClient::getStaticMetaObject(void) - ??_EHsActivityDbClient@@UAE@I@Z @ 14 NONAME ; HsActivityDbClient::~HsActivityDbClient(unsigned int) - ?metaObject@HsActivityDbClient@@UBEPBUQMetaObject@@XZ @ 15 NONAME ; struct QMetaObject const * HsActivityDbClient::metaObject(void) 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 const &) + ?activities@HsActivityDbClient@@UAEHAAV?$QList@V?$QHash@VQString@@VQVariant@@@@@@@Z @ 10 NONAME ; int HsActivityDbClient::activities(class QList > &) + ?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 const &) - ?tr@HsActivityDbClient@@SA?AVQString@@PBD0H@Z @ 17 NONAME ; class QString HsActivityDbClient::tr(char const *, char const *, int) - ?addActivity@HsActivityDbClient@@UAEHABV?$QHash@VQString@@VQVariant@@@@@Z @ 18 NONAME ; int HsActivityDbClient::addActivity(class QHash const &) - ?staticMetaObject@HsActivityDbClient@@2UQMetaObject@@B @ 19 NONAME ; struct QMetaObject const HsActivityDbClient::staticMetaObject - ??1HsActivityDbClient@@UAE@XZ @ 20 NONAME ; HsActivityDbClient::~HsActivityDbClient(void) - ?activityRequested@HsActivityDbClient@@IAEXABVQString@@@Z @ 21 NONAME ; void HsActivityDbClient::activityRequested(class QString const &) - ?updateActivity@HsActivityDbClient@@UAEHABV?$QHash@VQString@@VQVariant@@@@@Z @ 22 NONAME ; int HsActivityDbClient::updateActivity(class QHash const &) - ?removeActivity@HsActivityDbClient@@UAEHABV?$QHash@VQString@@VQVariant@@@@@Z @ 23 NONAME ; int HsActivityDbClient::removeActivity(class QHash 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 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 const &) + ?removeActivity@HsActivityDbClient@@UAEHABV?$QHash@VQString@@VQVariant@@@@@Z @ 26 NONAME ; int HsActivityDbClient::removeActivity(class QHash const &) diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/eabi/hsactivitydbclientu.def --- a/activityfw/activitydatabase/eabi/hsactivitydbclientu.def Mon May 03 12:48:45 2010 +0300 +++ b/activityfw/activitydatabase/eabi/hsactivitydbclientu.def Fri May 14 16:10:06 2010 +0300 @@ -3,33 +3,36 @@ _ZN18HsActivityDbClient11addActivityERK5QHashI7QString8QVariantE @ 2 NONAME _ZN18HsActivityDbClient11qt_metacallEN11QMetaObject4CallEiPPv @ 3 NONAME _ZN18HsActivityDbClient11qt_metacastEPKc @ 4 NONAME - _ZN18HsActivityDbClient12waitActivityERK5QHashI7QString8QVariantE @ 5 NONAME - _ZN18HsActivityDbClient14launchActivityERK5QHashI7QString8QVariantE @ 6 NONAME - _ZN18HsActivityDbClient14removeActivityERK5QHashI7QString8QVariantE @ 7 NONAME - _ZN18HsActivityDbClient14updateActivityERK5QHashI7QString8QVariantE @ 8 NONAME - _ZN18HsActivityDbClient16staticMetaObjectE @ 9 NONAME DATA 16 - _ZN18HsActivityDbClient17activityRequestedERK7QString @ 10 NONAME - _ZN18HsActivityDbClient19getStaticMetaObjectEv @ 11 NONAME - _ZN18HsActivityDbClient21applicationActivitiesER5QListI5QHashI7QString8QVariantEERKS4_ @ 12 NONAME - _ZN18HsActivityDbClient22asyncRequestCompleatedEiiRK7QString @ 13 NONAME - _ZN18HsActivityDbClient27removeApplicationActivitiesERK5QHashI7QString8QVariantE @ 14 NONAME - _ZN18HsActivityDbClient7connectEv @ 15 NONAME - _ZN18HsActivityDbClientC1EP7QObject @ 16 NONAME - _ZN18HsActivityDbClientC2EP7QObject @ 17 NONAME - _ZN18HsActivityDbClientD0Ev @ 18 NONAME - _ZN18HsActivityDbClientD1Ev @ 19 NONAME - _ZN18HsActivityDbClientD2Ev @ 20 NONAME - _ZNK18HsActivityDbClient10metaObjectEv @ 21 NONAME - _ZTI18HsActivityDbClient @ 22 NONAME - _ZTV18HsActivityDbClient @ 23 NONAME - _ZThn12_N18HsActivityDbClient22asyncRequestCompleatedEiiRK7QString @ 24 NONAME - _ZThn8_N18HsActivityDbClient10activitiesER5QListI5QHashI7QString8QVariantEE @ 25 NONAME - _ZThn8_N18HsActivityDbClient11addActivityERK5QHashI7QString8QVariantE @ 26 NONAME - _ZThn8_N18HsActivityDbClient12waitActivityERK5QHashI7QString8QVariantE @ 27 NONAME - _ZThn8_N18HsActivityDbClient14launchActivityERK5QHashI7QString8QVariantE @ 28 NONAME - _ZThn8_N18HsActivityDbClient14removeActivityERK5QHashI7QString8QVariantE @ 29 NONAME - _ZThn8_N18HsActivityDbClient14updateActivityERK5QHashI7QString8QVariantE @ 30 NONAME - _ZThn8_N18HsActivityDbClient21applicationActivitiesER5QListI5QHashI7QString8QVariantEERKS4_ @ 31 NONAME - _ZThn8_N18HsActivityDbClient27removeApplicationActivitiesERK5QHashI7QString8QVariantE @ 32 NONAME - _ZN18HsActivityDbClient12getThumbnailER7QPixmapRK7QString @ 33 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 diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/hsactivitydbclient/hsactivitydbclient.pro --- a/activityfw/activitydatabase/hsactivitydbclient/hsactivitydbclient.pro Mon May 03 12:48:45 2010 +0300 +++ b/activityfw/activitydatabase/hsactivitydbclient/hsactivitydbclient.pro Fri May 14 16:10:06 2010 +0300 @@ -37,12 +37,17 @@ s60/src/hsactivitydbclient_p.cpp \ s60/src/hsactivitydbasyncrequest_p.cpp +LIBS += -lxqutils \ + -lestor \ + -lfbscli + hsactivitydbclientdll.sources = hsactivitydbclient.dll hsactivitydbclientdll.path = $$SHARED_LIB_DIR DEPLOYMENT += hsactivitydbclientdll BLD_INF_RULES.prj_exports += "../inc/hsactivitydbclientinterface.h /epoc32/include/hsactivitydbclientinterface.h" \ + "../inc/activitycmd.h /epoc32/include/activitycmd.h" \ "inc/hsactivitydbclient.h /epoc32/include/hsactivitydbclient.h" \ "inc/hsactivitydbasyncrequestobserver.h /epoc32/include/hsactivitydbasyncrequestobserver.h" DEPLOYMENT += api diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/hsactivitydbclient/inc/hsactivitydbasyncrequestobserver.h --- a/activityfw/activitydatabase/hsactivitydbclient/inc/hsactivitydbasyncrequestobserver.h Mon May 03 12:48:45 2010 +0300 +++ b/activityfw/activitydatabase/hsactivitydbclient/inc/hsactivitydbasyncrequestobserver.h Fri May 14 16:10:06 2010 +0300 @@ -18,6 +18,8 @@ #ifndef HSACTIVITYDBASYNCREQUESTOBSERVER_H #define HSACTIVITYDBASYNCREQUESTOBSERVER_H #include +#include + class HsActivityDbAsyncRequestObserver { public: @@ -30,5 +32,16 @@ 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; }; #endif // HSACTIVITYDBASYNCREQUESTOBSERVER_H diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/hsactivitydbclient/inc/hsactivitydbclient.h --- a/activityfw/activitydatabase/hsactivitydbclient/inc/hsactivitydbclient.h Mon May 03 12:48:45 2010 +0300 +++ b/activityfw/activitydatabase/hsactivitydbclient/inc/hsactivitydbclient.h Fri May 14 16:10:06 2010 +0300 @@ -62,6 +62,12 @@ /** * Interface implementation. + * @see int HsActivityDbAsyncRequestObserver::asyncRequestCompleated(int, int, QPixmap&) + */ + void asyncRequestCompleated(int, int, const QPixmap&, void*); + + /** + * Interface implementation. * @see int HsActivityDbClientInterface::saveActivity(const QVariantHash&) */ int addActivity(const QVariantHash &); @@ -110,12 +116,9 @@ int launchActivity(const QVariantHash &); /** - * Read thumbnail from file - * @param dst - destination QPixmap instance - * @param src - thumbnail file path - * @return 0 on success, error code otherwise */ - int getThumbnail(QPixmap &dst, const QString & src); + //getThumbnail(resolution, thumbnailPath, "image/png", data) + int getThumbnail(QSize size, QString imagePath, QString mimeType, void* userDdata); signals: /** @@ -123,12 +126,21 @@ * @param activityId - requested activity name */ void activityRequested(const QString &activityId); + + /** + * Function notify about runtime activity change + * @param thumbnailPixmap - requested thumbnail + */ + void thumbnailRequested(QPixmap thumbnailPixmap, void *userData); + private: /** * Private client implementation. * Own. */ HsActivityDbClientPrivate *d_ptr; + + friend class HsActivityDbClientPrivate; }; #endif //HSACTIVITYDBCLIENT_H diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/hsactivitydbclient/s60/inc/hsactivitydbasyncrequest_p.h --- a/activityfw/activitydatabase/hsactivitydbclient/s60/inc/hsactivitydbasyncrequest_p.h Mon May 03 12:48:45 2010 +0300 +++ b/activityfw/activitydatabase/hsactivitydbclient/s60/inc/hsactivitydbasyncrequest_p.h Fri May 14 16:10:06 2010 +0300 @@ -18,7 +18,9 @@ #define HSACTIVITYDBASYNCREQUESTPRIVATE_H #include #include +#include #include +#include class HsActivityDbClientPrivate; @@ -29,17 +31,36 @@ { public: + + enum TAsyncRequest{ + EWaitActivity = WaitActivity, + EWaitGetThumbnail = GetThumbnail + }; + +private: /** * First step constructor */ static HsActivityDbAsyncRequestPrivate* - NewL(HsActivityDbAsyncRequestObserver &, HsActivityDbClientPrivate &); - - /** - * First step constructor - */ + NewL(HsActivityDbAsyncRequestObserver &, + HsActivityDbClientPrivate &, + TAsyncRequest, + void* userData = 0); + +public: + static HsActivityDbAsyncRequestPrivate* - NewLC(HsActivityDbAsyncRequestObserver &, HsActivityDbClientPrivate &); + newWaitActivityL(HsActivityDbAsyncRequestObserver &, + HsActivityDbClientPrivate &); + + static void + getThumbnailLD(HsActivityDbAsyncRequestObserver &observer, + HsActivityDbClientPrivate &session, + QSize size, + QString imagePath, + QString mimeType, + void *userDdata); + /** * Destructor @@ -51,6 +72,15 @@ * @param condition - activity filetering rules */ void waitActivity(const QVariantHash &condition); +private: + /** + */ + void getThumbnail(QSize size, QString imagePath, QString mimeType); + + /** + */ + QPixmap copyPixmap(CFbsBitmap* bitmap); + protected: /** * Interface implementation. @@ -67,13 +97,20 @@ /** * Constructor */ - HsActivityDbAsyncRequestPrivate(HsActivityDbAsyncRequestObserver &, - HsActivityDbClientPrivate &); + HsActivityDbAsyncRequestPrivate(HsActivityDbAsyncRequestObserver &, + HsActivityDbClientPrivate &, + TAsyncRequest, + void* userData); private: HsActivityDbAsyncRequestObserver &mObserver; HsActivityDbClientPrivate &mSession; - int mRequestType; + const TAsyncRequest mRequestType; + TPckgBuf mTaskId; + TPckgBuf mDataSize; + TPckgBuf mBitmapId; + HBufC* mBitmapPath; + HBufC8* mBitmapMimeType; RBuf8 mDataBuf; - TPckgBuf mDataSize; + void *const mUserData; }; #endif // HSACTIVITYDBCLIENTPRIVATE_H diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/hsactivitydbclient/s60/inc/hsactivitydbclient_p.h --- a/activityfw/activitydatabase/hsactivitydbclient/s60/inc/hsactivitydbclient_p.h Mon May 03 12:48:45 2010 +0300 +++ b/activityfw/activitydatabase/hsactivitydbclient/s60/inc/hsactivitydbclient_p.h Fri May 14 16:10:06 2010 +0300 @@ -72,12 +72,6 @@ /** * Interface implementation. - * @see int HsActivityDbClientInterface::requestedActivityName(QString &, const QVariantHash &); - */ - int requestedActivityName(QString &, const QVariantHash &); - - /** - * Interface implementation. * @see int HsActivityDbClientInterface::activities(QList &); */ int activities(QList &); @@ -93,6 +87,8 @@ * @see int HsActivityDbClientInterface::waitActivity(const QVariantHash &) */ int waitActivity(const QVariantHash &activity); + + int getThumbnail(QSize size, QString imagePath, QString mimeType, void *userDdata); /** * Interface implementation. @@ -106,20 +102,13 @@ */ int cancelWaitActivity(); - /** - * Read thumbnail from file - * @param dst - destination QPixmap instance - * @param src - thumbnail file path - * @return 0 on success, error code otherwise - */ - int getThumbnail(QPixmap &dst, const QString & src); - public: /** * Function get cached data from server + * @param taskId - request task id * @param dst - destination, preallocated buffer */ - void getData(RBuf8 &dst); + void getData(int taskId, RBuf8 &dst); /** * Function initialize aync request @@ -128,6 +117,13 @@ * @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: /** @@ -175,12 +171,15 @@ const QVariantHash &cond); void waitActivityL(const QVariantHash &activity); + + void getThumbnailL(QSize size, QString imagePath, QString mimeType, void *userDdata); private: /** * Async request handler * Own */ HsActivityDbAsyncRequestPrivate *mAsyncDataHandler; - + RPointerArray mAsyncTasks; + HsActivityDbAsyncRequestObserver& mObserver; }; #endif // HSACTIVITYDBCLIENTPRIVATE_H diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/hsactivitydbclient/s60/src/hsactivitydbasyncrequest_p.cpp --- a/activityfw/activitydatabase/hsactivitydbclient/s60/src/hsactivitydbasyncrequest_p.cpp Mon May 03 12:48:45 2010 +0300 +++ b/activityfw/activitydatabase/hsactivitydbclient/s60/src/hsactivitydbasyncrequest_p.cpp Fri May 14 16:10:06 2010 +0300 @@ -17,46 +17,70 @@ #include "hsactivitydbasyncrequest_p.h" #include "hsactivitydbclient_p.h" -#include "hsserializer.h" +#include "hsactivitydbclient.h" +#include +#include + + // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // HsActivityDbAsyncRequestPrivate* HsActivityDbAsyncRequestPrivate::NewL(HsActivityDbAsyncRequestObserver &observer, - HsActivityDbClientPrivate &session) + HsActivityDbClientPrivate &session, + TAsyncRequest requestType, + void* userData) { - HsActivityDbAsyncRequestPrivate *self = - HsActivityDbAsyncRequestPrivate::NewLC(observer, session); + HsActivityDbAsyncRequestPrivate *self = + new(ELeave)HsActivityDbAsyncRequestPrivate(observer, session, requestType, userData); + CleanupStack::PushL(self); + self->mDataBuf.CreateL(64); CleanupStack::Pop(self); return self; } + // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // HsActivityDbAsyncRequestPrivate* -HsActivityDbAsyncRequestPrivate::NewLC(HsActivityDbAsyncRequestObserver &observer, - HsActivityDbClientPrivate &session) +HsActivityDbAsyncRequestPrivate::newWaitActivityL(HsActivityDbAsyncRequestObserver & observer, + HsActivityDbClientPrivate & session) + { + return HsActivityDbAsyncRequestPrivate::NewL(observer, session, EWaitActivity); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void HsActivityDbAsyncRequestPrivate::getThumbnailLD(HsActivityDbAsyncRequestObserver &observer, + HsActivityDbClientPrivate &session, + QSize size, + QString imagePath, + QString mimeType, + void *userDdata) { - HsActivityDbAsyncRequestPrivate *self = - new(ELeave)HsActivityDbAsyncRequestPrivate(observer, session); - CleanupStack::PushL(self); - self->mDataBuf.CreateL(64); - return self; + HsActivityDbAsyncRequestPrivate *instance = + HsActivityDbAsyncRequestPrivate::NewL(observer, session, EWaitGetThumbnail, userDdata); + instance->getThumbnail( size, imagePath, mimeType); } + // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // HsActivityDbAsyncRequestPrivate::HsActivityDbAsyncRequestPrivate(HsActivityDbAsyncRequestObserver &observer, - HsActivityDbClientPrivate &session) + HsActivityDbClientPrivate &session, + TAsyncRequest requestType, + void* userData) : CActive(EPriorityStandard), mObserver(observer), mSession(session), - mRequestType(-1), - mDataSize() + mRequestType(requestType), + mUserData(userData) { CActiveScheduler::Add(this); } @@ -69,6 +93,8 @@ { mDataBuf.Close(); Cancel(); + delete mBitmapPath; + delete mBitmapMimeType; } // ----------------------------------------------------------------------------- @@ -88,21 +114,36 @@ // void HsActivityDbAsyncRequestPrivate::RunL() { - RBuf8 buff; - CleanupClosePushL(buff); - QString data; int requestResult(iStatus.Int()); if (KErrNone == requestResult) { - if (0 < mDataSize()) { - buff.CreateL(mDataSize()); + switch (mRequestType){ + case WaitActivity: { + RBuf8 buff; + CleanupClosePushL(buff); + QString data; + if (0 < mDataSize()) { + buff.CreateL(mDataSize()); + } + mSession.getData(mTaskId(), buff); + data = QString::fromAscii(reinterpret_cast(buff.Ptr()), + buff.Length()); + buff.Close(); + mObserver.asyncRequestCompleated(requestResult, mRequestType, data); + CleanupStack::PopAndDestroy(&buff); + break; + } + case EWaitGetThumbnail: { + 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); + CleanupStack::PopAndDestroy(bitmap); + break; + } } - mSession.getData(buff); - data = QString::fromAscii(reinterpret_cast(buff.Ptr()), - buff.Length()); - buff.Close(); + mSession.Pop(this); } - mObserver.asyncRequestCompleated(requestResult, mRequestType, data); - CleanupStack::PopAndDestroy(&buff); } // ----------------------------------------------------------------------------- @@ -111,9 +152,25 @@ // void HsActivityDbAsyncRequestPrivate::waitActivity(const QVariantHash &condition) { - mRequestType = WaitActivity; iStatus = KRequestPending; SetActive(); - mDataBuf << condition; - mSession.sendDataAsync(mRequestType, TIpcArgs(&mDataBuf, &mDataSize), iStatus); + mDataSize = condition.find(ActivityApplicationKeyword).value().toInt(); + TPtrC8 actId(KNullDesC8); + TPtrC8 desc(KNullDesC8); + mSession.sendDataAsync(mRequestType, TIpcArgs(&mDataSize, &actId, &desc, &mTaskId), iStatus); } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void HsActivityDbAsyncRequestPrivate::getThumbnail(QSize size, QString imagePath, QString mimeType) +{ + iStatus = KRequestPending; + SetActive(); + mBitmapId = size.width(); + mTaskId = size.height(); + mBitmapPath = XQConversions::qStringToS60Desc(imagePath); + mBitmapMimeType = XQConversions::qStringToS60Desc8(mimeType); + mSession.sendDataAsync(mRequestType, TIpcArgs(&mBitmapId, &mTaskId, mBitmapPath, mBitmapMimeType), iStatus); +} diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/hsactivitydbclient/s60/src/hsactivitydbclient_p.cpp --- a/activityfw/activitydatabase/hsactivitydbclient/s60/src/hsactivitydbclient_p.cpp Mon May 03 12:48:45 2010 +0300 +++ b/activityfw/activitydatabase/hsactivitydbclient/s60/src/hsactivitydbclient_p.cpp Fri May 14 16:10:06 2010 +0300 @@ -20,15 +20,18 @@ #include "hsactivityglobals.h" #include "hsserializer.h" #include +#include // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // -HsActivityDbClientPrivate::HsActivityDbClientPrivate(HsActivityDbAsyncRequestObserver &observer) +HsActivityDbClientPrivate::HsActivityDbClientPrivate(HsActivityDbAsyncRequestObserver &observer): + mObserver(observer) { - mAsyncDataHandler = HsActivityDbAsyncRequestPrivate::NewL(observer, *this); + mAsyncDataHandler = HsActivityDbAsyncRequestPrivate::newWaitActivityL( + observer, *this); } // ----------------------------------------------------------------------------- @@ -37,6 +40,7 @@ // HsActivityDbClientPrivate::~HsActivityDbClientPrivate() { + mAsyncTasks.ResetAndDestroy(); delete mAsyncDataHandler; Close(); } @@ -57,7 +61,11 @@ // int HsActivityDbClientPrivate::addActivity(const QVariantHash &activity) { - TRAPD(errNo, execSimpleRequestL(AddActivity, activity);) + int errNo(KErrCorrupt); + if (activity.end() != activity.find(ActivityApplicationKeyword) && + activity.end() != activity.find(ActivityActivityKeyword)) { + TRAP(errNo, execSimpleRequestL(AddActivity, activity);) + } return errNo; } @@ -67,7 +75,11 @@ // int HsActivityDbClientPrivate::updateActivity(const QVariantHash &activity) { - TRAPD(errNo, execSimpleRequestL(UpdateActivity, activity);) + int errNo(KErrCorrupt); + if (activity.end() != activity.find(ActivityApplicationKeyword) && + activity.end() != activity.find(ActivityActivityKeyword)) { + TRAP(errNo, execSimpleRequestL(UpdateActivity, activity);) + } return errNo; } @@ -77,7 +89,11 @@ // int HsActivityDbClientPrivate::removeActivity(const QVariantHash &activity) { - TRAPD(errNo, execSimpleRequestL(RemoveActivity, activity);) + int errNo(KErrCorrupt); + if (activity.end() != activity.find(ActivityApplicationKeyword) && + activity.end() != activity.find(ActivityActivityKeyword)) { + TRAP(errNo, execSimpleRequestL(RemoveActivity, activity);) + } return errNo; } @@ -87,7 +103,10 @@ // int HsActivityDbClientPrivate::removeApplicationActivities(const QVariantHash &activity) { - TRAPD(errNo, execSimpleRequestL(RemoveApplicationActivities, activity);) + int errNo(KErrCorrupt); + if (activity.end() != activity.find(ActivityApplicationKeyword)) { + TRAP(errNo, execSimpleRequestL(RemoveApplicationActivities, activity);) + } return errNo; } @@ -127,6 +146,16 @@ // // ----------------------------------------------------------------------------- // +int HsActivityDbClientPrivate::getThumbnail(QSize size, QString imagePath, QString mimeType, void *userDdata) +{ + TRAPD(errNo, getThumbnailL(size, imagePath, mimeType, userDdata);) + return errNo; +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// int HsActivityDbClientPrivate::launchActivity(const QVariantHash &activity) { TRAPD(errNo, execSimpleRequestL(LaunchActivity, activity);) @@ -174,7 +203,7 @@ // void HsActivityDbClientPrivate::connectL() { - const int asyncMessageSlots(4); + const int asyncMessageSlots(12); const int maxRetry(4); TInt retry = maxRetry; @@ -200,34 +229,17 @@ // void HsActivityDbClientPrivate::execSimpleRequestL(int function, const QVariantHash &activity) { + TPckgBuf appId( activity.find(ActivityApplicationKeyword).value().toInt() ); + HBufC8 *actId = XQConversions::qStringToS60Desc8(activity.find(ActivityActivityKeyword).value().toString()); + CleanupStack::PushL(actId); + TPckgBuf taskId(0); RBuf8 data; CleanupClosePushL(data); data.CreateL(256); data << activity; - User::LeaveIfError(SendReceive(function, TIpcArgs(&data))); + User::LeaveIfError(SendReceive(function, TIpcArgs(&appId, actId, &data, &taskId))); CleanupStack::PopAndDestroy(&data); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void HsActivityDbClientPrivate::requestedActivityNameL(QString &result, - const QVariantHash &activity) -{ - RBuf8 data; - TPckgBuf sizeBuf; - CleanupClosePushL(data); - data.CreateL(256); - data << activity; - User::LeaveIfError(SendReceive(RequestedActivityName, TIpcArgs(&data,&sizeBuf))); - if (sizeBuf() > data.MaxSize()) { - data.ReAlloc(sizeBuf()); - } - User::LeaveIfError(SendReceive(GetData, TIpcArgs(&data))); - result = QString::fromAscii(reinterpret_cast(data.Ptr()), - data.Length()); - CleanupStack::PopAndDestroy(&data); + CleanupStack::PopAndDestroy(actId); } // ----------------------------------------------------------------------------- @@ -236,15 +248,19 @@ // void HsActivityDbClientPrivate::activitiesL(QList& result) { + TPckgBuf appId(0); + TPtrC8 actId(KNullDesC8); + TPtrC8 desc(KNullDesC8); + TPckgBuf taskId(0); + User::LeaveIfError(SendReceive(Activities, + TIpcArgs(&appId, &actId, &desc, &taskId))); + + int sizeBuf(appId()); RBuf8 data; - TPckgBuf sizeBuf; CleanupClosePushL(data); - data.CreateL(256); - User::LeaveIfError(SendReceive(Activities, TIpcArgs(&data, &sizeBuf))); - if (sizeBuf() > data.MaxSize()) { - data.ReAlloc(sizeBuf()); - } - User::LeaveIfError(SendReceive(GetData, TIpcArgs(&data))); + data.Create(sizeBuf); + User::LeaveIfError(SendReceive(GetData, TIpcArgs(&taskId, &data))); + result << data; CleanupStack::PopAndDestroy(&data); } @@ -256,16 +272,19 @@ void HsActivityDbClientPrivate::applicationActivitiesL(QList& result, const QVariantHash & condition) { + TPckgBuf appId = condition.find(ActivityApplicationKeyword).value().toInt(); + TPtrC8 actId(KNullDesC8); + TPtrC8 desc(KNullDesC8); + TPckgBuf taskId(0); + User::LeaveIfError(SendReceive(ApplicationActivities, + TIpcArgs(&appId, &actId, &desc, &taskId))); + + int sizeBuf(appId()); RBuf8 data; - TPckgBuf sizeBuf; CleanupClosePushL(data); - data.CreateL(256); - data << condition; - User::LeaveIfError(SendReceive(ApplicationActivities, TIpcArgs(&data, &sizeBuf))); - if (sizeBuf() > data.MaxSize()) { - data.ReAlloc(sizeBuf()); - } - User::LeaveIfError(SendReceive(GetData, TIpcArgs(&data))); + data.Create(sizeBuf); + User::LeaveIfError(SendReceive(GetData, TIpcArgs(&taskId, &data))); + result << data; CleanupStack::PopAndDestroy(&data); } @@ -287,9 +306,20 @@ // // ----------------------------------------------------------------------------- // -void HsActivityDbClientPrivate::getData(RBuf8 &data) +void HsActivityDbClientPrivate::getThumbnailL(QSize size, QString imagePath, QString mimeType, void *userDdata) { - SendReceive(GetData, TIpcArgs(&data)); + HsActivityDbAsyncRequestPrivate::getThumbnailLD(mObserver, + *this, size, imagePath, mimeType, userDdata); +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void HsActivityDbClientPrivate::getData(int taskId, RBuf8 &data) +{ + TPckgBuf requestId(taskId); + SendReceive(GetData, TIpcArgs(&requestId, &data)); } // ----------------------------------------------------------------------------- @@ -307,21 +337,21 @@ // // ----------------------------------------------------------------------------- // -int HsActivityDbClientPrivate::getThumbnail(QPixmap &dst, const QString & src) +void HsActivityDbClientPrivate::PushL(HsActivityDbAsyncRequestPrivate * task) { - RBuf8 data; - QVariantHash thumbnailRequest; - thumbnailRequest.insert(ActivityScreenshotKeyword, src); - TPckgBuf sizeBuf(0); - CleanupClosePushL(data); - data.CreateL(256); - data << thumbnailRequest; - User::LeaveIfError(SendReceive(GetThumbnail, TIpcArgs(&data, &sizeBuf))); - if (sizeBuf() > data.MaxSize()) { - data.ReAlloc(sizeBuf()); + (KErrNotFound == mAsyncTasks.Find(task)) ? + mAsyncTasks.AppendL(task): + User::Leave(KErrAlreadyExists); +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void HsActivityDbClientPrivate::Pop(HsActivityDbAsyncRequestPrivate *task) +{ + const TInt offset(mAsyncTasks.Find(task)); + if (KErrNotFound != offset) { + mAsyncTasks.Remove(offset); } - User::LeaveIfError(SendReceive(GetData, TIpcArgs(&data))); - dst << data; - CleanupStack::PopAndDestroy(&data); - return 0; } diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/hsactivitydbclient/src/hsactivitydbclient.cpp --- a/activityfw/activitydatabase/hsactivitydbclient/src/hsactivitydbclient.cpp Mon May 03 12:48:45 2010 +0300 +++ b/activityfw/activitydatabase/hsactivitydbclient/src/hsactivitydbclient.cpp Fri May 14 16:10:06 2010 +0300 @@ -68,6 +68,24 @@ // // ----------------------------------------------------------------------------- // +void HsActivityDbClient::asyncRequestCompleated(int result, + int requestType, + const QPixmap& pixmap, + void* userData) +{ + switch (requestType) { + case GetThumbnail: + if (KErrNone == result) { + emit thumbnailRequested(pixmap, userData); + } + break; + } +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// int HsActivityDbClient::addActivity(const QVariantHash &activity) { return d_ptr->addActivity(activity); @@ -141,7 +159,8 @@ // // ----------------------------------------------------------------------------- // -int HsActivityDbClient::getThumbnail(QPixmap &dst, const QString & src) +//int HsActivityDbClient::getThumbnail(const QVariantHash &condition) +int HsActivityDbClient::getThumbnail(QSize size, QString imagePath, QString mimeType, void* userDdata) { - return d_ptr->getThumbnail(dst, src); + return d_ptr->getThumbnail(size, imagePath, mimeType, userDdata); } diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/hsactivitydbserver/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/hsactivitydbserver/group/bld.inf Fri May 14 16:10:06 2010 +0300 @@ -0,0 +1,21 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +PRJ_PLATFORMS +DEFAULT + +PRJ_MMPFILES +hsactivitydbserver.mmp diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/hsactivitydbserver/group/hsactivitydbserver.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/hsactivitydbserver/group/hsactivitydbserver.mmp Fri May 14 16:10:06 2010 +0300 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +TARGET hsactivitydbserver.exe +TARGETTYPE exe +UID 0 0x200267B4 + +SYSTEMINCLUDE /epoc32/include + +USERINCLUDE ../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 + +LIBRARY euser.lib +LIBRARY estor.lib +LIBRARY edbms.lib +LIBRARY efsrv.lib +LIBRARY bafl.lib +LIBRARY fbscli.lib +LIBRARY bitmaptransforms.lib +LIBRARY imageconversion.lib + +CAPABILITY ALL -TCB +EPOCHEAPSIZE 0x100000 0x600000 // 1MB - 6MB + +#ifdef ENABLE_ABIV2_MODE +DEBUGGABLE_UDEBONLY +#endif \ No newline at end of file diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/hsactivitydbserver/hsactivitydbserver.pro --- a/activityfw/activitydatabase/hsactivitydbserver/hsactivitydbserver.pro Mon May 03 12:48:45 2010 +0300 +++ b/activityfw/activitydatabase/hsactivitydbserver/hsactivitydbserver.pro Fri May 14 16:10:06 2010 +0300 @@ -11,46 +11,10 @@ # # Contributors: # -# Description: +# Description: # -TEMPLATE = app -TARGET = hsactivitydbserver - -QT += core \ - gui \ - sql - -HEADERS += ../inc/hsactivitydbclientinterface.h \ - inc/hsactivity.h \ - inc/hsactivityserver.h \ - inc/hsactivitystorage.h \ - inc/hsactivitystorage_p.h - -SOURCES += src/hsactivityserver.cpp \ - src/hsactivitystorage.cpp \ - src/hsactivitystorage_p.cpp +TEMPLATE = subdirs -symbian{ -TARGET.UID3 = 0x200267B4 -HEADERS += ../s60/inc/hsactivityglobals.h \ - ../s60/inc/hsserializer.h \ - s60/inc/hsactivityserver_p.h \ - s60/inc/hsactivitysession_p.h - - -SOURCES += s60/src/main.cpp \ - ../s60/src/hsserializer.cpp \ - s60/src/hsactivityserver_p.cpp \ - s60/src/hsactivitysession_p.cpp - -LIBS += -lcone -lavkon -leikcore -leiksrv -lapparc -lws32 -lapgrfx - -TARGET.CAPABILITY = ALL -TCB - -myrssrules = \ -"hidden = KAppIsHidden;" -RSS_RULES += myrssrules +BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include \"group/bld.inf\"" -} - diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/hsactivitydbserver/inc/activitybroadcasttask.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/hsactivitydbserver/inc/activitybroadcasttask.h Fri May 14 16:10:06 2010 +0300 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef ACTIVITYBROADCASTTASK_H +#define ACTIVITYBROADCASTTASK_H + +// INCLUDES +#include +#include + +#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 diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/hsactivitydbserver/inc/activitydataprovidertask.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/hsactivitydbserver/inc/activitydataprovidertask.h Fri May 14 16:10:06 2010 +0300 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef ACTIVITYDATAPROVIDERTASK_H +#define ACTIVITYDATAPROVIDERTASK_H + +// INCLUDES +#include +#include + +#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 diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/hsactivitydbserver/inc/activitygraphicfilescaling.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/hsactivitydbserver/inc/activitygraphicfilescaling.h Fri May 14 16:10:06 2010 +0300 @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description : + * + */ +#ifndef 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 + +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 diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/hsactivitydbserver/inc/activityobservertask.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/hsactivitydbserver/inc/activityobservertask.h Fri May 14 16:10:06 2010 +0300 @@ -0,0 +1,85 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef ACTIVITYOBSERVERTASK_H +#define ACTIVITYOBSERVERTASK_H + +// INCLUDES +#include +#include + +#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 diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/hsactivitydbserver/inc/activityqueries.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/hsactivitydbserver/inc/activityqueries.h Fri May 14 16:10:06 2010 +0300 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef ACTIVITYQUERIES_H +#define ACTIVITYQUERIES_H + + +#include + +_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 + diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/hsactivitydbserver/inc/activityserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/hsactivitydbserver/inc/activityserver.h Fri May 14 16:10:06 2010 +0300 @@ -0,0 +1,91 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef ACTIVITYSERVER_H +#define ACTIVITYSERVER_H + +#define __E32SVR_H__ + +// INCLUDES +#include +#include +#include // 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& 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 mObservers; +}; + +#endif // ACTIVITYSERVER_H diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/hsactivitydbserver/inc/activitysession.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/hsactivitydbserver/inc/activitysession.h Fri May 14 16:10:06 2010 +0300 @@ -0,0 +1,105 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 +#include +#include + +#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& 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 mRunningTasks; +}; + +#endif // ACTIVITYSESSION_H diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/hsactivitydbserver/inc/activitystorage.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/hsactivitydbserver/inc/activitystorage.h Fri May 14 16:10:06 2010 +0300 @@ -0,0 +1,196 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 +#include +#include // RDbStoreDatabase +#include // 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 diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/hsactivitydbserver/inc/activitystorageasynctask.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/hsactivitydbserver/inc/activitystorageasynctask.h Fri May 14 16:10:06 2010 +0300 @@ -0,0 +1,103 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 +#include + +#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 diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/hsactivitydbserver/inc/activitystoragesynctask.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/hsactivitydbserver/inc/activitystoragesynctask.h Fri May 14 16:10:06 2010 +0300 @@ -0,0 +1,77 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef ACTIVITYSTORAGESYNCTASK_H +#define ACTIVITYSTORAGESYNCTASK_H + +// INCLUDES +#include +#include + +#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 diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/hsactivitydbserver/inc/activitytask.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/hsactivitydbserver/inc/activitytask.h Fri May 14 16:10:06 2010 +0300 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#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 + diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/hsactivitydbserver/inc/activitytaskstorage.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/hsactivitydbserver/inc/activitytaskstorage.h Fri May 14 16:10:06 2010 +0300 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef ACTIVITYTASKSTORAGE_H +#define ACTIVITYTASKSTORAGE_H +#include +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& StorageData() const =0; +}; + +#endif //ACTIVITYTASKSTORAGE_H + diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/hsactivitydbserver/inc/activitythumbnailtask.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/hsactivitydbserver/inc/activitythumbnailtask.h Fri May 14 16:10:06 2010 +0300 @@ -0,0 +1,77 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef ACTIVITYTHUMBNAILTASK_H +#define ACTIVITYTHUMBNAILTASK_H + +#ifndef __E32SVR_H__ +#define __E32SVR_H__ +#endif + +#include +#include +#include + +#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 diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/hsactivitydbserver/inc/hsactivity.h --- a/activityfw/activitydatabase/hsactivitydbserver/inc/hsactivity.h Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -#ifndef HSACTIVITY_H -#define HSACTIVITY_H - - -const char ActivityOrganization [] = "nokia"; - -const char ActivityApplication [] = "hsactivitydbserver"; - -const char ActivityStorageDriver [] = "QSQLITE"; - -const char ActivityStorageName [] = "ActivitySQLClient"; - -const char ActivityStorageProperty [] = "activitydatabase"; - -const char ActivityDefaultStorage [] = "activitydatabase.db"; - -const char ActivityTableKeyword [] = ":Table"; -const char ActivityDataKeyword [] = ":Data"; - - - -const char ActivityCreateQuery [] = "CREATE TABLE Activities(" \ - "ApplicationId INTEGER NOT NULL," \ - "ActivityName TEXT NOT NULL," \ - "Data BLOB NOT NULL," \ - "PRIMARY KEY ( ApplicationId, ActivityName ) )"; - -const char ActivityDropQuery [] = "DROP TABLE :Table"; - -const char ActivitySelectActivityQuery [] = "SELECT ApplicationId FROM Activities WHERE " \ - "ApplicationId = :ApplicationId AND " \ - "ActivityName = :ActivityName"; - -const char ActivityUpdateActivityQuery [] = "UPDATE Activities SET Data = :Data WHERE " \ - "ApplicationId = :ApplicationId AND " \ - "ActivityName = :ActivityName"; - -const char ActivityInsertActivityQuery [] = "INSERT INTO Activities( ApplicationId, ActivityName, Data ) VALUES " \ - "( :ApplicationId, :ActivityName, :Data )"; - -const char ActivitySelectActiveQuery [] = "SELECT ActivityName FROM Activities WHERE " \ - "ApplicationId = :ApplicationId"; - -const char ActivityActivitiesQuery [] = "SELECT Data FROM Activities"; - -const char ActivityApplicationActivitiesQuery [] = "SELECT Data FROM Activities " \ - "WHERE ApplicationId = :ApplicationId"; - -const char ActivityDeleteActivityQuery [] = "DELETE FROM Activities WHERE " \ - "ApplicationId = :ApplicationId AND " \ - "ActivityName = :ActivityName"; - -const char ActivityDeleteApplicationActivitiesQuery [] = "DELETE FROM Activities WHERE " \ - "ApplicationId = :ApplicationId"; - -#endif //HSACTIVITY_H diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/hsactivitydbserver/inc/hsactivityserver.h --- a/activityfw/activitydatabase/hsactivitydbserver/inc/hsactivityserver.h Mon May 03 12:48:45 2010 +0300 +++ /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: -* -*/ - -#ifndef HSACTIVITYSERVER_H -#define HSACTIVITYSERVER_H - -#include "hsactivitydbclientinterface.h" - -class HsActivityServerPrivate; - -/** - * Class implemets server functionality to store and retrieve activity - */ -class HsActivityServer -{ -public: - /** - * Constructor - * @param storage - reference to initialized activity storage - */ - HsActivityServer(HsActivityDbClientInterface &storage); - - /** - * Destructor - */ - ~HsActivityServer(); - - /** - * Function establish server and initialize listening proces - * @return true on succees, false otherwise - */ - bool start(); -private: - /** - * Private server implementation - */ - HsActivityServerPrivate *d_ptr; -}; - -#endif //HSACTIVITYSERVER_H diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/hsactivitydbserver/inc/hsactivitystorage.h --- a/activityfw/activitydatabase/hsactivitydbserver/inc/hsactivitystorage.h Mon May 03 12:48:45 2010 +0300 +++ /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: -* -*/ -#ifndef HSACTIVITYSTORAGE_H -#define HSACTIVITYSTORAGE_H -#include "hsactivitydbclientinterface.h" -class HsActivityStoragePrivate; - -/** - * Class implements HsActivityDbClientInterface and storage functionality - */ -class HsActivityStorage: public HsActivityDbClientInterface -{ -public: - /** - * Constructor - */ - HsActivityStorage(); - - /** - * Destructor - */ - ~HsActivityStorage(); - - /** - * Interface implementation. - * @see int HsActivityDbClientInterface::addActivity(const QVariantHash&) - */ - int addActivity(const QVariantHash &activity); - - /** - * Interface implementation. - * @see int HsActivityDbClientInterface::updateActivity(const QVariantHash&) - */ - int updateActivity(const QVariantHash &activity); - - /** - * 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 &) - */ - int activities(QList& result); - - /** - * Interface implementation. - * @see int HsActivityDbClientInterface::applicationActivities(QList &, const QVariantHash &) - */ - int applicationActivities(QList& result, - const QVariantHash &activity); - - /** - * Interface implementation. - * @see int HsActivityDbClientInterface::waitActivity(const QVariantHash &) - */ - int waitActivity(const QVariantHash &activity); - - /** - * Interface implementation. - * @see int HsActivityDbClientInterface::launchActivity(const QVariantHash &) - */ - int launchActivity(const QVariantHash &activity); -private: - /** - * Private storage implementation - * Own. - */ - HsActivityStoragePrivate *d_ptr; -}; -#endif //HSACTIVITYSTORAGE_H diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/hsactivitydbserver/inc/hsactivitystorage_p.h --- a/activityfw/activitydatabase/hsactivitydbserver/inc/hsactivitystorage_p.h Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,152 +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 HSACTIVITYSTORAGEPRIVATE_H -#define HSACTIVITYSTORAGEPRIVATE_H -#include "hsactivitydbclientinterface.h" -#include - -/** - * Class implements HsActivityDbClientInterface and storage functionality using - * database subsystem - */ -class HsActivityStoragePrivate: public HsActivityDbClientInterface -{ -public: - /** - * Constructor - */ - HsActivityStoragePrivate(); - - /** - * Destructor - */ - ~HsActivityStoragePrivate(); - - /** - * Interface implementation. - * @see int HsActivityDbClientInterface::addActivity(const QVariantHash&) - */ - int addActivity(const QVariantHash &); - - /** - * Interface implementation. - * @see int HsActivityDbClientInterface::updateActivity(const QVariantHash&) - */ - int updateActivity(const QVariantHash &); - - /** - * 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::requestedActivityName( QString &, const QVariantHash &) - */ - int requestedActivityName(QString &result, - const QVariantHash &activity); - - /** - * Interface implementation. - * @see int HsActivityDbClientInterface::activities(QList &) - */ - int activities(QList &); - - /** - * Interface implementation. - * @see int HsActivityDbClientInterface::applicationActivities(QList &, const QVariantHash &) - */ - int applicationActivities(QList &, const QVariantHash &); - - /** - * Interface implementation. - * @see int HsActivityDbClientInterface::waitActivity(const QVariantHash &) - */ - int waitActivity(const QVariantHash &activity); - - /** - * Interface implementation. - * @see int HsActivityDbClientInterface::launchActivity(const QVariantHash &) - */ - int launchActivity(const QVariantHash &activity); -private: - /** - * Function check database structure - * @return true if structure is valid, false otherwise - */ - bool checkTables(); - - /** - * Function create database structure - */ - void recreateTables(); - - /** - * Function return last SQL query error code - * @param querty - executed sql query - * @return SQL query error code - */ - int getSqlErrorCode(const QSqlQuery &query); - - /** - * Function exeute SQL query - * @param query - SQL - * @return true on succees, false otherwise - */ - bool exec(QSqlQuery &query); - - /** - * Function exeute SQL query - * @param query - SQL query that has to be executed - * @return true on succees, false otherwise - */ - bool exec(const QString &query, const QVariantHash ¶ms); - - /** - * Funciton bind provided filtering rules with prepared SQL query - * @param query - SQL query - * @param activity - filtering rules - * @param additionalData - additional filetering rules - */ - void bind(QSqlQuery &query, - const QVariantHash &activity, - const QVariantHash &additionalData = QVariantHash()); - - /** - * Funciton get records that match conditions - * @param result - output destination - * @param query - SQL query sting - * @param conditions - query conditions - */ - int activities(QList &results, - const QString &query, - const QVariantHash &conditions); - -private: - /** - * Connectioin to SQL engine - */ - QSqlDatabase mConn; -}; -#endif //HSACTIVITYSTORAGEPRIVATE_H diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/hsactivitydbserver/s60/inc/hsactivityserver_p.h --- a/activityfw/activitydatabase/hsactivitydbserver/s60/inc/hsactivityserver_p.h Mon May 03 12:48:45 2010 +0300 +++ /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 HSACTIVITYSERVERPRIVATE_H -#define HSACTIVITYSERVERPRIVATE_H - -#include -#include "hsactivitydbclientinterface.h" - -/** - * Class implemets server functionality for S60 enviroment - */ -class HsActivityServerPrivate : public CServer2 -{ -public: - /** - * Constructor - */ - HsActivityServerPrivate(HsActivityDbClientInterface &storage); - - /** - * Destructor - */ - ~HsActivityServerPrivate(); - - /** - * Function establish server and initialize listening proces - * @return true on succees, false otherwise - */ - bool start(); - - /** - * Function look for active application session and complete pending message - */ - void notifyL(int applicationId, const QString &activityName); - - /** - * Cancel notification - */ - void cancelNotify(int applicationId); - - /** - * Function add item to pending messages - */ - void waitNotification(int applicationId, const RMessage2 &msg); -private: - /** - * Function create new client session to handle its request - * @param version - client implementation version - * @param message - request message - */ - CSession2 *NewSessionL(const TVersion &version,const RMessage2 &message)const; - -private: - /** - * Reference to initialized storage client - */ - HsActivityDbClientInterface &mStorage; - - QHash mPendingMessage; -}; - -#endif //HSACTIVITYSERVERPRIVATE_H diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/hsactivitydbserver/s60/inc/hsactivitysession_p.h --- a/activityfw/activitydatabase/hsactivitydbserver/s60/inc/hsactivitysession_p.h Mon May 03 12:48:45 2010 +0300 +++ /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: -* -*/ - -#ifndef ACTIVITYSESSIONPRIVATE_H -#define ACTIVITYSESSIONPRIVATE_H -#include -#include "hsactivitydbclientinterface.h" - -/** - * Class impolements client session for S60 enviroment. - * Class is responsible for request handling and data translations - */ -class HsActivitySessionPrivate: public CSession2 -{ -public: - /** - * Constructor - * @param storage - reference to initialized activity storage - */ - HsActivitySessionPrivate(HsActivityDbClientInterface &storage); - - /** - * Destructor - */ - ~HsActivitySessionPrivate(); - - /** - * Implements interface - * @see void CSession2::ServiceL(const RMessage2&) - */ - void ServiceL(const RMessage2 &message); - - /** - * Implements interface - * @see void CSession2::ServiceError(const RMessage2 &, TInt) - */ - void ServiceError(const RMessage2 &message, TInt error); - - void LaunchActivityL(const RMessage2 &message, const QString &name); - - void CancelNotify(RMessage2 &message); -private: - /** - * Function handle data translation and forward request to storage client - * Function can leave on failure. - * @param message - request message - */ - void HandleAddActivityL(const RMessage2 &message); - - /** - * Function handle data translation and forward request to storage client - * Function can leave on failure. - * @param message - request message - */ - void HandleUpdateActivityL(const RMessage2 &message); - - /** - * Function handle data translation and forward request to storage client - * Function can leave on failure. - * @param message - request message - */ - void HandleRemoveActivityL(const RMessage2 &message); - - /** - * Function handle data translation and forward request to storage client - * Function can leave on failure. - * @param message - request message - */ - void HandleRemoveApplicationActivitiesL(const RMessage2 &message); - - /** - * Function handle data translation and forward request to storage client - * Function can leave on failure. - * @param message - request message - */ - void HandleActivitiesL(const RMessage2 &message); - - /** - * Function handle data translation and forward request to storage client - * Function can leave on failure. - * @param message - request message - */ - void HandleApplicationActivitiesL(const RMessage2 &message); - - /** - * Function handle data translation and forward request to server - * Function can leave on failure. - * @param message - request message - */ - void HandleLaunchActivityL(const RMessage2 &message); - - /** - * Function handle data translation and forward request to server - * Function can leave on failure. - * @param message - request message - */ - void HandleWaitActivityL(const RMessage2 &message); - - /** - * Function cancels subscribtion - * @param message - request message - */ - void HandleCancelWaitActivity(const RMessage2 &message); - - /** - * Function read thumbail - * @param message - request message - */ - void HandleGetThumbnailL(const RMessage2 &message); - - /** - * Function handle data translation and forward request to storage client - * Function can leave on failure. - * @param message - request message - */ - void HandleGetDataL(const RMessage2 &message); - - void LaunchActivityL(); - - void WaitActivityL(const RMessage2 &message); - - void GetThumbnailL(const RMessage2 &message); - - void CancelNotify(); - - - /** - * Function deserialize data for request message - * Function can leave on failure. - */ - void ReadDataL(const RMessage2 &src); - - /** - * Function handle data translation and forward request to storage client - * Function can leave on failure. - * @param message - request message - */ - void LeaveIfNotZero(int errNo); -private: - /** - * Reference to storage client - */ - HsActivityDbClientInterface &mStorage; - RBuf8 mData; - QVariantHash mActivity; - QList mResult; - QString mName; - int mAppId; -}; -#endif // ACTIVITYSESSIONPRIVATE_H diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/hsactivitydbserver/s60/src/hsactivityserver_p.cpp --- a/activityfw/activitydatabase/hsactivitydbserver/s60/src/hsactivityserver_p.cpp Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Application entry point -* -*/ -#include "hsactivityserver_p.h" -#include "hsactivitysession_p.h" -#include "hsactivityglobals.h" - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -HsActivityServerPrivate::HsActivityServerPrivate(HsActivityDbClientInterface &storage) - : - CServer2(EPriorityNormal, ESharableSessions), - mStorage(storage) -{ -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -HsActivityServerPrivate::~HsActivityServerPrivate() -{ -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -bool HsActivityServerPrivate::start() -{ - return (KErrNone == Start(KActivityServerName)); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void HsActivityServerPrivate::notifyL(int applicationId, - const QString &activityName) -{ - if (mPendingMessage.end() != mPendingMessage.find(applicationId)) { - static_cast(mPendingMessage.find(applicationId).value().Session()) - ->LaunchActivityL(mPendingMessage.find(applicationId).value(), activityName); - mPendingMessage.erase(mPendingMessage.find(applicationId)); - } -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void HsActivityServerPrivate::waitNotification(int applicationId, - const RMessage2 &msg) -{ - if (mPendingMessage.find(applicationId) != mPendingMessage.end()) { - msg.Kill(EBadMessageNumber); - } - mPendingMessage.insert(applicationId,msg); -} -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void HsActivityServerPrivate::cancelNotify(int applicationId) -{ - if (mPendingMessage.end() != mPendingMessage.find(applicationId)) { - static_cast(mPendingMessage.find(applicationId).value().Session()) - ->CancelNotify(mPendingMessage.find(applicationId).value()); - mPendingMessage.erase(mPendingMessage.find(applicationId)); - } -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -CSession2 *HsActivityServerPrivate::NewSessionL(const TVersion &, - const RMessage2&)const -{ - return new(ELeave) HsActivitySessionPrivate(mStorage); -} diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/hsactivitydbserver/s60/src/hsactivitysession_p.cpp --- a/activityfw/activitydatabase/hsactivitydbserver/s60/src/hsactivitysession_p.cpp Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,330 +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: Application entry point -* -*/ -#include "hsactivityserver_p.h" -#include "hsactivitysession_p.h" -#include "hsactivityglobals.h" -#include "hsserializer.h" -#include -#include -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -HsActivitySessionPrivate::HsActivitySessionPrivate(HsActivityDbClientInterface &storage) - : mStorage(storage), mAppId(KErrNotFound) -{ -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -HsActivitySessionPrivate::~HsActivitySessionPrivate() -{ - CancelNotify(); - mData.Close(); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void HsActivitySessionPrivate::ServiceL(const RMessage2 &message) -{ - mActivity.clear(); - mResult.clear(); - mName.clear(); - - switch (message.Function()) { - case AddActivity: - HandleAddActivityL(message); - break; - case UpdateActivity: - HandleUpdateActivityL(message); - break; - case RemoveActivity: - HandleRemoveActivityL(message); - break; - case RemoveApplicationActivities: - HandleRemoveApplicationActivitiesL(message); - break; - case Activities: - HandleActivitiesL(message); - break; - case ApplicationActivities: - HandleApplicationActivitiesL(message); - break; - case LaunchActivity: - HandleLaunchActivityL(message); - break; - case WaitActivity: - HandleWaitActivityL(message); - return; //!!!!! This message shouldn't be compleated !!!!! - case GetThumbnail: - HandleGetThumbnailL(message); - break; - case GetData: - HandleGetDataL(message); - break; - case CancelWait: - HandleCancelWaitActivity(message); - break; - default: - message.Panic(KErr400, CServer2::EBadMessageNumber); - } - message.Complete(KErrNone); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void HsActivitySessionPrivate::ServiceError(const RMessage2 &message, TInt error) -{ - message.Complete(error); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void HsActivitySessionPrivate::HandleAddActivityL(const RMessage2 &message) -{ - ReadDataL(message); - LeaveIfNotZero(mStorage.addActivity(mActivity)); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void HsActivitySessionPrivate::HandleUpdateActivityL(const RMessage2 &message) -{ - ReadDataL(message); - LeaveIfNotZero(mStorage.updateActivity(mActivity)); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void HsActivitySessionPrivate::HandleRemoveActivityL(const RMessage2 &message) -{ - ReadDataL(message); - LeaveIfNotZero(mStorage.removeActivity(mActivity)); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void HsActivitySessionPrivate::HandleRemoveApplicationActivitiesL(const RMessage2 &message) -{ - ReadDataL(message); - LeaveIfNotZero(mStorage.removeApplicationActivities(mActivity)); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void HsActivitySessionPrivate::HandleActivitiesL(const RMessage2 &message) -{ - int errNo(KErrNone); - QT_TRYCATCH_LEAVING(errNo = mStorage.activities(mResult)); - LeaveIfNotZero(errNo); - mData << mResult; - TPckgC dataSize(mData.Size()); - message.WriteL(1, dataSize); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void HsActivitySessionPrivate::HandleApplicationActivitiesL(const RMessage2 &message) -{ - int errNo(KErrNone); - ReadDataL(message); - QT_TRYCATCH_LEAVING(errNo = mStorage.applicationActivities(mResult, mActivity)); - LeaveIfNotZero(errNo); - mData << mResult; - TPckgC dataSize(mData.Size()); - message.WriteL(1, dataSize); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void HsActivitySessionPrivate::HandleLaunchActivityL(const RMessage2 &message) -{ - ReadDataL(message); - LaunchActivityL(); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void HsActivitySessionPrivate::HandleWaitActivityL(const RMessage2 &message) -{ - ReadDataL(message); - WaitActivityL(message); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void HsActivitySessionPrivate::HandleGetThumbnailL(const RMessage2 &message) -{ - ReadDataL(message); - GetThumbnailL(message); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void HsActivitySessionPrivate::HandleCancelWaitActivity(const RMessage2& /*message*/) -{ - CancelNotify(); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void HsActivitySessionPrivate::HandleGetDataL(const RMessage2 &message) -{ - message.WriteL(0, mData); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void HsActivitySessionPrivate::LaunchActivityL() -{ - CServer2 *const server(const_cast(Server())); - if (mActivity.end() == mActivity.find(ActivityApplicationKeyword) || - mActivity.end() == mActivity.find(ActivityActivityKeyword)) { - User::Leave(KErrCorrupt); - } - static_cast - (server)->notifyL(mActivity.find(ActivityApplicationKeyword).value().toInt(), - mActivity.find(ActivityActivityKeyword).value().toString()); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void HsActivitySessionPrivate::LaunchActivityL(const RMessage2 &message, - const QString &name) -{ - if (mData.MaxSize() < name.toAscii().length()) { - mData.ReAlloc(name.toAscii().length()); - } - mData.Copy(reinterpret_cast(name.toAscii().data()), - name.toAscii().length()); - TPckgC dataSize(mData.Size()); - message.WriteL(1, dataSize); - message.Complete(KErrNone); -} -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void HsActivitySessionPrivate::WaitActivityL(const RMessage2 &msg) -{ - CServer2 *const server(const_cast(Server())); - if (mActivity.end() == mActivity.find(ActivityApplicationKeyword)) { - User::Leave(KErrCorrupt); - } - mAppId = mActivity.find(ActivityApplicationKeyword).value().toInt(); - static_cast - (server)->waitNotification(mAppId, msg); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void HsActivitySessionPrivate::GetThumbnailL(const RMessage2 &message) -{ - if (mActivity.constEnd() == mActivity.constFind(ActivityScreenshotKeyword)) { - User::Leave(KErrGeneral); - } - mData << QPixmap(mActivity.constFind(ActivityScreenshotKeyword).value().toString()); - TPckgC dataSize(mData.Size()); - message.WriteL(1, dataSize); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void HsActivitySessionPrivate::CancelNotify() -{ - if (mAppId != KErrNotFound) { - CServer2 *const server(const_cast(Server())); - static_cast(server)->cancelNotify(mAppId); - mAppId = KErrNotFound; - } -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void HsActivitySessionPrivate::CancelNotify(RMessage2 &message) -{ - message.Complete(KErrCancel); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void HsActivitySessionPrivate::ReadDataL(const RMessage2 &src) -{ - int srcLength = src.GetDesLength(0); - User::LeaveIfError(srcLength); - RBuf8 buffer; - CleanupClosePushL(buffer); - buffer.CreateL(srcLength); - src.ReadL(0, buffer, 0); - if (buffer.Length() != srcLength) { - User::Leave(KErrCorrupt); - } - mActivity << buffer; - CleanupStack::PopAndDestroy(&buffer); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void HsActivitySessionPrivate::LeaveIfNotZero(int errNo) -{ - if (KErrNone != errNo) { - User::LeaveIfError(errNo); - User::Leave(KErrGeneral); - } -} diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/hsactivitydbserver/s60/src/main.cpp --- a/activityfw/activitydatabase/hsactivitydbserver/s60/src/main.cpp Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Application entry point -* -*/ - -#include -#include -#include -#include -#include - -#include -#include - -#include "hsactivityserver.h" -#include "hsactivitystorage.h" - -class HsActivityMainAppUi : public QS60MainAppUi -{ -public: - TBool FrameworkCallsRendezvous() const { - return EFalse; - } -}; - -class HsActivityMainDocument : public QS60MainDocument -{ -public: - HsActivityMainDocument(CEikApplication &mainApplication):QS60MainDocument(mainApplication) {} - - CEikAppUi *CreateAppUiL() { - return (static_cast (new(ELeave)HsActivityMainAppUi)); - } -}; - -class HsActivityApplication : public QS60MainApplication -{ -protected: - CApaDocument *CreateDocumentL() { - return new(ELeave) HsActivityMainDocument(*this); - } -}; - -CApaApplication *newHsActivityApplication() -{ - return new HsActivityApplication; -} - -int main(int argc, char *argv[]) -{ - QApplication app(newHsActivityApplication, argc, argv); - HsActivityStorage storage; - HsActivityServer server(storage); - int retVal(KErrGeneral); - if (server.start()) { - CEikonEnv *env = CEikonEnv::Static(); - if (env) { - CApaWindowGroupName *wgName = CApaWindowGroupName::NewLC(env->WsSession()); - wgName->SetHidden(ETrue); // hides us from FSW and protects us from OOM FW etc. - wgName->SetSystem(ETrue); // Allow only application with PowerManagement cap to shut us down - RWindowGroup &rootWindowGroup = env->RootWin(); - wgName->SetWindowGroupName(rootWindowGroup); - rootWindowGroup.SetOrdinalPosition(-1, ECoeWinPriorityNormal); //move to background. - CleanupStack::PopAndDestroy(); - } - RProcess::Rendezvous(KErrNone); - retVal = app.exec(); - } else - RProcess::Rendezvous(retVal); - return retVal; -} - - diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/hsactivitydbserver/src/activitybroadcasttask.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/hsactivitydbserver/src/activitybroadcasttask.cpp Fri May 14 16:10:06 2010 +0300 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#include "activitybroadcasttask.h" + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void ActivityBroadcastTask::ExecuteL(MActivityTaskStorage& storage, + const RMessage2& msg) +{ + const RPointerArray &tasks(storage.StorageData()); + for (TInt iter(0); iter < tasks.Count(); ++iter) { + (tasks[iter])->BroadcastReceivedL(msg); + } + msg.Complete(KErrNone); +} diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/hsactivitydbserver/src/activitydataprovidertask.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/hsactivitydbserver/src/activitydataprovidertask.cpp Fri May 14 16:10:06 2010 +0300 @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#include "activitydataprovidertask.h" +#include "activitycmd.h" + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void ActivityDataProviderTask::ExecuteL(MActivityTaskStorage& storage, + const RMessage2& msg) +{ + TPckgBuf requestId; + CActivityTask* taskPtr(0); + msg.Read(KRequestIdOffset, requestId); + + for (TInt iter(0);iter + + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +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; +} diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/hsactivitydbserver/src/activityobservertask.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/hsactivitydbserver/src/activityobservertask.cpp Fri May 14 16:10:06 2010 +0300 @@ -0,0 +1,109 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#include "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 observerdId; + mMsg.ReadL(KRequestAppIdOffset, observerdId); + + TPckgBuf 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(mData.Length()));//write data size + mMsg.WriteL(KResponseIdOffset, TPckgBuf(this));//task identyfier +} diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/hsactivitydbserver/src/activityserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/hsactivitydbserver/src/activityserver.cpp Fri May 14 16:10:06 2010 +0300 @@ -0,0 +1,116 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#include "activityserver.h" +#include "activitysession.h" +#include "activitystorage.h" +#include "activitytask.h" + +#include + +_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(this)->mFsSession, + *const_cast(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& CActivityServer::StorageData() const +{ + return mObservers; +} diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/hsactivitydbserver/src/activitysession.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/hsactivitydbserver/src/activitysession.cpp Fri May 14 16:10:06 2010 +0300 @@ -0,0 +1,150 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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& CActivitySession::StorageData() const +{ + return mRunningTasks; +} diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/hsactivitydbserver/src/activitystorage.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/hsactivitydbserver/src/activitystorage.cpp Fri May 14 16:10:06 2010 +0300 @@ -0,0 +1,399 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 +#include + +_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); + } +} diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/hsactivitydbserver/src/activitystorageasynctask.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/hsactivitydbserver/src/activitystorageasynctask.cpp Fri May 14 16:10:06 2010 +0300 @@ -0,0 +1,126 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 appId; + msg.ReadL(KRequestAppIdOffset, appId); + dataStorage.ActivitiesL(mData, appId()); + WriteResponseL(msg); +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CActivityStorageAsyncTask::WriteResponseL(const RMessage2& msg) +{ + msg.WriteL(KResponseDataSizeOffset, TPckgBuf(mData.Length()));//write data size + msg.WriteL(KResponseIdOffset, TPckgBuf(this));//task identyfier +} diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/hsactivitydbserver/src/activitystoragesynctask.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/hsactivitydbserver/src/activitystoragesynctask.cpp Fri May 14 16:10:06 2010 +0300 @@ -0,0 +1,126 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 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 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 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 appId; + msg.ReadL(KRequestAppIdOffset, appId); + dataStorage.DeleteActivitiesL(appId()); +} diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/hsactivitydbserver/src/activitythumbnailtask.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/hsactivitydbserver/src/activitythumbnailtask.cpp Fri May 14 16:10:06 2010 +0300 @@ -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: +* +*/ + +#include "activitythumbnailtask.h" +#include "activitycmd.h" + +#include + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +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 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(const_cast(bitmap)->Handle())); + mMsg.Write(1, TPckgBuf(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& ) +{ +} + diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/hsactivitydbserver/src/hsactivityserver.cpp --- a/activityfw/activitydatabase/hsactivitydbserver/src/hsactivityserver.cpp Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Application entry point -* -*/ -#include "hsactivityserver.h" -#include "hsactivityserver_p.h" - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -HsActivityServer::HsActivityServer(HsActivityDbClientInterface &storage) - : - d_ptr(new HsActivityServerPrivate(storage)) -{ -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -HsActivityServer::~HsActivityServer() -{ - delete d_ptr; -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -bool HsActivityServer::start() -{ - return d_ptr->start(); -} diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/hsactivitydbserver/src/hsactivitystorage.cpp --- a/activityfw/activitydatabase/hsactivitydbserver/src/hsactivitystorage.cpp Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,110 +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: Application entry point -* -*/ -#include "hsactivitystorage.h" -#include "hsactivitystorage_p.h" - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -HsActivityStorage::HsActivityStorage() - : - d_ptr(new HsActivityStoragePrivate()) -{ -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -HsActivityStorage::~HsActivityStorage() -{ - delete d_ptr; -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -int HsActivityStorage::addActivity(const QVariantHash &activity) -{ - return d_ptr->addActivity(activity); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -int HsActivityStorage::updateActivity(const QVariantHash &activity) -{ - return d_ptr->updateActivity(activity); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -int HsActivityStorage::removeActivity(const QVariantHash &activity) -{ - return d_ptr->removeActivity(activity); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -int HsActivityStorage::removeApplicationActivities(const QVariantHash &activity) -{ - return d_ptr->removeApplicationActivities(activity); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -int HsActivityStorage::activities(QList& result) -{ - return d_ptr->activities(result); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -int HsActivityStorage::applicationActivities(QList& result, - const QVariantHash &activity) -{ - return d_ptr->applicationActivities(result, activity); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -int HsActivityStorage::waitActivity(const QVariantHash &activity) -{ - return d_ptr->waitActivity(activity); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -int HsActivityStorage::launchActivity(const QVariantHash &activity) -{ - return d_ptr->launchActivity(activity); -} diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/hsactivitydbserver/src/hsactivitystorage_p.cpp --- a/activityfw/activitydatabase/hsactivitydbserver/src/hsactivitystorage_p.cpp Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,345 +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 -#include -#include -#include -#include -#include -#include "hsactivitystorage_p.h" -#include "hsactivity.h" - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -HsActivityStoragePrivate::HsActivityStoragePrivate() -{ - // determine database localization - QSettings settings(ActivityOrganization, ActivityApplication); - settings.setValue(ActivityStorageProperty, ActivityDefaultStorage); - if (!settings.contains(ActivityStorageProperty)) { - settings.setValue(ActivityStorageProperty, ActivityDefaultStorage); - } - QString databaseFile = settings.value(ActivityStorageProperty).toString(); - - if (QSqlDatabase::contains(ActivityStorageName)) { - mConn = QSqlDatabase::database(ActivityStorageName); - } else { - mConn = QSqlDatabase::addDatabase(ActivityStorageDriver, ActivityStorageName); - mConn.setDatabaseName(databaseFile); - if (!mConn.open()) { - qWarning(qPrintable(mConn.lastError().text())); - return; - } - } - if (!checkTables()) { - recreateTables(); - } -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -HsActivityStoragePrivate::~HsActivityStoragePrivate() -{ - mConn.close(); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -int HsActivityStoragePrivate::addActivity(const QVariantHash &activity) -{ - // stream whole entry to bytearray - QByteArray streamedData; - QDataStream stream(&streamedData, QIODevice::WriteOnly); - stream << activity; - - //insert data - QSqlQuery query(mConn); - query.prepare(ActivitySelectActivityQuery); - bind(query, activity); - exec(query); - if (query.next()) { - return KErrGeneral; - } - query.prepare(ActivityInsertActivityQuery); - QVariantHash additionalData; - additionalData.insert(ActivityDataKeyword, streamedData); - bind(query, activity, additionalData); - exec(query); - return 0>=query.numRowsAffected() ? KErrGeneral : getSqlErrorCode(query); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -int HsActivityStoragePrivate::updateActivity(const QVariantHash &activity) -{ - // stream whole entry to bytearray - QByteArray streamedData; - QDataStream stream(&streamedData, QIODevice::WriteOnly); - stream << activity; - - // update - QSqlQuery query(mConn); - query.prepare(ActivityUpdateActivityQuery); - QVariantHash additionalData; - additionalData.insert(ActivityDataKeyword, streamedData); - bind(query, activity, additionalData); - exec(query); - return 0>=query.numRowsAffected() ? KErrGeneral : getSqlErrorCode(query); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -int HsActivityStoragePrivate::removeActivity(const QVariantHash &activity) -{ - return exec(ActivityDeleteActivityQuery, activity); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -int HsActivityStoragePrivate::removeApplicationActivities(const QVariantHash &activity) -{ - return exec(ActivityDeleteApplicationActivitiesQuery, activity); -} -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -int HsActivityStoragePrivate::requestedActivityName(QString &result, - const QVariantHash &activity) -{ - QSqlQuery query(mConn); - query.prepare(ActivitySelectActiveQuery); - bind(query, activity); - int retVal(KErrNone); - if (exec(query) && query.next()) { - result = query.value(0).toString(); - } else { - retVal = KErrNotFound; - } - return retVal; -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -int HsActivityStoragePrivate::activities(QList& result) -{ - return activities(result, ActivityActivitiesQuery, QVariantHash()); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -int HsActivityStoragePrivate::applicationActivities(QList & result, - const QVariantHash &condition) -{ - return activities(result, ActivityApplicationActivitiesQuery, condition); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -int HsActivityStoragePrivate::waitActivity(const QVariantHash &) -{ - return KErrNotSupported; -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -int HsActivityStoragePrivate::launchActivity(const QVariantHash &) -{ - return KErrNotSupported; -} -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -bool HsActivityStoragePrivate::checkTables() -{ - return (QStringList("Activities") == mConn.tables()); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void HsActivityStoragePrivate::recreateTables() -{ - //start sql transaction - if (!mConn.transaction()) { - qErrnoWarning(qPrintable(mConn.lastError().text())); - return; - } - - // drop any existing tables - QSqlQuery query(mConn); - foreach(const QString &tableName, mConn.tables()) { - query.prepare(ActivityDropQuery); - query.bindValue(ActivityTableKeyword, tableName); - exec(query); - } - - // create new table - query.prepare(ActivityCreateQuery); - exec(query); - - //finish sql transaction - if (!mConn.commit()) { - qErrnoWarning(qPrintable(mConn.lastError().text())); - } -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -int HsActivityStoragePrivate::getSqlErrorCode(const QSqlQuery &query) -{ - const QSqlError err(query.lastError()); - const QString errStr(err.text()); - - if (QSqlError ::NoError == err.type()) { - return 0; - } else { - qErrnoWarning(qPrintable(errStr)); - return err.number(); - } -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -bool HsActivityStoragePrivate::exec(QSqlQuery &query) -{ - const bool retVal = query.exec(); - qErrnoWarning(qPrintable(query.lastQuery())); - if (!retVal) { - getSqlErrorCode(query); - } - return retVal; -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -bool HsActivityStoragePrivate::exec(const QString &queryStr, const QVariantHash ¶ms) -{ - QSqlQuery query(mConn); - query.prepare(queryStr); - bind(query, params); - query.exec(); - return getSqlErrorCode(query); - -} -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void HsActivityStoragePrivate::bind(QSqlQuery &query, - const QVariantHash &activity, - const QVariantHash &additionalData) -{ - const QChar tag(' '); - QString queryString(query.lastQuery()); - QVariantHash::const_iterator iter; - int offset(0); - QStringList tokens; - - //explode SQL query to tokens - do { - offset = queryString.indexOf(tag, 0); - if (0 < offset) { - tokens << queryString.left(offset++); - queryString = queryString.right(queryString.length() - offset); - } else { - if (0 < queryString.length()) { - tokens << queryString; - } - break; - } - } while (true); - - //current Sql driver doesnt support proper query formating. - //reuest filtering data has to be binded in right order. - QStringList::iterator token = tokens.begin(); - //iterate all tokens - for (; token != tokens.end(); token = tokens.erase(token)) { - //iterate all provided data and chcek if it match pattern - for (iter = activity.constBegin(); - iter != activity.constEnd(); - ++iter) { - if ((*token).contains(iter.key())) { - query.bindValue(iter.key(), iter.value()); - break; - } - } - for (iter = additionalData.constBegin(); - iter != additionalData.constEnd(); - ++iter) { - if ((*token).contains(iter.key())) { - query.bindValue(iter.key(), iter.value()); - break; - } - } - } -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -int HsActivityStoragePrivate::activities(QList &results, - const QString &queryStr, - const QVariantHash &conditions) -{ - results.clear(); - - QSqlQuery query(mConn); - query.prepare(queryStr); - bind(query, conditions); - if (exec(query)) { - QVariantHash activityEntry; - while (query.next()) { - activityEntry.clear(); - QByteArray data(query.value(0).toByteArray()); - QDataStream stream(&data, QIODevice::ReadOnly); - stream >> activityEntry; - results.append(activityEntry); - } - } - return getSqlErrorCode(query); -} diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/hsactivitydbserver/src/main.cpp --- a/activityfw/activitydatabase/hsactivitydbserver/src/main.cpp Mon May 03 12:48:45 2010 +0300 +++ b/activityfw/activitydatabase/hsactivitydbserver/src/main.cpp Fri May 14 16:10:06 2010 +0300 @@ -11,32 +11,53 @@ * * Contributors: * -* Description: Application entry point +* Description: * */ -#include -#include - -#include "hsactivityserver.h" -#include "hsactivitystorage.h" +#include "activityserver.h" +#include -#ifdef Q_OS_SYMBIAN -#include -#include -#endif - -int main(int argc, char *argv[]) +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +LOCAL_C void StartActivityServerL() { -#ifdef Q_OS_SYMBIAN - CCoeEnv::Static()->RootWin().SetOrdinalPosition(0, ECoeWinPriorityNeverAtFront); -#endif + CActiveScheduler* activeScheduler = new( ELeave ) CActiveScheduler; + CleanupStack::PushL( activeScheduler ); + CActiveScheduler::Install( activeScheduler ); + CActivityServer* serverObject = CActivityServer::NewLC(); + RProcess::Rendezvous( KErrNone ); + CActiveScheduler::Start(); + CleanupStack::PopAndDestroy( serverObject ); + CleanupStack::PopAndDestroy( activeScheduler ); +} - QCoreApplication app(argc, argv); - HsActivityStorage storage; - HsActivityServer server(storage); - int retVal(KErrGeneral); - if (server.start()) { - retVal = app.exec(); +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +LOCAL_C TInt StartActivityServer() +{ + __UHEAP_MARK; + TInt errNo(KErrNoMemory); + CTrapCleanup* cleanupStack = CTrapCleanup::New(); + if (cleanupStack) { + TRAP(errNo, StartActivityServerL()); + delete cleanupStack; } - return retVal; + __UHEAP_MARKEND; + if (KErrNone != errNo) { + RProcess::Rendezvous(errNo); + } + return errNo; } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TInt E32Main() +{ + return StartActivityServer(); +} diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/inc/activitycmd.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/inc/activitycmd.h Fri May 14 16:10:06 2010 +0300 @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef ACTIVITYCMD_H +#define ACTIVITYCMD_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, + WaitActivity, + LaunchActivity, + GetThumbnail, + GetData, + CancelWait +}; + +#endif //ACTIVITYCMD_H + diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/inc/hsactivitydbclientinterface.h --- a/activityfw/activitydatabase/inc/hsactivitydbclientinterface.h Mon May 03 12:48:45 2010 +0300 +++ b/activityfw/activitydatabase/inc/hsactivitydbclientinterface.h Fri May 14 16:10:06 2010 +0300 @@ -17,24 +17,10 @@ #ifndef HSACTIVITYDBCLIENTINTERFACE_H #define HSACTIVITYDBCLIENTINTERFACE_H #include - +#include /** * Enumerate supported functions */ -enum ClientFunctions { - AddActivity =0, - UpdateActivity, - RemoveActivity, - RemoveApplicationActivities, - RequestedActivityName, - Activities, - ApplicationActivities, - WaitActivity, - LaunchActivity, - GetThumbnail, - GetData, - CancelWait -}; const char ActivityApplicationKeyword [] = ":ApplicationId"; const char ActivityActivityKeyword [] = ":ActivityName"; diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activitydatabase/s60/src/hsserializer.cpp --- a/activityfw/activitydatabase/s60/src/hsserializer.cpp Mon May 03 12:48:45 2010 +0300 +++ b/activityfw/activitydatabase/s60/src/hsserializer.cpp Fri May 14 16:10:06 2010 +0300 @@ -15,7 +15,7 @@ * */ #include "hsserializer.h" - +#include // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- @@ -106,10 +106,28 @@ // QList& operator <<(QList& dst, const TDesC8 &src) { - QByteArray buffer(QByteArray::fromRawData(reinterpret_cast(src.Ptr()), - src.Length())); - - QDataStream stream(&buffer, QIODevice::ReadOnly); - QT_TRYCATCH_LEAVING(stream >> dst); + 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; } diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activityserviceplugin/activityclient_p.cpp --- a/activityfw/activityserviceplugin/activityclient_p.cpp Mon May 03 12:48:45 2010 +0300 +++ b/activityfw/activityserviceplugin/activityclient_p.cpp Fri May 14 16:10:06 2010 +0300 @@ -26,11 +26,11 @@ #include #include -ActivityClientPrivate::ActivityClientPrivate(ActivityClient *q) : QObject(q), isconnected(false) +ActivityClientPrivate::ActivityClientPrivate(ActivityClient *q) : QObject(q), mIsconnected(false) { mDataStorage = new ActivityDataStorage(); mServerClient = new HsActivityDbClient(); - isconnected = ( KErrNone == mServerClient->connect()); + mIsconnected = ( KErrNone == mServerClient->connect()); connect(mServerClient, SIGNAL(activityRequested(QString)), q, SIGNAL(activityRequested(QString))); } @@ -42,55 +42,67 @@ bool ActivityClientPrivate::addActivity(const QString &activityId, const QVariant &data, const QVariantHash ¶meters) { - if (isconnected) { - mDataStorage->addActivity(activityId, data); - QVariantHash activity(parameters); - RProcess process; - registerThumbnail(activityId, activity); - activity.insert(ActivityApplicationKeyword, static_cast(process.SecureId().iId)); - activity.insert(ActivityActivityKeyword, activityId); - mServerClient->addActivity(activity); + 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(process.SecureId().iId)); + activity.insert(ActivityActivityKeyword, activityId); + int error = mServerClient->addActivity(activity); + result = error == KErrNone ? true : false; + } } // @todo make those operations atomic - // @todo return real result - return isconnected; + return result; } bool ActivityClientPrivate::removeActivity(const QString &activityId) { - if (isconnected) { - mDataStorage->removeActivity(activityId); - QVariantHash activity; - RProcess process; - activity.insert(ActivityApplicationKeyword, static_cast(process.SecureId().iId)); - activity.insert(ActivityActivityKeyword, activityId); - mServerClient->removeActivity(activity); + bool result(false); + if (mIsconnected) { + result = mDataStorage->removeActivity(activityId); + if ( result ) { + QVariantHash activity; + RProcess process; + activity.insert(ActivityApplicationKeyword, static_cast(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 - // @todo return real result - return isconnected; + return result; } bool ActivityClientPrivate::updateActivity(const QString &activityId, const QVariant &data, const QVariantHash ¶meters) { - if (isconnected) { - mDataStorage->updateActivity(activityId, data); - QVariantHash activity(parameters); - RProcess process; - registerThumbnail(activityId, activity); - activity.insert(ActivityApplicationKeyword, static_cast(process.SecureId().iId)); - activity.insert(ActivityActivityKeyword, activityId); - mServerClient->updateActivity(activity); + 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(process.SecureId().iId)); + activity.insert(ActivityActivityKeyword, activityId); + int error = mServerClient->updateActivity(activity); + result = error == KErrNone ? true : false; + } } // @todo make those operations atomic - // @todo return real result - return isconnected; + return result; } QList ActivityClientPrivate::activities() const { QList activities; - if (isconnected) { + if (mIsconnected) { QVariantHash activity; RProcess process; activity.insert(ActivityApplicationKeyword, static_cast(process.SecureId().iId)); @@ -101,13 +113,13 @@ QVariant ActivityClientPrivate::activityData(const QString &activityId) const { - return isconnected ? mDataStorage->activityData(activityId) : QVariant(); + return mIsconnected ? mDataStorage->activityData(activityId) : QVariant(); } bool ActivityClientPrivate::waitActivity() { - bool retVal(isconnected); - if (isconnected) { + bool retVal(mIsconnected); + if (mIsconnected) { RProcess process; QVariantHash activity; activity.insert(ActivityApplicationKeyword, static_cast(process.SecureId().iId)); @@ -138,7 +150,7 @@ void ActivityClientPrivate::registerThumbnail(const QString &name, QVariantHash &activity) { - QVariantHash::const_iterator findIterator(activity.constFind(ActivityScreenshotKeyword)); + QVariantHash::const_iterator findIterator(activity.constFind(ActivityScreenshotKeyword)); if (activity.constEnd() != findIterator && findIterator.value().canConvert()) { const QString thumbnailManagerName = thumbnailName(name); @@ -157,3 +169,4 @@ QString::number(qHash(activityId), 16) + ".png"); } + diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activityserviceplugin/activityclient_p.h --- a/activityfw/activityserviceplugin/activityclient_p.h Mon May 03 12:48:45 2010 +0300 +++ b/activityfw/activityserviceplugin/activityclient_p.h Fri May 14 16:10:06 2010 +0300 @@ -51,7 +51,7 @@ private: ActivityDataStorage *mDataStorage; HsActivityDbClient *mServerClient; - bool isconnected; + bool mIsconnected; }; #endif // ACTIVITYCLIENT_P_H diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activityserviceplugin/activitymanager.cpp --- a/activityfw/activityserviceplugin/activitymanager.cpp Mon May 03 12:48:45 2010 +0300 +++ b/activityfw/activityserviceplugin/activitymanager.cpp Fri May 14 16:10:06 2010 +0300 @@ -41,17 +41,7 @@ d_ptr->launchActivity(applicationId, activityId); } -void ActivityManager::removeActivity(int applicationId, const QString &activityId) -{ - d_ptr->removeActivity(applicationId, activityId); -} - -void ActivityManager::removeApplicationActivities(int applicationId) +void ActivityManager::getThumbnail(QSize resolution,const QString &thumbnailPath, void *data) { - d_ptr->removeApplicationActivities(applicationId); + d_ptr->getThumbnail(resolution, thumbnailPath, data); } - -void ActivityManager::getThumbnail(const QString &thumbnailId, void *userData) -{ - d_ptr->getThumbnail(thumbnailId, userData); -} diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activityserviceplugin/activitymanager.h --- a/activityfw/activityserviceplugin/activitymanager.h Mon May 03 12:48:45 2010 +0300 +++ b/activityfw/activityserviceplugin/activitymanager.h Fri May 14 16:10:06 2010 +0300 @@ -21,6 +21,7 @@ #include #include #include +#include class ActivityManagerPrivate; @@ -37,9 +38,7 @@ QList activitiesList(); void launchActivity(const QString &uri); void launchActivity(int applicationId, const QString &activityId); - void removeActivity(int applicationId, const QString &activityId); - void removeApplicationActivities(int applicationId); - void getThumbnail(const QString &thumbnailId, void * =0); + void getThumbnail(QSize resolution,const QString &thumbnailPath, void *data =0); signals: void thumbnailReady(QPixmap, void *); diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activityserviceplugin/activitymanager_p.cpp --- a/activityfw/activityserviceplugin/activitymanager_p.cpp Mon May 03 12:48:45 2010 +0300 +++ b/activityfw/activityserviceplugin/activitymanager_p.cpp Fri May 14 16:10:06 2010 +0300 @@ -25,6 +25,10 @@ { mServerClient = new HsActivityDbClient(); mServerClient->connect(); + connect(mServerClient, + SIGNAL(thumbnailRequested(QPixmap, void *)), + q, + SIGNAL(thumbnailReady(QPixmap, void *))); } ActivityManagerPrivate::~ActivityManagerPrivate() @@ -46,7 +50,7 @@ if (uriMatcher.indexIn(uri) != -1) { QStringList list = uriMatcher.capturedTexts(); Q_ASSERT(list.count() == 3); - launchActivity(list.at(1).toInt(), list.at(2)); + launchActivity(list.at(1).toUInt(0, 16), list.at(2)); } else { qWarning("Activity URI parsing error"); } @@ -66,24 +70,7 @@ } } -void ActivityManagerPrivate::removeActivity(int applicationId, const QString &activityId) -{ - QVariantHash activity; - activity.insert(ActivityApplicationKeyword, applicationId); - activity.insert(ActivityActivityKeyword, activityId); - mServerClient->removeActivity(activity); -} - -void ActivityManagerPrivate::removeApplicationActivities(int applicationId) +void ActivityManagerPrivate::getThumbnail(QSize resolution,const QString &thumbnailPath, void *data) { - QVariantHash activity; - activity.insert(ActivityApplicationKeyword, applicationId); - mServerClient->removeApplicationActivities(activity); + mServerClient->getThumbnail(resolution, thumbnailPath, "image/png", data); } - -void ActivityManagerPrivate::getThumbnail(const QString &thumbnailId, void *userData) -{ - QPixmap ico; - mServerClient->getThumbnail(ico, thumbnailId); - emit q_ptr->thumbnailReady(ico, userData); -} diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/activityserviceplugin/activitymanager_p.h --- a/activityfw/activityserviceplugin/activitymanager_p.h Mon May 03 12:48:45 2010 +0300 +++ b/activityfw/activityserviceplugin/activitymanager_p.h Fri May 14 16:10:06 2010 +0300 @@ -20,6 +20,7 @@ #include #include #include +#include #include "applicationlauncher.h" class ActivityManager; @@ -38,9 +39,7 @@ QList activitiesList(); void launchActivity(const QString &uri); void launchActivity(int applicationId, const QString &activityId); - void removeActivity(int applicationId, const QString &activityId); - void removeApplicationActivities(int applicationId); - void getThumbnail(const QString &thumbnailId, void *); + void getThumbnail(QSize resolution,const QString &thumbnailPath, void *data); private: ActivityManager *q_ptr; diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/orbitintegration/hbactivityplugin/hbactivityplugin.cpp --- a/activityfw/orbitintegration/hbactivityplugin/hbactivityplugin.cpp Mon May 03 12:48:45 2010 +0300 +++ b/activityfw/orbitintegration/hbactivityplugin/hbactivityplugin.cpp Fri May 14 16:10:06 2010 +0300 @@ -15,14 +15,13 @@ * */ -#include "hbactivityplugininterface.h" #include "hbactivityplugin.h" #include QTM_USE_NAMESPACE -HbActivityPlugin::HbActivityPlugin(QObject *parent) : HbActivityPluginInterface(parent), mActivityClient(0) +HbActivityPlugin::HbActivityPlugin(QObject *parent) : QObject(parent), mActivityClient(0) { QServiceManager serviceManager; diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/orbitintegration/hbactivityplugin/hbactivityplugin.h --- a/activityfw/orbitintegration/hbactivityplugin/hbactivityplugin.h Mon May 03 12:48:45 2010 +0300 +++ b/activityfw/orbitintegration/hbactivityplugin/hbactivityplugin.h Fri May 14 16:10:06 2010 +0300 @@ -18,9 +18,10 @@ #ifndef HBACTIVITYPLUGIN_H #define HBACTIVITYPLUGIN_H -#include "hbactivityplugininterface.h" +#include +#include "hbactivityplugininterface_p.h" -class HbActivityPlugin : public HbActivityPluginInterface +class HbActivityPlugin : public QObject, public HbActivityPluginInterface { Q_OBJECT Q_INTERFACES(HbActivityPluginInterface) @@ -38,6 +39,9 @@ virtual bool waitActivity(); virtual QVariantHash parseCommandLine(const QStringList &commandLineParams); +signals: + void activityRequested(const QString &activityId); + private: QObject *mActivityClient; diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/orbitintegration/hbactivityplugin/hbactivityplugin.pro --- a/activityfw/orbitintegration/hbactivityplugin/hbactivityplugin.pro Mon May 03 12:48:45 2010 +0300 +++ b/activityfw/orbitintegration/hbactivityplugin/hbactivityplugin.pro Fri May 14 16:10:06 2010 +0300 @@ -22,7 +22,7 @@ CONFIG += mobility MOBILITY = serviceframework -HEADERS += hbactivityplugininterface.h \ +HEADERS += hbactivityplugininterface_p.h \ hbactivityplugin.h \ SOURCES += hbactivityplugin.cpp \ diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/orbitintegration/hbactivityplugin/hbactivityplugininterface.h --- a/activityfw/orbitintegration/hbactivityplugin/hbactivityplugininterface.h Mon May 03 12:48:45 2010 +0300 +++ /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 HBACTIVITYPLUGININTERFACE_H -#define HBACTIVITYPLUGININTERFACE_H - -#include -#include -#include -#include -#include -#include - -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 ¶meters) = 0; - virtual bool removeActivity(const QString &activityId) = 0; - virtual bool updateActivity(const QString &activityId, const QVariant &data, const QVariantHash ¶meters) = 0; - virtual QList 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 diff -r 32469d7d46ff -r 4bc7b118b3df activityfw/orbitintegration/hbactivityplugin/hbactivityplugininterface_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/orbitintegration/hbactivityplugin/hbactivityplugininterface_p.h Fri May 14 16:10:06 2010 +0300 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2008-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: +* +*/ + + +#ifndef HBACTIVITYPLUGININTERFACE_P_H +#define HBACTIVITYPLUGININTERFACE_P_H + +#include +#include +#include +#include +#include + +class HbActivityPluginInterface +{ +public: + virtual ~HbActivityPluginInterface() {} + +public: + virtual bool addActivity(const QString &activityId, const QVariant &data, const QVariantHash ¶meters) = 0; + virtual bool removeActivity(const QString &activityId) = 0; + virtual bool updateActivity(const QString &activityId, const QVariant &data, const QVariantHash ¶meters) = 0; + virtual QList activities() = 0; + virtual QVariant activityData(const QString &activityId) = 0; + virtual bool waitActivity() = 0; + virtual QVariantHash parseCommandLine(const QStringList &commandLineParams) = 0; + +signals: + // signal must be re-declared in the plugin implementation + void activityRequested(const QString &activityId); +}; + +Q_DECLARE_INTERFACE(HbActivityPluginInterface, "HbActivityPluginInterface/1.0") + +#endif // HBACTIVITYPLUGININTERFACE_P_H diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentharvester/contentharvesterclient/bwins/contentharvesterclientu.def --- a/contentpublishingsrv/contentharvester/contentharvesterclient/bwins/contentharvesterclientu.def Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -EXPORTS - ??0RContentHarvesterClient@@QAE@XZ @ 1 NONAME ; RContentHarvesterClient::RContentHarvesterClient(void) - ?Connect@RContentHarvesterClient@@QAEHXZ @ 2 NONAME ; int RContentHarvesterClient::Connect(void) - ?Stop@RContentHarvesterClient@@QAEHXZ @ 3 NONAME ; int RContentHarvesterClient::Stop(void) - ?Update@RContentHarvesterClient@@QAEHXZ @ 4 NONAME ; int RContentHarvesterClient::Update(void) - diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentharvester/contentharvesterclient/eabi/contentharvesterclientu.def --- a/contentpublishingsrv/contentharvester/contentharvesterclient/eabi/contentharvesterclientu.def Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -EXPORTS - _ZN23RContentHarvesterClient4StopEv @ 1 NONAME - _ZN23RContentHarvesterClient6UpdateEv @ 2 NONAME - _ZN23RContentHarvesterClient7ConnectEv @ 3 NONAME - _ZN23RContentHarvesterClientC1Ev @ 4 NONAME - _ZN23RContentHarvesterClientC2Ev @ 5 NONAME - diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentharvester/contentharvesterclient/group/bld.inf --- a/contentpublishingsrv/contentharvester/contentharvesterclient/group/bld.inf Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Build information file for Content Publisher Client -* -*/ - - - -PRJ_PLATFORMS - -DEFAULT - - -PRJ_EXPORTS - - -PRJ_MMPFILES -contentharvesterclient.mmp - -// End of File diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentharvester/contentharvesterclient/group/contentharvesterclient.mmp --- a/contentpublishingsrv/contentharvester/contentharvesterclient/group/contentharvesterclient.mmp Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Interface to CP Active Data Server -* -*/ - -// To get the MW_LAYER_SYSTEMINCLUDE-definition -#include - -TARGET contentharvesterclient.dll -TARGETTYPE dll - -UID 0x1000008D 0x10282E59 -CAPABILITY CAP_GENERAL_DLL -VENDORID VID_DEFAULT - -LANG SC - -SOURCEPATH ../src -SOURCE contentharvesterclient.cpp - -USERINCLUDE ../inc -USERINCLUDE ../../contentharvesterserver/inc - -// Default system include paths for application layer modules. -MW_LAYER_SYSTEMINCLUDE - -LIBRARY euser.lib -LIBRARY estor.lib -LIBRARY efsrv.lib -DEBUGLIBRARY flogger.lib - - -//end of file diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentharvester/contentharvesterclient/inc/contentharvesterclient.h --- a/contentpublishingsrv/contentharvester/contentharvesterclient/inc/contentharvesterclient.h Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +0,0 @@ -/* -* 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 C_CONTENTHARVESTERCLIENT_H -#define C_CONTENTHARVESTERCLIENT_H - -// INCLUDES -#include - -// FORWARD DECLARATIONS - - -// CLASS DECLARATION - -/** - * @brief Client-side interface to CP Active Data Server - * - * This class provides the client-side interface to the active data server session, - * it just passes requests to the server. - * - * @lib contentharvesterclient.lib - * @since S60 v3.1 - */ -class RContentHarvesterClient : public RSessionBase - { -public: - - /** - * Construct the object. - */ - IMPORT_C RContentHarvesterClient(); - - /** - * Connects to the server and create a session. - * When the server is not running, the function starts the server. - * @return error code - */ - IMPORT_C TInt Connect(); - - /** - * Triggers updating process of Active Data Server, - * the function returns right after the server receives the request - * (it isn't information about the whole update process.) - * @return error code - */ - IMPORT_C TInt Update(); - - /** - * Triggers stop process on server - * @return error code - */ - IMPORT_C TInt Stop(); - - /** - * Returns the version number - * @return the version - */ - TVersion Version() const; - }; - -#endif // C_CONTENTHARVESTERCLIENT_H -// End of File diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentharvester/contentharvesterclient/src/contentharvesterclient.cpp --- a/contentpublishingsrv/contentharvester/contentharvesterclient/src/contentharvesterclient.cpp Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,147 +0,0 @@ -/* -* 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 "contentharvesterclient.h" -#include "contentharvesterglobals.h" - -// Number of message slots to reserve for this client server session. -const TUint KDefaultMessageSlots( 5); - -// Function prototypes -static TInt StartServer(); -static TInt CreateServerProcess(); - -// ======== MEMBER FUNCTIONS ======== - -// ----------------------------------------------------------------------------- -// RContentHarvesterClient::RContentHarvesterClient -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -EXPORT_C RContentHarvesterClient::RContentHarvesterClient() -:RSessionBase() - { - // No implementation required - } - -// ----------------------------------------------------------------------------- -// RContentHarvesterClient::Connect -// Connect to Content Harvester Server session. -// exist -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt RContentHarvesterClient::Connect() - { - TInt error = ::StartServer(); - - if ( error == KErrNone ) - { - error = CreateSession( KContentHarvesterName, - Version(), - KDefaultMessageSlots ); - } - return error; - } - -// ----------------------------------------------------------------------------- -// RContentHarvesterClient::Update -// Client requests to trigger update process -// ----------------------------------------------------------------------------- - -EXPORT_C TInt RContentHarvesterClient::Update() - { - return SendReceive( EContentHarvesterUpdate ); - } - -// ----------------------------------------------------------------------------- -// RContentHarvesterClient::Stop -// Client requests to trigger stop process -// ----------------------------------------------------------------------------- - -EXPORT_C TInt RContentHarvesterClient::Stop() - { - return SendReceive( EContentHarvesterStop ); - } - -// ----------------------------------------------------------------------------- -// RContentHarvesterClient::Version -// Version information. -// ----------------------------------------------------------------------------- -// -TVersion RContentHarvesterClient::Version() const - { - return (TVersion( KContentHarvesterMajorVersionNumber, - KContentHarvesterMinorVersionNumber, - KContentHarvesterBuildVersionNumber ) ); - } - -// ----------------------------------------------------------------------------- -// StartServer -// Static method to start the server. -// ----------------------------------------------------------------------------- -// -static TInt StartServer() - { - TInt result; - - TFindServer findServer( KContentHarvesterName ); - TFullName name; - - result = findServer.Next( name ); - if ( result != KErrNone ) - { - // Server not running - result = CreateServerProcess( ); - } - return result; - } - -// ----------------------------------------------------------------------------- -// CreateServerProcess -// Static method to create the server process. -// ----------------------------------------------------------------------------- -// -static TInt CreateServerProcess() - { - const TUidType serverUid( KNullUid, KNullUid, KServerUid3); - RProcess server; - TInt result; - result = server.Create( KContentHarvesterFilename, KNullDesC, serverUid ); - if ( result == KErrNone ) - { - TRequestStatus stat = KRequestPending; - server.Rendezvous( stat ); - if ( stat != KRequestPending ) - { - server.Kill( 0 ); // abort startup - } - else - { - server.Resume( ); // logon OK - start the server - } - - User::WaitForRequest( stat ); // wait for start or death - // we can't use the 'exit reason' if the server panicked as this - // is the panic 'reason' and may be '0' which cannot be distinguished - // from KErrNone - result = (server.ExitType( ) == EExitPanic ) ? KErrGeneral - : stat.Int( ); - } - server.Close( ); - return result; - } diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentharvester/contentharvesterserver/group/bld.inf --- a/contentpublishingsrv/contentharvester/contentharvesterserver/group/bld.inf Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Build information file for Content Publisher Server -* -*/ - - - -PRJ_PLATFORMS - -DEFAULT - - -PRJ_EXPORTS - -PRJ_MMPFILES -contentharvesterserver.mmp - - -// End of File \ No newline at end of file diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentharvester/contentharvesterserver/group/contentharvesterserver.mmp --- a/contentpublishingsrv/contentharvester/contentharvesterserver/group/contentharvesterserver.mmp Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 -* -*/ - -// To get the MW_LAYER_SYSTEMINCLUDE-definition -#include - -TARGET contentharvester.exe -TARGETTYPE exe -CAPABILITY CAP_SERVER NetworkControl -VENDORID VID_DEFAULT - -UID 0x1000008d 0x10282E5A - -LANG SC - -SOURCEPATH ../src -SOURCE contentharvesterserver.cpp -SOURCE contentharvesterengine.cpp -SOURCE contentharvestersession.cpp - -USERINCLUDE ../inc -USERINCLUDE ../../../contentpublishingserver/cpserver/inc -USERINCLUDE ../../../contentpublishingutils/contentpublishingdebug/inc -USERINCLUDE ../../../contentpublishingutils/pluginvalidator/inc - -// Default system include paths for application layer modules. -MW_LAYER_SYSTEMINCLUDE - - -LIBRARY euser.lib -LIBRARY efsrv.lib -LIBRARY ecom.lib - -LIBRARY fbscli.lib // to operate with images -LIBRARY eikcore.lib -LIBRARY cone.lib -LIBRARY liwservicehandler.lib -LIBRARY pluginvalidator.lib - -#ifdef CONTENT_PUBLISHER_DEBUG -LIBRARY cpdebug.lib -#endif - -DEBUGLIBRARY flogger.lib - -EPOCHEAPSIZE 0x1000 0x400000 -EPOCSTACKSIZE 0x5000 - -//end of file - diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentharvester/contentharvesterserver/inc/contentharvesterengine.h --- a/contentpublishingsrv/contentharvester/contentharvesterserver/inc/contentharvesterengine.h Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +0,0 @@ -/* -* 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: Engine for cp active data server - * -*/ - - -#ifndef C_CONTENTHARVESTERENGINE_H -#define C_CONTENTHARVESTERENGINE_H - -#include "contentharvesterplugin.h" - -// FORWARD DECLARATIONS -//class CContentHarvesterPlugin; -class MLiwInterface; -class CLiwServiceHandler; -class CPluginValidator; - -// CLASS DECLARATION - -/** - * The engine that discovers and manages all installed harvesting plugins. - * - * @lib contentharvesterserver.lib - * @since S60 v3.1 - */ -class CContentHarvesterEngine : public CBase - { - -public: - // New methods - - /** - * Create a CContentHarvesterEngine object using two phase construction, - * and return a pointer to the created object. - * @return pointer to new session - */ - static CContentHarvesterEngine* NewL(); - - /** - * Create a CContentHarvesterEngine object using two phase construction, - * and return a pointer to the created object. - * @return pointer to new session - */ - static CContentHarvesterEngine* NewLC(); - - /** - * Destroy the object and release all memory objects. - */ - virtual ~CContentHarvesterEngine(); - - /** - * Pass update request to all registered plugins. - */ - void Update(); - -private: - // New methods - - /** - * Perform the first phase of two phase construction. - */ - CContentHarvesterEngine(); - - /** - * Perform the second phase construction of a CContentHarvesterEngine object. - */ - void ConstructL(); - -private: - - /** - * handler to CPS - * Own - */ - CLiwServiceHandler* iServiceHandler; - - /** - * interface to CPS - * Own - */ - MLiwInterface * iCPSInterface; - - /** - * Plugins - * Own - */ - CPluginValidator* iPluginManager; - - }; - -#endif // C_CONTENTHARVESTERENGINE_H diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentharvester/contentharvesterserver/inc/contentharvesterglobals.h --- a/contentpublishingsrv/contentharvester/contentharvesterserver/inc/contentharvesterglobals.h Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -/* -* 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: Globals for cp active data server - * -*/ - - -#ifndef C_CONTENTHARVESTERGLOBALS_H -#define C_CONTENTHARVESTERGLOBALS_H - -// CONSTANTS -const TUint KContentHarvesterMajorVersionNumber = 0; -const TUint KContentHarvesterMinorVersionNumber = 1; -const TUint KContentHarvesterBuildVersionNumber = 1; - -_LIT( KContentHarvesterThreadName, "contentharvester_MainThread" ); -_LIT( KContentHarvesterName, "contentharvester" ); -_LIT( KContentHarvesterFilename, "contentharvester" ); - -const TUid KServerUid3 = - { - 0x10282E5A - }; - -// ENUMERATIONS -// Opcodes used in message passing between client and server -enum KContentHarvesterRqst - { - EContentHarvesterUpdate = 100, - EContentHarvesterStop - }; - -enum KContentHarvesterRsp - { - EContentHarvesterUpdateComplete = 200, - EContentHarvesterStopComplete - }; - -#endif // C_CONTENTHARVESTERGLOBALS_H -// End of File diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentharvester/contentharvesterserver/inc/contentharvesterpanic.h --- a/contentpublishingsrv/contentharvester/contentharvesterserver/inc/contentharvesterpanic.h Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -/* -* 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: Panics for cp active data server - * -*/ - - -#ifndef __CONTENTHARVESTERPANIC_H_ -#define __CONTENTHARVESTERPANIC_H_ - -/** Panic Category */ - -/** Content Harvester panic codes */ -enum TContentHarvesterPanic - { - EContentHarvesterBadRequest = 1, - EContentHarvesterBadDescriptor = 2, - EContentHarvesterSrvCreateServer = 3, - EContentHarvesterMainSchedulerError = 4, - EContentHarvesterCreateTrapCleanup = 5, - EContentHarvesterSrvSessCreateTimer = 6, - EContentHarvesterReqAlreadyPending = 7, // A request is already pending - EContentHarvesterEIkonEnv = 8 - }; - -#endif // __CONTENTHARVESTERPANIC_H_ diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentharvester/contentharvesterserver/inc/contentharvesterserver.h --- a/contentpublishingsrv/contentharvester/contentharvesterserver/inc/contentharvesterserver.h Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,167 +0,0 @@ -/* -* 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: Content Harvester Server - implemenration of CServer2 - * -*/ - - -#ifndef C_CONTENTHARVESTERSERVER_H -#define C_CONTENTHARVESTERSERVER_H - -#include -#include -#include "contentharvesterpanic.h" - -class CContentHarvesterEngine; - -// CONSTANTS - -// FORWARD DECLARATIONS - -// CLASS DECLARATION - -/** - * CP Active Data Server container. - * Provides interface for CP Active Data Server maintanace purposes. - * - * @lib ???.lib - * @since Series 60 3.1 - */ -class CContentHarvesterServer : public CServer2 - { - /** - * EIkonEnv for the server process. - * - * @lib ???.lib - * @since Series 60 3.1 - */ - class CContentHarvesterEikonEnv : public CEikonEnv - { -public: - void DestroyEnvironment(); - void ConstructL(); - }; - - /** - * EikAppUi for the server process. - * - * @lib ???.lib - * @since Series 60 3.1 - */ - class CContentHarvesterAppUi : public CEikAppUi - { -public: - ~CContentHarvesterAppUi(); - void ConstructL(); - }; - -public: - // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CContentHarvesterServer* NewLC(); - - /** - * Destructor. - */ - virtual ~CContentHarvesterServer(); - -public: - // New functions - - /** - * Return the reference to the engine. - * @return engine reference - */ - CContentHarvesterEngine& Engine(); - - /** - * Stops server. - */ - void Stop(); - - /** - * First stage startup for the server thread. - * @return return KErrNone or panics thread - */ - static TInt ThreadFunction(); - - /** - * Panic client. - * @param aMessage RMessage2 - * @param aPanic panic code - */ - static void PanicClient( const RMessage2& aMessage, - TContentHarvesterPanic aPanic ); - -protected: - // From CActive - /** - * Process any errors. - * @param aError the leave code reported - * @return return KErrNone if leave is handled - */ - TInt RunError( TInt aError ); - -private: - // New methods - - /** - * Constructs the server. - * @param aPriority CServer2 input parameter - */ - CContentHarvesterServer( TInt aPriority ); - - /** - * Perform the second phase construction of a CContentHarvesterServer object. - */ - void ConstructL(); - - /** - * Panic the server. - * @param param aPanic the panic code - * @return a updateId of container - */ - static void PanicServer( TContentHarvesterPanic aPanic ); - - /** - * Second stage startup for the server thread. - */ - static void ThreadFunctionL(); - -private: - // From CServer2 - - /** - * Create a time server session, and return a pointer to the created object. - * @param aVersion the client version - * @param aMessage RMessage2 - * @return pointer to new session - */ - CSession2* NewSessionL( const TVersion& aVersion, - const RMessage2& aMessage ) const; - -private: - - /** - * instance of engine, where the whole logic is implemented - * Own. - */ - CContentHarvesterEngine* iEngine; - - }; - -#endif // C_CONTENTHARVESTERSERVER_H diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentharvester/contentharvesterserver/inc/contentharvestersession.h --- a/contentpublishingsrv/contentharvester/contentharvesterserver/inc/contentharvestersession.h Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +0,0 @@ -/* -* 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: Engine for content harvester server - * -*/ - - -#ifndef C_CONTENTHARVESTERSESSION_H -#define C_CONTENTHARVESTERSESSION_H - -// INCLUDES -#include - -// FORWARD DECLARATIONS -class CContentHarvesterServer; - -// CLASS DECLARATION - -/** - An instance of class CContentHarvesterSession is created for each client - */ -class CContentHarvesterSession : public CSession2 - { - -public: - // New methods - - /** - * Create a CContentHarvesterSession object using two phase construction, - * and return a pointer to the created object - * @param aServer CContentHarvesterServer - * @return pointer to new session - */ - static CContentHarvesterSession* NewL( CContentHarvesterServer* aServer ); - - /** - * Create a CContentHarvesterSession object using two phase construction, - * and return a pointer to the created object - * @param aServer CContentHarvesterServer - * @return pointer to new session - */ - static CContentHarvesterSession* NewLC( CContentHarvesterServer* aServer ); - - /** - * Destroy the object and release all memory objects - */ - virtual ~CContentHarvesterSession(); - -public: - // From CSession - /** - * Called after a service request from client; from class CSession - * @param aMessage message from client (containing requested operation and any data) - */ - void ServiceL( const RMessage2& aMessage ); - -private: - // New methods - - /** - * Perform the first phase of two phase construction - * @param aServer CContentHarvesterServer - */ - CContentHarvesterSession( CContentHarvesterServer* aServer ); - - /** - * Perform the second phase construction of a CContentHarvesterSession object - */ - void ConstructL(); - -private: - - /** - * CP Active Data Server container - * Own. - */ - CContentHarvesterServer* iContentHarvesterServer; - }; - -#endif // C_CONTENTHARVESTERSESSION_H diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentharvester/contentharvesterserver/src/contentharvesterengine.cpp --- a/contentpublishingsrv/contentharvester/contentharvesterserver/src/contentharvesterengine.cpp Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,167 +0,0 @@ -/* -* 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: Content Harvester Engine - * -*/ - - -// for CleanupResetAndDestroyPushL -#include -#include // harvesting plugin -#include -#include - -#include "charvesterpluginvalidator.h" -#include "contentharvesterpluginuids.hrh" -#include "cpglobals.h" -#include "cpdebug.h" -#include "contentharvesterengine.h" - -// LOCAL CONSTANTS -const TInt KADatFactorySettingsServerPluginUid( 0x102830EF); - - - -// ================= MEMBER FUNCTIONS ======================= -// ----------------------------------------------------------------------------- -// CContentHarvesterEngine::CContentHarvesterEngine -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CContentHarvesterEngine::CContentHarvesterEngine() - { - } - -// ----------------------------------------------------------------------------- -// CContentHarvesterEngine::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CContentHarvesterEngine::ConstructL() - { - CP_DEBUG(_L8("Create Engine" )); - - CP_DEBUG(_L8("Start delayed update" )); - // start updating process - - iServiceHandler = CLiwServiceHandler::NewL( ); - // for convinience keep pointers to Service Handler param lists - CLiwGenericParamList* inParamList = &iServiceHandler->InParamListL( ); - CLiwGenericParamList* outParamList = &iServiceHandler->OutParamListL( ); - - RCriteriaArray criteriaArray; - CleanupResetAndDestroyPushL( criteriaArray ); - - // create Liw criteria - CLiwCriteriaItem* criterion = CLiwCriteriaItem::NewLC( KLiwCmdAsStr, - KCPInterface, KCPService ); - criterion->SetServiceClass( TUid::Uid( KLiwClassBase ) ); - - criteriaArray.AppendL( criterion ); - CleanupStack::Pop( criterion ); - - // attach Liw criteria - iServiceHandler->AttachL( criteriaArray ); - // get BS Service interface - iServiceHandler->ExecuteServiceCmdL( *criterion, *inParamList, - *outParamList ); - - CleanupStack::PopAndDestroy( &criteriaArray ); - - TInt pos( 0); - outParamList->FindFirst( pos, KCPInterface ); - if ( pos != KErrNotFound ) - { - iCPSInterface = (*outParamList)[pos].Value().AsInterface( ); - } - - iPluginManager = CHarvesterPluginValidator::NewL( - TUid::Uid( KContentHarvesterPluginUid ), - iCPSInterface ); - } - -// ----------------------------------------------------------------------------- -// CContentHarvesterEngine::~CContentHarvesterEngine -// Destructor. -// ----------------------------------------------------------------------------- -// -CContentHarvesterEngine::~CContentHarvesterEngine() - { - if ( iCPSInterface ) - { - iCPSInterface->Close( ); - } - delete iServiceHandler; - delete iPluginManager; - } - -// ----------------------------------------------------------------------------- -// CContentHarvesterEngine::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CContentHarvesterEngine* CContentHarvesterEngine::NewL() - { - CContentHarvesterEngine* self = CContentHarvesterEngine::NewLC( ); - CleanupStack::Pop( self ) ; - return self; - } - -// ----------------------------------------------------------------------------- -// CContentHarvesterEngine::NewLC -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CContentHarvesterEngine* CContentHarvesterEngine::NewLC() - { - CContentHarvesterEngine* self = new ( ELeave ) CContentHarvesterEngine(); - CleanupStack::PushL( self ); - self->ConstructL( ) ; - return self; - } - -// ----------------------------------------------------------------------------- -// CContentHarvesterEngine::Update -// Pass request for update to all installed plugins -// ----------------------------------------------------------------------------- -// -void CContentHarvesterEngine::Update() - { - CP_DEBUG(_L8("CContentHarvesterEngine::Update" )); - CContentHarvesterPlugin* plugin( NULL ); - CContentHarvesterPlugin* fsplugin = - static_cast - ( iPluginManager->GetImplementation( - TUid::Uid( KADatFactorySettingsServerPluginUid) ) ); - - if (fsplugin) - { - TRAP_IGNORE( fsplugin->UpdateL() ); - } - - for ( TInt i = 0; i < iPluginManager->GetCount(); i++ ) - { - plugin = static_cast - ( iPluginManager->GetImplementation( i ) ); - if( plugin!= fsplugin ) - { - TRAP_IGNORE( plugin->UpdateL() ); - } - } - } - -// End of File - - diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentharvester/contentharvesterserver/src/contentharvesterserver.cpp --- a/contentpublishingsrv/contentharvester/contentharvesterserver/src/contentharvesterserver.cpp Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,283 +0,0 @@ -/* -* 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: Content Harvester Server - * -*/ - - -//#include -//#include - -#include - -#include "contentharvesterserver.h" -#include "contentharvestersession.h" -#include "contentharvesterglobals.h" -#include "contentharvesterengine.h" -#include "cpdebug.h" - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CContentHarvesterServer::CContentHarvesterServer -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CContentHarvesterServer::CContentHarvesterServer( TInt aPriority ) : - CServer2(aPriority) - { - } - -// ----------------------------------------------------------------------------- -// CContentHarvesterServer::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CContentHarvesterServer::ConstructL() - { - CP_DEBUG( _L8("Start Content Harvester Server" )); - StartL( KContentHarvesterName ); - iEngine = CContentHarvesterEngine::NewL( ); - } - -// ----------------------------------------------------------------------------- -// CContentHarvesterServer::NewL -// Two-phased constructor. -// -------------------------------------- --------------------------------------- -// -CContentHarvesterServer* CContentHarvesterServer::NewLC() - { - CContentHarvesterServer* self = new( ELeave ) - CContentHarvesterServer( EPriorityNormal ); - CleanupStack::PushL( self ); - self->ConstructL( ); - return self; - } - -// Destructor -CContentHarvesterServer::~CContentHarvesterServer() - { - CP_DEBUG( _L8("Destroy Content Harvester Server" )); - delete iEngine; - } - -// ----------------------------------------------------------------------------- -// CContentHarvesterServer::NewSessionL -// Create new session. -// ----------------------------------------------------------------------------- -// -CSession2* CContentHarvesterServer::NewSessionL( const TVersion& aVersion, - const RMessage2& /*aMessage*/ ) const - { - CP_DEBUG(_L8("CContentHarvesterServer::NewSessionL" )); - // Check we're the right version - if ( !User::QueryVersionSupported( TVersion( - KContentHarvesterMajorVersionNumber, - KContentHarvesterMinorVersionNumber, - KContentHarvesterBuildVersionNumber ), aVersion ) ) - { - User::Leave( KErrNotSupported ); - } - return CContentHarvesterSession::NewL( ( CContentHarvesterServer* ) this ); - } - -// ----------------------------------------------------------------------------- -// CContentHarvesterServer::RunError -// RunError is called when RunL leaves. -// ----------------------------------------------------------------------------- -// -TInt CContentHarvesterServer::RunError( TInt aError ) - { - CP_DEBUG( _L8("CContentHarvesterServer::RunError " )); - if ( aError == KErrBadDescriptor ) - { - PanicClient( Message( ), EContentHarvesterBadDescriptor ); - } - else - { - Message().Complete( aError ); - } - - // The leave will result in an early return from CServer::RunL(), skipping - // the call to request another message. So do that now in order to keep the - // server running. - ReStart( ); - // Handled the error fully - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CContentHarvesterServer::PanicClient -// Panic client. -// ----------------------------------------------------------------------------- -// -void CContentHarvesterServer::PanicClient( const RMessage2& aMessage, - TContentHarvesterPanic aPanic ) - { - aMessage.Panic( KContentHarvesterName, aPanic ); - } - -// ----------------------------------------------------------------------------- -// CContentHarvesterServer::PanicServer -// Panic server. -// ----------------------------------------------------------------------------- -// -void CContentHarvesterServer::PanicServer( TContentHarvesterPanic aPanic ) - { - User::Panic( KContentHarvesterName, aPanic ); - } - -// ----------------------------------------------------------------------------- -// CContentHarvesterServer::ThreadFunctionL -// Create and start the server. -// ----------------------------------------------------------------------------- -// -void CContentHarvesterServer::ThreadFunctionL() - { - RFbsSession::Connect( ); - // Construct our server - - CContentHarvesterServer* server = CContentHarvesterServer::NewLC( ); - CP_DEBUG(_L8("Send Rendezvous" )); - RProcess::Rendezvous( KErrNone ); - - CActiveScheduler::Start( ); - - CleanupStack::PopAndDestroy( server ); - - RFbsSession::Disconnect( ); - } -// ----------------------------------------------------------------------------- -// CContentHarvesterServer::ThreadFunctionL -// Create and start the server. -// ----------------------------------------------------------------------------- -// -TInt CContentHarvesterServer::ThreadFunction() - { - __UHEAP_MARK; - - TFindServer findCountServer( KContentHarvesterName ); - TFullName name; - - // Need to check that the server exists. - if (findCountServer.Next(name) != KErrNone) - { - User::RenameThread( KContentHarvesterThreadName ); - - CTrapCleanup* cleanupStack = CTrapCleanup::New( ); - if ( !(cleanupStack ) ) - { - PanicServer( EContentHarvesterCreateTrapCleanup ); - } - - CContentHarvesterEikonEnv* env = new CContentHarvesterEikonEnv; - __ASSERT_ALWAYS( env, PanicServer( EContentHarvesterEIkonEnv ) ); - - CContentHarvesterAppUi* ui = new CContentHarvesterAppUi; - __ASSERT_ALWAYS( ui, PanicServer( EContentHarvesterEIkonEnv ) ); - - TRAPD(error, env->ConstructL(); ui->ConstructL()); - __ASSERT_ALWAYS( !error, PanicServer( EContentHarvesterEIkonEnv ) ); - - TRAPD( err, ThreadFunctionL() ); - if ( err != KErrNone ) - { - PanicServer( EContentHarvesterSrvCreateServer ); - } - ui->PrepareToExit( ); - env->DestroyEnvironment( ); - - delete cleanupStack; - cleanupStack = NULL; - } - - __UHEAP_MARKEND; - - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CContentHarvesterServer::Engine -// Getter of engine -// ----------------------------------------------------------------------------- -// -CContentHarvesterEngine& CContentHarvesterServer::Engine() - { - return *iEngine; - } -// ----------------------------------------------------------------------------- -// CContentHarvesterServer::Engine -// Getter of engine -// ----------------------------------------------------------------------------- -// -void CContentHarvesterServer::Stop() - { - CActiveScheduler::Stop( ); - } - -// ----------------------------------------------------------------------------- -// CContentHarvesterEikonEnv::DestroyEnvironment -// -// ----------------------------------------------------------------------------- -// -void CContentHarvesterServer::CContentHarvesterEikonEnv::DestroyEnvironment() - { - CEikonEnv::DestroyEnvironment( ); - } - -// ----------------------------------------------------------------------------- -// CContentHarvesterEikonEnv::ConstructL -// -// ----------------------------------------------------------------------------- -// -void CContentHarvesterServer::CContentHarvesterEikonEnv::ConstructL() - { - CEikonEnv::ConstructL( EFalse ); - SetAutoForwarding( ETrue ); - User::SetPriorityControl( EFalse ); - } -// ----------------------------------------------------------------------------- -// CContentHarvesterAppUi::~CContentHarvesterAppUi -// -// ----------------------------------------------------------------------------- -// -CContentHarvesterServer::CContentHarvesterAppUi::~CContentHarvesterAppUi() - { - } - -// ----------------------------------------------------------------------------- -// CContentHarvesterAppUi::ConstructL -// -// ----------------------------------------------------------------------------- -// -void CContentHarvesterServer::CContentHarvesterAppUi::ConstructL() - { - CEikAppUi::BaseConstructL( ENoAppResourceFile|ENoScreenFurniture ); - } - -// ============================= LOCAL FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// E32Main entry point. -// Returns: KErrNone -// ----------------------------------------------------------------------------- -// -TInt E32Main() - { - return CContentHarvesterServer::ThreadFunction( ); - } - -// End of File - diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentharvester/contentharvesterserver/src/contentharvestersession.cpp --- a/contentpublishingsrv/contentharvester/contentharvesterserver/src/contentharvestersession.cpp Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,117 +0,0 @@ -/* -* 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: Content Harvester Server Session - * -*/ - - -// INCLUDE FILES -#include "contentharvestersession.h" -#include "contentharvesterengine.h" -#include "contentharvesterserver.h" -#include "contentharvesterglobals.h" -#include "cpdebug.h" - -// ================= MEMBER FUNCTIONS ======================= - -// ----------------------------------------------------------------------------- -// CContentHarvesterSession::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CContentHarvesterSession* CContentHarvesterSession::NewL( - CContentHarvesterServer* aServer ) - { - CContentHarvesterSession* self = - CContentHarvesterSession::NewLC( aServer ); - CleanupStack::Pop( self ) ; - return self; - } - -// ----------------------------------------------------------------------------- -// CContentHarvesterSession::NewLC -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CContentHarvesterSession* CContentHarvesterSession::NewLC( - CContentHarvesterServer* aServer ) - { - CContentHarvesterSession* self = new ( ELeave ) - CContentHarvesterSession(aServer); - CleanupStack::PushL( self ); - self->ConstructL( ) ; - return self; - } - -// ----------------------------------------------------------------------------- -// CContentHarvesterSession::~CContentHarvesterSession -// Destructor. -// ----------------------------------------------------------------------------- -// -CContentHarvesterSession::~CContentHarvesterSession() - { - - } - -// ----------------------------------------------------------------------------- -// CContentHarvesterSession::ServiceL -// Handle client requests. -// ----------------------------------------------------------------------------- -// -void CContentHarvesterSession::ServiceL( const RMessage2& aMessage ) - { - CP_DEBUG(_L8("CContentHarvesterSession::ServiceL")); - switch ( aMessage.Function( ) ) - { - case EContentHarvesterUpdate: - CP_DEBUG(_L8("Update command")); - aMessage.Complete( EContentHarvesterUpdateComplete ); - iContentHarvesterServer->Engine().Update( ); - break; - case EContentHarvesterStop: - CP_DEBUG(_L8("Stop command")); - aMessage.Complete( EContentHarvesterStopComplete ); - iContentHarvesterServer->Stop( ); - break; - default: - iContentHarvesterServer->PanicClient( aMessage, - EContentHarvesterBadRequest ); - break; - } - } - -// ----------------------------------------------------------------------------- -// CContentHarvesterSession::CContentHarvesterSession -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CContentHarvesterSession::CContentHarvesterSession( - CContentHarvesterServer* aServer ) : - CSession2() - { - iContentHarvesterServer = aServer; - } - -// ----------------------------------------------------------------------------- -// CContentHarvesterSession::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CContentHarvesterSession::ConstructL() - { - CP_DEBUG(_L8("CContentHarvesterSession::ConstructL")); - } - -// End of File diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentharvester/contentharvesterswiplugin/data/chswiplugin.rss --- a/contentpublishingsrv/contentharvester/contentharvesterswiplugin/data/chswiplugin.rss Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* -* 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 -#include - - -// RESOURCE DEFINITIONS -// ----------------------------------------------------------------------------- -// -// REGISTRY_INFO theInfo -// Declares info for the "all" implementation -// -// ----------------------------------------------------------------------------- -// -RESOURCE REGISTRY_INFO theInfo - { - // UID for the DLL - dll_uid = KCHSwiPluginUidDll; - // Declare array of interface info - interfaces = - { - INTERFACE_INFO - { - // UID of interface that is implemented - interface_uid = KContentHarvesterPluginUid; - implementations = - { - // Info for CCHSwiPlugin - IMPLEMENTATION_INFO - { - implementation_uid = KCHSwiPluginUidImpl; - version_no = 1; - display_name = "chswiplugin"; - default_data = "chswiplugin"; - opaque_data = "chswiplugin"; - } - }; - } - }; - } - -// End of File diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentharvester/contentharvesterswiplugin/group/bld.inf --- a/contentpublishingsrv/contentharvester/contentharvesterswiplugin/group/bld.inf Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* -* 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: - * -*/ - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS - - -PRJ_MMPFILES -chswiplugin.mmp - - -// End of File - diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentharvester/contentharvesterswiplugin/group/chswiplugin.mmp --- a/contentpublishingsrv/contentharvester/contentharvesterswiplugin/group/chswiplugin.mmp Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* -* 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: - * -*/ - -// To get the MW_LAYER_SYSTEMINCLUDE-definition -#include - -TARGET chswiplugin.dll -TARGETTYPE PLUGIN -UID 0x10009D8D 0x20022E84 -CAPABILITY CAP_ECOM_PLUGIN - -LANG SC - -VENDORID VID_DEFAULT - -SOURCEPATH ../src -SOURCE chswiplugin.cpp - -SOURCEPATH ../data -START RESOURCE chswiplugin.rss -HEADER -TARGET chswiplugin.rsc -TARGETPATH resource/plugins -END - -USERINCLUDE ../inc -USERINCLUDE ../../../contentpublishingserver/cpserver/inc - -MW_LAYER_SYSTEMINCLUDE - - -LIBRARY ecom.lib -LIBRARY euser.lib - -LIBRARY apgrfx.lib -LIBRARY apparc.lib - -LIBRARY liwservicehandler.lib //AIW Framework - -//end of file diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentharvester/contentharvesterswiplugin/inc/chswiplugin.h --- a/contentpublishingsrv/contentharvester/contentharvesterswiplugin/inc/chswiplugin.h Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +0,0 @@ -/* -* 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 C_CCHSWIPLUGIN_H -#define C_CCHSWIPLUGIN_H - -#include -#include - -class MLiwInterface; -class CLiwGenericParamList; - -/** - * Active Data plugin for SIS installation events. - * - * @since S60 S60 v3.1 - */ -class CCHSwiPlugin: public CContentHarvesterPlugin, - MApaAppListServObserver - { - -public: - /** - * Two-phased constructor. - * @param aInterface liw interface - */ - static CCHSwiPlugin* NewL( MLiwInterface* aInterface ); - - /** - * Destructor. - */ - virtual ~CCHSwiPlugin(); - - /** - * From CContentHarvesterPlugin. - * This function updates all data entries which could change when an applicaion is installed - * or when the MMC is removed/inserted. - */ - void UpdateL(); - -private: - // from MApaAppListServObserver - - void HandleAppListEvent( TInt aEvent ); - /** - * Performs the second phase construction of a CADatSwi object. - */ - void ConstructL(); - - /** - * Default Constructor. - * @param aActiveSpace An instance of the Active Space Client. - */ - CCHSwiPlugin( MLiwInterface* aInterface ); - - - /** - * This function removes publishers from database when - * an applicaion is uninstalled or when the MMC is removed. - */ - void UpdateWidgetsL(); - - - void RemoveWidgetsL( CLiwGenericParamList* aWidgets ); - - void RemoveWidgetL( const TDesC& aType, - const TDesC& aContentId ); - - -private: - - /** - * An interface to Content Publisher Service - */ - MLiwInterface* iCPSInterface; - - - /** - * AppArc session. - * Own. - */ - RApaLsSession iApaLsSession; - - CApaAppListNotifier* iNotifier; ///< Change notifier. Own. - - }; - -#endif // C_CCHSWIPLUGIN_H - diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentharvester/contentharvesterswiplugin/src/chswiplugin.cpp --- a/contentpublishingsrv/contentharvester/contentharvesterswiplugin/src/chswiplugin.cpp Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,214 +0,0 @@ -/* -* 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 "chswiplugin.h" - -#include - -#include -#include -#include -#include "cpglobals.h" - -_LIT( KHsWidgetPublisher, "hswidgetpublisher"); -_LIT( KHsPublisher, "ai3templatedwidget" ); -_LIT8( KWidgetUid, "widget_uid"); - -// Map the interface UIDs to implementation factory functions -// ============================= LOCAL FUNCTIONS =============================== - -// Map the interface UIDs to implementation factory functions -const TImplementationProxy ImplementationTable[] = - { - {{KCHSwiPluginUidImpl}, (TProxyNewLPtr)CCHSwiPlugin::NewL}, - }; - -// ---------------------------------------------------------------------------- -// Exported proxy for instantiation method resolution -// ---------------------------------------------------------------------------- -// -EXPORT_C const TImplementationProxy* ImplementationGroupProxy( - TInt& aTableCount ) - { - aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); - return ImplementationTable; - } - -// ============================ MEMBER FUNCTIONS ============================== - -// ---------------------------------------------------------------------------- -// CCHSwiPlugin::CCHSwiPlugin -// Constructor -// ---------------------------------------------------------------------------- -// -CCHSwiPlugin::CCHSwiPlugin( MLiwInterface* aInterface ) - { - iCPSInterface = aInterface; - } - -// ---------------------------------------------------------------------------- -// CADatSwi::ConstructL -// Symbian 2nd phase constructor can leave. -// ---------------------------------------------------------------------------- -// -void CCHSwiPlugin::ConstructL() - { - iNotifier = CApaAppListNotifier::NewL( this, CActive::EPriorityStandard ); - User::LeaveIfError( iApaLsSession.Connect() ); - } - -// ---------------------------------------------------------------------------- -// CADatSwi::NewL -// Two-phased constructor. -// ---------------------------------------------------------------------------- -// -CCHSwiPlugin* CCHSwiPlugin::NewL( MLiwInterface* aInterface) - { - CCHSwiPlugin* self = new (ELeave) CCHSwiPlugin( aInterface ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// ---------------------------------------------------------------------------- -// CCHSwiPlugin::~CCHSwiPlugin -// Destructor. -// ---------------------------------------------------------------------------- -// -CCHSwiPlugin::~CCHSwiPlugin() - { - iApaLsSession.Close(); - delete iNotifier; - } - -// ---------------------------------------------------------------------------- -// CCHSwiPlugin::UpdateL -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void CCHSwiPlugin::UpdateL() - { - UpdateWidgetsL(); - } - -// ---------------------------------------------------------------------------- -// CCHSwiPlugin::HandleAppListEvent -// (other items were commented in a header). -// ---------------------------------------------------------------------------- -// -void CCHSwiPlugin::HandleAppListEvent( TInt /*aEvent*/ ) - { - TRAP_IGNORE( UpdateWidgetsL() ); - } - -// ---------------------------------------------------------------------------- -// CCHSwiPlugin::UpdateWidgetsL -// MMC watcher callback. -// ---------------------------------------------------------------------------- -// -void CCHSwiPlugin::UpdateWidgetsL() - { - CLiwGenericParamList* inparam = CLiwGenericParamList::NewLC( ); - CLiwGenericParamList* outparam = CLiwGenericParamList::NewLC( ); - inparam->AppendL( TLiwGenericParam( KType, TLiwVariant( KPublisher ) ) ); - CLiwDefaultMap* filter = CLiwDefaultMap::NewLC(); - - filter->InsertL( KPublisherId, TLiwVariant( KHsWidgetPublisher )); - filter->InsertL( KContentType, TLiwVariant( KHsPublisher )); - inparam->AppendL( TLiwGenericParam( KFilter, TLiwVariant( filter ) ) ); - - iCPSInterface->ExecuteCmdL( KGetList, *inparam, *outparam ); - - RemoveWidgetsL( outparam ); - - CleanupStack::PopAndDestroy( filter ); - CleanupStack::PopAndDestroy( outparam ); - CleanupStack::PopAndDestroy( inparam ); - } - -// ---------------------------------------------------------------------------- -// CCHSwiPlugin::RemoveWidgetsL -// MMC watcher callback. -// ---------------------------------------------------------------------------- -// -void CCHSwiPlugin::RemoveWidgetsL( CLiwGenericParamList* aWidgets ) - { - TInt pos ( 0 ); - aWidgets->FindFirst( pos, KResults ); - if( pos != KErrNotFound ) - { - TLiwVariant variant = (*aWidgets)[pos].Value(); - variant.PushL(); - CLiwIterable* iterable = variant.AsIterable(); - iterable->Reset(); - if( iterable->NextL( variant ) ) - { - CLiwDefaultMap *map = CLiwDefaultMap::NewLC(); - variant.Get( *map ); - if ( map->FindL( KDataMap, variant) ) - { - CLiwDefaultMap *dataMap = CLiwDefaultMap::NewLC(); - variant.Get( *dataMap ); - if ( dataMap->FindL( KWidgetUid, variant ) ) - { - TApaAppInfo appInfo; - - if( KErrNotFound == iApaLsSession.GetAppInfo( - appInfo, TUid::Uid( variant.AsTInt32() ) ) ) - { - if( map->FindL( KContentId, variant ) ) - { - RemoveWidgetL( KPublisher, variant.AsDes() ); - RemoveWidgetL( KCpData, variant.AsDes() ); - } - } - } - CleanupStack::PopAndDestroy( dataMap ); - } - CleanupStack::PopAndDestroy( map ); - } - CleanupStack::PopAndDestroy(&variant); - } - } - -// ---------------------------------------------------------------------------- -// CCHSwiPlugin::RemoveWidgetL -// MMC watcher callback. -// ---------------------------------------------------------------------------- -// -void CCHSwiPlugin::RemoveWidgetL( const TDesC& aType, - const TDesC& aContentId ) - { - CLiwGenericParamList* inparam = CLiwGenericParamList::NewLC( ); - CLiwGenericParamList* outparam = CLiwGenericParamList::NewLC( ); - inparam->AppendL( TLiwGenericParam( KType, TLiwVariant( aType ) ) ); - CLiwDefaultMap* filter = CLiwDefaultMap::NewLC(); - - filter->InsertL( KPublisherId, TLiwVariant( KHsWidgetPublisher )); - filter->InsertL( KContentType, TLiwVariant( KHsPublisher )); - filter->InsertL( KContentId, TLiwVariant( aContentId )); - inparam->AppendL( TLiwGenericParam( KFilter, TLiwVariant( filter ) ) ); - - iCPSInterface->ExecuteCmdL( KDelete, *inparam, *outparam ); - - CleanupStack::PopAndDestroy( filter ); - CleanupStack::PopAndDestroy( outparam ); - CleanupStack::PopAndDestroy( inparam ); - } - -// End of File diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentharvester/factorysettingsplugin/data/chfactorysettingsplugin.rss --- a/contentpublishingsrv/contentharvester/factorysettingsplugin/data/chfactorysettingsplugin.rss Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -/* -* 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 registration for Factory Settings EC harvesting plugin -* -*/ - - -// INCLUDES -#include -#include - -// RESOURCE DEFINITIONS -// ----------------------------------------------------------------------------- -// -// REGISTRY_INFO theInfo -// Declares info for the "all" implementation -// -// ----------------------------------------------------------------------------- -// -RESOURCE REGISTRY_INFO theInfo - { - // UID for the DLL - dll_uid = 0x10282E6C; - // Declare array of interface info - interfaces = - { - INTERFACE_INFO - { - // UID of interface that is implemented - interface_uid = KContentHarvesterPluginUid; - implementations = - { - // Info for CADatFactorySettings - IMPLEMENTATION_INFO - { - implementation_uid = 0x102830EF; - version_no = 1; - display_name = "factorysettings"; - default_data = "factorysettings"; - opaque_data = "factorysettings"; - } - }; - } - }; - } - -// End of File diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentharvester/factorysettingsplugin/group/bld.inf --- a/contentpublishingsrv/contentharvester/factorysettingsplugin/group/bld.inf Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -/* -* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Content Publisher Plugin -* -*/ - - -PRJ_EXPORTS - -//XMLs used by this DLL are in main rom dir and are exported by main bld.inf -PRJ_MMPFILES -chfactorysettingsplugin.mmp - - -// End of File \ No newline at end of file diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentharvester/factorysettingsplugin/group/chfactorysettingsplugin.mmp --- a/contentpublishingsrv/contentharvester/factorysettingsplugin/group/chfactorysettingsplugin.mmp Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +0,0 @@ -/* -* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Active Space Facory Settings -* -*/ - -// To get the MW_LAYER_SYSTEMINCLUDE-definition -#include - -TARGET chfactorysettingsplugin.dll -TARGETTYPE PLUGIN -UID 0x10009D8D 0x10282E6C -CAPABILITY CAP_ECOM_PLUGIN - -LANG SC - -VENDORID VID_DEFAULT -SOURCEPATH ../data -START RESOURCE chfactorysettingsplugin.rss -HEADER -TARGET chfactorysettingsplugin.rsc -TARGETPATH resource/plugins -END - -SOURCEPATH ../src -SOURCE chfactorysettingsplugin.cpp -SOURCE chfactorysettingsinstallnotifier.cpp -SOURCE chfactsetutils.cpp -SOURCE chdbstatehandler.cpp -SOURCE chfactorysettingsdomparser.cpp - -USERINCLUDE ../inc -USERINCLUDE ../../../contentpublishingutils/contentpublishingdebug/inc -USERINCLUDE ../../../contentpublishingserver/cpserver/inc - -MW_LAYER_SYSTEMINCLUDE - - -LIBRARY euser.lib -LIBRARY estor.lib -LIBRARY efsrv.lib -LIBRARY bafl.lib -LIBRARY ecom.lib -LIBRARY xmlengineDOM.lib -//AIW Plugin -LIBRARY liwservicehandler.lib //AIW Framework -#ifdef CONTENT_PUBLISHER_DEBUG -LIBRARY cpdebug.lib -#endif -LIBRARY centralrepository.lib -LIBRARY charconv.lib - -DEBUGLIBRARY flogger.lib - -// End of file - diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentharvester/factorysettingsplugin/inc/chdbstatehandler.h --- a/contentpublishingsrv/contentharvester/factorysettingsplugin/inc/chdbstatehandler.h Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,128 +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: Central Repository about DB state change information observer - * -*/ - - -#ifndef C_CHDBSTATEHANDLER_H -#define C_CHDBSTATEHANDLER_H - -#include // For CActive, link against: euser.lib -#include - - -class CRepository; -class CCHFactorySettings; - -class CCHDbStateHandler : - public CActive - { -public: - /* - * Destructor. - */ - ~CCHDbStateHandler(); - - /** - * Two-phased constructor. - */ - static CCHDbStateHandler* NewL( CCHFactorySettings* aCallback ); - -private: - /** - * Simply constructor. - */ - CCHDbStateHandler( CCHFactorySettings* aCallback ); - - /** - * 2nd phase constructor. - */ - void ConstructL(); - -private: - /** - * From CActive. - * Invoke when asynchronous request will be completed. - * - * @since S60 S60 v3.1 - */ - void RunL(); - - /** - * From CActive. - * Invoke for canceling asynchronous request. - * - * @since S60 S60 v3.1 - */ - void DoCancel(); - - /** - * Override to handle leaves from RunL(). Default implementation causes - * the active scheduler to panic. - * - * @since S60 S60 v3.1 - */ - TInt RunError(TInt aError); - -private: - /** - */ - void ConstructFactorySettingsPathL(); - - /** - * Removes parsed Factory Settings files - */ - void RemoveFactorySettingsParsedFilesL(); - - /** - * Handle repository db state. - * If KSQLDBStateRestored state match then calls HandleRestoredDbStateL - * remove repository db state KSQLDBStateRestored, add KSQLDBStateNormal. - */ - void HandleDbStateL(); - - /** - * Handle restored db state. - * Calls RemoveFactorySettingsParsedFilesL and call UpdateL on iCallback - * member. - */ - void HandleRestoredDbStateL(); - -private: - - /** - * Pointer to repository. - * Own. - */ - CRepository* iRepository; - - /** - * Interface for notifying need of update after DB restore. - * Not own. - */ - CCHFactorySettings* iCallback; - - /** - * File server session. - */ - RFs iFs; - - /** - * Path of parsed Factory Settings - */ - TFileName iFSPath; - }; - -#endif // C_CHDBSTATEHANDLER_H diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentharvester/factorysettingsplugin/inc/chfactorysettingsdomparser.h --- a/contentpublishingsrv/contentharvester/factorysettingsplugin/inc/chfactorysettingsdomparser.h Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,175 +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: factory settings functionality for content harvester -* -*/ - -#ifndef CHFACTORYSETTINGSDOMPARSER_H_ -#define CHFACTORYSETTINGSDOMPARSER_H_ - -// INCLUDES -#include - -#include -#include -#include -#include - -class MLiwInterface; -class CLiwDefaultMap; -class CLiwContainer; -class CLiwDefaultList; - -class CCHFactorySettingsDOMParser : public CBase - { - enum TTypes - { - EUndefined, - EInteger, - EUInteger, - EDescriptor8, - EDescriptor16, - EMap, - EList, - EBool, - EReal, - EUid - }; - -public: - // Constructors and destructor - - /** - * Two-phased constructor. - * @param aInterface Liw Interface. - * @param aFs file session. - */ - static CCHFactorySettingsDOMParser* NewL( MLiwInterface* aInterface, - RFs& aFs ); - - /** - * Two-phased constructor. - * @param aInterface Liw Interface. - * @param aFs file session. - */ - static CCHFactorySettingsDOMParser* NewLC( MLiwInterface* aInterface, - RFs& aFs ); - - /** - * Destructor. - */ - virtual ~CCHFactorySettingsDOMParser(); - -public: // new functions - - /** - * Restores all factory settings - * - * @param aStr Path to file. - * @param aUnInstall mark indicating add or remove option. - */ - TInt Restore( const TDesC& aStr, TBool aUnInstall=EFalse ); - -private: - - /** - * C++ default constructor. - * @param aFs file session. - */ - CCHFactorySettingsDOMParser( RFs& aFs ); - - /** - * By default Symbian 2nd phase constructor is private. - * @param aInterface Liw Interface. - */ - void ConstructL( MLiwInterface* aInterface ); - -private: // new functions - - /** - * Parse xml files. - * @param aFilePath Path to file. - * @param aUnInstall mark indicating add or remove option. - */ - void ParseFactorySettingsFileL( const TDesC& aFilePath, - TBool aUnInstall ); - - /** - * Converts type from TDesC to TTypes. - * @param aType type key as attributes. - */ - TTypes ConvertToType( const TDesC& aType ); - - /** - * Removes an item from the database. - * @param aNode A node. - * @param aMap CLiwDefaultMap with item. - */ - void RemoveItemL( - const TXmlEngElement& aNode, - CLiwDefaultMap* aMap ); - /** - * Adds an item do the database. - * @param aNode An "item" node. - * @param aContainer container with item. - * @param aType type of item. - */ - void AddItemL( const TXmlEngElement& aNode, - CLiwContainer* aContainer, - TTypes aType ); - - /** - * Extracts deleted attributes from "item" node. - * @param aNode An "item" node. - * @param aMap CLiwDefaultMap with item. - */ - void ExtractDeleteAttributesL( - const TXmlEngElement& aNode, - CLiwDefaultMap* aMap ); - - /** - * Extracts and adds attributes from "item" node to map. - * @param aNode An "item" node. - * @param aMap CLiwDefaultMap with item. - */ - void ExtractAttributesAndAddL( - const TXmlEngElement& aNode, - CLiwDefaultMap* aMap ); - - /** - * Extracts and adds attributes from "item" node to list. - * @param aItem An "item" node. - * @param aList CLiwDefaultList with item. - */ - void ExtractAttributesAndAddL( - const TXmlEngElement& aNode, - CLiwDefaultList* aList ); - -private: - // Data - - /** - * CPS interface - * Not own - */ - MLiwInterface* iCPSInterface; - - /* - * File server session.Not Own - */ - RFs iFs; - - }; - -#endif /* CHFACTORYSETTINGSDOMPARSER_H_ */ diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentharvester/factorysettingsplugin/inc/chfactorysettingsglobals.h --- a/contentpublishingsrv/contentharvester/factorysettingsplugin/inc/chfactorysettingsglobals.h Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +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 T_CHFACTORYSETTINGSGLOBALS_H -#define T_CHFACTORYSETTINGSGLOBALS_H - -// -const TInt KRootItemId( -1 ); -const TInt KMaxIntString( 10 ); - -_LIT8( KNullDes8, "" ); - -// CONSTANTS -_LIT( KMainDataItem, "cps:data" ); -_LIT( KMainPublisherItem, "cps:publisher" ); -_LIT( KDataItem, "cps:data_item" ); -_LIT8( KDataItem8, "data_item" ); -_LIT( KNoArgumentsString, "-1" ); -_LIT( KAttributeKey, "key" ); -_LIT8( KAttributeKey8, "key" ); -_LIT( KAttributeType, "type" ); -_LIT8( KAttributeType8, "type" ); -_LIT( KAttributeValue, "value" ); -_LIT8( KAttributeValue8, "value" ); -_LIT( KTrue, "true" ); -_LIT( KFalse, "false" ); - -//Supported Types -_LIT( KInteger, "integer" ); -_LIT( KUInteger, "uinteger" ); -_LIT( KDescriptor8, "string8" ); -_LIT( KDescriptor16, "string" ); -_LIT( KMap, "map" ); -_LIT( KList, "list" ); -_LIT( KBool, "bool" ); -_LIT( KReal, "float" ); -_LIT( KUid, "uid" ); - -#endif // T_CHFACTORYSETTINGSGLOBALS_H -// End of file diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentharvester/factorysettingsplugin/inc/chfactorysettingsinstallnotifier.h --- a/contentpublishingsrv/contentharvester/factorysettingsplugin/inc/chfactorysettingsinstallnotifier.h Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,129 +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: Sis package installation event listener - * -*/ - - -#ifndef C_CCHFACTORYSETTINGSINSTALLNOTIFIER_H -#define C_CCHFACTORYSETTINGSINSTALLNOTIFIER_H - -#include -#include - -class CCHFactorySettings; - -/** - * Central Repository notifier. - * - * @since S60 S60 v3.1 - */ -class CCHFactorySettingsInstallNotifier : public CActive - { - /** - * Enum defining the purpouse of the installation event. - */ - enum TInstOp - { - EInstOpNone = 0x00000000, - EInstOpInstall = 0x00000001, - EInstOpUninstall = 0x00000002, - EInstOpRestore = 0x00000004 - }; - - /** - * Enum defining the exit status of the installation event. - */ - enum TInstOpStatus - { - EInstOpStatusNone = 0x00000000, - EInstOpStatusSuccess = 0x00000100, - EInstOpStatusAborted = 0x00000200 - }; - -public: - - /** - * Creates an instance of CCHFactorySettingsInstallNotifier implementation. - * @param aCallBack Reference to notifier interface. - * @param aCategory Package uid. - * @param aKey Key for central repository. - */ - static CCHFactorySettingsInstallNotifier* NewL( - CCHFactorySettings* aCallback, TUid aCategory, TUint aKey ); - - /** - * Destructor. - */ - virtual ~CCHFactorySettingsInstallNotifier(); - -private: - /** - * Constructor. - * @param aCallBack Reference to notifier interface. - * @param aCategory Package uid. - * @param aKey Key for central repository. - */ - CCHFactorySettingsInstallNotifier( CCHFactorySettings* aCallback, - TUid aCategory, TUint aKey ); - - /** - * Symbian 2nd phase constructor. - */ - void ConstructL(); - - /** - * From CActive. - */ - void DoCancel(); - - /** - * From CActive. - */ - void RunL(); - - /** - * From CActive. - */ - TInt RunError( TInt aError ); - -private: - /** - * User side interface to Publish & Subscribe. - * Own. - */ - RProperty iProperty; - - /** - * Interface for notifying changes in SWI. - * Not own. - */ - CCHFactorySettings* iCallback; - - /** - * Category uid. - * Own. - */ - TUid iCategory; - - /** - * Key identifier. - * Own. - */ - TUint iKey; - - }; - -#endif // C_CCHFACTORYSETTINGSINSTALLNOTIFIER_H -// End of File diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentharvester/factorysettingsplugin/inc/chfactorysettingsplugin.h --- a/contentpublishingsrv/contentharvester/factorysettingsplugin/inc/chfactorysettingsplugin.h Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,126 +0,0 @@ -/* -* 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_CCHFACTORYSETTINGS_H -#define C_CCHFACTORYSETTINGS_H - -#include -#include -#include - -class MLiwInterface; -class CCHFactorySettingsInstallNotifier; -class CFileMan; -class CCHDbStateHandler; -class CCHFactorySettingsDOMParser; // mw - -class CCHFactorySettings : public CContentHarvesterPlugin - - { -public: - // Constructors and destructor - - /** - * Two-phased constructor. - * @param aStorage instance of AS storage DB - */ - static CCHFactorySettings* NewL( MLiwInterface* aInterface ); - static CCHFactorySettings* NewLC( MLiwInterface* aInterface ); - /** - * C++ destructor - */ - ~CCHFactorySettings(); -private: - - /** - * C++ default constructor. - */ - CCHFactorySettings(); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL( MLiwInterface* aInterface ); - /** - * CreateStorageL. - */ - void CreateStorageL(); - /** - * AddNewL. - */ - void AddNewL(); - /** - * UnInstallL. - */ - void UnInstallL(); - /** - * CheckDrivesL. - */ - void CheckDrivesL(); - -public: - // from CADatServerPlugin - /** - * This function updates all information in CPS related to FactorySettings - */ - void UpdateL(); - -private: - /** - * Data base state handler - */ - CCHDbStateHandler* iDBStateHandler; - - /** - * Sis installation notifier - */ - CCHFactorySettingsInstallNotifier* iInstallNotifier; - - /** - *List containing xml files that should be installed from all drives - */ - CDesCArrayFlat* iFileNewList; - - /** - * File server session - */ - RFs iFs; - - /** - * File manager used for files copying - */ - CFileMan* iFileMan; - - /** - * An interface to Content Publisher Service - */ - MLiwInterface* iCPSInterface; - - /** - * Pointer to a parser object - */ - CCHFactorySettingsDOMParser* iParser; // - - /** - * Descriptor containing a path to a directory with files to parse - */ - RBuf iFilePath; - - }; - -#endif // C_CCHFACTORYSETTINGS_H diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentharvester/factorysettingsplugin/inc/chfactsetutils.h --- a/contentpublishingsrv/contentharvester/factorysettingsplugin/inc/chfactsetutils.h Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,147 +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: Utils methods. - * -*/ - - -#ifndef FACTSETCHUTILS_H -#define FACTSETCHUTILS_H - -// INCLUDES -#include - -// CLASS DECLARATION -class CGECODefaultObject; -class MXCFWNode; - -/** - * Common utils methods. - * - * @lib aspafactorysettings.lib - * @since Series 60 3.1 - */ -class FactSetCHUtils - { -public: - // New functions - - /** - * Extracts a TUint from the given string. - * @since Series 60 3.1 - * @param aStr A string defining the uint. - * @return TUint Object. - */ - static TUint Str2Uint( const TDesC& aStr ); - - /** - * Extracts a TInt from the given string. - * @since Series 60 3.1 - * @param aStr A string defining the int. - * @return TInt Object. - */ - static TInt Str2Int( const TDesC& aStr ); - - /** - * Extracts a TBool from the given string. - * @since Series 60 3.1 - * @param aStr A string defining the bool. - * @return TBool Object. - */ - static TBool Str2Bool( const TDesC& aStr ); - - /** - * Extracts a TUid from the given string. - * @since Series 60 3.1 - * @param aStr A string defining the uid. - * @return Uid Object. - */ - static TUid Str2Uid( const TDesC& aStr ); - - /** - * Creates HBufC8* from the given string. - * @since Series 60 3.1 - * @param aStr A string to convert to HBufC8*. - * @return HBufC8* Pointer. - */ - static HBufC8* Str2Str8LC( const TDesC& aStr ); - - /** - * Extracts a TReal from the given string. - * @since Series 60 3.1 - * @param aStr A string defining the real value. - * @return Real Object. - */ - static TReal Str2Real( const TDesC& aStr ); - - /** - * Extracts a TInt from the given string. - * @since Series 60 3.1 - * @param aStr A string defining the real value. - * @return Real Object. - */ - static TInt32 Str2Int32( const TDesC& aStr ); - -private: - - /** - * Extracts an integer from the given hex string. - * @since Series 60 3.1 - * @param aStr A hex string containg an integer number. - * @return Integer value of the number. - */ - static TUint StrHex2Uint( const TDesC& aStr ); - - /** - * Extracts an integer from the given string. - * @since Series 60 3.1 - * @param aStr A string containg an integer number. - * @return Integer value of the number. - */ - static TUint StrDec2Uint( const TDesC& aStr ); - - /** - * Handles bad argument passed into utility function - * @since Series 60 3.1 - * @param aCategory describes bad argument - * @param aArgument bad argument - * @param aReason bad argument code - */ - static void BadArgument( const TDesC& aCategory, const TDesC& aArgument, - TInt aReason ); - static void BadArgumentL( const TDesC& aCategory, const TDesC& aArgument, - TInt aReason ); - - /** - * Handles bad argument passed into utility function - * @since Series 60 3.1 - * @param aCategory describes bad argument - * @param aArgument bad argument - * @param aReason bad argument code - */ - static void BadArgument( const TDesC& aCategory, TInt aArgument, - TInt aReason ); - - /** - * Handles bad argument passed into utility function - * @since Series 60 3.1 - * @param aCategory describes bad argument - * @param aReason bad argument code - */ - static void BadArgument( const TDesC& aCategory, TInt aReason ); - - }; - -#endif // FACTSETCHUTILS_H -// End of File diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentharvester/factorysettingsplugin/src/chdbstatehandler.cpp --- a/contentpublishingsrv/contentharvester/factorysettingsplugin/src/chdbstatehandler.cpp Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,182 +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: Central Repository about DB state change information observer - * -*/ - -#include -#include -#include "cpserverdef.h" -#include "chdbstatehandler.h" -#include "chfactorysettingsplugin.h" - - -_LIT( KParsedDir, "parsed\\fs\\" ); -_LIT( KDriveC, "C:" ); - - -// ============================ MEMBER FUNCTIONS ============================= - -// ----------------------------------------------------------------------------- -// CCHDbStateHandler::CCHDbStateHandler() -// -// ----------------------------------------------------------------------------- -// -CCHDbStateHandler::CCHDbStateHandler( CCHFactorySettings* aCallback ) : - CActive( EPriorityStandard ), // Standard priority - iCallback( aCallback ) - { - } - -// ----------------------------------------------------------------------------- -// CCHDbStateHandler::NewL() -// Two-phased constructor -// ----------------------------------------------------------------------------- -// -CCHDbStateHandler* CCHDbStateHandler::NewL( - CCHFactorySettings* aCallback ) - { - CCHDbStateHandler* self = new (ELeave) CCHDbStateHandler( aCallback ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// ----------------------------------------------------------------------------- -// CCHDbStateHandler::NewL() -// Constructor -// ----------------------------------------------------------------------------- -// -void CCHDbStateHandler::ConstructL() - { - User::LeaveIfError( iFs.Connect() ); - ConstructFactorySettingsPathL(); - iRepository = CRepository::NewL( KServerUid ); - HandleDbStateL(); - CActiveScheduler::Add(this); // Add to scheduler - iRepository->NotifyRequest( KCPStorageUid, iStatus ); - iStatus = KRequestPending; - SetActive(); - } - -// ----------------------------------------------------------------------------- -// CCHDbStateHandler::NewL() -// -// ----------------------------------------------------------------------------- -// -CCHDbStateHandler::~CCHDbStateHandler() - { - Cancel(); // Cancel any request, if outstanding - delete iRepository; - iFs.Close(); - } - -// ----------------------------------------------------------------------------- -// CCHDbStateHandler::NewL() -// -// ----------------------------------------------------------------------------- -// -void CCHDbStateHandler::DoCancel() - { - iRepository->NotifyCancel( KCPStorageUid ); - } - -// ----------------------------------------------------------------------------- -// CCHDbStateHandler::RunL() -// -// ----------------------------------------------------------------------------- -// -void CCHDbStateHandler::RunL() - { - // status contais information about event type - if (iStatus.Int() >= KErrNone) - { - HandleDbStateL(); - iRepository->NotifyRequest( KCPStorageUid, iStatus ); - iStatus = KRequestPending; - SetActive(); - } - } - -// ----------------------------------------------------------------------------- -// CCHDbStateHandler::RunError() -// -// ----------------------------------------------------------------------------- -// -TInt CCHDbStateHandler::RunError(TInt aError) - { - return aError; - } - -// ----------------------------------------------------------------------------- -// CCHDbStateHandler::ConstructFactorySettingsPathL() -// -// ----------------------------------------------------------------------------- -// -void CCHDbStateHandler::ConstructFactorySettingsPathL() - { - TFileName privatePath; - User::LeaveIfError( iFs.PrivatePath( privatePath ) ); - iFSPath.Append( KDriveC ); - iFSPath.Append( privatePath ); - iFSPath.Append( KParsedDir ); - } - -// ----------------------------------------------------------------------------- -// CCHDbStateHandler::RemoveFactorySettingsParsedFilesL() -// -// ----------------------------------------------------------------------------- -// -void CCHDbStateHandler::RemoveFactorySettingsParsedFilesL() - { - CFileMan* fileManager = CFileMan::NewL( iFs ); - CleanupStack::PushL( fileManager ); - fileManager->Delete( iFSPath, CFileMan::ERecurse ); - CleanupStack::PopAndDestroy( fileManager ); - } - -// ----------------------------------------------------------------------------- -// CCHDbStateHandler::HandleDbStateL() -// -// ----------------------------------------------------------------------------- -// -void CCHDbStateHandler::HandleDbStateL() - { - TInt value( 0 ); - if( iRepository->Get( KCPStorageUid, value ) == KErrNone ) - { - if( value & KSQLDBStateRestored ) - { - HandleRestoredDbStateL(); - value ^= KSQLDBStateRestored; - value |= KSQLDBStateNormal; - iRepository->Set( KCPStorageUid, value ); - } - } - } - -// ----------------------------------------------------------------------------- -// CCHDbStateHandler::HandleRestoredStateL() -// -// ----------------------------------------------------------------------------- -// -void CCHDbStateHandler::HandleRestoredDbStateL() - { - RemoveFactorySettingsParsedFilesL(); - iCallback->UpdateL(); - } - - -//End file diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentharvester/factorysettingsplugin/src/chfactorysettingsdomparser.cpp --- a/contentpublishingsrv/contentharvester/factorysettingsplugin/src/chfactorysettingsdomparser.cpp Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,484 +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: factory settings for content harvester -* -*/ - - -// INCLUDE FILES - -#include -#include -#include -#include -#include -#include -#include "chfactorysettingsdomparser.h" -#include "chfactorysettingsglobals.h" -#include "chfactsetutils.h" -#include "cpdebug.h" - -// CONSTANTS -_LIT8( KMainDataItem8, "data" ); -_LIT8( KMainPublisherItem8, "publisher" ); -_LIT8( KType, "type" ); -_LIT8( KItem, "item" ); -_LIT8( KData, "data" ); -_LIT8( KAdd, "Add" ); -_LIT8( KDelete, "Delete" ); -_LIT8( KCpData, "cp_data" ); -_LIT8( KPublisher, "publisher" ); - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CCHFactorySettingsDOMParser::CCHFactorySettingsDOMParser -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CCHFactorySettingsDOMParser::CCHFactorySettingsDOMParser( RFs& aFs ): - iFs( aFs ) - { - } - -// ----------------------------------------------------------------------------- -// CCHFactorySettingsDOMParser::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CCHFactorySettingsDOMParser::ConstructL( MLiwInterface* aInterface ) - { - iCPSInterface = aInterface; - } - -// ----------------------------------------------------------------------------- -// CCHFactorySettingsDOMParser::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CCHFactorySettingsDOMParser* CCHFactorySettingsDOMParser::NewL( - MLiwInterface* aInterface, RFs& aFs ) - { - CCHFactorySettingsDOMParser* self = NewLC( aInterface, aFs ); - CleanupStack::Pop( self ); - return self; - } - -// ----------------------------------------------------------------------------- -// CCHFactorySettingsDOMParser::NewLC -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CCHFactorySettingsDOMParser* CCHFactorySettingsDOMParser::NewLC( - MLiwInterface* aInterface, RFs& aFs ) - { - CCHFactorySettingsDOMParser* self = new( ELeave ) CCHFactorySettingsDOMParser( aFs ); - CleanupStack::PushL( self ); - self->ConstructL( aInterface ); - return self; - } - -// ----------------------------------------------------------------------------- -// CCHFactorySettingsDOMParser::~CCHFactorySettingsDOMParser -// Destructor -// ----------------------------------------------------------------------------- -// -CCHFactorySettingsDOMParser::~CCHFactorySettingsDOMParser() - { - } - -// ----------------------------------------------------------------------------- -// CCHFactorySettingsDOMParser::Restore -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt CCHFactorySettingsDOMParser::Restore( const TDesC& aStr, TBool aUnInstall ) - { - TRAPD( err, ParseFactorySettingsFileL( aStr, aUnInstall ) ); - return err; - } - -// ----------------------------------------------------------------------------- -// CCHFactorySettingsDOMParser::ParseFactorySettingsFileL -// ----------------------------------------------------------------------------- -// -void CCHFactorySettingsDOMParser::ParseFactorySettingsFileL( - const TDesC& aFilePath, TBool aUnInstall ) - { - RXmlEngDOMImplementation domImpl; - CleanupClosePushL( domImpl ); - domImpl.OpenL(); - - RXmlEngDOMParser parser; - CleanupClosePushL( parser ); - User::LeaveIfError( parser.Open( domImpl ) ); - - RXmlEngDocument doc = parser.ParseFileL( aFilePath ); - CleanupClosePushL( doc ); - - TXmlEngElement docElement = doc.AsElement(); // cast node to element node - - TXmlEngElement element = docElement.FirstChild().AsElement(); - - RXmlEngNodeList elementList; - CleanupClosePushL( elementList ); - - element.GetChildElements( elementList );// to remove - - while( elementList.HasNext() ) - { - element = elementList.Next(); - TPtrC8 typeIdentifier( element.Name() ); - if( !( typeIdentifier.CompareC( KMainDataItem8 ) ) || - !( typeIdentifier.CompareC( KMainPublisherItem8 ) ) ) - { - CLiwGenericParamList* inparam = CLiwGenericParamList::NewLC(); - CLiwGenericParamList* outparam = CLiwGenericParamList::NewLC(); - CLiwDefaultMap* map = CLiwDefaultMap::NewLC(); - - if( !( typeIdentifier.CompareC( KMainDataItem8 ) ) ) - { - TLiwGenericParam item_type( KType, TLiwVariant( KCpData )); - inparam->AppendL( item_type ); - } - else - { - TLiwGenericParam item_type( KType, TLiwVariant( KPublisher )); - inparam->AppendL( item_type ); - } - - if( aUnInstall ) - { - // remove - RemoveItemL(element, map); - TLiwGenericParam item( KData, TLiwVariant( map )); - inparam->AppendL( item ); - iCPSInterface->ExecuteCmdL( KDelete, *inparam, *outparam ); - } - else - { - // add - AddItemL( element, map, EMap ); - TLiwGenericParam item( KItem, TLiwVariant( map )); - inparam->AppendL( item ); - iCPSInterface->ExecuteCmdL( KAdd, *inparam, *outparam ); - } - - CleanupStack::PopAndDestroy( map ); - CleanupStack::PopAndDestroy( outparam ); - CleanupStack::PopAndDestroy( inparam ); - } - } - - CleanupStack::PopAndDestroy( &elementList ); - CleanupStack::PopAndDestroy( &doc ); - CleanupStack::PopAndDestroy( &parser ); - CleanupStack::PopAndDestroy( &domImpl ); - - } - -// ----------------------------------------------------------------------------- -// CCHFactorySettingsDOMParser::AddItemL -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -void CCHFactorySettingsDOMParser::AddItemL( const TXmlEngElement& aNode, - CLiwContainer* aContainer, TTypes aType ) - { - RXmlEngNodeList children; - CleanupClosePushL( children ); - aNode.GetChildElements( children ); - - while( children.HasNext() ) - { - TXmlEngElement node = children.Next(); - TPtrC8 typeIdentifier( node.Name() ); - if( !( typeIdentifier.CompareC( KDataItem8 ) ) ) - { - switch ( aType ) - { - case EMap: - ExtractAttributesAndAddL( node, - static_cast(aContainer) ); - break; - case EList: - ExtractAttributesAndAddL( node, - static_cast( aContainer ) ); - break; - default: - { - User::Panic( _L("Wrong Type" ),1 ); - } - } - } - } - - CleanupStack::PopAndDestroy( &children ); - } - -// ----------------------------------------------------------------------------- -// CCHFactorySettingsDOMParser::RemoveItemL -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -void CCHFactorySettingsDOMParser::RemoveItemL( const TXmlEngElement& aNode, - CLiwDefaultMap* aMap ) - { - CP_DEBUG(_L8("CCHFactorySettingsDOMParser::RemoveItemL" )); - RXmlEngNodeList children; - CleanupClosePushL( children ); - - aNode.GetChildElements( children ); - - while( children.HasNext() ) - { - TXmlEngElement node = children.Next(); - TPtrC8 typeIdentifier( node.Name() ); - if( !( typeIdentifier.CompareC( KDataItem8 ) ) ) - { - ExtractDeleteAttributesL( node, aMap ); - } - } - CleanupStack::PopAndDestroy( &children ); - } - - -// ----------------------------------------------------------------------------- -// CCHFactorySettingsDOMParser::ExtractDeleteAttributesL -// ----------------------------------------------------------------------------- -// -void CCHFactorySettingsDOMParser::ExtractDeleteAttributesL( - const TXmlEngElement& aNode, - CLiwDefaultMap* aMap ) - { - CP_DEBUG(_L8("CCHFactorySettingsDOMParser::ExtractDeleteAttributesL" )); - - TPtrC8 key = aNode.AttributeValueL(KAttributeKey8); - TPtrC8 value = aNode.AttributeValueL(KAttributeValue8); - HBufC* type = CnvUtfConverter::ConvertToUnicodeFromUtf8L( - aNode.AttributeValueL(KAttributeType8)); - CleanupStack::PushL( type ); - - if ( key.Compare( KNullDesC8 ) != 0 - && type->Compare( KNullDesC ) != 0 - && value.Compare( KNullDesC8 ) != 0 ) - { - HBufC* value16 = NULL; - switch ( ConvertToType( *type ) ) - { - case EDescriptor8: - aMap->InsertL( key, value ); - break; - case EDescriptor16: - value16 = CnvUtfConverter::ConvertToUnicodeFromUtf8L( value ); - CleanupStack::PushL( value16 ); - aMap->InsertL( key, *value16 ); - CleanupStack::PopAndDestroy( value16 ); - break; - default: - { - //wrong type - ignore - } - } - } - CleanupStack::PopAndDestroy( type ); - } - -// ----------------------------------------------------------------------------- -// CCHFactorySettingsDOMParser::ExtractAttributesAndAddL -// ----------------------------------------------------------------------------- -// -void CCHFactorySettingsDOMParser::ExtractAttributesAndAddL( - const TXmlEngElement& aNode, CLiwDefaultMap* aMap ) - { - CP_DEBUG(_L8("CCHFactorySettingsDOMParser::ExtractAttributesAndAddL" )); - TPtrC8 key = aNode.AttributeValueL(KAttributeKey8); - HBufC* type = CnvUtfConverter::ConvertToUnicodeFromUtf8L( - aNode.AttributeValueL(KAttributeType8)); - CleanupStack::PushL( type ); - - if ( key.Compare( KNullDesC8 ) != 0 - && type->Compare( KNullDesC ) != 0 ) - { - HBufC* value = CnvUtfConverter::ConvertToUnicodeFromUtf8L( - aNode.AttributeValueL(KAttributeValue8)); - CleanupStack::PushL( value ); - TTypes typeCheck = ConvertToType( *type ); - //check if value exist - //it is not needed in case of Map and List - if ( value->Compare( KNullDesC ) != 0 - || typeCheck == EMap - || typeCheck == EList ) - { - HBufC8* bufV = NULL; - CLiwDefaultMap* nestedMap = NULL; - CLiwDefaultList* nestedList = NULL; - - switch ( typeCheck ) - { - case EInteger: - aMap->InsertL( key, FactSetCHUtils::Str2Int32( *value ) ); - break; - case EUInteger: - aMap->InsertL( key, FactSetCHUtils::Str2Uint( *value ) ); - break; - case EDescriptor8: - bufV = FactSetCHUtils::Str2Str8LC( *value ); - aMap->InsertL( key, *bufV ); - CleanupStack::PopAndDestroy( bufV ); - break; - case EDescriptor16: - aMap->InsertL( key, *value ); - break; - case EMap: - nestedMap = CLiwDefaultMap::NewLC(); - AddItemL( aNode, nestedMap, EMap ); - aMap->InsertL( key, nestedMap ); - CleanupStack::PopAndDestroy( nestedMap ); - break; - case EList: - nestedList = CLiwDefaultList::NewLC(); - AddItemL( aNode, nestedList, EList ); - aMap->InsertL( key, nestedList ); - CleanupStack::PopAndDestroy( nestedList ); - break; - case EBool: - aMap->InsertL( key, FactSetCHUtils::Str2Bool( *value ) ); - break; - case EReal: - aMap->InsertL( key, FactSetCHUtils::Str2Real( *value ) ); - break; - case EUid: - aMap->InsertL( key, FactSetCHUtils::Str2Uid( *value ) ); - break; - default: - { - //wrong type - ignore - } - } - } - CleanupStack::PopAndDestroy( value ); - } - CleanupStack::PopAndDestroy( type ); - } - - -// ----------------------------------------------------------------------------- -// CCHFactorySettingsDOMParser::ExtractAttributesAndAddL -// ----------------------------------------------------------------------------- -// -void CCHFactorySettingsDOMParser::ExtractAttributesAndAddL( - const TXmlEngElement& aNode, CLiwDefaultList* aList ) - { - CP_DEBUG( _L8( "CCHFactorySettingsDOMParser::ExtractAttributesAndAddL" ) ); - - HBufC* type = CnvUtfConverter::ConvertToUnicodeFromUtf8L( - aNode.AttributeValueL(KAttributeType8)); - CleanupStack::PushL( type ); - - if( type->Compare( KNullDesC ) != 0 ) - { - HBufC* value = CnvUtfConverter::ConvertToUnicodeFromUtf8L( - aNode.AttributeValueL(KAttributeValue8)); - CleanupStack::PushL( value ); - TTypes typeCheck = ConvertToType( *type ); - //check if value exist - //it is not needed in case of Map and List - if( value->Compare( KNullDesC ) != 0 - || typeCheck == EMap - || typeCheck == EList ) - { - HBufC8* bufV = NULL; - CLiwDefaultMap* nestedMap = NULL; - CLiwDefaultList* nestedList = NULL; - - switch( typeCheck ) - { - case EInteger: - aList->AppendL( FactSetCHUtils::Str2Int32( *value ) ); - break; - case EUInteger: - aList->AppendL( FactSetCHUtils::Str2Uint( *value ) ); - break; - case EDescriptor8: - bufV = FactSetCHUtils::Str2Str8LC( *value ); - aList->AppendL( *bufV ); - CleanupStack::PopAndDestroy( bufV ); - break; - case EDescriptor16: - aList->AppendL( value ); - break; - case EMap: - nestedMap = CLiwDefaultMap::NewLC(); - AddItemL( aNode, nestedMap, EMap ); - aList->AppendL( nestedMap ); - CleanupStack::PopAndDestroy( nestedMap ); - break; - case EList: - nestedList = CLiwDefaultList::NewLC(); - AddItemL( aNode, nestedList, EList ); - aList->AppendL( nestedList ); - CleanupStack::PopAndDestroy( nestedList ); - break; - case EBool: - aList->AppendL( FactSetCHUtils::Str2Bool( *value ) ); - break; - case EReal: - aList->AppendL( FactSetCHUtils::Str2Real( *value ) ); - break; - case EUid: - aList->AppendL( FactSetCHUtils::Str2Uid( *value ) ); - break; - default: - { - //wrong type - ignore - } - } - } - CleanupStack::PopAndDestroy( value ); - } - CleanupStack::PopAndDestroy( type ); - } - - -// ----------------------------------------------------------------------------- -// CCHFactorySettingsDOMParser::ConvertToType -// ----------------------------------------------------------------------------- -// -CCHFactorySettingsDOMParser::TTypes CCHFactorySettingsDOMParser::ConvertToType( - const TDesC& aType ) - { - CP_DEBUG(_L8("CCHFactorySettingsDOMParser::ConvertToType" )); - if ( !aType.Compare( KInteger ) ) - return EInteger; - if ( !aType.Compare( KUInteger ) ) - return EUInteger; - if ( !aType.Compare( KDescriptor8 ) ) - return EDescriptor8; - if ( !aType.Compare( KDescriptor16 ) ) - return EDescriptor16; - if ( !aType.Compare( KMap ) ) - return EMap; - if ( !aType.Compare( KList ) ) - return EList; - if ( !aType.Compare( KBool ) ) - return EBool; - if ( !aType.Compare( KReal ) ) - return EReal; - if ( !aType.Compare( KUid ) ) - return EUid; - return EUndefined; - } diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentharvester/factorysettingsplugin/src/chfactorysettingsinstallnotifier.cpp --- a/contentpublishingsrv/contentharvester/factorysettingsplugin/src/chfactorysettingsinstallnotifier.cpp Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,124 +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: Sis package installation event listener - * -*/ - - -#include -#include "chfactorysettingsinstallnotifier.h" -#include "chfactorysettingsplugin.h" -#include "cpdebug.h" - -// ============================ MEMBER FUNCTIONS ============================= - -// ----------------------------------------------------------------------------- -// CCHFactorySettingsInstallNotifier::CCHFactorySettingsInstallNotifier -// C++ default constructor -// ----------------------------------------------------------------------------- -// -CCHFactorySettingsInstallNotifier::CCHFactorySettingsInstallNotifier( - CCHFactorySettings* aCallback, TUid aCategory, TUint aKey ) : - CActive(EPriorityNormal) - { - CActiveScheduler::Add( this ); - - iCallback = aCallback; - iCategory = aCategory; - iKey = aKey; - // Prepare automatically - iProperty.Attach( iCategory, iKey ); - SetActive( ); - iProperty.Subscribe( iStatus ); - } - -// ----------------------------------------------------------------------------- -// CCHFactorySettingsInstallNotifier::ConstructL -// S2nd phase constructor. -// ----------------------------------------------------------------------------- -// -void CCHFactorySettingsInstallNotifier::ConstructL() - { - - } - -// --------------------------------------------------------------------------- -// CCHFactorySettingsInstallNotifier::NewL -// --------------------------------------------------------------------------- -// -CCHFactorySettingsInstallNotifier* CCHFactorySettingsInstallNotifier::NewL( - CCHFactorySettings* aCallback, TUid aCategory, TUint aKey ) - { - CCHFactorySettingsInstallNotifier* self = - new (ELeave) CCHFactorySettingsInstallNotifier( aCallback, - aCategory, aKey ); - CleanupStack::PushL( self ); - self->ConstructL( ); - CleanupStack::Pop( self ); - - return self; - } - -// --------------------------------------------------------------------------- -// CCHFactorySettingsInstallNotifier::~CCHFactorySettingsInstallNotifier -// --------------------------------------------------------------------------- -// -CCHFactorySettingsInstallNotifier::~CCHFactorySettingsInstallNotifier() - { - Cancel( ); - iProperty.Close( ); - } - -// --------------------------------------------------------------------------- -// CCHFactorySettingsInstallNotifier::DoCancel -// --------------------------------------------------------------------------- -// -void CCHFactorySettingsInstallNotifier::DoCancel() - { - iProperty.Cancel( ); - } - -// --------------------------------------------------------------------------- -// CCHFactorySettingsInstallNotifier::RunError -// --------------------------------------------------------------------------- -// -TInt CCHFactorySettingsInstallNotifier::RunError( TInt /*aError*/) - { - - // No need to do anything - return KErrNone; - } - -// --------------------------------------------------------------------------- -// CCHFactorySettingsInstallNotifier::RunL -// --------------------------------------------------------------------------- -// -void CCHFactorySettingsInstallNotifier::RunL() - { - CP_DEBUG(_L8("CCHFactorySettingsInstallNotifier::RunL" )); - // Re-issue request before notifying - SetActive( ); - iProperty.Subscribe( iStatus ); - - TInt status; - User::LeaveIfError( iProperty.Get( KUidSystemCategory, - KSAUidSoftwareInstallKeyValue, status ) ); - - if ( (status & EInstOpInstall )||(status & EInstOpUninstall ) ) - { - iCallback->UpdateL( ); - } - - } -// End of File diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentharvester/factorysettingsplugin/src/chfactorysettingsplugin.cpp --- a/contentpublishingsrv/contentharvester/factorysettingsplugin/src/chfactorysettingsplugin.cpp Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,337 +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: - * -*/ - -// INCLUDE FILES - -#include -#include - -#include "chfactorysettingsinstallnotifier.h" -#include "cpdebug.h" -#include "chdbstatehandler.h" -#include "chfactorysettingsdomparser.h" -#include "chfactorysettingsplugin.h" - -// LOCAL CONSTANTS AND MACROS -const TInt KADatFactorySettingsServerPluginUid( 0x102830EF); -// Dynamically loaded data storage handler - -const TInt KDefaultGranularity = 5; - -_LIT( KDirFSNew, "import\\fs\\" ); -_LIT( KParsedDir, "parsed\\fs\\" ); -_LIT( KParsed, "parsed\\" ); -_LIT( KFs, "fs\\" ); - -_LIT( KDriveC, "C:" ); -_LIT( KColen, ":" ); - -// Map the interface UIDs to implementation factory functions -const TImplementationProxy ImplementationTable[] = - { - { - { - KADatFactorySettingsServerPluginUid - }, ( TProxyNewLPtr )CCHFactorySettings::NewL - } - }; - -// ---------------------------------------------------------------------------- -// ImplementationGroupProxy -// Exported proxy for instantiation method resolution -// ---------------------------------------------------------------------------- -// -EXPORT_C const TImplementationProxy* -ImplementationGroupProxy( TInt& aTableCount ) - { - aTableCount = sizeof( ImplementationTable ) / - sizeof( TImplementationProxy ); - return ImplementationTable; - } - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CCHFactorySettings::CCHFactorySettings -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CCHFactorySettings::CCHFactorySettings() - { - - } - -// ----------------------------------------------------------------------------- -// CCHFactorySettings::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CCHFactorySettings::ConstructL( MLiwInterface* aInterface ) - { - CP_DEBUG(_L8("CCHFactorySettings::ConstructL" )); - iCPSInterface = aInterface; - iFileNewList = new (ELeave) CDesCArrayFlat(KDefaultGranularity); - User::LeaveIfError( iFs.Connect( ) ); - iInstallNotifier = CCHFactorySettingsInstallNotifier::NewL( this, - KUidSystemCategory, KSAUidSoftwareInstallKeyValue ); - - iParser = CCHFactorySettingsDOMParser::NewL( iCPSInterface, iFs ); // mw - - iFileMan = CFileMan::NewL( iFs ); - iFilePath.CreateL( KMaxPath ); - - iFs.CreatePrivatePath( EDriveC ); - User::LeaveIfError( iFs.PrivatePath( iFilePath ) ); - - //create "parsed" directory if it doesn't exist yet; - RBuf filePath; - filePath.CreateL( KMaxPath ); - filePath.Append( KDriveC ); - filePath.Append( iFilePath ); - filePath.Append( KParsed ); - iFs.MkDir( filePath ); - filePath.Append( KFs ); - iFs.MkDir( filePath ); - filePath.Close( ); - iDBStateHandler = CCHDbStateHandler::NewL( this ); - } - -// ----------------------------------------------------------------------------- -// CCHFactorySettings::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CCHFactorySettings* CCHFactorySettings::NewL( MLiwInterface* aInterface ) - { - CCHFactorySettings* self = NewLC( aInterface ); - CleanupStack::Pop( self ); - return self; - } - -// ----------------------------------------------------------------------------- -// CCHFactorySettings::NewLC -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CCHFactorySettings* CCHFactorySettings::NewLC( MLiwInterface* aInterface ) - { - CCHFactorySettings* self = new( ELeave ) CCHFactorySettings(); - CleanupStack::PushL( self ); - self->ConstructL( aInterface ); - return self; - } - -// ----------------------------------------------------------------------------- -// Destructor -// ----------------------------------------------------------------------------- -// -CCHFactorySettings::~CCHFactorySettings() - { - delete iFileNewList; - delete iInstallNotifier; - delete iFileMan; - delete iParser; - iFs.Close( ); - iFilePath.Close( ); - delete iDBStateHandler; - } - -// ---------------------------------------------------------------------------- -// CCHFactorySettings::UpdateL -// -// ---------------------------------------------------------------------------- -// -void CCHFactorySettings::UpdateL() - { - CP_DEBUG(_L8("CCHFactorySettings::UpdateL" )); - CheckDrivesL( ); // fill in list with file names from all drives - AddNewL( ); // if any of them isn't added to db then add - UnInstallL( ); // if any of files from any drive was removed remove data - // from DB - - } - -// ---------------------------------------------------------------------------- -// CCHFactorySettings::AddNewL -// Add new entries after sis intallation. -// ---------------------------------------------------------------------------- -// -void CCHFactorySettings::AddNewL() - { - CP_DEBUG(_L8("CCHFactorySettings::AddNewL" )); - CDir* fileListInstalled= NULL; - RBuf filePath; - filePath.CreateL( KMaxPath ); - CleanupClosePushL( filePath ); - filePath.Append( KDriveC ); - filePath.Append( iFilePath ); - filePath.Append( KParsedDir ); - iFs.GetDir( filePath, KEntryAttMaskSupported, ESortByName, - fileListInstalled ); - CleanupStack::PushL( fileListInstalled ); - - for ( TInt i(0); iCount( ); i++ ) - { - TBool parse(ETrue); - TPtrC fileNewName = - (*iFileNewList)[i].Mid( (*iFileNewList)[i].LocateReverse( '\\' ) + 1 ); - TInt count = fileListInstalled->Count( ); - for ( TInt j(0); j< count; j++ ) - { - TPtrC existingFile = (*fileListInstalled)[j].iName; - if ( fileNewName.Compare( existingFile ) ) - { - parse = ETrue; - } - else - { - parse = EFalse; - break; - } - } - if ( parse ) - { - //file wasn't found in afterinstallation dir - //so should be copied and entries install - TBool fileOpened(ETrue); - iFs.IsFileOpen( (*iFileNewList)[i], fileOpened ); - - if ( !fileOpened ) - { - TInt error = iParser->Restore( (*iFileNewList)[i], EFalse ); - if ( error == KErrNone ) - { - iFileMan->Copy( (*iFileNewList)[i], filePath ); - } - } - - } - } - CleanupStack::PopAndDestroy( fileListInstalled ); - CleanupStack::PopAndDestroy( &filePath ); - } - -// ---------------------------------------------------------------------------- -// CCHFactorySettings::UnInstallL -// Removes entries after uninstallation. -// ---------------------------------------------------------------------------- -// -void CCHFactorySettings::UnInstallL() - { - CP_DEBUG(_L8("CCHFactorySettings::UnInstallL" )); - TBool found(EFalse); - CDir* fileListInstalled= NULL; - RBuf filePath; - filePath.CreateL( KMaxPath ); - CleanupClosePushL( filePath ); - filePath.Append( KDriveC ); - filePath.Append( iFilePath ); - filePath.Append( KParsedDir ); - iFs.GetDir( filePath, KEntryAttMaskSupported, ESortByName, - fileListInstalled ); - CleanupStack::PushL( fileListInstalled ); - - for ( TInt i(0); iCount( ); i++ ) - { - TPtrC fileInstalledName = (*fileListInstalled)[i].iName; - found = EFalse; - for ( TInt j(0); jCount( ); j++ ) - { - TPtrC fileNewPath = (*iFileNewList)[j]; - TPtrC fileNewName = - (*iFileNewList)[j].Mid( (*iFileNewList)[j].LocateReverse( '\\' ) + 1 ); - if ( fileInstalledName.Compare( fileNewName )==0 ) - { - if ( !(*fileListInstalled)[i].IsDir( ) ) - { - found = ETrue; - break; - } - } - } - if ( !found ) //this file should be removed also entries from database - { - filePath.Zero( ); - filePath.Append( KDriveC ); - filePath.Append( iFilePath ); - filePath.Append( KParsedDir ); - filePath.Append( fileInstalledName ); - - iParser->Restore( filePath, ETrue ); - iFileMan->Delete( filePath ); - } - } - CleanupStack::PopAndDestroy( fileListInstalled ); - CleanupStack::PopAndDestroy( &filePath ); - } - -// ---------------------------------------------------------------------------- -// CCHFactorySettings::CheckDrivesL -// -// ---------------------------------------------------------------------------- -// -void CCHFactorySettings::CheckDrivesL() - { - CP_DEBUG(_L8("CCHFactorySettings::CheckDrivesL" )); - iFileNewList->Reset( ); - TDriveList driveList; - TChar driveLetter; - User::LeaveIfError( iFs.DriveList( driveList ) ); - for ( TInt driveNumber=EDriveA; driveNumber <= EDriveZ; driveNumber++ ) - { - if ( driveList[driveNumber] ) - { - User::LeaveIfError( iFs.DriveToChar( driveNumber, driveLetter ) ); - RBuf filePath; - filePath.CreateL( KMaxPath ); - CleanupClosePushL( filePath ); - filePath.Append( driveLetter ); - filePath.Append( KColen ); - filePath.Append( iFilePath ); - filePath.Append( KDirFSNew ); - CDir* fileList; - iFs.GetDir( filePath, KEntryAttMaskSupported, ESortByName, - fileList ); - CleanupStack::PopAndDestroy( &filePath ); - if ( fileList ) - { - CleanupStack::PushL( fileList ); - for ( TInt i(0); iCount( ); i++ ) - { - RBuf fullFileName; - fullFileName.CreateL( KMaxPath ); - CleanupClosePushL( fullFileName ); - fullFileName.Append( driveLetter ); - fullFileName.Append( KColen ); - fullFileName.Append( iFilePath ); - fullFileName.Append( KDirFSNew ) ; - fullFileName.Append( (*fileList)[i].iName ); - if ( !(*fileList)[i].IsDir( ) ) - { - //check if already exist - iFileNewList->AppendL( fullFileName ); - } - CleanupStack::PopAndDestroy( &fullFileName ); - } - CleanupStack::PopAndDestroy( fileList ); - } - } - } - } - -// end of file diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentharvester/factorysettingsplugin/src/chfactsetutils.cpp --- a/contentpublishingsrv/contentharvester/factorysettingsplugin/src/chfactsetutils.cpp Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,225 +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: Utils methods. - * -*/ - - -// INCLUDE FILES - -#include "chfactsetutils.h" -#include "chfactorysettingsglobals.h" -#include "cpdebug.h" - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// FactSetCHUtils::StrDec2Int -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TUint FactSetCHUtils::StrDec2Uint( const TDesC& aStr ) - { - CP_DEBUG(_L8("FactSetCHUtils::StrDec2Uint" )); - TLex lexer(aStr); - TInt ret; - if ( lexer.Val( ret ) ) - { - _LIT(KDesc, "Int"); - BadArgument( KDesc, aStr, KErrArgument ) ; - } - return ret; - } - -// ----------------------------------------------------------------------------- -// FactSetCHUtils::Str2Uint -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TUint FactSetCHUtils::Str2Uint( const TDesC& aStr ) - { - TUint ret(Str2Int( aStr ) ); - return ret; - } - -// ----------------------------------------------------------------------------- -// FactSetCHUtils::Str2Bool -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TBool FactSetCHUtils::Str2Bool( const TDesC& aStr ) - { - CP_DEBUG(_L8("FactSetCHUtils::Str2Bool" )); - TBool ret; - if ( !aStr.Compare( KTrue ) ) - { - ret = ETrue; - } - else if ( !aStr.Compare( KFalse ) ) - { - ret = EFalse; - } - else - ret = (Str2Int( aStr ) ); - return ret; - } - -// ----------------------------------------------------------------------------- -// FactSetCHUtils::Str2Int -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt FactSetCHUtils::Str2Int( const TDesC& aStr ) - { - CP_DEBUG(_L8("FactSetCHUtils::Str2Int" )); - // if a string starts from '0x' then convert aStr from hex to int. - // else send aStr to the StrDec2Uint - _LIT(KHexStart,"0x"); - - TInt position(aStr.Find( KHexStart ) ); - TInt ret(KErrArgument); - if ( position == 0 ) - { - // is hex - TPtrC string(aStr.Mid( KHexStart().Length( ) ) ); - - ret = StrHex2Uint( string ); - } - else - { - ret = StrDec2Uint( aStr ); - } - return ret; - } - -// ----------------------------------------------------------------------------- -// FactSetCHUtils::StrHex2UintL -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TUint FactSetCHUtils::StrHex2Uint( const TDesC& aStr ) - { - CP_DEBUG(_L8("FactSetCHUtils::StrHex2Uint" )); - TLex lexer(aStr); - TUint ret; - if ( lexer.Val( ret, EHex ) ) - { - _LIT(KDesc, "Hex"); - BadArgument( KDesc, aStr, KErrArgument ); - } - return ret; - } - -// ----------------------------------------------------------------------------- -// FactSetCHUtils::Str2Str8L -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -HBufC8* FactSetCHUtils::Str2Str8LC( const TDesC& aStr ) - { - CP_DEBUG(_L8("FactSetCHUtils::Str2Str8LC" )); - HBufC8* ret = HBufC8::NewLC( aStr.Length( ) ); - ret->Des().Copy( aStr ); - return ret; - } -// ----------------------------------------------------------------------------- -// FactSetCHUtils::Str2UidL -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TUid FactSetCHUtils::Str2Uid( const TDesC& aStr ) - { - return TUid( TUid::Uid( Str2Uint( aStr ) ) ); - } -// ----------------------------------------------------------------------------- -// FactSetCHUtils::Str2UidL -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TReal FactSetCHUtils::Str2Real( const TDesC& aStr ) - { - CP_DEBUG(_L8("FactSetCHUtils::Str2Real" )); - TLex lexer(aStr); - TReal ret; - if ( lexer.Val( ret ) ) - { - _LIT(KDesc, "Real"); - BadArgument( KDesc, aStr, KErrArgument ); - } - return ret; - } - -// ----------------------------------------------------------------------------- -// FactSetCHUtils::Str2IntL -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt32 FactSetCHUtils::Str2Int32( const TDesC& aStr ) - { - TInt32 ret(Str2Int( aStr ) ); - return ret; - } - -// ----------------------------------------------------------------------------- -// FactSetCHUtils::BadArgument -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -void FactSetCHUtils::BadArgument( const TDesC& aCategory, - const TDesC& aArgument, TInt aReason ) - { - TRAP_IGNORE( BadArgumentL(aCategory, aArgument, aReason) ); - } -// ----------------------------------------------------------------------------- -// FactSetCHUtils::BadArgumentL -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -void FactSetCHUtils::BadArgumentL( const TDesC& aCategory, - const TDesC& aArgument, TInt aReason ) - { - CP_DEBUG(_L8("FactSetCHUtils::BadArgumentL" )); - _LIT(K2Dot,":"); - HBufC* buf = HBufC::NewLC( aCategory.Length( ) + aArgument.Length( ) - + K2Dot().Length( ) ); - TPtr ptr(buf->Des( ) ); - ptr.Copy( aCategory ); - ptr.Append( K2Dot ); - ptr.Append( aArgument ); - BadArgument( ptr, aReason ); - CleanupStack::PopAndDestroy( buf ); - } -// ----------------------------------------------------------------------------- -// FactSetCHUtils::BadArgument -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -void FactSetCHUtils::BadArgument( const TDesC& aCategory, TInt aArgument, - TInt aReason ) - { - TBuf buf; - buf.Num( aArgument ); - BadArgument( aCategory, buf, aReason ); - } -// ----------------------------------------------------------------------------- -// FactSetCHUtils::BadArgument -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -void FactSetCHUtils::BadArgument( const TDesC& aCategory, TInt aReason ) - { - User::Panic( aCategory, aReason ); - } - -// End of File diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentharvester/group/bld.inf --- a/contentpublishingsrv/contentharvester/group/bld.inf Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Build info for the Content Publisher subsystem -* -*/ - -#include -PRJ_PLATFORMS -WINSCW ARMV5 -//DEFAULT - -PRJ_EXPORTS - - -PRJ_MMPFILES - -#include "../contentharvesterclient/group/bld.inf" -#include "../contentharvesterserver/group/bld.inf" -#include "../factorysettingsplugin/group/bld.inf" -#include "../contentharvesterswiplugin/group/bld.inf" - -PRJ_EXPORTS - - -#ifdef _MATRIX_MENU_INCLUDE_TEST_CONTENT -#include "../internal/group/bld.inf" -#endif -// End of file diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingserver/cpserver/data/20016b7b.txt Binary file contentpublishingsrv/contentpublishingserver/cpserver/data/20016b7b.txt has changed diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingserver/cpserver/data/backup_registration.xml --- a/contentpublishingsrv/contentpublishingserver/cpserver/data/backup_registration.xml Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingserver/cpserver/group/bld.inf --- a/contentpublishingsrv/contentpublishingserver/cpserver/group/bld.inf Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Build information file for Content Publisher Server -* -*/ - - - -PRJ_PLATFORMS - -DEFAULT - - -PRJ_EXPORTS -../data/backup_registration.xml z:/private/20016b7b/backup_registration.xml - -// Cenrep -../data/20016b7b.txt z:/private/10202be9/20016b7b.txt - -../inc/cpglobals.h |../../../../inc/cpglobals.h -../inc/cpserverdef.h |../../../../inc/cpserverdef.h - -PRJ_MMPFILES -cpserver.mmp - -// End of File \ No newline at end of file diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingserver/cpserver/group/cpserver.mmp --- a/contentpublishingsrv/contentpublishingserver/cpserver/group/cpserver.mmp Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 -* -*/ - -// To get the MW_LAYER_SYSTEMINCLUDE-definition -#include - -TARGET cpserver.exe -TARGETTYPE exe -CAPABILITY CAP_SERVER - -UID 0 0x20016B7B - -SOURCEPATH ../src -SOURCE cpserver.cpp -SOURCE cpserversession.cpp -SOURCE cpserverdatamanager.cpp -SOURCE cpserveractionmanager.cpp -SOURCE cpnotificationhandler.cpp -SOURCE cpserverburlistener.cpp -SOURCE cpactionhandlerthread.cpp - -USERINCLUDE ../inc -USERINCLUDE ../../cpsqlitestorage/inc -USERINCLUDE ../../../contentpublishingutils/contentpublishingdebug/inc -USERINCLUDE ../../../contentpublishingutils/contentpublishingmap/inc - -// Default system include paths for application layer modules. -MW_LAYER_SYSTEMINCLUDE - -LIBRARY euser.lib -LIBRARY efsrv.lib -LIBRARY ecom.lib -LIBRARY liwservicehandler.lib -LIBRARY eikcore.lib -LIBRARY cone.lib -LIBRARY estor.lib -LIBRARY cputils.lib -LIBRARY cpstorage.lib -LIBRARY inetprotutil.lib -#ifdef CONTENT_PUBLISHER_DEBUG -LIBRARY cpdebug.lib -#endif - - -//end of file diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingserver/cpserver/inc/cpactionhandlerthread.h --- a/contentpublishingsrv/contentpublishingserver/cpserver/inc/cpactionhandlerthread.h Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,235 +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 CPACTIONHANDLERTHREAD_H_ -#define CPACTIONHANDLERTHREAD_H_ - -#include -#include -#include - -class MLiwInterface; -class CLiwGenericParamList; -class CCPActionManager; - -/** - * The function to be passed as an argument to RThread::Create. - * - * It just calls CCPActionHandlerThread::ThreadFunction. The only - * reason this declaration is in the header file is to let - * CCPActionHandlerThread declare friendship with this funcion. - * - * @param aParam pointer to CCPActionHandlerThread object - * @return error code - */ -TInt CPExecutionThreadFunction( TAny* aParam ); - -/** - * Action handler thread. - * - * Provides easy-to-use interface for executing plugin actions - * in a separate thread. - * @since S60 5.0 - */ -class CCPActionHandlerThread: public CBase - { - friend TInt CPExecutionThreadFunction( TAny* ); - -public: - - /** - * Creates new instance of CCPActionHandlerThread. - * - * @return new instance of CCPActionHandlerThread - */ - static CCPActionHandlerThread* NewL(); - - /** - * Creates new instance of CCPActionHandlerThread. - * - * @return new instance of CCPActionHandlerThread - */ - static CCPActionHandlerThread* NewLC(); - - /** - * Destructor. - * Stops the action execution thread. - */ - ~CCPActionHandlerThread(); - - /** - * Executes an action handler action in the action execution thread. - * - * @param aActionParams action parameters - */ - void ExecuteL( const CLiwGenericParamList& aActionParams ); - - /** - * Starts the action execution thread. - * - * Creates a new instance of action execution thread - * provided it is not running already. - */ - void StartExecutionThreadIfNeededL(); - - /** - * Checks whether action execution thread is alive. - * - * @return ETrue if the thread is alive, EFalse otherwise. - */ - TBool ExecutionThreadRunning(); - -private: - /** - * Constructor. - */ - CCPActionHandlerThread(); - - /** - * 2nd phase constructor. - */ - void ConstructL(); - - /** - * This function is run is a separate thread. It creates - * CServerEikonEnv and CServerAppUi objects, which provide - * a trap cleanup and an active scheduler for the thread and - * then starts the active scheduler. - * - * @return error code - */ - TInt ThreadFunction(); - -private: // internal data types - - /** - * EIkonEnv for the server process. - */ - class CServerEikonEnv : public CEikonEnv - { - public: - void DestroyEnvironment(); - void ConstructL(); - }; - - /** - * EikAppUi for the server process. - */ - class CServerAppUi : public CEikAppUi - { - public: - ~CServerAppUi(); - void ConstructL(); - }; - - /** - * A simple active object for executin actions. - * Objects of this class are created and destroyed - * by action execution thread. - */ - class CActionExecutorAO: public CActive - { - public: - /** - * Factory method. - */ - static CActionExecutorAO* NewL(); - /** - * Factory method. - */ - static CActionExecutorAO* NewLC(); - /** - * Destructor. - */ - ~CActionExecutorAO(); - /** - * The RunL method which is run whever an action needs - * to be executed in the action execution thread. - * It just executes the action using the parameters - * supplied with a call to SetActionParams. If that - * parameters are NULL, it stops the active scheduler - * thus terminating action execution thread. - */ - void RunL(); - /** - * A dummy cancel method required by Symbian. - */ - void DoCancel(); - /** - * Returns a pointer to this active object's iStatus - * member variable. - */ - TRequestStatus* RequestStatus(); - /** - * TODO - * Sets paramters of the action to be executed in RunL. - * This method is supposed to be called from the main CPS thread. - * @param aActionParams action parameters - */ - void SetActionParams( const CLiwGenericParamList* aActionParams ); - private: - /** - * Constructor. - */ - CActionExecutorAO(); - /** - * 2nd phase constructor. - */ - void ConstructL(); - private: - /** - * Parameters of the action to be executed in RunL. - * Not own. - */ - const CLiwGenericParamList* iActionParams; - /** - * Action manager instance. - * Own. - */ - CCPActionManager* iActionManager; - }; - -private: // data - /** - * Handle to the action execution thread. - * Own. - */ - RThread iActionExecThread; - - /** - * Active object created in the action execution thread. - * Own. - */ - CActionExecutorAO *iActionExecutorAO; - - /** - * ETrue if action execution thread was started at least once. - */ - TBool iActionExecThreadStarted; - - /** - * A counter for naming action execution thread. - * - * Every action execution thread has a number appended to its name. - * When the thread dies (i.e. as a result of panic in a plugin), a - * new instance of that thread is started with the number in the name - * increased by one. - */ - TUint iThreadNum; - }; - -#endif /* CPACTIONHANDLERTHREAD_H_ */ diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingserver/cpserver/inc/cpglobals.h --- a/contentpublishingsrv/contentpublishingserver/cpserver/inc/cpglobals.h Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,139 +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: Global definitions - * -*/ - - -#ifndef CPCLIENTGLOBALS_H -#define CPCLIENTGLOBALS_H - -/** Data types for CP content */ -enum TDataTypes - { - ECPHardcodedText = 1, // 0001 - ECPResourceText = 2, // 0010 - ECPFilepathImage = 4, // 0100 - ECPResourceIcon = 8 // 1000 - }; - -enum TCPGetListOrder - { - ECPRecent = 1, // 0001 - ECPPublisher = 2, // 0010 - ECPContent = 4, // 0100 - ECPContentId = 8 // 1000 - }; - -enum TFlag - { - EActivate = 1, // 0001 - }; - -const TInt KNameArgumentsLimit = 5; -const TInt KThreadNameLimit = 64; - -_LIT( KService, "CP Service" ); - -_LIT8( KCPInterface, "IDataSource" ); -_LIT8( KCPContentInterface, "IContentPublishing" ); -_LIT8( KCPService, "Service.ContentPublishing" ); -_LIT8( KCommand, "cmd" ); - -//Supported Commands -_LIT8( KGetList, "GetList" ); -_LIT8( KAdd, "Add" ); -_LIT8( KDelete, "Delete" ); -_LIT8( KRequestNotification, "RequestNotification" ); -_LIT8( KExecuteAction, "ExecuteAction" ); -_LIT8( KCmdCancel, "Cancel" ); -_LIT8( KActivate, "Activate" ); -_LIT8( KActivateTrigger, "activate" ); -_LIT8( KDeactivateTrigger, "deactivate" ); - -// Input arguments -_LIT8( KType, "type" ); -_LIT8( KAction, "action" ); -_LIT8( KItem, "item" ); -_LIT8( KFilter, "filter" ); -_LIT8( KData, "data" ); -_LIT8( KSortOrder, "sort_order" ); -_LIT8( KItemId, "item_id" ); -_LIT8( KByPublisher, "by_publisher" ); -_LIT8( KByEntryIds, "by_entryids" ); -_LIT8( KPublisherId, "publisher" ); -_LIT8( KContentType, "content_type" ); -_LIT8( KContentId, "content_id" ); -_LIT8( KExpirationDate, "expiration_date" ); -_LIT8( KActivatePublisher, "activate" ); -_LIT8( KIds, "ids" ); -_LIT8( KId, "id" ); -_LIT8( KFlag, "flag"); -_LIT8( KAccessList, "ACL" ); -_LIT8( KACLRead, "read"); -_LIT8( KACLWrite, "write"); -_LIT8( KACLDelete, "delete"); -_LIT8( KUIDs, "UID" ); -_LIT8( KCapability, "Capability" ); -_LIT( KAll, "all"); -_LIT( KSortPublisher, "publisher"); -_LIT( KSortContentType, "content_type"); -_LIT( KSortContentId, "content_id"); -_LIT( KSortRecent, "recent"); -_LIT( KOperationAdd, "add" ); -_LIT( KOperationUpdate, "update" ); -_LIT( KOperationDelete, "delete" ); -_LIT( KOperationExecute, "execute" ); -_LIT8( KDataType, "data_type" ); -_LIT8( KOperation, "operation" ); -_LIT8( KActionTrigger, "action_trigger" ); -_LIT8( KActionTrigger16, "action_trigger16" ); -_LIT8( KHardcodedText, "harcoded_text" ); -_LIT8( KResourceText, "resource_text" ); -_LIT8( KFilepathImage, "filepath_image" ); -_LIT8( KIdMask, "id_mask" ); -_LIT8( KResourceIcon, "resource_icon" ); -_LIT8( KIdIcon, "id_icon" ); -_LIT8( KIdText, "id_text" ); -_LIT( KCpData, "cp_data" ); -_LIT( KPublisher, "publisher" ); -_LIT8( KChangeInfo, "change_info" ); - -_LIT8( KPublisher_Uid, "publisher_Uid" ); - -// Argument in Action -_LIT8( KActionHandlerInterface, "IDataAction" ); -_LIT8( KActionHandlerService, "Service.ActionHandler" ); -_LIT8( KCmdExecute, "Execute" ); -_LIT8( KPluginUid, "plugin_id" ); -_LIT8( KDataForActionHandler, "data" ); - -_LIT8( KLaunchMethod, "launch_method" ); -_LIT8( KApplicationUid, "application_uid" ); -_LIT8( KDocumentName, "document_name" ); -_LIT8( KViewId, "view_id" ); -_LIT8( KMessageUid, "message_uid" ); - -// Output -_LIT8( KResults, "results" ); -_LIT8( KListMap, "list_map" ); -_LIT8( KStatus, "status" ); -_LIT8( KDataMap, "data_map" ); -_LIT8( KActionMap, "action_map" ); -_LIT8( KKey, "key" ); - -_LIT8( KTransactionID, "TransactionID" ); -_LIT8( KErrorCode, "ErrorCode" ); - -#endif /*CPCLIENTGLOBALS_H*/ diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingserver/cpserver/inc/cpnotificationhandler.h --- a/contentpublishingsrv/contentpublishingserver/cpserver/inc/cpnotificationhandler.h Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,207 +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: Class used by session to handle asynchronous requests - * -*/ - - -#ifndef C_CPNOTIFICATIONHANDLER_H -#define C_CPNOTIFICATIONHANDLER_H - -#include -#include - -class CLiwGenericParamList; -class CLiwDefaultList; -class CLiwDefaultMap; -class CCPLiwMap; - -/** - * Internal class for handling asynchronous request - * for notifications. Used by server session object. - * - * @since S60 v5.0 - */ -class CCPNotificationHandler : public CBase - { -public: - - /** - * Two-phased constructor. - */ - static CCPNotificationHandler* NewL( RPointerArray& - aNotifications ); - - /** - * Two-phased constructor. - */ - static CCPNotificationHandler* NewLC( RPointerArray& - aNotifications ); - - /** - * Destructor. - */ - virtual ~CCPNotificationHandler(); - - /** - * Save message from client and initialize needed members - */ - void SaveMessageL( const RMessage2& aMessage ); - - /** - * Adds observer - */ - void AddObserverL( const RMessage2& aMessage ); - - /** - * Removes observer - */ - void RemoveObserverL( const RMessage2& aMessage ); - - /** - * Invoked in order to send notification - * @param List of changes to send - */ - void SendNotificationL( CLiwDefaultList* aListOfMaps ); - - /** - * Getter - * @return pointer to current notification - */ - const CLiwGenericParamList* GetPointerToChangeInfoList(); - - /** - * Resets internal stare - */ - void Reset(); - - /** - * Completes iMessage with provided error - * @param Error Code - */ - void ErrorComplete( TInt aErrCode ); - -private: - - /** - * C++ default constructor. - */ - CCPNotificationHandler(); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL( RPointerArray& aNotifications ); - - /** - * Invoked in order to send notification - * @param List of changes to send - * @since Series 60 5.0 - */ - TBool SendChangeInfoListL( const CLiwDefaultList* aListOfMaps ); - - /** - * Compares argument to stored filter - * @param aMap Information about change - * @param aFilter filter to compare with - * @return ETrue if argument matches filter - */ - TBool IsProperForFilterL( const CLiwDefaultMap& aMap, - const CCPLiwMap& aFilter ); - - /** - * Extracts parameter from LIW Map - * - * @param aMap Source Map - * @param aProperty Key of parameter to extract - * @param aResult Target for value - */ - void GetPropertyL( const CLiwDefaultMap& aMap, const TDesC8& aProperty, - RBuf& aResult ); - - /** - * Checks if IDs are the same - * - * @param aMap Map with notifications - * @param aFilter filter to compare with - * @return ETrue if ID are identical - */ - TBool CheckIdL( const CLiwDefaultMap& aMap, const CCPLiwMap& aFilter ); - - /** - * Checks if Properties like publisher,content type - * and content id are the same - * - * @param aMap Map with notifications - * @param aFilter filter to compare with - * @return ETrue if Parameters are identical - */ - TBool CheckPropertiesL( const CLiwDefaultMap& aMap, - const CCPLiwMap& aFilter ); - - /** - * Checks if operation types are the same - * - * @param aMap Map with notifications - * @param aFilter filter to compare with - * @return ETrue if operation types are the same - */ - TBool CheckOperationTypeL( const CLiwDefaultMap& aMap, - const CCPLiwMap& aFilter ); - - /** - * Checks if registry types are the same - * - * @param aMap Map with notifications - * @param aFilter filter to compare with - * @return ETrue if registry types are the same - */ - TBool CheckRegistryTypeL( const CLiwDefaultMap& aMap, - const CCPLiwMap& aFilter ); - -private: - // data - - /* - * Own. - * ETrue if message is ready to send notification - */ - TBool iIsReadyToSend; - - /* - * Own. - * List of waiting notifications. - */ - RPointerArray iNotifications; - - /* - * Not own. - * Message from client - */ - RMessage2 iMessage; - - /* - * Own. - * Notification to send. - */ - CLiwGenericParamList* iChangeInfoList; - - /* - * Own. - * Filters - */ - RHashMap< TInt32, CCPLiwMap*> iFilters; - }; - -#endif // C_CPNOTIFICATIONHANDLER_H diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingserver/cpserver/inc/cpserver.h --- a/contentpublishingsrv/contentpublishingserver/cpserver/inc/cpserver.h Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,227 +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: Content Publisher Server - Main class -* -*/ - - -#ifndef C_CCPSERVER_H -#define C_CCPSERVER_H - -// INCLUDES -#include -#include "cpserverdef.h" -#include "cpserverburlistener.h" - -#ifdef CONTENT_PUBLISHER_DEBUG -class CCPDebug; -#endif - -class CCPDataManager; -class CCPActionHandlerThread; -class CCPServer; - -struct TPointersForSession - { - CCPServer* iServer; - CCPDataManager* iDataManager; - CCPActionHandlerThread* iActionHandlerThread; - }; - -// CLASS DECLARATION -/** - * Content Publisher Server implementation - * - * @since Series 60 5.0 - */ -class CCPServer : public CPolicyServer, public MBURListenerCallback - { -public: - // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CCPServer* NewLC(); - - /** - * Destructor. - */ - virtual ~CCPServer(); - -public: - // New functions - - /** - * Stops server. - */ - void Stop(); - - /** - * Panic client. - * @param aMessage RMessage2 - * @param aPanic panic code - */ - static void PanicClient( const RMessage2& aMessage, - TCPServerPanic aPanic ); - - /** - * start server - * @return aErr Error code. - */ - static TInt ThreadStart(); - - /** - * Decrements session counter - */ - void RemoveSession(); - - /** - * Increments session counter - */ - void AddSession(); - - /** - * HandleBUREventL is called when Backup and Restore state has been changed. - * - * @since S60 v3.1 - * @param aStatus Current Backup and Restore status. - */ - void HandleBUREventL( TBURStatus aStatus ); - - /** - * Get Lock - * - * @return ETrue if Backup or Restore are running - */ - TBool GetLock(); - - /** - * Returns notifications array - */ - RPointerArray& GetNotifications( ); - -private: - // From CActive - - /** - * Process any errors. - * @param aError the leave code reported - * @return KErrNone if leave is handled - */ - TInt RunError( TInt aError ); - -private: - // New methods - - /** - * Constructs the server. - * @param aPriority CServer2 input parameter - */ - CCPServer( TInt aPriority ); - - /** - * Perform the second phase construction of a CCPServer object. - */ - void ConstructL(); - - /** - * Panic the server. - * @param param aPanic the panic code - * @return a updateId of container - */ - static void PanicServer( TCPServerPanic aPanic ); - - /** - * Send notification - * @param Map containing ids of item - */ - void AppendNotificationL( CCPLiwMap* aMap ); - - -private: - // From CServer2 - - /** - * Create a time server session, and return a pointer to the created object. - * @param aVersion the client version - * @param aMessage RMessage2 - * @return pointer to new session - */ - CSession2* NewSessionL( const TVersion& /*aVersion*/, - const RMessage2& /*aMessage*/) const; - - /** - * create and run server - */ - static void CreateAndRunServerL(); - - - /** - * Publishers deactivation - */ - void DeactivatePublishersL(); - - - /** - * Resets Activate flag and update item in the DB - */ - void ResetAndUpdateFlagL( CCPLiwMap* aMap ); - -private: - //data - - /* - * Manager to send and receive data beetween server and storage - * Own. - */ - CCPDataManager* iDataManager; - - /* - * Manager to prepare and execute action - * Own. - */ - CCPActionHandlerThread* iActionHandlerThread; - - /* - * Count of sessions - * Own. - */ - TInt iCountSession; - - /** - * Notifier for Backup and Restore changes. - * Own. - */ - CCPServerBURListener* iBURListener; - -#ifdef CONTENT_PUBLISHER_DEBUG - CCPDebug* iDebug; -#endif - - /* - * Own. - * True if database is lock - */ - TBool iBURLock; - - /* - * Own. - * List of waiting notifications about publisher - * activation during startup - */ - RPointerArray iNotifications; - }; - -#endif // C_CCPSERVER_H diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingserver/cpserver/inc/cpserveractionmanager.h --- a/contentpublishingsrv/contentpublishingserver/cpserver/inc/cpserveractionmanager.h Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,118 +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: Used by sessions for handling execute action requests - * -*/ - - -#ifndef C_CPACTION_MANAGER_H -#define C_CPACTION_MANAGER_H - -#include -// FORWARD DECLARATIONS -#ifdef CONTENT_PUBLISHER_DEBUG -class CCPDebug; -#endif -class CLiwServiceHandler; -class MLiwInterface; -class CLiwDefaultMap; - -/** - * Used to execute action using Action Handler Service - * - * @since S60 5.0 - */ -class CCPActionManager : public CBase - { -public: - - /** - * C++ destructor - */ - ~CCPActionManager(); - - /** - * Two-phased constructor. - */ - static CCPActionManager* NewL(); - - /** - * Two-phased constructor. - */ - static CCPActionManager* NewLC(); - - /** - * Executes action - * @param Action to be executed - */ - void ExecuteL( const CLiwGenericParamList& aList ); - -private: - // methods - - /** - * Standard C++ constructor. - */ - CCPActionManager(); - - /** - * Standard 2nd phase constructor. - */ - void ConstructL(); - - /** - * Loads interface - * @param interface loaded from service - */ - void PrepareServiceL( MLiwInterface*& aInterface ); - - /** - * Prepares data to execute command - * @param paramList from server - * @param target list to execute action - */ - void PrepareInputListL( const CLiwGenericParamList& aList, - CLiwGenericParamList& aTarget ); - - /** - * Extracts and adds attributes from aMap to aTarget. - * @since Series 60 3.2 - * @param aMap CLiwDefaultMap with action. - * @param aTarget CLiwGenericParamList with Uid and Map. - */ - void ExtractUidAndMapL( const CLiwDefaultMap& aMap, - CLiwGenericParamList& aTarget ); - -private: - // data - - /* - * Own. - * Handler to service - */ - CLiwServiceHandler* iServiceHandler; - - /* - * Own. - * Interface to CPS service - */ - MLiwInterface* iInterface; - -#ifdef CONTENT_PUBLISHER_DEBUG - CCPDebug* iDebug; -#endif - }; - -#endif // C_CPACTION_MANAGER_H -// end of file diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingserver/cpserver/inc/cpserverburlistener.h --- a/contentpublishingsrv/contentpublishingserver/cpserver/inc/cpserverburlistener.h Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,120 +0,0 @@ -/* -* 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: Backup and restore events listener. - * -*/ - - -#ifndef C_CPSERVERBURLISTENER_H -#define C_CPSERVERBURLISTENER_H - -#include -#include - -/** - * Interface for observing Backup and Restore events. - * - * @since S60 S60 v3.1 - */ -class MBURListenerCallback - { - -public: - /** - * Enum defining the status of Backup and Restore. - */ - enum TBURStatus - { - EBURStatusNone, - EBURStatusBackup, - EBURStatusRestore - }; - - /** - * HandleBUREventL is called when Backup and Restore state has been changed. - * @param aStatus Current Backup and Restore status. - */ - virtual void HandleBUREventL( TBURStatus aStatus ) = 0; - - }; - -/** - * Central Repository observer for Backup and Restore. - * - * @since S60 S60 v3.1 - */ -NONSHARABLE_CLASS(CCPServerBURListener) : public CActive - { - -public: - - /** - * Creates an instance of CCPServerBURListener implementation. - * @param aCallBack Pointer to observer interface. - */ - static CCPServerBURListener* NewL( MBURListenerCallback* aCallback ); - - /** - * Destructor. - */ - virtual ~CCPServerBURListener(); - - /** - * @return EFalse if the device as a whole is not engaged in a backup or restore . - */ - TBool CheckBUR(); - -private: - /** - * Constructor. - * @param aCallBack Pointer to observer interface. - */ - CCPServerBURListener( MBURListenerCallback* aCallback ); - - /** - * Symbian 2nd phase constructor. - */ - void ConstructL(); - - /** - * From CActive. - */ - void DoCancel(); - - /** - * From CActive. - */ - void RunL(); - - /** - * From CActive. - */ - TInt RunError( TInt aError ); - -private: - /** - * User side interface to Publish & Subscribe. - */ - RProperty iProperty; - - /** - * Interface for notifying changes in Backup and Restore. - * Not own. - */ - MBURListenerCallback* iCallback; - - }; - -#endif // C_CPSERVERBURLISTENER_H -// End of File diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingserver/cpserver/inc/cpserverdatamanager.h --- a/contentpublishingsrv/contentpublishingserver/cpserver/inc/cpserverdatamanager.h Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,258 +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: Used by sessions for handling data related requests - * -*/ - - -#ifndef C_CPDATA_MANAGER_H -#define C_CPDATA_MANAGER_H - -#include -#include "cpstorage.h" - -// FORWARD DECLARATIONS -#ifdef CONTENT_PUBLISHER_DEBUG -class CCPDebug; -#endif -class CLiwMap; -class CCPLiwMap; -class CCpStorage; -class CCPServerSession; -class CCPNotificationHandler; -class TLiwVariant; - -/** - * Content publisher data manager. - * - * Used to add, modify and remove data and actions. - * @since S60 v5.0 - */ -class CCPDataManager : public CBase, MCPChangeNotifier - { -public: - // exported - - /** - * C++ destructor - */ - ~CCPDataManager(); - - /** - * Two-phased constructor. - */ - static CCPDataManager* NewL( TBool aTBool = EFalse ); - - /** - * Two-phased constructor. - */ - static CCPDataManager* NewLC( TBool aTBool = EFalse ); - - /** - * Add a new data to database - * - * @param aData Data to be added. - * @return Id of a newly created data item - */ - TUint AddDataL( CCPLiwMap& aMap ); - - /** - * Fetches data from database - * @param aInParamList filter and sorting criteria - * @param aOutParamList results - */ - void GetListL( const CCPLiwMap& aMa, CLiwGenericParamList& aOutParamList ); - /** - * Fetches action from database - * @param aInParamList filter and sorting criteria - * @param aOutParamList results - * @param aNotificationList change info list (for notifications) - * @return KErrNotFound if data was not found - */ - TInt GetActionL( const CCPLiwMap& aMa, - CLiwGenericParamList& aOutParamList, - CLiwDefaultList* aNotificationList = NULL ); - - /** - * Fetches all activated publishers - * @param aInParamList filter and sorting criteria - * @param aOutParamList results - */ - void GetActivePublishersL( CLiwGenericParamList* aResultList ); - - /** - * Removes data from database - * @param aInParamList filter criteria - */ - void RemoveDataL( const CCPLiwMap& aMa ); - - /** - * Adds observer to database - * @param new observer - */ - void AddObserverL( CCPNotificationHandler* aNotificationHandler ); - - /** - * Removes observer from database - * @param aNotificationHandler observer to remove - */ - void RemoveObserver( CCPNotificationHandler* aNotificationHandler ); - - // from MCPChangeNotifier - /** - * @param Map containing change information - * @return - */ - void HandleChangeL( CLiwDefaultList* aListOfMaps ); - - /** - * Close database - * @return - */ - void CloseDatabase(); - /** - * Open database - * @return - */ - void OpenDatabaseL(); - -private: - // methods - - /** - * Standard C++ constructor. - */ - CCPDataManager(); - - /** - * Standard 2nd phase constructor. - */ - void ConstructL( TBool aTBool ); - - /** - * Fetches action bound to provided trigger. - * - * @param aOutParamList of all actions - * @param aMap for found action - * @param aTrigger - */ - void ExtractTriggerL( CLiwGenericParamList& aOutParamList, - const CLiwDefaultMap* aMap, const TDesC8& aTrigger ); - /** - * Sends notifications to observers stored in iNotificationsArray - * - * @param List of change information - * @param index od data item - */ - void SendNotificationL( CLiwDefaultList* aListOfMaps, TInt aIndex ); - - /** - * Exctracts action from input parameters - * - * @param aParam for data - * @param aAction for action - */ - void ExtractActionL( const TLiwGenericParam* aParam, RBuf8& aAction ); - - /** - * Fills aOutParamList with parameters for action. - * - * @param aOutParamList parsed list of items - * @param aParamList list of items from data base - * @param aActionTrigger action trigger - */ - void FillActionParamListL( - CLiwGenericParamList & aOutParamList, - const TLiwGenericParam* aParam, - RBuf8 & aActionTrigger); - - /** - * Creates map for GetList request - publisher, content_type - * and content_id are copied from aMap to returned map - * @param aMap - input map - * @return input map for GetList request - */ - CCPLiwMap* CreateMapForGetlistLC( const CCPLiwMap& aMap ); - - - /** - * Gets Flag for specified item from DB and returns activate - * info - * @param aMap - input map - * @return activate flag - */ - TBool GetActivateInfoL( const CCPLiwMap* aMap ); - - /** - * Builds change info list - * @param aMap - map containing parameters needed to build change info list - * @param aParam - param from getlist result - * @param aChangeInfoList - output list containing change info list sent - * as notification - */ - void BuildChangeInfoL( - const CCPLiwMap* aMap, - const TLiwGenericParam* aParam, - CLiwDefaultList* aChangeInfoList ); - /** - * Builds change info list when query to database returned nothing - * @param aMap - map containing parameters needed to build change info list - * @param aChangeInfoList - output list containing change info list sent - * as notification - */ - void BuildDefaultChangeInfoL( - const CCPLiwMap* aMap, - CLiwDefaultList* aChangeInfoList ); - - - /** - * Copies variant from in to out map if entry with provided key exists - * @param aKey a key - * @param aInMap input map - * @param aOutMap output map - */ - void CopyVariantL(const TDesC8& aKey, const CLiwMap* aInMap, - CLiwDefaultMap* aOutMap ); - - /** - * Copies variant from in map for key KActionTrigger to out map with key KActionTrigger16 - * and formated type(from TDesC8 to TDesC) - * @param aInMap input map - * @param aOutMap output map - */ - void CopyActionTrigger16L( const CLiwMap* aInMap, - CLiwDefaultMap* aOutMap ); - -private: - // data - - /* - * Storage database - * Own. - */ - CCpStorage* iStorage; - - /* - * Array of registered notification handlers. - * Own. - */ - RPointerArray iNotificationsArray; - -#ifdef CONTENT_PUBLISHER_DEBUG - CCPDebug* iDebug; -#endif - }; - -#endif // C_CPDATA_MANAGER_H -// end of file diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingserver/cpserver/inc/cpserverdef.h --- a/contentpublishingsrv/contentpublishingserver/cpserver/inc/cpserverdef.h Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +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: Globals for Content Publisher server - * -*/ - - -#ifndef C_CPSERVERDEF_H -#define C_CPSERVERDEF_H - -// CONSTANTS -const TUint KCPServerMajorVersionNumber = 0; -const TUint KCPServerMinorVersionNumber = 1; -const TUint KCPServerBuildVersionNumber = 1; - -// ENUMERATIONS -// Opcodes used in message passing between client and server -enum TCpServerRqst - { - ECpServerAddData = 1, - ECpServerRemoveData = 2, - ECpServerGetListSize = 10, - ECpServerGetListData = 11, - ECpServerRegisterObserver = 20, - ECpServerUnRegisterObserver = 21, - ECpServerGetChangeInfoData = 22, - ECpServerAddObserver = 23, - ECpServerRemoveObserver = 24, - ECpServerExecuteAction = 30, - ECpServerInternal = 100 - }; - -_LIT( KCPServerThreadName, "cpserver_MainThread" ); -_LIT( KCPServerName, "cpserver" ); -_LIT( KCPServerFilename, "cpserver" ); -_LIT( KActiveDes, "1" ); -_LIT( KInActiveDes, "0" ); -_LIT( KColon, ":" ); -_LIT( KSemiColon, ";" ); - -_LIT( KCPServerPluginThreadName, "CPS plugin command execution thread %d" ); -const TInt KCPServerPluginThreadMinHeapSize = 0x400; // 1kB -const TInt KCPServerPluginThreadMaxHeapSize = 0x100000; // 1MB - -const TUid KServerUid3 = - { - 0x20016B7B - }; - -/** Panic Category */ - -/** Active Data Server panic codes */ -enum TCPServerPanic - { - ECPServerBadRequest = 1, - ECPServerBadDescriptor = 2, - ECPServerSrvCreateServer = 3 - }; - -const TUint KDescriptorPosition( 0); -const TUint KReturnPosition( 1); -const TUint KInfoPosition( 2); -const TUint KTransactionPosition( 3); -const TBool KActive( ETrue ); -const TBool KInActive( EFalse ); - -// Uid of CP Server -const TUid KServerUid = { 0x20016B7B }; -// Uid of cpstorage -const TUint32 KCPStorageUid = { 0x20016B7C }; -//Values of KSQLDBStateKey key -const TInt KSQLDBStateNormal = 0x00000001; -const TInt KSQLDBStateRestored = 0x00000002;//KSQLDBStateNormal << 1 -// const ITnt NextState = LastState << 1; - - - -#endif // C_CPSERVERDEF_H diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingserver/cpserver/inc/cpserversession.h --- a/contentpublishingsrv/contentpublishingserver/cpserver/inc/cpserversession.h Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,242 +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: Server Session - * -*/ - - -#ifndef C_CCPSERVERSESSION_H -#define C_CCPSERVERSESSION_H - -// INCLUDES -#include - -// FORWARD DECLARATIONS -#ifdef CONTENT_PUBLISHER_DEBUG -class CCPDebug; -#endif -class CLiwGenericParamList; -class CLiwDefaultMap; -class CLiwDefaultList; -class CCPServer; -class CCPDataManager; -class CCPLiwMap; -class CCPActionHandlerThread; -class CCPNotificationHandler; -struct TPointersForSession; - -// CLASS DECLARATION -/** - * Server side session representation - * - * @since Series 60 5.0 - */ -class CCPServerSession : public CSession2 - { - -public: - // New methods - - /** - * Two-phased constructor. - */ - static CCPServerSession* NewL( TPointersForSession& aPasser ); - - /** - * Two-phased constructor. - */ - static CCPServerSession* NewLC( TPointersForSession& aPasser ); - - /** - * Destroy the object and release all memory objects - */ - virtual ~CCPServerSession(); - -public: - // From CSession - - /** - * Called after a service request from client - * @param aMessage message from client (containing requested operation - * and any data) - */ - void ServiceL( const RMessage2& aMessage ); - - /** - * Selects correct function from message - * @param aMessage message from client (containing requested operation - * and any data) - */ - void DispatchMessageL( const RMessage2& aMessage, TBool& aPanicedClient ); - -private: - // New methods - - /** - * Standard C++ constructor. - */ - CCPServerSession(); - - /** - * Perform the second phase construction of a CCPServerSession object - */ - void ConstructL( TPointersForSession& aPasser ); - - /** - * Add Data request - * @param Message from client - */ - void AddDataL( const RMessage2& aMessage ); - - /** - * Get data request - first phase - * @param Message from client - */ - void GetListSizeL( const RMessage2& aMessage ); - - /** - * Get data request - second phase - * @param Message from client - */ - void GetListDataL( const RMessage2& aMessage ); - - /** - * Remove data request - * @param Message from client - */ - void RemoveDataL( const RMessage2& aMessage ); - - /** - * Executes action request - * @param Message from client - */ - void ExecuteActionL( const RMessage2& aMessage ); - - /** - * Executes action request - * @param aActionParams list with actions - */ - void ExecuteL( const CLiwGenericParamList& aActionParams ); - - /** - * Register for notification request - * @param Message from client - */ - void RegisterObserverL( const RMessage2& aMessage ); - - /** - * Adds new observer - * @param Message from client - */ - void AddObserverL( const RMessage2& aMessage ); - - /** - * Removes observer - * @param Message from client - */ - void RemoveObserverL( const RMessage2& aMessage ); - - /** - * Unregister from notification request - * @param Message from client - */ - void UnregisterObserverL(); - - /** - * Send information about change in database to client - * @param Message from client - */ - void GetChangeInfoDataL( const RMessage2& aMessage ); - - /** - * Converts CLiwGenericParamList to descriptor and - * sends to client - * @param Message to complete - * @param Parameters for message - */ - void ExternalizeAndWriteToClientL( const RMessage2& aMessage, - const CLiwGenericParamList* outParamList ); - - /** - * Unpacks message from client to map - * @param Message to complete - * @return CCPLiwMap with data from client - */ - CCPLiwMap* UnpackFromClientLC( const RMessage2& aMessage ); - - /** - * Send notification - * @param aNotificationList - */ - void SendNotificationL( CCPLiwMap* aMap, - CLiwDefaultList* aNotificationList ); - - /** - * Get and Execute Activate or Deactivate action from the DB - * @param Map containing ids of item - */ - void GetAndExecuteActionL( CCPLiwMap* aMap, CLiwDefaultList* aNotificationList, - TBool aInsertTrigger = EFalse ); - - /** - * Get Server Lock - * @return ETrue if aMessege cannot be processed - * because Backup or Restore is running - **/ - TBool GetServerLock( const RMessage2& aMessage ); - -private: - - /* - * Own. - * Handler for asynchronous request for notifications - */ - CCPNotificationHandler* iNotificationHandler; - - /* - * Not own. - * True if message is register - */ - TBool isRegister; - - /* - * Not own. - * Pointer to Content Publisher Server - */ - CCPServer* iServer; - - /* - * Not own. - * Manager to send and receive data beetween server and storage - */ - CCPDataManager* iDataManager; - - /* - * Own. - * List write to message with getList function - */ - CLiwGenericParamList* iParamList; - - /* - * Not Own. - * Manager to prepare and execute action - */ - CCPActionHandlerThread* iActionHandlerThread; - -#ifdef CONTENT_PUBLISHER_DEBUG - CCPDebug* iDebug; -#endif - }; - -#endif // C_CCPSERVERSESSION_H diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingserver/cpserver/src/cpactionhandlerthread.cpp --- a/contentpublishingsrv/contentpublishingserver/cpserver/src/cpactionhandlerthread.cpp Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,410 +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: -* -*/ - -#include "cpactionhandlerthread.h" -#include "cpserverdef.h" -#include "cpserveractionmanager.h" -#include "cpglobals.h" - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -TInt CPExecutionThreadFunction( TAny* aParam ) - { - ASSERT( aParam ); - CCPActionHandlerThread* actionHandlerThread = - reinterpret_cast( aParam ); - return actionHandlerThread->ThreadFunction(); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -CCPActionHandlerThread* CCPActionHandlerThread::NewL() - { - CCPActionHandlerThread* self = NewLC(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -CCPActionHandlerThread* CCPActionHandlerThread::NewLC() - { - CCPActionHandlerThread* self = new ( ELeave ) CCPActionHandlerThread; - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -CCPActionHandlerThread::~CCPActionHandlerThread() - { - if ( ExecutionThreadRunning() && iActionExecutorAO ) - { - // stop action execution thread - - // request notification when action execution thread terminates - TRequestStatus exitStatus; - iActionExecThread.Logon( exitStatus ); - - // passing NULL as action parameters will cause the action executor to - // stop active scheduler in command execution thread - iActionExecutorAO->SetActionParams( NULL ); - // ask action executor to execute the action - TRequestStatus* actionExecutorAOStatus = - iActionExecutorAO->RequestStatus(); - iActionExecThread.RequestComplete( actionExecutorAOStatus, KErrNone ); - - // wait for the action execution thread to terminate - User::WaitForRequest( exitStatus ); - } - iActionExecThread.Close(); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPActionHandlerThread::ExecuteL( - const CLiwGenericParamList& aActionParams ) - { - StartExecutionThreadIfNeededL(); - - ASSERT( iActionExecutorAO ); - iActionExecutorAO->SetActionParams( &aActionParams ); - - // create rendezvous so that we are notified when action - // execution finishes - TRequestStatus actionExecutionStatus = KRequestPending; - iActionExecThread.Rendezvous( actionExecutionStatus ); - - // request action execution by completing request for the AO running - // in the action execution thread - TRequestStatus* actionExecutorAOStatus = - iActionExecutorAO->RequestStatus(); - iActionExecThread.RequestComplete( actionExecutorAOStatus, KErrNone ); - - // wait until action execution finishes - User::WaitForRequest( actionExecutionStatus ); - - TInt err = actionExecutionStatus.Int(); - // please note that checking actionExecutionStatus is not a reliable way of - // determining whether everything is OK because if plugin panics with - // reason (panic number) KErrNone, actionExecutionStatus will contain KErrNone - if ( !ExecutionThreadRunning() ) - { - // action execution thread died, - // iActionExecutorAO pointer is no longer valid - iActionExecutorAO = NULL; - if ( err >= 0 ) - { - err = KErrDied; - } - } - else - { - iActionExecutorAO->SetActionParams( NULL ); - } - - User::LeaveIfError( err ); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// - void CCPActionHandlerThread::StartExecutionThreadIfNeededL() - { - if ( !ExecutionThreadRunning() ) - { - TBuf threadName; - if ( iActionExecThreadStarted ) - { - iActionExecThread.Close(); - } - - // create action execution thread - threadName.Format( KCPServerPluginThreadName, ++iThreadNum ); - TInt err = iActionExecThread.Create( threadName, - CPExecutionThreadFunction, - KDefaultStackSize, - KCPServerPluginThreadMinHeapSize, - KCPServerPluginThreadMaxHeapSize, - reinterpret_cast( this ) ); - User::LeaveIfError( err ); - - // create rendezvous so that we are notified when the thread - // has started - TRequestStatus threadStatus; - iActionExecThread.Rendezvous( threadStatus ); - - // start the action execution thread - iActionExecThread.Resume(); - - // wait for the thread to start - User::WaitForRequest( threadStatus ); - - User::LeaveIfError( threadStatus.Int() ); - - iActionExecThreadStarted = ETrue; - ASSERT( ExecutionThreadRunning() ); - } - } - -// --------------------------------------------------------------------------- -// RThread::ExitType() returns EExitPending if the thread is alive or has not -// been started yet. There is a member variable, iActionExecThreadStarted -// which tells if the thread was started or not. Combining the information -// from the member variable and RThread::ExitType() allows us to determine if -// the thread is running (alive). -// --------------------------------------------------------------------------- -// - TBool CCPActionHandlerThread::ExecutionThreadRunning() - { - TBool actionExecThreadDidNotDie = - iActionExecThread.ExitType() == EExitPending; - - TBool threadRunning = - iActionExecThreadStarted && actionExecThreadDidNotDie; - - // if the thread is alive, it must have created an active object for - // executing actions in plugins; verify that it is the case - ASSERT( !threadRunning || ( threadRunning && iActionExecutorAO )); - - return threadRunning; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// - CCPActionHandlerThread::CCPActionHandlerThread() - { - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPActionHandlerThread::ConstructL() - { - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -TInt CCPActionHandlerThread::ThreadFunction() - { - __UHEAP_MARK; - - CServerEikonEnv* env = new CServerEikonEnv; - if ( !env ) - { - return KErrNoMemory; - } - CServerAppUi* ui = new CServerAppUi; - if ( !ui ) - { - delete env; - return KErrNoMemory; - } - - TRAPD( err, - env->ConstructL(); - env->DisableExitChecks( ETrue ); - ui->ConstructL(); - - iActionExecutorAO = CActionExecutorAO::NewL(); - - // notify the main thread that action execution thread - // has successfully started - RThread::Rendezvous( KErrNone ); - - CActiveScheduler::Start(); - ); - - delete iActionExecutorAO; - iActionExecutorAO = NULL; - - ui->PrepareToExit(); - env->DestroyEnvironment(); - - __UHEAP_MARKEND; - - return err; - } - -// ----------------------------------------------------------------------------- -// CContentHarvesterEikonEnv::DestroyEnvironment -// -// ----------------------------------------------------------------------------- -// -void CCPActionHandlerThread::CServerEikonEnv::DestroyEnvironment() - { - CEikonEnv::DestroyEnvironment( ); - } - -// ----------------------------------------------------------------------------- -// CContentHarvesterEikonEnv::ConstructL -// -// ----------------------------------------------------------------------------- -// -void CCPActionHandlerThread::CServerEikonEnv::ConstructL() - { - CEikonEnv::ConstructL( EFalse ); - SetAutoForwarding( ETrue ); - User::SetPriorityControl( EFalse ); - } -// ----------------------------------------------------------------------------- -// CContentHarvesterAppUi::~CContentHarvesterAppUi -// -// ----------------------------------------------------------------------------- -// -CCPActionHandlerThread::CServerAppUi::~CServerAppUi() - { - } - -// --------------------------------------------------------------------------- -// CContentHarvesterAppUi::ConstructL -// -// --------------------------------------------------------------------------- -// -void CCPActionHandlerThread::CServerAppUi::ConstructL() - { - CEikAppUi::BaseConstructL( ENoAppResourceFile | ENoScreenFurniture ); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -CCPActionHandlerThread::CActionExecutorAO* -CCPActionHandlerThread::CActionExecutorAO::NewL() - { - CActionExecutorAO* self = NewLC(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -CCPActionHandlerThread::CActionExecutorAO* -CCPActionHandlerThread::CActionExecutorAO::NewLC() - { - CActionExecutorAO* self = new ( ELeave ) CActionExecutorAO(); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -CCPActionHandlerThread::CActionExecutorAO::~CActionExecutorAO() - { - delete iActionManager; - } - -// --------------------------------------------------------------------------- -// Any code executed in this method must not leave! -// This way we avoid implementing RunError while making sure that -// Rendezvous will always be called -// --------------------------------------------------------------------------- -// -void CCPActionHandlerThread::CActionExecutorAO::RunL() - { - if( iActionParams ) - { - // execute action - TRAPD( err, iActionManager->ExecuteL( *iActionParams ) ); - - // notify the main thread that action execution has finished - RThread::Rendezvous( err ); - - // wait until another action execution is requested - iStatus = KRequestPending; - SetActive(); - } - else - { - CActiveScheduler::Stop(); - } - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPActionHandlerThread::CActionExecutorAO::DoCancel() - { - TRequestStatus* myRequestStatus = &iStatus; - User::RequestComplete( myRequestStatus, KErrCancel ); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -TRequestStatus* CCPActionHandlerThread::CActionExecutorAO::RequestStatus() - { - return &iStatus; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPActionHandlerThread::CActionExecutorAO::SetActionParams( - const CLiwGenericParamList* aActionParams ) - { - iActionParams = aActionParams; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -CCPActionHandlerThread::CActionExecutorAO::CActionExecutorAO() - : CActive( CActive::EPriorityLow ) - { - CActiveScheduler::Add( this ); - - // wait until action execution is requested - iStatus = KRequestPending; - SetActive(); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPActionHandlerThread::CActionExecutorAO::ConstructL() - { - iActionManager = CCPActionManager::NewL(); - } diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingserver/cpserver/src/cpnotificationhandler.cpp --- a/contentpublishingsrv/contentpublishingserver/cpserver/src/cpnotificationhandler.cpp Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,520 +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 -#include - -#include "cpnotificationhandler.h" -#include "cpdebug.h" -#include "cpliwmap.h" -#include "cpglobals.h" -#include "cpserverdef.h" - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -CCPNotificationHandler::CCPNotificationHandler() - { - - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPNotificationHandler::ConstructL( RPointerArray& - aNotifications) - { - iChangeInfoList = CLiwGenericParamList::NewL( ); - for ( TInt i(0); i< aNotifications.Count( ); i++ ) - { - iNotifications.AppendL(aNotifications[i]); - aNotifications[i]->IncRef(); - } - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -CCPNotificationHandler* CCPNotificationHandler::NewL( - RPointerArray& aNotifications ) - { - CCPNotificationHandler* self = CCPNotificationHandler::NewLC( - aNotifications ); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -CCPNotificationHandler* CCPNotificationHandler::NewLC( - RPointerArray& aNotifications ) - { - CCPNotificationHandler* self = new( ELeave ) CCPNotificationHandler; - CleanupStack::PushL( self ); - self->ConstructL( aNotifications ); - return self; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -CCPNotificationHandler::~CCPNotificationHandler() - { - THashMapIter iter( iFilters ); - - const TInt32* transaction = iter.NextKey(); - while( transaction ) - { - CCPLiwMap** filter = iFilters.Find( *transaction );// leaves if not found - if ( filter ) - { - (*filter)->Reset(); - (*filter)->Close(); - } - transaction = iter.NextKey( ); - } - iFilters.Close(); - Reset( ); - for ( TInt i(0); i< iNotifications.Count( ); i++ ) - { - iNotifications[i]->Close( ); - } - iNotifications.Close( ); - delete iChangeInfoList; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPNotificationHandler::SaveMessageL( const RMessage2& aMessage ) - { - iIsReadyToSend = ETrue; - iMessage = aMessage; - - TInt32 transactionId = aMessage.Int3(); - if ( transactionId != KErrAlreadyExists ) - { - TInt deslen = aMessage.GetDesLengthL( KDescriptorPosition ); - if( deslen > 0 ) - { - HBufC8* buffer = HBufC8::NewLC( deslen ); - TPtr8 tempDes = buffer->Des( ); - aMessage.Read( KDescriptorPosition, tempDes ); - RDesReadStream datastrm( *buffer); - CleanupClosePushL( datastrm ); - CCPLiwMap* filterMap = CCPLiwMap::NewL( datastrm ); - CleanupStack::PushL( filterMap ); - iFilters.InsertL( transactionId, filterMap ); - CleanupStack::Pop( filterMap ); - CleanupStack::PopAndDestroy( &datastrm ); - CleanupStack::PopAndDestroy( buffer ); - } - } - if ( iNotifications.Count( ) ) - { - SendNotificationL( NULL ); - } - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPNotificationHandler::AddObserverL( const RMessage2& aMessage ) - { - TInt32 transactionId = aMessage.Int3(); - TInt deslen = aMessage.GetDesLength( KDescriptorPosition ); - if( deslen > 0 ) - { - HBufC8* buffer = HBufC8::NewLC( deslen ); - TPtr8 tempDes = buffer->Des( ); - aMessage.Read( KDescriptorPosition, tempDes ); - RDesReadStream datastrm( *buffer); - CleanupClosePushL( datastrm ); - CCPLiwMap* filterMap = CCPLiwMap::NewL( datastrm ); - CleanupStack::PushL( filterMap ); - iFilters.InsertL( transactionId, filterMap ); - CleanupStack::Pop( filterMap ); - CleanupStack::PopAndDestroy( &datastrm ); - CleanupStack::PopAndDestroy( buffer ); - } - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPNotificationHandler::RemoveObserverL( const RMessage2& aMessage ) - { - TInt32 transactionId = aMessage.Int3(); - CCPLiwMap* filter = iFilters.FindL( transactionId );// leaves if not found - filter->Reset(); - filter->Close(); - iFilters.Remove( transactionId ); - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -TBool CCPNotificationHandler::IsProperForFilterL( const CLiwDefaultMap& aMap, - const CCPLiwMap& aFilter ) - { - CP_DEBUG( _L8("CCPNotificationHandler::IsProperForFilter()") ); - TBool result( EFalse ); - if( CheckRegistryTypeL( aMap, aFilter ) && - CheckOperationTypeL( aMap, aFilter ) ) - { - if( CheckIdL( aMap, aFilter ) ) - { - result= ETrue; - } - else if( CheckPropertiesL( aMap, aFilter ) ) - { - result = ETrue; - } - } - return result; - } - -// ---------------------------------------------------------------------------- -// -// ---------------------------------------------------------------------------- -// -void CCPNotificationHandler::SendNotificationL( CLiwDefaultList* aListOfMaps ) - { - CP_DEBUG( _L8("CCPNotificationHandler::SendNotificationL()") ); - if ( iIsReadyToSend ) - { - //notification can be send - if ( iNotifications.Count( ) ) - { - //at least one notification is waiting to be sent - TBool sent; - sent = SendChangeInfoListL( iNotifications[0] ); - iNotifications[0]->Close( ); - iNotifications.Remove( 0 ); - if ( !sent ) - { - //if notification from array wasn't sent because it didn't - //match the filter, try to send the next one - SendNotificationL( NULL ); - } - else - { - //message was send - iIsReadyToSend = EFalse; - } - } - else - { - //no notification is waiting, so send the new one - if ( aListOfMaps && SendChangeInfoListL( aListOfMaps ) ) - { - iIsReadyToSend = EFalse; - } - } - } - else - { - //notification cannot be sent in this moment - aListOfMaps->IncRef( ); - iNotifications.AppendL( aListOfMaps ); - } - } - -// ---------------------------------------------------------------------------- -// -// ---------------------------------------------------------------------------- -// - -const CLiwGenericParamList* CCPNotificationHandler::GetPointerToChangeInfoList() - { - return iChangeInfoList; - } - -// ---------------------------------------------------------------------------- -// -// ---------------------------------------------------------------------------- -// -void CCPNotificationHandler::Reset() - { - iIsReadyToSend = EFalse; - iChangeInfoList->Reset( ); - } - -// ---------------------------------------------------------------------------- -// -// ---------------------------------------------------------------------------- -// -void CCPNotificationHandler::ErrorComplete( TInt aErrCode ) - { - if( iIsReadyToSend && iMessage.IsNull() == EFalse ) - { - iMessage.Complete( aErrCode ); - iIsReadyToSend = EFalse; - } - } - -// ---------------------------------------------------------------------------- -// -// ---------------------------------------------------------------------------- -// -TBool CCPNotificationHandler::SendChangeInfoListL( - const CLiwDefaultList* aListOfMaps ) - { - CP_DEBUG( _L8("CCPNotificationHandler::SendChangeInfoListL()") ); - iChangeInfoList->Reset( ); - TBool sent(EFalse); - //for every observer in session - THashMapIter iter( iFilters ); - const CCPLiwMap*const* filter = iter.NextValue( ); - while( filter ) - { - - CLiwDefaultList* listOfMatchingMaps = CLiwDefaultList::NewLC( ); - - //for every item in the input list - for ( TInt j = 0; j < aListOfMaps->Count( ); j++ ) - { - CLiwDefaultMap* map = CLiwDefaultMap::NewLC( ); - TLiwVariant variant; - variant.PushL( ); - aListOfMaps->AtL( j, variant ); - variant.Get( *map ); - if ( IsProperForFilterL( *map, **filter ) ) - { - listOfMatchingMaps->AppendL( TLiwVariant( map ) ); - } - CleanupStack::PopAndDestroy( &variant ); - CleanupStack::PopAndDestroy( map ); - } - if ( listOfMatchingMaps->Count( ) ) - { - //append transaction id - listOfMatchingMaps->AppendL( TLiwVariant( *iter.CurrentKey() )); - iChangeInfoList->AppendL( TLiwGenericParam( KChangeInfo, - TLiwVariant( listOfMatchingMaps ) ) ); - } - CleanupStack::PopAndDestroy( listOfMatchingMaps ); - filter = iter.NextValue( ); - } - - if( iChangeInfoList->Count( ) ) - { - TPckgBuf sizeDes( iChangeInfoList->Size( ) ); - TInt err = iMessage.Write( KReturnPosition, sizeDes ); - iMessage.Complete( err ); - sent = ETrue; - } - return sent; - } - -// ---------------------------------------------------------------------------- -// -// ---------------------------------------------------------------------------- -// -void CCPNotificationHandler::GetPropertyL( const CLiwDefaultMap& aMap, - const TDesC8& aProperty, RBuf& aResult ) - { - TLiwVariant value; - value.PushL( ); - if ( aMap.FindL( aProperty, value ) ) - { - TPtrC result( KNullDesC ); - value.Get( result ); - aResult.CreateL( result ); - } - CleanupStack::PopAndDestroy( &value ); - } - -// ---------------------------------------------------------------------------- -// -// ---------------------------------------------------------------------------- -// -TBool CCPNotificationHandler::CheckIdL( const CLiwDefaultMap& aMap, - const CCPLiwMap& aFilter ) - { - TBool result = EFalse; - TInt32 id( 0); - if ( aFilter.GetProperty( KId, id ) ) - { - TLiwVariant value; - value.PushL( ); - if ( aMap.FindL( KId, value ) ) - { - TUint idToCompare( 0); - if ( value.Get( idToCompare ) ) - { - if ( id == idToCompare ) - { - result = ETrue; - } - } - } - CleanupStack::PopAndDestroy( &value ); - } - return result; - } - -// ---------------------------------------------------------------------------- -// -// ---------------------------------------------------------------------------- -// -TBool CCPNotificationHandler::CheckPropertiesL( const CLiwDefaultMap& aMap, - const CCPLiwMap& aFilter ) - { - TBool result( EFalse ); - TBool publisherName( ETrue ); - TBool contentType( ETrue ); - TBool contentId( ETrue ); - RBuf publisher; - publisher.CleanupClosePushL(); - - if ( aFilter.GetPropertyL( KPublisherId, publisher ) ) - { - if ( publisher != KAll ) - { - RBuf str2compare; - str2compare.CleanupClosePushL(); - GetPropertyL( aMap, KPublisherId, str2compare ); - if ( publisher!=str2compare ) - { - publisherName = EFalse; - } - CleanupStack::PopAndDestroy( &str2compare ); - } - } - RBuf content; - content.CleanupClosePushL(); - if ( aFilter.GetPropertyL( KContentType, content ) ) - { - if ( content != KAll ) - { - RBuf str2compare; - str2compare.CleanupClosePushL(); - GetPropertyL( aMap, KContentType, str2compare ); - if ( content!=str2compare ) - { - contentType = EFalse; - } - CleanupStack::PopAndDestroy( &str2compare ); - } - } - RBuf content_id; - content_id.CleanupClosePushL(); - if ( (publisher != KAll)||(content != KAll) ) - { - if ( aFilter.GetPropertyL( KContentId, content_id ) ) - { - if ( content_id != KAll ) - { - RBuf str2compare; - str2compare.CleanupClosePushL(); - GetPropertyL( aMap, KContentId, str2compare ); - if ( content_id!=str2compare ) - { - contentId = EFalse; - } - CleanupStack::PopAndDestroy( &str2compare ); - } - } - } - if ( publisherName && contentType && contentId ) - { - result = ETrue; - } - CleanupStack::PopAndDestroy( &content_id ); - CleanupStack::PopAndDestroy( &content ); - CleanupStack::PopAndDestroy( &publisher ); - return result; - } - -// ---------------------------------------------------------------------------- -// -// ---------------------------------------------------------------------------- -// -TBool CCPNotificationHandler::CheckOperationTypeL( const CLiwDefaultMap& aMap, - const CCPLiwMap& aFilter ) - { - TBool result = ETrue; - RBuf operation; - operation.CleanupClosePushL(); - if ( aFilter.GetPropertyL( KOperation, operation ) ) - { - result = EFalse; - TLiwVariant value; - value.PushL( ); - if ( aMap.FindL( KOperation, value ) ) - { - TPtrC operationToCompare( KNullDesC ); - if ( value.Get( operationToCompare ) ) - { - if ( operation.Find( operationToCompare ) != KErrNotFound ) - { - result = ETrue; - } - } - } - CleanupStack::PopAndDestroy( &value ); - } - CleanupStack::PopAndDestroy( &operation ); - return result; - } - -// ---------------------------------------------------------------------------- -// -// ---------------------------------------------------------------------------- -// -TBool CCPNotificationHandler::CheckRegistryTypeL( const CLiwDefaultMap& aMap, - const CCPLiwMap& aFilter ) - { - TBool result = ETrue; - RBuf type; - type.CleanupClosePushL(); - if ( aFilter.GetPropertyL( KType, type ) ) - { - result = EFalse; - TLiwVariant value; - value.PushL( ); - if ( aMap.FindL( KType, value ) ) - { - TPtrC typeToCompare( KNullDesC ); - if ( value.Get( typeToCompare ) ) - { - if ( type.Find( typeToCompare ) != KErrNotFound ) - { - result = ETrue; - } - } - } - CleanupStack::PopAndDestroy( &value ); - } - CleanupStack::PopAndDestroy( &type ); - return result; - } diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingserver/cpserver/src/cpserver.cpp --- a/contentpublishingsrv/contentpublishingserver/cpserver/src/cpserver.cpp Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,393 +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: Content publisher Server -* -*/ - - -#include -#include -#include - -#include "cpublisherregistrymap.h" -#include "cpserver.h" -#include "cpglobals.h" -#include "cpdebug.h" -#include "cpserversession.h" -#include "cpserverdatamanager.h" -#include "cpactionhandlerthread.h" - - -// Policy Server -// ============================================================================ -const TUint KServerPolicyRangeCount = 3; -const TInt KServerPolicyRanges[KServerPolicyRangeCount] = - { - 0, // range 0 -- ECpServerExecuteAction - 1 - ECpServerGetListSize, // range ECpServerGetListSize -- ECpServerExecuteAction - 1 - ECpServerExecuteAction - // range ECpServerExecuteAction -- inf - }; - -const TUint8 KServerPolicyElementsIndex[KServerPolicyRangeCount] = - { - 0, // applies to 0th range - 1, // applies to 1st range - CPolicyServer::EAlwaysPass - }; - -const CPolicyServer::TPolicyElement KServerPolicyElements[] = - { - { - _INIT_SECURITY_POLICY_C1(ECapability_None), CPolicyServer::EFailClient - }, - { - _INIT_SECURITY_POLICY_C1(ECapability_None), CPolicyServer::EFailClient - } - }; - -const CPolicyServer::TPolicy KServerPolicy = - { - CPolicyServer::EAlwaysPass, // specifies all connect attempts should pass - KServerPolicyRangeCount, - KServerPolicyRanges, - KServerPolicyElementsIndex, - KServerPolicyElements - }; -// ============================================================================ - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CCPServer::CCPServer -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CCPServer::CCPServer( TInt aPriority ) : - CPolicyServer( aPriority, KServerPolicy, EUnsharableSessions) - { - } - -// ----------------------------------------------------------------------------- -// CCPServer::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CCPServer::ConstructL() - { - CP_DEBUG( _L8("CCPServer::ConstructL()" ) ); - StartL(KCPServerName); - iBURListener = CCPServerBURListener::NewL(this); - iCountSession = 0; - iBURLock = iBURListener->CheckBUR(); - iDataManager = CCPDataManager::NewL(iBURLock); - iActionHandlerThread = CCPActionHandlerThread::NewL(); - if (!iBURLock) - { - TRAP_IGNORE( DeactivatePublishersL() ); - } - } - -// ----------------------------------------------------------------------------- -// CCPServer::NewL -// Two-phased constructor. -// -------------------------------------- --------------------------------------- -// -CCPServer* CCPServer::NewLC() - { - CP_DEBUG( _L8("CCPServer::NewLC()" ) ); - CCPServer* self = new( ELeave ) CCPServer( EPriorityNormal ); - CleanupStack::PushL( self ); - self->ConstructL( ); - return self; - } - -// ----------------------------------------------------------------------------- -// CCPServer::~CCPServer() -// Destructor. -// -------------------------------------- --------------------------------------- -// -CCPServer::~CCPServer() - { - CP_DEBUG( _L8("CCPServer::~CCPServer()" ) ); - for ( TInt i(0); i< iNotifications.Count( ); i++ ) - { - iNotifications[i]->Close( ); - } - iNotifications.Close( ); - delete iDataManager; - delete iActionHandlerThread; - delete iBURListener; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPServer::RemoveSession() - { - CP_DEBUG( _L8("CCPServer::RemoveSession()" ) ); - iCountSession--; - if ( !iCountSession ) - { - Stop( ); - } - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPServer::AddSession() - { - CP_DEBUG( _L8("CCPServer::AddSession()" ) ); - iCountSession++; - } - -// --------------------------------------------------------------------------- -// CCPServer::HandleBUREventL -// --------------------------------------------------------------------------- -// -void CCPServer::HandleBUREventL( TBURStatus aStatus ) - { - CP_DEBUG( _L8("CCPServer::HandleBUREventL()" ) ); - if ( (aStatus == EBURStatusBackup ) || (aStatus == EBURStatusRestore ) ) - { - iBURLock = ETrue; - iDataManager->CloseDatabase( ); - } - else - { - iDataManager->OpenDatabaseL( ); - iBURLock = EFalse; - } - } - -// --------------------------------------------------------------------------- -// CCPServer::GetLock -// --------------------------------------------------------------------------- -// -TBool CCPServer::GetLock() - { - return iBURLock; - } - -// ----------------------------------------------------------------------------- -// CCPServer::GetNotifications -// ----------------------------------------------------------------------------- -// -RPointerArray& CCPServer::GetNotifications( ) - { - return iNotifications; - } - - -// ----------------------------------------------------------------------------- -// CCPServer::NewSessionL -// Create new session. -// ----------------------------------------------------------------------------- -// -CSession2* CCPServer::NewSessionL( const TVersion& /*aVersion*/, - const RMessage2& /*aMessage*/) const - { - CP_DEBUG( _L8("CCPServer::NewSessionL()" ) ); - TPointersForSession passer; - passer.iDataManager = iDataManager; - passer.iServer = const_cast(this); - passer.iActionHandlerThread = iActionHandlerThread; - return CCPServerSession::NewL( passer ); - } - -// ----------------------------------------------------------------------------- -// CCPServer::RunError -// RunError is called when RunL leaves. -// ----------------------------------------------------------------------------- -// -TInt CCPServer::RunError( TInt /*aError*/) - { - ReStart( ); - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CCPServer::PanicClient -// Panic client. -// ----------------------------------------------------------------------------- -// -void CCPServer::PanicClient( const RMessage2& aMessage, TCPServerPanic aPanic ) - { - aMessage.Panic( KCPServerName, aPanic ); - } - -// ----------------------------------------------------------------------------- -// CCPServer::PanicServer -// Panic server. -// ----------------------------------------------------------------------------- -// -void CCPServer::PanicServer( TCPServerPanic aPanic ) - { - User::Panic( KCPServerName, aPanic ); - } - - -// ----------------------------------------------------------------------------- -// CCPServer::SendNotificationL -// ----------------------------------------------------------------------------- -// -void CCPServer::AppendNotificationL( CCPLiwMap* aMap ) - { - aMap->InsertL( KType, TLiwVariant( KPublisher ) ); - aMap->InsertL( KOperation, TLiwVariant( KOperationUpdate ) ); - CLiwDefaultList* list = CLiwDefaultList::NewLC( ); - list->AppendL( TLiwVariant( aMap ) ); - iNotifications.AppendL( list ); - CleanupStack::Pop( list ); - } - -// ----------------------------------------------------------------------------- -// CCPServer::Stop -// Stop serwer -// ----------------------------------------------------------------------------- -// -void CCPServer::Stop() - { - CP_DEBUG( _L8("CCPServer::Stop()" ) ); - CActiveScheduler::Stop( ); - } - -// ----------------------------------------------------------------------------- -// CCPServer::ThreadStart(void) -// Starts server. -// ----------------------------------------------------------------------------- -// -TInt CCPServer::ThreadStart( void ) - { - __UHEAP_MARK; - // Create the server, if one with this name does not already exist. - TFindServer findCountServer( KCPServerName ); - TFullName name; - - CTrapCleanup* trapCleanup = CTrapCleanup::New(); - if ( !trapCleanup ) - { - PanicServer( ECPServerSrvCreateServer ); - } - CActiveScheduler* activeScheduler = new CActiveScheduler; - if ( !activeScheduler ) - { - PanicServer( ECPServerSrvCreateServer ); - } - CActiveScheduler::Install( activeScheduler ); - - // Need to check that the server exists. - if ( findCountServer.Next( name ) != KErrNone ) - { - User::RenameThread( KCPServerName ); - - TRAPD( err, CreateAndRunServerL() ); - if ( err != KErrNone ) - { - PanicServer( ECPServerSrvCreateServer ); - } - } - - delete activeScheduler; - delete trapCleanup; - __UHEAP_MARKEND; - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CCPServer::CreateAndRunServerL(void) -// Creates and runs server. -// ----------------------------------------------------------------------------- -// -void CCPServer::CreateAndRunServerL( void ) - { - // Construct server - // - CCPServer* server = CCPServer::NewLC( ); - // Initialisation complete, now signal the client - // - RProcess::Rendezvous( KErrNone ); - CActiveScheduler::Start( ); - CleanupStack::PopAndDestroy( server ); - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void CCPServer::DeactivatePublishersL() - { - CLiwGenericParamList* publishers = CLiwGenericParamList::NewLC( ); - CCPLiwMap* map = CPublisherRegistryMap::NewLC( ); - iDataManager->GetActivePublishersL( publishers ); - TInt pos( 0 ); - while( pos != KErrNotFound ) - { - publishers->FindFirst( pos, KListMap ); - - if( pos != KErrNotFound ) - { - TLiwVariant variant = ( *publishers )[pos++].Value( ); - map->Reset( ); - variant.Get( *map ); - - // update flag value in the database - TRAP_IGNORE( ResetAndUpdateFlagL( map ) ); - - //append update notification - TRAP_IGNORE( AppendNotificationL( map ) ); - - variant.Reset( ); - } - } - CleanupStack::PopAndDestroy( map ); - CleanupStack::PopAndDestroy( publishers ); - } - -// ----------------------------------------------------------------------------- -// CCPServer::ResetAndUpdateFlagL -// Resets Activate flag and update item in the DB -// ----------------------------------------------------------------------------- -// -void CCPServer::ResetAndUpdateFlagL( CCPLiwMap* aMap ) - { - TInt32 flag(0); - if( !aMap->GetProperty( KFlag, flag )) - { - User::Leave(KErrNotFound); - } - aMap->Remove( KFlag ); - flag &= 0xFFFFFFFE; - aMap->InsertL( KFlag, TLiwVariant( flag ) ); - iDataManager->AddDataL( *aMap ); - } - -// ============================= LOCAL FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// E32Main entry point. -// Returns: KErrNone -// ----------------------------------------------------------------------------- -// -TInt E32Main() - { - return CCPServer::ThreadStart( ); - } - -// End of File diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingserver/cpserver/src/cpserveractionmanager.cpp --- a/contentpublishingsrv/contentpublishingserver/cpserver/src/cpserveractionmanager.cpp Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,198 +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: -* -*/ - -#include -#include -#include - -#include "cpserveractionmanager.h" -#include "cpdebug.h" -#include "cpglobals.h" - -using namespace LIW; - -// --------------------------------------------------------------------------- -// C++ destructor -// --------------------------------------------------------------------------- -// -CCPActionManager::~CCPActionManager() - { - if ( iInterface ) - { - iInterface->Close( ); - } - delete iServiceHandler; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -CCPActionManager* CCPActionManager::NewL() - { - CCPActionManager* self = CCPActionManager::NewLC( ); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -CCPActionManager* CCPActionManager::NewLC() - { - CCPActionManager* self = new( ELeave ) CCPActionManager; - CleanupStack::PushL( self ); - self->ConstructL( ); - return self; - } - -// --------------------------------------------------------------------------- -// C++ constructor. -// --------------------------------------------------------------------------- -// -CCPActionManager::CCPActionManager() - { - - } - -// --------------------------------------------------------------------------- -// Standard 2nd phase constructor. -// --------------------------------------------------------------------------- -// -void CCPActionManager::ConstructL() - { - CP_DEBUG( _L8("CCPActionManager::ConstructL()") ); - iServiceHandler = CLiwServiceHandler::NewL( ); - } - -// ----------------------------------------------------------------------------- -// CCPActionManager::ExecuteL -// --------------- -------------------------------------------------------------- -// -void CCPActionManager::ExecuteL( const CLiwGenericParamList& aList ) - { - CP_DEBUG( _L8("CCPActionManager::ExecuteL()") ); - if ( !iInterface ) - { - PrepareServiceL( iInterface ); - } - CLiwGenericParamList* inparam = CLiwGenericParamList::NewLC( ); - CLiwGenericParamList* outparam = CLiwGenericParamList::NewLC( ); - PrepareInputListL( aList, *inparam ); - - iInterface->ExecuteCmdL( KCmdExecute, *inparam, *outparam ) ; - TInt pos(0); - outparam->FindFirst( pos, EGenericParamError ); - if ( pos != KErrNotFound ) - { - User::LeaveIfError( ( *outparam )[pos].Value().AsTInt32( ) ); - } - else - { - User::Leave( KErrNotFound ); - } - CleanupStack::PopAndDestroy( outparam ); - CleanupStack::PopAndDestroy( inparam ); - } - -// ----------------------------------------------------------------------------- -// CCPActionManager::ExecuteL -// --------------- -------------------------------------------------------------- -// -void CCPActionManager::PrepareServiceL( MLiwInterface*& aInterface ) - { - CP_DEBUG( _L8("CCPActionManager::PrepareServiceL()") ); - CLiwGenericParamList* inparam = &(iServiceHandler->InParamListL( ) ); - CLiwGenericParamList* outparam = &(iServiceHandler->OutParamListL( ) ); - CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL( 1, - KActionHandlerInterface, KActionHandlerService ); - CleanupStack::PushL( crit ); - crit->SetServiceClass( TUid::Uid( KLiwClassBase ) ); - RCriteriaArray array; - CleanupClosePushL( array ); - array.AppendL( crit ); - iServiceHandler->AttachL( array ); - iServiceHandler->ExecuteServiceCmdL( *crit, *inparam, *outparam ); - CleanupStack::PopAndDestroy( &array ); - CleanupStack::PopAndDestroy( crit ); - TInt pos = 0; - outparam->FindFirst( pos, KActionHandlerInterface ); - if ( pos != KErrNotFound ) - { - aInterface = ( *outparam )[pos].Value().AsInterface( ); - } - else - { - User::Leave( KErrNotFound ); - } - } - -// ----------------------------------------------------------------------------- -// CCPActionManager::PrepareInputListL -// --------------- -------------------------------------------------------------- -// -void CCPActionManager::PrepareInputListL( const CLiwGenericParamList& aList, - CLiwGenericParamList& aTarget ) - { - CP_DEBUG( _L8("CCPActionManager::PrepareInputListL()") ); - const TLiwGenericParam* param= NULL; - TInt pos( 0); - param = aList.FindFirst( pos, KListMap, EVariantTypeMap ); - if ( param && pos !=KErrNotFound ) - { - CLiwDefaultMap* map = CLiwDefaultMap::NewLC( ); - param->Value().Get( *map ); - ExtractUidAndMapL( *map, aTarget ); - CleanupStack::PopAndDestroy( map ); - } - else - { - User::Leave( KErrNotFound ); - } - } - -// ----------------------------------------------------------------------------- -// CCPActionManager::ExtractUidAndMapL -// --------------- -------------------------------------------------------------- -// -void CCPActionManager::ExtractUidAndMapL( const CLiwDefaultMap& aMap, - CLiwGenericParamList& aTarget ) - { - CP_DEBUG( _L8("CCPActionManager::ExtractUidAndMapL()") ); - TLiwVariant variant; - variant.PushL( ); - if ( aMap.FindL( KActionMap, variant ) ) - { - CLiwDefaultMap* map = CLiwDefaultMap::NewLC( ); - variant.Get( *map ); - if ( map->FindL( KDataForActionHandler, variant ) ) - { - TLiwGenericParam param( KDataForActionHandler, variant); - aTarget.AppendL( param ); - } - if ( map->FindL( KPluginUid, variant ) ) - { - TLiwGenericParam param( KPluginUid, variant); - aTarget.AppendL( param ); - } - CleanupStack::PopAndDestroy( map ); - } - - CleanupStack::PopAndDestroy( &variant ); - } - diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingserver/cpserver/src/cpserverburlistener.cpp --- a/contentpublishingsrv/contentpublishingserver/cpserver/src/cpserverburlistener.cpp Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,148 +0,0 @@ -/* -* 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: Backup and restore events listener. - * -*/ - - -#include - -#include "cpserverburlistener.h" -#include "cpdebug.h" -// conn - "Declaration of Types and Constants for Secure Backup and Restore" namespace, see sbdefs.h -using namespace conn; - -// ============================ MEMBER FUNCTIONS ============================= - -// ----------------------------------------------------------------------------- -// CSpaceDataStorageBURListener::CSpaceDataStorageBURListener -// C++ default constructor -// ----------------------------------------------------------------------------- -// -CCPServerBURListener::CCPServerBURListener( MBURListenerCallback* aCallback ) : - CActive(EPriorityNormal) - { - CActiveScheduler::Add( this ); - iCallback = aCallback; - - // Prepare automatically - iProperty.Attach( KUidSystemCategory, KUidBackupRestoreKey ); - SetActive( ); - iProperty.Subscribe( iStatus ); - } - -// ----------------------------------------------------------------------------- -// CSpaceDataStorageBURListener::ConstructL -// S2nd phase constructor. -// ----------------------------------------------------------------------------- -// -void CCPServerBURListener::ConstructL() - { - - } - -// --------------------------------------------------------------------------- -// CSpaceDataStorageBURListener::NewL -// --------------------------------------------------------------------------- -// -CCPServerBURListener* CCPServerBURListener::NewL( - MBURListenerCallback* aCallback ) - { - CCPServerBURListener* self = new (ELeave) - CCPServerBURListener( aCallback ); - CleanupStack::PushL( self ); - self->ConstructL( ); - CleanupStack::Pop( self ); - - return self; - } - -// --------------------------------------------------------------------------- -// CSpaceDataStorageBURListener::~CSpaceDataStorageBURListener -// --------------------------------------------------------------------------- -// -CCPServerBURListener::~CCPServerBURListener() - { - Cancel( ); - iProperty.Close( ); - } - -// --------------------------------------------------------------------------- -// CSpaceDataStorageBURListener::DoCancel -// --------------------------------------------------------------------------- -// -void CCPServerBURListener::DoCancel() - { - iProperty.Cancel( ); - } - -// --------------------------------------------------------------------------- -// CSpaceDataStorageBURListener::RunError -// --------------------------------------------------------------------------- -// -TInt CCPServerBURListener::RunError( TInt /*aError*/) - { - // No need to do anything - return KErrNone; - } - -// --------------------------------------------------------------------------- -// CCPServerBURListener::CheckStatus -// --------------------------------------------------------------------------- -// -TBool CCPServerBURListener::CheckBUR() - { - TInt pnsStatus; - TInt err; - err = iProperty.Get( KUidSystemCategory, KUidBackupRestoreKey, pnsStatus ); - if ( pnsStatus < EBURBackupFull && err >= KErrNone ) - { - return EFalse; - } - else - { - return ETrue; - } - } - -// --------------------------------------------------------------------------- -// CSpaceDataStorageBURListener::RunL -// --------------------------------------------------------------------------- -// -void CCPServerBURListener::RunL() - { - CP_DEBUG( _L8("CCPServerBURListener::RunL()") ); - // Re-issue request before notifying - SetActive( ); - iProperty.Subscribe( iStatus ); - - TInt pnsStatus; - User::LeaveIfError( iProperty.Get( KUidSystemCategory, - KUidBackupRestoreKey, pnsStatus ) ); - - MBURListenerCallback::TBURStatus - burStatus(MBURListenerCallback::EBURStatusNone); - if ( pnsStatus & (EBURBackupFull | EBURBackupPartial ) ) - { - burStatus = MBURListenerCallback::EBURStatusBackup; - } - else if ( pnsStatus & (EBURRestoreFull | EBURRestorePartial ) ) - { - burStatus = MBURListenerCallback::EBURStatusRestore; - } - - iCallback->HandleBUREventL( burStatus ); - } - -// End of File diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingserver/cpserver/src/cpserverdatamanager.cpp --- a/contentpublishingsrv/contentpublishingserver/cpserver/src/cpserverdatamanager.cpp Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,545 +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: - * -*/ - - -#include -#include -#include - -#include "cpserverdatamanager.h" -#include "ccontentmap.h" -#include "cpublisherregistrymap.h" -#include "cpstorage.h" -#include "cpdebug.h" -#include "cpstoragefactory.h" -#include "cpglobals.h" -#include "cpserversession.h" -#include "cpnotificationhandler.h" - -using namespace LIW; - -// --------------------------------------------------------------------------- -// C++ destructor -// --------------------------------------------------------------------------- -// -CCPDataManager::~CCPDataManager() - { - iNotificationsArray.Close( ); - delete iStorage; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -CCPDataManager* CCPDataManager::NewL( TBool aBool ) - { - CCPDataManager* self = CCPDataManager::NewLC( aBool ); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -CCPDataManager* CCPDataManager::NewLC( TBool aBool ) - { - CCPDataManager* self = new( ELeave ) CCPDataManager; - CleanupStack::PushL( self ); - self->ConstructL( aBool ); - return self; - } - -// --------------------------------------------------------------------------- -// C++ constructor. -// --------------------------------------------------------------------------- -// -CCPDataManager::CCPDataManager() - { - - } - -// --------------------------------------------------------------------------- -// Standard 2nd phase constructor. -// --------------------------------------------------------------------------- -// -void CCPDataManager::ConstructL( TBool aBool ) - { - CP_DEBUG( _L8("CCPDataManager::ConstructL()") ); - if ( !aBool ) - { - iStorage = StorageFactory::NewDatabaseL( ); - } - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -TUint CCPDataManager::AddDataL( CCPLiwMap& aMap ) - { - CP_DEBUG( _L8("CCPDataManager::AddDataL()") ); - __ASSERT_DEBUG( iStorage , User::Panic( _L("cpserver"), 0 ) ); - - CCPLiwMap* getlistmap = CreateMapForGetlistLC( aMap ); - - TBool activateMap = aMap.GetActivateInfo(); - TBool activateDB ( EFalse ); - TBool activateSupport =aMap.ActivateActionSupport( ); - - if( activateSupport ) - { - activateDB = GetActivateInfoL( getlistmap ); - } - - TInt id = iStorage->AddL( &aMap ); - - if( activateSupport ) - { - if ( activateMap && !activateDB ) - { - // append action trigger for activate - aMap.InsertL( KActionTrigger, TLiwVariant( KActivateTrigger ) ); - } - if ( !activateMap && activateDB ) - { - // append action trigger for deactivate - aMap.InsertL( KActionTrigger, TLiwVariant( KDeactivateTrigger ) ); - } - //remove flag from map ( needed because map will be used in getlist - //operation ) - aMap.Remove( KFlag ); - } - - CleanupStack::PopAndDestroy( getlistmap ); - - return id; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPDataManager::GetListL( const CCPLiwMap& aMap, - CLiwGenericParamList& aOutParamList ) - { - CP_DEBUG( _L8("CCPDataManager::GetListL()") ); - __ASSERT_DEBUG( iStorage , User::Panic( _L("cpserver"), 0 ) ); - iStorage->GetListL( &aMap, aOutParamList ); - } -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -TInt CCPDataManager::GetActionL( const CCPLiwMap& aMap, - CLiwGenericParamList& aOutParamList, CLiwDefaultList* aNotificationList ) - { - CP_DEBUG( _L8("CCPDataManager::GetActionL()") ); - __ASSERT_DEBUG( iStorage , User::Panic( _L("cpserver"), 0 ) ); - - CLiwGenericParamList* paramList = CLiwGenericParamList::NewLC( ); - TInt result( KErrNone ); - TRAP( result, iStorage->GetListL( &aMap, *paramList ) ); - RBuf8 actionTrigger; - actionTrigger.CleanupClosePushL(); - - if ( aMap.GetPropertyL( KActionTrigger, actionTrigger ) ) - { - const TLiwGenericParam* param; - TInt pos( 0); - - param = paramList->FindFirst( pos, KListMap ); - //at least one param should be valid to preceed - if ( !param || pos == KErrNotFound ) - { - BuildDefaultChangeInfoL(&aMap, aNotificationList); - } - - //iteration through paramList items - while ( param && pos != KErrNotFound ) - { - BuildChangeInfoL( &aMap, param, aNotificationList ); - FillActionParamListL( aOutParamList, param, actionTrigger ); - param = paramList->FindNext( pos, KListMap ); - } - } - else - { - User::Leave( KErrNotFound ); - } - CleanupStack::PopAndDestroy( &actionTrigger ); - CleanupStack::PopAndDestroy( paramList ); - return result; - } - - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPDataManager::FillActionParamListL( - CLiwGenericParamList& aOutParamList, - const TLiwGenericParam* aParam, - RBuf8 & aActionTrigger) - { - CP_DEBUG( _L8("CCPDataManager::FillActionParamListL()") ); - __ASSERT_DEBUG( iStorage , User::Panic( _L("cpserver"), 0 ) ); - - RBuf8 actionBinaries; - actionBinaries.CleanupClosePushL(); - ExtractActionL( aParam, actionBinaries ); - - RDesReadStream str(actionBinaries); - CleanupClosePushL( str ); - CLiwDefaultMap* actionMap = CLiwDefaultMap::NewLC( str ); - ExtractTriggerL( aOutParamList, actionMap, aActionTrigger ); - - CleanupStack::PopAndDestroy( actionMap ); - CleanupStack::PopAndDestroy( &str ); - CleanupStack::PopAndDestroy( &actionBinaries ); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPDataManager::GetActivePublishersL( CLiwGenericParamList* aResultList ) - { - CCPLiwMap *map = CPublisherRegistryMap::NewLC(); - map->InsertL( KFlag, TLiwVariant( TUint( 0 | EActivate ) ) ); - iStorage->GetListL( map, *aResultList ); - CleanupStack::PopAndDestroy(map); - } - - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPDataManager::ExtractTriggerL( CLiwGenericParamList& aOutParamList, - const CLiwDefaultMap* aMap, const TDesC8& aTrigger ) - { - CP_DEBUG( _L8("CCPDataManager::GetActionL()") ); - CLiwDefaultMap* targetMap = CLiwDefaultMap::NewLC( ); - TLiwVariant variant; - variant.PushL( ); - if ( aMap->FindL( aTrigger, variant ) ) - { - targetMap->InsertL( KActionMap, variant ); - } - else - { - User::Leave( KErrNotFound ); - } - - TLiwGenericParam result( KListMap, TLiwVariant( targetMap )); - aOutParamList.AppendL( result ); - CleanupStack::PopAndDestroy( &variant ); - CleanupStack::PopAndDestroy( targetMap ); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPDataManager::RemoveDataL( const CCPLiwMap& aMap ) - { - CP_DEBUG( _L8("CCPDataManager::RemoveData()") ); - __ASSERT_DEBUG( iStorage , User::Panic( _L("cpserver"), 0 ) ); - iStorage->RemoveL( &aMap ); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPDataManager::AddObserverL( - CCPNotificationHandler* aNotificationHandler ) - { - CP_DEBUG( _L8("CCPDataManager::AddObserverL()") ); - __ASSERT_DEBUG( iStorage , User::Panic( _L("cpserver"), 0 ) ); - iNotificationsArray.AppendL( aNotificationHandler ); - if ( iNotificationsArray.Count( ) == 1 ) - { - iStorage->SetCallback( this ); - } - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPDataManager::RemoveObserver( - CCPNotificationHandler* aNotificationHandler ) - { - CP_DEBUG( _L8("CCPDataManager::RemoveObserver()") ); - TInt index = iNotificationsArray.Find( aNotificationHandler ); - __ASSERT_DEBUG( index >= 0 , User::Panic( _L("cpserver"), 0 ) ); - iNotificationsArray.Remove( index ); - if ( iNotificationsArray.Count( ) == 0 ) - { - iStorage->SetCallback( 0 ); - } - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPDataManager::HandleChangeL( CLiwDefaultList* aListOfMaps ) - { - CP_DEBUG( _L8("CCPDataManager::HandleChangeL()") ); - //for every session - for ( TInt i = 0; iErrorComplete( error ); - } - } - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPDataManager::CloseDatabase() - { - CP_DEBUG( _L8("CCPDataManager::CloseDatabase()") ); - delete iStorage; - iStorage = NULL; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPDataManager::OpenDatabaseL() - { - CP_DEBUG( _L8("CCPDataManager::OpenDatabaseL()") ); - if ( !iStorage ) - { - iStorage = StorageFactory::NewDatabaseL( ); - - // Restore storage observers - if ( iNotificationsArray.Count() > 0 ) - { - iStorage->SetCallback( this ); - } - } - } -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPDataManager::SendNotificationL( CLiwDefaultList* aListOfMaps, - TInt aIndex ) - { - CP_DEBUG( _L8("CCPDataManager::SendNotificationL()") ); - iNotificationsArray[aIndex]->SendNotificationL( aListOfMaps ); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPDataManager::ExtractActionL( const TLiwGenericParam* aParam, RBuf8& aAction ) - { - CP_DEBUG( _L8("CCPDataManager::ExtractActionL()") ); - CLiwDefaultMap* map = CLiwDefaultMap::NewLC( ); - if ( !aParam->Value().Get( *map ) ) - { - User::Leave( KErrArgument ); - } - - TLiwVariant variant; variant.PushL( ); - TPtrC8 tempBuf( KNullDesC8 ); - if ( map->FindL( KActionMap, variant ) - && variant.Get( tempBuf ) ) - { - aAction.CreateL( tempBuf ); - } - else - { - User::Leave( KErrArgument ); - } - - CleanupStack::PopAndDestroy( &variant ); - CleanupStack::PopAndDestroy( map ); - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -CCPLiwMap* CCPDataManager::CreateMapForGetlistLC( const CCPLiwMap& aMap ) - { - CCPLiwMap *resultmap = CPublisherRegistryMap::NewLC(); - RBuf publisher; - publisher.CleanupClosePushL(); - RBuf content_type; - content_type.CleanupClosePushL(); - RBuf content_id; - content_id.CleanupClosePushL(); - aMap.GetPropertyL( KContentType, content_type ); - aMap.GetPropertyL( KContentId, content_id ); - aMap.GetPropertyL( KPublisherId, publisher ); - resultmap->InsertL( KPublisherId, TLiwVariant( publisher )); - resultmap->InsertL( KContentId, TLiwVariant( content_id )); - resultmap->InsertL( KContentType, TLiwVariant( content_type )); - CleanupStack::PopAndDestroy( &content_id ); - CleanupStack::PopAndDestroy( &content_type ); - CleanupStack::PopAndDestroy( &publisher ); - return resultmap; - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -TBool CCPDataManager::GetActivateInfoL( const CCPLiwMap* aMap ) - { - TBool result( EFalse ); - CLiwGenericParamList* outList = CLiwGenericParamList::NewLC(); - TRAPD(err,GetListL(*aMap,*outList)); - if (err == KErrNone) - { - TInt pos( 0 ); - outList->FindFirst( pos, KListMap ); - if( pos != KErrNotFound ) - { - TLiwVariant variant = (*outList)[pos].Value(); - CLiwDefaultMap *map = CLiwDefaultMap::NewLC(); - variant.Get( *map ); - if (map->FindL( KFlag, variant )) - { - TUint flag; - variant.Get( flag ); - result = flag & EActivate; - } - CleanupStack::PopAndDestroy( map ); - variant.Reset(); - } - } - CleanupStack::PopAndDestroy( outList ); - return result; - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void CCPDataManager::BuildChangeInfoL( const CCPLiwMap* aMap, - const TLiwGenericParam* aParam, - CLiwDefaultList* aChangeInfoList ) - { - TLiwVariant resultVar = aParam->Value(); - resultVar.PushL(); - CLiwDefaultMap* changeInfoMap = CLiwDefaultMap::NewLC(); - CLiwDefaultMap* resultMap = CLiwDefaultMap::NewLC(); - resultVar.Get( *resultMap ); - - CopyVariantL(KId, resultMap, changeInfoMap ); - CopyVariantL(KPublisherId, resultMap, changeInfoMap ); - CopyVariantL(KContentType, resultMap, changeInfoMap ); - CopyVariantL(KContentId, resultMap, changeInfoMap ); - CopyVariantL(KFlag, resultMap, changeInfoMap ); - CopyVariantL(KType, aMap, changeInfoMap ); - CopyVariantL(KActionTrigger, aMap, changeInfoMap ); - CopyActionTrigger16L( aMap, changeInfoMap ); - - changeInfoMap->InsertL( KOperation, TLiwVariant( KOperationExecute ) ); - - aChangeInfoList->AppendL( TLiwVariant( changeInfoMap ) ); - CleanupStack::PopAndDestroy( resultMap ); - CleanupStack::PopAndDestroy( changeInfoMap ); - CleanupStack::PopAndDestroy( &resultVar ); - } - - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void CCPDataManager::BuildDefaultChangeInfoL( const CCPLiwMap* aMap, - CLiwDefaultList* aChangeInfoList ) - { - CLiwDefaultMap* changeInfoMap = CLiwDefaultMap::NewLC(); - - CopyVariantL(KId, aMap, changeInfoMap ); - CopyVariantL(KPublisherId, aMap, changeInfoMap ); - CopyVariantL(KContentType, aMap, changeInfoMap ); - CopyVariantL(KContentId, aMap, changeInfoMap ); - CopyVariantL(KFlag, aMap, changeInfoMap ); - CopyVariantL(KType, aMap, changeInfoMap ); - CopyVariantL(KActionTrigger, aMap, changeInfoMap ); - CopyActionTrigger16L( aMap, changeInfoMap ); - - changeInfoMap->InsertL( KOperation, TLiwVariant( KOperationExecute ) ); - - aChangeInfoList->AppendL( TLiwVariant( changeInfoMap ) ); - CleanupStack::PopAndDestroy( changeInfoMap ); - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void CCPDataManager::CopyVariantL(const TDesC8& aKey, - const CLiwMap* aInMap, CLiwDefaultMap* aOutMap ) - { - TLiwVariant variant; - variant.PushL(); - if ( aInMap->FindL( aKey, variant ) ) - { - aOutMap->InsertL( aKey, variant ); - } - CleanupStack::PopAndDestroy( &variant ); - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void CCPDataManager::CopyActionTrigger16L( - const CLiwMap* aInMap, CLiwDefaultMap* aOutMap ) - { - TLiwVariant variant; - variant.PushL(); - if ( aInMap->FindL( KActionTrigger(), variant ) ) - { - - TPtrC8 result8( KNullDesC8 ); - if( variant.Get( result8 ) ) - { - RBuf actionTrigger; - actionTrigger.CleanupClosePushL(); - actionTrigger.Assign( - EscapeUtils::ConvertToUnicodeFromUtf8L( result8 ) ); - - variant.Reset(); - variant.Set( actionTrigger ); - CleanupStack::PopAndDestroy( &actionTrigger ); - } - - aOutMap->InsertL( KActionTrigger16(), variant ); - } - CleanupStack::PopAndDestroy( &variant ); - } - diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingserver/cpserver/src/cpserversession.cpp --- a/contentpublishingsrv/contentpublishingserver/cpserver/src/cpserversession.cpp Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,483 +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: Content Publisher Server Session - * -*/ - - -// INCLUDE FILES -#include -// for CleanupResetAndDestroyPushL -#include -#include - -#include "cpserversession.h" -#include "cpliwmap.h" -#include "cpublisherregistrymap.h" -#include "cpsecuritypolicy.h" -#include "cpserverdef.h" -#include "cpdebug.h" -#include "cpserver.h" -#include "cpserverdatamanager.h" -#include "cpactionhandlerthread.h" -#include "cpnotificationhandler.h" - - -using namespace LIW; - -// ================= MEMBER FUNCTIONS ======================= - -// ----------------------------------------------------------------------------- -// CCPServerSession::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CCPServerSession* CCPServerSession::NewL( TPointersForSession& aPasser ) - { - CCPServerSession* self = CCPServerSession::NewLC( aPasser ); - CleanupStack::Pop( self ) ; - return self; - } - -// ----------------------------------------------------------------------------- -// CCPServerSession::NewLC -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CCPServerSession* CCPServerSession::NewLC( TPointersForSession& aPasser ) - { - CCPServerSession* self = new ( ELeave ) CCPServerSession(); - CleanupStack::PushL( self ); - self->ConstructL( aPasser ) ; - return self; - } - -// ----------------------------------------------------------------------------- -// CCPServerSession::~CCPServerSession -// Destructor. -// ----------------------------------------------------------------------------- -// -CCPServerSession::~CCPServerSession() - { - if ( isRegister && iNotificationHandler ) - { - //remove notification handler from an array of sessions in data manager - if ( iDataManager ) - { - iDataManager->RemoveObserver( iNotificationHandler ); - } - iNotificationHandler->ErrorComplete( KErrCancel ); - } - if ( iServer ) - { - iServer->RemoveSession( ); - } - delete iNotificationHandler; - delete iParamList; - } - -// ----------------------------------------------------------------------------- -// CCPServerSession::CCPServerSession -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CCPServerSession::CCPServerSession() : - CSession2() - { - - } - -// ----------------------------------------------------------------------------- -// CCPServerSession::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CCPServerSession::ConstructL( TPointersForSession& aPasser ) - { - CP_DEBUG( _L8("CCPServerSession::ConstructL()") ); - iDataManager = aPasser.iDataManager; - iServer = aPasser.iServer; - iActionHandlerThread = aPasser.iActionHandlerThread; - iServer->AddSession( ); - isRegister = EFalse; - } - -// ----------------------------------------------------------------------------- -// CCPServerSession::ServiceL -// Handle client requests. -// ----------------------------------------------------------------------------- -// -void CCPServerSession::ServiceL( const RMessage2& aMessage ) - { - CP_DEBUG( _L8("CCPServerSession::ServiceL()" ) ); - TBool serverLocked = GetServerLock( aMessage ); - if ( serverLocked ) - { - aMessage.Complete( KErrLocked ); - } - else - { - TInt err(KErrNone); - TBool panicedClient(EFalse); - TRAP( err , DispatchMessageL( aMessage, panicedClient ) ); - if ( (!(aMessage.Function( ) == ECpServerRegisterObserver ) - || err == KErrInUse) && !panicedClient ) - { - aMessage.Complete( err ); - } - } - } - -// ----------------------------------------------------------------------------- -// CCPServerSession::ServiceL -// Handle client requests. -// ----------------------------------------------------------------------------- -// -void CCPServerSession::DispatchMessageL( const RMessage2& aMessage, TBool& aPanicedClient ) - { - CP_DEBUG( _L8("CCPServerSession::DispatchMessageL()" ) ); - switch ( aMessage.Function( ) ) - { - case ECpServerAddData: - AddDataL( aMessage ); - break; - case ECpServerGetListSize: - GetListSizeL( aMessage ); - break; - case ECpServerGetListData: - GetListDataL( aMessage ); - break; - case ECpServerRemoveData: - RemoveDataL( aMessage ); - break; - case ECpServerRegisterObserver: - RegisterObserverL( aMessage ); - break; - case ECpServerAddObserver: - AddObserverL( aMessage ); - break; - case ECpServerRemoveObserver: - RemoveObserverL( aMessage ); - break; - case ECpServerUnRegisterObserver: - UnregisterObserverL( ); - break; - case ECpServerGetChangeInfoData: - GetChangeInfoDataL( aMessage ); - break; - case ECpServerExecuteAction: - ExecuteActionL( aMessage ); - break; - default: - iServer->PanicClient( aMessage, ECPServerBadRequest ); - aPanicedClient = ETrue; - break; - } - } - -// ----------------------------------------------------------------------------- -// CCPServerSession::AddDataL -// --------------- -------------------------------------------------------------- -// -void CCPServerSession::AddDataL( const RMessage2& aMessage ) - { - CP_DEBUG( _L8("CCPServerSession::AddDataL()" ) ); - CCPLiwMap* map = UnpackFromClientLC( aMessage ); - map->SetSecurityL( aMessage ); - TBool activateSupport = map->ActivateActionSupport( ); - TUint id( 0 ); - id = iDataManager->AddDataL( *map ); - TPckg idData(id); - aMessage.WriteL( KReturnPosition, idData ); - if(activateSupport) - { - CLiwDefaultList* list = CLiwDefaultList::NewLC( ); - // execute activation or deactivation action for publisher - TRAP_IGNORE( GetAndExecuteActionL( map, list ) ); - TRAP_IGNORE( SendNotificationL( map, list ) ); - CleanupStack::PopAndDestroy( list ); - } - CleanupStack::PopAndDestroy( map ); - } - -// ----------------------------------------------------------------------------- -// CCPServerSession::GetListL -// --------------- -------------------------------------------------------------- -// -void CCPServerSession::GetListSizeL( const RMessage2& aMessage ) - { - CP_DEBUG( _L8("CCPServerSession::GetListSizeL()" ) ); - CCPLiwMap* map = UnpackFromClientLC( aMessage ); - map->SetSecurityL( aMessage ); - delete iParamList; - iParamList = NULL; - iParamList = CLiwGenericParamList::NewL( ); - iDataManager->GetListL( *map, *iParamList ); - TPckg sizeDes(iParamList->Size( ) ); - aMessage.WriteL( KReturnPosition, sizeDes ); - CleanupStack::PopAndDestroy( map ); - } - -// ----------------------------------------------------------------------------- -// CCPServerSession::GetListDataL -// --------------- -------------------------------------------------------------- -// -void CCPServerSession::GetListDataL( const RMessage2& aMessage ) - { - CP_DEBUG( _L8("CCPServerSession::GetListDataL()" ) ); - if( iParamList ) - { - ExternalizeAndWriteToClientL( aMessage, iParamList ); - delete iParamList; - } - iParamList = NULL; - } - -// ----------------------------------------------------------------------------- -// CCPServerSession::RemoveDataL -// --------------- -------------------------------------------------------------- -// -void CCPServerSession::RemoveDataL( const RMessage2& aMessage ) - { - CP_DEBUG( _L8("CCPServerSession::RemoveDataL()" ) ); - CCPLiwMap* map = UnpackFromClientLC( aMessage ); - map->SetSecurityL( aMessage ); - iDataManager->RemoveDataL( *map ); - CleanupStack::PopAndDestroy( map ); - } - -// ----------------------------------------------------------------------------- -// CCPServerSession::ExecuteActionL -// --------------- -------------------------------------------------------------- -// -void CCPServerSession::ExecuteActionL( const RMessage2& aMessage ) - { - TInt error(KErrNone); - CP_DEBUG( _L8("CCPServerSession::ExecuteActionSizeL()" ) ); - CCPLiwMap* map = UnpackFromClientLC( aMessage ); - CLiwGenericParamList* paramList = CLiwGenericParamList::NewLC( ); - CLiwDefaultList* list = CLiwDefaultList::NewLC(); - error = iDataManager->GetActionL( *map, *paramList, list ); - //we notify apart from action execution result. So in fact - //notification means there was an attempt to execute action - iDataManager->HandleChangeL( list ); - User::LeaveIfError( error ); - ExecuteL( *paramList ); - CleanupStack::PopAndDestroy( list ); - CleanupStack::PopAndDestroy( paramList ); - CleanupStack::PopAndDestroy( map ); - } - -// ----------------------------------------------------------------------------- -// CCPServerSession::ExecuteL -// --------------- -------------------------------------------------------------- -// -void CCPServerSession::ExecuteL( - const CLiwGenericParamList& aActionParams ) - { - for ( TInt i = 0; i < aActionParams.Count(); i++ ) - { - TLiwGenericParam param; - param.PushL(); - aActionParams.AtL( i, param ); - CLiwGenericParamList* singleAction = CLiwGenericParamList::NewLC(); - singleAction->AppendL( param ); - TRAP_IGNORE( iActionHandlerThread->ExecuteL( *singleAction ) ); - CleanupStack::PopAndDestroy( singleAction ); - CleanupStack::PopAndDestroy( ¶m ); - } - } - -// ----------------------------------------------------------------------------- -// CCPServerSession::RegisterObserverL -// --------------- -------------------------------------------------------------- -// -void CCPServerSession::RegisterObserverL( const RMessage2& aMessage ) - { - CP_DEBUG( _L8("CCPServerSession::RegisterObserverL()" ) ); - if ( !isRegister ) - { - if (aMessage.Int3() != KErrAlreadyExists && - aMessage.GetDesLength( KDescriptorPosition) < KErrNone ) - { - iServer->PanicClient( aMessage, ECPServerBadRequest ); - User::Leave( KErrGeneral ); - } - if ( !iNotificationHandler ) - { - iNotificationHandler = CCPNotificationHandler::NewL( - iServer->GetNotifications()); - iDataManager->AddObserverL( iNotificationHandler ); - } - iNotificationHandler->SaveMessageL( aMessage ); - isRegister = ETrue; - } - else - { - User::Leave( KErrInUse ); - } - } - -// ----------------------------------------------------------------------------- -// CCPServerSession::AddObserverL -// --------------- -------------------------------------------------------------- -// -void CCPServerSession::AddObserverL( const RMessage2& aMessage ) - { - CP_DEBUG( _L8("CCPServerSession::AddObserverL()" ) ); - if( iNotificationHandler ) - { - iNotificationHandler->AddObserverL( aMessage ); - } - } - -// ----------------------------------------------------------------------------- -// CCPServerSession::RemoveObserverL -// --------------- -------------------------------------------------------------- -// -void CCPServerSession::RemoveObserverL( const RMessage2& aMessage ) - { - CP_DEBUG( _L8("CCPServerSession::RemoveObserverL()" ) ); - if( iNotificationHandler ) - { - iNotificationHandler->RemoveObserverL( aMessage ); - } - } - - -// ----------------------------------------------------------------------------- -// CCPServerSession::UnregisterObserverL -// --------------- -------------------------------------------------------------- -// -void CCPServerSession::UnregisterObserverL() - { - CP_DEBUG( _L8("CCPServerSession::UnregisterObserverL()" ) ); - if ( isRegister ) - { - //remove notification handler from an array of sessions in data manager - iDataManager->RemoveObserver( iNotificationHandler ); - //reset filter for this session - iNotificationHandler->ErrorComplete( KErrCancel ); - delete iNotificationHandler; - iNotificationHandler = NULL; - isRegister = EFalse; - } - else - { - User::Leave( KErrNotFound ); - } - } - -// ----------------------------------------------------------------------------- -// CCPServerSession::GetChangeInfoDataL -// ----------------------------------------------------------------------------- -// -void CCPServerSession::GetChangeInfoDataL( const RMessage2& aMessage ) - { - CP_DEBUG( _L8("CCPServerSession::GetChangeInfoData()" ) ); - if( iNotificationHandler ) - { - isRegister = EFalse; - ExternalizeAndWriteToClientL( aMessage, - iNotificationHandler->GetPointerToChangeInfoList( ) ); - iNotificationHandler->Reset( ); - } - } - -// ----------------------------------------------------------------------------- -// CCPServerSession::ExternalizeAndWriteToClient -// ----------------------------------------------------------------------------- -// -void CCPServerSession::ExternalizeAndWriteToClientL( - const RMessage2& aMessage, const CLiwGenericParamList* outParamList ) - { - CP_DEBUG( _L8("CCPServerSession::ExternalizeAndWriteToClientL()" ) ); - HBufC8* buf = HBufC8::NewLC( outParamList->Size( ) ); - TPtr8 des = buf->Des( ); - RDesWriteStream writeStream(des); - CleanupClosePushL( writeStream ); - outParamList->ExternalizeL( writeStream ); - writeStream.CommitL( ); - aMessage.WriteL( KDescriptorPosition, des ); - CleanupStack::PopAndDestroy( &writeStream ); - CleanupStack::PopAndDestroy( buf ); - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -CCPLiwMap* CCPServerSession::UnpackFromClientLC( const RMessage2& aMessage ) - { - CP_DEBUG( _L8("CCPServerSession::UnpackFromClientLC()") ); - TInt deslen = aMessage.GetDesLengthL( KDescriptorPosition ); - HBufC8* buffer = HBufC8::NewLC( deslen ); - TPtr8 tempDes = buffer->Des( ); - aMessage.Read( KDescriptorPosition, tempDes ); - RDesReadStream datastrm( *buffer); - CleanupClosePushL( datastrm ); - CCPLiwMap* inParamList = CCPLiwMap::NewL( datastrm ); - CleanupStack::PopAndDestroy( &datastrm ); - CleanupStack::PopAndDestroy( buffer ); - inParamList->PushL( ); - return inParamList; - } - -// ----------------------------------------------------------------------------- -// CCPServerSession::SendNotificationL -// ----------------------------------------------------------------------------- -// -void CCPServerSession::SendNotificationL( CCPLiwMap* aMap, - CLiwDefaultList* aNotificationList ) - { - RBuf8 trigger; - trigger.CleanupClosePushL(); - aMap->GetPropertyL( KActionTrigger, trigger ); - if( ( trigger == KActivateTrigger ) || ( trigger == KDeactivateTrigger ) ) - { - iDataManager->HandleChangeL( aNotificationList ); - } - CleanupStack::PopAndDestroy( &trigger ); - } - -// ----------------------------------------------------------------------------- -// CCPServerSession::GetAndExecuteActionL -// --------------- -------------------------------------------------------------- -// -void CCPServerSession::GetAndExecuteActionL( CCPLiwMap* aMap, - CLiwDefaultList* aNotificationList, TBool aInsertTrigger ) - { - if (aInsertTrigger) - { - aMap->InsertL( KActionTrigger, TLiwVariant( KActivateTrigger ) ); - } - CLiwGenericParamList* paramList = CLiwGenericParamList::NewLC(); - iDataManager->GetActionL( *aMap, *paramList, aNotificationList ); - iActionHandlerThread->ExecuteL( *paramList ); - CleanupStack::PopAndDestroy( paramList ); - } - -// ----------------------------------------------------------------------------- -// CCPServerSession::GetServerLock -// --------------- -------------------------------------------------------------- -// -TBool CCPServerSession::GetServerLock( const RMessage2& aMessage ) - { - // Allways allow to unregister - return ( (aMessage.Function() != ECpServerUnRegisterObserver) - && iServer->GetLock() ); - - } -// End of File diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingserver/cpsqlitestorage/bwins/cpstorageu.def --- a/contentpublishingsrv/contentpublishingserver/cpsqlitestorage/bwins/cpstorageu.def Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - ?NewDatabaseL@StorageFactory@@SAPAVCCpStorage@@XZ @ 1 NONAME ; class CCpStorage * StorageFactory::NewDatabaseL(void) - diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingserver/cpsqlitestorage/eabi/cpstorageu.def --- a/contentpublishingsrv/contentpublishingserver/cpsqlitestorage/eabi/cpstorageu.def Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - _ZN14StorageFactory12NewDatabaseLEv @ 1 NONAME - diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingserver/cpsqlitestorage/group/bld.inf --- a/contentpublishingsrv/contentpublishingserver/cpsqlitestorage/group/bld.inf Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -/* -* Copyright (c) Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Build information file for Content Publisher Storage -* -*/ - - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS - -PRJ_MMPFILES -cpstorage.mmp diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingserver/cpsqlitestorage/group/cpstorage.mmp --- a/contentpublishingsrv/contentpublishingserver/cpsqlitestorage/group/cpstorage.mmp Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +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: -* -*/ - -// To get the MW_LAYER_SYSTEMINCLUDE-definition -#include - -TARGET cpstorage.dll -TARGETTYPE dll -UID 0x1000008d 0x20016B7C - -CAPABILITY CAP_GENERAL_DLL - -SOURCEPATH ../src -SOURCE cpstorageengine.cpp -SOURCE cpstoragefactory.cpp - -USERINCLUDE ../inc -USERINCLUDE ../../cpserver/inc -USERINCLUDE ../../../contentpublishingutils/contentpublishingdebug/inc -USERINCLUDE ../../../contentpublishingutils/contentpublishingmap/inc - -MW_LAYER_SYSTEMINCLUDE - -LIBRARY euser.lib -LIBRARY estor.lib -LIBRARY sqldb.lib -LIBRARY efsrv.lib -LIBRARY cputils.lib -LIBRARY liwservicehandler.lib -LIBRARY centralrepository.lib - -#ifdef CONTENT_PUBLISHER_DEBUG -LIBRARY cpdebug.lib -#endif - - diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingserver/cpsqlitestorage/inc/cpssqlcommands.h --- a/contentpublishingsrv/contentpublishingserver/cpsqlitestorage/inc/cpssqlcommands.h Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,126 +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 C_CPSSQL_H -#define C_CPSSQL_H -#ifdef CONTENT_PUBLISHER_STORAGE_MT -_LIT( KCPpathdatabase, "c:\\cpdatastorage.sq" ); -#endif - -_LIT( KCPdatabase, "[20016B7B]cpdatastorage.sq" ); -_LIT( KCPdatabaseDrive, "C:" ); -_LIT8( KMdsSqlDbaConfig, - "cache_size=10000; page_size=4096; encoding=\"UTF-8\";" ); - -//Create Tables -_LIT( KSQLCreateMainTable, - "CREATE TABLE CP_MAIN_TABLE( Id INTEGER PRIMARY KEY ,\ - Publisher TEXT NOT NULL,\ - Content_type TEXT NOT NULL,\ - Content_id TEXT NOT NULL,\ - Expiration_date BIGINT NOT NULL,\ - Data BLOB, \ - Action BLOB, \ - UNIQUE( Publisher, Content_type, Content_id ));" ); - -_LIT( KSQLCreatePublisherTable, - "CREATE TABLE CP_PUBLISHER_TABLE( Id INTEGER PRIMARY KEY ,\ - Publisher TEXT NOT NULL,\ - Content_type TEXT NOT NULL,\ - Content_id TEXT NOT NULL, \ - Data BLOB, \ - UNIQUE( Publisher, Content_type, Content_id ));" ); - -//Create Indexes -_LIT( KSQLIndexOnMain_Publisher, - "CREATE INDEX Main_PublisherIndex ON CP_MAIN_TABLE(Publisher);" ); -_LIT( KSQLIndexOnMain_Content_type, - "CREATE INDEX Main_Content_typeIndex ON CP_MAIN_TABLE(Content_type);" ); - -_LIT( KSQLIndexOnPub_Content_type, - "CREATE INDEX Pub_Content_typeIndex ON CP_PUBLISHER_TABLE(Content_type);" ); -_LIT( KSQLIndexOnPub_Content_type_Content_id, - "CREATE INDEX Pub_Content_type_Content_Id_Index ON CP_PUBLISHER_TABLE(Content_type,Content_id);" ); - -//Insert Data -//Update Data -_LIT( KSQLUpdateComplete, - "UPDATE CP_MAIN_TABLE SET \ - Data = :Data, Action = :Action WHERE Id = :Id " ); - -_LIT( KSQLUpdateData, - "UPDATE CP_MAIN_TABLE SET \ - Data = :Data WHERE Id = :Id " ); - -_LIT( KSQLUpdateAction, - "UPDATE CP_MAIN_TABLE SET \ - Action = :Action WHERE Id = :Id " ); - -_LIT( KSQLInsert, - "INSERT INTO CP_MAIN_TABLE (Publisher,Content_type,Content_id,Expiration_date,Data,Action) VALUES ( \ - :Publisher,\ - :Content_type,\ - :Content_id,\ - :Expiration_date,\ - :Data,\ - :Action )" ); - -//Delete Data -_LIT( KSQLDelete, "DELETE FROM CP_MAIN_TABLE WHERE " ); - -//Get Data -_LIT( KSQLGetLastInsertId, "SELECT last_insert_rowid() " ); -_LIT( KSQLGetList, - "SELECT Id,Publisher,Content_type,Content_id,Expiration_date,Data,Action FROM CP_MAIN_TABLE WHERE " ); -_LIT( KSQLGetIds, - "SELECT Id,Publisher,Content_type,Content_id FROM CP_MAIN_TABLE WHERE " ); -_LIT( KSQLGetAction, "SELECT Id, Action FROM CP_MAIN_TABLE WHERE " ); -_LIT( KSQLGetPublisher, "Publisher = :Publisher" ); -_LIT( KSQLGetContentType, "Content_type = :Content_type" ); -_LIT( KSQLGetContentId, "Content_id = :Content_id" ); -_LIT( KSQLGetId, "Id = :Id" ); -_LIT( KAnd, " AND " ); - -_LIT( KSQLFetchId, - "SELECT Id FROM CP_MAIN_TABLE WHERE Publisher =:Publisher AND Content_type=:Content_type AND Content_id =:Content_id" ); -_LIT( KSQLFetchIds, - "SELECT Publisher,Content_type,Content_id FROM CP_MAIN_TABLE WHERE Id =:Id" ); - -_LIT( KSQLPublisher, ":Publisher" ); -_LIT( KSQLContent_type, ":Content_type" ); -_LIT( KSQLContent_id, ":Content_id" ); -_LIT( KSQLExpiration_date, ":Expiration_date" ); -_LIT( KSQLData, ":Data" ); -_LIT( KSQLAction, ":Action" ); -_LIT( KSQLId, ":Id" ); - -_LIT( KSQLOrderRecent, " ORDER BY Id DESC" ); -_LIT( KSQLOrderPublisher, " ORDER BY Publisher" ); -_LIT( KSQLOrderContent, " ORDER BY Content_type" ); - -_LIT( KColumnId, "Id" ); -_LIT( KColumnPublisher, "Publisher" ); -_LIT( KColumnContent_type, "Content_type" ); -_LIT( KColumnContent_id, "Content_id" ); -_LIT( KColumnExpiration_date, "Expiration_date" ); -_LIT( KColumnData, "Data" ); -_LIT( KColumnAction, "Action" ); - -_LIT8( KList, "List" ); - -#endif //C_CPSSQL_H diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingserver/cpsqlitestorage/inc/cpssqlconstants.h --- a/contentpublishingsrv/contentpublishingserver/cpsqlitestorage/inc/cpssqlconstants.h Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +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 C_CPSSQLCONSTS_H -#define C_CPSSQLCONSTS_H -#ifdef CONTENT_PUBLISHER_STORAGE_MT -_LIT( KCPpathdatabase, "c:\\cpdatastorage.sq" ); -#endif - -_LIT( KCPdatabase, "[20016B7B]cpdatastorage.sq" ); -_LIT( KCPdatabaseDrive, "C:" ); -_LIT8( KMdsSqlDbaConfig, - "cache_size=10000; page_size=4096; encoding=\"UTF-8\";" ); - -//Create Tables -_LIT( KSQLCreateMainTable, - "CREATE TABLE CP_MAIN_TABLE( Id INTEGER PRIMARY KEY ,\ - Publisher TEXT NOT NULL,\ - Content_type TEXT NOT NULL,\ - Content_id TEXT NOT NULL,\ - Expiration_date BIGINT NOT NULL,\ - Access_List BLOB,\ - Data BLOB, \ - Action BLOB, \ - UNIQUE( Publisher, Content_type, Content_id ));" ); - -_LIT( KSQLCreatePublisherTable, - "CREATE TABLE CP_PUBLISHER_TABLE( Id INTEGER PRIMARY KEY ,\ - Publisher TEXT NOT NULL,\ - Content_type TEXT NOT NULL,\ - Content_id TEXT NOT NULL, \ - Flag INTEGER NOT NULL, \ - Access_List BLOB,\ - Data BLOB, \ - Action BLOB, \ - UNIQUE( Publisher, Content_type, Content_id ));" ); - -//Create Indexes -_LIT( KSQLIndexOnMain_Publisher, - "CREATE INDEX Main_PublisherIndex ON CP_MAIN_TABLE(Publisher);" ); -_LIT( KSQLIndexOnMain_Content_type, - "CREATE INDEX Main_Content_typeIndex ON CP_MAIN_TABLE(Content_type);" ); - -_LIT( KSQLIndexOnPub_Content_type, - "CREATE INDEX Pub_Content_typeIndex ON CP_PUBLISHER_TABLE(Content_type);" ); -_LIT( KSQLIndexOnPub_Content_type_Content_id, - "CREATE INDEX Pub_Content_type_Content_Id_Index ON CP_PUBLISHER_TABLE(Content_type,Content_id);" ); - -#endif //C_CPSSQLCONSTS_H diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingserver/cpsqlitestorage/inc/cpstorage.h --- a/contentpublishingsrv/contentpublishingserver/cpsqlitestorage/inc/cpstorage.h Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +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 C_CPSTORAGE_H -#define C_CPSTORAGE_H - -// FORWARD DECLARATIONS -class CLiwMap; -class CLiwGenericParamList; -class CLiwDefaultList; - -/** - * Callback Interface for observing changes in Content Publisher Database - * - * @since S60 v5.0 - */ -class MCPChangeNotifier - { -public: - - /** - * This method should be implemented by subscriber for changes in - * database - * - * @param Map containing change information - * @param Id of changed entry - * @return - */ - virtual void HandleChangeL( CLiwDefaultList* aListOfMaps ) = 0; - - }; - -/** - * Interface for CPS database implementations - * - */ -class CCpStorage : public CBase - { -public: - - /** - * Fetches data from database - * - * @param aMap Filtering and sorting criteria - * @param aList Target for results - */ - virtual void GetListL( const CLiwMap* aMap, - CLiwGenericParamList& aList ) = 0; - /** - * Adds or Updates data & action to database - * @param Map containing data item - * @return id of added entry - */ - virtual TInt32 AddL( const CLiwMap* aMap ) = 0; - - /** - * Removes data item from database - * @param Filtering and sorting criteria - */ - virtual void RemoveL( const CLiwMap* aMap ) = 0; - - /** - * Set database observer - * @param Callback pointer - */ - virtual void SetCallback( MCPChangeNotifier* aCallback ) = 0; - - }; - -#endif //C_CPSTORAGE_H diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingserver/cpsqlitestorage/inc/cpstorageengine.h --- a/contentpublishingsrv/contentpublishingserver/cpsqlitestorage/inc/cpstorageengine.h Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,145 +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: Database implementation - * -*/ - - -#ifndef C_CPSTORAGE_ENGINE_H -#define C_CPSTORAGE_ENGINE_H - -#include -#include -#include "cpstorage.h" - -// FORWARD DECLARATIONS -#ifdef CONTENT_PUBLISHER_DEBUG -class CCPDebug; -#endif -class MCPChangeNotifier; -class CRepository; - -// CLASS DECLARATION -/** - * SQLite based databse for Content Publisher - * - * @lib cpstorage.dll - * @since S60 v5.0 - */ -NONSHARABLE_CLASS( CCpStorageEngine ): public CCpStorage - { -public: - - /** - * Two-phased constructor. - */ - static CCpStorageEngine* NewL(); - - /** - * Two-phased constructor. - */ - static CCpStorageEngine* NewLC(); - - /** - * Destructor. - */ - ~CCpStorageEngine(); - - //from CCpStorage - - /** - * Fetches data from database - * - * @param aMap Filtering and sorting criteria - * @param aList Target for results - */ - void GetListL( const CLiwMap* aMap, CLiwGenericParamList& aList ); - - /** - * Adds or Updates data & action to database - * @param Map containing data item - * @return id of added entry - */ - TInt32 AddL( const CLiwMap* aMap ); - - /** - * Remove data item from database - * @param Filtering and sorting criteria - */ - void RemoveL( const CLiwMap* aMap ); - - /** - * Set database observer - * @param Callback pointer - */ - void SetCallback( MCPChangeNotifier* aCallback ); - -private: - - /** - * Perform the second phase construction of a CCpStorageEngine object. - */ - void ConstructL(); - - /** - * C++ default constructor. - */ - CCpStorageEngine(); - - /** - * Creates database tables. - */ - void CreateTablesL(); - - /** - * Creates new database. - * If Db is created for the first time, - * set repository db state into KSQLDBStateNormal - */ - void CreateNewDbL(); - - /** - * Deletes database. - * Called when opening Db try return KSqlErrCorrupt error. - * Removes KSQLDBStateNormal state and set KSQLDBStateRestored into - * repository db state. - */ - void DeleteCorruptedDbL(); - -private: - - /** - * Database. - * Own. - */ - RSqlDatabase iSqlDb; - - /** - * Callback pointer. - * Not own. - */ - MCPChangeNotifier* iCallback; - - /** - * Repository keeps information about Db state. - * Own. - */ - CRepository* iRepository; - -#ifdef CONTENT_PUBLISHER_DEBUG - CCPDebug* iDebug; -#endif - }; - -#endif //C_CPSTORAGE_ENGINE_H diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingserver/cpsqlitestorage/inc/cpstoragefactory.h --- a/contentpublishingsrv/contentpublishingserver/cpsqlitestorage/inc/cpstoragefactory.h Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +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 C_CPSTORAGE_FACTORY_H -#define C_CPSTORAGE_FACTORY_H - -#include - -// FORWARD DECLARATIONS -class CCpStorage; - -// CLASS DECLARATION -/** - * Class with one static method used by CPS Server to - * instantiate storage database. - * - * @since S60 v5.0 - */ -class StorageFactory - { -public: - IMPORT_C static CCpStorage* NewDatabaseL(); - }; - -#endif //C_CPSTORAGE_FACTORY_H diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingserver/cpsqlitestorage/src/cpstorageengine.cpp --- a/contentpublishingsrv/contentpublishingserver/cpsqlitestorage/src/cpstorageengine.cpp Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,266 +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: - * -*/ - - -#include "cpstorageengine.h" -#include "cpliwmap.h" -#include "ccontentmap.h" -#include "cpdebug.h" -#include "cpssqlconstants.h" -#include "cpserverdef.h" -#include - -// --------------------------------------------------------------------------- -// CCpStorageEngine::CCpStorageEngine() -// -// --------------------------------------------------------------------------- -// -CCpStorageEngine::CCpStorageEngine() - { - } - -// --------------------------------------------------------------------------- -// CCpStorageEngine::ConstructL() -// -// --------------------------------------------------------------------------- -// -void CCpStorageEngine::ConstructL() - { -#ifdef CONTENT_PUBLISHER_DEBUG - if(!CCPDebug::Enable()) - { - iDebug = CCPDebug::NewL( KCPDebugFileName2 ); - } -#endif - CP_DEBUG( _L8("CCpStorageEngine::ConstructL()") ); - - iRepository = CRepository::NewL( KServerUid ); - TBool createNew( EFalse ); - TInt err = iSqlDb.Open( KCPdatabase, &KMdsSqlDbaConfig ); - if( err == KSqlErrCorrupt ) - { - DeleteCorruptedDbL(); - createNew = ETrue; - } - else if( err/* == KErrNotFound */) - { - createNew = ETrue; - } - - if ( createNew ) - { - CreateNewDbL(); - } - } - -// --------------------------------------------------------------------------- -// CCpStorageEngine::NewL() -// -// --------------------------------------------------------------------------- -// -CCpStorageEngine* CCpStorageEngine::NewL() - { - CCpStorageEngine* self = CCpStorageEngine::NewLC( ); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// CCpStorageEngine::NewLC() -// -// --------------------------------------------------------------------------- -// -CCpStorageEngine* CCpStorageEngine::NewLC() - { - CCpStorageEngine* self = new (ELeave) CCpStorageEngine(); - CleanupStack::PushL( self ); - self->ConstructL( ); - return self; - } - -// --------------------------------------------------------------------------- -// CCpStorageEngine::~CCpStorageEngine() -// -// --------------------------------------------------------------------------- -// -CCpStorageEngine::~CCpStorageEngine() - { - CP_DEBUG( _L8("CCpStorageEngine::~CCpStorageEngine()") ); - iSqlDb.Close( ); - delete iRepository; -#ifdef CONTENT_PUBLISHER_DEBUG - delete iDebug; -#endif - } - -// --------------------------------------------------------------------------- -// CCpStorageEngine::CreateTablesL -// -// --------------------------------------------------------------------------- -// -void CCpStorageEngine::CreateTablesL() - { - CP_DEBUG( _L8("CCpStorageEngine::CreateTablesL()") ); - - //Main Table - User::LeaveIfError( iSqlDb.Exec( KSQLCreateMainTable ) ); - User::LeaveIfError( iSqlDb.Exec( KSQLIndexOnMain_Publisher ) ); - User::LeaveIfError( iSqlDb.Exec( KSQLIndexOnMain_Content_type ) ); - //Publisher Table - User::LeaveIfError( iSqlDb.Exec( KSQLCreatePublisherTable ) ); - User::LeaveIfError( iSqlDb.Exec( KSQLIndexOnPub_Content_type ) ); - User::LeaveIfError( iSqlDb.Exec( KSQLIndexOnPub_Content_type_Content_id ) ); - } - -// --------------------------------------------------------------------------- -// CCpStorageEngine::GetListL -// -// --------------------------------------------------------------------------- -// -void CCpStorageEngine::GetListL( const CLiwMap* aMap, - CLiwGenericParamList& aList ) - { - CP_DEBUG( _L8("CCpStorageEngine::GetListL()") ); - const CCPLiwMap* map = static_cast(aMap); - RArray itemsToDelete; - TUint numberOfItems = map->GetListL( iSqlDb, &aList, itemsToDelete ); - //delete outdated items - CContentMap* removeItemMap = CContentMap::NewLC( ); - for ( TInt i = 0; iInsertL( KId, TLiwVariant( itemsToDelete[i] ) ); - removeItemMap->InsertL( KType, TLiwVariant( KCpData ) ); - RemoveL( removeItemMap ); - removeItemMap->Remove( KId ); - } - CleanupStack::PopAndDestroy( removeItemMap ); - itemsToDelete.Reset( ); - - if ( numberOfItems == 0 ) - { - User::Leave( KErrNotFound ); - } - } - -// --------------------------------------------------------------------------- -// CCpStorageEngine::AddL -// -// --------------------------------------------------------------------------- -// -TInt32 CCpStorageEngine::AddL( const CLiwMap* aMap ) - { - CP_DEBUG( _L8("CCpStorageEngine::AddL()") ); - TInt32 id(0); - const CCPLiwMap* map = static_cast(aMap); - if ( iCallback ) - { - CLiwDefaultList* listOfMaps = CLiwDefaultList::NewLC( ); - id = map->AddL( iSqlDb, listOfMaps ); - iCallback->HandleChangeL( listOfMaps ); - CleanupStack::PopAndDestroy( listOfMaps ) ; - } - else - { - id = map->AddL( iSqlDb ); - } - return id; - } - -// --------------------------------------------------------------------------- -// CCpStorageEngine::RemoveL -// -// --------------------------------------------------------------------------- -// -void CCpStorageEngine::RemoveL( const CLiwMap* aMap ) - { - CP_DEBUG( _L8("CCpStorageEngine::RemoveL()") ); - const CCPLiwMap* map = static_cast(aMap); - if ( iCallback ) - { - CLiwDefaultList* listOfMaps = CLiwDefaultList::NewLC( ); - map->RemoveL( iSqlDb, listOfMaps ); - iCallback->HandleChangeL( listOfMaps ); - CleanupStack::PopAndDestroy( listOfMaps ) ; - } - else - { - map->RemoveL( iSqlDb ); - } - } - -// --------------------------------------------------------------------------- -// CCpStorageEngine::SetCallback() -// -// --------------------------------------------------------------------------- -// -void CCpStorageEngine::SetCallback( MCPChangeNotifier* aCallback ) - { - iCallback = aCallback; - } - -// --------------------------------------------------------------------------- -// CCpStorageEngine::DeleteCorruptedDbL() -// -// --------------------------------------------------------------------------- -// -void CCpStorageEngine::DeleteCorruptedDbL() - { - User::LeaveIfError( iSqlDb.Delete( KCPdatabase ) ); - TInt value( 0 ); - if( !iRepository->Get( KCPStorageUid, value ) ) - { - value ^= KSQLDBStateNormal; - value |= KSQLDBStateRestored; - } - else - { - value = KSQLDBStateRestored; - } - iRepository->Set( KCPStorageUid, value ); - } - -// --------------------------------------------------------------------------- -// CCpStorageEngine::CreateNewDbL() -// -// --------------------------------------------------------------------------- -// -void CCpStorageEngine::CreateNewDbL() - { - TSecureId id( KServerUid ); // Uid of CP Server - only this process has access rights - TSecurityPolicy defaultPolicy; - TSecurityPolicy securityPolicy(id); - RSqlSecurityPolicy sqlSecurityPolicy; - CleanupClosePushL( sqlSecurityPolicy ); - User::LeaveIfError( sqlSecurityPolicy.Create( defaultPolicy ) ); - User::LeaveIfError( sqlSecurityPolicy.SetDbPolicy( - RSqlSecurityPolicy::ESchemaPolicy, securityPolicy ) ); -#ifdef CONTENT_PUBLISHER_STORAGE_MT - iSqlDb.CreateL( KCPpathdatabase, &KMdsSqlDbaConfig ); -#else - iSqlDb.CreateL( KCPdatabase, sqlSecurityPolicy, &KMdsSqlDbaConfig ); -#endif - CleanupStack::PopAndDestroy( &sqlSecurityPolicy ); - CreateTablesL( ); - - TInt value( 0 ); - if( iRepository->Get( KCPStorageUid, value ) == KErrNotFound ) - { - value = KSQLDBStateNormal; - iRepository->Set( KCPStorageUid, value ); - } - } - diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingserver/cpsqlitestorage/src/cpstoragefactory.cpp --- a/contentpublishingsrv/contentpublishingserver/cpsqlitestorage/src/cpstoragefactory.cpp Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +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: - * -*/ - - -#include "cpstoragefactory.h" -#include "cpstorageengine.h" - -EXPORT_C CCpStorage* StorageFactory::NewDatabaseL() - { - return CCpStorageEngine::NewL(); - } diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingserver/group/bld.inf --- a/contentpublishingsrv/contentpublishingserver/group/bld.inf Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS - -PRJ_MMPFILES -#include "../cpsqlitestorage/group/bld.inf" -#include "../cpserver/group/bld.inf" - - -// End of file diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingsrv.pro --- a/contentpublishingsrv/contentpublishingsrv.pro Mon May 03 12:48:45 2010 +0300 +++ /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: -# - -TEMPLATE = subdirs - -BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include \"group/bld.inf\"" - diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingutils/contentpublishingdebug/bwins/cpdebugu.def --- a/contentpublishingsrv/contentpublishingutils/contentpublishingdebug/bwins/cpdebugu.def Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -EXPORTS - ?Data@CCPDebug@@CAPAUDebugData@@XZ @ 1 NONAME ; struct DebugData * CCPDebug::Data(void) - ?Enable@CCPDebug@@SAHXZ @ 2 NONAME ; int CCPDebug::Enable(void) - ?EnableLogging@CCPDebug@@SAXH@Z @ 3 NONAME ; void CCPDebug::EnableLogging(int) - ?NewL@CCPDebug@@SAPAV1@ABVTDesC16@@@Z @ 4 NONAME ; class CCPDebug * CCPDebug::NewL(class TDesC16 const &) - ?NewLC@CCPDebug@@SAPAV1@ABVTDesC16@@@Z @ 5 NONAME ; class CCPDebug * CCPDebug::NewLC(class TDesC16 const &) - ?Printf@CCPDebug@@SAXV?$TRefByValue@$$CBVTDesC8@@@@ZZ @ 6 NONAME ; void CCPDebug::Printf(class TRefByValue, ...) - diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingutils/contentpublishingdebug/eabi/cpdebugu.def --- a/contentpublishingsrv/contentpublishingutils/contentpublishingdebug/eabi/cpdebugu.def Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -EXPORTS - _ZN8CCPDebug13EnableLoggingEi @ 1 NONAME - _ZN8CCPDebug4DataEv @ 2 NONAME - _ZN8CCPDebug4NewLERK7TDesC16 @ 3 NONAME - _ZN8CCPDebug5NewLCERK7TDesC16 @ 4 NONAME - _ZN8CCPDebug6EnableEv @ 5 NONAME - _ZN8CCPDebug6PrintfE11TRefByValueIK6TDesC8Ez @ 6 NONAME - diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingutils/contentpublishingdebug/group/bld.inf --- a/contentpublishingsrv/contentpublishingutils/contentpublishingdebug/group/bld.inf Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Build information file for Content Publisher Debug -* -*/ - - - -PRJ_PLATFORMS - -DEFAULT - - -PRJ_EXPORTS - - -PRJ_MMPFILES -cpdebug.mmp - - -// End of File diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingutils/contentpublishingdebug/group/cpdebug.mmp --- a/contentpublishingsrv/contentpublishingutils/contentpublishingdebug/group/cpdebug.mmp Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Project definition macros to log -* -*/ - - -// To get the MW_LAYER_SYSTEMINCLUDE-definition -#include - -TARGET cpdebug.dll -TARGETTYPE dll -UID 0x1000018d 0x04066666 - -CAPABILITY CAP_GENERAL_DLL -VENDORID VID_DEFAULT - -LANG SC - -SOURCEPATH ../src - -SOURCE cpdebug.cpp - -USERINCLUDE ../inc - -MW_LAYER_SYSTEMINCLUDE - -LIBRARY euser.lib -LIBRARY estor.lib -LIBRARY efsrv.lib - -//end of file diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingutils/contentpublishingdebug/inc/cpdebug.h --- a/contentpublishingsrv/contentpublishingutils/contentpublishingdebug/inc/cpdebug.h Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +0,0 @@ -/* -* 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: Debug printing to a log file - * -*/ - -#ifndef C_CP_DEBUG_H -#define C_CP_DEBUG_H - -// INCLUDES - -#include -#ifdef CONTENT_PUBLISHER_DEBUG -#include - -_LIT(KCPDebugDirName, "contentpublisher" ); -_LIT(KCPDebugFileName, "c:\\contentpublisher.txt" ); -_LIT(KCPDebugFileName2, "c:\\server.txt" ); - -/** - * Content publisher debug - * - * - * @lib cpdebug.lib - * @since S60 v3.2 - */ -NONSHARABLE_CLASS( CCPDebug ): public CBase - { -public: - - IMPORT_C static CCPDebug* NewLC( const TDesC& aFile ); - - IMPORT_C static CCPDebug* NewL( const TDesC& aFile ); - - virtual ~CCPDebug(); - - /** - * Determines whether CCPDebug is exist . - */ - IMPORT_C static TBool Enable(); - - /** - * Enables or disables Printf message logging to a file. - * @param aEnable Set to true to enable logging, false to disable. - */ - IMPORT_C static void EnableLogging(TBool aEnable); - - /** - * Print debug text to the file (c:\\contentpublisher.txt). - * - */ - IMPORT_C static void Printf(TRefByValue aFormat, ...); - -private: - - CCPDebug(); - - void ConstructL( const TDesC& aFile ); - - /** - * Returns a pointer to the thread-local data struct. - */ - IMPORT_C static struct DebugData* Data(); - -private: // data - - /** - * Thread local storage for this DLL, as we cannot declare static - * global variables in Symbian. - */ - struct DebugData* iData; - - }; - -#define CP_DEBUG(s) CCPDebug::Printf(s) - -/** - * Thread local storage space. Writable static data is not supported in - * Symbian, so static data is stored in this struct. - */ -struct DebugData - { - RFile iLogFile; - RFs iFs; - TBool iLogEnabled; - TTime iFirstUpdateTime; - RBuf iFileName; - }; - -#else - -#define CP_DEBUG(s) - -#endif - -#endif // C_CP_DEBUG_H diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingutils/contentpublishingdebug/src/cpdebug.cpp --- a/contentpublishingsrv/contentpublishingutils/contentpublishingdebug/src/cpdebug.cpp Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,169 +0,0 @@ -/* -* Copyright (c) Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 "cpdebug.h" - -const TUint KMemDataSize( 100 ); -const TUint KBufMaxSize( 512 ); -const TUint KThousand( 1000 ); - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPDebug::ConstructL( const TDesC& aFile ) - { - iData = new (ELeave) DebugData(); - iData->iLogEnabled = EFalse; - iData->iFirstUpdateTime.UniversalTime( ); - iData->iFileName.Create( aFile.Length( ) ); - iData->iFileName = aFile; - Dll::SetTls( iData ); - User::LeaveIfError( iData->iFs.Connect( ) ); - EnableLogging( ETrue ); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -EXPORT_C CCPDebug* CCPDebug::NewL( const TDesC& aFile ) - { - CCPDebug* self = NewLC( aFile ); - CleanupStack::Pop(self); - return self; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -EXPORT_C CCPDebug* CCPDebug::NewLC( const TDesC& aFile ) - { - CCPDebug* self = new (ELeave) CCPDebug(); - CleanupStack::PushL(self); - self->ConstructL( aFile ); - return self; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -CCPDebug::CCPDebug() - { - - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -CCPDebug::~CCPDebug() - { - if ( iData ) - { - iData->iFileName.Close( ); - iData->iLogFile.Close( ); - iData->iFs.Close( ); - } - Dll::FreeTls( ); - delete iData; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -EXPORT_C TBool CCPDebug::Enable() - { - DebugData* data = Data(); - if(!data) - { - return false; - } - else - { - return true; - } - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -EXPORT_C void CCPDebug::EnableLogging(TBool aEnable) - { - DebugData* data = Data(); - if(aEnable && !data->iLogEnabled) - { - if( data->iLogFile.Replace(data->iFs, data->iFileName, EFileWrite) == KErrNone ) - { - data->iLogEnabled = ETrue; - Printf(_L8("CCPDebug::EnableLogging()")); - } - } - else if(!aEnable && data->iLogEnabled) - { - data->iLogFile.Close(); - data->iLogEnabled = EFalse; - } - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -EXPORT_C void CCPDebug::Printf(TRefByValue aFormat, ...) - { - DebugData* data = Data(); - if(!data || !data->iLogEnabled) - { - return; - } - TTime now; - now.UniversalTime(); - TInt32 elapsed = (TInt32)(now.MicroSecondsFrom(data->iFirstUpdateTime).Int64() / KThousand); - - TBuf8 memData; - memData.Format(_L8("% 2d,%03d "), elapsed / KThousand, elapsed % KThousand); - - TBuf8 buf; - VA_LIST list; - VA_START(list, aFormat); - buf.FormatList(aFormat, list); - VA_END(list); - buf.Insert(0, memData); - buf.Append(_L8("\n")); - - data->iLogFile.Write(buf); - data->iLogFile.Flush(); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -EXPORT_C DebugData* CCPDebug::Data() - { - return static_cast(Dll::Tls()); - } - -// End of File diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingutils/contentpublishingmap/bwins/cputilsu.def --- a/contentpublishingsrv/contentpublishingutils/contentpublishingmap/bwins/cputilsu.def Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ -EXPORTS - ?GetProperty@CCPLiwMap@@QBEHABVTDesC8@@AAJ@Z @ 1 NONAME ; int CCPLiwMap::GetProperty(class TDesC8 const &, long &) const - ?GetPropertyL@CCPLiwMap@@QBEHABVTDesC8@@AAVRBuf16@@@Z @ 2 NONAME ; int CCPLiwMap::GetPropertyL(class TDesC8 const &, class RBuf16 &) const - ?GetPropertyL@CCPLiwMap@@QBEHABVTDesC8@@AAVRBuf8@@@Z @ 3 NONAME ; int CCPLiwMap::GetPropertyL(class TDesC8 const &, class RBuf8 &) const - ?IsValidForActionL@CCPLiwMap@@QBEXXZ @ 4 NONAME ; void CCPLiwMap::IsValidForActionL(void) const - ?IsValidForNotificationL@CCPLiwMap@@QBEXXZ @ 5 NONAME ; void CCPLiwMap::IsValidForNotificationL(void) const - ?NewL@CCPLiwMap@@SAPAV1@AAVRDesReadStream@@@Z @ 6 NONAME ; class CCPLiwMap * CCPLiwMap::NewL(class RDesReadStream &) - ?NewL@CCPLiwMap@@SAPAV1@ABVCLiwGenericParamList@@@Z @ 7 NONAME ; class CCPLiwMap * CCPLiwMap::NewL(class CLiwGenericParamList const &) - ?NewL@CContentMap@@SAPAV1@XZ @ 8 NONAME ; class CContentMap * CContentMap::NewL(void) - ?NewL@CPublisherRegistryMap@@SAPAV1@XZ @ 9 NONAME ; class CPublisherRegistryMap * CPublisherRegistryMap::NewL(void) - ?NewLC@CContentMap@@SAPAV1@XZ @ 10 NONAME ; class CContentMap * CContentMap::NewLC(void) - ?NewLC@CPublisherRegistryMap@@SAPAV1@XZ @ 11 NONAME ; class CPublisherRegistryMap * CPublisherRegistryMap::NewLC(void) - ?PackForServerLC@CCPLiwMap@@QBEPAVHBufC8@@XZ @ 12 NONAME ; class HBufC8 * CCPLiwMap::PackForServerLC(void) const - ?Reset@CCPLiwMap@@QBEXXZ @ 13 NONAME ; void CCPLiwMap::Reset(void) const - ?SetSecurityL@CCPLiwMap@@QAEXABVRMessage2@@@Z @ 14 NONAME ; void CCPLiwMap::SetSecurityL(class RMessage2 const &) - diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingutils/contentpublishingmap/eabi/cputilsu.def --- a/contentpublishingsrv/contentpublishingutils/contentpublishingmap/eabi/cputilsu.def Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -EXPORTS - _ZN11CContentMap4NewLEv @ 1 NONAME - _ZN11CContentMap5NewLCEv @ 2 NONAME - _ZN21CPublisherRegistryMap4NewLEv @ 3 NONAME - _ZN21CPublisherRegistryMap5NewLCEv @ 4 NONAME - _ZN9CCPLiwMap12SetSecurityLERK9RMessage2 @ 5 NONAME - _ZN9CCPLiwMap4NewLER14RDesReadStream @ 6 NONAME - _ZN9CCPLiwMap4NewLERK20CLiwGenericParamList @ 7 NONAME - _ZNK9CCPLiwMap11GetPropertyERK6TDesC8Rl @ 8 NONAME - _ZNK9CCPLiwMap12GetPropertyLERK6TDesC8R5RBuf8 @ 9 NONAME - _ZNK9CCPLiwMap12GetPropertyLERK6TDesC8R6RBuf16 @ 10 NONAME - _ZNK9CCPLiwMap15PackForServerLCEv @ 11 NONAME - _ZNK9CCPLiwMap17IsValidForActionLEv @ 12 NONAME - _ZNK9CCPLiwMap23IsValidForNotificationLEv @ 13 NONAME - _ZNK9CCPLiwMap5ResetEv @ 14 NONAME - _ZTI9CCPLiwMap @ 15 NONAME ; ## - _ZTV9CCPLiwMap @ 16 NONAME ; ## - diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingutils/contentpublishingmap/group/bld.inf --- a/contentpublishingsrv/contentpublishingutils/contentpublishingmap/group/bld.inf Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Build information file for Content Publisher Map -* -*/ - -// Macro definitions -#include - - -PRJ_PLATFORMS - -DEFAULT - -PRJ_EXPORTS -../inc/ccontentmap.h |../../../../inc/ccontentmap.h -../inc/cpliwmap.h |../../../../inc/cpliwmap.h -../inc/cpublisherregistrymap.h |../../../../inc/cpublisherregistrymap.h - -PRJ_MMPFILES -cputils.mmp - - -// End of File diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingutils/contentpublishingmap/group/cputils.mmp --- a/contentpublishingsrv/contentpublishingutils/contentpublishingmap/group/cputils.mmp Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 -* -*/ - -// To get the MW_LAYER_SYSTEMINCLUDE-definition -#include - -TARGET cputils.dll -TARGETTYPE dll - -UID 0x1000008D 0x20016B7F - -CAPABILITY CAP_GENERAL_DLL -VENDORID VID_DEFAULT - -LANG SC - -SOURCEPATH ../src -SOURCE cpliwmap.cpp -SOURCE ccontentmap.cpp -SOURCE cpublisherregistrymap.cpp -SOURCE cpsecuritypolicy.cpp - -USERINCLUDE ../inc -USERINCLUDE ../../contentpublishingdebug/inc -USERINCLUDE ../../../contentpublishingserver/cpserver/inc - -MW_LAYER_SYSTEMINCLUDE - -LIBRARY euser.lib -LIBRARY estor.lib -LIBRARY efsrv.lib -LIBRARY sqldb.lib -LIBRARY bafl.lib -LIBRARY liwservicehandler.lib inetprotutil.lib - -#ifdef CONTENT_PUBLISHER_DEBUG -LIBRARY cpdebug.lib -#endif - -//end of file diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingutils/contentpublishingmap/inc/ccontentmap.h --- a/contentpublishingsrv/contentpublishingutils/contentpublishingmap/inc/ccontentmap.h Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,215 +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: CContentMap - class used in Content Publisher - * -*/ - -#ifndef C_CONTENTMAP_H -#define C_CONTENTMAP_H - -#include "cpliwmap.h" - -// CLASS DECLARATION -/** - * Map which contains ids and serialized data stored by - * Content Publisher - * - * @lib cputils.dll - * @since S60 v5.0 - */ -NONSHARABLE_CLASS( CContentMap ): public CCPLiwMap - { -public: - - /** - * Two-phased constructor. - */ - IMPORT_C static CContentMap* NewL( ); - - /** - * Two-phased constructor. - */ - IMPORT_C static CContentMap* NewLC( ); - - /** - * Destructor. - */ - virtual ~CContentMap(); - - -private: - - /** - * Adds to database current content - * - * @param aSqlDb handle to database - * @param aNotificationList list of notifications to fill in when - * something was actually changed in dataabse - * - * @return id of added entry - */ - TInt32 AddL( RSqlDatabase aSqlDb, - CLiwDefaultList* aNotificationList = NULL ) const; - - /** - * Fetches entries from database - * - * @param aSqlDb handle to database - * @param aList target list for enntries - * @param aItemsToDelete ids of entries for removal - - * they were found to be expired - * - * @return number of fetched entries - */ - TUint GetListL( RSqlDatabase aSqlDb, - CLiwGenericParamList* aList, - RArray& aItemsToDelete ) const; - - /** - * Removes entries from database - * - * @param aSqlDb handle to database - * @param aNotificationList list of notifications to fill in when - * something was actually changed in dataabse - */ - void RemoveL( RSqlDatabase aSqlDb , - CLiwDefaultList* aNotificationList = 0 ) const; - - /** - * Saves results from query to SQLite Server - * - * @param aStmt handle to SQL statement - * @param aList target list for enntries - * @param aItemsToDelete ids of entries for removal - - * they were found to be expired - */ - void SaveQueryResultsL( RSqlStatement& aStmt , - CLiwGenericParamList& aList, - RArray& aItemsToDelete ) const; - - /** - * Prepares SQL query for Add operation - * - * @param aSqlDb handle to database - * @param aStmt handle to SQL statement - * @param aQuery SQL query - * - */ - void PrepareStmtforAddL(RSqlDatabase aSqlDb, - RSqlStatement& aStmt , - const TDesC& aQuery ) const; - - /** - * Prepares SQL query for Update operation - * - * @param aSqlDb handle to database - * @param aStmt handle to SQL statement - * @param aId id of entry to update - * - */ - void PrepareStmtforUpdateL( RSqlDatabase aSqlDb, - RSqlStatement& aStmt, - TInt32 aId ) const; - - /** - * Updates entry in database - * - * @param aSqlDb handle to database - * @param aId id entry to update - * @param aNotificationList list of notifications to fill in when - * something was actually changed in dataabse - */ - void UpdateL( RSqlDatabase aSqlDb, TInt32 aId, - CLiwDefaultList* aNotificationList ) const; - - /** - * Performs actuall add operation - * - * @param aSqlDb handle to database - * @param aNotificationList list of notifications to fill in when - * something was actually changed in dataabse - * - * @return id of added entry - */ - TInt32 AddToDbL( RSqlDatabase aSqlDb, - CLiwDefaultList* aNotificationList ) const; - - /** - * Appends sorting criteria as strings to SQL query according to aSort - * - * @param aQuery SQL query - * @param aSort sort filter as TInt - */ - void AppendSortL( RBuf& aQuery, const TCPSortOrder& aSort ) const; - - /** - * Checks expiration time - * @param aExpirationTime time to checking with current time - * @return true if aExpirationTime is correct - */ - TBool IsOutdated( const TTime aExpirationTime ) const; - - /** - * Check if data map is set - * - * @return ETrue if ContentType was set, EFalse if not - */ - void IsDataMapL() const; - - /** - * Gets expiration time from own data - * @param aResult expiration date - * @return ETrue if expiration date is find, EFalse if not - */ - TBool GetExpirationDateL( TTime& aResult ) const; - - /** - * Check if IDs are valid for Delete operation - * - */ - void IsValidForDeleteL() const; - - /** - * Check if IDs are valid for GetList operation - */ - void IsValidForGetListL() const ; - - /** - * - * @return ETrue if supported, EFalse if not - */ - TBool ActivateActionSupport( ) const; - - /** - * - * @return ETrue if activate flag is set, EFalse if not - */ - TBool GetActivateInfo( ) const; - - -private: - - /** - * C++ default constructor. - */ - CContentMap(); - - /** - * Perform the second phase construction of a CContentMap object. - */ - void ConstructL(); - - }; - -#endif // C_CONTENTMAP_H diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingutils/contentpublishingmap/inc/cpliwmap.h --- a/contentpublishingsrv/contentpublishingutils/contentpublishingmap/inc/cpliwmap.h Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,620 +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: CCPLiwMap - class used in Content Publisher - * -*/ - -#ifndef C_CPLIWIDSMAP_H -#define C_CPLIWIDSMAP_H - -#include -#include -#include "cpglobals.h" - -class RDesReadStream; -class CCPSecurityPolicy; - -// CLASS DECLARATION -/** - * Base Map class for Publisher Registry and Content - * - * @lib cputils.dll - * @since S60 v5.0 - */ -class CCPLiwMap : public CLiwMap - { - -protected: - - /** - * Enum defining the properties of filter. - */ - enum TCPProperties - { - EPublisher = 1, - EContentType = 2, - EContentId = 4, - EFlag = 8, - }; - - /** - * Enum defining the sort ordering. - */ - enum TCPSortOrder - { - ECPRecent = 1, // 0001 - ECPPublisher = 2, // 0010 - ECPContent = 4, // 0100 - ECPContentId = 8 // 1000 - }; - -public: - - friend class CCpStorageEngine; - - /** - * Two-phased constructor. - */ - IMPORT_C static CCPLiwMap* NewL( RDesReadStream& aStream ); - - /** - * Two-phased constructor. - */ - IMPORT_C static CCPLiwMap* NewL( const CLiwGenericParamList& aList ); - - /** - * Used by client to serialize this object - * - * @return object serialized to binary - */ - IMPORT_C HBufC8* PackForServerLC() const; - - /** - * Reset map - */ - IMPORT_C void Reset( ) const; - - /** - * Leaves when Add data operation is not possible due - * to missing of some parameter - */ - virtual void IsValidForAddL( ) const; - - /** - * Leaves when Execute Action operation is not possible due - * to missing of some parameter - */ - IMPORT_C void IsValidForActionL( ) const; - - /** - * Leaves when RequestNotification operation is not possible due - * to missing of some parameter - */ - IMPORT_C void IsValidForNotificationL( ) const; - - /** - * Fetches value for property(key) from internal map - * - * @param aProperty name of the property ( key ) - * @param aResult target descriptor for fetching operation - * @return ETrue is property found or EFalse if not - */ - IMPORT_C TBool GetPropertyL( const TDesC8& aProperty, - RBuf& aResult ) const; - - /** - * Fetches value for property(key) from internal map - * - * @param aProperty name of the property ( key ) - * @param aResult target binary for fetching operation - * @return ETrue is property found or EFalse if not - */ - IMPORT_C TBool GetPropertyL( const TDesC8& aProperty, - RBuf8& aResult ) const; - - /** - * Fetches value for property(key) from internal map - * - * @param aProperty name of the property ( key ) - * @param aResult target integer for fetching operation - * @return ETrue is property found or EFalse if not - */ - IMPORT_C TBool GetProperty( const TDesC8& aProperty, - TInt32& aResult ) const; - - - /** - * Setter for security policy - * - * @param aPolicy security policy - */ - IMPORT_C void SetSecurityL( const RMessage2& aMessage ); - - /** - * Destructor. - */ - virtual ~CCPLiwMap(); - - /** - * Check if IDs are valid for Delete operation - */ - virtual void IsValidForDeleteL() const =0; - - /** - * Check if IDs are valid for GetList operation - */ - virtual void IsValidForGetListL() const =0; - - /** - * - * @return ETrue if supported, EFalse if not - */ - virtual TBool ActivateActionSupport( ) const = 0; - - /** - * - * @return ETrue if activate flag is set, EFalse if not - */ - virtual TBool GetActivateInfo( ) const = 0; - - -public: - - // from base class CLiwMap - /** - * Inserts a key-value pair element to the map collection. If - * the specified key already exists, it will be removed from - * the collection and the new key-value pair will be added to the - * map. - * - * @param aKey the key to be stored - * @param aValue the value associated with the key to be stored - */ - void InsertL( const TDesC8& aKey, const TLiwVariant& aValue ); - - /** - * Finds a value stored in the map collection based on the key. - * - * @param aKey the key to be searched - * @param aFndValue the value associated with the found key - * @return false if there is no key stored; true otherwise - */ - TBool FindL( const TDesC8& aKey, TLiwVariant& aValue ) const; - - /** - * Returns the number of key-value pair stored in the map collection. - * - * @return the number of key-value pair stored in the map collection - */ - TInt Count() const; - - /** - * Returns the key stored at a specified index. - * - * @param aIndex the index of the key to be found - * @param aFndKey the key found at the passed index - * - * @return true if a key-value entry is found at the passed index; - * false otherwise - */ - TBool AtL( TInt aIndex, TDes8& aFndKey ) const; - - /** - * Removes a key from the map collection. - * - * @param aKey the key to be removed from the map - */ - void Remove( const TDesC8& aKey ); - - /** - * Returns the size of the collection. The size is - * calculated based on the total numer of key-value elements - * and the size of each pair in the collection - * - * @return the size of the collection - */ - TInt Size() const; - - /** - * The container managed data values can be serialized to an output - * stream. - * - * @param aOutputStream the output stream to which the data will be streamed - */ - void ExternalizeL( RWriteStream& aOutputStream ) const; - -protected: - - /** - * Adds to database current content - * - * @param aSqlDb handle to database - * @param aNotificationList list of notifications to fill in when - * something was actually changed in dataabse - * - * @return id of added entry - */ - virtual TInt32 AddL( RSqlDatabase aSqlDb, - CLiwDefaultList* aNotificationList = 0 ) const= 0; - - /** - * Fetches entries from database - * - * @param aSqlDb handle to database - * @param aList target list for enntries - * @param aItemsToDelete ids of entries for removal - - * they were found to be expired - * - * @return number of fetched entries - */ - virtual TUint GetListL( RSqlDatabase aSqlDb, CLiwGenericParamList* aList, - RArray& aItemsToDelete ) const = 0; - - /** - * Removes entries from database - * - * @param aSqlDb handle to database - * @param aNotificationList list of notifications to fill in when - * something was actually changed in dataabse - */ - virtual void RemoveL( RSqlDatabase aSqlDb, - CLiwDefaultList* aNotificationList = 0 ) const = 0; - - /** - * Saves results from query to SQLite Server - * - * @param aStmt handle to SQL statement - * @param aList target list for enntries - * @param aItemsToDelete ids of entries for removal - - * they were found to be expired - */ - virtual void SaveQueryResultsL( RSqlStatement& aStmt, - CLiwGenericParamList& aList, RArray& aItemsToDelete ) const = 0; - - /** - * Updates entry in database - * - * @param aSqlDb handle to database - * @param aNotificationList list of notifications to fill in when - * something was actually changed in dataabse - */ - virtual void UpdateL( RSqlDatabase aSqlDb, TInt32 aId, - CLiwDefaultList* aNotificationList = 0 ) const = 0; - - /** - * Performs actuall add operation - * - * @param aSqlDb handle to database - * @param aNotificationList list of notifications to fill in when - * something was actually changed in dataabse - * - * @return id of added entry - */ - virtual TInt32 AddToDbL( RSqlDatabase aSqlDb, - CLiwDefaultList* aNotificationList = 0 ) const = 0; - - /** - * Checks if operation value is proper - * - * @param aValue contains operation value - */ - void IsProperOperationL( const TLiwVariant& aValue ) const; - - - /** - * Appends GetList filter as strings to SQL query according to aFilter - * - * @param aQuery SQL query - * @param aFilter as enum - * - */ - void AppendGetListFilterL( RBuf& aQuery, TUint& aFilter ) const; - - /** - * Appends Remove filter as strings to SQL query according to aFilter - * - * @param aQuery SQL query - * @param aFilter as enum - * - */ - void AppendRemoveFilterL( RBuf& aQuery, TUint& aFilter ) const; - - - /** - * Appends filter as strings to SQL query according to aFilter - * - * @param aQuery SQL query - * @param aFilter as enum - * - */ - virtual void AppendFilterL( RBuf& aQuery, TUint& aFilter ) const; - - /** - * Prepares SQL query for Add operation - * - * @param aSqlDb handle to database - * @param aStmt handle to SQL statement - * @param aQuery SQL query - * - */ - virtual void PrepareStmtforAddL( RSqlDatabase aSqlDb, - RSqlStatement& aStmt, const TDesC& aQuery ) const; - /** - * Appends sorting criteria as strings to SQL query according to aSort - * - * @param aQuery SQL query - * @param aSort sort filter as TInt - * - */ - virtual void AppendSortL( RBuf& aQuery, - const TCPSortOrder& aSort ) const = 0; - - /** - * Fills change info map with proper values - *aStmt - * @param aStmt handle to SQL statement - * @param aChangeInfoMap map that will be filed - * - */ - virtual void FillChangeInfoMapL( RSqlStatement& aStmt, - CLiwDefaultMap* aMap ) const; - -protected: - - /** - * Sets all parameters according to provided list - * @param aItemMap map with parameters - */ - void SetL( const CLiwGenericParamList& aInParamList ); - - /** - * Check Get properties - * - * @return logical sum of TCPProperties of the object - */ - TUint GetFilterL() const; - - /** - * Check and return sort order - * - * @return Sort Criteria - */ - TCPSortOrder GetSortL() const; - - /** - * Check if Publisher name is set - * - * @return ETrue if Publisher name was set, EFalse if not - */ - TBool IsPublisherNameL() const; - - /** - * Check if ContentType is set - * - * @return ETrue if ContentType was set, EFalse if not - */ - TBool IsContentTypeL() const; - - /** - * Check if ContentId is set - * - * @return ETrue if ContentId was set, EFalse if not - */ - TBool IsContentIdL() const; - - /** - * Check if ActionTrigger is set - * - * @return ETrue if ActionTrigger was set, EFalse if not - */ - TBool IsTriggerL( ) const; - - /** - * Check if Flag is present - * - * @return ETrue if ContentId was set, EFalse if not - */ - TBool IsFlag( ) const; - - /** - * Checks if Id property is present in internal map - * - */ - TBool IsId() const; - - /** - * Checks if property(key) is present in internal map - * - */ - TBool PropertyExists( const TDesC8& aProperty ) const; - - - /** - * Fetches entries from database - * - * @param aSqlDb handle to database - * @param aQuery aQuery SQL query - * @param aList target list for enntries - * @param aItemsToDelete ids of entries for removal - - * they were found to be expired - * - * @return number of fetched entries - */ - TUint GetListL( RSqlDatabase aSqlDb, const TDesC& aQuery, - CLiwGenericParamList* aList, RArray& aItemsToDelete ) const; - - /** - * Removes entries from database - * - * @param aSqlDb handle to database - * @param aQuery SQL query - * - */ - void RemoveL( RSqlDatabase aSqlDb, const TDesC& aQuery ) const; - - /** - * Fetches Ids (Publisher, ContentType, ContentId) from database - * - * @param aId id entry in database - * @param aQuery SQL query - * @param aMap map to insert Ids - * @param aSqlDb handle to database - * - */ - void FetchIdsL( TInt32 aId, const TDesC& aQuery, CLiwDefaultMap* aMap, - RSqlDatabase aSqlDb ) const; - - /** - * Fetches Id from database - * - * @param aSqlDb handle to database - * @param aQuery SQL query - * @param aId id entry from database - * - */ - void FetchIdL( RSqlDatabase aSqlDb, - const TDesC& aQuery, TInt32& aId ) const; - - /** - * Gets Ids (Id, Publisher, ContentType, ContentId) - * of removed entries from database - * - * @param aSqlDb handle to database - * @param aQuery SQL query - * @param aList List with ids - * - */ - void GetIdsOfRemovedEntriesL( RSqlDatabase aSqlDb, const TDesC& aQuery, - CLiwDefaultList* aList ) const; - - /** - * Saves Ids (Id, Publisher, ContentType, ContentId) from database - * - * @param aSqlDb handle to database - * @param aList List with ids - * - */ - void SaveQueryResultsIdsL( RSqlStatement& aStmt, - CLiwDefaultList* aList ) const; - - /** - * Contructs SQL query to select entry - * @param aQuery SQL query - * - */ - void ConstructSelectIdL( RBuf& aQuery ) const; - - /** - * Contructs SQL query to select entries for GetList - * @param aQuery SQL query - * - */ - void ConstructGetListSelectL( RBuf& aQuery, TBool aGet = ETrue ) const; - - /** - * Contructs SQL query to select entries for Remove - * @param aQuery SQL query - * - */ - void ConstructRemoveSelectL( RBuf& aQuery, TBool aGet = ETrue ) const; - - /** - * Binds value to query - * @param aQuery SQL query - * @param aSqlDb handle to database - * - */ - void BindValueL( const RBuf& aQuery, RSqlStatement& aStmt ) const; - - /** - * Checks if GetList for all items should be done - * @param aFilter flag describing which ids are set - * @return ETrue if getlist for all items shold be done, EFalse if not - */ - TBool IsGetListAllL( TUint aFilter ) const; - - /** - * Removes attributes with "All" value from map - * @param aFilter filter bit will be reset if any attribute == "all" - */ - void RemoveAllAttributeL( TUint& aFilter ) const; - - /** - * Leaves if publisher, content type od content_id is not descriptor type. - */ - void CheckIdentifiersL() const; - - /** - * Leaves if aParameterIndex is negative-error value - * or in case of binding error. - */ - void BindTextL(RSqlStatement& aStmt, TInt aParameterIndex, - const TDesC& aParameterText) const; - - /** - * Leaves if aParameterIndex is negative-error value - * or in case of binding error. - */ - void BindBinaryL(RSqlStatement& aStmt, TInt aParameterIndex, - const TDesC8& aParameterText) const; - - /** - * Leaves if aParameterIndex is negative-error value - * or in case of binding error. - */ - void BindInt64L(RSqlStatement& aStmt, TInt aParameterIndex, - TInt64 aParameterValue) const; - - /** - * Leaves if aParameterIndex is negative-error value - * or in case of binding error. - */ - void BindIntL(RSqlStatement& aStmt, TInt aParameterIndex, - TInt aParameterValue) const; - - /** - * Leaves if column index return value is negative. - * @return result of RSqlStatement::ColumnIndex - */ - TInt ColumnIndexL( RSqlStatement& aStmt, const TDesC& aColumnName ) const; -protected: - - /** - * C++ default constructor. - */ - CCPLiwMap(); - - /** - * Perform the second phase construction of a CCPLiwMap object. - */ - void ConstructL(); - -protected: - // data - - /* - * The underlying generic parameter list - * Own. - */ - CLiwGenericParamList* iMap; - - /* - * Class used for security - *Own. - */ - const CCPSecurityPolicy* iPolicy; - - }; - -#endif // C_CPLIWIDSMAP_H diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingutils/contentpublishingmap/inc/cpsecuritypolicy.h --- a/contentpublishingsrv/contentpublishingutils/contentpublishingmap/inc/cpsecuritypolicy.h Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,145 +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: Class used by session to handle access control list - * Version : %version: ou1s60ui#4.1.1 % << Don't touch! Updated by Synergy at check-out. - * -*/ - - -#ifndef C_CPSECURITYPOLICY_H -#define C_CPSECURITYPOLICY_H - -#include - -class CLiwDefaultMap; - -/** - * Internal class for Security related activities - * - * @since S60 v5.0 - */ -NONSHARABLE_CLASS( CCPSecurityPolicy ): public CBase - { -public: - - enum TACLPolicy - { - ERead, - EWrite, - EDelete - }; - - /** - * Two-phased constructor. - */ - static CCPSecurityPolicy* NewL( const RMessage2& aMessage ); - - /** - * Two-phased constructor. - */ - static CCPSecurityPolicy* NewLC( const RMessage2& aMessage ); - - /** - * Destructor. - */ - virtual ~CCPSecurityPolicy(); - - /** - * Sets default ACL map and serializes it - * - * @param aPolicy target for ACL binary - */ - void GetDefaultSecurityL( RBuf8& aResult ) const ; - - /** - * Checks if access for client (iMessage) - * should be granted or not - * - * @param aBinary serialized ACL map - * @param aPolicy secururity policy to check - * @return ETrue if security check is ok, - * EFalse if not - */ - TBool CheckSecurityL( TPtrC8& aBinary , TACLPolicy aPolicy ) const; - - /** - * Performs actuall security check - * should be granted or not - * - * @param aMap ACL map - * @return ETrue if security check is ok, - * EFalse if not - */ - TInt DoCheckSecurityL( const CLiwMap* aMap ) const; - - /** - * Performs security check based on client UIDs - * - * @param aList list of uids which have access - * - * @return access granted or not - */ - TBool CheckUids( const TDesC& aList ) const ; - - /** - * Performs security check based on client Capabilities - * - * @param aList list of capabilities which client must have - * - * @return access granted or not - */ - TBool CheckCapabilities( const TDesC& aList ) const; - - /** - * Exctracts from list next token( UID or Capability ) - * - * @param aList list as desciptor - * @param aResult single token extracted from list - * @param aPos position of the reuired token - */ - void ExctractNextToken( const TDesC& aList, - TPtrC& aResult , TInt& aPos ) const; - /** - * Converts capability given as descriptor to enum - * - * @param aCapability descriptor to convert - * - * @return Capablity as enum - */ - TCapability GetCapability( const TDesC& aCapability ) const; - -private: - - /** - * C++ default constructor. - */ - CCPSecurityPolicy( const RMessage2& aMessage ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - -private: - // data - - /* - * Not own. - * Message from client - */ - const RMessage2& iMessage; - - }; - -#endif // C_CPSECURITYPOLICY_H diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingutils/contentpublishingmap/inc/cpssqlcommands.h --- a/contentpublishingsrv/contentpublishingutils/contentpublishingmap/inc/cpssqlcommands.h Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,126 +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: - * Version : %version: ou1s60ui#7.1.1 % << Don't touch! Updated by Synergy at check-out. - * -*/ - - -#ifndef C_CPSSQL_H -#define C_CPSSQL_H - -//Insert Data -//Update Data - - -_LIT( KSQLUpdate, "UPDATE CP_MAIN_TABLE SET " ); -_LIT( KSQLUpdateData, "Data = :Data " ); -_LIT( KSQLUpdateAction, "Action = :Action " ); -_LIT( KSQLUpdateExpirationDate, "Expiration_date = :Expiration_date " ); -_LIT( KSQLUpdateFlag, "Flag = :Flag " ); -_LIT( KSQLUpdateWhere, "WHERE Id = :Id " ); -_LIT( KComma, ", " ); - -_LIT( KSQLUpdateRegistry, "UPDATE CP_PUBLISHER_TABLE SET " ); - -_LIT( KSQLInsert, - "INSERT INTO CP_MAIN_TABLE (Publisher,Content_type,Content_id,Expiration_date,Access_List,Data,Action) VALUES ( \ - :Publisher,\ - :Content_type,\ - :Content_id,\ - :Expiration_date,\ - :Access_List,\ - :Data,\ - :Action )" ); - -_LIT( KSQLInsertToRegistry, - "INSERT INTO CP_PUBLISHER_TABLE (Publisher,Content_type,Content_id,Flag,Access_List,Data,Action) VALUES ( \ - :Publisher,\ - :Content_type,\ - :Content_id,\ - :Flag,\ - :Access_List,\ - :Data,\ - :Action )" ); - -//Delete Data -_LIT( KSQLDelete, "DELETE FROM CP_MAIN_TABLE" ); -_LIT( KSQLDeleteFromRegistry, "DELETE FROM CP_PUBLISHER_TABLE" ); - -//Get Data -_LIT( KSQLGetLastInsertId, "SELECT last_insert_rowid() "); - -_LIT( KSQLGetList, - "SELECT Id,Publisher,Content_type,Content_id,Expiration_date,Access_List,Data,Action FROM CP_MAIN_TABLE"); -_LIT( KSQLGetIds, - "SELECT Id,Publisher,Content_type,Content_id,Access_List FROM CP_MAIN_TABLE"); -_LIT( KSQLGetIdsRegistry, - "SELECT Id,Publisher,Content_type,Content_id,Access_List,Flag FROM CP_PUBLISHER_TABLE" ); -_LIT( KSQLGetAction, - "SELECT Action FROM CP_MAIN_TABLE WHERE "); - -_LIT( KSQLGetListFromRegistry, - "SELECT Id,Publisher,Content_type,Content_id,Access_List,Flag,Data,Action FROM CP_PUBLISHER_TABLE"); -_LIT( KSQLGetIdsFromRegistry, - "SELECT Id,Publisher,Content_type,Content_id FROM CP_PUBLISHER_TABLE"); -_LIT( KSQLGetActionFromRegistry, - "SELECT Id,Action FROM CP_PUBLISHER_TABLE WHERE "); - -_LIT( KSQLGetFlag ,"Flag <> 0"); -_LIT( KSQLGetPublisher ,"Publisher = :Publisher"); -_LIT( KSQLGetContentType ,"Content_type = :Content_type"); -_LIT( KSQLGetContentId ,"Content_id = :Content_id"); -_LIT( KSQLGetId ,"Id = :Id"); -_LIT( KAnd," AND "); - -_LIT( KSQLFetchId, - "SELECT Id FROM CP_MAIN_TABLE WHERE Publisher =:Publisher AND Content_type=:Content_type AND Content_id =:Content_id"); -_LIT( KSQLFetchIds, - "SELECT Publisher,Content_type,Content_id,Access_List FROM CP_MAIN_TABLE WHERE Id =:Id"); - -_LIT( KSQLFetchIdFromRegistry, - "SELECT Id FROM CP_PUBLISHER_TABLE WHERE Publisher =:Publisher AND Content_type=:Content_type AND Content_id =:Content_id" ); -_LIT( KSQLFetchIdsFromRegistry, - "SELECT Publisher,Content_type,Content_id,Access_List FROM CP_PUBLISHER_TABLE WHERE Id =:Id" ); - -_LIT( KSQLPublisher, ":Publisher" ); -_LIT( KSQLContent_type, ":Content_type" ); -_LIT( KSQLContent_id, ":Content_id" ); -_LIT( KSQLExpiration_date, ":Expiration_date" ); -_LIT( KSQLFlag, ":Flag" ); -_LIT( KSQLData, ":Data" ); -_LIT( KSQLAction, ":Action" ); -_LIT( KSQLAccessList, ":Access_List" ); -_LIT( KSQLId, ":Id" ); - -_LIT( KSQLOrderRecent, " ORDER BY Id DESC" ); -_LIT( KSQLOrderPublisher, " ORDER BY Publisher" ); -_LIT( KSQLOrderContent, " ORDER BY Content_type" ); -_LIT( KSQLOrderContentId, " ORDER BY Content_id" ); - -_LIT( KColumnId, "Id" ); -_LIT( KColumnPublisher, "Publisher" ); -_LIT( KColumnContent_type, "Content_type" ); -_LIT( KColumnContent_id, "Content_id" ); -_LIT( KColumnAccessList, "Access_List" ); -_LIT( KColumnExpiration_date, "Expiration_date" ); -_LIT( KColumnFlag, "Flag" ); -_LIT( KColumnData, "Data" ); -_LIT( KColumnAction, "Action" ); - -_LIT( KWhere, " WHERE "); - -_LIT8( KList, "List" ); - -#endif //C_CPSSQL_H diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingutils/contentpublishingmap/inc/cpublisherregistrymap.h --- a/contentpublishingsrv/contentpublishingutils/contentpublishingmap/inc/cpublisherregistrymap.h Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,204 +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: CPublisherRegistryMap - class used in Content Publisher - * -*/ - -#ifndef C_CPUBLISHERREGISTRYMAP_H -#define C_CPUBLISHERREGISTRYMAP_H - -#include "cpliwmap.h" - -// CLASS DECLARATION -/** - * Map which contains Publisher Registry information - * - * @lib cputils.dll - * @since S60 v5.0 - */ -NONSHARABLE_CLASS( CPublisherRegistryMap ): public CCPLiwMap - { -public: - - /** - * Two-phased constructor. - */ - IMPORT_C static CPublisherRegistryMap* NewL( ); - - /** - * Two-phased constructor. - */ - IMPORT_C static CPublisherRegistryMap* NewLC( ); - - /** - * Destructor. - */ - virtual ~CPublisherRegistryMap(); - -private: - - /** - * Adds to database current content - * - * @param aSqlDb handle to database - * @param aNotificationList list of notifications to fill in when - * something was actually changed in dataabse - * - * @return id of added entry - */ - TInt32 AddL( RSqlDatabase aSqlDb, - CLiwDefaultList* aNotificationList = 0 ) const; - - /** - * Fetches entries from database - * - * @param aSqlDb handle to database - * @param aList target list for enntries - * @param aItemsToDelete ids of entries for removal - - * they were found to be expired - * - * @return number of fetched entries - */ - TUint GetListL( RSqlDatabase aSqlDb, - CLiwGenericParamList* aList, - RArray& aItemsToDelete ) const; - /** - * - */ - void RemoveL( RSqlDatabase aSqlDb, - CLiwDefaultList* aNotificationList = 0 ) const; - - /** - * Removes entries from database - * - * @param aSqlDb handle to database - * @param aNotificationList list of notifications to fill in when - * something was actually changed in dataabse - */ - void SaveQueryResultsL( RSqlStatement& aStmt , - CLiwGenericParamList& aList, - RArray& aItemsToDelete )const; - - /** - * Performs actuall add operation - * - * @param aSqlDb handle to database - * @param aNotificationList list of notifications to fill in when - * something was actually changed in dataabse - * - * @return id of added entry - */ - TInt32 AddToDbL( RSqlDatabase aSqlDb, - CLiwDefaultList* aNotificationList ) const; - - /** - * Appends filter as strings to SQL query according to aFilter - * - * @param aQuery SQL query - * @param aFilter as enum - * - */ - void AppendFilterL( RBuf& aQuery, TUint& aFilter ) const; - - /** - * Appends sorting criteria as strings to SQL query according to aSort - * - * @param aQuery SQL query - * @param aSort sort filter as TInt - */ - void AppendSortL( RBuf& aQuery, const TCPSortOrder& aSort ) const; - - /** - * Prepares SQL query for Add operation - * - * @param aSqlDb handle to database - * @param aStmt handle to SQL statement - * @param aQuery SQL query - * - */ - void PrepareStmtforAddL(RSqlDatabase aSqlDb, - RSqlStatement& aStmt , - const TDesC& aQuery ) const; - - /** - * Prepares SQL query for Update operation - * - * @param aSqlDb handle to database - * @param aStmt handle to SQL statement - * @param aId id of entry to update - * - */ - void PrepareStmtforUpdateL( RSqlDatabase aSqlDb, - RSqlStatement& aStmt, - TInt32 aId ) const; - - /** - * Updates entry in database - * - * @param aSqlDb handle to database - * @param aId id entry to update - * @param aNotificationList list of notifications to fill in when - * something was actually changed in dataabse - */ - void UpdateL( RSqlDatabase aSqlDb, TInt32 aId, - CLiwDefaultList* aNotificationList = 0 ) const; - - /** - * Check if IDs are valid for Delete operation - * - */ - void IsValidForDeleteL() const; - - /** - * Check if IDs are valid for GetList operation - */ - void IsValidForGetListL() const ; - - /** - * - * @return ETrue if supported, EFalse if not - */ - TBool ActivateActionSupport( ) const; - - /** - * - * @return ETrue if activate flag is set, EFalse if not - */ - TBool GetActivateInfo( ) const; - - /** - * Fills change info map with proper values - *aStmt - * @param aStmt handle to SQL statement - * @param aChangeInfoMap map that will be filed - * - */ - void FillChangeInfoMapL( RSqlStatement& aStmt, - CLiwDefaultMap* aMap ) const; - -private: - - /** - * C++ default constructor. - */ - CPublisherRegistryMap(); - - /** - * Perform the second phase construction of a CPublisherRegistryMap object. - */ - void ConstructL(); - - }; - -#endif // C_CPUBLISHERREGISTRYMAP_H diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingutils/contentpublishingmap/src/ccontentmap.cpp --- a/contentpublishingsrv/contentpublishingutils/contentpublishingmap/src/ccontentmap.cpp Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,563 +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 - -#include "ccontentmap.h" -#include "cpglobals.h" -#include "cpdebug.h" -#include "cpssqlcommands.h" -#include "cpsecuritypolicy.h" - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// - -CContentMap::CContentMap() - { - - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CContentMap::ConstructL() - { - CCPLiwMap::ConstructL( ); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -EXPORT_C CContentMap* CContentMap::NewL( ) - { - CContentMap* self = CContentMap::NewLC( ); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -EXPORT_C CContentMap* CContentMap::NewLC( ) - { - CContentMap* self = new (ELeave) CContentMap(); - self->PushL(); - self->ConstructL( ); - return self; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -CContentMap::~CContentMap() - { - - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -TInt32 CContentMap::AddL( RSqlDatabase aSqlDb, - CLiwDefaultList* aNotificationList ) const - { - CP_DEBUG( _L8("CContentMap::AddL") ); - TInt32 id( 0); - if ( !GetProperty( KId, id ) ) - { - FetchIdL( aSqlDb, KSQLFetchId, id ); - } - if ( id ) - { - UpdateL( aSqlDb, id, aNotificationList ); - } - else - { - id = AddToDbL( aSqlDb, aNotificationList ); - } - return id; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -TUint CContentMap::GetListL( RSqlDatabase aSqlDb, - CLiwGenericParamList* aList, RArray& aItemsToDelete ) const - { - CP_DEBUG( _L8("CContentMap::GetListL") ); - aItemsToDelete.Reset( ); - return CCPLiwMap::GetListL( aSqlDb, KSQLGetList, aList, aItemsToDelete ); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CContentMap::RemoveL( RSqlDatabase aSqlDb, - CLiwDefaultList* aNotificationList ) const - { - CP_DEBUG( _L8("CContentMap::RemoveL") ); - //get ids of items to be deleted - GetIdsOfRemovedEntriesL( aSqlDb, KSQLGetIds, aNotificationList ); - CCPLiwMap::RemoveL( aSqlDb, KSQLDelete ); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CContentMap::SaveQueryResultsL( RSqlStatement& aStmt, - CLiwGenericParamList& aList, RArray& aItemsToDelete ) const - { - CP_DEBUG( _L8("CContentMap::SaveQueryResultsL") ); - TInt idIndex = ColumnIndexL( aStmt, KColumnId ); - TInt publisherIndex = ColumnIndexL( aStmt, KColumnPublisher ); - TInt contentIndex = ColumnIndexL( aStmt, KColumnContent_type ); - TInt content_idIndex = ColumnIndexL( aStmt, KColumnContent_id ); - TInt expiration_dateIndex = ColumnIndexL( aStmt, KColumnExpiration_date ); - TInt acl_Index = ColumnIndexL( aStmt, KColumnAccessList ); - TInt data_Index = ColumnIndexL( aStmt, KColumnData ); - TInt action_Index = ColumnIndexL( aStmt, KColumnAction ); - - TBool aclCheckFailed( EFalse ); - while ( aStmt.Next( ) == KSqlAtRow ) - { - TBool securityOk( EFalse ); - if( iPolicy ) - { - TPtrC8 acl; - User::LeaveIfError( aStmt.ColumnBinary( acl_Index, acl ) ); - securityOk = iPolicy->CheckSecurityL( acl , - CCPSecurityPolicy::ERead ); - if ( !securityOk ) - { - aclCheckFailed = ETrue; - } - } - if ( !iPolicy || securityOk ) - { - TInt32 id = aStmt.ColumnInt( idIndex ) ; - TPtrC publisher; - User::LeaveIfError( aStmt.ColumnText( publisherIndex, - publisher ) ); - TPtrC content_type; - User::LeaveIfError( aStmt.ColumnText( contentIndex, - content_type ) ); - TPtrC content_id; - User::LeaveIfError( aStmt.ColumnText( content_idIndex, - content_id ) ); - CLiwDefaultMap* targetMap = CLiwDefaultMap::NewLC( ); - targetMap->InsertL( KId, TLiwVariant( id ) ); - targetMap->InsertL( KPublisherId, TLiwVariant( publisher ) ); - targetMap->InsertL( KContentType, TLiwVariant(content_type ) ); - targetMap->InsertL( KContentId, TLiwVariant( content_id ) ); - - TInt64 expiration_date; - expiration_date = aStmt.ColumnInt64( expiration_dateIndex ); - if ( ( expiration_date ) - &&(IsOutdated( TTime( expiration_date ) )) ) - { - // add id of item to be deleted to aItemsToDelete array - // do not continue getlist operation - aItemsToDelete.AppendL( id ); - }//if - else - { - // continue getlist operation - TPtrC8 data; - User::LeaveIfError( aStmt.ColumnBinary( data_Index, data ) ); - TPtrC8 action; - User::LeaveIfError( aStmt.ColumnBinary( action_Index, action ) ); - if( data.Ptr() ) - { - targetMap->InsertL( KDataMap , TLiwVariant( data ) ); - } - if( action.Ptr() ) - { - targetMap->InsertL( KActionMap , TLiwVariant( action ) ); - } - TLiwGenericParam result( KListMap, TLiwVariant( targetMap )); - aList.AppendL( result ); - }//else - CleanupStack::PopAndDestroy( targetMap ); - }// if - }//while - //leave only if ACL security check for all items failed - if ( aclCheckFailed && !aList.Count()) - { - User::Leave( KErrPermissionDenied ); - } - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CContentMap::PrepareStmtforAddL( RSqlDatabase aSqlDb, - RSqlStatement& aStmt, const TDesC& aQuery ) const - { - CP_DEBUG( _L8("CContentMap::PrepareStmtforAddL") ); - CCPLiwMap::PrepareStmtforAddL( aSqlDb, aStmt, aQuery ); - TTime expiration_date( NULL); - GetExpirationDateL( expiration_date ); - TInt expiration_dateIndex = aStmt.ParameterIndex( KSQLExpiration_date ); - if ( expiration_dateIndex != KErrNotFound ) - { - BindInt64L( aStmt, expiration_dateIndex, expiration_date.Int64() ); - } - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CContentMap::PrepareStmtforUpdateL( RSqlDatabase aSqlDb, - RSqlStatement& aStmt, TInt32 aId ) const - { - CP_DEBUG( _L8("CContentMap::PrepareStmtforUpdateL") ); - TTime expiration_date; - TBool isExpirationDate = GetExpirationDateL( expiration_date ); - TBool isParameter(EFalse); - RBuf query; - query.CleanupClosePushL(); - query.CreateL( KSQLUpdate().Length( ) ); - query.Append( KSQLUpdate ); - RBuf8 data; - data.CleanupClosePushL(); - RBuf8 action; - action.CleanupClosePushL(); - if ( GetPropertyL( KDataMap, data ) ) - { - query.ReAllocL( query.Length( ) + KSQLUpdateData().Length( ) ); - query.Append( KSQLUpdateData ); - isParameter = ETrue; - } - if ( GetPropertyL( KActionMap, action ) ) - { - if ( isParameter ) - { - query.ReAllocL( query.Length( ) + KComma().Length( ) ); - query.Append( KComma ); - } - query.ReAllocL( query.Length( ) + KSQLUpdateAction().Length( ) ); - query.Append( KSQLUpdateAction ); - isParameter = ETrue; - } - if ( isExpirationDate ) - { - if ( isParameter ) - { - query.ReAllocL( query.Length( ) + KComma().Length( ) ); - query.Append( KComma ); - } - query.ReAllocL( query.Length( ) + KSQLUpdateExpirationDate().Length( ) ); - query.Append( KSQLUpdateExpirationDate ); - isParameter = ETrue; - } - if ( !isParameter ) User::Leave( KErrPathNotFound ); - query.ReAllocL( query.Length( ) + KSQLUpdateWhere().Length( ) ); - query.Append( KSQLUpdateWhere ); - - User::LeaveIfError( aStmt.Prepare( aSqlDb, query ) ); - TInt dataId = aStmt.ParameterIndex( KSQLId ); - BindIntL( aStmt, dataId, aId ); - - if ( data.Length( ) ) - { - TInt dataIndex = aStmt.ParameterIndex( KSQLData ); - BindBinaryL( aStmt, dataIndex, data ); - } - if ( action.Length( ) ) - { - TInt actionIndex = aStmt.ParameterIndex( KSQLAction ); - BindBinaryL( aStmt, actionIndex, action ); - } - if ( isExpirationDate ) - { - TInt expiration_dateIndex = - aStmt.ParameterIndex( KSQLExpiration_date ); - BindInt64L( aStmt, expiration_dateIndex, - expiration_date.Int64( ) ); - - } - CleanupStack::PopAndDestroy( &action ); - CleanupStack::PopAndDestroy( &data ); - CleanupStack::PopAndDestroy( &query ); - } -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CContentMap::UpdateL( RSqlDatabase aSqlDb, TInt32 aId, - CLiwDefaultList* aNotificationList ) const - { - CP_DEBUG( _L8("CContentMap::UpdateL") ); - RSqlStatement stmt; - CleanupClosePushL( stmt ); - CLiwDefaultMap* changeInfoMap = CLiwDefaultMap::NewLC( ); - FetchIdsL( aId, KSQLFetchIds, changeInfoMap, aSqlDb ); - if ( aNotificationList ) - { - changeInfoMap->InsertL( KType, TLiwVariant( KCpData ) ); - aNotificationList->AppendL( TLiwVariant( changeInfoMap ) ); - } - CleanupStack::PopAndDestroy( changeInfoMap ); - PrepareStmtforUpdateL( aSqlDb, stmt, aId ); - if ( stmt.Exec( ) <= 0 ) - { - User::Leave( KErrNotFound ); - } - CleanupStack::PopAndDestroy( &stmt ); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -TInt32 CContentMap::AddToDbL( RSqlDatabase aSqlDb, - CLiwDefaultList* aNotificationList ) const - { - CP_DEBUG( _L8("CContentMap::AddToDbL") ); - RSqlStatement stmt; - CleanupClosePushL( stmt ); - PrepareStmtforAddL( aSqlDb, stmt, KSQLInsert ); - - TInt dataIndex = stmt.ParameterIndex( KSQLData ); - TInt actionIndex = stmt.ParameterIndex( KSQLAction ); - TInt aclIndex = stmt.ParameterIndex( KSQLAccessList ); - - RBuf8 data; - data.CleanupClosePushL(); - GetPropertyL( KDataMap, data ) ; - BindBinaryL( stmt, dataIndex, data ); - - RBuf8 action; - action.CleanupClosePushL(); - GetPropertyL( KActionMap, action ) ; - BindBinaryL( stmt, actionIndex, action ); - - RBuf8 acl; - acl.CleanupClosePushL(); - if( !GetPropertyL( KAccessList , acl ) ) - { - iPolicy->GetDefaultSecurityL( acl ); - } - - BindBinaryL( stmt, aclIndex, acl ); - if ( stmt.Exec( ) <= 0 ) - { - User::Leave( KErrGeneral ); - } - - TSqlScalarFullSelectQuery id_query(aSqlDb); - TInt32 ret( 0); - ret = id_query.SelectIntL( KSQLGetLastInsertId ); - - if ( aNotificationList ) - { - RBuf publisher; - publisher.CleanupClosePushL(); - RBuf contentType; - contentType.CleanupClosePushL(); - RBuf contentId; - contentId.CleanupClosePushL(); - GetPropertyL( KPublisherId, publisher ) ; - GetPropertyL( KContentType, contentType ); - GetPropertyL( KContentId, contentId ); - CLiwDefaultMap* changeInfoMap = CLiwDefaultMap::NewLC( ); - changeInfoMap->InsertL( KId, TLiwVariant( ret ) ); - changeInfoMap->InsertL( KType, TLiwVariant( KCpData ) ); - changeInfoMap->InsertL( KPublisherId, TLiwVariant( publisher ) ); - changeInfoMap->InsertL( KContentType, TLiwVariant( contentType ) ); - changeInfoMap->InsertL( KContentId, TLiwVariant( contentId ) ); - changeInfoMap->InsertL( KOperation, TLiwVariant( KOperationAdd ) ); - aNotificationList->AppendL( TLiwVariant( changeInfoMap ) ); - CleanupStack::PopAndDestroy( changeInfoMap ) ; - CleanupStack::PopAndDestroy( &contentId ) ; - CleanupStack::PopAndDestroy( &contentType ) ; - CleanupStack::PopAndDestroy( &publisher ) ; - } - - CleanupStack::PopAndDestroy( &acl ) ; - CleanupStack::PopAndDestroy( &action ) ; - CleanupStack::PopAndDestroy( &data ) ; - CleanupStack::PopAndDestroy( &stmt ) ; - return ret; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CContentMap::AppendSortL( RBuf& aQuery, const TCPSortOrder& aSort ) const - { - CP_DEBUG( _L8("CContentMap::AppendSortL") ); - switch ( aSort ) - { - case ECPPublisher: - aQuery.ReAllocL( aQuery.Length( ) + KSQLOrderPublisher().Length( ) ); - aQuery.Append( KSQLOrderPublisher ); - break; - case ECPContent: - aQuery.ReAllocL( aQuery.Length( ) + KSQLOrderContent().Length( ) ); - aQuery.Append( KSQLOrderContent ); - break; - default: - aQuery.ReAllocL( aQuery.Length( ) + KSQLOrderRecent().Length( ) ); - aQuery.Append( KSQLOrderRecent ); - break; - } - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -TBool CContentMap::IsOutdated( const TTime aExpirationTime ) const - { - CP_DEBUG( _L8("CContentMap::IsOutdated") ); - TBool result(EFalse); - TTime currentTime(0); - currentTime.HomeTime( ); - if ( currentTime>aExpirationTime ) - { - result = ETrue; - } - return result; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CContentMap::IsDataMapL() const - { - TInt pos( 0 ); - const TLiwGenericParam* paramForValue = iMap->FindFirst( pos, KDataMap ); - if ( pos != KErrNotFound ) - { - if( paramForValue->Value().TypeId() != LIW::EVariantTypeDesC8 ) - { - User::Leave( KErrBadName ); - } - } - else - { - User::Leave( KErrPathNotFound ); - } - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -TBool CContentMap::GetExpirationDateL( TTime& aResult ) const - { - CP_DEBUG( _L8("CContentMap::GetExpirationDateL") ); - TInt pos( 0); - TBool result(EFalse); - const TLiwGenericParam* param= NULL; - param = iMap->FindFirst( pos, KExpirationDate ); - if ( KErrNotFound != pos ) - { - if ( !param->Value().Get( aResult ) ) - User::Leave( KErrArgument ); - result = ETrue; - } - return result; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CContentMap::IsValidForDeleteL() const - { - CP_DEBUG( _L8("CContentMap::IsValidFilterL") ); - TInt err( KErrNone ); - TInt32 id( 0 ); - if( GetProperty( KId, id ) && ( id < 1 ) ) - { - err = KErrArgument; - } - else if( !IsId() && PropertyExists( KId ) ) - { - err = KErrBadName; - } - - if( err == KErrNone && !IsId( ) && !( IsPublisherNameL( ) - || IsContentTypeL( ) || IsContentIdL() ) ) - { - err = KErrPathNotFound; - } - - if( err != KErrNone ) - { - User::Leave( err ); - } - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CContentMap::IsValidForGetListL() const - { - CP_DEBUG( _L8("CContentMap::IsValidForGetListL") ); - TInt err( KErrNone ); - TInt32 id( 0 ); - if( GetProperty( KId, id ) && ( id < 1 ) ) - { - err = KErrArgument; - } - else if( !IsId() && PropertyExists( KId ) ) - { - err = KErrBadName; - } - - if( err != KErrNone ) - { - User::Leave( err ); - } - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -TBool CContentMap::ActivateActionSupport( ) const - { - return EFalse; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -TBool CContentMap::GetActivateInfo( ) const - { - return EFalse; - } - diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingutils/contentpublishingmap/src/cpliwmap.cpp --- a/contentpublishingsrv/contentpublishingutils/contentpublishingmap/src/cpliwmap.cpp Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1270 +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 -#include -#include -#include - -#include "cpliwmap.h" -#include "cpdebug.h" -#include "cpssqlcommands.h" -#include "ccontentmap.h" -#include "cpublisherregistrymap.h" -#include "cpsecuritypolicy.h" - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -EXPORT_C CCPLiwMap* CCPLiwMap::NewL( RDesReadStream& aStream ) - { - CLiwGenericParamList* list = CLiwGenericParamList::NewLC( aStream ); - CCPLiwMap* map = CCPLiwMap::NewL( *list ); - CleanupStack::PopAndDestroy( list ); - return map; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -EXPORT_C CCPLiwMap* CCPLiwMap::NewL( const CLiwGenericParamList& aList ) - { - CP_DEBUG( _L8("CCPLiwMap::NewL") ); - const TLiwGenericParam* param = NULL; - TInt pos( 0 ); - param = aList.FindFirst( pos, KType ); - CCPLiwMap* map( NULL ); - if( param && pos !=KErrNotFound ) - { - RBuf typeBuf; - typeBuf.CleanupClosePushL(); - TPtrC type( KNullDesC ); - if( !param->Value().Get( type ) ) - { - TPtrC8 type8( KNullDesC8 ); - if( !param->Value().Get( type8 ) ) - { - User::Leave( KErrBadName ); - } - typeBuf.Assign( EscapeUtils::ConvertToUnicodeFromUtf8L( type8 ) ); - } - else - { - typeBuf.CreateL( type ); - } - if( typeBuf.Find( KCpData () ) != KErrNotFound ) - { - map = CContentMap::NewLC(); - } - else if ( typeBuf.Find( KPublisher () ) != KErrNotFound ) - { - map = CPublisherRegistryMap::NewLC(); - } - else User::Leave( KErrArgument ); - map->SetL( aList ); - CleanupStack::Pop( map ); - CleanupStack::PopAndDestroy( &typeBuf ); - } - else - { - User::Leave( KErrPathNotFound ); - } - return map; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -EXPORT_C HBufC8* CCPLiwMap::PackForServerLC() const - { - CP_DEBUG( _L8("CCPLiwMap::PackForServerLC") ); - HBufC8* datadesc = HBufC8::NewLC( Size() ); - TPtr8 ptr = datadesc->Des(); - RDesWriteStream datastrm( ptr ); - CleanupClosePushL(datastrm); - ExternalizeL(datastrm); - datastrm.CommitL(); - CleanupStack::PopAndDestroy(&datastrm); - return datadesc; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -EXPORT_C void CCPLiwMap::Reset( ) const - { - iMap->Reset(); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPLiwMap::IsValidForAddL( ) const - { - CP_DEBUG( _L8("CCPLiwMap::IsValidForAddL") ); - TInt err( KErrNone ); - TInt32 id( 0 ); - if( GetProperty( KId, id ) && ( id < 1 ) ) - { - err = KErrArgument; - } - else if( !IsId() && PropertyExists( KId ) ) - { - err = KErrBadName; - } - - CheckIdentifiersL(); - - if( err == KErrNone && !IsId() && !( IsPublisherNameL() - && IsContentTypeL() && IsContentIdL() ) ) - { - err = KErrPathNotFound; - } - - if( err != KErrNone ) - { - User::Leave( err ); - } - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -EXPORT_C void CCPLiwMap::IsValidForActionL( )const - { - CP_DEBUG( _L8("CCPLiwMap::IsValidForActionL") ); - CCPLiwMap::IsValidForNotificationL(); - if( !IsTriggerL() ) User::Leave( KErrPathNotFound ); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -EXPORT_C void CCPLiwMap::IsValidForNotificationL( ) const - { - CP_DEBUG( _L8("CCPLiwMap::IsValidForAddL") ); - TInt err( KErrNone ); - TInt32 id( 0 ); - if( GetProperty( KId, id ) && ( id < 1 ) ) - { - err = KErrArgument; - } - else if( !IsId() && PropertyExists( KId ) ) - { - err = KErrBadName; - } - - CheckIdentifiersL(); - - if( err == KErrNone && !IsId() && !IsPublisherNameL() - && !IsContentTypeL() && !IsContentIdL() ) - { - err = KErrPathNotFound; - } - - if( err != KErrNone ) - { - User::Leave( err ); - } - } - - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -EXPORT_C TBool CCPLiwMap::GetPropertyL( const TDesC8& aProperty , - RBuf& aResult ) const - { - //change name - CP_DEBUG( _L8("CCPLiwMap::GetProperty - TPtrC") ); - TBool result( EFalse ); - TInt pos( 0 ); - TPtrC result16( KNullDesC); - TPtrC8 result8( KNullDesC8); - const TLiwGenericParam* paramForValue = iMap->FindFirst( pos, aProperty ); - if ( pos != KErrNotFound ) - { - if( paramForValue->Value().Get( result16 ) ) - { - aResult.CreateL( result16 ); - result = ETrue; - } - else if( paramForValue->Value().Get( result8 ) ) - { - aResult.Assign( EscapeUtils::ConvertToUnicodeFromUtf8L( result8 ) ); - result = ETrue; - } - else - { - User::Leave( KErrBadName ); - } - } - return result; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -EXPORT_C TBool CCPLiwMap::GetPropertyL( const TDesC8& aProperty , - RBuf8& aResult ) const - { - CP_DEBUG( _L8("CCPLiwMap::GetProperty - TPtrC8") ); - TBool result( EFalse ); - TInt pos( 0 ); - TPtrC8 result8( KNullDesC8 ); - TPtrC result16( KNullDesC ); - const TLiwGenericParam* paramForValue = iMap->FindFirst( pos, aProperty ); - if ( pos != KErrNotFound ) - { - if( paramForValue->Value().Get( result8 ) ) - { - aResult.CreateL( result8 ); - result = ETrue; - } - else if( paramForValue->Value().Get( result16 ) ) - { - aResult.Assign( EscapeUtils::ConvertFromUnicodeToUtf8L( result16 ) ); - result = ETrue; - } - else - { - User::Leave( KErrBadName ); - } - } - return result; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -EXPORT_C TBool CCPLiwMap::GetProperty( const TDesC8& aProperty , - TInt32& aResult ) const - { - CP_DEBUG( _L8("CCPLiwMap::GetProperty - TInt32") ); - TBool result( EFalse ); - TInt pos( 0 ); - const TLiwGenericParam* paramForValue = iMap->FindFirst( pos, aProperty ); - if ( pos != KErrNotFound ) - { - if( paramForValue->Value().Get( aResult ) ) - { - result = ETrue; - } - } - return result; - } - - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -EXPORT_C void CCPLiwMap::SetSecurityL( const RMessage2& aMessage ) - { - delete iPolicy; - iPolicy = NULL; - iPolicy = CCPSecurityPolicy::NewL( aMessage ); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -CCPLiwMap::~CCPLiwMap() - { - delete iMap; - delete iPolicy; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -CCPLiwMap::CCPLiwMap() - { - - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPLiwMap::InsertL( const TDesC8& aKey, const TLiwVariant& aValue ) - { - CP_DEBUG( _L8("CCPLiwMap::InsertL") ); - Remove( aKey ); - TLiwGenericParam mp; - mp.SetNameAndValueL( aKey, aValue ); - iMap->AppendL( mp ); - mp.Reset( ); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -TBool CCPLiwMap::FindL( const TDesC8& aKey, TLiwVariant& aValue ) const - { - CP_DEBUG( _L8("CCPLiwMap::FindL") ); - TInt pos = 0; - TBool result(EFalse); - const TLiwGenericParam* tempParam = iMap->FindFirst( pos, aKey ); - if ( tempParam ) - { - aValue.SetL( tempParam->Value( ) ); - result = ETrue; - } - return result; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -TInt CCPLiwMap::Count() const - { - return iMap->Count( ); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -TBool CCPLiwMap::AtL( TInt aIndex, TDes8& aKey ) const - { - CP_DEBUG( _L8("CCPLiwMap::AtL") ); - TBool result(EFalse); - if ( 0 <= aIndex && aIndex < iMap->Count( ) ) - { - aKey = ((*iMap)[aIndex]).Name( ); - result = ETrue; - } - return result; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPLiwMap::Remove( const TDesC8& aKey ) - { - CP_DEBUG( _L8("CCPLiwMap::Remove") ); - TInt pos = 0; - iMap->FindFirst( pos, aKey ); - if ( pos != KErrNotFound ) - { - iMap->Remove( aKey ); - } - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -TInt CCPLiwMap::Size() const - { - return iMap->Size( ); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPLiwMap::ExternalizeL( RWriteStream& aStream ) const - { - CP_DEBUG( _L8("CCPLiwMap::ExternalizeL") ); - iMap->ExternalizeL( aStream ); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPLiwMap::FillChangeInfoMapL( RSqlStatement& aStmt, - CLiwDefaultMap* aMap )const - { - TInt idIndex = ColumnIndexL( aStmt, KColumnId ); - TInt publisherIndex = ColumnIndexL( aStmt, KColumnPublisher ); - TInt contentIndex = ColumnIndexL( aStmt, KColumnContent_type ); - TInt content_idIndex = ColumnIndexL( aStmt, KColumnContent_id ); - TInt acl_Index = ColumnIndexL( aStmt, KColumnAccessList ); - - TInt32 id = aStmt.ColumnInt( idIndex ) ; - TPtrC publisher; - User::LeaveIfError(aStmt.ColumnText( publisherIndex,publisher) ); - TPtrC content_type; - User::LeaveIfError(aStmt.ColumnText( contentIndex,content_type ) ); - TPtrC content_id; - User::LeaveIfError(aStmt.ColumnText( content_idIndex,content_id) ); - aMap->InsertL( KId, TLiwVariant( id ) ); - aMap->InsertL( KPublisherId, TLiwVariant( publisher ) ); - aMap->InsertL( KContentType, TLiwVariant( content_type ) ); - aMap->InsertL( KContentId, TLiwVariant( content_id ) ); - aMap->InsertL( KOperation, TLiwVariant( KOperationDelete ) ); - RBuf type; - type.CleanupClosePushL(); - if( GetPropertyL( KType, type ) ) - { - aMap->InsertL( KType , TLiwVariant( type ) ); - } - CleanupStack::PopAndDestroy( &type ); - } - - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPLiwMap::SetL( const CLiwGenericParamList& aInParamList ) - { - - CP_DEBUG( _L8("CCPLiwMap::SetL") ); - for ( TInt i = 0; i < aInParamList.Count( ); i++ ) - { - const TLiwGenericParam& param = aInParamList[i]; - if ( param.Value().TypeId( ) == LIW::EVariantTypeMap ) - { - const CLiwMap* map = param.Value().AsMap( ); - for ( TInt i = 0; i Count( ); i++ ) - { - TBuf8<128> key; - map->AtL( i, key ); - TLiwVariant value; - value.PushL( ); - map->FindL( key, value ); - if ( key == KOperation ) - { - IsProperOperationL( value ); - } - RBuf8 datadesc; - datadesc.CleanupClosePushL(); - if ( value.TypeId( ) == LIW::EVariantTypeMap ) - { - const CLiwMap* internalMap = value.AsMap( ); - datadesc.CreateL( internalMap->Size( ) ); - RDesWriteStream datastrm(datadesc); - CleanupClosePushL( datastrm ); - internalMap->ExternalizeL( datastrm ); - datastrm.CommitL( ); - CleanupStack::PopAndDestroy( &datastrm ); - value.Reset( ); - value.Set( datadesc ); - } - TLiwGenericParam data( key, value); - iMap->AppendL( data ); - CleanupStack::PopAndDestroy( &datadesc ); - CleanupStack::PopAndDestroy( &value ); - } - } - else - { - iMap->AppendL( param ); - } - } - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPLiwMap::IsProperOperationL( const TLiwVariant& aValue ) const - { - CP_DEBUG( _L8("CContentMap::IsProperOperationL") ); - TPtrC valDesc( KNullDesC ); - TPtrC8 valDesc8( KNullDesC8 ); - RBuf desc; - desc.CleanupClosePushL(); - - if( aValue.Get( valDesc ) == EFalse ) - { - if( aValue.Get( valDesc8 ) != EFalse ) - { - desc.Assign( EscapeUtils::ConvertToUnicodeFromUtf8L( valDesc8 ) ); - valDesc.Set( desc ); - } - else - { - User::Leave( KErrBadName ); - } - } - - TLex input( valDesc ); - - CDesC16Array* array = new (ELeave) CDesC16ArrayFlat(4); - CleanupStack::PushL( array ); - - TLexMark startMark; - input.Mark( startMark ); - TBool notEmpty = EFalse; - while ( !input.Eos() ) - { - if( input.Peek() == ':') - { - array->AppendL( input.MarkedToken( startMark ) ); - input.Inc(); - input.Mark( startMark ); - } - input.Inc(); - notEmpty = ETrue; - } - if ( notEmpty ) - { - array->AppendL( input.MarkedToken( startMark ) ); - } - - for( TInt i= 0; i < array->MdcaCount(); i++ ) - { - TPtrC operValue( array->MdcaPoint(i) ); - - if( operValue.Compare( KOperationAdd ) && - operValue.Compare( KOperationUpdate ) && - operValue.Compare( KOperationDelete ) && - operValue.Compare( KOperationExecute ) ) - { - User::Leave( KErrArgument ); - } - } - CleanupStack::PopAndDestroy( array ); - CleanupStack::PopAndDestroy( &desc ); - } - - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPLiwMap::AppendGetListFilterL( RBuf& aQuery, TUint& aFilter ) const - { - CP_DEBUG( _L8("CContentMap::AppendGetListFilterL") ); - if( !IsGetListAllL( aFilter ) ) - { - AppendFilterL( aQuery, aFilter ); - } - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPLiwMap::AppendRemoveFilterL( RBuf& aQuery, TUint& aFilter ) const - { - CP_DEBUG( _L8("CContentMap::AppendRemoveFilterL") ); - AppendFilterL( aQuery, aFilter ); - } -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPLiwMap::AppendFilterL( RBuf& aQuery, TUint& aFilter ) const - { - CP_DEBUG( _L8("CContentMap::AppendFilterL") ); - - TBool nextFilter( EFalse ); - - RemoveAllAttributeL( aFilter ); //remove "all" attribute from publisher, - //cont_type or cont_id - - aQuery.ReAllocL( aQuery.Length( ) + KWhere().Length( ) ); - aQuery.Append( KWhere ); - - if( aFilter & EContentType ) - { - aQuery.ReAllocL( aQuery.Length( ) + KSQLGetContentType().Length( ) ); - aQuery.Append( KSQLGetContentType ); - nextFilter = ETrue; - } - if( aFilter & EPublisher ) - { - if( nextFilter ) - { - aQuery.ReAllocL( aQuery.Length( ) + KAnd().Length( ) + - KSQLGetPublisher().Length( ) ); - aQuery.Append( KAnd ); - aQuery.Append( KSQLGetPublisher ); - } - else - { - aQuery.ReAllocL( aQuery.Length( ) + - KSQLGetPublisher().Length( ) ); - aQuery.Append( KSQLGetPublisher ); - } - nextFilter = ETrue; - } - if( aFilter & EContentId ) - { - if( nextFilter ) - { - aQuery.ReAllocL( aQuery.Length( ) + - KAnd().Length( ) + KSQLGetContentId().Length( ) ); - aQuery.Append( KAnd ); - aQuery.Append( KSQLGetContentId ); - } - else - { - aQuery.ReAllocL( aQuery.Length( ) + KSQLGetContentId().Length( ) ); - aQuery.Append( KSQLGetContentId ); - } - nextFilter = ETrue; - } - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPLiwMap::PrepareStmtforAddL( RSqlDatabase aSqlDb, - RSqlStatement& aStmt, const TDesC& aQuery ) const - { - CP_DEBUG( _L8("CCPLiwMap::PrepareStmtforAddL") ); - RBuf publisher; - publisher.CleanupClosePushL(); - RBuf content_type; - content_type.CleanupClosePushL(); - RBuf content_id; - content_id.CleanupClosePushL(); - if ( GetPropertyL( KPublisherId, publisher ) - && GetPropertyL( KContentType, content_type ) - && GetPropertyL( KContentId, content_id ) ) - { - User::LeaveIfError( aStmt.Prepare( aSqlDb, aQuery ) ); - TInt publisherIndex = aStmt.ParameterIndex( KSQLPublisher ); - TInt content_typeIndex = aStmt.ParameterIndex( KSQLContent_type ); - TInt content_idIndex = aStmt.ParameterIndex( KSQLContent_id ); - - BindTextL( aStmt, publisherIndex, publisher ); - BindTextL( aStmt, content_typeIndex, content_type ); - BindTextL( aStmt, content_idIndex, content_id ); - } - else - { - User::Leave( KErrArgument ); - } - CleanupStack::PopAndDestroy( &content_id ); - CleanupStack::PopAndDestroy( &content_type ); - CleanupStack::PopAndDestroy( &publisher ); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -TUint CCPLiwMap::GetFilterL( )const - { - CP_DEBUG( _L8("CCPLiwMap::GetFilterL") ); - TUint result (0); - if(IsPublisherNameL()) - { - result |= EPublisher; - } - if(IsContentTypeL()) - { - result |= EContentType; - } - if(IsContentIdL()) - { - result |= EContentId; - } - if(IsFlag()) - { - result |= EFlag; - } - return result; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -CCPLiwMap::TCPSortOrder CCPLiwMap::GetSortL() const - { - CP_DEBUG( _L8("CCPLiwMap::GetSortL") ); - TCPSortOrder result(ECPRecent); - RBuf sort; - sort.CleanupClosePushL(); - if ( GetPropertyL( KSortOrder, sort ) ) - { - if ( !sort.Compare( KSortRecent ) ) - { - result = ECPRecent; - } - else if ( !sort.Compare( KSortPublisher ) ) - { - result = ECPPublisher; - } - else if ( !sort.Compare( KSortContentType ) ) - { - result = ECPContent; - } - else if ( !sort.Compare( KSortContentId ) ) - { - result = ECPContentId; - } - } - CleanupStack::PopAndDestroy( &sort ); - return result; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -TBool CCPLiwMap::IsPublisherNameL() const - { - TBool result( EFalse ); - RBuf buffer; - buffer.CleanupClosePushL(); - result = GetPropertyL( KPublisherId, buffer ); - if( result && buffer.Length() == KErrNone ) - { - User::Leave( KErrArgument ); - } - CleanupStack::PopAndDestroy( &buffer ); - return result; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -TBool CCPLiwMap::IsContentTypeL() const - { - TBool result( EFalse ); - RBuf buffer; - buffer.CleanupClosePushL(); - result = GetPropertyL( KContentType, buffer ); - if( result && buffer.Length() == KErrNone ) - { - User::Leave( KErrArgument ); - } - CleanupStack::PopAndDestroy( &buffer ); - return result; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -TBool CCPLiwMap::IsContentIdL() const - { - TBool result( EFalse ); - RBuf buffer; - buffer.CleanupClosePushL(); - result = GetPropertyL( KContentId, buffer ); - if( result && buffer.Length() == KErrNone ) - { - User::Leave( KErrArgument ); - } - CleanupStack::PopAndDestroy( &buffer ); - return result; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -TBool CCPLiwMap::IsTriggerL( ) const - { - TBool result( EFalse ); - RBuf8 buffer; - buffer.CleanupClosePushL(); - result = GetPropertyL( KActionTrigger, buffer ); - CleanupStack::PopAndDestroy( &buffer ); - return result; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -TBool CCPLiwMap::IsFlag( ) const - { - TInt32 buffer( 0 ); - return GetProperty( KFlag, buffer ); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -TBool CCPLiwMap::IsId() const - { - TInt32 id( 0); - return GetProperty( KId, id ); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -TBool CCPLiwMap::PropertyExists( const TDesC8& aProperty ) const - { - TBool result( EFalse ); - TInt pos( 0 ); - iMap->FindFirst( pos, aProperty ); - if ( pos != KErrNotFound ) - { - result = ETrue; - } - return result; - } - - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -TUint CCPLiwMap::GetListL( RSqlDatabase aSqlDb, const TDesC& aQuery, - CLiwGenericParamList* aList, RArray& aItemsToDelete ) const - { - CP_DEBUG( _L8("CCPLiwMap::GetListL") ); - RBuf sqlquery; - sqlquery.CleanupClosePushL(); - sqlquery.CreateL( aQuery ); - TInt32 id( 0); - if ( GetProperty( KId, id ) ) - { - ConstructSelectIdL( sqlquery ); - } - else - { - ConstructGetListSelectL( sqlquery ); - } - RSqlStatement stmt; - CleanupClosePushL( stmt ); - User::LeaveIfError( stmt.Prepare( aSqlDb, sqlquery ) ); - BindValueL( sqlquery, stmt ); - SaveQueryResultsL( stmt, *aList, aItemsToDelete ); - CleanupStack::PopAndDestroy( &stmt ) ; - CleanupStack::PopAndDestroy( &sqlquery ); - return aList->Count( ); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPLiwMap::RemoveL( RSqlDatabase aSqlDb, const TDesC& aQuery ) const - { - CP_DEBUG( _L8("CCPLiwMap::RemoveL") ); - RBuf sqlquery; - sqlquery.CleanupClosePushL(); - sqlquery.CreateL( aQuery ); - TInt32 id( 0); - if ( GetProperty( KId, id ) ) - { - ConstructSelectIdL( sqlquery ); - } - else - { - ConstructRemoveSelectL( sqlquery, EFalse ); - } - - RSqlStatement stmt; - CleanupClosePushL( stmt ); - User::LeaveIfError( stmt.Prepare( aSqlDb, sqlquery ) ); - - BindValueL( sqlquery, stmt ); - if ( stmt.Exec( ) <= 0 ) - { - User::Leave( KErrNotFound ); - } - CleanupStack::PopAndDestroy( &stmt ) ; - CleanupStack::PopAndDestroy( &sqlquery ); - } -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPLiwMap::FetchIdsL( TInt32 aId, const TDesC& aQuery, - CLiwDefaultMap* aMap, RSqlDatabase aSqlDb ) const - { - CP_DEBUG( _L8("CCPLiwMap::FetchIdsL") ); - RSqlStatement stmt; - CleanupClosePushL( stmt ); - //prepare statment for "Get Ids" (Publisher, ContentType,ContentId) - User::LeaveIfError( stmt.Prepare( aSqlDb, aQuery ) ); - TInt idIndex = stmt.ParameterIndex( KSQLId ); - User::LeaveIfError( stmt.BindInt( idIndex, aId ) ); - - TInt publisherIndex = ColumnIndexL( stmt, KColumnPublisher ); - TInt contentTypeIndex = ColumnIndexL( stmt, KColumnContent_type ); - TInt contentIdIndex = ColumnIndexL( stmt, KColumnContent_id ); - TInt acl_Index = ColumnIndexL( stmt, KColumnAccessList ); - - if ( stmt.Next( ) == KSqlAtRow ) - { - if( iPolicy ) - { - TPtrC8 acl; - User::LeaveIfError( stmt.ColumnBinary( acl_Index, acl ) ); - if( !iPolicy->CheckSecurityL( acl , CCPSecurityPolicy::EWrite ) ) - { - User::Leave( KErrPermissionDenied ); - } - } - TPtrC publisher; - User::LeaveIfError( stmt.ColumnText( publisherIndex, publisher ) ); - TPtrC content_type; - User::LeaveIfError( stmt.ColumnText( contentTypeIndex, content_type ) ); - TPtrC content_id; - User::LeaveIfError( stmt.ColumnText( contentIdIndex, content_id ) ); - aMap->InsertL( KId, TLiwVariant( aId ) ); - aMap->InsertL( KPublisherId, TLiwVariant( publisher ) ); - aMap->InsertL( KContentType, TLiwVariant( content_type ) ); - aMap->InsertL( KContentId, TLiwVariant( content_id ) ); - aMap->InsertL( KOperation, TLiwVariant( KOperationUpdate ) ); - } - CleanupStack::PopAndDestroy( &stmt ) ; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPLiwMap::FetchIdL( RSqlDatabase aSqlDb, const TDesC& aQuery, - TInt32& aId ) const - { - CP_DEBUG( _L8("CCPLiwMap::FetchIdL") ); - aId = 0; - RSqlStatement stmt; - CleanupClosePushL( stmt ); - PrepareStmtforAddL( aSqlDb, stmt, aQuery ); - TInt idIndex = ColumnIndexL( stmt, KColumnId ); - if ( stmt.Next( ) == KSqlAtRow ) - { - aId = stmt.ColumnInt( idIndex ); - } - CleanupStack::PopAndDestroy( &stmt ) ; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPLiwMap::GetIdsOfRemovedEntriesL( RSqlDatabase aSqlDb, - const TDesC& aQuery, CLiwDefaultList* aList ) const - { - CP_DEBUG( _L8("CCPLiwMap::GetIdsOfRemovedEntriesL") ); - RBuf sqlquery; - sqlquery.CleanupClosePushL(); - sqlquery.CreateL( aQuery ); - TInt32 id( 0); - if ( GetProperty( KId, id ) ) - { - ConstructSelectIdL( sqlquery ); - } - else - { - ConstructRemoveSelectL( sqlquery ); - } - RSqlStatement stmt; - CleanupClosePushL( stmt ); - User::LeaveIfError( stmt.Prepare( aSqlDb, sqlquery ) ); - BindValueL( sqlquery, stmt ); - SaveQueryResultsIdsL( stmt, aList ); - if( aList && aList->Count()==0 ) - { - User::Leave( KErrNotFound ); - } - CleanupStack::PopAndDestroy( &stmt ) ; - CleanupStack::PopAndDestroy( &sqlquery ); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPLiwMap::SaveQueryResultsIdsL( RSqlStatement& aStmt, - CLiwDefaultList* aList ) const - { - CP_DEBUG( _L8("CCPLiwMap::SaveQueryResultsIdsL") ); - TInt acl_Index = ColumnIndexL( aStmt, KColumnAccessList ); - - while ( aStmt.Next( ) == KSqlAtRow ) - { - if( iPolicy ) - { - TPtrC8 acl; - User::LeaveIfError( aStmt.ColumnBinary( acl_Index, acl ) ); - if ( !iPolicy->CheckSecurityL( acl , - CCPSecurityPolicy::EDelete ) ) - { - User::Leave( KErrPermissionDenied ); - } - } - if ( aList ) - { - CLiwDefaultMap* targetMap = CLiwDefaultMap::NewLC( ); - FillChangeInfoMapL( aStmt, targetMap ); - aList->AppendL( TLiwVariant( targetMap ) ); - CleanupStack::PopAndDestroy( targetMap ); - } - } - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPLiwMap::ConstructSelectIdL( RBuf& aQuery ) const - { - aQuery.ReAllocL( aQuery.Length( ) + KSQLGetId().Length( ) + - KWhere().Length() ); - aQuery.Append( KWhere ); - aQuery.Append( KSQLGetId ); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPLiwMap::ConstructGetListSelectL( RBuf& aQuery, TBool aGet ) const - { - TUint filter = GetFilterL( ); - AppendGetListFilterL( aQuery, filter ); - if ( aGet ) - { - AppendSortL( aQuery, GetSortL( ) ); - } - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPLiwMap::ConstructRemoveSelectL( RBuf& aQuery, TBool aGet ) const - { - TUint filter = GetFilterL( ); - AppendRemoveFilterL( aQuery, filter ); - if ( aGet ) - { - AppendSortL( aQuery, GetSortL( ) ); - } - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPLiwMap::BindValueL( const RBuf& aQuery, RSqlStatement& aStmt ) const - { - CP_DEBUG( _L8("CCPLiwMap::BindValueL") ); - if ( aQuery.Find( KSQLGetPublisher ) != KErrNotFound ) - { - TInt param = aStmt.ParameterIndex( KSQLPublisher ); - RBuf publisher; - publisher.CleanupClosePushL(); - User::LeaveIfError( GetPropertyL( KPublisherId, publisher )); - BindTextL( aStmt, param, publisher ); - CleanupStack::PopAndDestroy( &publisher ); - } - if ( aQuery.Find( KSQLGetContentType ) != KErrNotFound ) - { - TInt param = aStmt.ParameterIndex( KSQLContent_type ); - RBuf content_type; - content_type.CleanupClosePushL(); - User::LeaveIfError( GetPropertyL( KContentType, content_type )); - BindTextL( aStmt, param, content_type ); - CleanupStack::PopAndDestroy( &content_type ); - } - if ( aQuery.Find( KSQLGetContentId ) != KErrNotFound ) - { - TInt param = aStmt.ParameterIndex( KSQLContent_id ); - RBuf content_id; - content_id.CleanupClosePushL(); - User::LeaveIfError( GetPropertyL( KContentId, content_id )); - BindTextL( aStmt, param, content_id ); - CleanupStack::PopAndDestroy( &content_id ); - } - if ( aQuery.Find( KSQLGetId ) != KErrNotFound ) - { - TInt param = aStmt.ParameterIndex( KSQLId ); - TInt32 id( 0); - User::LeaveIfError( GetProperty( KId, id )); - BindIntL( aStmt, param, id ); - } - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -TBool CCPLiwMap::IsGetListAllL( TUint aFilter ) const - { - TBool result( EFalse ); - if ( !( aFilter & EContentType ) && - !( aFilter & EContentId ) && - !( aFilter & EPublisher ) ) - { - result = ETrue; - } - else if ( ( aFilter & EContentType ) && - ( aFilter & EContentId ) && - ( aFilter & EPublisher ) ) - { - RBuf publisher; - publisher.CleanupClosePushL(); - RBuf content_type; - content_type.CleanupClosePushL(); - RBuf content_id; - content_id.CleanupClosePushL(); - GetPropertyL( KPublisherId, publisher ); - GetPropertyL( KContentType, content_type ); - GetPropertyL( KContentId, content_id ); - - if( ( publisher == KAll ) && - ( content_type == KAll ) && - ( content_id == KAll) ) - { - result = ETrue; - } - CleanupStack::PopAndDestroy( &content_id ); - CleanupStack::PopAndDestroy( &content_type ); - CleanupStack::PopAndDestroy( &publisher ); - } - return result; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPLiwMap::RemoveAllAttributeL( TUint& aFilter ) const - { - RBuf publisher; - publisher.CleanupClosePushL(); - RBuf content_type; - content_type.CleanupClosePushL(); - RBuf content_id; - content_id.CleanupClosePushL(); - GetPropertyL( KPublisherId, publisher ); - GetPropertyL( KContentType, content_type ); - GetPropertyL( KContentId, content_id ); - - if( publisher == KAll ) - { - iMap->Remove( KPublisherId ); - aFilter = aFilter & ~EPublisher; - } - if( content_type == KAll ) - { - iMap->Remove( KContentType ); - aFilter = aFilter & ~EContentType; - } - if( content_id == KAll ) - { - iMap->Remove( KContentId ); - aFilter = aFilter & ~EContentId; - } - - CleanupStack::PopAndDestroy( &content_id ); - CleanupStack::PopAndDestroy( &content_type ); - CleanupStack::PopAndDestroy( &publisher ); - - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPLiwMap::ConstructL() - { - iMap = CLiwGenericParamList::NewL( ); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPLiwMap::CheckIdentifiersL() const - { - IsPublisherNameL(); - IsContentTypeL(); - IsContentIdL(); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPLiwMap::BindTextL(RSqlStatement& aStmt, TInt aParameterIndex, - const TDesC& aParameterText) const - { - User::LeaveIfError( aParameterIndex ); - User::LeaveIfError( aStmt.BindText( aParameterIndex, aParameterText ) ); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPLiwMap::BindBinaryL(RSqlStatement& aStmt, TInt aParameterIndex, - const TDesC8& aParameterData) const - { - User::LeaveIfError(aParameterIndex); - User::LeaveIfError(aStmt.BindBinary(aParameterIndex, aParameterData)); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPLiwMap::BindInt64L(RSqlStatement& aStmt, TInt aParameterIndex, - TInt64 aParameterValue) const - { - User::LeaveIfError(aParameterIndex); - User::LeaveIfError(aStmt.BindInt64(aParameterIndex, aParameterValue)); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPLiwMap::BindIntL(RSqlStatement& aStmt, TInt aParameterIndex, - TInt aParameterValue) const - { - User::LeaveIfError(aParameterIndex); - User::LeaveIfError(aStmt.BindInt(aParameterIndex, aParameterValue)); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -TInt CCPLiwMap::ColumnIndexL(RSqlStatement& aStmt, const TDesC& aColumnName ) - const - { - TInt ret( aStmt.ColumnIndex( aColumnName ) ); - User::LeaveIfError( ret ); - return ret; - } - - - diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingutils/contentpublishingmap/src/cpsecuritypolicy.cpp --- a/contentpublishingsrv/contentpublishingutils/contentpublishingmap/src/cpsecuritypolicy.cpp Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,372 +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 - * Version : %version: ou1s60ui#5.1.2 % << Don't touch! Updated by Synergy at check-out. - * -*/ - - -#include -#include -#include - -#include "cpsecuritypolicy.h" -#include "cpdebug.h" -#include "cpglobals.h" - -_LIT( KHex, "0x" ); -_LIT( KTCB, "TCB" ); -_LIT( KLocalServices, "LocalServices" ); -_LIT( KLocation, "Location" ); -_LIT( KNetworkServices, "NetworkServices" ); -_LIT( KReadUserData, "ReadUserData" ); -_LIT( KUserEnvironment, "UserEnvironment" ); -_LIT( KWriteUserData, "WriteUserData" ); -_LIT( KAllFiles, "AllFiles" ); -_LIT( KCommDD, "CommDD" ); -_LIT( KDiskAdmin, "DiskAdmin" ); -_LIT( KDrm, "Drm" ); -_LIT( KMultimediaDD, "MultimediaDD" ); -_LIT( KNetworkControl, "NetworkControl" ); -_LIT( KPowerMgmt, "PowerMgmt" ); -_LIT( KProtServ, "ProtServ" ); -_LIT( KReadDeviceData, "ReadDeviceData" ); -_LIT( KSurroundingsDD, "SurroundingsDD" ); -_LIT( KSwEvent, "SwEvent" ); -_LIT( KTrustedUI, "TrustedUI" ); -_LIT( KWriteDeviceData, "WriteDeviceData" ); - - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -CCPSecurityPolicy::CCPSecurityPolicy( const RMessage2& aMessage ): - iMessage( aMessage ) - { - - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPSecurityPolicy::ConstructL() - { - - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -CCPSecurityPolicy* CCPSecurityPolicy::NewL( const RMessage2& aMessage ) - { - CCPSecurityPolicy* self = CCPSecurityPolicy::NewLC( aMessage ); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -CCPSecurityPolicy* CCPSecurityPolicy::NewLC( const RMessage2& aMessage ) - { - CCPSecurityPolicy* self = new( ELeave ) CCPSecurityPolicy( aMessage ); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -CCPSecurityPolicy::~CCPSecurityPolicy() - { - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPSecurityPolicy::GetDefaultSecurityL( RBuf8& aResult ) const - { - CLiwDefaultMap* aclMap = CLiwDefaultMap::NewLC(); - CLiwDefaultMap* writeMap = CLiwDefaultMap::NewLC(); - CLiwDefaultMap* deleteMap = CLiwDefaultMap::NewLC(); - - TUint32 publisherUid = iMessage.SecureId(); - - TBuf<10> uidString; - uidString.Append( KHex ); - uidString.AppendNumFixedWidth(publisherUid,EHex,8); - - writeMap->InsertL( KUIDs, TLiwVariant( uidString ) ); - deleteMap->InsertL( KUIDs, TLiwVariant( uidString ) ); - - aclMap->InsertL( KACLWrite, TLiwVariant( writeMap ) ); - aclMap->InsertL( KACLDelete, TLiwVariant( deleteMap ) ); - - //externalize - aResult.CreateL( aclMap->Size() ); - RDesWriteStream strm( aResult ); - CleanupClosePushL( strm ); - aclMap->ExternalizeL( strm ); - strm.CommitL( ); - - CleanupStack::PopAndDestroy( &strm ); - CleanupStack::PopAndDestroy( deleteMap ); - CleanupStack::PopAndDestroy( writeMap ); - CleanupStack::PopAndDestroy( aclMap ); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -TBool CCPSecurityPolicy::CheckSecurityL( TPtrC8& aBinary, - TACLPolicy aPolicy ) const - { - TBool error( ETrue ); - RDesReadStream datastrm( aBinary ); - CleanupClosePushL( datastrm ); - CLiwDefaultMap* map = CLiwDefaultMap::NewLC( datastrm ); - TLiwVariant variant; - variant.PushL(); - switch( aPolicy ) - { - case ERead: - if( map->FindL( KACLRead, variant ) ) - { - error = DoCheckSecurityL( variant.AsMap() ); - } - break; - case EWrite: - if( map->FindL( KACLWrite, variant ) ) - { - error = DoCheckSecurityL( variant.AsMap() ); - } - break; - case EDelete: - if( map->FindL( KACLDelete, variant ) ) - { - error = DoCheckSecurityL( variant.AsMap() ); - } - break; - default: - User::Leave( KErrNotSupported ); - } - CleanupStack::PopAndDestroy( &variant ); - CleanupStack::PopAndDestroy( map ); - CleanupStack::PopAndDestroy( &datastrm ); - return error; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -TBool CCPSecurityPolicy::DoCheckSecurityL( const CLiwMap* aMap ) const - { - TLiwVariant variant; - variant.PushL(); - TBool denyAccess( ETrue ); - if( aMap->FindL( KUIDs, variant ) ) - { - TPtrC uidList( KNullDesC ); - if( variant.Get( uidList) ) - { - denyAccess = CheckUids( uidList ); - } - } - if( denyAccess && aMap->FindL( KCapability, variant ) ) - { - TPtrC capList( KNullDesC ); - if( variant.Get( capList ) ) - { - denyAccess = CheckCapabilities( capList ); - } - } - CleanupStack::PopAndDestroy( &variant ); - return !denyAccess; - } - - // --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -TBool CCPSecurityPolicy::CheckUids( const TDesC& aList ) const - { - TInt i( 1 ); - TBool denyAccess( ETrue ); - TPtrC singleUid( KNullDesC ); - while( i ) - { - ExctractNextToken( aList , singleUid, i ); - TLex converter( singleUid ); - converter.Inc( KHex().Length() ); - TUint32 aclUid( 0 ); - converter.Val( aclUid , EHex ); - if( iMessage.SecureId().iId == aclUid ) - { - denyAccess = EFalse; - break; - } - ++i; - } - return denyAccess; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -TBool CCPSecurityPolicy::CheckCapabilities( const TDesC& aList ) const - { - TInt i( 1 ); - TBool denyAccess( EFalse ); - TPtrC singleCap( KNullDesC ); - while( i ) - { - ExctractNextToken( aList , singleCap, i ); - if( !iMessage.HasCapability( GetCapability( singleCap ) ) ) - { - denyAccess = ETrue; - break; - } - ++i; - } - return denyAccess; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCPSecurityPolicy::ExctractNextToken( const TDesC& aList, - TPtrC& aResult , TInt& aPos ) const - { - TPtrC buf( aList ); - for( TInt x(0); x < aPos; x++ ) - { - TInt pos = buf.Locate(':'); - if( pos!= KErrNotFound ) - { - aResult.Set( buf.Left( pos ) ); - buf.Set( buf.Right( buf.Length() - pos - 1 ) ); - } - else - { - aResult.Set( buf ); - aPos = -1; - break; - } - } - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -TCapability CCPSecurityPolicy::GetCapability( const TDesC& aCapability ) const - { - TCapability ret( ECapability_None ); - if( aCapability == KTCB ) - { - ret = ECapabilityTCB; - } - else if( aCapability == KLocalServices ) - { - ret = ECapabilityLocalServices; - } - else if( aCapability == KLocation ) - { - ret = ECapabilityLocation; - } - else if( aCapability == KNetworkServices ) - { - ret = ECapabilityNetworkServices; - } - else if( aCapability == KReadUserData ) - { - ret = ECapabilityReadUserData; - } - else if( aCapability == KUserEnvironment ) - { - ret = ECapabilityUserEnvironment; - } - else if( aCapability == KWriteUserData ) - { - ret = ECapabilityWriteUserData; - } - else if( aCapability == KAllFiles ) - { - ret = ECapabilityAllFiles; - } - else if( aCapability == KDiskAdmin ) - { - ret = ECapabilityDiskAdmin; - } - else if( aCapability == KCommDD ) - { - ret = ECapabilityCommDD; - } - else if( aCapability == KDrm ) - { - ret = ECapabilityDRM; - } - else if( aCapability == KMultimediaDD ) - { - ret = ECapabilityMultimediaDD; - } - else if( aCapability == KNetworkControl ) - { - ret = ECapabilityNetworkControl; - } - else if( aCapability == KPowerMgmt ) - { - ret = ECapabilityPowerMgmt; - } - else if( aCapability == KProtServ ) - { - ret = ECapabilityProtServ; - } - else if( aCapability == KReadDeviceData ) - { - ret = ECapabilityReadDeviceData; - } - else if( aCapability == KSurroundingsDD ) - { - ret = ECapabilitySurroundingsDD; - } - else if( aCapability == KSwEvent ) - { - ret = ECapabilitySwEvent; - } - else if( aCapability == KTrustedUI ) - { - ret = ECapabilityTrustedUI; - } - else if( aCapability == KWriteDeviceData ) - { - ret = ECapabilityWriteDeviceData; - } - else ret = ECapability_None; - return ret; - } - diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingutils/contentpublishingmap/src/cpublisherregistrymap.cpp --- a/contentpublishingsrv/contentpublishingutils/contentpublishingmap/src/cpublisherregistrymap.cpp Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,550 +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 - -#include "cpserverdef.h" -#include "cpublisherregistrymap.h" -#include "cpglobals.h" -#include "cpdebug.h" -#include "cpssqlcommands.h" -#include "cpsecuritypolicy.h" - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// - -CPublisherRegistryMap::CPublisherRegistryMap() - { - - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CPublisherRegistryMap::ConstructL() - { - CCPLiwMap::ConstructL( ); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -EXPORT_C CPublisherRegistryMap* CPublisherRegistryMap::NewL( ) - { - CPublisherRegistryMap* self = CPublisherRegistryMap::NewLC( ); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -EXPORT_C CPublisherRegistryMap* CPublisherRegistryMap::NewLC( ) - { - CPublisherRegistryMap* self = new (ELeave) CPublisherRegistryMap(); - self->PushL(); - self->ConstructL( ); - return self; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -CPublisherRegistryMap::~CPublisherRegistryMap() - { - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -TInt32 CPublisherRegistryMap::AddL( RSqlDatabase aSqlDb, - CLiwDefaultList* aNotificationList ) const - { - CP_DEBUG( _L8("CPublisherRegistryMap::AddL") ); - TInt32 id( 0); - if ( !GetProperty( KId, id ) ) - { - FetchIdL( aSqlDb, KSQLFetchIdFromRegistry, id ); - } - if ( id ) - { - UpdateL( aSqlDb, id , aNotificationList ); - } - else - { - id = AddToDbL( aSqlDb , aNotificationList ); - } - return id; - - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -TUint CPublisherRegistryMap::GetListL( RSqlDatabase aSqlDb, - CLiwGenericParamList* aList, RArray& aItemsToDelete ) const - { - CP_DEBUG( _L8("CPublisherRegistryMap::GetListL") ); - aItemsToDelete.Reset( ); //no items to delete - return CCPLiwMap::GetListL( aSqlDb, KSQLGetListFromRegistry, aList, - aItemsToDelete ); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CPublisherRegistryMap::RemoveL( RSqlDatabase aSqlDb, - CLiwDefaultList* aNotificationList ) const - { - CP_DEBUG( _L8("CContentMap::RemoveL") ); - //get ids of items to be deleted - GetIdsOfRemovedEntriesL( aSqlDb, KSQLGetIdsRegistry, aNotificationList ); - CCPLiwMap::RemoveL( aSqlDb, KSQLDeleteFromRegistry ); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CPublisherRegistryMap::SaveQueryResultsL( RSqlStatement& aStmt, - CLiwGenericParamList& aList, RArray& /*aItemsToDelete*/) const - { - CP_DEBUG( _L8("CPublisherRegistryMap::SaveQueryResultsL") ); - TInt idIndex = ColumnIndexL( aStmt, KColumnId ); - TInt publisherIndex = ColumnIndexL( aStmt, KColumnPublisher ); - TInt contentIndex = ColumnIndexL( aStmt, KColumnContent_type ); - TInt content_idIndex = ColumnIndexL( aStmt, KColumnContent_id ); - TInt flagIndex = ColumnIndexL( aStmt, KColumnFlag ); - TInt acl_Index = ColumnIndexL( aStmt, KColumnAccessList ); - TInt data_Index = ColumnIndexL( aStmt, KColumnData ); - TInt action_Index = ColumnIndexL( aStmt, KColumnAction ); - - TBool aclCheckFailed( EFalse ); - while ( aStmt.Next( ) == KSqlAtRow ) - { - TBool securityOk(EFalse); - if( iPolicy ) - { - TPtrC8 acl; - User::LeaveIfError( aStmt.ColumnBinary( acl_Index, acl ) ); - securityOk = iPolicy->CheckSecurityL( acl , - CCPSecurityPolicy::ERead ); - if ( !securityOk ) - { - aclCheckFailed = ETrue; - } - } - - if( !iPolicy || securityOk ) - { - TInt32 id = aStmt.ColumnInt( idIndex ) ; - TPtrC publisher; - User::LeaveIfError( aStmt.ColumnText( publisherIndex, - publisher ) ); - TPtrC content_type; - User::LeaveIfError( aStmt.ColumnText( contentIndex, - content_type ) ); - TPtrC content_id; - User::LeaveIfError( aStmt.ColumnText( content_idIndex, - content_id )); - TInt32 flag_db = aStmt.ColumnInt( flagIndex ); - TInt32 flag_map(0); - - TUint filter = GetFilterL(); - GetProperty( KFlag, flag_map ); - - if (!(filter & EFlag) || ( (flag_db & flag_map)==flag_map)) - { - CLiwDefaultMap* targetMap = CLiwDefaultMap::NewLC(); - targetMap->InsertL( KId , TLiwVariant( id ) ); - targetMap->InsertL( KPublisherId , TLiwVariant( publisher ) ); - targetMap->InsertL( KContentType , TLiwVariant( content_type ) ); - targetMap->InsertL( KContentId , TLiwVariant( content_id ) ); - targetMap->InsertL( KFlag , TLiwVariant( flag_db ) ); - TPtrC8 data; - User::LeaveIfError( aStmt.ColumnBinary( data_Index, data ) ); - TPtrC8 action; - User::LeaveIfError( aStmt.ColumnBinary( action_Index, action ) ); - if( data.Ptr() ) - { - targetMap->InsertL( KDataMap , TLiwVariant( data ) ); - } - if( action.Ptr() ) - { - targetMap->InsertL( KActionMap , TLiwVariant( action ) ); - } - TLiwGenericParam result( KListMap, TLiwVariant( targetMap )); - aList.AppendL( result ); - CleanupStack::PopAndDestroy( targetMap ); - } - }//if - }//while - //leave only if ACL security check for all items failed - if ( aclCheckFailed && !aList.Count()) - { - User::Leave( KErrPermissionDenied ); - } - } - - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -TInt32 CPublisherRegistryMap::AddToDbL( RSqlDatabase aSqlDb, - CLiwDefaultList* aNotificationList ) const - { - CP_DEBUG( _L8("CPublisherRegistryMap::AddToDbL") ); - RSqlStatement stmt; - CleanupClosePushL( stmt ); - PrepareStmtforAddL( aSqlDb, stmt, KSQLInsertToRegistry ); - - TInt dataIndex = stmt.ParameterIndex( KSQLData ); - TInt actionIndex = stmt.ParameterIndex( KSQLAction ); - TInt aclIndex = stmt.ParameterIndex( KSQLAccessList ); - - RBuf8 data; - data.CleanupClosePushL(); - GetPropertyL( KDataMap, data ) ; - BindBinaryL( stmt, dataIndex, data ); - RBuf8 action; - action.CleanupClosePushL(); - GetPropertyL( KActionMap, action ) ; - BindBinaryL( stmt, actionIndex, action ); - - RBuf8 acl; - acl.CleanupClosePushL(); - if( !GetPropertyL( KAccessList , acl ) ) - { - iPolicy->GetDefaultSecurityL( acl ); - } - BindBinaryL( stmt, aclIndex, acl ); - - if ( stmt.Exec( ) <= 0 ) - { - User::Leave( KErrGeneral ); - } - - TSqlScalarFullSelectQuery id_query(aSqlDb); - TInt32 ret( 0); - ret = id_query.SelectIntL( KSQLGetLastInsertId ); - - if ( aNotificationList ) - { - RBuf publisher; - publisher.CleanupClosePushL(); - RBuf contentType; - contentType.CleanupClosePushL(); - RBuf contentId; - contentId.CleanupClosePushL(); - GetPropertyL( KPublisherId, publisher ) ; - GetPropertyL( KContentType, contentType ); - GetPropertyL( KContentId, contentId ); - CLiwDefaultMap* changeInfoMap = CLiwDefaultMap::NewLC( ); - changeInfoMap->InsertL( KId, TLiwVariant( ret ) ); - changeInfoMap->InsertL( KType, TLiwVariant( KPublisher ) ); - changeInfoMap->InsertL( KPublisherId, TLiwVariant( publisher ) ); - changeInfoMap->InsertL( KContentType, TLiwVariant( contentType ) ); - changeInfoMap->InsertL( KContentId, TLiwVariant( contentId ) ); - changeInfoMap->InsertL( KOperation, TLiwVariant( KOperationAdd ) ); - TInt32 flag( 0 ); - GetProperty( KFlag, flag ); - changeInfoMap->InsertL( KFlag, TLiwVariant( flag ) ); - aNotificationList->AppendL( TLiwVariant( changeInfoMap ) ); - CleanupStack::PopAndDestroy( changeInfoMap ) ; - CleanupStack::PopAndDestroy( &contentId ) ; - CleanupStack::PopAndDestroy( &contentType ) ; - CleanupStack::PopAndDestroy( &publisher ) ; - } - - CleanupStack::PopAndDestroy( &acl ); - CleanupStack::PopAndDestroy( &action ); - CleanupStack::PopAndDestroy( &data ); - CleanupStack::PopAndDestroy( &stmt ) ; - - return ret; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CPublisherRegistryMap::AppendFilterL( RBuf& aQuery, - TUint& aFilter ) const - { - CP_DEBUG( _L8("CPublisherRegistryMap::AppendFilterL") ); - if( aFilter & EFlag ) - { - aQuery.ReAllocL( aQuery.Length() + KSQLGetFlag().Length() + - KWhere().Length() ); - aQuery.Append( KWhere ); - aQuery.Append( KSQLGetFlag ); - } - else - { - CCPLiwMap::AppendFilterL( aQuery, aFilter ); - } - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CPublisherRegistryMap::AppendSortL( RBuf& aQuery, - const TCPSortOrder& aSort ) const - { - CP_DEBUG( _L8("CPublisherRegistryMap::AppendSortL") ); - switch ( aSort ) - { - case ECPContentId: - aQuery.ReAllocL( aQuery.Length( ) + KSQLOrderContentId().Length( ) ); - aQuery.Append( KSQLOrderContentId ); - break; - case ECPContent: - aQuery.ReAllocL( aQuery.Length( ) + KSQLOrderContent().Length( ) ); - aQuery.Append( KSQLOrderContent ); - break; - case ECPPublisher: - aQuery.ReAllocL( aQuery.Length( ) + KSQLOrderPublisher().Length( ) ); - aQuery.Append( KSQLOrderPublisher ); - break; - default: - aQuery.ReAllocL( aQuery.Length( ) + KSQLOrderRecent().Length( ) ); - aQuery.Append( KSQLOrderRecent ); - break; - } - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CPublisherRegistryMap::PrepareStmtforAddL( RSqlDatabase aSqlDb, - RSqlStatement& aStmt , - const TDesC& aQuery ) const - { - CP_DEBUG( _L8("CPublisherRegistryMap::PrepareStmtforAddL") ); - CCPLiwMap::PrepareStmtforAddL( aSqlDb,aStmt,aQuery); - TInt32 flag( 0x00000000 ); - GetProperty( KFlag, flag ); - TInt flagIndex = aStmt.ParameterIndex( KSQLFlag ); - if (flagIndex != KErrNotFound) - { - BindIntL( aStmt, flagIndex , flag ); - } - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CPublisherRegistryMap::PrepareStmtforUpdateL( RSqlDatabase aSqlDb, - RSqlStatement& aStmt, TInt32 aId ) const - { - CP_DEBUG( _L8("CPublisherRegistryMap::PrepareStmtforUpdateL") ); - TInt32 flag; - TBool isFlagInfo = GetProperty( KFlag, flag ); - - TBool isParameter(EFalse); - RBuf query; - query.CleanupClosePushL(); - query.CreateL( KSQLUpdateRegistry().Length( ) ); - query.Append( KSQLUpdateRegistry ); - RBuf8 data; - data.CleanupClosePushL(); - if ( GetPropertyL( KDataMap, data ) ) - { - query.ReAllocL( query.Length( ) + KSQLUpdateData().Length( ) ); - query.Append( KSQLUpdateData ); - isParameter = ETrue; - } - RBuf8 action; - action.CleanupClosePushL(); - if ( GetPropertyL( KActionMap, action ) ) - { - if ( isParameter ) - { - query.ReAllocL( query.Length( ) + KComma().Length( ) ); - query.Append( KComma ); - } - query.ReAllocL( query.Length( ) + KSQLUpdateAction().Length( ) ); - query.Append( KSQLUpdateAction ); - isParameter = ETrue; - } - if( isFlagInfo ) - { - if(isParameter) - { - query.ReAllocL( query.Length() + KComma().Length()); - query.Append( KComma ); - } - query.ReAllocL( query.Length() + KSQLUpdateFlag().Length()); - query.Append( KSQLUpdateFlag ); - isParameter = ETrue; - } - if( !isParameter ) User::Leave( KErrPathNotFound ); - query.ReAllocL( query.Length( ) + KSQLUpdateWhere().Length( ) ); - query.Append( KSQLUpdateWhere ); - User::LeaveIfError( aStmt.Prepare( aSqlDb, query ) ); - TInt dataId = aStmt.ParameterIndex( KSQLId ); - BindIntL( aStmt, dataId, aId ); - - if ( data.Length( ) ) - { - TInt dataIndex = aStmt.ParameterIndex( KSQLData ); - BindBinaryL( aStmt,dataIndex, data ); - } - if ( action.Length( ) ) - { - TInt actionIndex = aStmt.ParameterIndex( KSQLAction ); - BindBinaryL( aStmt, actionIndex, action ); - } - if( isFlagInfo ) - { - TInt flagIndex = aStmt.ParameterIndex( KSQLFlag ); - BindIntL( aStmt, flagIndex , flag ); - } - CleanupStack::PopAndDestroy( &action ); - CleanupStack::PopAndDestroy( &data ); - CleanupStack::PopAndDestroy( &query ); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CPublisherRegistryMap::UpdateL( RSqlDatabase aSqlDb, TInt32 aId, - CLiwDefaultList* aNotificationList) const - { - CP_DEBUG( _L8("CPublisherRegistryMap::UpdateL") ); - RSqlStatement stmt; - CleanupClosePushL( stmt ); - CLiwDefaultMap* changeInfoMap = CLiwDefaultMap::NewLC( ); - FetchIdsL( aId, KSQLFetchIdsFromRegistry, changeInfoMap, aSqlDb ); - if ( aNotificationList ) - { - changeInfoMap->InsertL( KType, TLiwVariant( KPublisher ) ); - TInt32 flag( 0 ); - GetProperty( KFlag, flag ); - changeInfoMap->InsertL( KFlag, TLiwVariant( flag ) ); - aNotificationList->AppendL( TLiwVariant( changeInfoMap ) ); - } - CleanupStack::PopAndDestroy( changeInfoMap ) ; - PrepareStmtforUpdateL( aSqlDb, stmt, aId ); - if ( stmt.Exec( ) <= 0 ) - { - User::Leave( KErrNotFound ); - } - CleanupStack::PopAndDestroy( &stmt ) ; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CPublisherRegistryMap::IsValidForDeleteL() const - { - TInt err( KErrNone ); - TInt32 id( 0 ); - if( GetProperty( KId, id ) && ( id < 1 ) ) - { - err = KErrArgument; - } - else if( !IsId() && PropertyExists( KId ) ) - { - err = KErrBadName; - } - - if( err == KErrNone && !IsFlag() && !IsId( ) && !( IsPublisherNameL( ) - || IsContentTypeL( ) || IsContentIdL() ) ) - { - err = KErrPathNotFound; - } - - if( err != KErrNone ) - { - User::Leave( err ); - } - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CPublisherRegistryMap::IsValidForGetListL() const - { - TInt err( KErrNone ); - TInt32 id( 0 ); - if( GetProperty( KId, id ) && ( id < 1 ) ) - { - err = KErrArgument; - } - else if( !IsId() && PropertyExists( KId ) ) - { - err = KErrBadName; - } - - if( err != KErrNone ) - { - User::Leave( err ); - } - } -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -TBool CPublisherRegistryMap::ActivateActionSupport( ) const - { - return ETrue; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -TBool CPublisherRegistryMap::GetActivateInfo( ) const - { - TInt32 flag; - GetProperty( KFlag, flag ); - TBool activate = flag & EActivate; - return activate; - } - - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CPublisherRegistryMap::FillChangeInfoMapL( RSqlStatement& aStmt, - CLiwDefaultMap* aMap )const - { - CCPLiwMap::FillChangeInfoMapL(aStmt, aMap); - TInt flagIndex = ColumnIndexL( aStmt, KColumnFlag ); - TInt32 flag_db = aStmt.ColumnInt( flagIndex ); - aMap->InsertL( KFlag , TLiwVariant( flag_db ) ); - } - diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingutils/group/bld.inf --- a/contentpublishingsrv/contentpublishingutils/group/bld.inf Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Build information file for Content Publisher Utils -* -*/ - - - -PRJ_PLATFORMS - -DEFAULT - - -PRJ_EXPORTS -../contentpublishingdebug/inc/cpdebug.h |../../../inc/cpdebug.h - - -PRJ_MMPFILES -#include "../contentpublishingmap/group/bld.inf" -#include "../pluginvalidator/group/bld.inf" - -// End of File diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingutils/pluginvalidator/bwins/pluginvalidatoru.def --- a/contentpublishingsrv/contentpublishingutils/pluginvalidator/bwins/pluginvalidatoru.def Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -EXPORTS - ?GetCount@CPluginValidator@@QAEHXZ @ 1 NONAME ; int CPluginValidator::GetCount(void) - ?GetImplementation@CPluginValidator@@QAEPAXH@Z @ 2 NONAME ; void * CPluginValidator::GetImplementation(int) - ?GetImplementation@CPluginValidator@@QAEPAXVTUid@@@Z @ 3 NONAME ; void * CPluginValidator::GetImplementation(class TUid) - ?NewL@CPluginValidator@@SAPAV1@VTUid@@PAX@Z @ 4 NONAME ; class CPluginValidator * CPluginValidator::NewL(class TUid, void *) - ?NewLC@CPluginValidator@@SAPAV1@VTUid@@PAX@Z @ 5 NONAME ; class CPluginValidator * CPluginValidator::NewLC(class TUid, void *) - ?NewL@CHarvesterPluginValidator@@SAPAV1@VTUid@@PAX@Z @ 6 NONAME ; class CHarvesterPluginValidator * CHarvesterPluginValidator::NewL(class TUid, void *) - ?NewLC@CHarvesterPluginValidator@@SAPAV1@VTUid@@PAX@Z @ 7 NONAME ; class CHarvesterPluginValidator * CHarvesterPluginValidator::NewLC(class TUid, void *) - diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingutils/pluginvalidator/eabi/pluginvalidatoru.def --- a/contentpublishingsrv/contentpublishingutils/pluginvalidator/eabi/pluginvalidatoru.def Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -EXPORTS - _ZN16CPluginValidator17GetImplementationE4TUid @ 1 NONAME - _ZN16CPluginValidator17GetImplementationEi @ 2 NONAME - _ZN16CPluginValidator4NewLE4TUidPv @ 3 NONAME - _ZN16CPluginValidator5NewLCE4TUidPv @ 4 NONAME - _ZN16CPluginValidator8GetCountEv @ 5 NONAME - _ZN25CHarvesterPluginValidator4NewLE4TUidPv @ 6 NONAME - _ZN25CHarvesterPluginValidator5NewLCE4TUidPv @ 7 NONAME - diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingutils/pluginvalidator/group/bld.inf --- a/contentpublishingsrv/contentpublishingutils/pluginvalidator/group/bld.inf Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Build information file for Content Publisher Debug -* -*/ - -// Macro definitions -#include - -PRJ_PLATFORMS - -DEFAULT - -PRJ_EXPORTS -../inc/cpluginvalidator.h |../../../../inc/cpluginvalidator.h - -PRJ_MMPFILES -pluginvalidator.mmp - - -// End of File diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingutils/pluginvalidator/group/pluginvalidator.mmp --- a/contentpublishingsrv/contentpublishingutils/pluginvalidator/group/pluginvalidator.mmp Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 -* -*/ - -// To get the MW_LAYER_SYSTEMINCLUDE-definition -#include - -TARGET pluginvalidator.dll -TARGETTYPE dll - -UID 0x1000008D 0x2001CB6C - -CAPABILITY CAP_GENERAL_DLL -VENDORID VID_DEFAULT - -LANG SC - -SOURCEPATH ../src -SOURCE cpluginvalidator.cpp -SOURCE cblacklisthandler.cpp -SOURCE charvesterpluginvalidator.cpp - -USERINCLUDE ../inc -USERINCLUDE ../../../../inc - -MW_LAYER_SYSTEMINCLUDE - -LIBRARY euser.lib -LIBRARY ecom.lib -LIBRARY estor.lib -LIBRARY centralrepository.lib -//end of file diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingutils/pluginvalidator/inc/cblacklisthandler.h --- a/contentpublishingsrv/contentpublishingutils/pluginvalidator/inc/cblacklisthandler.h Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,108 +0,0 @@ -/* -* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 CBLACKLISTHANDLER_H_ -#define CBLACKLISTHANDLER_H_ - -//INCLUDES -#include - -//FORWARD DECLARATIONS -class CRepository; - -/* - * Blacklist Handler - */ -NONSHARABLE_CLASS( CBlacklistHandler ): public CBase - { -public: - - /** - * Two-phased constructor. - * - */ - static CBlacklistHandler* NewL( ); - - /** - * Two-phased constructor. - * - */ - static CBlacklistHandler* NewLC( ); - - /** - * Desctructor. - */ - ~CBlacklistHandler(); - - /* - * Appends plugin UID to blacklist - * @param aUid uid of the plugin - */ - void AppendL( TUid aUid ); - - /* - * Removes plugin UID from blacklist - * @param aUid uid of the plugin - */ - void RemoveL( TUid aUid ); - - /* - * Checks if plugin with provided UID is on the blacklist - * @param aUid uid of the plugin - */ - TBool IsPresentL( TUid aUid ); - - /* - * Copies blacklist unofficial blacklist to official - * if flag is set to EFalse and official to unofficial if flag = ETrue - * @param aUnofficialToOfficial flag indicating which blacklist - * should be copied - */ - void CopyBlacklistL( TBool aOfficialToUnofficial ); - -private: - - /** - * C++ default constructor. - */ - CBlacklistHandler( ); - - /** - * Perform the second phase construction of a CPluginValidator object. - */ - void ConstructL(); - - /* - * Gets blacklist array from CPS - */ - void GetArrayL( RArray& aArray, TBool aOfficial ); - - /* - * Stores blacklist array in CPS - */ - void StoreArrayL( const RArray& aArray, TBool aOfficial ); - -private: - - /** - * Provides access to repository - * Own - */ - CRepository* iRepository; - }; - -#endif /* CBLACKLISTHANDLER_H_ */ diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingutils/pluginvalidator/inc/charvesterpluginvalidator.h --- a/contentpublishingsrv/contentpublishingutils/pluginvalidator/inc/charvesterpluginvalidator.h Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,116 +0,0 @@ -/* -* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 CHARVESTERPLUGINVALIDATOR_H -#define CHARVESTERPLUGINVALIDATOR_H - -// INCLUDES -#include -#include -#include "cpluginvalidator.h" - -// FORWARD DECLARATIONS -class CBlacklistHandler; - -//CONSTS -//PubSub Category AI plug-in registry API -const TUid KPSUidActiveIdle2 = {0x102750F0}; // ActiveIdle2 SID -// Indicates that all the CPS Harvester plugins have been updated -const TUint KActiveIdleCpsPluginsUpdated = 0x0000000C; -enum EPSActiveIdleCpsPluginsUpdated - { - EPSAiPluginsNotUpdated = 0, - EPSAiPluginsUpdated - }; - -/** - * Class used to maintain required ECOM plugins implementations - * - * - * @lib cpclient.dll - * @since S60 v 5.0 - */ -NONSHARABLE_CLASS( CHarvesterPluginValidator ): public CPluginValidator - { -public: - - /** - * Two-phased constructor. - * - */ - IMPORT_C static CHarvesterPluginValidator* NewL( TUid aUid, - TAny *aParameter = NULL ); - - /** - * Two-phased constructor. - * - */ - IMPORT_C static CHarvesterPluginValidator* NewLC( TUid aUid, - TAny *aParameter = NULL ); - - /** - * Desctructor. - */ - ~CHarvesterPluginValidator(); - - -private: - - /** - * C++ default constructor. - */ - CHarvesterPluginValidator( TUid aUid, TAny *aParameter ); - - /** - * Perform the second phase construction of a CPluginValidator object. - */ - void ConstructL(); - - /** - * Loads or destroys plugins - */ - void ManagePluginsL(); - - /** - * Loads ECOM plugins - */ - void LoadPluginL( TPluginInfo& aPluginInfo ); - - -private: - - /** - * Blacklist Handler - * Own - */ - CBlacklistHandler* iBlacklist; - - /* - * Startup flag - * - */ - TBool iStartup; - - /* - * Property indicating the status of load operation - * Own - */ - RProperty iInProgressProperty; - }; - -#endif // CHARVESTERPLUGINVALIDATOR_H diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingutils/pluginvalidator/inc/cpluginvalidator.h --- a/contentpublishingsrv/contentpublishingutils/pluginvalidator/inc/cpluginvalidator.h Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,195 +0,0 @@ -/* -* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 CPLUGINVALIDATOR_H -#define CPLUGINVALIDATOR_H - -// INCLUDES -#include -#include -#include - -// FORWARD DECLARATIONS -class REComSession; - -/** - * Class containing information regarding a plugin - * - * - * @lib cpclient.dll - * @since S60 v 5.0 - */ -NONSHARABLE_CLASS( TPluginInfo ) - { -public: - TAny* iPlugin; // not own - TUid iImplementationUid; - TInt iVersion; - TUid iDtor_ID_Key; - }; - -/** - * Class used to maintain required ECOM plugins implementations - * - * - * @lib cpclient.dll - * @since S60 v 5.0 - */ -NONSHARABLE_CLASS( CPluginValidator ): public CActive - { -public: - - /** - * Two-phased constructor. - * - */ - IMPORT_C static CPluginValidator* NewL( TUid aUid, - TAny *aParameter = NULL ); - - /** - * Two-phased constructor. - * - */ - IMPORT_C static CPluginValidator* NewLC( TUid aUid, - TAny *aParameter = NULL ); - - /** - * Gets plugin with provided UID - * - * @param aUid required plugin - * @return pointer to plugin implementation - */ - IMPORT_C TAny* GetImplementation( TUid aUid ); - - /** - * Gets plugin with provided index - * - * @param aIndex index of plugin - * @return pointer to plugin implementation - */ - IMPORT_C TAny* GetImplementation( TInt aIndex ); - - /** - * Gets number of plugins - * - * @return number of plugins - */ - IMPORT_C TInt GetCount(); - - /** - * Desctructor. - */ - virtual ~CPluginValidator(); - -protected: - - /** - * From CActive, RunL. - * Handles the active object’s request completion event - */ - void RunL(); - - /** - * From CActive, DoCancel. - * Implements cancellation of an outstanding request. - */ - void DoCancel(); - - /** - * From CActive, RunError. - * Method called when leave occured in RunL - */ - TInt RunError( TInt aError ); - -protected: - - /** - * C++ default constructor. - */ - CPluginValidator( TUid aUid, TAny *aParameter ); - - /** - * Perform the second phase construction of a CPluginValidator object. - */ - void ConstructL(); - - /* - * Checks if plugin is present in an array - */ - TBool PresentInArrayL( TPluginInfo aPluginInfo, - const RImplInfoPtrArray& aInfoArray ); - - /* - * - */ - void DestroyPlugin( TInt aIndex ); - - /** - * Cleans plugins table; - */ - void CleanPluginsTable(); - - /** - * Loads or destroys plugins - */ - virtual void ManagePluginsL(); - - /** - * Loads ECOM plugins - */ - virtual void LoadPluginL( TPluginInfo& aPluginInfo ); - -protected: - - /** - * ECOM handler - * Own. - */ - REComSession* iSession; - - /** - * Array containing plugins - * Own. - */ - RArray iPluginArray; - - /** - * UID of the interface - */ - const TUid iUid; - - /** - * Parameter to pass to the object creation method. - */ - TAny* iParameter; - }; - -// ==================== LOCAL FUNCTIONS ==================== - -/** -* Identity function to search in an array of TPluginInfo. -* @param aLeft Search term. -* @param aRight Array item. -* @return ETrue if ID-s match. -*/ -LOCAL_C TBool UidMatch( const TPluginInfo& aLeft, const TPluginInfo& aRight ) - { - return aLeft.iImplementationUid == aRight.iImplementationUid; - } - -#endif // CPLUGINVALIDATOR_H diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingutils/pluginvalidator/src/cblacklisthandler.cpp --- a/contentpublishingsrv/contentpublishingutils/pluginvalidator/src/cblacklisthandler.cpp Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,227 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 -#include -#include "cpserverdef.h" - -#include "cpglobals.h" -#include "cblacklisthandler.h" -#include "centralrepository.h" - - -//CONST -const TUint32 KOfficialBlacklistCRKey = { 0x1028000A }; -const TUint32 KOfficialBlacklistSizeCRKey = { 0x1028000B }; -const TUint32 KUnofficialBlacklistCRKey = { 0x1028000C }; -const TUint32 KUnoficialBlacklistSizeCRKey = { 0x1028000D }; - -// ---------------------------------------------------------------------------- -// -// ---------------------------------------------------------------------------- -// -CBlacklistHandler* CBlacklistHandler::NewL( ) - { - CBlacklistHandler* self = CBlacklistHandler::NewLC( ); - CleanupStack::Pop( self ); - return self; - } - -// ---------------------------------------------------------------------------- -// -// ---------------------------------------------------------------------------- -// -CBlacklistHandler* CBlacklistHandler::NewLC( ) - { - CBlacklistHandler* self = new( ELeave ) CBlacklistHandler( ); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// ---------------------------------------------------------------------------- -// -// ---------------------------------------------------------------------------- -// -CBlacklistHandler::~CBlacklistHandler() - { - delete iRepository; - } - -// ---------------------------------------------------------------------------- -// -// ---------------------------------------------------------------------------- -// -CBlacklistHandler::CBlacklistHandler( ) - { - - } - -// ---------------------------------------------------------------------------- -// -// ---------------------------------------------------------------------------- -// -void CBlacklistHandler::ConstructL() - { - iRepository = CRepository::NewL( KServerUid ); - } - -// ---------------------------------------------------------------------------- -// -// ---------------------------------------------------------------------------- -// -void CBlacklistHandler::AppendL( TUid aUid ) - { - RArray blacklist; - CleanupClosePushL( blacklist ); - GetArrayL( blacklist, EFalse ); //unofficial blacklist - blacklist.AppendL( aUid ); - StoreArrayL( blacklist, EFalse );//unofficial blacklist - CleanupStack::PopAndDestroy( &blacklist ); - } - -// ---------------------------------------------------------------------------- -// -// ---------------------------------------------------------------------------- -// -void CBlacklistHandler::RemoveL( TUid aUid ) - { - RArray blacklist; - CleanupClosePushL( blacklist ); - GetArrayL( blacklist, EFalse );//from unofficial blacklist - TInt index = blacklist.Find( aUid ); - if ( index != KErrNotFound ) - { - blacklist.Remove( index ); - } - StoreArrayL( blacklist, EFalse );//unofficial blacklist - CleanupStack::PopAndDestroy( &blacklist ); - } - -// ---------------------------------------------------------------------------- -// -// ---------------------------------------------------------------------------- -// -TBool CBlacklistHandler::IsPresentL( TUid aUid ) - { - TBool result(EFalse); - RArray blacklist; - CleanupClosePushL( blacklist ); - GetArrayL( blacklist, ETrue );// from official blacklist - TInt index = blacklist.Find( aUid ); - if ( index != KErrNotFound ) - { - result = ETrue; - } - CleanupStack::PopAndDestroy( &blacklist ); - return result; - } - - -// ---------------------------------------------------------------------------- -// -// ---------------------------------------------------------------------------- -// -void CBlacklistHandler::GetArrayL( RArray& aArray, TBool aOfficial ) - { - TInt32 repositoryKey( NULL ); - TInt32 repositorySize( NULL ); - if( aOfficial ) - { - repositorySize = KOfficialBlacklistSizeCRKey; - repositoryKey = KOfficialBlacklistCRKey; - } - else - { - repositorySize = KUnoficialBlacklistSizeCRKey; - repositoryKey = KUnofficialBlacklistCRKey; - } - - TInt size(-1); - if ( KErrNone == iRepository->Get( repositorySize, size ) ) - { - RBuf8 serializedBlacklist; - serializedBlacklist.Create( size ); - CleanupClosePushL( serializedBlacklist ); - if ( KErrNone == iRepository->Get( repositoryKey, serializedBlacklist ) ) - { - RDesReadStream stream( serializedBlacklist ); - CleanupClosePushL( stream ); - TUint16 count = stream.ReadUint16L(); - for ( TInt i = 0; i < count; i++ ) - { - aArray.AppendL(TUid::Uid(stream.ReadInt32L())); - } - CleanupStack::PopAndDestroy( &stream ); - } - CleanupStack::PopAndDestroy( &serializedBlacklist ); - } - } - -// ---------------------------------------------------------------------------- -// -// ---------------------------------------------------------------------------- -// -void CBlacklistHandler::StoreArrayL( const RArray& aArray, - TBool aOfficial ) - { - TInt32 repositoryKey( NULL ); - TInt32 repositorySize( NULL ); - if( aOfficial ) - { - repositorySize = KOfficialBlacklistSizeCRKey; - repositoryKey = KOfficialBlacklistCRKey; - } - else - { - repositorySize = KUnoficialBlacklistSizeCRKey; - repositoryKey = KUnofficialBlacklistCRKey; - } - - RBuf8 serializedBlacklist; - serializedBlacklist.Create( aArray.Count() * sizeof(TInt32) + - sizeof(TUint16) ); - CleanupClosePushL( serializedBlacklist ); - RDesWriteStream stream( serializedBlacklist ); - CleanupClosePushL( stream ); - stream.WriteUint16L( aArray.Count() ); - for ( TInt i = 0; i< aArray.Count(); i++ ) - { - stream.WriteInt32L( aArray[i].iUid ); - } - stream.CommitL(); - if ( KErrNone == iRepository->Set( repositoryKey, serializedBlacklist ) ) - { - iRepository->Set( repositorySize, serializedBlacklist.Size() ); - } - CleanupStack::PopAndDestroy( &stream ); - CleanupStack::PopAndDestroy( &serializedBlacklist ); - } - -// ---------------------------------------------------------------------------- -// -// ---------------------------------------------------------------------------- -// -void CBlacklistHandler::CopyBlacklistL( TBool aOfficialToUnofficial ) - { - RArray blacklist; - CleanupClosePushL( blacklist ); - GetArrayL( blacklist, aOfficialToUnofficial ); - StoreArrayL( blacklist, !aOfficialToUnofficial ); - CleanupStack::PopAndDestroy( &blacklist ); - } - diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingutils/pluginvalidator/src/charvesterpluginvalidator.cpp --- a/contentpublishingsrv/contentpublishingutils/pluginvalidator/src/charvesterpluginvalidator.cpp Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,169 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 -#include -#include -#include // harvesting plugin - -#include "charvesterpluginvalidator.h" -#include "cblacklisthandler.h" - -const TUint32 KInProgressPropertyKey = { 0x1028000E }; -const TUint32 KHarvesterUid = { 0x10282E5A }; - -// ======== MEMBER FUNCTIONS ======== - -// ---------------------------------------------------------------------------- -// -// ---------------------------------------------------------------------------- -// -EXPORT_C CHarvesterPluginValidator* CHarvesterPluginValidator::NewL( TUid aUid, - TAny *aParameter ) - { - CHarvesterPluginValidator* self = - CHarvesterPluginValidator::NewLC( aUid , aParameter ); - CleanupStack::Pop( self ); - return self; - } - -// ---------------------------------------------------------------------------- -// -// ---------------------------------------------------------------------------- -// -EXPORT_C CHarvesterPluginValidator* CHarvesterPluginValidator::NewLC( TUid aUid, - TAny *aParameter ) - { - CHarvesterPluginValidator* self = new( ELeave ) - CHarvesterPluginValidator( aUid, aParameter ); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - - - -// --------------------------------------------------------------------------- -// destructor -// --------------------------------------------------------------------------- -CHarvesterPluginValidator::~CHarvesterPluginValidator() - { - iInProgressProperty.Close( ); - delete iBlacklist; - } - -// ---------------------------------------------------------------------------- -// -// ---------------------------------------------------------------------------- -// -CHarvesterPluginValidator::CHarvesterPluginValidator( TUid aUid, TAny* aParameter ): - CPluginValidator(aUid, aParameter), - iStartup( ETrue ) - { - - } - -// ---------------------------------------------------------------------------- -// -// ---------------------------------------------------------------------------- -// -void CHarvesterPluginValidator::ConstructL() - { - iBlacklist = CBlacklistHandler::NewL( ); - CPluginValidator::ConstructL(); - } - - -// ---------------------------------------------------------------------------- -// -// ---------------------------------------------------------------------------- -// -void CHarvesterPluginValidator::ManagePluginsL() - { - TInt errorCode = iInProgressProperty.Define( TUid::Uid( KHarvesterUid ), - KInProgressPropertyKey, RProperty::EInt ); - - if ( KErrAlreadyExists == errorCode ) - { - TInt value(-1); - iInProgressProperty.Get( TUid::Uid( KHarvesterUid ), - KInProgressPropertyKey, value); - if ( value == 1 ) - { - // property value == inprogress - // there was a panic in the previous startup - // so we make unofficial blacklist official - iBlacklist->CopyBlacklistL( EFalse ); - } - } - else - { - User::LeaveIfError( errorCode ); - } - // copy blacklisted plugins to unoffical blacklist at startup - iBlacklist->CopyBlacklistL( ETrue ); - - // set property value to 1 (which means "in progress") - iInProgressProperty.Set( TUid::Uid( KHarvesterUid ), - KInProgressPropertyKey, 1 ); - - CPluginValidator::ManagePluginsL(); - - if ( iStartup ) - { - RProperty::Set( KPSUidActiveIdle2, - KActiveIdleCpsPluginsUpdated , EPSAiPluginsUpdated ); - iStartup = EFalse; - } - // set property value to 0 (which means "finished") - iInProgressProperty.Set( TUid::Uid( KHarvesterUid ), - KInProgressPropertyKey, 0 ); - } - -// ---------------------------------------------------------------------------- -// -// ---------------------------------------------------------------------------- -// -void CHarvesterPluginValidator::LoadPluginL( TPluginInfo& aPluginInfo ) - { - if ( !iBlacklist->IsPresentL( aPluginInfo.iImplementationUid ) ) - { - //first we append UID to the blacklist - iBlacklist->AppendL( aPluginInfo.iImplementationUid ); - TAny* plug ( NULL ); - TInt err( KErrNone ); - TRAP( err, plug = REComSession::CreateImplementationL( - aPluginInfo.iImplementationUid, - aPluginInfo.iDtor_ID_Key, iParameter ) ); - if( err==KErrNone && plug ) - { - TRAP_IGNORE( - CleanupStack::PushL( plug ); - aPluginInfo.iPlugin = plug; - iPluginArray.AppendL( aPluginInfo ); - CleanupStack::Pop( plug ); - static_cast( plug )->UpdateL() - ); - } - //no panic during load so we can remove UID from blacklist - iBlacklist->RemoveL( aPluginInfo.iImplementationUid ); - } - } - - - - diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/contentpublishingutils/pluginvalidator/src/cpluginvalidator.cpp --- a/contentpublishingsrv/contentpublishingutils/pluginvalidator/src/cpluginvalidator.cpp Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,269 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 -#include -#include "cpluginvalidator.h" - -// ======== MEMBER FUNCTIONS ======== - -// ---------------------------------------------------------------------------- -// -// ---------------------------------------------------------------------------- -// -EXPORT_C CPluginValidator* CPluginValidator::NewL( TUid aUid, - TAny *aParameter ) - { - CPluginValidator* self = CPluginValidator::NewLC( aUid , aParameter ); - CleanupStack::Pop( self ); - return self; - } - -// ---------------------------------------------------------------------------- -// -// ---------------------------------------------------------------------------- -// -EXPORT_C CPluginValidator* CPluginValidator::NewLC( TUid aUid, - TAny *aParameter ) - { - CPluginValidator* self = new( ELeave ) CPluginValidator( aUid, - aParameter ); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// ---------------------------------------------------------------------------- -// -// ---------------------------------------------------------------------------- -// -EXPORT_C TAny* CPluginValidator::GetImplementation( TUid aUid ) - { - TPluginInfo pluginInfo; - pluginInfo.iImplementationUid = aUid; - TInt index = iPluginArray.Find( pluginInfo, - TIdentityRelation< TPluginInfo >(UidMatch) ); - return GetImplementation( index ); - } - -// ---------------------------------------------------------------------------- -// -// ---------------------------------------------------------------------------- -// -EXPORT_C TAny* CPluginValidator::GetImplementation( TInt aIndex ) - { - TAny* ret( NULL ); - if (( aIndex != KErrNotFound ) && ( aIndex < iPluginArray.Count() )) - { - ret= iPluginArray[aIndex].iPlugin; - } - return ret; - } - -// ---------------------------------------------------------------------------- -// -// ---------------------------------------------------------------------------- -// -EXPORT_C TInt CPluginValidator::GetCount( ) - { - return iPluginArray.Count(); - } - -// --------------------------------------------------------------------------- -// destructor -// --------------------------------------------------------------------------- -CPluginValidator::~CPluginValidator() - { - Cancel(); - CleanPluginsTable(); - iPluginArray.Close( ); - if( iSession ) - { - iSession->Close(); - } - REComSession::FinalClose( ); - } - -// ---------------------------------------------------------------------------- -// -// ---------------------------------------------------------------------------- -// -void CPluginValidator::RunL() - { - ManagePluginsL(); - iSession->NotifyOnChange( iStatus ); - SetActive(); - } - -// ---------------------------------------------------------------------------- -// -// ---------------------------------------------------------------------------- -// -void CPluginValidator::DoCancel() - { - iSession->CancelNotifyOnChange( iStatus ); - } - -// ---------------------------------------------------------------------------- -// -// ---------------------------------------------------------------------------- -// -TInt CPluginValidator::RunError( TInt /*aError*/) - { - return KErrNone; - } -// ---------------------------------------------------------------------------- -// -// ---------------------------------------------------------------------------- -// -CPluginValidator::CPluginValidator( TUid aUid, TAny* aParameter ): - CActive(EPriorityStandard), - iUid( aUid ), - iParameter( aParameter ) - { - - } - -// ---------------------------------------------------------------------------- -// -// ---------------------------------------------------------------------------- -// -void CPluginValidator::ConstructL() - { - iSession = &REComSession::OpenL(); - ManagePluginsL(); - iSession->NotifyOnChange( iStatus ); - CActiveScheduler::Add( this ); - SetActive(); - } - -// ---------------------------------------------------------------------------- -// -// ---------------------------------------------------------------------------- -// -TBool CPluginValidator::PresentInArrayL( TPluginInfo aPluginInfo, - const RImplInfoPtrArray& aInfoArray ) - { - TBool result(EFalse); - for ( TInt i = 0; i< aInfoArray.Count(); i++ ) - { - if ( aPluginInfo.iImplementationUid.iUid == - aInfoArray[i]->ImplementationUid().iUid) - { - result = ETrue; - break; - } - } - return result; - } - -// ---------------------------------------------------------------------------- -// -// ---------------------------------------------------------------------------- -// -void CPluginValidator::DestroyPlugin( TInt aIndex ) - { - CBase* plugin = static_cast( iPluginArray[aIndex].iPlugin ); - delete plugin; - REComSession::DestroyedImplementation( - iPluginArray[aIndex].iDtor_ID_Key ); - } - -// ---------------------------------------------------------------------------- -// -// ---------------------------------------------------------------------------- -// -void CPluginValidator::CleanPluginsTable() - { - for ( TInt i = 0; i < iPluginArray.Count(); i++ ) - { - DestroyPlugin( i ); - } - } - - - - -// ---------------------------------------------------------------------------- -// -// ---------------------------------------------------------------------------- -// -void CPluginValidator::ManagePluginsL() - { - // Read info about all implementations into infoArray - RImplInfoPtrArray infoArray; - CleanupResetAndDestroyPushL( infoArray ); - - REComSession::ListImplementationsL( iUid , infoArray ); - TPluginInfo pluginInfo; - //Load new plugins - for ( TInt i = 0; i < infoArray.Count( ); i++ ) - { - pluginInfo.iImplementationUid = infoArray[i]->ImplementationUid( ); - pluginInfo.iVersion = infoArray[i]->Version(); - - TInt index = iPluginArray.Find( pluginInfo, - TIdentityRelation< TPluginInfo >(UidMatch) ); - - if ( index == KErrNotFound ) - { - //plugin wasn't present, we load it now - LoadPluginL( pluginInfo ); - } - else if ( pluginInfo.iVersion > iPluginArray[index].iVersion ) - { - //plugin was present but it is a newer version, - //remove old and load a new one - DestroyPlugin( index ); - iPluginArray.Remove( index ); - LoadPluginL( pluginInfo ); - } - } - //Remove old plugins - for ( TInt i = iPluginArray.Count() - 1 ; i >= 0; i-- ) - { - pluginInfo = iPluginArray[i]; - if ( !PresentInArrayL( pluginInfo, infoArray ) ) - { - DestroyPlugin( i ); - iPluginArray.Remove( i ); - } - } - CleanupStack::PopAndDestroy( &infoArray ); - } - -// ---------------------------------------------------------------------------- -// -// ---------------------------------------------------------------------------- -// -void CPluginValidator::LoadPluginL( TPluginInfo& aPluginInfo ) - { - TAny* plug ( NULL ); - TInt err( KErrNone ); - TRAP( err, plug = REComSession::CreateImplementationL( - aPluginInfo.iImplementationUid, - aPluginInfo.iDtor_ID_Key, iParameter ) ); - if( err==KErrNone && plug ) - { - CleanupStack::PushL( plug ); - aPluginInfo.iPlugin = plug; - iPluginArray.AppendL( aPluginInfo ); - CleanupStack::Pop( plug ); - } - } - diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/group/bld.inf --- a/contentpublishingsrv/group/bld.inf Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Build info file for the Content Publisher -* -*/ - -#include - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS -../rom/contentpublishingservice.iby CORE_MW_LAYER_IBY_EXPORT_PATH(contentpublishingservice.iby) - -PRJ_MMPFILES -#ifdef CONTENT_PUBLISHER_DEBUG -#include "../contentpublishingutils/contentpublishingdebug/group/bld.inf" -#endif - -#include "../contentpublishingutils/group/bld.inf" -#include "../contentpublishingserver/group/bld.inf" -#include "../contentharvester/group/bld.inf" - -PRJ_TESTMMPFILES - -PRJ_TESTEXPORTS - -// End of file diff -r 32469d7d46ff -r 4bc7b118b3df contentpublishingsrv/rom/contentpublishingservice.iby --- a/contentpublishingsrv/rom/contentpublishingservice.iby Mon May 03 12:48:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* -* 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: IBY file for the content publishing -* -*/ - - -#ifndef CONTENTPUBLISHINGSERVICE_IBY -#define CONTENTPUBLISHINGSERVICE_IBY - -file=ABI_DIR\BUILD_DIR\cpserver.exe SHARED_LIB_DIR\cpserver.exe -file=ABI_DIR\BUILD_DIR\cpstorage.dll SHARED_LIB_DIR\cpstorage.dll -file=ABI_DIR\BUILD_DIR\cputils.dll SHARED_LIB_DIR\cputils.dll -file=ABI_DIR\BUILD_DIR\contentharvesterclient.dll SHARED_LIB_DIR\contentharvesterclient.dll -file=ABI_DIR\BUILD_DIR\contentharvester.exe SHARED_LIB_DIR\contentharvester.exe -file=ABI_DIR\BUILD_DIR\pluginvalidator.dll SHARED_LIB_DIR\pluginvalidator.dll - -ECOM_PLUGIN(chswiplugin.dll,chswiplugin.rsc) -ECOM_PLUGIN(chfactorysettingsplugin.dll,chfactorysettingsplugin.rsc) - -#ifdef CONTENT_PUBLISHER_DEBUG -file=ABI_DIR\BUILD_DIR\cpdebug.dll SHARED_LIB_DIR\cpdebug.dll -#endif // CONTENT_PUBLISHER_DEBUG - -data=\epoc32\data\z\private\20016b7b\backup_registration.xml private\20016b7b\backup_registration.xml -data=\epoc32\data\z\private\10202be9\20016b7b.txt private\10202be9\20016b7b.txt - -#endif // CONTENTPUBLISHING_IBY - -// End of File \ No newline at end of file diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/bwins/camenuu.def --- a/contentstorage/bwins/camenuu.def Mon May 03 12:48:45 2010 +0300 +++ b/contentstorage/bwins/camenuu.def Fri May 14 16:10:06 2010 +0300 @@ -1,24 +1,24 @@ EXPORTS - ?Find@CCaSrvMmcHistory@@QAEHI@Z @ 1 NONAME ; int CCaSrvMmcHistory::Find(unsigned int) - ?GetApaAppInfo@CCaSrvEngUtils@@QBEHVTUid@@AAVTApaAppInfo@@@Z @ 2 NONAME ; int CCaSrvEngUtils::GetApaAppInfo(class TUid, class TApaAppInfo &) const - ?GetAppInfo@CCaSrvEngUtils@@QBEHABVCCaInnerEntry@@AAVTApaAppInfo@@@Z @ 3 NONAME ; int CCaSrvEngUtils::GetAppInfo(class CCaInnerEntry const &, class TApaAppInfo &) const - ?GetEntriesIdsL@CCaStorageProxy@@QAEXPBVCCaInnerQuery@@AAV?$RArray@H@@@Z @ 4 NONAME ; void CCaStorageProxy::GetEntriesIdsL(class CCaInnerQuery const *, class RArray &) - ?GetEntriesL@CCaStorageProxy@@QAEXPBVCCaInnerQuery@@AAV?$RPointerArray@VCCaInnerEntry@@@@@Z @ 5 NONAME ; void CCaStorageProxy::GetEntriesL(class CCaInnerQuery const *, class RPointerArray &) - ?InsertL@CCaSrvMmcHistory@@QAEXI@Z @ 6 NONAME ; void CCaSrvMmcHistory::InsertL(unsigned int) - ?LoadL@CCaSrvMmcHistory@@QAEXAAVRFs@@ABVTDesC16@@@Z @ 7 NONAME ; void CCaSrvMmcHistory::LoadL(class RFs &, class TDesC16 const &) - ?NewL@CCaInstallNotifier@@SAPAV1@AAVMCaInstallListener@@W4TNotificationType@1@@Z @ 8 NONAME ; class CCaInstallNotifier * CCaInstallNotifier::NewL(class MCaInstallListener &, enum CCaInstallNotifier::TNotificationType) - ?OrganizeL@CCaStorageProxy@@QAEXABV?$RArray@H@@VTCaOperationParams@@@Z @ 9 NONAME ; void CCaStorageProxy::OrganizeL(class RArray const &, class TCaOperationParams) - ?RemoveL@CCaStorageProxy@@QAEXABV?$RArray@H@@@Z @ 10 NONAME ; void CCaStorageProxy::RemoveL(class RArray const &) - ?RunCaServer@@YAHXZ @ 11 NONAME ; int RunCaServer(void) - ?SaveL@CCaSrvMmcHistory@@QAEXAAVRFs@@ABVTDesC16@@@Z @ 12 NONAME ; void CCaSrvMmcHistory::SaveL(class RFs &, class TDesC16 const &) - ?TouchL@CCaStorageProxy@@QAEXPAVCCaInnerEntry@@@Z @ 13 NONAME ; void CCaStorageProxy::TouchL(class CCaInnerEntry *) - ?GetLocalizationsL@CCaStorageProxy@@QAEXAAV?$RPointerArray@VCCaLocalizationEntry@@@@@Z @ 14 NONAME ; void CCaStorageProxy::GetLocalizationsL(class RPointerArray &) - ?LocalizeEntryL@CCaStorageProxy@@QAEXAAVCCaLocalizationEntry@@@Z @ 15 NONAME ; void CCaStorageProxy::LocalizeEntryL(class CCaLocalizationEntry &) - ?DbPropertyL@CCaStorageProxy@@QAEXABVTDesC16@@AAVTDes16@@@Z @ 16 NONAME ; void CCaStorageProxy::DbPropertyL(class TDesC16 const &, class TDes16 &) - ?SetDBPropertyL@CCaStorageProxy@@QAEXABVTDesC16@@0@Z @ 17 NONAME ; void CCaStorageProxy::SetDBPropertyL(class TDesC16 const &, class TDesC16 const &) - ?AddL@CCaStorageProxy@@QAEXPAVCCaInnerEntry@@H@Z @ 18 NONAME ; void CCaStorageProxy::AddL(class CCaInnerEntry *, int) + ?SaveL@CCaSrvMmcHistory@@QAEXAAVRFs@@ABVTDesC16@@@Z @ 1 NONAME ; void CCaSrvMmcHistory::SaveL(class RFs &, class TDesC16 const &) + ?GetAppInfo@CCaSrvEngUtils@@QBEHABVCCaInnerEntry@@AAVTApaAppInfo@@@Z @ 2 NONAME ; int CCaSrvEngUtils::GetAppInfo(class CCaInnerEntry const &, class TApaAppInfo &) const + ?GetApaAppInfo@CCaSrvEngUtils@@QBEHVTUid@@AAVTApaAppInfo@@@Z @ 3 NONAME ; int CCaSrvEngUtils::GetApaAppInfo(class TUid, class TApaAppInfo &) const + ?RemoveL@CCaStorageProxy@@QAEXABV?$RArray@H@@@Z @ 4 NONAME ; void CCaStorageProxy::RemoveL(class RArray const &) + ?LocalizeEntryL@CCaStorageProxy@@QAEXAAVCCaLocalizationEntry@@@Z @ 5 NONAME ; void CCaStorageProxy::LocalizeEntryL(class CCaLocalizationEntry &) + ?DbPropertyL@CCaStorageProxy@@QAEXABVTDesC16@@AAVTDes16@@@Z @ 6 NONAME ; void CCaStorageProxy::DbPropertyL(class TDesC16 const &, class TDes16 &) + ?SetDBPropertyL@CCaStorageProxy@@QAEXABVTDesC16@@0@Z @ 7 NONAME ; void CCaStorageProxy::SetDBPropertyL(class TDesC16 const &, class TDesC16 const &) + ?LoadDataBaseFromRomL@CCaStorageProxy@@QAEXXZ @ 8 NONAME ; void CCaStorageProxy::LoadDataBaseFromRomL(void) + ?Find@CCaSrvMmcHistory@@QAEHI@Z @ 9 NONAME ; int CCaSrvMmcHistory::Find(unsigned int) + ?AddL@CCaStorageProxy@@QAEXPAVCCaInnerEntry@@HW4TItemAppearance@@@Z @ 10 NONAME ; void CCaStorageProxy::AddL(class CCaInnerEntry *, int, enum TItemAppearance) + ?NewL@CCaMmcWatcher@@SAPAV1@AAVRFs@@PAVMMmcWatcherCallback@@@Z @ 11 NONAME ; class CCaMmcWatcher * CCaMmcWatcher::NewL(class RFs &, class MMmcWatcherCallback *) + ?GetEntriesL@CCaStorageProxy@@QAEXPBVCCaInnerQuery@@AAV?$RPointerArray@VCCaInnerEntry@@@@@Z @ 12 NONAME ; void CCaStorageProxy::GetEntriesL(class CCaInnerQuery const *, class RPointerArray &) + ?NewL@CCaInstallNotifier@@SAPAV1@AAVMCaInstallListener@@W4TNotificationType@1@@Z @ 13 NONAME ; class CCaInstallNotifier * CCaInstallNotifier::NewL(class MCaInstallListener &, enum CCaInstallNotifier::TNotificationType) + ?InsertL@CCaSrvMmcHistory@@QAEXI@Z @ 14 NONAME ; void CCaSrvMmcHistory::InsertL(unsigned int) + ?NewLC@CCaMmcWatcher@@SAPAV1@AAVRFs@@PAVMMmcWatcherCallback@@@Z @ 15 NONAME ; class CCaMmcWatcher * CCaMmcWatcher::NewLC(class RFs &, class MMmcWatcherCallback *) + ?TouchL@CCaStorageProxy@@QAEXPAVCCaInnerEntry@@@Z @ 16 NONAME ; void CCaStorageProxy::TouchL(class CCaInnerEntry *) + ?LoadL@CCaSrvMmcHistory@@QAEXAAVRFs@@ABVTDesC16@@@Z @ 17 NONAME ; void CCaSrvMmcHistory::LoadL(class RFs &, class TDesC16 const &) + ?OrganizeL@CCaStorageProxy@@QAEXABV?$RArray@H@@VTCaOperationParams@@@Z @ 18 NONAME ; void CCaStorageProxy::OrganizeL(class RArray const &, class TCaOperationParams) ?CustomSortL@CCaStorageProxy@@QAEXABV?$RArray@H@@H@Z @ 19 NONAME ; void CCaStorageProxy::CustomSortL(class RArray const &, int) - ?LoadDataBaseFromRomL@CCaStorageProxy@@QAEXXZ @ 20 NONAME ; void CCaStorageProxy::LoadDataBaseFromRomL(void) - ?NewL@CCaMmcWatcher@@SAPAV1@AAVRFs@@PAVMMmcWatcherCallback@@@Z @ 21 NONAME ; class CCaMmcWatcher * CCaMmcWatcher::NewL(class RFs &, class MMmcWatcherCallback *) - ?NewLC@CCaMmcWatcher@@SAPAV1@AAVRFs@@PAVMMmcWatcherCallback@@@Z @ 22 NONAME ; class CCaMmcWatcher * CCaMmcWatcher::NewLC(class RFs &, class MMmcWatcherCallback *) + ?GetLocalizationsL@CCaStorageProxy@@QAEXAAV?$RPointerArray@VCCaLocalizationEntry@@@@@Z @ 20 NONAME ; void CCaStorageProxy::GetLocalizationsL(class RPointerArray &) + ?RunCaServer@@YAHXZ @ 21 NONAME ; int RunCaServer(void) + ?GetEntriesIdsL@CCaStorageProxy@@QAEXPBVCCaInnerQuery@@AAV?$RArray@H@@@Z @ 22 NONAME ; void CCaStorageProxy::GetEntriesIdsL(class CCaInnerQuery const *, class RArray &) diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/bwins/cautilsu.def --- a/contentstorage/bwins/cautilsu.def Mon May 03 12:48:45 2010 +0300 +++ b/contentstorage/bwins/cautilsu.def Fri May 14 16:10:06 2010 +0300 @@ -29,71 +29,71 @@ ?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 &) - ?SetFileNameL@CCaInnerIconDescription@@QAEXABVTDesC16@@@Z @ 31 NONAME ; void CCaInnerIconDescription::SetFileNameL(class TDesC16 const &) - ?SetParentId@CCaInnerNotifierFilter@@QAEXH@Z @ 32 NONAME ; void CCaInnerNotifierFilter::SetParentId(int) - ?SetFlagsOn@CCaInnerQuery@@QAEXI@Z @ 33 NONAME ; void CCaInnerQuery::SetFlagsOn(unsigned int) - ?SetTypeNames@CCaInnerNotifierFilter@@QAEXPAVCDesC16ArrayFlat@@@Z @ 34 NONAME ; void CCaInnerNotifierFilter::SetTypeNames(class CDesC16ArrayFlat *) - ?NewLC@CCaLocalizationEntry@@SAPAV1@XZ @ 35 NONAME ; class CCaLocalizationEntry * CCaLocalizationEntry::NewLC(void) - ?NewL@CCaInnerNotifierFilter@@SAPAV1@W4TNotifierType@1@@Z @ 36 NONAME ; class CCaInnerNotifierFilter * CCaInnerNotifierFilter::NewL(enum CCaInnerNotifierFilter::TNotifierType) - ?GetTableName@CCaLocalizationEntry@@QBEABVRBuf16@@XZ @ 37 NONAME ; class RBuf16 const & CCaLocalizationEntry::GetTableName(void) const - ?GetFlagsOff@CCaInnerQuery@@QBEIXZ @ 38 NONAME ; unsigned int CCaInnerQuery::GetFlagsOff(void) const - ?InternalizeL@CCaInnerEntry@@QAEXAAVRReadStream@@@Z @ 39 NONAME ; void CCaInnerEntry::InternalizeL(class RReadStream &) - ?GetAttributeName@CCaLocalizationEntry@@QBEABVRBuf16@@XZ @ 40 NONAME ; class RBuf16 const & CCaLocalizationEntry::GetAttributeName(void) const - ?AddAttributeL@CCaInnerQuery@@QAEXABVTDesC16@@0@Z @ 41 NONAME ; void CCaInnerQuery::AddAttributeL(class TDesC16 const &, 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 &) - ?Exist@RCaEntryAttrArray@@QAEHABVTDesC16@@@Z @ 43 NONAME ; int RCaEntryAttrArray::Exist(class TDesC16 const &) - ?AddAttributeL@CCaInnerEntry@@QAEXABVTDesC16@@0@Z @ 44 NONAME ; void CCaInnerEntry::AddAttributeL(class TDesC16 const &, class TDesC16 const &) - ?GetParentId@CCaInnerQuery@@QBEHXZ @ 45 NONAME ; int CCaInnerQuery::GetParentId(void) const - ?SetDescriptionL@CCaInnerEntry@@QAEXABVTDesC16@@@Z @ 46 NONAME ; void CCaInnerEntry::SetDescriptionL(class TDesC16 const &) - ?SetEntryRole@CCaInnerNotifierFilter@@QAEXW4TEntryRole@@@Z @ 47 NONAME ; void CCaInnerNotifierFilter::SetEntryRole(enum TEntryRole) - ?GetFlagsOn@CCaInnerQuery@@QBEIXZ @ 48 NONAME ; unsigned int CCaInnerQuery::GetFlagsOn(void) const - ?GetIconId@CCaInnerEntry@@QBEHXZ @ 49 NONAME ; int CCaInnerEntry::GetIconId(void) const - ?SetIconDataL@CCaInnerEntry@@QAEXABVTDesC16@@00@Z @ 50 NONAME ; void CCaInnerEntry::SetIconDataL(class TDesC16 const &, class TDesC16 const &, class TDesC16 const &) - ?GetEntryRole@CCaInnerNotifierFilter@@QBE?AW4TEntryRole@@XZ @ 51 NONAME ; enum TEntryRole CCaInnerNotifierFilter::GetEntryRole(void) const - ?GetId@CCaInnerEntry@@QBEHXZ @ 52 NONAME ; int CCaInnerEntry::GetId(void) const - ?SetEntryTypeNames@CCaInnerQuery@@QAEXPAVCDesC16ArrayFlat@@@Z @ 53 NONAME ; void CCaInnerQuery::SetEntryTypeNames(class CDesC16ArrayFlat *) - ?GetNotifierType@CCaInnerNotifierFilter@@QBE?AW4TNotifierType@1@XZ @ 54 NONAME ; enum CCaInnerNotifierFilter::TNotifierType CCaInnerNotifierFilter::GetNotifierType(void) const - ?ExternalizeL@CCaInnerEntry@@QBEXAAVRWriteStream@@@Z @ 55 NONAME ; void CCaInnerEntry::ExternalizeL(class RWriteStream &) const - ?SetRole@CCaInnerQuery@@QAEXH@Z @ 56 NONAME ; void CCaInnerQuery::SetRole(int) - ?NewL@CCaLocalizationEntry@@SAPAV1@XZ @ 57 NONAME ; class CCaLocalizationEntry * CCaLocalizationEntry::NewL(void) - ?InternalizeL@CCaInnerNotifierFilter@@QAEXAAVRReadStream@@@Z @ 58 NONAME ; void CCaInnerNotifierFilter::InternalizeL(class RReadStream &) - ?InternalizeL@RCaIdsArray@@QAEXAAVRReadStream@@@Z @ 59 NONAME ; void RCaIdsArray::InternalizeL(class RReadStream &) - ?MarshalDataLC@RCaIdsArray@@QBEPAVHBufC8@@XZ @ 60 NONAME ; class HBufC8 * RCaIdsArray::MarshalDataLC(void) const - ?GetEntryTypeNames@CCaInnerQuery@@QBEPBVCDesC16ArrayFlat@@XZ @ 61 NONAME ; class CDesC16ArrayFlat const * CCaInnerQuery::GetEntryTypeNames(void) const - ?SetValueL@CCaEntryAttribute@@QAEXABVTDesC16@@@Z @ 62 NONAME ; void CCaEntryAttribute::SetValueL(class TDesC16 const &) - ?SetSkinIdL@CCaInnerIconDescription@@QAEXABVTDesC16@@@Z @ 63 NONAME ; void CCaInnerIconDescription::SetSkinIdL(class TDesC16 const &) - ?ExternalizeL@CCaInnerQuery@@QBEXAAVRWriteStream@@@Z @ 64 NONAME ; void CCaInnerQuery::ExternalizeL(class RWriteStream &) const - ?GetLocalizedString@CCaLocalizationEntry@@QBEABVRBuf16@@XZ @ 65 NONAME ; class RBuf16 const & CCaLocalizationEntry::GetLocalizedString(void) const - ?InternalizeL@CCaInnerQuery@@QAEXAAVRReadStream@@@Z @ 66 NONAME ; void CCaInnerQuery::InternalizeL(class RReadStream &) - ?NewLC@CCaEntryAttribute@@SAPAV1@ABVTDesC16@@@Z @ 67 NONAME ; class CCaEntryAttribute * CCaEntryAttribute::NewLC(class TDesC16 const &) - ?GetTypeNames@CCaInnerNotifierFilter@@QBEPAVCDesC16ArrayFlat@@XZ @ 68 NONAME ; class CDesC16ArrayFlat * CCaInnerNotifierFilter::GetTypeNames(void) const - ?NewL@CCaInnerEntry@@SAPAV1@XZ @ 69 NONAME ; class CCaInnerEntry * CCaInnerEntry::NewL(void) - ?SetRole@CCaInnerEntry@@QAEXI@Z @ 70 NONAME ; void CCaInnerEntry::SetRole(unsigned int) - ?NewLC@CCaInnerEntry@@SAPAV1@XZ @ 71 NONAME ; class CCaInnerEntry * CCaInnerEntry::NewLC(void) - ?SetTableNameL@CCaLocalizationEntry@@QAEXABVTDesC16@@@Z @ 72 NONAME ; void CCaLocalizationEntry::SetTableNameL(class TDesC16 const &) - ?GetAttributes@CCaInnerEntry@@QBEABVRCaEntryAttrArray@@XZ @ 73 NONAME ; class RCaEntryAttrArray const & CCaInnerEntry::GetAttributes(void) const - ?GetRowId@CCaLocalizationEntry@@QBEHXZ @ 74 NONAME ; int CCaLocalizationEntry::GetRowId(void) const - ?NewLC@CCaInnerIconDescription@@SAPAV1@XZ @ 75 NONAME ; class CCaInnerIconDescription * CCaInnerIconDescription::NewLC(void) - ?SetIdsL@CCaInnerQuery@@QAEXABV?$RArray@H@@@Z @ 76 NONAME ; void CCaInnerQuery::SetIdsL(class RArray const &) - ?SetFlagsOff@CCaInnerQuery@@QAEXI@Z @ 77 NONAME ; void CCaInnerQuery::SetFlagsOff(unsigned int) - ?Icon@CCaInnerEntry@@QBEPBVCCaInnerIconDescription@@XZ @ 78 NONAME ; class CCaInnerIconDescription const * CCaInnerEntry::Icon(void) const - ?SetApplicationIdL@CCaInnerIconDescription@@QAEXABVTDesC16@@@Z @ 79 NONAME ; void CCaInnerIconDescription::SetApplicationIdL(class TDesC16 const &) - ?RemoveAttributeL@CCaInnerEntry@@QAEXABVTDesC16@@@Z @ 80 NONAME ; void CCaInnerEntry::RemoveAttributeL(class TDesC16 const &) - ?GetRole@CCaInnerEntry@@QBEIXZ @ 81 NONAME ; unsigned int CCaInnerEntry::GetRole(void) const - ?GetIds@CCaInnerQuery@@QBEABV?$RArray@H@@XZ @ 82 NONAME ; class RArray const & CCaInnerQuery::GetIds(void) const - ?ExternalizeL@RCaEntriesArray@@QBEXAAVRWriteStream@@@Z @ 83 NONAME ; void RCaEntriesArray::ExternalizeL(class RWriteStream &) const - ?NewL@CCaInnerQuery@@SAPAV1@XZ @ 84 NONAME ; class CCaInnerQuery * CCaInnerQuery::NewL(void) - ?SetUid@CCaInnerQuery@@QAEXI@Z @ 85 NONAME ; void CCaInnerQuery::SetUid(unsigned int) - ?GetDescription@CCaInnerEntry@@QBEABVRBuf16@@XZ @ 86 NONAME ; class RBuf16 const & CCaInnerEntry::GetDescription(void) const - ?GetRole@CCaInnerQuery@@QBEHXZ @ 87 NONAME ; int CCaInnerQuery::GetRole(void) const - ?GetEntryTypeName@CCaInnerEntry@@QBEABVRBuf16@@XZ @ 88 NONAME ; class RBuf16 const & CCaInnerEntry::GetEntryTypeName(void) const - ?NewLC@CCaInnerQuery@@SAPAV1@XZ @ 89 NONAME ; class CCaInnerQuery * CCaInnerQuery::NewLC(void) - ?SetTextL@CCaInnerEntry@@QAEXABVTDesC16@@@Z @ 90 NONAME ; void CCaInnerEntry::SetTextL(class TDesC16 const &) - ?SetParentId@CCaInnerQuery@@QAEXH@Z @ 91 NONAME ; void CCaInnerQuery::SetParentId(int) - ?GetIds@CCaInnerNotifierFilter@@QBE?AV?$RArray@H@@XZ @ 92 NONAME ; class RArray CCaInnerNotifierFilter::GetIds(void) const - ?SetStringIdL@CCaLocalizationEntry@@QAEXABVTDesC16@@@Z @ 93 NONAME ; void CCaLocalizationEntry::SetStringIdL(class TDesC16 const &) - ?SetTextId@CCaLocalizationEntry@@QAEXI@Z @ 94 NONAME ; void CCaLocalizationEntry::SetTextId(unsigned int) - ?RemoveAttribute@RCaEntryAttrArray@@QAEXABVTDesC16@@@Z @ 95 NONAME ; void RCaEntryAttrArray::RemoveAttribute(class TDesC16 const &) - ?Find@RCaEntryAttrArray@@QAEHABVTDesC16@@AAVTPtrC16@@@Z @ 96 NONAME ; int RCaEntryAttrArray::Find(class TDesC16 const &, class TPtrC16 &) - ?FindAttribute@CCaInnerEntry@@QAEHABVTDesC16@@AAVTPtrC16@@@Z @ 97 NONAME ; int CCaInnerEntry::FindAttribute(class TDesC16 const &, class TPtrC16 &) + ?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 &) + ?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 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 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 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 &) diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/caclient/inc/caentry_p.h --- a/contentstorage/caclient/inc/caentry_p.h Mon May 03 12:48:45 2010 +0300 +++ b/contentstorage/caclient/inc/caentry_p.h Fri May 14 16:10:06 2010 +0300 @@ -68,50 +68,22 @@ private: - /*! - * Points to the CaEntry instance that uses - * this private implementation. - */ CaEntry *const m_q; - /*! - * - */ int mId; - /*! - * - */ QString mText; - /*! - * - */ QString mDescription; - /*! - * - */ CaIconDescription mIconDescription; - /*! - * - */ EntryFlags mFlags; - /*! - * - */ QString mEntryTypeName; - /*! - * - */ QMap mAttributes; - /*! - * - */ EntryRole mEntryRole; }; diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/caclient/inc/caiconcache.h --- a/contentstorage/caclient/inc/caiconcache.h Mon May 03 12:48:45 2010 +0300 +++ b/contentstorage/caclient/inc/caiconcache.h Fri May 14 16:10:06 2010 +0300 @@ -53,11 +53,11 @@ private: static QSharedPointer mInstance; - QCache mCache; //own + QCache mCache; - QSharedPointer mService;//not own + QSharedPointer mService; - CaNotifier *mNotifier;//own + CaNotifier *mNotifier; friend class QtSharedPointer::ExternalRefCount; }; diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/caclient/inc/caicondescription_p.h --- a/contentstorage/caclient/inc/caicondescription_p.h Mon May 03 12:48:45 2010 +0300 +++ b/contentstorage/caclient/inc/caicondescription_p.h Fri May 14 16:10:06 2010 +0300 @@ -45,29 +45,14 @@ private: - /*! - * Points to the CaEntry instance that uses this private implementation. - */ CaIconDescription *const m_q; - /*! - * - */ int mId; - /*! - * - */ QString mFilename; - /*! - * - */ QString mSkinId; - /*! - * - */ QString mApplicationId; }; diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/caclient/inc/canotifier_p.h --- a/contentstorage/caclient/inc/canotifier_p.h Mon May 03 12:48:45 2010 +0300 +++ b/contentstorage/caclient/inc/canotifier_p.h Fri May 14 16:10:06 2010 +0300 @@ -21,6 +21,7 @@ class CaClientNotifierProxy; class CaNotifier; class CaNotifierFilter; +class CaObserver; class CaNotifierPrivate { @@ -33,7 +34,8 @@ GroupContentChangedNotifierType }; - CaNotifierPrivate(const CaNotifierFilter ¬ifierFilter); + CaNotifierPrivate(const CaNotifierFilter ¬ifierFilter, + CaClientNotifierProxy *notifierProxy); ~CaNotifierPrivate(); int registerNotifier(NotifierType notifierType); @@ -41,24 +43,14 @@ void makeConnect(); - void makeDisconnect(); - private: - /*! - * Points to the CaNotifier instance that uses - * this private implementation. - */ const CaNotifier *m_q; - /*! - * Own. - */ const CaNotifierFilter *mNotifierFilter; - /*! - * Own. - */ + const CaObserver *mObserver; + CaClientNotifierProxy *mNotifierProxy; friend class CaNotifier; diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/caclient/inc/canotifierfilter_p.h --- a/contentstorage/caclient/inc/canotifierfilter_p.h Mon May 03 12:48:45 2010 +0300 +++ b/contentstorage/caclient/inc/canotifierfilter_p.h Fri May 14 16:10:06 2010 +0300 @@ -57,10 +57,6 @@ private: - /*! - * Points to the CaNotifierFilter instance that uses - * this private implementation. - */ CaNotifierFilter *const m_q; }; diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/caclient/inc/caquery_p.h --- a/contentstorage/caclient/inc/caquery_p.h Mon May 03 12:48:45 2010 +0300 +++ b/contentstorage/caclient/inc/caquery_p.h Fri May 14 16:10:06 2010 +0300 @@ -66,9 +66,6 @@ private: - /** - * Points to the CaQuery instance that uses this private implementation. - */ CaQuery *const m_q; EntryRoles mEntryRoles; diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/caclient/inc/caservice_p.h --- a/contentstorage/caclient/inc/caservice_p.h Mon May 03 12:48:45 2010 +0300 +++ b/contentstorage/caclient/inc/caservice_p.h Fri May 14 16:10:06 2010 +0300 @@ -26,6 +26,7 @@ class CaQuery; class CaService; class CaNotifier; +class CaClientNotifierProxy; class CaServicePrivate { @@ -66,19 +67,12 @@ private: - /** - * Points to the CaService instance that uses this private implementation. - */ CaService *const m_q; - /** - * Proxy to communicate with Symbian server. - */ CaClientProxy *mProxy; + + CaClientNotifierProxy *mNotifierProxy; - /** - * code of error caused by last operation. - */ mutable ErrorCode mErrorCode; }; diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/caclient/s60/inc/caclientnotifierproxy.h --- a/contentstorage/caclient/s60/inc/caclientnotifierproxy.h Mon May 03 12:48:45 2010 +0300 +++ b/contentstorage/caclient/s60/inc/caclientnotifierproxy.h Fri May 14 16:10:06 2010 +0300 @@ -30,44 +30,7 @@ class CaEntry; class CaNotifierFilter; -/** - * IDataObserver - * - */ -class IDataObserver -{ -public: - /** - * Method invoked when entry is changed. - * @param entryId entry id. - * @param changeType change type. - */ - virtual void entryChanged(TInt entryId, - TChangeType changeType) const = 0; - - /** - * Method invoked when entry is changed. - * @param entry entry. - * @param changeType change type. - */ - virtual void entryChanged(const CCaInnerEntry &entry, - TChangeType changeType) const = 0; - - /** - * Method invoked when entry was changed. - * @param entryId entry id. - */ - virtual void entryTouched(TInt id) const = 0; - - /** - * Method invoked when entry was changed. - * @param groupId group id. - */ - virtual void groupContentChanged(TInt groupId) const = 0; -}; - -class CACLIENT_EXPORT CaClientNotifierProxy: public QObject, - public IDataObserver +class CACLIENT_EXPORT CaClientNotifierProxy: public QObject { Q_OBJECT @@ -85,33 +48,6 @@ ~CaClientNotifierProxy(); /** - * Method invoked when entry is changed. - * @param entryId entry id. - * @param changeType change type. - */ - virtual void entryChanged(TInt entryId, TChangeType changeType) const; - - /** - * Method invoked when entry is changed. - * @param entry entry. - * @param changeType change type. - */ - virtual void entryChanged(const CCaInnerEntry &entry, - TChangeType changeType) const; - - /** - * Method invoked when entry was changed. - * @param entryId entry id. - */ - virtual void entryTouched(TInt entryId) const; - - /** - * Method invoked when entry was changed. - * @param groupId group id. - */ - virtual void groupContentChanged(TInt groupId) const; - - /** * Method for registering notifier * * @param notifierFilter notifierFilter used to register notifier. @@ -121,7 +57,7 @@ int registerNotifier( const CaNotifierFilter *notifierFilter, CaNotifierPrivate::NotifierType notifierType, - const CaClientNotifierProxy *notifierProxy); + const IDataObserver *observer); /** * Method for unregistering notifier. @@ -133,13 +69,11 @@ const CaNotifierFilter ¬ifierFilter, CaNotifierPrivate::NotifierType notifierType); -signals: - - void signalEntryChanged(int entryId, ChangeType changeType) const; - void signalEntryChanged(const CaEntry &entry, - ChangeType changeType) const; - void signalEntryTouched(int id) const; - void signalGroupContentChanged(int groupId) const; + /** + * Reconnect all sessions when server was terminated + * + */ + void connectSessions(); private: /** @@ -181,7 +115,6 @@ Q_DISABLE_COPY(CaClientNotifierProxy) friend class CaClientProxy; - friend class CaClientObserver; }; diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/caclient/s60/inc/caclientnotifiersession.h --- a/contentstorage/caclient/s60/inc/caclientnotifiersession.h Mon May 03 12:48:45 2010 +0300 +++ b/contentstorage/caclient/s60/inc/caclientnotifiersession.h Fri May 14 16:10:06 2010 +0300 @@ -74,6 +74,13 @@ void Close(); /** + * Reconnect all subsession + * + * @since S60 v 5.0 + */ + void ConnectAllL(); + + /** * Registers a notifier. * @param innerNotifierFilter pointer to inner (symbian style) filter. * @param notifierFilter notifier filter address @@ -84,7 +91,7 @@ */ TInt RegisterNotifier(CCaInnerNotifierFilter *innerNotifierFilter, const TAny* notifierFilter, - const CaClientNotifierProxy* notifierProxy); + const IDataObserver* notifierProxy); /** * Unregisters a notifier. @@ -135,7 +142,7 @@ */ void RegisterNotifierL(CCaInnerNotifierFilter* innerNotifierFilter, const TAny* notifierFilter, - const CaClientNotifierProxy *notifierProxy); + const IDataObserver *notifierProxy); /* * GetSizeL method diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/caclient/s60/inc/caclientsubsession.h --- a/contentstorage/caclient/s60/inc/caclientsubsession.h Mon May 03 12:48:45 2010 +0300 +++ b/contentstorage/caclient/s60/inc/caclientsubsession.h Fri May 14 16:10:06 2010 +0300 @@ -58,17 +58,12 @@ /** * Sends request for getting change information. */ - void GetChangeInfoAndNotifyObserverL() const; + void GetChangeInfoL() const; -private: /** * Notify observer. - * @param aEntry pointer to inner entry. - * @param aChangeType change type. */ - void NotifyObserver( - CCaInnerEntry* aEntry, - TChangeType aChangeType ) const; + void NotifyObserver() const; private: /** @@ -95,6 +90,16 @@ * Own. */ TPckgBuf* iMessageSize; + + /** + * Own. + */ + mutable CCaInnerEntry* iChangedEntry; + + /** + * Own. + */ + mutable TChangeType iChangedEntryType; }; #endif /* CACLIENTSUBSESSION_H_ */ diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/caclient/s60/inc/caobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentstorage/caclient/s60/inc/caobserver.h Fri May 14 16:10:06 2010 +0300 @@ -0,0 +1,121 @@ +/* + * 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 : Content Arsenal client session + * + */ + +#ifndef CAOBSERVER_H_ +#define CAOBSERVER_H_ + +#include + +#include "cadef.h" +#include "cadefs.h" + + +class CCaInnerEntry; +class CaEntry; + +/** + * IDataObserver + * + */ +class IDataObserver +{ +public: + /** + * Method invoked when entry is changed. + * @param entryId entry id. + * @param changeType change type. + */ + virtual void entryChanged(TInt entryId, + TChangeType changeType) const = 0; + + /** + * Method invoked when entry is changed. + * @param entry entry. + * @param changeType change type. + */ + virtual void entryChanged(const CCaInnerEntry &entry, + TChangeType changeType) const = 0; + + /** + * Method invoked when entry was changed. + * @param entryId entry id. + */ + virtual void entryTouched(TInt id) const = 0; + + /** + * Method invoked when entry was changed. + * @param groupId group id. + */ + virtual void groupContentChanged(TInt groupId) const = 0; +}; + + + +class CaObserver: public QObject, public IDataObserver +{ + Q_OBJECT +public: + /** + * Constructor. + * @param parent pointer to parent. Defaults to NULL. + */ + CaObserver(QObject *parent = 0); + + /** + * Destructor. + */ + ~CaObserver(); + + /** + * Method invoked when entry is changed. + * @param entryId entry id. + * @param changeType change type. + */ + void entryChanged(TInt entryId, + TChangeType changeType) const; + + /** + * Method invoked when entry is changed. + * @param entry entry. + * @param changeType change type. + */ + void entryChanged(const CCaInnerEntry &entry, + TChangeType changeType) const; + + /** + * Method invoked when entry was changed. + * @param entryId entry id. + */ + void entryTouched(TInt id) const ; + + /** + * Method invoked when entry was changed. + * @param groupId group id. + */ + void groupContentChanged(TInt groupId) const; + +signals: + + void signalEntryChanged(int entryId, ChangeType changeType) const; + void signalEntryChanged(const CaEntry &entry, + ChangeType changeType) const; + void signalEntryTouched(int id) const; + void signalGroupContentChanged(int groupId) const; +}; + + +#endif /* CAOBSERVER_H_ */ diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/caclient/s60/src/caclientnotifier.cpp --- a/contentstorage/caclient/s60/src/caclientnotifier.cpp Mon May 03 12:48:45 2010 +0300 +++ b/contentstorage/caclient/s60/src/caclientnotifier.cpp Fri May 14 16:10:06 2010 +0300 @@ -76,11 +76,12 @@ TInt error = iStatus.Int(); if( error == KErrNone ) { - TRAP( error, iSubsession->GetChangeInfoAndNotifyObserverL() ); + TRAP( error, iSubsession->GetChangeInfoL() ); if( error == KErrNone ) { iSubsession->RegisterForNotificationsL( iStatus ); SetActive(); + iSubsession->NotifyObserver(); } } } diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/caclient/s60/src/caclientnotifierproxy.cpp --- a/contentstorage/caclient/s60/src/caclientnotifierproxy.cpp Mon May 03 12:48:45 2010 +0300 +++ b/contentstorage/caclient/s60/src/caclientnotifierproxy.cpp Fri May 14 16:10:06 2010 +0300 @@ -17,6 +17,7 @@ #include #include "caclientnotifierproxy.h" +#include "caobserver.h" #include "caentry.h" #include "cainnerentry.h" #include "caobjectadapter.h" @@ -38,63 +39,10 @@ //---------------------------------------------------------------------------- // //---------------------------------------------------------------------------- -void CaClientNotifierProxy::entryChanged(TInt entryId, - TChangeType changeType) const -{ - qDebug() << "CaClientProxy::entryChanged entryId:" - << entryId << "changeType:" << changeType; - - int entryChangedId(entryId); - ChangeType entryChangeType(AddChangeType); - CaObjectAdapter::convert(changeType, entryChangeType); - - emit signalEntryChanged(entryChangedId, entryChangeType); -} - -//---------------------------------------------------------------------------- -// -//---------------------------------------------------------------------------- -void CaClientNotifierProxy::entryChanged(const CCaInnerEntry &entry, - TChangeType changeType) const -{ - qDebug() << "CaClientProxy::entryChanged changeType:" << changeType; - - CaEntry *caEntry = new CaEntry(static_cast(entry.GetRole())); - ChangeType entryChangeType(AddChangeType); - CaObjectAdapter::convert(entry, *caEntry); - CaObjectAdapter::convert(changeType, entryChangeType); - - emit signalEntryChanged(*caEntry, entryChangeType); -} - -//---------------------------------------------------------------------------- -// -//---------------------------------------------------------------------------- -void CaClientNotifierProxy::entryTouched(TInt id) const -{ - qDebug() << "CaClientProxy::entryTouched id:" << id; - emit signalEntryTouched(id); -} - -//---------------------------------------------------------------------------- -// -//---------------------------------------------------------------------------- -void CaClientNotifierProxy::groupContentChanged(TInt groupId) const -{ - qDebug() << "CaClientProxy::groupContentChanged groupId:" << groupId; - - int groupChangedId(groupId); - - emit signalGroupContentChanged(groupChangedId); -} - -//---------------------------------------------------------------------------- -// -//---------------------------------------------------------------------------- int CaClientNotifierProxy::registerNotifier( const CaNotifierFilter *notifierFilter, CaNotifierPrivate::NotifierType notifierType, - const CaClientNotifierProxy *notifierProxy) + const IDataObserver *observer) { qDebug() << "CaClientProxy::registerNotifier notifierType:" << notifierType; @@ -123,7 +71,7 @@ } if (!error) { error = session->RegisterNotifier(innerNotifierFilter, - notifierFilter, notifierProxy); + notifierFilter, observer); } } @@ -164,6 +112,16 @@ //---------------------------------------------------------------------------- // //---------------------------------------------------------------------------- +void CaClientNotifierProxy::connectSessions() +{ + for (int i = 0; i < mSessions.Count(); i++) { + TRAP_IGNORE(mSessions[i].ConnectAllL()); + } +} + +//---------------------------------------------------------------------------- +// +//---------------------------------------------------------------------------- RCaClientNotifierSession *CaClientNotifierProxy::findSession() { RCaClientNotifierSession *session(NULL); diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/caclient/s60/src/caclientnotifiersession.cpp --- a/contentstorage/caclient/s60/src/caclientnotifiersession.cpp Mon May 03 12:48:45 2010 +0300 +++ b/contentstorage/caclient/s60/src/caclientnotifiersession.cpp Fri May 14 16:10:06 2010 +0300 @@ -102,10 +102,27 @@ // // ----------------------------------------------------------------------------- // +void RCaClientNotifierSession::ConnectAllL() +{ + if( !CreateSession(KCaSrvName, Version(), KDefaultMessageSlots) ) + { + RHashMap::TIter iter(iSubsessions); + while(iter.NextValue()) + { + (*iter.CurrentValue())->CreateL(); + } + } +} + +// ----------------------------------------------------------------------------- +// +// +// ----------------------------------------------------------------------------- +// TInt RCaClientNotifierSession::RegisterNotifier( CCaInnerNotifierFilter* innerNotifierFilter, const TAny* notifierFilter, - const CaClientNotifierProxy* notifierProxy) + const IDataObserver* notifierProxy) { TRAPD(error, RegisterNotifierL(innerNotifierFilter, notifierFilter, @@ -121,7 +138,7 @@ void RCaClientNotifierSession::RegisterNotifierL( CCaInnerNotifierFilter* innerNotifierFilter, const TAny* notifierFilter, - const CaClientNotifierProxy *notifierProxy) + const IDataObserver *notifierProxy) { RCaClientSubSession* subsession = new RCaClientSubSession(this, notifierProxy, innerNotifierFilter); diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/caclient/s60/src/caclientsubsession.cpp --- a/contentstorage/caclient/s60/src/caclientsubsession.cpp Mon May 03 12:48:45 2010 +0300 +++ b/contentstorage/caclient/s60/src/caclientsubsession.cpp Fri May 14 16:10:06 2010 +0300 @@ -22,7 +22,7 @@ #include "casrvdef.h" #include "cainnerentry.h" #include "caclientproxy.h" -#include "caclientnotifierproxy.h" +#include "caobserver.h" #include "cautils.h" // ----------------------------------------------------------------------------- @@ -34,7 +34,8 @@ const CCaInnerNotifierFilter *aInnerNotifierFilter ) : RSubSessionBase(), iSession( aSession ), iObserver( aObserver ), iInnerNotifierFilter( aInnerNotifierFilter ), - iNotifier( NULL ), iMessageSize( NULL ) + iNotifier( NULL ), iMessageSize( NULL ), iChangedEntry( NULL ), + iChangedEntryType( EAddChangeType ) { } @@ -44,10 +45,21 @@ // ----------------------------------------------------------------------------- void RCaClientSubSession::CreateL() { + if( iNotifier ) + { + delete iNotifier; + iNotifier = NULL; + } + if( iMessageSize ) + { + delete iMessageSize; + iMessageSize = NULL; + } iMessageSize = new ( ELeave ) TPckgBuf (); User::LeaveIfError( CreateSubSession( *iSession, static_cast( EContentArsenalNotifierOpen ) ) ); iNotifier = CCaClientNotifier::NewL( this ); + iChangedEntry = CCaInnerEntry::NewL(); } // ----------------------------------------------------------------------------- @@ -55,6 +67,8 @@ // ----------------------------------------------------------------------------- void RCaClientSubSession::Close() { + delete iChangedEntry; + iChangedEntry = NULL; delete iMessageSize; iMessageSize = NULL; delete iNotifier; @@ -88,30 +102,28 @@ // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- -void RCaClientSubSession::NotifyObserver( - CCaInnerEntry* aEntry, - TChangeType aChangeType ) const +void RCaClientSubSession::NotifyObserver() const { switch( iInnerNotifierFilter->GetNotifierType() ) { case CCaInnerNotifierFilter::EEntryChangedWithId: { - iObserver->entryChanged( aEntry->GetId(), aChangeType ); + iObserver->entryChanged( iChangedEntry->GetId(), iChangedEntryType ); break; } case CCaInnerNotifierFilter::EEntryChangedWithEntry: { - iObserver->entryChanged( *aEntry, aChangeType ); + iObserver->entryChanged( *iChangedEntry, iChangedEntryType ); break; } case CCaInnerNotifierFilter::EEntryTouched: { - iObserver->entryTouched( aEntry->GetId() ); + iObserver->entryTouched( iChangedEntry->GetId() ); break; } case CCaInnerNotifierFilter::EGroupContentChanged: { - iObserver->groupContentChanged( aEntry->GetId() ); + iObserver->groupContentChanged( iChangedEntry->GetId() ); break; } default: @@ -124,7 +136,7 @@ // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- -void RCaClientSubSession::GetChangeInfoAndNotifyObserverL() const +void RCaClientSubSession::GetChangeInfoL() const { TIpcArgs args; RBuf8 outbuf; @@ -137,14 +149,11 @@ EContentArsenalGetChangeInfo, args ); if( error == KErrNone ) { - CCaInnerEntry* entry = CCaInnerEntry::NewLC(); RDesReadStream stream( outbuf ); CleanupClosePushL( stream ); - entry->InternalizeL( stream ); + iChangedEntry->InternalizeL( stream ); CleanupStack::PopAndDestroy( &stream ); - TChangeType changeType = changeTypePckg(); - NotifyObserver( entry, changeType ); - CleanupStack::PopAndDestroy( entry ); + iChangedEntryType = changeTypePckg(); } CleanupStack::PopAndDestroy( &outbuf ); } diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/caclient/s60/src/camenuiconmifutility.cpp --- a/contentstorage/caclient/s60/src/camenuiconmifutility.cpp Mon May 03 12:48:45 2010 +0300 +++ b/contentstorage/caclient/s60/src/camenuiconmifutility.cpp Fri May 14 16:10:06 2010 +0300 @@ -31,28 +31,25 @@ { CFbsBitmap *bitamp(0); CFbsBitmap *mask(0); - - if ( AknIconUtils::IsMifFile(fileName)) { - // SVG icon - // SVG always has only one icon - TInt bitmapIndex = 0; - TInt maskIndex = 1; - AknIconUtils::ValidateLogicalAppIconId( fileName, - bitmapIndex, maskIndex ); - AknIconUtils::CreateIconLC( bitamp, mask, fileName, + TInt bitmapIndex = 0; + TInt maskIndex = 1; + // it will change bitmap ids if it is mif (checking inside) + AknIconUtils::ValidateLogicalAppIconId( fileName, bitmapIndex, maskIndex ); - } + AknIconUtils::CreateIconLC( bitamp, mask, fileName, + bitmapIndex, maskIndex ); - AknIconUtils::DisableCompression(bitamp); - AknIconUtils::SetSize(bitamp, TSize(size.width(), size.height()), - EAspectRatioPreservedAndUnusedSpaceRemoved); + if (AknIconUtils::IsMifFile(fileName)) { + AknIconUtils::DisableCompression(bitamp); + AknIconUtils::SetSize(bitamp, TSize(size.width(), size.height()), + EAspectRatioPreservedAndUnusedSpaceRemoved); - AknIconUtils::DisableCompression(mask); - AknIconUtils::SetSize(mask, TSize(size.width(), size.height()), - EAspectRatioPreservedAndUnusedSpaceRemoved); - - CaBitmapAdapter::fromBitmapAndMaskToPixmapL(bitamp, mask, pixmap); + CaBitmapAdapter::fromBitmapAndMaskToPixmapL(bitamp, mask, pixmap); + } else { + CaBitmapAdapter::fromBitmapAndMaskToPixmapL(bitamp, mask, pixmap); + pixmap.scaled(size); + } // bitmap and icon, AknsUtils::CreateIconLC doesn't specify the order CleanupStack::Pop(2); diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/caclient/s60/src/camenuiconutility.cpp --- a/contentstorage/caclient/s60/src/camenuiconutility.cpp Mon May 03 12:48:45 2010 +0300 +++ b/contentstorage/caclient/s60/src/camenuiconutility.cpp Fri May 14 16:10:06 2010 +0300 @@ -122,13 +122,15 @@ if (err2 == KErrNone) { QString fileName = XQConversions::s60DescToQString( fileNameFromApparc->Des()); - if (fileName.contains(QString(".mif"))) { + if (fileName.contains(QString(".mif")) || fileName.contains(QString(".mbm"))) { TPtr ptr(fileNameFromApparc->Des()); CaMenuIconMifUtility::GetPixmapByFilenameL(ptr,size,pixmap); pixmap = pixmap.scaled(size, Qt::KeepAspectRatioByExpanding); icon = HbIcon(QIcon(pixmap)); + } else { + icon = HbIcon(fileName); } } CleanupStack::Pop(fileNameFromApparc); diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/caclient/s60/src/caobjectadapter.cpp --- a/contentstorage/caclient/s60/src/caobjectadapter.cpp Mon May 03 12:48:45 2010 +0300 +++ b/contentstorage/caclient/s60/src/caobjectadapter.cpp Fri May 14 16:10:06 2010 +0300 @@ -287,6 +287,9 @@ case KErrArgument: error = BadArgumentErrorCode; break; + case KErrServerTerminated: + error = ServerTerminated; + break; default: error = UnknownErrorCode; break; diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/caclient/s60/src/caobserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentstorage/caclient/s60/src/caobserver.cpp Fri May 14 16:10:06 2010 +0300 @@ -0,0 +1,90 @@ +/* + * 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: + * + */ + +#include +#include "caobserver.h" +#include "caobjectadapter.h" +#include "cainnerentry.h" + +//---------------------------------------------------------------------------- +// +//---------------------------------------------------------------------------- +CaObserver::CaObserver(QObject *parent) : + QObject(parent) +{ +} +//---------------------------------------------------------------------------- +// +//---------------------------------------------------------------------------- +CaObserver::~CaObserver() +{ +} + +//---------------------------------------------------------------------------- +// +//---------------------------------------------------------------------------- +void CaObserver::entryChanged(TInt entryId, + TChangeType changeType) const +{ + qDebug() << "CaClientProxy::entryChanged entryId:" + << entryId << "changeType:" << changeType; + + int entryChangedId(entryId); + ChangeType entryChangeType(AddChangeType); + CaObjectAdapter::convert(changeType, entryChangeType); + + emit signalEntryChanged(entryChangedId, entryChangeType); +} + +//---------------------------------------------------------------------------- +// +//---------------------------------------------------------------------------- +void CaObserver::entryChanged(const CCaInnerEntry &entry, + TChangeType changeType) const +{ + qDebug() << "CaClientProxy::entryChanged changeType:" << changeType; + + CaEntry *caEntry = new CaEntry(static_cast(entry.GetRole())); + ChangeType entryChangeType(AddChangeType); + CaObjectAdapter::convert(entry, *caEntry); + CaObjectAdapter::convert(changeType, entryChangeType); + + + emit signalEntryChanged(*caEntry, entryChangeType); +} + +//---------------------------------------------------------------------------- +// +//---------------------------------------------------------------------------- +void CaObserver::entryTouched(TInt id) const +{ + qDebug() << "CaClientProxy::entryTouched id:" << id; + emit signalEntryTouched(id); +} + +//---------------------------------------------------------------------------- +// +//---------------------------------------------------------------------------- +void CaObserver::groupContentChanged(TInt groupId) const +{ + qDebug() << "CaClientProxy::groupContentChanged groupId:" << groupId; + + int groupChangedId(groupId); + + emit signalGroupContentChanged(groupChangedId); +} + diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/caclient/src/caentry.cpp --- a/contentstorage/caclient/src/caentry.cpp Mon May 03 12:48:45 2010 +0300 +++ b/contentstorage/caclient/src/caentry.cpp Fri May 14 16:10:06 2010 +0300 @@ -30,38 +30,44 @@ // ======== MEMBER FUNCTIONS ======== /*! - * \class CaEntry - * - * \brief This abstract class describes particular entry. - * - * To create instance of CaEntry object, you have to use service's object's - * createEntry() method. - * - * \example - * \code - * QSharedPointer service = CaService::instance(); - * // default you create item (ItemEntryRole) - * CaEntry entry; - * // to create CaEntry invoking setText() and setEntryTypeName() methods - * is obligatoried - * entry.setText("Text"); - * entry.setEntryTypeName("TypeName"); - * CaEntry * resultEntry = service->createEntry(entry); - * ... - * delete resultEntry; - * ... - * - * // if you want create group, you should use entry role parametr - * CaEntry entryGroup(GroupEntryRole); - * ... - * resultEntry = service->createEntry(entryGroup); - * - * \endcode + \class CaEntry + \brief This abstract class describes particular entry. + To create instance of CaEntry object, you have to use service's object's + createEntry() method. + \example + \code + QSharedPointer service = CaService::instance(); + // default you create item (ItemEntryRole) + CaEntry entry; + // to create CaEntry invoking setText() and setEntryTypeName() methods + is obligatoried + entry.setText("Text"); + entry.setEntryTypeName("TypeName"); + CaEntry * resultEntry = service->createEntry(entry); + ... + delete resultEntry; + ... + // if you want create group, you should use entry role parametr + CaEntry entryGroup(GroupEntryRole); + ... + resultEntry = service->createEntry(entryGroup); + \endcode */ /*! - * Constructor. - * \param entryRole entry's role. + \var CaEntryPrivate::m_q + Points to the CaEntry instance that uses + this private implementation. + */ + +/*! + \var CaEntryPrivate::mId + Id. + */ + +/*! + Constructor. + \param entryRole entry's role. */ CaEntry::CaEntry(EntryRole entryRole) : m_d(new CaEntryPrivate(this)) @@ -70,13 +76,12 @@ } /*! - * Copy constructor. - * \param entry const reference to CaEntry. - * - * \code - * ... - * CaEntry * copyEntry( *resultEntry ); - * \endcode + Copy constructor. + \param entry const reference to CaEntry. + \code + ... + CaEntry * copyEntry( *resultEntry ); + \endcode */ CaEntry::CaEntry(const CaEntry &entry) : m_d(new CaEntryPrivate(this)) diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/caclient/src/caiconcache.cpp --- a/contentstorage/caclient/src/caiconcache.cpp Mon May 03 12:48:45 2010 +0300 +++ b/contentstorage/caclient/src/caiconcache.cpp Fri May 14 16:10:06 2010 +0300 @@ -29,13 +29,25 @@ QSharedPointer CaIconCache::mInstance(0); /*! - * \class CaIconCache - * - * \brief This class provides icon caching mechanism - * - * Class implements singleton design patern. Use cache() method - * to get an instance of CaIconCache - * + \class CaIconCache + \brief This class provides icon caching mechanism + Class implements singleton design patern. Use cache() method + to get an instance of CaIconCache + */ + +/*! + \var CaIconCache::mCache + Own. + */ + +/*! + \var CaIconCache::mService + Not own. + */ + +/*! + \var CaIconCache::mNotifier + Own. */ /*! diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/caclient/src/caicondescription.cpp --- a/contentstorage/caclient/src/caicondescription.cpp Mon May 03 12:48:45 2010 +0300 +++ b/contentstorage/caclient/src/caicondescription.cpp Fri May 14 16:10:06 2010 +0300 @@ -59,6 +59,16 @@ */ /*! + \var CaIconDescriptionPrivate::m_q + Points to the CaEntry instance that uses this private implementation. + */ + +/*! + \var CaIconDescriptionPrivate::mId + Id. + */ + +/*! Default constructor. */ CaIconDescription::CaIconDescription() : diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/caclient/src/canotifier.cpp --- a/contentstorage/caclient/src/canotifier.cpp Mon May 03 12:48:45 2010 +0300 +++ b/contentstorage/caclient/src/canotifier.cpp Fri May 14 16:10:06 2010 +0300 @@ -19,6 +19,7 @@ #include "canotifier_p.h" #include "canotifierfilter.h" #include "caclientnotifierproxy.h" +#include "caobserver.h" /*! \class CaNotifier. @@ -89,6 +90,22 @@ */ /*! + \var CaNotifierPrivate::m_q + Points to the CaNotifier instance that uses + this private implementation. + */ + +/*! + \var CaNotifierPrivate::mNotifierFilter + Own. + */ + +/*! + \var CaNotifierPrivate::mNotifierProxy + Not own. + */ + +/*! Constructor. \param entryPrivate pointer to private implementation. */ @@ -104,7 +121,14 @@ */ CaNotifier::~CaNotifier() { - m_d->makeDisconnect(); + m_d->unregisterNotifier( + CaNotifierPrivate::EntryChangedWithIdNotifierType); + m_d->unregisterNotifier( + CaNotifierPrivate::EntryChangedWithEntryNotifierType); + m_d->unregisterNotifier( + CaNotifierPrivate::EntryTouchedNotifierType); + m_d->unregisterNotifier( + CaNotifierPrivate::GroupContentChangedNotifierType); delete m_d; } @@ -193,11 +217,13 @@ \param notifierFilter descrbies entries to observe. */ CaNotifierPrivate::CaNotifierPrivate( - const CaNotifierFilter ¬ifierFilter) : + const CaNotifierFilter ¬ifierFilter, + CaClientNotifierProxy *notifierProxy) : m_q(NULL), - mNotifierFilter(NULL), - mNotifierProxy(NULL) + mNotifierFilter(NULL), + mObserver(NULL) { + mNotifierProxy = notifierProxy; mNotifierFilter = new CaNotifierFilter(notifierFilter); } @@ -217,7 +243,6 @@ GroupContentChangedNotifierType); } delete mNotifierFilter; - delete mNotifierProxy; } /*! Registers notifier @@ -229,7 +254,7 @@ return mNotifierProxy->registerNotifier( mNotifierFilter, notifierType, - mNotifierProxy); + mObserver); } return 0; } @@ -251,48 +276,23 @@ void CaNotifierPrivate::makeConnect() { if (m_q) { - if (!mNotifierProxy) { - mNotifierProxy = new CaClientNotifierProxy(); - } - m_q->connect(mNotifierProxy, + mObserver = new CaObserver(); + m_q->connect(mObserver, SIGNAL(signalEntryChanged(int,ChangeType)), m_q, SIGNAL(entryChanged(int,ChangeType))); - m_q->connect(mNotifierProxy, + m_q->connect(mObserver, SIGNAL(signalEntryChanged(const CaEntry &,ChangeType)), m_q, SIGNAL(entryChanged(const CaEntry &,ChangeType))); - m_q->connect(mNotifierProxy, + m_q->connect(mObserver, SIGNAL(signalEntryTouched(int)), m_q, SIGNAL(entryTouched(int))); - m_q->connect(mNotifierProxy, + m_q->connect(mObserver, SIGNAL(signalGroupContentChanged(int)), m_q, SIGNAL(groupContentChanged(int))); } } -/*! - Disconnects this Notifier - */ -void CaNotifierPrivate::makeDisconnect() -{ - if (m_q && mNotifierProxy) { - m_q->disconnect(mNotifierProxy, - SIGNAL(signalEntryChanged(int,ChangeType)), - m_q, - SIGNAL(entryChanged(int,ChangeType))); - m_q->disconnect(mNotifierProxy, - SIGNAL(signalEntryChanged(const CaEntry &,ChangeType)), - m_q, - SIGNAL(entryChanged(const CaEntry &,ChangeType))); - m_q->disconnect(mNotifierProxy, - SIGNAL(signalEntryTouched(int)), - m_q, - SIGNAL(entryTouched(int))); - m_q->disconnect(mNotifierProxy, - SIGNAL(signalGroupContentChanged(int)), - m_q, - SIGNAL(groupContentChanged(int))); - } -} + diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/caclient/src/canotifierfilter.cpp --- a/contentstorage/caclient/src/canotifierfilter.cpp Mon May 03 12:48:45 2010 +0300 +++ b/contentstorage/caclient/src/canotifierfilter.cpp Fri May 14 16:10:06 2010 +0300 @@ -20,6 +20,12 @@ #include "caquery.h" /*! + \var CaNotifierFilterPrivate::m_q + Points to the CaNotifierFilter instance that uses + this private implementation. + */ + +/*! Constructor. \param pointer to CaNotifierFilter - public notifier implementation class. */ diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/caclient/src/caquery.cpp --- a/contentstorage/caclient/src/caquery.cpp Mon May 03 12:48:45 2010 +0300 +++ b/contentstorage/caclient/src/caquery.cpp Fri May 14 16:10:06 2010 +0300 @@ -54,6 +54,11 @@ */ /*! + \var CaQueryPrivate::m_q + Points to the CaQuery instance that uses this private implementation. + */ + +/*! Default constructor. */ CaQuery::CaQuery() : diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/caclient/src/caservice.cpp --- a/contentstorage/caclient/src/caservice.cpp Mon May 03 12:48:45 2010 +0300 +++ b/contentstorage/caclient/src/caservice.cpp Fri May 14 16:10:06 2010 +0300 @@ -29,6 +29,7 @@ #include "cadefs.h" #include "caclientproxy.h" +#include "caclientnotifierproxy.h" #include "caobjectadapter.h" #include "caclienttest_global.h" @@ -53,6 +54,26 @@ */ +/*! + \var CaServicePrivate::m_q + Points to the CaService instance that uses this private implementation. + */ + +/*! + \var CaServicePrivate::mProxy + Proxy to communicate with Symbian server. + */ + +/*! + \var CaServicePrivate::mErrorCode + code of error caused by last operation. + */ + +/*! + \var CaServicePrivate::mNotifierProxy + Proxy to client notifier. + */ + // Initialization of a static member variable. QWeakPointer CaService::m_instance = QWeakPointer(); /*! @@ -574,22 +595,6 @@ } /*! - Performs touch operation on entry. - \param entry to be touched - \retval boolean with result of operation - */ -bool CaServicePrivate::touch(const CaEntry &entry) -{ - qDebug() << "CaServicePrivate::touch" << "entryId: " << entry.id(); - - mErrorCode = mProxy->touch(entry); - - qDebug() << "CaServicePrivate::touch mErrorCode:" << mErrorCode; - - return (mErrorCode == NoErrorCode); -} - -/*! Place entries in a given group at the end. \param groupId id of a group. \param entryId id of entry to append. @@ -933,7 +938,8 @@ \param servicePublic pointer to public service */ CaServicePrivate::CaServicePrivate(CaService *servicePublic) : - m_q(servicePublic), mProxy(new CaClientProxy) + m_q(servicePublic), mProxy(new CaClientProxy), + mNotifierProxy(NULL) { const ErrorCode connectionResult = mProxy->connect(); @@ -949,6 +955,7 @@ CaServicePrivate::~CaServicePrivate() { delete mProxy; + delete mNotifierProxy; } /*! @@ -972,6 +979,15 @@ if (mErrorCode == NoErrorCode && entryIdList.count() != resultList.count()) { mErrorCode = NotFoundErrorCode; + }//one line with else if + else if (mErrorCode == ServerTerminated) { + if (!mProxy->connect()) { + if (mNotifierProxy) { + mNotifierProxy->connectSessions(); + } + resultList.clear(); + mErrorCode = mProxy->getData(entryIdList, resultList); + } } CACLIENTTEST_FUNC_EXIT("CaServicePrivate::getEntries"); @@ -991,7 +1007,15 @@ QList< QSharedPointer > resultList; mErrorCode = mProxy->getData(query, resultList); - + if (mErrorCode == ServerTerminated) { + if (!mProxy->connect()) { + if (mNotifierProxy) { + mNotifierProxy->connectSessions(); + } + resultList.clear(); + mErrorCode = mProxy->getData(query, resultList); + } + } qDebug() << "CaServicePrivate::getEntries mErrorCode:" << mErrorCode; return resultList; @@ -1008,6 +1032,15 @@ QList resultList; mErrorCode = mProxy->getEntryIds(query, resultList); + if (mErrorCode == ServerTerminated) { + if (!mProxy->connect()) { + if (mNotifierProxy) { + mNotifierProxy->connectSessions(); + } + resultList.clear(); + mErrorCode = mProxy->getEntryIds(query, resultList); + } + } CACLIENTTEST_FUNC_EXIT("CaItemModelList::getEntryIds"); qDebug() << "CaServicePrivate::getEntryIds mErrorCode:" << mErrorCode; return resultList; @@ -1035,6 +1068,15 @@ addDataResult = mProxy->addData(*entryClone, *newEntry); + if (addDataResult == ServerTerminated) { + if (!mProxy->connect()) { + if (mNotifierProxy) { + mNotifierProxy->connectSessions(); + } + addDataResult = + mProxy->addData(*entryClone, *newEntry); + } + } // return empty pointer if nothing was added if (addDataResult != NoErrorCode) { @@ -1051,6 +1093,30 @@ } /*! + Performs touch operation on entry. + \param entry to be touched + \retval boolean with result of operation + */ +bool CaServicePrivate::touch(const CaEntry &entry) +{ + qDebug() << "CaServicePrivate::touch" << "entryId: " << entry.id(); + + mErrorCode = mProxy->touch(entry); + if (mErrorCode == ServerTerminated) { + if (!mProxy->connect()) { + if (mNotifierProxy) { + mNotifierProxy->connectSessions(); + } + mErrorCode = mProxy->touch(entry); + } + } + + qDebug() << "CaServicePrivate::touch mErrorCode:" << mErrorCode; + + return (mErrorCode == NoErrorCode); +} + +/*! Update entry. \param entry entry const reference of entry to update \retval true if operation was successful @@ -1069,6 +1135,14 @@ QScopedPointer updatedEntry(new CaEntry(entry.role())); updateEntryResult = mProxy->addData(entry, *updatedEntry); + if (updateEntryResult == ServerTerminated) { + if (!mProxy->connect()) { + if (mNotifierProxy) { + mNotifierProxy->connectSessions(); + } + updateEntryResult = mProxy->addData(entry, *updatedEntry); + } + } } catch (const std::bad_alloc &) { updateEntryResult = OutOfMemoryErrorCode; @@ -1097,6 +1171,14 @@ CACLIENTTEST_FUNC_ENTRY("CaServicePrivate::removeEntries"); mErrorCode = mProxy->removeData(entryIdList); + if (mErrorCode == ServerTerminated) { + if (!mProxy->connect()) { + if (mNotifierProxy) { + mNotifierProxy->connectSessions(); + } + mErrorCode = mProxy->removeData(entryIdList); + } + } qDebug() << "CaServicePrivate::removeEntries mErrorCode:" << mErrorCode; @@ -1123,8 +1205,17 @@ CACLIENTTEST_FUNC_ENTRY("CaServicePrivate::insertEntriesIntoGroup"); - mErrorCode = mProxy->insertEntriesIntoGroup(groupId, entryIdList, beforeEntryId); - + mErrorCode = mProxy->insertEntriesIntoGroup(groupId, + entryIdList, beforeEntryId); + if (mErrorCode == ServerTerminated) { + if (!mProxy->connect()) { + if (mNotifierProxy) { + mNotifierProxy->connectSessions(); + } + mErrorCode = mProxy->insertEntriesIntoGroup(groupId, + entryIdList, beforeEntryId); + } + } qDebug() << "CaServicePrivate::insertEntriesIntoGroup mErrorCode:" << mErrorCode; @@ -1150,6 +1241,14 @@ CACLIENTTEST_FUNC_ENTRY("CaServicePrivate::removeEntriesFromGroup"); mErrorCode = mProxy->removeEntriesFromGroup(groupId, entryIdList); + if (mErrorCode == ServerTerminated) { + if (!mProxy->connect()) { + if (mNotifierProxy) { + mNotifierProxy->connectSessions(); + } + mErrorCode = mProxy->removeEntriesFromGroup(groupId, entryIdList); + } + } qDebug() << "CaServicePrivate::removeEntriesFromGroup mErrorCode:" << mErrorCode; @@ -1250,7 +1349,10 @@ */ CaNotifier *CaServicePrivate::createNotifier(const CaNotifierFilter &filter) { - return new CaNotifier(new CaNotifierPrivate(filter)); + if (!mNotifierProxy) { + mNotifierProxy = new CaClientNotifierProxy(); + } + return new CaNotifier(new CaNotifierPrivate(filter, mNotifierProxy)); } /*! @@ -1265,7 +1367,14 @@ CACLIENTTEST_FUNC_ENTRY("CaServicePrivate::customSort"); mErrorCode = mProxy->customSort(entryIdList, groupId); - + if (mErrorCode == ServerTerminated) { + if (!mProxy->connect()) { + if (mNotifierProxy) { + mNotifierProxy->connectSessions(); + } + mErrorCode = mProxy->customSort(entryIdList, groupId); + } + } CACLIENTTEST_FUNC_EXIT("CaServicePrivate::customSort"); return (mErrorCode == NoErrorCode); diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/caclient/stub/inc/caclientnotifierproxy.h --- a/contentstorage/caclient/stub/inc/caclientnotifierproxy.h Mon May 03 12:48:45 2010 +0300 +++ b/contentstorage/caclient/stub/inc/caclientnotifierproxy.h Fri May 14 16:10:06 2010 +0300 @@ -27,42 +27,9 @@ class CaEntry; class CaNotifierFilter; - -/** - * IDataObserver - * - */ -class IDataObserver -{ -public: - /** - * Method invoked when entry is changed. - * @param entryId entry id. - * @param changeType change type. - */ - virtual void entryChanged(int entryId, - ChangeType changeType) const = 0; +class CaObserver; - /** - * Method invoked when entry is changed. - * @param entry entry. - * @param changeType change type. - */ - virtual void entryChanged(const CaEntry &entry, - ChangeType changeType) const = 0; - /** - * Method invoked when entry was changed. - * @param entryId entry id. - */ - virtual void entryTouched(int id) const = 0; - - /** - * Method invoked when entry was changed. - * @param groupId group id. - */ - virtual void groupContentChanged(int groupId) const = 0; -}; class CACLIENT_EXPORT CaClientNotifierProxy: public QObject @@ -83,33 +50,6 @@ ~CaClientNotifierProxy(); /** - * Method invoked when entry is changed. - * @param entryId entry id. - * @param changeType change type. - */ - virtual void entryChanged(int entryId, ChangeType changeType) const; - - /** - * Method invoked when entry is changed. - * @param entry entry. - * @param changeType change type. - */ - virtual void entryChanged(const CaEntry &entry, - ChangeType changeType) const; - - /** - * Method invoked when entry was changed. - * @param entryId entry id. - */ - virtual void entryTouched(int id) const; - - /** - * Method invoked when entry was changed. - * @param groupId group id. - */ - virtual void groupContentChanged(int groupId) const; - - /** * Method for registering notifier * * @param notifierFilter notifierFilter used to register notifier. @@ -119,7 +59,7 @@ int registerNotifier( const CaNotifierFilter *notifierFilter, CaNotifierPrivate::NotifierType notifierType, - const CaClientNotifierProxy *notifierProxy); + const CaObserver *observer); /** * Method for unregistering notifier. @@ -131,19 +71,15 @@ const CaNotifierFilter ¬ifierFilter, CaNotifierPrivate::NotifierType notifierType); -signals: - void signalEntryChanged(int entryId, ChangeType changeType) const; - void signalEntryChanged(const CaEntry &entry, - ChangeType changeType) const; - void signalEntryTouched(int id) const; - void signalGroupContentChanged(int groupId) const; + /** + * Reconnect all sessions when server was terminated + * + */ + void connectSessions(); private: - // Mutex to serialize registering/unregistering for notifications. - QMutex mMutex; - Q_DISABLE_COPY(CaClientNotifierProxy) }; diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/caclient/stub/inc/canotifiers.h --- a/contentstorage/caclient/stub/inc/canotifiers.h Mon May 03 12:48:45 2010 +0300 +++ b/contentstorage/caclient/stub/inc/canotifiers.h Fri May 14 16:10:06 2010 +0300 @@ -24,14 +24,14 @@ #include "canotifier_p.h" class CaNotifierFilter; -class CaClientNotifierProxy; +class CaObserver; class CaNotifiers { public: static int addNotifier(const CaNotifierFilter *notifierFilter, CaNotifierPrivate::NotifierType notifierType, - const CaClientNotifierProxy *notifierProxy); + const CaObserver *notifierProxy); static void removeNotifier(const CaNotifierFilter *notifierFilter, CaNotifierPrivate::NotifierType notifierType); @@ -53,7 +53,7 @@ private: typedef QPair NotifierKey; - typedef QHash NotifierHash; + typedef QHash NotifierHash; private: static NotifierHash mNotifiers; diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/caclient/stub/inc/caobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentstorage/caclient/stub/inc/caobserver.h Fri May 14 16:10:06 2010 +0300 @@ -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 : Content Arsenal client session + * + */ + +#ifndef CAOBSERVER_H_ +#define CAOBSERVER_H_ + +#include +#include + +#include "cadefs.h" + + +class CaEntry; + + +class CaObserver: public QObject +{ + Q_OBJECT +public: + /** + * Constructor. + * @param parent pointer to parent. Defaults to NULL. + */ + CaObserver(QObject *parent = 0); + + /** + * Destructor. + */ + ~CaObserver(); + + /** + * Method invoked when entry is changed. + * @param entryId entry id. + * @param changeType change type. + */ + void entryChanged(int entryId, + ChangeType changeType) const; + + /** + * Method invoked when entry is changed. + * @param entry entry. + * @param changeType change type. + */ + void entryChanged(const CaEntry &entry, + ChangeType changeType) const; + + /** + * Method invoked when entry was changed. + * @param entryId entry id. + */ + void entryTouched(int id) const; + + /** + * Method invoked when entry was changed. + * @param groupId group id. + */ + void groupContentChanged(int groupId) const; + +signals: + + void signalEntryChanged(int entryId, ChangeType changeType) const; + void signalEntryChanged(const CaEntry &entry, + ChangeType changeType) const; + void signalEntryTouched(int id) const; + void signalGroupContentChanged(int groupId) const; +}; + + +#endif /* CAOBSERVER_H_ */ diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/caclient/stub/inc/hswidgetcomponentdescriptor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentstorage/caclient/stub/inc/hswidgetcomponentdescriptor.h Fri May 14 16:10:06 2010 +0300 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef HSWIDGETCOMPONENTDESCRIPTION_H +#define HSWIDGETCOMPONENTDESCRIPTION_H + + +#include +#include + +class HsWidgetComponentDescriptor +{ +public: + QString installationPath; + QString uri; + QString title; + QString description; + QString iconUri; + QString hidden; + QString serviceXml; + QString version; + bool isValid(); +}; + +Q_DECLARE_METATYPE(HsWidgetComponentDescriptor) + +#endif diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/caclient/stub/inc/hswidgetcomponentparser.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentstorage/caclient/stub/inc/hswidgetcomponentparser.h Fri May 14 16:10:06 2010 +0300 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef HSWIDGETCOMPONENTPARSER_H +#define HSWIDGETCOMPONENTPARSER_H + +#include +#include +#include "hswidgetcomponentdescriptor.h" + +class HsWidgetComponentParser : public QObject +{ + Q_OBJECT + +public: + HsWidgetComponentParser(const QString &aComponentManifest, QObject *parent=0); + ~HsWidgetComponentParser(); + HsWidgetComponentDescriptor widgetComponentDescriptor(); + bool error(); +private: + void parseFile(const QString &aComponentManifest); + void parseWidgetManifestTag(); + void parseWidgetProviderTag(); + + void parseVersion1_0(); + + void parseUri(); + void parseIcon(); + void parseTitle(); + void parseDescription(); + void parseHidden(); + void parseServiceXml(); + + + bool isWidgetTagValid(); +private: + QXmlStreamReader mParser; + HsWidgetComponentDescriptor mComponentDescriptor; + bool mError; +}; + +#endif // HSWIDGETCOMPONENTPARSER_H diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/caclient/stub/src/caclientnotifierproxy.cpp --- a/contentstorage/caclient/stub/src/caclientnotifierproxy.cpp Mon May 03 12:48:45 2010 +0300 +++ b/contentstorage/caclient/stub/src/caclientnotifierproxy.cpp Fri May 14 16:10:06 2010 +0300 @@ -40,55 +40,14 @@ //---------------------------------------------------------------------------- // //---------------------------------------------------------------------------- -void CaClientNotifierProxy::entryChanged(int entryId, - ChangeType changeType) const -{ - qDebug() << "CaClientProxy::entryChanged entryId:" - << entryId << "changeType:" << changeType; - emit signalEntryChanged(entryId, changeType); -} - -//---------------------------------------------------------------------------- -// -//---------------------------------------------------------------------------- -void CaClientNotifierProxy::entryChanged(const CaEntry &entry, - ChangeType changeType) const -{ - qDebug() << "CaClientProxy::entryChanged changeType:" << changeType; - CaEntry *caEntry = new CaEntry(entry); - emit signalEntryChanged(*caEntry, changeType); -} - -//---------------------------------------------------------------------------- -// -//---------------------------------------------------------------------------- -void CaClientNotifierProxy::entryTouched(int id) const -{ - qDebug() << "CaClientProxy::entryTouched id:" << id; - emit signalEntryTouched(id); -} - -//---------------------------------------------------------------------------- -// -//---------------------------------------------------------------------------- -void CaClientNotifierProxy::groupContentChanged(int groupId) const -{ - qDebug() << "CaClientProxy::groupContentChanged groupId:" << groupId; - emit signalGroupContentChanged(groupId); -} - -//---------------------------------------------------------------------------- -// -//---------------------------------------------------------------------------- int CaClientNotifierProxy::registerNotifier( const CaNotifierFilter *notifierFilter, CaNotifierPrivate::NotifierType notifierType, - const CaClientNotifierProxy *notifierProxy) + const CaObserver *observer) { qDebug() << "CaClientProxy::registerNotifier notifierType:" << notifierType; - QMutexLocker locker(&mMutex); - return CaNotifiers::addNotifier(notifierFilter, notifierType, notifierProxy); + return CaNotifiers::addNotifier(notifierFilter, notifierType, observer); } //---------------------------------------------------------------------------- @@ -100,7 +59,16 @@ { qDebug() << "CaClientProxy::unregisterNotifier notifierType:" << notifierType; - QMutexLocker locker(&mMutex); CaNotifiers::removeNotifier(¬ifierFilter, notifierType); } + +//---------------------------------------------------------------------------- +// +//---------------------------------------------------------------------------- +void CaClientNotifierProxy::connectSessions() +{ + qDebug() << "Nothing to do on windows"; +} + + diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/caclient/stub/src/canotifiers.cpp --- a/contentstorage/caclient/stub/src/canotifiers.cpp Mon May 03 12:48:45 2010 +0300 +++ b/contentstorage/caclient/stub/src/canotifiers.cpp Fri May 14 16:10:06 2010 +0300 @@ -19,13 +19,14 @@ #include #include "canotifiers.h" +#include "caobserver.h" #include "caclientnotifierproxy.h" CaNotifiers::NotifierHash CaNotifiers::mNotifiers; int CaNotifiers::addNotifier(const CaNotifierFilter *notifierFilter, CaNotifierPrivate::NotifierType notifierType, - const CaClientNotifierProxy *notifierProxy) + const CaObserver *notifierProxy) { NotifierKey key = NotifierKey(notifierFilter, notifierType); if (!mNotifiers.contains(key)) { diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/caclient/stub/src/caobserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentstorage/caclient/stub/src/caobserver.cpp Fri May 14 16:10:06 2010 +0300 @@ -0,0 +1,77 @@ +/* + * 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: + * + */ + +#include +#include "caobserver.h" +#include "caobjectadapter.h" +#include "caentry.h" + +//---------------------------------------------------------------------------- +// +//---------------------------------------------------------------------------- +CaObserver::CaObserver(QObject *parent) : + QObject(parent) +{ +} +//---------------------------------------------------------------------------- +// +//---------------------------------------------------------------------------- +CaObserver::~CaObserver() +{ +} + +//---------------------------------------------------------------------------- +// +//---------------------------------------------------------------------------- +void CaObserver::entryChanged(int entryId, + ChangeType changeType) const +{ + qDebug() << "CaClientProxy::entryChanged entryId:" + << entryId << "changeType:" << changeType; + emit signalEntryChanged(entryId, changeType); +} + +//---------------------------------------------------------------------------- +// +//---------------------------------------------------------------------------- +void CaObserver::entryChanged(const CaEntry &entry, + ChangeType changeType) const +{ + qDebug() << "CaClientProxy::entryChanged changeType:" << changeType; + CaEntry *caEntry = new CaEntry(entry); + emit signalEntryChanged(*caEntry, changeType); +} + +//---------------------------------------------------------------------------- +// +//---------------------------------------------------------------------------- +void CaObserver::entryTouched(int id) const +{ + qDebug() << "CaClientProxy::entryTouched id:" << id; + emit signalEntryTouched(id); +} + +//---------------------------------------------------------------------------- +// +//---------------------------------------------------------------------------- +void CaObserver::groupContentChanged(int groupId) const +{ + qDebug() << "CaClientProxy::groupContentChanged groupId:" << groupId; + + emit signalGroupContentChanged(groupId); +} + diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/caclient/stub/src/hswidgetcomponentdescriptor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentstorage/caclient/stub/src/hswidgetcomponentdescriptor.cpp Fri May 14 16:10:06 2010 +0300 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#include "hswidgetcomponentdescriptor.h" + +bool HsWidgetComponentDescriptor::isValid() +{ + bool ret(false); + if (version == "1.0") { + ret = !(uri.isEmpty() || serviceXml.isEmpty() || title.isEmpty()); + } else if (version.isEmpty()) { + ret = !(uri.isEmpty() || title.isEmpty()); + } + return ret; +} + diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/caclient/stub/src/hswidgetcomponentparser.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentstorage/caclient/stub/src/hswidgetcomponentparser.cpp Fri May 14 16:10:06 2010 +0300 @@ -0,0 +1,206 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#include "hswidgetcomponentparser.h" +#include + +const char WIDGETPROVIDER[] = "widgetprovider"; +const char WIDGET[] = "widget"; +const char WIDGETMANIFEST[] = "hswidgetmanifest"; + +const char URI[] = "uri"; +const char TITLE[] = "title"; +const char ICONURI[] = "iconuri"; +const char ICON[] = "icon"; +const char DESCRIPTION[] = "description"; +const char HIDDEN[] = "hidden"; +const char SERVICEXML[] = "servicexml"; +const char VERSION[] = "version"; +const char VERSION_1_0[] = "1.0"; + + + +HsWidgetComponentParser::HsWidgetComponentParser(const QString &aComponentManifest, QObject *parent) + : QObject(parent),mError(false) +{ + parseFile(aComponentManifest); +} + +HsWidgetComponentParser::~HsWidgetComponentParser() +{ + +} + +HsWidgetComponentDescriptor HsWidgetComponentParser::widgetComponentDescriptor() +{ + return mComponentDescriptor; +} + +bool HsWidgetComponentParser::error() +{ + return mError; +} + +void HsWidgetComponentParser::parseFile(const QString &aComponentManifest) +{ + QFile file(aComponentManifest); + if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { + mError = false; + return; + } + mParser.setDevice(&file); + if (mParser.readNextStartElement()) { + if (mParser.name() == WIDGETMANIFEST){ + parseWidgetManifestTag(); + } else if(mParser.name() == WIDGETPROVIDER){ + parseWidgetProviderTag(); + } else { + mParser.raiseError(QObject::tr("Malformed manifest")); + } + } else { + mParser.raiseError(QObject::tr("Malformed manifest")); + } + mError = mParser.error(); + +} + +void HsWidgetComponentParser::parseWidgetManifestTag() +{ + Q_ASSERT(mParser.isStartElement() && mParser.name() == WIDGETMANIFEST); + + /* Detect version */ + if (mParser.attributes().hasAttribute(VERSION)) { + QStringRef version = mParser.attributes().value(VERSION); + mComponentDescriptor.version = version.toString(); + if (version == VERSION_1_0) { + parseVersion1_0(); + } + } else { + // newest is default + parseVersion1_0(); + mComponentDescriptor.version = VERSION_1_0; + } +} + +void HsWidgetComponentParser::parseWidgetProviderTag() +{ + Q_ASSERT(mParser.isStartElement() && mParser.name() == WIDGETPROVIDER); + if (!mParser.readNextStartElement() || mParser.name() != WIDGET) { + mParser.raiseError(QObject::tr("Malformed manifest")); + return; + } + + // everything is in attributes + QXmlStreamAttributes attrs = mParser.attributes(); + foreach (QXmlStreamAttribute attr, attrs) { + QStringRef name = attr.name(); + if (name == URI) { + mComponentDescriptor.uri = attr.value().toString(); + } else if (name == ICONURI) { + mComponentDescriptor.iconUri = attr.value().toString(); + } else if (name == TITLE) { + mComponentDescriptor.title = attr.value().toString(); + } else if (name == DESCRIPTION) { + mComponentDescriptor.description = attr.value().toString(); + } else if (name == HIDDEN) { + mComponentDescriptor.hidden = attr.value().toString(); + } + } + +} +void HsWidgetComponentParser::parseVersion1_0() +{ + Q_ASSERT(mParser.isStartElement() && mParser.name() == WIDGETMANIFEST); + /* We'll parse the XML until we reach tag, end of cml or have an error. */ + while( !(mParser.tokenType() == QXmlStreamReader::EndElement && mParser.name() == WIDGETMANIFEST) && + !mParser.hasError() && !mParser.atEnd()) { + + mParser.readNext(); + if (mParser.tokenType() != QXmlStreamReader::StartElement) { + continue; + } + /* Read next start element.*/ + QStringRef tag = mParser.name(); + if(tag == URI) { + parseUri(); + } else if (tag == ICON) { + parseIcon(); + } else if (tag == TITLE) { + parseTitle(); + } else if (tag == DESCRIPTION) { + parseDescription(); + } else if (tag == HIDDEN) { + parseHidden(); + } else if (tag == SERVICEXML) { + parseServiceXml(); + } + } +} + + +void HsWidgetComponentParser::parseUri() +{ + mParser.readNext(); + if(mParser.tokenType() != QXmlStreamReader::Characters) { + return; + } + mComponentDescriptor.uri = mParser.text().toString(); +} +void HsWidgetComponentParser::parseIcon() +{ + mParser.readNext(); + if(mParser.tokenType() != QXmlStreamReader::Characters) { + return; + } + mComponentDescriptor.iconUri = mParser.text().toString(); +} +void HsWidgetComponentParser::parseTitle() +{ + mParser.readNext(); + if(mParser.tokenType() != QXmlStreamReader::Characters) { + return; + } + mComponentDescriptor.title = mParser.text().toString(); +} +void HsWidgetComponentParser::parseDescription() +{ + mParser.readNext(); + if(mParser.tokenType() != QXmlStreamReader::Characters) { + return; + } + mComponentDescriptor.description = mParser.text().toString(); +} +void HsWidgetComponentParser::parseHidden() +{ + mParser.readNext(); + if(mParser.tokenType() != QXmlStreamReader::Characters) { + return; + } + mComponentDescriptor.hidden = mParser.text().toString(); +} +void HsWidgetComponentParser::parseServiceXml() +{ + mParser.readNext(); + if(mParser.tokenType() != QXmlStreamReader::Characters) { + return; + } + mComponentDescriptor.serviceXml = mParser.text().toString(); +} + +bool HsWidgetComponentParser::isWidgetTagValid() +{ + return true; +} diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/caclient/stub/src/hswidgetregistryservice.cpp --- a/contentstorage/caclient/stub/src/hswidgetregistryservice.cpp Mon May 03 12:48:45 2010 +0300 +++ b/contentstorage/caclient/stub/src/hswidgetregistryservice.cpp Fri May 14 16:10:06 2010 +0300 @@ -21,15 +21,9 @@ #include "hswidgetregistryservice.h" #include "hswidgetregistryservice_p.h" -#include "hswidgetprovidermanifest.h" +#include "hswidgetcomponentdescriptor.h" +#include "hswidgetcomponentparser.h" -const char POSTERURI[] = "homescreen.nokia.com/widget/poster/"; -const char POSTERWIDGETNAME[] = "name"; -const char POSTERWIDGETID[] = "posterwidgetid"; -const char PUBLISHER[] = "publisher"; -const char TEMPLATETYPE[] = "templatetype"; -const char CONTENTID[] = "contentid"; -const char CONTENTTYPE[] = "contenttype"; /*! ?Qt_style_documentation @@ -161,7 +155,6 @@ const QString &manifestFilePath) { QList widgets; - HsWidgetProviderManifest manifest; QStringList filters("*.manifest"); QDir dir(manifestFilePath); QStringList manifestDir = dir.entryList(filters, QDir::Files); @@ -169,12 +162,30 @@ if (!manifestDir.isEmpty()) { // ? 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; + if (widgetDescriptor.iconUri.length() > 0 ) { + widgetToken.mIconUri = manifestFilePath + "/" + widgetDescriptor.iconUri; + } + widgetToken.mDescription = widgetDescriptor.description; + int widgetUid = dir.dirName().toUInt(0, 16); + widgetToken.mUid = widgetUid; + widgets << widgetToken; + 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(); +// manifest.loadFromXml(dir.absoluteFilePath(fileName)); +// widgets = manifest.widgets(); int widgetUid = dir.dirName().toUInt(0, 16); // ? @@ -190,6 +201,7 @@ qDebug() << "HsWidgetRegistryServicePrivate::readManifestFile - " \ "widget added: " << fileName; } +#endif } return widgets; } diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/cahandler/tapp/src/catapphandler.cpp --- a/contentstorage/cahandler/tapp/src/catapphandler.cpp Mon May 03 12:48:45 2010 +0300 +++ b/contentstorage/cahandler/tapp/src/catapphandler.cpp Fri May 14 16:10:06 2010 +0300 @@ -70,7 +70,7 @@ // e.g. QUrl url ("application://101F7AE7?"); QUrl url(QString::fromUtf16(attribute.Ptr(), attribute.Length())); - QScopedPointer request(mAiwMgr->create(url, true)); + QScopedPointer request(mAiwMgr->create(url, false)); if (!request.isNull()) { bool res = request->send(); if (!res) { diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/casrv/caappscanner/inc/casrvappscanner.h --- a/contentstorage/casrv/caappscanner/inc/casrvappscanner.h Mon May 03 12:48:45 2010 +0300 +++ b/contentstorage/casrv/caappscanner/inc/casrvappscanner.h Fri May 14 16:10:06 2010 +0300 @@ -157,7 +157,7 @@ * @result id of download collection */ TInt GetCollectionDownloadIdL(); - + /** * Gets collectionId of all collection * @result id of all collection @@ -169,7 +169,7 @@ * @param aEntryId application entry id. */ void AddEntryToDownloadedCollectionL( TInt aEntryId ); - + /** * Add application entry to predefined collection * @param aEntry application entry. @@ -177,14 +177,14 @@ */ void AddEntryToPredefinedCollectionL( CCaInnerEntry* aEntry, TBool aUpdate = EFalse ); - + /** * Create predefined collection * @param aGroupName group name. * @result id of new created collection */ TInt CreatePredefinedCollectionL( const TDesC& aGroupName ); - + /** * Add collection to all collection. * @param aCollectionId collection id to add. @@ -200,20 +200,20 @@ TBool HandleLockDeleteFlagUpdateL( CCaInnerEntry* aItem ); /** - * Updates application's missing attribute. + * Updates application's missing and visible flags. * Add new menu item referring to this application. * @param aItem menu item. - * @return ETrue if missing flag was updated + * @return ETrue if flags were updated */ - TBool HandleMissingFlagUpdate( CCaInnerEntry* aItem ); + TBool HandleMissingVisibleFlagsUpdate( CCaInnerEntry* aItem ); /** - * Updates hidden flag. + * Updates visible flag. * @param aItem menu item. * @param aUid Application's uid. - * @return ETrue if hidden flag was updated + * @return ETrue if visible flag was updated */ - TBool HandleHiddenFlagUpdateL( CCaInnerEntry* aItem ); + TBool HandleVisibleFlagUpdate( CCaInnerEntry* aItem ); /** * Updates used flag. @@ -221,7 +221,7 @@ * @param aUid Application's uid. * @return ETrue if used flag was updated */ - TBool HandleUsedFlagUpdateL( CCaInnerEntry* aItem ); + TBool HandleUsedFlagUpdate( CCaInnerEntry* aItem ); /** * Updates mmc attribute. * @param aItem menu item. @@ -328,11 +328,16 @@ void RemoveAppL( CCaInnerEntry* aAppEntry ); /** - * Adds flag objects(only one flag at time). + * Set "missing" flag. * @param aEntry entry. - * @param aFlag menu item's flag. */ - void AddObjectFlagL( CCaInnerEntry* aEntry, const TInt& aFlag ); + void SetMissingFlagL( CCaInnerEntry* aEntry ); + + /** + * Set "visible" flag. + * @param aEntry entry. + */ + void ClearVisibleFlagL( CCaInnerEntry* aEntry ); /** * Check currently inserted MMC card, update and save MMC history. @@ -410,12 +415,12 @@ * 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 diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/casrv/caappscanner/src/casrvappscanner.cpp --- a/contentstorage/casrv/caappscanner/src/casrvappscanner.cpp Mon May 03 12:48:45 2010 +0300 +++ b/contentstorage/casrv/caappscanner/src/casrvappscanner.cpp Fri May 14 16:10:06 2010 +0300 @@ -222,33 +222,38 @@ void CCaSrvAppScanner::UpdateAppEntryL( CCaInnerEntry* aEntry, TUint aMmcId ) { TBool toUpdate = HandleMmcAttrUpdateL( aEntry, aMmcId ); - toUpdate = HandleHiddenFlagUpdateL( aEntry ) || toUpdate; - toUpdate = HandleMissingFlagUpdate( aEntry ) || toUpdate; + TBool missingVisibleFlagChanged = + HandleMissingVisibleFlagsUpdate( aEntry ); + toUpdate = missingVisibleFlagChanged || toUpdate; toUpdate = HandleLockDeleteFlagUpdateL( aEntry ) || toUpdate; toUpdate = SetApaAppInfoL( aEntry ) || toUpdate; - + if( iInstalledPackages.Find( aEntry->GetUid() ) != KErrNotFound ) { AddEntryToDownloadedCollectionL( aEntry->GetId() ); - toUpdate = HandleUsedFlagUpdateL( aEntry ) || toUpdate; + toUpdate = HandleUsedFlagUpdate( aEntry ) || toUpdate; + AddEntryToPredefinedCollectionL( aEntry, ETrue ); } if( toUpdate ) { //update app in storage - iCaStorageProxy.AddL( aEntry ); + TItemAppearance itemAppearanceChange = EItemAppearanceNotChanged; + if( missingVisibleFlagChanged ) + { + itemAppearanceChange = EItemAppeared; + } + iCaStorageProxy.AddL( aEntry, EFalse, itemAppearanceChange ); RemoveFromInstalledPackages( aEntry->GetUid() ); - AddEntryToPredefinedCollectionL( aEntry, ETrue ); } } // --------------------------------------------------------- -// CCaSrvAppScanner::HandleHiddenFlagUpdateL +// // --------------------------------------------------------- // -TBool CCaSrvAppScanner::HandleHiddenFlagUpdateL( CCaInnerEntry* aItem ) +TBool CCaSrvAppScanner::HandleVisibleFlagUpdate( CCaInnerEntry* aItem ) { TBool toChange( EFalse ); - TBool itemHidden = ( 0 == ( aItem->GetFlags() & EVisible ) ); - if( itemHidden ) + if( !( aItem->GetFlags() & EVisible ) ) { aItem->SetFlags( aItem->GetFlags() | EVisible ); toChange = ETrue; @@ -257,20 +262,18 @@ } // --------------------------------------------------------- -// CCaSrvAppScanner::HandleUsedFlagUpdateL +// // --------------------------------------------------------- // -TBool CCaSrvAppScanner::HandleUsedFlagUpdateL( CCaInnerEntry* aItem ) +TBool CCaSrvAppScanner::HandleUsedFlagUpdate( CCaInnerEntry* aItem ) { + TBool changed( EFalse ); if( aItem->GetFlags() & EUsed ) { aItem->SetFlags( aItem->GetFlags() & ~EUsed ); - return ETrue; + changed = ETrue; } - else - { - return EFalse; - } + return changed; } // --------------------------------------------------------- @@ -391,18 +394,17 @@ // CCaSrvAppScanner::HandleMissingFlagUpdateL // --------------------------------------------------------- // -TBool CCaSrvAppScanner::HandleMissingFlagUpdate( CCaInnerEntry* aItem ) +TBool CCaSrvAppScanner::HandleMissingVisibleFlagsUpdate( CCaInnerEntry* aItem ) { - if( aItem->GetFlags() & EMissing ) + TBool ret( EFalse ); + if( aItem->GetFlags() & EMissing || + !( aItem->GetFlags() & EVisible ) ) { - //application found so we unset "missing" flag - aItem->SetFlags( aItem->GetFlags() & ~EMissing ); - return ETrue; + //application found so we unset "missing" and set "visible" flags + aItem->SetFlags( aItem->GetFlags() & ~EMissing | EVisible ); + ret = ETrue; } - else - { - return EFalse; - } + return ret; } // --------------------------------------------------------- @@ -449,17 +451,20 @@ appEntry, TIdentityRelation( UidMatch ) ); if ( index != KErrNotFound ) - { // hs app already in storage - ensure it is hidden and remove from resultArray - if ( ( aArray[index]->GetFlags() & EVisible ) != 0 ) + { + // hs app already in storage - ensure it is hidden + // and remove from resultArray + if ( aArray[index]->GetFlags() & EVisible ) { aArray[index]->SetFlags( aArray[index]->GetFlags() & ~EVisible); - iCaStorageProxy.AddL( aArray[index] ); + iCaStorageProxy.AddL( aArray[index], EFalse, EItemDisappeared ); } delete aArray[index]; aArray.Remove( index ); } else - { // if not found add as not visible to the storage + { + // if not found add as not visible to the storage appEntry->SetEntryTypeNameL( KCaTypeApp ); appEntry->SetFlags( 0 ); appEntry->SetRole( EItemEntryRole ); @@ -556,7 +561,7 @@ typenameArray->AppendL( KCaTypeMenuCollections ); getAllCollectionIdQuery->SetEntryTypeNames( typenameArray ); CleanupStack::Pop( typenameArray ); - + RArray idArray; CleanupClosePushL( idArray ); iCaStorageProxy.GetEntriesIdsL( getAllCollectionIdQuery, @@ -676,8 +681,8 @@ RPointerArray resultArray; CleanupResetAndDestroyPushL( resultArray ); GetCaAppEntriesL( aAppUid, resultArray ); - if( resultArray.Count() ) - { + if( resultArray.Count() && ( resultArray[0]->GetFlags() & EVisible ) ) + {//TODO: this only for icons. This functionality should be change iCaStorageProxy.AddL( resultArray[0] ); } CleanupStack::PopAndDestroy( &resultArray ); @@ -715,10 +720,10 @@ { // appgroup_name is defined for this app. Find or create folder. CCaInnerQuery *innerQuery = CCaInnerQuery::NewLC(); - innerQuery->SetRole( CCaInnerQuery::Group ); + innerQuery->SetRole( CCaInnerQuery::Group ); innerQuery->AddAttributeL( KCaAppGroupName, capability().iGroupName ); - + // get entries by attributes RPointerArray resultArrayItems; CleanupResetAndDestroyPushL( resultArrayItems ); @@ -730,10 +735,10 @@ entryIds.AppendL( entryId ); TCaOperationParams organizeParams; organizeParams.iBeforeEntryId = 0; - + if( resultArrayItems.Count() ) { - // collection with appgroup_name exist - add entry + // collection with appgroup_name exist - add entry // to this collection organizeParams.iGroupId = resultArrayItems[0]->GetId(); } @@ -742,29 +747,29 @@ // create new collection TInt predefinedCollectionId = CreatePredefinedCollectionL( capability().iGroupName ); - + organizeParams.iGroupId = predefinedCollectionId; - // add new collection to all collection + // add new collection to all collection AddCollectionToAllCollectionL( predefinedCollectionId ); - + if( aUpdate ) { organizeParams.iOperationType = TCaOperationParams::EAppend; iCaStorageProxy.OrganizeL( entryIds, organizeParams ); } } - + if( !aUpdate ) { organizeParams.iOperationType = TCaOperationParams::EAppend; iCaStorageProxy.OrganizeL( entryIds, organizeParams ); } - + CleanupStack::PopAndDestroy( &entryIds ); CleanupStack::PopAndDestroy( &resultArrayItems ); CleanupStack::PopAndDestroy( innerQuery ); - } + } } // --------------------------------------------------------- @@ -787,7 +792,7 @@ // Get new collection Id TInt newCollectionId = innerEntry->GetId(); CleanupStack::PopAndDestroy( innerEntry ); - + return newCollectionId; } @@ -800,7 +805,7 @@ RArray entryIds; CleanupClosePushL( entryIds ); entryIds.AppendL( aCollectionId ); - + TCaOperationParams organizeParams; organizeParams.iBeforeEntryId = 0; organizeParams.iOperationType = TCaOperationParams::EAppend; @@ -862,9 +867,9 @@ HandleMmcAttrUpdateL( appEntry, aCurrentMmcId ); iCaStorageProxy.AddL( appEntry ); - + AddEntryToPredefinedCollectionL( appEntry ); - + if( iInstalledPackages.Find( aUid ) != KErrNotFound ) { AddEntryToDownloadedCollectionL( appEntry->GetId() ); @@ -920,7 +925,7 @@ aEntry->AddAttributeL( KCaAttrAppType, KCaAttrAppTypeValueJava ); aEntry->AddAttributeL( KCaAttrAppSettingsPlugin, KCaAttrJavaAppSettingsPluginValue ); } - else if (appTypeUid == KCWRTApplicationTypeUid) + else if (appTypeUid == KCWRTApplicationTypeUid) { aEntry->AddAttributeL( KCaAttrAppType, KCaAttrAppTypeValueCWRT ); aEntry->AddAttributeL( KCaAttrAppWidgetUri, KCaAttrAppWidgetUriCWRTValue ); @@ -948,34 +953,32 @@ for( TInt i = 0; i < aCaEntries.Count(); i++ ) { const TInt id = aCaEntries[i]->GetId(); - TUint mmcId = 0; RBuf attrVal; attrVal.CleanupClosePushL(); attrVal.CreateL( KCaMaxAttrValueLen ); if( aCaEntries[i]->FindAttribute( KCaAttrMmcId(), attrVal ) ) { + TUint mmcId = 0; MenuUtils::GetTUint( attrVal, mmcId ); - if( mmcId && KErrNotFound != iMmcHistory->Find( mmcId ) - && mmcId != CurrentMmcId() ) + if( ( mmcId && KErrNotFound != iMmcHistory->Find( mmcId ) + && mmcId != CurrentMmcId() ) || + ( attrVal == KCaMassStorage() && + IsDriveInUse( DriveInfo::EDefaultMassStorage ) ) ) { - // This item is on an MMC which is currently in the MMC history. + // This item is on an MMC which is currently + // in the MMC history or on a mass storage in use. // Set it "missing" but keep it. - AddObjectFlagL( aCaEntries[i], EMissing ); - } - else if ( attrVal == KCaMassStorage() - && IsDriveInUse( DriveInfo::EDefaultMassStorage ) ) - { - AddObjectFlagL( aCaEntries[i], EMissing ); + SetMissingFlagL( aCaEntries[i] ); } else { - //RemoveAppL( aCaEntries[i] ); - AddObjectFlagL( aCaEntries[i], EMissing ); + aCaEntries[i]->RemoveAttributeL(KCaAttrMmcId()); + ClearVisibleFlagL( aCaEntries[i] ); } } else { - AddObjectFlagL( aCaEntries[i], EMissing ); + ClearVisibleFlagL( aCaEntries[i] ); } CleanupStack::PopAndDestroy( &attrVal ); } @@ -995,17 +998,28 @@ } // --------------------------------------------------------- -// CCaSrvAppScanner::AddObjectFlagL +// // --------------------------------------------------------- // -void CCaSrvAppScanner::AddObjectFlagL( - CCaInnerEntry* aEntry, const TInt& aFlags ) +void CCaSrvAppScanner::SetMissingFlagL( CCaInnerEntry* aEntry ) { - TBool itemFlagPresent = ( 0 != ( aEntry->GetFlags() & aFlags ) ); - if( !itemFlagPresent ) + if( !( aEntry->GetFlags() & EMissing ) ) { - aEntry->SetFlags( aEntry->GetFlags() | aFlags ); - iCaStorageProxy.AddL( aEntry ); + aEntry->SetFlags( aEntry->GetFlags() | EMissing ); + iCaStorageProxy.AddL( aEntry, EFalse, EItemDisappeared ); + } + } + +// --------------------------------------------------------- +// +// --------------------------------------------------------- +// +void CCaSrvAppScanner::ClearVisibleFlagL( CCaInnerEntry* aEntry ) + { + if( aEntry->GetFlags() & EVisible ) + { + aEntry->SetFlags( aEntry->GetFlags() & ~EVisible & ~EMissing & ~EUsed ); + iCaStorageProxy.AddL( aEntry, EFalse, EItemDisappeared ); } } @@ -1181,16 +1195,17 @@ if( resultEntriesArray.Count() ) { // set collection visible if hidden - if( HandleHiddenFlagUpdateL( aEntry ) ) + if( HandleVisibleFlagUpdate( aEntry ) ) { // update here this collection - iCaStorageProxy.AddL( aEntry, ETrue ); + iCaStorageProxy.AddL( aEntry ); } } CleanupStack::PopAndDestroy( visibleEntriesQuery ); CleanupStack::PopAndDestroy( &resultEntriesArray ); } + // ==================== MEMBER FUNCTIONS ==================== // --------------------------------------------------------- diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/casrv/calocalizerscanner/calocalizerscanner.pro --- a/contentstorage/casrv/calocalizerscanner/calocalizerscanner.pro Mon May 03 12:48:45 2010 +0300 +++ b/contentstorage/casrv/calocalizerscanner/calocalizerscanner.pro Fri May 14 16:10:06 2010 +0300 @@ -16,6 +16,8 @@ include(./../../../common.pri) +CONFIG += symbian_i18n hb + TRANSLATIONS=contentstorage.ts symbian: { @@ -56,7 +58,6 @@ -lcautils \ -lcamenu } -CONFIG += symbian_i18n exportResources(./*.qm, resource/qt/translations) diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/casrv/calocalizerscanner/inc/calocalizerscannerproxy.h --- a/contentstorage/casrv/calocalizerscanner/inc/calocalizerscannerproxy.h Mon May 03 12:48:45 2010 +0300 +++ b/contentstorage/casrv/calocalizerscanner/inc/calocalizerscannerproxy.h Fri May 14 16:10:06 2010 +0300 @@ -21,16 +21,14 @@ // INCLUDES #include #include -#include -#include +#include "hbtextresolversymbian.h" #include "castorage_global.h" // FORWARD DECLARATIONS class CCaLocalizationEntry; -class QTranslator; class CCaStorageProxy; - +class CCaInnerEntry; /** * CCaLocalizerScannerProxy @@ -39,7 +37,6 @@ class CCaLocalizerScannerProxy : public CBase { -//CA_STORAGE_TEST_FRIEND_CLASS (TestCaLocalizerScanner) public: @@ -59,11 +56,7 @@ */ ~CCaLocalizerScannerProxy( ); - /** - * Performs whole localization of database, can be called at any moment - */ - void PerformL( ); - + private: /** @@ -83,36 +76,23 @@ void UpdateLocalNamesL( ); /** - * Load translations to mTranslator - * @param aFilename file name with translations - * @return success or failure - */ - TBool LoadTranslator( QString aFilename ); - - /** * Gets localization rows from database as table of CCaLocalizationEntries * @param aLocals pointers to localization entries */ void GetLocalizationRowsL( RPointerArray& aLocals ); - /** - * Converts descriptor to const char* - * @param aDescriptor descriptor with text to convert - * @return pointer to const char containing text - */ - const char* DescriptorToStringL( const TDesC& aDescriptor ); - + const TDesC& GetEntryText( + RPointerArray aEntries, TInt aId ); /* * Not own */ CCaStorageProxy* iStorageProxy; /* - * Own - */ - QTranslator* iTranslator; + * Owned + */ + HbTextResolverSymbian* iResolver; - //CA_STORAGE_TEST_FRIEND_CLASS (TestCaLocalizerScanner) }; #endif // CALOCALSCANNERPROXY_H diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/casrv/calocalizerscanner/src/calocalizerscannerproxy.cpp --- a/contentstorage/casrv/calocalizerscanner/src/calocalizerscannerproxy.cpp Mon May 03 12:48:45 2010 +0300 +++ b/contentstorage/casrv/calocalizerscanner/src/calocalizerscannerproxy.cpp Fri May 14 16:10:06 2010 +0300 @@ -26,8 +26,10 @@ #include "calocalizerscannerproxy.h" #include "castorageproxy.h" #include "cadef.h" +#include "cainnerquery.h" +#include "cainnerentry.h" -const char* KEmptyString = ""; +_LIT(KPathLoc,"z:/resource/qt/translations"); // --------------------------------------------------------------------------- // CCaLocalizerScannerProxy::NewL @@ -65,8 +67,13 @@ // void CCaLocalizerScannerProxy::ConstructL() { - iTranslator = new ( ELeave ) QTranslator(); - PerformL(); + TBuf filenameDsc; + iStorageProxy->DbPropertyL( KCaDbPropQMfile, filenameDsc ); + iResolver = new (ELeave) HbTextResolverSymbian; + iResolver->Init(filenameDsc, KPathLoc); + UpdateLocalNamesL(); + delete iResolver; + iResolver = NULL; } // --------------------------------------------------------------------------- @@ -88,46 +95,10 @@ // CCaLocalizerScannerProxy::~CCaLocalizerScannerProxy() { - delete iTranslator; - } - -// --------------------------------------------------------------------------- -// CCaLocalizerScannerProxy::PerformL -// --------------------------------------------------------------------------- -// -void CCaLocalizerScannerProxy::PerformL() - { - QString locale = QLocale::system().name(); - QString filename = QString( "contentstorage_" ) + locale; - LoadTranslator( filename ); - TPtrC ptrLocale( reinterpret_cast( locale.constData() ) ); - TBuf propertyValue; - // trap is here to assure deletion of qtranslator in case code leaves - iStorageProxy->DbPropertyL( KCaDbPropLanguage, propertyValue ); - if( ptrLocale.CompareC( propertyValue ) ) - { - // language is changed - update locale names - UpdateLocalNamesL(); - // remember info about new language in db - iStorageProxy->SetDBPropertyL( KCaDbPropLanguage, ptrLocale ); - } - } - -// --------------------------------------------------------------------------- -// CCaLocalizerScannerProxy::LoadTranslator -// --------------------------------------------------------------------------- -// -TBool CCaLocalizerScannerProxy::LoadTranslator( QString filename ) - { - TBool loaded( false ); - // load from rom or testbase - loaded = iTranslator->load( filename, QString( "z:/resource/qt/translations" ) ); - if( !loaded ) - { - loaded = iTranslator->load( filename, QString( "c:/resource/qt/translations" ) ); - } - - return loaded; + if (iResolver) + { + delete iResolver; + } } // --------------------------------------------------------------------------- @@ -151,47 +122,63 @@ { RPointerArray locals; CleanupResetAndDestroyPushL( locals ); + RPointerArray entries; + CleanupResetAndDestroyPushL( entries ); + RArray ids; + CleanupClosePushL( ids ); + GetLocalizationRowsL( locals ); - QString locName; - RBuf localizedName; - CleanupClosePushL( localizedName ); - localizedName.CreateL( KCaMaxAttrValueLen ); - - for( TInt i = 0; i < locals.Count(); i++ ) + + TInt locCount = locals.Count(); + for( TInt idx = 0; idx < locCount; idx++ ) + { + ids.Append( locals[idx]->GetRowId() ); + } + CCaInnerQuery* query = CCaInnerQuery::NewLC(); + query->SetIdsL( ids ); + iStorageProxy->GetEntriesL( query, entries ); + CleanupStack::PopAndDestroy( query ); + + HBufC16* localizedName; + for( TInt i = 0; i < locCount; i++ ) { - const char* temp = DescriptorToStringL( locals[i]->GetStringId() ); - // first string is a contex, probably to put in database in future - locName = iTranslator->translate( KEmptyString, temp, KEmptyString ); - localizedName = reinterpret_cast ( locName.constData() ); - if (localizedName.Compare(KNullDesC)) - { - locals[i]->SetLocalizedStringL( localizedName ); - } - else - { - locals[i]->SetLocalizedStringL( locals[i]->GetStringId() ); - } - iStorageProxy->LocalizeEntryL( *( locals[i] ) ); - delete[] temp; + localizedName = iResolver->LoadLC( locals[i]->GetStringId() ); + if( localizedName->Compare( + GetEntryText( entries, locals[i]->GetRowId() ) ) ) + // translation different than text + { + locals[i]->SetLocalizedStringL( *localizedName ); + iStorageProxy->LocalizeEntryL( *( locals[i] ) ); + } + else if( !localizedName->Compare(KNullDesC) ) + // no translation, string id as text + { + locals[i]->SetLocalizedStringL( locals[i]->GetStringId() ); + iStorageProxy->LocalizeEntryL( *( locals[i] ) ); + } + CleanupStack::PopAndDestroy( localizedName ); } - CleanupStack::PopAndDestroy( &localizedName ); + + CleanupStack::PopAndDestroy( &ids ); + CleanupStack::PopAndDestroy( &entries ); CleanupStack::PopAndDestroy( &locals ); } + // --------------------------------------------------------------------------- -// CCaLocalizerScannerProxy::DescriptorToStringL +// CCaLocalizerScannerProxy::LocalGetEntryById // --------------------------------------------------------------------------- // -const char* CCaLocalizerScannerProxy::DescriptorToStringL( - const TDesC& aDescriptor ) +const TDesC& CCaLocalizerScannerProxy::GetEntryText( + RPointerArray aEntries, TInt aId ) { - TInt length = aDescriptor.Length(); - HBufC8* buffer = HBufC8::NewLC( length ); - buffer->Des().Copy( aDescriptor ); - char* str = new ( ELeave ) char[length + 1]; - Mem::Copy( str, buffer->Ptr(), length ); - str[length] = '\0'; - CleanupStack::PopAndDestroy( buffer ); - return str; + TInt entriesCount = aEntries.Count(); + for( TInt i=0; i < entriesCount; i++ ) + { + if( aEntries[i]->GetId() == aId ) + { + return aEntries[i]->GetText(); + } + } + return KNullDesC(); } - diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/casrv/cawidgetscanner/inc/cawidgetdescription.h --- a/contentstorage/casrv/cawidgetscanner/inc/cawidgetdescription.h Mon May 03 12:48:45 2010 +0300 +++ b/contentstorage/casrv/cawidgetscanner/inc/cawidgetdescription.h Fri May 14 16:10:06 2010 +0300 @@ -69,7 +69,7 @@ * MMC id setter * @param aMmcId MMC id */ - void SetMmcId( TUint aMmcId ); + void SetMmcIdL( const TDesC& aMmcId ); /* * PackageUid setter @@ -112,13 +112,13 @@ * @param aLibrary widget library */ void SetPathL( const TDesC& aPath ); - + /* * Path getter * @return widget library */ TPtrC GetPath( ) const; - + /* * Missing flag setter * @param aMissing flag @@ -135,8 +135,8 @@ * Used flag setter * @param aUsed flag */ - void SetUsed( TBool aUsed ); - + void SetUsed( TBool aUsed ); + /* * Content arsenal entry id getter * @return CA entry id @@ -147,7 +147,7 @@ * MMC id getter * @return CA entry id */ - TUint GetMmcId( ) const; + TPtrC GetMmcId( ) const; /* * Library getter @@ -189,14 +189,21 @@ * 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; + /* * Entry getter * @return entry representing widget */ CCaInnerEntry* GetEntryLC( ) const; - + /* * Modification time setter * @param aModificationTime @@ -207,7 +214,22 @@ * Modification time getter * @return widget Modification time */ - TPtrC GetModificationTime( ) const; + TPtrC GetModificationTime() const; + + /* + * Remove MMC id. + */ + void RemoveMmcId(); + /* + * Set service fw xml filename + * @param aServiceXml Service xml filename + */ + void SetServiceXmlL(const TDesC& aServiceXml); + /* + * Get service fw xml filename + * @return Service xml filename + */ + TPtrC GetServiceXml() const; private: @@ -254,7 +276,7 @@ /* * MMC id */ - TUint iMmcId; + RBuf iMmcId; /* * Widget title. Own @@ -280,7 +302,7 @@ * Widget library. Own */ RBuf iPath; - + /* * Widget library. Own */ @@ -290,11 +312,15 @@ * Widgets flags. */ TInt iFlags; - + /* * Modification time. */ RBuf iModificationTime; + /* + * Service fw xml file + */ + RBuf iServiceXml; }; typedef RPointerArray RWidgetArray; diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/casrv/cawidgetscanner/inc/cawidgetscannerparser.h --- a/contentstorage/casrv/cawidgetscanner/inc/cawidgetscannerparser.h Mon May 03 12:48:45 2010 +0300 +++ b/contentstorage/casrv/cawidgetscanner/inc/cawidgetscannerparser.h Fri May 14 16:10:06 2010 +0300 @@ -168,6 +168,13 @@ * @param aWidget widget to set value */ void SetMmcIdL( CCaWidgetDescription * aWidget ); + + 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: @@ -207,6 +214,8 @@ * Own. */ RXmlEngDOMImplementation iDomImpl; + + CCaWidgetDescription* iWidgetDescriptor; }; diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/casrv/cawidgetscanner/inc/cawidgetstoragehandler.h --- a/contentstorage/casrv/cawidgetscanner/inc/cawidgetstoragehandler.h Mon May 03 12:48:45 2010 +0300 +++ b/contentstorage/casrv/cawidgetscanner/inc/cawidgetstoragehandler.h Fri May 14 16:10:06 2010 +0300 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: +* Description: * */ @@ -46,64 +46,70 @@ /** * Two-phased constructor. */ - static CCaWidgetStorageHandler* NewL( CCaStorageProxy* aStorage, + static CCaWidgetStorageHandler* NewL( CCaStorageProxy* aStorage, RFs& aFs ); - static CCaWidgetStorageHandler* NewLC( CCaStorageProxy* aStorage, + static CCaWidgetStorageHandler* NewLC( CCaStorageProxy* aStorage, RFs& aFs ); /** * Destructor. */ virtual ~CCaWidgetStorageHandler(); - + /** * Synchronizes widgets * @param aWidgets widgets to synchronize */ - void SynchronizeL( const RWidgetArray& aWidgets ); + void SynchronizeL( const RWidgetArray& aWidgets ); - + private: /** * Adds widget to storage. - * @param aWidget widget to be added + * @param aWidget widget to be added */ - void AddL( const CCaWidgetDescription* aWidget ); + void AddL( const CCaWidgetDescription* aWidget ); /** * Updates widget in storage. - * @param aWidget widget to be updated + * @param aWidget widget to be updated */ - void UpdateL( const CCaWidgetDescription* aWidget, TUint aEntryId ); - + void UpdateL( const CCaWidgetDescription* aWidget, TUint aEntryId ); + /** * Add/Updates widgets in DB * @param aWidgets widgets to add */ void AddWidgetsL( const RWidgetArray& aWidgets ); - + /** * Removes widgets from DB */ void RemoveWidgetsL( ) ; - + /** * Fetch widgets from content storage */ - void FetchWidgetsL( ); + void FetchWidgetsL( ); /** * Add widget to download collection * @param aEntry entry containing widget information */ void AddWidgetToDownloadCollectionL( const CCaInnerEntry* aEntry ); - + /** - * Sets missing flag for an entry - * @param aWidget widget + * Set missing flag for an entry. + * @param aWidget widget. */ - void SetMissingFlagL( const CCaWidgetDescription * aWidget ); + void SetMissingFlagL( const CCaWidgetDescription * aWidget ); + + /** + * Clear missing flag for an entry. + * @param aWidget widget. + */ + void ClearVisibleFlagL( const CCaWidgetDescription* aWidget ); private: @@ -117,30 +123,36 @@ */ void ConstructL( ); + /** + * Check if mass storage is not in use. + * @return true if mass storage is not in use. + */ + TBool MassStorageNotInUse(); + private: - // Data + // Data /* * Content Storage. Not Own */ CCaStorageProxy* iStorage; - + /* * File server. Not own */ RFs iFs; - + /* * Widgets. Own. */ RWidgetArray iWidgets; - + /* * Indexes updated during last add operation. Own. */ RArray iUpdatedIndexes; - - + + }; #endif // C_WIDGETSTORAGEHANDLER_H diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/casrv/cawidgetscanner/inc/widgetscannerutils.h --- a/contentstorage/casrv/cawidgetscanner/inc/widgetscannerutils.h Mon May 03 12:48:45 2010 +0300 +++ b/contentstorage/casrv/cawidgetscanner/inc/widgetscannerutils.h Fri May 14 16:10:06 2010 +0300 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: +* Description: * */ @@ -27,6 +27,7 @@ _LIT(KAttrWidgetPath, "widget:path"); _LIT(KAttrWidgetLibrary, "widget:library"); _LIT(KAttrWidgetUri, "widget:uri"); +_LIT(KAttrWidgetServiceXml, "widget:servicexml"); _LIT(KSlash, "/"); _LIT(KDllExt, ".dll"); _LIT(KNoLibrary, "NoLibrary"); @@ -38,7 +39,7 @@ * * @since Series Series60 5.x */ -class WidgetScannerUtils +class WidgetScannerUtils { public: @@ -52,11 +53,11 @@ const DriveInfo::TDefaultDrives& aDefaultDrive); /** - * Returns current MMC id - * @param aFs file server session reference - * @return current mmc id - */ - static TUint CurrentMmcId( RFs& aFs ); + * Returns current MMC id. + * @param aFs file server session reference. + * @param aMmcId mmc id reference. + */ + static void CurrentMmcId( const RFs& aFs, TDes& aMmcId ); }; diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/casrv/cawidgetscanner/src/cawidgetdescription.cpp --- a/contentstorage/casrv/cawidgetscanner/src/cawidgetdescription.cpp Mon May 03 12:48:45 2010 +0300 +++ b/contentstorage/casrv/cawidgetscanner/src/cawidgetdescription.cpp Fri May 14 16:10:06 2010 +0300 @@ -36,7 +36,7 @@ // ----------------------------------------------------------------------------- // CCaWidgetDescription::CCaWidgetDescription() : - iEntryId(KNoId), iFlags(EVisible) + iEntryId(KNoId), iMmcId() { } @@ -78,21 +78,13 @@ iUri.CreateL( KCaMaxAttrValueLen ); aEntry->FindAttribute( KAttrWidgetUri, iUri ); //mmc id - TBuf mmcId; - if( aEntry->FindAttribute( KCaAttrMmcId, mmcId ) ) - { - TLex mmcLex( mmcId ); - User::LeaveIfError( mmcLex.Val( iMmcId, EHex )); - } - if( aEntry->GetFlags() & EMissing ) - { - iFlags = iFlags | EMissing; - } - if( aEntry->GetFlags() & EUsed ) - { - iFlags = iFlags | EUsed; - } + iMmcId.CreateL(KMassStorageIdLength); + aEntry->FindAttribute( KCaAttrMmcId, iMmcId ); + //service xml + iServiceXml.CreateL( KCaMaxAttrValueLen ); + aEntry->FindAttribute( KAttrWidgetServiceXml,iServiceXml ); + iFlags = aEntry->GetFlags(); iModificationTime.CreateL(KCaMaxAttrValueLen); aEntry->FindAttribute( KCaAttrInstallationTime, iModificationTime ); } @@ -148,6 +140,8 @@ iLibrary.Close(); iPath.Close(); iModificationTime.Close(); + iMmcId.Close(); + iServiceXml.Close(); } // ---------------------------------------------------------------------------- @@ -157,7 +151,7 @@ TBool CCaWidgetDescription::Compare( const CCaWidgetDescription& aFirst,const CCaWidgetDescription& aSecond) { - if( aFirst.GetLibraryName() == aSecond.GetLibraryName() ) + if( aFirst.GetUri() == aSecond.GetUri() ) { return ETrue; } @@ -179,7 +173,8 @@ aToCompare.GetIconUri() == GetIconUri() && aToCompare.GetTitle() == GetTitle() && aToCompare.GetLibrary() != KNoLibrary && - aToCompare.GetModificationTime() == GetModificationTime() + aToCompare.GetModificationTime() == GetModificationTime() && + aToCompare.GetServiceXml() == GetServiceXml() ) { return ETrue; @@ -194,9 +189,10 @@ // // ----------------------------------------------------------------------------- // -void CCaWidgetDescription::SetMmcId( TUint aMmcId ) +void CCaWidgetDescription::SetMmcIdL( const TDesC& aMmcId ) { - iMmcId = aMmcId; + iMmcId.Close(); + iMmcId.CreateL( aMmcId ); } // ----------------------------------------------------------------------------- @@ -323,7 +319,7 @@ // // ----------------------------------------------------------------------------- // -TUint CCaWidgetDescription::GetMmcId( ) const +TPtrC CCaWidgetDescription::GetMmcId( ) const { return iMmcId; } @@ -425,6 +421,16 @@ return iFlags & EUsed; } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool CCaWidgetDescription::IsVisible( ) const + { + return iFlags & EVisible; + } + // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- @@ -434,10 +440,7 @@ CCaInnerEntry* entry = CCaInnerEntry::NewLC(); entry->SetEntryTypeNameL( KCaTypeWidget ); entry->SetRole( EItemEntryRole ); - if ( iFlags & EVisible ) - { - entry->SetFlags( EVisible ); - } + entry->SetFlags( iFlags ); if ( iPackageUid ) { TBuf uidDesc; @@ -448,11 +451,9 @@ { entry->SetId( iEntryId ); } - if ( iMmcId ) + if ( iMmcId != KNullDesC ) { - TBuf mmcId; - mmcId.AppendNum( iMmcId, EHex); - entry->AddAttributeL( KCaAttrMmcId, mmcId ); + entry->AddAttributeL( KCaAttrMmcId, iMmcId ); } if ( iLibrary != KNullDesC ) { @@ -498,7 +499,10 @@ { entry->AddAttributeL( KCaAttrInstallationTime, iModificationTime ); } - + if ( iServiceXml != KNullDesC ) + { + entry->AddAttributeL( KAttrWidgetServiceXml, iServiceXml); + } return entry; } @@ -521,4 +525,30 @@ } return libraryName; } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CCaWidgetDescription::RemoveMmcId( ) + { + iMmcId.Close(); + } +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CCaWidgetDescription::SetServiceXmlL(const TDesC& aServiceXml) + { + iServiceXml.Close(); + iServiceXml.CreateL( aServiceXml ); + } +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TPtrC CCaWidgetDescription::GetServiceXml() const + { + return iServiceXml; + } // End of File diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/casrv/cawidgetscanner/src/cawidgetscannerparser.cpp --- a/contentstorage/casrv/cawidgetscanner/src/cawidgetscannerparser.cpp Mon May 03 12:48:45 2010 +0300 +++ b/contentstorage/casrv/cawidgetscanner/src/cawidgetscannerparser.cpp Fri May 14 16:10:06 2010 +0300 @@ -24,6 +24,7 @@ #include #include +#include "cadef.h" #include "cawidgetscannerparser.h" #include "widgetscannerutils.h" @@ -46,7 +47,11 @@ _LIT8(KDescription, "description" ); _LIT8(KHidden, "hidden" ); _LIT8(KIconUri, "iconuri" ); +_LIT8(KWidgetProvider, "widgetprovider"); +_LIT8(KWidgetManifest, "hswidgetmanifest"); +_LIT8(KIcon, "icon"); +_LIT8(KServiceXml, "servicexml"); // ============================ MEMBER FUNCTIONS =============================== @@ -105,6 +110,7 @@ // CCaWidgetScannerParser::~CCaWidgetScannerParser() { + delete iWidgetDescriptor; iImportPath.Close(); iWidgets.ResetAndDestroy(); iDomImpl.Close(); @@ -200,23 +206,102 @@ User::LeaveIfError(parser.Open(iDomImpl)); RXmlEngDocument doc = parser.ParseFileL(aFilePath, KChunkSize); CleanupClosePushL(doc); - TXmlEngElement docElement = doc.AsElement(); - TXmlEngElement element; - RXmlEngNodeList elementList; - CleanupClosePushL(elementList); + TXmlEngElement docElement = doc.DocumentElement(); + + if (docElement.Name() == KWidgetProvider) { + TXmlEngElement element; + RXmlEngNodeList elementList; + CleanupClosePushL(elementList); + docElement.GetElementsByTagNameL(elementList, KWidget); - element = docElement.FirstChild().AsElement(); - element.GetElementsByTagNameL(elementList, KWidget); + while (elementList.HasNext()) + { + element = elementList.Next(); + if ( element.HasAttributes() ) + { + ParseWidgetL( aFilePath, element, aPackageUid ); + } + } + CleanupStack::PopAndDestroy(&elementList); + } else if (docElement.Name() == KWidgetManifest) { + + delete iWidgetDescriptor; + iWidgetDescriptor = NULL; + iWidgetDescriptor = CCaWidgetDescription::NewL(); + iWidgetDescriptor->SetPackageUidL(aPackageUid); + iWidgetDescriptor->SetVisible(ETrue); + + + SetMmcIdL( iWidgetDescriptor ); - while (elementList.HasNext()) - { - element = elementList.Next(); - if ( element.HasAttributes() ) + RXmlEngNodeList 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); + + //set path for hs to use, trim last 2 chars (doubleslash) + HBufC *libraryPath = GetManifestDirectoryPathLC( aPackageUid ); + iWidgetDescriptor->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 ); + + TInt index = iWidgets.Find( iWidgetDescriptor, CCaWidgetDescription::Compare ); + if ( index != KErrNotFound ) { - ParseWidgetL( aFilePath, element, aPackageUid ); + delete iWidgets[index]; + iWidgets.Remove( index ); } - } - CleanupStack::PopAndDestroy(&elementList); + iWidgets.AppendL( iWidgetDescriptor );//ownership transfer + iWidgetDescriptor = NULL; + } + CleanupStack::PopAndDestroy(&doc); CleanupStack::PopAndDestroy(&parser); } @@ -364,6 +449,10 @@ { aWidget->SetVisible( EFalse ); } + else + { + aWidget->SetVisible( ETrue ); + } CleanupStack::PopAndDestroy( hidden ); } @@ -403,9 +492,21 @@ User::LeaveIfError( DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRemovableMassStorage, removableDrive ) ); + TChar massStorageDrive; + User::LeaveIfError( DriveInfo::GetDefaultDrive( + DriveInfo::EDefaultMassStorage, massStorageDrive ) ); if( iCurrentDriveLetter == removableDrive ) { - widget->SetMmcId( WidgetScannerUtils::CurrentMmcId( iFs ) ); + RBuf mmcId; + mmcId.CreateL(KMassStorageIdLength); + mmcId.CleanupClosePushL(); + WidgetScannerUtils::CurrentMmcId( iFs, mmcId ); + widget->SetMmcIdL( mmcId ); + CleanupStack::PopAndDestroy( &mmcId ); + } + else if( iCurrentDriveLetter == massStorageDrive ) + { + widget->SetMmcIdL( KCaMassStorage ); } } @@ -429,7 +530,8 @@ // HBufC* CCaWidgetScannerParser::FullPathLC( ) { - HBufC* result = HBufC16::NewLC( iImportPath.Length() + KDriveLetterLength ); + HBufC* result = + HBufC16::NewLC( iImportPath.Length() + KDriveLetterLength ); TPtr modifier( result->Des() ); modifier.Append( iCurrentDriveLetter ); modifier.Append( KColen ); @@ -454,4 +556,79 @@ return result; } +void CCaWidgetScannerParser::ParseUriL(TXmlEngElement & aElement) + { + if (aElement.Text().Length()) + { + 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 ); + } + } +void CCaWidgetScannerParser::ParseIconL(TXmlEngElement & aElement, + const TDesC & aPackageUid ) + { + 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 ); + } + + CleanupStack::PopAndDestroy( utf16 ); + } + +void CCaWidgetScannerParser::ParseDescriptionL(TXmlEngElement & aElement) + { + HBufC *desc = + CnvUtfConverter::ConvertToUnicodeFromUtf8L( aElement.Text() ); + CleanupStack::PushL( desc ); + + if( desc->Compare( KNullDesC ) != 0 ) + { + iWidgetDescriptor->SetDescriptionL( *desc ); + } + CleanupStack::PopAndDestroy( desc ); + } +void CCaWidgetScannerParser::ParseHiddenL( TXmlEngElement& aElement ) + { + if( aElement.Text().Compare( _L8("true") ) == 0 ) + { + iWidgetDescriptor->SetVisible( EFalse ); + } + + } +void CCaWidgetScannerParser::ParseServiceXmlL( TXmlEngElement& aElement ) + { + HBufC *serviceXml = CnvUtfConverter::ConvertToUnicodeFromUtf8L( aElement.Text() ); + CleanupStack::PushL( serviceXml ); + + if (serviceXml->Compare(KNullDesC) != 0) + { + iWidgetDescriptor->SetServiceXmlL( *serviceXml ); + } + CleanupStack::PopAndDestroy( serviceXml ); + } // End of File diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/casrv/cawidgetscanner/src/cawidgetstoragehandler.cpp --- a/contentstorage/casrv/cawidgetscanner/src/cawidgetstoragehandler.cpp Mon May 03 12:48:45 2010 +0300 +++ b/contentstorage/casrv/cawidgetscanner/src/cawidgetstoragehandler.cpp Fri May 14 16:10:06 2010 +0300 @@ -11,7 +11,7 @@ * * Contributors: * - * Description: + * Description: * */ // INCLUDE FILES @@ -88,9 +88,9 @@ } // ---------------------------------------------------------------------------- -// +// // ---------------------------------------------------------------------------- -// +// void CCaWidgetStorageHandler::SynchronizeL( const RWidgetArray& aWidgets ) { FetchWidgetsL(); @@ -99,14 +99,14 @@ } // ---------------------------------------------------------------------------- -// +// // ---------------------------------------------------------------------------- -// +// void CCaWidgetStorageHandler::AddL( const CCaWidgetDescription* aWidget ) { CCaInnerEntry* entry = aWidget->GetEntryLC(); iStorage->AddL( entry ); - if( ( entry->GetFlags() & ERemovable ) != 0 ) + if( entry->GetFlags() & ERemovable ) { AddWidgetToDownloadCollectionL( entry ); } @@ -114,24 +114,26 @@ } // ---------------------------------------------------------------------------- -// +// // ---------------------------------------------------------------------------- -// +// void CCaWidgetStorageHandler::UpdateL( const CCaWidgetDescription* aWidget, TUint aEntryId ) { CCaInnerEntry* entry = aWidget->GetEntryLC(); entry->SetId( aEntryId ); - if( !aWidget->IsMissing() && ( aWidget->GetLibrary() != KNoLibrary ) ) + if( !aWidget->IsMissing() && aWidget->IsUsed() ) { entry->SetFlags( entry->GetFlags() & ~EUsed ); } - else if(aWidget->IsUsed()) + TItemAppearance itemAppearanceChange = EItemAppearanceNotChanged; + if( ( entry->GetFlags() & EMissing ) || + !( entry->GetFlags() & EVisible ) ) { - entry->SetFlags( entry->GetFlags() | EUsed ); + itemAppearanceChange = EItemAppeared; } - entry->SetFlags( entry->GetFlags() & ~EMissing ); - iStorage->AddL( entry ); + entry->SetFlags( entry->GetFlags() & ~EMissing | EVisible ); + iStorage->AddL( entry, EFalse, itemAppearanceChange ); if( !aWidget->IsMissing() ) { AddWidgetToDownloadCollectionL( entry ); @@ -140,23 +142,24 @@ } // ---------------------------------------------------------------------------- -// +// // ---------------------------------------------------------------------------- -// +// void CCaWidgetStorageHandler::AddWidgetsL( const RWidgetArray& aWidgets ) { iUpdatedIndexes.Reset(); for( TInt i = 0; i < aWidgets.Count(); i++ ) { - TInt index = iWidgets.Find( + TInt index = iWidgets.Find( aWidgets[i], CCaWidgetDescription::Compare ); if( index != KErrNotFound ) { - if( !iWidgets[index]->Compare( *aWidgets[i] ) || + 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() ); UpdateL( aWidgets[i], iWidgets[index]->GetEntryId() ); } iUpdatedIndexes.AppendL( index ); @@ -169,33 +172,48 @@ } // ---------------------------------------------------------------------------- -// +// // ---------------------------------------------------------------------------- -// +// void CCaWidgetStorageHandler::RemoveWidgetsL() { for( TInt i = 0; i < iWidgets.Count(); i++ ) { if( iUpdatedIndexes.Find( i ) == KErrNotFound ) { - if( iWidgets[i]->GetMmcId() && - ( iWidgets[i]->GetMmcId() != - WidgetScannerUtils::CurrentMmcId( iFs ) ) ) + if( iWidgets[i]->GetMmcId() != KNullDesC ) { - SetMissingFlagL( iWidgets[i] ); + RBuf currentMmcId; + currentMmcId.CreateL( KMassStorageIdLength ); + currentMmcId.CleanupClosePushL(); + WidgetScannerUtils::CurrentMmcId( iFs, currentMmcId ); + if( iWidgets[i]->GetMmcId() == currentMmcId || + ( iWidgets[i]->GetMmcId() == KCaMassStorage() && + MassStorageNotInUse() ) ) + { + //item was uninstalled so we remove its mmc id + iWidgets[i]->RemoveMmcId(); + ClearVisibleFlagL( iWidgets[i] ); + } + else + { + SetMissingFlagL( iWidgets[i] ); + } + CleanupStack::PopAndDestroy(¤tMmcId); } else { - SetMissingFlagL( iWidgets[i] ); + //item was uninstalled so we remove its mmc id + ClearVisibleFlagL( iWidgets[i] ); } } } } // ---------------------------------------------------------------------------- -// +// // ---------------------------------------------------------------------------- -// +// void CCaWidgetStorageHandler::AddWidgetToDownloadCollectionL( const CCaInnerEntry* aEntry ) { @@ -228,9 +246,9 @@ } // ---------------------------------------------------------------------------- -// +// // ---------------------------------------------------------------------------- -// +// void CCaWidgetStorageHandler::FetchWidgetsL() { CCaInnerQuery* query = CCaInnerQuery::NewLC(); @@ -257,20 +275,60 @@ } // ---------------------------------------------------------------------------- -// +// // ---------------------------------------------------------------------------- -// +// void CCaWidgetStorageHandler::SetMissingFlagL( const CCaWidgetDescription* aWidget ) { - CCaInnerEntry* entry = aWidget->GetEntryLC(); - entry->SetFlags( entry->GetFlags() | EMissing ); - if( aWidget->IsUsed() ) + if( !aWidget->IsMissing() ) { - entry->SetFlags( entry->GetFlags() | EUsed ); + CCaInnerEntry* entry = aWidget->GetEntryLC(); + entry->SetFlags( entry->GetFlags() | EMissing ); + if( aWidget->IsUsed() ) + { + entry->SetFlags( entry->GetFlags() | EUsed ); + } + iStorage->AddL( entry, EFalse, EItemDisappeared ); + CleanupStack::PopAndDestroy( entry ); } - iStorage->AddL( entry ); - CleanupStack::PopAndDestroy( entry ); } -// End of File +// ---------------------------------------------------------------------------- +// +// ---------------------------------------------------------------------------- +// +void CCaWidgetStorageHandler::ClearVisibleFlagL( + const CCaWidgetDescription* aWidget ) + { + if( aWidget->IsVisible() ) + { + CCaInnerEntry* entry = aWidget->GetEntryLC(); + entry->SetFlags( entry->GetFlags() & ~EVisible & ~EMissing & ~EUsed ); + iStorage->AddL( entry, EFalse, EItemDisappeared ); + CleanupStack::PopAndDestroy( entry ); + } + } + +// ---------------------------------------------------------------------------- +// +// ---------------------------------------------------------------------------- +// +TBool CCaWidgetStorageHandler::MassStorageNotInUse() + { + TBool massStorageNotInUse( ETrue ); + TInt drive; + if( DriveInfo::GetDefaultDrive( DriveInfo::EDefaultMassStorage, drive ) == + KErrNone ) + { + TUint status; + if( DriveInfo::GetDriveStatus( iFs, drive, status ) == KErrNone && + ( status & DriveInfo::EDriveInUse ) ) + { + massStorageNotInUse = EFalse; + } + } + return massStorageNotInUse; + } + +// End of File diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/casrv/cawidgetscanner/src/widgetscannerutils.cpp --- a/contentstorage/casrv/cawidgetscanner/src/widgetscannerutils.cpp Mon May 03 12:48:45 2010 +0300 +++ b/contentstorage/casrv/cawidgetscanner/src/widgetscannerutils.cpp Fri May 14 16:10:06 2010 +0300 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: +* Description: * */ @@ -21,11 +21,11 @@ #include "cadef.h" // ----------------------------------------------------------------------------- -// +// // ----------------------------------------------------------------------------- // TBool WidgetScannerUtils::IsFileOnDrive(const TDesC& aFileName, - const DriveInfo::TDefaultDrives& aDefaultDrive) + const DriveInfo::TDefaultDrives& aDefaultDrive) { if (aFileName.Length()) { TInt drive; @@ -43,12 +43,11 @@ // ----------------------------------------------------------------------------- -// +// // ----------------------------------------------------------------------------- // -TUint WidgetScannerUtils::CurrentMmcId( RFs& aFs ) +void WidgetScannerUtils::CurrentMmcId( const RFs& aFs, TDes& aMmcId ) { - TUint mmcId = 0; TInt mmcDrive; if ( DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRemovableMassStorage, mmcDrive ) == KErrNone ) @@ -56,10 +55,10 @@ TVolumeInfo volumeInfo; if( aFs.Volume( volumeInfo, mmcDrive ) == KErrNone ) { - mmcId = volumeInfo.iUniqueID; + aMmcId.Zero(); + aMmcId.AppendNum( volumeInfo.iUniqueID ); } } - return mmcId; } -// End of File +// End of File diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/castorage/conf/castoragedb.confml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentstorage/castorage/conf/castoragedb.confml Fri May 14 16:10:06 2010 +0300 @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + FavoritesFavorites4qtg_large_applications_user + OfficeOffice4txt_applib_dblist_officeqtg_large_applications_user + MultimediaMultimedia4qtg_large_applications_user + UtilsUtils4qtg_large_applications_user + GamesGames4txt_applib_dblist_gamesqtg_large_applications_user + applicationcalendar268458241 + applicationCamera270501242 + applicationContacts537014009 + applicationEmail537023930 + applicationFM Radio270530934 + applicationInternet222222222 + applicationMaps222222222 + applicationMessaging537001593 + applicationMusic270564450 + applicationPhotos (camera)536913858 + applicationSettings268458220 + applicationVideos (video camera)222222222 + applicationcalendar268458241 + applicationPhonebook537014009 + applicationThemes268458546 + applicationPaint Cursor537001564 + applicationVideoplayer537006590 + applicationControlPanel537026521 + applicationBluetooth268458321 + applicationSW update537001519 + applicationeshell270498535 + applicationConn. mgr.270501072 + + + + \ No newline at end of file diff -r 32469d7d46ff -r 4bc7b118b3df contentstorage/castorage/conf/castoragedb.implml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentstorage/castorage/conf/castoragedb.implml Fri May 14 16:10:06 2010 +0300 @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + +