107
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include "afactivitystorage_p.h"
|
|
19 |
|
|
20 |
#include <QPixmap>
|
119
|
21 |
#include <QDateTime>
|
107
|
22 |
|
|
23 |
#include <afstorageglobals.h>
|
|
24 |
|
|
25 |
AfActivityStoragePrivate::AfActivityStoragePrivate(const QSharedPointer<AfStorageProxy> &connection) : mConnection(connection)
|
|
26 |
{
|
|
27 |
}
|
|
28 |
|
|
29 |
bool AfActivityStoragePrivate::saveActivity(const QString &activityId, const QVariant &activityData, const QVariantHash &metadata)
|
|
30 |
{
|
|
31 |
QVariantHash publicData(metadata);
|
|
32 |
|
|
33 |
QPixmap screenshot(publicData[ActivityScreenshotKeyword].value<QPixmap>());
|
|
34 |
publicData.remove(ActivityScreenshotKeyword);
|
|
35 |
|
|
36 |
publicData.insert(ActivityApplicationKeyword, applicationId());
|
|
37 |
publicData.insert(ActivityActivityKeyword, activityId);
|
119
|
38 |
publicData.insert(ActivityTimestamp, QDateTime::currentDateTime());
|
107
|
39 |
|
116
|
40 |
return mConnection->saveActivity(applicationId(), activityId, publicData[ActivityApplicationName].toString(), activityData, publicData, screenshot);
|
107
|
41 |
}
|
|
42 |
|
|
43 |
bool AfActivityStoragePrivate::removeActivity(const QString &activityId)
|
|
44 |
{
|
|
45 |
return mConnection->removeActivity(applicationId(), activityId);
|
|
46 |
}
|
|
47 |
|
|
48 |
QStringList AfActivityStoragePrivate::allActivities() const
|
|
49 |
{
|
|
50 |
QStringList activities;
|
|
51 |
mConnection->applicationActivities(activities, applicationId());
|
|
52 |
return activities;
|
|
53 |
}
|
|
54 |
|
|
55 |
QVariant AfActivityStoragePrivate::activityData(const QString &activityId) const
|
|
56 |
{
|
|
57 |
QVariant data;
|
|
58 |
mConnection->activityData(data, applicationId(), activityId);
|
|
59 |
return data;
|
|
60 |
}
|
|
61 |
|
|
62 |
QVariantHash AfActivityStoragePrivate::activityMetaData(const QString &activityId) const
|
|
63 |
{
|
|
64 |
QVariantHash metadata;
|
|
65 |
mConnection->activityMetaData(metadata, applicationId(), activityId);
|
|
66 |
return metadata;
|
|
67 |
}
|
|
68 |
|
|
69 |
int AfActivityStoragePrivate::applicationId()
|
|
70 |
{
|
|
71 |
return RProcess().SecureId().iId;
|
|
72 |
}
|