|
1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef __CBACKUPRESTORENOTIFICATION_H__ |
|
17 #define __CBACKUPRESTORENOTIFICATION_H__ |
|
18 |
|
19 // System includes |
|
20 #include <e32base.h> |
|
21 #include <s32file.h> |
|
22 |
|
23 #include <e32property.h> |
|
24 #include <connect/sbdefs.h> |
|
25 |
|
26 // User includes |
|
27 #include "MBackupRestoreNotificationObserver.h" |
|
28 |
|
29 /** |
|
30 The CBackupRestoreNotification |
|
31 A "wrapper" class around the Backup & Restore notification mechanisms |
|
32 Configured to use Publish & Subscribe Flag |
|
33 |
|
34 @internalTechnology |
|
35 @released |
|
36 */ |
|
37 |
|
38 class CBackupRestoreNotification : |
|
39 public CActive |
|
40 { |
|
41 |
|
42 public: |
|
43 IMPORT_C static CBackupRestoreNotification* NewL(const TDesC& aFilename, |
|
44 MBackupRestoreNotificationObserver& aCallback); |
|
45 IMPORT_C ~CBackupRestoreNotification(); |
|
46 IMPORT_C TBool BackupInProgress() const; |
|
47 IMPORT_C TBool RestoreInProgress() const; |
|
48 |
|
49 private: |
|
50 CBackupRestoreNotification(MBackupRestoreNotificationObserver& aCallback); |
|
51 void ConstructL(const TDesC& aFilename); |
|
52 |
|
53 void ReceivedNotificationL(TInt aNewState); |
|
54 void ProcessInitialStateL(TInt aNewState); |
|
55 void DoCancel(); |
|
56 void RunL(); |
|
57 TInt RunError(TInt aError); |
|
58 |
|
59 private: |
|
60 |
|
61 /** |
|
62 * Publish & Subscribe object used to tell when a Backup/Restore event has occured. |
|
63 */ |
|
64 RProperty iBackupNotification; |
|
65 |
|
66 /** |
|
67 * Current state of Backup Restore. This stores the flags value when they change. |
|
68 * and can be checked the next time they change. |
|
69 */ |
|
70 TInt iCurrentState; |
|
71 |
|
72 /** |
|
73 * Means by which an object can be notified of an operation. |
|
74 */ |
|
75 MBackupRestoreNotificationObserver& iObserver; |
|
76 |
|
77 }; |
|
78 |
|
79 #endif // __CBACKUPRESTORENOTIFICATION_H__ |