89
|
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 |
*
|
92
|
14 |
* Description:
|
89
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include "activitydatabase_p.h"
|
|
19 |
|
|
20 |
#include <QSqlDatabase>
|
|
21 |
#include <QSqlQuery>
|
|
22 |
#include <QSqlError>
|
|
23 |
#include <QStringList>
|
|
24 |
#include <QSettings>
|
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
ActivityDatabasePrivate::ActivityDatabasePrivate()
|
|
29 |
{
|
|
30 |
mClient.connect();
|
|
31 |
}
|
|
32 |
|
|
33 |
ActivityDatabasePrivate::~ActivityDatabasePrivate()
|
|
34 |
{
|
|
35 |
}
|
|
36 |
|
92
|
37 |
void ActivityDatabasePrivate::saveActivity(const QString &applicationName, const QString &activityName, const QVariantHash &activityMetadata)
|
89
|
38 |
{
|
|
39 |
QVariantHash request(activityMetadata);
|
|
40 |
request.insert(ActivityApplicationKeyword,applicationName);
|
|
41 |
request.insert(ActivityActivityKeyword,activityName);
|
|
42 |
mClient.saveActivity(request);
|
92
|
43 |
|
89
|
44 |
}
|
|
45 |
|
|
46 |
void ActivityDatabasePrivate::deleteActivity(const QString &applicationName, const QString &activityName)
|
|
47 |
{
|
|
48 |
QVariantHash request;
|
|
49 |
request.insert(ActivityApplicationKeyword,applicationName);
|
|
50 |
request.insert(ActivityActivityKeyword,activityName);
|
|
51 |
mClient.deleteActivity(request);
|
|
52 |
}
|
|
53 |
|
|
54 |
void ActivityDatabasePrivate::deleteApplicationActivities(const QString &applicationName)
|
|
55 |
{
|
|
56 |
QVariantHash request;
|
|
57 |
request.insert(ActivityApplicationKeyword,applicationName);
|
|
58 |
mClient.deleteApplicationActivities(request);
|
|
59 |
}
|
|
60 |
|
|
61 |
QList<QVariantHash> ActivityDatabasePrivate::allActivitiesList()
|
|
62 |
{
|
|
63 |
QList<QVariantHash> retVal;
|
|
64 |
mClient.activities(retVal);
|
|
65 |
return retVal;
|
|
66 |
}
|
|
67 |
|
92
|
68 |
QList<QVariantHash> ActivityDatabasePrivate::applicationActivitiesList(const QString &applicationName)
|
89
|
69 |
{
|
|
70 |
QList<QVariantHash> result;
|
|
71 |
QVariantHash request;
|
|
72 |
request.insert(ActivityApplicationKeyword,applicationName);
|
|
73 |
mClient.applicationActivities(result, request);
|
|
74 |
return result;
|
|
75 |
}
|
|
76 |
|
|
77 |
|
|
78 |
QString ActivityDatabasePrivate::requestedActivityName(const QString &applicationName)
|
|
79 |
{
|
|
80 |
QString result;
|
|
81 |
QVariantHash request;
|
|
82 |
request.insert(ActivityApplicationKeyword,applicationName);
|
|
83 |
mClient.requestedActivityName(result, request);
|
|
84 |
return result;
|
|
85 |
}
|
|
86 |
|
|
87 |
void ActivityDatabasePrivate::setActivityRequestFlag(const QString &applicationName, const QString &activityName)
|
|
88 |
{
|
|
89 |
QVariantHash request;
|
|
90 |
request.insert(ActivityApplicationKeyword,applicationName);
|
|
91 |
request.insert(ActivityActivityKeyword,activityName);
|
|
92 |
mClient.setActivityRequestFlag(request);
|
|
93 |
}
|
|
94 |
|
|
95 |
void ActivityDatabasePrivate::clearActivityRequestFlag(const QString &applicationName, const QString &activityName)
|
|
96 |
{
|
|
97 |
QVariantHash request;
|
|
98 |
request.insert(ActivityApplicationKeyword,applicationName);
|
|
99 |
request.insert(ActivityActivityKeyword,activityName);
|
|
100 |
mClient.clearActivityRequestFlag(request);
|
|
101 |
}
|
|
102 |
|