|
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: Network connection restore UI control. |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include <E32std.h> |
|
20 #include <CIMPSSAPSettings.h> |
|
21 #include "CCnUiReconnectAllUiCntrlStep.h" |
|
22 |
|
23 #include "MCnUiUiControlContext.h" |
|
24 #include "MCnUiUiFacade.h" |
|
25 #include "MCnUiSignaller.h" |
|
26 #include "MCnUiConnectionHandler.h" |
|
27 #include "MCnUiClientPlugin.h" |
|
28 #include "CCnUiConnOpener.h" |
|
29 |
|
30 |
|
31 #include "CnUiErrors.h" |
|
32 |
|
33 |
|
34 |
|
35 // ================= MEMBER FUNCTIONS ======================= |
|
36 // Two-phased constructor. |
|
37 CCnUiReconnectAllUiCntrlStep* CCnUiReconnectAllUiCntrlStep::NewLC( |
|
38 MCnUiUiControlContext& aCCntxt, |
|
39 CIMPSSAPSettings& aLoginSap, |
|
40 TIMPSConnectionClient aReconnectedClient, |
|
41 CPEngNWSessionSlotID2& aNWSessionSlotID ) |
|
42 { |
|
43 CCnUiReconnectAllUiCntrlStep* self = |
|
44 new ( ELeave ) CCnUiReconnectAllUiCntrlStep( |
|
45 aCCntxt, |
|
46 aLoginSap, |
|
47 aReconnectedClient, |
|
48 aNWSessionSlotID ); |
|
49 CleanupStack::PushL( self ); |
|
50 self->ConstructL(); |
|
51 return self; |
|
52 } |
|
53 |
|
54 |
|
55 // Destructor |
|
56 CCnUiReconnectAllUiCntrlStep::~CCnUiReconnectAllUiCntrlStep() |
|
57 { |
|
58 iClientsToReConn.Reset(); |
|
59 } |
|
60 |
|
61 // C++ default constructor can NOT contain any code, that |
|
62 // might leave. |
|
63 // |
|
64 CCnUiReconnectAllUiCntrlStep::CCnUiReconnectAllUiCntrlStep( |
|
65 MCnUiUiControlContext& aCCntxt, |
|
66 CIMPSSAPSettings& aLoginSap, |
|
67 TIMPSConnectionClient aReconnectedClient, |
|
68 CPEngNWSessionSlotID2& aNWSessionSlotID ) |
|
69 : CCnUiLoginUiCntrlStep( aCCntxt, aLoginSap, aNWSessionSlotID, aReconnectedClient ), |
|
70 iRequestedReconnClient( aReconnectedClient ), iNWSessionSlotID( aNWSessionSlotID ) |
|
71 { |
|
72 } |
|
73 |
|
74 |
|
75 // Symbian OS default constructor can leave. |
|
76 void CCnUiReconnectAllUiCntrlStep::ConstructL() |
|
77 { |
|
78 CCnUiLoginUiCntrlStep::ConstructL(); |
|
79 } |
|
80 |
|
81 |
|
82 // ----------------------------------------------------------------------------- |
|
83 // CCnUiReconnectAllUiCntrlStep::HandleCompleteL() |
|
84 // ----------------------------------------------------------------------------- |
|
85 // |
|
86 TCnUiHandleCompleteStatus CCnUiReconnectAllUiCntrlStep::HandleCompleteL() |
|
87 { |
|
88 //if there has been a client to reconnect, it has been |
|
89 //the first in the count array ==> index 0 |
|
90 |
|
91 if ( iClientsToReConn.Count() > 0 ) |
|
92 { |
|
93 iClientsToReConn.Remove( 0 ); |
|
94 } |
|
95 |
|
96 |
|
97 //If there is more clients to reconnect, do so |
|
98 if ( iClientsToReConn.Count() > 0 ) |
|
99 { |
|
100 //there is still clients to reconnect |
|
101 return ECnUiRestartStep; |
|
102 } |
|
103 else |
|
104 { |
|
105 //all done |
|
106 return ECnUiStepContinueTeardown; |
|
107 } |
|
108 } |
|
109 |
|
110 |
|
111 // ----------------------------------------------------------------------------- |
|
112 // CCnUiReconnectAllUiCntrlStep::UndoStepL() |
|
113 // ----------------------------------------------------------------------------- |
|
114 // |
|
115 void CCnUiReconnectAllUiCntrlStep::UndoStepL() |
|
116 { |
|
117 //nothing to undo |
|
118 } |
|
119 |
|
120 |
|
121 // ----------------------------------------------------------------------------- |
|
122 // CCnUiReconnectAllUiCntrlStep::DoInitLoginStepL() |
|
123 // Template method |
|
124 // ----------------------------------------------------------------------------- |
|
125 // |
|
126 TInt CCnUiReconnectAllUiCntrlStep::DoInitLoginStepL( TIMPSConnectionClient& aClient ) |
|
127 { |
|
128 if ( !iInitDone ) |
|
129 { |
|
130 //Login and thus also reconnects are connection owning so they have |
|
131 //to always check for simultaneous operations |
|
132 if ( iCCntxt.Signaller().OperationRunning() ) |
|
133 { |
|
134 ShowSimultaneousLoginOperationNoteL(); |
|
135 return KCnUiErrorLoginOperationAlreadyInUse; |
|
136 } |
|
137 |
|
138 |
|
139 //initialize the reconnection array |
|
140 InitNWReConnectL(); |
|
141 iInitDone = ETrue; |
|
142 if ( iClientsToReConn.Count() == 0 ) |
|
143 { |
|
144 //there isn't any clients to reconnect |
|
145 return KCnUiErrorNoClientsToReconnect; |
|
146 } |
|
147 } |
|
148 |
|
149 //in all other rounds prepare the client again, |
|
150 //to cope from possible sub steps. |
|
151 if ( iClientsToReConn.Count() > 0 ) |
|
152 { |
|
153 aClient = iClientsToReConn[ 0 ]; |
|
154 return ECnUiLoginInitContinue; |
|
155 } |
|
156 |
|
157 else |
|
158 { |
|
159 //no more clients to logout |
|
160 return KErrNone; //breaks away from RunStepL() with KErrNone |
|
161 } |
|
162 } |
|
163 |
|
164 |
|
165 |
|
166 // ----------------------------------------------------------------------------- |
|
167 // CCnUiReconnectAllUiCntrlStep::DoShowLoginStateSpecificWaitnoteL() |
|
168 // ----------------------------------------------------------------------------- |
|
169 // |
|
170 void CCnUiReconnectAllUiCntrlStep::DoShowLoginStateSpecificWaitnoteL( |
|
171 TInt aStateId, |
|
172 TIMPSConnectionClient aClient ) |
|
173 { |
|
174 switch ( aStateId ) |
|
175 { |
|
176 case ECnOpenerOpeningSAPConnection: |
|
177 case ECnOpenerProcessingPlugin: |
|
178 case ECnOpenerClosingInterferingSAPConnection: |
|
179 { |
|
180 if ( !iWaitNote ) |
|
181 { |
|
182 //the same wait note is used |
|
183 //both when opening SAP connection & |
|
184 //processing plug-in stuff |
|
185 if ( aClient == EIMPSConnClientIM ) |
|
186 { |
|
187 iWaitNote = iCCntxt.Ui().WaitNoteL( ECnUiWaitNoteReConnectingChat, |
|
188 iLoginSap.SAPName(), |
|
189 this ); |
|
190 } |
|
191 |
|
192 else |
|
193 { |
|
194 //client is considered to be PEC |
|
195 iWaitNote = iCCntxt.Ui().WaitNoteL( ECnUiWaitNoteReConnectingPEC, |
|
196 iLoginSap.SAPName(), |
|
197 this ); |
|
198 } |
|
199 } |
|
200 |
|
201 break; |
|
202 } |
|
203 |
|
204 case ECnOpenerIdle: |
|
205 case ECnOpenerClosingOwnedSAPConnection: |
|
206 default: |
|
207 { |
|
208 //clear any existing wait note set by the previous |
|
209 //progress steps. No wait note used during these steps. |
|
210 //own waitnote container used ==> direct deletion ok. |
|
211 delete iWaitNote; |
|
212 iWaitNote = NULL; |
|
213 |
|
214 break; |
|
215 } |
|
216 } |
|
217 } |
|
218 |
|
219 // ----------------------------------------------------------------------------- |
|
220 // CCnUiReconnectAllUiCntrlStep::InitNWReConnectL() |
|
221 // ----------------------------------------------------------------------------- |
|
222 // |
|
223 void CCnUiReconnectAllUiCntrlStep::InitNWReConnectL() |
|
224 { |
|
225 //internal count array |
|
226 iClientsToReConn.Reset(); |
|
227 |
|
228 //determine is reconnection needed for given clients |
|
229 //UI specification states that only those clients which |
|
230 //connection mode settings is automatic are reconnected back |
|
231 |
|
232 MCnUiClientPlugin& clientPlugin = iCCntxt.ClientPluginL( iRequestedReconnClient, |
|
233 iNWSessionSlotID ); |
|
234 if ( clientPlugin.CurrentConnectionModeSettingL() == ECnUiCMAutomatic ) |
|
235 { |
|
236 User::LeaveIfError( iClientsToReConn.Append( iRequestedReconnClient ) ); |
|
237 } |
|
238 } |
|
239 |
|
240 |
|
241 // ----------------------------------------------------------------------------- |
|
242 // CCnUiReconnectAllUiCntrlStep::ShowSimultaneousLoginOperationNoteL() |
|
243 // ----------------------------------------------------------------------------- |
|
244 // |
|
245 void CCnUiReconnectAllUiCntrlStep::ShowSimultaneousLoginOperationNoteL() |
|
246 { |
|
247 HBufC* serverName = NULL; |
|
248 iCCntxt.Signaller().OperationDetailsL( serverName ); |
|
249 |
|
250 //OperationDetailsL() returns the HBufC ownership |
|
251 CleanupStack::PushL( serverName ); |
|
252 iCCntxt.Ui().ShowNoteL( ECnUiConnOperationAllreadyRunning, *serverName ); |
|
253 CleanupStack::PopAndDestroy( serverName ); //serverName |
|
254 } |
|
255 |
|
256 |
|
257 |
|
258 // End of File |