|
1 /* |
|
2 * Copyright (c) 2002-2006 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: Settings deleter with progress note. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CWPCXDELETER_H |
|
20 #define CWPCXDELETER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <aknprogressdialog.h> |
|
24 #include <activeapdb.h> |
|
25 #include <favouritesdbobserver.h> |
|
26 #include <FavouritesDb.h> |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class CWPEngine; |
|
30 class CActiveFavouritesDbNotifier; |
|
31 |
|
32 // CLASS DECLARATION |
|
33 |
|
34 /** |
|
35 * Helper class for deleting Provisioning settings. |
|
36 */ |
|
37 class CWPCxDeleter : public CActive, |
|
38 private MProgressDialogCallback, |
|
39 private MActiveApDbObserver, |
|
40 private MFavouritesDbObserver |
|
41 { |
|
42 public: |
|
43 /** |
|
44 * C++ default constructor. |
|
45 * @param aEngine Engine to be used for saving |
|
46 */ |
|
47 CWPCxDeleter( CWPEngine& aEngine, TUint32 aContext ); |
|
48 |
|
49 /** |
|
50 * Destructor. |
|
51 */ |
|
52 ~CWPCxDeleter(); |
|
53 |
|
54 public: |
|
55 /** |
|
56 * Prepares the object for saving. |
|
57 */ |
|
58 void PrepareLC(); |
|
59 |
|
60 /** |
|
61 * Executes save with a progress note. Ownership of the |
|
62 * CWPSaver object is transferred. |
|
63 * @param aNumDeleted When returns, contains number of settings saved. |
|
64 * @return Status code. >= 0 if saving was completed |
|
65 */ |
|
66 TInt ExecuteLD( TInt& aNumDeleted ); |
|
67 |
|
68 protected: // From CActive |
|
69 |
|
70 void DoCancel(); |
|
71 void RunL(); |
|
72 TInt RunError( TInt aError ); |
|
73 |
|
74 private: // From MProgressDialogCallback |
|
75 |
|
76 void DialogDismissedL( TInt aButtonId ); |
|
77 |
|
78 private: // from MActiveApDbObserver |
|
79 |
|
80 void HandleApDbEventL( TEvent anEvent ); |
|
81 |
|
82 private: // from MFavouritesDbObserver |
|
83 |
|
84 void HandleFavouritesDbEventL( RDbNotifier::TEvent aEvent ); |
|
85 |
|
86 private: |
|
87 /** |
|
88 * Complete the request so that RunL() gets called. |
|
89 */ |
|
90 void CompleteRequest(); |
|
91 |
|
92 /** |
|
93 * Complete the request so that Timeout() gets called after |
|
94 * a delay. |
|
95 */ |
|
96 void DelayedCompleteRequestL(); |
|
97 |
|
98 /** |
|
99 * Retry save now. |
|
100 */ |
|
101 void Retry(); |
|
102 |
|
103 /** |
|
104 * Timer timed-out. |
|
105 */ |
|
106 static TInt Timeout(TAny* aSelf); |
|
107 |
|
108 private: |
|
109 // The engine used for performing the save. Refs. |
|
110 CWPEngine& iEngine; |
|
111 |
|
112 // The context being deleted |
|
113 TUint32 iContext; |
|
114 |
|
115 // The progress dialog. Owns. |
|
116 CAknProgressDialog* iDialog; |
|
117 |
|
118 // The item to be saved next |
|
119 TInt iCurrentItem; |
|
120 |
|
121 // Contains result to be passed to the called of ExecuteLD |
|
122 TInt iResult; |
|
123 |
|
124 // Active AP database |
|
125 CActiveApDb* iApDbNotifier; |
|
126 |
|
127 // Active Favourites Database |
|
128 CActiveFavouritesDbNotifier* iFavouritesNotifier; |
|
129 |
|
130 // Contains ETrue if commsdb is being waited on |
|
131 TBool iWaitCommsDb; |
|
132 |
|
133 // Contains ETrue if favourites db is being waited on |
|
134 TBool iWaitFavourites; |
|
135 |
|
136 // Active scheduler. |
|
137 CActiveSchedulerWait iWait; |
|
138 |
|
139 // Timer for retry |
|
140 CPeriodic* iRetryTimer; |
|
141 |
|
142 // Retry count |
|
143 TInt iRetryCount; |
|
144 |
|
145 RFavouritesDb iBookmarkDb; |
|
146 RFavouritesSession iSession; |
|
147 }; |
|
148 |
|
149 |
|
150 #endif // CWPCXDELETER_H |
|
151 |
|
152 // End of File |