1 /* |
|
2 * Copyright (c) 2005 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: CMMCScBkupOpParamsBase implementation |
|
15 * |
|
16 * |
|
17 */ |
|
18 |
|
19 #include "CMMCScBkupOperationParameters.h" |
|
20 |
|
21 // System includes |
|
22 #include <e32std.h> |
|
23 |
|
24 // User includes |
|
25 #include "MMCScBkupLogger.h" |
|
26 #include "CMMCScBkupDriveAndOperationTypeManager.h" |
|
27 #include "CMMCScBkupArchiveInfo.h" |
|
28 #include "BkupEngine.hrh" |
|
29 |
|
30 // ========================= MEMBER FUNCTIONS ================================ |
|
31 |
|
32 // --------------------------------------------------------------------------- |
|
33 // CMMCScBkupOpParamsBase::CMMCScBkupOpParamsBase() |
|
34 // |
|
35 // C++ constructor. |
|
36 // --------------------------------------------------------------------------- |
|
37 CMMCScBkupOpParamsBase::CMMCScBkupOpParamsBase() |
|
38 { |
|
39 } |
|
40 |
|
41 |
|
42 // --------------------------------------------------------------------------- |
|
43 // CMMCScBkupOpParamsBase::~CMMCScBkupOpParamsBase() |
|
44 // |
|
45 // C++ destructor. |
|
46 // --------------------------------------------------------------------------- |
|
47 EXPORT_C CMMCScBkupOpParamsBase::~CMMCScBkupOpParamsBase() |
|
48 { |
|
49 delete iDriveAndOperations; |
|
50 iArchiveInfos.ResetAndDestroy(); |
|
51 iArchiveInfos.Close(); |
|
52 } |
|
53 |
|
54 |
|
55 // --------------------------------------------------------------------------- |
|
56 // CMMCScBkupOpParamsBase::ConstructL() |
|
57 // |
|
58 // |
|
59 // --------------------------------------------------------------------------- |
|
60 void CMMCScBkupOpParamsBase::ConstructL( TResourceReader& aDriveReader, TBitFlags aCategories ) |
|
61 { |
|
62 iCategories = aCategories; |
|
63 iDriveAndOperations = CMMCScBkupDriveAndOperationTypeManager::NewL( aDriveReader ); |
|
64 } |
|
65 |
|
66 |
|
67 // --------------------------------------------------------------------------- |
|
68 // CMMCScBkupOpParamsBase::DriveAndOperations() |
|
69 // |
|
70 // |
|
71 // --------------------------------------------------------------------------- |
|
72 EXPORT_C const CMMCScBkupDriveAndOperationTypeManager& CMMCScBkupOpParamsBase::DriveAndOperations() const |
|
73 { |
|
74 return *iDriveAndOperations; |
|
75 } |
|
76 |
|
77 // --------------------------------------------------------------------------- |
|
78 // CMMCScBkupOpParamsBase::SetArchiveInfosL() |
|
79 // |
|
80 // |
|
81 // --------------------------------------------------------------------------- |
|
82 EXPORT_C void CMMCScBkupOpParamsBase::SetArchiveInfosL(RPointerArray<CMMCScBkupArchiveInfo>& aInfos) |
|
83 { |
|
84 iArchiveInfos.ResetAndDestroy(); |
|
85 |
|
86 for(TInt i = 0; i < aInfos.Count(); i++) |
|
87 { |
|
88 iArchiveInfos.AppendL(aInfos[i]); |
|
89 } |
|
90 } |
|
91 |
|
92 |
|
93 // --------------------------------------------------------------------------- |
|
94 // CMMCScBkupOpParamsBase::ArchiveInfos() |
|
95 // |
|
96 // |
|
97 // --------------------------------------------------------------------------- |
|
98 RMMCScBkupPointerArray<CMMCScBkupArchiveInfo>& CMMCScBkupOpParamsBase::ArchiveInfos() |
|
99 { |
|
100 return iArchiveInfos; |
|
101 } |
|
102 |
|
103 |
|
104 // --------------------------------------------------------------------------- |
|
105 // CMMCScBkupOpParamsBase::ArchiveInfo() |
|
106 // |
|
107 // |
|
108 // --------------------------------------------------------------------------- |
|
109 const CMMCScBkupArchiveInfo& CMMCScBkupOpParamsBase::ArchiveInfo(TBitFlags aCategory) const |
|
110 { |
|
111 CMMCScBkupArchiveInfo* archiveInfo = NULL; |
|
112 |
|
113 for(TInt i = 0; i < iArchiveInfos.Count(); i++) |
|
114 { |
|
115 archiveInfo = iArchiveInfos[i]; |
|
116 if(archiveInfo->Category() == aCategory) |
|
117 { |
|
118 break; |
|
119 } |
|
120 } |
|
121 |
|
122 return *archiveInfo; |
|
123 } |
|
124 |
|
125 |
|
126 // --------------------------------------------------------------------------- |
|
127 // CMMCScBkupOpParamsBase::FileName() |
|
128 // |
|
129 // |
|
130 // --------------------------------------------------------------------------- |
|
131 const TDesC& CMMCScBkupOpParamsBase::FileName(TInt aIndex) const |
|
132 { |
|
133 const TDesC* ret = &KNullDesC; |
|
134 const CMMCScBkupArchiveInfo& archiveInfo = *iArchiveInfos[aIndex]; |
|
135 |
|
136 if( archiveInfo.FileName().Length() ) |
|
137 { |
|
138 ret = &archiveInfo.FileName(); |
|
139 } |
|
140 |
|
141 return *ret; |
|
142 } |
|
143 |
|
144 |
|
145 // --------------------------------------------------------------------------- |
|
146 // CMMCScBkupOpParamsBackupFull::ReadFromResourceL() |
|
147 // |
|
148 // Read categories with associated data from resource |
|
149 // --------------------------------------------------------------------------- |
|
150 void CMMCScBkupOpParamsBackupFull::ReadFromResourceL( TResourceReader& aReader ) |
|
151 { |
|
152 TInt count( aReader.ReadInt16() ); |
|
153 |
|
154 for ( TInt i( 0 ); i < count; i++ ) |
|
155 { |
|
156 // Read category |
|
157 TBitFlags category = static_cast< TBitFlags >(aReader.ReadUint32()); |
|
158 |
|
159 // Read archive name |
|
160 const TDriveUnit driveUnit(iDrive); |
|
161 const TDriveName driveName(driveUnit.Name()); |
|
162 TFileName name; |
|
163 TPtrC archiveName( aReader.ReadTPtrC() ); |
|
164 |
|
165 name.Append(driveName); |
|
166 name.Append(KBackUpFolder()); |
|
167 name.Append(archiveName); |
|
168 |
|
169 // Read special flags |
|
170 TBitFlags flags = static_cast< TBitFlags >(aReader.ReadUint32()); |
|
171 TBitFlags excludedFlags = static_cast< TBitFlags >(aReader.ReadUint32()); |
|
172 |
|
173 // Read SIDs belonging to category |
|
174 TInt16 subCount = aReader.ReadInt16(); |
|
175 RArray<TSecureId> sids; |
|
176 CleanupClosePushL( sids ); |
|
177 |
|
178 for(TInt j = 0; j < subCount; j++) |
|
179 { |
|
180 sids.AppendL(static_cast<TSecureId>(aReader.ReadUint32())); |
|
181 } |
|
182 |
|
183 // Read excluded SIDs for category |
|
184 subCount = aReader.ReadInt16(); |
|
185 RArray<TSecureId> excludeSids; |
|
186 CleanupClosePushL( excludeSids ); |
|
187 |
|
188 for(TInt j = 0; j < subCount; j++) |
|
189 { |
|
190 excludeSids.AppendL(static_cast<TSecureId>(aReader.ReadUint32())); |
|
191 } |
|
192 |
|
193 TEntry entry; |
|
194 entry.iName = name; |
|
195 CMMCScBkupArchiveInfo* archiveInfo = CMMCScBkupArchiveInfo::NewLC( entry ); |
|
196 archiveInfo->SetCategory( category ); |
|
197 archiveInfo->SetSpecialFlags( flags ); |
|
198 archiveInfo->SetExcludedSpecialFlags( excludedFlags ); |
|
199 archiveInfo->SetSIDs( sids ); |
|
200 archiveInfo->SetExcludedSIDs( excludeSids ); |
|
201 |
|
202 // If the category is specified, then add it in list of categories to be archived |
|
203 #ifdef RD_FILE_MANAGER_BACKUP |
|
204 if( Categories().Value() & category.Value() ) |
|
205 #else |
|
206 if( category.Value() == EBUCatAllInOne ) |
|
207 #endif |
|
208 { |
|
209 __LOG1("CMMCScBkupOpParamsBase::ReadFromResourceL() - adding category 0x%x", category.Value()); |
|
210 RMMCScBkupPointerArray<CMMCScBkupArchiveInfo>& archives = ArchiveInfos(); |
|
211 archives.AppendL( archiveInfo ); |
|
212 CleanupStack::Pop( archiveInfo ); |
|
213 } |
|
214 else |
|
215 { |
|
216 __LOG1("CMMCScBkupOpParamsBase::ReadFromResourceL() - category 0x%x not included", category.Value()); |
|
217 CleanupStack::PopAndDestroy( archiveInfo ); |
|
218 } |
|
219 |
|
220 CleanupStack::PopAndDestroy( &excludeSids ); |
|
221 CleanupStack::PopAndDestroy( &sids ); |
|
222 } |
|
223 } |
|
224 |
|
225 |
|
226 |
|
227 |
|
228 |
|
229 |
|
230 |
|
231 |
|
232 |
|
233 |
|
234 |
|
235 |
|
236 |
|
237 |
|
238 |
|
239 |
|
240 |
|
241 |
|
242 |
|
243 |
|
244 // ========================= MEMBER FUNCTIONS ================================ |
|
245 |
|
246 // --------------------------------------------------------------------------- |
|
247 // CMMCScBkupOpParamsBackupFull::CMMCScBkupOpParamsBackupFull() |
|
248 // |
|
249 // C++ constructor. |
|
250 // --------------------------------------------------------------------------- |
|
251 CMMCScBkupOpParamsBackupFull::CMMCScBkupOpParamsBackupFull( TDriveNumber aDrive ) |
|
252 : iDrive( aDrive ) |
|
253 { |
|
254 } |
|
255 |
|
256 |
|
257 // --------------------------------------------------------------------------- |
|
258 // CMMCScBkupOpParamsBackupFull::~CMMCScBkupOpParamsBackupFull() |
|
259 // |
|
260 // C++ destructor. |
|
261 // --------------------------------------------------------------------------- |
|
262 EXPORT_C CMMCScBkupOpParamsBackupFull::~CMMCScBkupOpParamsBackupFull() |
|
263 { |
|
264 } |
|
265 |
|
266 // --------------------------------------------------------------------------- |
|
267 // CMMCScBkupOpParamsBackupFull::ConstructL() |
|
268 // |
|
269 // |
|
270 // --------------------------------------------------------------------------- |
|
271 void CMMCScBkupOpParamsBackupFull::ConstructL( TResourceReader& aDriveReader, TResourceReader& aCategoryReader, |
|
272 TBitFlags aCategories ) |
|
273 { |
|
274 CMMCScBkupOpParamsBase::ConstructL( aDriveReader, aCategories ); |
|
275 ReadFromResourceL( aCategoryReader ); |
|
276 } |
|
277 |
|
278 |
|
279 // --------------------------------------------------------------------------- |
|
280 // CMMCScBkupOpParamsBackupFull::NewL() |
|
281 // |
|
282 // |
|
283 // --------------------------------------------------------------------------- |
|
284 EXPORT_C CMMCScBkupOpParamsBackupFull* CMMCScBkupOpParamsBackupFull::NewL( TResourceReader& aDriveReader, TResourceReader& aCategoryReader, |
|
285 TDriveNumber aDrive, TBitFlags aCategories ) |
|
286 { |
|
287 CMMCScBkupOpParamsBackupFull* self = new(ELeave) CMMCScBkupOpParamsBackupFull( aDrive ); |
|
288 CleanupStack::PushL( self ); |
|
289 self->ConstructL( aDriveReader, aCategoryReader, aCategories ); |
|
290 CleanupStack::Pop( self ); |
|
291 return self; |
|
292 } |
|
293 |
|
294 |
|
295 // --------------------------------------------------------------------------- |
|
296 // CMMCScBkupOpParamsBackupFull::AssociatedOpType() |
|
297 // |
|
298 // |
|
299 // --------------------------------------------------------------------------- |
|
300 EXPORT_C TMMCScBkupOperationType CMMCScBkupOpParamsBackupFull::AssociatedOpType() const |
|
301 { |
|
302 return EMMCScBkupOperationTypeFullBackup; |
|
303 } |
|
304 |
|
305 |
|
306 // --------------------------------------------------------------------------- |
|
307 // CMMCScBkupOpParamsBackupFull::PartType() |
|
308 // |
|
309 // |
|
310 // --------------------------------------------------------------------------- |
|
311 EXPORT_C TBURPartType CMMCScBkupOpParamsBackupFull::PartType() const |
|
312 { |
|
313 return EBURBackupFull; |
|
314 } |
|
315 |
|
316 |
|
317 // --------------------------------------------------------------------------- |
|
318 // CMMCScBkupOpParamsBackupFull::IncrementType() |
|
319 // |
|
320 // |
|
321 // --------------------------------------------------------------------------- |
|
322 EXPORT_C TBackupIncType CMMCScBkupOpParamsBackupFull::IncrementType() const |
|
323 { |
|
324 return EBackupBase; |
|
325 } |
|
326 |
|
327 |
|
328 // --------------------------------------------------------------------------- |
|
329 // CMMCScBkupOpParamsBackupFull::PassiveTransferType() |
|
330 // |
|
331 // |
|
332 // --------------------------------------------------------------------------- |
|
333 EXPORT_C TTransferDataType CMMCScBkupOpParamsBackupFull::PassiveTransferType() const |
|
334 { |
|
335 return EPassiveBaseData; |
|
336 } |
|
337 |
|
338 |
|
339 // --------------------------------------------------------------------------- |
|
340 // CMMCScBkupOpParamsBackupFull::ActiveTransferType() |
|
341 // |
|
342 // |
|
343 // --------------------------------------------------------------------------- |
|
344 EXPORT_C TTransferDataType CMMCScBkupOpParamsBackupFull::ActiveTransferType() const |
|
345 { |
|
346 return EActiveBaseData; |
|
347 } |
|
348 |
|
349 |
|
350 // --------------------------------------------------------------------------- |
|
351 // CMMCScBkupOpParamsBackupFull::PackageTransferType() |
|
352 // |
|
353 // |
|
354 // --------------------------------------------------------------------------- |
|
355 EXPORT_C TPackageDataType CMMCScBkupOpParamsBackupFull::PackageTransferType() const |
|
356 { |
|
357 return ESystemData; |
|
358 } |
|
359 |
|
360 |
|
361 |
|
362 |
|
363 |
|
364 |
|
365 |
|
366 |
|
367 |
|
368 |
|
369 |
|
370 |
|
371 |
|
372 |
|
373 |
|
374 |
|
375 |
|
376 |
|
377 |
|
378 |
|
379 |
|
380 |
|
381 |
|
382 |
|
383 |
|
384 |
|
385 |
|
386 |
|
387 |
|
388 // ========================= MEMBER FUNCTIONS ================================ |
|
389 |
|
390 // --------------------------------------------------------------------------- |
|
391 // CMMCScBkupOpParamsRestoreFull::CMMCScBkupOpParamsRestoreFull() |
|
392 // |
|
393 // C++ constructor. |
|
394 // --------------------------------------------------------------------------- |
|
395 CMMCScBkupOpParamsRestoreFull::CMMCScBkupOpParamsRestoreFull() |
|
396 { |
|
397 } |
|
398 |
|
399 |
|
400 // --------------------------------------------------------------------------- |
|
401 // CMMCScBkupOpParamsRestoreFull::~CMMCScBkupOpParamsRestoreFull() |
|
402 // |
|
403 // C++ destructor. |
|
404 // --------------------------------------------------------------------------- |
|
405 EXPORT_C CMMCScBkupOpParamsRestoreFull::~CMMCScBkupOpParamsRestoreFull() |
|
406 { |
|
407 } |
|
408 |
|
409 |
|
410 // --------------------------------------------------------------------------- |
|
411 // CMMCScBkupOpParamsRestoreFull::NewL() |
|
412 // |
|
413 // |
|
414 // --------------------------------------------------------------------------- |
|
415 EXPORT_C CMMCScBkupOpParamsRestoreFull* CMMCScBkupOpParamsRestoreFull::NewL( TResourceReader& aDriveReader, TBitFlags aCategories ) |
|
416 { |
|
417 CMMCScBkupOpParamsRestoreFull* self = new(ELeave) CMMCScBkupOpParamsRestoreFull( ); |
|
418 CleanupStack::PushL( self ); |
|
419 self->ConstructL( aDriveReader, aCategories ); |
|
420 CleanupStack::Pop( self ); |
|
421 return self; |
|
422 } |
|
423 |
|
424 |
|
425 // --------------------------------------------------------------------------- |
|
426 // CMMCScBkupOpParamsRestoreFull::AssociatedOpType() |
|
427 // |
|
428 // |
|
429 // --------------------------------------------------------------------------- |
|
430 EXPORT_C TMMCScBkupOperationType CMMCScBkupOpParamsRestoreFull::AssociatedOpType() const |
|
431 { |
|
432 return EMMCScBkupOperationTypeFullRestore; |
|
433 } |
|
434 |
|
435 |
|
436 // --------------------------------------------------------------------------- |
|
437 // CMMCScBkupOpParamsRestoreFull::PartType() |
|
438 // |
|
439 // |
|
440 // --------------------------------------------------------------------------- |
|
441 EXPORT_C TBURPartType CMMCScBkupOpParamsRestoreFull::PartType() const |
|
442 { |
|
443 return EBURRestoreFull; |
|
444 } |
|
445 |
|
446 |
|
447 // --------------------------------------------------------------------------- |
|
448 // CMMCScBkupOpParamsRestoreFull::IncrementType() |
|
449 // |
|
450 // |
|
451 // --------------------------------------------------------------------------- |
|
452 EXPORT_C TBackupIncType CMMCScBkupOpParamsRestoreFull::IncrementType() const |
|
453 { |
|
454 return EBackupBase; |
|
455 } |
|
456 |
|
457 |
|
458 // --------------------------------------------------------------------------- |
|
459 // CMMCScBkupOpParamsRestoreFull::PassiveTransferType() |
|
460 // |
|
461 // |
|
462 // --------------------------------------------------------------------------- |
|
463 EXPORT_C TTransferDataType CMMCScBkupOpParamsRestoreFull::PassiveTransferType() const |
|
464 { |
|
465 return EPassiveBaseData; |
|
466 } |
|
467 |
|
468 |
|
469 // --------------------------------------------------------------------------- |
|
470 // CMMCScBkupOpParamsRestoreFull::ActiveTransferType() |
|
471 // |
|
472 // |
|
473 // --------------------------------------------------------------------------- |
|
474 EXPORT_C TTransferDataType CMMCScBkupOpParamsRestoreFull::ActiveTransferType() const |
|
475 { |
|
476 return EActiveBaseData; |
|
477 } |
|
478 |
|
479 |
|
480 // --------------------------------------------------------------------------- |
|
481 // CMMCScBkupOpParamsRestoreFull::PackageTransferType() |
|
482 // |
|
483 // |
|
484 // --------------------------------------------------------------------------- |
|
485 EXPORT_C TPackageDataType CMMCScBkupOpParamsRestoreFull::PackageTransferType() const |
|
486 { |
|
487 return ESystemData; |
|
488 } |
|
489 |
|
490 |
|