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 |
/**
|
107
|
77 |
* Function save an activity (add new one or update existing one)
|
|
78 |
* @param entry - activity entry data structure
|
|
79 |
* @param imageHandle - handle for activity thumbnail
|
|
80 |
* @return 0 on success, error code otherwise
|
|
81 |
*/
|
|
82 |
EXPORT_C int CAfStorageClient::saveActivity(const CAfEntry &entry, TInt imageHandle)
|
|
83 |
{
|
|
84 |
return d_ptr->saveActivity(entry, imageHandle);
|
99
|
85 |
}
|
|
86 |
|
|
87 |
// -----------------------------------------------------------------------------
|
|
88 |
/**
|
|
89 |
* Function remove existing activity
|
|
90 |
* @param entry - activity entry template
|
|
91 |
* @return 0 on success, error code otherwise
|
|
92 |
*/
|
107
|
93 |
EXPORT_C int CAfStorageClient::removeActivity(const CAfEntry &entry)
|
99
|
94 |
{
|
|
95 |
return d_ptr->removeActivity(entry);
|
|
96 |
}
|
|
97 |
|
|
98 |
// -----------------------------------------------------------------------------
|
|
99 |
/**
|
|
100 |
* Function remove existing activities for application
|
|
101 |
* @param entry - activity entry template
|
|
102 |
* @return 0 on success, error code otherwise
|
|
103 |
*/
|
107
|
104 |
EXPORT_C int CAfStorageClient::removeApplicationActivities(const CAfEntry &entry)
|
99
|
105 |
{
|
|
106 |
return d_ptr->removeApplicationActivities(entry);
|
|
107 |
}
|
|
108 |
|
|
109 |
// -----------------------------------------------------------------------------
|
|
110 |
/**
|
|
111 |
* Function retreive public data for all activities
|
|
112 |
* @param dst - list of results
|
|
113 |
* @return 0 on success, error code otherwise
|
|
114 |
*/
|
116
|
115 |
EXPORT_C int CAfStorageClient::activities(RPointerArray<CAfEntry> &dst, TInt limit)
|
99
|
116 |
{
|
116
|
117 |
return d_ptr->activities(dst, limit);
|
99
|
118 |
}
|
|
119 |
|
|
120 |
// -----------------------------------------------------------------------------
|
|
121 |
/**
|
|
122 |
* Function retreive public data for all application activities
|
|
123 |
* @param dst - list of results
|
|
124 |
* @param entry - activity template
|
|
125 |
* @return 0 on success, error code otherwise
|
|
126 |
*/
|
107
|
127 |
EXPORT_C int CAfStorageClient::applicationActivities(RPointerArray<CAfEntry> &dst, const CAfEntry &entry)
|
99
|
128 |
{
|
|
129 |
return d_ptr->applicationActivities(dst, entry);
|
|
130 |
}
|
|
131 |
|
|
132 |
// -----------------------------------------------------------------------------
|
|
133 |
/**
|
|
134 |
* Function retreive all data for requested activity
|
|
135 |
* @param dst - activity entry
|
|
136 |
* @param entry - activity template
|
|
137 |
* @return 0 on success, error code otherwise
|
|
138 |
*/
|
107
|
139 |
EXPORT_C int CAfStorageClient::activityData(CAfEntry *&dst, const CAfEntry &entry)
|
99
|
140 |
{
|
|
141 |
return d_ptr->activityData(dst, entry);
|
|
142 |
}
|
|
143 |
|
|
144 |
// -----------------------------------------------------------------------------
|
|
145 |
/**
|
|
146 |
* Function subscribe application for notyfication about requested activity changes
|
|
147 |
* @return 0 on success, error code otherwise
|
|
148 |
*/
|
107
|
149 |
EXPORT_C int CAfStorageClient::waitActivity()
|
99
|
150 |
{
|
|
151 |
return d_ptr->waitActivity();
|
|
152 |
}
|
|
153 |
|
|
154 |
// -----------------------------------------------------------------------------
|
|
155 |
/**
|
|
156 |
* Function request activity change
|
|
157 |
* @param entry - activity template
|
|
158 |
* @return 0 on success, error code otherwise
|
|
159 |
*/
|
107
|
160 |
EXPORT_C int CAfStorageClient::launchActivity(const CAfEntry &entry)
|
99
|
161 |
{
|
|
162 |
return d_ptr->launchActivity(entry);
|
|
163 |
}
|
|
164 |
|
|
165 |
// -----------------------------------------------------------------------------
|
119
|
166 |
EXPORT_C int CAfStorageClient::getThumbnail(const TDesC &imagePath, void *userData)
|
99
|
167 |
{
|
119
|
168 |
return d_ptr->getThumbnail(imagePath, userData);
|
99
|
169 |
}
|
|
170 |
|
|
171 |
// -----------------------------------------------------------------------------
|
|
172 |
/**
|
|
173 |
* Function subscribe launcher for data model changes
|
|
174 |
* @return 0 on success, error code otherwise
|
|
175 |
*/
|
107
|
176 |
EXPORT_C int CAfStorageClient::notifyDataChange()
|
99
|
177 |
{
|
107
|
178 |
return d_ptr->notifyDataChange();
|
99
|
179 |
}
|