85
|
1 |
/*
|
|
2 |
* Copyright (c) 2008 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: Interface for CA database implementations
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef CASTORAGEPROXY_H
|
|
19 |
#define CASTORAGEPROXY_H
|
|
20 |
|
93
|
21 |
#include "cadef.h"
|
98
|
22 |
#include "castorage_global.h"
|
85
|
23 |
#include "caoperationparams.h"
|
|
24 |
|
|
25 |
|
98
|
26 |
|
85
|
27 |
// FORWARD DECLARATIONS
|
|
28 |
class CCaStorage;
|
|
29 |
class CCaInnerQuery;
|
|
30 |
class CCaInnerEntry;
|
|
31 |
class CCaLocalizationEntry;
|
|
32 |
class MCaSessionNorifier;
|
|
33 |
|
98
|
34 |
CA_STORAGE_TEST_CLASS( TestCaClient )
|
|
35 |
|
85
|
36 |
/**
|
|
37 |
* Interface for CA database implementations.
|
|
38 |
*
|
|
39 |
*/
|
|
40 |
class CCaStorageProxy: public CBase
|
|
41 |
{
|
|
42 |
public:
|
86
|
43 |
|
85
|
44 |
/**
|
|
45 |
* Two-phased constructor.
|
|
46 |
*/
|
|
47 |
static CCaStorageProxy* NewL();
|
|
48 |
|
|
49 |
/**
|
|
50 |
* Two-phased constructor.
|
|
51 |
*/
|
|
52 |
static CCaStorageProxy* NewLC();
|
|
53 |
|
|
54 |
/**
|
|
55 |
* Destructor.
|
|
56 |
*/
|
|
57 |
~CCaStorageProxy();
|
86
|
58 |
|
85
|
59 |
/**
|
|
60 |
* Localizes one entry attribute
|
|
61 |
*
|
|
62 |
* @param aLocalization information about one localization row.
|
|
63 |
*/
|
|
64 |
IMPORT_C void LocalizeEntryL( CCaLocalizationEntry& aLocalization );
|
|
65 |
|
|
66 |
/**
|
94
|
67 |
* Add localization row to the storage
|
|
68 |
*
|
|
69 |
* @param aLocalization entry containing localization row to be added
|
|
70 |
*/
|
|
71 |
IMPORT_C void AddLocalizationL(const CCaLocalizationEntry& aLocalization);
|
|
72 |
|
|
73 |
/**
|
85
|
74 |
* Fetches localization data from database
|
|
75 |
*
|
|
76 |
* @param aResultContainer Target for results.
|
|
77 |
*/
|
86
|
78 |
IMPORT_C void GetLocalizationsL(
|
|
79 |
RPointerArray<CCaLocalizationEntry>& aResultContainer );
|
85
|
80 |
|
|
81 |
/**
|
|
82 |
* Fetches data from storage.
|
|
83 |
* @param aQuery Query filter for entries to be fetched.
|
|
84 |
* @param aResult Result entry container.
|
|
85 |
*/
|
86
|
86 |
IMPORT_C void GetEntriesL( const CCaInnerQuery* aQuery,
|
85
|
87 |
RPointerArray<CCaInnerEntry>& aResultContainer );
|
|
88 |
|
|
89 |
/**
|
|
90 |
* Fetches entry ids from storage.
|
|
91 |
* @param aQuery Query filter for entries' ids to be fetched.
|
|
92 |
* @param aResultIdArray Result entry id array.
|
|
93 |
*/
|
|
94 |
IMPORT_C void GetEntriesIdsL( const CCaInnerQuery* aQuery,
|
|
95 |
RArray<TInt>& aResultIdArray );
|
|
96 |
|
|
97 |
/**
|
|
98 |
* Adds or Updates data to storage.
|
93
|
99 |
* In case when data is added the input aEntry serves.
|
85
|
100 |
* also as an output entry.
|
|
101 |
* @param aEntry Entry data.
|
93
|
102 |
* @param aUpdate is entry updated by a client.
|
|
103 |
* @param aItemAppearanceChange a type of change of the item.
|
85
|
104 |
*/
|
93
|
105 |
IMPORT_C void AddL( CCaInnerEntry* aEntry,
|
|
106 |
TBool aUpdate = EFalse,
|
|
107 |
TItemAppearance aItemAppearanceChange = EItemAppearanceNotChanged );
|
85
|
108 |
|
|
109 |
/**
|
|
110 |
* Removes entries from storage.
|
|
111 |
* @param aEntryIds Ids of entries to be removed.
|
|
112 |
*/
|
|
113 |
IMPORT_C void RemoveL( const RArray<TInt>& aEntryIds );
|
|
114 |
|
|
115 |
/**
|
|
116 |
* Organizes entries in storage.
|
86
|
117 |
* @param aEntryIds Entry ids to be organized
|
85
|
118 |
* (insert, remove, append, prepend are possible).
|
|
119 |
* @param aParams Organize parameters.
|
|
120 |
*/
|
|
121 |
IMPORT_C void OrganizeL( const RArray<TInt>& aEntryIds,
|
|
122 |
TCaOperationParams aParams );
|
|
123 |
|
|
124 |
/**
|
86
|
125 |
* Executes touch specific actions on storage.
|
85
|
126 |
* Should be called when e.g. entry is clicked.
|
|
127 |
* @param aEntry entry to be touched
|
|
128 |
*/
|
|
129 |
IMPORT_C void TouchL( CCaInnerEntry* aEntry );
|
86
|
130 |
|
85
|
131 |
/**
|
|
132 |
* Get database property on storage.
|
|
133 |
*
|
|
134 |
* @param aProperty The property to get.
|
|
135 |
* @param aPropertyValue The value of property.
|
|
136 |
*/
|
|
137 |
IMPORT_C void DbPropertyL( const TDesC& aProperty, TDes& aPropertyValue );
|
86
|
138 |
|
85
|
139 |
/**
|
|
140 |
* Set property action on storage.
|
|
141 |
*
|
|
142 |
* @param aProperty The property to set.
|
|
143 |
* @param aPropertyValue The value of property.
|
|
144 |
*/
|
86
|
145 |
IMPORT_C void SetDBPropertyL( const TDesC& aProperty,
|
|
146 |
const TDesC& aPropertyValue );
|
|
147 |
|
85
|
148 |
/**
|
|
149 |
* Organizes data within a group in custom order in storage.
|
|
150 |
*
|
|
151 |
* @param aEntryIds Ids of entries in custom order.
|
|
152 |
* @param aGroupId Group to sort.
|
|
153 |
*/
|
86
|
154 |
IMPORT_C void CustomSortL( const RArray<TInt>& aEntryIds,
|
|
155 |
const TInt aGroupId );
|
|
156 |
|
107
|
157 |
|
|
158 |
/**
|
|
159 |
* Saves a copy of database to private.
|
|
160 |
*/
|
|
161 |
IMPORT_C void SaveDatabaseL();
|
|
162 |
|
|
163 |
/**
|
|
164 |
* Marks db to be restored from backup by next restart
|
|
165 |
*/
|
|
166 |
IMPORT_C void RestoreDatabaseL();
|
|
167 |
|
|
168 |
|
86
|
169 |
/**
|
|
170 |
* Loads data base from rom.
|
|
171 |
*/
|
|
172 |
IMPORT_C void LoadDataBaseFromRomL();
|
|
173 |
|
85
|
174 |
/**
|
|
175 |
* Add a session. Ownership not taken, this object only keeps a list of
|
|
176 |
* sessions that are dependent on its engine.
|
|
177 |
* @param aSession Session.
|
|
178 |
*/
|
|
179 |
void AddSessionL( MCaSessionNorifier* aHandlerNotifier );
|
86
|
180 |
|
85
|
181 |
/**
|
|
182 |
* Remove a session. Safe to call if not added.
|
|
183 |
* When no more sessions remain dependent on this object, timed
|
|
184 |
* self-deletion is scheduled.
|
|
185 |
*/
|
|
186 |
void RemoveSession( MCaSessionNorifier* aHandlerNotifier );
|
|
187 |
|
|
188 |
private:
|
|
189 |
|
|
190 |
/**
|
|
191 |
* Perform the second phase construction of a CCpStorageEngine object.
|
|
192 |
*/
|
|
193 |
void ConstructL();
|
|
194 |
|
|
195 |
/**
|
|
196 |
* C++ default constructor.
|
|
197 |
*/
|
|
198 |
CCaStorageProxy();
|
98
|
199 |
|
|
200 |
CCaLocalizationEntry* LocalizeTextL( CCaInnerEntry* aEntry );
|
|
201 |
|
|
202 |
CCaLocalizationEntry* LocalizeDescriptionL( CCaInnerEntry* aEntry );
|
|
203 |
|
125
|
204 |
void AddTitleNameL( CCaInnerEntry* aEntry );
|
|
205 |
|
|
206 |
TBool InitializeTranslatorL( const TDesC& aQmFilename );
|
85
|
207 |
|
|
208 |
private:
|
|
209 |
//Data
|
|
210 |
|
|
211 |
/**
|
|
212 |
* Data storage. Own.
|
|
213 |
*/
|
|
214 |
CCaStorage* iStorage;
|
|
215 |
|
|
216 |
/**
|
|
217 |
* Sessions using this engine. Own.
|
|
218 |
*/
|
86
|
219 |
RPointerArray<MCaSessionNorifier> iHandlerNotifier;
|
125
|
220 |
|
|
221 |
/**
|
|
222 |
* Translated user collection name. Own.
|
|
223 |
*/
|
|
224 |
RBuf iTitleUserColName;
|
98
|
225 |
|
|
226 |
CA_STORAGE_TEST_FRIEND_CLASS( TestCaClient )
|
|
227 |
|
85
|
228 |
};
|
|
229 |
|
|
230 |
#endif //CASTORAGEPROXY_H
|