|
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 * |
|
15 * Description: |
|
16 * The header file of the backup common class |
|
17 */ |
|
18 |
|
19 #ifndef FMBKUPCOMMON_H |
|
20 #define FMBKUPCOMMON_H |
|
21 |
|
22 |
|
23 //#define KFileManagerUID3 0x101F84EB |
|
24 |
|
25 namespace FmBkupEngineCommon |
|
26 { |
|
27 |
|
28 enum TFileManagerBackupContentMask |
|
29 { |
|
30 EFileManagerBackupContentAll = 0x1, |
|
31 EFileManagerBackupContentSettings = 0x2, |
|
32 EFileManagerBackupContentMessages = 0x4, |
|
33 EFileManagerBackupContentContacts = 0x8, |
|
34 EFileManagerBackupContentCalendar = 0x10, |
|
35 EFileManagerBackupContentBookmarks = 0x20, |
|
36 EFileManagerBackupContentUserFiles = 0x40, |
|
37 EFileManagerBackupContentFirst = 0x2, |
|
38 EFileManagerBackupContentLast = 0x40 |
|
39 }; |
|
40 |
|
41 |
|
42 // Partial backup categories bitmask values |
|
43 enum MAEngineBackupCategories |
|
44 { |
|
45 EBUCatSettings = 0x1, |
|
46 EBUCatMessages = 0x2, |
|
47 EBUCatContacts = 0x4, |
|
48 EBUCatCalendar = 0x8, |
|
49 EBUCatBookmarks = 0x10, |
|
50 EBUCatUserFiles = 0x20, |
|
51 EBUCatAllInOne = 0x8000000, |
|
52 EBUCatAllSeparately = 0x7FFFFFF |
|
53 // Set as 0xFFFFFFF (EBUCatAllInOne+EBUCatAllSeparately) if archive containing |
|
54 // data from all data owners needs to be created. |
|
55 }; |
|
56 |
|
57 // Bitmask values for special ruling of which category data owner belongs to |
|
58 enum MAEngineBackupCatSpecFlag |
|
59 { |
|
60 EBUCatSpecNone = 0x0, |
|
61 EBUCatSpecSystem = 0x1, |
|
62 EBUCatSpecJava = 0x2, |
|
63 EBUCatSpecPublic = 0x4, |
|
64 EBUCatSpecAll = 0x8 |
|
65 }; |
|
66 |
|
67 // Defines drive caterories for multiple drives to setup backup sources and restore targets |
|
68 enum MAEngineBackupDriveType |
|
69 { |
|
70 EBkupDeviceMemories = 0x1, |
|
71 EBkupInternalMassStorages = 0x2, |
|
72 EBkupExternalMassStorages = 0x4 |
|
73 }; |
|
74 |
|
75 enum TMMCScBkupOwnerDataType |
|
76 { |
|
77 // Relates to all data owners |
|
78 EMMCScBkupOwnerDataTypeDataOwner = 0, |
|
79 |
|
80 // Relates to java data for a particular owner |
|
81 EMMCScBkupOwnerDataTypeJavaData, |
|
82 |
|
83 // Relates to public data for a particular owner |
|
84 EMMCScBkupOwnerDataTypePublicData, |
|
85 |
|
86 // Relates to system data for a particular owner |
|
87 EMMCScBkupOwnerDataTypeSystemData, |
|
88 |
|
89 // Relates to active data for a particular owner |
|
90 EMMCScBkupOwnerDataTypeActiveData, |
|
91 |
|
92 // Relates to passive data for a particular owner |
|
93 EMMCScBkupOwnerDataTypePassiveData, |
|
94 |
|
95 // Always leave this last, don't assign it |
|
96 // a value. Don't use it either! |
|
97 EMMCScBkupOwnerDataTypeCount, |
|
98 |
|
99 // A generic 'any data type' value. Used by the drive-specific-request & |
|
100 // data sizer. Not a real SBE data type, hence it appears after |
|
101 // the last marker. |
|
102 EMMCScBkupOwnerDataTypeAny |
|
103 }; |
|
104 |
|
105 const QString const_Bkup_EBUCatSettings ( "EBUCatSettings" ); |
|
106 const QString const_Bkup_EBUCatMessages ( "EBUCatMessages" ); |
|
107 const QString const_Bkup_EBUCatContacts ( "EBUCatContacts" ); |
|
108 const QString const_Bkup_EBUCatCalendar ( "EBUCatCalendar" ); |
|
109 const QString const_Bkup_EBUCatBookmarks ( "EBUCatBookmarks" ); |
|
110 const QString const_Bkup_EBUCatUserFiles ( "EBUCatUserFiles" ); |
|
111 const QString const_Bkup_EBUCatAllInOne ( "EBUCatAllInOne" ); |
|
112 const QString const_Bkup_EBUCatAllSeparately( "EBUCatAllSeparately" ); |
|
113 |
|
114 const QString const_bkup_EBUCatSpecNone ( "EBUCatSpecNone" ); |
|
115 const QString const_bkup_EBUCatSpecSystem ( "EBUCatSpecSystem" ); |
|
116 const QString const_bkup_EBUCatSpecJava ( "EBUCatSpecJava" ); |
|
117 const QString const_bkup_EBUCatSpecPublic ( "EBUCatSpecPublic" ); |
|
118 const QString const_bkup_EBUCatSpecAll ( "EBUCatSpecAll" ); |
|
119 |
|
120 const QString const_bkup_EBkupDeviceMemories( |
|
121 "EBkupDeviceMemories" |
|
122 ); |
|
123 const QString const_bkup_EBkupInternalMassStorages( |
|
124 "EBkupInternalMassStorages" |
|
125 ); |
|
126 const QString const_bkup_EBkupExternalMassStorages( |
|
127 "EBkupExternalMassStorages" |
|
128 ); |
|
129 |
|
130 const QString const_bkup_EMMCScBkupOwnerDataTypeDataOwner( |
|
131 "EMMCScBkupOwnerDataTypeDataOwner" |
|
132 ); |
|
133 const QString const_bkup_EMMCScBkupOwnerDataTypeJavaData( |
|
134 "EMMCScBkupOwnerDataTypeJavaData" |
|
135 ); |
|
136 const QString const_bkup_EMMCScBkupOwnerDataTypePublicData( |
|
137 "EMMCScBkupOwnerDataTypePublicData" |
|
138 ); |
|
139 const QString const_bkup_EMMCScBkupOwnerDataTypeSystemData( |
|
140 "EMMCScBkupOwnerDataTypeSystemData" |
|
141 ); |
|
142 const QString const_bkup_EMMCScBkupOwnerDataTypeActiveData( |
|
143 "EMMCScBkupOwnerDataTypeActiveData" |
|
144 ); |
|
145 const QString const_bkup_EMMCScBkupOwnerDataTypePassiveData( |
|
146 "EMMCScBkupOwnerDataTypePassiveData" |
|
147 ); |
|
148 |
|
149 } |
|
150 |
|
151 class ConfigStringConverter |
|
152 { |
|
153 public: |
|
154 static unsigned int drivesAndOperations_DriveToUInt( bool* ok, QString paramString ) |
|
155 { |
|
156 unsigned int ret = 0; |
|
157 *ok = false; |
|
158 if ( paramString.contains( |
|
159 FmBkupEngineCommon::const_bkup_EBkupDeviceMemories, |
|
160 Qt::CaseInsensitive ) ){ |
|
161 *ok = true; |
|
162 ret |= FmBkupEngineCommon::EBkupDeviceMemories; |
|
163 } |
|
164 if ( paramString.contains( |
|
165 FmBkupEngineCommon::const_bkup_EBkupInternalMassStorages, |
|
166 Qt::CaseInsensitive ) ){ |
|
167 *ok = true; |
|
168 ret |= FmBkupEngineCommon::EBkupInternalMassStorages; |
|
169 } |
|
170 if ( paramString.contains( |
|
171 FmBkupEngineCommon::const_bkup_EBkupExternalMassStorages, |
|
172 Qt::CaseInsensitive ) ){ |
|
173 *ok = true; |
|
174 ret |= FmBkupEngineCommon::EBkupExternalMassStorages; |
|
175 } |
|
176 return ret; |
|
177 } |
|
178 |
|
179 static unsigned int drivesAndOperations_TypeToUInt( |
|
180 bool* ok, QString paramString ) |
|
181 { |
|
182 unsigned int ret = 0; |
|
183 *ok = false; |
|
184 if ( paramString.contains( |
|
185 FmBkupEngineCommon::const_bkup_EMMCScBkupOwnerDataTypeDataOwner, |
|
186 Qt::CaseInsensitive ) ){ |
|
187 *ok = true; |
|
188 ret |= FmBkupEngineCommon::EMMCScBkupOwnerDataTypeDataOwner; |
|
189 } |
|
190 if ( paramString.contains( |
|
191 FmBkupEngineCommon::const_bkup_EMMCScBkupOwnerDataTypeJavaData, |
|
192 Qt::CaseInsensitive ) ){ |
|
193 *ok = true; |
|
194 ret |= FmBkupEngineCommon::EMMCScBkupOwnerDataTypeJavaData; |
|
195 } |
|
196 if ( paramString.contains( |
|
197 FmBkupEngineCommon::const_bkup_EMMCScBkupOwnerDataTypePublicData, |
|
198 Qt::CaseInsensitive ) ){ |
|
199 *ok = true; |
|
200 ret |= FmBkupEngineCommon::EMMCScBkupOwnerDataTypePublicData; |
|
201 } |
|
202 if ( paramString.contains( |
|
203 FmBkupEngineCommon::const_bkup_EMMCScBkupOwnerDataTypeSystemData, |
|
204 Qt::CaseInsensitive ) ){ |
|
205 *ok = true; |
|
206 ret |= FmBkupEngineCommon::EMMCScBkupOwnerDataTypeSystemData; |
|
207 } |
|
208 if ( paramString.contains( |
|
209 FmBkupEngineCommon::const_bkup_EMMCScBkupOwnerDataTypeActiveData, |
|
210 Qt::CaseInsensitive ) ){ |
|
211 *ok = true; |
|
212 ret |= FmBkupEngineCommon::EMMCScBkupOwnerDataTypeActiveData; |
|
213 } |
|
214 if ( paramString.contains( |
|
215 FmBkupEngineCommon::const_bkup_EMMCScBkupOwnerDataTypePassiveData, |
|
216 Qt::CaseInsensitive ) ){ |
|
217 *ok = true; |
|
218 ret |= FmBkupEngineCommon::EMMCScBkupOwnerDataTypePassiveData; |
|
219 } |
|
220 return ret; |
|
221 } |
|
222 |
|
223 static unsigned int backupCategory_CategoryToUInt( |
|
224 bool* ok, QString paramString ) |
|
225 { |
|
226 unsigned int ret = 0; |
|
227 *ok = false; |
|
228 if ( paramString.contains( |
|
229 FmBkupEngineCommon::const_Bkup_EBUCatSettings, |
|
230 Qt::CaseInsensitive ) ){ |
|
231 *ok = true; |
|
232 ret |= FmBkupEngineCommon::EBUCatSettings; |
|
233 } |
|
234 if ( paramString.contains( |
|
235 FmBkupEngineCommon::const_Bkup_EBUCatMessages, |
|
236 Qt::CaseInsensitive ) ){ |
|
237 *ok = true; |
|
238 ret |= FmBkupEngineCommon::EBUCatMessages; |
|
239 } |
|
240 if ( paramString.contains( |
|
241 FmBkupEngineCommon::const_Bkup_EBUCatContacts, |
|
242 Qt::CaseInsensitive ) ){ |
|
243 *ok = true; |
|
244 ret |= FmBkupEngineCommon::EBUCatContacts; |
|
245 } |
|
246 if ( paramString.contains( |
|
247 FmBkupEngineCommon::const_Bkup_EBUCatCalendar, |
|
248 Qt::CaseInsensitive ) ){ |
|
249 *ok = true; |
|
250 ret |= FmBkupEngineCommon::EBUCatCalendar; |
|
251 } |
|
252 if ( paramString.contains( |
|
253 FmBkupEngineCommon::const_Bkup_EBUCatBookmarks, |
|
254 Qt::CaseInsensitive ) ){ |
|
255 *ok = true; |
|
256 ret |= FmBkupEngineCommon::EBUCatBookmarks; |
|
257 } |
|
258 if ( paramString.contains( |
|
259 FmBkupEngineCommon::const_Bkup_EBUCatUserFiles, |
|
260 Qt::CaseInsensitive ) ){ |
|
261 *ok = true; |
|
262 ret |= FmBkupEngineCommon::EBUCatUserFiles; |
|
263 } |
|
264 if ( paramString.contains( |
|
265 FmBkupEngineCommon::const_Bkup_EBUCatAllInOne, |
|
266 Qt::CaseInsensitive ) ){ |
|
267 *ok = true; |
|
268 ret |= FmBkupEngineCommon::EBUCatAllInOne; |
|
269 } |
|
270 if ( paramString.contains( |
|
271 FmBkupEngineCommon::const_Bkup_EBUCatAllSeparately, |
|
272 Qt::CaseInsensitive ) ){ |
|
273 *ok = true; |
|
274 ret |= FmBkupEngineCommon::EBUCatAllSeparately; |
|
275 } |
|
276 return ret; |
|
277 } |
|
278 |
|
279 static unsigned int backupCategory_Special_flagsToUInt( |
|
280 bool* ok, QString paramString ) |
|
281 { |
|
282 unsigned int ret = 0; |
|
283 *ok = false; |
|
284 if ( paramString.contains( |
|
285 FmBkupEngineCommon::const_bkup_EBUCatSpecNone, |
|
286 Qt::CaseInsensitive ) ){ |
|
287 *ok = true; |
|
288 ret |= FmBkupEngineCommon::EBUCatSpecNone; |
|
289 } |
|
290 if ( paramString.contains( |
|
291 FmBkupEngineCommon::const_bkup_EBUCatSpecSystem, |
|
292 Qt::CaseInsensitive ) ){ |
|
293 *ok = true; |
|
294 ret |= FmBkupEngineCommon::EBUCatSpecSystem; |
|
295 } |
|
296 if ( paramString.contains( |
|
297 FmBkupEngineCommon::const_bkup_EBUCatSpecJava, |
|
298 Qt::CaseInsensitive ) ){ |
|
299 *ok = true; |
|
300 ret |= FmBkupEngineCommon::EBUCatSpecJava; |
|
301 } |
|
302 if ( paramString.contains( |
|
303 FmBkupEngineCommon::const_bkup_EBUCatSpecPublic, |
|
304 Qt::CaseInsensitive ) ){ |
|
305 *ok = true; |
|
306 ret |= FmBkupEngineCommon::EBUCatSpecPublic; |
|
307 } |
|
308 if ( paramString.contains( |
|
309 FmBkupEngineCommon::const_bkup_EBUCatSpecAll, |
|
310 Qt::CaseInsensitive ) ){ |
|
311 *ok = true; |
|
312 ret |= FmBkupEngineCommon::EBUCatSpecAll; |
|
313 } |
|
314 return ret; |
|
315 } |
|
316 }; |
|
317 class FmBkupDrivesAndOperation |
|
318 { |
|
319 public: |
|
320 FmBkupDrivesAndOperation(){} |
|
321 FmBkupDrivesAndOperation( unsigned int drvCategories, unsigned int ownerDataType ); |
|
322 FmBkupDrivesAndOperation( const FmBkupDrivesAndOperation &other ) |
|
323 { |
|
324 mDrvCategories = other.mDrvCategories; |
|
325 mOwnerDataType = other.mOwnerDataType; |
|
326 } |
|
327 |
|
328 void setDrvCategories( unsigned int drvCategories ){ mDrvCategories = drvCategories; } |
|
329 void setOwnerDataType( unsigned int ownerDataType ){ mOwnerDataType = ownerDataType; } |
|
330 |
|
331 unsigned int drvCategories(){ return mDrvCategories; } |
|
332 unsigned int ownerDataType(){ return mOwnerDataType; } |
|
333 private: |
|
334 unsigned int mDrvCategories; |
|
335 unsigned int mOwnerDataType; |
|
336 }; |
|
337 |
|
338 class FmBkupBackupCategory |
|
339 { |
|
340 public: |
|
341 FmBkupBackupCategory(){} |
|
342 FmBkupBackupCategory( const FmBkupBackupCategory &other ) |
|
343 { |
|
344 mCategory = other.mCategory; |
|
345 mArchive_name = other.mArchive_name; |
|
346 mSpecial_flags = other.mSpecial_flags; |
|
347 mExclude_special_flags = other.mExclude_special_flags; |
|
348 mUids = other.mUids; |
|
349 mExclude_uids = other.mExclude_uids; |
|
350 } |
|
351 ~FmBkupBackupCategory() |
|
352 { |
|
353 mUids.clear(); |
|
354 mExclude_uids.clear(); |
|
355 } |
|
356 |
|
357 void setCategory( unsigned int category ) |
|
358 { |
|
359 mCategory = category; |
|
360 } |
|
361 |
|
362 void setArchive_name( QString archive_name ) |
|
363 { |
|
364 mArchive_name = archive_name; |
|
365 } |
|
366 |
|
367 void setSpecial_flags( unsigned int special_flags ) |
|
368 { |
|
369 mSpecial_flags = special_flags; |
|
370 } |
|
371 |
|
372 void setExclude_special_flags( unsigned int exclude_special_flags ) |
|
373 { |
|
374 mExclude_special_flags = exclude_special_flags; |
|
375 } |
|
376 |
|
377 void addUids( unsigned int uid ) |
|
378 { |
|
379 mUids.append( uid); |
|
380 } |
|
381 |
|
382 void addExclude_uids( unsigned int exclude_uid ) |
|
383 { |
|
384 mExclude_uids.append( exclude_uid ); |
|
385 } |
|
386 |
|
387 unsigned int category() { return mCategory; } |
|
388 QString archive_name() { return mArchive_name; } |
|
389 unsigned int special_flags() { return mSpecial_flags; } |
|
390 unsigned int exclude_special_flags() { return mExclude_special_flags; } |
|
391 QList<unsigned int> *uids() { return &mUids; } |
|
392 QList<unsigned int> *exclude_uids() { return &mExclude_uids; } |
|
393 |
|
394 private: |
|
395 unsigned int mCategory; |
|
396 QString mArchive_name; |
|
397 unsigned int mSpecial_flags; |
|
398 unsigned int mExclude_special_flags; |
|
399 QList<unsigned int> mUids; |
|
400 QList<unsigned int> mExclude_uids; |
|
401 }; |
|
402 |
|
403 |
|
404 #endif //FMBKUPCOMMON_H |