99
|
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 |
#include "afstorageclient.h"
|
107
|
18 |
|
|
19 |
#include <e32debug.h>
|
|
20 |
|
99
|
21 |
#include "afstorageclient_p.h"
|
106
|
22 |
#include "afcmd.h"
|
|
23 |
|
99
|
24 |
// -----------------------------------------------------------------------------
|
|
25 |
/**
|
107
|
26 |
* Two-phase constructor. Create and initialize instance
|
|
27 |
* @return entry instance
|
99
|
28 |
*/
|
107
|
29 |
EXPORT_C CAfStorageClient *CAfStorageClient::NewL(MAfAsyncRequestObserver &observer)
|
99
|
30 |
{
|
107
|
31 |
CAfStorageClient *self = CAfStorageClient::NewLC(observer);
|
|
32 |
CleanupStack::Pop(self);
|
|
33 |
return self;
|
99
|
34 |
}
|
|
35 |
|
|
36 |
// -----------------------------------------------------------------------------
|
|
37 |
/**
|
107
|
38 |
* Two-phase constructor. Create, initialize and push instance into cleanup stack
|
|
39 |
* @return entry instance
|
|
40 |
*/
|
|
41 |
EXPORT_C CAfStorageClient *CAfStorageClient::NewLC(MAfAsyncRequestObserver &observer)
|
|
42 |
{
|
|
43 |
CAfStorageClient *self = new (ELeave) CAfStorageClient();
|
|
44 |
CleanupStack::PushL(self);
|
|
45 |
self->ConstructL(observer);
|
|
46 |
return self;
|
|
47 |
}
|
|
48 |
|
|
49 |
// -----------------------------------------------------------------------------
|
|
50 |
/**
|
99
|
51 |
* Destructor
|
|
52 |
*/
|
107
|
53 |
EXPORT_C CAfStorageClient::~CAfStorageClient()
|
99
|
54 |
{
|
|
55 |
delete d_ptr;
|
|
56 |
}
|
107
|
57 |
|
99
|
58 |
// -----------------------------------------------------------------------------
|
|
59 |
/**
|
107
|
60 |
* Constructor
|
99
|
61 |
*/
|
107
|
62 |
CAfStorageClient::CAfStorageClient()
|
99
|
63 |
{
|
|
64 |
}
|
|
65 |
|
|
66 |
// -----------------------------------------------------------------------------
|
|
67 |
/**
|
107
|
68 |
* 2nd phase of construction
|
99
|
69 |
*/
|
107
|
70 |
void CAfStorageClient::ConstructL(MAfAsyncRequestObserver &observer)
|
99
|
71 |
{
|
107
|
72 |
d_ptr = CAfStorageClientPrivate::NewL(observer);
|
99
|
73 |
}
|
|
74 |
|
|
75 |
// -----------------------------------------------------------------------------
|
|
76 |
/**
|
|
77 |
* Function add new activity
|
|
78 |
* @param entry - activity entry data structure
|
107
|
79 |
* @param imageHandle - handle for activity thumbnail
|
99
|
80 |
* @return 0 on success, error code otherwise
|
|
81 |
*/
|
107
|
82 |
EXPORT_C int CAfStorageClient::addActivity(const CAfEntry &entry, TInt imageHandle)
|
99
|
83 |
{
|
107
|
84 |
RDebug::Print(_L("This method is deprecated, please use CAfStorageClient::saveActivity instead"));
|
|
85 |
return d_ptr->addActivity(entry, imageHandle);
|
99
|
86 |
}
|
|
87 |
|
|
88 |
// -----------------------------------------------------------------------------
|
|
89 |
/**
|
|
90 |
* Function update existing activity
|
|
91 |
* @param entry - activity entry data structure
|
107
|
92 |
* @param imageHandle - handle for activity thumbnail
|
99
|
93 |
* @return 0 on success, error code otherwise
|
|
94 |
*/
|
107
|
95 |
EXPORT_C int CAfStorageClient::updateActivity(const CAfEntry &entry, TInt imageHandle)
|
99
|
96 |
{
|
107
|
97 |
RDebug::Print(_L("This method is deprecated, please use CAfStorageClient::saveActivity instead"));
|
|
98 |
return d_ptr->updateActivity(entry, imageHandle);
|
|
99 |
}
|
|
100 |
|
|
101 |
// -----------------------------------------------------------------------------
|
|
102 |
/**
|
|
103 |
* Function save an activity (add new one or update existing one)
|
|
104 |
* @param entry - activity entry data structure
|
|
105 |
* @param imageHandle - handle for activity thumbnail
|
|
106 |
* @return 0 on success, error code otherwise
|
|
107 |
*/
|
|
108 |
EXPORT_C int CAfStorageClient::saveActivity(const CAfEntry &entry, TInt imageHandle)
|
|
109 |
{
|
|
110 |
return d_ptr->saveActivity(entry, imageHandle);
|
99
|
111 |
}
|
|
112 |
|
|
113 |
// -----------------------------------------------------------------------------
|
|
114 |
/**
|
|
115 |
* Function remove existing activity
|
|
116 |
* @param entry - activity entry template
|
|
117 |
* @return 0 on success, error code otherwise
|
|
118 |
*/
|
107
|
119 |
EXPORT_C int CAfStorageClient::removeActivity(const CAfEntry &entry)
|
99
|
120 |
{
|
|
121 |
return d_ptr->removeActivity(entry);
|
|
122 |
}
|
|
123 |
|
|
124 |
// -----------------------------------------------------------------------------
|
|
125 |
/**
|
|
126 |
* Function remove existing activities for application
|
|
127 |
* @param entry - activity entry template
|
|
128 |
* @return 0 on success, error code otherwise
|
|
129 |
*/
|
107
|
130 |
EXPORT_C int CAfStorageClient::removeApplicationActivities(const CAfEntry &entry)
|
99
|
131 |
{
|
|
132 |
return d_ptr->removeApplicationActivities(entry);
|
|
133 |
}
|
|
134 |
|
|
135 |
// -----------------------------------------------------------------------------
|
|
136 |
/**
|
|
137 |
* Function retreive public data for all activities
|
|
138 |
* @param dst - list of results
|
|
139 |
* @return 0 on success, error code otherwise
|
|
140 |
*/
|
116
|
141 |
EXPORT_C int CAfStorageClient::activities(RPointerArray<CAfEntry> &dst, TInt limit)
|
99
|
142 |
{
|
116
|
143 |
return d_ptr->activities(dst, limit);
|
99
|
144 |
}
|
|
145 |
|
|
146 |
// -----------------------------------------------------------------------------
|
|
147 |
/**
|
|
148 |
* Function retreive public data for all application activities
|
|
149 |
* @param dst - list of results
|
|
150 |
* @param entry - activity template
|
|
151 |
* @return 0 on success, error code otherwise
|
|
152 |
*/
|
107
|
153 |
EXPORT_C int CAfStorageClient::applicationActivities(RPointerArray<CAfEntry> &dst, const CAfEntry &entry)
|
99
|
154 |
{
|
|
155 |
return d_ptr->applicationActivities(dst, entry);
|
|
156 |
}
|
|
157 |
|
|
158 |
// -----------------------------------------------------------------------------
|
|
159 |
/**
|
|
160 |
* Function retreive all data for requested activity
|
|
161 |
* @param dst - activity entry
|
|
162 |
* @param entry - activity template
|
|
163 |
* @return 0 on success, error code otherwise
|
|
164 |
*/
|
107
|
165 |
EXPORT_C int CAfStorageClient::activityData(CAfEntry *&dst, const CAfEntry &entry)
|
99
|
166 |
{
|
|
167 |
return d_ptr->activityData(dst, entry);
|
|
168 |
}
|
|
169 |
|
|
170 |
// -----------------------------------------------------------------------------
|
|
171 |
/**
|
|
172 |
* Function subscribe application for notyfication about requested activity changes
|
|
173 |
* @return 0 on success, error code otherwise
|
|
174 |
*/
|
107
|
175 |
EXPORT_C int CAfStorageClient::waitActivity()
|
99
|
176 |
{
|
|
177 |
return d_ptr->waitActivity();
|
|
178 |
}
|
|
179 |
|
|
180 |
// -----------------------------------------------------------------------------
|
|
181 |
/**
|
|
182 |
* Function request activity change
|
|
183 |
* @param entry - activity template
|
|
184 |
* @return 0 on success, error code otherwise
|
|
185 |
*/
|
107
|
186 |
EXPORT_C int CAfStorageClient::launchActivity(const CAfEntry &entry)
|
99
|
187 |
{
|
|
188 |
return d_ptr->launchActivity(entry);
|
|
189 |
}
|
|
190 |
|
|
191 |
// -----------------------------------------------------------------------------
|
107
|
192 |
EXPORT_C int CAfStorageClient::getThumbnail(const TSize &size, const TDesC &imagePath, void *userData)
|
99
|
193 |
{
|
107
|
194 |
return d_ptr->getThumbnail(size, imagePath, userData);
|
99
|
195 |
}
|
|
196 |
|
|
197 |
// -----------------------------------------------------------------------------
|
|
198 |
/**
|
|
199 |
* Function subscribe launcher for data model changes
|
|
200 |
* @return 0 on success, error code otherwise
|
|
201 |
*/
|
107
|
202 |
EXPORT_C int CAfStorageClient::notifyDataChange()
|
99
|
203 |
{
|
107
|
204 |
return d_ptr->notifyDataChange();
|
99
|
205 |
}
|