|
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 "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: Login UI control. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __CCNUILOGINUICNTRLSTEP_H |
|
19 #define __CCNUILOGINUICNTRLSTEP_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <E32Base.h> |
|
23 #include <f32file.h> |
|
24 #include <impspresenceconnectionuiconstsng.h> |
|
25 #include "MCnUiCntrlStep.h" |
|
26 #include "MCnUiWaitNoteObserver.h" |
|
27 #include "MCnUiOpProgressStateObserver.h" |
|
28 |
|
29 |
|
30 //FORWARD DECLARATION |
|
31 class MCnUiUiControlContext; |
|
32 class MCnUiConnWaitNote; |
|
33 class CCnUiConnOpener; |
|
34 class CPEngNWSessionSlotID2; |
|
35 class RResourceFile; |
|
36 class MIMPSSharedData; |
|
37 |
|
38 // CLASS DECLARATION |
|
39 /** |
|
40 * Login SAP select UI control. |
|
41 * Performs real connection open |
|
42 * using the CCnUiConnOpener. |
|
43 * |
|
44 * This class behaviour can be extented by deriving. |
|
45 * |
|
46 * @since 2.1 |
|
47 */ |
|
48 NONSHARABLE_CLASS( CCnUiLoginUiCntrlStep ) : public CBase, |
|
49 public MCnUiCntrlStep, |
|
50 public MCnUiWaitNoteObserver, |
|
51 public MCnUiOpProgressStateObserver |
|
52 { |
|
53 protected: //own enumerations |
|
54 /** |
|
55 * Return status for succesful login init. |
|
56 */ |
|
57 enum TCnUiLoginInitStatus |
|
58 { |
|
59 ECnUiLoginInitContinue = 1 //must be positive to distinguish from KErrXXX error codes |
|
60 }; |
|
61 |
|
62 |
|
63 public: // Two-phased constructors and destructor |
|
64 |
|
65 /** |
|
66 * Two-phased constructor. |
|
67 * @param aCCntxt UI control context. |
|
68 */ |
|
69 static CCnUiLoginUiCntrlStep* NewLC( MCnUiUiControlContext& aCCntxt, |
|
70 CIMPSSAPSettings& aLoginSap, |
|
71 TIMPSLoginType aLoginType, |
|
72 CPEngNWSessionSlotID2& aNWSessionSlotID, |
|
73 TIMPSConnectionClient aClient ); |
|
74 |
|
75 |
|
76 /** |
|
77 * Destructor. |
|
78 */ |
|
79 virtual ~CCnUiLoginUiCntrlStep(); |
|
80 |
|
81 |
|
82 protected: //protected to allow derivation |
|
83 |
|
84 /** |
|
85 * C++ constructor. |
|
86 * |
|
87 * By default the UI level login type is |
|
88 * EIMPSManualLogin ==> Login is reported |
|
89 * as manual login, not AA one. |
|
90 */ |
|
91 CCnUiLoginUiCntrlStep( MCnUiUiControlContext& aCCntxt, |
|
92 CIMPSSAPSettings& aLoginSap, |
|
93 CPEngNWSessionSlotID2& aNWSessionSlotID, |
|
94 TIMPSConnectionClient aClient, |
|
95 TIMPSLoginType aLoginType = EIMPSManualLogin ); |
|
96 |
|
97 |
|
98 /** |
|
99 * Symbian OS constructor. |
|
100 */ |
|
101 void ConstructL(); |
|
102 |
|
103 |
|
104 |
|
105 public: // New functions from MCnUiCntrlStep |
|
106 |
|
107 |
|
108 /** |
|
109 * Runs connection open / login step. |
|
110 * |
|
111 * @since 2.1 |
|
112 * @return Error code from login. |
|
113 */ |
|
114 TInt RunStepL(); |
|
115 |
|
116 |
|
117 /** |
|
118 * Handles complete. |
|
119 * |
|
120 * @since 2.1 |
|
121 * @return Always ECnUiStepContinueTeardown. |
|
122 */ |
|
123 TCnUiHandleCompleteStatus HandleCompleteL(); |
|
124 |
|
125 |
|
126 /** |
|
127 * Handles undo. |
|
128 * |
|
129 * @since 2.1 |
|
130 */ |
|
131 void UndoStepL(); |
|
132 |
|
133 |
|
134 |
|
135 public: // New functions from MCnUiWaitNoteObserver |
|
136 |
|
137 /** |
|
138 * Notify method for wait note cancel events. |
|
139 * @since 2.1 |
|
140 */ |
|
141 void HandleWaitNoteCancel(); |
|
142 |
|
143 |
|
144 |
|
145 public: // New functions from MCnUiOpProgressStateObserver |
|
146 |
|
147 /** |
|
148 * Handles progress state enter. |
|
149 * Setups proper wait note using the DoShowLoginStateSpecificWaitnoteL() |
|
150 * |
|
151 * @since 2.1 |
|
152 * @param aStateId The state id from CCnUiConnOpener. |
|
153 * @param aClient The accessed client. |
|
154 */ |
|
155 void HandleProgressStateEnter( TInt aStateId, |
|
156 TIMPSConnectionClient aClient ); |
|
157 |
|
158 |
|
159 |
|
160 |
|
161 protected: // New template functions for derived class use |
|
162 |
|
163 |
|
164 /** |
|
165 * Framework method. |
|
166 * Virtual method to initializes the login operation. |
|
167 * |
|
168 * @since 2.1 |
|
169 * |
|
170 * @param aClient Init has to initialize the aClient |
|
171 * with the client id to log in. |
|
172 * |
|
173 * @return Error status from init. If init returns something |
|
174 * else than ECnUiLoginInitContinue login operaion RunStepL() |
|
175 * is breaked with return value. |
|
176 */ |
|
177 virtual TInt DoInitLoginStepL( TIMPSConnectionClient& aClient ); |
|
178 |
|
179 |
|
180 /** |
|
181 * Framework method. |
|
182 * |
|
183 * Virtual method to show proper wait note for |
|
184 * login state. |
|
185 * |
|
186 * @since 2.1 |
|
187 * @param aStateId State id from CCnUiConnOpener. |
|
188 * @param aClient The accessed client. |
|
189 */ |
|
190 virtual void DoShowLoginStateSpecificWaitnoteL( TInt aStateId, |
|
191 TIMPSConnectionClient aClient ); |
|
192 |
|
193 |
|
194 private: // New functions |
|
195 |
|
196 |
|
197 /** |
|
198 * Handles the login data failure error. |
|
199 * |
|
200 * @since 2.1 |
|
201 * @param aTrieError The original trie error |
|
202 * @return KErrNone if login is allowed to try again. |
|
203 * Else error to return from login try. |
|
204 */ |
|
205 TInt HandleLoginDataFailureL( TInt aTrieError ); |
|
206 |
|
207 |
|
208 /** |
|
209 * Handles the conflicting SAP connection error. |
|
210 * |
|
211 * @since 2.1 |
|
212 * @param aTrieError The original trie error |
|
213 * @param aTriedLoginClient Client which were tried to login. |
|
214 * @return KErrNone if login is allowed to try again. |
|
215 * Else error to return from login try. |
|
216 */ |
|
217 TInt HandleConflictingSapConnectionL( TInt aTrieError, |
|
218 TIMPSConnectionClient aTriedLoginClient ); |
|
219 |
|
220 |
|
221 |
|
222 /** |
|
223 * Tries disconnect other currently active |
|
224 * connections. |
|
225 * |
|
226 * @since 2.1 |
|
227 * @return ETrue if succesfully disconnected |
|
228 * other connections. Else EFalse. |
|
229 */ |
|
230 TBool TryDisconnectOtherConnectionsL(); |
|
231 |
|
232 /** |
|
233 * Opens correct resource file. |
|
234 * !!! Two items left to cleanup stack. !!! |
|
235 * @param aResourceFile Contains opened file on return |
|
236 * @since 3.1 |
|
237 */ |
|
238 void OpenResourceFileLC( RResourceFile& aResourceFile ); |
|
239 |
|
240 /** |
|
241 * Resource reader for non-Cone situations |
|
242 * @param aResourceId The integer-valued resource id to read |
|
243 * @return The value of the integer |
|
244 * @since 3.1 |
|
245 */ |
|
246 TInt ReadResourceIntValueL( TInt aResourceId ); |
|
247 |
|
248 protected: // protected data |
|
249 |
|
250 ///<Used UI control context, not owned |
|
251 MCnUiUiControlContext& iCCntxt; |
|
252 |
|
253 ///<Used login SAP, not owned |
|
254 CIMPSSAPSettings& iLoginSap; |
|
255 |
|
256 ///<Wait note, owned. Initialized and destroyed during the operation. |
|
257 MCnUiConnWaitNote* iWaitNote; |
|
258 |
|
259 |
|
260 |
|
261 private: // private data |
|
262 |
|
263 ///<Connection opener, owned |
|
264 CCnUiConnOpener* iConnOpener; |
|
265 |
|
266 ///<Login type setting, owned |
|
267 const TIMPSLoginType iLoginType; |
|
268 |
|
269 // Does not own Network session slot ID |
|
270 CPEngNWSessionSlotID2& iSessionSlotID; |
|
271 |
|
272 // The client application ID |
|
273 TIMPSConnectionClient iClient; |
|
274 |
|
275 // file handle used by resource file reading routine |
|
276 RFs iRFs; |
|
277 |
|
278 // Owned. |
|
279 MIMPSSharedData* iSharedData; |
|
280 }; |
|
281 |
|
282 #endif // __CCNUILOGINUICNTRLSTEP_H |
|
283 |
|
284 // End of File |
|
285 |