|
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: Listens for changes in one CommsDat table through CenRep. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CMCOMMSDATNOTIFIER_H |
|
19 #define CMCOMMSDATNOTIFIER_H |
|
20 |
|
21 _LIT( KIapDisappear, "Iap disappears from CommsDat" ); |
|
22 _LIT( KDestDisappear, "Destination disappears from CommsDat" ); |
|
23 |
|
24 class CCmManagerImpl; |
|
25 class CRepository; |
|
26 class MCmCommsDatWatcher; |
|
27 |
|
28 // A stack to store watchers |
|
29 typedef CArrayPtrFlat<MCmCommsDatWatcher> CCmCallBackArray; |
|
30 |
|
31 // Used to notify parent view what happens during son's view editing. |
|
32 const TInt KCmNotifiedNone = 0; |
|
33 const TInt KCmNotifiedDestinationDisappear = 1; |
|
34 const TInt KCmNotifiedIapIsNotInThisDestination = 2; |
|
35 const TInt KCmNotifiedIapDisappear = 3; |
|
36 |
|
37 class MCmCommsDatWatcher |
|
38 { |
|
39 public: |
|
40 // watcher should implement this function to get the notification of CommsDat changes. |
|
41 // see class CCmManagerImpl for watcher registration |
|
42 virtual void CommsDatChangesL() = 0; |
|
43 }; |
|
44 |
|
45 // Used for son's watcher to notify parent watcher that CommsDat has changes |
|
46 // if farther watcher wants to know what heppens when son's watcher exiting |
|
47 class CCmParentViewNotifier |
|
48 { |
|
49 public: |
|
50 virtual void NotifyParentView( TInt aValue ) = 0; |
|
51 }; |
|
52 |
|
53 /* |
|
54 * CommsDat can suddenly change with some reasons, e.g., an application may suddenly add/delete a destination |
|
55 * and Iap. Those changes may affect CmManager. This class will listen to changes in one CommsDat table |
|
56 * through CenRep and inform related watcher that is interesting in CommsDat changes. |
|
57 */ |
|
58 NONSHARABLE_CLASS( CCmCommsDatNotifier ) : public CActive |
|
59 { |
|
60 public: |
|
61 |
|
62 static CCmCommsDatNotifier* NewL( TUint32 aTableId ); |
|
63 |
|
64 static CCmCommsDatNotifier* NewLC( TUint32 aTableId ); |
|
65 |
|
66 virtual ~CCmCommsDatNotifier(); |
|
67 |
|
68 void WatcherRegisterL( MCmCommsDatWatcher* aWatcher ); |
|
69 void WatcherUnRegister( ); |
|
70 |
|
71 private: |
|
72 CCmCommsDatNotifier( TUint32 aTableId ); |
|
73 |
|
74 void ConstructL(); |
|
75 TInt RequestNotifications(); |
|
76 |
|
77 void DeleteCallBackArray(); |
|
78 |
|
79 private: // Methods from base class |
|
80 void DoCancel(); |
|
81 void RunL(); |
|
82 |
|
83 private: |
|
84 TUint32 iTableId; |
|
85 CRepository* iRepository; |
|
86 MCmCommsDatWatcher* iWatcher; // callback object that wants to see changes in CommsDat |
|
87 CCmCallBackArray* iCallBackArray; // used as stack to go to the next view |
|
88 }; |
|
89 |
|
90 #endif // CMCOMMSDATNOTIFIER_H |
|
91 |
|
92 // End-of-file |