--- a/activityfw/activitydatabase/hsactivitydbserver/group/hsactivitydbserver.mmp Fri Jun 11 16:13:51 2010 +0300
+++ b/activityfw/activitydatabase/hsactivitydbserver/group/hsactivitydbserver.mmp Thu Jun 24 16:18:29 2010 +0300
@@ -19,7 +19,6 @@
UID 0 0x200267B4
MW_LAYER_SYSTEMINCLUDE
-APP_LAYER_SYSTEMINCLUDE
USERINCLUDE ../inc
USERINCLUDE ../../inc
--- a/activityfw/activitydatabase/inc/hsactivitydbclientinterface.h Fri Jun 11 16:13:51 2010 +0300
+++ b/activityfw/activitydatabase/inc/hsactivitydbclientinterface.h Thu Jun 24 16:18:29 2010 +0300
@@ -29,6 +29,7 @@
const char ActivityVisibility [] = ":ActivityVisibility";
const char ActivityScreenshotKeyword [] = "screenshot";
const char ActivityDataKeyword [] = ":ActivityData";
+const char ActivityApplicationName[] = ":ApplicationName";
class HsActivityDbClientInterface
{
--- a/activityfw/activityfw.pro Fri Jun 11 16:13:51 2010 +0300
+++ b/activityfw/activityfw.pro Thu Jun 24 16:18:29 2010 +0300
@@ -20,7 +20,7 @@
SUBDIRS += tsutils
-symbian:SUBDIRS += activitydatabase
+symbian:SUBDIRS += storage
SUBDIRS += activityserviceplugin \
orbitintegration/hbactivityplugin \
--- a/activityfw/activityserviceplugin/activityserviceplugin.pro Fri Jun 11 16:13:51 2010 +0300
+++ b/activityfw/activityserviceplugin/activityserviceplugin.pro Thu Jun 24 16:18:29 2010 +0300
@@ -21,19 +21,16 @@
include(activityserviceplugin.pri)
INCLUDEPATH += ./inc \
+ ../../inc
HEADERS += ./inc/activityserviceplugin.h \
./inc/activityclient.h \
- ./inc/activityclient_p.h \
./inc/activitymanager.h \
- ./inc/activitymanager_p.h \
./inc/applicationlauncher.h \
SOURCES += ./src/activityserviceplugin.cpp \
./src/activityclient.cpp \
- ./src/activityclient_p.cpp \
./src/activitymanager.cpp \
- ./src/activitymanager_p.cpp \
./src/applicationlauncher.cpp \
symbian {
@@ -46,7 +43,7 @@
LIBS += -lapparc \
-lapgrfx \
-lcone \
- -lhsactivitydbclient \
+ -lafstorageclient \
-lxqutils
}
--- a/activityfw/activityserviceplugin/inc/activityclient.h Fri Jun 11 16:13:51 2010 +0300
+++ b/activityfw/activityserviceplugin/inc/activityclient.h Thu Jun 24 16:18:29 2010 +0300
@@ -21,7 +21,7 @@
#include <QVariant>
#include <QString>
-class ActivityClientPrivate;
+#include <afstorageclient.h>
class ActivityClient : public QObject
{
@@ -29,7 +29,7 @@
Q_OBJECT
public:
- ActivityClient(QObject *parent = 0);
+ ActivityClient(const QSharedPointer<AfStorageClient> &serviceProvider,QObject *parent = 0);
~ActivityClient();
public slots:
@@ -44,9 +44,8 @@
void activityRequested(const QString &activityId);
private:
- ActivityClientPrivate *d_ptr;
- friend class ActivityClientPrivate;
-
+ QSharedPointer<AfStorageClient> mServiceProvider;
+ bool mIsconnected;
};
#endif // ACTIVITYCLIENT_H
--- a/activityfw/activityserviceplugin/inc/activityclient_p.h Fri Jun 11 16:13:51 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_P_H
-#define ACTIVITYCLIENT_P_H
-
-#include <QObject>
-#include <QVariant>
-#include <QString>
-#include <QPixmap>
-
-class ActivityClient;
-class ActivityDataStorage;
-class ActivityServerClient;
-class HsActivityDbClient;
-class ActivityClientPrivate : public QObject
-{
-
- Q_OBJECT
-
-public:
- ActivityClientPrivate(ActivityClient *q);
- ~ActivityClientPrivate();
-
-public:
- bool addActivity(const QString &activityId, const QVariant &data, const QVariantHash ¶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;
-
-private:
- HsActivityDbClient *mServerClient;
- bool mIsconnected;
-};
-
-#endif // ACTIVITYCLIENT_P_H
--- a/activityfw/activityserviceplugin/inc/activitymanager.h Fri Jun 11 16:13:51 2010 +0300
+++ b/activityfw/activityserviceplugin/inc/activitymanager.h Thu Jun 24 16:18:29 2010 +0300
@@ -23,7 +23,7 @@
#include <QPixmap>
#include <QSize>
-class ActivityManagerPrivate;
+#include <afstorageclient.h>
class ActivityManager : public QObject
{
@@ -31,7 +31,7 @@
Q_OBJECT
public:
- ActivityManager(QObject *parent = 0);
+ ActivityManager(const QSharedPointer<AfStorageClient> &serviceProvider, QObject *parent = 0);
~ActivityManager();
public slots:
@@ -46,9 +46,11 @@
void dataChanged();
private:
- ActivityManagerPrivate *d_ptr;
+ void launchActivity(const QVariantHash& activity);
+ QUrl activityToUri(const QVariantHash& activity) const;
- friend class ActivityManagerPrivate;
+private:
+ QSharedPointer<AfStorageClient> mServiceProvider;
};
#endif // ACTIVITYMANAGER_H
--- a/activityfw/activityserviceplugin/inc/activitymanager_p.h Fri Jun 11 16:13:51 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-#ifndef ACTIVITYMANAGER_P_H
-#define ACTIVITYMANAGER_P_H
-
-#include <QObject>
-#include <QVariant>
-#include <QList>
-#include <QSize>
-#include "applicationlauncher.h"
-
-class ActivityManager;
-class HsActivityDbClient;
-
-class ActivityManagerPrivate : public QObject
-{
-
- Q_OBJECT
-
-public:
- ActivityManagerPrivate(ActivityManager *q);
- ~ActivityManagerPrivate();
-
-public slots:
- QList<QVariantHash> activitiesList();
- void launchActivity(const QUrl &uri);
- void launchActivity(int applicationId, const QString &activityId, const QVariantHash& parameters);
- void getThumbnail(QSize resolution,const QString &thumbnailPath, void *data);
-
-private:
- void launchActivity(const QVariantHash& activity);
- QUrl activityToUri(const QVariantHash& activity) const;
-
-private:
- ActivityManager *q_ptr;
- HsActivityDbClient *mServerClient;
-};
-
-#endif // ACTIVITYMANAGER_P_H
--- a/activityfw/activityserviceplugin/s60/inc/activitydatabase_p.h Fri Jun 11 16:13:51 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-#ifndef ACTIVITYDATABASE_P_H
-#define ACTIVITYDATABASE_P_H
-
-#include <QVariant>
-#include <QList>
-#include <hsactivitydbclient.h>
-class ActivityDatabasePrivate
-{
-
-public:
- ActivityDatabasePrivate();
- ~ActivityDatabasePrivate();
-
-public:
- void saveActivity(const QString &applicationName, const QString &activityName, const QVariantHash &activityMetadata);
- void deleteActivity(const QString &applicationName, const QString &activityName);
- void deleteApplicationActivities(const QString &applicationName);
- QList<QVariantHash> allActivitiesList();
- QList<QVariantHash> applicationActivitiesList(const QString &applicationName);
- QString requestedActivityName(const QString &applicationName);
- void setActivityRequestFlag(const QString &applicationName, const QString &activityName);
- void clearActivityRequestFlag(const QString &applicationName, const QString &activityName);
-
-private:
- HsActivityDbClient mClient;
-};
-
-#endif // ACTIVITYDATABASE_P_H
--- a/activityfw/activityserviceplugin/s60/inc/activityserverclient_p.h Fri Jun 11 16:13:51 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-#ifndef ACTIVITYSERVERCLIENT_P_H
-#define ACTIVITYSERVERCLIENT_P_H
-
-#include <QString>
-#include <QVariantHash>
-
-class ActivityServerClient;
-
-class ActivityServerClientPrivate
-{
-
-public:
- ActivityServerClientPrivate();
-
-public: // API used by ActivityClient
- bool addActivity(const QString &activityId, const QVariantHash ¶meters);
- bool removeActivity(const QString &activityId);
- bool updateActivity(const QString &activityId, const QVariantHash ¶meters);
- QList<QVariantHash> applicationActivities();
-
-public: // API used by ActivityManager
- bool removeActivity(int applicationId, const QString &activityId);
- bool removeApplicationActivities(int applicationId);
- QList<QVariantHash> activities();
-
-public:
- ActivityServerClient *q_ptr;
-
-};
-
-#endif // ACTIVITYSERVERCLIENT_P_H
--- a/activityfw/activityserviceplugin/s60/src/activitydatabase_p.cpp Fri Jun 11 16:13:51 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "activitydatabase_p.h"
-
-#include <QSqlDatabase>
-#include <QSqlQuery>
-#include <QSqlError>
-#include <QStringList>
-#include <QSettings>
-
-
-
-ActivityDatabasePrivate::ActivityDatabasePrivate()
-{
- mClient.connect();
-}
-
-ActivityDatabasePrivate::~ActivityDatabasePrivate()
-{
-}
-
-void ActivityDatabasePrivate::saveActivity(const QString &applicationName, const QString &activityName, const QVariantHash &activityMetadata)
-{
- QVariantHash request(activityMetadata);
- request.insert(ActivityApplicationKeyword,applicationName);
- request.insert(ActivityActivityKeyword,activityName);
- mClient.saveActivity(request);
-
-}
-
-void ActivityDatabasePrivate::deleteActivity(const QString &applicationName, const QString &activityName)
-{
- QVariantHash request;
- request.insert(ActivityApplicationKeyword,applicationName);
- request.insert(ActivityActivityKeyword,activityName);
- mClient.deleteActivity(request);
-}
-
-void ActivityDatabasePrivate::deleteApplicationActivities(const QString &applicationName)
-{
- QVariantHash request;
- request.insert(ActivityApplicationKeyword,applicationName);
- mClient.deleteApplicationActivities(request);
-}
-
-QList<QVariantHash> ActivityDatabasePrivate::allActivitiesList()
-{
- QList<QVariantHash> retVal;
- mClient.activities(retVal);
- return retVal;
-}
-
-QList<QVariantHash> ActivityDatabasePrivate::applicationActivitiesList(const QString &applicationName)
-{
- QList<QVariantHash> result;
- QVariantHash request;
- request.insert(ActivityApplicationKeyword,applicationName);
- mClient.applicationActivities(result, request);
- return result;
-}
-
-
-QString ActivityDatabasePrivate::requestedActivityName(const QString &applicationName)
-{
- QString result;
- QVariantHash request;
- request.insert(ActivityApplicationKeyword,applicationName);
- mClient.requestedActivityName(result, request);
- return result;
-}
-
-void ActivityDatabasePrivate::setActivityRequestFlag(const QString &applicationName, const QString &activityName)
-{
- QVariantHash request;
- request.insert(ActivityApplicationKeyword,applicationName);
- request.insert(ActivityActivityKeyword,activityName);
- mClient.setActivityRequestFlag(request);
-}
-
-void ActivityDatabasePrivate::clearActivityRequestFlag(const QString &applicationName, const QString &activityName)
-{
- QVariantHash request;
- request.insert(ActivityApplicationKeyword,applicationName);
- request.insert(ActivityActivityKeyword,activityName);
- mClient.clearActivityRequestFlag(request);
-}
-
--- a/activityfw/activityserviceplugin/s60/src/activityserverclient_p.cpp Fri Jun 11 16:13:51 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "activityserverclient_p.h"
-
-ActivityServerClientPrivate::ActivityServerClientPrivate()
-{
-}
-
-bool ActivityServerClientPrivate::addActivity(const QString &activityId, const QVariantHash ¶meters)
-{
- return true;
-}
-
-bool ActivityServerClientPrivate::removeActivity(const QString &activityId)
-{
- return true;
-}
-
-bool ActivityServerClientPrivate::updateActivity(const QString &activityId, const QVariantHash ¶meters)
-{
- return true;
-}
-
-QList<QVariantHash> ActivityServerClientPrivate::applicationActivities()
-{
- return QList<QVariantHash>();
-}
-
-bool ActivityServerClientPrivate::removeActivity(int applicationId, const QString &activityId)
-{
- return true;
-}
-
-bool ActivityServerClientPrivate::removeApplicationActivities(int applicationId)
-{
- return true;
-}
-
-QList<QVariantHash> ActivityServerClientPrivate::activities()
-{
- return QList<QVariantHash>();
-}
--- a/activityfw/activityserviceplugin/s60/src/applicationlauncher_p.cpp Fri Jun 11 16:13:51 2010 +0300
+++ b/activityfw/activityserviceplugin/s60/src/applicationlauncher_p.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -32,7 +32,7 @@
void ApplicationLauncherPrivate::startApplication(int applicationId, const QUrl &uri)
{
- QString commandLine = QString("-activity %1").arg(uri.toString());
+ QString commandLine = QString("-activity %1").arg(QString(uri.toEncoded()));
QT_TRAP_THROWING( {
HBufC *commandLineAsDescriptor = XQConversions::qStringToS60Desc(commandLine);
--- a/activityfw/activityserviceplugin/src/activityclient.cpp Fri Jun 11 16:13:51 2010 +0300
+++ b/activityfw/activityserviceplugin/src/activityclient.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -14,13 +14,28 @@
* Description:
*
*/
+#include <QCoreApplication>
+#include <QStringList>
+#include <QTimer>
+#include <QUrl>
+#include <QDebug>
+#include <QDir>
+
+#include <afstorageentry.h>
+#include <afstorageglobals.h>
#include "activityclient.h"
-#include "activityclient_p.h"
-
-ActivityClient::ActivityClient(QObject *parent) : QObject(parent)
+ActivityClient::ActivityClient(const QSharedPointer<AfStorageClient> &serviceProvider, QObject *parent)
+:
+ QObject(parent),
+ mServiceProvider(serviceProvider),
+ mIsconnected(false)
{
- d_ptr = new ActivityClientPrivate(this);
+ mIsconnected = ( KErrNone == mServiceProvider->connect());
+ if( mIsconnected) {
+ mServiceProvider->waitActivity();
+ }
+ connect(mServiceProvider.data(), SIGNAL(activityRequested(QString)), this, SIGNAL(activityRequested(QString)));
}
ActivityClient::~ActivityClient()
@@ -29,30 +44,95 @@
bool ActivityClient::addActivity(const QString &activityId, const QVariant &data, const QVariantHash ¶meters)
{
- return d_ptr->addActivity(activityId, data, parameters);
+ bool result(mIsconnected);
+ if (result) {
+ QVariantHash publicData(parameters);
+
+ QPixmap screenshot(publicData[ActivityScreenshotKeyword].value<QPixmap>());
+ publicData.remove(ActivityScreenshotKeyword);
+
+ RProcess process;
+ publicData.insert(ActivityApplicationKeyword, static_cast<int>(process.SecureId().iId));
+ publicData.insert(ActivityActivityKeyword, activityId);
+ AfStorageEntry entry(process.SecureId().iId, activityId, data, publicData);
+ result = (KErrNone == mServiceProvider->addActivity(entry, screenshot));
+ }
+ return result;
}
bool ActivityClient::removeActivity(const QString &activityId)
{
- return d_ptr->removeActivity(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)
{
- return d_ptr->updateActivity(activityId, data, parameters);
+ bool result(mIsconnected);
+ if (result) {
+ QVariantHash publicData(parameters);
+ QPixmap screenshot(publicData[ActivityScreenshotKeyword].value<QPixmap>());
+ publicData.remove(ActivityScreenshotKeyword);
+ RProcess process;
+ publicData.insert(ActivityApplicationKeyword, static_cast<int>(process.SecureId().iId));
+ publicData.insert(ActivityActivityKeyword, activityId);
+ AfStorageEntry entry(process.SecureId().iId, activityId, data, publicData);
+ result = (KErrNone == mServiceProvider->updateActivity(entry, screenshot));
+ }
+ return result;
}
QList<QVariantHash> ActivityClient::activities() const
{
- return d_ptr->activities();
+ 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
{
- return d_ptr->activityData(activityId);
+ 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
{
- return d_ptr->parseCommandLine(commandLineParams);
+ 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/activityclient_p.cpp Fri Jun 11 16:13:51 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,129 +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 <hsactivitydbclient.h>
-
-#include <QCoreApplication>
-#include <QStringList>
-#include <QTimer>
-#include <QUrl>
-#include <QDebug>
-#include <QDir>
-
-ActivityClientPrivate::ActivityClientPrivate(ActivityClient *q) : QObject(q), mIsconnected(false)
-{
- mServerClient = new HsActivityDbClient();
- mIsconnected = ( KErrNone == mServerClient->connect());
- if( mIsconnected) {
- mServerClient->waitActivity(QVariantHash());
- }
- connect(mServerClient, SIGNAL(activityRequested(QString)), q, SIGNAL(activityRequested(QString)));
-}
-
-ActivityClientPrivate::~ActivityClientPrivate()
-{
- delete mServerClient;
-}
-
-bool ActivityClientPrivate::addActivity(const QString &activityId, const QVariant &data, const QVariantHash ¶meters)
-{
- bool result(false);
- if (mIsconnected) {
- QVariantHash privateData;
- privateData.insert(ActivityDataKeyword, data);
- QVariantHash publicData(parameters);
- RProcess process;
- publicData.insert(ActivityApplicationKeyword, static_cast<int>(process.SecureId().iId));
- publicData.insert(ActivityActivityKeyword, activityId);
- result = (KErrNone == mServerClient->addActivity(privateData, publicData));
- }
- return result;
-}
-
-bool ActivityClientPrivate::removeActivity(const QString &activityId)
-{
- bool result(false);
- if (mIsconnected) {
- QVariantHash activity;
- RProcess process;
- activity.insert(ActivityApplicationKeyword, static_cast<int>(process.SecureId().iId));
- activity.insert(ActivityActivityKeyword, activityId);
- result = (KErrNone == mServerClient->removeActivity(activity));
- }
- return result;
-}
-
-bool ActivityClientPrivate::updateActivity(const QString &activityId, const QVariant &data, const QVariantHash ¶meters)
-{
- bool result(false);
- if (mIsconnected) {
- QVariantHash privateData;
- privateData.insert(ActivityDataKeyword, data);
- QVariantHash publicData(parameters);
- RProcess process;
- publicData.insert(ActivityApplicationKeyword, static_cast<int>(process.SecureId().iId));
- publicData.insert(ActivityActivityKeyword, activityId);
- result = (KErrNone == mServerClient->updateActivity(privateData, publicData));
- }
- return result;
-}
-
-QList<QVariantHash> ActivityClientPrivate::activities() const
-{
- QList<QVariantHash> activities;
- if (mIsconnected) {
- QVariantHash activity;
- RProcess process;
- activity.insert(ActivityApplicationKeyword, static_cast<int>(process.SecureId().iId));
- mServerClient->applicationActivities(activities, activity);
- }
- return activities;
-}
-
-QVariant ActivityClientPrivate::activityData(const QString &activityId) const
-{
- QVariant data;
- if (mIsconnected) {
- QVariantHash activity;
- RProcess process;
- activity.insert(ActivityApplicationKeyword, static_cast<int>(process.SecureId().iId));
- activity.insert(ActivityActivityKeyword, activityId);
- mServerClient->activityData(data, activity);
- }
- return data;
-}
-
-QVariantHash ActivityClientPrivate::parseCommandLine(const QStringList &commandLineParams) const
-{
- QVariantHash activityParams;
- int activityMarkerIndex = commandLineParams.indexOf("-activity");
- if (activityMarkerIndex != -1 && commandLineParams.count() - 1 > activityMarkerIndex) {
- QUrl activityUri(commandLineParams.at(activityMarkerIndex+1));
- if (activityUri.scheme() == "appto") {
- QList<QPair<QString, QString> > parameters = activityUri.queryItems();
- for (QList<QPair<QString, QString> >::const_iterator i = parameters.constBegin(); i != parameters.constEnd(); ++i) {
- activityParams.insert(i->first, i->second);
- }
-
- if (activityParams.contains("activityname") && !activityParams.value("activityname").toString().isEmpty()) {
- return activityParams;
- }
- }
- }
- return QVariantHash();
-}
--- a/activityfw/activityserviceplugin/src/activitymanager.cpp Fri Jun 11 16:13:51 2010 +0300
+++ b/activityfw/activityserviceplugin/src/activitymanager.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -15,13 +15,33 @@
*
*/
-#include "activitymanager.h"
-#include "activitymanager_p.h"
-
+#include <QStringList>
#include <QUrl>
-ActivityManager::ActivityManager(QObject *parent) : QObject(parent), d_ptr(new ActivityManagerPrivate(this))
+#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()
@@ -30,12 +50,44 @@
QList<QVariantHash> ActivityManager::activitiesList()
{
- return d_ptr->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)
{
- d_ptr->launchActivity(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)
@@ -46,10 +98,45 @@
void ActivityManager::launchActivity(int applicationId, const QString &activityId, const QVariantHash& parameters)
{
- d_ptr->launchActivity(applicationId, activityId, 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)
{
- d_ptr->getThumbnail(resolution, thumbnailPath, 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/activitymanager_p.cpp Fri Jun 11 16:13:51 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,124 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-#include "activitymanager_p.h"
-#include "activitymanager.h"
-#include <hsactivitydbclient.h>
-
-#include <QStringList>
-#include <QUrl>
-
-ActivityManagerPrivate::ActivityManagerPrivate(ActivityManager *q) : QObject(q), q_ptr(q)
-{
- mServerClient = new HsActivityDbClient();
- if(0 == mServerClient->connect()){
- mServerClient->notifyDataChange();
- }
- connect(mServerClient,
- SIGNAL(thumbnailRequested(QPixmap, void *)),
- q,
- SIGNAL(thumbnailReady(QPixmap, void *)));
- connect(mServerClient,
- SIGNAL(dataChanged()),
- q,
- SIGNAL(dataChanged()));
-}
-
-ActivityManagerPrivate::~ActivityManagerPrivate()
-{
- delete mServerClient;
-}
-
-QList<QVariantHash> ActivityManagerPrivate::activitiesList()
-{
- QList<QVariantHash> retVal;
- mServerClient->activities(retVal);
- return retVal;
-}
-
-void ActivityManagerPrivate::launchActivity(const QUrl &uri)
-{
- if (uri.scheme() != "appto")
- return;
-
- bool conversionOk(false);
- int applicationId = uri.host().toUInt(&conversionOk, 16);
- if (!conversionOk)
- return;
-
- QVariantHash activity;
- activity.insert(ActivityApplicationKeyword, applicationId);
-
- QVariantHash parameters;
- QList<QPair<QString, QString> > uriParams = uri.queryItems();
- for (QList<QPair<QString, QString> >::const_iterator i = uriParams.constBegin(); i != uriParams.constEnd(); ++i) {
- parameters.insert(i->first, i->second);
- }
-
- if (parameters.contains("activityname")) {
- activity.insert(ActivityActivityKeyword, parameters.value("activityname").toString());
- parameters.remove("activityname");
- }
-
- activity.insert(ActivityParametersKeyword, parameters);
-
- launchActivity(activity);
-}
-
-void ActivityManagerPrivate::launchActivity(int applicationId, const QString &activityId, const QVariantHash& parameters)
-{
- QVariantHash activity;
- activity.insert(ActivityApplicationKeyword, applicationId);
- activity.insert(ActivityActivityKeyword, activityId);
- activity.insert(ActivityParametersKeyword, parameters);
-
- launchActivity(activity);
-}
-
-void ActivityManagerPrivate::launchActivity(const QVariantHash &activity)
-{
- ApplicationLauncher applicationLauncher;
- int applicationId = activity.value(ActivityApplicationKeyword).toInt();
-
- if (applicationLauncher.isRunning(applicationId)) {
- mServerClient->launchActivity(activity);
- applicationLauncher.bringToForeground(applicationId);
- } else {
- applicationLauncher.startApplication(applicationId, activityToUri(activity));
- }
-}
-
-QUrl ActivityManagerPrivate::activityToUri(const QVariantHash &activity) const
-{
- QUrl uri;
- uri.setScheme("appto");
- uri.setHost(QString("%1").arg(activity.value(ActivityApplicationKeyword).toUInt(), 8, 16, QChar('0')));
-
- if (activity.contains(ActivityActivityKeyword))
- uri.addQueryItem("activityname", activity.value(ActivityActivityKeyword).toString());
-
- QVariantHash parameters = activity.value(ActivityParametersKeyword).toHash();
- foreach(const QString &key, parameters.keys()) {
- uri.addQueryItem(key, parameters.value(key).toString());
- }
-
- return uri;
-}
-
-void ActivityManagerPrivate::getThumbnail(QSize resolution,const QString &thumbnailPath, void *data)
-{
- mServerClient->getThumbnail(resolution, thumbnailPath, "image/png", data);
-}
--- a/activityfw/activityserviceplugin/src/activityserviceplugin.cpp Fri Jun 11 16:13:51 2010 +0300
+++ b/activityfw/activityserviceplugin/src/activityserviceplugin.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -30,9 +30,9 @@
Q_UNUSED(session);
if (descriptor.interfaceName() == "com.nokia.qt.activities.ActivityClient") {
- return new ActivityClient();
+ return new ActivityClient(QSharedPointer<AfStorageClient>(new AfStorageClient()));
} else if (descriptor.interfaceName() == "com.nokia.qt.activities.ActivityManager") {
- return new ActivityManager();
+ return new ActivityManager(QSharedPointer<AfStorageClient>(new AfStorageClient()));
} else {
return NULL;
}
--- a/activityfw/activityserviceplugin/win/inc/activitydatabase_p.h Fri Jun 11 16:13:51 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-#ifndef ACTIVITYDATABASE_P_H
-#define ACTIVITYDATABASE_P_H
-
-#include <QVariant>
-#include <QList>
-
-class ActivityDatabasePrivate
-{
-
-public:
- ActivityDatabasePrivate();
- ~ActivityDatabasePrivate();
-
-public:
- void saveActivity(const QString &applicationName, const QString &activityName, const QVariantHash &activityMetadata);
- void deleteActivity(const QString &applicationName, const QString &activityName);
- void deleteApplicationActivities(const QString &applicationName);
- QList<QVariantHash> allActivitiesList();
- QList<QVariantHash> applicationActivitiesList(const QString &applicationName);
- QString requestedActivityName(const QString &applicationName);
- void setActivityRequestFlag(const QString &applicationName, const QString &activityName);
- void clearActivityRequestFlag(const QString &applicationName, const QString &activityName);
-
-private:
- QList<QVariantHash> activitiesList(const QString &sqlCommand);
-
-private:
- bool checkTables();
- void recreateTables();
-
-};
-
-#endif // ACTIVITYDATABASE_P_H
--- a/activityfw/activityserviceplugin/win/src/activitydatabase_p.cpp Fri Jun 11 16:13:51 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,249 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-#include "activitydatabase_p.h"
-
-#include <QSqlDatabase>
-#include <QSqlQuery>
-#include <QSqlError>
-#include <QStringList>
-#include <QSettings>
-
-#include <hsactivitydbclient.h>
-
-const char KConnectionName[] = "ActivityDatabase";
-
-ActivityDatabasePrivate::ActivityDatabasePrivate()
-{
- // determine database localization
- QSettings settings("nokia", "activities");
- if (!settings.contains("activitydatabase")) {
- settings.setValue("activitydatabase", "C:\\activitydatabase.db");
- }
- QString databaseFile = settings.value("activitydatabase").toString();
-
- QSqlDatabase database;
- if (QSqlDatabase::contains(KConnectionName)) {
- database = QSqlDatabase::database(KConnectionName);
- } else {
- database = QSqlDatabase::addDatabase("QSQLITE", KConnectionName);
- database.setDatabaseName(databaseFile);
- if (!database.open()) {
- qFatal(qPrintable(database.lastError().text()));
- }
- }
-
- if (!checkTables()) {
- recreateTables();
- }
-}
-
-ActivityDatabasePrivate::~ActivityDatabasePrivate()
-{
- QSqlDatabase::database(KConnectionName).close();
-}
-
-void ActivityDatabasePrivate::saveActivity(const QString &applicationName, const QString &activityName, const QVariantHash &activityMetadata)
-{
- if (applicationName.isEmpty() || activityName.isEmpty() || activityMetadata.value("screenshot").isNull()) {
- qWarning("Activity entry is invalid, aborting save");
- return;
- }
-
- QVariantHash activityData(activityMetadata);
- activityData.insert(ActivityApplicationKeyword, applicationName);
- activityData.insert(ActivityActivityKeyword, activityName);
-
- // stream whole entry to bytearray
- QByteArray streamedData;
- {
- QDataStream stream(&streamedData, QIODevice::WriteOnly);
- stream << activityData;
- }
-
- QSqlDatabase database = QSqlDatabase::database(KConnectionName);
-
- if (!database.transaction()) {
- qFatal(qPrintable(database.lastError().text()));
- }
-
- // update or insert data
- {
- QSqlQuery query(database);
- if (!query.exec(QString("SELECT ApplicationName FROM Activities WHERE ApplicationName = '%1' AND ActivityName = '%2'").arg(applicationName).arg(activityName))) {
- qFatal(qPrintable(query.lastError().text()));
- }
-
- if (query.next()) {
- if (!query.prepare("UPDATE Activities SET Data = :Data WHERE ApplicationName = :ApplicationName AND ActivityName = :ActivityName")) {
- qFatal(qPrintable(query.lastError().text()));
- }
- query.bindValue(":Data", streamedData);
- query.bindValue(":ApplicationName", applicationName);
- query.bindValue(":ActivityName", activityName);
- if (!query.exec()) {
- qFatal(qPrintable(query.lastError().text()));
- }
- } else {
- if (!query.prepare("INSERT INTO Activities(ApplicationName, ActivityName, Data) VALUES(:ApplicationName, :ActivityName, :Data)")) {
- qFatal(qPrintable(query.lastError().text()));
- }
- query.bindValue(":ApplicationName", applicationName);
- query.bindValue(":ActivityName", activityName);
- query.bindValue(":Data", streamedData);
- if (!query.exec()) {
- qFatal(qPrintable(query.lastError().text()));
- }
- }
- }
-
- if (!database.commit()) {
- qFatal(qPrintable(database.lastError().text()));
- }
-}
-
-void ActivityDatabasePrivate::deleteActivity(const QString &applicationName, const QString &activityName)
-{
- QString sqlCommand = QString("DELETE FROM Activities WHERE ApplicationName = '%1' AND ActivityName = '%2'").arg(applicationName).arg(activityName);
- QSqlQuery query(QSqlDatabase::database(KConnectionName));
- if (!query.exec(sqlCommand)) {
- qFatal(qPrintable(query.lastError().text()));
- }
-}
-
-void ActivityDatabasePrivate::deleteApplicationActivities(const QString &applicationName)
-{
- QString sqlCommand = QString("DELETE FROM Activities WHERE ApplicationName = '%1'").arg(applicationName);
- QSqlQuery query(QSqlDatabase::database(KConnectionName));
- if (!query.exec(sqlCommand)) {
- qFatal(qPrintable(query.lastError().text()));
- }
-}
-
-QList<QVariantHash> ActivityDatabasePrivate::allActivitiesList()
-{
- return activitiesList("SELECT Data FROM Activities");
-}
-
-QList<QVariantHash> ActivityDatabasePrivate::applicationActivitiesList(const QString &applicationName)
-{
- return activitiesList(QString("SELECT Data FROM Activities WHERE ApplicationName = '%1'").arg(applicationName));
-}
-
-QList<QVariantHash> ActivityDatabasePrivate::activitiesList(const QString &sqlCommand)
-{
- QSqlQuery query(QSqlDatabase::database(KConnectionName));
- if (!query.exec(sqlCommand)) {
- qFatal(qPrintable(query.lastError().text()));
- }
-
- QList<QVariantHash> result;
- while (query.next()) {
- QVariantHash activityEntry;
- {
- QByteArray data(query.value(0).toByteArray());
- QDataStream stream(&data, QIODevice::ReadOnly);
- stream >> activityEntry;
- }
- result.append(activityEntry);
- }
- return result;
-}
-
-QString ActivityDatabasePrivate::requestedActivityName(const QString &applicationName)
-{
- QSqlQuery query(QSqlDatabase::database(KConnectionName));
- if (!query.exec(QString("SELECT ActivityName FROM Activities WHERE ApplicationName = '%1' AND RequestFlag").arg(applicationName))) {
- qFatal(qPrintable(query.lastError().text()));
- }
-
- QString result;
- if (query.next()) {
- result = query.value(0).toString();
- }
- return result;
-}
-
-void ActivityDatabasePrivate::setActivityRequestFlag(const QString &applicationName, const QString &activityName)
-{
- QSqlQuery query(QSqlDatabase::database(KConnectionName));
-
- // clear old requests for given application
- if (!query.exec(QString("UPDATE Activities SET RequestFlag=0 WHERE ApplicationName = '%1'").arg(applicationName))) {
- qFatal(qPrintable(query.lastError().text()));
- }
-
- // set new request
- if (!query.exec(QString("UPDATE Activities SET RequestFlag=1 WHERE ApplicationName = '%1' AND ActivityName = '%2'").arg(applicationName).arg(activityName))) {
- qFatal(qPrintable(query.lastError().text()));
- }
-}
-
-void ActivityDatabasePrivate::clearActivityRequestFlag(const QString &applicationName, const QString &activityName)
-{
- QSqlQuery query(QSqlDatabase::database(KConnectionName));
-
- // just clear the given request
- if (!query.exec(QString("UPDATE Activities SET RequestFlag=0 WHERE ApplicationName = '%1' AND ActivityName = '%2'").arg(applicationName).arg(activityName))) {
- qFatal(qPrintable(query.lastError().text()));
- }
-}
-
-bool ActivityDatabasePrivate::checkTables()
-{
- QStringList expectedTables("Activities");
- QStringList actualTables = QSqlDatabase::database(KConnectionName).tables();
- return (expectedTables == actualTables);
-}
-
-void ActivityDatabasePrivate::recreateTables()
-{
- QSqlDatabase database = QSqlDatabase::database(KConnectionName);
-
- if (!database.transaction()) {
- qFatal(qPrintable(database.lastError().text()));
- }
-
- // drop any existing tables
- {
- QSqlQuery dropQuery(database);
- foreach(const QString &tableName, database.tables()) {
- if (!dropQuery.exec(QString("DROP TABLE %1").arg(tableName))) {
- qFatal(qPrintable(dropQuery.lastError().text()));
- }
- }
- }
-
- // create new table
- {
- QSqlQuery createQuery(database);
- QString statement(
- "CREATE TABLE Activities("
- "ApplicationName TEXT NOT NULL,"
- "ActivityName TEXT NOT NULL,"
- "RequestFlag BOOL NOT NULL DEFAULT FALSE,"
- "Data BLOB NOT NULL,"
- "PRIMARY KEY(ActivityName, ApplicationName))");
-
- if (!createQuery.exec(statement)) {
- qFatal(qPrintable(createQuery.lastError().text()));
- }
- }
-
- if (!database.commit()) {
- qFatal(qPrintable(database.lastError().text()));
- }
-}
--- a/activityfw/rom/activitymanager_core.iby Fri Jun 11 16:13:51 2010 +0300
+++ b/activityfw/rom/activitymanager_core.iby Thu Jun 24 16:18:29 2010 +0300
@@ -22,8 +22,8 @@
file=ABI_DIR\BUILD_DIR\hsactivitydbserver.exe PROGRAMS_DIR\hsactivitydbserver.exe
-file=ABI_DIR\BUILD_DIR\hsactivitydbclient.dll SHARED_LIB_DIR\hsactivitydbclient.dll
-file=ABI_DIR\BUILD_DIR\tsutils.dll SHARED_LIB_DIR\tsutils.dll
+file=ABI_DIR\BUILD_DIR\afstorageclient.dll SHARED_LIB_DIR\afstorageclient.dll
+file=ABI_DIR\BUILD_DIR\tsutils.dll SHARED_LIB_DIR\tsutils.dll
file=ABI_DIR\BUILD_DIR\hbactivityplugin.dll SHARED_LIB_DIR\hbactivityplugin.dll
data=\epoc32\data\z\resource\qt\plugins\hbactivityplugin.qtplugin resource\qt\plugins\hbactivityplugin.qtplugin
--- a/activityfw/sis/activitymanager.pkg Fri Jun 11 16:13:51 2010 +0300
+++ b/activityfw/sis/activitymanager.pkg Thu Jun 24 16:18:29 2010 +0300
@@ -31,7 +31,7 @@
"/epoc32/release/armv5/urel/hsactivitydbserver.exe" - "!:\sys\bin\hsactivitydbserver.exe"
-"/epoc32/release/armv5/urel/hsactivitydbclient.dll" - "!:\sys\bin\hsactivitydbclient.dll"
+"/epoc32/release/armv5/urel/afstorageclient.dll" - "!:\sys\bin\afstorageclient.dll"
"/epoc32/release/armv5/urel/tsutils.dll" - "!:\sys\bin\tsutils.dll"
"/epoc32/release/armv5/urel/hbactivityplugin.dll" - "!:\sys\bin\hbactivityplugin.dll"
--- a/activityfw/sis/stubs/activitymanager_stub.pkg Fri Jun 11 16:13:51 2010 +0300
+++ b/activityfw/sis/stubs/activitymanager_stub.pkg Thu Jun 24 16:18:29 2010 +0300
@@ -37,7 +37,7 @@
"" - "Z:\sys\bin\hsactivitydbserver.exe"
-"" - "Z:\sys\bin\hsactivitydbclient.dll"
+"" - "Z:\sys\bin\afstorageclient.dll"
"" - "Z:\sys\bin\tsutils.dll"
"" - "Z:\sys\bin\hbactivityplugin.dll"
Binary file activityfw/sis/stubs/activitymanager_stub.sis has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/bwins/afstorageclientu.def Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,44 @@
+EXPORTS
+ ?updateActivity@AfStorageClient@@QAEHABVAfStorageEntry@@ABVQPixmap@@@Z @ 1 NONAME ; int AfStorageClient::updateActivity(class AfStorageEntry const &, class QPixmap const &)
+ ?tr@AfStorageClient@@SA?AVQString@@PBD0H@Z @ 2 NONAME ; class QString AfStorageClient::tr(char const *, char const *, int)
+ ?asyncRequestCompleated@AfStorageClient@@EAEXHHABVQString@@@Z @ 3 NONAME ; void AfStorageClient::asyncRequestCompleated(int, int, class QString const &)
+ ??_EAfStorageClient@@UAE@I@Z @ 4 NONAME ; AfStorageClient::~AfStorageClient(unsigned int)
+ ?dataChanged@AfStorageClient@@IAEXXZ @ 5 NONAME ; void AfStorageClient::dataChanged(void)
+ ?waitActivity@AfStorageClient@@QAEHXZ @ 6 NONAME ; int AfStorageClient::waitActivity(void)
+ ?asyncRequestCompleated@AfStorageClient@@EAEXHH@Z @ 7 NONAME ; void AfStorageClient::asyncRequestCompleated(int, int)
+ ?applicationId@AfStorageEntry@@QBEHXZ @ 8 NONAME ; int AfStorageEntry::applicationId(void) const
+ ?removeActivity@AfStorageClient@@QAEHABVAfStorageEntry@@@Z @ 9 NONAME ; int AfStorageClient::removeActivity(class AfStorageEntry const &)
+ ?qt_metacall@AfStorageClient@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 10 NONAME ; int AfStorageClient::qt_metacall(enum QMetaObject::Call, int, void * *)
+ ??_EAfStorageEntry@@QAE@I@Z @ 11 NONAME ; AfStorageEntry::~AfStorageEntry(unsigned int)
+ ?data@AfStorageEntry@@QBEPBVCAfEntry@@XZ @ 12 NONAME ; class CAfEntry const * AfStorageEntry::data(void) const
+ ?getStaticMetaObject@AfStorageClient@@SAABUQMetaObject@@XZ @ 13 NONAME ; struct QMetaObject const & AfStorageClient::getStaticMetaObject(void)
+ ?activityData@AfStorageClient@@QAEHAAVAfStorageEntry@@ABV2@@Z @ 14 NONAME ; int AfStorageClient::activityData(class AfStorageEntry &, class AfStorageEntry const &)
+ ?activityRequested@AfStorageClient@@IAEXABVQString@@@Z @ 15 NONAME ; void AfStorageClient::activityRequested(class QString const &)
+ ?getThumbnail@AfStorageClient@@QAEHVQSize@@VQString@@PAX@Z @ 16 NONAME ; int AfStorageClient::getThumbnail(class QSize, class QString, void *)
+ ?metaObject@AfStorageClient@@UBEPBUQMetaObject@@XZ @ 17 NONAME ; struct QMetaObject const * AfStorageClient::metaObject(void) const
+ ??0AfStorageEntry@@QAE@V?$QSharedPointer@VCAfEntry@@@@@Z @ 18 NONAME ; AfStorageEntry::AfStorageEntry(class QSharedPointer<class CAfEntry>)
+ ??0AfStorageClient@@QAE@PAVQObject@@@Z @ 19 NONAME ; AfStorageClient::AfStorageClient(class QObject *)
+ ?thumbnailRequested@AfStorageClient@@IAEXVQPixmap@@PAX@Z @ 20 NONAME ; void AfStorageClient::thumbnailRequested(class QPixmap, void *)
+ ?staticMetaObject@AfStorageClient@@2UQMetaObject@@B @ 21 NONAME ; struct QMetaObject const AfStorageClient::staticMetaObject
+ ?activities@AfStorageClient@@QAEHAAV?$QList@VAfStorageEntry@@@@@Z @ 22 NONAME ; int AfStorageClient::activities(class QList<class AfStorageEntry> &)
+ ?publicData@AfStorageEntry@@QBE?AV?$QHash@VQString@@VQVariant@@@@XZ @ 23 NONAME ; class QHash<class QString, class QVariant> AfStorageEntry::publicData(void) const
+ ??1AfStorageEntry@@QAE@XZ @ 24 NONAME ; AfStorageEntry::~AfStorageEntry(void)
+ ??0AfStorageEntry@@QAE@ABV0@@Z @ 25 NONAME ; AfStorageEntry::AfStorageEntry(class AfStorageEntry const &)
+ ?launchActivity@AfStorageClient@@QAEHABVAfStorageEntry@@@Z @ 26 NONAME ; int AfStorageClient::launchActivity(class AfStorageEntry const &)
+ ?trUtf8@AfStorageClient@@SA?AVQString@@PBD0H@Z @ 27 NONAME ; class QString AfStorageClient::trUtf8(char const *, char const *, int)
+ ?removeApplicationActivities@AfStorageClient@@QAEHABVAfStorageEntry@@@Z @ 28 NONAME ; int AfStorageClient::removeApplicationActivities(class AfStorageEntry const &)
+ ?trUtf8@AfStorageClient@@SA?AVQString@@PBD0@Z @ 29 NONAME ; class QString AfStorageClient::trUtf8(char const *, char const *)
+ ?applicationActivities@AfStorageClient@@QAEHAAV?$QList@VAfStorageEntry@@@@ABVAfStorageEntry@@@Z @ 30 NONAME ; int AfStorageClient::applicationActivities(class QList<class AfStorageEntry> &, class AfStorageEntry const &)
+ ?connect@AfStorageClient@@QAEHXZ @ 31 NONAME ; int AfStorageClient::connect(void)
+ ?tr@AfStorageClient@@SA?AVQString@@PBD0@Z @ 32 NONAME ; class QString AfStorageClient::tr(char const *, char const *)
+ ?notifyDataChange@AfStorageClient@@QAEHXZ @ 33 NONAME ; int AfStorageClient::notifyDataChange(void)
+ ?imageSrc@AfStorageEntry@@QBE?AVQString@@XZ @ 34 NONAME ; class QString AfStorageEntry::imageSrc(void) const
+ ?asyncRequestCompleated@AfStorageClient@@EAEXHHABVQPixmap@@PAX@Z @ 35 NONAME ; void AfStorageClient::asyncRequestCompleated(int, int, class QPixmap const &, void *)
+ ??0AfStorageEntry@@QAE@HABVQString@@ABVQVariant@@ABV?$QHash@VQString@@VQVariant@@@@@Z @ 36 NONAME ; AfStorageEntry::AfStorageEntry(int, class QString const &, class QVariant const &, class QHash<class QString, class QVariant> const &)
+ ?addActivity@AfStorageClient@@QAEHABVAfStorageEntry@@ABVQPixmap@@@Z @ 37 NONAME ; int AfStorageClient::addActivity(class AfStorageEntry const &, class QPixmap const &)
+ ?privateData@AfStorageEntry@@QBE?AVQVariant@@XZ @ 38 NONAME ; class QVariant AfStorageEntry::privateData(void) const
+ ??1AfStorageClient@@UAE@XZ @ 39 NONAME ; AfStorageClient::~AfStorageClient(void)
+ ?activityId@AfStorageEntry@@QBE?AVQString@@XZ @ 40 NONAME ; class QString AfStorageEntry::activityId(void) const
+ ?flags@AfStorageEntry@@QBEHXZ @ 41 NONAME ; int AfStorageEntry::flags(void) const
+ ?qt_metacast@AfStorageClient@@UAEPAXPBD@Z @ 42 NONAME ; void * AfStorageClient::qt_metacast(char const *)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/client/client.pro Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,66 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+TEMPLATE = lib
+TARGET = afstorageclient
+
+QT += core \
+ sql
+
+HEADERS += inc/afstorageclient.h \
+ inc/afstorageentry.h
+
+SOURCES += src/afstorageclient.cpp \
+ src/afstorageentry.cpp
+
+DEFINES += ACTIVITY_LIB
+
+symbian{
+TARGET.UID3 = 0xE467C21E
+
+HEADERS += ../s60/inc/afentry.h \
+ ../s60/inc/afserializer.h \
+ s60/inc/afstorageclient_p.h \
+ s60/inc/afstorageclientimp.h \
+ s60/inc/afasyncrequest_p.h \
+ s60/inc/afthumbnailrequest_p.h
+
+SOURCES += ../s60/src/afentry.cpp \
+ ../s60/src/afserializer.cpp \
+ s60/src/afstorageclient_p.cpp \
+ s60/src/afstorageclientimp.cpp \
+ s60/src/afasyncrequest_p.cpp \
+ s60/src/afthumbnailrequest_p.cpp
+
+LIBS += -lxqutils \
+ -lestor \
+ -lfbscli
+
+afstorageclientdll.sources = afstorageclient.dll
+afstorageclientdll.path = $$SHARED_LIB_DIR
+DEPLOYMENT += afstorageclientdll
+
+BLD_INF_RULES.prj_exports += "../inc/afstorageglobals.h /epoc32/include/afstorageglobals.h" \
+ "../inc/afcmd.h /epoc32/include/afcmd.h" \
+ "inc/afstorageclient.h |../../../inc/afstorageclient.h" \
+ "inc/afstorageentry.h |../../../inc/afstorageentry.h" \
+ "inc/afasyncrequestobserver.h |../../../inc/afasyncrequestobserver.h"
+DEPLOYMENT += api
+TARGET.CAPABILITY = ALL -TCB
+TARGET.EPOCALLOWDLLDATA = 1
+TARGET.UID3 = 0x200267B3
+MMP_RULES += EXPORTUNFROZEN
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/client/inc/afasyncrequestobserver.h Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef AFASYNCREQUESTOBSERVER_H
+#define AFASYNCREQUESTOBSERVER_H
+#include <QString>
+#include <QPixmap>
+
+class MAfAsyncRequestObserver
+{
+public:
+ /**
+ * Function inform observer about asynchronous request results
+ * @param result - request result
+ * @param requestType - request type
+ * @param data - respons data
+ */
+ virtual void asyncRequestCompleated(int result,
+ int requestType,
+ const QString &data)=0;
+
+ /**
+ * Function inform observer about asynchronous request results
+ * @param result - request result
+ * @param requestType - request type
+ * @param pixmap - pixmap respons
+ */
+ virtual void asyncRequestCompleated(int result,
+ int requestType,
+ const QPixmap& pixmap,
+ void* userData)=0;
+
+ /**
+ * Function inform observer about asynchronous request results
+ * @param result - request result
+ * @param requestType - request type
+ */
+ virtual void asyncRequestCompleated(int result,
+ int requestType)=0;
+};
+#endif // AFASYNCREQUESTOBSERVER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/client/inc/afstorageclient.h Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef AFSTORAGECLIENT_H
+#define AFSTORAGECLIENT_H
+#include <QObject>
+#include <afasyncrequestobserver.h>
+
+#ifdef ACTIVITY_LIB
+ #define ACTIVITY_EXPORT Q_DECL_EXPORT
+#else
+ #define ACTIVITY_EXPORT Q_DECL_IMPORT
+#endif
+
+class AfStorageClientPrivate;
+class AfStorageEntry;
+
+class ACTIVITY_EXPORT AfStorageClient: public QObject,
+ public MAfAsyncRequestObserver
+{
+ Q_OBJECT
+public:
+ AfStorageClient(QObject* =0);
+
+ ~AfStorageClient();
+
+ int connect();
+
+ int addActivity(const AfStorageEntry &entry, const QPixmap& imageSource = QPixmap());
+
+ int updateActivity(const AfStorageEntry &entry, const QPixmap& imageSource = QPixmap());
+
+ int removeActivity(const AfStorageEntry &entry);
+
+ int removeApplicationActivities(const AfStorageEntry &entry);
+
+ int activities(QList<AfStorageEntry> &dst);
+
+ int applicationActivities(QList<AfStorageEntry> &dst,
+ const AfStorageEntry &entry);
+
+ int activityData(AfStorageEntry &dst, const AfStorageEntry &entry);
+
+ int waitActivity();
+
+ int launchActivity(const AfStorageEntry &entry);
+
+ int getThumbnail(QSize size, QString imagePath, void* userDdata);
+
+ int notifyDataChange();
+
+private:
+ void asyncRequestCompleated(int, int, const QString &);
+
+ void asyncRequestCompleated(int, int, const QPixmap&, void*);
+
+ void asyncRequestCompleated(int result,
+ int requestType);
+
+signals:
+ void activityRequested(const QString &activityId);
+
+ void thumbnailRequested(QPixmap thumbnailPixmap, void *userData);
+
+ void dataChanged();
+
+private:
+ /**
+ * Private client implementation.
+ * Own.
+ */
+ AfStorageClientPrivate *d_ptr;
+
+ friend class AfStorageClientPrivate;
+};
+
+#endif //AFSTORAGECLIENT_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/client/inc/afstorageentry.h Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef AFSTORAGEENTRY_H
+#define AFSTORAGEENTRY_H
+
+#include <qvariant.h>
+#include <qsharedpointer.h>
+
+class CAfEntry;
+
+#ifdef ACTIVITY_LIB
+ #define ACTIVITY_EXPORT Q_DECL_EXPORT
+#else
+ #define ACTIVITY_EXPORT Q_DECL_IMPORT
+#endif
+
+class ACTIVITY_EXPORT AfStorageEntry
+{
+public:
+ AfStorageEntry(QSharedPointer<CAfEntry> data = QSharedPointer<CAfEntry>(0));
+
+ AfStorageEntry(const AfStorageEntry &templateEntry);
+
+ AfStorageEntry(int appId,
+ const QString &actId = QString(),
+ const QVariant &privateData = QVariant(),
+ const QVariantHash& publicData = QVariantHash());
+
+ const CAfEntry* data() const;
+
+ int flags() const;
+
+ int applicationId() const;
+
+ QString activityId() const;
+
+ QString imageSrc() const;
+
+ QVariantHash publicData() const;
+
+ QVariant privateData() const;
+
+private:
+ QSharedPointer<CAfEntry> mData;
+
+};
+
+#endif //AFSTORAGEENTRY_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/client/s60/inc/afasyncrequest_p.h Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef AFASYNCREQUESTPRIVATE_H
+#define AFASYNCREQUESTPRIVATE_H
+#include <e32base.h>
+#include <QVariant>
+#include <QPixmap>
+#include "afasyncrequestobserver.h"
+#include "afstorageclientimp.h"
+#include "afcmd.h"
+
+class CAfAsyncRequestPrivate : public CActive
+
+{
+public:
+ static void NewLD(MAfAsyncRequestObserver &observer,
+ RAfStorageClientImplementation & session,
+ ActivityCmd cmd);
+
+ ~CAfAsyncRequestPrivate();
+
+protected:
+ void DoCancel();
+
+ void RunL();
+
+ TInt RunError(TInt error);
+
+private:
+ CAfAsyncRequestPrivate(MAfAsyncRequestObserver &,
+ RAfStorageClientImplementation &,
+ ActivityCmd);
+ void ConstructL();
+
+private:
+ MAfAsyncRequestObserver &mObserver;
+ RAfStorageClientImplementation &mSession;
+ const ActivityCmd mCmd;
+ TPckgBuf<TInt> mIds[4];
+};
+#endif // AFASYNCREQUESTPRIVATE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/client/s60/inc/afstorageclient_p.h Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef AFSTORAGECLIENTPRIVATE_H
+#define AFSTORAGECLIENTPRIVATE_H
+
+#include <e32base.h>
+#include "afstorageglobals.h"
+#include "afstorageclientimp.h"
+
+class AfStorageEntry;
+class AfAsyncRequestPrivate;
+
+class AfStorageClientPrivate
+{
+public:
+ AfStorageClientPrivate(MAfAsyncRequestObserver & observer);
+
+ ~AfStorageClientPrivate();
+
+ int connect();
+
+ int addActivity(const AfStorageEntry &sourceEntry, const QPixmap& sourceImage);
+
+ int updateActivity(const AfStorageEntry &sourceEntry, const QPixmap& sourceImage);
+
+ int removeActivity(const AfStorageEntry &templateEntry);
+
+ int removeApplicationActivities(const AfStorageEntry &templateEntry);
+
+ int activities(QList<AfStorageEntry> &dst);
+
+ int applicationActivities(QList<AfStorageEntry> &dst,
+ const AfStorageEntry &entry);
+
+ int activityData(AfStorageEntry &resultEntry, const AfStorageEntry &templateEntry);
+
+ int waitActivity();
+
+ int getThumbnail(QSize size, QString imagePath , void *userDdata);
+
+ int notifyDataChange();
+
+ int launchActivity(const AfStorageEntry &templateEntry);
+
+ int cancelWaitActivity();
+
+ int cancelNotifyDataChange();
+
+private:
+ int execute(int function, const AfStorageEntry &sourceEntry, const QPixmap& sourceImage);
+ int execute(int function, QList<AfStorageEntry>& resultsList,const AfStorageEntry& templateEntry);
+
+private:
+ RAfStorageClientImplementation mImplementation;
+};
+#endif // AFSTORAGECLIENTPRIVATE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/client/s60/inc/afstorageclientimp.h Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef AFSTORAGECLIENTIMPLEMENTATION_H
+#define AFSTORAGECLIENTIMPLEMENTATION_H
+#include <e32base.h>
+#include "afasyncrequestobserver.h"
+
+class CAfEntry;
+class CFbsBitmap;
+
+class RAfStorageClientImplementation: protected RSessionBase
+{
+public:
+ RAfStorageClientImplementation(MAfAsyncRequestObserver &observer);
+
+ ~RAfStorageClientImplementation();
+
+ void Close();
+
+ void executeL(int function);
+
+ void executeL(int function,
+ const CAfEntry &sourceEntry,
+ int userData =0);
+
+ void executeL(int function,
+ RPointerArray<CAfEntry> &resultsList,
+ const CAfEntry& templateEntry);
+
+ void getThumbnailL(TSize size,
+ const TDesC& source,
+ TAny *userData );
+
+ void connectL();
+
+public:
+ void PushL(CBase* asyncTask);
+
+ void Pop(CBase* asyncTask);
+
+ void sendAsync(int function, const TIpcArgs &args, TRequestStatus& status);
+
+ void getDataL(int id, TDes8& buffer);
+
+private:
+ void startServerL();
+
+private:
+ RPointerArray<CBase> mAsyncTasks;
+ MAfAsyncRequestObserver &mObserver;
+};
+
+#endif //AFSTORAGECLIENTIMPLEMENTATION_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/client/s60/inc/afthumbnailrequest_p.h Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef AFTHUMBNAILREQUESTPRIVATE_H
+#define AFTHUMBNAILREQUESTPRIVATE_H
+#include <e32base.h>
+#include <QVariant>
+#include <QPixmap>
+#include "afasyncrequestobserver.h"
+#include "afstorageclientimp.h"
+
+class CAfThumbnailRequestPrivate : public CActive
+
+{
+public:
+ static void NewLD(MAfAsyncRequestObserver &observer,
+ RAfStorageClientImplementation & session,
+ TSize resolution,
+ const TDesC& source,
+ TAny* userData);
+
+ ~CAfThumbnailRequestPrivate();
+
+protected:
+ void DoCancel();
+
+ void RunL();
+
+ TInt RunError(TInt error);
+
+private:
+ CAfThumbnailRequestPrivate(MAfAsyncRequestObserver &,
+ RAfStorageClientImplementation &,
+ TAny*);
+
+ void ConstructL(TSize resolution, const TDesC& source);
+
+private:
+ MAfAsyncRequestObserver &mObserver;
+ RAfStorageClientImplementation &mSession;
+ TPckgBuf<TInt> mIds[4];
+ RBuf mImgSrc;
+ TAny* mUserData;
+};
+#endif // AFTHUMBNAILREQUESTPRIVATE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/client/s60/src/afasyncrequest_p.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,139 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "afasyncrequest_p.h"
+#include "afstorageclient_p.h"
+#include "afstorageclient.h"
+#include "afentry.h"
+#include <fbs.h>
+#include <XQConversions>
+
+// -----------------------------------------------------------------------------
+/**
+ * Create and initialize handler for anyc. activity requests
+ * @param observer - request completion observer
+ * @param session - activity client implementation
+ * @param cmd - requested functionality
+ */
+void CAfAsyncRequestPrivate::NewLD(MAfAsyncRequestObserver &observer,
+ RAfStorageClientImplementation & session,
+ ActivityCmd cmd)
+{
+ CAfAsyncRequestPrivate* self = new(ELeave)CAfAsyncRequestPrivate(observer, session, cmd);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ session.PushL(self);
+ CleanupStack::Pop(self);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * First phase construction
+ * @param observer - request completion observer
+ * @param session - activity client implementation
+ * @param cmd - requested functionality
+ */
+CAfAsyncRequestPrivate::CAfAsyncRequestPrivate(MAfAsyncRequestObserver & observer,
+ RAfStorageClientImplementation & session,
+ ActivityCmd cmd)
+:
+CActive(EPriorityStandard),
+mObserver(observer),
+mSession(session),
+mCmd(cmd)
+{
+ CActiveScheduler::Add(this);
+ RProcess process;
+ mIds[0] = static_cast<TInt>(process.SecureId().iId);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Second phase construction
+ */
+void CAfAsyncRequestPrivate::ConstructL()
+{
+ mSession.sendAsync(mCmd,
+ TIpcArgs(&mIds[0],&mIds[1], &mIds[2], &mIds[3]),
+ iStatus);
+ SetActive();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Destructor
+ */
+CAfAsyncRequestPrivate::~CAfAsyncRequestPrivate()
+{
+ Cancel();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Cancel pending requst
+ */
+void CAfAsyncRequestPrivate::DoCancel()
+{
+ TRAP_IGNORE(
+ switch (mCmd) {
+ case WaitActivity: mSession.executeL(CancelWait); break;
+ case NotifyChange: mSession.executeL(CancelNotify); break;
+ }
+ )
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function handle request completion, copy data, forward information and destroy handler
+ */
+void CAfAsyncRequestPrivate::RunL()
+{
+ User::LeaveIfError(iStatus.Int());
+ switch (mCmd) {
+ case WaitActivity:
+ {
+ RBuf8 data;
+ CleanupClosePushL(data);
+ CAfEntry::ReallocL(data, (mIds[0])());
+ mSession.getDataL((mIds[3])(), data);
+ mObserver.asyncRequestCompleated(iStatus.Int(), mCmd, XQConversions::s60Desc8ToQString(data));
+ CleanupStack::PopAndDestroy(&data);
+ break;
+ }
+ case NotifyChange:
+ mObserver.asyncRequestCompleated(iStatus.Int(), mCmd);
+ break;
+ }
+ mSession.Pop(this);
+ delete this;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function handle request processing errors
+ * @param error - error code
+ */
+TInt CAfAsyncRequestPrivate::RunError(TInt error)
+{
+ (WaitActivity == mCmd) ? mObserver.asyncRequestCompleated(error, mCmd, QString::null) :
+ mObserver.asyncRequestCompleated(error, mCmd);
+ mSession.Pop(this);
+ delete this;
+ return KErrNone;
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/client/s60/src/afstorageclient_p.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,282 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include <fbs.h>
+#include <s32mem.h>
+
+#include <qvariant.h>
+#include <XQConversions>
+
+#include "afstorageclient_p.h"
+#include "afasyncrequest_p.h"
+#include "afstorageglobals.h"
+#include "afserializer.h"
+#include "afentry.h"
+#include "afstorageentry.h"
+
+
+// -----------------------------------------------------------------------------
+template <class T>
+void RPointerArrayCleanupMethod(TAny *aPtr)
+{
+ static_cast< RPointerArray<T>* >(aPtr)->ResetAndDestroy();
+}
+
+// -----------------------------------------------------------------------------
+template <class T>
+void CleanupResetAndDestroyPushL(RPointerArray<T> &array) {
+ CleanupStack::PushL(TCleanupItem(&RPointerArrayCleanupMethod<T>, &array));
+}
+// -----------------------------------------------------------------------------
+/**
+ * Constructor
+ */
+AfStorageClientPrivate::AfStorageClientPrivate(MAfAsyncRequestObserver & observer)
+:
+mImplementation(observer)
+{
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Destructor
+ */
+AfStorageClientPrivate::~AfStorageClientPrivate()
+{
+ mImplementation.Close();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function implementation
+ * @see AfStorageClient::connect
+ */
+int AfStorageClientPrivate::connect()
+{
+ TRAPD(errNo, mImplementation.connectL());
+ return errNo;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function implementation
+ * @see AfStorageClient::addActivity(const AfStorageEntry &,const QPixmap&)
+ */
+int AfStorageClientPrivate::addActivity(const AfStorageEntry &entry,
+ const QPixmap& imageSrc)
+{
+ return execute(AddActivity, entry, imageSrc);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function implementation
+ * @see AfStorageClient::updateActivity(const AfStorageEntry &,const QPixmap&)
+ */
+int AfStorageClientPrivate::updateActivity(const AfStorageEntry &entry,
+ const QPixmap& imageSrc)
+{
+ return execute(UpdateActivity, entry, imageSrc);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function implementation
+ * @see AfStorageClient::removeActivity(const AfStorageEntry &)
+ */
+int AfStorageClientPrivate::removeActivity(const AfStorageEntry &entry)
+{
+ return execute(RemoveActivity, entry, QPixmap());
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function implementation
+ * @see AfStorageClient::removeApplicationActivities(const AfStorageEntry &)
+ */
+int AfStorageClientPrivate::removeApplicationActivities(const AfStorageEntry &entry)
+{
+ return execute(RemoveApplicationActivities, entry, QPixmap());
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function implementation
+ * @see AfStorageClient::activities(QList<AfStorageEntry> &)
+ */
+int AfStorageClientPrivate::activities(QList<AfStorageEntry> &results)
+{
+ return execute(Activities, results, AfStorageEntry());
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function implementation
+ * @see AfStorageClient::applicationActivities(QList<AfStorageEntry> &, const AfStorageEntry &)
+ */
+int AfStorageClientPrivate::applicationActivities(QList<AfStorageEntry> &results,
+ const AfStorageEntry &templateEntry)
+{
+ return execute(ApplicationActivities, results, templateEntry);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function implementation
+ * @see AfStorageClient::activityData(AfStorageEntry &, const AfStorageEntry &)
+ */
+int AfStorageClientPrivate::activityData(AfStorageEntry &resultEntry,
+ const AfStorageEntry &templateEntry)
+{
+
+ QList<AfStorageEntry> results;
+ int errNo(execute(ApplicationActivity, results, templateEntry));
+ if (0 == errNo) {
+ resultEntry = results.first();
+ }
+ return errNo;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function implementation
+ * @see AfStorageClient::waitActivity()
+ */
+int AfStorageClientPrivate::waitActivity()
+{
+ return execute(WaitActivity, AfStorageEntry(), QPixmap());
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function implementation
+ * @see AfStorageClient::getThumbnail(QSize, QString, void *)
+ */
+int AfStorageClientPrivate::getThumbnail(QSize size, QString imagePath, void *userData)
+{
+ HBufC *source = XQConversions::qStringToS60Desc(imagePath);
+ TRAPD(errNo, mImplementation.getThumbnailL(TSize(size.width(), size.height()), *source, userData);)
+ delete source;
+ return errNo;
+
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function implementation
+ * @see AfStorageClient::notifyDataChange()
+ */
+int AfStorageClientPrivate::notifyDataChange()
+{
+ return execute(NotifyChange, AfStorageEntry(), QPixmap());
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function implementation
+ * @see AfStorageClient::launchActivity(const AfStorageEntry &)
+ */
+int AfStorageClientPrivate::launchActivity(const AfStorageEntry &templateEntry)
+{
+ return execute(LaunchActivity, templateEntry, QPixmap());
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function implementation
+ * @see AfStorageClient::cancelWaitActivity()
+ */
+int AfStorageClientPrivate::cancelWaitActivity()
+{
+ return execute(CancelWait, AfStorageEntry(), QPixmap());
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function implementation
+ * @see AfStorageClient::cancelNotifyDataChange()
+ */
+int AfStorageClientPrivate::cancelNotifyDataChange()
+{
+ return execute(CancelNotify, AfStorageEntry(), QPixmap());
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function execute activity framework functinality and return results
+ */
+int AfStorageClientPrivate::execute(int function, const AfStorageEntry &sourceEntry, const QPixmap& sourceImage)
+{
+ TRAPD(errNo,
+ const CAfEntry *entry(sourceEntry.data());
+ int userData(-1);
+ CFbsBitmap* bitmap(sourceImage.toSymbianCFbsBitmap());
+ if(0 != bitmap) {
+ CleanupStack::PushL(bitmap);
+ userData = bitmap->Handle();
+ }
+ switch (function) {
+ case AddActivity:
+ case UpdateActivity:
+ case RemoveActivity:
+ case RemoveApplicationActivities:
+ case LaunchActivity:
+ User::LeaveIfNull(entry);
+ mImplementation.executeL(function, *entry, userData);
+ break;
+
+ case CancelNotify:
+ case CancelWait:
+ case WaitActivity:
+ case NotifyChange:
+ mImplementation.executeL(function);
+ break;
+ }
+ if(0 != bitmap) {
+ CleanupStack::PopAndDestroy(bitmap);
+ }
+ )
+ return errNo;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function execute activity framework functinality and return results
+ */
+int AfStorageClientPrivate::execute(int function, QList<AfStorageEntry>& resultsList,const AfStorageEntry& templateEntry)
+{
+ TRAPD(errNo,
+ RPointerArray<CAfEntry> results;
+ CleanupResetAndDestroyPushL<CAfEntry>(results);
+
+ CAfEntry *entry(const_cast<CAfEntry *>(templateEntry.data()));
+ if(0 == entry) {
+ entry = CAfEntry::NewLC();
+ }
+ mImplementation.executeL(function, results, *entry);
+ if(templateEntry.data() != entry) {
+ CleanupStack::PopAndDestroy(entry);
+ }
+
+ //copy data
+ while (results.Count()) {
+ resultsList.append(AfStorageEntry(QSharedPointer<CAfEntry>(results[0])));
+ results.Remove(0);
+ }
+ CleanupStack::PopAndDestroy(&results);
+ )
+ return errNo;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/client/s60/src/afstorageclientimp.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,190 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include <fbs.h>
+#include <s32mem.h>
+#include "afstorageclientimp.h"
+#include "afstorageglobals.h"
+#include "afglobals.h"
+#include "afentry.h"
+#include "afasyncrequest_p.h"
+#include "afthumbnailrequest_p.h"
+
+// -----------------------------------------------------------------------------
+/**
+ * Furst phase constructor
+ */
+RAfStorageClientImplementation::RAfStorageClientImplementation(MAfAsyncRequestObserver &observer)
+:
+mObserver(observer)
+{}
+
+// -----------------------------------------------------------------------------
+/**
+ * Destructor
+ */
+RAfStorageClientImplementation::~RAfStorageClientImplementation()
+{
+ Close();
+}
+
+// -----------------------------------------------------------------------------
+void RAfStorageClientImplementation::Close()
+{
+ mAsyncTasks.ResetAndDestroy();
+ RSessionBase::Close();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function establish connection to activity server
+ */
+void RAfStorageClientImplementation::connectL()
+{
+ const int asyncMessageSlots(12);
+ const int maxRetry(4);
+ TInt retry = maxRetry;
+ TInt errNo(KErrNone);
+ do {
+ errNo = CreateSession(KActivityServerName,
+ TVersion(0, 0, 0),
+ asyncMessageSlots);
+ if (KErrNotFound != errNo && KErrServerTerminated != errNo) {
+ retry =0;
+ } else {
+ TRAP(errNo, startServerL());
+ if (KErrNone != errNo && KErrAlreadyExists != errNo) {
+ retry =0;
+ errNo = CreateSession(KActivityServerName,
+ TVersion(0, 0, 0),
+ asyncMessageSlots);
+ }
+ }
+ } while (--retry > 0);
+ User::LeaveIfError(errNo);
+}
+
+// -----------------------------------------------------------------------------
+void RAfStorageClientImplementation::startServerL()
+{
+ RProcess server;
+ const TUidType uid(KNullUid, KNullUid, KActivityServerUid);
+ User::LeaveIfError(server.Create(KActivityServerName, KNullDesC, uid));
+ TRequestStatus stat;
+ server.Rendezvous(stat);
+ if (stat != KRequestPending) {
+ server.Kill(0);
+ } else {
+ server.Resume();
+ }
+ User::WaitForRequest(stat);
+ int errNo = (EExitPanic == server.ExitType()) ?
+ KErrGeneral : stat.Int();
+ if (KErrCancel == errNo) {
+ errNo = KErrNone;
+ }
+ server.Close();
+ User::LeaveIfError(errNo);
+}
+
+// -----------------------------------------------------------------------------
+void RAfStorageClientImplementation::executeL(int function)
+{
+ switch (function) {
+ case WaitActivity:
+ case NotifyChange:
+ CAfAsyncRequestPrivate::NewLD(mObserver, *this, static_cast<ActivityCmd>(function));
+ break;
+ default:
+ User::LeaveIfError(SendReceive(function, TIpcArgs()));
+ }
+}
+
+// -----------------------------------------------------------------------------
+void RAfStorageClientImplementation::executeL(int function,
+ const CAfEntry &entry,
+ int userData)
+{
+ TPckgBuf<TInt> data(userData);
+ RBuf8 serializedEntry;
+ CleanupClosePushL(serializedEntry);
+ serializedEntry.CreateL(entry.Size());
+ RDesWriteStream stream(serializedEntry);
+ CleanupClosePushL(stream);
+ stream << entry;
+ CleanupStack::PopAndDestroy(&stream);
+ User::LeaveIfError(SendReceive(function, TIpcArgs(&serializedEntry, &data)));
+ CleanupStack::PopAndDestroy(&serializedEntry);
+}
+
+// -----------------------------------------------------------------------------
+void RAfStorageClientImplementation::executeL(int function, RPointerArray<CAfEntry> &resultsList, const CAfEntry& templateEntry)
+{
+ resultsList.ResetAndDestroy();
+ RBuf8 buffer;
+ CleanupClosePushL(buffer);
+ CAfEntry::ReallocL(buffer, templateEntry.Size());
+ RDesWriteStream writer(buffer);
+ CleanupClosePushL(writer);
+ writer << templateEntry;
+ CleanupStack::PopAndDestroy(&writer);
+ TPckgBuf<int> length(0), taskId(0);
+ User::LeaveIfError(SendReceive(function,
+ TIpcArgs(&buffer, &length, &taskId)));
+ CAfEntry::ReallocL(buffer, length());
+ User::LeaveIfError(SendReceive(GetData, TIpcArgs(&taskId, &buffer)));
+ resultsList << buffer;
+ CleanupStack::PopAndDestroy(&buffer);
+}
+
+// -----------------------------------------------------------------------------
+void RAfStorageClientImplementation::getThumbnailL(TSize size,
+ const TDesC& source,
+ TAny *userData )
+{
+ CAfThumbnailRequestPrivate::NewLD(mObserver, *this, size, source, userData);
+}
+
+// -----------------------------------------------------------------------------
+void RAfStorageClientImplementation::PushL(CBase* asyncTask)
+{
+ const TInt offset(mAsyncTasks.Find(asyncTask));
+ (KErrNotFound == offset) ? mAsyncTasks.AppendL(asyncTask) : User::Leave(KErrAlreadyExists);
+}
+
+// -----------------------------------------------------------------------------
+void RAfStorageClientImplementation::Pop(CBase* asyncTask)
+{
+ const TInt offset(mAsyncTasks.Find(asyncTask));
+ if (KErrNotFound != offset) {
+ mAsyncTasks.Remove(offset);
+ }
+}
+
+// -----------------------------------------------------------------------------
+void RAfStorageClientImplementation::sendAsync(int function,
+ const TIpcArgs& args,
+ TRequestStatus& status)
+{
+ SendReceive(function, args, status);
+}
+
+// -----------------------------------------------------------------------------
+void RAfStorageClientImplementation::getDataL(int id, TDes8& buffer)
+{
+ TPckgBuf<int> requestId(id);
+ SendReceive(GetData, TIpcArgs(&requestId, &buffer));
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/client/s60/src/afthumbnailrequest_p.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,132 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include <fbs.h>
+#include <XQConversions>
+
+#include "afthumbnailrequest_p.h"
+#include "afstorageclient_p.h"
+#include "afstorageclient.h"
+#include "afentry.h"
+
+// -----------------------------------------------------------------------------
+/**
+ * Create and initialize handler for activity thumbnail request
+ * @param observer - request completion observer
+ * @param session - activity client implementation
+ * @param source - thumbnail source location
+ * @param userData - rsponse user data
+ */
+void CAfThumbnailRequestPrivate::NewLD(MAfAsyncRequestObserver &observer,
+ RAfStorageClientImplementation & session,
+ TSize resolution,
+ const TDesC& source,
+ TAny* userData)
+{
+ CAfThumbnailRequestPrivate* self = new(ELeave)CAfThumbnailRequestPrivate(observer, session, userData);
+ CleanupStack::PushL(self);
+ self->ConstructL(resolution, source);
+ session.PushL(self);
+ CleanupStack::Pop(self);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Constructor
+ * @param observer - request completion observer
+ * @param session - activity client implementation
+ * @param userData - rsponse user data
+ */
+CAfThumbnailRequestPrivate::CAfThumbnailRequestPrivate(MAfAsyncRequestObserver & observer,
+ RAfStorageClientImplementation & session,
+ TAny* userData)
+:
+CActive(EPriorityStandard),
+mObserver(observer),
+mSession(session),
+mUserData(userData)
+{
+ CActiveScheduler::Add(this);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Second phase constructor
+ * @param resolution - requested thumbnail resolution
+ * @param source - thumbnail source location
+ */
+void CAfThumbnailRequestPrivate::ConstructL(TSize resolution, const TDesC& source)
+{
+ mIds[0] = resolution.iWidth;
+ mIds[1] = resolution.iHeight;
+ CAfEntry::CopyL(mImgSrc, source);
+ mSession.sendAsync(GetThumbnail,
+ TIpcArgs(&mIds[0],&mIds[1], &mImgSrc),
+ iStatus);
+ SetActive();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Destuctor
+ */
+CAfThumbnailRequestPrivate::~CAfThumbnailRequestPrivate()
+{
+ Cancel();
+ mImgSrc.Close();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Cancel pending requst
+ */
+void CAfThumbnailRequestPrivate::DoCancel()
+{
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function handle request completion, copy data, forward information and destroy handler
+ */
+void CAfThumbnailRequestPrivate::RunL()
+{
+ User::LeaveIfError(iStatus.Int());
+ CFbsBitmap* bitmap = new (ELeave) CFbsBitmap();
+ CleanupStack::PushL(bitmap);
+ User::LeaveIfError(bitmap->Duplicate(mIds[0]()));
+ mObserver.asyncRequestCompleated(iStatus.Int(),
+ GetThumbnail,
+ QPixmap::fromSymbianCFbsBitmap(bitmap),
+ mUserData);
+ CleanupStack::PopAndDestroy(bitmap);
+ mSession.Pop(this);
+ delete this;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function handle request processing errors
+ * @param error - error code
+ */
+TInt CAfThumbnailRequestPrivate::RunError(TInt error)
+{
+ mObserver.asyncRequestCompleated(error, GetThumbnail, QPixmap(), mUserData);
+ mSession.Pop(this);
+ delete this;
+ return KErrNone;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/client/src/afstorageclient.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,228 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "afstorageclient.h"
+#include "afstorageclient_p.h"
+
+// -----------------------------------------------------------------------------
+/**
+ * Constructor
+ */
+AfStorageClient::AfStorageClient(QObject *obj)
+:
+QObject(obj),
+d_ptr(0)
+{
+ d_ptr = new AfStorageClientPrivate(*this);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Destructor
+ */
+AfStorageClient::~AfStorageClient()
+{
+ delete d_ptr;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Establish connection with activity server
+ * @return 0 on succees, error code otherwise
+ */
+int AfStorageClient::connect()
+{
+ return d_ptr->connect();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation.
+ * @see int MAfAsyncRequestObserver::asyncRequestCompleated(int, int, const QString&)
+ */
+void AfStorageClient::asyncRequestCompleated(int result,
+ int requestType,
+ const QString& data)
+{
+ switch (requestType) {
+ case WaitActivity:
+ if (KErrCancel != result) {
+ waitActivity();
+ }
+ if (KErrNone == result) {
+ emit activityRequested(data);
+ }
+
+ break;
+ }
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation.
+ * @see int MAfAsyncRequestObserver::asyncRequestCompleated(int, int, QPixmap&, void*)
+ */
+void AfStorageClient::asyncRequestCompleated(int result,
+ int requestType,
+ const QPixmap& pixmap,
+ void* userData)
+{
+ switch (requestType) {
+ case GetThumbnail:
+ emit thumbnailRequested(0 == result ? pixmap : QPixmap(),
+ userData);
+ break;
+ }
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation.
+ * @see int MAfAsyncRequestObserver::asyncRequestCompleated(int, int)
+ */
+void AfStorageClient::asyncRequestCompleated(int result,int requestType)
+{
+ switch(requestType) {
+ case NotifyChange:
+ if (KErrCancel != result) {
+ notifyDataChange();
+ }
+ if (KErrNone == result) {
+ emit dataChanged();
+ }
+ break;
+ }
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function add new activity
+ * @param entry - activity entry data structure
+ * @param imageSource - source for activity thumbnail
+ * @return 0 on success, error code otherwise
+ */
+int AfStorageClient::addActivity(const AfStorageEntry &entry, const QPixmap &imageSource)
+{
+ return d_ptr->addActivity(entry, imageSource);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function update existing activity
+ * @param entry - activity entry data structure
+ * @param imageSource - source for activity thumbnail
+ * @return 0 on success, error code otherwise
+ */
+int AfStorageClient::updateActivity(const AfStorageEntry &entry,
+ const QPixmap &imageSource)
+{
+ return d_ptr->updateActivity(entry, imageSource);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function remove existing activity
+ * @param entry - activity entry template
+ * @return 0 on success, error code otherwise
+ */
+int AfStorageClient::removeActivity(const AfStorageEntry &entry)
+{
+ return d_ptr->removeActivity(entry);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function remove existing activities for application
+ * @param entry - activity entry template
+ * @return 0 on success, error code otherwise
+ */
+int AfStorageClient::removeApplicationActivities(const AfStorageEntry &entry)
+{
+ return d_ptr->removeApplicationActivities(entry);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function retreive public data for all activities
+ * @param dst - list of results
+ * @return 0 on success, error code otherwise
+ */
+int AfStorageClient::activities(QList<AfStorageEntry> &dst)
+{
+ return d_ptr->activities(dst);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function retreive public data for all application activities
+ * @param dst - list of results
+ * @param entry - activity template
+ * @return 0 on success, error code otherwise
+ */
+int AfStorageClient::applicationActivities(QList<AfStorageEntry> &dst,
+ const AfStorageEntry &entry)
+{
+ return d_ptr->applicationActivities(dst, entry);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function retreive all data for requested activity
+ * @param dst - activity entry
+ * @param entry - activity template
+ * @return 0 on success, error code otherwise
+ */
+int AfStorageClient::activityData(AfStorageEntry &dst, const AfStorageEntry &entry)
+{
+ return d_ptr->activityData(dst, entry);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function subscribe application for notyfication about requested activity changes
+ * @return 0 on success, error code otherwise
+ */
+int AfStorageClient::waitActivity()
+{
+ return d_ptr->waitActivity();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function request activity change
+ * @param entry - activity template
+ * @return 0 on success, error code otherwise
+ */
+int AfStorageClient::launchActivity(const AfStorageEntry &entry)
+{
+ return d_ptr->launchActivity(entry);
+}
+
+// -----------------------------------------------------------------------------
+int AfStorageClient::getThumbnail(QSize size, QString imagePath, void* userDdata)
+{
+ return d_ptr->getThumbnail(size, imagePath, userDdata);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Function subscribe launcher for data model changes
+ * @return 0 on success, error code otherwise
+ */
+int AfStorageClient::notifyDataChange()
+{
+ return d_ptr->notifyDataChange();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/client/src/afstorageentry.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,171 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include <xqconversions.h>
+
+#include "afstorageentry.h"
+#include "afentry.h"
+#include "afserializer.h"
+#include "afstorageglobals.h"
+// -----------------------------------------------------------------------------
+/**
+ * Constructor.
+ * Initialize object with preallocated symbian specyfic data structure. Function doesn't copy content
+ * @param data - pointer to symbian specyfic data structure
+ */
+AfStorageEntry::AfStorageEntry(QSharedPointer<CAfEntry> data)
+:
+mData(data)
+{}
+
+// -----------------------------------------------------------------------------
+/**
+* Constructor
+* Initialize object with preallocated data structure. Function doesn't copy content
+* @param data - activity data structure
+*/
+AfStorageEntry::AfStorageEntry(const AfStorageEntry &data)
+:
+ mData(data.mData)
+{}
+
+// -----------------------------------------------------------------------------
+/**
+ * Constructor
+ * Initialize object with data. Function do deep copy of data
+ * @param appId - unique application identifier
+ * @param actId - activity identifier
+ * @param privateData - private part of activity data
+ * @param publicData - public part of activity data
+ */
+AfStorageEntry::AfStorageEntry(int appId,
+ const QString &actId,
+ const QVariant &privateData,
+ const QVariantHash& publicData)
+:
+ mData(0)
+{
+ int flags(0);
+ QVariantHash privData;
+ privData.insert(ActivityDataKeyword, privateData);
+ RBuf8 privateBuff, publicBuff;
+ CleanupClosePushL(privateBuff);
+ CleanupClosePushL(publicBuff);
+ privateBuff << privData;
+ publicBuff << publicData;
+
+ if (publicData.end() != publicData.find(ActivityPersistence) &&
+ publicData[ActivityPersistence].toBool()) {
+ flags |= CAfEntry::Persistent;
+ }
+
+ if (publicData.end() != publicData.find(ActivityVisibility) &&
+ !publicData[ActivityVisibility].toBool()) {
+ flags |= CAfEntry::Invisible;
+ }
+
+ HBufC *actBuff = XQConversions::qStringToS60Desc(actId);
+ CleanupStack::PushL(actBuff);
+ mData = QSharedPointer<CAfEntry>(CAfEntry::NewL(flags,
+ appId,
+ *actBuff,
+ KNullDesC,
+ privateBuff,
+ publicBuff));
+ CleanupStack::PopAndDestroy(actBuff);
+ CleanupStack::PopAndDestroy(&publicBuff);
+ CleanupStack::PopAndDestroy(&privateBuff);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Retrieve S60 structure representation
+ */
+const CAfEntry* AfStorageEntry::data() const
+{
+ return mData.data();
+}
+
+
+// -----------------------------------------------------------------------------
+/**
+ * Retrieve activity flags
+ * @return activity flags
+ */
+int AfStorageEntry::flags() const
+{
+ return mData->Flags();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Retrieve application unique identifier
+ * @return application identifier
+ */
+int AfStorageEntry::applicationId() const
+{
+ return mData->ApplicationId();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Retrieve activity identifier. Identyfier is unique for each application
+ * @return activity identifier
+ */
+QString AfStorageEntry::activityId() const
+{
+ return XQConversions::s60DescToQString(mData->ActivityId());
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Retrieve path to activity thumbanil path
+ * @return thumbail loacation path
+ */
+QString AfStorageEntry::imageSrc() const
+{
+ return XQConversions::s60DescToQString(mData->ImageSrc());
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Retrieve public part of activity data
+ * @return public activity data
+ */
+QVariantHash AfStorageEntry::publicData() const
+{
+ QVariantHash deserializedData;
+ deserializedData << mData->Data(CAfEntry::Public);
+ deserializedData.insert(ActivityApplicationKeyword, applicationId());
+ deserializedData.insert(ActivityActivityKeyword, activityId());
+ deserializedData.insert(ActivityScreenshotKeyword, imageSrc());
+ deserializedData.insert(ActivityPersistence, (flags() & CAfEntry::Persistent) ? true : false);
+ deserializedData.insert(ActivityVisibility, (flags() & CAfEntry::Invisible) ? false : true);
+ return deserializedData;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Retrieve private part of activity data
+ * @return private activity data
+ */
+QVariant AfStorageEntry::privateData() const
+{
+ QVariantHash deserializedData;
+ deserializedData << mData->Data(CAfEntry::Private);
+ return deserializedData[ActivityDataKeyword];
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/eabi/afstorageclientu.def Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,48 @@
+EXPORTS
+ _ZN14AfStorageEntryC1E14QSharedPointerI8CAfEntryE @ 1 NONAME
+ _ZN14AfStorageEntryC1ERKS_ @ 2 NONAME
+ _ZN14AfStorageEntryC1EiRK7QStringRK8QVariantRK5QHashIS0_S3_E @ 3 NONAME
+ _ZN14AfStorageEntryC2E14QSharedPointerI8CAfEntryE @ 4 NONAME
+ _ZN14AfStorageEntryC2ERKS_ @ 5 NONAME
+ _ZN14AfStorageEntryC2EiRK7QStringRK8QVariantRK5QHashIS0_S3_E @ 6 NONAME
+ _ZN15AfStorageClient10activitiesER5QListI14AfStorageEntryE @ 7 NONAME
+ _ZN15AfStorageClient11addActivityERK14AfStorageEntryRK7QPixmap @ 8 NONAME
+ _ZN15AfStorageClient11dataChangedEv @ 9 NONAME
+ _ZN15AfStorageClient11qt_metacallEN11QMetaObject4CallEiPPv @ 10 NONAME
+ _ZN15AfStorageClient11qt_metacastEPKc @ 11 NONAME
+ _ZN15AfStorageClient12activityDataER14AfStorageEntryRKS0_ @ 12 NONAME
+ _ZN15AfStorageClient12getThumbnailE5QSize7QStringPv @ 13 NONAME
+ _ZN15AfStorageClient12waitActivityEv @ 14 NONAME
+ _ZN15AfStorageClient14launchActivityERK14AfStorageEntry @ 15 NONAME
+ _ZN15AfStorageClient14removeActivityERK14AfStorageEntry @ 16 NONAME
+ _ZN15AfStorageClient14updateActivityERK14AfStorageEntryRK7QPixmap @ 17 NONAME
+ _ZN15AfStorageClient16notifyDataChangeEv @ 18 NONAME
+ _ZN15AfStorageClient16staticMetaObjectE @ 19 NONAME DATA 16
+ _ZN15AfStorageClient17activityRequestedERK7QString @ 20 NONAME
+ _ZN15AfStorageClient18thumbnailRequestedE7QPixmapPv @ 21 NONAME
+ _ZN15AfStorageClient19getStaticMetaObjectEv @ 22 NONAME
+ _ZN15AfStorageClient21applicationActivitiesER5QListI14AfStorageEntryERKS1_ @ 23 NONAME
+ _ZN15AfStorageClient22asyncRequestCompleatedEii @ 24 NONAME
+ _ZN15AfStorageClient22asyncRequestCompleatedEiiRK7QPixmapPv @ 25 NONAME
+ _ZN15AfStorageClient22asyncRequestCompleatedEiiRK7QString @ 26 NONAME
+ _ZN15AfStorageClient27removeApplicationActivitiesERK14AfStorageEntry @ 27 NONAME
+ _ZN15AfStorageClient7connectEv @ 28 NONAME
+ _ZN15AfStorageClientC1EP7QObject @ 29 NONAME
+ _ZN15AfStorageClientC2EP7QObject @ 30 NONAME
+ _ZN15AfStorageClientD0Ev @ 31 NONAME
+ _ZN15AfStorageClientD1Ev @ 32 NONAME
+ _ZN15AfStorageClientD2Ev @ 33 NONAME
+ _ZNK14AfStorageEntry10activityIdEv @ 34 NONAME
+ _ZNK14AfStorageEntry10publicDataEv @ 35 NONAME
+ _ZNK14AfStorageEntry11privateDataEv @ 36 NONAME
+ _ZNK14AfStorageEntry13applicationIdEv @ 37 NONAME
+ _ZNK14AfStorageEntry4dataEv @ 38 NONAME
+ _ZNK14AfStorageEntry5flagsEv @ 39 NONAME
+ _ZNK14AfStorageEntry8imageSrcEv @ 40 NONAME
+ _ZNK15AfStorageClient10metaObjectEv @ 41 NONAME
+ _ZTI15AfStorageClient @ 42 NONAME
+ _ZTV15AfStorageClient @ 43 NONAME
+ _ZThn8_N15AfStorageClient22asyncRequestCompleatedEii @ 44 NONAME
+ _ZThn8_N15AfStorageClient22asyncRequestCompleatedEiiRK7QPixmapPv @ 45 NONAME
+ _ZThn8_N15AfStorageClient22asyncRequestCompleatedEiiRK7QString @ 46 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/inc/afcmd.h Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef AFCMD_H
+#define AFCMD_H
+
+const TInt KRequestAppIdOffset(0);
+const TInt KRequestActOffset(1);
+const TInt KRequestData(2);
+const TInt KRequestIdOffset(0);
+
+const TInt KResponseDataSizeOffset(0);
+const TInt KResponseIdOffset(3);
+const TInt KResponseDataOffset(1);
+
+
+enum ActivityCmd {
+ AddActivity =0,
+ UpdateActivity,
+ RemoveActivity,
+ RemoveApplicationActivities,
+ Activities,
+ ApplicationActivities,
+ ApplicationActivity,
+ WaitActivity,
+ LaunchActivity,
+ GetThumbnail,
+ GetData,
+ NotifyChange,
+ CancelWait,
+ CancelNotify
+};
+
+#endif //AFCMD_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/inc/afstorageglobals.h Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef AFSTORAGEGLOBALS_H
+#define AFSTORAGEGLOBALS_H
+#include <qvariant.h>
+#include <afcmd.h>
+/**
+ * Enumerate supported functions
+ */
+
+const char ActivityApplicationKeyword [] = ":ApplicationId";
+const char ActivityActivityKeyword [] = ":ActivityName";
+const char ActivityParametersKeyword [] = ":ActivityParams";
+const char ActivityPersistence [] = ":ActivityPersistence";
+const char ActivityVisibility [] = ":ActivityVisibility";
+const char ActivityScreenshotKeyword [] = "screenshot";
+const char ActivityDataKeyword [] = ":ActivityData";
+const char ActivityApplicationName[] = ":ApplicationName";
+
+#endif //AFSTORAGEGLOBALS_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/s60/inc/afentry.h Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,133 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef AFENTRYDATA_H
+#define AFENTRYDATA_H
+
+#include <e32base.h>
+#include <s32strm.h>
+class RDbColWriteStream;
+class RDbColReadStream;
+const TInt KAfMask(0x0001);
+
+#ifdef AF_ADD_MASK
+#undef AF_ADD_MASK
+#endif
+#define AF_ADD_MASK(n) (KAfMask << n)
+
+class CAfEntry: public CBase
+{
+public:
+ enum AccessRights {
+ Private =0,
+ Public
+ };
+
+ enum Flags {
+ Invisible = KAfMask,
+ Persistent = 0x40000000,
+ };
+
+public:
+ static CAfEntry* NewL();
+
+ static CAfEntry* NewLC();
+
+ static CAfEntry* NewL(TInt flags,
+ TInt applicationId,
+ const TDesC &activityId,
+ const TDesC &imgSrc,
+ const TDesC8 &privateData,
+ const TDesC8 &publicData);
+
+ static CAfEntry* NewLC(TInt flags,
+ TInt applicationId,
+ const TDesC &activityId,
+ const TDesC &imgSrc,
+ const TDesC8 &privateData,
+ const TDesC8 &publicData);
+
+ static CAfEntry* NewLC(const RMessage2& msg,
+ int offset =0);
+
+ ~CAfEntry();
+
+ TInt Size() const;
+
+ TInt DataSize() const;
+
+ void ExternalizeL(RWriteStream &stream) const;
+
+ void InternalizeL(RReadStream &stream);
+
+ void ExternalizeDataOnlyL(RWriteStream &stream) const;
+
+ void InternalizeDataOnlyL(RReadStream &stream);
+
+ TInt Flags() const;
+
+ TInt ApplicationId() const;
+
+ const TDesC& ActivityId() const;
+
+ const TDesC& ImageSrc() const;
+
+ void SetImageSrcL(const TDesC& src);
+
+ const TDesC8& Data(CAfEntry::AccessRights rights) const;
+
+ void SetDataL(const TDesC8& src, CAfEntry::AccessRights rights);
+
+ static void ReallocL(RBuf8 &dst,TInt length);
+
+ static void ReallocL(RBuf &dst,TInt length);
+
+ static void CopyL(RBuf8 &dst,const TDesC8 &src);
+
+ static void CopyL(RBuf &dst,const TDesC &src);
+
+private:
+ CAfEntry();
+
+ void ConstructL(TInt flags,
+ TInt applicationId,
+ const TDesC &activityId,
+ const TDesC &imgSrc,
+ const TDesC8 &privateData,
+ const TDesC8 &publicData);
+
+ static void InternalizeL(RBuf8 &dst, RReadStream &src);
+
+ static void InternalizeL(RBuf &dst, RReadStream &src);
+
+ static void ExternalizeL(RWriteStream &dst,const TDesC8 & src);
+
+ static void ExternalizeL(RWriteStream &dst,const TDesC& src);
+private:
+ TInt mFlags;
+ TInt mAppId;
+ RBuf mActivityId;
+ RBuf mImgSrc;
+ RBuf8 mPrivateData;
+ RBuf8 mPublicData;
+
+};
+
+RPointerArray<CAfEntry>& operator <<(RPointerArray<CAfEntry>& dst, const TDesC8 &src);
+
+RBuf8& operator << (RBuf8 &dst, const RPointerArray<CAfEntry>& src);
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/s60/inc/afglobals.h Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef AFGLOBALS_H
+#define AFGLOBALS_H
+
+#include <e32base.h>
+const TUid KActivityServerUid = {0x200267B4};
+_LIT(KActivityServerName, "hsactivitydbserver");
+_LIT(KErr400, "Bad Reqest");
+_LIT(KErr403, "Access denied");
+
+#endif //AFGLOBALS_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/s60/inc/afserializer.h Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef HSSERIALIZER_H
+#define HSSERIALIZER_H
+
+#include <qvariant.h>
+
+/**
+ * Operator serialize VarinatHash to RBuf8
+ */
+RBuf8 &operator <<(RBuf8 &dst, const QVariantHash &src);
+
+/**
+ * Operator deserialize RBuf8 to VarinatHash
+ */
+QVariantHash &operator <<(QVariantHash &dst, const TDesC8 &src);
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/s60/src/afentry.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,461 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "afentry.h"
+#include <s32mem.h>
+
+// -----------------------------------------------------------------------------
+/**
+ * Two-phase constructor. Create and initialize instance
+ * @return entry instance
+ */
+CAfEntry* CAfEntry::NewL()
+{
+ CAfEntry *self = CAfEntry::NewLC();
+ CleanupStack::Pop(self);
+ return self;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Two-phase constructor. Create, initialize and push instance into cleanup stack
+ * @return entry instance
+ */
+CAfEntry* CAfEntry::NewLC()
+{
+ CAfEntry *self = new (ELeave)CAfEntry();
+ CleanupStack::PushL(self);
+ return self;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Two-phase constructor. Create and initialize instance
+ * @param flags - entry flags
+ * @param applicationId - application unique identifier
+ * @param activityId - activity unique identifier
+ * @param imgSrc - thumbanail source
+ * @param privateData - privated application data
+ * @param publicData - public activity data
+ * @return entry instance
+ */
+CAfEntry* CAfEntry::NewL(TInt flags,
+ TInt applicationId,
+ const TDesC &activityId,
+ const TDesC &imgSrc,
+ const TDesC8 &privateData,
+ const TDesC8 &publicData)
+{
+ CAfEntry* self = CAfEntry::NewLC(flags,
+ applicationId,
+ activityId,
+ imgSrc,
+ privateData,
+ publicData);
+ CleanupStack::Pop(self);
+ return self;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Two-phase constructor. Create, initialize and push instance into cleanup stack
+ * @param flags - entry flags
+ * @param applicationId - application unique identifier
+ * @param activityId - activity unique identifier
+ * @param imgSrc - thumbanail source
+ * @param privateData - privated application data
+ * @param publicData - public activity data
+ * @return entry instance
+ */
+CAfEntry* CAfEntry::NewLC(TInt flags,
+ TInt applicationId,
+ const TDesC &activityId,
+ const TDesC &imgSrc,
+ const TDesC8 &privateData,
+ const TDesC8 &publicData)
+{
+ CAfEntry *self = CAfEntry::NewLC();
+ self->ConstructL(flags,
+ applicationId,
+ activityId,
+ imgSrc,
+ privateData,
+ publicData);
+ return self;
+}
+
+// -----------------------------------------------------------------------------
+CAfEntry* CAfEntry::NewLC(const RMessage2& msg, int offset)
+{
+ CAfEntry* self = CAfEntry::NewLC();
+ RBuf8 serializedEntry;
+ CleanupClosePushL(serializedEntry);
+ ReallocL(serializedEntry, msg.GetDesMaxLength(offset));
+ msg.ReadL(offset, serializedEntry);
+ RDesReadStream entryReader(serializedEntry);
+ CleanupClosePushL(entryReader);
+ entryReader >> (*self);
+ CleanupStack::PopAndDestroy(&entryReader);
+ CleanupStack::PopAndDestroy(&serializedEntry);
+ return self;
+}
+// -----------------------------------------------------------------------------
+/**
+ * First phase constructor
+ */
+CAfEntry::CAfEntry()
+{
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Second phase constructor. Initialize instance
+ * @param flags - entry flags
+ * @param applicationId - application unique identifier
+ * @param activityId - activity unique identifier
+ * @param imgSrc - thumbanail source
+ * @param privateData - privated application data
+ * @param publicData - public activity data
+ */
+void CAfEntry::ConstructL(TInt flags,
+ TInt applicationId,
+ const TDesC &activityId,
+ const TDesC &imgSrc,
+ const TDesC8 &privateData,
+ const TDesC8 &publicData)
+{
+ mFlags = flags;
+ mAppId = applicationId;
+ CopyL(mActivityId, activityId);
+ CopyL(mImgSrc, imgSrc);
+ CopyL(mPrivateData, privateData);
+ CopyL(mPublicData, publicData);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Destructor. Release allocated resources
+ */
+CAfEntry::~CAfEntry()
+{
+ mActivityId.Close();
+ mPrivateData.Close();
+ mPublicData.Close();
+ mImgSrc.Close();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Provide size of serialized entry
+ * @return size of serialized entry instance
+ */
+TInt CAfEntry::Size() const
+{
+ return (sizeof(TInt) * 3) + //flags + appId + actId size info
+ mActivityId.Size() + //actId content size
+ DataSize(); //data size
+
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Provide size of serialized entry
+ * @return size of serialized entry instance
+ */
+TInt CAfEntry::DataSize() const
+{
+ return (sizeof(TInt) * 3) + //privData size info + pubData size info + imgSrc size info
+ mImgSrc.Size() + //imgSize content size
+ mPrivateData.Size() + //privData content size
+ mPublicData.Size(); //pubData content size
+}
+// -----------------------------------------------------------------------------
+/**
+ * Serialize entry content into output stream.
+ * @param stream - output stream
+ */
+void CAfEntry::ExternalizeL(RWriteStream &stream) const
+{
+ stream.WriteInt32L(mFlags);
+ stream.WriteInt32L(mAppId);
+ ExternalizeL(stream, mActivityId);
+ ExternalizeDataOnlyL(stream);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Deserialize entry content from input stream
+ * @param stream - input stream
+ */
+void CAfEntry::InternalizeL(RReadStream &stream)
+{
+ mFlags = stream.ReadInt32L();
+ mAppId = stream.ReadInt32L();
+ InternalizeL(mActivityId, stream);
+ InternalizeDataOnlyL(stream);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Serialize entry content into output stream.
+ * @param stream - output stream
+ */
+void CAfEntry::ExternalizeDataOnlyL(RWriteStream &stream) const
+{
+ ExternalizeL(stream, mImgSrc);
+ ExternalizeL(stream, mPrivateData);
+ ExternalizeL(stream, mPublicData);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Deserialize entry content from input stream
+ * @param stream - input stream
+ */
+void CAfEntry::InternalizeDataOnlyL(RReadStream &stream)
+{
+
+ InternalizeL(mImgSrc, stream);
+ InternalizeL(mPrivateData, stream);
+ InternalizeL(mPublicData, stream);
+
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Provide access to activity flags
+ * @return activity flags
+ */
+TInt CAfEntry::Flags() const
+{
+ return mFlags;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Provide access to activity identifier.
+ * @return activity identifier
+ */
+TInt CAfEntry::ApplicationId() const
+{
+ return mAppId;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Provide access to activity identifier.
+ * @return activity identifier
+ */
+const TDesC& CAfEntry::ActivityId() const
+{
+ return mActivityId;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Provide access to activity data.
+ * @param rights - type of requested data
+ * @return activity data
+ */
+const TDesC8& CAfEntry::Data(CAfEntry::AccessRights rights) const
+{
+ return Private == rights ? mPrivateData : mPublicData;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Provide access to activity data.
+ * @param rights - type of requested data
+ * @return activity data
+ */
+void CAfEntry::SetDataL(const TDesC8& src, CAfEntry::AccessRights rights)
+{
+ CopyL(Private == rights ? mPrivateData : mPublicData, src);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Provide access to activity thumbail path
+ * @return path to activity thumbnail
+ */
+const TDesC& CAfEntry::ImageSrc() const
+{
+ return mImgSrc;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Set new value of image source
+ */
+void CAfEntry::SetImageSrcL(const TDesC& src)
+{
+ CopyL(mImgSrc, src);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Reallocate blob buffer to requested size
+ * @param dst - destination buffer
+ * @param length - requested length
+ */
+void CAfEntry::ReallocL(RBuf8 &dst,TInt length)
+{
+ if (0 < length) {
+ if (dst.MaxLength() < length) {
+ dst.ReAllocL(length);
+ }
+ } else {
+ dst.Close();
+ }
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Reallocate text buffer to requested size
+ * @param dst - destination buffer
+ * @param length - requested length
+ */
+void CAfEntry::ReallocL(RBuf &dst,TInt length)
+{
+ if (0 < length) {
+ if (dst.MaxLength() < length) {
+ dst.ReAllocL(length);
+ }
+ } else {
+ dst.Close();
+ }
+}
+// -----------------------------------------------------------------------------
+/**
+ * Copy blob content from input stream
+ * @param dst - destination buffer
+ * @param src - source buffer
+ */
+void CAfEntry::CopyL(RBuf8 &dst,const TDesC8 &src)
+{
+ ReallocL(dst, src.Length());
+ if(0 < src.Length()) {
+ dst.Copy(src);
+ }
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Copy text content from input buffer
+ * @param dst - destination buffer
+ * @param src - source buffer
+ */
+void CAfEntry::CopyL(RBuf &dst,const TDesC &src)
+{
+ ReallocL(dst, src.Length());
+ if(0 < src.Length()) {
+ dst.Copy(src);
+ }
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Deserialize blob content from input stream
+ * @param dst - destination buffer
+ * @param src - input stream
+ */
+void CAfEntry::InternalizeL(RBuf8 &dst, RReadStream &src)
+{
+ const TInt length(src.ReadInt32L());
+ ReallocL(dst, length);
+ if (0 < length) {
+ src.ReadL(dst, length);
+ }
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Deserialize text content from input stream
+ * @param dst - destination buffer
+ * @param src - input stream
+ */
+void CAfEntry::InternalizeL(RBuf &dst, RReadStream &src)
+{
+ const TInt length(src.ReadInt32L());
+ ReallocL(dst, length);
+ if (0 < length) {
+ src.ReadL(dst, length);
+ }
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Serialize blob content into output stream
+ * @param dst - destination stream
+ * @param src - input buffer
+ */
+void CAfEntry::ExternalizeL(RWriteStream &dst,const TDesC8 & src)
+{
+ dst.WriteInt32L(src.Length());
+ if (src.Length()) {
+ dst.WriteL(src, src.Length());
+ }
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Serialize text content into output stream
+ * @param dst - destination stream
+ * @param src - input buffer
+ */
+void CAfEntry::ExternalizeL(RWriteStream &dst,const TDesC& src)
+{
+ dst.WriteInt32L(src.Length());
+ if (src.Length()) {
+ dst.WriteL(src, src.Length());
+ }
+}
+
+// -----------------------------------------------------------------------------
+RPointerArray<CAfEntry>& operator <<(RPointerArray<CAfEntry>& dst, const TDesC8 &src)
+{
+ dst.ResetAndDestroy();
+ RDesReadStream srcStream(src);
+ CleanupClosePushL(srcStream);
+ int numOfItems(srcStream.ReadInt32L());
+ for (int i(0); i < numOfItems; ++i) {
+ CAfEntry *entry = CAfEntry::NewLC();
+ srcStream >> (*entry);
+ dst.AppendL(entry);
+ CleanupStack::Pop(entry);
+ }
+ CleanupStack::PopAndDestroy(&srcStream);
+ return dst;
+}
+
+// -----------------------------------------------------------------------------
+RBuf8& operator <<(RBuf8 &dst, const RPointerArray<CAfEntry>& src)
+{
+ int iter(0),
+ requiredSize(sizeof(int));
+ for(iter =0; iter< src.Count(); ++iter) {
+ requiredSize += src[iter]->Size();
+ }
+ CAfEntry::ReallocL(dst, requiredSize);
+ RDesWriteStream dstStream(dst);
+ CleanupClosePushL(dstStream);
+ dstStream.WriteInt32L(src.Count());
+ for (iter =0; iter < src.Count(); ++iter) {
+ dstStream << *(src[iter]);
+ }
+ CleanupStack::PopAndDestroy(&dstStream);
+ return dst;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/s60/src/afserializer.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include <s32mem.h>
+#include "afserializer.h"
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+RBuf8 &operator <<(RBuf8 &dst, const QVariantHash &src)
+{
+ QByteArray buffer;
+ QDataStream stream(&buffer, QIODevice::WriteOnly);
+
+ QT_TRYCATCH_LEAVING(stream << src);
+ const int dataLength(buffer.length());
+ const unsigned char *dataPtr(reinterpret_cast<const unsigned char *>(buffer.constData()));
+ if (dst.MaxLength() < dataLength) {
+ dst.ReAllocL(dataLength);
+ }
+ dst.Copy(dataPtr, dataLength);
+ return dst;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+QVariantHash &operator <<(QVariantHash &dst, const TDesC8 &src)
+{
+ QByteArray buffer(QByteArray::fromRawData(reinterpret_cast<const char *>(src.Ptr()),
+ src.Length()) );
+
+ QDataStream stream(&buffer, QIODevice::ReadOnly);
+ QT_TRYCATCH_LEAVING(stream >> dst);
+ return dst;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/group/bld.inf Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,21 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_MMPFILES
+server.mmp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/group/server.mmp Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+TARGET hsactivitydbserver.exe
+TARGETTYPE exe
+UID 0 0x200267B4
+
+MW_LAYER_SYSTEMINCLUDE
+
+USERINCLUDE ../inc
+USERINCLUDE ../../inc
+USERINCLUDE ../../s60/inc
+USERINCLUDE ../../../../inc
+
+SOURCEPATH ../src
+SOURCE main.cpp
+SOURCE afserver.cpp
+SOURCE afsession.cpp
+SOURCE afstorage.cpp
+SOURCE afdataprovidertask.cpp
+SOURCE afbroadcasttask.cpp
+SOURCE afstoragesynctask.cpp
+SOURCE afstorageasynctask.cpp
+SOURCE afobservertask.cpp
+SOURCE afthumbnailtask.cpp
+
+SOURCEPATH ../../s60/src
+SOURCE afentry.cpp
+
+LIBRARY euser.lib
+LIBRARY estor.lib
+LIBRARY edbms.lib
+LIBRARY efsrv.lib
+LIBRARY bafl.lib
+LIBRARY fbscli.lib
+LIBRARY hash.lib
+LIBRARY bitmaptransforms.lib
+LIBRARY imageconversion.lib
+LIBRARY tsutils.lib
+
+CAPABILITY ALL -TCB
+EPOCHEAPSIZE 0x100000 0x600000 // 1MB - 6MB
+
+#ifdef ENABLE_ABIV2_MODE
+DEBUGGABLE_UDEBONLY
+#endif
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/inc/afbroadcasttask.h Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef AFBROADCASTTASK_H
+#define AFBROADCASTTASK_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+#include "aftaskstorage.h"
+#include "aftask.h"
+
+class AfBroadcastTask
+{
+public:
+ static void ExecuteL(MAfTaskStorage& storage, const RMessage2& msg);
+};
+
+#endif // AFBROADCASTTASK_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/inc/afdataprovidertask.h Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef AFDATAPROVIDERTASK_H
+#define AFDATAPROVIDERTASK_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+#include "aftaskstorage.h"
+#include "aftask.h"
+
+class AfDataProviderTask
+{
+public:
+ static void ExecuteL(MAfTaskStorage& storage, const RMessage2& msg);
+
+private:
+ static void ProvideDataL(const RMessage2& msg, const CAfTask& src);
+
+};
+
+#endif // AFDATAPROVIDERTASK_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/inc/afobservertask.h Thu Jun 24 16:18:29 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 AFOBSERVERTASK_H
+#define AFOBSERVERTASK_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+#include "aftask.h"
+#include "aftaskstorage.h"
+
+class CAfObserverTask : public CAfTask
+{
+public:
+ ~CAfObserverTask();
+
+ static void ExecuteLD(MAfTaskStorage& globalStorage,
+ MAfTaskStorage& localStorage,
+ const RMessage2& msg);
+
+ const TDesC8& Data() const;
+
+ void BroadcastReceivedL(const RMessage2& );
+
+private:
+ CAfObserverTask(MAfTaskStorage& globalStorage,
+ MAfTaskStorage& localStorage,
+ const RMessage2& msg);
+
+ void WriteResponseL();
+
+ TBool IsSessionTask(const CSession2* session);
+
+private:
+ MAfTaskStorage& mGlobalStorage;
+ MAfTaskStorage& mLocalStorage;
+ const RMessage2 mMsg;
+ RBuf8 mData;
+};
+
+#endif // AFOBSERVERTASK_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/inc/afqueries.h Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef AFQUERIES_H
+#define AFQUERIES_H
+
+
+#include <e32base.h>
+
+_LIT( KSelectRow, "SELECT * FROM Activities WHERE ApplicationId=%S AND ActivityName='%S'");
+_LIT( KSelectRows, "SELECT * FROM Activities");
+_LIT( KSelectAppRows, "SELECT * FROM Activities WHERE ApplicationId=%S");
+_LIT( KDeleteRow, "DELETE FROM Activities WHERE ApplicationId=%S AND ActivityName='%S'");
+_LIT( KDeleteRows, "DELETE FROM Activities WHERE ApplicationId=%S");
+_LIT( KDeleteNonPersistentActivities, "DELETE FROM Activities WHERE Flags<%S");
+
+_LIT(KApplicationColumnName, "ApplicationId");
+_LIT(KActivityColumnName, "ActivityName");
+_LIT(KFlagsColumnName, "Flags");
+_LIT(KDataColumnName, "Data");
+
+_LIT(KActivityTableName, "Activities");
+_LIT(KActivityIndexName, "ActivitiesKey");
+#endif // AFQUERIES_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/inc/afserver.h Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef AFSERVER_H
+#define AFSERVER_H
+
+#define __E32SVR_H__
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <f32file.h> // RFs
+
+#include "aftaskstorage.h"
+
+class CAfStorage;
+
+class CAfServer : public CServer2,
+ public MAfTaskStorage
+{
+public:
+ ~CAfServer();
+
+ static CAfServer* NewLC();
+
+public:
+ void PushL(CAfTask *);
+
+ void Pop(CAfTask *);
+
+ const RPointerArray<CAfTask>& StorageData() const;
+
+
+private:
+ CAfServer();
+
+ void ConstructL();
+
+ CSession2* NewSessionL(const TVersion& version, const RMessage2& message) const;
+
+ void RemoveNotValidTasks(const CSession2* session);
+
+private:
+ RFs mFsSession;
+ CAfStorage* mStorage;
+ RPointerArray<CAfTask> mObservers;
+};
+
+#endif // AFSERVER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/inc/afsession.h Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef AFSESSION_H
+#define AFSESSION_H
+
+#ifndef __E32SVR_H__
+#define __E32SVR_H__
+#endif
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <f32file.h>
+
+#include "aftaskstorage.h"
+
+class CAfStorage;
+
+class CAfSession : public CSession2,
+ public MAfTaskStorage
+{
+public:
+ ~CAfSession();
+
+ static CAfSession* NewL(RFs& fileSession,
+ MAfTaskStorage& taskStorage,
+ CAfStorage&storage);
+
+public:
+ void PushL(CAfTask *);
+
+ void Pop(CAfTask *);
+
+ const RPointerArray<CAfTask>& StorageData() const;
+
+ void RemoveNotValidTasks(const CSession2* session);
+
+private:
+ CAfSession(RFs& fileSession,
+ MAfTaskStorage& taskStorage,
+ CAfStorage& storage);
+
+ void ConstructL();
+
+private:
+ void ServiceL(const RMessage2& message);
+
+private:
+ RFs& mFileSession;
+ MAfTaskStorage& mTasksStorage;
+ CAfStorage& mStorage;
+ RPointerArray<CAfTask> mRunningTasks;
+};
+
+#endif // AFSESSION_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/inc/afstorage.h Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,116 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef AFSTORAGE_H
+#define AFSTORAGE_H
+
+#define __E32SVR_H__
+
+#include <e32std.h>
+#include <e32base.h>
+#include <d32dbms.h> // RDbStoreDatabase
+#include <s32file.h> // CFileStore & CPermanentFileStore
+#include "afentry.h"
+
+class CAfStorage : public CBase
+ {
+public:
+ ~CAfStorage();
+
+ static CAfStorage* NewL(RFs& session);
+
+ void AddActivityL(CAfEntry &entry);
+
+ void UpdateActivityL(CAfEntry &entry);
+
+ void DeleteActivityL(CAfEntry &entry);
+
+ void DeleteActivitiesL(CAfEntry &entry);
+
+ void ActivitiesL(RPointerArray<CAfEntry> &dst);
+
+ void ActivitiesL(RPointerArray<CAfEntry> &dst, TInt appId);
+
+ void ActivityL(RPointerArray<CAfEntry> &dst, CAfEntry &src);
+
+ RFs& Fs();
+
+ static void ThumbnailPathL(RBuf &dst,
+ RFs& fileSystem,
+ TInt uid,
+ const TDesC &activityName,
+ TBool persistent);
+
+ static void StoragePathL(RBuf &dst,
+ RFs& fileSystem,
+ TBool persistent);
+ static void AppStoragePathL(RBuf &dst,
+ RFs& fileSystem,
+ TInt uid,
+ TBool persistent);
+private:
+ static HBufC8* Md5HexDigestL(const TDesC8 &string);
+
+private:
+ CAfStorage(RFs& session);
+
+ void ConstructL();
+
+ void CreateDbL(const TDesC& databaseFile);
+
+ void OpenDbL(const TDesC& databaseFile);
+
+ void CreateTableL();
+
+ void DeleteNonPersistentActivitiesL();
+
+ void GetActivitiesL(const TDesC& dst);
+
+ HBufC* SelectRowLC(TInt appId, const TDesC& actId) const;
+
+ HBufC* SelectRowsLC(TInt appId) const;
+
+ HBufC* DeleteRowLC(TInt appId, const TDesC& actId) const;
+
+ HBufC* DeleteRowsLC(TInt appId) const;
+
+ HBufC* BuildQueryLC(const TDesC& format, TInt appId, const TDesC& actId) const;
+
+ void ActivitiesL(RPointerArray<CAfEntry>& dst,
+ const TDesC& query,
+ CAfEntry::AccessRights rights,
+ TInt limit = 0);
+
+ void ActivitiesL(RPointerArray<CAfEntry>& dst,
+ RDbView& query,
+ CAfEntry::AccessRights rights,
+ TInt limit = 0);
+
+ void GetActivityForUpdateL(RDbView& query, TInt appId, const TDesC& actId);
+
+ void ReadDataL(RBuf& dst, RDbRowSet& src, TInt offset) const;
+
+ void ExternalizeDataL(RDbRowSet &dst,const CAfEntry & src, TInt offset) const;
+
+ void InternalizeDataL(CAfEntry &dst, RDbRowSet& src, TInt offset) const;
+
+private:
+ RFs& mFsSession;
+ RDbStoreDatabase mActDb;/* For database operations */
+ CFileStore* mFileStore; /* For creating and opening database files */
+};
+
+#endif //AFSTORAGE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/inc/afstorageasynctask.h Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef AFSTORAGEASYNCTASK_H
+#define AFSTORAGEASYNCTASK_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+#include "aftask.h"
+#include "aftaskstorage.h"
+#include "afstorage.h"
+
+class CAfStorageAsyncTask : public CAfTask
+{
+public:
+ ~CAfStorageAsyncTask();
+
+ static void ExecuteLD(MAfTaskStorage& taskStorage,
+ CAfStorage& dataStorage,
+ const RMessage2& msg);
+
+ const TDesC8& Data() const;
+
+ void BroadcastReceivedL(const RMessage2 &);
+
+private:
+ CAfStorageAsyncTask();
+
+ void ExecuteL(CAfStorage& dataStorage, const RMessage2& msg);
+
+ void AllActivitiesL(CAfStorage& dataStorage, const RMessage2& msg);
+
+ void ApplicationActivitiesL(CAfStorage& dataStorage, const RMessage2& msg);
+
+ void ApplicationActivityL(CAfStorage& dataStorage, const RMessage2& msg);
+
+ void WriteResponseL(const RMessage2& msg);
+
+ TBool IsSessionTask(const CSession2* session);
+
+ void ExternalizeL();
+
+private:
+ RBuf8 mExternalizedData;
+ RPointerArray<CAfEntry> mInternalizedData;
+};
+
+#endif // AFSTORAGEASYNCTASK_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/inc/afstoragesynctask.h Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef AFSTORAGESYNCTASK_H
+#define AFSTORAGESYNCTASK_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+#include "aftask.h"
+#include "afstorage.h"
+#include "aftaskstorage.h"
+
+class CAfEntry;
+/**
+ * CActivityStorageSyncTask
+ *
+ */
+class AfStorageSyncTask
+ {
+public:
+ static void ExecuteL(MAfTaskStorage& observers,
+ CAfStorage& dataStorage,
+ const RMessage2& msg);
+
+private:
+ static void AddActivityL(CAfStorage& dataStorage,
+ const RMessage2& msg);
+
+ static void UpdateActivityL(CAfStorage& dataStorage,
+ const RMessage2& msg);
+
+ static void DeleteActivityL(CAfStorage& dataStorage,
+ const RMessage2& msg);
+
+ static void DeleteApplicationActivitiesL(CAfStorage& dataStorage,
+ const RMessage2& msg);
+
+ static void NotifyChangeL(MAfTaskStorage& observers,
+ const RMessage2& msg);
+
+ static void CreateThumbnailL(const TDesC &path, TInt hdl);
+
+ static void DeleteActivityScreenshotL(CAfStorage& dataStorage,
+ TInt uid,
+ const TDesC &activityName);
+ };
+
+#endif // AFSTORAGESYNCTASK_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/inc/aftask.h Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef AFTASK_H
+#define AFTASK_H
+
+#include <e32base.h>
+
+class CAfTask: public CBase
+{
+public:
+ /**
+ * Return task data
+ */
+ virtual const TDesC8& Data() const =0;
+
+ /**
+ * Notify instance about incoming broadcast message.
+ * @param msg - broadcast message
+ */
+ virtual void BroadcastReceivedL(const RMessage2& msg) =0;
+
+ /**
+ * Returns ETrue if task is related with session argument
+ */
+ virtual TBool IsSessionTask(const CSession2* session) =0;
+};
+
+#endif //AFTASK_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/inc/aftaskstorage.h Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef AFTASKSTORAGE_H
+#define AFTASKSTORAGE_H
+#include <e32base.h>
+class CAfTask;
+class MAfTaskStorage
+{
+public:
+ /**
+ * Register new task instance in storage. Ownership is transfered to storage.
+ * @param task - instance that need to be registered
+ */
+ virtual void PushL(CAfTask * task)=0;
+
+ /**
+ * Unregister task instance from storage. Ownership is transfered to caller.
+ * @param task - instance that need to be unregistered
+ */
+ virtual void Pop(CAfTask *)=0;
+
+ /**
+ * List of registered tasks
+ */
+ virtual const RPointerArray<CAfTask>& StorageData() const =0;
+
+ /**
+ * Removes not valid task
+ */
+ virtual void RemoveNotValidTasks(const CSession2* session) =0;
+};
+
+#endif //AFTASKSTORAGE_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/inc/afthumbnailtask.h Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef AFTHUMBNAILTASK_H
+#define AFTHUMBNAILTASK_H
+
+#ifndef __E32SVR_H__
+#define __E32SVR_H__
+#endif
+
+#include <e32std.h>
+#include <e32base.h>
+#include <f32file.h>
+
+#include "aftask.h"
+#include "aftaskstorage.h"
+#include "tsgraphicfilescalinghandler.h"
+
+class CFbsBitmap;
+
+class CAfThumbnailTask : public CAfTask,
+ public MImageReadyCallBack
+{
+public:
+ ~CAfThumbnailTask();
+
+ static void ExecuteLD(MAfTaskStorage& taskStorage,
+ const RMessage2& message);
+
+private:
+ CAfThumbnailTask(MAfTaskStorage& storage, const RMessage2 msg);
+
+ void ConstructL();
+
+ void ImageReadyCallBack(TInt error, const CFbsBitmap *bitmap );
+
+ const TDesC8& Data()const;
+
+ void BroadcastReceivedL(const RMessage2& );
+
+ TBool IsSessionTask(const CSession2* session);
+
+private:
+ MAfTaskStorage& mStorage;
+ const RMessage2 mMsg;
+ CBase* mService;
+};
+
+#endif // AFTHUMBNAILTASK_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/server.pro Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,20 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+TEMPLATE = subdirs
+
+BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include \"group/bld.inf\""
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/src/afbroadcasttask.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "afbroadcasttask.h"
+
+// -----------------------------------------------------------------------------
+/**
+ * Handle broadccast message request
+ * @param storage - observer tasks storage
+ * @param msg - request message that will be provided to observers
+ */
+void AfBroadcastTask::ExecuteL(MAfTaskStorage& storage,
+ const RMessage2& msg)
+{
+ const RPointerArray<CAfTask> &tasks(storage.StorageData());
+ for (TInt iter(tasks.Count() - 1); iter >= 0 ; --iter ) {
+ if(EFalse == msg.IsNull()) {
+ (tasks[iter])->BroadcastReceivedL(msg);
+ }
+ }
+ if(EFalse == msg.IsNull()) {
+ msg.Complete(KErrNone);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/src/afdataprovidertask.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "afdataprovidertask.h"
+#include "afcmd.h"
+
+// -----------------------------------------------------------------------------
+/**
+ * Handle data request. Deliver data stored in other task.
+ * @param storage - data tasks storage
+ * @param msg - request message
+ */
+void AfDataProviderTask::ExecuteL(MAfTaskStorage& storage,
+ const RMessage2& msg)
+{
+ TPckgBuf<void*> requestId;
+ CAfTask* taskPtr(0);
+ msg.Read(KRequestIdOffset, requestId);
+
+ for (TInt iter(0);iter <storage.StorageData().Count();++iter) {
+ taskPtr = storage.StorageData()[iter];
+ if (taskPtr == requestId()) {//compare requested task address with storage objects
+ ProvideDataL(msg, *taskPtr);
+ storage.Pop(taskPtr);
+ delete taskPtr;
+ return;
+ }
+ }
+ User::Leave(KErrNotFound);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Write response data to request message
+ * @param msg - destination message
+ * @param src - data source
+ */
+void AfDataProviderTask::ProvideDataL(const RMessage2& msg,
+ const CAfTask& src)
+{
+ if (EFalse ==msg.IsNull()) {
+ msg.WriteL(KResponseDataOffset, src.Data());
+ msg.Complete(KErrNone);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/src/afobservertask.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,144 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "afobservertask.h"
+#include "afcmd.h"
+#include "afentry.h"
+// -----------------------------------------------------------------------------
+/**
+ * Constructor for performing 1st stage construction
+ * @param globalStorage - global observers storage
+ * @param localStorage - local observers storage
+ * @param msg - request message
+ */
+CAfObserverTask::CAfObserverTask(MAfTaskStorage& globalStorage,
+ MAfTaskStorage& localStorage,
+ const RMessage2& msg)
+:
+ mGlobalStorage(globalStorage),
+ mLocalStorage(localStorage),
+ mMsg(msg)
+{
+ // No implementation required
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Destructor.
+ */
+CAfObserverTask::~CAfObserverTask()
+{
+ mData.Close();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Handle observer request.
+ * @param globalStorage - global observers storage
+ * @param localStorage - local observers storage
+ * @param msg - request message
+ */
+
+void CAfObserverTask::ExecuteLD(MAfTaskStorage& globalStorage,
+ MAfTaskStorage& localStorage,
+ const RMessage2& msg)
+{
+ CAfObserverTask *self = new(ELeave)CAfObserverTask(globalStorage,
+ localStorage,
+ msg);
+ CleanupStack::PushL(self);
+ globalStorage.PushL(self);
+ CleanupStack::Pop(self);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see CActivityTask::Data()
+ */
+const TDesC8& CAfObserverTask::Data() const
+{
+ return mData;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see CActivityTask::BroadcastReceivedL(const RMessage2&)
+ */
+void CAfObserverTask::BroadcastReceivedL(const RMessage2& msg)
+{
+ if(EFalse != mMsg.IsNull()) {
+ mGlobalStorage.Pop(this);//
+ mLocalStorage.Pop(this);
+ delete this;
+ } else if (WaitActivity == mMsg.Function() &&
+ LaunchActivity == msg.Function()) {
+
+ CAfEntry* entry = CAfEntry::NewLC(msg);
+ TPckgBuf<TInt> observerdId;
+ mMsg.ReadL(KRequestAppIdOffset, observerdId);
+ if (observerdId() == entry->ApplicationId()) {
+ CAfEntry::ReallocL(mData, entry->ActivityId().Length());
+ mData.Copy(entry->ActivityId());
+ WriteResponseL();
+ mLocalStorage.PushL(this);
+ mGlobalStorage.Pop(this);
+ mMsg.Complete(KErrNone);
+ }
+ CleanupStack::PopAndDestroy(entry);
+
+ } else if (WaitActivity == mMsg.Function() &&
+ CancelWait == msg.Function() &&
+ mMsg.Session() == msg.Session()) {
+ mGlobalStorage.Pop(this);
+ mMsg.Complete(KErrCancel);
+ delete this;
+ } else if (NotifyChange == mMsg.Function() &&
+ CancelNotify == msg.Function() &&
+ mMsg.Session() == msg.Session()) {
+ mGlobalStorage.Pop(this);
+ mMsg.Complete(KErrCancel);
+ delete this;
+ } else if(NotifyChange == mMsg.Function() &&
+ (AddActivity == msg.Function() ||
+ UpdateActivity == msg.Function() ||
+ RemoveActivity == msg.Function() ||
+ RemoveApplicationActivities == msg.Function())){
+ mMsg.Complete(KErrNone);
+ mGlobalStorage.Pop(this);
+ delete this;
+ }
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Write response data to requested message
+ */
+void CAfObserverTask::WriteResponseL()
+{
+ mMsg.WriteL(KResponseDataSizeOffset, TPckgBuf<TInt>(mData.Length()));//write data size
+ mMsg.WriteL(KResponseIdOffset, TPckgBuf<CBase*>(this));//task identyfier
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Returns ETrue if task is related with session argument
+ */
+TBool CAfObserverTask::IsSessionTask(const CSession2* session)
+{
+ return mMsg.Session() == session ? ETrue : EFalse;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/src/afserver.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,134 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include <fbs.h>
+
+#include "afserver.h"
+#include "afsession.h"
+#include "afstorage.h"
+#include "aftask.h"
+
+_LIT( KActivityServerName, "hsactivitydbserver" );
+_LIT(KObserverAlreadyExists, "Observer task exists");
+
+// -----------------------------------------------------------------------------
+/**
+ * Constructor for performing 1st stage construction
+ */
+CAfServer::CAfServer()
+:
+CServer2( EPriorityStandard )
+{
+ // No implementation required
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Destructor.
+ */
+CAfServer::~CAfServer()
+{
+ delete mStorage;
+ mFsSession.Close();
+ mObservers.ResetAndDestroy();
+ RFbsSession::Disconnect();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Two-phased constructor.
+ */
+CAfServer* CAfServer::NewLC()
+{
+ CAfServer* self = new (ELeave) CAfServer();
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ return self;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Default constructor for performing 2nd stage construction
+ */
+void CAfServer::ConstructL()
+{
+ StartL(KActivityServerName);
+ User::LeaveIfError(mFsSession.Connect());
+ User::LeaveIfError(RFbsSession::Connect(mFsSession));
+ mStorage = CAfStorage::NewL(mFsSession);
+ mObservers.Array();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see CServer2::NewSessionL(const TVersion&, const RMessage2&)
+ */
+CSession2* CAfServer::NewSessionL(const TVersion &, const RMessage2&) const
+{
+ return CAfSession::NewL(const_cast<CAfServer*>(this)->mFsSession,
+ *const_cast<CAfServer*>(this),
+ *mStorage);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see MAfTaskStorage::PushL(CAfTask *)
+ */
+void CAfServer::PushL(CAfTask * task)
+{
+ (KErrNotFound == mObservers.Find(task)) ?
+ mObservers.AppendL(task) :
+ User::Panic(KObserverAlreadyExists, KErrAlreadyExists);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see MAfTaskStorage::Pop(CActivityTask *)
+ */
+void CAfServer::Pop(CAfTask *task)
+{
+ const TInt offset(mObservers.Find(task));
+ if (KErrNotFound != offset) {
+ mObservers.Remove(offset);
+ }
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see MAfTaskStorage::StorageData()
+ */
+const RPointerArray<CAfTask>& CAfServer::StorageData() const
+{
+ return mObservers;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Removes not valid task
+ */
+void CAfServer::RemoveNotValidTasks(const CSession2* session)
+{
+ for (TInt i=mObservers.Count()-1; i>=0; --i) {
+ if( mObservers[i]->IsSessionTask(session) ) {
+ delete mObservers[i];
+ mObservers.Remove(i);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/src/afsession.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,177 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "afsession.h"
+#include "aftask.h"
+#include "afcmd.h"
+
+#include "afstorageasynctask.h"
+#include "afstoragesynctask.h"
+#include "afobservertask.h"
+#include "afbroadcasttask.h"
+#include "afdataprovidertask.h"
+#include "afthumbnailtask.h"
+
+_LIT(KTaskAlreadyExists, "Activity task exists");
+
+// -----------------------------------------------------------------------------
+/**
+ * Constructor for performing 1st stage construction
+ * @param fileSession - initialized file system session
+ * @param taskStorage - global observers storage
+ * @param storage - data storage
+ */
+
+CAfSession::CAfSession(RFs& fileSession,
+ MAfTaskStorage& taskStorage,
+ CAfStorage& storage)
+:
+mFileSession(fileSession),
+mTasksStorage(taskStorage),
+mStorage(storage)
+{
+ // No implementation required
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Destructor.
+ */
+CAfSession::~CAfSession()
+{
+ RemoveNotValidTasks(this);
+ mTasksStorage.RemoveNotValidTasks(this);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Two-phased constructor.
+ * @param fileSession - initialized file system session
+ * @param taskStorage - global observers storage
+ * @param storage - data storage
+ */
+CAfSession* CAfSession::NewL(RFs& fileSession,
+ MAfTaskStorage& taskStorage,
+ CAfStorage& storage)
+{
+ CAfSession* self = new (ELeave) CAfSession(fileSession,
+ taskStorage,
+ storage);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ return self;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * EPOC default constructor for performing 2nd stage construction
+ */
+void CAfSession::ConstructL()
+{
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Implements interface
+ * @see void CSession2::ServiceL(const RMessage2&)
+ */
+void CAfSession::ServiceL(const RMessage2& message)
+{
+ switch (message.Function()) {
+ case AddActivity:
+ case UpdateActivity:
+ case RemoveActivity:
+ case RemoveApplicationActivities:
+ AfStorageSyncTask::ExecuteL(mTasksStorage, mStorage, message);
+ break;
+
+ case ApplicationActivity:
+ case Activities:
+ case ApplicationActivities:
+ CAfStorageAsyncTask::ExecuteLD(*this, mStorage, message);
+ break;
+
+ case WaitActivity:
+ case NotifyChange:
+ CAfObserverTask::ExecuteLD(mTasksStorage, *this, message);
+ break;
+
+ case GetThumbnail:
+ CAfThumbnailTask::ExecuteLD(*this, message);
+ break;
+
+ case LaunchActivity:
+ case CancelWait:
+ case CancelNotify:
+ AfBroadcastTask::ExecuteL(mTasksStorage, message);
+ break;
+
+ case GetData:
+ AfDataProviderTask::ExecuteL(*this,message);
+ break;
+
+ default:
+ message.Complete(CServer2::EBadMessageNumber);
+ break;
+ }
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see MAfTaskStorage::PushL(CAfTask *)
+ */
+void CAfSession::PushL(CAfTask * task)
+{
+ (KErrNotFound == mRunningTasks.Find(task)) ?
+ mRunningTasks.AppendL(task) :
+ User::Panic(KTaskAlreadyExists, KErrAlreadyExists);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see MAfTaskStorage::Pop(CAfTask *)
+ */
+void CAfSession::Pop(CAfTask *task)
+{
+ const TInt offset(mRunningTasks.Find(task));
+ if (KErrNotFound != offset) {
+ mRunningTasks.Remove(offset);
+ }
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see MAfTaskStorage::StorageData()
+ */
+const RPointerArray<CAfTask>& CAfSession::StorageData() const
+{
+ return mRunningTasks;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Removes not valid task
+ */
+void CAfSession::RemoveNotValidTasks(const CSession2* session)
+{
+ if (session == this) {
+ mRunningTasks.ResetAndDestroy();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/src/afstorage.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,611 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "afstorage.h"
+#include <bautils.h>
+#include <hash.h>
+#include <s32mem.h>
+
+#include "afqueries.h"
+#include "afentry.h"
+
+_LIT(KDbName, "activity.db");
+_LIT(KDbDrive, "c:");
+const TInt KMaxPathLength = 256;
+
+_LIT(KNonPersistent, "non_persistent\\");
+_LIT(KPersistent, "persistent\\");
+_LIT(KUidFormat, "%+08x\\");
+_LIT(KExtFormat, ".mbm");
+
+// -----------------------------------------------------------------------------
+/**
+ * Constructor for performing 1st stage construction
+ * @param session - initialized session to file system
+ */
+CAfStorage::CAfStorage(RFs& session)
+:
+mFsSession(session)
+{
+ // No implementation required
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Destructor.
+ */
+CAfStorage::~CAfStorage()
+{
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Two-phased constructor.
+ * @param session - initialized session to file system
+ */
+CAfStorage* CAfStorage::NewL(RFs& session)
+{
+ CAfStorage* self = new (ELeave) CAfStorage(session);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(); // self;
+ return self;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * EPOC default constructor for performing 2nd stage construction
+ */
+void CAfStorage::ConstructL()
+{
+ RBuf path;
+ CleanupClosePushL( path );
+ path.CreateL(KMaxPathLength);
+ User::LeaveIfError(mFsSession.PrivatePath(path ));
+ path.Append(KDbName);
+ path.Insert(0, KDbDrive);
+ BaflUtils::EnsurePathExistsL(mFsSession, path);
+ BaflUtils::FileExists(mFsSession, path) ? OpenDbL(path) : CreateDbL(path);
+ CleanupStack::PopAndDestroy(&path);
+
+ DeleteNonPersistentActivitiesL();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Create database and its structure
+ * @param databaseFile - database file path
+ */
+void CAfStorage::CreateDbL(const TDesC& databaseFile)
+{
+ mFileStore = CPermanentFileStore::ReplaceL(mFsSession,
+ databaseFile,
+ EFileRead|EFileWrite);
+ mFileStore->SetTypeL(mFileStore->Layout());// Set file store type
+ TStreamId id = mActDb.CreateL(mFileStore);// Create stream object
+ mFileStore->SetRootL(id);// Keep database id as root of store
+ mFileStore->CommitL();// Complete creation by commiting
+ CreateTableL();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Open database
+ * @param databaseFile - database file path
+ */
+void CAfStorage::OpenDbL(const TDesC& databaseFile)
+{
+ mFileStore = CPermanentFileStore::OpenL(mFsSession,
+ databaseFile,
+ EFileRead|EFileWrite);
+ mFileStore->SetTypeL(mFileStore->Layout()); /* Set file store type*/
+ mActDb.OpenL(mFileStore,mFileStore->Root());
+ CDbTableNames* tables = mActDb.TableNamesL();
+ CleanupStack::PushL(tables);
+ if (0 == tables->Count()) {
+ CreateTableL();
+ }
+ CleanupStack::PopAndDestroy(tables);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Create database structure
+ */
+void CAfStorage::CreateTableL()
+{
+ // Add the columns to column set
+ CDbColSet* actColSet = CDbColSet::NewLC();
+
+ TDbCol appName(KApplicationColumnName, EDbColInt64);
+ appName.iAttributes = TDbCol::ENotNull;
+ actColSet->AddL(appName);
+
+ TDbCol actName(KActivityColumnName, EDbColText16);// Using default length
+ actName.iAttributes = TDbCol::ENotNull;
+ actColSet->AddL(actName);
+
+ TDbCol actFlags(KFlagsColumnName, EDbColInt32);
+ actFlags.iAttributes = TDbCol::ENotNull;
+ actColSet->AddL(actFlags);
+
+ actColSet->AddL(TDbCol(KDataColumnName, EDbColLongBinary));// Stream Data
+
+ // Create the table
+ User::LeaveIfError(mActDb.CreateTable(KActivityTableName,
+ *actColSet));
+
+ CleanupStack::PopAndDestroy(actColSet);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Delete non-persistent activities
+ */
+void CAfStorage::DeleteNonPersistentActivitiesL()
+{
+ HBufC *query(BuildQueryLC(KDeleteNonPersistentActivities(), CAfEntry::Persistent, KNullDesC));
+ User::LeaveIfError(mActDb.Execute(*query));
+ RBuf privatePath;
+ CleanupClosePushL(privatePath);
+ privatePath.CreateL(KMaxPathLength);
+ StoragePathL(privatePath, Fs(), FALSE);
+ CFileMan *fileMan = CFileMan::NewL(Fs());
+ TInt i = fileMan->RmDir(privatePath);
+ delete fileMan;
+ CleanupStack::PopAndDestroy(&privatePath);
+ CleanupStack::PopAndDestroy(query);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Register new activity
+ * @param appId - application id
+ * @param actId - activity id
+ * @param flags - activity flags
+ * @param imgSrc - activity thumbnail source
+ * @param privateData - activity private data
+ * @param publicData - activity public data
+ */
+void CAfStorage::AddActivityL(CAfEntry& entry)
+{
+ //verify if row already exists
+ TInt errNo(KErrNone);
+ RDbView view;
+ CleanupClosePushL(view);
+ TRAP( errNo, GetActivityForUpdateL(view, entry.ApplicationId(), entry.ActivityId()));
+ if (KErrNone == errNo) {
+ User::Leave(KErrAlreadyExists);
+ }
+ CleanupStack::PopAndDestroy(&view);
+
+ //write table
+ RDbTable table;
+ CleanupClosePushL(table);
+ User::LeaveIfError(table.Open(mActDb, KActivityTableName, table.EUpdatable));
+ CDbColSet *row = table.ColSetL();
+ CleanupStack::PushL(row);
+
+ table.InsertL();
+ TRAP(errNo,
+ table.SetColL(row->ColNo(KApplicationColumnName), TInt64(entry.ApplicationId()));
+ table.SetColL(row->ColNo(KActivityColumnName), entry.ActivityId());
+ table.SetColL(row->ColNo(KFlagsColumnName), entry.Flags());
+ ExternalizeDataL(table, entry, row->ColNo(KDataColumnName));
+ table.PutL();)
+ if (KErrNone != errNo) {
+ table.Cancel();
+ User::Leave(errNo);
+ }
+ CleanupStack::PopAndDestroy(row);
+ CleanupStack::PopAndDestroy(&table);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Update activity
+ * @param entry - activity data
+ */
+void CAfStorage::UpdateActivityL(CAfEntry& entry)
+{
+ RDbView view;
+ CleanupClosePushL(view);
+ GetActivityForUpdateL(view, entry.ApplicationId(), entry.ActivityId());
+ view.UpdateL();
+ TRAPD(errNo,
+ CDbColSet* colSet = view.ColSetL();
+ CleanupStack::PushL(colSet);
+
+ view.SetColL(colSet->ColNo(KFlagsColumnName), entry.Flags());
+ ExternalizeDataL(view, entry, colSet->ColNo(KDataColumnName));
+
+ view.PutL();
+ if (KErrNone != errNo) {
+ view.Cancel();
+ User::Leave(errNo);
+ }
+ CleanupStack::PopAndDestroy(colSet);)
+
+ if (KErrNone != errNo) {
+ view.Cancel();
+ User::Leave(errNo);
+ }
+ CleanupStack::PopAndDestroy(&view);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Delete activity
+ * @param appId - application id
+ * @param actId - activity id
+ */
+void CAfStorage::DeleteActivityL(CAfEntry& entry)
+{
+ HBufC *query(DeleteRowLC(entry.ApplicationId(), entry.ActivityId()));
+ User::LeaveIfError(mActDb.Execute(*query));
+ CleanupStack::PopAndDestroy(query);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CAfStorage::DeleteActivitiesL(CAfEntry& entry)
+{
+ HBufC *query(DeleteRowsLC(entry.ApplicationId()));
+ User::LeaveIfError(mActDb.Execute(*query));
+ RBuf privatePath;
+ CleanupClosePushL(privatePath);
+ privatePath.CreateL(KMaxPathLength);
+ AppStoragePathL(privatePath, Fs(), entry.ApplicationId(), FALSE);
+ CFileMan *fileMan = CFileMan::NewL(Fs());
+ CleanupStack::PushL(fileMan);
+ fileMan->RmDir(privatePath);
+ privatePath.Zero();
+
+ AppStoragePathL(privatePath, Fs(), entry.ApplicationId(), TRUE);
+ fileMan->RmDir(privatePath);
+
+ CleanupStack::PopAndDestroy(fileMan);
+ CleanupStack::PopAndDestroy(&privatePath);
+ CleanupStack::PopAndDestroy(query);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CAfStorage::ActivitiesL(RPointerArray<CAfEntry>& dst)
+{
+ ActivitiesL(dst, KSelectRows(), CAfEntry::Public);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Serialize application activity into the buffer
+ * @param dst - destination buffer
+ * @param appId - application id
+ */
+void CAfStorage::ActivitiesL(RPointerArray<CAfEntry>& dst,TInt appId)
+{
+ HBufC *query(SelectRowsLC(appId));
+ ActivitiesL(dst, *query, CAfEntry::Private);
+ CleanupStack::PopAndDestroy(query);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Serialize application activity into the buffer
+ * @param dst - destination entry
+ * @param src - condition pattern
+ */
+void CAfStorage::ActivityL(RPointerArray<CAfEntry> &dst, CAfEntry& src)
+{
+ HBufC *query = SelectRowLC(src.ApplicationId(), src.ActivityId());
+ ActivitiesL(dst, *query, CAfEntry::Private, 1);
+ if (0 >= dst.Count()) {
+ User::Leave(KErrNotFound);
+ }
+ CleanupStack::PopAndDestroy(query);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Provide initialized file system session
+ * @return file system session
+ */
+RFs& CAfStorage::Fs()
+{
+ return mFsSession;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Format query to select activity row
+ * @param appId - application id
+ * @param actId - activity id
+ * @return formated sql query
+ */
+HBufC* CAfStorage::SelectRowLC(TInt appId, const TDesC& actId) const
+{
+ return BuildQueryLC(KSelectRow(),appId, actId);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Format query to select activities for application
+ * @param appId - application id
+ * @return formated sql query
+ */
+HBufC* CAfStorage::SelectRowsLC(TInt appId) const
+{
+ return BuildQueryLC(KSelectAppRows(), appId, KNullDesC);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Format query to delete activity
+ * @param appId - application id
+ * @param actId - activity id
+ * @return formated sql query
+ */
+HBufC* CAfStorage::DeleteRowLC(TInt appId, const TDesC& actId) const
+{
+ return BuildQueryLC(KDeleteRow(),appId, actId);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Format query to delete activities for application
+ * @param appId - application id
+ * @return formated sql query
+ */
+HBufC* CAfStorage::DeleteRowsLC(TInt appId) const
+{
+ return BuildQueryLC(KDeleteRows(),appId, KNullDesC);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Format sql query
+ * @format - sql format string
+ * @param appId - application id
+ * @param actId - activity id
+ * @return formated sql query
+ */
+HBufC* CAfStorage::BuildQueryLC(const TDesC& format,
+ TInt appId,
+ const TDesC& actId) const
+{
+ TBuf<16> appName;
+ appName.AppendNum(appId);
+ RBuf actName;
+ CleanupClosePushL(actName);
+ actName.CreateL(actId.Length());
+ actName.Copy(actId);
+ HBufC* query = HBufC::NewL(format.Length() +
+ appName.Length() +
+ actName.Length() );
+ query->Des().AppendFormat(format, &appName, &actName);
+ CleanupStack::PopAndDestroy(&actName);
+ CleanupStack::PushL(query);
+ return query;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Execute sql query and result serialize into buffer
+ * @param dst - destination result buffer
+ * @param query - sql activity query
+ */
+void CAfStorage::ActivitiesL(RPointerArray<CAfEntry>& dst, const TDesC& query, CAfEntry::AccessRights rights, TInt limit)
+{
+ RDbView view;// Create a view on the database
+ CleanupClosePushL(view);
+ User::LeaveIfError(view.Prepare(mActDb, TDbQuery(query), view.EReadOnly));
+ User::LeaveIfError(view.EvaluateAll());
+ ActivitiesL(dst, view, rights, limit);
+ CleanupStack::PopAndDestroy(&view);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Return view deserialisd into entries array
+ * @param dst - destination result
+ * @param query - view
+ * @param rights - acess rights
+ */
+void CAfStorage::ActivitiesL(RPointerArray<CAfEntry>& dst, RDbView& src, CAfEntry::AccessRights rights, TInt limit)
+{
+ CDbColSet* row = src.ColSetL();
+ CleanupStack::PushL(row);
+
+ const TInt flagsOffset(row->ColNo(KFlagsColumnName)),
+ applicationOffset(row->ColNo(KApplicationColumnName)),
+ activityOffset(row->ColNo(KActivityColumnName)),
+ dataOffset(row->ColNo(KDataColumnName));
+
+ RBuf activityName;
+ CleanupClosePushL(activityName);
+
+ for (src.FirstL(); src.AtRow(); src.NextL()) {
+ if(0 < limit && dst.Count() >= limit) {
+ break;
+ }
+ src.GetL();
+ ReadDataL(activityName, src, activityOffset);
+
+ CAfEntry *entry = CAfEntry::NewLC(src.ColInt32(flagsOffset),
+ src.ColInt64(applicationOffset),
+ activityName,
+ KNullDesC,
+ KNullDesC8,
+ KNullDesC8);
+ if (CAfEntry::Public == rights && (entry->Flags() & CAfEntry::Invisible)) {
+ CleanupStack::PopAndDestroy(entry);
+ continue;
+ }
+ InternalizeDataL(*entry, src, dataOffset);
+
+ if (CAfEntry::Public == rights || 0 >= limit) {
+ entry->SetDataL(KNullDesC8(), CAfEntry::Private);
+ }
+ dst.AppendL(entry);
+ CleanupStack::Pop(entry);
+ }
+
+ CleanupStack::PopAndDestroy(&activityName);
+ CleanupStack::PopAndDestroy(row);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Get activity for update
+ * @param query - destination query result
+ * @param appId - application id
+ * @param actId - activity id
+ */
+void CAfStorage::GetActivityForUpdateL(RDbView& view, TInt appId, const TDesC& actId)
+{
+ HBufC* query(SelectRowLC(appId, actId));
+ User::LeaveIfError(view.Prepare(mActDb, TDbQuery(*query), view.EUpdatable));
+ CleanupStack::PopAndDestroy(query);
+ User::LeaveIfError(view.EvaluateAll());
+ if (!view.FirstL()) {
+ User::Leave(KErrNotFound);
+ }
+}
+
+// -----------------------------------------------------------------------------
+void CAfStorage::ReadDataL(RBuf& dst, RDbRowSet& src, TInt offset) const
+{
+ const TInt length(src.ColLength(offset));
+ CAfEntry::ReallocL(dst, length);
+ RDbColReadStream srcStream;
+ srcStream.OpenLC(src,offset);
+ srcStream.ReadL(dst, src.ColLength(offset));
+ CleanupStack::PopAndDestroy(&srcStream);
+}
+
+// -----------------------------------------------------------------------------
+void CAfStorage::ExternalizeDataL(RDbRowSet& dst,const CAfEntry &src, TInt offset) const
+{
+ RDbColWriteStream dbStream;
+ CleanupClosePushL(dbStream);
+ dbStream.OpenL(dst, offset);
+ src.ExternalizeDataOnlyL(dbStream);
+ CleanupStack::PopAndDestroy(&dbStream);
+}
+
+// -----------------------------------------------------------------------------
+void CAfStorage::InternalizeDataL(CAfEntry & dst, RDbRowSet& src, TInt offset) const
+{
+ RDbColReadStream dbStream;
+ CleanupClosePushL(dbStream);
+ dbStream.OpenL(src, offset);
+ dst.InternalizeDataOnlyL(dbStream);
+ CleanupStack::PopAndDestroy(&dbStream);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CAfStorage::StoragePathL(RBuf &dst,
+ RFs& fileSystem,
+ TBool persistent)
+{
+ if (dst.MaxLength() < KMaxPathLength) {
+ dst.ReAllocL(KMaxPathLength);
+ }
+ dst.Zero();
+ User::LeaveIfError(fileSystem.PrivatePath(dst));
+ if(persistent) {
+ dst.Append(KPersistent);
+ }
+ else {
+ dst.Append(KNonPersistent);
+ }
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CAfStorage::AppStoragePathL(RBuf &dst,
+ RFs& fileSystem,
+ TInt uid,
+ TBool persistent)
+{
+ StoragePathL(dst, fileSystem, persistent);
+
+ //Format activity path
+ dst.AppendFormat( KUidFormat, uid);
+ }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CAfStorage::ThumbnailPathL(RBuf &dst,
+ RFs& fileSystem,
+ TInt uid,
+ const TDesC &activityName,
+ TBool persistent)
+{
+ RBuf8 buff8;
+ CleanupClosePushL(buff8);
+ buff8.CreateL(activityName.Length());
+ buff8.Copy(activityName);
+ HBufC8 *activityHash = Md5HexDigestL(buff8);
+ CleanupStack::PopAndDestroy(&buff8);
+ CleanupStack::PushL(activityHash);
+
+ AppStoragePathL(dst, fileSystem, uid, persistent);
+
+ RBuf hash16;
+ CleanupClosePushL(hash16);
+ hash16.CreateL(KMaxPathLength);
+ hash16.Copy(*activityHash);
+ dst.Append(hash16);//reuse already allocated buffer to convert 8 -> 16
+ CleanupStack::PopAndDestroy(&hash16);
+ dst.Append(KExtFormat());
+ CleanupStack::PopAndDestroy(activityHash);
+
+ BaflUtils::EnsurePathExistsL(fileSystem, dst);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+HBufC8* CAfStorage::Md5HexDigestL(const TDesC8 &string)
+{
+ _LIT8(KMd5HexFormat, "%+02x");
+ CMD5* md5 = CMD5::NewL();
+ CleanupStack::PushL(md5);
+
+ TPtrC8 hashedSig(md5->Hash(string));
+
+ HBufC8* buf = HBufC8::NewL(hashedSig.Length() * 2);
+ TPtr8 bufPtr = buf->Des();
+
+ for(TInt i(0); i< hashedSig.Length(); ++i) {
+ bufPtr.AppendFormat(KMd5HexFormat,hashedSig[i]);
+ }
+ CleanupStack::PopAndDestroy(md5);
+ return buf;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/src/afstorageasynctask.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,185 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include <s32mem.h>
+
+#include "afstorageasynctask.h"
+#include "afcmd.h"
+
+_LIT(KUnsupportedStorageAsyncTask, "Unsupported async storage task");
+
+// -----------------------------------------------------------------------------
+/**
+ * Constructor for performing 1st stage construction
+ */
+CAfStorageAsyncTask::CAfStorageAsyncTask()
+{
+ // No implementation required
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Destructor.
+ */
+CAfStorageAsyncTask::~CAfStorageAsyncTask()
+{
+ mExternalizedData.Close();
+ mInternalizedData.ResetAndDestroy();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Handle asynchronous data storage requests
+ * @param taskStorage - data tasks storage
+ * @param dataStorage - data storage
+ * @param msg - request message
+ */
+void CAfStorageAsyncTask::ExecuteLD(MAfTaskStorage& taskStorage,
+ CAfStorage& dataStorage,
+ const RMessage2& msg)
+{
+ CAfStorageAsyncTask* self = new (ELeave) CAfStorageAsyncTask();
+ CleanupStack::PushL(self);
+ self->ExecuteL(dataStorage, msg);
+ taskStorage.PushL(self);
+ CleanupStack::Pop(self);
+ if (EFalse == msg.IsNull()) {
+ msg.Complete(KErrNone);
+ }
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see CActivityTask::Data()
+ */
+const TDesC8& CAfStorageAsyncTask::CAfStorageAsyncTask::Data() const
+{
+ return mExternalizedData;
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see CActivityTask::BroadcastReceivedL(const RMessage2 &)
+ */
+void CAfStorageAsyncTask::BroadcastReceivedL(const RMessage2& )
+{
+ // No implementation required
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Handle asynchronous data storage requests
+ * @param dataStorage - data storage
+ * @param msg - request message
+ */
+void CAfStorageAsyncTask::ExecuteL(CAfStorage& dataStorage,
+ const RMessage2& msg)
+{
+ switch (msg.Function()) {
+ case Activities:
+ AllActivitiesL(dataStorage, msg);
+ break;
+ case ApplicationActivities:
+ ApplicationActivitiesL(dataStorage, msg);
+ break;
+ case ApplicationActivity:
+ ApplicationActivityL(dataStorage, msg);
+ break;
+ default:
+ //this code shouldn't be called. fatal error: means wrong session implementation
+ User::Panic(KUnsupportedStorageAsyncTask, KErrGeneral);
+ };
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Handle getting all activities request
+ * @param dataStorage - data storage
+ * @param msg - requested message
+ */
+void CAfStorageAsyncTask::AllActivitiesL(CAfStorage& dataStorage,
+ const RMessage2& msg)
+{
+ dataStorage.ActivitiesL(mInternalizedData);
+ ExternalizeL();
+ WriteResponseL(msg);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Handle getting application activities request
+ * @param dataStorage - data storage
+ * @param msg - requested message
+ */
+void CAfStorageAsyncTask::ApplicationActivitiesL(CAfStorage& dataStorage,
+ const RMessage2& msg)
+{
+ CAfEntry *entry = CAfEntry::NewLC(msg);
+ dataStorage.ActivitiesL(mInternalizedData, entry->ApplicationId());
+ CleanupStack::PopAndDestroy(entry);
+ ExternalizeL();
+ WriteResponseL(msg);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Handle getting application activity request
+ * @param dataStorage - data storage
+ * @param msg - requested message
+ */
+void CAfStorageAsyncTask::ApplicationActivityL(CAfStorage& dataStorage,
+ const RMessage2& msg)
+{
+ CAfEntry *src(CAfEntry::NewLC(msg));
+ dataStorage.ActivityL(mInternalizedData, *src);
+ CleanupStack::PopAndDestroy(src);
+ ExternalizeL();
+ WriteResponseL(msg);
+}
+
+// -----------------------------------------------------------------------------
+void CAfStorageAsyncTask::ExternalizeL()
+{
+ mExternalizedData << mInternalizedData;
+ mInternalizedData.ResetAndDestroy();
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Write response data into request message
+ * @param msg - destination message
+ */
+void CAfStorageAsyncTask::WriteResponseL(const RMessage2& msg)
+{
+ if (EFalse == msg.IsNull()) {
+ msg.WriteL(1,
+ TPckgBuf<TInt>(mExternalizedData.Length()));//write data size
+ msg.WriteL(2,
+ TPckgBuf<CBase*>(this));//task identyfier
+ }
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Returns ETrue if task is related with session argument
+ */
+
+TBool CAfStorageAsyncTask::IsSessionTask(const CSession2* /*session*/)
+{
+ return EFalse;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/src/afstoragesynctask.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,205 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include <s32mem.h>
+#include <fbs.h>
+#include <bautils.h>
+
+#include "afstoragesynctask.h"
+#include "afcmd.h"
+#include "afentry.h"
+
+_LIT(KUnsupportedStorageSyncTask, "Unsupported sync storage task");
+
+// -----------------------------------------------------------------------------
+/**
+ * Handle synchronous data storage requests
+ * @param dataStorage - data storage
+ * @param msg - request message
+ */
+void AfStorageSyncTask::ExecuteL(MAfTaskStorage& observers,
+ CAfStorage& dataStorage,
+ const RMessage2& msg)
+{
+ switch (msg.Function()) {
+ case AddActivity:
+ AddActivityL(dataStorage, msg);
+ break;
+ case UpdateActivity:
+ UpdateActivityL(dataStorage, msg);
+ break;
+ case RemoveActivity:
+ DeleteActivityL(dataStorage, msg);
+ break;
+ case RemoveApplicationActivities:
+ DeleteApplicationActivitiesL(dataStorage, msg);
+ break;
+ default:
+ //this code shouldn't be called. fatal error: means wrong session implementation
+ User::Panic(KUnsupportedStorageSyncTask, KErrGeneral);
+ };
+ msg.Complete(KErrNone);
+ NotifyChangeL(observers, msg);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Handle adding new activity.
+ * @param dataStorage - data storage
+ * @param msg - request message
+ */
+void AfStorageSyncTask::AddActivityL(CAfStorage& dataStorage,
+ const RMessage2& msg)
+{
+ //Read message and bitmap handle
+ TPckgBuf<TInt> bitmapHdl(0);
+ CAfEntry *entry = CAfEntry::NewLC(msg);
+ msg.ReadL(1, bitmapHdl);
+
+ RBuf thumbnailPath;
+ CleanupClosePushL(thumbnailPath);
+ dataStorage.ThumbnailPathL(thumbnailPath,
+ dataStorage.Fs(),
+ entry->ApplicationId(),
+ entry->ActivityId(),
+ entry->Flags() & CAfEntry::Persistent);
+ CreateThumbnailL(thumbnailPath, bitmapHdl());
+ entry->SetImageSrcL(thumbnailPath);
+ dataStorage.AddActivityL(*entry);
+ CleanupStack::PopAndDestroy(&thumbnailPath);
+
+ CleanupStack::PopAndDestroy(entry);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Handle updating existing activiy
+ * @param dataStorage - data storage
+ * @param msg - request message
+ */
+void AfStorageSyncTask::UpdateActivityL(CAfStorage& dataStorage,
+ const RMessage2& msg)
+{
+ TPckgBuf<TInt> bitmapHdl(0);
+ CAfEntry *entry = CAfEntry::NewLC(msg);
+ msg.ReadL(1, bitmapHdl);
+
+ RBuf thumbnailPath;
+ CleanupClosePushL(thumbnailPath);
+ DeleteActivityScreenshotL(dataStorage,
+ entry->ApplicationId(),
+ entry->ActivityId());
+
+ dataStorage.ThumbnailPathL(thumbnailPath,
+ dataStorage.Fs(),
+ entry->ApplicationId(),
+ entry->ActivityId(),
+ entry->Flags() & CAfEntry::Persistent);
+ CreateThumbnailL(thumbnailPath, bitmapHdl());
+ entry->SetImageSrcL(thumbnailPath);
+ dataStorage.UpdateActivityL(*entry);
+ CleanupStack::PopAndDestroy(&thumbnailPath);
+ CleanupStack::PopAndDestroy(entry);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Handle removing activity.
+ * @param dataStorage - data storage
+ * @param msg - request message
+ */
+void AfStorageSyncTask::DeleteActivityL(CAfStorage& dataStorage,
+ const RMessage2& msg)
+{
+ CAfEntry *entry = CAfEntry::NewLC(msg);
+ dataStorage.DeleteActivityL(*entry);
+ DeleteActivityScreenshotL(dataStorage,
+ entry->ApplicationId(),
+ entry->ActivityId());
+ CleanupStack::PopAndDestroy(entry);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Handle removing activity.
+ * @param dataStorage - data storage
+ * @param msg - request message
+ */
+void AfStorageSyncTask::DeleteActivityScreenshotL(CAfStorage& dataStorage,
+ TInt uid,
+ const TDesC &activityName)
+{
+ RBuf thumbnailPath;
+ CleanupClosePushL(thumbnailPath);
+ dataStorage.ThumbnailPathL(thumbnailPath,
+ dataStorage.Fs(),
+ uid,
+ activityName,
+ TRUE);
+ dataStorage.Fs().Delete(thumbnailPath);
+ thumbnailPath.Zero();
+ dataStorage.ThumbnailPathL(thumbnailPath,
+ dataStorage.Fs(),
+ uid,
+ activityName,
+ FALSE);
+ dataStorage.Fs().Delete(thumbnailPath);
+ thumbnailPath.Zero();
+ CleanupStack::PopAndDestroy(&thumbnailPath);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Handle removing all application activities.
+ * @param dataStorage - data storage
+ * @param msg - request message
+ */
+void AfStorageSyncTask::DeleteApplicationActivitiesL(CAfStorage& dataStorage,
+ const RMessage2& msg)
+{
+ CAfEntry *entry = CAfEntry::NewLC(msg);
+ dataStorage.DeleteActivitiesL(*entry);
+ CleanupStack::PopAndDestroy(entry);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void AfStorageSyncTask::NotifyChangeL(MAfTaskStorage& observers,
+ const RMessage2& msg)
+{
+ const RPointerArray<CAfTask> &table(observers.StorageData());
+ for (TInt iter(table.Count() - 1); 0 <= iter; --iter) {
+ table[iter]->BroadcastReceivedL(msg);
+ }
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void AfStorageSyncTask::CreateThumbnailL(const TDesC &path, TInt hdl)
+{
+ if (0 >= hdl) {
+ User::Leave(KErrCorrupt);
+ }
+ CFbsBitmap *bitmap = new (ELeave) CFbsBitmap;
+ CleanupStack::PushL(bitmap);
+ User::LeaveIfError(bitmap->Duplicate(hdl));
+ User::LeaveIfError(bitmap->Save(path));
+ CleanupStack::PopAndDestroy(bitmap);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/src/afthumbnailtask.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,129 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "afthumbnailtask.h"
+#include "afcmd.h"
+
+#include <fbs.h>
+
+// -----------------------------------------------------------------------------
+/**
+ * Constructor for performing 1st stage construction
+ */
+CAfThumbnailTask::CAfThumbnailTask(MAfTaskStorage& storage,
+ const RMessage2 msg)
+:
+ mStorage(storage),
+ mMsg(msg)
+{
+ // No implementation required
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Destructor.
+ */
+CAfThumbnailTask::~CAfThumbnailTask()
+{
+ delete mService;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CAfThumbnailTask::ExecuteLD(MAfTaskStorage& taskStorage,
+ const RMessage2& message)
+{
+ CAfThumbnailTask *self = new (ELeave)CAfThumbnailTask(taskStorage,
+ message);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ taskStorage.PushL(self);
+ CleanupStack::Pop(self);
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * EPOC default constructor for performing 2nd stage construction
+ */
+void CAfThumbnailTask::ConstructL()
+{
+ TPckgBuf<int> width(0), height(0);
+ RBuf path;
+ CleanupClosePushL(path);
+ mMsg.ReadL(0, width);
+ mMsg.ReadL(1, height);
+ path.CreateL(mMsg.GetDesLengthL(2));
+ mMsg.ReadL(2, path);
+
+ CFbsBitmap *bitmap = new (ELeave) CFbsBitmap();
+ CleanupStack::PushL(bitmap);
+ User::LeaveIfError(bitmap->Load(path));
+ mService = CTsGraphicFileScalingHandler::NewL(*this,
+ *bitmap,
+ TSize(width(), height()),
+ CTsGraphicFileScalingHandler::EKeepAspectRatioByExpanding);
+ CleanupStack::PopAndDestroy(bitmap);
+ CleanupStack::PopAndDestroy(&path);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CAfThumbnailTask::ImageReadyCallBack(TInt error,const CFbsBitmap *bitmap)
+{
+ if (EFalse == mMsg.IsNull() &&
+ KErrNone == error) {
+ mMsg.Write(0, TPckgBuf<int>(const_cast<CFbsBitmap*>(bitmap)->Handle()));
+ mMsg.Write(1, TPckgBuf<void *>(this));
+ mMsg.Complete(error);
+ } else {
+ if (EFalse == mMsg.IsNull()) {
+ mMsg.Complete(error);
+ }
+ mStorage.Pop(this);
+ delete this;
+ }
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+const TDesC8& CAfThumbnailTask::Data() const
+{
+ return KNullDesC8();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CAfThumbnailTask::BroadcastReceivedL(const RMessage2&)
+{
+}
+
+// -----------------------------------------------------------------------------
+/**
+ * Returns ETrue if task is related with session argument
+ */
+TBool CAfThumbnailTask::IsSessionTask(const CSession2* session)
+{
+ return mMsg.Session() == session ? ETrue : EFalse;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/server/src/main.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "afserver.h"
+#include <e32base.h>
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LOCAL_C void StartActivityServerL()
+{
+ CActiveScheduler* activeScheduler = new( ELeave ) CActiveScheduler;
+ CleanupStack::PushL( activeScheduler );
+ CActiveScheduler::Install( activeScheduler );
+ CAfServer* serverObject = CAfServer::NewLC();
+ RProcess::Rendezvous( KErrNone );
+ CActiveScheduler::Start();
+ CleanupStack::PopAndDestroy( serverObject );
+ CleanupStack::PopAndDestroy( activeScheduler );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LOCAL_C TInt StartActivityServer()
+{
+ __UHEAP_MARK;
+ TInt errNo(KErrNoMemory);
+ CTrapCleanup* cleanupStack = CTrapCleanup::New();
+ if (cleanupStack) {
+ TRAP(errNo, StartActivityServerL());
+ delete cleanupStack;
+ }
+ __UHEAP_MARKEND;
+ if (KErrNone != errNo) {
+ RProcess::Rendezvous(errNo);
+ }
+ return errNo;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+TInt E32Main()
+{
+ return StartActivityServer();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/activityfw/storage/storage.pro Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,20 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+TEMPLATE = subdirs
+
+SUBDIRS += client \
+ server
--- a/contentstorage/bwins/cautilsu.def Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/bwins/cautilsu.def Thu Jun 24 16:18:29 2010 +0300
@@ -99,4 +99,6 @@
?SetStringIdL@CCaLocalizationEntry@@QAEXABVTDesC16@@@Z @ 98 NONAME ; void CCaLocalizationEntry::SetStringIdL(class TDesC16 const &)
?SetTextId@CCaLocalizationEntry@@QAEXI@Z @ 99 NONAME ; void CCaLocalizationEntry::SetTextId(unsigned int)
?RemoveAttribute@RCaEntryAttrArray@@QAEXABVTDesC16@@@Z @ 100 NONAME ; void RCaEntryAttrArray::RemoveAttribute(class TDesC16 const &)
+ ?GetChildId@CCaInnerQuery@@QBEHXZ @ 101 NONAME ; int CCaInnerQuery::GetChildId(void) const
+ ?SetChildId@CCaInnerQuery@@QAEXH@Z @ 102 NONAME ; void CCaInnerQuery::SetChildId(int)
--- a/contentstorage/caclient/caclient.pro Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/caclient/caclient.pro Thu Jun 24 16:18:29 2010 +0300
@@ -65,8 +65,6 @@
./stub/src
INCLUDEPATH += ./stub/inc
-LIBS += -lhswidgetmodel
-
QT += sql
include(caclient_stub.pri)
--- a/contentstorage/caclient/inc/cahandlerproxy.h Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/caclient/inc/cahandlerproxy.h Thu Jun 24 16:18:29 2010 +0300
@@ -36,7 +36,7 @@
explicit CaHandlerProxy(const QSharedPointer<CaHandlerLoader> &loader);
- ErrorCode execute(const CaEntry &entry, const QString &commandName);
+ int execute(const CaEntry &entry, const QString &commandName);
private:
CaHandler *getHandler(const CaEntry &entry,
--- a/contentstorage/caclient/inc/caquery_p.h Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/caclient/inc/caquery_p.h Thu Jun 24 16:18:29 2010 +0300
@@ -39,6 +39,9 @@
int parentId() const;
void setParentId(int id);
+ int childId() const;
+ void setChildId(int id);
+
QStringList entryTypeNames() const;
void setEntryTypeNames(const QStringList &entryTypeNames);
@@ -71,6 +74,8 @@
EntryRoles mEntryRoles;
int mParentId;
+
+ int mChildId;
QStringList mEntryTypeNames;
--- a/contentstorage/caclient/inc/caservice_p.h Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/caclient/inc/caservice_p.h Thu Jun 24 16:18:29 2010 +0300
@@ -58,7 +58,7 @@
bool prependEntriesToGroup(int groupId, const QList<int> &entryIdList);
- bool executeCommand(const CaEntry &entry, const QString &command);
+ int executeCommand(const CaEntry &entry, const QString &command);
CaNotifier *createNotifier(const CaNotifierFilter &filter);
--- a/contentstorage/caclient/s60/src/camenuiconutility.cpp Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/caclient/s60/src/camenuiconutility.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -108,7 +108,7 @@
pixmap = pixmap.scaled(size, Qt::KeepAspectRatioByExpanding);
icon = HbIcon(QIcon(pixmap));
} else {
- HBufC* fileNameFromApparc;
+ HBufC* fileNameFromApparc = NULL;
TInt err2 = apaLsSession.GetAppIcon(uid,fileNameFromApparc);
CleanupStack::PushL(fileNameFromApparc);
if (err2 == KErrNone) {
@@ -125,9 +125,8 @@
icon = HbIcon(fileName);
}
}
- CleanupStack::Pop(fileNameFromApparc);
+ CleanupStack::PopAndDestroy(fileNameFromApparc);
}
-
CleanupStack::PopAndDestroy(apaMaskedBitmap);
}
CleanupStack::PopAndDestroy(&apaLsSession);
--- a/contentstorage/caclient/s60/src/caobjectadapter.cpp Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/caclient/s60/src/caobjectadapter.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -95,6 +95,8 @@
CCaInnerQuery &toQuery)
{
toQuery.SetParentId(fromQuery.parentId());
+
+ toQuery.SetChildId(fromQuery.childId());
toQuery.SetFlagsOn(static_cast<TUint>(fromQuery.flagsOn()));
--- a/contentstorage/caclient/src/cahandlerproxy.cpp Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/caclient/src/cahandlerproxy.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -55,14 +55,13 @@
\retval KErrNone on succes, error code otherwise.
\sa e32err.h for KErrNone definition.
*/
-ErrorCode CaHandlerProxy::execute(const CaEntry &entry, const QString &commandName)
+int CaHandlerProxy::execute(const CaEntry &entry, const QString &commandName)
{
CaHandler *const handler = getHandler(entry, commandName);
- ErrorCode result = NotFoundErrorCode;
+ int result = -1;
if (handler) {
- result = CaObjectAdapter::convertErrorCode(
- handler->execute(entry, commandName));
+ result = handler->execute(entry, commandName);
}
return result;
}
--- a/contentstorage/caclient/src/caiconcache.cpp Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/caclient/src/caiconcache.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -169,6 +169,8 @@
QString key;
if (!entry.iconDescription().filename().isEmpty()) {
key.append(entry.iconDescription().filename());
+ key.append(separator);
+ key.append(entry.entryTypeName());
} else {
key.append(separator);
key.append(entry.id());
--- a/contentstorage/caclient/src/caquery.cpp Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/caclient/src/caquery.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -135,6 +135,24 @@
}
/*!
+ Sets child id.
+ \param id id of the child.
+ */
+void CaQuery::setChildId(int id)
+{
+ m_d->setChildId(id);
+}
+
+/*!
+ Returns child id.
+ \retval child id.
+ */
+int CaQuery::childId() const
+{
+ return m_d->childId();
+}
+
+/*!
Sets names of entry types.
\param entryTypeNames list of entry type names (strings).
*/
@@ -288,7 +306,7 @@
*/
CaQueryPrivate::CaQueryPrivate(CaQuery *queryPublic) :
m_q(queryPublic), mEntryRoles(ItemEntryRole | GroupEntryRole),
- mParentId(0), mEntryTypeNames(), mFlagsOn(), mFlagsOff(),
+ mParentId(0), mChildId(0), mEntryTypeNames(), mFlagsOn(), mFlagsOff(),
mSortAttribute(DefaultSortAttribute),
mSortOrder(Qt::AscendingOrder), mCount(0), mAttributes()
{
@@ -306,6 +324,7 @@
/*m_q is not changed*/
mEntryRoles = queryPrivate.mEntryRoles;
mParentId = queryPrivate.mParentId;
+ mChildId = queryPrivate.mChildId;
mEntryTypeNames = queryPrivate.mEntryTypeNames;
mFlagsOn = queryPrivate.mFlagsOn;
mFlagsOff = queryPrivate.mFlagsOff;
@@ -361,6 +380,24 @@
}
/*!
+ Returns child id.
+ \retval child id.
+ */
+int CaQueryPrivate::childId() const
+{
+ return mChildId;
+}
+
+/*!
+ Sets child id.
+ \param id id of the child.
+ */
+void CaQueryPrivate::setChildId(int id)
+{
+ mChildId = id;
+}
+
+/*!
Returns a list of entry type names.
\retval list of names of entry types.
*/
@@ -508,6 +545,7 @@
{
mEntryRoles = ItemEntryRole | GroupEntryRole;
mParentId = 0;
+ mChildId = 0;
mEntryTypeNames = QStringList();
mFlagsOn = EntryFlags();
mFlagsOff = EntryFlags();
--- a/contentstorage/caclient/src/caservice.cpp Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/caclient/src/caservice.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -823,7 +823,7 @@
Execute command.
\param entryId id of an entry.
\param command command.
- \retval true if operation was successful.
+ \retval 0 if operation was successful.
\example
\code
@@ -833,15 +833,15 @@
itemExecute.setTypeName("application");
itemExecute.setAttribute("application:uid", "0x12345678");
CaEntry * entryExecute = service->createEntry(itemExecute->id());
- bool result = service->executeCommand(entryExecute->id(), "remove");
+ int result = service->executeCommand(entryExecute->id(), "remove");
...
\b Output:
- result == true
+ result == 0
\endcode
*/
-bool CaService::executeCommand(int entryId, const QString &command) const
+int CaService::executeCommand(int entryId, const QString &command) const
{
- bool result = false;
+ int result = -19;
const QSharedPointer<CaEntry> temporaryEntry = getEntry(entryId);
@@ -855,7 +855,7 @@
Execute command.
\param entry entry.
\param command command.
- \retval true if operation was successful.
+ \retval 0 if operation was successful.
\example
\code
@@ -865,13 +865,13 @@
itemExecute.setTypeName("url");
itemExecute.setAttribute("url", "http://www.nokia.com");
CaEntry * entryExecute = service->createEntry(itemExecute->id());
- bool result = service->executeCommand(*entryExecute, "open");
+ int result = service->executeCommand(*entryExecute, "open");
...
\b Output:
- result == true
+ result == 0
\endcode
*/
-bool CaService::executeCommand(const CaEntry &entry, const QString &command) const
+int CaService::executeCommand(const CaEntry &entry, const QString &command) const
{
return m_d->executeCommand(entry, command);
}
@@ -1329,9 +1329,9 @@
Executes command on entry (fe. "open", "remove")
\param const reference to an entry on which command will be issued
\param string containing a command
- \retval boolean which is used as an error code return value, true means positive result
+ \retval int which is used as an error code return value, 0 means no errors
*/
-bool CaServicePrivate::executeCommand(const CaEntry &entry,
+int CaServicePrivate::executeCommand(const CaEntry &entry,
const QString &command)
{
qDebug() << "CaServicePrivate::executeCommand"
@@ -1340,21 +1340,23 @@
CACLIENTTEST_FUNC_ENTRY("CaServicePrivate::executeCommand");
if (entry.flags() & UninstallEntryFlag) {
- return false;
+ return 0;
}
if (command == caCmdOpen) {
touch(entry);
}
- mErrorCode = mCommandHandler->execute(entry, command);
+ int errorCode = mCommandHandler->execute(entry, command);
+ mErrorCode = CaObjectAdapter::convertErrorCode(errorCode);
+
qDebug() << "CaServicePrivate::executeCommand mErrorCode on return:"
<< mErrorCode;
CACLIENTTEST_FUNC_EXIT("CaServicePrivate::executeCommand");
- return (mErrorCode == NoErrorCode);
+ return errorCode;
}
/*!
--- a/contentstorage/caclient/stub/inc/caclientproxy.h Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/caclient/stub/inc/caclientproxy.h Thu Jun 24 16:18:29 2010 +0300
@@ -25,7 +25,7 @@
class CaClientNotifierProxy;
class CaEntry;
class CaQuery;
-class HsWidgetToken;
+class HsWidgetComponentDescriptor;
/**
* CaClientProxy
@@ -131,16 +131,6 @@
QList<int>& sourceIdList);
/**
- * Method for executing command
- *
- * @param entry entry on wchich command will be executed
- * @param command command to execute
- * @return error code
- */
- ErrorCode executeCommand(const CaEntry &entry,
- const QString &command);
-
- /**
* Method for touching entry.
*
* @param entry entry to touch
@@ -166,8 +156,8 @@
QList<int> &parentIds);
private:
- bool hsWidgetExists(int uid);
- void addWidgetEntry(const HsWidgetToken &widgetToken);
+ int hsWidgetId(int uid);
+ void addWidgetEntry(const HsWidgetComponentDescriptor &widgetToken, int widgetId);
void modifyQueryForSortOrder(QString &queryString,
const CaQuery &query, bool parent) const;
--- a/contentstorage/caclient/stub/inc/hswidgetcomponentdescriptor.h Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/caclient/stub/inc/hswidgetcomponentdescriptor.h Thu Jun 24 16:18:29 2010 +0300
@@ -32,7 +32,11 @@
QString iconUri;
QString hidden;
QString serviceXml;
- QString version;
+ QString version;
+ QString library;
+ QString translationFilename;
+ int uid;
+ QString previewImage;
bool isValid();
};
--- a/contentstorage/caclient/stub/inc/hswidgetcomponentparser.h Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/caclient/stub/inc/hswidgetcomponentparser.h Thu Jun 24 16:18:29 2010 +0300
@@ -44,6 +44,8 @@
void parseDescription();
void parseHidden();
void parseServiceXml();
+ void parsePreviewImage();
+ void parseTranslationFileName();
bool isWidgetTagValid();
--- a/contentstorage/caclient/stub/inc/hswidgetregistryservice.h Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/caclient/stub/inc/hswidgetregistryservice.h Thu Jun 24 16:18:29 2010 +0300
@@ -21,7 +21,7 @@
#include <QObject>
#include <QSharedPointer>
-#include "hsiwidgetprovider.h"
+#include "hswidgetcomponentdescriptor.h"
class HsWidgetRegistryServicePrivate;
@@ -37,11 +37,11 @@
virtual ~HsWidgetRegistryService();
- QList<HsWidgetToken> widgets();
+ QList<HsWidgetComponentDescriptor> widgets();
signals:
- void widgetAddedToRegistry(const QList<HsWidgetToken> &widgetTokenList);
+ void widgetAddedToRegistry(const QList<HsWidgetComponentDescriptor> &widgetTokenList);
void widgetRemovedFromRegistry(int uid);
@@ -51,7 +51,7 @@
private:
- void emitWidgetAddedToRegistry(const QList<HsWidgetToken> &widgetsAdded);
+ void emitWidgetAddedToRegistry(const QList<HsWidgetComponentDescriptor> &widgetsAdded);
void emitWidgetRemovedFromRegistry(int uid);
--- a/contentstorage/caclient/stub/inc/hswidgetregistryservice_p.h Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/caclient/stub/inc/hswidgetregistryservice_p.h Thu Jun 24 16:18:29 2010 +0300
@@ -25,7 +25,7 @@
#include <QMap>
#include <QFileSystemWatcher>
-#include "hsiwidgetprovider.h"
+#include "hswidgetcomponentdescriptor.h"
class HsWidgetRegistryService;
@@ -40,20 +40,20 @@
~HsWidgetRegistryServicePrivate();
- QList<HsWidgetToken> widgets();
+ QList<HsWidgetComponentDescriptor> widgets();
private:
Q_DISABLE_COPY(HsWidgetRegistryServicePrivate)
- IHsWidgetProvider *loadProviderFromPlugin(const QString &pluginName);
+// IHsWidgetProvider *loadProviderFromPlugin(const QString &pluginName);
QStringList readManifestDirectories(const QString &path);
void doWidgetRemove(const QString &path, const QStringList &originalList,
const QStringList ¤tList);
- QList<HsWidgetToken> readManifestFile(const QString &path);
+ QList<HsWidgetComponentDescriptor> readManifestFile(const QString &path);
void ensureWidgetRegistryPaths();
--- a/contentstorage/caclient/stub/src/caclientproxy.cpp Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/caclient/stub/src/caclientproxy.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -94,18 +94,13 @@
HsWidgetRegistryService *rs =
new HsWidgetRegistryService(mWidgetRegistryPath);
- QList<HsWidgetToken> widgets = rs->widgets();
+ QList<HsWidgetComponentDescriptor> widgets = rs->widgets();
// Read widgets in order to add synchronize the content of the widgets
// registry with Content Storage database.
- foreach(const HsWidgetToken &widgetToken, widgets) {
- int uid = widgetToken.mUid;
-
- if (!hsWidgetExists(uid)) {
- // The given widget does not have a corresonding entry
- // in the databse, so such an entry needs do be created.
- addWidgetEntry(widgetToken);
- }
+ foreach(const HsWidgetComponentDescriptor &widgetToken, widgets) {
+ int uid = widgetToken.uid;
+ addWidgetEntry(widgetToken, hsWidgetId(uid));
}
delete rs;
@@ -115,51 +110,82 @@
/*!
Returns true if a widget with the given uid exists in the database.
*/
-void CaClientProxy::addWidgetEntry(const HsWidgetToken &widgetToken)
+void CaClientProxy::addWidgetEntry(const HsWidgetComponentDescriptor &widgetToken,
+ int widgetId)
{
- QString description = widgetToken.mDescription;
- QString iconUri = widgetToken.mIconUri;
- QString library = widgetToken.mLibrary;
- QString title = widgetToken.mTitle;
- int uid = widgetToken.mUid;
- QString uri = widgetToken.mUri;
+ QString description = widgetToken.description;
+ QString iconUri = widgetToken.iconUri;
+ QString library = widgetToken.library;
+ QString title = widgetToken.title;
+ int uid = widgetToken.uid;
+ QString uri = widgetToken.uri;
+ QString previewImage = widgetToken.previewImage;
+ QString translationFileName = widgetToken.translationFilename;
QSqlDatabase db = dbConnection();
QSqlQuery query(db);
QString hexUid;
hexUid.setNum(uid,16);
QDir currentDir = QDir::current();
+ if (widgetId == -1) {
+ // Add icon.
+ QString queryAddIcon =
+ "INSERT INTO CA_ICON " \
+ "(IC_FILENAME) " \
+ "VALUES " \
+ "(?)";
- // Add icon.
- QString queryAddIcon =
- "INSERT INTO CA_ICON " \
- "(IC_FILENAME) " \
- "VALUES " \
- "(?)";
+ query.prepare(queryAddIcon);
+ query.addBindValue(iconUri);
+ query.exec();
+ qDebug() << query.executedQuery();
- query.prepare(queryAddIcon);
- query.addBindValue(iconUri);
- query.exec();
- qDebug() << query.executedQuery();
+ // Add entry.
+ QString queryAddEntry =
+ "INSERT INTO CA_ENTRY " \
+ "(EN_TEXT, EN_DESCRIPTION, EN_ROLE, EN_TYPE_NAME, EN_ICON_ID) " \
+ "VALUES " \
+ "(?, ?, 1, 'widget', last_insert_rowid())";
+
+ query.prepare(queryAddEntry);
+ query.addBindValue(title);
+ query.addBindValue(description);
+ query.exec();
+ qDebug() << query.executedQuery();
- // Add entry.
- QString queryAddEntry =
- "INSERT INTO CA_ENTRY " \
- "(EN_TEXT, EN_DESCRIPTION, EN_ROLE, EN_TYPE_NAME, EN_ICON_ID) " \
- "VALUES " \
- "(?, ?, 1, 'widget', last_insert_rowid())";
+ // Get last id
+ QString queryLastId = "SELECT last_insert_rowid() AS LAST_ID";
+ query.prepare(queryLastId);
+ query.exec();
+ query.next();
+ widgetId = query.value(query.record().indexOf("LAST_ID")).toInt();
+ } else {
+ // update entry.
+ QString queryUpdateEntry =
+ "UPDATE CA_ENTRY SET EN_TEXT = ?, EN_DESCRIPTION = ? WHERE ENTRY_ID = ?";
+
+ query.prepare(queryUpdateEntry);
+ query.addBindValue(title);
+ query.addBindValue(description);
+ query.addBindValue(widgetId);
+ query.exec();
+ qDebug() << query.executedQuery();
- query.prepare(queryAddEntry);
- query.addBindValue(title);
- query.addBindValue(description);
- query.exec();
- qDebug() << query.executedQuery();
+ QString queryUpdateIcon =
+ "UPDATE CA_ICON SET IC_FILENAME = ? WHERE" \
+ " ICON_ID = (SELECT EN_ICON_ID FROM CA_ENTRY WHERE ENTRY_ID = ?)";
+
+ query.prepare(queryUpdateIcon);
+ query.addBindValue(iconUri);
+ query.addBindValue(widgetId);
+ query.exec();
+ qDebug() << query.executedQuery();
- // Get last id
- QString queryLastId = "SELECT last_insert_rowid() AS LAST_ID";
- query.prepare(queryLastId);
- query.exec();
- query.next();
- int lastId = query.value(query.record().indexOf("LAST_ID")).toInt();
+ // delete old attribute
+ query.prepare("DELETE FROM CA_ATTRIBUTE WHERE AT_ENTRY_ID = ?");
+ query.addBindValue(widgetId);
+ query.exec();
+ qDebug() << query.executedQuery();
+ }
// Add attribute packageuid
QString queryAddAttribute1 =
@@ -169,7 +195,7 @@
"(?, 'packageuid', ?)";
query.prepare(queryAddAttribute1);
- query.addBindValue(lastId);
+ query.addBindValue(widgetId);
query.addBindValue(hexUid);
query.exec();
qDebug() << query.executedQuery();
@@ -182,7 +208,7 @@
"(?, 'widget:uri', ?)";
query.prepare(queryAddAttribute2);
- query.addBindValue(lastId);
+ query.addBindValue(widgetId);
query.addBindValue(uri);
query.exec();
qDebug() << query.executedQuery();
@@ -195,18 +221,48 @@
"(?, 'widget:library', ?)";
query.prepare(queryAddAttribute3);
- query.addBindValue(lastId);
+ query.addBindValue(widgetId);
query.addBindValue(library);
query.exec();
qDebug() << query.executedQuery();
+
+ // Add attribute preview image
+ if (!previewImage.isEmpty()) {
+ QString queryAddPreviewImage =
+ "INSERT INTO CA_ATTRIBUTE " \
+ "(AT_ENTRY_ID, AT_NAME, AT_VALUE) " \
+ "VALUES " \
+ "(?, 'preview_image_name', ?)";
+
+ query.prepare(queryAddPreviewImage);
+ query.addBindValue(widgetId);
+ query.addBindValue(previewImage);
+ query.exec();
+ qDebug() << query.executedQuery();
+ }
+
+ // Add attribute widget:traslation_file
+ if (!translationFileName.isEmpty()) {
+ QString queryAddWidgetTranslationFile =
+ "INSERT INTO CA_ATTRIBUTE " \
+ "(AT_ENTRY_ID, AT_NAME, AT_VALUE) " \
+ "VALUES " \
+ "(?, 'widget:traslation_file', ?)";
+
+ query.prepare(queryAddWidgetTranslationFile);
+ query.addBindValue(widgetId);
+ query.addBindValue(translationFileName);
+ query.exec();
+ qDebug() << query.executedQuery();
+ }
}
/*!
Returns true if a widget with the given uid exists in the database.
*/
-bool CaClientProxy::hsWidgetExists(int uid)
+int CaClientProxy::hsWidgetId(int uid)
{
- bool exists(false);
+ int result(-1);
QSqlDatabase db = dbConnection();
QSqlQuery query(db);
QString hexUid;
@@ -223,17 +279,12 @@
query.prepare(queryString);
query.addBindValue(hexUid);
- if (query.exec() && query.next()) {
- // Query returned a non empty result.
- exists = true;
- } else {
- // The widget with the given uid was not found.
- exists = false;
- }
-
+ if (query.exec() && query.next()) {
+ result = query.value(query.record().indexOf("AT_ENTRY_ID")).toInt();
+ }
qDebug() << query.executedQuery();
- return exists;
+ return result;
}
//----------------------------------------------------------------------------
@@ -705,22 +756,6 @@
//----------------------------------------------------------------------------
//
//----------------------------------------------------------------------------
-ErrorCode CaClientProxy::executeCommand(const CaEntry &entry,
- const QString &command)
-{
- qDebug() << "CaClientProxy::executeCommand" << "entry id: "
- << entry.id() << "command: " << command;
-
- ErrorCode result = NoErrorCode;
- if (command != caCmdOpen && command != QString("remove")) {
- result = UnknownErrorCode;
- }
- return result;
-}
-
-//----------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------
ErrorCode CaClientProxy::touch(const CaEntry &entry)
{
int id = entry.id();
--- a/contentstorage/caclient/stub/src/caobserver.cpp Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/caclient/stub/src/caobserver.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -52,7 +52,7 @@
ChangeType changeType) const
{
qDebug() << "CaClientProxy::entryChanged changeType:" << changeType;
- CaEntry *caEntry = new CaEntry(entry);
+ QSharedPointer<CaEntry> caEntry(new CaEntry(entry));
emit signalEntryChanged(*caEntry, changeType);
}
--- a/contentstorage/caclient/stub/src/hswidgetcomponentparser.cpp Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/caclient/stub/src/hswidgetcomponentparser.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -29,8 +29,10 @@
const char DESCRIPTION[] = "description";
const char HIDDEN[] = "hidden";
const char SERVICEXML[] = "servicexml";
+const char PREVIEWIAMGE[] = "previewimage";
const char VERSION[] = "version";
const char VERSION_1_0[] = "1.0";
+const char TRANSLATIONFILENAME[] = "translationfile";
@@ -147,8 +149,12 @@
parseHidden();
} else if (tag == SERVICEXML) {
parseServiceXml();
- }
- }
+ } else if (tag == PREVIEWIAMGE) {
+ parsePreviewImage();
+ } else if (tag == TRANSLATIONFILENAME) {
+ parseTranslationFileName();
+ }
+ }
}
@@ -160,6 +166,7 @@
}
mComponentDescriptor.uri = mParser.text().toString();
}
+
void HsWidgetComponentParser::parseIcon()
{
mParser.readNext();
@@ -168,6 +175,7 @@
}
mComponentDescriptor.iconUri = mParser.text().toString();
}
+
void HsWidgetComponentParser::parseTitle()
{
mParser.readNext();
@@ -176,6 +184,7 @@
}
mComponentDescriptor.title = mParser.text().toString();
}
+
void HsWidgetComponentParser::parseDescription()
{
mParser.readNext();
@@ -184,6 +193,7 @@
}
mComponentDescriptor.description = mParser.text().toString();
}
+
void HsWidgetComponentParser::parseHidden()
{
mParser.readNext();
@@ -192,6 +202,7 @@
}
mComponentDescriptor.hidden = mParser.text().toString();
}
+
void HsWidgetComponentParser::parseServiceXml()
{
mParser.readNext();
@@ -201,6 +212,24 @@
mComponentDescriptor.serviceXml = mParser.text().toString();
}
+void HsWidgetComponentParser::parsePreviewImage()
+{
+ mParser.readNext();
+ if(mParser.tokenType() != QXmlStreamReader::Characters) {
+ return;
+ }
+ mComponentDescriptor.previewImage = mParser.text().toString();
+}
+
+void HsWidgetComponentParser::parseTranslationFileName()
+{
+ mParser.readNext();
+ if (mParser.tokenType() != QXmlStreamReader::Characters) {
+ return;
+ }
+ mComponentDescriptor.translationFilename = mParser.text().toString();
+}
+
bool HsWidgetComponentParser::isWidgetTagValid()
{
return true;
--- a/contentstorage/caclient/stub/src/hswidgetregistryservice.cpp Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/caclient/stub/src/hswidgetregistryservice.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -67,9 +67,9 @@
/*!
?Qt_style_documentation
*/
-QList<HsWidgetToken> HsWidgetRegistryServicePrivate::widgets()
+QList<HsWidgetComponentDescriptor> HsWidgetRegistryServicePrivate::widgets()
{
- QList<HsWidgetToken> widgets;
+ QList<HsWidgetComponentDescriptor> widgets;
QMapIterator<QString, QStringList> i(mManifestDirectories);
while (i.hasNext()) {
@@ -88,6 +88,7 @@
/*!
?Qt_style_documentation
*/
+/*
IHsWidgetProvider *HsWidgetRegistryServicePrivate::loadProviderFromPlugin(
const QString &pluginName)
{
@@ -109,6 +110,7 @@
// qDebug("Widget provider load failed - Not found.")
return 0;
}
+*/
/*!
?Qt_style_documentation
@@ -151,10 +153,10 @@
/*!
?Qt_style_documentation
*/
-QList<HsWidgetToken> HsWidgetRegistryServicePrivate::readManifestFile(
+QList<HsWidgetComponentDescriptor> HsWidgetRegistryServicePrivate::readManifestFile(
const QString &manifestFilePath)
{
- QList<HsWidgetToken> widgets;
+ QList<HsWidgetComponentDescriptor> widgets;
QStringList filters("*.manifest");
QDir dir(manifestFilePath);
QStringList manifestDir = dir.entryList(filters, QDir::Files);
@@ -164,44 +166,22 @@
QString fileName = manifestDir.first();
HsWidgetComponentParser componentParser(dir.absoluteFilePath(fileName));
if ( !componentParser.error() ) {
- HsWidgetToken widgetToken;
- HsWidgetComponentDescriptor widgetDescriptor = componentParser.widgetComponentDescriptor();
- widgetToken.mUri = widgetDescriptor.uri;
- widgetToken.mLibrary = manifestFilePath + "/" + widgetDescriptor.uri + ".dll";
- widgetToken.mTitle = widgetDescriptor.title;
+
+ HsWidgetComponentDescriptor widgetDescriptor = componentParser.widgetComponentDescriptor();
+ widgetDescriptor.library = manifestFilePath + "/" + widgetDescriptor.uri + ".dll";
if (widgetDescriptor.iconUri.length() > 0 ) {
- widgetToken.mIconUri = manifestFilePath + "/" + widgetDescriptor.iconUri;
- }
- widgetToken.mDescription = widgetDescriptor.description;
+ widgetDescriptor.iconUri = manifestFilePath + "/" + widgetDescriptor.iconUri;
+ }
+ if (widgetDescriptor.previewImage.length() > 0 ) {
+ widgetDescriptor.previewImage = manifestFilePath + "/" + widgetDescriptor.previewImage;
+ }
+
int widgetUid = dir.dirName().toUInt(0, 16);
- widgetToken.mUid = widgetUid;
- widgets << widgetToken;
+ widgetDescriptor.uid = widgetUid;
+ widgets << widgetDescriptor;
qDebug() << "HsWidgetRegistryServicePrivate::readManifestFile - " \
"widget added: " << fileName;
}
-#if 0
-
- if (fileName != "hsposterwidgetprovider.manifest") {
- // Directory differs from the poster widget's directory
- // which is not supported for the time being.
-// manifest.loadFromXml(dir.absoluteFilePath(fileName));
-// widgets = manifest.widgets();
- int widgetUid = dir.dirName().toUInt(0, 16);
-
- // ?
- for (int i=0; i<widgets.count(); i++) {
- widgets[i].mUid = widgetUid;
- widgets[i].mLibrary = manifestFilePath + "/" + widgets[i].mLibrary;
- if (widgets[i].mIconUri != "") {
- // ?
- widgets[i].mIconUri = manifestFilePath + "/" + widgets[i].mIconUri;
- }
- }
-
- qDebug() << "HsWidgetRegistryServicePrivate::readManifestFile - " \
- "widget added: " << fileName;
- }
-#endif
}
return widgets;
}
@@ -219,8 +199,8 @@
for(int i=0; i < pathList.count(); i++) {
QDir registryDir(pathList.at(i));
- if(!registryDir.exists()) {
- // ?
+ if(!registryDir.exists()) {
+ // ?
registryDir.mkpath(pathList.at(i));
}
}
@@ -266,7 +246,7 @@
Q_UNUSED(newValue);
/*
if ((newValue & KSASwisOperationMask) == ESASwisNone) {
- // ?
+ // ?
mInstallerObserver.unSubscribe();
mInstallerObserver.disconnect();
QStringList originalList = mManifestDirectories.value(mLatestChangedDirectory);
@@ -317,7 +297,7 @@
Fetch available widgets information
Return List of widget tokens.
*/
-QList<HsWidgetToken> HsWidgetRegistryService::widgets()
+QList<HsWidgetComponentDescriptor> HsWidgetRegistryService::widgets()
{
return mPrivate->widgets();
}
@@ -345,7 +325,7 @@
Emits the widgetAddedToRegistry() signal
\a widgetsAdded Identifies the added widgets.
*/
-void HsWidgetRegistryService::emitWidgetAddedToRegistry(const QList<HsWidgetToken> &widgetsAdded)
+void HsWidgetRegistryService::emitWidgetAddedToRegistry(const QList<HsWidgetComponentDescriptor> &widgetsAdded)
{
emit widgetAddedToRegistry(widgetsAdded);
}
--- a/contentstorage/casoftwareregistry/s60/src/casoftwareregistry_p.cpp Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/casoftwareregistry/s60/src/casoftwareregistry_p.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -262,7 +262,7 @@
{
drives = drives.append(
HbParameterLengthLimiter("txt_applib_dialog_1_device_memory").arg(
- QString(QChar('A'+ i)).append(":")));
+ QString(QChar('A'+ i))));
}
else if(DriveInfo::GetDefaultDrive(
DriveInfo::EDefaultMassStorage, drive ) == KErrNone
@@ -270,7 +270,7 @@
{
drives = drives.append(
HbParameterLengthLimiter("txt_applib_dialog_1_mass_storage").arg(
- QString(QChar('A'+ i)).append(":")));
+ QString(QChar('A'+ i))));
}
else if(DriveInfo::GetDefaultDrive(
DriveInfo::EDefaultRemovableMassStorage, drive ) == KErrNone
@@ -287,13 +287,13 @@
if(tv.iName.Length()) {
drives = drives.append(
HbParameterLengthLimiter("txt_applib_dialog_1_2").arg(
- QString(QChar('A'+ i)).append(":")).arg(
+ QString(QChar('A'+ i))).arg(
XQConversions::s60DescToQString(tv.iName)));
}
else {
drives = drives.append(
HbParameterLengthLimiter("txt_applib_dialog_1_memory_card").arg(
- QString(QChar('A'+ i)).append(":")));
+ QString(QChar('A'+ i))));
}
}
} else {
@@ -309,13 +309,13 @@
static const TInt64 KMega = KKilo * KKilo;
if(entry.ComponentSize() >= KMega) {
detailMap[CaSoftwareRegistry::componentSizeKey()] =
- HbParameterLengthLimiter("txt_applib_dialog_l1_mb").arg(QString().setNum(
- static_cast<double>(entry.ComponentSize() / KMega)));
+ HbParameterLengthLimiter("txt_applib_dialog_l1_mb").arg(
+ static_cast<double>(entry.ComponentSize() / KMega));
}
else {
detailMap[CaSoftwareRegistry::componentSizeKey()] =
- HbParameterLengthLimiter("txt_applib_dialog_l1_kb").arg(QString().setNum(
- static_cast<double>(entry.ComponentSize() / KKilo)));
+ HbParameterLengthLimiter("txt_applib_dialog_l1_kb").arg(
+ static_cast<double>(entry.ComponentSize() / KKilo));
}
--- a/contentstorage/casrv/caappscanner/group/caappscanner.mmp Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/casrv/caappscanner/group/caappscanner.mmp Thu Jun 24 16:18:29 2010 +0300
@@ -54,6 +54,5 @@
LIBRARY apgrfx.lib
LIBRARY bafl.lib
LIBRARY efsrv.lib
-LIBRARY sisregistryclient.lib
LIBRARY platformenv.lib
LIBRARY scrclient.lib
--- a/contentstorage/casrv/caappscanner/inc/casrvappscanner.h Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/casrv/caappscanner/inc/casrvappscanner.h Thu Jun 24 16:18:29 2010 +0300
@@ -56,10 +56,7 @@
* to date continuously.
*/
-NONSHARABLE_CLASS( CCaSrvAppScanner ):
- public CActive,
- public MCaInstallListener,
- public MApaAppListServObserver
+NONSHARABLE_CLASS( CCaSrvAppScanner ) : public CActive
{
public:
@@ -78,16 +75,6 @@
static CCaSrvAppScanner* NewL( CCaStorageProxy& aCaStorageProxy,
CCaSrvEngUtils& aUtils );
-public:
- // from MCaInstallListener
-
- /**
- * Handle Install Event.
- * @since S60 v5.0
- * @param aUid installed/uninstalled app uid.
- */
- void HandleInstallNotifyL( TInt aUid );
-
private:
// Constructors and destructor
@@ -105,20 +92,6 @@
void ConstructL();
private:
-
- /**
- * Notifies storage about change for aAppUid.
- * @param aAppUid application uid.
- */
- void NotifyL( TInt aAppUid );
-
- /**
- * Notifies storage about change for aPackageEntry related app.
- * @param aPackageEntry application package entry.
- */
- void NotifyL( Swi::RSisRegistryEntry& aPackageEntry );
-
-private:
// from CActive
/**
@@ -138,11 +111,6 @@
TInt RunError( TInt aError );
private:
- // from MApaAppListServObserver
-
- void HandleAppListEvent( TInt aEvent );
-
-private:
// new methods
/**
@@ -150,9 +118,6 @@
* @result id of download collection.
*/
TInt GetCollectionDownloadIdL();
-
- //TODO temporary sollution for fake uninstall progres notification
- void ClearUninstallFlagL();
/**
* Gets collectionId of all collection.
@@ -201,6 +166,13 @@
TBool HandleRemovableVisibleFlagsUpdateL( CCaInnerEntry* aItem );
/**
+ * Removes application unninstall flag.
+ * @param aItem menu item.
+ * @return ETrue if flags were updated.
+ */
+ TBool RemoveUninstallFlagL( CCaInnerEntry* aItem );
+
+ /**
* Updates application's missing and visible flags.
* @param aItem menu item.
* @return ETrue if flags were updated.
@@ -285,14 +257,9 @@
* Add new menu item referring to this application.
* @param aUid Application capability.
* @param aCurrentMmcId MMC ID of currently inserted MMC, or 0.
+ * @return added item id
*/
- void AddAppEntryL( TUint aUid, TUint aCurrentMmcId );
-
- /**
- * Removes given uid from iInstalledPackages.
- * @param aUid Application uid.
- */
- void RemoveFromInstalledPackages( TUint aUid );
+ TInt AddAppEntryL( TUint aUid, TUint aCurrentMmcId );
/**
* Set information from TApaAppInfo to entry.
@@ -386,8 +353,11 @@
* Update entry from storage.
* @param aEntry application entry.
* @param aMmcId unique mmc id.
+ * @param aAlwaysUpdate item always should be updated.
*/
- void UpdateAppEntryL( CCaInnerEntry* aEntry, TUint aMmcId );
+ void UpdateAppEntryL( CCaInnerEntry* aEntry,
+ TUint aMmcId,
+ TBool aAlwaysUpdate = EFalse );
/**
* Get all applications from storage and visible from apparc
@@ -396,11 +366,6 @@
void UpdateApplicationEntriesL();
/**
- * Notifys storage about updated apps.
- */
- void InstallationNotifyL();
-
- /**
* Make not empty collections with not hidden apps visible.
*/
void MakeNotEmptyCollectionsVisibleL();
@@ -410,7 +375,7 @@
* @param aEntry application entry.
*/
void MakeCollectionVisibleIfHasVisibleEntryL( CCaInnerEntry* aEntry );
-
+
/**
* Adds or updates component id attribute in entry based on SCR provided data
* @param aEntry entry being updated with component id attribute.
@@ -418,28 +383,20 @@
*/
TBool UpdateComponentIdL( CCaInnerEntry& aEntry ) const;
- /**
- * Schedule appscanner run.
- * Self complete active object.
- */
- void ScheduleScan();
-
private:
// data
RApaLsSession iApaLsSession; ///< AppArc session. Own.
- CApaAppListNotifier* iNotifier; ///< Change notifier. Own.
- CCaInstallNotifier* iInstallNotifier; ///< Install notifier. Own.
CCaSrvMmcHistory* iMmcHistory; ///< MMC history. Own.
RFs iFs; ///< File Server Session. Own.
Usif::RSoftwareComponentRegistry iSoftwareRegistry;
CCaStorageProxy& iCaStorageProxy; ///< Not own
CCaSrvEngUtils& iSrvEngUtils; ///< Not own
- RArray<TInt> iInstalledPackages; ///< Own.
TInt iCollectionDownloadId;
TInt iAllCollectionId;
+
CA_STORAGE_TEST_FRIEND_CLASS (T_casrvAppScaner)
};
--- a/contentstorage/casrv/caappscanner/src/casrvappscanner.cpp Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/casrv/caappscanner/src/casrvappscanner.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -17,9 +17,6 @@
#include <e32property.h>
#include <bautils.h>
-#include <swi/sisregistrysession.h>
-#include <swi/sisregistryentry.h>
-#include <swi/sisregistrypackage.h>
#include <usif/scr/screntries.h>
#include "cadef.h"
@@ -91,9 +88,6 @@
Cancel();
iSoftwareRegistry.Close();
iApaLsSession.Close();
- iInstalledPackages.Close();
- delete iInstallNotifier;
- delete iNotifier;
delete iMmcHistory;
iFs.Close();
}
@@ -130,45 +124,17 @@
}
iMmcHistory = CCaSrvMmcHistory::NewL();
iMmcHistory->LoadL( iFs, KCaMmcHistoryFname() );
- iNotifier = CApaAppListNotifier::NewL(
- this, CActive::EPriorityStandard );
- iInstallNotifier = CCaInstallNotifier::NewL(
- *this, CCaInstallNotifier::ESisInstallNotification );
User::LeaveIfError( iApaLsSession.Connect() );
- User::LeaveIfError( iApaLsSession.GetAllApps() ); // This is async.
User::LeaveIfError( iSoftwareRegistry.Connect() );
- iApaLsSession.RegisterListPopulationCompleteObserver( iStatus );
+ iApaLsSession.SetNotify( EFalse, iStatus );
iCollectionDownloadId = 0;
iAllCollectionId = 0;
-
- //TODO temporary sollution for fake uninstall progres notification
- ClearUninstallFlagL();
-
- SetActive();
- }
-// ---------------------------------------------------------
-//
-// ---------------------------------------------------------
-//
-//TODO temporary sollution for fake uninstall progres notification
-void CCaSrvAppScanner::ClearUninstallFlagL()
- {
- CCaInnerQuery* uninstallQuery = CCaInnerQuery::NewLC();
- uninstallQuery->SetFlagsOn( EUninstall );
-
- RPointerArray<CCaInnerEntry> resultArray;
- CleanupResetAndDestroyPushL( resultArray );
- iCaStorageProxy.GetEntriesL( uninstallQuery, resultArray );
- for( TInt i = 0; i < resultArray.Count(); i++ )
- {
- resultArray[i]->SetFlags( resultArray[i]->GetFlags() & ~EUninstall );
- iCaStorageProxy.AddL( resultArray[i] );
- }
- CleanupStack::PopAndDestroy( &resultArray );
-
- CleanupStack::PopAndDestroy( uninstallQuery );
+ UpdateApplicationEntriesL();
+ MakeNotEmptyCollectionsVisibleL();
+
+ SetActive();
}
// ---------------------------------------------------------
@@ -178,10 +144,51 @@
void CCaSrvAppScanner::RunL()
{
User::LeaveIfError( iStatus.Int() );
+
// AppArc app scan complete, we have the app list.
- UpdateApplicationEntriesL();
- InstallationNotifyL();
- MakeNotEmptyCollectionsVisibleL();
+ RArray<TApaAppUpdateInfo> updatedAppsInfo;
+ CleanupClosePushL( updatedAppsInfo );
+ iApaLsSession.UpdatedAppsInfoL( updatedAppsInfo );
+
+ for( TInt i = 0; i < updatedAppsInfo.Count(); i++ )
+ {
+ TApaAppUpdateInfo::TApaAppAction action = updatedAppsInfo[i].iAction;
+ RPointerArray<CCaInnerEntry> resultArray;
+ CleanupResetAndDestroyPushL( resultArray );
+ GetCaAppEntriesL( updatedAppsInfo[i].iAppUid.iUid, resultArray );
+ if( action == TApaAppUpdateInfo::EAppPresent
+ || action == TApaAppUpdateInfo::EAppInfoChanged )
+ {
+ TInt id;
+ if( !resultArray.Count() )
+ {
+ id = AddAppEntryL(
+ updatedAppsInfo[i].iAppUid.iUid, UpdateMmcHistoryL() );
+ }
+ else
+ {
+ ASSERT( resultArray.Count() == 1 );
+ id = resultArray[0]->GetId();
+ UpdateAppEntryL( resultArray[0], UpdateMmcHistoryL(), ETrue );
+ AddEntryToPredefinedCollectionL( resultArray[0], ETrue );
+ }
+ AddEntryToDownloadedCollectionL( id );
+ MakeNotEmptyCollectionsVisibleL();
+ }
+ else if( action == TApaAppUpdateInfo::EAppNotPresent )
+ {
+ HandleMissingItemsL( resultArray );
+ }
+ else
+ {
+ User::Leave( KErrNotSupported );
+ }
+ CleanupStack::PopAndDestroy( &resultArray );
+ }
+ CleanupStack::PopAndDestroy( &updatedAppsInfo );
+
+ iApaLsSession.SetNotify( EFalse, iStatus );
+ SetActive();
}
// ---------------------------------------------------------
@@ -190,7 +197,7 @@
//
void CCaSrvAppScanner::DoCancel()
{
- iApaLsSession.CancelListPopulationCompleteObserver();
+ iApaLsSession.CancelNotify();
}
// ---------------------------------------------------------
@@ -247,7 +254,8 @@
//
// ---------------------------------------------------------
//
-void CCaSrvAppScanner::UpdateAppEntryL( CCaInnerEntry* aEntry, TUint aMmcId )
+void CCaSrvAppScanner::UpdateAppEntryL(
+ CCaInnerEntry* aEntry, TUint aMmcId, TBool aAlwaysUpdate )
{
TBool toUpdate = HandleMmcAttrUpdateL( aEntry, aMmcId );
TBool missingVisibleFlagChanged =
@@ -255,23 +263,18 @@
toUpdate = missingVisibleFlagChanged || toUpdate;
toUpdate = HandleRemovableVisibleFlagsUpdateL( aEntry ) || toUpdate;
toUpdate = SetApaAppInfoL( aEntry ) || toUpdate;
+ toUpdate = RemoveUninstallFlagL( aEntry ) || toUpdate;
- if( iInstalledPackages.Find( aEntry->GetUid() ) != KErrNotFound )
- {
- AddEntryToDownloadedCollectionL( aEntry->GetId() );
- toUpdate = HandleUsedFlagUpdate( aEntry ) || toUpdate;
- AddEntryToPredefinedCollectionL( aEntry, ETrue );
- }
- if( toUpdate )
+ if( toUpdate || aAlwaysUpdate )
{
//update app in storage
+ HandleUsedFlagUpdate( aEntry );
TItemAppearance itemAppearanceChange = EItemAppearanceNotChanged;
if( missingVisibleFlagChanged )
{
itemAppearanceChange = EItemAppeared;
}
iCaStorageProxy.AddL( aEntry, EFalse, itemAppearanceChange );
- RemoveFromInstalledPackages( aEntry->GetUid() );
}
}
@@ -322,19 +325,6 @@
//
// ---------------------------------------------------------
//
-void CCaSrvAppScanner::InstallationNotifyL()
- {
- for( TInt i = iInstalledPackages.Count() - 1; i >= 0; i-- )
- {
- NotifyL( iInstalledPackages[i] );
- iInstalledPackages.Remove( i );
- }
- }
-
-// ---------------------------------------------------------
-//
-// ---------------------------------------------------------
-//
void CCaSrvAppScanner::UpdateApplicationEntriesL()
{
TUint currentMmcId = UpdateMmcHistoryL();
@@ -396,6 +386,21 @@
//
// ---------------------------------------------------------
//
+TBool CCaSrvAppScanner::RemoveUninstallFlagL( CCaInnerEntry* aItem )
+ {
+ TBool toChange( EFalse );
+ if( aItem->GetFlags() & EUninstall )
+ {
+ aItem->SetFlags( aItem->GetFlags() & ~EUninstall );
+ toChange = ETrue;
+ }
+ return toChange;
+ }
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
TBool CCaSrvAppScanner::HandleMissingVisibleFlagsUpdate(
CCaInnerEntry* aItem )
{
@@ -627,104 +632,6 @@
//
// ---------------------------------------------------------
//
-void CCaSrvAppScanner::HandleAppListEvent( TInt /*aEvent*/)
- {
- // We only have one event, EAppListChanged.
- // Call back RunL async, to requeue and initiate rescan.
- if( !IsActive() )
- {
- ScheduleScan();
- }
- }
-
-// ---------------------------------------------------------
-//
-// ---------------------------------------------------------
-//
-void CCaSrvAppScanner::HandleInstallNotifyL( TInt aUid )
- {
- NotifyL( aUid );
- RArray<TUid> uids;
- CleanupClosePushL( uids );
-
- Swi::RSisRegistrySession iSisRegSession;
- CleanupClosePushL( iSisRegSession );
- User::LeaveIfError( iSisRegSession.Connect() );
-
- // Open sis package entry related to aUid
- Swi::RSisRegistryEntry packageEntry;
- if( KErrNone
- == packageEntry.Open( iSisRegSession, TUid::Uid( aUid ) ) )
- {
- CleanupClosePushL( packageEntry );
-
- // Get packageEntry's embedded sis'
- RPointerArray<Swi::CSisRegistryPackage> embedded;
- CleanupResetAndDestroyPushL( embedded );
- packageEntry.EmbeddedPackagesL( embedded );
- if( embedded.Count() )
- {
- // For each embadded sis we notify storage - recursive call
- for( TInt i = 0; i < embedded.Count(); ++i )
- {
- HandleInstallNotifyL( embedded[i]->Uid().iUid );
- }
- }
- else
- {
- // There are no embaddes sis', so we can notify storage
- // of changes in apps included in packageEntry
- NotifyL( packageEntry );
- }
- CleanupStack::PopAndDestroy( &embedded );
- CleanupStack::PopAndDestroy( &packageEntry );
- }
- CleanupStack::PopAndDestroy( &iSisRegSession );
- CleanupStack::PopAndDestroy( &uids );
- }
-
-// ---------------------------------------------------------
-//
-// ---------------------------------------------------------
-//
-void CCaSrvAppScanner::NotifyL( Swi::RSisRegistryEntry & aPackageEntry )
- {
- // Get sids ( == uids of exetucables included in aPackageEntry )
- RArray<TUid> sids;
- CleanupClosePushL( sids );
- aPackageEntry.SidsL( sids );
- if( sids.Count() )
- {
- // For each sid we notify storage
- for( TInt i = 0; i < sids.Count(); ++i )
- {
- iInstalledPackages.Append( sids[i].iUid );
- }
- }
- CleanupStack::PopAndDestroy( &sids );
- }
-
-// ---------------------------------------------------------
-//
-// ---------------------------------------------------------
-//
-void CCaSrvAppScanner::NotifyL( TInt aAppUid )
- {
- // Get entries for given aAppUid
- RPointerArray<CCaInnerEntry> resultArray;
- CleanupResetAndDestroyPushL( resultArray );
- GetCaAppEntriesL( aAppUid, resultArray );
- if( resultArray.Count() && ( resultArray[0]->GetFlags() & EVisible ) )
- {//TODO: this only for icons. This functionality should be change
- iCaStorageProxy.AddL( resultArray[0] );
- }
- CleanupStack::PopAndDestroy( &resultArray );
- }
-
-// ---------------------------------------------------------
-//
-// ---------------------------------------------------------
-//
void CCaSrvAppScanner::AddEntryToDownloadedCollectionL( TInt aEntryId )
{
TCaOperationParams params;
@@ -870,23 +777,9 @@
//
// ---------------------------------------------------------
//
-void CCaSrvAppScanner::ScheduleScan()
+TInt CCaSrvAppScanner::AddAppEntryL( TUint aUid, TUint aCurrentMmcId )
{
- if( !IsActive() )
- {
- TRequestStatus* ownStatus = &iStatus;
- *ownStatus = KRequestPending;
- SetActive();
- User::RequestComplete( ownStatus, KErrNone );
- }
- }
-
-// ---------------------------------------------------------
-//
-// ---------------------------------------------------------
-//
-void CCaSrvAppScanner::AddAppEntryL( TUint aUid, TUint aCurrentMmcId )
- {
+ TInt id(KErrNotFound);
// Now add the app entry.
CCaInnerEntry* appEntry = CCaInnerEntry::NewLC();
@@ -900,29 +793,12 @@
HandleMmcAttrUpdateL( appEntry, aCurrentMmcId );
iCaStorageProxy.AddL( appEntry );
+ id = appEntry->GetId();
AddEntryToPredefinedCollectionL( appEntry );
- if( iInstalledPackages.Find( aUid ) != KErrNotFound )
- {
- AddEntryToDownloadedCollectionL( appEntry->GetId() );
- RemoveFromInstalledPackages( aUid );
- }
-
CleanupStack::PopAndDestroy( appEntry );
- }
-
-// ---------------------------------------------------------
-//
-// ---------------------------------------------------------
-//
-void CCaSrvAppScanner::RemoveFromInstalledPackages( TUint aUid )
- {
- TInt appIndex = iInstalledPackages.Find( aUid );
- if( appIndex != KErrNotFound )
- {
- iInstalledPackages.Remove( appIndex );
- }
+ return id;
}
// ---------------------------------------------------------------------------
@@ -948,15 +824,15 @@
aEntry->AddAttributeL( KCaAttrShortName, info->iShortCaption );
changed = ETrue;
}
-
-
+
+
if ( UpdateComponentIdL( *aEntry ) )
{
changed = ETrue;
}
-
+
CleanupStack::PopAndDestroy( &attrVal );
-
+
// check if its java app and add attr for entries
TUid appTypeUid;
if( KErrNone == iApaLsSession.GetAppType( appTypeUid, info->iUid ) )
@@ -966,14 +842,14 @@
aEntry->AddAttributeL(
KCaAttrAppType,
KCaAttrAppTypeValueJava );
-
- TComponentId compId =
+
+ TComponentId compId =
iSoftwareRegistry.GetComponentIdForAppL( info->iUid );
- CPropertyEntry* propertyEntry =
+ CPropertyEntry* propertyEntry =
iSoftwareRegistry.GetComponentPropertyL( compId, KCaScrPropertyAppSettings );
CleanupStack::PushL( propertyEntry );
- if ( propertyEntry &&
- propertyEntry->PropertyType() == CPropertyEntry::ELocalizedProperty )
+ if ( propertyEntry &&
+ propertyEntry->PropertyType() == CPropertyEntry::ELocalizedProperty )
{
aEntry->AddAttributeL(
KCaAttrAppSettingsPlugin,
@@ -986,9 +862,9 @@
aEntry->AddAttributeL(
KCaAttrAppType,
KCaAttrAppTypeValueCWRT );
- TComponentId compId =
+ TComponentId compId =
iSoftwareRegistry.GetComponentIdForAppL( info->iUid );
- CPropertyEntry* isMiniview =
+ CPropertyEntry* isMiniview =
iSoftwareRegistry.GetComponentPropertyL( compId,
KCaScrPropertyIsMiniviewSupported );
CleanupStack::PushL( isMiniview );
@@ -996,11 +872,11 @@
if (isMiniview && isMiniview->PropertyType() == CPropertyEntry::EIntProperty &&
static_cast<CIntPropertyEntry*>(isMiniview)->IntValue())
{
- CPropertyEntry* appId =
+ CPropertyEntry* appId =
iSoftwareRegistry.GetComponentPropertyL( compId, KCaScrPropertyAppId );
CleanupStack::PushL( appId );
- if ( appId &&
- appId->PropertyType() == CPropertyEntry::ELocalizedProperty )
+ if ( appId &&
+ appId->PropertyType() == CPropertyEntry::ELocalizedProperty )
{
aEntry->AddAttributeL(
KCaAttrAppWidgetUri,
@@ -1010,7 +886,7 @@
static_cast<CLocalizablePropertyEntry*>(appId)->StrValue() );
}
CleanupStack::PopAndDestroy( appId );
- }
+ }
CleanupStack::PopAndDestroy( isMiniview );
}
}
@@ -1036,8 +912,8 @@
TUint mmcId = 0;
MenuUtils::GetTUint( attrVal, mmcId );
if( ( mmcId && KErrNotFound != iMmcHistory->Find( mmcId )
- && mmcId != CurrentMmcId() )
- || ( attrVal == KCaMassStorage()
+ && mmcId != CurrentMmcId() )
+ || ( attrVal == KCaMassStorage()
&& IsDriveInUse( DriveInfo::EDefaultMassStorage ) ) )
{
// This item is on an MMC which is currently
@@ -1286,38 +1162,38 @@
TBool CCaSrvAppScanner::UpdateComponentIdL( CCaInnerEntry& aEntry ) const
{
TBool updated( EFalse );
-
+
TUid uid;
TInt err(KErrNone);
TComponentId componentId( 0 );
- TRAP(err, componentId =
+ TRAP(err, componentId =
iSoftwareRegistry.GetComponentIdForAppL(
uid.Uid( aEntry.GetUid() ) ) )
-
+
if ( componentId > 0 && err == KErrNone )
{
RBuf newComponentId;
newComponentId.CleanupClosePushL();
newComponentId.CreateL( sizeof(TComponentId) + 1 );
newComponentId.AppendNum( componentId );
-
+
RBuf oldComponentId;
oldComponentId.CleanupClosePushL();
oldComponentId.CreateL( KCaMaxAttrValueLen );
-
- const TBool componentIdAttributeFound =
+
+ const TBool componentIdAttributeFound =
aEntry.FindAttribute( KCaComponentId, oldComponentId );
-
- if ( !componentIdAttributeFound
+
+ if ( !componentIdAttributeFound
|| oldComponentId.Compare( newComponentId ) != 0 )
{
// 'add' or 'update' the component id attribute value
- aEntry.AddAttributeL( KCaComponentId,
+ aEntry.AddAttributeL( KCaComponentId,
newComponentId );
-
+
updated = ETrue;
}
-
+
CleanupStack::PopAndDestroy( &oldComponentId );
CleanupStack::PopAndDestroy( &newComponentId );
}
--- a/contentstorage/casrv/calocalizerscanner/bwins/calocalizerscanneru.def Fri Jun 11 16:13:51 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-EXPORTS
- ?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 1 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &)
-
--- a/contentstorage/casrv/calocalizerscanner/calocalizerscanner.pro Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/casrv/calocalizerscanner/calocalizerscanner.pro Thu Jun 24 16:18:29 2010 +0300
@@ -45,7 +45,6 @@
" TARGET calocalizerscanner.rsc" \
"END"
MMP_RULES += rssResource
- MMP_RULES -= EXPORTUNFROZEN
MMP_RULES += "$${LITERAL_HASH}if defined(WINSCW)" \
"DEFFILE ./bwins/calocalizerscanner.def" \
"$${LITERAL_HASH}else" \
--- a/contentstorage/casrv/calocalizerscanner/eabi/calocalizerscanneru.def Fri Jun 11 16:13:51 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-EXPORTS
- _Z24ImplementationGroupProxyRi @ 1 NONAME
-
--- a/contentstorage/casrv/carunningappmonitor/group/carunningappmonitor.mmp Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/casrv/carunningappmonitor/group/carunningappmonitor.mmp Thu Jun 24 16:18:29 2010 +0300
@@ -40,7 +40,7 @@
USERINCLUDE ../../../srvinc
USERINCLUDE ../../../cautils/inc
-APP_LAYER_SYSTEMINCLUDE
+MW_LAYER_SYSTEMINCLUDE
SOURCEPATH ../data
START RESOURCE carunningappmonitor.rss
--- a/contentstorage/casrv/casrvmgr/group/casrvmanager.mmp Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/casrv/casrvmgr/group/casrvmanager.mmp Thu Jun 24 16:18:29 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// To get the APP_LAYER_SYSTEMINCLUDE-definition
+// To get the MW_LAYER_SYSTEMINCLUDE-definition
#include <platform_paths.hrh>
TARGET casrvmanager.dll
@@ -30,7 +30,7 @@
USERINCLUDE ../inc
-APP_LAYER_SYSTEMINCLUDE
+MW_LAYER_SYSTEMINCLUDE
LIBRARY euser.lib
LIBRARY ECom.lib
--- a/contentstorage/casrv/cawidgetscanner/inc/cawidgetdescription.h Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/casrv/cawidgetscanner/inc/cawidgetdescription.h Thu Jun 24 16:18:29 2010 +0300
@@ -101,6 +101,12 @@
* @param aUri widget uri
*/
void SetUriL( const TDesC& aUri );
+
+ /*
+ * Translation file setter.
+ * @param aTranslationFileName widget translation file.
+ */
+ void SetTranslationFileNameL( const TDesC& aTranslationFileName );
/*
* Icon Uri setter
@@ -121,6 +127,18 @@
void SetLibraryL( const TDesC& aLibrary );
/*
+ * Path setter
+ * @param aLibrary widget library
+ */
+ void SetPathL( const TDesC& aPath );
+
+ /*
+ * Path getter
+ * @return widget library
+ */
+ TPtrC GetPath( ) const;
+
+ /*
* Content storage entry id getter
* @return CS entry id
*/
@@ -151,6 +169,12 @@
TPtrC GetUri() const;
/*
+ * Uri translation filename
+ * @return widget translation filename
+ */
+ TPtrC GetTranslationFileName() const;
+
+ /*
* IconUri getter
* @return widget IconUri
*/
@@ -334,6 +358,11 @@
* Widget uri. Own
*/
RBuf iUri;
+
+ /*
+ * Widget translation file name. Own
+ */
+ RBuf iTranslationFileName;
/*
* Widget icon uri. Own
@@ -344,6 +373,12 @@
* Preview name. Own
*/
RBuf iPreviewImageName;
+
+ /*
+ * Widget library. Own
+ */
+ RBuf iPath;
+
/*
* Widget library. Own
*/
--- a/contentstorage/casrv/cawidgetscanner/inc/cawidgetscannerdef.h Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/casrv/cawidgetscanner/inc/cawidgetscannerdef.h Thu Jun 24 16:18:29 2010 +0300
@@ -51,11 +51,13 @@
_LIT8(KIcon, "icon");
_LIT8( KPreviewImageElementName, "previewimage" );
_LIT8(KServiceXml, "servicexml");
+_LIT8( KTranslationFileName, "translationfile" );
// CONSTANTS
_LIT(KAttrWidgetPath, "widget:path");
_LIT(KAttrWidgetLibrary, "widget:library");
_LIT(KAttrWidgetUri, "widget:uri");
+_LIT(KAttrWidgetTranslationFileName, "widget:translation_file");
_LIT(KAttrWidgetServiceXml, "widget:servicexml");
_LIT(KSlash, "/");
_LIT(KDllExt, ".dll");
--- a/contentstorage/casrv/cawidgetscanner/inc/cawidgetscannerparser.h Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/casrv/cawidgetscanner/inc/cawidgetscannerparser.h Thu Jun 24 16:18:29 2010 +0300
@@ -137,6 +137,13 @@
* @param aWidget widget to set value
*/
void SetUriL( TXmlEngElement& aElement, CCaWidgetDescription* aWidget );
+
+ /**
+ * Sets translation filename
+ * @param aElement xml element
+ * @param aWidget widget to set value
+ */
+ void SetTranslationFileNameL( TXmlEngElement& aElement, CCaWidgetDescription* aWidget );
/**
* Sets widgets library and path created from library
@@ -205,6 +212,9 @@
const TDesC& aPackageUid,
CCaWidgetDescription* aWidgetDescriptor,
TChar& aDrive );
+
+ void ParseTranslationFileNameL( TXmlEngElement& aElement,
+ CCaWidgetDescription* aWidgetDescriptor );
/**
* @param aElement xml document element.
--- a/contentstorage/casrv/cawidgetscanner/src/cawidgetdescription.cpp Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/casrv/cawidgetscanner/src/cawidgetdescription.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -71,13 +71,19 @@
aEntry->FindAttribute( KPreviewImageAttrName, attribute );
iPreviewImageName.CreateL( attribute.Length() );
iPreviewImageName = attribute;
-
+
//library
iLibrary.CreateL( KCaMaxAttrValueLen );
aEntry->FindAttribute( KAttrWidgetLibrary, iLibrary );
+ //path
+ iPath.CreateL( KCaMaxAttrValueLen );
+ aEntry->FindAttribute( KAttrWidgetPath, iPath );
//uri
iUri.CreateL( KCaMaxAttrValueLen );
aEntry->FindAttribute( KAttrWidgetUri, iUri );
+ //translation filename
+ iTranslationFileName.CreateL( KCaMaxAttrValueLen );
+ aEntry->FindAttribute( KAttrWidgetTranslationFileName, iTranslationFileName );
//mmc id
iMmcId.CreateL(KMassStorageIdLength);
aEntry->FindAttribute( KCaAttrMmcId, iMmcId );
@@ -134,11 +140,12 @@
//
CCaWidgetDescription::~CCaWidgetDescription()
{
-
+ iPath.Close();
iModificationTime.Close();
iServiceXml.Close();
iMmcId.Close();
iUri.Close();
+ iTranslationFileName.Close();
iLibrary.Close();
iPreviewImageName.Close();
iIconUri.Close();
@@ -182,6 +189,7 @@
aToCompare.GetIconUri() == GetIconUri() &&
aToCompare.GetPreviewImageName() == GetPreviewImageName() &&
aToCompare.GetTitle() == GetTitle() &&
+ aToCompare.GetTranslationFileName() == GetTranslationFileName() &&
aToCompare.GetLibrary() != KNoLibrary &&
aToCompare.GetModificationTime() == GetModificationTime() &&
aToCompare.GetServiceXml() == GetServiceXml()
@@ -255,6 +263,18 @@
iUri.Close();
iUri.CreateL(aUri);
}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CCaWidgetDescription::SetTranslationFileNameL(
+ const TDesC& aTranslationFileName )
+ {
+ iTranslationFileName.Close();
+ iTranslationFileName.CreateL( aTranslationFileName );
+ }
+
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
@@ -373,6 +393,25 @@
{
return iLibrary;
}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+TPtrC CCaWidgetDescription::GetPath( ) const
+ {
+ return iPath;
+ }
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CCaWidgetDescription::SetPathL( const TDesC& aPath )
+ {
+ iPath.Close();
+ iPath.CreateL(aPath);
+ }
+
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
@@ -395,6 +434,15 @@
//
// -----------------------------------------------------------------------------
//
+TPtrC CCaWidgetDescription::GetTranslationFileName() const
+ {
+ return iTranslationFileName;
+ }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
TPtrC CCaWidgetDescription::GetIconUri( ) const
{
return iIconUri;
@@ -500,6 +548,10 @@
entry->SetFlags( entry->GetFlags() & ~ERemovable );
}
}
+ if ( iPath != KNullDesC )
+ {
+ entry->AddAttributeL(KAttrWidgetPath, iPath);
+ }
if ( iTitle != KNullDesC )
{
entry->SetTextL(iTitle);
@@ -535,6 +587,11 @@
{
entry->AddAttributeL( KAttrWidgetServiceXml, iServiceXml);
}
+ if( iTranslationFileName != KNullDesC )
+ {
+ entry->AddAttributeL( KAttrWidgetTranslationFileName,
+ iTranslationFileName );
+ }
return entry;
}
@@ -589,72 +646,70 @@
// -----------------------------------------------------------------------------
//
void CCaWidgetDescription::LocalizeTextsL()
- {
-
-
- if( iUri.Length() )
- {
- RBuf uri;
- uri.Create( iUri.Length() + 1 );
- CleanupClosePushL( uri );
- uri.Copy( iUri );
- uri.Append( KWidgetScannerUnderline );
-
-
- if( !HbTextResolverSymbian::Init( uri, KLocalizationFilepathC ) )
- {
- if( !HbTextResolverSymbian::Init( uri, KLocalizationFilepathZ ) )
- {
- // this should not be called too often
+ {
+ if( iTranslationFileName.Length() )
+ {
+ RBuf translationFileName;
+ translationFileName.Create( iTranslationFileName.Length() + 1 );
+ CleanupClosePushL( translationFileName );
+ translationFileName.Copy( iTranslationFileName );
+ translationFileName.Append( KWidgetScannerUnderline );
+
+
+ if( !HbTextResolverSymbian::Init( translationFileName, KLocalizationFilepathC ) )
+ {
+ if( !HbTextResolverSymbian::Init( translationFileName, KLocalizationFilepathZ ) )
+ {
+ // this should not be called too often
TChar currentDriveLetter;
- TDriveList driveList;
- RFs fs;
- User::LeaveIfError( fs.Connect() );
- User::LeaveIfError( fs.DriveList( driveList ) );
+ TDriveList driveList;
+ RFs fs;
+ User::LeaveIfError( fs.Connect() );
+ User::LeaveIfError( fs.DriveList( driveList ) );
- RBuf path;
- path.Create( KLocalizationFilepath().Length() + 1 );
- CleanupClosePushL( path );
-
- for ( TInt driveNr=EDriveY; driveNr >= EDriveA; driveNr-- )
- {
- if ( driveList[driveNr] )
- {
- User::LeaveIfError( fs.DriveToChar( driveNr,
- currentDriveLetter ) );
- path.Append( currentDriveLetter );
- path.Append( KLocalizationFilepath );
- if( HbTextResolverSymbian::Init( uri, path ) )
- {
- break;
- }
- }
- path.Zero();
- }
- CleanupStack::PopAndDestroy( &path );
- fs.Close();
- }
- }
-
- HBufC* tmp;
-
- if( iTitle.Length() )
- {
- SetStringidTitleL( iTitle );
- tmp = HbTextResolverSymbian::LoadLC( iTitle );
- SetTitleL( *tmp );
- CleanupStack::PopAndDestroy( tmp );
- }
- if( iDescription.Length() )
- {
- SetStringIdDescriptionL( iDescription );
- tmp = HbTextResolverSymbian::LoadLC( iDescription );
- SetDescriptionL( *tmp );
- CleanupStack::PopAndDestroy( tmp );
- }
- CleanupStack::PopAndDestroy( &uri );
- }
- }
+ RBuf path;
+ path.Create( KLocalizationFilepath().Length() + 1 );
+ CleanupClosePushL( path );
+
+ for( TInt driveNr=EDriveY; driveNr >= EDriveA; driveNr-- )
+ {
+ if( driveList[driveNr] )
+ {
+ User::LeaveIfError( fs.DriveToChar( driveNr,
+ currentDriveLetter ) );
+ path.Append( currentDriveLetter );
+ path.Append( KLocalizationFilepath );
+ if( HbTextResolverSymbian::Init( translationFileName, path ) )
+ {
+ break;
+ }
+ }
+ path.Zero();
+ }
+ CleanupStack::PopAndDestroy( &path );
+ fs.Close();
+ }
+ }
+
+ HBufC* tmp;
+
+ if( iTitle.Length() )
+ {
+ SetStringidTitleL( iTitle );
+ tmp = HbTextResolverSymbian::LoadLC( iTitle );
+ SetTitleL( *tmp );
+ CleanupStack::PopAndDestroy( tmp );
+ }
+ if( iDescription.Length() )
+ {
+ SetStringIdDescriptionL( iDescription );
+ tmp = HbTextResolverSymbian::LoadLC( iDescription );
+ SetDescriptionL( *tmp );
+ CleanupStack::PopAndDestroy( tmp );
+ }
+ CleanupStack::PopAndDestroy( &translationFileName );
+ }
+ }
// -----------------------------------------------------------------------------
//
--- a/contentstorage/casrv/cawidgetscanner/src/cawidgetscannerinstallnotifier.cpp Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/casrv/cawidgetscanner/src/cawidgetscannerinstallnotifier.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -114,12 +114,14 @@
User::LeaveIfError( iProperty.Get( KUidSystemCategory,
KSAUidSoftwareInstallKeyValue, status ) );
- if ( iHackFlag )
+ if( iHackFlag )
{
iHackFlag = EFalse;
iCallback->SynchronizeL();
}
- else if ( ( status & EInstOpInstall ) || ( status & EInstOpUninstall ) )
+ else if( ( status & EInstOpStatusSuccess ) && (
+ ( status & EInstOpInstall ) ||
+ ( status & EInstOpUninstall ) ) )
{
iHackFlag = ETrue;
}
--- a/contentstorage/casrv/cawidgetscanner/src/cawidgetscannerparser.cpp Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/casrv/cawidgetscanner/src/cawidgetscannerparser.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -281,9 +281,19 @@
{
ParsePreviewImageNameL( element, aPackageUid, widgetDescriptor, aDrive );
}
+ else if ( element.Name() == KTranslationFileName )
+ {
+ ParseTranslationFileNameL( element, widgetDescriptor );
+ }
}
CleanupStack::PopAndDestroy( &childElementList );
+ //set path for hs to use, trim last 2 chars (doubleslash)
+ HBufC *libraryPath = GetManifestDirectoryPathLC( aPackageUid, aDrive );
+ widgetDescriptor->SetPathL(libraryPath->Mid(0,libraryPath->Length()-1));
+ CleanupStack::PopAndDestroy(libraryPath);
+
+
HBufC *libraryPath2 = GetManifestDirectoryPathLC( aPackageUid, aDrive );
libraryPath2 = libraryPath2->ReAllocL( libraryPath2->Length()
+ widgetDescriptor->GetUri().Length() );
@@ -326,6 +336,7 @@
widget->SetPackageUidL( aPackageUid );
widget->SetManifestFilePathNameL( aFilePath );
SetMmcIdL( widget, aDrive );
+ SetTranslationFileNameL( aElement, widget );
SetModificationTimeL( aFilePath, widget );
@@ -353,6 +364,25 @@
if ( attributeValue->Compare( KNullDesC ) != 0 )
{
aWidget->SetUriL( *attributeValue );
+ aWidget->SetTranslationFileNameL( *attributeValue );
+ }
+ CleanupStack::PopAndDestroy( attributeValue );
+ }
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void CCaWidgetScannerParser::SetTranslationFileNameL( TXmlEngElement& aElement,
+ CCaWidgetDescription* aWidget )
+ {
+ HBufC *attributeValue = CnvUtfConverter::ConvertToUnicodeFromUtf8L(
+ aElement.AttributeValueL( KTranslationFileName ) );
+ CleanupStack::PushL( attributeValue );
+
+ if ( attributeValue->Compare( KNullDesC ) != 0 )
+ {
+ aWidget->SetTranslationFileNameL( *attributeValue );
}
CleanupStack::PopAndDestroy( attributeValue );
}
@@ -372,6 +402,9 @@
{
HBufC *libraryPath = GetManifestDirectoryPathLC( aPackageUid, aDrive );
+ //set path for hs to use, trim last 2 chars (doubleslash)
+ aWidget->SetPathL(libraryPath->Mid(0,libraryPath->Length()-1));
+
libraryPath->ReAllocL( libraryPath->Length() + attributeValue->Length() );
TPtr libraryPathModifier( libraryPath->Des() );
@@ -569,7 +602,12 @@
CCaWidgetDescription* aWidgetDescriptor )
{
aWidgetDescriptor->SetUriL( *GetElementTextLC( aElement ) );
- CleanupStack::PopAndDestroy( );
+ CleanupStack::PopAndDestroy();
+
+ if( aWidgetDescriptor->GetTranslationFileName().Compare( KNullDesC ) == 0 )
+ {
+ ParseTranslationFileNameL( aElement, aWidgetDescriptor );
+ }
}
// ----------------------------------------------------------------------------
@@ -610,7 +648,18 @@
aWidgetDescriptor->SetPreviewImageNameL(
*GetThemableGraphicsNameLC(aElement, aPackageUid, aDrive ) );
- CleanupStack::PopAndDestroy( );
+ CleanupStack::PopAndDestroy();
+ }
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void CCaWidgetScannerParser::ParseTranslationFileNameL(
+ TXmlEngElement& aElement, CCaWidgetDescription* aWidgetDescriptor )
+ {
+ aWidgetDescriptor->SetTranslationFileNameL( *GetElementTextLC( aElement ) );
+ CleanupStack::PopAndDestroy();
}
// ----------------------------------------------------------------------------
--- a/contentstorage/casrv/cawidgetscanner/src/cawidgetstoragehandler.cpp Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/casrv/cawidgetscanner/src/cawidgetstoragehandler.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -356,9 +356,9 @@
const CCaWidgetDescription* aWidget, TInt aEntryId )
{
RBuf filename;
- filename.CreateL( aWidget->GetUri().Length() + 1 ); //1 for _
+ filename.CreateL( aWidget->GetTranslationFileName().Length() + 1 ); //1 for _
CleanupClosePushL( filename );
- filename.Copy( aWidget->GetUri() );
+ filename.Copy( aWidget->GetTranslationFileName() );
filename.Append( KWidgetScannerUnderline );
// prepare localizations
--- a/contentstorage/castorage/bwins/castorageu.def Fri Jun 11 16:13:51 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-EXPORTS
- ?NewDatabaseL@CaStorageFactory@@SAPAVCCaStorage@@XZ @ 1 NONAME ; class CCaStorage * CaStorageFactory::NewDatabaseL(void)
-
--- a/contentstorage/castorage/eabi/castorageu.def Fri Jun 11 16:13:51 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-EXPORTS
- _ZN16CaStorageFactory12NewDatabaseLEv @ 1 NONAME
-
--- a/contentstorage/castorage/inc/casqlcommands.h Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/castorage/inc/casqlcommands.h Thu Jun 24 16:18:29 2010 +0300
@@ -171,6 +171,9 @@
_LIT( KSQLGetListByParentId2, "LEFT JOIN CA_ICON ON EN_ICON_ID = ICON_ID LEFT JOIN CA_GROUP_ENTRY ON \
GE_ENTRY_ID = ENTRY_ID WHERE GE_GROUP_ID = :GE_GROUP_ID %S " );
+_LIT( KSQLGetListByChildId, "LEFT JOIN CA_ICON ON EN_ICON_ID = ICON_ID LEFT JOIN CA_GROUP_ENTRY ON \
+GE_GROUP_ID = ENTRY_ID WHERE GE_ENTRY_ID = :GE_ENTRY_ID %S " );
+
//Get all attributes by entry id
//:Entry_Id_List is a list of Integers seperated by commas.
_LIT( KSQLGetAttributesByEntryId, "SELECT \
--- a/contentstorage/castorage/inc/castorage.h Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/castorage/inc/castorage.h Thu Jun 24 16:18:29 2010 +0300
@@ -79,7 +79,7 @@
* @param aEntryIdArray list of enties ids.
* @param aParentIdArray The result list of parents' ids
* for a specific select.
- * @param aCheckParentsParent falg if set to true then
+ * @param aCheckParentsParent flag if set to true then
* search also for parent of the parent
*/
virtual void GetParentsIdsL( const RArray<TInt>& aEntryIdArray,
--- a/contentstorage/castorage/src/casqlquery.cpp Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/castorage/src/casqlquery.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -480,6 +480,12 @@
BindIntL( iStatement.ParameterIndex( KSQLGEIdGroup ),
aQuery->GetParentId() );
}
+ if( aQuery->GetChildId() != -1 && iQuery.Find( KSQLGEEntryId )
+ != KErrNotFound )
+ {
+ BindIntL( iStatement.ParameterIndex( KSQLGEEntryId ),
+ aQuery->GetChildId() );
+ }
if( aQuery->GetUid() != 0 && iQuery.Find( KSQLEnUid )
!= KErrNotFound )
{
--- a/contentstorage/castorage/src/casqlquerycreator.cpp Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/castorage/src/casqlquerycreator.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -818,6 +818,20 @@
query.Append( getListByParentId2withWhere );
CleanupStack::PopAndDestroy( &getListByParentId2withWhere );
}
+ else if ( aQuery->GetChildId() > 0 )
+ {
+ RBuf getListByCildIdwithWhere;
+ getListByCildIdwithWhere.CleanupClosePushL();
+ getListByCildIdwithWhere.CreateL( KSQLGetListByChildId().Length() + whereStatement.Length() );
+ getListByCildIdwithWhere.AppendFormat( KSQLGetListByChildId, &whereStatement );
+
+ query.ReAllocL( KSQLGetListByParentId1().Length() + leftJoins.Length() +
+ getListByCildIdwithWhere.Length() );
+ query.Append( KSQLGetListByParentId1 );
+ query.Append( leftJoins );
+ query.Append( getListByCildIdwithWhere );
+ CleanupStack::PopAndDestroy( &getListByCildIdwithWhere );
+ }
else
{
query.CreateL( KSQLGetList1().Length() );
--- a/contentstorage/cautils/inc/cainnerquery.h Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/cautils/inc/cainnerquery.h Thu Jun 24 16:18:29 2010 +0300
@@ -90,12 +90,25 @@
IMPORT_C TInt GetParentId() const;
/**
- * Sets the parent id to be queried. This will cause returning only entries whose aprent ids are aId.
+ * Sets the parent id to be queried. This will cause returning only entries whose parent ids are aId.
* @param aId The parent id to be set for the query.
*/
IMPORT_C void SetParentId( TInt aId );
/**
+ * Returns the child id set for the query.
+ * @return Id of entry's child.
+ */
+ IMPORT_C TInt GetChildId() const;
+
+ /**
+ * Sets the child id to be queried. This will cause returning parents of the entry with id aId
+ * @param aId The child id to be set for the query.
+ */
+ IMPORT_C void SetChildId( TInt aId );
+
+
+ /**
* Gets the typenames filter set in the query.
* @return Array of typenames set in this query.
*/
@@ -231,6 +244,11 @@
TInt iParentId;
/*
+ * Unique identifier of the child entry.
+ */
+ TInt iChildId;
+
+ /*
* Own.
*/
CDesC16ArrayFlat* iEntryTypeNames;
--- a/contentstorage/cautils/src/cainnerquery.cpp Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/cautils/src/cainnerquery.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -63,6 +63,7 @@
EXPORT_C void CCaInnerQuery::ExternalizeL( RWriteStream& aStream ) const
{
aStream.WriteInt32L( iParentId );
+ aStream.WriteInt32L( iChildId );
aStream.WriteInt32L( iRole );
aStream.WriteUint32L( iFlagsOn );
aStream.WriteUint32L( iFlagsOff );
@@ -93,6 +94,7 @@
EXPORT_C void CCaInnerQuery::InternalizeL( RReadStream& aStream )
{
iParentId = aStream.ReadInt32L();
+ iChildId = aStream.ReadInt32L();
iRole = aStream.ReadInt32L();
iFlagsOn = aStream.ReadUint32L();
iFlagsOff = aStream.ReadUint32L();
@@ -128,6 +130,7 @@
{
iEntryTypeNames = new ( ELeave ) CDesC16ArrayFlat( KDefaultGranularity );
iParentId = -1;
+ iChildId = -1;
iRole = Item | Group;
}
@@ -182,6 +185,25 @@
//
// ---------------------------------------------------------------------------
//
+EXPORT_C TInt CCaInnerQuery::GetChildId() const
+ {
+ return iChildId;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCaInnerQuery::SetChildId( TInt aId )
+ {
+ iChildId = aId;
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
EXPORT_C const CDesC16ArrayFlat* CCaInnerQuery::GetEntryTypeNames() const
{
return iEntryTypeNames;
--- a/contentstorage/eabi/cautilsu.def Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/eabi/cautilsu.def Thu Jun 24 16:18:29 2010 +0300
@@ -99,4 +99,6 @@
_ZNK22CCaInnerNotifierFilter12GetTypeNamesEv @ 98 NONAME
_ZNK22CCaInnerNotifierFilter15GetNotifierTypeEv @ 99 NONAME
_ZNK22CCaInnerNotifierFilter6GetIdsEv @ 100 NONAME
+ _ZN13CCaInnerQuery10SetChildIdEi @ 101 NONAME
+ _ZNK13CCaInnerQuery10GetChildIdEv @ 102 NONAME
--- a/contentstorage/group/camenu.mmp Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/group/camenu.mmp Thu Jun 24 16:18:29 2010 +0300
@@ -12,7 +12,7 @@
* Contributors:
*
* Description:
-* Version : %version: 19.1.8 % << Don't touch! Updated by Synergy at check-out.
+* Version : %version: 19.1.9 % << Don't touch! Updated by Synergy at check-out.
*
*/
@@ -49,7 +49,7 @@
USERINCLUDE ../casrv/casrvmgr/inc
-APP_LAYER_SYSTEMINCLUDE
+MW_LAYER_SYSTEMINCLUDE
LIBRARY euser.lib
LIBRARY efsrv.lib
--- a/contentstorage/group/camenusrv.mmp Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/group/camenusrv.mmp Thu Jun 24 16:18:29 2010 +0300
@@ -24,7 +24,7 @@
TARGET camenuserver.exe
TARGETTYPE exe
UID 0x1000008c CA_SRV_UID3
-CAPABILITY AllFiles ProtServ ReadDeviceData ReadUserData
+CAPABILITY CAP_SERVER AllFiles
VENDORID VID_DEFAULT
EPOCSTACKSIZE 0x5000
--- a/contentstorage/srvinc/caprogressnotifier.h Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/srvinc/caprogressnotifier.h Thu Jun 24 16:18:29 2010 +0300
@@ -20,100 +20,13 @@
#include <e32base.h>
#include <usif/sif/sifnotification.h>
+#include <usif/usifcommon.h>
+
#include "castorage_global.h"
using namespace Usif;
class CCaStorageProxy;
-
-// needed for fake notifier
-#include "cainstallnotifier.h"
-
-/**
- * Interface for updating after installer events.
- */
-class MCaFakeProgressListener
- {
-public:
- /**
- * Pure virtual method.
- * @param aEvent event type.
- */
- virtual void HandleFakeProgressNotifyL(TInt aCurrentProgress) = 0;
- };
-
-/**
- * Fake Install notifier.
- *
- * @since S60 v5.0
- */
-NONSHARABLE_CLASS( CCaFakeProgressNotifier ) : public CActive
- {
-public:
-
-/**
- * Creates an instance of CCaFakeProgressNotifier.
- * @param aListener Reference to notifier interface.
- */
-IMPORT_C static CCaFakeProgressNotifier* NewL( MCaFakeProgressListener& aListener);
-
- /**
- * Destructor.
- */
- virtual ~CCaFakeProgressNotifier();
-
- /**
- * Starts fake progress notifications.
- */
- void StartNotifying();
-
-private:
-
- /**
- * Constructor.
- * @param aListener Reference to notifier interface.
- */
- CCaFakeProgressNotifier( MCaFakeProgressListener& aListener );
-
- /**
- * Symbian 2nd phase constructor.
- */
- void ConstructL( );
-
- /**
- * From CActive.
- */
- void DoCancel();
-
- /**
- * From CActive.
- */
- void RunL();
-
- /**
- * From CActive.
- */
- TInt RunError( TInt aError );
-
-private:
-
- /**
- * Interface for fake notifications
- * Not Own.
- */
- MCaFakeProgressListener& iListener;
-
- /**
- * Timer
- */
- RTimer iTimer;
-
- /**
- * Counter for fake notifications
- */
- TInt iCount;
-
- };
-
+class CCaInnerEntry;
/**
* Uninstall Progress notifier.
@@ -121,9 +34,7 @@
* @since S60 v5.0
*/
NONSHARABLE_CLASS( CCaProgressNotifier ) : public CBase,
- //public MSifOperationsHandler, // USIF not working yet
- public MCaInstallListener, //needed for fake
- public MCaFakeProgressListener //needed for fake
+ public MSifOperationsHandler
{
public:
@@ -143,13 +54,18 @@
/**
* Constructor.
*/
- CCaProgressNotifier( );
+ CCaProgressNotifier( CCaStorageProxy& aCaStorageProxy );
/**
* Symbian 2nd phase constructor.
* @param aCaStorageProxy Reference to storage.
*/
- void ConstructL( CCaStorageProxy& aCaStorageProxy );
+ void ConstructL( );
+
+ void UpdateProgressL( const CSifOperationProgressData& aProgressData );
+ void EndOperationL(TInt aError);
+ TComponentId ComponentIdL(const TDesC& aGlobalComponentId, const TDesC& aSwType);
+ void MarkEntrysForUnistallL(TUint aKey, TComponentId aComponentId);
public:
/**
@@ -167,18 +83,6 @@
*/
void ProgressOperationHandler(const CSifOperationProgressData& aProgressData);
-public:
-
- /**
- * From MCaInstallListener, needed for fake
- */
- void HandleInstallNotifyL( TInt aUid );
-
- /**
- * From MCaFakeProgressListener, needed for fake
- */
- void HandleFakeProgressNotifyL(TInt aCurrentProgress);
-
private:
/**
@@ -188,28 +92,17 @@
* Commented out since USIF notifications do not
* work on MCL wk20
*/
- //CSifOperationsNotifier* iNotifier;
+ CSifOperationsNotifier* iNotifier;
/**
* Not Own.
* Reference to the Storage Proxy.
*/
- CCaStorageProxy* iStorageProxy;
-
- /**
- * Uninstall notifier. Own. Needed for fake
- */
- CCaInstallNotifier *iUsifUninstallNotifier;
-
- /**
- * Install and uninstall notifier. Own. Needed for fake
- */
- CCaInstallNotifier *iJavaInstallNotifier;
+ CCaStorageProxy& iStorageProxy;
- /**
- * Fake uninstall progress notifier. Own. Needed for fake
- */
- CCaFakeProgressNotifier *iFakeProgressNotifier;
+ RPointerArray<CCaInnerEntry> iResultArrayItems;
+
+ TUint iKey;
};
--- a/contentstorage/srvsrc/cainstallstrategy.cpp Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/srvsrc/cainstallstrategy.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -16,9 +16,10 @@
*/
#include <e32property.h>
#include <SWInstallerInternalPSKeys.h>
-#include <javadomainpskeys.h>
+#include <app/javadomainpskeys.h>
+#include <swi/swispubsubdefs.h>
+
#include "cainstallstrategy.h"
-#include <swi/swispubsubdefs.h>
// ---------------------------------------------------------------------------
//
--- a/contentstorage/srvsrc/caprogressnotifier.cpp Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/srvsrc/caprogressnotifier.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -15,9 +15,8 @@
*
*/
-#include "s32mem.h"
+#include <s32mem.h>
-#include <usif/usifcommon.h>
#include <usif/scr/scr.h>
#include <usif/scr/screntries.h>
@@ -29,83 +28,6 @@
using namespace Usif;
-//fake constants
-const TInt KMaxProgressValue = 100;
-const TInt KDelayTimeBetweenNotifications(500000);
-
-
-#ifdef COVERAGE_MEASUREMENT
-#pragma CTC SKIP
-#endif //COVERAGE_MEASUREMENT (fake notifier timer)
-
-EXPORT_C CCaFakeProgressNotifier* CCaFakeProgressNotifier::NewL(
- MCaFakeProgressListener& aListener )
- {
- CCaFakeProgressNotifier* self = new ( ELeave ) CCaFakeProgressNotifier( aListener );
- CleanupStack::PushL( self );
- self->ConstructL( );
- CleanupStack::Pop( self );
- return self;
- }
-
-CCaFakeProgressNotifier::~CCaFakeProgressNotifier()
- {
- Cancel();
- iTimer.Close();
- }
-
-CCaFakeProgressNotifier::CCaFakeProgressNotifier( MCaFakeProgressListener& aListener ) :
- CActive( EPriorityNormal ), iListener( aListener ), iCount( 0 )
- {
- CActiveScheduler::Add( this );
- }
-
-void CCaFakeProgressNotifier::ConstructL( )
- {
- User::LeaveIfError( iTimer.CreateLocal() );
- }
-
-void CCaFakeProgressNotifier::StartNotifying()
- {
- iCount = 0;
- Cancel();
- iTimer.After( iStatus, TTimeIntervalMicroSeconds32( KDelayTimeBetweenNotifications ) );
- SetActive();
- }
-
-void CCaFakeProgressNotifier::DoCancel()
- {
- iTimer.Cancel();
- }
-
-void CCaFakeProgressNotifier::RunL()
- {
- User::LeaveIfError( iStatus.Int() );
-
- if ( iCount <= KMaxProgressValue )
- {
- if( iCount > 20 )
- {
- iListener.HandleFakeProgressNotifyL(iCount);
- }
- iTimer.After( iStatus, TTimeIntervalMicroSeconds32( KDelayTimeBetweenNotifications ) );
- SetActive();
- iCount += 20;
- }
- }
-
-TInt CCaFakeProgressNotifier::RunError( TInt /*aError*/)
- {
- // No need to do anything
- return KErrNone;
- }
-
-#ifdef COVERAGE_MEASUREMENT
-#pragma CTC ENDSKIP
-#endif //COVERAGE_MEASUREMENT (fake notifier)
-
-
-
// ---------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------
@@ -113,9 +35,10 @@
EXPORT_C CCaProgressNotifier* CCaProgressNotifier::NewL(
CCaStorageProxy& aCaStorageProxy )
{
- CCaProgressNotifier* self = new ( ELeave ) CCaProgressNotifier( );
+ CCaProgressNotifier* self = new ( ELeave ) CCaProgressNotifier(
+ aCaStorageProxy );
CleanupStack::PushL( self );
- self->ConstructL( aCaStorageProxy );
+ self->ConstructL();
CleanupStack::Pop( self );
return self;
}
@@ -126,68 +49,16 @@
//
CCaProgressNotifier::~CCaProgressNotifier()
{
- // TODO: Commented out since USIF notifications do not
- // work on MCL wk20
- /*
- iNotifier->CancelSubscribeL();
delete iNotifier;
- */
-
- // needed for fake:
- delete iUsifUninstallNotifier;
- delete iJavaInstallNotifier;
- delete iFakeProgressNotifier;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CCaProgressNotifier::CCaProgressNotifier()
- {
+ iResultArrayItems.ResetAndDestroy();
}
// ---------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------
//
-void CCaProgressNotifier::ConstructL( CCaStorageProxy& aCaStorageProxy )
- {
- // TODO: Commented out since USIF notifications do not
- // work on MCL wk20
- /*
- iNotifier = CSifOperationsNotifier::NewL(*this);
- */
-
- iStorageProxy = &aCaStorageProxy;
-
- iUsifUninstallNotifier = CCaInstallNotifier::NewL( *this,
- CCaInstallNotifier::EUsifUninstallNotification );
-
- iJavaInstallNotifier = CCaInstallNotifier::NewL( *this,
- CCaInstallNotifier::EJavaInstallNotification );
-
- iFakeProgressNotifier = CCaFakeProgressNotifier::NewL(*this);
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CCaProgressNotifier::StartOperationHandler(TUint /*aKey*/, const CSifOperationStartData& /*aStartData*/)
- {
- // TODO: Commented out since USIF notifications do not
- // work on MCL wk20
- /*
- iNotifier->SubscribeL( aKey, ETrue );
- */
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CCaProgressNotifier::EndOperationHandler(const CSifOperationEndData& /*aEndData*/)
+CCaProgressNotifier::CCaProgressNotifier( CCaStorageProxy& aCaStorageProxy ) :
+ iStorageProxy( aCaStorageProxy )
{
}
@@ -195,96 +66,143 @@
//
// ---------------------------------------------------------------------------
//
-void CCaProgressNotifier::ProgressOperationHandler(const CSifOperationProgressData& /*aProgressData*/)
+void CCaProgressNotifier::ConstructL()
+ {
+ iNotifier = CSifOperationsNotifier::NewL( *this );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CCaProgressNotifier::StartOperationHandler( TUint aKey,
+ const CSifOperationStartData& aStartData )
{
-
- // TODO: Commented out since USIF notifications do not
- // work on MCL wk20
-
- /*
- // extract component ID
- TBuf8<20> globalIdBuf;
- globalIdBuf.Copy( aProgressData.GlobalComponentId() );
-
- RDesReadStream readStream( globalIdBuf );
- CleanupClosePushL( readStream );
- CGlobalComponentId *globalId = CGlobalComponentId::NewL( readStream );
- CleanupStack::PushL(globalId);
-
- RSoftwareComponentRegistry iScrSession;
- TComponentId componentId = iScrSession.GetComponentIdL( globalId->GlobalIdName(),
- globalId->SoftwareTypeName() );
+ TInt err( KErrNone );
+ TComponentId componentId;
+ iResultArrayItems.ResetAndDestroy();
+
+ TRAP(err, componentId = ComponentIdL( aStartData.GlobalComponentId(),
+ aStartData.SoftwareType() ));
+ if ( !err )
+ TRAP(err, MarkEntrysForUnistallL(aKey, componentId));
+
+ }
- CleanupStack::PopAndDestroy( globalId );
- CleanupStack::PopAndDestroy( &readStream );
-
- RBuf componentIdBuf;
- componentIdBuf.CleanupClosePushL();
- componentIdBuf.CreateL( sizeof(TComponentId) + 1 );
- componentIdBuf.AppendNum( componentId );
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CCaProgressNotifier::EndOperationHandler(
+ const CSifOperationEndData& aEndData )
+ {
+ TInt err = KErrNone;
+ TRAP(err, EndOperationL(aEndData.ErrorCode()));
+ iResultArrayItems.ResetAndDestroy();
+ }
- // find entry by componentID
- CCaInnerQuery *innerQuery = CCaInnerQuery::NewLC();
- innerQuery->SetRole( CCaInnerQuery::Item );
- innerQuery->AddAttributeL( KCaAttrComponentId,
- componentIdBuf );
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CCaProgressNotifier::ProgressOperationHandler(
+ const CSifOperationProgressData& aProgressData )
+ {
+ TInt err = KErrNone;
+ TRAP(err, UpdateProgressL(aProgressData));
+ }
- RPointerArray<CCaInnerEntry> resultArrayItems;
- CleanupResetAndDestroyPushL( resultArrayItems );
- iStorageProxy->GetEntriesL( innerQuery, resultArrayItems );
-
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CCaProgressNotifier::UpdateProgressL(
+ const CSifOperationProgressData& aProgressData )
+ {
RBuf totalProgressBuf;
totalProgressBuf.CleanupClosePushL();
totalProgressBuf.CreateL( sizeof(TComponentId) + 1 );
totalProgressBuf.AppendNum( aProgressData.CurrentProgess() );
- if (resultArrayItems.Count() && aProgressData.Phase() == EUninstalling)
+ if ( iResultArrayItems.Count() && aProgressData.Phase() == EUninstalling )
{
- CCaInnerEntry* appEntry = resultArrayItems[0];
- appEntry->AddAttributeL(KCaAppUninstallProgress, totalProgressBuf);
+ for ( int i = 0; i < iResultArrayItems.Count(); i++ )
+ {
+ iResultArrayItems[i]->AddAttributeL( KCaAppUninstallProgress,
+ totalProgressBuf );
+ iStorageProxy.AddL( iResultArrayItems[i], ETrue,
+ EItemUninstallProgressChanged );
+ }
+ }
- iStorageProxy->AddL(appEntry, ETrue, EItemUninstallProgressChanged );
- }
CleanupStack::PopAndDestroy( &totalProgressBuf );
- CleanupStack::PopAndDestroy( &resultArrayItems );
- CleanupStack::PopAndDestroy( innerQuery );
- CleanupStack::PopAndDestroy( &componentIdBuf );
- */
}
-void CCaProgressNotifier::HandleInstallNotifyL( TInt /*aUid*/)
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CCaProgressNotifier::EndOperationL( TInt aError )
{
- // start sending fake notifications
- iFakeProgressNotifier->StartNotifying();
+ if ( aError )
+ {
+ for ( int i = 0; i < iResultArrayItems.Count(); i++ )
+ {
+ iResultArrayItems[i]->SetFlags( iResultArrayItems[i]->GetFlags()
+ & ~EUninstall );
+ iStorageProxy.AddL( iResultArrayItems[i] );
+ }
+ }
+ iNotifier->CancelSubscribeL( iKey );
}
-void CCaProgressNotifier::HandleFakeProgressNotifyL(TInt aCurrentProgress)
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TComponentId CCaProgressNotifier::ComponentIdL(
+ const TDesC& aGlobalComponentId, const TDesC& aSwType )
{
- //update storage with new info
-
+ RSoftwareComponentRegistry registry;
+ User::LeaveIfError( registry.Connect() );
+ CleanupClosePushL( registry );
+ TComponentId componentId = registry.GetComponentIdL( aGlobalComponentId,
+ aSwType );
+ CleanupStack::PopAndDestroy( ®istry ); // registry
+ return componentId;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CCaProgressNotifier::MarkEntrysForUnistallL( TUint aKey,
+ TComponentId aComponentId )
+ {
+ RBuf componentIdBuf;
+ componentIdBuf.CleanupClosePushL();
+ componentIdBuf.CreateL( sizeof(TComponentId) + 1 );
+ componentIdBuf.AppendNum( aComponentId );
+
// find entry by componentID
CCaInnerQuery *innerQuery = CCaInnerQuery::NewLC();
innerQuery->SetRole( CCaInnerQuery::Item );
- innerQuery->SetFlagsOn(EUninstall);
-
- RPointerArray<CCaInnerEntry> resultArrayItems;
- CleanupResetAndDestroyPushL( resultArrayItems );
- iStorageProxy->GetEntriesL( innerQuery, resultArrayItems );
-
-
- RBuf totalProgressBuf;
- totalProgressBuf.CleanupClosePushL();
- totalProgressBuf.CreateL( sizeof( TInt ) + 1 );
- totalProgressBuf.AppendNum( aCurrentProgress );
-
- for ( TInt i = 0; i<resultArrayItems.Count(); i++ )
- {
- CCaInnerEntry* appEntry = resultArrayItems[i];
- appEntry->AddAttributeL(KCaAppUninstallProgress, totalProgressBuf);
- iStorageProxy->AddL(appEntry, ETrue, EItemUninstallProgressChanged );
- }
-
- CleanupStack::PopAndDestroy( &totalProgressBuf );
- CleanupStack::PopAndDestroy( &resultArrayItems );
+ innerQuery->AddAttributeL( KCaAttrComponentId, componentIdBuf );
+
+ iStorageProxy.GetEntriesL( innerQuery, iResultArrayItems );
+
+ if ( iResultArrayItems.Count() )
+ {
+ for ( int i = 0; i < iResultArrayItems.Count(); i++ )
+ {
+ iResultArrayItems[i]->SetFlags( iResultArrayItems[i]->GetFlags()
+ | EUninstall );
+ iStorageProxy.AddL( iResultArrayItems[i] );
+ }
+ // subscribe for progress notifier
+ iKey = aKey;
+ iNotifier->SubscribeL( aKey, ETrue );
+ }
CleanupStack::PopAndDestroy( innerQuery );
+ CleanupStack::PopAndDestroy( &componentIdBuf );
}
--- a/contentstorage/srvsrc/castorageproxy.cpp Fri Jun 11 16:13:51 2010 +0300
+++ b/contentstorage/srvsrc/castorageproxy.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -287,6 +287,8 @@
iStorage->GetParentsIdsL( id, parentArray );
for( TInt i = 0; i < iHandlerNotifier.Count(); i++ )
{
+ resultArray[0]->SetFlags(
+ resultArray[0]->GetFlags() | EUsed );
iHandlerNotifier[i]->EntryChanged( resultArray[0],
EUpdateChangeType,
parentArray );
@@ -444,15 +446,14 @@
result->SetAttributeNameL( KLocalizationEnText );
result->SetQmFilenameL( qmFile );
result->SetRowId( aEntry->GetId() ? 0 : aEntry->GetId() ); // must be added when present
+ CleanupStack::Pop( result );
}
else
{
- if (translatedString)
- {
- CleanupStack::PopAndDestroy(translatedString);
- }
+ CleanupStack::PopAndDestroy(translatedString);
+ CleanupStack::PopAndDestroy(result);
+ result = NULL;
}
- CleanupStack::Pop( result );
}
}
CleanupStack::PopAndDestroy( &title );
@@ -493,16 +494,20 @@
result->SetAttributeNameL( KLocalizationEnDescription );
result->SetQmFilenameL( qmFile );
result->SetRowId( aEntry->GetId() ? 0 : aEntry->GetId() ); // must be added when present
+ CleanupStack::Pop( result );
}
else
{
CleanupStack::PopAndDestroy( translatedString );
+ CleanupStack::PopAndDestroy( result );
+ result = NULL;
}
- CleanupStack::Pop( result );
+
}
}
CleanupStack::PopAndDestroy( &description );
}
+
return result;
}
--- a/homescreensrv.pro Fri Jun 11 16:13:51 2010 +0300
+++ b/homescreensrv.pro Thu Jun 24 16:18:29 2010 +0300
@@ -23,7 +23,7 @@
symbian:SUBDIRS += activityfw
symbian:SUBDIRS += tstaskmonitor
symbian:SUBDIRS += hsappkeyhandler
-
+symbian:SUBDIRS += tsdevicedialog
CONFIG += ordered
--- a/homescreensrv_plat/contentstorage_api/caquery.h Fri Jun 11 16:13:51 2010 +0300
+++ b/homescreensrv_plat/contentstorage_api/caquery.h Thu Jun 24 16:18:29 2010 +0300
@@ -40,6 +40,9 @@
void setParentId(int id);
int parentId() const;
+ void setChildId(int id);
+ int childId() const;
+
void setEntryTypeNames(const QStringList &entryTypeNames);
QStringList entryTypeNames() const;
--- a/homescreensrv_plat/contentstorage_api/caservice.h Fri Jun 11 16:13:51 2010 +0300
+++ b/homescreensrv_plat/contentstorage_api/caservice.h Thu Jun 24 16:18:29 2010 +0300
@@ -92,9 +92,9 @@
bool prependEntriesToGroup(const CaEntry &group,
const QList< QSharedPointer<CaEntry> > &entryList) const;
- bool executeCommand(int entryId, const QString &command =
+ int executeCommand(int entryId, const QString &command =
caCmdOpen) const;
- bool executeCommand(const CaEntry &entry, const QString &command =
+ int executeCommand(const CaEntry &entry, const QString &command =
caCmdOpen) const;
CaNotifier * createNotifier(const CaNotifierFilter &filter) const;
--- a/homescreensrv_plat/homescreen_information_api/inc/homescreendomainpskeys.h Fri Jun 11 16:13:51 2010 +0300
+++ b/homescreensrv_plat/homescreen_information_api/inc/homescreendomainpskeys.h Thu Jun 24 16:18:29 2010 +0300
@@ -37,7 +37,7 @@
*/
const char HsStatePSKeySubPath[] = "state";
-#ifdef Q_OS_SYMBIAN
+#if defined(__SYMBIAN32__) || defined(SYMBIAN)
/*!
Home Screen P&S category Uid for pure Symbian usage.
*/
@@ -49,7 +49,7 @@
are defined by the enum EPSHsState.
*/
const TUint KHsCategoryStateKey = 0x1;
-#endif //Q_OS_SYMBIAN
+#endif //SYMBIAN
/*!
Home screen state.
--- a/homescreensrv_plat/homescreensrv_plat.pro Fri Jun 11 16:13:51 2010 +0300
+++ b/homescreensrv_plat/homescreensrv_plat.pro Thu Jun 24 16:18:29 2010 +0300
@@ -21,6 +21,7 @@
include(hswidgetmodel_api/hswidgetmodel_api.pri)
include(menu_sat_interface_api/menu_sat_interface_api.pri)
include(homescreen_information_api/homescreen_information_api.pri)
+include(taskswitcher_api/taskswitcher_api.pri)
for(filename,PLATFORM_HEADERS){
BLD_INF_RULES.prj_exports *= "$$filename MW_LAYER_PLATFORM_EXPORT_PATH($$basename(filename))"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/homescreensrv_plat/taskswitcher_api/taskswitcher_api.pri Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,18 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+PLATFORM_HEADERS += taskswitcher_api/tstasksettings.h \
+ taskswitcher_api/tspropertydefs.h \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/homescreensrv_plat/taskswitcher_api/tspropertydefs.h Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef TSPROPERTYDEFS_H
+#define TSPROPERTYDEFS_H
+
+namespace TsProperty {
+
+#if defined(Q_OS_SYMBIAN)
+ const TUid KCategory = {0x20022fc5};
+ const TUint KVisibilityKey = 0x2002677F;
+#endif
+ const char KTsPath[] = "/TaskSwitcher";
+ const char KVisibilityPath[] = "Visibility";
+
+}
+
+#endif // TSPROPERTYDEFS_H
+
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/homescreensrv_plat/taskswitcher_api/tstasksettings.h Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef TSTASKSETTINGS_H
+#define TSTASKSETTINGS_H
+
+#include <QPixmap>
+
+#include "tstaskmonitor_global.h"
+
+class TsTaskSettingsPrivate;
+
+class TSTASKMONITOR_EXPORT TsTaskSettings
+{
+
+public:
+ TsTaskSettings();
+ ~TsTaskSettings();
+
+ bool registerScreenshot(const QPixmap &screenshot);
+ bool unregisterScreenshot();
+ bool setVisibility(bool);
+
+private:
+ TsTaskSettingsPrivate *d_ptr;
+};
+
+#endif //TSTASKSETTINGS_H
--- a/hsappkeyhandler/group/hsappkeyplugin.mmp Fri Jun 11 16:13:51 2010 +0300
+++ b/hsappkeyhandler/group/hsappkeyplugin.mmp Thu Jun 24 16:18:29 2010 +0300
@@ -34,7 +34,7 @@
USERINCLUDE ../inc
-APP_LAYER_SYSTEMINCLUDE
+MW_LAYER_SYSTEMINCLUDE
LIBRARY ecom.lib
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/common.pri Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,77 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: taskswitcherapp project - common QMake settings
+#
+
+CONFIG += debug_and_release
+
+# On win32 and mac, debug and release libraries are named differently.
+# We must follow the debug and release settings Qt was compiled with:
+# build debug iff Qt built debug, build release iff Qt built release.
+win32|mac {
+ !contains(QT_CONFIG,debug)|!contains(QT_CONFIG,release) {
+ CONFIG -= debug_and_release debug release
+ contains(QT_CONFIG,debug): CONFIG+=debug
+ contains(QT_CONFIG,release):CONFIG+=release
+ }
+}
+
+CONFIG(debug, debug|release) {
+ SUBDIRPART = debug
+} else {
+ SUBDIRPART = release
+}
+
+win32: OUTPUT_DIR = $$PWD/../../bin/$$SUBDIRPART
+symbian: OUTPUT_DIR = $$PWD/bin
+
+#test whether we have a unit test
+!testcase {
+ OBJECTS_DIR = $$OUTPUT_DIR/tmp/$$TARGET
+ DESTDIR = $$OUTPUT_DIR
+ MOC_DIR = $$OUTPUT_DIR/tmp/$$TARGET/moc
+ RCC_DIR = $$OUTPUT_DIR/tmp/$$TARGET/rcc
+ UI_DIR = $$OUTPUT_DIR/tmp/$$TARGET/ui
+} else { # test part is NOT DONE
+ QT *= testlib
+ CONFIG += console
+ CONFIG -= app_bundle
+ OBJECTS_DIR = $$OUTPUT_DIR/tests/tmp/$$TARGET
+ DESTDIR = $$OUTPUT_DIR
+ MOC_DIR = $$OUTPUT_DIR/tests/tmp/$$TARGET/moc
+ RCC_DIR = $$OUTPUT_DIR/tests/tmp/$$TARGET/rcc
+ UI_DIR = $$OUTPUT_DIR/tests/tmp/$$TARGET/ui
+ coverage {
+ DEFINES += COVERAGE_MEASUREMENT
+ DEFINES += QT_NO_DEBUG # omit ASSERTS in coverage measurements
+ }
+}
+
+# Add the output dirs to the link path too
+LIBS += -L$$DESTDIR
+
+#For some reason the default include path doesn't include MOC_DIR on symbian
+symbian {
+ INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+ INCLUDEPATH += $$MOC_DIR
+ TARGET.CAPABILITY = ALL -TCB
+ TARGET.EPOCALLOWDLLDATA=1
+}
+
+win32 {
+ # add platfrom API for windows
+ INCLUDEPATH += \
+ $$PWD/../../homescreensrv/homescreensrv_plat/contentstorage_api \
+ $$PWD/../../homescreensrv/homescreensrv_plat/hswidgetmodel_api \
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/rom.pri Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,21 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include <platform_paths.hrh>"
+BLD_INF_RULES.prj_exports += "rom/tsapplication_core.iby CORE_APP_LAYER_IBY_EXPORT_PATH(tsapplication_core.iby)"
+BLD_INF_RULES.prj_exports += "rom/tsapplication_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(tsapplication_resources.iby)"
+BLD_INF_RULES.prj_exports += "./sis/stubs/taskswitcher_stub.sis /epoc32/release/winscw/udeb/z/system/install/taskswitcher_stub.sis"
+BLD_INF_RULES.prj_exports += "./sis/stubs/taskswitcher_stub.sis /epoc32/data/z/system/install/taskswitcher_stub.sis"
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/rom/tsapplication_core.iby Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef __TSAPP_CORE_IBY__
+#define __TSAPP_CORE_IBY__
+
+file=ABI_DIR\BUILD_DIR\tsdevicedialogplugin.dll SHARED_LIB_DIR\tsdevicedialogplugin.dll
+data=\epoc32\data\z\resource\plugins\devicedialogs\tsdevicedialogplugin.qtplugin resource\plugins\devicedialogs\tsdevicedialogplugin.qtplugin
+
+// stub sis
+data=ZSYSTEM/install/taskswitcher_stub.sis system/install/taskswitcher_stub.sis
+
+// qcrml
+data=\epoc32\data\z\resource\qt\crml\tsdevicedialog.qcrml resource\qt\crml\tsdevicedialog.qcrml
+
+#endif //__TSAPP_CORE_IBY__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/rom/tsapplication_resources.iby Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef __TSAPP_LANGUAGE_IBY__
+#define __TSAPP_LANGUAGE_IBY__
+
+// -------- hsapplication
+data=DATAZ_\resource\qt\translations\taskswitcher.qm resource\qt\translations\taskswitcher.qm
+
+#endif //__TSAPP_LANGUAGE_IBY__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/sis/buildSis.cmd Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,39 @@
+@rem
+@rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+@rem All rights reserved.
+@rem This component and the accompanying materials are made available
+@rem under the terms of "Eclipse Public License v1.0"
+@rem which accompanies this distribution, and is available
+@rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+@rem
+@rem Initial Contributors:
+@rem Nokia Corporation - initial contribution.
+@rem
+@rem Contributors:
+@rem
+@rem Description:
+@rem
+@echo off
+setlocal EnableDelayedExpansion
+set openpar=(
+set closepar=)
+
+if exist *.sis* ( del *.sis* )
+if exist tmp.pkg ( del tmp.pkg )
+
+copy /Y taskswitcher.pkg tmp.pkg > NUL
+
+echo Creating sis for each component:
+for /R .. %%i IN (*_template.pkg) DO set tmpname=%%~ni && set modulename=!tmpname:~0,-10!&& call createpackage %%i release-armv5 cert.cer key.pem > NUL && set sisname=%%~dpi!modulename!_release-armv5.sis && if exist !sisname! ( echo [SUCCEEDED] !modulename! [SUCCEEDED] && move !sisname! . && FOR /F "eol=( tokens=4 delims=({}" %%j IN (%%i) DO FOR /F "tokens=1 delims=)" %%k IN ("%%j") DO echo @"!modulename!_release-armv5.sis",!openpar!%%k!closepar! >> tmp.pkg ) else ( echo [FAILED] !modulename! [FAILED] )
+
+REM echo.
+
+echo Embedding all sis files into single sis
+makesis tmp.pkg taskswitcher.sis >NUL
+signsis taskswitcher.sis taskswitcher.sisx cert.cer key.pem >NUL
+
+echo Cleaning up
+del tmp.pkg
+del taskswitcher.sis
+del *_release-armv5.sis*
+pause
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/sis/edit_pkg.pl Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,225 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+#Options:
+# -version -adds Qt version (4,6,0) intp pkg files
+# -target -replaces $(PLATFORM)/$(TARGET) into armv5/urel
+# -module -creates script for module tests sis
+# -module -delete module tests pkg
+# default -version
+
+use strict;
+use File::Find;
+my $base = `cd`;
+$base =~ s/\\\w+\s+$//; #move one dir upper
+my $modulebase = `cd`;
+$modulebase =~s/(\s+)$//; #remove linefeed from end
+print $base;;
+my $qtversion = "\, 4\, 6\, 0\,";
+my $target = "armv5\/urel";
+
+my $qtversionchnage = 0;
+my $qtversionarg = "-version";
+my $targetchnage = 0;
+my $targetarg = "-target";
+my $module = 0;
+my $modulearg = "-module";
+my $delmodule = 0;
+my $delmodulearg = "-delmodule";
+my $moduledir = "modulesis";
+my $modulepath = $base."\\".$moduledir;
+my $ccert = $modulebase."\\"."cert.cer";
+my $ckey = $modulebase."\\"."key.pem";
+my $modulebatpath = $modulebase."\\".$moduledir."\\createmodulesis.bat";
+
+checkCmdLine();
+
+if ( $qtversionchnage == 1 || $targetchnage == 1 )
+ {
+ find( \&edits, $base );
+ }
+if ( $module == 1 )
+ {
+ system "mkdir $moduledir";
+ if ( not ( open (FWM, ">$modulebatpath") ) )
+ {
+ print "\n***Error: Couldn't open $modulebatpath file to write\n";
+ return;
+ }
+ binmode FWM;
+ print FWM "del /S/Q *.SIS\r\n";
+ print FWM "del /S/Q *.SISX\r\n";
+ close FWM;
+ find( \&moduleSis, $base );
+ }
+if ( $delmodule == 1 )
+ {
+ find( \&delModuleSis, $base );
+ }
+
+sub edits()
+ {
+ my $file=$_;
+ my $winpath=$File::Find::name;
+ $winpath=~s/\//\\/g;
+ if( -f $file && $file=~/(_template\.pkg)$/i )
+ {
+ print "$winpath ";
+ system "attrib -R $winpath";
+ if ( not ( open (FR, $winpath) ) )
+ {
+ print "Error: Couldn't open $winpath file to read\n";
+ return;
+ }
+ binmode FR;
+ my $buf="";
+ my $length = 0;
+ $length = -s $winpath;
+ read( FR, $buf, $length );
+ close FR;
+ if ( $qtversionchnage == 1 )
+ {
+ $buf =~s/\,\s*\,\s*\,\s*\,\s*\{\"Qt\"\}/$qtversion \{\"Qt\"\}/si;
+ }
+ if ( $targetchnage == 1 )
+ {
+ $buf =~s/\$\(PLATFORM\)\/\$\(TARGET\)/$target/si;
+ }
+
+ if ( not ( open (FW, ">$winpath") ) )
+ {
+ print "\n***Error: Couldn't open $winpath file to write\n";
+ return;
+ }
+ binmode FW;
+ print FW $buf;
+ close FW;
+
+ print "\r\n";
+ }
+ }
+
+sub checkCmdLine()
+ {
+ my $numArgs = $#ARGV + 1;
+ if ( $numArgs == 0 )
+ {
+ $qtversionchnage = 1;
+ }
+ else
+ {
+ foreach my $argnum ( 0 .. $#ARGV )
+ {
+ my $argName = lc $ARGV[$argnum];
+ if ( $argName eq $qtversionarg )
+ {
+ $qtversionchnage = 1;
+ }
+ elsif ( $argName eq $targetarg )
+ {
+ $targetchnage = 1;
+ }
+ elsif ( $argName eq $modulearg )
+ {
+ $module = 1;
+ }
+ elsif ( $argName eq $delmodulearg )
+ {
+ $delmodule = 1;
+ }
+ else
+ {
+ die "\n***Error: Bad arguments\n";
+ }
+ }
+ }
+ }
+
+sub moduleSis()
+ {
+ my $file=$_;
+ my $winpath=$File::Find::name;
+ $winpath=~s/\//\\/g;
+
+
+ if( -f $file && $file=~/(_template\.pkg)$/i && ( $file=~/^(t_)/i || $file=~/test/i ) )
+ {
+ print "$winpath ";
+ system "attrib -R $winpath";
+ if ( not ( open (FR, $winpath) ) )
+ {
+ print "Error: Couldn't open $winpath file to read\n";
+ return;
+ }
+ binmode FR;
+ my $buf="";
+ my $length = 0;
+ $length = -s $winpath;
+ read( FR, $buf, $length );
+ close FR;
+ $buf =~s/\,\s*\,\s*\,\s*\,\s*\{\"Qt\"\}/$qtversion \{\"Qt\"\}/si;
+ $buf =~s/\$\(PLATFORM\)\/\$\(TARGET\)/$target/si;
+
+ if ( not ( open (FW, ">$winpath") ) )
+ {
+ print "Error: Couldn't open $winpath file to write\n";
+ return;
+ }
+ binmode FW;
+ print FW $buf;
+ close FW;
+ print "\r\n";
+
+ my $pkgname = sisName( $winpath );
+
+ if ( not ( open (FWM2, ">>$modulebatpath") ) )
+ {
+ print "Error: Couldn't open $modulebatpath file to append\n";
+ return;
+ }
+ binmode FWM2;
+ print FWM2 "makesis $winpath $pkgname\.SIS\r\n";
+ print FWM2 "signsis $pkgname\.SIS $pkgname\.SISX $ccert $ckey\r\n";
+ close FWM2;
+ }
+ }
+
+sub sisName()
+ {
+ my $path = shift;
+ my $name = "";
+ if ( $path =~ /\\(\w+)\.pkg/i )
+ {
+ $name = $1;
+ }
+ return $name;
+ }
+
+sub delModuleSis()
+ {
+ my $file=$_;
+ my $winpath=$File::Find::name;
+ $winpath=~s/\//\\/g;
+
+
+ if( -f $file && $file=~/(_template\.pkg)$/i && ( $file=~/^(t_)/i || $file=~/test/i ) )
+ {
+ print "Deleting: ";
+ print "$winpath ";
+ system "attrib -R $winpath";
+ system "del /S/Q $winpath";
+ print "\r\n";
+ }
+ }
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/sis/stubs/createstubs.bat Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,17 @@
+@rem
+@rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+@rem All rights reserved.
+@rem This component and the accompanying materials are made available
+@rem under the terms of "Eclipse Public License v1.0"
+@rem which accompanies this distribution, and is available
+@rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+@rem
+@rem Initial Contributors:
+@rem Nokia Corporation - initial contribution.
+@rem
+@rem Contributors:
+@rem
+@rem Description:
+@rem
+
+for %%f in (*.pkg) do makesis -s %%f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/sis/stubs/taskswitcher_stub.pkg Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,39 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description:
+;
+; ------------------------------------------------------------------------------
+; Taskswitcher stub SIS package file.
+; Used to enable Taskswitcher to be updated from ROM with a SIS package.
+; When you add new files into this stub, please remember to update
+; SIS stub with "makesis -s" command.
+; ------------------------------------------------------------------------------
+;
+;Language - standard language definitions
+&EN
+
+; standard SIS file header
+#{"taskswitcher"},(0x2002677F),1,0,0,TYPE=SA
+
+;Localized Vendor Name
+%{"Nokia"}
+
+;Unique Vendor name
+:"Nokia"
+
+""-"Z:\resource\qt\translations\taskswitcher.qm"
+""-"Z:\resource\qt\crml\tsexternalactivation.qcrml"
+
+""-"Z:\sys\bin\tsdevicedialogplugin.dll"
+""-"Z:\resource\plugins\devicedialogs\tsdevicedialogplugin.qtplugin"
Binary file tsdevicedialog/sis/stubs/taskswitcher_stub.sis has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/sis/taskswitcher.pkg Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,33 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description:
+;
+
+;Language - standard language definitions
+&EN
+
+; standard SIS file header
+#{"taskswitcher"},(0x2002677F),1,0,0,TYPE=SA, RU
+
+;Localized Vendor Name
+%{"Nokia"}
+
+;Unique Vendor name
+:"Nokia"
+
+"/epoc32/data/z/resource/qt/translations/taskswitcher.qm"-"!:\resource\qt\translations\taskswitcher.qm"
+"/epoc32/data/z/resource/qt/crml/tsexternalactivation.qcrml"-"!:\resource\qt\crml\tsexternalactivation.qcrml"
+
+"/epoc32/release/armv5/urel/tsdevicedialogplugin.dll"-"!:\sys\bin\tsdevicedialogplugin.dll"
+"/epoc32/data/z/resource/plugins/devicedialogs/tsdevicedialogplugin.qtplugin"-"!:\resource\plugins\devicedialogs\tsdevicedialogplugin.qtplugin"
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialog.pro Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,43 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+TEMPLATE = subdirs
+
+coverage {
+ SUBDIRS += ../activityfw
+ SUBDIRS += ../hsappkeyhandler
+ SUBDIRS += ../tstaskmonitor
+}
+
+SUBDIRS += tsdevicedialogplugin
+
+tests {
+ SUBDIRS += internal/tstestrunner
+ SUBDIRS += tsdevicedialogplugin/tsrc
+ SUBDIRS += ../activityfw/activityserviceplugin/tsrc
+ SUBDIRS += ../activityfw/storage/client/t_afstorageclient
+ SUBDIRS += ../hsappkeyhandler/tsrc/t_hsappkeyhandler
+ SUBDIRS += ../tstaskmonitor/client/tsrc
+ SUBDIRS += ../tstaskmonitor/server/tsrc
+ SUBDIRS += ../tstaskmonitor/screenshotplugin/tsrc
+ SUBDIRS += ../activityfw/tsutils/tsrc
+ SUBDIRS += ../tstaskmonitor/utils/tsrc
+ SUBDIRS += ../tstaskmonitor/backstepping/tsrc
+}
+
+symbian:include(rom.pri)
+
+CONFIG += ordered
Binary file tsdevicedialog/tsdevicedialogplugin/conf/tsdevicedialog.confml has changed
Binary file tsdevicedialog/tsdevicedialogplugin/conf/tsdevicedialog_2002677F.crml has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/inc/tsactivitymodelitem.h Thu Jun 24 16:18:29 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: tsactivitymodelitem.h
+*
+*/
+
+#ifndef TSACTIVITYMODELITEM_H
+#define TSACTIVITYMODELITEM_H
+#include "tsmodelitem.h"
+#include <qvariant.h>
+#include <qicon.h>
+/*!
+ Implements model item which represents Activity entry
+*/
+class TsActivityModelItem : public TsModelItem
+{
+ Q_OBJECT
+public:
+ TsActivityModelItem(QAbstractListModel &model, QObject &service, const QVariantHash &activity);
+ ~TsActivityModelItem();
+ QVariant data(int role) const;
+ void close();
+ void open();
+ static QString applicationKeyword();
+ static QString visibilityKeyword();
+ static QString screenshotKeyword();
+
+private:
+ QVariant decorationRole() const;
+ QVariant displayRole() const;
+ QVariant visibilityRole() const;
+
+private slots:
+ void thumbnailReady(QPixmap, void *);
+signals:
+ void entryChanged(TsModelItem *);
+
+private:
+ QObject &mService;
+ const QVariantHash mActivity;
+ QIcon mIcon;
+ bool mRequestPending;
+};
+
+#endif // TSACTIVITYMODELITEM_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/inc/tsdataroles.h Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef TSDATAROLES_H
+#define TSDATAROLES_H
+
+namespace TsDataRoles {
+ enum EntryAttributes {
+ Closable = Qt::UserRole + 1,
+ };
+}
+
+#endif // TSDATAROLES_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/inc/tsdevicedialogcontainer.h Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef TSDEVICEDIALOGCONTAINER_H
+#define TSDEVICEDIALOGCONTAINER_H
+
+#include <QObject>
+
+#include <HbDeviceDialogInterface>
+
+#include <qvaluespacepublisher.h>
+
+#include "tsdocumentloader.h"
+
+QTM_USE_NAMESPACE
+
+class QAbstractListModel;
+
+class TsDeviceDialogContainer : public QObject, public HbDeviceDialogInterface
+{
+Q_OBJECT
+public:
+ explicit TsDeviceDialogContainer(QAbstractListModel *model, QObject *parent = 0);
+ ~TsDeviceDialogContainer();
+
+public:
+ virtual bool setDeviceDialogParameters(const QVariantMap ¶meters);
+ virtual int deviceDialogError() const;
+ virtual void closeDeviceDialog(bool byClient);
+ virtual HbPopup *deviceDialogWidget() const;
+ virtual QObject *signalSender() const;
+
+signals:
+ void deviceDialogClosed();
+
+public slots:
+ void changeOrientation(Qt::Orientation orientation);
+
+private slots:
+ void notifyDialogClosed();
+
+private:
+ TsDocumentLoader mLoader;
+ QValueSpacePublisher mVisibilityPublisher;
+
+};
+
+#endif // TSDEVICEDIALOGCONTAINER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/inc/tsdevicedialogplugin.h Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef TSDEVICEDIALOGPLUGIN_H
+#define TSDEVICEDIALOGPLUGIN_H
+
+#include <hbdevicedialogplugin.h>
+
+#include <QObject>
+#include <QVariantMap>
+#include <QSharedPointer>
+#include <qabstractitemmodel.h>
+
+#include "tsdocumentloader.h"
+
+class TsTaskMonitor;
+class TsDeviceDialogPlugin : public HbDeviceDialogPlugin
+{
+ Q_OBJECT
+
+public:
+ TsDeviceDialogPlugin();
+ ~TsDeviceDialogPlugin();
+
+ bool accessAllowed(const QString &deviceDialogType, const QVariantMap ¶meters, const QVariantMap &securityInfo) const;
+ HbDeviceDialogInterface *createDeviceDialog(const QString &deviceDialogType, const QVariantMap ¶meters);
+ bool deviceDialogInfo(const QString &deviceDialogType, const QVariantMap ¶meters, DeviceDialogInfo *info) const;
+ QStringList deviceDialogTypes() const;
+ PluginFlags pluginFlags() const;
+ int error() const;
+
+private:
+ int mError;
+ TsDocumentLoader mLoader;
+ QAbstractListModel *mModel;
+ TsTaskMonitor *mStorage;
+
+ bool mTriedToLoadTranslation;
+
+ Q_DISABLE_COPY(TsDeviceDialogPlugin)
+};
+
+#endif // TSDEVICEDIALOGPLUGIN_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/inc/tsdocumentloader.h Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Screensaver custom document loader.
+*
+*/
+
+#ifndef TSDOCUMENTLOADER_H
+#define TSDOCUMENTLOADER_H
+
+#include <hbdocumentloader.h>
+
+class TsDocumentLoader : public HbDocumentLoader
+{
+
+private:
+ virtual QObject *createObject(const QString &type, const QString &name);
+
+};
+
+#endif // TSDOCUMENTLOADER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/inc/tsentrymodelitem.h Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: tsentrymodelitem.h
+*
+*/
+
+#ifndef TSENTRYMODELITEM_H
+#define TSENTRYMODELITEM_H
+#include "tsmodelitem.h"
+
+#include <qsharedpointer.h>
+#include <qstring.h>
+
+class TsTask;
+
+/*!
+ Class implements model item which represents Content Arsenal entry
+*/
+class TsEntryModelItem : public TsModelItem
+{
+public:
+ TsEntryModelItem(QSharedPointer<TsTask> entry);
+ ~TsEntryModelItem();
+ QVariant data(int role) const;
+ void close();
+ void open();
+
+private:
+ const QSharedPointer<TsTask> mEntry;
+};
+
+#endif // TSMODEL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/inc/tsmodel.h Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,89 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: tsmodel.h
+*
+*/
+
+#ifndef TSMODEL_H
+#define TSMODEL_H
+
+#include <QAbstractItemModel>
+#include <QList>
+#include <QSize>
+#include <QSharedPointer>
+#include <tstaskmonitor.h>
+#ifdef Q_OS_SYMBIAN
+#include <apgcli.h>
+#endif
+
+class TsTaskMonitor;
+class ActivityManager;
+class CaNotifier;
+class TsModelItem;
+
+class TsModel : public QAbstractListModel
+{
+ Q_OBJECT
+
+public:
+ explicit TsModel(TsTaskMonitor &applicationSrv,
+ QObject &activitySrv,
+ QObject *parent = 0);
+ ~TsModel();
+
+ int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ int maxRowCount()const;
+
+public slots:
+ void openApplication(const QModelIndex &index);
+ void closeApplication(const QModelIndex &index);
+ void updateModel();
+ void entryChanged(TsModelItem *);
+private:
+ TsModelItem *entry(const QModelIndex &index) const;
+ void getApplications();
+ void getActivities();
+ void prepareActivityEntry(QVariantHash &activity);
+ QString getApplicationName(int id);
+
+private:
+ /*
+ * List containing result
+ */
+ QList<TsModelItem *> mEntries;
+
+ TsTaskMonitor &mApplicationService;
+
+ /*
+ * Activity Service
+ */
+ QObject &mActivityService;
+
+#ifdef Q_OS_SYMBIAN
+ RApaLsSession iAppArcSession;
+#endif
+
+ /*
+ * Icon size in model
+ */
+ QSize mSize;
+
+ /*
+ * Maximum number of items (only for running apps + activities)
+ */
+ int mMaxItems;
+};
+
+#endif // TSMODEL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/inc/tsmodelitem.h Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: tsmodelitem.h
+*
+*/
+
+#ifndef TSMODELITEM_H
+#define TSMODELITEM_H
+#include <QVariant>
+#include <QModelIndex>
+/*!
+ Abstract class which define model item for taskswitcher
+*/
+class TsModelItem: public QObject
+{
+ Q_OBJECT
+
+public:
+ virtual QVariant data(int role) const =0;
+ virtual void close() =0;
+ virtual void open() =0;
+};
+
+#endif // TSMODELITEM_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/inc/tstasksgrid.h Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef TSTASKSGRID_H
+#define TSTASKSGRID_H
+
+#include <hbgridview.h>
+
+class TsTasksGrid : public HbGridView
+{
+ Q_OBJECT
+
+signals:
+ void deleteButtonClicked(const QModelIndex &index);
+
+protected:
+ virtual void polish(HbStyleParameters ¶ms);
+
+};
+
+#endif // TSTASKSGRID_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/inc/tstasksgriditem.h Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef TSTASKSGRIDITEM_H
+#define TSTASKSGRIDITEM_H
+
+#include <hbabstractviewitem.h>
+
+class HbTextItem;
+class HbIconItem;
+class HbFrameItem;
+class HbPushButton;
+
+class TsTasksGridItem : public HbAbstractViewItem
+{
+ Q_OBJECT
+
+public:
+ TsTasksGridItem();
+ TsTasksGridItem(const TsTasksGridItem &item);
+
+ HbAbstractViewItem *createItem();
+ void updateChildItems();
+
+private slots:
+ void handleDeleteClicked();
+
+signals:
+ void deleteClicked(const QModelIndex &index);
+
+private:
+ HbIconItem *mScreenshotLabel;
+ HbTextItem *mApplicationNameLabel;
+ HbPushButton *mDeleteButton;
+
+ HbFrameItem *mActiveLabelFrame;
+ HbTextItem *mActiveLabel;
+};
+
+#endif //TSTASKSGRIDITEM_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/resource/layout.docml Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<hbdocument version="0.10">
+ <widget name="tsdevicedialog" type="HbDialog">
+ <widget name="heading" role="HbDialog:headingWidget" type="HbLabel">
+ <string name="alignment" value="AlignVCenter|AlignHCenter" />
+ <string locid="txt_tsw_title_task_switcher" name="plainText" value="Task switcher" />
+ </widget>
+ <widget name="taskgrid" role="HbDialog:contentWidget" type="TsTasksGrid">
+ <widget name="item" role="HbAbstractView:prototype" type="TsTasksGridItem"/>
+ <bool name="longPressEnabled" value="FALSE"/>
+ <enums name="horizontalScrollBarPolicy" value="ScrollBarAlwaysOff"/>
+ </widget>
+ <bool name="backgroundFaded" value="TRUE"/>
+ <string name="dismissPolicy" value="TapOutside"/>
+ <integer name="timeout" value="0"/>
+ <sizepolicy horizontalPolicy="Preferred" horizontalStretch="0" verticalPolicy="Preferred" verticalStretch="0"/>
+ </widget>
+ <section name="portrait">
+ <widget name="tsdevicedialog">
+ <sizehint type="PREFERRED" width="48un" height="40un"/>
+ </widget>
+ <widget name="taskgrid">
+ <string name="scrollDirections" value="Horizontal"/>
+ <integer name="rowCount" value="1"/>
+ <integer name="columnCount" value="2"/>
+ </widget>
+ </section>
+ <section name="landscape">
+ <widget name="tsdevicedialog">
+ <sizehint type="PREFERRED" width="60un" height="40un"/>
+ </widget>
+ <widget name="taskgrid">
+ <string name="scrollDirections" value="Horizontal"/>
+ <integer name="rowCount" value="2"/>
+ <integer name="columnCount" value="1"/>
+ </widget>
+ </section>
+</hbdocument>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/resource/tsdevicedialog.qcrml Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<repository target="RProperty" uidValue="0x20022fc5">
+ <key int="0x2002677F" ref="/TaskSwitcher/Visibility"/>
+</repository>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/resource/tstasksgriditem.css Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,52 @@
+TsTasksGridItem {
+ layout:custom;
+}
+
+TsTasksGridItem::appname {
+ text-align: center;
+ color: var(qtc_default_main_pane_normal);
+ font-variant: secondary;
+ text-height: var(hb-param-text-height-tiny);
+}
+
+TsTasksGridItem > HbPushButton#closebadge {
+ min-width: 7un;
+ min-height: 7un;
+}
+
+TsTasksGridItem::screenshotFrame {
+ zvalue: -1;
+}
+
+TsTasksGridItem::applicationLabelFrame {
+ zvalue: -1;
+}
+
+TsTasksGridItem > HbPushButton#closebadge::toucharea {
+ left: 1un;
+ right: -1un;
+ top: 1un;
+ bottom: -1un;
+}
+
+TsTasksGridItem > HbPushButton#closebadge::icon {
+ max-width: var(hb-param-graphic-size-primary-small);
+ max-height: var(hb-param-graphic-size-primary-small);
+}
+
+TsTasksGridItem::activeLabel {
+ text-align: center;
+ color: var(qtc_default_main_pane_normal);
+ text-height: var(hb-param-text-height-tiny);
+ font-variant: secondary;
+
+ zvalue: 2;
+
+ /* workaround for mesh layout limitations */
+ max-height: 4un;
+ min-height: 4un;
+}
+
+TsTasksGridItem::activeLabelFrame {
+ zvalue: 1;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/resource/tstasksgriditem.widgetml Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,34 @@
+<hbwidget version="0.1" type="TsTasksGridItem">
+ <layout name="custom" type="mesh">
+ <meshitem src="appname" srcEdge="TOP" dst="" dstEdge="TOP" spacing="-4un"/>
+ <meshitem src="appname" srcEdge="LEFT" dst="screenshot" dstEdge="LEFT"/>
+ <meshitem src="appname" srcEdge="RIGHT" dst="screenshot" dstEdge="RIGHT"/>
+
+ <meshitem src="screenshot" srcEdge="TOP" dst="appname" dstEdge="BOTTOM" spacing="-1.5un"/>
+ <meshitem src="screenshot" srcEdge="RIGHT" dst="" dstEdge="RIGHT" spacing="1.5un"/>
+ <meshitem src="screenshot" srcEdge="LEFT" dst="" dstEdge="LEFT" spacing="-1.5un"/>
+ <meshitem src="screenshot" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" spacing="4un"/>
+
+ <meshitem src="screenshotFrame" srcEdge="TOP" dst="screenshot" dstEdge="TOP" spacing="0.5un"/>
+ <meshitem src="screenshotFrame" srcEdge="RIGHT" dst="screenshot" dstEdge="RIGHT" spacing="-0.5un"/>
+ <meshitem src="screenshotFrame" srcEdge="LEFT" dst="screenshot" dstEdge="LEFT" spacing="0.5un"/>
+ <meshitem src="screenshotFrame" srcEdge="BOTTOM" dst="screenshot" dstEdge="BOTTOM" spacing="-0.5un"/>
+
+ <meshitem src="applicationLabelFrame" srcEdge="TOP" dst="appname" dstEdge="TOP"/>
+ <meshitem src="applicationLabelFrame" srcEdge="RIGHT" dst="appname" dstEdge="RIGHT"/>
+ <meshitem src="applicationLabelFrame" srcEdge="LEFT" dst="appname" dstEdge="LEFT"/>
+ <meshitem src="applicationLabelFrame" srcEdge="BOTTOM" dst="appname" dstEdge="BOTTOM"/>
+
+ <meshitem src="closebadge" srcEdge="TOP" dst="screenshot" dstEdge="TOP"/>
+ <meshitem src="closebadge" srcEdge="RIGHT" dst="screenshot" dstEdge="RIGHT"/>
+
+ <meshitem src="activeLabel" srcEdge="RIGHT" dst="screenshot" dstEdge="RIGHT"/>
+ <meshitem src="activeLabel" srcEdge="LEFT" dst="screenshot" dstEdge="LEFT"/>
+ <meshitem src="activeLabel" srcEdge="BOTTOM" dst="screenshot" dstEdge="BOTTOM"/>
+
+ <meshitem src="activeLabelFrame" srcEdge="TOP" dst="activeLabel" dstEdge="TOP"/>
+ <meshitem src="activeLabelFrame" srcEdge="RIGHT" dst="activeLabel" dstEdge="RIGHT"/>
+ <meshitem src="activeLabelFrame" srcEdge="LEFT" dst="activeLabel" dstEdge="LEFT"/>
+ <meshitem src="activeLabelFrame" srcEdge="BOTTOM" dst="activeLabel" dstEdge="BOTTOM"/>
+ </layout>
+</hbwidget>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/src/tsactivitymodelitem.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,173 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: tsactivitymodelitem.cpp
+*
+*/
+#include <hbicon.h>
+#include <afstorageglobals.h>
+
+#include "tsactivitymodelitem.h"
+#include "tsdataroles.h"
+
+/*!
+ \class TsActivityModelItem
+ \ingroup group_tsdevicedialogplugin
+ \brief Item presenting activity in the grid.
+*/
+
+/*!
+ Standard C++ constructor
+ /param model - reference to parent model
+ /param service - reference to initialized ActivityManager instance
+ /param entry - Activity data
+*/
+TsActivityModelItem::TsActivityModelItem(QAbstractListModel &model,
+ QObject& service,
+ const QVariantHash & activity)
+ :
+ mService(service),
+ mActivity(activity),
+ mIcon(),
+ mRequestPending(false)
+{
+ connect(this,
+ SIGNAL(entryChanged(TsModelItem *)),
+ &model,
+ SLOT(entryChanged(TsModelItem *)));
+ connect(&mService,
+ SIGNAL(thumbnailReady(QPixmap, void *)),
+ this,
+ SLOT(thumbnailReady(QPixmap, void *)));
+}
+
+/*!
+ Standard C++ destructor
+ /param service - reference to initialized ActivityManager instance
+ /param entry - Activity data
+*/
+TsActivityModelItem::~TsActivityModelItem()
+{
+}
+
+/*!
+ Returns the data stored under the given role.
+ /param role - requested data role
+ /return data encapulated by QVariant
+*/
+QVariant TsActivityModelItem::data(int role) const
+{
+ switch (role) {
+ case Qt::DisplayRole:
+ return displayRole();
+ case Qt::DecorationRole:
+ return decorationRole();
+ case TsDataRoles::Closable:
+ return QVariant(false);
+ default:
+ return QVariant(QVariant::Invalid);
+ }
+}
+
+/*!
+ Empty interface implementation
+*/
+void TsActivityModelItem::close()
+{
+ //no implementation required
+}
+
+/*!
+ Open or move to foreground activity repesented by entry
+*/
+void TsActivityModelItem::open()
+{
+ QVariant application(mActivity.value(ActivityApplicationKeyword));
+ QVariant activity(mActivity.value(ActivityActivityKeyword));
+
+ if (application.isValid() && activity.isValid()) {
+ QMetaObject::invokeMethod(&mService,
+ "launchActivity",
+ Q_ARG(int, application.toInt()),
+ Q_ARG(QString, activity.toString()));
+ }
+}
+
+/*!
+ Return application name keyword
+*/
+QString TsActivityModelItem::applicationKeyword()
+{
+ static QString applicationName(ActivityApplicationName);
+ return applicationName;
+}
+
+/*!
+ Return activity visibility status keyword
+*/
+QString TsActivityModelItem::visibilityKeyword()
+{
+ static QString visibility("visible");
+ return visibility;
+}
+
+/*!
+ Return activity screenshot keyword
+*/
+QString TsActivityModelItem::screenshotKeyword()
+{
+ static QString screenshot(ActivityScreenshotKeyword);
+ return screenshot;
+}
+
+/*!
+ Returns the data stored under decoration role.
+ /return data encapulated by QVariant
+*/
+QVariant TsActivityModelItem::decorationRole() const
+{
+ if (!mRequestPending) {
+ const_cast<TsActivityModelItem *>(this)->mRequestPending = true;
+ QVariant screenshot = mActivity.value(screenshotKeyword());
+ if (screenshot.isValid()) {
+ QMetaObject::invokeMethod(&mService,
+ "getThumbnail",
+ Q_ARG(QSize, QSize(128, 128)),
+ Q_ARG(QString, screenshot.toString()),
+ Q_ARG(void *, const_cast<TsActivityModelItem *>(this)));
+ }
+ }
+ return QVariant::fromValue<HbIcon>(HbIcon(mIcon));
+}
+
+/*!
+ Returns the data stored under display role.
+ /return data encapulated by QVariant
+*/
+QVariant TsActivityModelItem::displayRole() const
+{
+ return mActivity.value(applicationKeyword());
+}
+
+/*!
+ Slot retrieve thumbnail form TM, update content and notify observers
+ /param pixmap - thumbnail content
+ /ptr - user data provided to request
+*/
+void TsActivityModelItem::thumbnailReady(QPixmap pixmap, void *ptr)
+{
+ if (ptr == this) {
+ mIcon = pixmap;
+ emit entryChanged(this);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/src/tsdevicedialogcontainer.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,119 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "tsdevicedialogcontainer.h"
+
+#include <QAbstractListModel>
+
+#include <HbDialog>
+#include <HbMainWindow>
+
+#include <tspropertydefs.h>
+
+#include "tstasksgrid.h"
+#include "tstasksgriditem.h"
+
+namespace {
+ const char KDocmlPath[] = ":/resource/layout.docml";
+}
+
+TsDeviceDialogContainer::TsDeviceDialogContainer(QAbstractListModel *model, QObject *parent) : QObject(parent), mVisibilityPublisher(TsProperty::KTsPath)
+{
+ bool ok(true);
+ mLoader.load(KDocmlPath, &ok);
+ Q_ASSERT(ok);
+
+ HbDialog *dialog = qobject_cast<HbDialog*>(mLoader.findWidget("tsdevicedialog"));
+ TsTasksGrid *grid = qobject_cast<TsTasksGrid *>(mLoader.findWidget("taskgrid"));
+ Q_ASSERT(dialog);
+ Q_ASSERT(grid);
+
+ changeOrientation(dialog->mainWindow()->orientation());
+
+ grid->setModel(model);
+
+ // needed because of Qt::QueuedConnection used below
+ // @todo: check if we actually need queued connections
+ qRegisterMetaType<QModelIndex>("QModelIndex");
+
+ // connect the grid and model
+ disconnect(grid, SIGNAL(activated(QModelIndex)), model, SLOT(openApplication(QModelIndex)));
+ disconnect(grid, SIGNAL(activated(QModelIndex)), dialog, SLOT(close()));
+ disconnect(grid, SIGNAL(deleteButtonClicked(QModelIndex)), model, SLOT(closeApplication(QModelIndex)));
+
+ connect(grid, SIGNAL(activated(QModelIndex)), model, SLOT(openApplication(QModelIndex)));
+ connect(grid, SIGNAL(activated(QModelIndex)), dialog, SLOT(close()));
+ connect(grid, SIGNAL(deleteButtonClicked(QModelIndex)), model, SLOT(closeApplication(QModelIndex)), Qt::QueuedConnection);
+
+ connect(dialog->mainWindow(), SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(changeOrientation(Qt::Orientation)));
+ connect(dialog, SIGNAL(aboutToClose()), this, SIGNAL(deviceDialogClosed()));
+
+ connect(this, SIGNAL(deviceDialogClosed()), this, SLOT(notifyDialogClosed()));
+ mVisibilityPublisher.setValue(TsProperty::KVisibilityPath, true);
+ mVisibilityPublisher.sync();
+}
+
+TsDeviceDialogContainer::~TsDeviceDialogContainer()
+{
+ delete deviceDialogWidget();
+}
+
+bool TsDeviceDialogContainer::setDeviceDialogParameters(const QVariantMap ¶meters)
+{
+ Q_UNUSED(parameters);
+ return false;
+}
+
+int TsDeviceDialogContainer::deviceDialogError() const
+{
+ return 0;
+}
+
+void TsDeviceDialogContainer::closeDeviceDialog(bool byClient)
+{
+ Q_UNUSED(byClient)
+ // @todo: should there be hide calls? deviceDialogWidget->hide();
+ emit deviceDialogClosed();
+}
+
+HbPopup *TsDeviceDialogContainer::deviceDialogWidget() const
+{
+ HbDialog *widget = qobject_cast<HbDialog*>(mLoader.findWidget("tsdevicedialog"));
+ Q_ASSERT(widget);
+ return widget;
+}
+
+QObject *TsDeviceDialogContainer::signalSender() const
+{
+ return const_cast<TsDeviceDialogContainer*>(this);
+}
+
+void TsDeviceDialogContainer::changeOrientation(Qt::Orientation orientation)
+{
+ bool ok(true);
+ if (orientation == Qt::Horizontal) {
+ mLoader.load(KDocmlPath, "landscape", &ok);
+ } else {
+ mLoader.load(KDocmlPath, "portrait", &ok);
+ }
+ Q_ASSERT(ok);
+}
+
+void TsDeviceDialogContainer::notifyDialogClosed()
+{
+ mVisibilityPublisher.setValue(TsProperty::KVisibilityPath, false);
+ mVisibilityPublisher.sync();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/src/tsdevicedialogplugin.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,171 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include <QTranslator>
+#include <QCoreApplication>
+#include <QLocale>
+#include <QtPlugin>
+
+#include <qservicemanager.h>
+
+#include <hbdevicedialog.h>
+#include <HbMainWindow>
+
+#include "tsdevicedialogplugin.h"
+#include "tsdevicedialogcontainer.h"
+#include "tstasksgrid.h"
+#include "tstasksgriditem.h"
+#include "tsdocumentloader.h"
+#include "tsmodel.h"
+
+/*!
+ \class TsDeviceDialogPlugin
+ \ingroup group_tsdevicedialogplugin
+ \brief TaskSwitcher Device Dialog Plug-in.
+ */
+
+namespace
+{
+ const char KTranslationPath[] = "resource/qt/translations";
+ const char KTsDialogType[] = "com.nokia.taskswitcher.tsdevicedialogplugin/1.0";
+}
+
+/*!
+ Constructor.
+ */
+TsDeviceDialogPlugin::TsDeviceDialogPlugin() : mError(0), mModel(0), mStorage(0), mTriedToLoadTranslation(false)
+{
+}
+
+TsDeviceDialogPlugin::~TsDeviceDialogPlugin()
+{
+ delete mModel;
+}
+/*!
+ \reimp
+ */
+bool TsDeviceDialogPlugin::accessAllowed(const QString &deviceDialogType, const QVariantMap ¶meters, const QVariantMap &securityInfo) const
+{
+ Q_UNUSED(deviceDialogType)
+ Q_UNUSED(parameters)
+ Q_UNUSED(securityInfo)
+
+ // This plugin doesn't perform operations that may compromise security.
+ // All clients are allowed to use it.
+ return true;
+}
+
+/*!
+ \reimp
+ */
+HbDeviceDialogInterface *TsDeviceDialogPlugin::createDeviceDialog(const QString &deviceDialogType, const QVariantMap ¶meters)
+{
+ Q_UNUSED(parameters)
+ HbDeviceDialogInterface *dialogInterface(0);
+ if (deviceDialogType == QString(KTsDialogType)) {
+ // lazy loading of translation
+ if (!mTriedToLoadTranslation) {
+ mTriedToLoadTranslation = true;
+
+ QTranslator *translator = new QTranslator(this);
+ QString translationFile = QString("taskswitcher_%1").arg(QLocale::system().name());
+
+ bool translationLoaded(false);
+ #ifdef Q_OS_SYMBIAN
+ translationLoaded = translator->load(translationFile, QString("z:/") + KTranslationPath);
+ if (!translationLoaded) {
+ translationLoaded = translator->load(translationFile, QString("c:/") + KTranslationPath);
+ }
+ #else
+ translationLoaded = translator->load(translationFile, QString(KTranslationPath));
+ #endif //Q_OS_SYMBIAN
+
+ Q_ASSERT(translationLoaded);
+ qApp->installTranslator(translator);
+ }
+
+ // lazy loading of model
+ if (0 == mModel) {
+ mStorage = new TsTaskMonitor(this);
+ if (0 == mStorage) {
+ return 0; // provider of running application list is critical
+ }
+
+ QtMobility::QServiceManager serviceManager;
+ QObject *activityManager(serviceManager.loadInterface("com.nokia.qt.activities.ActivityManager"));
+ if (activityManager) {
+ activityManager->setParent(this); //make it autodestructed
+ } else {
+ activityManager = this; //activity plugin is not present. provide invalid instance because its not critical functionality.
+ //QMetaObject::invokeMethod is safe to use in such a case.
+ }
+ mModel = new TsModel(*mStorage, *activityManager);
+ }
+
+ dialogInterface = new TsDeviceDialogContainer(mModel);
+ }
+ return dialogInterface;
+}
+
+/*!
+ \reimp
+ */
+bool TsDeviceDialogPlugin::deviceDialogInfo(const QString &deviceDialogType, const QVariantMap ¶meters, DeviceDialogInfo *info) const
+{
+ Q_UNUSED(parameters)
+ Q_UNUSED(deviceDialogType)
+
+ info->group = GenericDeviceDialogGroup;
+ info->flags = NoDeviceDialogFlags;
+ info->priority = DefaultPriority;
+
+ return true;
+}
+
+/*!
+ \reimp
+ */
+QStringList TsDeviceDialogPlugin::deviceDialogTypes() const
+{
+ return QStringList(QString(KTsDialogType));
+}
+
+/*!
+ \reimp
+ */
+HbDeviceDialogPlugin::PluginFlags TsDeviceDialogPlugin::pluginFlags() const
+{
+ return PluginFlags(PreloadPlugin | KeepPluginLoaded);
+}
+
+/*!
+ \reimp
+ */
+int TsDeviceDialogPlugin::error() const
+{
+ return mError;
+}
+
+#ifdef COVERAGE_MEASUREMENT
+#pragma CTC SKIP
+#endif //COVERAGE_MEASUREMENT
+
+Q_EXPORT_PLUGIN2(tsdevicedialogplugin, TsDeviceDialogPlugin)
+
+#ifdef COVERAGE_MEASUREMENT
+#pragma CTC ENDSKIP
+#endif //COVERAGE_MEASUREMENT
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/src/tsdocumentloader.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Screensaver custom document loader.
+*
+*/
+
+#include "tsdocumentloader.h"
+#include "tstasksgrid.h"
+#include "tstasksgriditem.h"
+
+/*!
+ \class TsDocumentLoader
+ \ingroup group_tsdevicedialogplugin
+ \brief Document loader.
+
+ TS implementation of document loader. It is creating TS objects used in UI
+*/
+
+QObject *TsDocumentLoader::createObject(const QString &type, const QString &name)
+{
+ if (type == TsTasksGrid::staticMetaObject.className()) {
+ QObject *object = new TsTasksGrid();
+ object->setObjectName(name);
+ return object;
+ } else if (type == TsTasksGridItem::staticMetaObject.className()) {
+ QObject *object = new TsTasksGridItem();
+ object->setObjectName(name);
+ return object;
+ }
+
+ return HbDocumentLoader::createObject(type, name);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/src/tsentrymodelitem.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: tsentrymodelitem.cpp
+*
+*/
+#include "tsentrymodelitem.h"
+#include "tsdataroles.h"
+
+#include <tstask.h>
+#include <HbIcon>
+
+/*!
+ \class TsEntryModelItem
+ \ingroup group_tsdevicedialogplugin
+ \brief Item presenting running apps in the grid.
+*/
+
+/*!
+ Standard C++ constructor
+ /param entry - Task Monitor data
+*/
+TsEntryModelItem::TsEntryModelItem(QSharedPointer<TsTask> entry)
+ :
+ mEntry(entry)
+{
+ //no implementation required
+}
+
+/*!
+ Standard C++ destructor
+*/
+TsEntryModelItem::~TsEntryModelItem()
+{
+}
+
+/*!
+ Returns the data stored under the given role.
+ /param role - requested data role
+ /return data encapulated by QVariant
+*/
+QVariant TsEntryModelItem::data(int role) const
+{
+ switch (role) {
+ case Qt::DisplayRole:
+ return QVariant(mEntry->name());
+ case Qt::DecorationRole:
+ {
+ QPixmap icon = mEntry->screenshot().isNull() ?
+ mEntry->icon() :
+ mEntry->screenshot();
+ if (icon.isNull()) {
+ return HbIcon("qtg_large_application");
+ } else {
+ return QVariant::fromValue<HbIcon>(HbIcon(icon));
+ }
+ }
+ case TsDataRoles::Closable:
+ return QVariant(mEntry->isClosable());
+ default:
+ return QVariant(QVariant::Invalid);
+ }
+}
+
+/*!
+ Close running application repesented by entry
+*/
+void TsEntryModelItem::close()
+{
+ mEntry->close();
+}
+
+/*!
+ Open or move to foreground application repesented by entry
+*/
+void TsEntryModelItem::open()
+{
+ mEntry->open();
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/src/tsmodel.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,244 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: tsmodel.cpp
+*
+*/
+#include "tsmodel.h"
+#include "tsmodelitem.h"
+#include "tsentrymodelitem.h"
+#include "tsactivitymodelitem.h"
+#include "tsdataroles.h"
+
+#include <HbIcon>
+#include <qvariant.h>
+#include <qlist.h>
+#include <afstorageglobals.h>
+
+#ifdef Q_OS_SYMBIAN
+#include <XQSettingsManager>
+#include <apaid.h>
+
+const int TSDeviceDialogUid = 0x2002677F;
+const int ItemsLimit = 0x00000001;
+#endif
+
+const int maxItems(10);
+/*!
+ \class TsModel
+ \ingroup group_tsdevicedialogplugin
+ \brief Model storing running application and activieties.
+*/
+
+/*!
+ Constructor
+ \param query used to create model
+ \param pointer to parent object
+*/
+TsModel::TsModel(TsTaskMonitor &applicationSrv, QObject &activitySrv, QObject *parent) :
+ QAbstractListModel(parent),
+ mEntries(),
+ mApplicationService(applicationSrv),
+ mActivityService(activitySrv),
+ mSize(240, 240),
+ mMaxItems(maxItems)
+{
+
+#ifdef Q_OS_SYMBIAN
+ XQSettingsManager *crManager = new XQSettingsManager;
+ XQCentralRepositorySettingsKey itemsNumberKey(TSDeviceDialogUid, ItemsLimit);
+ QVariant itemsNumberVariant = crManager->readItemValue(itemsNumberKey, XQSettingsManager::TypeInt);
+ if (!itemsNumberVariant.isNull()) {
+ int number = itemsNumberVariant.toInt();
+ if (number > 0) {
+ mMaxItems = number;
+ }
+ }
+ iAppArcSession.Connect();
+#endif
+
+ connect(&activitySrv, SIGNAL(dataChanged()), this, SLOT(updateModel()));
+ connect(&applicationSrv, SIGNAL(taskListChanged()), this, SLOT(updateModel()));
+ updateModel();
+}
+
+/*!
+ Destructor
+*/
+TsModel::~TsModel()
+{
+#ifdef Q_OS_SYMBIAN
+ iAppArcSession.Close();
+#endif
+ qDeleteAll(mEntries);
+}
+
+/*!
+ Returns count of rows in model
+ \retval number of rows
+*/
+int TsModel::rowCount(
+ const QModelIndex &parent) const
+{
+ Q_UNUSED(parent);
+ return mEntries.count();
+}
+
+/*!
+ Returns appropiate model's data
+ \param index model index
+ \param role which data role to return
+ \retval models data
+*/
+QVariant TsModel::data(const QModelIndex &index,
+ int role) const
+{
+ return index.isValid() ? entry(index)->data(role) : QVariant();
+}
+
+/*!
+ Returns maximum anount of data allowed for model
+ \retval maximum data count
+*/
+
+int TsModel::maxRowCount()const
+{
+ return mMaxItems;
+}
+
+/*!
+ Activate one of model entries
+*/
+void TsModel::openApplication(const QModelIndex &index)
+{
+ if (!index.isValid()) {
+ return;
+ }
+ entry(index)->open();
+}
+
+/*!
+ Close one of moder entries
+*/
+void TsModel::closeApplication(const QModelIndex &index)
+{
+ if (!index.isValid() || !entry(index)->data(TsDataRoles::Closable).toBool()) {
+ return;
+ }
+ entry(index)->close();
+}
+
+/*!
+ Updates model with fresh entries
+*/
+void TsModel::updateModel()
+{
+ //clear current data
+ qDeleteAll(mEntries);
+ mEntries.clear();
+
+ beginResetModel();
+ getApplications();
+ getActivities();
+ endResetModel();
+
+}
+
+/*!
+ Read list of running applications
+*/
+void TsModel::getApplications()
+{
+ //get running applications
+ TsModelItem *entry(0);
+ QList< QSharedPointer<TsTask> > tasks(mApplicationService.taskList());
+ foreach (QSharedPointer<TsTask> taskData, tasks) {
+ entry = new TsEntryModelItem(taskData);
+ if (0 != entry) {
+ mEntries.append(entry);
+ }
+ }
+}
+
+/*!
+ Read current activities
+*/
+void TsModel::getActivities()
+{
+ //get activities
+ TsModelItem *entry(0);
+ QList<QVariantHash> activities;
+ QMetaObject::invokeMethod(&mActivityService, "activitiesList", Q_RETURN_ARG(QList<QVariantHash>, activities));
+ foreach(QVariantHash activity, activities) {
+ prepareActivityEntry(activity);
+ entry = new TsActivityModelItem(*this, mActivityService, activity);
+ if (entry) {
+ if (maxRowCount() <= mEntries.count()) {
+ break;
+ }
+ mEntries.append(entry);
+ }
+ }
+}
+
+/*!
+ Modify activity entry replacing application id with name
+*/
+void TsModel::prepareActivityEntry(QVariantHash &activity)
+{
+ if (!activity.contains(TsActivityModelItem::applicationKeyword())) {
+ activity.insert(TsActivityModelItem::applicationKeyword(),
+ activity.contains(ActivityApplicationKeyword) ?
+ getApplicationName(activity[ActivityApplicationKeyword].toInt()) :
+ QString::null);
+ }
+}
+
+/*!
+ Return application name
+ \param id - reqiested application identyfier
+*/
+QString TsModel::getApplicationName(int id)
+{
+ QString retVal;
+#ifdef Q_OS_SYMBIAN
+ TApaAppInfo info;
+ iAppArcSession.GetAppInfo( info, TUid::Uid(id));
+ retVal = QString::fromUtf16(info.iShortCaption.Ptr(),
+ info.iShortCaption.Length());
+#endif
+ return retVal;
+}
+
+/*!
+ Called when some item was changed
+ \param itemPtr - address of updated item
+*/
+void TsModel::entryChanged(TsModelItem *itemPtr)
+{
+ const int itemIndex = mEntries.indexOf(itemPtr);
+ if (itemIndex != -1) {
+ emit dataChanged(index(itemIndex, 0), index(itemIndex, 0));
+ }
+}
+
+/*!
+ Returns an entry from model
+ \param index of entry in model
+ \retval pointer to an entry
+*/
+TsModelItem *TsModel::entry(const QModelIndex &index) const
+{
+ return mEntries.at(index.row());
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/src/tstasksgrid.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "tstasksgrid.h"
+
+void TsTasksGrid::polish(HbStyleParameters ¶ms)
+{
+ HbGridView::polish(params);
+
+ // center second item when dialog is shown
+ if (model()) {
+ scrollTo(model()->index(1, 0), PositionAtCenter);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/src/tstasksgriditem.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,102 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "tstasksgriditem.h"
+
+#include <HbPushButton>
+#include <HbAbstractItemView>
+#include <HbFrameItem>
+#include <HbTextItem>
+#include <HbIconItem>
+#include <HbStyleLoader>
+
+#include "tsdataroles.h"
+
+/*!
+ \class TsTasksGridItem
+ \ingroup group_tsdevicedialogplugin
+ \brief Item that should be presented in grid.
+*/
+
+
+TsTasksGridItem::TsTasksGridItem() : HbAbstractViewItem(), mScreenshotLabel(0), mApplicationNameLabel(0), mDeleteButton(0), mActiveLabelFrame(0), mActiveLabel(0)
+{
+ // Register the custom docml and css to provide our own style to the list items
+ bool widgetmlLoaded = HbStyleLoader::registerFilePath(":/resource/tstasksgriditem.widgetml");
+ Q_ASSERT(widgetmlLoaded);
+ bool cssLoaded = HbStyleLoader::registerFilePath(":/resource/tstasksgriditem.css");
+ Q_ASSERT(cssLoaded);
+}
+
+TsTasksGridItem::TsTasksGridItem(const TsTasksGridItem &item) : HbAbstractViewItem(item)
+{
+ mScreenshotLabel = new HbIconItem(this);
+ mApplicationNameLabel = new HbTextItem(this);
+ mDeleteButton = new HbPushButton(this);
+ HbFrameItem *screenshotFrame = new HbFrameItem(this);
+ screenshotFrame->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
+ screenshotFrame->frameDrawer().setFrameGraphicsName("qtg_fr_multimedia_trans");
+
+ HbFrameItem *applicationLabelFrame = new HbFrameItem(this);
+ applicationLabelFrame->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
+ applicationLabelFrame->frameDrawer().setFrameGraphicsName("qtg_fr_multimedia_trans");
+
+ mActiveLabel = new HbTextItem(hbTrId("txt_tsw_label_active"), this);
+ mActiveLabelFrame = new HbFrameItem(this);
+ mActiveLabelFrame->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
+ mActiveLabelFrame->frameDrawer().setFrameGraphicsName("qtg_fr_multimedia_trans");
+
+ mDeleteButton->setIcon(HbIcon("qtg_mono_exit"));
+
+ HbStyle::setItemName(mScreenshotLabel, "screenshot");
+ HbStyle::setItemName(mApplicationNameLabel, "appname");
+ HbStyle::setItemName(mDeleteButton, "closebadge");
+ mDeleteButton->setObjectName("closebadge");
+ HbStyle::setItemName(screenshotFrame, "screenshotFrame");
+ HbStyle::setItemName(applicationLabelFrame, "applicationLabelFrame");
+ HbStyle::setItemName(mActiveLabel, "activeLabel");
+ HbStyle::setItemName(mActiveLabelFrame, "activeLabelFrame");
+ connect(mDeleteButton, SIGNAL(clicked()), this, SLOT(handleDeleteClicked()));
+}
+
+HbAbstractViewItem *TsTasksGridItem::createItem()
+{
+ TsTasksGridItem *newItem = new TsTasksGridItem(*this);
+ connect(newItem, SIGNAL(deleteClicked(QModelIndex)), itemView(), SIGNAL(deleteButtonClicked(QModelIndex)));
+ return newItem;
+}
+
+void TsTasksGridItem::handleDeleteClicked()
+{
+ emit deleteClicked(modelIndex());
+}
+
+void TsTasksGridItem::updateChildItems()
+{
+ mScreenshotLabel->setIcon(modelIndex().data(Qt::DecorationRole).value<HbIcon>());
+ mApplicationNameLabel->setText(modelIndex().data(Qt::DisplayRole).toString());
+ QVariant status(modelIndex().data(TsDataRoles::Closable));
+ const bool isClosable(status.isValid() && status.toBool());
+ if (isClosable) {
+ mDeleteButton->show();
+ mActiveLabel->show();
+ mActiveLabelFrame->show();
+ } else {
+ mDeleteButton->hide();
+ mActiveLabel->hide();
+ mActiveLabelFrame->hide();
+ }
+}
Binary file tsdevicedialog/tsdevicedialogplugin/taskswitcher.qm has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/taskswitcher.ts Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="3.0" language="en_GB" sourcelanguage="en_GB">
+<context>
+<message numerus="no" id="txt_tsw_title_task_switcher">
+ <comment>Task switcher popup title text. Application allows user to swap between running and recently used applications and to clear them from the list.</comment>
+ <source>Task switcher</source>
+ <translation variants="no">Task switcher</translation>
+ <extra-loc-layout_id>cell_tport_appsw_pane_t1</extra-loc-layout_id>
+ <extra-loc-viewid>tsw_01</extra-loc-viewid>
+ <extra-loc-positionid>title</extra-loc-positionid>
+ <extra-loc-feature>ts</extra-loc-feature>
+ <extra-loc-blank>False</extra-loc-blank>
+</message>
+</context>
+</TS>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/tsdevicedialogplugin.pro Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,78 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: tsdevicedialogplugin.pro
+#
+
+TEMPLATE = lib
+CONFIG += hb plugin mobility
+MOBILITY = serviceframework publishsubscribe
+
+include (../common.pri)
+
+HEADERS += inc/tsdevicedialogcontainer.h \
+ inc/tsdevicedialogplugin.h \
+ inc/tsmodel.h \
+ inc/tsmodelitem.h \
+ inc/tsentrymodelitem.h \
+ inc/tsactivitymodelitem.h \
+ inc/tstasksgrid.h \
+ inc/tstasksgriditem.h \
+ inc/tsdocumentloader.h \
+ inc/tsdataroles.h \
+
+SOURCES += src/tsdevicedialogcontainer.cpp \
+ src/tsdevicedialogplugin.cpp \
+ src/tsmodel.cpp \
+ src/tsentrymodelitem.cpp \
+ src/tsactivitymodelitem.cpp \
+ src/tstasksgrid.cpp \
+ src/tstasksgriditem.cpp \
+ src/tsdocumentloader.cpp \
+
+INCLUDEPATH += . \
+ ./inc \
+
+LIBS += -ltstaskmonitorclient
+
+TRANSLATIONS = taskswitcher.ts
+
+RESOURCES += tsdevicedialogplugin.qrc
+
+symbian {
+ TARGET.CAPABILITY = CAP_ECOM_PLUGIN
+ TARGET.UID3 = 0x2002677F
+ pluginstub.sources = tsdevicedialogplugin.dll
+ pluginstub.path = /resource/plugins/devicedialogs
+
+ LIBS += -lxqsettingsmanager -lapparc -lapgrfx
+
+ # ugly hack
+ translation.sources = ./*.qm
+ translation.path = $$QT_PLUGINS_BASE_DIR/../translations
+
+ crml.sources = ./resource/*.qcrml
+ crml.path = /resource/qt/crml
+
+ DEPLOYMENT += pluginstub translation crml
+
+ BLD_INF_RULES.prj_exports += \
+ "$${LITERAL_HASH}include <platform_paths.hrh>" \
+ "conf/tsdevicedialog.confml APP_LAYER_CONFML(tsdevicedialog.confml)" \
+ "conf/tsdevicedialog_2002677F.crml APP_LAYER_CRML(tsdevicedialog_2002677F.crml)"
+}
+
+win32 {
+ include ($$[QMAKE_MKSPECS]/features/hb_install.prf)
+ DESTDIR = $$HB_PLUGINS_DIR/devicedialogs
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tsdevicedialog/tsdevicedialogplugin/tsdevicedialogplugin.qrc Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,7 @@
+<RCC>
+ <qresource prefix="/">
+ <file>resource/layout.docml</file>
+ <file>resource/tstasksgriditem.widgetml</file>
+ <file>resource/tstasksgriditem.css</file>
+ </qresource>
+</RCC>
--- a/tstaskmonitor/client/client.pri Fri Jun 11 16:13:51 2010 +0300
+++ b/tstaskmonitor/client/client.pri Thu Jun 24 16:18:29 2010 +0300
@@ -32,28 +32,28 @@
$$PWD/s60/inc/tstaskmonitorclient.h \
$$PWD/s60/inc/tstaskmonitorclientimpl.h \
$$PWD/s60/inc/tssession.h \
- $$PWD/../utils/inc/tsfswentry.h \
+ $$PWD/../utils/inc/tsentry.h \
$$PWD/../utils/inc/tsentrykey.h \
$$PWD/../utils/inc/tsutils.h \
$$PWD/s60/inc/tstaskmonitor_p.h \
$$PWD/s60/inc/tsapplicationtask.h \
$$PWD/s60/inc/tsscreenshotclient.h \
$$PWD/s60/inc/tsscreenshotclientimpl.h \
- $$PWD/inc/tsscreenshotregistry.h \
- $$PWD/s60/inc/tsscreenshotregistry_p.h \
+ $$PWD/s60/inc/tstasksettings_p.h \
+ $$PWD/../../homescreensrv_plat/taskswitcher_api/tstasksettings.h \
SOURCES += $$PWD/s60/src/tstaskmonitorclient.cpp \
$$PWD/s60/src/tstaskmonitorclientimpl.cpp \
$$PWD/s60/src/tssession.cpp \
- $$PWD/../utils/src/tsfswentry.cpp \
+ $$PWD/../utils/src/tsentry.cpp \
$$PWD/../utils/src/tsentrykey.cpp \
$$PWD/s60/src/tstaskmonitor_p.cpp \
$$PWD/s60/src/tstask.cpp \
$$PWD/s60/src/tsapplicationtask.cpp \
$$PWD/s60/src/tsscreenshotclient.cpp \
$$PWD/s60/src/tsscreenshotclientimpl.cpp \
- $$PWD/src/tsscreenshotregistry.cpp \
- $$PWD/s60/src/tsscreenshotregistry_p.cpp \
+ $$PWD/src/tstasksettings.cpp \
+ $$PWD/s60/src/tstasksettings_p.cpp \
LIBS += -lxqutils \
-lestor \
@@ -63,12 +63,12 @@
INCLUDEPATH += $$PWD/stub/inc \
HEADERS += $$PWD/stub/inc/tstaskmonitor_p.h \
- $$PWD/stub/inc/tsfswentry.h \
- $$PWD/stub/inc/tsscreenshotregistry_p.h \
+ $$PWD/stub/inc/tsentry.h \
+ $$PWD/stub/inc/tstasksettings_p.h \
SOURCES += $$PWD/stub/src/tstaskmonitor_p.cpp \
$$PWD/stub/src/tstask.cpp \
- $$PWD/stub/src/tsfswentry.cpp \
- $$PWD/stub/src/tsscreenshotregistry_p.cpp \
+ $$PWD/stub/src/tsentry.cpp \
+ $$PWD/stub/src/tstasksettings_p.cpp \
}
--- a/tstaskmonitor/client/client.pro Fri Jun 11 16:13:51 2010 +0300
+++ b/tstaskmonitor/client/client.pro Thu Jun 24 16:18:29 2010 +0300
@@ -33,7 +33,6 @@
"inc\tstask.h" \
"inc\tstaskmonitor_global.h" \
"s60\inc\tsscreenshotclient.h" \
- "inc\tsscreenshotregistry.h" \
TARGET.UID3 = 0x200267AF
TARGET.CAPABILITY = ALL -TCB
--- a/tstaskmonitor/client/inc/tsscreenshotregistry.h Fri Jun 11 16:13:51 2010 +0300
+++ /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 TSSCREENSHOTREGISTRY_H
-#define TSSCREENSHOTREGISTRY_H
-
-#include <QPixmap>
-
-#include "tstaskmonitor_global.h"
-
-class TsScreenshotRegistryPrivate;
-
-class TSTASKMONITOR_EXPORT TsScreenshotRegistry
-{
-
-public:
- TsScreenshotRegistry();
- ~TsScreenshotRegistry();
-
- bool registerScreenshot(const QPixmap &screenshot);
- bool unregisterScreenshot();
-
-private:
- TsScreenshotRegistryPrivate *d_ptr;
-};
-
-#endif //TSSCREENSHOTREGISTRY_H
--- a/tstaskmonitor/client/inc/tstask.h Fri Jun 11 16:13:51 2010 +0300
+++ b/tstaskmonitor/client/inc/tstask.h Thu Jun 24 16:18:29 2010 +0300
@@ -22,13 +22,13 @@
#include "tstaskmonitor_global.h"
-class CTsFswEntry;
+class CTsEntry;
class TsTask
{
public:
- TsTask(CTsFswEntry* entry);
+ TsTask(CTsEntry* entry);
TSTASKMONITOR_EXPORT virtual ~TsTask();
TSTASKMONITOR_EXPORT virtual void open() = 0;
@@ -40,7 +40,7 @@
TSTASKMONITOR_EXPORT QString name() const;
protected:
- CTsFswEntry* mEntry;
+ CTsEntry* mEntry;
};
--- a/tstaskmonitor/client/s60/inc/tsapplicationtask.h Fri Jun 11 16:13:51 2010 +0300
+++ b/tstaskmonitor/client/s60/inc/tsapplicationtask.h Thu Jun 24 16:18:29 2010 +0300
@@ -19,15 +19,20 @@
#include "tstask.h"
+#include <w32std.h>
+
class TsApplicationTask : public TsTask
{
public:
- TsApplicationTask(CTsFswEntry* entry);
+ TsApplicationTask(RWsSession &wsSession, CTsEntry* entry);
virtual void open();
virtual void close();
+private:
+ RWsSession &mWsSession;
+
};
#endif //TSAPPLICATIONTASK_H
--- a/tstaskmonitor/client/s60/inc/tsscreenshotclient.h Fri Jun 11 16:13:51 2010 +0300
+++ b/tstaskmonitor/client/s60/inc/tsscreenshotclient.h Thu Jun 24 16:18:29 2010 +0300
@@ -35,6 +35,7 @@
IMPORT_C TInt RegisterScreenshot(CFbsBitmap *screenshot, TInt wgId, UpdatePriority priority = Normal);
IMPORT_C void RegisterScreenshot(TRequestStatus &status, CFbsBitmap *screenshot, TInt wgId, UpdatePriority priority = Normal);
IMPORT_C TInt UnregisterScreenshot(TInt wgId);
+ IMPORT_C TInt SetVisibility(TInt wgId, Visibility value);
private:
CTsScreenshotClient();
--- a/tstaskmonitor/client/s60/inc/tsscreenshotclientimpl.h Fri Jun 11 16:13:51 2010 +0300
+++ b/tstaskmonitor/client/s60/inc/tsscreenshotclientimpl.h Thu Jun 24 16:18:29 2010 +0300
@@ -19,6 +19,7 @@
#include <e32base.h>
+#include "tstaskmonitorglobals.h"
#include "tssession.h"
class CFbsBitmap;
@@ -34,6 +35,7 @@
TInt RegisterScreenshot(CFbsBitmap *screenshot, TInt wgId, UpdatePriority priority);
void RegisterScreenshot(TRequestStatus &status, CFbsBitmap *screenshot, TInt wgId, UpdatePriority priority);
TInt UnregisterScreenshot(TInt wgId);
+ TInt SetVisibility(TInt wgId, Visibility value);
private:
CTsScreenshotClientImpl();
--- a/tstaskmonitor/client/s60/inc/tsscreenshotregistry_p.h Fri Jun 11 16:13:51 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-#ifndef TSSCREENSHOTREGISTRY_P_H
-#define TSSCREENSHOTREGISTRY_P_H
-
-#include <QPixmap>
-
-class CTsScreenshotClient;
-
-class TsScreenshotRegistryPrivate
-{
-public:
- TsScreenshotRegistryPrivate();
- ~TsScreenshotRegistryPrivate();
-
-public:
- bool registerScreenshot(const QPixmap &screenshot);
- bool unregisterScreenshot();
-
-private:
- int wgId();
-
-private:
- CTsScreenshotClient *mClient;
-
-};
-
-#endif //TSSCREENSHOTREGISTRY_P_H
--- a/tstaskmonitor/client/s60/inc/tssession.h Fri Jun 11 16:13:51 2010 +0300
+++ b/tstaskmonitor/client/s60/inc/tssession.h Thu Jun 24 16:18:29 2010 +0300
@@ -20,7 +20,7 @@
#include <e32base.h>
#include "tstaskmonitorglobals.h"
-#include "tsfswentry.h"
+#include "tsentry.h"
NONSHARABLE_CLASS( RTsSession ) : public RSessionBase
{
@@ -35,7 +35,8 @@
public: // screenshots API
TInt RegisterScreenshot(CFbsBitmap *screenshot, TInt wgId, UpdatePriority priority);
void RegisterScreenshot(TRequestStatus &status, CFbsBitmap *screenshot, TInt wgId, UpdatePriority priority);
- TInt UnregisterScreenshot(TInt wgId);
+ TInt UnregisterScreenshot(TInt wgId);
+ TInt SetVisibility(TInt wgId, Visibility value);
private:
TInt StartServer();
--- a/tstaskmonitor/client/s60/inc/tstaskmonitor_p.h Fri Jun 11 16:13:51 2010 +0300
+++ b/tstaskmonitor/client/s60/inc/tstaskmonitor_p.h Thu Jun 24 16:18:29 2010 +0300
@@ -19,6 +19,8 @@
#include "tstaskmonitorobserver.h"
+#include <w32std.h>
+
#include <QList>
#include <QSharedPointer>
@@ -41,7 +43,7 @@
private:
TsTaskMonitor *q_ptr;
CTsTaskMonitorClient *mClient;
-
+ RWsSession &mWsSession;
};
#endif //TSTASKMONITOR_P_H
--- a/tstaskmonitor/client/s60/inc/tstaskmonitorclient.h Fri Jun 11 16:13:51 2010 +0300
+++ b/tstaskmonitor/client/s60/inc/tstaskmonitorclient.h Thu Jun 24 16:18:29 2010 +0300
@@ -19,7 +19,7 @@
#include <e32base.h>
-#include "tsfswentry.h"
+#include "tsentry.h"
class MTsTaskMonitorObserver;
class CTsTaskMonitorClientImpl;
--- a/tstaskmonitor/client/s60/inc/tstaskmonitorclientimpl.h Fri Jun 11 16:13:51 2010 +0300
+++ b/tstaskmonitor/client/s60/inc/tstaskmonitorclientimpl.h Thu Jun 24 16:18:29 2010 +0300
@@ -19,7 +19,7 @@
#include <e32base.h>
-#include "tsfswentry.h"
+#include "tsentry.h"
#include "tssession.h"
class MTsTaskMonitorObserver;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/s60/inc/tstasksettings_p.h Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef TSTASKSETTINGS_P_H
+#define TSTASKSETTINGS_P_H
+
+#include <QPixmap>
+
+class CTsScreenshotClient;
+
+class TsTaskSettingsPrivate
+{
+public:
+ TsTaskSettingsPrivate();
+ ~TsTaskSettingsPrivate();
+
+public:
+ bool registerScreenshot(const QPixmap &screenshot);
+ bool unregisterScreenshot();
+ bool setVisibility(bool visibility);
+
+private:
+ int wgId();
+
+private:
+ CTsScreenshotClient *mClient;
+
+};
+
+#endif //TSTASKSETTINGS_P_H
--- a/tstaskmonitor/client/s60/src/tsapplicationtask.cpp Fri Jun 11 16:13:51 2010 +0300
+++ b/tstaskmonitor/client/s60/src/tsapplicationtask.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -21,30 +21,23 @@
#include <eikenv.h>
#include <AknDef.h>
-#include "tsfswentry.h"
+#include "tsentry.h"
-TsApplicationTask::TsApplicationTask(CTsFswEntry* entry) : TsTask(entry)
+TsApplicationTask::TsApplicationTask(RWsSession &wsSession, CTsEntry* entry) : TsTask(entry), mWsSession(wsSession)
{
}
void TsApplicationTask::open()
{
- TApaTaskList taskList(CEikonEnv::Static()->WsSession());
+ TApaTaskList taskList(mWsSession);
TApaTask task = taskList.FindApp(mEntry->AppUid());
task.BringToForeground();
}
void TsApplicationTask::close()
{
- RWsSession wsSession;
- if (wsSession.Connect() == KErrNone) {
- CleanupClosePushL<RWsSession>(wsSession);
-
- TWsEvent event;
- event.SetTimeNow();
- event.SetType(KAknShutOrHideApp);
- wsSession.SendEventToWindowGroup(mEntry->WgId(), event);
-
- CleanupStack::PopAndDestroy(&wsSession);
- }
+ TWsEvent event;
+ event.SetTimeNow();
+ event.SetType(KAknShutOrHideApp);
+ mWsSession.SendEventToWindowGroup(mEntry->Key().WindowGroupId(), event);
}
--- a/tstaskmonitor/client/s60/src/tsscreenshotclient.cpp Fri Jun 11 16:13:51 2010 +0300
+++ b/tstaskmonitor/client/s60/src/tsscreenshotclient.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -63,3 +63,8 @@
{
return iImpl->UnregisterScreenshot(wgId);
}
+
+EXPORT_C TInt CTsScreenshotClient::SetVisibility(TInt wgId, Visibility value)
+{
+ return iImpl->SetVisibility(wgId, value);
+}
--- a/tstaskmonitor/client/s60/src/tsscreenshotclientimpl.cpp Fri Jun 11 16:13:51 2010 +0300
+++ b/tstaskmonitor/client/s60/src/tsscreenshotclientimpl.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -62,3 +62,8 @@
{
return iSession.UnregisterScreenshot(wgId);
}
+
+TInt CTsScreenshotClientImpl::SetVisibility(TInt wgId, Visibility value)
+{
+ return iSession.SetVisibility(wgId, value);
+}
--- a/tstaskmonitor/client/s60/src/tsscreenshotregistry_p.cpp Fri Jun 11 16:13:51 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-#include "tsscreenshotregistry_p.h"
-
-#include <fbs.h>
-#include <coecntrl.h>
-#include <QScopedPointer>
-#include <QApplication>
-#include <QDesktopWidget>
-
-#include "tsscreenshotclient.h"
-
-TsScreenshotRegistryPrivate::TsScreenshotRegistryPrivate() : mClient(0)
-{
- QT_TRAP_THROWING(mClient = CTsScreenshotClient::NewL());
-}
-
-TsScreenshotRegistryPrivate::~TsScreenshotRegistryPrivate()
-{
- delete mClient;
-}
-
-bool TsScreenshotRegistryPrivate::registerScreenshot(const QPixmap &screenshot)
-{
- QScopedPointer<CFbsBitmap> bitmap(screenshot.toSymbianCFbsBitmap());
- if (bitmap.isNull())
- return false;
-
- return KErrNone == mClient->RegisterScreenshot(bitmap.data(), wgId());
-}
-
-bool TsScreenshotRegistryPrivate::unregisterScreenshot()
-{
- return KErrNone == mClient->UnregisterScreenshot(wgId());
-}
-
-int TsScreenshotRegistryPrivate::wgId()
-{
- return QApplication::desktop()->winId()->ControlEnv()->RootWin().WindowGroupId();
-}
--- a/tstaskmonitor/client/s60/src/tssession.cpp Fri Jun 11 16:13:51 2010 +0300
+++ b/tstaskmonitor/client/s60/src/tssession.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -74,7 +74,7 @@
if (err == KErrNone) {
RDesReadStream dataStream(dataPointer);
CleanupClosePushL(dataStream);
- CTsFswEntry::InternalizeArrayL(dataStream, tasks);
+ CTsEntry::InternalizeArrayL(dataStream, tasks);
CleanupStack::PopAndDestroy(&dataStream);
} else if (err != KErrCorrupt) {
User::Leave(err);
@@ -138,3 +138,11 @@
return SendReceive(UnregisterScreenshotMessage, arguments);
}
+
+TInt RTsSession::SetVisibility(TInt wgId, Visibility value)
+{
+ TPckgBuf<TInt> windowGroup(wgId), visibilityValue(value);
+
+ TIpcArgs arguments(&windowGroup, &visibilityValue);
+ return SendReceive(VisibilityChange, arguments);
+}
--- a/tstaskmonitor/client/s60/src/tstask.cpp Fri Jun 11 16:13:51 2010 +0300
+++ b/tstaskmonitor/client/s60/src/tstask.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -18,22 +18,45 @@
#include <XQConversions>
-#include "tsfswentry.h"
+#include "tsentry.h"
-TsTask::TsTask(CTsFswEntry* entry) : mEntry(entry)
+/*!
+ @class TsTask
+ @ingroup publicApi
+ @brief TsTask object represents a single task.
+
+ This class is one of the Qt interfaces for Task Monitor server. It can be
+ used to set custom screenshot of the task, or to change the task visibility.
+*/
+
+/*!
+ @internal
+ Constructor.
+ Takes ownership over @a entry.
+*/
+TsTask::TsTask(CTsEntry* entry) : mEntry(entry)
{
}
+/*!
+ Destructor.
+*/
TsTask::~TsTask()
{
delete mEntry;
}
+/*!
+ @return True if it's possible to close the task, false otherwise.
+*/
bool TsTask::isClosable() const
{
return mEntry->CloseableApp();
}
+/*!
+ @return Icon of the task.
+*/
QPixmap TsTask::icon() const
{
QPixmap pixmap = QPixmap::fromSymbianCFbsBitmap(mEntry->AppIconBitmap());
@@ -43,12 +66,28 @@
return pixmap;
}
+/*!
+ @return Screenshot of the task.
+*/
QPixmap TsTask::screenshot() const
{
return QPixmap::fromSymbianCFbsBitmap(mEntry->Screenshot());
}
+/*!
+ @return Name of the task.
+*/
QString TsTask::name() const
{
return XQConversions::s60DescToQString(mEntry->AppName());
}
+
+/*!
+ @fn TsTask::open()
+ Start or bring the task to foreground.
+*/
+
+/*!
+ @fn TsTask::close()
+ Close the task.
+*/
--- a/tstaskmonitor/client/s60/src/tstaskmonitor_p.cpp Fri Jun 11 16:13:51 2010 +0300
+++ b/tstaskmonitor/client/s60/src/tstaskmonitor_p.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -17,13 +17,15 @@
#include "tstaskmonitor_p.h"
#include "tstaskmonitor.h"
+#include <eikenv.h>
+
#include "tstaskmonitorclient.h"
#include "tsapplicationtask.h"
#include "tsutils.h"
using TaskSwitcher::CleanupResetAndDestroyPushL;
-TsTaskMonitorPrivate::TsTaskMonitorPrivate(TsTaskMonitor *q) : q_ptr(q), mClient(0)
+TsTaskMonitorPrivate::TsTaskMonitorPrivate(TsTaskMonitor *q) : q_ptr(q), mClient(0), mWsSession(CEikonEnv::Static()->WsSession())
{
QT_TRAP_THROWING(mClient = CTsTaskMonitorClient::NewL());
mClient->Subscribe(*this);
@@ -40,8 +42,8 @@
QList< QSharedPointer<TsTask> > tasks;
QT_TRAP_THROWING (
- RPointerArray<CTsFswEntry> entries;
- CleanupResetAndDestroyPushL<CTsFswEntry>(entries);
+ RPointerArray<CTsEntry> entries;
+ CleanupResetAndDestroyPushL<CTsEntry>(entries);
mClient->TaskListL(entries);
// TsTask claims ownership of CTsFswEntry, so we have to remove entries from
@@ -49,12 +51,12 @@
// CTsFswEntry objects in case of leave (for example due to OOM) in the middle
// of the loop below.
while (entries.Count()) {
- CTsFswEntry *firstEntry = entries[0];
+ CTsEntry *firstEntry = entries[0];
CleanupStack::PushL(firstEntry);
entries.Remove(0);
// @todo switch by entry type
- QT_TRYCATCH_LEAVING(tasks.append(QSharedPointer<TsTask>(new TsApplicationTask(firstEntry))));
+ QT_TRYCATCH_LEAVING(tasks.append(QSharedPointer<TsTask>(new TsApplicationTask(mWsSession, firstEntry))));
CleanupStack::Pop(firstEntry);
}
--- a/tstaskmonitor/client/s60/src/tstaskmonitorclientimpl.cpp Fri Jun 11 16:13:51 2010 +0300
+++ b/tstaskmonitor/client/s60/src/tstaskmonitorclientimpl.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -17,7 +17,7 @@
#include <e32base.h>
-#include "tsfswentry.h"
+#include "tsentry.h"
#include "tstaskmonitorclientimpl.h"
#include "tstaskmonitorobserver.h"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/s60/src/tstasksettings_p.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,60 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "tstasksettings_p.h"
+
+#include <fbs.h>
+#include <coecntrl.h>
+#include <QScopedPointer>
+#include <QApplication>
+#include <QDesktopWidget>
+
+#include "tsscreenshotclient.h"
+#include "tstaskmonitorglobals.h"
+
+TsTaskSettingsPrivate::TsTaskSettingsPrivate() : mClient(0)
+{
+ QT_TRAP_THROWING(mClient = CTsScreenshotClient::NewL());
+}
+
+TsTaskSettingsPrivate::~TsTaskSettingsPrivate()
+{
+ delete mClient;
+}
+
+bool TsTaskSettingsPrivate::registerScreenshot(const QPixmap &screenshot)
+{
+ QScopedPointer<CFbsBitmap> bitmap(screenshot.toSymbianCFbsBitmap());
+ if (bitmap.isNull())
+ return false;
+
+ return KErrNone == mClient->RegisterScreenshot(bitmap.data(), wgId());
+}
+
+bool TsTaskSettingsPrivate::unregisterScreenshot()
+{
+ return KErrNone == mClient->UnregisterScreenshot(wgId());
+}
+
+bool TsTaskSettingsPrivate::setVisibility(bool visibility)
+{
+ return (KErrNone == mClient->SetVisibility(wgId(), visibility ? Visible : Invisible));
+}
+
+int TsTaskSettingsPrivate::wgId()
+{
+ return QApplication::desktop()->winId()->ControlEnv()->RootWin().WindowGroupId();
+}
--- a/tstaskmonitor/client/src/tsscreenshotregistry.cpp Fri Jun 11 16:13:51 2010 +0300
+++ /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:
-*
-*/
-#include "tsscreenshotregistry.h"
-#include "tsscreenshotregistry_p.h"
-
-TsScreenshotRegistry::TsScreenshotRegistry() : d_ptr(new TsScreenshotRegistryPrivate())
-{
-}
-
-TsScreenshotRegistry::~TsScreenshotRegistry()
-{
- delete d_ptr;
-}
-
-bool TsScreenshotRegistry::registerScreenshot(const QPixmap &screenshot)
-{
- return d_ptr->registerScreenshot(screenshot);
-}
-
-bool TsScreenshotRegistry::unregisterScreenshot()
-{
- return d_ptr->unregisterScreenshot();
-}
--- a/tstaskmonitor/client/src/tstaskmonitor.cpp Fri Jun 11 16:13:51 2010 +0300
+++ b/tstaskmonitor/client/src/tstaskmonitor.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -20,17 +20,52 @@
#include "tstask.h"
+/*!
+ @class TsTaskMonitor
+ @ingroup publicApi
+ @brief TsTaskMonitor gives access to list of running tasks.
+
+ This class is one of the Qt interfaces for Task Monitor server. It can be
+ used to retrieve list of running tasks and receive notifications about the
+ changes of this list.
+*/
+
+/*!
+ Constructor.
+*/
TsTaskMonitor::TsTaskMonitor(QObject *parent) : QObject(parent), d_ptr(0)
{
d_ptr = new TsTaskMonitorPrivate(this);
}
+/*!
+ Destructor.
+*/
TsTaskMonitor::~TsTaskMonitor()
{
delete d_ptr;
}
+/*!
+ \return Current list of tasks from Task Monitor server.
+
+ \sa TsTask, taskListChanged()
+*/
QList< QSharedPointer<TsTask> > TsTaskMonitor::taskList()
{
return d_ptr->taskList();
}
+
+/*!
+ @fn TsTaskMonitor::taskListChanged()
+
+ This signal is emitted when task list changes in any way:
+ - the new task is started
+ - running task is terminated
+ - parameters of one task change (for example image representing the task is updated)
+
+ No data is passed within this signal, user should retrieve task list
+ using taskList().
+
+ \sa taskList()
+*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/src/tstasksettings.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "tstasksettings.h"
+#include "tstasksettings_p.h"
+
+/*!
+ @class TsTaskSettings
+ @ingroup publicApi
+ @brief TsTaskSettings allows application to alter the way it will be
+ handled by TsTaskMonitor.
+
+ This class is one of the Qt interfaces for Task Monitor server. It can be
+ used to set custom screenshot of the task, or to change the task visibility.
+*/
+
+/*!
+ Constructor.
+*/
+TsTaskSettings::TsTaskSettings() : d_ptr(new TsTaskSettingsPrivate())
+{
+}
+
+/*!
+ Destructor.
+*/
+TsTaskSettings::~TsTaskSettings()
+{
+ delete d_ptr;
+}
+
+/*!
+ Overwrites default screenshot of task with \a screenshot. If \a
+ screenshot is null, this method will return false.
+ @return True if the screenshot is successfully saved, false otherwise.
+*/
+bool TsTaskSettings::registerScreenshot(const QPixmap &screenshot)
+{
+ return d_ptr->registerScreenshot(screenshot);
+}
+
+/*!
+ Removes custom screenshot saved with registerScreenshot(). If there was no
+ saved screenshot, this method will return false.
+ @return True if the screenshot is successfully removed, false otherwise.
+*/
+bool TsTaskSettings::unregisterScreenshot()
+{
+ return d_ptr->unregisterScreenshot();
+}
+
+/*!
+ Changes the \a visibilty of task. Hidden tasks are not present on the task
+ list returned by TsTaskMonitor::taskList().
+ @return True if the visibility is changed successfully, false otherwise.
+*/
+bool TsTaskSettings::setVisibility(bool visibility)
+{
+ return d_ptr->setVisibility(visibility);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/stub/inc/tsentry.h Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef TSFSWENTRY_H
+#define TSFSWENTRY_H
+
+class CTsEntry
+{
+public:
+ CTsEntry();
+};
+
+#endif //TSFSWENTRY_H
--- a/tstaskmonitor/client/stub/inc/tsfswentry.h Fri Jun 11 16:13:51 2010 +0300
+++ /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 TSFSWENTRY_H
-#define TSFSWENTRY_H
-
-class CTsFswEntry
-{
-public:
- CTsFswEntry();
-};
-
-#endif //TSFSWENTRY_H
--- a/tstaskmonitor/client/stub/inc/tsscreenshotregistry_p.h Fri Jun 11 16:13:51 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +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 TSSCREENSHOTREGISTRY_P_H
-#define TSSCREENSHOTREGISTRY_P_H
-
-#include <QPixmap>
-
-class TsScreenshotRegistryPrivate
-{
-public:
- bool registerScreenshot(const QPixmap &screenshot);
- bool unregisterScreenshot();
-};
-
-#endif //TSSCREENSHOTREGISTRY_P_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/stub/inc/tstasksettings_p.h Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef TSTASKSETTINGS_P_H
+#define TSTASKSETTINGS_P_H
+
+#include <QPixmap>
+
+class TsTaskSettingsPrivate
+{
+public:
+ bool registerScreenshot(const QPixmap &screenshot);
+ bool unregisterScreenshot();
+};
+
+#endif //TSTASKSETTINGS_P_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/stub/src/tsentry.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,22 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "tsentry.h"
+
+CTsEntry::CTsEntry()
+{
+}
--- a/tstaskmonitor/client/stub/src/tsfswentry.cpp Fri Jun 11 16:13:51 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +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 "tsfswentry.h"
-
-CTsFswEntry::CTsFswEntry()
-{
-}
--- a/tstaskmonitor/client/stub/src/tsscreenshotregistry_p.cpp Fri Jun 11 16:13:51 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-#include "tsscreenshotregistry_p.h"
-
-bool TsScreenshotRegistryPrivate::registerScreenshot(const QPixmap &screenshot)
-{
- Q_UNUSED(screenshot);
- return true;
-}
-
-bool TsScreenshotRegistryPrivate::unregisterScreenshot()
-{
- return true;
-}
--- a/tstaskmonitor/client/stub/src/tstask.cpp Fri Jun 11 16:13:51 2010 +0300
+++ b/tstaskmonitor/client/stub/src/tstask.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -16,9 +16,9 @@
*/
#include "tstask.h"
-#include "tsfswentry.h"
+#include "tsentry.h"
-TsTask::TsTask(CTsFswEntry* entry) : mEntry(entry)
+TsTask::TsTask(CTsEntry* entry) : mEntry(entry)
{
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/client/stub/src/tstasksettings_p.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "tstasksettings_p.h"
+
+bool TsTaskSettingsPrivate::registerScreenshot(const QPixmap &screenshot)
+{
+ Q_UNUSED(screenshot);
+ return true;
+}
+
+bool TsTaskSettingsPrivate::unregisterScreenshot()
+{
+ return true;
+}
--- a/tstaskmonitor/inc/tstaskmonitorglobals.h Fri Jun 11 16:13:51 2010 +0300
+++ b/tstaskmonitor/inc/tstaskmonitorglobals.h Thu Jun 24 16:18:29 2010 +0300
@@ -32,6 +32,7 @@
CancelSubscribeRunningAppChanges,
RegisterScreenshotMessage,
UnregisterScreenshotMessage,
+ VisibilityChange
};
enum UpdatePriority {
@@ -40,6 +41,11 @@
High
};
+enum Visibility {
+ Invisible =0,
+ Visible
+};
+
enum ScreenshotMessageOffsets {
ScreenshotHandle = 0,
WindowsGroup,
--- a/tstaskmonitor/server/group/hsrunningappmonitor.mmp Fri Jun 11 16:13:51 2010 +0300
+++ b/tstaskmonitor/server/group/hsrunningappmonitor.mmp Thu Jun 24 16:18:29 2010 +0300
@@ -25,8 +25,6 @@
USERINCLUDE ../../backstepping/inc
MW_LAYER_SYSTEMINCLUDE
-APP_LAYER_SYSTEMINCLUDE
-
SOURCEPATH ../src
SOURCE main.cpp
@@ -37,13 +35,13 @@
SOURCE tsdatatask.cpp
SOURCE tsrunningappstorage.cpp
-SOURCE tsfswdatalist.cpp
+SOURCE tsdatalist.cpp
SOURCE tsscreenshotprovider.cpp
SOURCEPATH ../../utils/src
SOURCE tsentrykey.cpp
SOURCE tsentrykeygenerator.cpp
-SOURCE tsfswentry.cpp
+SOURCE tsentry.cpp
LIBRARY euser.lib
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/server/inc/tsdatalist.h Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,115 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Non-closeable app list class
+ *
+*/
+
+
+#ifndef TSDATALIST_H
+#define TSDATALIST_H
+
+#include <e32base.h>
+#include <tswindowgroupsobserver.h>
+#include "tsentry.h"
+#include "tsdatastorage.h"
+#include "tsdataobserver.h"
+
+class CApaWindowGroupName;
+class CFbsBitmap;
+
+NONSHARABLE_CLASS( CTsDataList ) : public CTsWindowGroupsObserver,
+ public MTsDataStorage
+ {
+public:
+ static CTsDataList* NewL(MTsResourceManager& resources,
+ MTsWindowGroupsMonitor &monitor,
+ MHsDataObserver& observer);
+
+ ~CTsDataList();
+
+private:
+ CTsDataList(MTsResourceManager& resources,
+ MTsWindowGroupsMonitor &monitor,
+ MHsDataObserver& observer);
+
+ void ConstructL();
+
+public:
+ const RTsFswArray& Data() const;
+
+ void HandleWindowGroupChanged(MTsResourceManager &,
+ const TArray<RWsSession::TWindowGroupChainInfo> &);
+
+ TBool IsHiddenUid( TUid uid );
+
+ void UpdateL(TInt key,const CFbsBitmap& data, TInt param, TInt priority);
+
+ void UpdateL(TInt key, const Visibility& data, TInt param);
+
+ void RemoveL(TInt key, TInt param);
+
+private:
+ void CollectAppsL(RTsFswArray& appsList,
+ const TArray<RWsSession::TWindowGroupChainInfo> &wgList);
+
+ void AddEntryL(const TTsEntryKey& key,
+ const TUid& appUid,
+ CApaWindowGroupName* wgName,
+ RTsFswArray& newList );
+
+ TBool ConsiderOldDataL( const TTsEntryKey& key );
+
+ HBufC* FindAppNameLC(CApaWindowGroupName* windowName,
+ const TUid& appUid,
+ TInt wgId );
+
+ void FitDataToList( RTsFswArray& listToFit);
+
+ TBool CheckIfExists(const CTsEntry& entry,
+ const RTsFswArray& newList) const;
+
+ void GetAppIconL(const TUid& appUid,
+ CFbsBitmap*& bitmapArg,
+ CFbsBitmap*& maskArg);
+
+ TInt FindEntry(const RTsFswArray& list, const TTsEntryKey& key ) const;
+
+ TBool EstablishOrder(const RArray<TTsEntryKey>& keyList);
+
+ TBool VerifyApplicationL(TUid);
+
+ TTsEntryKey GenerateKeyL(TInt);
+
+ void CompressLookupTable(RArray<TUid> &array);
+
+ void UpdateLookupTableL(RArray<TUid> &array, TInt offset);
+
+private:
+ /**
+ * Resource manager. Not own
+ */
+ MTsResourceManager& mResources;
+
+ MHsDataObserver &mObserver;
+
+ RTsFswArray mData; // current fsw content, i.e. the task list
+
+ // list of hidden uids
+ RArray<TUid> mHiddenUids;
+
+ // list of allowed uids
+ RArray<TUid> mAllowedUids;
+ };
+
+#endif //TSDATALIST_H
--- a/tstaskmonitor/server/inc/tsdatastorage.h Fri Jun 11 16:13:51 2010 +0300
+++ b/tstaskmonitor/server/inc/tsdatastorage.h Thu Jun 24 16:18:29 2010 +0300
@@ -18,10 +18,12 @@
#define DATASTORAGE_H
#include <e32base.h>
+#include "tstaskmonitorglobals.h"
class CFbsBitmap;
class MTsDataStorage {
public:
- virtual void UpdateL(TInt key,const CFbsBitmap& data, TInt param, TInt priority) =0;
+ virtual void UpdateL(TInt key, const CFbsBitmap& data, TInt param, TInt priority) =0;
+ virtual void UpdateL(TInt key, const Visibility& data, TInt param) =0;
virtual void RemoveL(TInt key, TInt param) =0;
};
--- a/tstaskmonitor/server/inc/tsdatatask.h Fri Jun 11 16:13:51 2010 +0300
+++ b/tstaskmonitor/server/inc/tsdatatask.h Thu Jun 24 16:18:29 2010 +0300
@@ -29,6 +29,9 @@
static void UnregisterScreenshotL(MTsDataStorage& dataStorage,
const RMessage2& msg);
+
+ static void VisibilityChangeL(MTsDataStorage& dataStorage,
+ const RMessage2& msg);
};
#endif //TSDATATASK_H
--- a/tstaskmonitor/server/inc/tsfswdatalist.h Fri Jun 11 16:13:51 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,221 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Non-closeable app list class
- *
-*/
-
-
-#ifndef TSFSWDATALIST_H
-#define TSFSWDATALIST_H
-
-#include <e32base.h>
-#include <tswindowgroupsobserver.h>
-#include "tsfswentry.h"
-#include "tsdataobserver.h"
-
-class CApaWindowGroupName;
-class CFbsBitmap;
-
-/**
- * Engine's data list.
- */
-NONSHARABLE_CLASS( CTsFswDataList ) : public CTsWindowGroupsObserver
- {
-public:
- /**
- * Two-phased constructor.
- */
- static CTsFswDataList* NewL(MTsResourceManager& resources,
- MTsWindowGroupsMonitor &monitor,
- MHsDataObserver& observer);
-
- /*
- * Destructor
- */
- ~CTsFswDataList();
-
-private:
- /**
- * Constructor.
- */
- CTsFswDataList(MTsResourceManager& resources,
- MTsWindowGroupsMonitor &monitor,
- MHsDataObserver& observer);
-
- /**
- * Performs 2nd phase construction.
- */
- void ConstructL();
-
-public:
- /**
- * Returns a reference to the current content.
- * Also performs sanity checks, e.g. associates application icons
- * when no screenshot has been received.
- * @return ref to content array
- */
- const RTsFswArray& FswDataL();
-
- /**
- * Interface implementation
- * @see MTsWindowGroupsObserver HandleWindowGroupChanged
- */
- void HandleWindowGroupChanged(MTsResourceManager &,
- const TArray<RWsSession::TWindowGroupChainInfo> &);
-
- /**
- * Checks if given uid is on hidden list
- * @param aUid uid to be checked
- * @return ETrue if uid is on hidden list
- */
- TBool IsHiddenUid( TUid uid );
-
- /**
- * Set screenshot
- */
- void SetScreenshotL(const CFbsBitmap* bitmap, UpdatePriority priority, TInt wgId);
-
- /**
- * Removes screenshot
- */
- void RemoveScreenshotL(TInt wgId);
-
-private:
- /**
- * Adds running apps to the list.
- * @param appsList array to add to
- */
- void CollectAppsL(RTsFswArray& appsList,
- const TArray<RWsSession::TWindowGroupChainInfo> &wgList);
-
- /**
- * Called from CollectTasksL for each entry in the task list.
- * @param key entry key
- * @param appUid application uid
- * @param wgName window group name or NULL
- * @param newList list to add to
- */
- void AddEntryL(const TTsEntryKey& key,
- const TUid& appUid,
- CApaWindowGroupName* wgName,
- RTsFswArray& newList );
-
- /**
- * Checks if there is an entry for same app in the content list.
- * If yes then it takes some of the data for the entry that
- * will correspond to the same app in the refreshed content list.
- * @param key new key in content list
- * @return ETrue if app was found
- */
- TBool ConsiderOldDataL( const TTsEntryKey& key );
-
- /**
- * Finds out the application name.
- * @param windowName window group name or NULL
- * @param appUId application uid
- * @param wgId window group id
- * @return application name, ownership transferred to caller
- */
- HBufC* FindAppNameLC(CApaWindowGroupName* windowName,
- const TUid& appUid,
- TInt wgId );
-
-
- /**
- * Fit existing class contained data list into give one.
- * Data is being changed with application type consideration that is based
- * on aConsiderWidgets param.
- * Function removes or add entries into data depend on given list.
- * @param listToFit list with actual data
- */
- void FitDataToList( RTsFswArray& listToFit);
-
- /**
- * Checks if there is an entry for same app in the given list.
- * @param entry entry
- * @param newList ref to list
- * @return ETrue if app was found
- */
- TBool CheckIfExists( const CTsFswEntry& entry,
- const RTsFswArray& newList ) const;
-
- /**
- * Retrieves the bitmap/mask for the icon of the given app.
- * @param appUid application uid
- * @param bitmapArg bitmap ptr, ownership transferred to caller, or NULL
- * @param maskArg mask ptr, ownership transferred to caller, or NULL
- */
- void GetAppIconL(const TUid& appUid,
- CFbsBitmap*& bitmapArg,
- CFbsBitmap*& maskArg);
-
- /**
- * Finds entry in array
- * @param list list to find
- * @param key finding key
- * @return position or KErrNotFound
- */
- TInt FindEntry(const RTsFswArray& list, const TTsEntryKey& key ) const;
-
- /**
- * Establish entry order accridung to aKeyList, all keys MUST be in iData
- * @param keyList reference key list
- * @return ETrue if changes occured
- */
- TBool EstablishOrder(const RArray<TTsEntryKey>& keyList);
-
- /**
- * Gets allowed uids, tries to filter non GUI application
- */
- TBool VerifyApplicationL(TUid);
-
- /**
- * Function generate task key using window group id
- * @param wgId - window group id of running application
- * @param entry key
- */
- TTsEntryKey GenerateKeyL(TInt);
-
- /**
- * Analyse and compress lookup table id needed
- * @param array - lookup table that has to be checked
- *
- */
- void CompressLookupTable(RArray<TUid> &array);
-
- /**
- * Change priority of an item in the lookup table
- * @param array - look up table
- * @param offset - index of an item in the table
- */
- void UpdateLookupTableL(RArray<TUid> &array, TInt offset);
-
-private:
- /**
- * Resource manager. Not own
- */
- MTsResourceManager& mResources;
-
- MHsDataObserver &mObserver;
-
- RTsFswArray mData; // current fsw content, i.e. the task list
-
- // list of hidden uids
- RArray<TUid> mHiddenUids;
-
- // list of allowed uids
- RArray<TUid> mAllowedUids;
- };
-
-#endif //TSFSWDATALIST_H
--- a/tstaskmonitor/server/inc/tsrunningappstorage.h Fri Jun 11 16:13:51 2010 +0300
+++ b/tstaskmonitor/server/inc/tsrunningappstorage.h Thu Jun 24 16:18:29 2010 +0300
@@ -25,7 +25,7 @@
#include "hsdataprovider.h"
#include "tsdatastorage.h"
-class CTsFswDataList;
+class CTsDataList;
class MTsResourceManager;
class MTsWindowGroupsMonitor;
@@ -59,6 +59,8 @@
void UpdateL(TInt key,const CFbsBitmap& data, TInt param, TInt priority);
+ void UpdateL(TInt key, const Visibility& data, TInt param);
+
void RemoveL(TInt key, TInt param);
private:
@@ -78,7 +80,7 @@
private:
MHsDataObserver& mObserver;
RBuf8 mData;
- CTsFswDataList* mEngine;
+ CTsDataList* mEngine;
};
#endif // RUNNINGAPPSERVER_H
--- a/tstaskmonitor/server/src/hsrunningappsession.cpp Fri Jun 11 16:13:51 2010 +0300
+++ b/tstaskmonitor/server/src/hsrunningappsession.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -91,6 +91,7 @@
case RegisterScreenshotMessage:
case UnregisterScreenshotMessage:
+ case VisibilityChange:
TsDataTask::ExecuteL(mDataStorage, message);
break;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/server/src/tsdatalist.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,541 @@
+/*
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: File containing application list classes
+ *
+ */
+
+//INCLUDES:
+
+#include "tsdatalist.h"
+#include "tsentrykeygenerator.h"
+#include <mmf/common/mmfcontrollerpluginresolver.h> // for CleanupResetAndDestroyPushL
+#include <apgwgnam.h>
+#include <bitstd.h>
+#include <AknIconUtils.h> // avkon
+#include <apgicnfl.h> // fbsbitmap
+#include <AknIconSrvClient.h>
+#include <fbs.h>
+#include <apgwgnam.h>
+
+
+// size for the created app icons
+const TInt KAppIconWidth = 128;
+const TInt KAppIconHeight = 128;
+
+//uids to be hidden
+const TUid KHsApplicationUid = { 0x20022F35 };
+
+const TInt KMaxLookupSize(75);
+
+// ================= MEMBER FUNCTIONS =======================
+
+// --------------------------------------------------------------------------
+/**
+ * Two-phased constructor.
+ */
+CTsDataList* CTsDataList::NewL(MTsResourceManager& resources,
+ MTsWindowGroupsMonitor &monitor,
+ MHsDataObserver& observer)
+{
+ CTsDataList* self = new (ELeave) CTsDataList(resources, monitor, observer);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ return self;
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Constructor.
+ */
+CTsDataList::CTsDataList(MTsResourceManager& resources,
+ MTsWindowGroupsMonitor &monitor,
+ MHsDataObserver& observer)
+:
+ CTsWindowGroupsObserver(monitor),
+ mResources(resources),
+ mObserver(observer)
+{
+}
+
+// --------------------------------------------------------------------------
+/*
+ * Destructor
+ */
+CTsDataList::~CTsDataList()
+{
+ mData.ResetAndDestroy();
+ mHiddenUids.Close();
+ mAllowedUids.Close();
+ RFbsSession::Disconnect();
+ RAknIconSrvClient::Disconnect();
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Performs 2nd phase construction.
+ */
+void CTsDataList::ConstructL()
+{
+ BaseConstructL();
+ mHiddenUids.AppendL(KHsApplicationUid);
+ User::LeaveIfError(RFbsSession::Connect());
+ RAknIconSrvClient::Connect();
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Returns a reference to the current content.
+ * Also performs sanity checks, e.g. associates application icons
+ * when no screenshot has been received.
+ * @return ref to content array
+ */
+const RTsFswArray& CTsDataList::Data() const
+{
+ return mData;
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Interface implementation
+ * @see MTsWindowGroupsObserver HandleWindowGroupChanged
+ */
+void CTsDataList::HandleWindowGroupChanged(MTsResourceManager &,
+ const TArray<RWsSession::TWindowGroupChainInfo> &wgList)
+{
+ TRAP_IGNORE(RTsFswArray newAppsList;
+ CleanupResetAndDestroyPushL(newAppsList);
+ CollectAppsL(newAppsList, wgList);
+ FitDataToList(newAppsList);
+ CleanupStack::PopAndDestroy(&newAppsList));
+
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Adds running apps to the list.
+ * @param appsList array to add to
+ */
+void CTsDataList::CollectAppsL(RTsFswArray& appsList,
+ const TArray<RWsSession::TWindowGroupChainInfo> &wgList)
+{
+ TInt offset(KErrNotFound);
+ for (TInt i = 0; i < wgList.Count(); ++i) {
+ TTsEntryKey key = TsEntryKeyGeneraror::GenerateL(wgList[i].iId, wgList);
+ //skip this entry if it is already on list
+ if (FindEntry(appsList, key) >= 0) {
+ continue;
+ }
+
+ // get window group name
+ CApaWindowGroupName* windowName = CApaWindowGroupName::NewLC(mResources.WsSession(), key.WindowGroupId());
+ TUid appUid = windowName->AppUid();
+
+ //Check hidden applications
+ if (KErrNotFound != (offset = mHiddenUids.Find(appUid))) {
+ UpdateLookupTableL(mHiddenUids, offset);
+ } else if (KErrNotFound != (offset = mAllowedUids.Find(appUid))) {
+ UpdateLookupTableL(mAllowedUids, offset);
+ AddEntryL(key, appUid, windowName, appsList);
+ } else if(VerifyApplicationL(appUid)) {
+ AddEntryL(key, appUid, windowName, appsList);
+ }
+ CleanupStack::PopAndDestroy(windowName);
+ }
+ CompressLookupTable(mHiddenUids);
+ CompressLookupTable(mAllowedUids);
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Called from CollectTasksL for each entry in the task list.
+ * @param key entry key
+ * @param appUid application uid
+ * @param wgName window group name or NULL
+ * @param newList list to add to
+ */
+void CTsDataList::AddEntryL(const TTsEntryKey& key, const TUid& appUid,
+ CApaWindowGroupName* wgName, RTsFswArray& newList)
+{
+ CTsEntry* entry = CTsEntry::NewLC(key, &mObserver);
+
+ // check if present in old list and if yes then take some of the old data
+ TBool found = ConsiderOldDataL(key);
+
+ // if not present previously then find out app name
+ // and check if screenshot is already available
+ if (!found) {
+ entry->SetAppUid(appUid);
+ HBufC* name = FindAppNameLC(wgName, appUid, key.WindowGroupId());
+ if (name) {
+ entry->SetAppNameL(*name);
+ }
+ CleanupStack::PopAndDestroy(name);
+
+ if (wgName) {
+ entry->SetCloseableApp(!wgName->IsSystem());
+ }
+ CFbsBitmap* iconBitmap = NULL;
+ CFbsBitmap* iconMask = NULL;
+ GetAppIconL(appUid, iconBitmap, iconMask);
+ //transfer ownership to entry
+ entry->SetAppIcon(iconBitmap, iconMask);
+ }
+
+ // add to new list, ownership is transferred
+ newList.AppendL(entry);
+ CleanupStack::Pop(entry);
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Checks if there is an entry for same app in the content list.
+ * If yes then it takes some of the data for the entry that
+ * will correspond to the same app in the refreshed content list.
+ * @param key new key in content list
+ * @return ETrue if app was found
+ */
+TBool CTsDataList::ConsiderOldDataL(const TTsEntryKey& key)
+{
+ for (TInt entryIdx = 0, oldCount = mData.Count(); entryIdx < oldCount; ++entryIdx) {
+ if (mData[entryIdx]->Key() == key) {
+ return ETrue;
+ }
+ }
+ return EFalse;
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Finds out the application name.
+ * @param windowName window group name or NULL
+ * @param appUId application uid
+ * @param wgId window group id
+ * @return application name, ownership transferred to caller
+ */
+HBufC* CTsDataList::FindAppNameLC(CApaWindowGroupName* windowName, const TUid& appUid, TInt wgId)
+{
+ //Retrieve the app name
+ TApaAppInfo info;
+ mResources.ApaSession().GetAppInfo(info, appUid);
+ TPtrC caption = info.iShortCaption;
+
+ HBufC* tempName = 0;
+ if (!caption.Length() && windowName) // if not set - use thread name instead
+ {
+ if (windowName->Caption().Length()) {
+ tempName = windowName->Caption().AllocL();
+ //put on cleanupstack after the if
+ }
+ else {
+ TThreadId threadId;
+ TInt err = mResources.WsSession().GetWindowGroupClientThreadId(wgId, threadId);
+ if (err == KErrNone) {
+ RThread thread;
+ CleanupClosePushL(thread);
+ err = thread.Open(threadId);
+ if (err == KErrNone) {
+ tempName = thread.Name().AllocL(); // codescanner::forgottoputptroncleanupstack
+ // tempName put on cleanupstack after the if
+ }
+ CleanupStack::PopAndDestroy(&thread);
+ }
+ }
+ }
+ else {
+ tempName = caption.AllocL();
+ //put on cleanupstack after the if
+ }
+ CleanupStack::PushL(tempName);
+ return tempName;
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Fit existing class contained data list into give one.
+ * Data is being changed with application type consideration that is based
+ * on aConsiderWidgets param.
+ * Function removes or add entries into data depend on given list.
+ * @param listToFit list with actual data
+ */
+void CTsDataList::FitDataToList(RTsFswArray& listToFit)
+{
+ TBool changed = EFalse;
+ TInt listCount = listToFit.Count();
+ TInt dataCount = mData.Count();
+
+ //remove items that dont't exists in newly collected list
+ for (TInt i = dataCount - 1; i >= 0; --i) {
+ if (!CheckIfExists(*mData[i], listToFit)) {
+ delete mData[i];
+ mData.Remove(i);
+ changed = ETrue;
+ }
+ }
+ RArray<TTsEntryKey> allKeys;
+
+ //add new item at start
+ for (TInt i = listToFit.Count() - 1; i >= 0; --i) {
+ allKeys.Insert(listToFit[i]->Key(), 0);
+ if (!CheckIfExists(*listToFit[i], mData)) {
+ mData.Insert(listToFit[i], 0);
+ listToFit[i] = 0;
+ changed = ETrue;
+ }
+ }
+ //establish order
+ TBool orderChanged = EstablishOrder(allKeys);
+ if (changed || orderChanged) {
+ mObserver.DataChanged();
+ }
+ allKeys.Close();
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Checks if there is an entry for same app in the given list.
+ * @param entry entry
+ * @param newList ref to list
+ * @return ETrue if app was found
+ */
+
+TBool CTsDataList::CheckIfExists(const CTsEntry& entry, const RTsFswArray& list) const
+{
+ TBool exists(EFalse);
+ TInt pos = FindEntry(list, entry.Key());
+ if (pos >= 0) {
+ exists = ETrue;
+ }
+ return exists;
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Retrieves the bitmap/mask for the icon of the given app.
+ * @param appUid application uid
+ * @param bitmapArg bitmap ptr, ownership transferred to caller, or NULL
+ * @param maskArg mask ptr, ownership transferred to caller, or NULL
+ */
+void CTsDataList::GetAppIconL(const TUid& aAppUid, CFbsBitmap*& bitmapArg, CFbsBitmap*& maskArg)
+{
+ bitmapArg = maskArg = NULL;
+
+ TSize size(KAppIconWidth, KAppIconHeight);
+ CApaMaskedBitmap* apaMaskedBitmap = CApaMaskedBitmap::NewLC();
+ TInt err = mResources.ApaSession().GetAppIcon(aAppUid, size, *apaMaskedBitmap);
+ TInt iconsCount(0);
+ if (err == KErrNone) {
+ err = mResources.ApaSession().NumberOfOwnDefinedIcons(aAppUid, iconsCount);
+ }
+
+ if ((err == KErrNone) && (iconsCount > 0)) {
+ bitmapArg = static_cast<CFbsBitmap*> (apaMaskedBitmap);
+ TInt maskHandle = apaMaskedBitmap->Mask()->Handle();
+ maskArg = new (ELeave) CFbsBitmap;
+ maskArg->Duplicate(maskHandle);
+ CleanupStack::Pop(apaMaskedBitmap);
+ }
+ else {
+ CleanupStack::PopAndDestroy(apaMaskedBitmap);
+ HBufC* fileNameFromApparc = NULL;
+ TInt err = mResources.ApaSession().GetAppIcon(aAppUid, fileNameFromApparc);
+ if (err == KErrNone) {
+ CleanupStack::PushL(fileNameFromApparc);
+ CFbsBitmap *bitamp(0);
+ CFbsBitmap *mask(0);
+ TInt bitmapIndex = 0;
+ TInt maskIndex = 1;
+ // it will change bitmap ids if it is mif (checking inside)
+ AknIconUtils::ValidateLogicalAppIconId(*fileNameFromApparc, bitmapIndex, maskIndex);
+ AknIconUtils::CreateIconLC(bitamp, mask, fileNameFromApparc->Des(), bitmapIndex,
+ maskIndex);
+
+ if (AknIconUtils::IsMifFile(*fileNameFromApparc)) {
+ AknIconUtils::DisableCompression(bitamp);
+ AknIconUtils::SetSize(bitamp, TSize(KAppIconWidth, KAppIconHeight),
+ EAspectRatioPreservedAndUnusedSpaceRemoved);
+ // bitmap and icon, AknsUtils::CreateIconLC doesn't specify the order
+ CleanupStack::Pop(2);
+ bitmapArg = bitamp;
+ maskArg = mask;
+ }
+ else {
+ CleanupStack::PopAndDestroy(2);
+ }
+ CleanupStack::PopAndDestroy(fileNameFromApparc);
+ }
+ }
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Checks if given uid is on hidden list
+ * @param aUid uid to be checked
+ * @return ETrue if uid is on hidden list
+ */
+TBool CTsDataList::IsHiddenUid(TUid uid)
+{
+ return mHiddenUids.Find(uid) >= 0 ? ETrue : EFalse;
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Finds entry in array
+ * @param list list to find
+ * @param key finding key
+ * @return position or KErrNotFound
+ */
+TInt CTsDataList::FindEntry(const RTsFswArray& list, const TTsEntryKey& key) const
+{
+ TInt pos(KErrNotFound);
+ for (TInt entryIdx = 0; entryIdx < list.Count(); ++entryIdx) {
+ if (list[entryIdx]->Key() == key) {
+ pos = entryIdx;
+ break;
+ }
+ }
+ return pos;
+}
+// --------------------------------------------------------------------------
+/**
+ * Set screenshot
+ */
+void CTsDataList::UpdateL(TInt key, const CFbsBitmap& data, TInt /*param*/, TInt priority)
+{
+ const TInt pos = FindEntry(mData, GenerateKeyL(key));
+ User::LeaveIfError(pos);
+ mData[pos]->SetScreenshotL(data, static_cast<UpdatePriority>(priority));
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Change visibility status
+ */
+void CTsDataList::UpdateL(TInt key, const Visibility& data, TInt /*param*/)
+{
+ const TInt pos = FindEntry(mData, GenerateKeyL(key));
+ User::LeaveIfError(pos);
+ data == mData[pos]->GetVisibility() ? User::Leave(KErrInUse) :
+ mData[pos]->SetVisibility(data);
+ mObserver.DataChanged();
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Removes screenshot
+ */
+void CTsDataList::RemoveL(TInt key, TInt /*param*/)
+{
+ TInt pos = FindEntry(mData, GenerateKeyL(key));
+ User::LeaveIfError(pos);
+ mData[pos]->RemoveScreenshotL();
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Establish entry order accridung to aKeyList, all keys MUST be in iData
+ * @param keyList reference key list
+ * @return ETrue if changes occured
+ */
+TBool CTsDataList::EstablishOrder(const RArray<TTsEntryKey>& keyList)
+{
+ TBool changed(EFalse);
+ __ASSERT_ALWAYS(mData.Count() == keyList.Count(), User::Panic(_L("EstablishOrder 1"), KErrBadHandle) );
+ for (TInt i = 0; i < keyList.Count(); i++) {
+ const TTsEntryKey& currentdataKey = mData[i]->Key();
+ const TTsEntryKey& referenceKey = keyList[i];
+ if (!(currentdataKey == referenceKey)) {
+ TInt foundPos = FindEntry(mData, referenceKey);
+ __ASSERT_ALWAYS(foundPos>=0, User::Panic(_L("EstablishOrder 2"), KErrBadHandle) );
+ CTsEntry* entry = mData[foundPos];
+ mData.Remove(foundPos);
+ mData.Insert(entry, i);
+ changed = ETrue;
+ }
+ }
+ return changed;
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Gets allowed uids, tries to filter non GUI application
+ */
+TBool CTsDataList::VerifyApplicationL(TUid uid)
+{
+ TBool retVal(EFalse);
+ TApaAppInfo appInfo;
+ TApaAppCapabilityBuf appCap;
+
+ User::LeaveIfError(mResources.ApaSession().GetAllApps(0));
+ // for every application get uid, hidden and missing attribute
+ // and add to aArray.
+ while (KErrNone == mResources.ApaSession().GetNextApp(appInfo)) {
+ User::LeaveIfError(mResources.ApaSession().GetAppCapability(appCap, appInfo.iUid));
+ if(!appCap().iAppIsHidden) {
+ if (uid == appInfo.iUid) {
+ retVal = ETrue;
+ mAllowedUids.InsertL(appInfo.iUid, mAllowedUids.Count());
+ }
+ } else if(KErrNotFound == mHiddenUids.Find(appInfo.iUid)) {
+ mHiddenUids.InsertL(appInfo.iUid, mHiddenUids.Count());
+ }
+ }
+ if (EFalse == retVal && KErrNotFound == mHiddenUids.Find(uid)) {
+ mHiddenUids.InsertL(uid, mHiddenUids.Count());
+ }
+ return retVal;
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Function generate task key using window group id
+ * @param wgId - window group id of running application
+ * @param entry key
+ */
+TTsEntryKey CTsDataList::GenerateKeyL(TInt wgId)
+{
+ RArray<RWsSession::TWindowGroupChainInfo> allWgIds;
+ CleanupClosePushL(allWgIds);
+ User::LeaveIfError(mResources.WsSession().WindowGroupList(0, &allWgIds));
+ const TTsEntryKey key(TsEntryKeyGeneraror::GenerateL(wgId, allWgIds.Array()));
+ CleanupStack::PopAndDestroy(&allWgIds);
+ return key;
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Analyse and compress lookup table id needed
+ * @param array - lookup table that has to be checked
+ *
+ */
+void CTsDataList::CompressLookupTable(RArray<TUid> &array)
+{
+ while(KMaxLookupSize < array.Count()) {
+ array.Remove(0);
+ }
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Change priority of an item in the lookup table
+ * @param array - look up table
+ * @param offset - index of an item in the table
+ */
+void CTsDataList::UpdateLookupTableL(RArray<TUid> &array, TInt offset)
+{
+ const TUid uid(array[offset]);
+ array.Remove(offset);
+ array.InsertL(uid, array.Count());
+}
+// end of file
--- a/tstaskmonitor/server/src/tsdatatask.cpp Fri Jun 11 16:13:51 2010 +0300
+++ b/tstaskmonitor/server/src/tsdatatask.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -25,9 +25,14 @@
{
switch(msg.Function()) {
case RegisterScreenshotMessage:
- TsDataTask::RegisterScreenshotL(dataStorage, msg); break;
+ TsDataTask::RegisterScreenshotL(dataStorage, msg);
+ break;
case UnregisterScreenshotMessage:
- TsDataTask::UnregisterScreenshotL(dataStorage, msg); break;
+ TsDataTask::UnregisterScreenshotL(dataStorage, msg);
+ break;
+ case VisibilityChange:
+ VisibilityChangeL(dataStorage, msg);
+ break;
}
msg.Complete(KErrNone);
@@ -61,3 +66,14 @@
dataStorage.RemoveL(wgId(), param());
}
+
+void TsDataTask::VisibilityChangeL(MTsDataStorage& dataStorage,
+ const RMessage2& msg)
+{
+ TPckgBuf<TInt> wgId, visibility, param;
+
+ msg.ReadL(0, wgId);
+ msg.ReadL(1, visibility);
+
+ dataStorage.UpdateL(wgId(), static_cast<Visibility>(visibility()), 0);
+}
--- a/tstaskmonitor/server/src/tsfswdatalist.cpp Fri Jun 11 16:13:51 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,493 +0,0 @@
-/*
- * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description: File containing application list classes
- *
- */
-
-//INCLUDES:
-
-#include "tsfswdatalist.h"
-#include "tsentrykeygenerator.h"
-#include <mmf/common/mmfcontrollerpluginresolver.h> // for CleanupResetAndDestroyPushL
-#include <apgwgnam.h>
-#include <bitstd.h>
-#include <AknIconUtils.h> // avkon
-#include <apgicnfl.h> // fbsbitmap
-#include <AknIconSrvClient.h>
-#include <fbs.h>
-#include <apgwgnam.h>
-
-
-// size for the created app icons
-const TInt KAppIconWidth = 128;
-const TInt KAppIconHeight = 128;
-
-//uids to be hidden
-const TUid KHsApplicationUid = { 0x20022F35 };
-
-const TInt KMaxLookupSize(75);
-
-// ================= MEMBER FUNCTIONS =======================
-
-// --------------------------------------------------------------------------
-// CTsFswDataList::NewL
-// --------------------------------------------------------------------------
-//
-CTsFswDataList* CTsFswDataList::NewL(MTsResourceManager& resources,
- MTsWindowGroupsMonitor &monitor,
- MHsDataObserver& observer)
-{
- CTsFswDataList* self = new (ELeave) CTsFswDataList(resources, monitor, observer);
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop(self);
- return self;
-}
-
-// --------------------------------------------------------------------------
-// CTsFswDataList::CTsFswDataList
-// --------------------------------------------------------------------------
-//
-CTsFswDataList::CTsFswDataList(MTsResourceManager& resources,
- MTsWindowGroupsMonitor &monitor,
- MHsDataObserver& observer)
-:
- CTsWindowGroupsObserver(monitor),
- mResources(resources),
- mObserver(observer)
-{
-}
-
-// --------------------------------------------------------------------------
-// CTsFswDataList::~CTsFswDataList
-// --------------------------------------------------------------------------
-//
-CTsFswDataList::~CTsFswDataList()
-{
- mData.ResetAndDestroy();
- mHiddenUids.Close();
- mAllowedUids.Close();
- RFbsSession::Disconnect();
- RAknIconSrvClient::Disconnect();
-}
-
-// --------------------------------------------------------------------------
-// CTsFswDataList::ConstructL
-// --------------------------------------------------------------------------
-//
-void CTsFswDataList::ConstructL()
-{
- BaseConstructL();
- mHiddenUids.AppendL(KHsApplicationUid);
- User::LeaveIfError(RFbsSession::Connect());
- RAknIconSrvClient::Connect();
-}
-
-// --------------------------------------------------------------------------
-// CTsFswDataList::FswDataL
-// --------------------------------------------------------------------------
-//
-const RTsFswArray& CTsFswDataList::FswDataL()
-{
- return mData;
-}
-
-// --------------------------------------------------------------------------
-// CTsFswDataList::CollectTasksL
-// --------------------------------------------------------------------------
-//
-void CTsFswDataList::HandleWindowGroupChanged(MTsResourceManager &,
- const TArray<RWsSession::TWindowGroupChainInfo> &wgList)
-{
- TRAP_IGNORE(RTsFswArray newAppsList;
- CleanupResetAndDestroyPushL(newAppsList);
- CollectAppsL(newAppsList, wgList);
- FitDataToList(newAppsList);
- CleanupStack::PopAndDestroy(&newAppsList));
-
-}
-
-// --------------------------------------------------------------------------
-// CTsFswDataList::
-// --------------------------------------------------------------------------
-//
-void CTsFswDataList::CollectAppsL(RTsFswArray& appsList,
- const TArray<RWsSession::TWindowGroupChainInfo> &wgList)
-{
- TInt offset(KErrNotFound);
- for (TInt i = 0; i < wgList.Count(); ++i) {
- TTsEntryKey key = TsEntryKeyGeneraror::GenerateL(wgList[i].iId, wgList);
- //skip this entry if it is already on list
- if (FindEntry(appsList, key) >= 0) {
- continue;
- }
-
- // get window group name
- TInt wgId = key.mParentId;
- CApaWindowGroupName* windowName = CApaWindowGroupName::NewLC(mResources.WsSession(), wgId);
- TUid appUid = windowName->AppUid();
-
- //Check hidden applications
- if (KErrNotFound != (offset = mHiddenUids.Find(appUid))) {
- UpdateLookupTableL(mHiddenUids, offset);
- } else if (KErrNotFound != (offset = mAllowedUids.Find(appUid))) {
- UpdateLookupTableL(mAllowedUids, offset);
- AddEntryL(key, appUid, windowName, appsList);
- } else if(VerifyApplicationL(appUid)) {
- AddEntryL(key, appUid, windowName, appsList);
- }
- CleanupStack::PopAndDestroy(windowName);
- }
- CompressLookupTable(mHiddenUids);
- CompressLookupTable(mAllowedUids);
-}
-
-// --------------------------------------------------------------------------
-// CTsFswDataList::AddEntryL
-// --------------------------------------------------------------------------
-//
-void CTsFswDataList::AddEntryL(const TTsEntryKey& key, const TUid& appUid,
- CApaWindowGroupName* wgName, RTsFswArray& newList)
-{
- CTsFswEntry* entry = CTsFswEntry::NewLC(key, &mObserver);
-
- // check if present in old list and if yes then take some of the old data
- TBool found = ConsiderOldDataL(key);
-
- // if not present previously then find out app name
- // and check if screenshot is already available
- if (!found) {
- entry->SetAppUid(appUid);
- HBufC* name = FindAppNameLC(wgName, appUid, key.mParentId);
- if (name) {
- entry->SetAppNameL(*name);
- }
- CleanupStack::PopAndDestroy(name);
-
- if (wgName) {
- entry->SetCloseableApp(!wgName->IsSystem());
- }
- CFbsBitmap* iconBitmap = NULL;
- CFbsBitmap* iconMask = NULL;
- GetAppIconL(appUid, iconBitmap, iconMask);
- //transfer ownership to entry
- entry->SetAppIcon(iconBitmap, iconMask);
- }
-
- // add to new list, ownership is transferred
- newList.AppendL(entry);
- CleanupStack::Pop(entry);
-}
-
-// --------------------------------------------------------------------------
-// CTsFswDataList::ConsiderOldDataL
-// --------------------------------------------------------------------------
-//
-TBool CTsFswDataList::ConsiderOldDataL(const TTsEntryKey& key)
-{
- for (TInt entryIdx = 0, oldCount = mData.Count(); entryIdx < oldCount; ++entryIdx) {
- if (mData[entryIdx]->Key() == key) {
- return ETrue;
- }
- }
- return EFalse;
-}
-
-// --------------------------------------------------------------------------
-// CTsFswDataList::FindAppNameLC
-// --------------------------------------------------------------------------
-//
-HBufC* CTsFswDataList::FindAppNameLC(CApaWindowGroupName* windowName, const TUid& appUid, TInt wgId)
-{
- //Retrieve the app name
- TApaAppInfo info;
- mResources.ApaSession().GetAppInfo(info, appUid);
- TPtrC caption = info.iShortCaption;
-
- HBufC* tempName = 0;
- if (!caption.Length() && windowName) // if not set - use thread name instead
- {
- if (windowName->Caption().Length()) {
- tempName = windowName->Caption().AllocL();
- //put on cleanupstack after the if
- }
- else {
- TThreadId threadId;
- TInt err = mResources.WsSession().GetWindowGroupClientThreadId(wgId, threadId);
- if (err == KErrNone) {
- RThread thread;
- CleanupClosePushL(thread);
- err = thread.Open(threadId);
- if (err == KErrNone) {
- tempName = thread.Name().AllocL(); // codescanner::forgottoputptroncleanupstack
- // tempName put on cleanupstack after the if
- }
- CleanupStack::PopAndDestroy(&thread);
- }
- }
- }
- else {
- tempName = caption.AllocL();
- //put on cleanupstack after the if
- }
- CleanupStack::PushL(tempName);
- return tempName;
-}
-
-// --------------------------------------------------------------------------
-// CTsFswDataList::FitDataToListL
-// --------------------------------------------------------------------------
-//
-void CTsFswDataList::FitDataToList(RTsFswArray& listToFit)
-{
- TBool changed = EFalse;
- TInt listCount = listToFit.Count();
- TInt dataCount = mData.Count();
-
- //remove items that dont't exists in newly collected list
- for (TInt i = dataCount - 1; i >= 0; --i) {
- if (!CheckIfExists(*mData[i], listToFit)) {
- delete mData[i];
- mData.Remove(i);
- changed = ETrue;
- }
- }
- RArray<TTsEntryKey> allKeys;
-
- //add new item at start
- for (TInt i = listToFit.Count() - 1; i >= 0; --i) {
- allKeys.Insert(listToFit[i]->Key(), 0);
- if (!CheckIfExists(*listToFit[i], mData)) {
- mData.Insert(listToFit[i], 0);
- listToFit[i] = 0;
- changed = ETrue;
- }
- }
- //establish order
- TBool orderChanged = EstablishOrder(allKeys);
- if (changed || orderChanged) {
- mObserver.DataChanged();
- }
- allKeys.Close();
-}
-
-// --------------------------------------------------------------------------
-// CTsFswDataList::CheckIfExists
-// --------------------------------------------------------------------------
-//
-TBool CTsFswDataList::CheckIfExists(const CTsFswEntry& entry, const RTsFswArray& list) const
-{
- TBool exists(EFalse);
- TTsEntryKey key;
- TInt pos = FindEntry(list, entry.Key());
- if (pos >= 0) {
- exists = ETrue;
- }
- return exists;
-}
-
-// --------------------------------------------------------------------------
-// CTsFswDataList::GetAppIconL
-// --------------------------------------------------------------------------
-//
-void CTsFswDataList::GetAppIconL(const TUid& aAppUid, CFbsBitmap*& bitmapArg, CFbsBitmap*& maskArg)
-{
- bitmapArg = maskArg = NULL;
-
- TSize size(KAppIconWidth, KAppIconHeight);
- CApaMaskedBitmap* apaMaskedBitmap = CApaMaskedBitmap::NewLC();
- TInt err = mResources.ApaSession().GetAppIcon(aAppUid, size, *apaMaskedBitmap);
- TInt iconsCount(0);
- if (err == KErrNone) {
- err = mResources.ApaSession().NumberOfOwnDefinedIcons(aAppUid, iconsCount);
- }
-
- if ((err == KErrNone) && (iconsCount > 0)) {
- bitmapArg = static_cast<CFbsBitmap*> (apaMaskedBitmap);
- TInt maskHandle = apaMaskedBitmap->Mask()->Handle();
- maskArg = new (ELeave) CFbsBitmap;
- maskArg->Duplicate(maskHandle);
- CleanupStack::Pop(apaMaskedBitmap);
- }
- else {
- CleanupStack::PopAndDestroy(apaMaskedBitmap);
- HBufC* fileNameFromApparc = NULL;
- TInt err = mResources.ApaSession().GetAppIcon(aAppUid, fileNameFromApparc);
- if (err == KErrNone) {
- CleanupStack::PushL(fileNameFromApparc);
- CFbsBitmap *bitamp(0);
- CFbsBitmap *mask(0);
- TInt bitmapIndex = 0;
- TInt maskIndex = 1;
- // it will change bitmap ids if it is mif (checking inside)
- AknIconUtils::ValidateLogicalAppIconId(*fileNameFromApparc, bitmapIndex, maskIndex);
- AknIconUtils::CreateIconLC(bitamp, mask, fileNameFromApparc->Des(), bitmapIndex,
- maskIndex);
-
- if (AknIconUtils::IsMifFile(*fileNameFromApparc)) {
- AknIconUtils::DisableCompression(bitamp);
- AknIconUtils::SetSize(bitamp, TSize(KAppIconWidth, KAppIconHeight),
- EAspectRatioPreservedAndUnusedSpaceRemoved);
- // bitmap and icon, AknsUtils::CreateIconLC doesn't specify the order
- CleanupStack::Pop(2);
- bitmapArg = bitamp;
- maskArg = mask;
- }
- else {
- CleanupStack::PopAndDestroy(2);
- }
- CleanupStack::PopAndDestroy(fileNameFromApparc);
- }
- }
-}
-
-// --------------------------------------------------------------------------
-// CTsFswDataList::GetAppIconL
-// --------------------------------------------------------------------------
-//
-TBool CTsFswDataList::IsHiddenUid(TUid uid)
-{
- TInt result = mHiddenUids.Find(uid);
- return result >= 0 ? ETrue : EFalse;
-}
-
-// --------------------------------------------------------------------------
-// CTsFswDataList::FindEntry
-// --------------------------------------------------------------------------
-//
-TInt CTsFswDataList::FindEntry(const RTsFswArray& list, const TTsEntryKey& key) const
-{
- TInt pos(KErrNotFound);
- TInt dataCount = list.Count();
- for (TInt entryIdx = 0; entryIdx < dataCount; ++entryIdx) {
- if (list[entryIdx]->Key() == key) {
- pos = entryIdx;
- break;
- }
- }
- return pos;
-}
-
-// --------------------------------------------------------------------------
-// CTsFswDataList::SetScreenshotL
-// --------------------------------------------------------------------------
-//
-void CTsFswDataList::SetScreenshotL(const CFbsBitmap* bitmap, UpdatePriority priority, TInt wgId)
-{
- TInt pos = FindEntry(mData, GenerateKeyL(wgId));
- User::LeaveIfError(pos);
- mData[pos]->SetScreenshotL(bitmap, priority);
-}
-
-// --------------------------------------------------------------------------
-// CTsFswDataList::RemoveScreenshotL
-// --------------------------------------------------------------------------
-//
-void CTsFswDataList::RemoveScreenshotL(TInt wgId)
-{
-
- TInt pos = FindEntry(mData, GenerateKeyL(wgId));
- User::LeaveIfError(pos);
- mData[pos]->RemoveScreenshotL();
-}
-
-// --------------------------------------------------------------------------
-// CTsFswDataList::EstablishOrder
-// --------------------------------------------------------------------------
-//
-TBool CTsFswDataList::EstablishOrder(const RArray<TTsEntryKey>& keyList)
-{
- TBool changed(EFalse);
- __ASSERT_ALWAYS(mData.Count() == keyList.Count(), User::Panic(_L("EstablishOrder 1"), KErrBadHandle) );
- for (TInt i = 0; i < keyList.Count(); i++) {
- const TTsEntryKey& currentdataKey = mData[i]->Key();
- const TTsEntryKey& referenceKey = keyList[i];
- if (!(currentdataKey == referenceKey)) {
- TInt foundPos = FindEntry(mData, referenceKey);
- __ASSERT_ALWAYS(foundPos>=0, User::Panic(_L("EstablishOrder 2"), KErrBadHandle) );
- CTsFswEntry* entry = mData[foundPos];
- mData.Remove(foundPos);
- mData.Insert(entry, i);
- changed = ETrue;
- }
- }
- return changed;
-}
-
-// --------------------------------------------------------------------------
-// CTsFswDataList::GetAllowedUidsL
-// --------------------------------------------------------------------------
-//
-TBool CTsFswDataList::VerifyApplicationL(TUid uid)
-{
- TBool retVal(EFalse);
- TApaAppInfo appInfo;
- TApaAppCapabilityBuf appCap;
-
- User::LeaveIfError(mResources.ApaSession().GetAllApps(0));
- // for every application get uid, hidden and missing attribute
- // and add to aArray.
- while (KErrNone == mResources.ApaSession().GetNextApp(appInfo)) {
- User::LeaveIfError(mResources.ApaSession().GetAppCapability(appCap, appInfo.iUid));
- if(!appCap().iAppIsHidden) {
- if (uid == appInfo.iUid) {
- retVal = ETrue;
- mAllowedUids.InsertL(appInfo.iUid, mAllowedUids.Count());
- }
- } else if(KErrNotFound == mHiddenUids.Find(appInfo.iUid)) {
- mHiddenUids.InsertL(appInfo.iUid, mHiddenUids.Count());
- }
- }
- if (EFalse == retVal && KErrNotFound == mHiddenUids.Find(uid)) {
- mHiddenUids.InsertL(uid, mHiddenUids.Count());
- }
- return retVal;
-}
-
-// --------------------------------------------------------------------------
-// CTsFswDataList::GenerateKeyL(TInt)
-// --------------------------------------------------------------------------
-//
-TTsEntryKey CTsFswDataList::GenerateKeyL(TInt wgId)
-{
- RArray<RWsSession::TWindowGroupChainInfo> allWgIds;
- CleanupClosePushL(allWgIds);
- User::LeaveIfError(mResources.WsSession().WindowGroupList(0, &allWgIds));
- const TTsEntryKey key = TsEntryKeyGeneraror::GenerateL(wgId, allWgIds.Array());
- CleanupStack::PopAndDestroy(&allWgIds);
- return key;
-}
-
-// --------------------------------------------------------------------------
-// CTsFswDataList::CompressLookupTable(RArray<TUid> &)
-// --------------------------------------------------------------------------
-//
-void CTsFswDataList::CompressLookupTable(RArray<TUid> &array)
-{
- while(KMaxLookupSize < array.Count()) {
- array.Remove(0);
- }
-}
-
-// --------------------------------------------------------------------------
-// CTsFswDataList::UpdateLookupTableL(RArray<TUid> &, TInt)
-// --------------------------------------------------------------------------
-//
-void CTsFswDataList::UpdateLookupTableL(RArray<TUid> &array, TInt offset)
-{
- const TUid uid(array[offset]);
- array.Remove(offset);
- array.InsertL(uid, array.Count());
-}
-// end of file
--- a/tstaskmonitor/server/src/tsrunningappstorage.cpp Fri Jun 11 16:13:51 2010 +0300
+++ b/tstaskmonitor/server/src/tsrunningappstorage.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -15,8 +15,8 @@
*
*/
#include "tsrunningappstorage.h"
-#include "tsfswdatalist.h"
-#include "tsfswentry.h"
+#include "tsdatalist.h"
+#include "tsentry.h"
#include <s32strm.h>
#include <s32mem.h>
// -----------------------------------------------------------------------------
@@ -60,7 +60,7 @@
void CRunningAppStorage::ConstructL(MTsResourceManager& resources,
MTsWindowGroupsMonitor &wsMonitor)
{
- mEngine = CTsFswDataList::NewL(resources, wsMonitor, *this) ;
+ mEngine = CTsDataList::NewL(resources, wsMonitor, *this) ;
RArray<RWsSession::TWindowGroupChainInfo> wgList;
CleanupClosePushL(wgList);
User::LeaveIfError(resources.WsSession().WindowGroupList(&wgList));
@@ -97,41 +97,43 @@
//
void CRunningAppStorage::DataChangedL()
{
- RTsFswArray taskList = mEngine->FswDataL();
- CTsFswEntry* entry = CTsFswEntry::NewLC();
- // Create a dynamic flat buffer to hold this object’s member data
-
const TInt KExpandSize = 256; // "Granularity" of dynamic buffer
CBufFlat* buf = CBufFlat::NewL(KExpandSize);
CleanupStack::PushL(buf);
RBufWriteStream stream(*buf);
CleanupClosePushL(stream);
- entry->ExternalizeArrayL(stream, taskList);
+ CTsEntry::ExternalizeArrayL(stream, mEngine->Data());
CleanupStack::PopAndDestroy(&stream);
mData.Close();
mData.CreateL( buf->Size() );
buf->Read(0, mData, buf->Size());
-
-
CleanupStack::PopAndDestroy(buf);
- CleanupStack::PopAndDestroy(entry);
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
-void CRunningAppStorage::UpdateL(TInt key, const CFbsBitmap& data, TInt /*param*/, TInt priority)
- {
- UpdatePriority newpriority = static_cast<UpdatePriority>(priority);
- mEngine->SetScreenshotL(&data, newpriority, key);
- }
+void CRunningAppStorage::UpdateL(TInt key, const CFbsBitmap& data, TInt param, TInt priority)
+{
+ mEngine->UpdateL(key, data, param, priority);
+
+}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
-void CRunningAppStorage::RemoveL(TInt key, TInt /*param*/)
- {
- mEngine->RemoveScreenshotL(key);
- }
+void CRunningAppStorage::UpdateL(TInt key, const Visibility& data, TInt param)
+{
+ mEngine->UpdateL(key, data, param);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CRunningAppStorage::RemoveL(TInt key, TInt param)
+{
+ mEngine->RemoveL(key, param);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/utils/inc/tsentry.h Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,126 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Task list entry
+ *
+*/
+
+
+#ifndef TSENTRY_H
+#define TSENTRY_H
+
+#include <e32base.h>
+#include <e32cmn.h>
+#include <tsgraphicfilescalinghandler.h>
+
+#include "tsentrykey.h"
+#include "tstaskmonitorglobals.h"
+
+class CTsEntry;
+class RReadStream;
+class RWriteStream;
+class CFbsBitmap;
+class MHsDataObserver;
+
+typedef RPointerArray<CTsEntry> RTsFswArray;
+
+enum TAppType
+{
+ EApp = 0,
+ EWidget,
+ EJava
+};
+
+/**
+ * An entry in the task list.
+ */
+NONSHARABLE_CLASS( CTsEntry ) : public CBase,
+ private MImageReadyCallBack
+ {
+public:
+ static CTsEntry* NewL();
+
+ static CTsEntry* NewLC();
+
+ static CTsEntry* NewL(const TTsEntryKey& key, MHsDataObserver* observer =0);
+
+ static CTsEntry* NewLC(const TTsEntryKey& key, MHsDataObserver* observer =0);
+
+ ~CTsEntry();
+
+ TUid AppUid() const;
+
+ TAppType Type() const;
+
+ const TDesC& AppName() const;
+
+ TBool CloseableApp() const;
+
+ Visibility GetVisibility() const;
+
+ void SetVisibility(Visibility visibility);
+
+ CFbsBitmap* AppIconBitmap() const;
+
+ CFbsBitmap* AppIconMask() const;
+
+ CFbsBitmap* Screenshot() const;
+
+ UpdatePriority Priority() const;
+
+ const TTsEntryKey& Key() const;
+
+ void SetAppUid( const TUid& uid );
+
+ void SetAppNameL( const TDesC& appName );
+
+ void SetCloseableApp( TBool value );
+
+ void SetScreenshotL(const CFbsBitmap& bitmap, UpdatePriority priority);
+
+ void RemoveScreenshotL();
+
+ void SetAppIcon( CFbsBitmap* aBitmap, CFbsBitmap* aMask );
+
+ void ExternalizeL( RWriteStream& aStream ) const;
+
+ void InternalizeL( RReadStream& aStream );
+
+ static void ExternalizeArrayL( RWriteStream& stream,
+ const RTsFswArray& array );
+
+ static void InternalizeArrayL( RReadStream& stream,
+ RTsFswArray& array );
+
+private:
+ CTsEntry();
+
+ CTsEntry(const TTsEntryKey& aKey, MHsDataObserver* observer);
+
+ void ImageReadyCallBack(TInt error, const CFbsBitmap *bitmap );
+
+private:
+ TUid mAppUid;
+ HBufC* mAppName;
+ TBool mCloseableApp;
+ Visibility mVisibility;
+ CFbsBitmap* mAppIconBitmap;
+ CFbsBitmap* mAppIconMask;
+ CFbsBitmap* mScreenshot;
+ TTsEntryKey mKey;
+ UpdatePriority mPriority;
+ MHsDataObserver* mObserver;
+ CTsGraphicFileScalingHandler* mImgTool;
+ };
+
+#endif
--- a/tstaskmonitor/utils/inc/tsentrykey.h Fri Jun 11 16:13:51 2010 +0300
+++ b/tstaskmonitor/utils/inc/tsentrykey.h Thu Jun 24 16:18:29 2010 +0300
@@ -28,10 +28,11 @@
public:
TTsEntryKey(TInt parentId =0);
TBool operator ==(const TTsEntryKey& key) const;
- void ExternalizeL(RWriteStream& output);
+ void ExternalizeL(RWriteStream& output) const;
void InternalizeL(RReadStream& input);
+ TInt WindowGroupId() const;
-public:
+private:
TInt mParentId;
};
--- a/tstaskmonitor/utils/inc/tsfswentry.h Fri Jun 11 16:13:51 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,149 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Task list entry
- *
-*/
-
-
-#ifndef TSFSWENTRY_H
-#define TSFSWENTRY_H
-
-#include <e32base.h>
-#include <e32cmn.h>
-#include <tsgraphicfilescalinghandler.h>
-
-#include "tsentrykey.h"
-#include "tstaskmonitorglobals.h"
-
-class CTsFswEntry;
-class RReadStream;
-class RWriteStream;
-class CFbsBitmap;
-class MHsDataObserver;
-
-typedef RPointerArray<CTsFswEntry> RTsFswArray;
-
-enum TAppType
-{
- EApp = 0,
- EWidget,
- EJava
-};
-
-/**
- * An entry in the task list.
- */
-NONSHARABLE_CLASS( CTsFswEntry ) : public CBase,
- private MImageReadyCallBack
- {
-public:
- static CTsFswEntry* NewL();
- static CTsFswEntry* NewLC();
-
- static CTsFswEntry* NewL(const TTsEntryKey& key, MHsDataObserver* observer =0);
- static CTsFswEntry* NewLC(const TTsEntryKey& key, MHsDataObserver* observer =0);
-
- ~CTsFswEntry();
-
- /**
- * Window group id.
- * In case of wrt widgets this is negative and is not a valid window group id.
- * Use this when calling CloseApp or SwitchToApp. (these work with widgets too)
- */
- TInt WgId() const;
-
- /**
- * Application uid.
- */
- TUid AppUid() const;
-
- /**
- * Application type.
- */
- TAppType Type() const;
-
- /**
- * Application name.
- */
- const TDesC& AppName() const;
-
- /**
- * ETrue if the application is closeable
- */
- TBool CloseableApp() const;
-
- /**
- * Application icon bitmap
- */
- CFbsBitmap* AppIconBitmap() const;
-
- /**
- * Application icon mask.
- */
- CFbsBitmap* AppIconMask() const;
-
- /**
- * Application screenshot.
- */
- CFbsBitmap* Screenshot() const;
-
- /**
- * Priority.
- */
- UpdatePriority Priority() const;
-
- /**
- * Entry's key
- */
- const TTsEntryKey& Key() const;
-
-
- void SetWgId( TInt wgId );
- void SetAppUid( const TUid& uid );
- void SetAppNameL( const TDesC& appName );
- void SetCloseableApp( TBool value );
- void SetScreenshotL(const CFbsBitmap* bitmap, UpdatePriority priority);
- void RemoveScreenshotL();
-
- // takes ownership of bitmaps
- void SetAppIcon( CFbsBitmap* aBitmap, CFbsBitmap* aMask );
- void ExternalizeL( RWriteStream& aStream );
- void InternalizeL( RReadStream& aStream );
-
- static void ExternalizeArrayL( RWriteStream& aStream,
- const RTsFswArray& aArray );
- static void InternalizeArrayL( RReadStream& aStream,
- RTsFswArray& aArray );
-
-private:
- //constructors
- CTsFswEntry();
- CTsFswEntry(const TTsEntryKey& aKey, MHsDataObserver* observer);
- void ImageReadyCallBack(TInt error, const CFbsBitmap *bitmap );
-
-private:
- TInt mWgId;
- TUid mAppUid;
- HBufC* mAppName;
- TBool mCloseableApp;
- CFbsBitmap* mAppIconBitmap;
- CFbsBitmap* mAppIconMask;
- CFbsBitmap* mScreenshot;
- TTsEntryKey mKey;
- UpdatePriority mPriority;
- MHsDataObserver* mObserver;
- CTsGraphicFileScalingHandler* mImgTool;
- };
-
-#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tstaskmonitor/utils/src/tsentry.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -0,0 +1,409 @@
+/*
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Task list entry
+ *
+ */
+
+#define __E32SVR_H__
+#include <s32strm.h>
+#include <fbs.h>
+#include "tsentry.h"
+#include "tsdataobserver.h"
+
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::NewL
+// --------------------------------------------------------------------------
+//
+CTsEntry* CTsEntry::NewL()
+{
+ CTsEntry* self = NewLC();
+ CleanupStack::Pop(self);
+ return self;
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::NewLC
+// --------------------------------------------------------------------------
+//
+CTsEntry* CTsEntry::NewLC()
+{
+ CTsEntry* self = new (ELeave) CTsEntry;
+ CleanupStack::PushL(self);
+ return self;
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::NewL
+// --------------------------------------------------------------------------
+//
+CTsEntry* CTsEntry::NewL(const TTsEntryKey& key, MHsDataObserver *observer)
+{
+ CTsEntry* self = NewLC(key, observer);
+ CleanupStack::Pop(self);
+ return self;
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::NewLC
+// --------------------------------------------------------------------------
+//
+CTsEntry* CTsEntry::NewLC(const TTsEntryKey& key, MHsDataObserver* observer)
+{
+ CTsEntry* self = new (ELeave) CTsEntry(key, observer);
+ CleanupStack::PushL(self);
+ return self;
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::~CTsFswEntry
+// --------------------------------------------------------------------------
+//
+CTsEntry::~CTsEntry()
+{
+ delete mAppName;
+ delete mAppIconBitmap;
+ delete mAppIconMask;
+ delete mScreenshot;
+ delete mImgTool;
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::CTsFswEntry
+// --------------------------------------------------------------------------
+//
+CTsEntry::CTsEntry() :
+ mVisibility(Visible),
+ mPriority(Low)
+{
+ mKey = TTsEntryKey();
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::CTsFswEntry
+// --------------------------------------------------------------------------
+//
+CTsEntry::CTsEntry(const TTsEntryKey& key, MHsDataObserver *observer)
+:
+ mVisibility(Visible),
+ mKey(key),
+ mPriority(Low),
+ mObserver(observer)
+{
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::SetAppUid
+// --------------------------------------------------------------------------
+//
+void CTsEntry::SetAppUid(const TUid& uid)
+{
+ mAppUid = uid;
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::SetAppNameL
+// --------------------------------------------------------------------------
+//
+void CTsEntry::SetAppNameL(const TDesC& appName)
+{
+ delete mAppName;
+ mAppName = 0;
+ mAppName = appName.AllocL();
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::SetSystemApp
+// --------------------------------------------------------------------------
+//
+void CTsEntry::SetCloseableApp(TBool value)
+{
+ mCloseableApp = value;
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::SetAppIconHandles
+// --------------------------------------------------------------------------
+//
+void CTsEntry::SetAppIcon(CFbsBitmap* bitmap, CFbsBitmap* mask)
+{
+ mAppIconBitmap = bitmap;
+ mAppIconMask = mask;
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Application uid.
+ */
+TUid CTsEntry::AppUid() const
+{
+ return mAppUid;
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Application name.
+ */
+const TDesC& CTsEntry::AppName() const
+{
+ return mAppName ? *mAppName : KNullDesC();
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Retrieve entry visibilit status
+ */
+Visibility CTsEntry::GetVisibility() const
+{
+ return mVisibility;
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Change entry visibility status
+ * @param visibility - new visibility status
+ */
+void CTsEntry::SetVisibility(Visibility visibility)
+{
+ mVisibility = visibility;
+}
+
+// --------------------------------------------------------------------------
+/**
+ * ETrue if the application is closeable
+ */
+TBool CTsEntry::CloseableApp() const
+{
+ return mCloseableApp;
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Application icon bitmap
+ */
+CFbsBitmap* CTsEntry::AppIconBitmap() const
+{
+ return mAppIconBitmap;
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Application icon mask.
+ */
+CFbsBitmap* CTsEntry::AppIconMask() const
+{
+ return mAppIconMask;
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Entry's key
+ */
+const TTsEntryKey& CTsEntry::Key() const
+{
+ return mKey;
+}
+// --------------------------------------------------------------------------
+// CTsFswEntry::ExternalizeL
+// --------------------------------------------------------------------------
+//
+void CTsEntry::ExternalizeL(RWriteStream& stream) const
+{
+ stream.WriteInt32L(mAppUid.iUid);
+ stream << AppName();
+ stream.WriteInt32L(mCloseableApp);
+ if (mAppIconBitmap) {
+ stream.WriteInt32L(mAppIconBitmap->Handle());
+ }
+ else {
+ stream.WriteInt32L(KErrNotFound);
+ }
+
+ if (mAppIconMask) {
+ stream.WriteInt32L(mAppIconMask->Handle());
+ }
+ else {
+ stream.WriteInt32L(KErrNotFound);
+ }
+
+ if (mScreenshot) {
+ stream.WriteInt32L(mScreenshot->Handle());
+ }
+ else {
+ stream.WriteInt32L(KErrNotFound);
+ }
+
+ mKey.ExternalizeL(stream);
+ TInt currentPriority = static_cast<TInt> (mPriority);
+ stream.WriteInt32L(currentPriority);
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::InternalizeL
+// --------------------------------------------------------------------------
+//
+void CTsEntry::InternalizeL(RReadStream& stream)
+{
+
+ mAppUid = TUid::Uid(stream.ReadInt32L());
+ delete mAppName;
+ mAppName = NULL;
+ mAppName = HBufC::NewL(stream, KMaxTInt);
+ mCloseableApp = stream.ReadInt32L();
+ TInt appIconBitmapHandle = stream.ReadInt32L();
+ TInt appIconMaskHandle = stream.ReadInt32L();
+ TInt screenshotHandle = stream.ReadInt32L();
+ if (appIconBitmapHandle != KErrNotFound) {
+ mAppIconBitmap = new (ELeave) CFbsBitmap;
+ mAppIconBitmap->Duplicate(appIconBitmapHandle);
+ }
+ if (appIconMaskHandle != KErrNotFound) {
+ mAppIconMask = new (ELeave) CFbsBitmap;
+ mAppIconMask->Duplicate(appIconMaskHandle);
+ }
+ if (screenshotHandle != KErrNotFound) {
+ mScreenshot = new (ELeave) CFbsBitmap;
+ mScreenshot->Duplicate(screenshotHandle);
+ }
+ mKey.InternalizeL(stream);
+ TInt currentPriority = stream.ReadInt32L();
+ mPriority = static_cast<UpdatePriority> (currentPriority);
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::ExternalizeArrayL
+// --------------------------------------------------------------------------
+//
+void CTsEntry::ExternalizeArrayL(RWriteStream& stream, const RTsFswArray& array)
+{
+ TInt iter(0);
+ RArray<TInt> visibleItems(array.Count() ? array.Count() : 1);
+ CleanupClosePushL(visibleItems);
+ for (iter = 0; iter < array.Count(); ++iter) {
+ if (Visible == array[iter]->GetVisibility()) {
+ visibleItems.AppendL(iter);
+ }
+ }
+ stream.WriteInt32L(visibleItems.Count());
+ for (iter = 0; iter < visibleItems.Count(); ++iter) {
+ array[visibleItems[iter]]->ExternalizeL(stream);
+ }
+ CleanupStack::PopAndDestroy(&visibleItems);
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::InternalizeArrayL
+// --------------------------------------------------------------------------
+//
+void CTsEntry::InternalizeArrayL(RReadStream& stream, RTsFswArray& array)
+{
+ array.ResetAndDestroy();
+ TInt count = stream.ReadInt32L();
+ for (TInt i = 0; i < count; ++i) {
+ CTsEntry* entry = CTsEntry::NewLC();
+ entry->InternalizeL(stream);
+ array.AppendL(entry);
+ CleanupStack::Pop(entry);
+ }
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Application type.
+ */
+TAppType CTsEntry::Type() const
+{
+ return EApp;
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::SetScreenshot
+// --------------------------------------------------------------------------
+//
+void CTsEntry::SetScreenshotL(const CFbsBitmap& bitmapArg, UpdatePriority priority)
+{
+ TInt currentPriority = static_cast<TInt> (mPriority);
+ TInt newPriority = static_cast<TInt> (priority);
+ if(newPriority <currentPriority) {
+ User::Leave(KErrAccessDenied);
+ }
+
+ CFbsBitmap* bitmap = new (ELeave) CFbsBitmap;
+ CleanupStack::PushL(bitmap);
+ User::LeaveIfError(bitmap->Duplicate(bitmapArg.Handle()));
+ CleanupStack::Pop(bitmap);
+
+ mPriority = priority;
+ delete mScreenshot;
+ mScreenshot = bitmap;
+
+ delete mImgTool;
+ mImgTool = 0;
+
+ mImgTool = CTsGraphicFileScalingHandler::NewL(*this, *mScreenshot, TSize(128, 128),
+ CTsGraphicFileScalingHandler::EKeepAspectRatioByExpanding);
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::RemoveScreenshot
+// --------------------------------------------------------------------------
+//
+void CTsEntry::RemoveScreenshotL()
+{
+ if (!mScreenshot) {
+ User::Leave(KErrNotFound);
+ }
+ delete mScreenshot;
+ mScreenshot = NULL;
+ mPriority = Low;
+ if (mObserver) {
+ mObserver->DataChanged();
+ }
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Application screenshot.
+ */
+CFbsBitmap* CTsEntry::Screenshot() const
+{
+ return mScreenshot;
+}
+
+// --------------------------------------------------------------------------
+/**
+ * Priority.
+ */
+UpdatePriority CTsEntry::Priority() const
+{
+ return mPriority;
+}
+
+// --------------------------------------------------------------------------
+// CTsFswEntry::Priority
+// --------------------------------------------------------------------------
+//
+void CTsEntry::ImageReadyCallBack(TInt error, const CFbsBitmap *bitmap)
+{
+ if (KErrNone == error && 0 != bitmap) {
+ mScreenshot->Reset();
+ mScreenshot->Duplicate(bitmap->Handle());
+
+ if (mObserver) {
+ mObserver->DataChanged();
+ }
+ }
+}
+
+// end of file
--- a/tstaskmonitor/utils/src/tsentrykey.cpp Fri Jun 11 16:13:51 2010 +0300
+++ b/tstaskmonitor/utils/src/tsentrykey.cpp Thu Jun 24 16:18:29 2010 +0300
@@ -41,7 +41,7 @@
//
// -----------------------------------------------------------------------------
//
-void TTsEntryKey::ExternalizeL(RWriteStream& output)
+void TTsEntryKey::ExternalizeL(RWriteStream& output) const
{
output.WriteInt32L(mParentId);
}
@@ -54,3 +54,12 @@
{
mParentId = input.ReadInt32L();
}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+TInt TTsEntryKey::WindowGroupId() const
+{
+ return mParentId;
+}
--- a/tstaskmonitor/utils/src/tsfswentry.cpp Fri Jun 11 16:13:51 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,397 +0,0 @@
-/*
- * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description: Task list entry
- *
- */
-
-#define __E32SVR_H__
-#include "tsfswentry.h"
-#include "tsdataobserver.h"
-#include <s32strm.h>
-#include <fbs.h>
-
-// --------------------------------------------------------------------------
-// CTsFswEntry::NewL
-// --------------------------------------------------------------------------
-//
-CTsFswEntry* CTsFswEntry::NewL()
-{
- CTsFswEntry* self = NewLC();
- CleanupStack::Pop(self);
- return self;
-}
-
-// --------------------------------------------------------------------------
-// CTsFswEntry::NewLC
-// --------------------------------------------------------------------------
-//
-CTsFswEntry* CTsFswEntry::NewLC()
-{
- CTsFswEntry* self = new (ELeave) CTsFswEntry;
- CleanupStack::PushL(self);
- return self;
-}
-
-// --------------------------------------------------------------------------
-// CTsFswEntry::NewL
-// --------------------------------------------------------------------------
-//
-CTsFswEntry* CTsFswEntry::NewL(const TTsEntryKey& key, MHsDataObserver *observer)
-{
- CTsFswEntry* self = NewLC(key, observer);
- CleanupStack::Pop(self);
- return self;
-}
-
-// --------------------------------------------------------------------------
-// CTsFswEntry::NewLC
-// --------------------------------------------------------------------------
-//
-CTsFswEntry* CTsFswEntry::NewLC(const TTsEntryKey& key, MHsDataObserver* observer)
-{
- CTsFswEntry* self = new (ELeave) CTsFswEntry(key, observer);
- CleanupStack::PushL(self);
- return self;
-}
-
-// --------------------------------------------------------------------------
-// CTsFswEntry::~CTsFswEntry
-// --------------------------------------------------------------------------
-//
-CTsFswEntry::~CTsFswEntry()
-{
- delete mAppName;
- delete mAppIconBitmap;
- delete mAppIconMask;
- delete mScreenshot;
- delete mImgTool;
-}
-
-// --------------------------------------------------------------------------
-// CTsFswEntry::CTsFswEntry
-// --------------------------------------------------------------------------
-//
-CTsFswEntry::CTsFswEntry() :
- mPriority(Low)
-{
- mKey = TTsEntryKey();
-}
-
-// --------------------------------------------------------------------------
-// CTsFswEntry::CTsFswEntry
-// --------------------------------------------------------------------------
-//
-CTsFswEntry::CTsFswEntry(const TTsEntryKey& key, MHsDataObserver *observer) :
- mKey(key), mPriority(Low), mObserver(observer)
-{
- mWgId = key.mParentId;
-}
-
-// --------------------------------------------------------------------------
-// CTsFswEntry::SetWgId
-// --------------------------------------------------------------------------
-//
-void CTsFswEntry::SetWgId(TInt wgId)
-{
- mWgId = wgId;
- mKey = TTsEntryKey(mWgId);
-}
-
-// --------------------------------------------------------------------------
-// CTsFswEntry::SetAppUid
-// --------------------------------------------------------------------------
-//
-void CTsFswEntry::SetAppUid(const TUid& uid)
-{
- mAppUid = uid;
-}
-
-// --------------------------------------------------------------------------
-// CTsFswEntry::SetAppNameL
-// --------------------------------------------------------------------------
-//
-void CTsFswEntry::SetAppNameL(const TDesC& appName)
-{
- delete mAppName;
- mAppName = 0;
- mAppName = appName.AllocL();
-}
-
-// --------------------------------------------------------------------------
-// CTsFswEntry::SetSystemApp
-// --------------------------------------------------------------------------
-//
-void CTsFswEntry::SetCloseableApp(TBool value)
-{
- mCloseableApp = value;
-}
-
-// --------------------------------------------------------------------------
-// CTsFswEntry::SetAppIconHandles
-// --------------------------------------------------------------------------
-//
-void CTsFswEntry::SetAppIcon(CFbsBitmap* bitmap, CFbsBitmap* mask)
-{
- mAppIconBitmap = bitmap;
- mAppIconMask = mask;
-}
-
-// --------------------------------------------------------------------------
-// CTsFswEntry::WgId
-// --------------------------------------------------------------------------
-//
-TInt CTsFswEntry::WgId() const
-{
- return mWgId;
-}
-
-// --------------------------------------------------------------------------
-// CTsFswEntry::AppUid
-// --------------------------------------------------------------------------
-//
-TUid CTsFswEntry::AppUid() const
-{
- return mAppUid;
-}
-
-// --------------------------------------------------------------------------
-// CTsFswEntry::AppName
-// --------------------------------------------------------------------------
-//
-const TDesC& CTsFswEntry::AppName() const
-{
- return mAppName ? *mAppName : KNullDesC();
-}
-
-// --------------------------------------------------------------------------
-// CTsFswEntry::SystemApp
-// --------------------------------------------------------------------------
-//
-TBool CTsFswEntry::CloseableApp() const
-{
- return mCloseableApp;
-}
-
-// --------------------------------------------------------------------------
-// CTsFswEntry::AppIconBitmapHandle
-// --------------------------------------------------------------------------
-//
-CFbsBitmap* CTsFswEntry::AppIconBitmap() const
-{
- return mAppIconBitmap;
-}
-
-// --------------------------------------------------------------------------
-// CTsFswEntry::AppIconMaskHandle
-// --------------------------------------------------------------------------
-//
-CFbsBitmap* CTsFswEntry::AppIconMask() const
-{
- return mAppIconMask;
-}
-
-// --------------------------------------------------------------------------
-// CTsFswEntry::Key
-// --------------------------------------------------------------------------
-//
-const TTsEntryKey& CTsFswEntry::Key() const
-{
- return mKey;
-}
-// --------------------------------------------------------------------------
-// CTsFswEntry::ExternalizeL
-// --------------------------------------------------------------------------
-//
-void CTsFswEntry::ExternalizeL(RWriteStream& stream)
-{
- stream.WriteInt32L(mWgId);
- stream.WriteInt32L(mAppUid.iUid);
- stream << AppName();
- stream.WriteInt32L(mCloseableApp);
- if (mAppIconBitmap) {
- stream.WriteInt32L(mAppIconBitmap->Handle());
- }
- else {
- stream.WriteInt32L(KErrNotFound);
- }
-
- if (mAppIconMask) {
- stream.WriteInt32L(mAppIconMask->Handle());
- }
- else {
- stream.WriteInt32L(KErrNotFound);
- }
-
- if (mScreenshot) {
- stream.WriteInt32L(mScreenshot->Handle());
- }
- else {
- stream.WriteInt32L(KErrNotFound);
- }
-
- mKey.ExternalizeL(stream);
- TInt currentPriority = static_cast<TInt> (mPriority);
- stream.WriteInt32L(currentPriority);
-}
-
-// --------------------------------------------------------------------------
-// CTsFswEntry::InternalizeL
-// --------------------------------------------------------------------------
-//
-void CTsFswEntry::InternalizeL(RReadStream& stream)
-{
- mWgId = stream.ReadInt32L();
- mAppUid = TUid::Uid(stream.ReadInt32L());
- delete mAppName;
- mAppName = NULL;
- mAppName = HBufC::NewL(stream, KMaxTInt);
- mCloseableApp = stream.ReadInt32L();
- TInt appIconBitmapHandle = stream.ReadInt32L();
- TInt appIconMaskHandle = stream.ReadInt32L();
- TInt screenshotHandle = stream.ReadInt32L();
- if (appIconBitmapHandle != KErrNotFound) {
- mAppIconBitmap = new (ELeave) CFbsBitmap;
- mAppIconBitmap->Duplicate(appIconBitmapHandle);
- }
- if (appIconMaskHandle != KErrNotFound) {
- mAppIconMask = new (ELeave) CFbsBitmap;
- mAppIconMask->Duplicate(appIconMaskHandle);
- }
- if (screenshotHandle != KErrNotFound) {
- mScreenshot = new (ELeave) CFbsBitmap;
- mScreenshot->Duplicate(screenshotHandle);
- }
- mKey.InternalizeL(stream);
- TInt currentPriority = stream.ReadInt32L();
- mPriority = static_cast<UpdatePriority> (currentPriority);
-}
-
-// --------------------------------------------------------------------------
-// CTsFswEntry::ExternalizeArrayL
-// --------------------------------------------------------------------------
-//
-void CTsFswEntry::ExternalizeArrayL(RWriteStream& stream, const RTsFswArray& aArray)
-{
- TInt count = aArray.Count();
- stream.WriteInt32L(count);
- for (TInt i = 0; i < count; ++i) {
- aArray[i]->ExternalizeL(stream);
- }
-}
-
-// --------------------------------------------------------------------------
-// CTsFswEntry::InternalizeArrayL
-// --------------------------------------------------------------------------
-//
-void CTsFswEntry::InternalizeArrayL(RReadStream& stream, RTsFswArray& aArray)
-{
- aArray.ResetAndDestroy();
- TInt count = stream.ReadInt32L();
- for (TInt i = 0; i < count; ++i) {
- CTsFswEntry* entry = CTsFswEntry::NewLC();
- entry->InternalizeL(stream);
- aArray.AppendL(entry);
- CleanupStack::Pop(entry);
- }
-}
-
-// --------------------------------------------------------------------------
-// CTsFswEntry::Type
-// --------------------------------------------------------------------------
-//
-TAppType CTsFswEntry::Type() const
-{
- return EApp;
-}
-
-// --------------------------------------------------------------------------
-// CTsFswEntry::SetScreenshot
-// --------------------------------------------------------------------------
-//
-void CTsFswEntry::SetScreenshotL(const CFbsBitmap* bitmapArg, UpdatePriority priority)
-{
- TInt currentPriority = static_cast<TInt> (mPriority);
- TInt newPriority = static_cast<TInt> (priority);
- if(newPriority <currentPriority) {
- User::Leave(KErrAccessDenied);
- }
-
- CFbsBitmap* bitmap = new (ELeave) CFbsBitmap;
- CleanupStack::PushL(bitmap);
- User::LeaveIfError(bitmap->Duplicate(bitmapArg->Handle()));
- CleanupStack::Pop(bitmap);
-
- mPriority = priority;
- delete mScreenshot;
- mScreenshot = bitmap;
-
- delete mImgTool;
- mImgTool = 0;
-
- mImgTool = CTsGraphicFileScalingHandler::NewL(*this, *mScreenshot, TSize(128, 128),
- CTsGraphicFileScalingHandler::EKeepAspectRatioByExpanding);
-}
-
-// --------------------------------------------------------------------------
-// CTsFswEntry::RemoveScreenshot
-// --------------------------------------------------------------------------
-//
-void CTsFswEntry::RemoveScreenshotL()
-{
- if (!mScreenshot) {
- User::Leave(KErrNotFound);
- }
- delete mScreenshot;
- mScreenshot = NULL;
- mPriority = Low;
- if (mObserver) {
- mObserver->DataChanged();
- }
-}
-
-// --------------------------------------------------------------------------
-// CTsFswEntry::Screenshot
-// --------------------------------------------------------------------------
-//
-CFbsBitmap* CTsFswEntry::Screenshot() const
-{
- return mScreenshot;
-}
-
-// --------------------------------------------------------------------------
-// CTsFswEntry::Priority
-// --------------------------------------------------------------------------
-//
-UpdatePriority CTsFswEntry::Priority() const
-{
- return mPriority;
-}
-
-// --------------------------------------------------------------------------
-// CTsFswEntry::Priority
-// --------------------------------------------------------------------------
-//
-void CTsFswEntry::ImageReadyCallBack(TInt error, const CFbsBitmap *bitmap)
-{
- if (KErrNone == error && 0 != bitmap) {
- mScreenshot->Reset();
- mScreenshot->Duplicate(bitmap->Handle());
-
- if (mObserver) {
- mObserver->DataChanged();
- }
- }
-}
-
-// end of file