|
1 /* |
|
2 * ============================================================================ |
|
3 * Name : CWPSaver.h |
|
4 * Part of : Provisioning / ProvisioningBC |
|
5 * Description : Settings saver with progress note. |
|
6 * Version : %version: 1 % << Don't touch! Updated by Synergy at check-out. |
|
7 * |
|
8 * Copyright © 2002-2006 Nokia. All rights reserved. |
|
9 * This material, including documentation and any related computer |
|
10 * programs, is protected by copyright controlled by Nokia. All |
|
11 * rights are reserved. Copying, including reproducing, storing, |
|
12 * adapting or translating, any or all of this material requires the |
|
13 * prior written consent of Nokia. This material also contains |
|
14 * confidential information which may not be disclosed to others |
|
15 * without the prior written consent of Nokia. |
|
16 * ============================================================================ |
|
17 */ |
|
18 |
|
19 #ifndef CWPSAVER_H |
|
20 #define CWPSAVER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <aknprogressdialog.h> |
|
24 #include <activeapdb.h> |
|
25 #include <favouritesdbobserver.h> |
|
26 #include <FavouritesDb.h> |
|
27 #include <HbProgressDialog> |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class CWPEngine; |
|
31 class CActiveFavouritesDbNotifier; |
|
32 |
|
33 // CLASS DECLARATION |
|
34 |
|
35 /** |
|
36 * Helper class for saving Provisioning settings. Provides a progress note. |
|
37 * @since 2.0 |
|
38 */ |
|
39 class CWPSaver : public CActive, |
|
40 private MProgressDialogCallback, |
|
41 private MActiveApDbObserver, |
|
42 private MFavouritesDbObserver |
|
43 { |
|
44 public: |
|
45 /** |
|
46 * C++ default constructor. |
|
47 * @param aEngine Engine to be used for saving |
|
48 * @param aSetAsDefault EFalse => call CWPEngine::SaveL, ETrue |
|
49 * => call CWPEngine::SetAsDefaultL |
|
50 */ |
|
51 CWPSaver( CWPEngine& aEngine, TBool aSetAsDefault ); |
|
52 |
|
53 /** |
|
54 * Destructor. |
|
55 */ |
|
56 virtual ~CWPSaver(); |
|
57 |
|
58 public: |
|
59 /** |
|
60 * Prepares the object for saving. |
|
61 */ |
|
62 void PrepareLC(); |
|
63 |
|
64 /** |
|
65 * Executes save with a progress note. Ownership of the |
|
66 * CWPSaver object is transferred. |
|
67 * @param aNumSaved When returns, contains number of settings saved. |
|
68 * @return Status code. >= 0 if saving was completed |
|
69 */ |
|
70 TInt ExecuteLD( TInt& aNumSaved, TBufC<256>& value ); |
|
71 |
|
72 protected: // From CActive |
|
73 |
|
74 void DoCancel(); |
|
75 void RunL(); |
|
76 TInt RunError( TInt aError ); |
|
77 |
|
78 private: // From MProgressDialogCallback |
|
79 |
|
80 void DialogDismissedL( TInt aButtonId ); |
|
81 |
|
82 private: // from MActiveApDbObserver |
|
83 |
|
84 void HandleApDbEventL( TEvent anEvent ); |
|
85 |
|
86 private: // from MFavouritesDbObserver |
|
87 |
|
88 void HandleFavouritesDbEventL( RDbNotifier::TEvent aEvent ); |
|
89 |
|
90 private: |
|
91 /** |
|
92 * Complete the request so that RunL() gets called. |
|
93 */ |
|
94 void CompleteRequest(); |
|
95 |
|
96 /** |
|
97 * Complete the request so that Timeout() gets called after |
|
98 * a delay. Leaves with KErrTimeout if retry count is |
|
99 * exceeded. |
|
100 */ |
|
101 void DelayedCompleteRequestL(); |
|
102 |
|
103 /** |
|
104 * Retry save now. |
|
105 */ |
|
106 void Retry(); |
|
107 |
|
108 /** |
|
109 * Timer timed-out. |
|
110 */ |
|
111 static TInt Timeout(TAny* aSelf); |
|
112 |
|
113 private: |
|
114 /// The engine used for performing the save. Refs. |
|
115 CWPEngine& iEngine; |
|
116 |
|
117 /// ETrue if setting as default |
|
118 TBool iSetAsDefault; |
|
119 |
|
120 /// The item to be saved next |
|
121 TInt iCurrentItem; |
|
122 |
|
123 /// Contains result to be passed to the called of ExecuteLD |
|
124 TInt iResult; |
|
125 |
|
126 /// Active AP database. Owns. |
|
127 CActiveApDb* iApDbNotifier; |
|
128 |
|
129 /// Active Favourites Database. Owns. |
|
130 CActiveFavouritesDbNotifier* iFavouritesNotifier; |
|
131 |
|
132 /// Contains ETrue if commsdb is being waited on |
|
133 TBool iWaitCommsDb; |
|
134 |
|
135 /// Contains ETrue if favourites db is being waited on |
|
136 TBool iWaitFavourites; |
|
137 |
|
138 /// Active scheduler. |
|
139 CActiveSchedulerWait iWait; |
|
140 |
|
141 /// Timer for retry. Owns. |
|
142 CPeriodic* iRetryTimer; |
|
143 |
|
144 /// Retry counter |
|
145 TInt iRetryCount; |
|
146 |
|
147 RFavouritesDb iBookmarkDb; |
|
148 RFavouritesSession iSession; |
|
149 HbProgressDialog *iProgress; |
|
150 TBufC<200> iValue; |
|
151 }; |
|
152 |
|
153 |
|
154 #endif // CWPSAVER_H |
|
155 |
|
156 // End of File |