# HG changeset patch # User hgs # Date 1269428763 -7200 # Node ID 0e41c72311af7fcaf336f587c4d3536f128c8b05 # Parent 1e87eb3b400f98f1430f49c2f09c877006a00695 201011_02 diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activitydatabase/activitydatabase.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/activitydatabase.pro Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,20 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = subdirs + +SUBDIRS += hsactivitydbclient \ + hsactivitydbserver diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activitydatabase/bwins/hsactivitydbclientu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/bwins/hsactivitydbclientu.def Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,25 @@ +EXPORTS + ?launchActivity@HsActivityDbClient@@UAEHABV?$QHash@VQString@@VQVariant@@@@@Z @ 1 NONAME ; int HsActivityDbClient::launchActivity(class QHash const &) + ?connect@HsActivityDbClient@@QAEHXZ @ 2 NONAME ; int HsActivityDbClient::connect(void) + ?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 + ?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 &) + diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activitydatabase/eabi/hsactivitydbclientu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/eabi/hsactivitydbclientu.def Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,34 @@ +EXPORTS + _ZN18HsActivityDbClient10activitiesER5QListI5QHashI7QString8QVariantEE @ 1 NONAME + _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 + diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activitydatabase/hsactivitydbclient/hsactivitydbclient.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/hsactivitydbclient/hsactivitydbclient.pro Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,54 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = lib +TARGET = hsactivitydbclient + +QT += core \ + sql + +QT -= gui + +HEADERS += inc/hsactivitydbclient.h + +SOURCES += src/hsactivitydbclient.cpp + +DEFINES += ACTIVITY_LIB + +symbian{ +TARGET.UID3 = 0xE467C21E + +HEADERS += ../s60/inc/hsserializer.h \ + s60/inc/hsactivitydbclient_p.h \ + s60/inc/hsactivitydbasyncrequest_p.h + +SOURCES += ../s60/src/hsserializer.cpp \ + s60/src/hsactivitydbclient_p.cpp \ + s60/src/hsactivitydbasyncrequest_p.cpp + + +hsactivitydbclientdll.sources = hsactivitydbclient.dll +hsactivitydbclientdll.path = $$SHARED_LIB_DIR +DEPLOYMENT += hsactivitydbclientdll + +BLD_INF_RULES.prj_exports += "../inc/hsactivitydbclientinterface.h /epoc32/include/hsactivitydbclientinterface.h" \ + "inc/hsactivitydbclient.h /epoc32/include/hsactivitydbclient.h" \ + "inc/hsactivitydbasyncrequestobserver.h /epoc32/include/hsactivitydbasyncrequestobserver.h" +DEPLOYMENT += api +TARGET.CAPABILITY = ALL -TCB +TARGET.EPOCALLOWDLLDATA = 1 +MMP_RULES += EXPORTUNFROZEN +} diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activitydatabase/hsactivitydbclient/inc/hsactivitydbasyncrequestobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/hsactivitydbclient/inc/hsactivitydbasyncrequestobserver.h Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef HSACTIVITYDBASYNCREQUESTOBSERVER_H +#define HSACTIVITYDBASYNCREQUESTOBSERVER_H +#include +class HsActivityDbAsyncRequestObserver +{ +public: + /** + * Function inform observer about asynchronous request results + * @param result - request result + * @param requestType - request type + * @param data - respons data + */ + virtual void asyncRequestCompleated(int result, + int requestType, + const QString& data)=0; +}; +#endif // HSACTIVITYDBASYNCREQUESTOBSERVER_H diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activitydatabase/hsactivitydbclient/inc/hsactivitydbclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/hsactivitydbclient/inc/hsactivitydbclient.h Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,125 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef HSACTIVITYDBCLIENT_H +#define HSACTIVITYDBCLIENT_H +#include +#include +#include "hsactivitydbclientinterface.h" + +#ifdef ACTIVITY_LIB + #define ACTIVITY_EXPORT Q_DECL_EXPORT +#else + #define ACTIVITY_EXPORT Q_DECL_IMPORT +#endif + +class HsActivityDbClientPrivate; + +/** + * Class implemets HsActivityDbClientInterface and is responsible for activity data management. + */ +class ACTIVITY_EXPORT HsActivityDbClient: public QObject, + public HsActivityDbClientInterface, + public HsActivityDbAsyncRequestObserver +{ +Q_OBJECT +public: + /** + * Constructor + */ + HsActivityDbClient(QObject* =0); + + /** + * Destructor + */ + ~HsActivityDbClient(); + + /** + * Establish connection with activity server + * @return 0 on succees, error code otherwise + */ + int connect(); + + /** + * Interface implementation. + * @see int HsActivityDbAsyncRequestObserver::asyncRequestCompleated(int, int, const QString&) + */ + void asyncRequestCompleated(int, int, const QString&); + + /** + * Interface implementation. + * @see int HsActivityDbClientInterface::saveActivity(const QVariantHash&) + */ + int addActivity(const QVariantHash &); + + /** + * Interface implementation. + * @see int HsActivityDbClientInterface::updateActivity(const QVariantHash&) + */ + int updateActivity(const QVariantHash &); + + /** + * Interface implementation. + * @see int HsActivityDbClientInterface::deleteActivity(const QVariantHash &) + */ + int removeActivity(const QVariantHash &activity); + + /** + * Interface implementation. + * @see int HsActivityDbClientInterface::deleteApplicationActivities(const QVariantHash &) + */ + int removeApplicationActivities(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 &); + + /** + * Interface implementation. + * @see int HsActivityDbClientInterface::launchActivity(const QVariantHash &) + */ + int launchActivity(const QVariantHash &); +signals: + /** + * Function notify about runtime activity change + * @param activityId - requested activity name + */ + void activityRequested(const QString& activityId); +private: + /** + * Private client implementation. + * Own. + */ + HsActivityDbClientPrivate* d_ptr; +}; + +#endif //HSACTIVITYDBCLIENT_H diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activitydatabase/hsactivitydbclient/s60/inc/hsactivitydbasyncrequest_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/hsactivitydbclient/s60/inc/hsactivitydbasyncrequest_p.h Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,79 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef HSACTIVITYDBASYNCREQUESTPRIVATE_H +#define HSACTIVITYDBASYNCREQUESTPRIVATE_H +#include +#include +#include + +class HsActivityDbClientPrivate; + +/** + * Class is responsible for async. request handling + */ +class HsActivityDbAsyncRequestPrivate : public CActive + +{ +public: + /** + * First step constructor + */ + static HsActivityDbAsyncRequestPrivate* + NewL(HsActivityDbAsyncRequestObserver &, HsActivityDbClientPrivate &); + + /** + * First step constructor + */ + static HsActivityDbAsyncRequestPrivate* + NewLC(HsActivityDbAsyncRequestObserver &, HsActivityDbClientPrivate &); + + /** + * Destructor + */ + ~HsActivityDbAsyncRequestPrivate(); + + /** + * Function create subscription to current ativity changes + * @param condition - activity filetering rules + */ + void waitActivity(const QVariantHash& condition); +protected: + /** + * Interface implementation. + * @see void CActive::DoCancel() + */ + void DoCancel(); + + /** + * Interface implementation. + * @see void CActive::DoCancel() + */ + void RunL(); +private: + /** + * Constructor + */ + HsActivityDbAsyncRequestPrivate(HsActivityDbAsyncRequestObserver &, + HsActivityDbClientPrivate &); +private: + HsActivityDbAsyncRequestObserver& mObserver; + HsActivityDbClientPrivate& mSession; + int mRequestType; + RBuf8 mDataBuf; + TPckgBuf mDataSize; +}; +#endif // HSACTIVITYDBCLIENTPRIVATE_H diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activitydatabase/hsactivitydbclient/s60/inc/hsactivitydbclient_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/hsactivitydbclient/s60/inc/hsactivitydbclient_p.h Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,178 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef HSACTIVITYDBCLIENTPRIVATE_H +#define HSACTIVITYDBCLIENTPRIVATE_H +#include "hsactivitydbclientinterface.h" +#include +#include + +class HsActivityDbAsyncRequestPrivate; +/** + * Class implemets HsActivityDbClientInterface and is responsible for + * activity data management on S60 enviroment. + */ +class HsActivityDbClientPrivate : protected RSessionBase, + public HsActivityDbClientInterface +{ +public: + /** + * Constructor + */ + HsActivityDbClientPrivate(HsActivityDbAsyncRequestObserver&); + + /** + * Destructor + */ + ~HsActivityDbClientPrivate(); + + /** + * Function establish connection to activity server + * @return 0 on succees, error code otherwise + */ + int connect(); + + /** + * Interface implementation. + * @see int HsActivityDbClientInterface::addActivity(const QVariantHash &) + */ + int addActivity(const QVariantHash &); + + /** + * 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 &, const QVariantHash &); + + /** + * 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 &); + + /** + * Interface implementation. + * @see int HsActivityDbClientInterface::cancelWaitActivity() + */ + int cancelWaitActivity(); + +public: + /** + * Function get cached data from server + * @param dst - destination, preallocated buffer + */ + void getData(RBuf8 & dst); + + /** + * Function initialize aync request + * @param func - requested function + * @param data - request data + * @param status - request status + */ + void sendDataAsync(int func,const TIpcArgs & data, TRequestStatus& status); + +private: + /** + * Function start activity server process. + * Function can leave on failure. + */ + void startServerL(); + + /** + * Function establish connection to activity server. + * Function can leave on failure + */ + void connectL(); + + /** + * Function execute remote call request. + * @param function - remote function identyfier + * @param activity - remote function parameters + */ + void execSimpleRequestL( int function, const QVariantHash &activity); + + /** + * Function retrieve current activity name for application. + * Function can leave on failure + * @param result - activity name + * @param activity - request filtering rules + */ + void requestedActivityNameL(QString& result, + const QVariantHash &activity); + + /** + * Function retrieve all stored activity + * Function can leave on failure + * @param result - list of activity + */ + void activitiesL(QList& result); + + /** + * Function retrieve all stored activity + * Function can leave on failure + * @param result - list of activity + * @param cond - request conditions + */ + void applicationActivitiesL(QList& result, + const QVariantHash & cond); + + void waitActivityL(const QVariantHash &activity); +private: + /** + * Async request handler + * Own + */ + HsActivityDbAsyncRequestPrivate* mAsyncDataHandler; + +}; +#endif // HSACTIVITYDBCLIENTPRIVATE_H diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activitydatabase/hsactivitydbclient/s60/src/hsactivitydbasyncrequest_p.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/hsactivitydbclient/s60/src/hsactivitydbasyncrequest_p.cpp Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,119 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "hsactivitydbasyncrequest_p.h" +#include "hsactivitydbclient_p.h" +#include "hsserializer.h" +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +HsActivityDbAsyncRequestPrivate* + HsActivityDbAsyncRequestPrivate::NewL(HsActivityDbAsyncRequestObserver& observer, + HsActivityDbClientPrivate& session) +{ + HsActivityDbAsyncRequestPrivate* self = + HsActivityDbAsyncRequestPrivate::NewLC(observer, session); + CleanupStack::Pop(self); + return self; +} +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +HsActivityDbAsyncRequestPrivate* + HsActivityDbAsyncRequestPrivate::NewLC(HsActivityDbAsyncRequestObserver& observer, + HsActivityDbClientPrivate& session) +{ + HsActivityDbAsyncRequestPrivate* self = + new (ELeave)HsActivityDbAsyncRequestPrivate(observer, session); + CleanupStack::PushL(self); + self->mDataBuf.CreateL(64); + return self; +} +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +HsActivityDbAsyncRequestPrivate::HsActivityDbAsyncRequestPrivate(HsActivityDbAsyncRequestObserver &observer, + HsActivityDbClientPrivate &session) +: + CActive(EPriorityStandard), + mObserver(observer), + mSession(session), + mRequestType(-1), + mDataSize() +{ + CActiveScheduler::Add(this); +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +HsActivityDbAsyncRequestPrivate::~HsActivityDbAsyncRequestPrivate() +{ + mDataBuf.Close(); + Cancel(); +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void HsActivityDbAsyncRequestPrivate::DoCancel() +{ + if(IsActive()) { + mSession.cancelWaitActivity(); + } +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void HsActivityDbAsyncRequestPrivate::RunL() +{ + RBuf8 buff; + CleanupClosePushL(buff); + QString data; + int requestResult(iStatus.Int()); + if(KErrNone == requestResult) { + if(0 < mDataSize()) { + buff.CreateL(mDataSize()); + } + mSession.getData(buff); + data = QString::fromAscii(reinterpret_cast(buff.Ptr()), + buff.Length()); + buff.Close(); + } + mObserver.asyncRequestCompleated(requestResult, mRequestType, data); + CleanupStack::PopAndDestroy(&buff); +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void HsActivityDbAsyncRequestPrivate::waitActivity(const QVariantHash& condition) +{ + mRequestType = WaitActivity; + iStatus = KRequestPending; + SetActive(); + mDataBuf << condition; + mSession.sendDataAsync(mRequestType, TIpcArgs(&mDataBuf, &mDataSize), iStatus); +} diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activitydatabase/hsactivitydbclient/s60/src/hsactivitydbclient_p.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/hsactivitydbclient/s60/src/hsactivitydbclient_p.cpp Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,301 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 "hsactivitydbclient_p.h" +#include "hsactivitydbasyncrequest_p.h" +#include "hsactivityglobals.h" +#include "hsserializer.h" + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +HsActivityDbClientPrivate::HsActivityDbClientPrivate(HsActivityDbAsyncRequestObserver& observer) +{ + mAsyncDataHandler = HsActivityDbAsyncRequestPrivate::NewL(observer, *this); +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +HsActivityDbClientPrivate::~HsActivityDbClientPrivate() +{ + delete mAsyncDataHandler; + Close(); +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +int HsActivityDbClientPrivate::connect() +{ + TRAPD(errNo, connectL()); + return errNo; +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +int HsActivityDbClientPrivate::addActivity(const QVariantHash &activity) +{ + TRAPD( errNo, execSimpleRequestL(AddActivity, activity);) + return errNo; +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +int HsActivityDbClientPrivate::updateActivity(const QVariantHash &activity) +{ + TRAPD( errNo, execSimpleRequestL(UpdateActivity, activity);) + return errNo; +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +int HsActivityDbClientPrivate::removeActivity(const QVariantHash &activity) +{ + TRAPD( errNo, execSimpleRequestL(RemoveActivity, activity);) + return errNo; +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +int HsActivityDbClientPrivate::removeApplicationActivities(const QVariantHash &activity) +{ + TRAPD( errNo, execSimpleRequestL(RemoveApplicationActivities, activity);) + return errNo; +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +int HsActivityDbClientPrivate::activities(QList& result) +{ + TRAPD(errNo, activitiesL(result)); + return errNo; +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +int HsActivityDbClientPrivate::applicationActivities(QList& result, + const QVariantHash & condition) +{ + TRAPD(errNo, applicationActivitiesL(result, condition)); + return errNo; +} + + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +int HsActivityDbClientPrivate::waitActivity(const QVariantHash &activity) +{ + TRAPD( errNo, waitActivityL(activity);) + return errNo; +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +int HsActivityDbClientPrivate::launchActivity(const QVariantHash &activity) +{ + TRAPD( errNo, execSimpleRequestL(LaunchActivity, activity);) + return errNo; +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +int HsActivityDbClientPrivate::cancelWaitActivity() +{ + return SendReceive(CancelWait, TIpcArgs()); +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void HsActivityDbClientPrivate::startServerL() +{ + RProcess server; + const TUidType uid(KNullUid, KNullUid, KActivityServerUid); + User::LeaveIfError(server.Create( KActivityServerName, KNullDesC, uid)); + TRequestStatus stat; + server.Rendezvous( stat ); + if ( stat != KRequestPending ) { + server.Kill(0); + } else { + server.Resume(); + } + User::WaitForRequest(stat); + int errNo = (EExitPanic == server.ExitType()) ? + KErrGeneral : stat.Int(); + if(KErrCancel == errNo) { + errNo = KErrNone; + } + server.Close(); + User::LeaveIfError(errNo); +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void HsActivityDbClientPrivate::connectL() +{ + const int asyncMessageSlots(4); + const int maxRetry(4); + + TInt retry = maxRetry; + TInt errNo(KErrNone); + do { + errNo = CreateSession( KActivityServerName, TVersion( 0, 0, 0 ), asyncMessageSlots ); + if( KErrNotFound != errNo && KErrServerTerminated != errNo) { + retry =0; + } else { + TRAP(errNo, startServerL()); + if (KErrNone != errNo && KErrAlreadyExists != errNo) { + retry =0; + } + } + } while(--retry > 0); + User::LeaveIfError(errNo); +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void HsActivityDbClientPrivate::execSimpleRequestL(int function, const QVariantHash &activity) +{ + RBuf8 data; + CleanupClosePushL(data); + data.CreateL(256); + data << activity; + User::LeaveIfError(SendReceive(function, TIpcArgs(&data))); + 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); +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void HsActivityDbClientPrivate::activitiesL(QList& result) +{ + 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))); + result << data; + CleanupStack::PopAndDestroy(&data); +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void HsActivityDbClientPrivate::applicationActivitiesL(QList& result, + const QVariantHash & condition) +{ + 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))); + result << data; + CleanupStack::PopAndDestroy(&data); +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void HsActivityDbClientPrivate::waitActivityL(const QVariantHash &activity) +{ + if(mAsyncDataHandler->IsActive()) { + User::Leave(KErrServerBusy); + } else { + mAsyncDataHandler->waitActivity(activity); + } +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void HsActivityDbClientPrivate::getData(RBuf8& data) +{ + SendReceive(GetData, TIpcArgs(&data)); +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void HsActivityDbClientPrivate::sendDataAsync(int func, + const TIpcArgs &data, + TRequestStatus& status) +{ + SendReceive(func, data, status); +} diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activitydatabase/hsactivitydbclient/src/hsactivitydbclient.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/hsactivitydbclient/src/hsactivitydbclient.cpp Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,138 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#include "hsactivitydbclient.h" +#include "hsactivitydbclient_p.h" + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +HsActivityDbClient::HsActivityDbClient(QObject* obj) +: + QObject(obj), + d_ptr(0) +{ + d_ptr = new HsActivityDbClientPrivate(*this); +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +HsActivityDbClient::~HsActivityDbClient() +{ + delete d_ptr; +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +int HsActivityDbClient::connect() +{ + return d_ptr->connect(); +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void HsActivityDbClient::asyncRequestCompleated(int result, + int requestType, + const QString& data) +{ + switch(requestType){ + case WaitActivity: + if( KErrNone == result ) { + emit activityRequested(data); + } + break; + } +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +int HsActivityDbClient::addActivity(const QVariantHash &activity) +{ + return d_ptr->addActivity(activity); +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +int HsActivityDbClient::updateActivity(const QVariantHash &activity) +{ + return d_ptr->updateActivity(activity); +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +int HsActivityDbClient::removeActivity(const QVariantHash &activity) +{ + return d_ptr->removeActivity(activity); +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +int HsActivityDbClient::removeApplicationActivities(const QVariantHash &activity) +{ + return d_ptr->removeApplicationActivities(activity); +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +int HsActivityDbClient::activities(QList& result) +{ + return d_ptr->activities(result); +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +int HsActivityDbClient::applicationActivities(QList & result, + const QVariantHash & conditions) +{ + return d_ptr->applicationActivities(result, conditions); +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +int HsActivityDbClient::waitActivity(const QVariantHash &activity) +{ + return d_ptr->waitActivity(activity); +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +int HsActivityDbClient::launchActivity(const QVariantHash &activity) +{ + return d_ptr->launchActivity(activity); +} diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activitydatabase/hsactivitydbserver/hsactivitydbserver.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/hsactivitydbserver/hsactivitydbserver.pro Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,49 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +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 + +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 + +TARGET.CAPABILITY = ALL -TCB +} + diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activitydatabase/hsactivitydbserver/inc/hsactivity.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/hsactivitydbserver/inc/hsactivity.h Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this 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 1e87eb3b400f -r 0e41c72311af activityfw/activitydatabase/hsactivitydbserver/inc/hsactivityserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/hsactivitydbserver/inc/hsactivityserver.h Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef 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 1e87eb3b400f -r 0e41c72311af activityfw/activitydatabase/hsactivitydbserver/inc/hsactivitystorage.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/hsactivitydbserver/inc/hsactivitystorage.h Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,93 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#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 1e87eb3b400f -r 0e41c72311af activityfw/activitydatabase/hsactivitydbserver/inc/hsactivitystorage_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/hsactivitydbserver/inc/hsactivitystorage_p.h Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,152 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this 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& params); + + /** + * 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 1e87eb3b400f -r 0e41c72311af activityfw/activitydatabase/hsactivitydbserver/s60/inc/hsactivityserver_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/hsactivitydbserver/s60/inc/hsactivityserver_p.h Wed Mar 24 13:06:03 2010 +0200 @@ -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 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 1e87eb3b400f -r 0e41c72311af activityfw/activitydatabase/hsactivitydbserver/s60/inc/hsactivitysession_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/hsactivitydbserver/s60/inc/hsactivitysession_p.h Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,155 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this 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 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 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 1e87eb3b400f -r 0e41c72311af activityfw/activitydatabase/hsactivitydbserver/s60/src/hsactivityserver_p.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/hsactivitydbserver/s60/src/hsactivityserver_p.cpp Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,97 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 1e87eb3b400f -r 0e41c72311af activityfw/activitydatabase/hsactivitydbserver/s60/src/hsactivitysession_p.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/hsactivitydbserver/s60/src/hsactivitysession_p.cpp Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,286 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 + +const char ActivityPrimaryKeyFormat [] = "%1:%2"; +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +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(); + + int errNo(KErrNone); + 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 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::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::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 1e87eb3b400f -r 0e41c72311af activityfw/activitydatabase/hsactivitydbserver/s60/src/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/hsactivitydbserver/s60/src/main.cpp Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Application entry point +* +*/ +#include +#include + +#include "hsactivityserver.h" +#include "hsactivitystorage.h" + + + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + HsActivityStorage storage; + HsActivityServer server(storage); + int retVal(KErrGeneral); + if( server.start() ){ + RProcess::Rendezvous(KErrNone); + retVal = app.exec(); + }else + RProcess::Rendezvous(retVal); + return retVal; +} diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activitydatabase/hsactivitydbserver/src/hsactivityserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/hsactivitydbserver/src/hsactivityserver.cpp Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: 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 1e87eb3b400f -r 0e41c72311af activityfw/activitydatabase/hsactivitydbserver/src/hsactivitystorage.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/hsactivitydbserver/src/hsactivitystorage.cpp Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,110 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 1e87eb3b400f -r 0e41c72311af activityfw/activitydatabase/hsactivitydbserver/src/hsactivitystorage_p.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/hsactivitydbserver/src/hsactivitystorage_p.cpp Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,345 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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& params) +{ + 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 1e87eb3b400f -r 0e41c72311af activityfw/activitydatabase/hsactivitydbserver/src/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/hsactivitydbserver/src/main.cpp Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Application entry point +* +*/ +#include +#include + +#include "hsactivityserver.h" +#include "hsactivitystorage.h" + + + +int main(int argc, char *argv[]) +{ + QCoreApplication app(argc, argv); + HsActivityStorage storage; + HsActivityServer server(storage); + int retVal(KErrGeneral); + if( server.start() ){ + retVal = app.exec(); + } + return retVal; +} diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activitydatabase/inc/hsactivitydbclientinterface.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/inc/hsactivitydbclientinterface.h Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,104 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef HSACTIVITYDBCLIENTINTERFACE_H +#define HSACTIVITYDBCLIENTINTERFACE_H +#include + +/** + * Enumerate supported functions + */ +enum ClientFunctions +{ + AddActivity =0, + UpdateActivity, + RemoveActivity, + RemoveApplicationActivities, + RequestedActivityName, + Activities, + ApplicationActivities, + WaitActivity, + LaunchActivity, + GetData, + CancelWait +}; + +const char ActivityApplicationKeyword [] = ":ApplicationId"; +const char ActivityActivityKeyword [] = ":ActivityName"; + +class HsActivityDbClientInterface +{ +public: + + /** + * Function save provided avtivity in activity storage + * @param activity - activity to store + * @return 0 on succees, error code otherwise + */ + virtual int addActivity(const QVariantHash &activity) =0; + + /** + * Function update exiting activity + * @param activity - filtering rules + * @return 0 on succees, error code otherwise + */ + virtual int updateActivity(const QVariantHash &activity) =0; + + /** + * Function delete activity + * @param activity - filtering rules + * @return 0 on succees, error code otherwise + */ + virtual int removeActivity(const QVariantHash &activity) =0; + + /** + * Function delete activity for application + * @param activity - filtering rules + * @return 0 on succees, error code otherwise + */ + virtual int removeApplicationActivities(const QVariantHash &activity) =0; + + /** + * Function return list of all activity + * @param result - destination list + * @return 0 on succees, error code otherwise + */ + virtual int activities(QList& result) =0; + + /** + * Function return list of all activity + * @param result - destination list, + * @param activity - filtering rules + * @return 0 on succees, error code otherwise + */ + virtual int applicationActivities(QList& result, + const QVariantHash &activity) =0; + + /** + * Function subscribe to activity + * @param activity - filtering rules + * @return 0 on succees, error code otherwise + */ + virtual int waitActivity(const QVariantHash &activity)=0; + + /** + * Function launch application activity + * @param activity - filtering rules + * @return 0 on succees, error code otherwise + */ + virtual int launchActivity(const QVariantHash &activity)=0; +}; +#endif //HSACTIVITYDBCLIENTINTERFACE_H diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activitydatabase/s60/inc/hsactivityglobals.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/s60/inc/hsactivityglobals.h Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef ACTIVITYSYMBIAN_H +#define ACTIVITYSYMBIAN_H + +#include +const TUid KActivityServerUid = {0x200267B4}; +_LIT( KActivityServerName, "hsactivitydbserver" ); +_LIT( KErr400, "Bad Reqest" ); +_LIT( KErr403, "Access denied" ); + +#endif diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activitydatabase/s60/inc/hsserializer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/s60/inc/hsserializer.h Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef HSSERIALIZER_H +#define HSSERIALIZER_H +#include + +/** + * Operator serialize VarinatHash to RBuf8 + */ +RBuf8& operator <<(RBuf8& dst, const QVariantHash& src); + +/** + * Operator deserialize RBuf8 to VarinatHash + */ +QVariantHash& operator <<(QVariantHash& dst, const TDesC8& src); + +/** + * Operator serialize QList to RBuf8 + */ +RBuf8& operator <<(RBuf8& dst, const QList& src); + +/** + * Operator deserialize RBuf8 to QList + */ +QList& operator <<(QList& dst, const TDesC8& src); +#endif diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activitydatabase/s60/src/hsserializer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitydatabase/s60/src/hsserializer.cpp Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,82 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#include "hsserializer.h" + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +RBuf8& operator <<(RBuf8& dst, const QVariantHash& src) +{ + QByteArray buffer; + QDataStream stream(&buffer, QIODevice::WriteOnly); + + QT_TRYCATCH_LEAVING(stream << src); + const int dataLength(buffer.length()); + const unsigned char* dataPtr(reinterpret_cast(buffer.constData())); + if( dst.MaxLength() < dataLength ) { + dst.ReAllocL(dataLength); + } + dst.Copy(dataPtr, dataLength); + return dst; +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +QVariantHash& operator <<(QVariantHash& dst, const TDesC8& src) +{ + QByteArray buffer( QByteArray::fromRawData(reinterpret_cast(src.Ptr()), + src.Length()) ); + + QDataStream stream(&buffer, QIODevice::ReadOnly); + QT_TRYCATCH_LEAVING(stream >> dst); + return dst; +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +RBuf8& operator <<(RBuf8& dst, const QList& src) +{ + QByteArray buffer; + QDataStream stream(&buffer, QIODevice::WriteOnly); + + QT_TRYCATCH_LEAVING(stream << src); + + if( dst.MaxLength() < buffer.length() ) { + dst.ReAllocL(buffer.length()); + } + dst.Copy(reinterpret_cast(buffer.data()), buffer.length()); + return dst; +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +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); + return dst; +} diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activityfw.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activityfw.pro Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,32 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = subdirs + +CONFIG += ordered + +symbian:SUBDIRS += activitydatabase + +SUBDIRS += activityserviceplugin \ + activitylauncher \ + orbitintegration/hbactivityplugin + + + +tests:SUBDIRS += activityserviceplugin/unittests +symbian:SUBDIRS += activityserviceplugin/symbianinstaller + +symbian:include(rom.pri) \ No newline at end of file diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activitylauncher/activitylauncher.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitylauncher/activitylauncher.pro Wed Mar 24 13:06:03 2010 +0200 @@ -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: +# + +TEMPLATE = app + +TARGET = activitylauncher + +CONFIG += hb console mobility +MOBILITY = serviceframework + +SOURCES = main.cpp \ + activitylauncherview.cpp \ + +HEADERS = activitylauncherview.h \ + +symbian { + TARGET.EPOCHEAPSIZE = 0x20000 0x1000000 // 128kB - 16MB +} \ No newline at end of file diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activitylauncher/activitylauncherview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitylauncher/activitylauncherview.cpp Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,107 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#include "activitylauncherview.h" + +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include + +QTM_USE_NAMESPACE + +ActivityLauncherView::ActivityLauncherView(QGraphicsItem *parent) : HbView(parent), mModel(NULL), mActivityManager(NULL) +{ + QServiceManager serviceManager; + mActivityManager = serviceManager.loadInterface("com.nokia.qt.activities.ActivityManager"); + + if (!mActivityManager) { + qFatal("Cannot initialize critical com.nokia.qt.activities.ActivityManager service"); + } + + // create UI + setTitle(tr("Activity launcher")); + QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical); + QGraphicsLinearLayout* statusLayout = new QGraphicsLinearLayout(Qt::Horizontal); + mStatusLabel = new HbLabel(this); + mStatusLabel->setAlignment(Qt::AlignLeft); + statusLayout->setMaximumHeight(15); + + HbLabel* statusHeader = new HbLabel("Status: "); + statusHeader->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum); + statusLayout->addItem(statusHeader); + statusLayout->addItem(mStatusLabel); + + HbGridView* activities = new HbGridView(); + connect(activities, SIGNAL(activated(QModelIndex)), this, SLOT(itemPressed(QModelIndex))); + activities->setRowCount(1); + activities->setColumnCount(1); + + activities->setScrollDirections(Qt::Horizontal); + + mModel = new QStandardItemModel(this); + activities->setModel(mModel); + + layout->addItem(statusLayout); + layout->addItem(activities); + + setLayout(layout); + qApp->installEventFilter(this); + getActivitiesList(); +} + +ActivityLauncherView::~ActivityLauncherView() +{ + delete mActivityManager; +} + +void ActivityLauncherView::getActivitiesList() +{ + mStatusLabel->setPlainText("Fetching activities"); + mCurrentActivities.clear(); + QMetaObject::invokeMethod(mActivityManager, "activitiesList", Q_RETURN_ARG(QList, mCurrentActivities)); + mModel->clear(); + + foreach(const QVariantHash& activityEntry, mCurrentActivities) { + QStandardItem* newItem = new QStandardItem(QIcon(activityEntry.value("screenshot").value()), QString("%1").arg(activityEntry.value(ActivityActivityKeyword).toInt())); + mModel->invisibleRootItem()->appendRow(newItem); + } + mStatusLabel->setPlainText(QString("Ready (%1 activities)").arg(mCurrentActivities.count())); +} + +bool ActivityLauncherView::eventFilter(QObject* obj, QEvent* event) +{ + if (event->type() == QEvent::ApplicationActivate) { + getActivitiesList(); + } + return QObject::eventFilter(obj, event); +} + +void ActivityLauncherView::itemPressed(const QModelIndex& index) +{ + QVariantHash activity = mCurrentActivities.at(index.row()); + int applicationId = activity.value(ActivityApplicationKeyword).toInt(); + QString activityName = activity.value(ActivityActivityKeyword).toString(); + QMetaObject::invokeMethod(mActivityManager, "launchActivity", Q_ARG(int, applicationId), Q_ARG(QString, activityName)); +} diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activitylauncher/activitylauncherview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitylauncher/activitylauncherview.h Wed Mar 24 13:06:03 2010 +0200 @@ -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 ACTIVITYLAUNCHERVIEW_H +#define ACTIVITYLAUNCHERVIEW_H + +#include +#include + +class HbLabel; +class QStandardItemModel; + +class ActivityLauncherView : public HbView +{ + Q_OBJECT + +public: + ActivityLauncherView(QGraphicsItem *parent = 0); + ~ActivityLauncherView(); + +private slots: + void itemPressed(const QModelIndex& index); + +protected: + bool eventFilter(QObject* obj, QEvent* event); + +private: + void getActivitiesList(); + +private: + QStandardItemModel* mModel; + QList mCurrentActivities; + HbLabel* mStatusLabel; + + QObject* mActivityManager; +}; + +#endif // ACTIVITYLAUNCHERVIEW_H diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activitylauncher/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activitylauncher/main.cpp Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include + +#include +#include + +#include "activitylauncherview.h" + +int main(int argc, char *argv[]) +{ + HbApplication app(argc, argv); + + HbMainWindow mainWindow; + ActivityLauncherView mainView; + mainWindow.addView(&mainView); + mainWindow.show(); + + return app.exec(); +} diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activityserviceplugin/activityclient.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activityserviceplugin/activityclient.cpp Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "activityclient.h" +#include "activityclient_p.h" + +ActivityClient::ActivityClient(QObject *parent) : QObject(parent), d_ptr(new ActivityClientPrivate(this)) +{ +} + +ActivityClient::~ActivityClient() +{ +} + +bool ActivityClient::addActivity(const QString &activityId, const QVariant &data, const QVariantHash ¶meters) +{ + return d_ptr->addActivity(activityId, data, parameters); +} + +bool ActivityClient::removeActivity(const QString &activityId) +{ + return d_ptr->removeActivity(activityId); +} + +bool ActivityClient::updateActivity(const QString &activityId, const QVariant &data, const QVariantHash ¶meters) +{ + return d_ptr->updateActivity(activityId, data, parameters); +} + +QList ActivityClient::activities() const +{ + return d_ptr->activities(); +} + +QVariant ActivityClient::activityData(const QString &activityId) const +{ + return d_ptr->activityData(activityId); +} + +bool ActivityClient::waitActivity() +{ + return d_ptr->waitActivity(); +} diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activityserviceplugin/activityclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activityserviceplugin/activityclient.h Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef ACTIVITYCLIENT_H +#define ACTIVITYCLIENT_H + +#include +#include +#include + +class ActivityClientPrivate; + +class ActivityClient : public QObject +{ + +Q_OBJECT + +public: + ActivityClient(QObject *parent = 0); + ~ActivityClient(); + +public slots: + bool addActivity(const QString &activityId, const QVariant &data, const QVariantHash ¶meters); + bool removeActivity(const QString &activityId); + bool updateActivity(const QString &activityId, const QVariant &data, const QVariantHash ¶meters); + QList activities() const; + QVariant activityData(const QString &activityId) const; + bool waitActivity(); + +signals: + void activityRequested(const QString &activityId); + +private: + ActivityClientPrivate *d_ptr; + friend class ActivityClientPrivate; + +}; + +#endif // ACTIVITYCLIENT_H diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activityserviceplugin/activityclient_p.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activityserviceplugin/activityclient_p.cpp Wed Mar 24 13:06:03 2010 +0200 @@ -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: +* +*/ +#include "activityclient_p.h" +#include "activityclient.h" +#include "activitydatastorage.h" +#include + +#include +#include + +ActivityClientPrivate::ActivityClientPrivate(ActivityClient *q) : QObject(q) +{ + mDataStorage = new ActivityDataStorage(); + mServerClient = new HsActivityDbClient(); + mServerClient->connect(); + connect(mServerClient, SIGNAL(activityRequested(QString)), q, SIGNAL(activityRequested(QString))); +} + +ActivityClientPrivate::~ActivityClientPrivate() +{ + delete mServerClient; + delete mDataStorage; +} + +bool ActivityClientPrivate::addActivity(const QString &activityId, const QVariant &data, const QVariantHash ¶meters) +{ + QVariantHash activity(parameters); + mDataStorage->addActivity(activityId, data); + RProcess process; + + activity.insert(ActivityApplicationKeyword, static_cast(process.SecureId().iId)); + activity.insert(ActivityActivityKeyword, activityId); + mServerClient->addActivity(activity); + + // @todo make those operations atomic + // @todo return real result + return true; +} + +bool ActivityClientPrivate::removeActivity(const QString &activityId) +{ + QVariantHash activity; + RProcess process; + activity.insert(ActivityApplicationKeyword, static_cast(process.SecureId().iId)); + activity.insert(ActivityActivityKeyword, activityId); + mDataStorage->removeActivity(activityId); + mServerClient->removeActivity(activity); + // @todo make those operations atomic + // @todo return real result + return true; +} + +bool ActivityClientPrivate::updateActivity(const QString &activityId, const QVariant &data, const QVariantHash ¶meters) +{ + QVariantHash activity(parameters); + RProcess process; + activity.insert(ActivityApplicationKeyword, static_cast(process.SecureId().iId)); + activity.insert(ActivityActivityKeyword, activityId); + mDataStorage->updateActivity(activityId, data); + mServerClient->updateActivity(activity); + // @todo make those operations atomic + // @todo return real result + return true; +} + +QList ActivityClientPrivate::activities() const +{ + QVariantHash activity; + RProcess process; + activity.insert(ActivityApplicationKeyword, static_cast(process.SecureId().iId)); + + QList activities; + + mServerClient->applicationActivities(activities, activity); + return activities; +} + +QVariant ActivityClientPrivate::activityData(const QString &activityId) const +{ + return mDataStorage->activityData(activityId); +} + +bool ActivityClientPrivate::waitActivity() +{ + RProcess process; + QVariantHash activity; + activity.insert(ActivityApplicationKeyword, static_cast(process.SecureId().iId)); + return !mServerClient->waitActivity(activity); +} diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activityserviceplugin/activityclient_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activityserviceplugin/activityclient_p.h Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef ACTIVITYCLIENT_P_H +#define ACTIVITYCLIENT_P_H + +#include +#include +#include +#include + +class ActivityClient; +class ActivityDataStorage; +class ActivityServerClient; +class HsActivityDbClient; + +class ActivityClientPrivate : public QObject +{ + +Q_OBJECT + +public: + ActivityClientPrivate(ActivityClient *q); + ~ActivityClientPrivate(); + +public: + bool addActivity(const QString &activityId, const QVariant &data, const QVariantHash ¶meters); + bool removeActivity(const QString &activityId); + bool updateActivity(const QString &activityId, const QVariant &data, const QVariantHash ¶meters); + QList activities() const; + QVariant activityData(const QString &activityId) const; + bool waitActivity(); + + +private: + ActivityClient* q_ptr; + ActivityDataStorage* mDataStorage; + HsActivityDbClient* mServerClient; +}; + +#endif // ACTIVITYCLIENT_P_H diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activityserviceplugin/activitydatastorage.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activityserviceplugin/activitydatastorage.cpp Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,171 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#include "activitydatastorage.h" + +#include +#include +#include +#include + +const char KConnectionName[] = "ActivityDataStorage"; + +ActivityDataStorage::ActivityDataStorage() +{ + QSqlDatabase database; + if (QSqlDatabase::contains(KConnectionName)) { + database = QSqlDatabase::database(KConnectionName); + } else { + database = QSqlDatabase::addDatabase("QSQLITE", KConnectionName); + database.setDatabaseName("activitydatastorage.db"); + if (!database.open()) { + qFatal(qPrintable(database.lastError().text())); + } + } + + if (!checkTables()) { + recreateTables(); + } +} + +ActivityDataStorage::~ActivityDataStorage() +{ + QSqlDatabase::database(KConnectionName).close(); +} + +bool ActivityDataStorage::addActivity(const QString &activityId, const QVariant &data) +{ + QSqlDatabase database = QSqlDatabase::database(KConnectionName); + + QByteArray streamedData; + { + QDataStream stream(&streamedData, QIODevice::WriteOnly); + stream << data; + } + + // insert data + QSqlQuery query(database); + if (!query.prepare("INSERT INTO Activities(Name, Data) VALUES(:Name, :Data)")) { + qCritical(qPrintable(query.lastError().text())); + return false; + } + query.bindValue(":Name", activityId); + query.bindValue(":Data", streamedData); + if (!query.exec()) { + qCritical(qPrintable(query.lastError().text())); + return false; + } + + return true; +} + +bool ActivityDataStorage::removeActivity(const QString &activityId) +{ + QString sqlCommand = QString("DELETE FROM Activities WHERE Name = '%1'").arg(activityId); + QSqlQuery query(QSqlDatabase::database(KConnectionName)); + if (!query.exec(sqlCommand)) { + qCritical(qPrintable(query.lastError().text())); + return false; + } + return query.numRowsAffected() > 0; +} + +bool ActivityDataStorage::updateActivity(const QString &activityId, const QVariant &data) +{ + QSqlDatabase database = QSqlDatabase::database(KConnectionName); + + QByteArray streamedData; + { + QDataStream stream(&streamedData, QIODevice::WriteOnly); + stream << data; + } + + // update data + QSqlQuery query(database); + if (!query.prepare("UPDATE Activities SET Data = :Data WHERE Name = :Name")) { + qCritical(qPrintable(query.lastError().text())); + return false; + } + query.bindValue(":Data", streamedData); + query.bindValue(":Name", activityId); + if (!query.exec()) { + qCritical(qPrintable(query.lastError().text())); + return false; + } + + return query.numRowsAffected() > 0; +} + +QVariant ActivityDataStorage::activityData(const QString &activityId) const +{ + QSqlDatabase database = QSqlDatabase::database(KConnectionName); + QSqlQuery query(database); + if (!query.exec(QString("SELECT Data FROM Activities WHERE Name = '%1'").arg(activityId))) { + qCritical(qPrintable(query.lastError().text())); + return QVariant(); + } + + QVariant result; + if (query.next()) { + QByteArray data(query.value(0).toByteArray()); + QDataStream stream(&data, QIODevice::ReadOnly); + stream >> result; + } + return result; +} + +bool ActivityDataStorage::checkTables() +{ + QStringList expectedTables("Activities"); + QStringList actualTables = QSqlDatabase::database(KConnectionName).tables(); + return (expectedTables == actualTables); +} + +void ActivityDataStorage::recreateTables() +{ + QSqlDatabase database = QSqlDatabase::database(KConnectionName); + + if (!database.transaction()) { + qFatal(qPrintable(database.lastError().text())); + } + + // drop any existing tables + { + QSqlQuery dropQuery(database); + foreach(const QString &tableName, database.tables()) { + if (!dropQuery.exec(QString("DROP TABLE %1").arg(tableName))) { + qFatal(qPrintable(dropQuery.lastError().text())); + } + } + } + + // create new table + { + QSqlQuery createQuery(database); + QString statement( + "CREATE TABLE Activities(" + "Name TEXT NOT NULL PRIMARY KEY UNIQUE," + "Data BLOB NOT NULL)"); + + if (!createQuery.exec(statement)) { + qFatal(qPrintable(createQuery.lastError().text())); + } + } + + if (!database.commit()) { + qFatal(qPrintable(database.lastError().text())); + } +} diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activityserviceplugin/activitydatastorage.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activityserviceplugin/activitydatastorage.h Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,42 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef ACTIVITYDATASTORAGE_H +#define ACTIVITYDATASTORAGE_H + +#include +#include + +class ActivityDataStorage +{ + +public: + ActivityDataStorage(); + ~ActivityDataStorage(); + +public: + bool addActivity(const QString &activityId, const QVariant &data); + bool removeActivity(const QString &activityId); + bool updateActivity(const QString &activityId, const QVariant &data); + QVariant activityData(const QString &activityId) const; + +private: + bool checkTables(); + void recreateTables(); + +}; + +#endif // ACTIVITYDATASTORAGE_H diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activityserviceplugin/activitymanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activityserviceplugin/activitymanager.cpp Wed Mar 24 13:06:03 2010 +0200 @@ -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 "activitymanager.h" +#include "activitymanager_p.h" + +ActivityManager::ActivityManager(QObject *parent) : QObject(parent), d_ptr(new ActivityManagerPrivate(this)) +{ +} + +ActivityManager::~ActivityManager() +{ +} + +QList ActivityManager::activitiesList() +{ + return d_ptr->activitiesList(); +} + +void ActivityManager::launchActivity(const QString &uri) +{ + d_ptr->launchActivity(uri); +} + +void ActivityManager::launchActivity(int applicationId, const QString &activityId) +{ + d_ptr->launchActivity(applicationId, activityId); +} + +void ActivityManager::removeActivity(int applicationId, const QString &activityId) +{ + d_ptr->removeActivity(applicationId, activityId); +} + +void ActivityManager::removeApplicationActivities(int applicationId) +{ + d_ptr->removeApplicationActivities(applicationId); +} diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activityserviceplugin/activitymanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activityserviceplugin/activitymanager.h Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef ACTIVITYMANAGER_H +#define ACTIVITYMANAGER_H + +#include +#include +#include + +class ActivityManagerPrivate; + +class ActivityManager : public QObject +{ + +Q_OBJECT + +public: + ActivityManager(QObject *parent = 0); + ~ActivityManager(); + +public slots: + 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); + +private: + ActivityManagerPrivate *d_ptr; + + friend class ActivityManagerPrivate; + +}; + +#endif // ACTIVITYMANAGER_H diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activityserviceplugin/activitymanager_p.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activityserviceplugin/activitymanager_p.cpp Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#include "activitymanager_p.h" +#include "activitymanager.h" +#include + +#include +#include + +ActivityManagerPrivate::ActivityManagerPrivate(ActivityManager *q) : QObject(q), q_ptr(q) +{ + mServerClient = new HsActivityDbClient(); + mServerClient->connect(); +} + +ActivityManagerPrivate::~ActivityManagerPrivate() +{ + delete mServerClient; +} + +QList ActivityManagerPrivate::activitiesList() +{ + QList retVal; + mServerClient->activities(retVal); + return retVal; +} + +void ActivityManagerPrivate::launchActivity(const QString &uri) +{ + // @todo use the same parser as in HbApplicationPrivate (if possible) + QRegExp uriMatcher("^appto://(.+)\\?activityname=(.+)$"); + if (uriMatcher.indexIn(uri) != -1) { + QStringList list = uriMatcher.capturedTexts(); + Q_ASSERT(list.count() == 3); + launchActivity(list.at(1).toInt(), list.at(2)); + } else { + qWarning("Activity URI parsing error"); + } +} + +void ActivityManagerPrivate::launchActivity(int applicationId, const QString &activityId) +{ + + ApplicationLauncher applicationLauncher; + if(applicationLauncher.isRunning(applicationId)) { + QVariantHash activity; + activity.insert(ActivityApplicationKeyword, applicationId); + activity.insert(ActivityActivityKeyword, activityId); + mServerClient->launchActivity(activity); + applicationLauncher.bringToForeground(applicationId); + } else { + applicationLauncher.startApplication(applicationId, activityId); + } +} + +void ActivityManagerPrivate::removeActivity(int applicationId, const QString &activityId) +{ + QVariantHash activity; + activity.insert(ActivityApplicationKeyword, applicationId); + activity.insert(ActivityActivityKeyword, activityId); + mServerClient->removeActivity(activity); +} + +void ActivityManagerPrivate::removeApplicationActivities(int applicationId) +{ + QVariantHash activity; + activity.insert(ActivityApplicationKeyword, applicationId); + mServerClient->removeApplicationActivities(activity); +} diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activityserviceplugin/activitymanager_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activityserviceplugin/activitymanager_p.h Wed Mar 24 13:06:03 2010 +0200 @@ -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 ACTIVITYMANAGER_P_H +#define ACTIVITYMANAGER_P_H + +#include +#include +#include +#include "applicationlauncher.h" + +class ActivityManager; +class HsActivityDbClient; + +class ActivityManagerPrivate : public QObject +{ + +Q_OBJECT + +public: + ActivityManagerPrivate(ActivityManager *q); + ~ActivityManagerPrivate(); + +public slots: + 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); + +private: + ActivityManager *q_ptr; + HsActivityDbClient *mServerClient; + + +}; + +#endif // ACTIVITYMANAGER_P_H diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activityserviceplugin/activityserviceplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activityserviceplugin/activityserviceplugin.cpp Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "activityserviceplugin.h" + +#include +#include +#include + +#include "activityclient.h" +#include "activitymanager.h" + +QObject* ActivityServicePlugin::createInstance(const QServiceInterfaceDescriptor &descriptor, QServiceContext *context, QAbstractSecuritySession *session) +{ + Q_UNUSED(context); + Q_UNUSED(session); + + if (descriptor.interfaceName() == "com.nokia.qt.activities.ActivityClient") { + return new ActivityClient(); + } else if (descriptor.interfaceName() == "com.nokia.qt.activities.ActivityManager") { + return new ActivityManager(); + } else { + return NULL; + } +} + +Q_EXPORT_PLUGIN2(activityserviceplugin, ActivityServicePlugin) diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activityserviceplugin/activityserviceplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activityserviceplugin/activityserviceplugin.h Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef ACTIVITYSERVICEPLUGIN_H +#define ACTIVITYSERVICEPLUGIN_H + +#include +#include + +QTM_USE_NAMESPACE + +class ActivityServicePlugin : public QObject, public QServicePluginInterface +{ + Q_OBJECT + Q_INTERFACES(QtMobility::QServicePluginInterface) + +public: + QObject* createInstance(const QServiceInterfaceDescriptor &descriptor, QServiceContext *context, QAbstractSecuritySession *session); + +}; + +#endif //ACTIVITYSERVICEPLUGIN_H diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activityserviceplugin/activityserviceplugin.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activityserviceplugin/activityserviceplugin.pri Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,20 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +CONFIG += mobility +MOBILITY = serviceframework + +QT += sql diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activityserviceplugin/activityserviceplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activityserviceplugin/activityserviceplugin.pro Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,64 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = lib +TARGET = activityserviceplugin + +CONFIG += plugin +include(activityserviceplugin.pri) + +HEADERS += activityserviceplugin.h \ + activitydatastorage.h \ + activityclient.h \ + activityclient_p.h \ + activitymanager.h \ + activitymanager_p.h \ + applicationlauncher.h \ + +SOURCES += activityserviceplugin.cpp \ + activitydatastorage.cpp \ + activityclient.cpp \ + activityclient_p.cpp \ + activitymanager.cpp \ + activitymanager_p.cpp \ + applicationlauncher.cpp \ + +symbian { + INCLUDEPATH += ./s60/ + SOURCES += ./s60/applicationlauncher_p.cpp + + HEADERS += ./s60/applicationlauncher_p.h + + LIBS += -lhsactivitydbclient \ + -lxqutils \ + +} + +win32 { + INCLUDEPATH += ./win/ + SOURCES += ./win/applicationlauncher_p.cpp + + HEADERS += ./win/applicationlauncher_p.h +} + +symbian { + load(data_caging_paths) + TARGET.EPOCALLOWDLLDATA = 1 + TARGET.CAPABILITY = ALL -TCB + + plugin.sources = activityserviceplugin.dll + plugin.path = $$QT_PLUGINS_BASE_DIR +} diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activityserviceplugin/activityserviceplugin.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activityserviceplugin/activityserviceplugin.xml Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,16 @@ + + + ActivityService + activityserviceplugin + Activities service + + com.nokia.qt.activities.ActivityClient + 1.0 + Implementation of ActivityClient + + + com.nokia.qt.activities.ActivityManager + 1.0 + Implementation of ActivityManager + + diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activityserviceplugin/applicationlauncher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activityserviceplugin/applicationlauncher.cpp Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "applicationlauncher.h" +#include "applicationlauncher_p.h" + +ApplicationLauncher::ApplicationLauncher() : d_ptr(new ApplicationLauncherPrivate()) +{ +} + +ApplicationLauncher::~ApplicationLauncher() +{ + delete d_ptr; +} + +bool ApplicationLauncher::isRunning(int applicationId) +{ + return d_ptr->isRunning(applicationId); +} + +void ApplicationLauncher::startApplication(int applicationId, const QString &activityId) +{ + d_ptr->startApplication(applicationId, activityId); +} + +void ApplicationLauncher::bringToForeground(int applicationId) +{ + d_ptr->bringToForeground(applicationId); +} diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activityserviceplugin/applicationlauncher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activityserviceplugin/applicationlauncher.h Wed Mar 24 13:06:03 2010 +0200 @@ -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 APPLICATIONLAUNCHER_H +#define APPLICATIONLAUNCHER_H + +class ApplicationLauncherPrivate; + +#include + +class ApplicationLauncher +{ + +public: + ApplicationLauncher(); + ~ApplicationLauncher(); + +public: + bool isRunning(int applicationId); + void startApplication(int applicationId, const QString &activityId); + void bringToForeground(int applicationId); + +private: + ApplicationLauncherPrivate *d_ptr; + +}; + +#endif // APPLICATIONLAUNCHER_H diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activityserviceplugin/s60/activitydatabase_p.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activityserviceplugin/s60/activitydatabase_p.cpp Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,102 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "activitydatabase_p.h" + +#include +#include +#include +#include +#include + + + +ActivityDatabasePrivate::ActivityDatabasePrivate() +{ + mClient.connect(); +} + +ActivityDatabasePrivate::~ActivityDatabasePrivate() +{ +} + +void ActivityDatabasePrivate::saveActivity(const QString &applicationName, const QString &activityName, const QVariantHash &activityMetadata) +{ + QVariantHash request(activityMetadata); + request.insert(ActivityApplicationKeyword,applicationName); + request.insert(ActivityActivityKeyword,activityName); + mClient.saveActivity(request); + +} + +void ActivityDatabasePrivate::deleteActivity(const QString &applicationName, const QString &activityName) +{ + QVariantHash request; + request.insert(ActivityApplicationKeyword,applicationName); + request.insert(ActivityActivityKeyword,activityName); + mClient.deleteActivity(request); +} + +void ActivityDatabasePrivate::deleteApplicationActivities(const QString &applicationName) +{ + QVariantHash request; + request.insert(ActivityApplicationKeyword,applicationName); + mClient.deleteApplicationActivities(request); +} + +QList ActivityDatabasePrivate::allActivitiesList() +{ + QList retVal; + mClient.activities(retVal); + return retVal; +} + +QList ActivityDatabasePrivate::applicationActivitiesList(const QString & applicationName) +{ + QList result; + QVariantHash request; + request.insert(ActivityApplicationKeyword,applicationName); + mClient.applicationActivities(result, request); + return result; +} + + +QString ActivityDatabasePrivate::requestedActivityName(const QString &applicationName) +{ + QString result; + QVariantHash request; + request.insert(ActivityApplicationKeyword,applicationName); + mClient.requestedActivityName(result, request); + return result; +} + +void ActivityDatabasePrivate::setActivityRequestFlag(const QString &applicationName, const QString &activityName) +{ + QVariantHash request; + request.insert(ActivityApplicationKeyword,applicationName); + request.insert(ActivityActivityKeyword,activityName); + mClient.setActivityRequestFlag(request); +} + +void ActivityDatabasePrivate::clearActivityRequestFlag(const QString &applicationName, const QString &activityName) +{ + QVariantHash request; + request.insert(ActivityApplicationKeyword,applicationName); + request.insert(ActivityActivityKeyword,activityName); + mClient.clearActivityRequestFlag(request); +} + diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activityserviceplugin/s60/activitydatabase_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activityserviceplugin/s60/activitydatabase_p.h Wed Mar 24 13:06:03 2010 +0200 @@ -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 ACTIVITYDATABASE_P_H +#define ACTIVITYDATABASE_P_H + +#include +#include +#include +class ActivityDatabasePrivate { + +public: + ActivityDatabasePrivate(); + ~ActivityDatabasePrivate(); + +public: + void saveActivity(const QString &applicationName, const QString &activityName, const QVariantHash &activityMetadata); + void deleteActivity(const QString &applicationName, const QString &activityName); + void deleteApplicationActivities(const QString &applicationName); + QList allActivitiesList(); + QList applicationActivitiesList(const QString &applicationName); + QString requestedActivityName(const QString &applicationName); + void setActivityRequestFlag(const QString &applicationName, const QString &activityName); + void clearActivityRequestFlag(const QString &applicationName, const QString &activityName); + +private: + HsActivityDbClient mClient; +}; + +#endif // ACTIVITYDATABASE_P_H diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activityserviceplugin/s60/activityserverclient_p.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activityserviceplugin/s60/activityserverclient_p.cpp Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "activityserverclient_p.h" + +ActivityServerClientPrivate::ActivityServerClientPrivate() +{ +} + +bool ActivityServerClientPrivate::addActivity(const QString &activityId, const QVariantHash ¶meters) +{ + return true; +} + +bool ActivityServerClientPrivate::removeActivity(const QString &activityId) +{ + return true; +} + +bool ActivityServerClientPrivate::updateActivity(const QString &activityId, const QVariantHash ¶meters) +{ + return true; +} + +QList ActivityServerClientPrivate::applicationActivities() +{ + return QList(); +} + +bool ActivityServerClientPrivate::removeActivity(int applicationId, const QString &activityId) +{ + return true; +} + +bool ActivityServerClientPrivate::removeApplicationActivities(int applicationId) +{ + return true; +} + +QList ActivityServerClientPrivate::activities() +{ + return QList(); +} diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activityserviceplugin/s60/activityserverclient_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activityserviceplugin/s60/activityserverclient_p.h Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,47 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef ACTIVITYSERVERCLIENT_P_H +#define ACTIVITYSERVERCLIENT_P_H + +#include +#include + +class ActivityServerClient; + +class ActivityServerClientPrivate +{ + +public: + ActivityServerClientPrivate(); + +public: // API used by ActivityClient + bool addActivity(const QString &activityId, const QVariantHash ¶meters); + bool removeActivity(const QString &activityId); + bool updateActivity(const QString &activityId, const QVariantHash ¶meters); + QList applicationActivities(); + +public: // API used by ActivityManager + bool removeActivity(int applicationId, const QString &activityId); + bool removeApplicationActivities(int applicationId); + QList activities(); + +public: + ActivityServerClient* q_ptr; + +}; + +#endif // ACTIVITYSERVERCLIENT_P_H diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activityserviceplugin/s60/applicationlauncher_p.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activityserviceplugin/s60/applicationlauncher_p.cpp Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#include "applicationlauncher_p.h" + +#include +#include +#include +#include + +#include + +bool ApplicationLauncherPrivate::isRunning(int applicationId) +{ + TApaTaskList taskList(CEikonEnv::Static()->WsSession()); + TApaTask task = taskList.FindApp(TUid::Uid(applicationId)); + return task.Exists(); +} + +void ApplicationLauncherPrivate::startApplication(int applicationId, const QString &activityId) +{ + QString actId = "\""+activityId+"\""; + QString uri = QString("-activity appto://%1?activityname=%2").arg(uint(applicationId), 8, 16, QChar('0')).arg(actId); + + QT_TRAP_THROWING( + { + HBufC* uriAsDescriptor = XQConversions::qStringToS60Desc(uri); + CleanupStack::PushL(uriAsDescriptor); + + RApaLsSession apaLsSession; + User::LeaveIfError(apaLsSession.Connect()); + CleanupClosePushL(apaLsSession); + + TApaAppInfo appInfo; + TInt retVal = apaLsSession.GetAppInfo(appInfo, TUid::Uid(applicationId)); + + if(retVal == KErrNone) { + RProcess application; + User::LeaveIfError(application.Create(appInfo.iFullName, *uriAsDescriptor)); + application.Resume(); + } else { + // @todo + } + + CleanupStack::PopAndDestroy(&apaLsSession); + CleanupStack::PopAndDestroy(uriAsDescriptor); + } + ); +} + +void ApplicationLauncherPrivate::bringToForeground(int applicationId) +{ + TApaTaskList taskList(CEikonEnv::Static()->WsSession()); + TApaTask task = taskList.FindApp(TUid::Uid(applicationId)); + if (task.Exists()) { + task.BringToForeground(); + } else { + qCritical("Cannot bring to forward task %08x", applicationId); + } +} diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activityserviceplugin/s60/applicationlauncher_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activityserviceplugin/s60/applicationlauncher_p.h Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef APPLICATIONLAUNCHER_P_H +#define APPLICATIONLAUNCHER_P_H + +#include + +class ApplicationLauncherPrivate +{ + +public: + bool isRunning(int applicationId); + void startApplication(int applicationId, const QString &activityId); + void bringToForeground(int applicationId); + +}; + +#endif // APPLICATIONLAUNCHER_P_H diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activityserviceplugin/symbianinstaller/activityserviceinstaller/activityserviceinstaller.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activityserviceplugin/symbianinstaller/activityserviceinstaller/activityserviceinstaller.cpp Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include +#include + +QTM_USE_NAMESPACE + +int main(int argc, char *argv[]) +{ + QCoreApplication app(argc, argv); + + QServiceManager manager; + bool ok = manager.addService(":/activityserviceplugin.xml"); + if ( !ok ) + { + int err = manager.error(); + qFatal("%d ini", err); + } +} diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activityserviceplugin/symbianinstaller/activityserviceinstaller/activityserviceinstaller.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activityserviceplugin/symbianinstaller/activityserviceinstaller/activityserviceinstaller.pro Wed Mar 24 13:06:03 2010 +0200 @@ -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: +# + +TEMPLATE = app + +QT = core +#CONFIG += no_icon + +CONFIG += mobility +MOBILITY = serviceframework + +SOURCES += activityserviceinstaller.cpp + +RESOURCES += activityserviceinstaller.qrc + +symbian { + TARGET.CAPABILITY = ALL -TCB +} diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activityserviceplugin/symbianinstaller/activityserviceinstaller/activityserviceinstaller.qrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activityserviceplugin/symbianinstaller/activityserviceinstaller/activityserviceinstaller.qrc Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,5 @@ + + + ../../activityserviceplugin.xml + + diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activityserviceplugin/symbianinstaller/symbianinstaller.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activityserviceplugin/symbianinstaller/symbianinstaller.pro Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,30 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = subdirs +SUBDIRS = activityserviceinstaller + +symbian { + load(data_caging_paths) + + plugin.sources = activityserviceplugin.dll + plugin.path = $$QT_PLUGINS_BASE_DIR + + installer.pkg_postrules += "\"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/activityserviceinstaller.exe\" \ + - \"!:\sys\bin\activityserviceinstaller.exe\",FR,RB,RW" + + DEPLOYMENT += plugin installer +} diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activityserviceplugin/win/activitydatabase_p.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activityserviceplugin/win/activitydatabase_p.cpp Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,249 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#include "activitydatabase_p.h" + +#include +#include +#include +#include +#include + +#include + +const char KConnectionName[] = "ActivityDatabase"; + +ActivityDatabasePrivate::ActivityDatabasePrivate() +{ + // determine database localization + QSettings settings("nokia", "activities"); + if (!settings.contains("activitydatabase")) { + settings.setValue("activitydatabase", "C:\\activitydatabase.db"); + } + QString databaseFile = settings.value("activitydatabase").toString(); + + QSqlDatabase database; + if (QSqlDatabase::contains(KConnectionName)) { + database = QSqlDatabase::database(KConnectionName); + } else { + database = QSqlDatabase::addDatabase("QSQLITE", KConnectionName); + database.setDatabaseName(databaseFile); + if (!database.open()) { + qFatal(qPrintable(database.lastError().text())); + } + } + + if (!checkTables()) { + recreateTables(); + } +} + +ActivityDatabasePrivate::~ActivityDatabasePrivate() +{ + QSqlDatabase::database(KConnectionName).close(); +} + +void ActivityDatabasePrivate::saveActivity(const QString &applicationName, const QString &activityName, const QVariantHash &activityMetadata) +{ + if (applicationName.isEmpty() || activityName.isEmpty() || activityMetadata.value("screenshot").isNull()) { + qWarning("Activity entry is invalid, aborting save"); + return; + } + + QVariantHash activityData(activityMetadata); + activityData.insert(ActivityApplicationKeyword, applicationName); + activityData.insert(ActivityActivityKeyword, activityName); + + // stream whole entry to bytearray + QByteArray streamedData; + { + QDataStream stream(&streamedData, QIODevice::WriteOnly); + stream << activityData; + } + + QSqlDatabase database = QSqlDatabase::database(KConnectionName); + + if (!database.transaction()) { + qFatal(qPrintable(database.lastError().text())); + } + + // update or insert data + { + QSqlQuery query(database); + if (!query.exec(QString("SELECT ApplicationName FROM Activities WHERE ApplicationName = '%1' AND ActivityName = '%2'").arg(applicationName).arg(activityName))) { + qFatal(qPrintable(query.lastError().text())); + } + + if (query.next()) { + if (!query.prepare("UPDATE Activities SET Data = :Data WHERE ApplicationName = :ApplicationName AND ActivityName = :ActivityName")) { + qFatal(qPrintable(query.lastError().text())); + } + query.bindValue(":Data", streamedData); + query.bindValue(":ApplicationName", applicationName); + query.bindValue(":ActivityName", activityName); + if (!query.exec()) { + qFatal(qPrintable(query.lastError().text())); + } + } else { + if (!query.prepare("INSERT INTO Activities(ApplicationName, ActivityName, Data) VALUES(:ApplicationName, :ActivityName, :Data)")) { + qFatal(qPrintable(query.lastError().text())); + } + query.bindValue(":ApplicationName", applicationName); + query.bindValue(":ActivityName", activityName); + query.bindValue(":Data", streamedData); + if (!query.exec()) { + qFatal(qPrintable(query.lastError().text())); + } + } + } + + if (!database.commit()) { + qFatal(qPrintable(database.lastError().text())); + } +} + +void ActivityDatabasePrivate::deleteActivity(const QString &applicationName, const QString &activityName) +{ + QString sqlCommand = QString("DELETE FROM Activities WHERE ApplicationName = '%1' AND ActivityName = '%2'").arg(applicationName).arg(activityName); + QSqlQuery query(QSqlDatabase::database(KConnectionName)); + if (!query.exec(sqlCommand)) { + qFatal(qPrintable(query.lastError().text())); + } +} + +void ActivityDatabasePrivate::deleteApplicationActivities(const QString &applicationName) +{ + QString sqlCommand = QString("DELETE FROM Activities WHERE ApplicationName = '%1'").arg(applicationName); + QSqlQuery query(QSqlDatabase::database(KConnectionName)); + if (!query.exec(sqlCommand)) { + qFatal(qPrintable(query.lastError().text())); + } +} + +QList ActivityDatabasePrivate::allActivitiesList() +{ + return activitiesList("SELECT Data FROM Activities"); +} + +QList ActivityDatabasePrivate::applicationActivitiesList(const QString &applicationName) +{ + return activitiesList(QString("SELECT Data FROM Activities WHERE ApplicationName = '%1'").arg(applicationName)); +} + +QList ActivityDatabasePrivate::activitiesList(const QString& sqlCommand) +{ + QSqlQuery query(QSqlDatabase::database(KConnectionName)); + if (!query.exec(sqlCommand)) { + qFatal(qPrintable(query.lastError().text())); + } + + QList result; + while (query.next()) { + QVariantHash activityEntry; + { + QByteArray data(query.value(0).toByteArray()); + QDataStream stream(&data, QIODevice::ReadOnly); + stream >> activityEntry; + } + result.append(activityEntry); + } + return result; +} + +QString ActivityDatabasePrivate::requestedActivityName(const QString &applicationName) +{ + QSqlQuery query(QSqlDatabase::database(KConnectionName)); + if (!query.exec(QString("SELECT ActivityName FROM Activities WHERE ApplicationName = '%1' AND RequestFlag").arg(applicationName))) { + qFatal(qPrintable(query.lastError().text())); + } + + QString result; + if (query.next()) { + result = query.value(0).toString(); + } + return result; +} + +void ActivityDatabasePrivate::setActivityRequestFlag(const QString &applicationName, const QString &activityName) +{ + QSqlQuery query(QSqlDatabase::database(KConnectionName)); + + // clear old requests for given application + if (!query.exec(QString("UPDATE Activities SET RequestFlag=0 WHERE ApplicationName = '%1'").arg(applicationName))) { + qFatal(qPrintable(query.lastError().text())); + } + + // set new request + if (!query.exec(QString("UPDATE Activities SET RequestFlag=1 WHERE ApplicationName = '%1' AND ActivityName = '%2'").arg(applicationName).arg(activityName))) { + qFatal(qPrintable(query.lastError().text())); + } +} + +void ActivityDatabasePrivate::clearActivityRequestFlag(const QString &applicationName, const QString &activityName) +{ + QSqlQuery query(QSqlDatabase::database(KConnectionName)); + + // just clear the given request + if (!query.exec(QString("UPDATE Activities SET RequestFlag=0 WHERE ApplicationName = '%1' AND ActivityName = '%2'").arg(applicationName).arg(activityName))) { + qFatal(qPrintable(query.lastError().text())); + } +} + +bool ActivityDatabasePrivate::checkTables() +{ + QStringList expectedTables("Activities"); + QStringList actualTables = QSqlDatabase::database(KConnectionName).tables(); + return (expectedTables == actualTables); +} + +void ActivityDatabasePrivate::recreateTables() +{ + QSqlDatabase database = QSqlDatabase::database(KConnectionName); + + if (!database.transaction()) { + qFatal(qPrintable(database.lastError().text())); + } + + // drop any existing tables + { + QSqlQuery dropQuery(database); + foreach(const QString &tableName, database.tables()) { + if (!dropQuery.exec(QString("DROP TABLE %1").arg(tableName))) { + qFatal(qPrintable(dropQuery.lastError().text())); + } + } + } + + // create new table + { + QSqlQuery createQuery(database); + QString statement( + "CREATE TABLE Activities(" + "ApplicationName TEXT NOT NULL," + "ActivityName TEXT NOT NULL," + "RequestFlag BOOL NOT NULL DEFAULT FALSE," + "Data BLOB NOT NULL," + "PRIMARY KEY(ActivityName, ApplicationName))"); + + if (!createQuery.exec(statement)) { + qFatal(qPrintable(createQuery.lastError().text())); + } + } + + if (!database.commit()) { + qFatal(qPrintable(database.lastError().text())); + } +} diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activityserviceplugin/win/activitydatabase_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activityserviceplugin/win/activitydatabase_p.h Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef ACTIVITYDATABASE_P_H +#define ACTIVITYDATABASE_P_H + +#include +#include + +class ActivityDatabasePrivate { + +public: + ActivityDatabasePrivate(); + ~ActivityDatabasePrivate(); + +public: + void saveActivity(const QString &applicationName, const QString &activityName, const QVariantHash &activityMetadata); + void deleteActivity(const QString &applicationName, const QString &activityName); + void deleteApplicationActivities(const QString &applicationName); + QList allActivitiesList(); + QList applicationActivitiesList(const QString &applicationName); + QString requestedActivityName(const QString &applicationName); + void setActivityRequestFlag(const QString &applicationName, const QString &activityName); + void clearActivityRequestFlag(const QString &applicationName, const QString &activityName); + +private: + QList activitiesList(const QString& sqlCommand); + +private: + bool checkTables(); + void recreateTables(); + +}; + +#endif // ACTIVITYDATABASE_P_H diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activityserviceplugin/win/applicationlauncher_p.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activityserviceplugin/win/applicationlauncher_p.cpp Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#include "applicationlauncher_p.h" +#include + +bool ApplicationLauncherPrivate::isRunning(int applicationId) +{ + // @todo + return true; +} + +void ApplicationLauncherPrivate::startApplication(int applicationId, const QString &activityId) +{ + // @todo +} + +void ApplicationLauncherPrivate::bringToForeground(int applicationId) +{ + // @todo +} diff -r 1e87eb3b400f -r 0e41c72311af activityfw/activityserviceplugin/win/applicationlauncher_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/activityserviceplugin/win/applicationlauncher_p.h Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef APPLICATIONLAUNCHER_P_H +#define APPLICATIONLAUNCHER_P_H + +#include + +class ApplicationLauncherPrivate +{ + +public: + bool isRunning(int applicationId); + void startApplication(int applicationId, const QString &activityId); + void bringToForeground(int applicationId); + +}; + +#endif // APPLICATIONLAUNCHER_P_H diff -r 1e87eb3b400f -r 0e41c72311af activityfw/orbitintegration/hbactivityplugin/hbactivityplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/orbitintegration/hbactivityplugin/hbactivityplugin.cpp Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,112 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 "hbactivityplugininterface.h" +#include "hbactivityplugin.h" + +#include + +QTM_USE_NAMESPACE + +HbActivityPlugin::HbActivityPlugin(QObject *parent) : HbActivityPluginInterface(parent), mActivityClient(0) +{ + QServiceManager serviceManager; + + if (serviceManager.findInterfaces("ActivityService").isEmpty()) { + // clean old entries + serviceManager.removeService("ActivityService"); + bool servicesAdded = serviceManager.addService(":/activityserviceplugin.xml"); + if (!servicesAdded) { + qWarning("addService for ActivityService returned false, error %d", serviceManager.error()); + } + } + + mActivityClient = serviceManager.loadInterface("com.nokia.qt.activities.ActivityClient"); + if (!mActivityClient) { + qWarning("Cannot initialize critical com.nokia.qt.activities.ActivityClient service."); + } + + connect(mActivityClient, SIGNAL(activityRequested(QString)), this, SIGNAL(activityRequested(QString))); +} + +HbActivityPlugin::~HbActivityPlugin() +{ + delete mActivityClient; +} + +bool HbActivityPlugin::addActivity(const QString &activityId, const QVariant &data, const QVariantHash ¶meters) +{ + bool retVal(false); + QMetaObject::invokeMethod(mActivityClient, + "addActivity", + Q_RETURN_ARG(bool, retVal), + Q_ARG(QString, activityId), + Q_ARG(QVariant, data), + Q_ARG(QVariantHash, parameters)); + return retVal; +} + +bool HbActivityPlugin::removeActivity(const QString &activityId) +{ + bool retVal(false); + QMetaObject::invokeMethod(mActivityClient, + "removeActivity", + Q_RETURN_ARG(bool, retVal), + Q_ARG(QString, activityId)); + return retVal; +} + +bool HbActivityPlugin::updateActivity(const QString &activityId, const QVariant &data, const QVariantHash ¶meters) +{ + bool retVal(false); + QMetaObject::invokeMethod(mActivityClient, + "updateActivity", + Q_RETURN_ARG(bool, retVal), + Q_ARG(QString, activityId), + Q_ARG(QVariant, data), + Q_ARG(QVariantHash, parameters)); + return retVal; +} +QList HbActivityPlugin::activities() +{ + QList data; + QMetaObject::invokeMethod(mActivityClient, + "activities", + Q_RETURN_ARG(QList, data)); + return data; +} + +QVariant HbActivityPlugin::activityData(const QString &activityId) +{ + QVariant data; + QMetaObject::invokeMethod(mActivityClient, + "activityData", + Q_RETURN_ARG(QVariant, data), + Q_ARG(QString, activityId)); + return data; +} + +bool HbActivityPlugin::waitActivity() +{ + bool retVal(false); + QMetaObject::invokeMethod(mActivityClient, + "waitActivity", + Q_RETURN_ARG(bool, retVal)); + return retVal; +} + +Q_EXPORT_PLUGIN2(hbactivityplugin, HbActivityPlugin) diff -r 1e87eb3b400f -r 0e41c72311af activityfw/orbitintegration/hbactivityplugin/hbactivityplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/orbitintegration/hbactivityplugin/hbactivityplugin.h Wed Mar 24 13:06:03 2010 +0200 @@ -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 HBACTIVITYPLUGIN_H +#define HBACTIVITYPLUGIN_H + +#include "hbactivityplugininterface.h" + +class HbActivityPlugin : public HbActivityPluginInterface +{ + Q_OBJECT + Q_INTERFACES(HbActivityPluginInterface) + +public: + HbActivityPlugin(QObject *parent = 0); + ~HbActivityPlugin(); + +public: + virtual bool addActivity(const QString &activityId, const QVariant &data, const QVariantHash ¶meters); + virtual bool removeActivity(const QString &activityId); + virtual bool updateActivity(const QString &activityId, const QVariant &data, const QVariantHash ¶meters); + virtual QList activities(); + virtual QVariant activityData(const QString &activityId); + virtual bool waitActivity(); + +private: + QObject *mActivityClient; + +}; + +#endif //HBACTIVITYPLUGIN_H diff -r 1e87eb3b400f -r 0e41c72311af activityfw/orbitintegration/hbactivityplugin/hbactivityplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/orbitintegration/hbactivityplugin/hbactivityplugin.pro Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,40 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = lib +TARGET = hbactivityplugin + +CONFIG += plugin + +CONFIG += mobility +MOBILITY = serviceframework + +HEADERS += hbactivityplugininterface.h \ + hbactivityplugin.h \ + +SOURCES += hbactivityplugin.cpp \ + +RESOURCES += hbactivityplugin.qrc + +symbian { + load(data_caging_paths) + pluginDep.sources = hbactivityplugin.dll + pluginDep.path = $$QT_PLUGINS_BASE_DIR + DEPLOYMENT += pluginDep + + TARGET.EPOCALLOWDLLDATA = 1 + TARGET.CAPABILITY = ALL -TCB +} diff -r 1e87eb3b400f -r 0e41c72311af activityfw/orbitintegration/hbactivityplugin/hbactivityplugin.qrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/orbitintegration/hbactivityplugin/hbactivityplugin.qrc Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,5 @@ + + + ../../activityserviceplugin/activityserviceplugin.xml + + \ No newline at end of file diff -r 1e87eb3b400f -r 0e41c72311af activityfw/orbitintegration/hbactivityplugin/hbactivityplugininterface.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/orbitintegration/hbactivityplugin/hbactivityplugininterface.h Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef 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; + +signals: + void activityRequested(const QString &activityId); + +}; + +Q_DECLARE_INTERFACE(HbActivityPluginInterface, "HbActivityPluginInterface/1.0") + +#endif // HBACTIVITYPLUGININTERFACE_H diff -r 1e87eb3b400f -r 0e41c72311af activityfw/rom.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/rom.pri Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,20 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include " +BLD_INF_RULES.prj_exports += "rom/activitymanager_core.iby CORE_APP_LAYER_IBY_EXPORT_PATH(activitymanager_core.iby)" +BLD_INF_RULES.prj_exports += "./sis/stubs/activitymanager_stub.sis /epoc32/release/winscw/udeb/z/system/install/activitymanager_stub.sis" +BLD_INF_RULES.prj_exports += "./sis/stubs/activitymanager_stub.sis /epoc32/data/z/system/install/activitymanager_stub.sis" \ No newline at end of file diff -r 1e87eb3b400f -r 0e41c72311af activityfw/rom/activitymanager_core.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/rom/activitymanager_core.iby Wed Mar 24 13:06:03 2010 +0200 @@ -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 __TSACTMAN_CORE_IBY__ +#define __TSACTMAN_CORE_IBY__ + +//file=ABI_DIR\BUILD_DIR\activityserviceinstaller.exe PROGRAMS_DIR\activityserviceinstaller.exe +file=ABI_DIR\BUILD_DIR\activityserviceplugin.dll SHARED_LIB_DIR\activityserviceplugin.dll +data=\epoc32\data\z\resource\qt\plugins\activityserviceplugin.qtplugin resource\qt\plugins\activityserviceplugin.qtplugin + +file=ABI_DIR\BUILD_DIR\activitylauncher.exe PROGRAMS_DIR\activitylauncher.exe +data=ZPRIVATE\10003a3f\import\apps\activitylauncher_reg.rsc private\10003a3f\import\apps\activitylauncher_reg.rsc +data=\epoc32\data\z\resource\apps\activitylauncher.rsc resource\apps\activitylauncher.rsc + +file=ABI_DIR\BUILD_DIR\hsactivitydbserver.exe PROGRAMS_DIR\hsactivitydbserver.exe +data=ZPRIVATE\10003a3f\import\apps\hsactivitydbserver_reg.rsc private\10003a3f\import\apps\hsactivitydbserver_reg.rsc +data=\epoc32\data\z\resource\apps\hsactivitydbserver.rsc resource\apps\hsactivitydbserver.rsc + +file=ABI_DIR\BUILD_DIR\hsactivitydbclient.dll SHARED_LIB_DIR\hsactivitydbclient.dll + +file=ABI_DIR\BUILD_DIR\hbactivityplugin.dll SHARED_LIB_DIR\hbactivityplugin.dll +data=\epoc32\data\z\resource\qt\plugins\hbactivityplugin.qtplugin resource\qt\plugins\hbactivityplugin.qtplugin + + +// stub sis +data=ZSYSTEM/install/activitymanager_stub.sis system/install/activitymanager_stub.sis + +#endif //__TSACTMAN_CORE_IBY__ diff -r 1e87eb3b400f -r 0e41c72311af activityfw/sis/activitymanager.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/sis/activitymanager.pkg Wed Mar 24 13:06:03 2010 +0200 @@ -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: +; + +;Language - standard language definitions +&EN + +; standard SIS file header +#{"activitymanager"},(0x200267B4),1,0,0,TYPE=SA, RU + +;Localized Vendor Name +%{"Nokia"} + +;Unique Vendor name +:"Nokia" + + +;"/epoc32/release/armv5/urel/activityserviceinstaller.exe" - "!:\sys\bin\activityserviceinstaller.exe" +"/epoc32/release/armv5/urel/activityserviceplugin.dll"-"!:\sys\bin\activityserviceplugin.dll" +"/epoc32/data/z/resource/qt/plugins/activityserviceplugin.qtplugin"-"!:\resource\qt\plugins\activityserviceplugin.qtplugin" + +"/epoc32/release/armv5/urel/activitylauncher.exe" - "!:\sys\bin\activitylauncher.exe" +"/epoc32/data/z/resource/apps/activitylauncher.rsc" - "!:\resource\apps\activitylauncher.rsc" +"/epoc32/data/z/private/10003a3f/import/apps/activitylauncher_reg.rsc" - "!:\private\10003a3f\import\apps\activitylauncher_reg.rsc" + +"/epoc32/release/armv5/urel/hsactivitydbserver.exe" - "!:\sys\bin\hsactivitydbserver.exe" +"/epoc32/data/z/resource/apps/hsactivitydbserver.rsc" - "!:\resource\apps\hsactivitydbserver.rsc" +"/epoc32/data/z/private/10003a3f/import/apps/hsactivitydbserver_reg.rsc" - "!:\private\10003a3f\import\apps\hsactivitydbserver_reg.rsc" + +"/epoc32/release/armv5/urel/hsactivitydbclient.dll" - "!:\sys\bin\hsactivitydbclient.dll" + +"/epoc32/release/armv5/urel/hbactivityplugin.dll" - "!:\sys\bin\hbactivityplugin.dll" +"/epoc32/data/z/resource/qt/plugins/hbactivityplugin.qtplugin"-"!:\resource\qt\plugins\hbactivityplugin.qtplugin" diff -r 1e87eb3b400f -r 0e41c72311af activityfw/sis/edit_pkg.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/sis/edit_pkg.pl Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,224 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# +#Options: +# -version -adds Qt version (4,6,0) intp pkg files +# -target -replaces $(PLATFORM)/$(TARGET) into armv5/urel +# -test -creates script for test app +# default -version + +use strict; +use File::Find; +my $base = `cd`; +$base =~ s/\\\w+\s+$//; #move one dir upper +my $modulebase = `cd`; +$modulebase =~s/(\s+)$//; #remove linefeed from end +print $base;; +my $qtversion = "\, 4\, 6\, 0\,"; +my $target = "armv5\/urel"; + +my $qtversionchnage = 0; +my $qtversionarg = "-version"; +my $targetchnage = 0; +my $targetarg = "-target"; +my $module = 0; +my $modulearg = "-test"; +my $delmodule = 0; +my $delmodulearg = "-delmodule"; +my $moduledir = "testsis"; +my $modulepath = $base."\\".$moduledir; +my $ccert = $modulebase."\\"."cert.cer"; +my $ckey = $modulebase."\\"."key.pem"; +my $modulebatpath = $modulebase."\\".$moduledir."\\createmodulesis.bat"; + +checkCmdLine(); + +if ( $qtversionchnage == 1 || $targetchnage == 1 ) + { + find( \&edits, $base ); + } +if ( $module == 1 ) + { + system "mkdir $moduledir"; + if ( not ( open (FWM, ">$modulebatpath") ) ) + { + print "\n***Error: Couldn't open $modulebatpath file to write\n"; + return; + } + binmode FWM; + print FWM "del /S/Q *.SIS\r\n"; + print FWM "del /S/Q *.SISX\r\n"; + close FWM; + find( \&moduleSis, $base ); + } +if ( $delmodule == 1 ) + { + find( \&delModuleSis, $base ); + } + +sub edits() + { + my $file=$_; + my $winpath=$File::Find::name; + $winpath=~s/\//\\/g; + if( -f $file && $file=~/(_template\.pkg)$/i ) + { + print "$winpath "; + system "attrib -R $winpath"; + if ( not ( open (FR, $winpath) ) ) + { + print "Error: Couldn't open $winpath file to read\n"; + return; + } + binmode FR; + my $buf=""; + my $length = 0; + $length = -s $winpath; + read( FR, $buf, $length ); + close FR; + if ( $qtversionchnage == 1 ) + { + $buf =~s/\,\s*\,\s*\,\s*\,\s*\{\"Qt\"\}/$qtversion \{\"Qt\"\}/si; + } + if ( $targetchnage == 1 ) + { + $buf =~s/\$\(PLATFORM\)\/\$\(TARGET\)/$target/si; + } + + if ( not ( open (FW, ">$winpath") ) ) + { + print "\n***Error: Couldn't open $winpath file to write\n"; + return; + } + binmode FW; + print FW $buf; + close FW; + + print "\r\n"; + } + } + +sub checkCmdLine() + { + my $numArgs = $#ARGV + 1; + if ( $numArgs == 0 ) + { + $qtversionchnage = 1; + } + else + { + foreach my $argnum ( 0 .. $#ARGV ) + { + my $argName = lc $ARGV[$argnum]; + if ( $argName eq $qtversionarg ) + { + $qtversionchnage = 1; + } + elsif ( $argName eq $targetarg ) + { + $targetchnage = 1; + } + elsif ( $argName eq $modulearg ) + { + $module = 1; + } + elsif ( $argName eq $delmodulearg ) + { + $delmodule = 1; + } + else + { + die "\n***Error: Bad arguments\n"; + } + } + } + } + +sub moduleSis() + { + my $file=$_; + my $winpath=$File::Find::name; + $winpath=~s/\//\\/g; + + + if( -f $file && $file=~/(.*test.*_template\.pkg)$/i ) + { + print "$winpath "; + system "attrib -R $winpath"; + if ( not ( open (FR, $winpath) ) ) + { + print "Error: Couldn't open $winpath file to read\n"; + return; + } + binmode FR; + my $buf=""; + my $length = 0; + $length = -s $winpath; + read( FR, $buf, $length ); + close FR; + $buf =~s/\,\s*\,\s*\,\s*\,\s*\{\"Qt\"\}/$qtversion \{\"Qt\"\}/si; + $buf =~s/\$\(PLATFORM\)\/\$\(TARGET\)/$target/si; + + if ( not ( open (FW, ">$winpath") ) ) + { + print "Error: Couldn't open $winpath file to write\n"; + return; + } + binmode FW; + print FW $buf; + close FW; + print "\r\n"; + + my $pkgname = sisName( $winpath ); + + if ( not ( open (FWM2, ">>$modulebatpath") ) ) + { + print "Error: Couldn't open $modulebatpath file to append\n"; + return; + } + binmode FWM2; + print FWM2 "makesis $winpath $pkgname\.SIS\r\n"; + print FWM2 "signsis $pkgname\.SIS $pkgname\.SISX $ccert $ckey\r\n"; + close FWM2; + } + } + +sub sisName() + { + my $path = shift; + my $name = ""; + if ( $path =~ /\\(\w+)\.pkg/i ) + { + $name = $1; + } + return $name; + } + +sub delModuleSis() + { + my $file=$_; + my $winpath=$File::Find::name; + $winpath=~s/\//\\/g; + + + if( -f $file && $file=~/(_template\.pkg)$/i && ( $file=~/^(t_)/i || $file=~/test/i ) ) + { + print "Deleting: "; + print "$winpath "; + system "attrib -R $winpath"; + system "del /S/Q $winpath"; + print "\r\n"; + } + } \ No newline at end of file diff -r 1e87eb3b400f -r 0e41c72311af activityfw/sis/stubs/activitymanager_stub.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/sis/stubs/activitymanager_stub.pkg Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,50 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +; ------------------------------------------------------------------------------ +; Taskswitcher stub SIS package file. +; Used to enable Taskswitcher to be updated from ROM with a SIS package. +; When you add new files into this stub, please remember to update +; SIS stub with "makesis -s" command. +; ------------------------------------------------------------------------------ +; +;Language - standard language definitions +&EN + +; standard SIS file header +#{"activitymanager"},(0x200267B4),1,0,0,TYPE=SA + +;Localized Vendor Name +%{"Nokia"} + +;Unique Vendor name +:"Nokia" + +;"" - "Z:\sys\bin\activityserviceinstaller.exe" +"" - "Z:\sys\bin\activityserviceplugin.dll" +"" - "Z:\resource\qt\plugins\activityserviceplugin.qtplugin" + +"" - "Z:\sys\bin\activitylauncher.exe" +"" - "Z:\resource\apps\activitylauncher.rsc" +"" - "Z:\private\10003a3f\import\apps\activitylauncher_reg.rsc" + +"" - "Z:\sys\bin\hsactivitydbserver.exe" +"" - "Z:\resource\apps\hsactivitydbserver.rsc" +"" - "Z:\private\10003a3f\import\apps\hsactivitydbserver_reg.rsc" + +"" - "Z:\sys\bin\hsactivitydbclient.dll" + +"" - "Z:\sys\bin\hbactivityplugin.dll" +"" - "Z:\resource\qt\plugins\hbactivityplugin.qtplugin" \ No newline at end of file diff -r 1e87eb3b400f -r 0e41c72311af activityfw/sis/stubs/activitymanager_stub.sis Binary file activityfw/sis/stubs/activitymanager_stub.sis has changed diff -r 1e87eb3b400f -r 0e41c72311af activityfw/sis/stubs/createstubs.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/sis/stubs/createstubs.bat Wed Mar 24 13:06:03 2010 +0200 @@ -0,0 +1,17 @@ +@rem +@rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +@rem All rights reserved. +@rem This component and the accompanying materials are made available +@rem under the terms of "Eclipse Public License v1.0" +@rem which accompanies this distribution, and is available +@rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +@rem +@rem Initial Contributors: +@rem Nokia Corporation - initial contribution. +@rem +@rem Contributors: +@rem +@rem Description: +@rem + +for %%f in (*.pkg) do makesis -s %%f diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activitydatabase/activitydatabase.pro --- a/activitymanager/activitydatabase/activitydatabase.pro Wed Mar 24 03:15:43 2010 +0200 +++ /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 - -SUBDIRS += hsactivitydbclient \ - hsactivitydbserver diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activitydatabase/bwins/hsactivitydbclientu.def --- a/activitymanager/activitydatabase/bwins/hsactivitydbclientu.def Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -EXPORTS - ?launchActivity@HsActivityDbClient@@UAEHABV?$QHash@VQString@@VQVariant@@@@@Z @ 1 NONAME ; int HsActivityDbClient::launchActivity(class QHash const &) - ?connect@HsActivityDbClient@@QAEHXZ @ 2 NONAME ; int HsActivityDbClient::connect(void) - ?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 - ?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 &) - diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activitydatabase/eabi/hsactivitydbclientu.def --- a/activitymanager/activitydatabase/eabi/hsactivitydbclientu.def Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -EXPORTS - _ZN18HsActivityDbClient10activitiesER5QListI5QHashI7QString8QVariantEE @ 1 NONAME - _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 - diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activitydatabase/hsactivitydbclient/hsactivitydbclient.pro --- a/activitymanager/activitydatabase/hsactivitydbclient/hsactivitydbclient.pro Wed Mar 24 03:15:43 2010 +0200 +++ /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: -# - -TEMPLATE = lib -TARGET = hsactivitydbclient - -QT += core \ - sql - -QT -= gui - -HEADERS += inc/hsactivitydbclient.h - -SOURCES += src/hsactivitydbclient.cpp - -DEFINES += ACTIVITY_LIB - -symbian{ -TARGET.UID3 = 0xE467C21E - -HEADERS += ../s60/inc/hsserializer.h \ - s60/inc/hsactivitydbclient_p.h \ - s60/inc/hsactivitydbasyncrequest_p.h - -SOURCES += ../s60/src/hsserializer.cpp \ - s60/src/hsactivitydbclient_p.cpp \ - s60/src/hsactivitydbasyncrequest_p.cpp - - -hsactivitydbclientdll.sources = hsactivitydbclient.dll -hsactivitydbclientdll.path = $$SHARED_LIB_DIR -DEPLOYMENT += hsactivitydbclientdll - -BLD_INF_RULES.prj_exports += "../inc/hsactivitydbclientinterface.h /epoc32/include/hsactivitydbclientinterface.h" \ - "inc/hsactivitydbclient.h /epoc32/include/hsactivitydbclient.h" \ - "inc/hsactivitydbasyncrequestobserver.h /epoc32/include/hsactivitydbasyncrequestobserver.h" -DEPLOYMENT += api -TARGET.CAPABILITY = ALL -TCB -TARGET.EPOCALLOWDLLDATA = 1 -MMP_RULES += EXPORTUNFROZEN -} diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activitydatabase/hsactivitydbclient/inc/hsactivitydbasyncrequestobserver.h --- a/activitymanager/activitydatabase/hsactivitydbclient/inc/hsactivitydbasyncrequestobserver.h Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef HSACTIVITYDBASYNCREQUESTOBSERVER_H -#define HSACTIVITYDBASYNCREQUESTOBSERVER_H -#include -class HsActivityDbAsyncRequestObserver -{ -public: - /** - * Function inform observer about asynchronous request results - * @param result - request result - * @param requestType - request type - * @param data - respons data - */ - virtual void asyncRequestCompleated(int result, - int requestType, - const QString& data)=0; -}; -#endif // HSACTIVITYDBASYNCREQUESTOBSERVER_H diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activitydatabase/hsactivitydbclient/inc/hsactivitydbclient.h --- a/activitymanager/activitydatabase/hsactivitydbclient/inc/hsactivitydbclient.h Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,125 +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 HSACTIVITYDBCLIENT_H -#define HSACTIVITYDBCLIENT_H -#include -#include -#include "hsactivitydbclientinterface.h" - -#ifdef ACTIVITY_LIB - #define ACTIVITY_EXPORT Q_DECL_EXPORT -#else - #define ACTIVITY_EXPORT Q_DECL_IMPORT -#endif - -class HsActivityDbClientPrivate; - -/** - * Class implemets HsActivityDbClientInterface and is responsible for activity data management. - */ -class ACTIVITY_EXPORT HsActivityDbClient: public QObject, - public HsActivityDbClientInterface, - public HsActivityDbAsyncRequestObserver -{ -Q_OBJECT -public: - /** - * Constructor - */ - HsActivityDbClient(QObject* =0); - - /** - * Destructor - */ - ~HsActivityDbClient(); - - /** - * Establish connection with activity server - * @return 0 on succees, error code otherwise - */ - int connect(); - - /** - * Interface implementation. - * @see int HsActivityDbAsyncRequestObserver::asyncRequestCompleated(int, int, const QString&) - */ - void asyncRequestCompleated(int, int, const QString&); - - /** - * Interface implementation. - * @see int HsActivityDbClientInterface::saveActivity(const QVariantHash&) - */ - int addActivity(const QVariantHash &); - - /** - * Interface implementation. - * @see int HsActivityDbClientInterface::updateActivity(const QVariantHash&) - */ - int updateActivity(const QVariantHash &); - - /** - * Interface implementation. - * @see int HsActivityDbClientInterface::deleteActivity(const QVariantHash &) - */ - int removeActivity(const QVariantHash &activity); - - /** - * Interface implementation. - * @see int HsActivityDbClientInterface::deleteApplicationActivities(const QVariantHash &) - */ - int removeApplicationActivities(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 &); - - /** - * Interface implementation. - * @see int HsActivityDbClientInterface::launchActivity(const QVariantHash &) - */ - int launchActivity(const QVariantHash &); -signals: - /** - * Function notify about runtime activity change - * @param activityId - requested activity name - */ - void activityRequested(const QString& activityId); -private: - /** - * Private client implementation. - * Own. - */ - HsActivityDbClientPrivate* d_ptr; -}; - -#endif //HSACTIVITYDBCLIENT_H diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activitydatabase/hsactivitydbclient/s60/inc/hsactivitydbasyncrequest_p.h --- a/activitymanager/activitydatabase/hsactivitydbclient/s60/inc/hsactivitydbasyncrequest_p.h Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +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 HSACTIVITYDBASYNCREQUESTPRIVATE_H -#define HSACTIVITYDBASYNCREQUESTPRIVATE_H -#include -#include -#include - -class HsActivityDbClientPrivate; - -/** - * Class is responsible for async. request handling - */ -class HsActivityDbAsyncRequestPrivate : public CActive - -{ -public: - /** - * First step constructor - */ - static HsActivityDbAsyncRequestPrivate* - NewL(HsActivityDbAsyncRequestObserver &, HsActivityDbClientPrivate &); - - /** - * First step constructor - */ - static HsActivityDbAsyncRequestPrivate* - NewLC(HsActivityDbAsyncRequestObserver &, HsActivityDbClientPrivate &); - - /** - * Destructor - */ - ~HsActivityDbAsyncRequestPrivate(); - - /** - * Function create subscription to current ativity changes - * @param condition - activity filetering rules - */ - void waitActivity(const QVariantHash& condition); -protected: - /** - * Interface implementation. - * @see void CActive::DoCancel() - */ - void DoCancel(); - - /** - * Interface implementation. - * @see void CActive::DoCancel() - */ - void RunL(); -private: - /** - * Constructor - */ - HsActivityDbAsyncRequestPrivate(HsActivityDbAsyncRequestObserver &, - HsActivityDbClientPrivate &); -private: - HsActivityDbAsyncRequestObserver& mObserver; - HsActivityDbClientPrivate& mSession; - int mRequestType; - RBuf8 mDataBuf; - TPckgBuf mDataSize; -}; -#endif // HSACTIVITYDBCLIENTPRIVATE_H diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activitydatabase/hsactivitydbclient/s60/inc/hsactivitydbclient_p.h --- a/activitymanager/activitydatabase/hsactivitydbclient/s60/inc/hsactivitydbclient_p.h Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,178 +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 HSACTIVITYDBCLIENTPRIVATE_H -#define HSACTIVITYDBCLIENTPRIVATE_H -#include "hsactivitydbclientinterface.h" -#include -#include - -class HsActivityDbAsyncRequestPrivate; -/** - * Class implemets HsActivityDbClientInterface and is responsible for - * activity data management on S60 enviroment. - */ -class HsActivityDbClientPrivate : protected RSessionBase, - public HsActivityDbClientInterface -{ -public: - /** - * Constructor - */ - HsActivityDbClientPrivate(HsActivityDbAsyncRequestObserver&); - - /** - * Destructor - */ - ~HsActivityDbClientPrivate(); - - /** - * Function establish connection to activity server - * @return 0 on succees, error code otherwise - */ - int connect(); - - /** - * Interface implementation. - * @see int HsActivityDbClientInterface::addActivity(const QVariantHash &) - */ - int addActivity(const QVariantHash &); - - /** - * 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 &, const QVariantHash &); - - /** - * 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 &); - - /** - * Interface implementation. - * @see int HsActivityDbClientInterface::cancelWaitActivity() - */ - int cancelWaitActivity(); - -public: - /** - * Function get cached data from server - * @param dst - destination, preallocated buffer - */ - void getData(RBuf8 & dst); - - /** - * Function initialize aync request - * @param func - requested function - * @param data - request data - * @param status - request status - */ - void sendDataAsync(int func,const TIpcArgs & data, TRequestStatus& status); - -private: - /** - * Function start activity server process. - * Function can leave on failure. - */ - void startServerL(); - - /** - * Function establish connection to activity server. - * Function can leave on failure - */ - void connectL(); - - /** - * Function execute remote call request. - * @param function - remote function identyfier - * @param activity - remote function parameters - */ - void execSimpleRequestL( int function, const QVariantHash &activity); - - /** - * Function retrieve current activity name for application. - * Function can leave on failure - * @param result - activity name - * @param activity - request filtering rules - */ - void requestedActivityNameL(QString& result, - const QVariantHash &activity); - - /** - * Function retrieve all stored activity - * Function can leave on failure - * @param result - list of activity - */ - void activitiesL(QList& result); - - /** - * Function retrieve all stored activity - * Function can leave on failure - * @param result - list of activity - * @param cond - request conditions - */ - void applicationActivitiesL(QList& result, - const QVariantHash & cond); - - void waitActivityL(const QVariantHash &activity); -private: - /** - * Async request handler - * Own - */ - HsActivityDbAsyncRequestPrivate* mAsyncDataHandler; - -}; -#endif // HSACTIVITYDBCLIENTPRIVATE_H diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activitydatabase/hsactivitydbclient/s60/src/hsactivitydbasyncrequest_p.cpp --- a/activitymanager/activitydatabase/hsactivitydbclient/s60/src/hsactivitydbasyncrequest_p.cpp Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,119 +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 "hsactivitydbasyncrequest_p.h" -#include "hsactivitydbclient_p.h" -#include "hsserializer.h" -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -HsActivityDbAsyncRequestPrivate* - HsActivityDbAsyncRequestPrivate::NewL(HsActivityDbAsyncRequestObserver& observer, - HsActivityDbClientPrivate& session) -{ - HsActivityDbAsyncRequestPrivate* self = - HsActivityDbAsyncRequestPrivate::NewLC(observer, session); - CleanupStack::Pop(self); - return self; -} -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -HsActivityDbAsyncRequestPrivate* - HsActivityDbAsyncRequestPrivate::NewLC(HsActivityDbAsyncRequestObserver& observer, - HsActivityDbClientPrivate& session) -{ - HsActivityDbAsyncRequestPrivate* self = - new (ELeave)HsActivityDbAsyncRequestPrivate(observer, session); - CleanupStack::PushL(self); - self->mDataBuf.CreateL(64); - return self; -} -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -HsActivityDbAsyncRequestPrivate::HsActivityDbAsyncRequestPrivate(HsActivityDbAsyncRequestObserver &observer, - HsActivityDbClientPrivate &session) -: - CActive(EPriorityStandard), - mObserver(observer), - mSession(session), - mRequestType(-1), - mDataSize() -{ - CActiveScheduler::Add(this); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -HsActivityDbAsyncRequestPrivate::~HsActivityDbAsyncRequestPrivate() -{ - mDataBuf.Close(); - Cancel(); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void HsActivityDbAsyncRequestPrivate::DoCancel() -{ - if(IsActive()) { - mSession.cancelWaitActivity(); - } -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void HsActivityDbAsyncRequestPrivate::RunL() -{ - RBuf8 buff; - CleanupClosePushL(buff); - QString data; - int requestResult(iStatus.Int()); - if(KErrNone == requestResult) { - if(0 < mDataSize()) { - buff.CreateL(mDataSize()); - } - mSession.getData(buff); - data = QString::fromAscii(reinterpret_cast(buff.Ptr()), - buff.Length()); - buff.Close(); - } - mObserver.asyncRequestCompleated(requestResult, mRequestType, data); - CleanupStack::PopAndDestroy(&buff); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void HsActivityDbAsyncRequestPrivate::waitActivity(const QVariantHash& condition) -{ - mRequestType = WaitActivity; - iStatus = KRequestPending; - SetActive(); - mDataBuf << condition; - mSession.sendDataAsync(mRequestType, TIpcArgs(&mDataBuf, &mDataSize), iStatus); -} diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activitydatabase/hsactivitydbclient/s60/src/hsactivitydbclient_p.cpp --- a/activitymanager/activitydatabase/hsactivitydbclient/s60/src/hsactivitydbclient_p.cpp Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,301 +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 "hsactivitydbclient_p.h" -#include "hsactivitydbasyncrequest_p.h" -#include "hsactivityglobals.h" -#include "hsserializer.h" - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -HsActivityDbClientPrivate::HsActivityDbClientPrivate(HsActivityDbAsyncRequestObserver& observer) -{ - mAsyncDataHandler = HsActivityDbAsyncRequestPrivate::NewL(observer, *this); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -HsActivityDbClientPrivate::~HsActivityDbClientPrivate() -{ - delete mAsyncDataHandler; - Close(); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -int HsActivityDbClientPrivate::connect() -{ - TRAPD(errNo, connectL()); - return errNo; -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -int HsActivityDbClientPrivate::addActivity(const QVariantHash &activity) -{ - TRAPD( errNo, execSimpleRequestL(AddActivity, activity);) - return errNo; -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -int HsActivityDbClientPrivate::updateActivity(const QVariantHash &activity) -{ - TRAPD( errNo, execSimpleRequestL(UpdateActivity, activity);) - return errNo; -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -int HsActivityDbClientPrivate::removeActivity(const QVariantHash &activity) -{ - TRAPD( errNo, execSimpleRequestL(RemoveActivity, activity);) - return errNo; -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -int HsActivityDbClientPrivate::removeApplicationActivities(const QVariantHash &activity) -{ - TRAPD( errNo, execSimpleRequestL(RemoveApplicationActivities, activity);) - return errNo; -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -int HsActivityDbClientPrivate::activities(QList& result) -{ - TRAPD(errNo, activitiesL(result)); - return errNo; -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -int HsActivityDbClientPrivate::applicationActivities(QList& result, - const QVariantHash & condition) -{ - TRAPD(errNo, applicationActivitiesL(result, condition)); - return errNo; -} - - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -int HsActivityDbClientPrivate::waitActivity(const QVariantHash &activity) -{ - TRAPD( errNo, waitActivityL(activity);) - return errNo; -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -int HsActivityDbClientPrivate::launchActivity(const QVariantHash &activity) -{ - TRAPD( errNo, execSimpleRequestL(LaunchActivity, activity);) - return errNo; -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -int HsActivityDbClientPrivate::cancelWaitActivity() -{ - return SendReceive(CancelWait, TIpcArgs()); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void HsActivityDbClientPrivate::startServerL() -{ - RProcess server; - const TUidType uid(KNullUid, KNullUid, KActivityServerUid); - User::LeaveIfError(server.Create( KActivityServerName, KNullDesC, uid)); - TRequestStatus stat; - server.Rendezvous( stat ); - if ( stat != KRequestPending ) { - server.Kill(0); - } else { - server.Resume(); - } - User::WaitForRequest(stat); - int errNo = (EExitPanic == server.ExitType()) ? - KErrGeneral : stat.Int(); - if(KErrCancel == errNo) { - errNo = KErrNone; - } - server.Close(); - User::LeaveIfError(errNo); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void HsActivityDbClientPrivate::connectL() -{ - const int asyncMessageSlots(4); - const int maxRetry(4); - - TInt retry = maxRetry; - TInt errNo(KErrNone); - do { - errNo = CreateSession( KActivityServerName, TVersion( 0, 0, 0 ), asyncMessageSlots ); - if( KErrNotFound != errNo && KErrServerTerminated != errNo) { - retry =0; - } else { - TRAP(errNo, startServerL()); - if (KErrNone != errNo && KErrAlreadyExists != errNo) { - retry =0; - } - } - } while(--retry > 0); - User::LeaveIfError(errNo); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void HsActivityDbClientPrivate::execSimpleRequestL(int function, const QVariantHash &activity) -{ - RBuf8 data; - CleanupClosePushL(data); - data.CreateL(256); - data << activity; - User::LeaveIfError(SendReceive(function, TIpcArgs(&data))); - 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); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void HsActivityDbClientPrivate::activitiesL(QList& result) -{ - 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))); - result << data; - CleanupStack::PopAndDestroy(&data); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void HsActivityDbClientPrivate::applicationActivitiesL(QList& result, - const QVariantHash & condition) -{ - 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))); - result << data; - CleanupStack::PopAndDestroy(&data); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void HsActivityDbClientPrivate::waitActivityL(const QVariantHash &activity) -{ - if(mAsyncDataHandler->IsActive()) { - User::Leave(KErrServerBusy); - } else { - mAsyncDataHandler->waitActivity(activity); - } -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void HsActivityDbClientPrivate::getData(RBuf8& data) -{ - SendReceive(GetData, TIpcArgs(&data)); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void HsActivityDbClientPrivate::sendDataAsync(int func, - const TIpcArgs &data, - TRequestStatus& status) -{ - SendReceive(func, data, status); -} diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activitydatabase/hsactivitydbclient/src/hsactivitydbclient.cpp --- a/activitymanager/activitydatabase/hsactivitydbclient/src/hsactivitydbclient.cpp Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,138 +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 "hsactivitydbclient.h" -#include "hsactivitydbclient_p.h" - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -HsActivityDbClient::HsActivityDbClient(QObject* obj) -: - QObject(obj), - d_ptr(0) -{ - d_ptr = new HsActivityDbClientPrivate(*this); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -HsActivityDbClient::~HsActivityDbClient() -{ - delete d_ptr; -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -int HsActivityDbClient::connect() -{ - return d_ptr->connect(); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void HsActivityDbClient::asyncRequestCompleated(int result, - int requestType, - const QString& data) -{ - switch(requestType){ - case WaitActivity: - if( KErrNone == result ) { - emit activityRequested(data); - } - break; - } -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -int HsActivityDbClient::addActivity(const QVariantHash &activity) -{ - return d_ptr->addActivity(activity); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -int HsActivityDbClient::updateActivity(const QVariantHash &activity) -{ - return d_ptr->updateActivity(activity); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -int HsActivityDbClient::removeActivity(const QVariantHash &activity) -{ - return d_ptr->removeActivity(activity); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -int HsActivityDbClient::removeApplicationActivities(const QVariantHash &activity) -{ - return d_ptr->removeApplicationActivities(activity); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -int HsActivityDbClient::activities(QList& result) -{ - return d_ptr->activities(result); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -int HsActivityDbClient::applicationActivities(QList & result, - const QVariantHash & conditions) -{ - return d_ptr->applicationActivities(result, conditions); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -int HsActivityDbClient::waitActivity(const QVariantHash &activity) -{ - return d_ptr->waitActivity(activity); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -int HsActivityDbClient::launchActivity(const QVariantHash &activity) -{ - return d_ptr->launchActivity(activity); -} diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activitydatabase/hsactivitydbserver/hsactivitydbserver.pro --- a/activitymanager/activitydatabase/hsactivitydbserver/hsactivitydbserver.pro Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -# -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# - -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 - -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 - -TARGET.CAPABILITY = ALL -TCB -} - diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activitydatabase/hsactivitydbserver/inc/hsactivity.h --- a/activitymanager/activitydatabase/hsactivitydbserver/inc/hsactivity.h Wed Mar 24 03:15:43 2010 +0200 +++ /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 1e87eb3b400f -r 0e41c72311af activitymanager/activitydatabase/hsactivitydbserver/inc/hsactivityserver.h --- a/activitymanager/activitydatabase/hsactivitydbserver/inc/hsactivityserver.h Wed Mar 24 03:15:43 2010 +0200 +++ /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 1e87eb3b400f -r 0e41c72311af activitymanager/activitydatabase/hsactivitydbserver/inc/hsactivitystorage.h --- a/activitymanager/activitydatabase/hsactivitydbserver/inc/hsactivitystorage.h Wed Mar 24 03:15:43 2010 +0200 +++ /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 1e87eb3b400f -r 0e41c72311af activitymanager/activitydatabase/hsactivitydbserver/inc/hsactivitystorage_p.h --- a/activitymanager/activitydatabase/hsactivitydbserver/inc/hsactivitystorage_p.h Wed Mar 24 03:15:43 2010 +0200 +++ /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& params); - - /** - * 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 1e87eb3b400f -r 0e41c72311af activitymanager/activitydatabase/hsactivitydbserver/s60/inc/hsactivityserver_p.h --- a/activitymanager/activitydatabase/hsactivitydbserver/s60/inc/hsactivityserver_p.h Wed Mar 24 03:15:43 2010 +0200 +++ /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 1e87eb3b400f -r 0e41c72311af activitymanager/activitydatabase/hsactivitydbserver/s60/inc/hsactivitysession_p.h --- a/activitymanager/activitydatabase/hsactivitydbserver/s60/inc/hsactivitysession_p.h Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,155 +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 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 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 1e87eb3b400f -r 0e41c72311af activitymanager/activitydatabase/hsactivitydbserver/s60/src/hsactivityserver_p.cpp --- a/activitymanager/activitydatabase/hsactivitydbserver/s60/src/hsactivityserver_p.cpp Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,97 +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 1e87eb3b400f -r 0e41c72311af activitymanager/activitydatabase/hsactivitydbserver/s60/src/hsactivitysession_p.cpp --- a/activitymanager/activitydatabase/hsactivitydbserver/s60/src/hsactivitysession_p.cpp Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,286 +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 - -const char ActivityPrimaryKeyFormat [] = "%1:%2"; -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -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(); - - int errNo(KErrNone); - 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 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::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::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 1e87eb3b400f -r 0e41c72311af activitymanager/activitydatabase/hsactivitydbserver/s60/src/main.cpp --- a/activitymanager/activitydatabase/hsactivitydbserver/s60/src/main.cpp Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Application entry point -* -*/ -#include -#include - -#include "hsactivityserver.h" -#include "hsactivitystorage.h" - - - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - HsActivityStorage storage; - HsActivityServer server(storage); - int retVal(KErrGeneral); - if( server.start() ){ - RProcess::Rendezvous(KErrNone); - retVal = app.exec(); - }else - RProcess::Rendezvous(retVal); - return retVal; -} diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activitydatabase/hsactivitydbserver/src/hsactivityserver.cpp --- a/activitymanager/activitydatabase/hsactivitydbserver/src/hsactivityserver.cpp Wed Mar 24 03:15:43 2010 +0200 +++ /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 1e87eb3b400f -r 0e41c72311af activitymanager/activitydatabase/hsactivitydbserver/src/hsactivitystorage.cpp --- a/activitymanager/activitydatabase/hsactivitydbserver/src/hsactivitystorage.cpp Wed Mar 24 03:15:43 2010 +0200 +++ /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 1e87eb3b400f -r 0e41c72311af activitymanager/activitydatabase/hsactivitydbserver/src/hsactivitystorage_p.cpp --- a/activitymanager/activitydatabase/hsactivitydbserver/src/hsactivitystorage_p.cpp Wed Mar 24 03:15:43 2010 +0200 +++ /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& params) -{ - 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 1e87eb3b400f -r 0e41c72311af activitymanager/activitydatabase/hsactivitydbserver/src/main.cpp --- a/activitymanager/activitydatabase/hsactivitydbserver/src/main.cpp Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Application entry point -* -*/ -#include -#include - -#include "hsactivityserver.h" -#include "hsactivitystorage.h" - - - -int main(int argc, char *argv[]) -{ - QCoreApplication app(argc, argv); - HsActivityStorage storage; - HsActivityServer server(storage); - int retVal(KErrGeneral); - if( server.start() ){ - retVal = app.exec(); - } - return retVal; -} diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activitydatabase/inc/hsactivitydbclientinterface.h --- a/activitymanager/activitydatabase/inc/hsactivitydbclientinterface.h Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,104 +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 HSACTIVITYDBCLIENTINTERFACE_H -#define HSACTIVITYDBCLIENTINTERFACE_H -#include - -/** - * Enumerate supported functions - */ -enum ClientFunctions -{ - AddActivity =0, - UpdateActivity, - RemoveActivity, - RemoveApplicationActivities, - RequestedActivityName, - Activities, - ApplicationActivities, - WaitActivity, - LaunchActivity, - GetData, - CancelWait -}; - -const char ActivityApplicationKeyword [] = ":ApplicationId"; -const char ActivityActivityKeyword [] = ":ActivityName"; - -class HsActivityDbClientInterface -{ -public: - - /** - * Function save provided avtivity in activity storage - * @param activity - activity to store - * @return 0 on succees, error code otherwise - */ - virtual int addActivity(const QVariantHash &activity) =0; - - /** - * Function update exiting activity - * @param activity - filtering rules - * @return 0 on succees, error code otherwise - */ - virtual int updateActivity(const QVariantHash &activity) =0; - - /** - * Function delete activity - * @param activity - filtering rules - * @return 0 on succees, error code otherwise - */ - virtual int removeActivity(const QVariantHash &activity) =0; - - /** - * Function delete activity for application - * @param activity - filtering rules - * @return 0 on succees, error code otherwise - */ - virtual int removeApplicationActivities(const QVariantHash &activity) =0; - - /** - * Function return list of all activity - * @param result - destination list - * @return 0 on succees, error code otherwise - */ - virtual int activities(QList& result) =0; - - /** - * Function return list of all activity - * @param result - destination list, - * @param activity - filtering rules - * @return 0 on succees, error code otherwise - */ - virtual int applicationActivities(QList& result, - const QVariantHash &activity) =0; - - /** - * Function subscribe to activity - * @param activity - filtering rules - * @return 0 on succees, error code otherwise - */ - virtual int waitActivity(const QVariantHash &activity)=0; - - /** - * Function launch application activity - * @param activity - filtering rules - * @return 0 on succees, error code otherwise - */ - virtual int launchActivity(const QVariantHash &activity)=0; -}; -#endif //HSACTIVITYDBCLIENTINTERFACE_H diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activitydatabase/s60/inc/hsactivityglobals.h --- a/activitymanager/activitydatabase/s60/inc/hsactivityglobals.h Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -#ifndef ACTIVITYSYMBIAN_H -#define ACTIVITYSYMBIAN_H - -#include -const TUid KActivityServerUid = {0x200267B4}; -_LIT( KActivityServerName, "hsactivitydbserver" ); -_LIT( KErr400, "Bad Reqest" ); -_LIT( KErr403, "Access denied" ); - -#endif diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activitydatabase/s60/inc/hsserializer.h --- a/activitymanager/activitydatabase/s60/inc/hsserializer.h Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +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 HSSERIALIZER_H -#define HSSERIALIZER_H -#include - -/** - * Operator serialize VarinatHash to RBuf8 - */ -RBuf8& operator <<(RBuf8& dst, const QVariantHash& src); - -/** - * Operator deserialize RBuf8 to VarinatHash - */ -QVariantHash& operator <<(QVariantHash& dst, const TDesC8& src); - -/** - * Operator serialize QList to RBuf8 - */ -RBuf8& operator <<(RBuf8& dst, const QList& src); - -/** - * Operator deserialize RBuf8 to QList - */ -QList& operator <<(QList& dst, const TDesC8& src); -#endif diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activitydatabase/s60/src/hsserializer.cpp --- a/activitymanager/activitydatabase/s60/src/hsserializer.cpp Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,82 +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 "hsserializer.h" - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -RBuf8& operator <<(RBuf8& dst, const QVariantHash& src) -{ - QByteArray buffer; - QDataStream stream(&buffer, QIODevice::WriteOnly); - - QT_TRYCATCH_LEAVING(stream << src); - const int dataLength(buffer.length()); - const unsigned char* dataPtr(reinterpret_cast(buffer.constData())); - if( dst.MaxLength() < dataLength ) { - dst.ReAllocL(dataLength); - } - dst.Copy(dataPtr, dataLength); - return dst; -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -QVariantHash& operator <<(QVariantHash& dst, const TDesC8& src) -{ - QByteArray buffer( QByteArray::fromRawData(reinterpret_cast(src.Ptr()), - src.Length()) ); - - QDataStream stream(&buffer, QIODevice::ReadOnly); - QT_TRYCATCH_LEAVING(stream >> dst); - return dst; -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -RBuf8& operator <<(RBuf8& dst, const QList& src) -{ - QByteArray buffer; - QDataStream stream(&buffer, QIODevice::WriteOnly); - - QT_TRYCATCH_LEAVING(stream << src); - - if( dst.MaxLength() < buffer.length() ) { - dst.ReAllocL(buffer.length()); - } - dst.Copy(reinterpret_cast(buffer.data()), buffer.length()); - return dst; -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -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); - return dst; -} diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activitylauncher/activitylauncher.pro --- a/activitymanager/activitylauncher/activitylauncher.pro Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -# -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# - -TEMPLATE = app - -TARGET = activitylauncher - -CONFIG += hb console mobility -MOBILITY = serviceframework - -SOURCES = main.cpp \ - activitylauncherview.cpp \ - -HEADERS = activitylauncherview.h \ - -symbian { - TARGET.EPOCHEAPSIZE = 0x20000 0x1000000 // 128kB - 16MB -} \ No newline at end of file diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activitylauncher/activitylauncherview.cpp --- a/activitymanager/activitylauncher/activitylauncherview.cpp Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -#include "activitylauncherview.h" - -#include -#include -#include - -#include - -#include -#include -#include -#include - -#include - -QTM_USE_NAMESPACE - -ActivityLauncherView::ActivityLauncherView(QGraphicsItem *parent) : HbView(parent), mModel(NULL), mActivityManager(NULL) -{ - QServiceManager serviceManager; - mActivityManager = serviceManager.loadInterface("com.nokia.qt.activities.ActivityManager"); - - if (!mActivityManager) { - qFatal("Cannot initialize critical com.nokia.qt.activities.ActivityManager service"); - } - - // create UI - setTitle(tr("Activity launcher")); - QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical); - QGraphicsLinearLayout* statusLayout = new QGraphicsLinearLayout(Qt::Horizontal); - mStatusLabel = new HbLabel(this); - mStatusLabel->setAlignment(Qt::AlignLeft); - statusLayout->setMaximumHeight(15); - - HbLabel* statusHeader = new HbLabel("Status: "); - statusHeader->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum); - statusLayout->addItem(statusHeader); - statusLayout->addItem(mStatusLabel); - - HbGridView* activities = new HbGridView(); - connect(activities, SIGNAL(activated(QModelIndex)), this, SLOT(itemPressed(QModelIndex))); - activities->setRowCount(1); - activities->setColumnCount(1); - - activities->setScrollDirections(Qt::Horizontal); - - mModel = new QStandardItemModel(this); - activities->setModel(mModel); - - layout->addItem(statusLayout); - layout->addItem(activities); - - setLayout(layout); - qApp->installEventFilter(this); - getActivitiesList(); -} - -ActivityLauncherView::~ActivityLauncherView() -{ - delete mActivityManager; -} - -void ActivityLauncherView::getActivitiesList() -{ - mStatusLabel->setPlainText("Fetching activities"); - mCurrentActivities.clear(); - QMetaObject::invokeMethod(mActivityManager, "activitiesList", Q_RETURN_ARG(QList, mCurrentActivities)); - mModel->clear(); - - foreach(const QVariantHash& activityEntry, mCurrentActivities) { - QStandardItem* newItem = new QStandardItem(QIcon(activityEntry.value("screenshot").value()), QString("%1").arg(activityEntry.value(ActivityActivityKeyword).toInt())); - mModel->invisibleRootItem()->appendRow(newItem); - } - mStatusLabel->setPlainText(QString("Ready (%1 activities)").arg(mCurrentActivities.count())); -} - -bool ActivityLauncherView::eventFilter(QObject* obj, QEvent* event) -{ - if (event->type() == QEvent::ApplicationActivate) { - getActivitiesList(); - } - return QObject::eventFilter(obj, event); -} - -void ActivityLauncherView::itemPressed(const QModelIndex& index) -{ - QVariantHash activity = mCurrentActivities.at(index.row()); - int applicationId = activity.value(ActivityApplicationKeyword).toInt(); - QString activityName = activity.value(ActivityActivityKeyword).toString(); - QMetaObject::invokeMethod(mActivityManager, "launchActivity", Q_ARG(int, applicationId), Q_ARG(QString, activityName)); -} diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activitylauncher/activitylauncherview.h --- a/activitymanager/activitylauncher/activitylauncherview.h Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -#ifndef ACTIVITYLAUNCHERVIEW_H -#define ACTIVITYLAUNCHERVIEW_H - -#include -#include - -class HbLabel; -class QStandardItemModel; - -class ActivityLauncherView : public HbView -{ - Q_OBJECT - -public: - ActivityLauncherView(QGraphicsItem *parent = 0); - ~ActivityLauncherView(); - -private slots: - void itemPressed(const QModelIndex& index); - -protected: - bool eventFilter(QObject* obj, QEvent* event); - -private: - void getActivitiesList(); - -private: - QStandardItemModel* mModel; - QList mCurrentActivities; - HbLabel* mStatusLabel; - - QObject* mActivityManager; -}; - -#endif // ACTIVITYLAUNCHERVIEW_H diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activitylauncher/main.cpp --- a/activitymanager/activitylauncher/main.cpp Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include - -#include -#include - -#include "activitylauncherview.h" - -int main(int argc, char *argv[]) -{ - HbApplication app(argc, argv); - - HbMainWindow mainWindow; - ActivityLauncherView mainView; - mainWindow.addView(&mainView); - mainWindow.show(); - - return app.exec(); -} diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activitymanager.pro --- a/activitymanager/activitymanager.pro Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -# -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# - -TEMPLATE = subdirs - -CONFIG += ordered - -symbian:SUBDIRS += activitydatabase - -SUBDIRS += activityserviceplugin \ - activitylauncher \ - orbitintegration/hbactivityplugin - - - -tests:SUBDIRS += activityserviceplugin/unittests -symbian:SUBDIRS += activityserviceplugin/symbianinstaller - -symbian:include(rom.pri) \ No newline at end of file diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activityserviceplugin/activityclient.cpp --- a/activitymanager/activityserviceplugin/activityclient.cpp Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "activityclient.h" -#include "activityclient_p.h" - -ActivityClient::ActivityClient(QObject *parent) : QObject(parent), d_ptr(new ActivityClientPrivate(this)) -{ -} - -ActivityClient::~ActivityClient() -{ -} - -bool ActivityClient::addActivity(const QString &activityId, const QVariant &data, const QVariantHash ¶meters) -{ - return d_ptr->addActivity(activityId, data, parameters); -} - -bool ActivityClient::removeActivity(const QString &activityId) -{ - return d_ptr->removeActivity(activityId); -} - -bool ActivityClient::updateActivity(const QString &activityId, const QVariant &data, const QVariantHash ¶meters) -{ - return d_ptr->updateActivity(activityId, data, parameters); -} - -QList ActivityClient::activities() const -{ - return d_ptr->activities(); -} - -QVariant ActivityClient::activityData(const QString &activityId) const -{ - return d_ptr->activityData(activityId); -} - -bool ActivityClient::waitActivity() -{ - return d_ptr->waitActivity(); -} diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activityserviceplugin/activityclient.h --- a/activitymanager/activityserviceplugin/activityclient.h Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -#ifndef ACTIVITYCLIENT_H -#define ACTIVITYCLIENT_H - -#include -#include -#include - -class ActivityClientPrivate; - -class ActivityClient : public QObject -{ - -Q_OBJECT - -public: - ActivityClient(QObject *parent = 0); - ~ActivityClient(); - -public slots: - bool addActivity(const QString &activityId, const QVariant &data, const QVariantHash ¶meters); - bool removeActivity(const QString &activityId); - bool updateActivity(const QString &activityId, const QVariant &data, const QVariantHash ¶meters); - QList activities() const; - QVariant activityData(const QString &activityId) const; - bool waitActivity(); - -signals: - void activityRequested(const QString &activityId); - -private: - ActivityClientPrivate *d_ptr; - friend class ActivityClientPrivate; - -}; - -#endif // ACTIVITYCLIENT_H diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activityserviceplugin/activityclient_p.cpp --- a/activitymanager/activityserviceplugin/activityclient_p.cpp Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -#include "activityclient_p.h" -#include "activityclient.h" -#include "activitydatastorage.h" -#include - -#include -#include - -ActivityClientPrivate::ActivityClientPrivate(ActivityClient *q) : QObject(q) -{ - mDataStorage = new ActivityDataStorage(); - mServerClient = new HsActivityDbClient(); - mServerClient->connect(); - connect(mServerClient, SIGNAL(activityRequested(QString)), q, SIGNAL(activityRequested(QString))); -} - -ActivityClientPrivate::~ActivityClientPrivate() -{ - delete mServerClient; - delete mDataStorage; -} - -bool ActivityClientPrivate::addActivity(const QString &activityId, const QVariant &data, const QVariantHash ¶meters) -{ - QVariantHash activity(parameters); - mDataStorage->addActivity(activityId, data); - RProcess process; - - activity.insert(ActivityApplicationKeyword, static_cast(process.SecureId().iId)); - activity.insert(ActivityActivityKeyword, activityId); - mServerClient->addActivity(activity); - - // @todo make those operations atomic - // @todo return real result - return true; -} - -bool ActivityClientPrivate::removeActivity(const QString &activityId) -{ - QVariantHash activity; - RProcess process; - activity.insert(ActivityApplicationKeyword, static_cast(process.SecureId().iId)); - activity.insert(ActivityActivityKeyword, activityId); - mDataStorage->removeActivity(activityId); - mServerClient->removeActivity(activity); - // @todo make those operations atomic - // @todo return real result - return true; -} - -bool ActivityClientPrivate::updateActivity(const QString &activityId, const QVariant &data, const QVariantHash ¶meters) -{ - QVariantHash activity(parameters); - RProcess process; - activity.insert(ActivityApplicationKeyword, static_cast(process.SecureId().iId)); - activity.insert(ActivityActivityKeyword, activityId); - mDataStorage->updateActivity(activityId, data); - mServerClient->updateActivity(activity); - // @todo make those operations atomic - // @todo return real result - return true; -} - -QList ActivityClientPrivate::activities() const -{ - QVariantHash activity; - RProcess process; - activity.insert(ActivityApplicationKeyword, static_cast(process.SecureId().iId)); - - QList activities; - - mServerClient->applicationActivities(activities, activity); - return activities; -} - -QVariant ActivityClientPrivate::activityData(const QString &activityId) const -{ - return mDataStorage->activityData(activityId); -} - -bool ActivityClientPrivate::waitActivity() -{ - RProcess process; - QVariantHash activity; - activity.insert(ActivityApplicationKeyword, static_cast(process.SecureId().iId)); - return !mServerClient->waitActivity(activity); -} diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activityserviceplugin/activityclient_p.h --- a/activitymanager/activityserviceplugin/activityclient_p.h Wed Mar 24 03:15:43 2010 +0200 +++ /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 ACTIVITYCLIENT_P_H -#define ACTIVITYCLIENT_P_H - -#include -#include -#include -#include - -class ActivityClient; -class ActivityDataStorage; -class ActivityServerClient; -class HsActivityDbClient; - -class ActivityClientPrivate : public QObject -{ - -Q_OBJECT - -public: - ActivityClientPrivate(ActivityClient *q); - ~ActivityClientPrivate(); - -public: - bool addActivity(const QString &activityId, const QVariant &data, const QVariantHash ¶meters); - bool removeActivity(const QString &activityId); - bool updateActivity(const QString &activityId, const QVariant &data, const QVariantHash ¶meters); - QList activities() const; - QVariant activityData(const QString &activityId) const; - bool waitActivity(); - - -private: - ActivityClient* q_ptr; - ActivityDataStorage* mDataStorage; - HsActivityDbClient* mServerClient; -}; - -#endif // ACTIVITYCLIENT_P_H diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activityserviceplugin/activitydatastorage.cpp --- a/activitymanager/activityserviceplugin/activitydatastorage.cpp Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,171 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -#include "activitydatastorage.h" - -#include -#include -#include -#include - -const char KConnectionName[] = "ActivityDataStorage"; - -ActivityDataStorage::ActivityDataStorage() -{ - QSqlDatabase database; - if (QSqlDatabase::contains(KConnectionName)) { - database = QSqlDatabase::database(KConnectionName); - } else { - database = QSqlDatabase::addDatabase("QSQLITE", KConnectionName); - database.setDatabaseName("activitydatastorage.db"); - if (!database.open()) { - qFatal(qPrintable(database.lastError().text())); - } - } - - if (!checkTables()) { - recreateTables(); - } -} - -ActivityDataStorage::~ActivityDataStorage() -{ - QSqlDatabase::database(KConnectionName).close(); -} - -bool ActivityDataStorage::addActivity(const QString &activityId, const QVariant &data) -{ - QSqlDatabase database = QSqlDatabase::database(KConnectionName); - - QByteArray streamedData; - { - QDataStream stream(&streamedData, QIODevice::WriteOnly); - stream << data; - } - - // insert data - QSqlQuery query(database); - if (!query.prepare("INSERT INTO Activities(Name, Data) VALUES(:Name, :Data)")) { - qCritical(qPrintable(query.lastError().text())); - return false; - } - query.bindValue(":Name", activityId); - query.bindValue(":Data", streamedData); - if (!query.exec()) { - qCritical(qPrintable(query.lastError().text())); - return false; - } - - return true; -} - -bool ActivityDataStorage::removeActivity(const QString &activityId) -{ - QString sqlCommand = QString("DELETE FROM Activities WHERE Name = '%1'").arg(activityId); - QSqlQuery query(QSqlDatabase::database(KConnectionName)); - if (!query.exec(sqlCommand)) { - qCritical(qPrintable(query.lastError().text())); - return false; - } - return query.numRowsAffected() > 0; -} - -bool ActivityDataStorage::updateActivity(const QString &activityId, const QVariant &data) -{ - QSqlDatabase database = QSqlDatabase::database(KConnectionName); - - QByteArray streamedData; - { - QDataStream stream(&streamedData, QIODevice::WriteOnly); - stream << data; - } - - // update data - QSqlQuery query(database); - if (!query.prepare("UPDATE Activities SET Data = :Data WHERE Name = :Name")) { - qCritical(qPrintable(query.lastError().text())); - return false; - } - query.bindValue(":Data", streamedData); - query.bindValue(":Name", activityId); - if (!query.exec()) { - qCritical(qPrintable(query.lastError().text())); - return false; - } - - return query.numRowsAffected() > 0; -} - -QVariant ActivityDataStorage::activityData(const QString &activityId) const -{ - QSqlDatabase database = QSqlDatabase::database(KConnectionName); - QSqlQuery query(database); - if (!query.exec(QString("SELECT Data FROM Activities WHERE Name = '%1'").arg(activityId))) { - qCritical(qPrintable(query.lastError().text())); - return QVariant(); - } - - QVariant result; - if (query.next()) { - QByteArray data(query.value(0).toByteArray()); - QDataStream stream(&data, QIODevice::ReadOnly); - stream >> result; - } - return result; -} - -bool ActivityDataStorage::checkTables() -{ - QStringList expectedTables("Activities"); - QStringList actualTables = QSqlDatabase::database(KConnectionName).tables(); - return (expectedTables == actualTables); -} - -void ActivityDataStorage::recreateTables() -{ - QSqlDatabase database = QSqlDatabase::database(KConnectionName); - - if (!database.transaction()) { - qFatal(qPrintable(database.lastError().text())); - } - - // drop any existing tables - { - QSqlQuery dropQuery(database); - foreach(const QString &tableName, database.tables()) { - if (!dropQuery.exec(QString("DROP TABLE %1").arg(tableName))) { - qFatal(qPrintable(dropQuery.lastError().text())); - } - } - } - - // create new table - { - QSqlQuery createQuery(database); - QString statement( - "CREATE TABLE Activities(" - "Name TEXT NOT NULL PRIMARY KEY UNIQUE," - "Data BLOB NOT NULL)"); - - if (!createQuery.exec(statement)) { - qFatal(qPrintable(createQuery.lastError().text())); - } - } - - if (!database.commit()) { - qFatal(qPrintable(database.lastError().text())); - } -} diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activityserviceplugin/activitydatastorage.h --- a/activitymanager/activityserviceplugin/activitydatastorage.h Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -#ifndef ACTIVITYDATASTORAGE_H -#define ACTIVITYDATASTORAGE_H - -#include -#include - -class ActivityDataStorage -{ - -public: - ActivityDataStorage(); - ~ActivityDataStorage(); - -public: - bool addActivity(const QString &activityId, const QVariant &data); - bool removeActivity(const QString &activityId); - bool updateActivity(const QString &activityId, const QVariant &data); - QVariant activityData(const QString &activityId) const; - -private: - bool checkTables(); - void recreateTables(); - -}; - -#endif // ACTIVITYDATASTORAGE_H diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activityserviceplugin/activitymanager.cpp --- a/activitymanager/activityserviceplugin/activitymanager.cpp Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "activitymanager.h" -#include "activitymanager_p.h" - -ActivityManager::ActivityManager(QObject *parent) : QObject(parent), d_ptr(new ActivityManagerPrivate(this)) -{ -} - -ActivityManager::~ActivityManager() -{ -} - -QList ActivityManager::activitiesList() -{ - return d_ptr->activitiesList(); -} - -void ActivityManager::launchActivity(const QString &uri) -{ - d_ptr->launchActivity(uri); -} - -void ActivityManager::launchActivity(int applicationId, const QString &activityId) -{ - d_ptr->launchActivity(applicationId, activityId); -} - -void ActivityManager::removeActivity(int applicationId, const QString &activityId) -{ - d_ptr->removeActivity(applicationId, activityId); -} - -void ActivityManager::removeApplicationActivities(int applicationId) -{ - d_ptr->removeApplicationActivities(applicationId); -} diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activityserviceplugin/activitymanager.h --- a/activitymanager/activityserviceplugin/activitymanager.h Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -#ifndef ACTIVITYMANAGER_H -#define ACTIVITYMANAGER_H - -#include -#include -#include - -class ActivityManagerPrivate; - -class ActivityManager : public QObject -{ - -Q_OBJECT - -public: - ActivityManager(QObject *parent = 0); - ~ActivityManager(); - -public slots: - 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); - -private: - ActivityManagerPrivate *d_ptr; - - friend class ActivityManagerPrivate; - -}; - -#endif // ACTIVITYMANAGER_H diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activityserviceplugin/activitymanager_p.cpp --- a/activitymanager/activityserviceplugin/activitymanager_p.cpp Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -#include "activitymanager_p.h" -#include "activitymanager.h" -#include - -#include -#include - -ActivityManagerPrivate::ActivityManagerPrivate(ActivityManager *q) : QObject(q), q_ptr(q) -{ - mServerClient = new HsActivityDbClient(); - mServerClient->connect(); -} - -ActivityManagerPrivate::~ActivityManagerPrivate() -{ - delete mServerClient; -} - -QList ActivityManagerPrivate::activitiesList() -{ - QList retVal; - mServerClient->activities(retVal); - return retVal; -} - -void ActivityManagerPrivate::launchActivity(const QString &uri) -{ - // @todo use the same parser as in HbApplicationPrivate (if possible) - QRegExp uriMatcher("^appto://(.+)\\?activityname=(.+)$"); - if (uriMatcher.indexIn(uri) != -1) { - QStringList list = uriMatcher.capturedTexts(); - Q_ASSERT(list.count() == 3); - launchActivity(list.at(1).toInt(), list.at(2)); - } else { - qWarning("Activity URI parsing error"); - } -} - -void ActivityManagerPrivate::launchActivity(int applicationId, const QString &activityId) -{ - - ApplicationLauncher applicationLauncher; - if(applicationLauncher.isRunning(applicationId)) { - QVariantHash activity; - activity.insert(ActivityApplicationKeyword, applicationId); - activity.insert(ActivityActivityKeyword, activityId); - mServerClient->launchActivity(activity); - applicationLauncher.bringToForeground(applicationId); - } else { - applicationLauncher.startApplication(applicationId, activityId); - } -} - -void ActivityManagerPrivate::removeActivity(int applicationId, const QString &activityId) -{ - QVariantHash activity; - activity.insert(ActivityApplicationKeyword, applicationId); - activity.insert(ActivityActivityKeyword, activityId); - mServerClient->removeActivity(activity); -} - -void ActivityManagerPrivate::removeApplicationActivities(int applicationId) -{ - QVariantHash activity; - activity.insert(ActivityApplicationKeyword, applicationId); - mServerClient->removeApplicationActivities(activity); -} diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activityserviceplugin/activitymanager_p.h --- a/activitymanager/activityserviceplugin/activitymanager_p.h Wed Mar 24 03:15:43 2010 +0200 +++ /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 ACTIVITYMANAGER_P_H -#define ACTIVITYMANAGER_P_H - -#include -#include -#include -#include "applicationlauncher.h" - -class ActivityManager; -class HsActivityDbClient; - -class ActivityManagerPrivate : public QObject -{ - -Q_OBJECT - -public: - ActivityManagerPrivate(ActivityManager *q); - ~ActivityManagerPrivate(); - -public slots: - 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); - -private: - ActivityManager *q_ptr; - HsActivityDbClient *mServerClient; - - -}; - -#endif // ACTIVITYMANAGER_P_H diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activityserviceplugin/activityserviceplugin.cpp --- a/activitymanager/activityserviceplugin/activityserviceplugin.cpp Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "activityserviceplugin.h" - -#include -#include -#include - -#include "activityclient.h" -#include "activitymanager.h" - -QObject* ActivityServicePlugin::createInstance(const QServiceInterfaceDescriptor &descriptor, QServiceContext *context, QAbstractSecuritySession *session) -{ - Q_UNUSED(context); - Q_UNUSED(session); - - if (descriptor.interfaceName() == "com.nokia.qt.activities.ActivityClient") { - return new ActivityClient(); - } else if (descriptor.interfaceName() == "com.nokia.qt.activities.ActivityManager") { - return new ActivityManager(); - } else { - return NULL; - } -} - -Q_EXPORT_PLUGIN2(activityserviceplugin, ActivityServicePlugin) diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activityserviceplugin/activityserviceplugin.h --- a/activitymanager/activityserviceplugin/activityserviceplugin.h Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -#ifndef ACTIVITYSERVICEPLUGIN_H -#define ACTIVITYSERVICEPLUGIN_H - -#include -#include - -QTM_USE_NAMESPACE - -class ActivityServicePlugin : public QObject, public QServicePluginInterface -{ - Q_OBJECT - Q_INTERFACES(QtMobility::QServicePluginInterface) - -public: - QObject* createInstance(const QServiceInterfaceDescriptor &descriptor, QServiceContext *context, QAbstractSecuritySession *session); - -}; - -#endif //ACTIVITYSERVICEPLUGIN_H diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activityserviceplugin/activityserviceplugin.pri --- a/activitymanager/activityserviceplugin/activityserviceplugin.pri Wed Mar 24 03:15:43 2010 +0200 +++ /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: -# - -CONFIG += mobility -MOBILITY = serviceframework - -QT += sql diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activityserviceplugin/activityserviceplugin.pro --- a/activitymanager/activityserviceplugin/activityserviceplugin.pro Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -# -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# - -TEMPLATE = lib -TARGET = activityserviceplugin - -CONFIG += plugin -include(activityserviceplugin.pri) - -HEADERS += activityserviceplugin.h \ - activitydatastorage.h \ - activityclient.h \ - activityclient_p.h \ - activitymanager.h \ - activitymanager_p.h \ - applicationlauncher.h \ - -SOURCES += activityserviceplugin.cpp \ - activitydatastorage.cpp \ - activityclient.cpp \ - activityclient_p.cpp \ - activitymanager.cpp \ - activitymanager_p.cpp \ - applicationlauncher.cpp \ - -symbian { - INCLUDEPATH += ./s60/ - SOURCES += ./s60/applicationlauncher_p.cpp - - HEADERS += ./s60/applicationlauncher_p.h - - LIBS += -lhsactivitydbclient \ - -lxqutils \ - -} - -win32 { - INCLUDEPATH += ./win/ - SOURCES += ./win/applicationlauncher_p.cpp - - HEADERS += ./win/applicationlauncher_p.h -} - -symbian { - load(data_caging_paths) - TARGET.EPOCALLOWDLLDATA = 1 - TARGET.CAPABILITY = ALL -TCB - - plugin.sources = activityserviceplugin.dll - plugin.path = $$QT_PLUGINS_BASE_DIR -} diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activityserviceplugin/activityserviceplugin.xml --- a/activitymanager/activityserviceplugin/activityserviceplugin.xml Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ - - - ActivityService - activityserviceplugin - Activities service - - com.nokia.qt.activities.ActivityClient - 1.0 - Implementation of ActivityClient - - - com.nokia.qt.activities.ActivityManager - 1.0 - Implementation of ActivityManager - - diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activityserviceplugin/applicationlauncher.cpp --- a/activitymanager/activityserviceplugin/applicationlauncher.cpp Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "applicationlauncher.h" -#include "applicationlauncher_p.h" - -ApplicationLauncher::ApplicationLauncher() : d_ptr(new ApplicationLauncherPrivate()) -{ -} - -ApplicationLauncher::~ApplicationLauncher() -{ - delete d_ptr; -} - -bool ApplicationLauncher::isRunning(int applicationId) -{ - return d_ptr->isRunning(applicationId); -} - -void ApplicationLauncher::startApplication(int applicationId, const QString &activityId) -{ - d_ptr->startApplication(applicationId, activityId); -} - -void ApplicationLauncher::bringToForeground(int applicationId) -{ - d_ptr->bringToForeground(applicationId); -} diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activityserviceplugin/applicationlauncher.h --- a/activitymanager/activityserviceplugin/applicationlauncher.h Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -#ifndef APPLICATIONLAUNCHER_H -#define APPLICATIONLAUNCHER_H - -class ApplicationLauncherPrivate; - -#include - -class ApplicationLauncher -{ - -public: - ApplicationLauncher(); - ~ApplicationLauncher(); - -public: - bool isRunning(int applicationId); - void startApplication(int applicationId, const QString &activityId); - void bringToForeground(int applicationId); - -private: - ApplicationLauncherPrivate *d_ptr; - -}; - -#endif // APPLICATIONLAUNCHER_H diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activityserviceplugin/s60/activitydatabase_p.cpp --- a/activitymanager/activityserviceplugin/s60/activitydatabase_p.cpp Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "activitydatabase_p.h" - -#include -#include -#include -#include -#include - - - -ActivityDatabasePrivate::ActivityDatabasePrivate() -{ - mClient.connect(); -} - -ActivityDatabasePrivate::~ActivityDatabasePrivate() -{ -} - -void ActivityDatabasePrivate::saveActivity(const QString &applicationName, const QString &activityName, const QVariantHash &activityMetadata) -{ - QVariantHash request(activityMetadata); - request.insert(ActivityApplicationKeyword,applicationName); - request.insert(ActivityActivityKeyword,activityName); - mClient.saveActivity(request); - -} - -void ActivityDatabasePrivate::deleteActivity(const QString &applicationName, const QString &activityName) -{ - QVariantHash request; - request.insert(ActivityApplicationKeyword,applicationName); - request.insert(ActivityActivityKeyword,activityName); - mClient.deleteActivity(request); -} - -void ActivityDatabasePrivate::deleteApplicationActivities(const QString &applicationName) -{ - QVariantHash request; - request.insert(ActivityApplicationKeyword,applicationName); - mClient.deleteApplicationActivities(request); -} - -QList ActivityDatabasePrivate::allActivitiesList() -{ - QList retVal; - mClient.activities(retVal); - return retVal; -} - -QList ActivityDatabasePrivate::applicationActivitiesList(const QString & applicationName) -{ - QList result; - QVariantHash request; - request.insert(ActivityApplicationKeyword,applicationName); - mClient.applicationActivities(result, request); - return result; -} - - -QString ActivityDatabasePrivate::requestedActivityName(const QString &applicationName) -{ - QString result; - QVariantHash request; - request.insert(ActivityApplicationKeyword,applicationName); - mClient.requestedActivityName(result, request); - return result; -} - -void ActivityDatabasePrivate::setActivityRequestFlag(const QString &applicationName, const QString &activityName) -{ - QVariantHash request; - request.insert(ActivityApplicationKeyword,applicationName); - request.insert(ActivityActivityKeyword,activityName); - mClient.setActivityRequestFlag(request); -} - -void ActivityDatabasePrivate::clearActivityRequestFlag(const QString &applicationName, const QString &activityName) -{ - QVariantHash request; - request.insert(ActivityApplicationKeyword,applicationName); - request.insert(ActivityActivityKeyword,activityName); - mClient.clearActivityRequestFlag(request); -} - diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activityserviceplugin/s60/activitydatabase_p.h --- a/activitymanager/activityserviceplugin/s60/activitydatabase_p.h Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -#ifndef ACTIVITYDATABASE_P_H -#define ACTIVITYDATABASE_P_H - -#include -#include -#include -class ActivityDatabasePrivate { - -public: - ActivityDatabasePrivate(); - ~ActivityDatabasePrivate(); - -public: - void saveActivity(const QString &applicationName, const QString &activityName, const QVariantHash &activityMetadata); - void deleteActivity(const QString &applicationName, const QString &activityName); - void deleteApplicationActivities(const QString &applicationName); - QList allActivitiesList(); - QList applicationActivitiesList(const QString &applicationName); - QString requestedActivityName(const QString &applicationName); - void setActivityRequestFlag(const QString &applicationName, const QString &activityName); - void clearActivityRequestFlag(const QString &applicationName, const QString &activityName); - -private: - HsActivityDbClient mClient; -}; - -#endif // ACTIVITYDATABASE_P_H diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activityserviceplugin/s60/activityserverclient_p.cpp --- a/activitymanager/activityserviceplugin/s60/activityserverclient_p.cpp Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "activityserverclient_p.h" - -ActivityServerClientPrivate::ActivityServerClientPrivate() -{ -} - -bool ActivityServerClientPrivate::addActivity(const QString &activityId, const QVariantHash ¶meters) -{ - return true; -} - -bool ActivityServerClientPrivate::removeActivity(const QString &activityId) -{ - return true; -} - -bool ActivityServerClientPrivate::updateActivity(const QString &activityId, const QVariantHash ¶meters) -{ - return true; -} - -QList ActivityServerClientPrivate::applicationActivities() -{ - return QList(); -} - -bool ActivityServerClientPrivate::removeActivity(int applicationId, const QString &activityId) -{ - return true; -} - -bool ActivityServerClientPrivate::removeApplicationActivities(int applicationId) -{ - return true; -} - -QList ActivityServerClientPrivate::activities() -{ - return QList(); -} diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activityserviceplugin/s60/activityserverclient_p.h --- a/activitymanager/activityserviceplugin/s60/activityserverclient_p.h Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -#ifndef ACTIVITYSERVERCLIENT_P_H -#define ACTIVITYSERVERCLIENT_P_H - -#include -#include - -class ActivityServerClient; - -class ActivityServerClientPrivate -{ - -public: - ActivityServerClientPrivate(); - -public: // API used by ActivityClient - bool addActivity(const QString &activityId, const QVariantHash ¶meters); - bool removeActivity(const QString &activityId); - bool updateActivity(const QString &activityId, const QVariantHash ¶meters); - QList applicationActivities(); - -public: // API used by ActivityManager - bool removeActivity(int applicationId, const QString &activityId); - bool removeApplicationActivities(int applicationId); - QList activities(); - -public: - ActivityServerClient* q_ptr; - -}; - -#endif // ACTIVITYSERVERCLIENT_P_H diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activityserviceplugin/s60/applicationlauncher_p.cpp --- a/activitymanager/activityserviceplugin/s60/applicationlauncher_p.cpp Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -#include "applicationlauncher_p.h" - -#include -#include -#include -#include - -#include - -bool ApplicationLauncherPrivate::isRunning(int applicationId) -{ - TApaTaskList taskList(CEikonEnv::Static()->WsSession()); - TApaTask task = taskList.FindApp(TUid::Uid(applicationId)); - return task.Exists(); -} - -void ApplicationLauncherPrivate::startApplication(int applicationId, const QString &activityId) -{ - QString actId = "\""+activityId+"\""; - QString uri = QString("-activity appto://%1?activityname=%2").arg(uint(applicationId), 8, 16, QChar('0')).arg(actId); - - QT_TRAP_THROWING( - { - HBufC* uriAsDescriptor = XQConversions::qStringToS60Desc(uri); - CleanupStack::PushL(uriAsDescriptor); - - RApaLsSession apaLsSession; - User::LeaveIfError(apaLsSession.Connect()); - CleanupClosePushL(apaLsSession); - - TApaAppInfo appInfo; - TInt retVal = apaLsSession.GetAppInfo(appInfo, TUid::Uid(applicationId)); - - if(retVal == KErrNone) { - RProcess application; - User::LeaveIfError(application.Create(appInfo.iFullName, *uriAsDescriptor)); - application.Resume(); - } else { - // @todo - } - - CleanupStack::PopAndDestroy(&apaLsSession); - CleanupStack::PopAndDestroy(uriAsDescriptor); - } - ); -} - -void ApplicationLauncherPrivate::bringToForeground(int applicationId) -{ - TApaTaskList taskList(CEikonEnv::Static()->WsSession()); - TApaTask task = taskList.FindApp(TUid::Uid(applicationId)); - if (task.Exists()) { - task.BringToForeground(); - } else { - qCritical("Cannot bring to forward task %08x", applicationId); - } -} diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activityserviceplugin/s60/applicationlauncher_p.h --- a/activitymanager/activityserviceplugin/s60/applicationlauncher_p.h Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -#ifndef APPLICATIONLAUNCHER_P_H -#define APPLICATIONLAUNCHER_P_H - -#include - -class ApplicationLauncherPrivate -{ - -public: - bool isRunning(int applicationId); - void startApplication(int applicationId, const QString &activityId); - void bringToForeground(int applicationId); - -}; - -#endif // APPLICATIONLAUNCHER_P_H diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activityserviceplugin/symbianinstaller/activityserviceinstaller/activityserviceinstaller.cpp --- a/activitymanager/activityserviceplugin/symbianinstaller/activityserviceinstaller/activityserviceinstaller.cpp Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include - -QTM_USE_NAMESPACE - -int main(int argc, char *argv[]) -{ - QCoreApplication app(argc, argv); - - QServiceManager manager; - bool ok = manager.addService(":/activityserviceplugin.xml"); - if ( !ok ) - { - int err = manager.error(); - qFatal("%d ini", err); - } -} diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activityserviceplugin/symbianinstaller/activityserviceinstaller/activityserviceinstaller.pro --- a/activitymanager/activityserviceplugin/symbianinstaller/activityserviceinstaller/activityserviceinstaller.pro Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -# -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# - -TEMPLATE = app - -QT = core -#CONFIG += no_icon - -CONFIG += mobility -MOBILITY = serviceframework - -SOURCES += activityserviceinstaller.cpp - -RESOURCES += activityserviceinstaller.qrc - -symbian { - TARGET.CAPABILITY = ALL -TCB -} diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activityserviceplugin/symbianinstaller/activityserviceinstaller/activityserviceinstaller.qrc --- a/activitymanager/activityserviceplugin/symbianinstaller/activityserviceinstaller/activityserviceinstaller.qrc Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ - - - ../../activityserviceplugin.xml - - diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activityserviceplugin/symbianinstaller/symbianinstaller.pro --- a/activitymanager/activityserviceplugin/symbianinstaller/symbianinstaller.pro Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -# -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# - -TEMPLATE = subdirs -SUBDIRS = activityserviceinstaller - -symbian { - load(data_caging_paths) - - plugin.sources = activityserviceplugin.dll - plugin.path = $$QT_PLUGINS_BASE_DIR - - installer.pkg_postrules += "\"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/activityserviceinstaller.exe\" \ - - \"!:\sys\bin\activityserviceinstaller.exe\",FR,RB,RW" - - DEPLOYMENT += plugin installer -} diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activityserviceplugin/win/activitydatabase_p.cpp --- a/activitymanager/activityserviceplugin/win/activitydatabase_p.cpp Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,249 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -#include "activitydatabase_p.h" - -#include -#include -#include -#include -#include - -#include - -const char KConnectionName[] = "ActivityDatabase"; - -ActivityDatabasePrivate::ActivityDatabasePrivate() -{ - // determine database localization - QSettings settings("nokia", "activities"); - if (!settings.contains("activitydatabase")) { - settings.setValue("activitydatabase", "C:\\activitydatabase.db"); - } - QString databaseFile = settings.value("activitydatabase").toString(); - - QSqlDatabase database; - if (QSqlDatabase::contains(KConnectionName)) { - database = QSqlDatabase::database(KConnectionName); - } else { - database = QSqlDatabase::addDatabase("QSQLITE", KConnectionName); - database.setDatabaseName(databaseFile); - if (!database.open()) { - qFatal(qPrintable(database.lastError().text())); - } - } - - if (!checkTables()) { - recreateTables(); - } -} - -ActivityDatabasePrivate::~ActivityDatabasePrivate() -{ - QSqlDatabase::database(KConnectionName).close(); -} - -void ActivityDatabasePrivate::saveActivity(const QString &applicationName, const QString &activityName, const QVariantHash &activityMetadata) -{ - if (applicationName.isEmpty() || activityName.isEmpty() || activityMetadata.value("screenshot").isNull()) { - qWarning("Activity entry is invalid, aborting save"); - return; - } - - QVariantHash activityData(activityMetadata); - activityData.insert(ActivityApplicationKeyword, applicationName); - activityData.insert(ActivityActivityKeyword, activityName); - - // stream whole entry to bytearray - QByteArray streamedData; - { - QDataStream stream(&streamedData, QIODevice::WriteOnly); - stream << activityData; - } - - QSqlDatabase database = QSqlDatabase::database(KConnectionName); - - if (!database.transaction()) { - qFatal(qPrintable(database.lastError().text())); - } - - // update or insert data - { - QSqlQuery query(database); - if (!query.exec(QString("SELECT ApplicationName FROM Activities WHERE ApplicationName = '%1' AND ActivityName = '%2'").arg(applicationName).arg(activityName))) { - qFatal(qPrintable(query.lastError().text())); - } - - if (query.next()) { - if (!query.prepare("UPDATE Activities SET Data = :Data WHERE ApplicationName = :ApplicationName AND ActivityName = :ActivityName")) { - qFatal(qPrintable(query.lastError().text())); - } - query.bindValue(":Data", streamedData); - query.bindValue(":ApplicationName", applicationName); - query.bindValue(":ActivityName", activityName); - if (!query.exec()) { - qFatal(qPrintable(query.lastError().text())); - } - } else { - if (!query.prepare("INSERT INTO Activities(ApplicationName, ActivityName, Data) VALUES(:ApplicationName, :ActivityName, :Data)")) { - qFatal(qPrintable(query.lastError().text())); - } - query.bindValue(":ApplicationName", applicationName); - query.bindValue(":ActivityName", activityName); - query.bindValue(":Data", streamedData); - if (!query.exec()) { - qFatal(qPrintable(query.lastError().text())); - } - } - } - - if (!database.commit()) { - qFatal(qPrintable(database.lastError().text())); - } -} - -void ActivityDatabasePrivate::deleteActivity(const QString &applicationName, const QString &activityName) -{ - QString sqlCommand = QString("DELETE FROM Activities WHERE ApplicationName = '%1' AND ActivityName = '%2'").arg(applicationName).arg(activityName); - QSqlQuery query(QSqlDatabase::database(KConnectionName)); - if (!query.exec(sqlCommand)) { - qFatal(qPrintable(query.lastError().text())); - } -} - -void ActivityDatabasePrivate::deleteApplicationActivities(const QString &applicationName) -{ - QString sqlCommand = QString("DELETE FROM Activities WHERE ApplicationName = '%1'").arg(applicationName); - QSqlQuery query(QSqlDatabase::database(KConnectionName)); - if (!query.exec(sqlCommand)) { - qFatal(qPrintable(query.lastError().text())); - } -} - -QList ActivityDatabasePrivate::allActivitiesList() -{ - return activitiesList("SELECT Data FROM Activities"); -} - -QList ActivityDatabasePrivate::applicationActivitiesList(const QString &applicationName) -{ - return activitiesList(QString("SELECT Data FROM Activities WHERE ApplicationName = '%1'").arg(applicationName)); -} - -QList ActivityDatabasePrivate::activitiesList(const QString& sqlCommand) -{ - QSqlQuery query(QSqlDatabase::database(KConnectionName)); - if (!query.exec(sqlCommand)) { - qFatal(qPrintable(query.lastError().text())); - } - - QList result; - while (query.next()) { - QVariantHash activityEntry; - { - QByteArray data(query.value(0).toByteArray()); - QDataStream stream(&data, QIODevice::ReadOnly); - stream >> activityEntry; - } - result.append(activityEntry); - } - return result; -} - -QString ActivityDatabasePrivate::requestedActivityName(const QString &applicationName) -{ - QSqlQuery query(QSqlDatabase::database(KConnectionName)); - if (!query.exec(QString("SELECT ActivityName FROM Activities WHERE ApplicationName = '%1' AND RequestFlag").arg(applicationName))) { - qFatal(qPrintable(query.lastError().text())); - } - - QString result; - if (query.next()) { - result = query.value(0).toString(); - } - return result; -} - -void ActivityDatabasePrivate::setActivityRequestFlag(const QString &applicationName, const QString &activityName) -{ - QSqlQuery query(QSqlDatabase::database(KConnectionName)); - - // clear old requests for given application - if (!query.exec(QString("UPDATE Activities SET RequestFlag=0 WHERE ApplicationName = '%1'").arg(applicationName))) { - qFatal(qPrintable(query.lastError().text())); - } - - // set new request - if (!query.exec(QString("UPDATE Activities SET RequestFlag=1 WHERE ApplicationName = '%1' AND ActivityName = '%2'").arg(applicationName).arg(activityName))) { - qFatal(qPrintable(query.lastError().text())); - } -} - -void ActivityDatabasePrivate::clearActivityRequestFlag(const QString &applicationName, const QString &activityName) -{ - QSqlQuery query(QSqlDatabase::database(KConnectionName)); - - // just clear the given request - if (!query.exec(QString("UPDATE Activities SET RequestFlag=0 WHERE ApplicationName = '%1' AND ActivityName = '%2'").arg(applicationName).arg(activityName))) { - qFatal(qPrintable(query.lastError().text())); - } -} - -bool ActivityDatabasePrivate::checkTables() -{ - QStringList expectedTables("Activities"); - QStringList actualTables = QSqlDatabase::database(KConnectionName).tables(); - return (expectedTables == actualTables); -} - -void ActivityDatabasePrivate::recreateTables() -{ - QSqlDatabase database = QSqlDatabase::database(KConnectionName); - - if (!database.transaction()) { - qFatal(qPrintable(database.lastError().text())); - } - - // drop any existing tables - { - QSqlQuery dropQuery(database); - foreach(const QString &tableName, database.tables()) { - if (!dropQuery.exec(QString("DROP TABLE %1").arg(tableName))) { - qFatal(qPrintable(dropQuery.lastError().text())); - } - } - } - - // create new table - { - QSqlQuery createQuery(database); - QString statement( - "CREATE TABLE Activities(" - "ApplicationName TEXT NOT NULL," - "ActivityName TEXT NOT NULL," - "RequestFlag BOOL NOT NULL DEFAULT FALSE," - "Data BLOB NOT NULL," - "PRIMARY KEY(ActivityName, ApplicationName))"); - - if (!createQuery.exec(statement)) { - qFatal(qPrintable(createQuery.lastError().text())); - } - } - - if (!database.commit()) { - qFatal(qPrintable(database.lastError().text())); - } -} diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activityserviceplugin/win/activitydatabase_p.h --- a/activitymanager/activityserviceplugin/win/activitydatabase_p.h Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -#ifndef ACTIVITYDATABASE_P_H -#define ACTIVITYDATABASE_P_H - -#include -#include - -class ActivityDatabasePrivate { - -public: - ActivityDatabasePrivate(); - ~ActivityDatabasePrivate(); - -public: - void saveActivity(const QString &applicationName, const QString &activityName, const QVariantHash &activityMetadata); - void deleteActivity(const QString &applicationName, const QString &activityName); - void deleteApplicationActivities(const QString &applicationName); - QList allActivitiesList(); - QList applicationActivitiesList(const QString &applicationName); - QString requestedActivityName(const QString &applicationName); - void setActivityRequestFlag(const QString &applicationName, const QString &activityName); - void clearActivityRequestFlag(const QString &applicationName, const QString &activityName); - -private: - QList activitiesList(const QString& sqlCommand); - -private: - bool checkTables(); - void recreateTables(); - -}; - -#endif // ACTIVITYDATABASE_P_H diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activityserviceplugin/win/applicationlauncher_p.cpp --- a/activitymanager/activityserviceplugin/win/applicationlauncher_p.cpp Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -#include "applicationlauncher_p.h" -#include - -bool ApplicationLauncherPrivate::isRunning(int applicationId) -{ - // @todo - return true; -} - -void ApplicationLauncherPrivate::startApplication(int applicationId, const QString &activityId) -{ - // @todo -} - -void ApplicationLauncherPrivate::bringToForeground(int applicationId) -{ - // @todo -} diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/activityserviceplugin/win/applicationlauncher_p.h --- a/activitymanager/activityserviceplugin/win/applicationlauncher_p.h Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -#ifndef APPLICATIONLAUNCHER_P_H -#define APPLICATIONLAUNCHER_P_H - -#include - -class ApplicationLauncherPrivate -{ - -public: - bool isRunning(int applicationId); - void startApplication(int applicationId, const QString &activityId); - void bringToForeground(int applicationId); - -}; - -#endif // APPLICATIONLAUNCHER_P_H diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/orbitintegration/hbactivityplugin/hbactivityplugin.cpp --- a/activitymanager/orbitintegration/hbactivityplugin/hbactivityplugin.cpp Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,112 +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 "hbactivityplugininterface.h" -#include "hbactivityplugin.h" - -#include - -QTM_USE_NAMESPACE - -HbActivityPlugin::HbActivityPlugin(QObject *parent) : HbActivityPluginInterface(parent), mActivityClient(0) -{ - QServiceManager serviceManager; - - if (serviceManager.findInterfaces("ActivityService").isEmpty()) { - // clean old entries - serviceManager.removeService("ActivityService"); - bool servicesAdded = serviceManager.addService(":/activityserviceplugin.xml"); - if (!servicesAdded) { - qWarning("addService for ActivityService returned false, error %d", serviceManager.error()); - } - } - - mActivityClient = serviceManager.loadInterface("com.nokia.qt.activities.ActivityClient"); - if (!mActivityClient) { - qWarning("Cannot initialize critical com.nokia.qt.activities.ActivityClient service."); - } - - connect(mActivityClient, SIGNAL(activityRequested(QString)), this, SIGNAL(activityRequested(QString))); -} - -HbActivityPlugin::~HbActivityPlugin() -{ - delete mActivityClient; -} - -bool HbActivityPlugin::addActivity(const QString &activityId, const QVariant &data, const QVariantHash ¶meters) -{ - bool retVal(false); - QMetaObject::invokeMethod(mActivityClient, - "addActivity", - Q_RETURN_ARG(bool, retVal), - Q_ARG(QString, activityId), - Q_ARG(QVariant, data), - Q_ARG(QVariantHash, parameters)); - return retVal; -} - -bool HbActivityPlugin::removeActivity(const QString &activityId) -{ - bool retVal(false); - QMetaObject::invokeMethod(mActivityClient, - "removeActivity", - Q_RETURN_ARG(bool, retVal), - Q_ARG(QString, activityId)); - return retVal; -} - -bool HbActivityPlugin::updateActivity(const QString &activityId, const QVariant &data, const QVariantHash ¶meters) -{ - bool retVal(false); - QMetaObject::invokeMethod(mActivityClient, - "updateActivity", - Q_RETURN_ARG(bool, retVal), - Q_ARG(QString, activityId), - Q_ARG(QVariant, data), - Q_ARG(QVariantHash, parameters)); - return retVal; -} -QList HbActivityPlugin::activities() -{ - QList data; - QMetaObject::invokeMethod(mActivityClient, - "activities", - Q_RETURN_ARG(QList, data)); - return data; -} - -QVariant HbActivityPlugin::activityData(const QString &activityId) -{ - QVariant data; - QMetaObject::invokeMethod(mActivityClient, - "activityData", - Q_RETURN_ARG(QVariant, data), - Q_ARG(QString, activityId)); - return data; -} - -bool HbActivityPlugin::waitActivity() -{ - bool retVal(false); - QMetaObject::invokeMethod(mActivityClient, - "waitActivity", - Q_RETURN_ARG(bool, retVal)); - return retVal; -} - -Q_EXPORT_PLUGIN2(hbactivityplugin, HbActivityPlugin) diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/orbitintegration/hbactivityplugin/hbactivityplugin.h --- a/activitymanager/orbitintegration/hbactivityplugin/hbactivityplugin.h Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +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 HBACTIVITYPLUGIN_H -#define HBACTIVITYPLUGIN_H - -#include "hbactivityplugininterface.h" - -class HbActivityPlugin : public HbActivityPluginInterface -{ - Q_OBJECT - Q_INTERFACES(HbActivityPluginInterface) - -public: - HbActivityPlugin(QObject *parent = 0); - ~HbActivityPlugin(); - -public: - virtual bool addActivity(const QString &activityId, const QVariant &data, const QVariantHash ¶meters); - virtual bool removeActivity(const QString &activityId); - virtual bool updateActivity(const QString &activityId, const QVariant &data, const QVariantHash ¶meters); - virtual QList activities(); - virtual QVariant activityData(const QString &activityId); - virtual bool waitActivity(); - -private: - QObject *mActivityClient; - -}; - -#endif //HBACTIVITYPLUGIN_H diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/orbitintegration/hbactivityplugin/hbactivityplugin.pro --- a/activitymanager/orbitintegration/hbactivityplugin/hbactivityplugin.pro Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -# -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# - -TEMPLATE = lib -TARGET = hbactivityplugin - -CONFIG += plugin - -CONFIG += mobility -MOBILITY = serviceframework - -HEADERS += hbactivityplugininterface.h \ - hbactivityplugin.h \ - -SOURCES += hbactivityplugin.cpp \ - -RESOURCES += hbactivityplugin.qrc - -symbian { - load(data_caging_paths) - pluginDep.sources = hbactivityplugin.dll - pluginDep.path = $$QT_PLUGINS_BASE_DIR - DEPLOYMENT += pluginDep - - TARGET.EPOCALLOWDLLDATA = 1 - TARGET.CAPABILITY = ALL -TCB -} diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/orbitintegration/hbactivityplugin/hbactivityplugin.qrc --- a/activitymanager/orbitintegration/hbactivityplugin/hbactivityplugin.qrc Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ - - - ../../activityserviceplugin/activityserviceplugin.xml - - \ No newline at end of file diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/orbitintegration/hbactivityplugin/hbactivityplugininterface.h --- a/activitymanager/orbitintegration/hbactivityplugin/hbactivityplugininterface.h Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#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; - -signals: - void activityRequested(const QString &activityId); - -}; - -Q_DECLARE_INTERFACE(HbActivityPluginInterface, "HbActivityPluginInterface/1.0") - -#endif // HBACTIVITYPLUGININTERFACE_H diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/rom.pri --- a/activitymanager/rom.pri Wed Mar 24 03:15:43 2010 +0200 +++ /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: -# - -BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include " -BLD_INF_RULES.prj_exports += "rom/activitymanager_core.iby CORE_APP_LAYER_IBY_EXPORT_PATH(activitymanager_core.iby)" -BLD_INF_RULES.prj_exports += "./sis/stubs/activitymanager_stub.sis /epoc32/release/winscw/udeb/z/system/install/activitymanager_stub.sis" -BLD_INF_RULES.prj_exports += "./sis/stubs/activitymanager_stub.sis /epoc32/data/z/system/install/activitymanager_stub.sis" \ No newline at end of file diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/rom/activitymanager_core.iby --- a/activitymanager/rom/activitymanager_core.iby Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -#ifndef __TSACTMAN_CORE_IBY__ -#define __TSACTMAN_CORE_IBY__ - -//file=ABI_DIR\BUILD_DIR\activityserviceinstaller.exe PROGRAMS_DIR\activityserviceinstaller.exe -file=ABI_DIR\BUILD_DIR\activityserviceplugin.dll SHARED_LIB_DIR\activityserviceplugin.dll -data=\epoc32\data\z\resource\qt\plugins\activityserviceplugin.qtplugin resource\qt\plugins\activityserviceplugin.qtplugin - -file=ABI_DIR\BUILD_DIR\activitylauncher.exe PROGRAMS_DIR\activitylauncher.exe -data=ZPRIVATE\10003a3f\import\apps\activitylauncher_reg.rsc private\10003a3f\import\apps\activitylauncher_reg.rsc -data=\epoc32\data\z\resource\apps\activitylauncher.rsc resource\apps\activitylauncher.rsc - -file=ABI_DIR\BUILD_DIR\hsactivitydbserver.exe PROGRAMS_DIR\hsactivitydbserver.exe -data=ZPRIVATE\10003a3f\import\apps\hsactivitydbserver_reg.rsc private\10003a3f\import\apps\hsactivitydbserver_reg.rsc -data=\epoc32\data\z\resource\apps\hsactivitydbserver.rsc resource\apps\hsactivitydbserver.rsc - -file=ABI_DIR\BUILD_DIR\hsactivitydbclient.dll SHARED_LIB_DIR\hsactivitydbclient.dll - -file=ABI_DIR\BUILD_DIR\hbactivityplugin.dll SHARED_LIB_DIR\hbactivityplugin.dll -data=\epoc32\data\z\resource\qt\plugins\hbactivityplugin.qtplugin resource\qt\plugins\hbactivityplugin.qtplugin - - -// stub sis -data=ZSYSTEM/install/activitymanager_stub.sis system/install/activitymanager_stub.sis - -#endif //__TSACTMAN_CORE_IBY__ diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/sis/activitymanager.pkg --- a/activitymanager/sis/activitymanager.pkg Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +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: -; - -;Language - standard language definitions -&EN - -; standard SIS file header -#{"activitymanager"},(0x200267B4),1,0,0,TYPE=SA, RU - -;Localized Vendor Name -%{"Nokia"} - -;Unique Vendor name -:"Nokia" - - -;"/epoc32/release/armv5/urel/activityserviceinstaller.exe" - "!:\sys\bin\activityserviceinstaller.exe" -"/epoc32/release/armv5/urel/activityserviceplugin.dll"-"!:\sys\bin\activityserviceplugin.dll" -"/epoc32/data/z/resource/qt/plugins/activityserviceplugin.qtplugin"-"!:\resource\qt\plugins\activityserviceplugin.qtplugin" - -"/epoc32/release/armv5/urel/activitylauncher.exe" - "!:\sys\bin\activitylauncher.exe" -"/epoc32/data/z/resource/apps/activitylauncher.rsc" - "!:\resource\apps\activitylauncher.rsc" -"/epoc32/data/z/private/10003a3f/import/apps/activitylauncher_reg.rsc" - "!:\private\10003a3f\import\apps\activitylauncher_reg.rsc" - -"/epoc32/release/armv5/urel/hsactivitydbserver.exe" - "!:\sys\bin\hsactivitydbserver.exe" -"/epoc32/data/z/resource/apps/hsactivitydbserver.rsc" - "!:\resource\apps\hsactivitydbserver.rsc" -"/epoc32/data/z/private/10003a3f/import/apps/hsactivitydbserver_reg.rsc" - "!:\private\10003a3f\import\apps\hsactivitydbserver_reg.rsc" - -"/epoc32/release/armv5/urel/hsactivitydbclient.dll" - "!:\sys\bin\hsactivitydbclient.dll" - -"/epoc32/release/armv5/urel/hbactivityplugin.dll" - "!:\sys\bin\hbactivityplugin.dll" -"/epoc32/data/z/resource/qt/plugins/hbactivityplugin.qtplugin"-"!:\resource\qt\plugins\hbactivityplugin.qtplugin" diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/sis/edit_pkg.pl --- a/activitymanager/sis/edit_pkg.pl Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,224 +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: -# -#Options: -# -version -adds Qt version (4,6,0) intp pkg files -# -target -replaces $(PLATFORM)/$(TARGET) into armv5/urel -# -test -creates script for test app -# default -version - -use strict; -use File::Find; -my $base = `cd`; -$base =~ s/\\\w+\s+$//; #move one dir upper -my $modulebase = `cd`; -$modulebase =~s/(\s+)$//; #remove linefeed from end -print $base;; -my $qtversion = "\, 4\, 6\, 0\,"; -my $target = "armv5\/urel"; - -my $qtversionchnage = 0; -my $qtversionarg = "-version"; -my $targetchnage = 0; -my $targetarg = "-target"; -my $module = 0; -my $modulearg = "-test"; -my $delmodule = 0; -my $delmodulearg = "-delmodule"; -my $moduledir = "testsis"; -my $modulepath = $base."\\".$moduledir; -my $ccert = $modulebase."\\"."cert.cer"; -my $ckey = $modulebase."\\"."key.pem"; -my $modulebatpath = $modulebase."\\".$moduledir."\\createmodulesis.bat"; - -checkCmdLine(); - -if ( $qtversionchnage == 1 || $targetchnage == 1 ) - { - find( \&edits, $base ); - } -if ( $module == 1 ) - { - system "mkdir $moduledir"; - if ( not ( open (FWM, ">$modulebatpath") ) ) - { - print "\n***Error: Couldn't open $modulebatpath file to write\n"; - return; - } - binmode FWM; - print FWM "del /S/Q *.SIS\r\n"; - print FWM "del /S/Q *.SISX\r\n"; - close FWM; - find( \&moduleSis, $base ); - } -if ( $delmodule == 1 ) - { - find( \&delModuleSis, $base ); - } - -sub edits() - { - my $file=$_; - my $winpath=$File::Find::name; - $winpath=~s/\//\\/g; - if( -f $file && $file=~/(_template\.pkg)$/i ) - { - print "$winpath "; - system "attrib -R $winpath"; - if ( not ( open (FR, $winpath) ) ) - { - print "Error: Couldn't open $winpath file to read\n"; - return; - } - binmode FR; - my $buf=""; - my $length = 0; - $length = -s $winpath; - read( FR, $buf, $length ); - close FR; - if ( $qtversionchnage == 1 ) - { - $buf =~s/\,\s*\,\s*\,\s*\,\s*\{\"Qt\"\}/$qtversion \{\"Qt\"\}/si; - } - if ( $targetchnage == 1 ) - { - $buf =~s/\$\(PLATFORM\)\/\$\(TARGET\)/$target/si; - } - - if ( not ( open (FW, ">$winpath") ) ) - { - print "\n***Error: Couldn't open $winpath file to write\n"; - return; - } - binmode FW; - print FW $buf; - close FW; - - print "\r\n"; - } - } - -sub checkCmdLine() - { - my $numArgs = $#ARGV + 1; - if ( $numArgs == 0 ) - { - $qtversionchnage = 1; - } - else - { - foreach my $argnum ( 0 .. $#ARGV ) - { - my $argName = lc $ARGV[$argnum]; - if ( $argName eq $qtversionarg ) - { - $qtversionchnage = 1; - } - elsif ( $argName eq $targetarg ) - { - $targetchnage = 1; - } - elsif ( $argName eq $modulearg ) - { - $module = 1; - } - elsif ( $argName eq $delmodulearg ) - { - $delmodule = 1; - } - else - { - die "\n***Error: Bad arguments\n"; - } - } - } - } - -sub moduleSis() - { - my $file=$_; - my $winpath=$File::Find::name; - $winpath=~s/\//\\/g; - - - if( -f $file && $file=~/(.*test.*_template\.pkg)$/i ) - { - print "$winpath "; - system "attrib -R $winpath"; - if ( not ( open (FR, $winpath) ) ) - { - print "Error: Couldn't open $winpath file to read\n"; - return; - } - binmode FR; - my $buf=""; - my $length = 0; - $length = -s $winpath; - read( FR, $buf, $length ); - close FR; - $buf =~s/\,\s*\,\s*\,\s*\,\s*\{\"Qt\"\}/$qtversion \{\"Qt\"\}/si; - $buf =~s/\$\(PLATFORM\)\/\$\(TARGET\)/$target/si; - - if ( not ( open (FW, ">$winpath") ) ) - { - print "Error: Couldn't open $winpath file to write\n"; - return; - } - binmode FW; - print FW $buf; - close FW; - print "\r\n"; - - my $pkgname = sisName( $winpath ); - - if ( not ( open (FWM2, ">>$modulebatpath") ) ) - { - print "Error: Couldn't open $modulebatpath file to append\n"; - return; - } - binmode FWM2; - print FWM2 "makesis $winpath $pkgname\.SIS\r\n"; - print FWM2 "signsis $pkgname\.SIS $pkgname\.SISX $ccert $ckey\r\n"; - close FWM2; - } - } - -sub sisName() - { - my $path = shift; - my $name = ""; - if ( $path =~ /\\(\w+)\.pkg/i ) - { - $name = $1; - } - return $name; - } - -sub delModuleSis() - { - my $file=$_; - my $winpath=$File::Find::name; - $winpath=~s/\//\\/g; - - - if( -f $file && $file=~/(_template\.pkg)$/i && ( $file=~/^(t_)/i || $file=~/test/i ) ) - { - print "Deleting: "; - print "$winpath "; - system "attrib -R $winpath"; - system "del /S/Q $winpath"; - print "\r\n"; - } - } \ No newline at end of file diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/sis/stubs/activitymanager_stub.pkg --- a/activitymanager/sis/stubs/activitymanager_stub.pkg Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -; -; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -; All rights reserved. -; This component and the accompanying materials are made available -; under the terms of "Eclipse Public License v1.0" -; which accompanies this distribution, and is available -; at the URL "http://www.eclipse.org/legal/epl-v10.html". -; -; Initial Contributors: -; Nokia Corporation - initial contribution. -; -; Contributors: -; -; Description: -; -; ------------------------------------------------------------------------------ -; Taskswitcher stub SIS package file. -; Used to enable Taskswitcher to be updated from ROM with a SIS package. -; When you add new files into this stub, please remember to update -; SIS stub with "makesis -s" command. -; ------------------------------------------------------------------------------ -; -;Language - standard language definitions -&EN - -; standard SIS file header -#{"activitymanager"},(0x200267B4),1,0,0,TYPE=SA - -;Localized Vendor Name -%{"Nokia"} - -;Unique Vendor name -:"Nokia" - -;"" - "Z:\sys\bin\activityserviceinstaller.exe" -"" - "Z:\sys\bin\activityserviceplugin.dll" -"" - "Z:\resource\qt\plugins\activityserviceplugin.qtplugin" - -"" - "Z:\sys\bin\activitylauncher.exe" -"" - "Z:\resource\apps\activitylauncher.rsc" -"" - "Z:\private\10003a3f\import\apps\activitylauncher_reg.rsc" - -"" - "Z:\sys\bin\hsactivitydbserver.exe" -"" - "Z:\resource\apps\hsactivitydbserver.rsc" -"" - "Z:\private\10003a3f\import\apps\hsactivitydbserver_reg.rsc" - -"" - "Z:\sys\bin\hsactivitydbclient.dll" - -"" - "Z:\sys\bin\hbactivityplugin.dll" -"" - "Z:\resource\qt\plugins\hbactivityplugin.qtplugin" \ No newline at end of file diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/sis/stubs/activitymanager_stub.sis Binary file activitymanager/sis/stubs/activitymanager_stub.sis has changed diff -r 1e87eb3b400f -r 0e41c72311af activitymanager/sis/stubs/createstubs.bat --- a/activitymanager/sis/stubs/createstubs.bat Wed Mar 24 03:15:43 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -@rem -@rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -@rem All rights reserved. -@rem This component and the accompanying materials are made available -@rem under the terms of "Eclipse Public License v1.0" -@rem which accompanies this distribution, and is available -@rem at the URL "http://www.eclipse.org/legal/epl-v10.html". -@rem -@rem Initial Contributors: -@rem Nokia Corporation - initial contribution. -@rem -@rem Contributors: -@rem -@rem Description: -@rem - -for %%f in (*.pkg) do makesis -s %%f diff -r 1e87eb3b400f -r 0e41c72311af homescreensrv.pro --- a/homescreensrv.pro Wed Mar 24 03:15:43 2010 +0200 +++ b/homescreensrv.pro Wed Mar 24 13:06:03 2010 +0200 @@ -23,7 +23,7 @@ homescreensrv_plat \ screensavermodel \ bagetmodel \ - activitymanager \ + activityfw \ tsrc CONFIG += ordered