|
1 /* |
|
2 * Copyright (c) 2004 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 the License "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: Declaration of CActiveFavouritesDbNotifier. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef ACTIVE_FAVOURITES_DB_NOTIFIER_H |
|
20 #define ACTIVE_FAVOURITES_DB_NOTIFIER_H |
|
21 |
|
22 // INCLUDES |
|
23 |
|
24 #include <e32base.h> |
|
25 #include <d32dbms.h> |
|
26 #include <FavouritesDbNotifier.h> |
|
27 |
|
28 // FORWARD DECLARATION |
|
29 |
|
30 class RFavouritesDb; |
|
31 class MFavouritesDbObserver; |
|
32 |
|
33 // CLASS DECLARATION |
|
34 |
|
35 /** |
|
36 * ActiveFavouritesDbNotifier is an Active object encapsulating a favourites database notifier. |
|
37 * Once this notifier is Start()-ed, it keeps watching the database and notifies the |
|
38 * observer, until the database is closed by all clients (i.e. released by |
|
39 * DBMS), or it is DoCancel()-led. |
|
40 */ |
|
41 class CActiveFavouritesDbNotifier : public CActive |
|
42 { |
|
43 public: // Constructor and destructor |
|
44 |
|
45 /** |
|
46 * Constructor. |
|
47 * @since 0.9 |
|
48 * @param aDb The favourites database to watch for. |
|
49 * @param aObserver The Observer to be notified about database events. |
|
50 */ |
|
51 IMPORT_C CActiveFavouritesDbNotifier( RFavouritesDb& aDb, MFavouritesDbObserver& aObserver ); |
|
52 |
|
53 /** |
|
54 * Destructor. |
|
55 */ |
|
56 IMPORT_C virtual ~CActiveFavouritesDbNotifier(); |
|
57 |
|
58 protected: // from CActive |
|
59 |
|
60 /** |
|
61 * Invoked when the outstanding request completes. |
|
62 * @since 0.9 |
|
63 * @return void |
|
64 */ |
|
65 IMPORT_C void RunL(); |
|
66 |
|
67 /** |
|
68 * Cancel any outstading request. It's implementation of the Cancel protocol; |
|
69 * @since 0.9 |
|
70 * @return void |
|
71 */ |
|
72 IMPORT_C void DoCancel(); |
|
73 |
|
74 public: // new methods |
|
75 |
|
76 /** |
|
77 * Start the notifier. The notification request is automatically |
|
78 * renewed until it is cancelled, or the database is closed by |
|
79 * all clients (i.e. released by DBMS). |
|
80 * @since 0.9 |
|
81 * @return Error code. |
|
82 */ |
|
83 IMPORT_C TInt Start(); |
|
84 |
|
85 private: |
|
86 |
|
87 /** |
|
88 * Request database change notification from the Favourites Engine. |
|
89 * @since 0.9 |
|
90 * @return void |
|
91 */ |
|
92 void NotifyChange(); |
|
93 |
|
94 private: // data |
|
95 |
|
96 RFavouritesDbNotifier iNotifier; ///< Notifier object. |
|
97 RFavouritesDb& iDb; ///< Handle to the database. |
|
98 MFavouritesDbObserver* iObserver; ///< Pointer to observer. |
|
99 }; |
|
100 |
|
101 #endif |
|
102 |
|
103 // End of File |