|
1 /* |
|
2 * Copyright (c) 2008-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: Observes Backup & Restore's state key and status -* |
|
15 */ |
|
16 |
|
17 |
|
18 #ifndef CTBACKUPSUBSCRIBER_H |
|
19 #define CTBACKUPSUBSCRIBER_H |
|
20 |
|
21 // SYSTEM INCLUDE |
|
22 #include <e32base.h> |
|
23 #include <e32cmn.h> |
|
24 |
|
25 // USER INCLUDE |
|
26 #include "mpropertyobserver.h" |
|
27 |
|
28 // FORWARD CLASS DECLERATION |
|
29 class CPropertyWatcher; |
|
30 |
|
31 /** |
|
32 * Observer interface for Backup & Restore changes. |
|
33 */ |
|
34 class MBackupRestoreObserver |
|
35 { |
|
36 public: |
|
37 /** |
|
38 * Called by CBlacklistBackupSubscriberAO when |
|
39 * Backup&Restore is backing up or restoring. |
|
40 */ |
|
41 virtual void BackupRestoreStart() = 0; |
|
42 |
|
43 /** |
|
44 * Called by CBlacklistBackupSubscriberAO when |
|
45 * Backup&Restore has finished backup or restore. |
|
46 */ |
|
47 virtual void BackupRestoreReady() = 0; |
|
48 }; |
|
49 |
|
50 /** |
|
51 * This class implements object for watching |
|
52 * Backup & Restore is state. |
|
53 */ |
|
54 NONSHARABLE_CLASS( CBackupSubscriber ) : public CBase, public MKeyAndStatusObserver |
|
55 { |
|
56 public: |
|
57 |
|
58 /** |
|
59 * Creates and constructs a new instance of CBackupSubscriber. |
|
60 * |
|
61 * @return A pointer to the new instance. |
|
62 */ |
|
63 static CBackupSubscriber* NewL( MBackupRestoreObserver& aObserver ); |
|
64 |
|
65 /** |
|
66 * Destructor. |
|
67 */ |
|
68 virtual ~CBackupSubscriber(); |
|
69 |
|
70 public: |
|
71 /* |
|
72 @function NotifyKeyAndStatusL - get called when propertys value has changed. |
|
73 @param aKeyValue - key's value. |
|
74 @param aStatus - active object status, get from CListener object. |
|
75 @param aPropertyCategory observed key's category. |
|
76 @param aKey observed key. |
|
77 */ |
|
78 void CBackupSubscriber::NotifyKeyAndStatusL( |
|
79 const TInt aKeyValue, |
|
80 TRequestStatus& aStatus, |
|
81 const TUid aPropertyCategory, |
|
82 const TUint aKey ); |
|
83 |
|
84 |
|
85 private: |
|
86 |
|
87 /** |
|
88 * Default constructor, implicitly called by NewL(). |
|
89 */ |
|
90 CBackupSubscriber( MBackupRestoreObserver& aObserver ); |
|
91 |
|
92 /** |
|
93 * 2nd phase construction, called by NewL(). |
|
94 */ |
|
95 void ConstructL(); |
|
96 |
|
97 /** |
|
98 * Check Backup & Restore's state key status and act accordingly. |
|
99 */ |
|
100 void CheckBackupState( const TInt aKeyValue, TRequestStatus& aStatus ); |
|
101 |
|
102 private: // data |
|
103 |
|
104 /*iPropertyWatcher - constains observed key's, owned by this class*/ |
|
105 CPropertyWatcher* iPropertyWatcher; |
|
106 |
|
107 /*iObserver - callback for HarvesterAO to notify when backup/restore starts.*/ |
|
108 MBackupRestoreObserver& iObserver; |
|
109 }; |
|
110 |
|
111 #endif // CTBACKUPSUBSCRIBER_H |