--- a/activityfw/activityserviceplugin/activityserviceplugin.pro Thu Jun 24 16:18:29 2010 +0300
+++ b/activityfw/activityserviceplugin/activityserviceplugin.pro Tue Jun 29 10:20:30 2010 +0300
@@ -24,13 +24,13 @@
../../inc
HEADERS += ./inc/activityserviceplugin.h \
- ./inc/activityclient.h \
- ./inc/activitymanager.h \
+ ./inc/afactivityclient.h \
+ ./inc/afactivitymanager.h \
./inc/applicationlauncher.h \
SOURCES += ./src/activityserviceplugin.cpp \
- ./src/activityclient.cpp \
- ./src/activitymanager.cpp \
+ ./src/afactivityclient.cpp \
+ ./src/afactivitymanager.cpp \
./src/applicationlauncher.cpp \
symbian {
--- a/activityfw/activityserviceplugin/inc/activityclient.h Thu Jun 24 16:18:29 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-#ifndef ACTIVITYCLIENT_H
-#define ACTIVITYCLIENT_H
-
-#include <QObject>
-#include <QVariant>
-#include <QString>
-
-#include <afstorageclient.h>
-
-class ActivityClient : public QObject
-{
-
- Q_OBJECT
-
-public:
- ActivityClient(const QSharedPointer<AfStorageClient> &serviceProvider,QObject *parent = 0);
- ~ActivityClient();
-
-public slots:
- bool addActivity(const QString &activityId, const QVariant &data, const QVariantHash ¶meters);
- bool removeActivity(const QString &activityId);
- bool updateActivity(const QString &activityId, const QVariant &data, const QVariantHash ¶meters);
- QList<QVariantHash> activities() const;
- QVariant activityData(const QString &activityId) const;
- QVariantHash parseCommandLine(const QStringList &commandLineParams) const;
-
-signals:
- void activityRequested(const QString &activityId);
-
-private:
- QSharedPointer<AfStorageClient> mServiceProvider;
- bool mIsconnected;
-};
-
-#endif // ACTIVITYCLIENT_H
--- a/activityfw/activityserviceplugin/inc/activitymanager.h Thu Jun 24 16:18:29 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-#ifndef ACTIVITYMANAGER_H
-#define ACTIVITYMANAGER_H
-
-#include <QObject>
-#include <QVariant>
-#include <QList>
-#include <QPixmap>
-#include <QSize>
-
-#include <afstorageclient.h>
-
-class ActivityManager : public QObject
-{
-
- Q_OBJECT
-
-public:
- ActivityManager(const QSharedPointer<AfStorageClient> &serviceProvider, QObject *parent = 0);
- ~ActivityManager();
-
-public slots:
- QList<QVariantHash> activitiesList();
- void launchActivity(const QString &uri);
- void launchActivity(const QUrl &uri);
- void launchActivity(int applicationId, const QString &activityId, const QVariantHash& parameters = QVariantHash());
- void getThumbnail(QSize resolution,const QString &thumbnailPath, void *data =0);
-
-signals:
- void thumbnailReady(QPixmap, void *);
- void dataChanged();
-
-private:
- void launchActivity(const QVariantHash& activity);
- QUrl activityToUri(const QVariantHash& activity) const;
-
-private:
- QSharedPointer<AfStorageClient> mServiceProvider;
-};
-
-#endif // ACTIVITYMANAGER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activityserviceplugin/inc/afactivityclient.h Tue Jun 29 10:20:30 2010 +0300
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef AFACTIVITYCLIENT_H
+#define AFACTIVITYCLIENT_H
+
+#include <QObject>
+#include <QVariant>
+#include <QString>
+
+#include <afstorageclient.h>
+
+class ActivityClient : public QObject
+{
+
+ Q_OBJECT
+
+public:
+ ActivityClient(const QSharedPointer<AfStorageClient> &serviceProvider,QObject *parent = 0);
+ ~ActivityClient();
+
+public slots:
+ bool addActivity(const QString &activityId, const QVariant &data, const QVariantHash ¶meters);
+ bool removeActivity(const QString &activityId);
+ bool updateActivity(const QString &activityId, const QVariant &data, const QVariantHash ¶meters);
+ QList<QVariantHash> activities() const;
+ QVariant activityData(const QString &activityId) const;
+ QVariantHash parseCommandLine(const QStringList &commandLineParams) const;
+
+signals:
+ void activityRequested(const QString &activityId);
+
+private:
+ QSharedPointer<AfStorageClient> mServiceProvider;
+ bool mIsconnected;
+};
+
+#endif // AFACTIVITYCLIENT_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activityserviceplugin/inc/afactivitymanager.h Tue Jun 29 10:20:30 2010 +0300
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef AFACTIVITYMANAGER_H
+#define AFACTIVITYMANAGER_H
+
+#include <QObject>
+#include <QVariant>
+#include <QList>
+#include <QPixmap>
+#include <QSize>
+
+#include <afstorageclient.h>
+
+class ActivityManager : public QObject
+{
+
+ Q_OBJECT
+
+public:
+ ActivityManager(const QSharedPointer<AfStorageClient> &serviceProvider, QObject *parent = 0);
+ ~ActivityManager();
+
+public slots:
+ QList<QVariantHash> activitiesList();
+ void launchActivity(const QString &uri);
+ void launchActivity(const QUrl &uri);
+ void launchActivity(int applicationId, const QString &activityId, const QVariantHash& parameters = QVariantHash());
+ void getThumbnail(QSize resolution,const QString &thumbnailPath, void *data =0);
+
+signals:
+ void thumbnailReady(QPixmap, void *);
+ void dataChanged();
+
+private:
+ void launchActivity(const QVariantHash& activity);
+ QUrl activityToUri(const QVariantHash& activity) const;
+
+private:
+ QSharedPointer<AfStorageClient> mServiceProvider;
+};
+
+#endif // AFACTIVITYMANAGER_H
--- a/activityfw/activityserviceplugin/src/activityclient.cpp Thu Jun 24 16:18:29 2010 +0300
+++ /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 <QCoreApplication>
-#include <QStringList>
-#include <QTimer>
-#include <QUrl>
-#include <QDebug>
-#include <QDir>
-
-#include <afstorageentry.h>
-#include <afstorageglobals.h>
-
-#include "activityclient.h"
-ActivityClient::ActivityClient(const QSharedPointer<AfStorageClient> &serviceProvider, QObject *parent)
-:
- QObject(parent),
- mServiceProvider(serviceProvider),
- mIsconnected(false)
-{
- mIsconnected = ( KErrNone == mServiceProvider->connect());
- if( mIsconnected) {
- mServiceProvider->waitActivity();
- }
- connect(mServiceProvider.data(), SIGNAL(activityRequested(QString)), this, SIGNAL(activityRequested(QString)));
-}
-
-ActivityClient::~ActivityClient()
-{
-}
-
-bool ActivityClient::addActivity(const QString &activityId, const QVariant &data, const QVariantHash ¶meters)
-{
- bool result(mIsconnected);
- if (result) {
- QVariantHash publicData(parameters);
-
- QPixmap screenshot(publicData[ActivityScreenshotKeyword].value<QPixmap>());
- publicData.remove(ActivityScreenshotKeyword);
-
- RProcess process;
- publicData.insert(ActivityApplicationKeyword, static_cast<int>(process.SecureId().iId));
- publicData.insert(ActivityActivityKeyword, activityId);
- AfStorageEntry entry(process.SecureId().iId, activityId, data, publicData);
- result = (KErrNone == mServiceProvider->addActivity(entry, screenshot));
- }
- return result;
-}
-
-bool ActivityClient::removeActivity(const QString &activityId)
-{
- bool result(mIsconnected);
- if (result) {
- RProcess process;
- AfStorageEntry entry(process.SecureId().iId, activityId);
- result = (KErrNone == mServiceProvider->removeActivity(entry));
- }
- return result;
-}
-
-bool ActivityClient::updateActivity(const QString &activityId, const QVariant &data, const QVariantHash ¶meters)
-{
- bool result(mIsconnected);
- if (result) {
- QVariantHash publicData(parameters);
- QPixmap screenshot(publicData[ActivityScreenshotKeyword].value<QPixmap>());
- publicData.remove(ActivityScreenshotKeyword);
- RProcess process;
- publicData.insert(ActivityApplicationKeyword, static_cast<int>(process.SecureId().iId));
- publicData.insert(ActivityActivityKeyword, activityId);
- AfStorageEntry entry(process.SecureId().iId, activityId, data, publicData);
- result = (KErrNone == mServiceProvider->updateActivity(entry, screenshot));
- }
- return result;
-}
-
-QList<QVariantHash> ActivityClient::activities() const
-{
- QList<QVariantHash> retVal;
- if (mIsconnected) {
- RProcess process;
- AfStorageEntry entry(process.SecureId().iId);
- QList<AfStorageEntry> activities;
- mServiceProvider->applicationActivities(activities, entry);
-
- QList<AfStorageEntry>::iterator iter(activities.begin());
- for (; activities.end() != iter; iter = activities.erase(iter)) {
- retVal.append((*iter).publicData());
- }
- }
- return retVal;
-}
-
-QVariant ActivityClient::activityData(const QString &activityId) const
-{
- QVariant data;
- if (mIsconnected) {
- RProcess process;
- AfStorageEntry entry(static_cast<int>(process.SecureId().iId), activityId), result;
- if (0 == mServiceProvider->activityData(result, entry)) {
- data = result.privateData();
- }
- }
- return data;
-}
-
-QVariantHash ActivityClient::parseCommandLine(const QStringList &commandLineParams) const
-{
- QVariantHash activityParams;
- int activityMarkerIndex = commandLineParams.indexOf("-activity");
- if (activityMarkerIndex != -1 && commandLineParams.count() - 1 > activityMarkerIndex) {
- QUrl activityUri = QUrl::fromEncoded(commandLineParams.at(activityMarkerIndex+1).toAscii());
- if (activityUri.scheme() == "appto") {
- QList<QPair<QString, QString> > parameters = activityUri.queryItems();
- for (QList<QPair<QString, QString> >::const_iterator i = parameters.constBegin(); i != parameters.constEnd(); ++i) {
- activityParams.insert(i->first, i->second);
- }
-
- if (activityParams.contains("activityname") && !activityParams.value("activityname").toString().isEmpty()) {
- return activityParams;
- }
- }
- }
- return QVariantHash();
-}
--- a/activityfw/activityserviceplugin/src/activitymanager.cpp Thu Jun 24 16:18:29 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,142 +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 <QStringList>
-#include <QUrl>
-
-#include <afstorageclient.h>
-#include <afstorageentry.h>
-#include <afstorageglobals.h>
-
-#include "activitymanager.h"
-#include "applicationlauncher.h"
-
-ActivityManager::ActivityManager(const QSharedPointer<AfStorageClient> &serviceProvider,
- QObject *parent)
-:
- QObject(parent),
- mServiceProvider(serviceProvider)
-{
- if(0 == mServiceProvider->connect()){
- mServiceProvider->notifyDataChange();
- }
- connect(mServiceProvider.data(),
- SIGNAL(thumbnailRequested(QPixmap, void *)),
- this,
- SIGNAL(thumbnailReady(QPixmap, void *)));
- connect(mServiceProvider.data(),
- SIGNAL(dataChanged()),
- this,
- SIGNAL(dataChanged()));
-}
-
-ActivityManager::~ActivityManager()
-{
-}
-
-QList<QVariantHash> ActivityManager::activitiesList()
-{
- QList<AfStorageEntry> results;
- mServiceProvider->activities(results);
-
- QList<QVariantHash> retVal;
- QList<AfStorageEntry>::iterator iter(results.begin());
- for (; iter != results.end(); iter = results.erase(iter)) {
- retVal.append((*iter).publicData());
- }
- return retVal;
-}
-
-void ActivityManager::launchActivity(const QUrl &uri)
-{
- if (uri.scheme() != "appto")
- return;
-
- bool conversionOk(false);
- int applicationId = uri.host().toUInt(&conversionOk, 16);
- if (!conversionOk)
- return;
-
- QVariantHash activity;
- activity.insert(ActivityApplicationKeyword, applicationId);
-
- QVariantHash parameters;
- QList<QPair<QString, QString> > uriParams = uri.queryItems();
- for (QList<QPair<QString, QString> >::const_iterator i = uriParams.constBegin(); i != uriParams.constEnd(); ++i) {
- parameters.insert(i->first, i->second);
- }
-
- if (parameters.contains("activityname")) {
- activity.insert(ActivityActivityKeyword, parameters.value("activityname").toString());
- parameters.remove("activityname");
- }
-
- activity.insert(ActivityParametersKeyword, parameters);
-
- launchActivity(activity);
-}
-
-void ActivityManager::launchActivity(const QString &uri)
-{
- qWarning("ActivityManager::launchActivity(const QString &uri) is deprecated, use ActivityManager::launchActivity(const QUrl &uri) instead");
- launchActivity(QUrl(uri));
-}
-
-void ActivityManager::launchActivity(int applicationId, const QString &activityId, const QVariantHash& parameters)
-{
- QVariantHash activity;
- activity.insert(ActivityApplicationKeyword, applicationId);
- activity.insert(ActivityActivityKeyword, activityId);
- activity.insert(ActivityParametersKeyword, parameters);
-
- launchActivity(activity);
-}
-
-void ActivityManager::getThumbnail(QSize resolution,const QString &thumbnailPath, void *data)
-{
- mServiceProvider->getThumbnail(resolution, thumbnailPath, data);
-}
-
-void ActivityManager::launchActivity(const QVariantHash& activity)
-{
- ApplicationLauncher applicationLauncher;
- int applicationId = activity.value(ActivityApplicationKeyword).toInt();
- AfStorageEntry entry(applicationId,
- activity[ActivityActivityKeyword].toString());
- if (applicationLauncher.isRunning(applicationId)) {
- mServiceProvider->launchActivity(entry);
- applicationLauncher.bringToForeground(applicationId);
- } else {
- applicationLauncher.startApplication(applicationId, activityToUri(activity));
- }
-}
-
-QUrl ActivityManager::activityToUri(const QVariantHash& activity) const
-{
- QUrl uri;
- uri.setScheme("appto");
- uri.setHost(QString("%1").arg(activity.value(ActivityApplicationKeyword).toUInt(), 8, 16, QChar('0')));
-
- if (activity.contains(ActivityActivityKeyword))
- uri.addQueryItem("activityname", activity.value(ActivityActivityKeyword).toString());
-
- QVariantHash parameters = activity.value(ActivityParametersKeyword).toHash();
- foreach(const QString &key, parameters.keys()) {
- uri.addQueryItem(key, parameters.value(key).toString());
- }
- return uri;
-}
--- a/activityfw/activityserviceplugin/src/activityserviceplugin.cpp Thu Jun 24 16:18:29 2010 +0300
+++ b/activityfw/activityserviceplugin/src/activityserviceplugin.cpp Tue Jun 29 10:20:30 2010 +0300
@@ -21,8 +21,8 @@
#include <qabstractsecuritysession.h>
#include <qservicecontext.h>
-#include "activityclient.h"
-#include "activitymanager.h"
+#include "afactivityclient.h"
+#include "afactivitymanager.h"
QObject *ActivityServicePlugin::createInstance(const QServiceInterfaceDescriptor &descriptor, QServiceContext *context, QAbstractSecuritySession *session)
{
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activityserviceplugin/src/afactivityclient.cpp Tue Jun 29 10:20:30 2010 +0300
@@ -0,0 +1,138 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include <QCoreApplication>
+#include <QStringList>
+#include <QTimer>
+#include <QUrl>
+#include <QDebug>
+#include <QDir>
+
+#include <afstorageentry.h>
+#include <afstorageglobals.h>
+
+#include "afactivityclient.h"
+ActivityClient::ActivityClient(const QSharedPointer<AfStorageClient> &serviceProvider, QObject *parent)
+:
+ QObject(parent),
+ mServiceProvider(serviceProvider),
+ mIsconnected(false)
+{
+ mIsconnected = ( KErrNone == mServiceProvider->connect());
+ if( mIsconnected) {
+ mServiceProvider->waitActivity();
+ }
+ connect(mServiceProvider.data(), SIGNAL(activityRequested(QString)), this, SIGNAL(activityRequested(QString)));
+}
+
+ActivityClient::~ActivityClient()
+{
+}
+
+bool ActivityClient::addActivity(const QString &activityId, const QVariant &data, const QVariantHash ¶meters)
+{
+ bool result(mIsconnected);
+ if (result) {
+ QVariantHash publicData(parameters);
+
+ QPixmap screenshot(publicData[ActivityScreenshotKeyword].value<QPixmap>());
+ publicData.remove(ActivityScreenshotKeyword);
+
+ RProcess process;
+ publicData.insert(ActivityApplicationKeyword, static_cast<int>(process.SecureId().iId));
+ publicData.insert(ActivityActivityKeyword, activityId);
+ AfStorageEntry entry(process.SecureId().iId, activityId, data, publicData);
+ result = (KErrNone == mServiceProvider->addActivity(entry, screenshot));
+ }
+ return result;
+}
+
+bool ActivityClient::removeActivity(const QString &activityId)
+{
+ bool result(mIsconnected);
+ if (result) {
+ RProcess process;
+ AfStorageEntry entry(process.SecureId().iId, activityId);
+ result = (KErrNone == mServiceProvider->removeActivity(entry));
+ }
+ return result;
+}
+
+bool ActivityClient::updateActivity(const QString &activityId, const QVariant &data, const QVariantHash ¶meters)
+{
+ bool result(mIsconnected);
+ if (result) {
+ QVariantHash publicData(parameters);
+ QPixmap screenshot(publicData[ActivityScreenshotKeyword].value<QPixmap>());
+ publicData.remove(ActivityScreenshotKeyword);
+ RProcess process;
+ publicData.insert(ActivityApplicationKeyword, static_cast<int>(process.SecureId().iId));
+ publicData.insert(ActivityActivityKeyword, activityId);
+ AfStorageEntry entry(process.SecureId().iId, activityId, data, publicData);
+ result = (KErrNone == mServiceProvider->updateActivity(entry, screenshot));
+ }
+ return result;
+}
+
+QList<QVariantHash> ActivityClient::activities() const
+{
+ QList<QVariantHash> retVal;
+ if (mIsconnected) {
+ RProcess process;
+ AfStorageEntry entry(process.SecureId().iId);
+ QList<AfStorageEntry> activities;
+ mServiceProvider->applicationActivities(activities, entry);
+
+ QList<AfStorageEntry>::iterator iter(activities.begin());
+ for (; activities.end() != iter; iter = activities.erase(iter)) {
+ retVal.append((*iter).publicData());
+ }
+ }
+ return retVal;
+}
+
+QVariant ActivityClient::activityData(const QString &activityId) const
+{
+ QVariant data;
+ if (mIsconnected) {
+ RProcess process;
+ AfStorageEntry entry(static_cast<int>(process.SecureId().iId), activityId), result;
+ if (0 == mServiceProvider->activityData(result, entry)) {
+ data = result.privateData();
+ }
+ }
+ return data;
+}
+
+QVariantHash ActivityClient::parseCommandLine(const QStringList &commandLineParams) const
+{
+ QVariantHash activityParams;
+ int activityMarkerIndex = commandLineParams.indexOf("-activity");
+ if (activityMarkerIndex != -1 && commandLineParams.count() - 1 > activityMarkerIndex) {
+ QUrl activityUri = QUrl::fromEncoded(commandLineParams.at(activityMarkerIndex+1).toAscii());
+ if (activityUri.scheme() == "appto") {
+ QList<QPair<QString, QString> > parameters = activityUri.queryItems();
+ for (QList<QPair<QString, QString> >::const_iterator i = parameters.constBegin(); i != parameters.constEnd(); ++i) {
+ activityParams.insert(i->first, i->second);
+ }
+
+ if (activityParams.contains("activityname") && !activityParams.value("activityname").toString().isEmpty()) {
+ return activityParams;
+ }
+ }
+ }
+ return QVariantHash();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/activityserviceplugin/src/afactivitymanager.cpp Tue Jun 29 10:20:30 2010 +0300
@@ -0,0 +1,142 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include <QStringList>
+#include <QUrl>
+
+#include <afstorageclient.h>
+#include <afstorageentry.h>
+#include <afstorageglobals.h>
+
+#include "afactivitymanager.h"
+#include "applicationlauncher.h"
+
+ActivityManager::ActivityManager(const QSharedPointer<AfStorageClient> &serviceProvider,
+ QObject *parent)
+:
+ QObject(parent),
+ mServiceProvider(serviceProvider)
+{
+ if(0 == mServiceProvider->connect()){
+ mServiceProvider->notifyDataChange();
+ }
+ connect(mServiceProvider.data(),
+ SIGNAL(thumbnailRequested(QPixmap, void *)),
+ this,
+ SIGNAL(thumbnailReady(QPixmap, void *)));
+ connect(mServiceProvider.data(),
+ SIGNAL(dataChanged()),
+ this,
+ SIGNAL(dataChanged()));
+}
+
+ActivityManager::~ActivityManager()
+{
+}
+
+QList<QVariantHash> ActivityManager::activitiesList()
+{
+ QList<AfStorageEntry> results;
+ mServiceProvider->activities(results);
+
+ QList<QVariantHash> retVal;
+ QList<AfStorageEntry>::iterator iter(results.begin());
+ for (; iter != results.end(); iter = results.erase(iter)) {
+ retVal.append((*iter).publicData());
+ }
+ return retVal;
+}
+
+void ActivityManager::launchActivity(const QUrl &uri)
+{
+ if (uri.scheme() != "appto")
+ return;
+
+ bool conversionOk(false);
+ int applicationId = uri.host().toUInt(&conversionOk, 16);
+ if (!conversionOk)
+ return;
+
+ QVariantHash activity;
+ activity.insert(ActivityApplicationKeyword, applicationId);
+
+ QVariantHash parameters;
+ QList<QPair<QString, QString> > uriParams = uri.queryItems();
+ for (QList<QPair<QString, QString> >::const_iterator i = uriParams.constBegin(); i != uriParams.constEnd(); ++i) {
+ parameters.insert(i->first, i->second);
+ }
+
+ if (parameters.contains("activityname")) {
+ activity.insert(ActivityActivityKeyword, parameters.value("activityname").toString());
+ parameters.remove("activityname");
+ }
+
+ activity.insert(ActivityParametersKeyword, parameters);
+
+ launchActivity(activity);
+}
+
+void ActivityManager::launchActivity(const QString &uri)
+{
+ qWarning("AfActivityManager::launchActivity(const QString &uri) is deprecated, use AfActivityManager::launchActivity(const QUrl &uri) instead");
+ launchActivity(QUrl(uri));
+}
+
+void ActivityManager::launchActivity(int applicationId, const QString &activityId, const QVariantHash& parameters)
+{
+ QVariantHash activity;
+ activity.insert(ActivityApplicationKeyword, applicationId);
+ activity.insert(ActivityActivityKeyword, activityId);
+ activity.insert(ActivityParametersKeyword, parameters);
+
+ launchActivity(activity);
+}
+
+void ActivityManager::getThumbnail(QSize resolution,const QString &thumbnailPath, void *data)
+{
+ mServiceProvider->getThumbnail(resolution, thumbnailPath, data);
+}
+
+void ActivityManager::launchActivity(const QVariantHash& activity)
+{
+ ApplicationLauncher applicationLauncher;
+ int applicationId = activity.value(ActivityApplicationKeyword).toInt();
+ AfStorageEntry entry(applicationId,
+ activity[ActivityActivityKeyword].toString());
+ if (applicationLauncher.isRunning(applicationId)) {
+ mServiceProvider->launchActivity(entry);
+ applicationLauncher.bringToForeground(applicationId);
+ } else {
+ applicationLauncher.startApplication(applicationId, activityToUri(activity));
+ }
+}
+
+QUrl ActivityManager::activityToUri(const QVariantHash& activity) const
+{
+ QUrl uri;
+ uri.setScheme("appto");
+ uri.setHost(QString("%1").arg(activity.value(ActivityApplicationKeyword).toUInt(), 8, 16, QChar('0')));
+
+ if (activity.contains(ActivityActivityKeyword))
+ uri.addQueryItem("activityname", activity.value(ActivityActivityKeyword).toString());
+
+ QVariantHash parameters = activity.value(ActivityParametersKeyword).toHash();
+ foreach(const QString &key, parameters.keys()) {
+ uri.addQueryItem(key, parameters.value(key).toString());
+ }
+ return uri;
+}
--- a/contentstorage/casrv/calocalizerscanner/calocalizerscanner.pro Thu Jun 24 16:18:29 2010 +0300
+++ b/contentstorage/casrv/calocalizerscanner/calocalizerscanner.pro Tue Jun 29 10:20:30 2010 +0300
@@ -45,11 +45,6 @@
" TARGET calocalizerscanner.rsc" \
"END"
MMP_RULES += rssResource
- MMP_RULES += "$${LITERAL_HASH}if defined(WINSCW)" \
- "DEFFILE ./bwins/calocalizerscanner.def" \
- "$${LITERAL_HASH}else" \
- "DEFFILE ./eabi/calocalizerscanner.def" \
- "$${LITERAL_HASH}endif"
HEADERS += ./inc/*.h
SOURCES += ./src/*.cpp
LIBS += -leuser \