|
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: |
|
15 * Implementation of class CFavouritesSrvDbNotifier |
|
16 * |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 |
|
23 #include "FavouritesSrvDbNotifier.h" |
|
24 #include "FavouritesSrvDb.h" |
|
25 #include "FavouritesPanic.h" |
|
26 |
|
27 // ================= MEMBER FUNCTIONS ======================= |
|
28 |
|
29 // --------------------------------------------------------- |
|
30 // CFavouritesSrvDbNotifier::NewL |
|
31 // --------------------------------------------------------- |
|
32 // |
|
33 CFavouritesSrvDbNotifier* CFavouritesSrvDbNotifier::NewL |
|
34 ( CFavouritesSrvDb& aDb ) |
|
35 { |
|
36 CFavouritesSrvDbNotifier* notif = new (ELeave) CFavouritesSrvDbNotifier(); |
|
37 CleanupStack::PushL( notif ); |
|
38 notif->ConstructL( aDb ); |
|
39 CleanupStack::Pop( notif ); |
|
40 return notif; |
|
41 } |
|
42 |
|
43 // --------------------------------------------------------- |
|
44 // CFavouritesSrvDbNotifier::~CFavouritesSrvDbNotifier |
|
45 // --------------------------------------------------------- |
|
46 // |
|
47 CFavouritesSrvDbNotifier::~CFavouritesSrvDbNotifier() |
|
48 { |
|
49 Cancel(); |
|
50 iNotifier.Close(); |
|
51 } |
|
52 |
|
53 // --------------------------------------------------------- |
|
54 // CFavouritesSrvDbNotifier::CFavouritesSrvDbNotifier |
|
55 // --------------------------------------------------------- |
|
56 // |
|
57 CFavouritesSrvDbNotifier::CFavouritesSrvDbNotifier() |
|
58 : CActive( EPriorityStandard ) |
|
59 { |
|
60 CActiveScheduler::Add( this ); |
|
61 } |
|
62 |
|
63 // --------------------------------------------------------- |
|
64 // CFavouritesSrvDbNotifier::ConstructL |
|
65 // --------------------------------------------------------- |
|
66 // |
|
67 void CFavouritesSrvDbNotifier::ConstructL( CFavouritesSrvDb& aDb ) |
|
68 { |
|
69 User::LeaveIfError( iNotifier.Open( aDb.Database() ) ); |
|
70 } |
|
71 |
|
72 // --------------------------------------------------------- |
|
73 // CFavouritesSrvDbNotifier::RunL |
|
74 // --------------------------------------------------------- |
|
75 // |
|
76 void CFavouritesSrvDbNotifier::RunL() |
|
77 { |
|
78 iMessage.Complete( iStatus.Int() ); |
|
79 } |
|
80 |
|
81 // --------------------------------------------------------- |
|
82 // CFavouritesSrvDbNotifier::DoCancel |
|
83 // --------------------------------------------------------- |
|
84 // |
|
85 void CFavouritesSrvDbNotifier::DoCancel() |
|
86 { |
|
87 iNotifier.Cancel(); |
|
88 iMessage.Complete( KErrCancel ); |
|
89 } |
|
90 |
|
91 // --------------------------------------------------------- |
|
92 // CFavouritesSrvDbNotifier::NotifyAllEvents |
|
93 // --------------------------------------------------------- |
|
94 // |
|
95 void CFavouritesSrvDbNotifier::NotifyAllEvents( const RMessage2& aMessage ) |
|
96 { |
|
97 __ASSERT_DEBUG( !IsActive(), FavouritesPanic( EFavouritesInternal ) ); |
|
98 iMessage = aMessage; |
|
99 iNotifier.NotifyUnlock( iStatus ); |
|
100 SetActive(); |
|
101 } |
|
102 |
|
103 // --------------------------------------------------------- |
|
104 // CFavouritesSrvDbNotifier::NotifyChange |
|
105 // --------------------------------------------------------- |
|
106 // |
|
107 void CFavouritesSrvDbNotifier::NotifyChange( const RMessage2& aMessage ) |
|
108 { |
|
109 __ASSERT_DEBUG( !IsActive(), FavouritesPanic( EFavouritesInternal ) ); |
|
110 iMessage = aMessage; |
|
111 iNotifier.NotifyChange( iStatus ); |
|
112 SetActive(); |
|
113 } |
|
114 |
|
115 // End of File |