|
1 /* |
|
2 * Copyright (c) 2005-2007 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: Phonebook 2 server application start-up monitor. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPBK2SERVERAPPMONITOR_H |
|
20 #define CPBK2SERVERAPPMONITOR_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <badesca.h> |
|
24 #include <MPbk2StartupMonitor.h> |
|
25 #include <MVPbkContactStoreObserver.h> |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class MPbk2AppUiExtension; |
|
29 class MVPbkContactStoreList; |
|
30 class MPbk2ServerAppStartupObserver; |
|
31 class CEikonEnv; |
|
32 |
|
33 // CLASS DECLARATION |
|
34 |
|
35 /** |
|
36 * Phonebook 2 server application start-up monitor. |
|
37 */ |
|
38 class CPbk2ServerAppMonitor : public CBase, |
|
39 public MPbk2StartupMonitor, |
|
40 private MVPbkContactStoreObserver |
|
41 { |
|
42 public: // Constructors and destructor |
|
43 |
|
44 /** |
|
45 * Creates a new instance of this class. |
|
46 * |
|
47 * @param aStoreList List of stores to monitor. |
|
48 * @param aObserver Observer. |
|
49 * @return A new instance of this class. |
|
50 */ |
|
51 static CPbk2ServerAppMonitor* NewL( |
|
52 const MVPbkContactStoreList& aStoreList, |
|
53 MPbk2ServerAppStartupObserver& aObserver ); |
|
54 |
|
55 /** |
|
56 * Destructor. |
|
57 */ |
|
58 virtual ~CPbk2ServerAppMonitor(); |
|
59 |
|
60 public: // Interface |
|
61 |
|
62 /** |
|
63 * Call at start-up begin. |
|
64 */ |
|
65 void StartupBeginsL(); |
|
66 |
|
67 public: // From MPbk2StartupMonitor |
|
68 void HandleStartupComplete(); |
|
69 void HandleStartupFailed( |
|
70 TInt aError ); |
|
71 void RegisterEventsL( |
|
72 MPbk2StartupObserver& aObserver ); |
|
73 void DeregisterEvents( |
|
74 MPbk2StartupObserver& aObserver ); |
|
75 void NotifyViewActivationL( |
|
76 TUid aViewId ); |
|
77 void NotifyViewActivationL( |
|
78 TUid aViewId, MVPbkContactViewBase& aContactView ); |
|
79 |
|
80 private: // From MVPbkContactStoreObserver |
|
81 void StoreReady( |
|
82 MVPbkContactStore& aContactStore ); |
|
83 void StoreUnavailable( |
|
84 MVPbkContactStore& aContactStore, |
|
85 TInt aReason ); |
|
86 void HandleStoreEventL( |
|
87 MVPbkContactStore& aContactStore, |
|
88 TVPbkContactStoreEvent aStoreEvent ); |
|
89 |
|
90 private: // Construction |
|
91 CPbk2ServerAppMonitor( |
|
92 const MVPbkContactStoreList& aStoreList, |
|
93 MPbk2ServerAppStartupObserver& aObserver ); |
|
94 void ConstructL(); |
|
95 |
|
96 private: // Implementation |
|
97 void AddUnavailableStoreNameL( |
|
98 const TDesC& aName ); |
|
99 void ShowUnavailableStoresL(); |
|
100 void HandleStoreNotification( |
|
101 MVPbkContactStore& aContactStore ); |
|
102 void SendMessageToObservers(); |
|
103 void HandleError( |
|
104 TInt aResult ); |
|
105 |
|
106 private: // Data |
|
107 /// Own: Contact store list |
|
108 const MVPbkContactStoreList* iContactStoreList; |
|
109 /// Own: Handled stores counter |
|
110 TInt iHandledStores; |
|
111 /// Own: An array for observers |
|
112 RPointerArray<MPbk2StartupObserver> iObservers; |
|
113 /// Own: An array of unavailable store names |
|
114 CDesCArray* iUnavailableStoreNames; |
|
115 /// Ref: Server app startup observer |
|
116 MPbk2ServerAppStartupObserver& iServerAppObserver; |
|
117 /// Ref: Eikon enviroment |
|
118 CEikonEnv* iEikEnv; |
|
119 }; |
|
120 |
|
121 #endif // CPBK2SERVERAPPMONITOR_H |
|
122 |
|
123 // End of File |