|
1 /* |
|
2 * Copyright (c) 2003-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: This module contains the implementation of CCMAppUi class |
|
15 * methods |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <avkon.hrh> |
|
22 #include <apgcli.h> // for RApaLsSession |
|
23 #include <commdb.h> // for CCommsDatabase |
|
24 #include <cdbpreftable.h> // for CCommsDbConnectionPrefTableView |
|
25 #include <AknGlobalNote.h> // for CAknGlobalNote |
|
26 #include <AknGlobalConfirmationQuery.h> // for CAknGlobalConfirmationQuery |
|
27 #include <escapeutils.h> |
|
28 #include <etelmm.h> |
|
29 #include <textresolver.h> |
|
30 #include <sysutil.h> |
|
31 #include <HttpFilterCommonStringsExt.h> |
|
32 #include <OnlineSupport.rsg> // has to be system include. |
|
33 #include <centralrepository.h> // link against centralrepository.lib |
|
34 #include <BrowserUiSDKCRKeys.h> // for KCRUidBrowser |
|
35 #include <CoreApplicationUIsSDKCRKeys.h>// for KCRUidCoreApplicationUIs |
|
36 //#include <BrowserUiInternalCRKeys.h> // BrowserUiSDKCRKeys.h file can replace this header file |
|
37 #include <WebUtilsInternalCRKeys.h> // for the profile strings |
|
38 |
|
39 #include "OnlineSupportLogger.h" |
|
40 #include "CCMAppUi.h" |
|
41 #include "CCMRegistrationMonitor.h" |
|
42 #include "CCMSocketsEngine.h" |
|
43 #include "OnlineSupport.hrh" |
|
44 #include "PnpUtilImpl.h" |
|
45 #include "CCMDocument.h" |
|
46 #include "MiniBrowser.h" |
|
47 #include "DeviceParameterDefs.h" |
|
48 #include "VersionStrings.h" |
|
49 #include "OnlineSupportPrivateCRKeys.h" // Own central repository keys |
|
50 #include <PnpProvUtil.h> |
|
51 #include <aknnotewrappers.h> |
|
52 #include <StringLoader.h> |
|
53 |
|
54 // EXTERNAL DATA STRUCTURES |
|
55 // None |
|
56 |
|
57 // EXTERNAL FUNCTION PROTOTYPES |
|
58 // None |
|
59 |
|
60 // CONSTANTS |
|
61 |
|
62 // UID of the application |
|
63 const TUid KUidConfigurationManager = { 0x10204338 }; |
|
64 // TimeoutValue for the RegistrationMonitor, |
|
65 // Registration monitor itself has a time-out of 15 seconds |
|
66 const TInt KMonitoringTimeOut = 20000000; |
|
67 // TimeoutValue for the ConnectionTest |
|
68 const TInt KConnectionTimeOut = 35000000; |
|
69 // Timeout after the startupOperation will continue after ConstructL() |
|
70 const TInt KStartUpTimeOut = 20; |
|
71 |
|
72 // 0.1s Timeout for closing the app after the user has selected "Cancel" to |
|
73 // ConfirmationDialogL or to iWaitDialog. |
|
74 // See comments on TApplicationStatus (CCMAppUi.h) |
|
75 const TInt KExitTimeOut = 100000; |
|
76 |
|
77 _LIT( KInitAccess, "initAccess" ); |
|
78 |
|
79 _LIT( KSlash,"/"); |
|
80 |
|
81 // Help portal |
|
82 _LIT(KHelpPortal,".help-portal.com"); |
|
83 |
|
84 // Nokia |
|
85 _LIT( KServerNokia,"nokia" ); |
|
86 _LIT( KNokia,"pnpms.nokia.com"); |
|
87 |
|
88 // HTTP |
|
89 _LIT(KHttp, "http://"); |
|
90 |
|
91 // Default server string |
|
92 _LIT(KDefaultServerString,"www"); |
|
93 |
|
94 // Default page string |
|
95 _LIT(KDefaultPageString,"page1"); |
|
96 |
|
97 _LIT( KMNC0, "mnc0" ); |
|
98 _LIT( KMCC, "mcc" ); |
|
99 _LIT( KGprs, "gprs" ); |
|
100 _LIT( KDot, "." ); |
|
101 |
|
102 const TInt KMaxAPNLength = 256; |
|
103 |
|
104 _LIT( KDefaultRoamingName, "PNP Default Roaming" ); |
|
105 |
|
106 _LIT( KInitAccessRoamingName, "PNP InitAccess Roaming" ); |
|
107 |
|
108 const TInt KMaxSilentModeRedirectCount(3); |
|
109 |
|
110 |
|
111 // MACROS |
|
112 // None |
|
113 |
|
114 // LOCAL CONSTANTS AND MACROS |
|
115 // None |
|
116 |
|
117 // MODULE DATA STRUCTURES |
|
118 // None |
|
119 |
|
120 // LOCAL FUNCTION PROTOTYPES |
|
121 // None |
|
122 |
|
123 // FORWARD DECLARATIONS |
|
124 // None |
|
125 |
|
126 // ============================= LOCAL FUNCTIONS =============================== |
|
127 // None |
|
128 |
|
129 |
|
130 // ============================ MEMBER FUNCTIONS =============================== |
|
131 // ----------------------------------------------------------------------------- |
|
132 // CCMAppUI::CCMAppUi |
|
133 // ----------------------------------------------------------------------------- |
|
134 // |
|
135 CCMAppUi::CCMAppUi(): |
|
136 iAccessPoint(0), |
|
137 iAutoStart( EFalse), |
|
138 iTokenOverride( EFalse ), |
|
139 iStartingBrowser( EFalse ), |
|
140 iRedirectsLeft( KMaxSilentModeRedirectCount ), |
|
141 iInitAccessOn(KErrNone) |
|
142 { |
|
143 } |
|
144 |
|
145 // ----------------------------------------------------------------------------- |
|
146 // CCMAppUi::ConstructL |
|
147 // Symbian 2nd phase constructor can leave. |
|
148 // ----------------------------------------------------------------------------- |
|
149 // |
|
150 void CCMAppUi::ConstructL() |
|
151 { |
|
152 LOGSTRING( "Enter to CCMAppUi::ConstrtuctL" ); |
|
153 // Send to background |
|
154 BaseConstructL(ENoScreenFurniture); |
|
155 TApaTaskList taskList( CEikonEnv::Static()->WsSession() ); |
|
156 TApaTask task = taskList.FindApp( KUidConfigurationManager ); |
|
157 task.SendToBackground(); |
|
158 |
|
159 HideApplicationFromFSW(); |
|
160 |
|
161 iPreferencesChanged = EFalse; |
|
162 iFirstStartInHomeNetwork = EFalse; |
|
163 iNetworkStatusOk = EFalse; |
|
164 iNetworkStatus = CCMRegistrationMonitor::EStatusUnknown; |
|
165 iApplicationStatus = EAppStatusInactive; |
|
166 iInitAccessPointUsed = EFalse; |
|
167 |
|
168 iWaitDialogProgressVal = 1; |
|
169 |
|
170 LOGSTRING( "BaseConstructOk" ); |
|
171 |
|
172 //this->StatusPane()->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL_EXT); |
|
173 this->StatusPane()->MakeVisible( EFalse ); |
|
174 |
|
175 CEikonEnv::Static()->AddForegroundObserverL( *this ); |
|
176 |
|
177 TRAPD( err, iRepository = CRepository::NewL( KCRUidConfigurationManager ) ); |
|
178 if( err != KErrNone ) |
|
179 { |
|
180 LOGSTRING2( "Central repository init: %i", err ); |
|
181 User::Leave( err ); |
|
182 } |
|
183 err = GetIntValue(KOnlineSupportInitAccessOn,iInitAccessOn); |
|
184 if( KErrNone == err && iInitAccessOn == KErrNone) |
|
185 {//Fetaure off |
|
186 iConnectingVia = EConnectingViaInit; |
|
187 } |
|
188 else //feature off or Issue in reading cenrep key |
|
189 { |
|
190 iConnectingVia = EConnectingViaNull; |
|
191 } |
|
192 // The default values; these might change later in ProcessCommandParametersL |
|
193 SetServerString( KDefaultServerString ); |
|
194 SetPageString( KDefaultPageString ); |
|
195 SetConnectReason( EConnectReasonUnknown ); |
|
196 |
|
197 FetchProductModelAndSwVersionL(); |
|
198 |
|
199 iTimer = CPeriodic::NewL( CActive::EPriorityStandard ); |
|
200 iEngine = CCMSocketsEngine::NewL( *this ); |
|
201 iRegistrationMonitor = CCMRegistrationMonitor::NewL( *this ); |
|
202 iApplicationStatus = EAppStatusStartingUp; |
|
203 LOGSTRING( "Exit from ConstructL()" ); |
|
204 } |
|
205 |
|
206 // ----------------------------------------------------------------------------- |
|
207 // CCMAppUI::IsNetworkConnectionsAllowedL |
|
208 // ----------------------------------------------------------------------------- |
|
209 // |
|
210 TBool CCMAppUi::IsNetworkConnectionsAllowedL() |
|
211 { |
|
212 LOGSTRING( "Enter to CCMAppUi::IsNetworkConnectionsAllowedL()" ); |
|
213 TBool networkConnectionsAllowed( EFalse ); |
|
214 TInt allowed(0); |
|
215 CRepository* coreAppUisCr = CRepository::NewLC( KCRUidCoreApplicationUIs ); |
|
216 User::LeaveIfError( coreAppUisCr->Get( KCoreAppUIsNetworkConnectionAllowed, allowed ) ); |
|
217 CleanupStack::PopAndDestroy( coreAppUisCr ); |
|
218 if( allowed == ECoreAppUIsNetworkConnectionAllowed ) |
|
219 { |
|
220 LOGSTRING( "ConnectionAllowed" ); |
|
221 networkConnectionsAllowed = ETrue; |
|
222 } |
|
223 else |
|
224 { |
|
225 // display dialog that operation that possible in offline mode |
|
226 HBufC* string = StringLoader::LoadLC( R_OFFLINE_MODE ); |
|
227 CAknGlobalNote* globalNote = CAknGlobalNote::NewL(); |
|
228 CleanupStack::PushL( globalNote ); |
|
229 globalNote->ShowNoteL( EAknGlobalErrorNote , *string ); |
|
230 CleanupStack::PopAndDestroy(2 ); |
|
231 } |
|
232 |
|
233 LOGSTRING( "Exit from CCMAppUi::IsNetworkConnectionsAllowedL()" ); |
|
234 return networkConnectionsAllowed; |
|
235 } |
|
236 |
|
237 // Destructor |
|
238 // ----------------------------------------------------------------------------- |
|
239 // CCMAppUI::~CCMAppUi |
|
240 // ----------------------------------------------------------------------------- |
|
241 // |
|
242 CCMAppUi::~CCMAppUi() |
|
243 { |
|
244 LOGSTRING( "Enter ~CCMAppUI" ); |
|
245 |
|
246 CEikonEnv::Static()->RemoveForegroundObserver( *this ); |
|
247 |
|
248 if (iTimer) |
|
249 { |
|
250 iTimer->Cancel(); |
|
251 } |
|
252 delete iTimer; |
|
253 LOGSTRING( "Timer deleted" ); |
|
254 |
|
255 if (iRegistrationMonitor) |
|
256 { |
|
257 iRegistrationMonitor->StopMonitoring(); |
|
258 } |
|
259 delete iRegistrationMonitor; |
|
260 LOGSTRING( "Monitor deleted" ); |
|
261 |
|
262 delete iRepository; |
|
263 |
|
264 delete iMiniBrowser; |
|
265 // Must be deleted after iMiniBrowser since iMiniBrowser uses RSocketServ and |
|
266 // RConnection instances of iEngine |
|
267 delete iEngine; |
|
268 |
|
269 if (iCommonDialogMonitor) |
|
270 { |
|
271 iCommonDialogMonitor->Cancel(); |
|
272 delete iCommonDialogMonitor; |
|
273 } |
|
274 if (iGlobalConfirmationQuery) |
|
275 { |
|
276 delete iGlobalConfirmationQuery; |
|
277 } |
|
278 if( iGlobalWaitNote ) |
|
279 { |
|
280 //iGlobalWaitNote->CancelNoteL(iWaitNoteId); |
|
281 delete iGlobalWaitNote; |
|
282 } |
|
283 |
|
284 LOGSTRING( "Exit ~CCMAppUI" ); |
|
285 } |
|
286 |
|
287 |
|
288 |
|
289 // ----------------------------------------------------------------------------- |
|
290 // CCMAppUI::ConfirmationDialogL |
|
291 // Activates Confirmation dialog |
|
292 // (other items were commented in a header). |
|
293 // ----------------------------------------------------------------------------- |
|
294 // |
|
295 void CCMAppUi::ConfirmationDialogL() |
|
296 { |
|
297 LOGSTRING("CCMAppUi::ConfirmationDialogL"); |
|
298 if( !iAutoStart ) |
|
299 { |
|
300 HBufC* msgText = CEikonEnv::Static()->AllocReadResourceLC( |
|
301 R_CONFMANAGER_CONFIRMATION ); |
|
302 |
|
303 if (iCommonDialogMonitor) |
|
304 { |
|
305 iCommonDialogMonitor->Cancel(); |
|
306 delete iCommonDialogMonitor; |
|
307 iCommonDialogMonitor = NULL; |
|
308 } |
|
309 // instantiate the active object CGlobalConfirmationObserver |
|
310 iCommonDialogMonitor = CCMDialogMonitor::NewL( *this ); |
|
311 iCommonDialogMonitor->SetDialogMode( CCMDialogMonitor::EConfirmation ); |
|
312 // SetActive |
|
313 iCommonDialogMonitor->Start(); |
|
314 // iGlobalConfirmationQuery is an instance of the global |
|
315 // confirmation query class CAknGlobalConfirmationQuery. |
|
316 // show the global confirmation query, set the iStatus variable |
|
317 // of the active object as a parameter. |
|
318 if (!iGlobalConfirmationQuery) |
|
319 { |
|
320 iGlobalConfirmationQuery = CAknGlobalConfirmationQuery::NewL(); |
|
321 } |
|
322 |
|
323 iGlobalConfirmationQuery->ShowConfirmationQueryL( |
|
324 iCommonDialogMonitor->iStatus, |
|
325 *msgText, |
|
326 R_AVKON_SOFTKEYS_YES_NO__YES, |
|
327 R_QGN_NOTE_QUERY_ANIM); |
|
328 |
|
329 CleanupStack::PopAndDestroy( msgText ); |
|
330 } |
|
331 } |
|
332 |
|
333 |
|
334 // ----------------------------------------------------------------------------- |
|
335 // CCMAppUI::ErrorNoteConnectionL() |
|
336 // Activates error note. |
|
337 // (other items were commented in a header). |
|
338 // ----------------------------------------------------------------------------- |
|
339 // |
|
340 void CCMAppUi::ErrorNoteConnectionL() |
|
341 { |
|
342 LOGSTRING( "CCMAppUi::ErrorNoteConnectionL" ); |
|
343 if( !iAutoStart ) |
|
344 { |
|
345 HBufC* msgText = CEikonEnv::Static()-> |
|
346 AllocReadResourceLC( R_CONFMANAGER_ERRORNOTE ); |
|
347 |
|
348 CAknGlobalNote* globalNote = CAknGlobalNote::NewL(); |
|
349 CleanupStack::PushL( globalNote ); |
|
350 globalNote->ShowNoteL( EAknGlobalErrorNote , *msgText ); |
|
351 CleanupStack::PopAndDestroy( 2 ); |
|
352 } |
|
353 } |
|
354 |
|
355 // ----------------------------------------------------------------------------- |
|
356 // CCMAppUI::ErrorNoteUnknownL |
|
357 // ----------------------------------------------------------------------------- |
|
358 // |
|
359 void CCMAppUi::ErrorNoteUnknownL( TInt aError ) |
|
360 { |
|
361 LOGSTRING2( "CCMAppUi::ErrorNoteUnknownL %i", aError ); |
|
362 if( !iAutoStart ) |
|
363 { |
|
364 CTextResolver* textResolver = CTextResolver::NewLC(); |
|
365 TPtrC errMsg = textResolver->ResolveErrorString( aError ); |
|
366 HBufC* errMsgBuf = HBufC::NewLC( errMsg.Length() ); |
|
367 errMsgBuf->Des().Append( errMsg ); |
|
368 |
|
369 CAknGlobalNote* globalNote = CAknGlobalNote::NewL(); |
|
370 CleanupStack::PushL( globalNote ); |
|
371 globalNote->ShowNoteL( EAknGlobalErrorNote , *errMsgBuf ); |
|
372 |
|
373 CleanupStack::PopAndDestroy( globalNote ); |
|
374 CleanupStack::PopAndDestroy( errMsgBuf ); |
|
375 CleanupStack::PopAndDestroy( textResolver ); |
|
376 } |
|
377 } |
|
378 |
|
379 // ----------------------------------------------------------------------------- |
|
380 // CCMAppUI::ProcessCommandParametersL |
|
381 // 2 params |
|
382 // (other items were commented in a header). |
|
383 // ----------------------------------------------------------------------------- |
|
384 // |
|
385 TBool CCMAppUi::ProcessCommandParametersL( TApaCommand /*aCommand*/, TFileName& /*aDocumentName*/ ) |
|
386 { |
|
387 LOGSTRING( "CCMAppUi::ProcessCommandParametersL 2 params" ); |
|
388 return( ETrue ); |
|
389 } |
|
390 |
|
391 // ----------------------------------------------------------------------------- |
|
392 // CCMAppUI::ProcessCommandParametersL |
|
393 // 3 params |
|
394 // (other items were commented in a header). |
|
395 // ----------------------------------------------------------------------------- |
|
396 // |
|
397 TBool CCMAppUi::ProcessCommandParametersL( TApaCommand /*aCommand*/, TFileName& /*aDocumentName*/, const TDesC8& aTail ) |
|
398 { |
|
399 LOGSTRING( "CCMAppUi::ProcessCommandParametersL 3 params" ); |
|
400 LOGSTRING( "aTail:" ); |
|
401 LOGTEXT( aTail ); |
|
402 if( !IsNetworkConnectionsAllowedL() ) |
|
403 { |
|
404 // network connections not allowed |
|
405 LOGSTRING( "Network connections not allowed" ); |
|
406 //DelayedExit(); |
|
407 Exit(); |
|
408 return ETrue; |
|
409 } |
|
410 |
|
411 if( aTail.Length() == 0 ) |
|
412 { |
|
413 LOGSTRING( "no params" ) |
|
414 } |
|
415 else |
|
416 { |
|
417 // aTail is in 8-bit format, cast |
|
418 // (The format was changed from 16-bit to 8-bit because of 3.0 porting; |
|
419 // there is not CApaCommandLine::SetFullCommandLine in 3.0, SetTailEndL |
|
420 // is used instead and it uses 8-bit format) |
|
421 HBufC* paramsBuf = HBufC::NewLC( aTail.Length() ); |
|
422 TPtr paramsBufPtr = paramsBuf->Des(); |
|
423 paramsBufPtr.Copy( aTail ); |
|
424 TLex lexx( *paramsBuf ); |
|
425 TChar getchar; |
|
426 |
|
427 for( ;; ) |
|
428 { |
|
429 lexx.SkipSpace(); |
|
430 lexx.Mark(); |
|
431 TPtrC token = lexx.NextToken(); |
|
432 |
|
433 if( token.Length() == 0 ) |
|
434 { |
|
435 LOGSTRING( "token length == 0"); |
|
436 break; |
|
437 } |
|
438 else if( token.Length() == 1 ) |
|
439 { |
|
440 LOGSTRING( "token length == 1"); |
|
441 break; |
|
442 } |
|
443 |
|
444 // s"www" |
|
445 // 012345 |
|
446 |
|
447 if( token[1] == '\"' && token[token.Length()-1] != '\"' ) |
|
448 { |
|
449 do |
|
450 { |
|
451 getchar = lexx.Get(); |
|
452 } while( (getchar != '\"') && (getchar != 0) ); |
|
453 token.Set( lexx.MarkedToken() ); |
|
454 } |
|
455 |
|
456 LOGSTRING( "token:" ); |
|
457 LOGTEXT( token ); |
|
458 |
|
459 TChar param = token[0]; |
|
460 TPtrC paramVal; |
|
461 if( token[1] == '\"' ) |
|
462 { |
|
463 if( token[2] == '\"' ) |
|
464 { |
|
465 // just quotes, e.g. q"" |
|
466 } |
|
467 else |
|
468 { |
|
469 paramVal.Set( token.Mid(2,token.Length()-3) ); |
|
470 } |
|
471 } |
|
472 else |
|
473 { |
|
474 paramVal.Set( token.Mid(1) ); |
|
475 } |
|
476 |
|
477 LOGSTRING( "paramVal:" ); |
|
478 LOGTEXT( paramVal ); |
|
479 |
|
480 switch( param ) |
|
481 { |
|
482 case 's': |
|
483 { |
|
484 LOGSTRING( "setting server to:" ); |
|
485 LOGTEXT( paramVal ); |
|
486 SetServerString( paramVal ); |
|
487 break; |
|
488 } |
|
489 case 'p': |
|
490 { |
|
491 LOGSTRING( "setting page to:" ); |
|
492 LOGTEXT( paramVal ); |
|
493 SetPageString( paramVal ); |
|
494 break; |
|
495 } |
|
496 case 'r': |
|
497 { |
|
498 TLex lexx2( paramVal ); |
|
499 TInt reason = 0; |
|
500 lexx2.Val(reason); |
|
501 // Store connect reason |
|
502 switch(reason) |
|
503 { |
|
504 case 0: |
|
505 SetConnectReason(CCMAppUi::EConnectReasonUnknown); |
|
506 LOGSTRING( "Unknown connection reason" ); |
|
507 break; |
|
508 case 1: |
|
509 SetConnectReason(CCMAppUi::EConnectReasonFirstBoot); |
|
510 LOGSTRING( "Connection reason first boot" ); |
|
511 break; |
|
512 case 2: |
|
513 SetConnectReason(CCMAppUi::EConnectReasonNewSim); |
|
514 LOGSTRING( "Connection reason new sim" ); |
|
515 break; |
|
516 case 3: |
|
517 SetConnectReason(CCMAppUi::EConnectReasonUserTriggered); |
|
518 LOGSTRING( "Connection reason user triggered" ); |
|
519 break; |
|
520 case 4: |
|
521 SetConnectReason(CCMAppUi::EConnectReasonApplicationTriggered); |
|
522 LOGSTRING( "Connection reason application triggered" ); |
|
523 break; |
|
524 case 5: |
|
525 SetConnectReason(CCMAppUi::EConnectReasonRemoteTriggered); |
|
526 LOGSTRING( "Connection reason remote triggered" ); |
|
527 break; |
|
528 default: |
|
529 LOGSTRING( "Invalid connect reason parameter" ); |
|
530 break; |
|
531 } |
|
532 break; |
|
533 } |
|
534 case 'q': |
|
535 { |
|
536 LOGSTRING( "setting query string to:" ); |
|
537 LOGTEXT( paramVal ); |
|
538 SetQueryString( paramVal ); |
|
539 break; |
|
540 } |
|
541 case 'a': |
|
542 { |
|
543 LOGSTRING( "setting autostart to:" ); |
|
544 TLex lexx2( paramVal ); |
|
545 TInt autostart = 0; // Default is "off" |
|
546 TInt hiddenEnabled(0); |
|
547 TInt err(KErrNone); |
|
548 lexx2.Val( autostart ); |
|
549 LOGTEXT( paramVal ); |
|
550 switch( autostart ) |
|
551 { |
|
552 case 0: |
|
553 iAutoStart = EFalse; |
|
554 break; |
|
555 case 1: |
|
556 // check that autostart mode is allowed |
|
557 err = GetIntValue( KOnlineSupportHiddenEnabled, hiddenEnabled ); |
|
558 if (err != KErrNone) |
|
559 { |
|
560 LOGSTRING2( "GetIntValue(KOnlineSupportHiddenEnabled) errorcode %i", err ); |
|
561 } |
|
562 |
|
563 if(hiddenEnabled == 1) |
|
564 { |
|
565 iAutoStart = ETrue; |
|
566 } |
|
567 else |
|
568 { |
|
569 LOGSTRING( "Autostart not allowed" ); |
|
570 iAutoStart = EFalse; |
|
571 } |
|
572 break; |
|
573 default: |
|
574 iAutoStart = EFalse; |
|
575 break; |
|
576 } |
|
577 break; |
|
578 } |
|
579 case 't': |
|
580 { |
|
581 LOGSTRING( "setting TOKEN override to:" ); |
|
582 TLex lexx2( paramVal ); |
|
583 TInt tokenOverride = 0; // Default is "off" |
|
584 lexx2.Val( tokenOverride ); |
|
585 LOGTEXT( paramVal ); |
|
586 switch( tokenOverride ) |
|
587 { |
|
588 case 0: |
|
589 iTokenOverride = EFalse; |
|
590 break; |
|
591 case 1: |
|
592 iTokenOverride = ETrue; |
|
593 break; |
|
594 default: |
|
595 iTokenOverride = EFalse; |
|
596 break; |
|
597 } |
|
598 break; |
|
599 } |
|
600 default: |
|
601 { |
|
602 LOGSTRING( "commandline parse error, unrecognized param indentifier" ); |
|
603 break; |
|
604 } |
|
605 } |
|
606 lexx.SkipCharacters(); |
|
607 |
|
608 } |
|
609 LOGSTRING( "cmdline parsing done" ); |
|
610 |
|
611 CleanupStack::PopAndDestroy( paramsBuf ); |
|
612 } // else |
|
613 |
|
614 |
|
615 if( iAutoStart ) |
|
616 { |
|
617 // do not show confirmation dialog, but call "ok"-button handler |
|
618 CommonDialogDismissedL(CCMDialogMonitor::EConfirmation, EAknSoftkeyYes); |
|
619 } |
|
620 else |
|
621 { |
|
622 // show confirmation dialog to user, after user has accepted or cancelled |
|
623 // CommonDialogDismissedL -function is called |
|
624 ConfirmationDialogL(); |
|
625 |
|
626 } |
|
627 |
|
628 |
|
629 //StartTimeOut( KStartUpTimeOut ); |
|
630 |
|
631 //TRAP_IGNORE( WaitDialogL( iWaitDialogProgressVal ) ); |
|
632 return ETrue; |
|
633 } |
|
634 |
|
635 // ----------------------------------------------------------------------------- |
|
636 // CCMAppUI::DelayedExit |
|
637 // ----------------------------------------------------------------------------- |
|
638 // |
|
639 void CCMAppUi::DelayedExit() |
|
640 { |
|
641 LOGSTRING("CCMAppUi::DelayedExit - begin"); |
|
642 StartTimeOut( KExitTimeOut ); |
|
643 iApplicationStatus = EAppStatusClosing; |
|
644 |
|
645 // In case doing a delayed exit, iWaitDialog has not been deleted yet |
|
646 // (except if delayed exit is being done via iWaitDialog "Cancel" selection |
|
647 // -> see DialogDismissedL) |
|
648 /*if( iWaitDialog && !iWaitDialogProcessFinished ) |
|
649 { |
|
650 LOGSTRING( "iWaitDialog->ProcessFinishedL" ); |
|
651 iWaitDialogProcessFinished = ETrue; |
|
652 TRAP_IGNORE( iWaitDialog->ProcessFinishedL() ); |
|
653 LOGSTRING( "iWaitDialog->ProcessFinishedL - done" ); |
|
654 }*/ |
|
655 |
|
656 LOGSTRING("DelayedExit - done"); |
|
657 } |
|
658 |
|
659 // ----------------------------------------------------------------------------- |
|
660 // CCMAppUI::TimeOutCallBack |
|
661 // ----------------------------------------------------------------------------- |
|
662 // |
|
663 TInt CCMAppUi::TimeOutCallBack( TAny* aCCMAppUi ) |
|
664 { |
|
665 TRAPD( err, ( ( CCMAppUi* )aCCMAppUi )->DoTimeOutCallBackL() ); |
|
666 // DoTimeOutCallBackL might have called Exit() |
|
667 if( err == KLeaveExit ) |
|
668 { |
|
669 User::Leave( KLeaveExit ); |
|
670 } |
|
671 return err; |
|
672 } |
|
673 |
|
674 // ----------------------------------------------------------------------------- |
|
675 // CCMAppUI::DoTimeOutCallBackL |
|
676 // ----------------------------------------------------------------------------- |
|
677 // |
|
678 void CCMAppUi::DoTimeOutCallBackL() |
|
679 { |
|
680 LOGSTRING( "CCMAppUi::DoTimeOutCallBackL()" ); |
|
681 LOGSTRING2( "application status %i", iApplicationStatus ) |
|
682 if( iTimer->IsActive() ) |
|
683 { |
|
684 iTimer->Cancel(); |
|
685 } |
|
686 |
|
687 switch( iApplicationStatus ) |
|
688 { |
|
689 case EAppStatusMonitoring: |
|
690 LOGSTRING("CCMAppUi calls StopMonitoring "); |
|
691 iRegistrationMonitor->StopMonitoring(); |
|
692 iApplicationStatus = EAppStatusInactive; |
|
693 //ErrorNoteNetworkL(); |
|
694 ErrorNoteConnectionL(); |
|
695 //DelayedExit(); |
|
696 Exit(); |
|
697 break; |
|
698 case EAppStatusConnecting: |
|
699 LOGSTRING("CCMAppUi calls disconnect"); |
|
700 iEngine->Disconnect(); |
|
701 iApplicationStatus = EAppStatusInactive; |
|
702 ConnectionResultL( KErrTimedOut ); |
|
703 break; |
|
704 case EAppStatusWaitingDisconnect: |
|
705 LOGSTRING("Connection will be disconnected"); |
|
706 iEngine->Disconnect(); |
|
707 iApplicationStatus = EAppStatusInactive; |
|
708 break; |
|
709 case EAppStatusStartingUp: |
|
710 LOGSTRING("Starting up"); |
|
711 StartUpOperationL(); |
|
712 break; |
|
713 case EAppStatusClosing: |
|
714 LOGSTRING("EAppStatusClosing"); |
|
715 LOGSTRING("Restore settings"); |
|
716 // Exit immediately, a call to DelayedExit has been made |
|
717 // (and the exit timeout has already been passed) |
|
718 Exit(); // Leaves with KLeaveExit |
|
719 break; |
|
720 default: |
|
721 LOGSTRING("Restore settings"); |
|
722 //DelayedExit(); |
|
723 Exit(); |
|
724 break; |
|
725 }; |
|
726 |
|
727 LOGSTRING( "DoTimeOutCallBack - done" ); |
|
728 } |
|
729 |
|
730 // ----------------------------------------------------------------------------- |
|
731 // CCMAppUI::InitiateNextConnectionTestL() |
|
732 // ----------------------------------------------------------------------------- |
|
733 // |
|
734 void CCMAppUi::InitiateNextConnectionTestL() |
|
735 { |
|
736 LOGSTRING( "CCMAppUi::InitiateNextConnectionTestL" ); |
|
737 TInt err( KErrNone ); |
|
738 |
|
739 if( iNetworkStatus != CCMRegistrationMonitor::EHomenetwork && |
|
740 iNetworkStatus != CCMRegistrationMonitor::ERoaming ) |
|
741 { |
|
742 LOGSTRING( "InitiateNextConnectionTestL, network NOT ok" ); |
|
743 if( iGlobalWaitNote ) |
|
744 { |
|
745 iGlobalWaitNote->CancelNoteL(iWaitNoteId); |
|
746 delete iGlobalWaitNote; |
|
747 iGlobalWaitNote = NULL; |
|
748 } |
|
749 /*if( iWaitDialog && !iWaitDialogProcessFinished ) |
|
750 { |
|
751 LOGSTRING("iWaitDialog->ProcessFinishedL()"); |
|
752 iWaitDialogProcessFinished = ETrue; |
|
753 iWaitDialog->ProcessFinishedL(); |
|
754 }*/ |
|
755 if( iConnectReason == CCMAppUi::EConnectReasonFirstBoot ) |
|
756 { |
|
757 LOGSTRING( "...startupstart" ); |
|
758 //Roaming information to confmanager's ini file |
|
759 if ( iNetworkStatusOk == EFalse ) |
|
760 { |
|
761 StoreIntValue( KOnlineSupportRoaming, EFalse ); |
|
762 } |
|
763 Exit(); |
|
764 //DelayedExit(); |
|
765 return; |
|
766 } |
|
767 else // menu start, show error note |
|
768 { |
|
769 LOGSTRING( "ErrorNoteConnectionL" ); |
|
770 //ErrorNoteNetworkL(); |
|
771 ErrorNoteConnectionL(); |
|
772 Exit(); |
|
773 //DelayedExit(); |
|
774 return; |
|
775 } |
|
776 } |
|
777 if( iConnectingVia == EConnectingViaNull && iInitAccessOn ) |
|
778 { |
|
779 iConnectingVia = EConnectingViaInit; |
|
780 if( TryInitAccessL() ) |
|
781 { |
|
782 return; |
|
783 } |
|
784 } |
|
785 if( iConnectingVia == EConnectingViaInit ) |
|
786 { |
|
787 iConnectingVia = EConnectingViaDefault; |
|
788 __UHEAP_MARK; |
|
789 TBool value( EFalse ); |
|
790 TRAP( err, value = TryDefaultAccessL() ); |
|
791 __UHEAP_MARKEND; |
|
792 if( value ) |
|
793 { |
|
794 return; |
|
795 } |
|
796 } |
|
797 if( iConnectingVia == EConnectingViaDefault ) |
|
798 { |
|
799 iConnectingVia = EConnectingViaUser; |
|
800 TBool value( EFalse ); |
|
801 TRAP( err, value = TryUserAccessL() ); |
|
802 if( value ) |
|
803 { |
|
804 LOGSTRING( "User access test initiated" ); |
|
805 return; |
|
806 } |
|
807 else |
|
808 { |
|
809 LOGSTRING2( "TryUserAccessL err: %i", err ); |
|
810 LOGSTRING( "ErrorNoteConnectionL" ) |
|
811 ErrorNoteConnectionL(); |
|
812 LOGSTRING( "Exit" ) |
|
813 //DelayedExit(); |
|
814 Exit(); |
|
815 } |
|
816 } |
|
817 } |
|
818 |
|
819 // ----------------------------------------------------------------------------- |
|
820 // CCMAppUI::TryInitAccessL() |
|
821 // ----------------------------------------------------------------------------- |
|
822 // |
|
823 TBool CCMAppUi::TryInitAccessL() |
|
824 { |
|
825 LOGSTRING( "CCMAppUi::TryInitAccessL()" ); |
|
826 if( iInitAccessOn ) |
|
827 { |
|
828 TUint32 ap = InitAccessPointL(); |
|
829 iInitAccessPointUsed = ETrue; |
|
830 |
|
831 if ( ap != 0 ) |
|
832 { |
|
833 TBuf<255> domain; |
|
834 AppendDomainL( domain ); |
|
835 LOGSTRING( "Starting Init access test" ); |
|
836 iEngine->ConnectL( ap, domain ); |
|
837 |
|
838 StartTimeOut( KConnectionTimeOut ); |
|
839 iApplicationStatus = EAppStatusConnecting; |
|
840 return( ETrue ); |
|
841 } |
|
842 |
|
843 LOGSTRING( "Init access failed in db" ); |
|
844 return( EFalse ); |
|
845 } |
|
846 else |
|
847 { |
|
848 LOGSTRING( "CCMAppUi::TryInitAccessL() InitAccess feature off " ); |
|
849 return EFalse; |
|
850 } |
|
851 } |
|
852 |
|
853 // ----------------------------------------------------------------------------- |
|
854 // CCMAppUI::StartTimeOut |
|
855 // ----------------------------------------------------------------------------- |
|
856 // |
|
857 void CCMAppUi::StartTimeOut( const TInt aTimeOut ) |
|
858 { |
|
859 LOGSTRING2( "CCMAppUi::StartTimeOut: %i", aTimeOut ); |
|
860 // EAppStatusClosing means we are already waiting for the timer to |
|
861 // trigger application exit, no need for a new time-out in that case |
|
862 if( iApplicationStatus != EAppStatusClosing ) |
|
863 { |
|
864 TCallBack callBack( TimeOutCallBack, this ); |
|
865 if( iTimer->IsActive() ) |
|
866 { |
|
867 iTimer->Cancel(); |
|
868 } |
|
869 iTimer->Start( aTimeOut, aTimeOut, callBack ); |
|
870 } |
|
871 } |
|
872 |
|
873 // ----------------------------------------------------------------------------- |
|
874 // CCMAppUI::TryDefaultAccessL() |
|
875 // ----------------------------------------------------------------------------- |
|
876 // |
|
877 TBool CCMAppUi::TryDefaultAccessL() |
|
878 { |
|
879 LOGSTRING( "CCMAppUi::TryDefaultAccessL" ); |
|
880 TUint32 ap = CheckDefaultAccessPointL(); |
|
881 iInitAccessPointUsed = EFalse; |
|
882 |
|
883 if ( ap != 0 ) |
|
884 { |
|
885 TBuf<255> domain; |
|
886 AppendDomainL( domain ); |
|
887 LOGSTRING( "Starting default access test" ); |
|
888 iEngine->ConnectL( ap, domain ); |
|
889 |
|
890 StartTimeOut( KConnectionTimeOut ); |
|
891 iApplicationStatus = EAppStatusConnecting; |
|
892 return( ETrue ); |
|
893 } |
|
894 |
|
895 LOGSTRING( "Default access failed in db" ); |
|
896 return( EFalse ); |
|
897 } |
|
898 |
|
899 |
|
900 // ----------------------------------------------------------------------------- |
|
901 // CCMAppUI::TryUserAccessL() |
|
902 // ----------------------------------------------------------------------------- |
|
903 // |
|
904 TBool CCMAppUi::TryUserAccessL() |
|
905 { |
|
906 LOGSTRING( "CCMAppUi::TryUserAccessL" ); |
|
907 TInt accessPoints = CheckSettingsL(); |
|
908 iInitAccessPointUsed = EFalse; |
|
909 |
|
910 // initAccess and browser default is tested, if more ap then ask from user |
|
911 if ( !iAutoStart ) |
|
912 { |
|
913 if( (iInitAccessOn && accessPoints > 2) || !iInitAccessOn) |
|
914 { |
|
915 LOGSTRING( "Starting user access test" ); |
|
916 |
|
917 TBuf<255> domain; |
|
918 AppendDomainL( domain ); |
|
919 iEngine->ConnectL( 0, domain ); |
|
920 |
|
921 StartTimeOut( KConnectionTimeOut ); |
|
922 iApplicationStatus = EAppStatusConnecting; |
|
923 |
|
924 return( ETrue ); |
|
925 } |
|
926 } |
|
927 |
|
928 LOGSTRING( "User access test not started" ); |
|
929 return( EFalse ); |
|
930 } |
|
931 |
|
932 /// ----------------------------------------------------------------------------- |
|
933 // CCMAppUI::CheckSettingsL |
|
934 // Cheks if there is wap setting available. |
|
935 // (other items were commented in a header). |
|
936 // ----------------------------------------------------------------------------- |
|
937 // |
|
938 TInt CCMAppUi::CheckSettingsL() |
|
939 { |
|
940 CCommsDatabase* theDb; |
|
941 CCommsDbTableView* theView; |
|
942 TInt settings( 0 ); |
|
943 TInt errorCode( KErrNone ); |
|
944 theDb = CCommsDatabase::NewL( ); |
|
945 CleanupStack::PushL( theDb ); |
|
946 theView = theDb->OpenTableLC( TPtrC( IAP ) ); |
|
947 errorCode = theView->GotoFirstRecord(); |
|
948 if ( errorCode != KErrNotFound ) |
|
949 { |
|
950 settings = 1; |
|
951 while ( errorCode != KErrNotFound ) |
|
952 { |
|
953 errorCode = theView->GotoNextRecord(); |
|
954 if ( errorCode == KErrNone ) |
|
955 { |
|
956 settings++; |
|
957 } |
|
958 } |
|
959 } |
|
960 CleanupStack::PopAndDestroy( 2 ); |
|
961 return settings; |
|
962 } |
|
963 |
|
964 // ----------------------------------------------------------------------------- |
|
965 // CCMAppUI::AppendDomainL |
|
966 // ----------------------------------------------------------------------------- |
|
967 // |
|
968 void CCMAppUi::AppendDomainL( TDes& aUrl ) |
|
969 { |
|
970 if( iServer.Compare( KServerNokia ) == 0 ) |
|
971 { |
|
972 if( aUrl.MaxLength() < aUrl.Length() + KNokia().Length() ) |
|
973 { |
|
974 User::Leave( KErrArgument ); |
|
975 } |
|
976 aUrl.Append( KNokia ); |
|
977 } |
|
978 else |
|
979 { |
|
980 if( aUrl.MaxLength() < aUrl.Length() + iServer.Length() + KHelpPortal().Length() ) |
|
981 { |
|
982 User::Leave( KErrArgument ); |
|
983 } |
|
984 aUrl.Append( iServer ); |
|
985 aUrl.Append( KHelpPortal ); |
|
986 } |
|
987 } |
|
988 |
|
989 // ----------------------------------------------------------------------------- |
|
990 // CCMAppUI::OpenWapBrowserL |
|
991 // Opens WAP browser |
|
992 // (other items were commented in a header). |
|
993 // ----------------------------------------------------------------------------- |
|
994 // |
|
995 void CCMAppUi::OpenWapBrowserL() |
|
996 { |
|
997 LOGSTRING( "Enter to CCMAppUi::OpenWapBrowserL" ); |
|
998 iWapPage.Zero(); |
|
999 |
|
1000 DeleteServiceActivationInfoL(); |
|
1001 |
|
1002 CPnpUtilImpl* pnpUtil = CPnpUtilImpl::NewLC(); |
|
1003 |
|
1004 LOGSTRING( "OpenWapBrowserL 2" ); |
|
1005 |
|
1006 if( !iAutoStart ) |
|
1007 { |
|
1008 // Help portal address and type |
|
1009 // 4 means Url address. (see Browser API documentation) |
|
1010 _LIT ( KAddressType, "4 " ); |
|
1011 iWapPage.Copy( KAddressType ); |
|
1012 } |
|
1013 |
|
1014 LOGSTRING( "OpenWapBrowserL 3" ); |
|
1015 |
|
1016 iWapPage.Append( KHttp ); |
|
1017 AppendDomainL( iWapPage ); |
|
1018 iWapPage.Append( KSlash ); |
|
1019 |
|
1020 LOGSTRING( "OpenWapBrowserL 4" ); |
|
1021 iWapPage.Append( iPage ); |
|
1022 iWapPage.Append( KQuestionMark ); |
|
1023 |
|
1024 #ifdef __WINS__ |
|
1025 RMobilePhone::TMobilePhoneNetworkInfoV1 homeNetworkInfo; |
|
1026 homeNetworkInfo.iCountryCode.Copy( _L("244") ); |
|
1027 homeNetworkInfo.iNetworkId.Copy( _L("05") ); |
|
1028 #else |
|
1029 const RMobilePhone::TMobilePhoneNetworkInfoV1& homeNetworkInfo = iRegistrationMonitor->GetHomeNetworkInfo(); |
|
1030 #endif |
|
1031 // Home MCC |
|
1032 //iWapPage.Append( KParameterDelimeter ); |
|
1033 iWapPage.Append( KSimMccParameter ); |
|
1034 iWapPage.Append( homeNetworkInfo.iCountryCode ); |
|
1035 pnpUtil->SetHomeMccL( homeNetworkInfo.iCountryCode ); |
|
1036 |
|
1037 LOGSTRING( "OpenWapBrowserL 5" ); |
|
1038 // Home MNC |
|
1039 RMobilePhone::TMobilePhoneNetworkIdentity formattedMnc; |
|
1040 pnpUtil->FormatMncCodeL( homeNetworkInfo.iCountryCode, homeNetworkInfo.iNetworkId, formattedMnc ); |
|
1041 iWapPage.Append( KParameterDelimeter ); |
|
1042 iWapPage.Append( KSimMncParameter ); |
|
1043 iWapPage.Append( formattedMnc ); |
|
1044 pnpUtil->SetHomeMncL( formattedMnc ); |
|
1045 |
|
1046 LOGSTRING( "OpenWapBrowserL 6" ); |
|
1047 #ifdef __WINS__ |
|
1048 RMobilePhone::TMobilePhoneNetworkInfoV1 currentNetworkInfo; |
|
1049 currentNetworkInfo.iCountryCode.Copy( _L("244") ); |
|
1050 currentNetworkInfo.iNetworkId.Copy( _L("05") ); |
|
1051 #else |
|
1052 const RMobilePhone::TMobilePhoneNetworkInfoV1& currentNetworkInfo = iRegistrationMonitor->GetCurrentNetworkInfo(); |
|
1053 #endif |
|
1054 // current MCC |
|
1055 iWapPage.Append( KParameterDelimeter ); |
|
1056 iWapPage.Append( KCurrentMccParameter ); |
|
1057 iWapPage.Append( currentNetworkInfo.iCountryCode ); |
|
1058 pnpUtil->SetNetworkMccL( currentNetworkInfo.iCountryCode ); |
|
1059 |
|
1060 LOGSTRING( "OpenWapBrowserL 7" ); |
|
1061 // current MNC |
|
1062 TRAPD( err, pnpUtil->FormatMncCodeL( currentNetworkInfo.iCountryCode, currentNetworkInfo.iNetworkId, formattedMnc ) ); |
|
1063 if( err != KErrNone ) |
|
1064 { |
|
1065 LOGSTRING2( "FormatMncCodeL err: %i", err ); |
|
1066 pnpUtil->SetNetworkMncL( currentNetworkInfo.iNetworkId ); |
|
1067 } |
|
1068 else |
|
1069 { |
|
1070 iWapPage.Append( KParameterDelimeter ); |
|
1071 iWapPage.Append( KCurrentMncParameter ); |
|
1072 iWapPage.Append( formattedMnc ); |
|
1073 pnpUtil->SetNetworkMncL( formattedMnc ); |
|
1074 } |
|
1075 |
|
1076 LOGSTRING( "OpenWapBrowserL 8" ); |
|
1077 //pnpUtil->StoreAccessPoint( iAccessPoint ); // not needed anymore |
|
1078 |
|
1079 // Init AP, use token |
|
1080 LOGSTRING( "iServer:" ); |
|
1081 LOGTEXT( iServer ); |
|
1082 |
|
1083 // AppendTokenAndNonceVal |
|
1084 AppendTokenAndNonceValL(); |
|
1085 |
|
1086 // Connection reason |
|
1087 LOGSTRING( "connection reason" ); |
|
1088 iWapPage.Append( KParameterDelimeter ); |
|
1089 iWapPage.Append( KConnectReasonParameter ); |
|
1090 if( iConnectReason == EConnectReasonUnknown ) |
|
1091 { |
|
1092 iWapPage.AppendNum( (TInt)EConnectReasonUserTriggered ); |
|
1093 } |
|
1094 else |
|
1095 { |
|
1096 iWapPage.AppendNum( (TInt)iConnectReason ); |
|
1097 } |
|
1098 |
|
1099 // PnpVersion |
|
1100 TBuf<KMaxVersionStringLength> pnpversion; |
|
1101 User::LeaveIfError( pnpUtil->Version( pnpversion ) ); |
|
1102 LOGSTRING( "PnPVersion" ); |
|
1103 iWapPage.Append( KParameterDelimeter ); |
|
1104 iWapPage.Append( KPnpVersionParameter ); |
|
1105 iWapPage.Append( pnpversion ); |
|
1106 LOGSTRING( "PopAndDestroy pnpUtil" ) |
|
1107 CleanupStack::PopAndDestroy( pnpUtil ); |
|
1108 |
|
1109 // help query string |
|
1110 if( iQuery.Length() > 0 ) |
|
1111 { |
|
1112 LOGSTRING( "query" ); |
|
1113 HBufC16* param = EscapeUtils::EscapeEncodeL(iQuery,EscapeUtils::EEscapeUrlEncoded); |
|
1114 if(param) |
|
1115 { |
|
1116 LOGSTRING( "converted:" ); |
|
1117 LOGTEXT( *param ); |
|
1118 iWapPage.Append( KParameterDelimeter ); |
|
1119 iWapPage.Append( KQueryParameter ); |
|
1120 iWapPage.Append( *param ); |
|
1121 delete param; |
|
1122 } |
|
1123 |
|
1124 } |
|
1125 |
|
1126 |
|
1127 |
|
1128 // Append Device Information to URL |
|
1129 |
|
1130 AppendDeviceInfoL(); |
|
1131 |
|
1132 |
|
1133 // Operator name, service provider |
|
1134 const RMobilePhone::TMobilePhoneServiceProviderNameV2& serviceProviderName = iRegistrationMonitor->GetServiceProviderName(); |
|
1135 if( serviceProviderName.iSPName.Length() > 0 ) |
|
1136 { |
|
1137 LOGSTRING( "spname" ); |
|
1138 HBufC16* param = EscapeUtils::EscapeEncodeL( serviceProviderName.iSPName, EscapeUtils::EEscapeUrlEncoded ); |
|
1139 if(param) |
|
1140 { |
|
1141 LOGSTRING( "converted:" ); |
|
1142 LOGTEXT( *param ); |
|
1143 iWapPage.Append( KParameterDelimeter ); |
|
1144 iWapPage.Append( KOperatorNameParameter ); |
|
1145 iWapPage.Append( *param ); |
|
1146 delete param; |
|
1147 } |
|
1148 } |
|
1149 LOGTEXT( currentNetworkInfo.iShortName ); |
|
1150 LOGTEXT( currentNetworkInfo.iLongName ); |
|
1151 |
|
1152 // Current operator name |
|
1153 if( currentNetworkInfo.iLongName.Length() > 0 ) |
|
1154 { |
|
1155 LOGSTRING( "current operator name" ); |
|
1156 HBufC16* param = EscapeUtils::EscapeEncodeL( currentNetworkInfo.iLongName, EscapeUtils::EEscapeUrlEncoded ); |
|
1157 if(param) |
|
1158 { |
|
1159 LOGSTRING( "converted:" ); |
|
1160 LOGTEXT( *param ); |
|
1161 iWapPage.Append( KParameterDelimeter ); |
|
1162 iWapPage.Append( KCurrentOperatorNameParameter ); |
|
1163 iWapPage.Append( *param ); |
|
1164 delete param; |
|
1165 } |
|
1166 } |
|
1167 |
|
1168 //Append WebUtils Params to URL |
|
1169 AppendWebUtilParamsL(); |
|
1170 |
|
1171 |
|
1172 |
|
1173 // MSISDN |
|
1174 const RMobileONStore::TMobileONEntryV1& ownNumberInfo = iRegistrationMonitor->GetOwnNumberInfo(); |
|
1175 if( ownNumberInfo.iNumber.iTelNumber.Length() ) |
|
1176 { |
|
1177 LOGSTRING( "ownNumberInfo.iNumber.iTelNumber" ); |
|
1178 iWapPage.Append( KParameterDelimeter ); |
|
1179 iWapPage.Append( KMSISDNParameter ); |
|
1180 iWapPage.Append( ownNumberInfo.iNumber.iTelNumber ); |
|
1181 } |
|
1182 |
|
1183 // Phone alias |
|
1184 iWapPage.Append( KParameterDelimeter ); |
|
1185 iWapPage.Append( KPhoneAlias ); |
|
1186 iWapPage.Append( KPhoneAliasValue ); |
|
1187 |
|
1188 //Create online help based on Interactive or NonInteractive feature |
|
1189 OnlineHelpL(); |
|
1190 |
|
1191 LOGSTRING( "Exit from OpenWapBrowser" ); |
|
1192 } |
|
1193 |
|
1194 |
|
1195 // ----------------------------------------------------------------------------- |
|
1196 // CCMAppUI::DeleteServiceActivationInfoL |
|
1197 // |
|
1198 // ----------------------------------------------------------------------------- |
|
1199 // |
|
1200 |
|
1201 void CCMAppUi::DeleteServiceActivationInfoL() |
|
1202 { |
|
1203 |
|
1204 // Reset values for service activation. Service activation should not be supported |
|
1205 // by online support since WDS Global server URL is hardcoded (help-portal server |
|
1206 // connecting to WDS) if service activation required for onlinesupport comment below |
|
1207 // statements for PnpProvUtil. |
|
1208 |
|
1209 CPnpProvUtil* prov = CPnpProvUtil::NewLC(); |
|
1210 |
|
1211 const TUint32 uidval = 0; |
|
1212 prov->SetApplicationUidL(uidval); |
|
1213 |
|
1214 |
|
1215 TBuf<2> buf(_L("")); |
|
1216 prov->SetProvAdapterAppIdL(buf); |
|
1217 |
|
1218 CleanupStack::PopAndDestroy(); |
|
1219 |
|
1220 } |
|
1221 |
|
1222 |
|
1223 // ----------------------------------------------------------------------------- |
|
1224 // CCMAppUI::AppendTokenAndNonceValL |
|
1225 // |
|
1226 // ----------------------------------------------------------------------------- |
|
1227 // |
|
1228 |
|
1229 void CCMAppUi::AppendTokenAndNonceValL() |
|
1230 { |
|
1231 |
|
1232 |
|
1233 CPnpUtilImpl *pnpUtil = CPnpUtilImpl::NewLC(); |
|
1234 |
|
1235 |
|
1236 // TOKEN has to be sent: |
|
1237 // - When connecting through "initAccess" to www.help-portal.com/page1 |
|
1238 // - When connecting through the fallback APN to *.help-portal.com EXCEPT to www.help-portal.com |
|
1239 // -- This feature is needed for testing of provisioning over HTTP |
|
1240 // TOKEN should NOT be sent: |
|
1241 // - When connecting through "initAccess" to any other URL |
|
1242 // - When connecting through the fallback APN to pnpms.nokia.com |
|
1243 |
|
1244 // Changed: |
|
1245 // Token override allows now giving token even when not connecting through initAccess, |
|
1246 // so there is no need to allow TOKEN for demo purposes if token override is not on |
|
1247 |
|
1248 if( iTokenOverride // token override set on commandline params |
|
1249 || |
|
1250 // No token override: |
|
1251 ( iInitAccessPointUsed |
|
1252 && iServer.Compare( KDefaultServerString ) == 0 ) // connecting to www.help-portal.com |
|
1253 ) |
|
1254 { |
|
1255 // Add Token |
|
1256 LOGSTRING( "token" ); |
|
1257 TInt validitytime = pnpUtil->GetTokenValidityTime(); |
|
1258 TInt tokenvalue = 0; |
|
1259 TInt err = pnpUtil->CreateNewToken( validitytime, tokenvalue ); |
|
1260 if( err != KErrNone ) |
|
1261 { |
|
1262 LOGSTRING2( "CreateNewToken returned: %i", err ); |
|
1263 User::Leave( err ); |
|
1264 } |
|
1265 iWapPage.Append( KParameterDelimeter ); |
|
1266 iWapPage.Append( KTokenParameter ); |
|
1267 iWapPage.AppendNum( tokenvalue ); |
|
1268 // Token validity |
|
1269 LOGSTRING( "token validity" ); |
|
1270 iWapPage.Append( KParameterDelimeter ); |
|
1271 iWapPage.Append( KTokenValidityTimeParameter ); |
|
1272 iWapPage.AppendNum( validitytime ); |
|
1273 } |
|
1274 |
|
1275 |
|
1276 // The KEYINFO and NONCE should be SENT: |
|
1277 // - in all cases, also to "*help-portal.com" and through "initAccess". |
|
1278 |
|
1279 // Nonce |
|
1280 LOGSTRING( "nonce" ); |
|
1281 // validity time not used |
|
1282 TBuf8<KNonceLength> nonce8; |
|
1283 TBuf<KNonceLength> nonce; |
|
1284 TRAPD( err, pnpUtil->CreateNewNonceL( 0, nonce8 ) ); |
|
1285 if( err != KErrNone ) |
|
1286 { |
|
1287 LOGSTRING2( "CreateNewNonceL leave code: %i", err ); |
|
1288 User::Leave( err ); |
|
1289 } |
|
1290 nonce.Copy( nonce8 ); |
|
1291 |
|
1292 iWapPage.Append( KParameterDelimeter ); |
|
1293 iWapPage.Append( KNonceParameter ); |
|
1294 iWapPage.Append( nonce ); |
|
1295 |
|
1296 TBuf8<KMaxKeyInfoLength> keyInfo8; |
|
1297 TBuf<KMaxKeyInfoLength> keyInfo; |
|
1298 pnpUtil->GetKeyInfoL( keyInfo8 ); |
|
1299 keyInfo.Copy( keyInfo8 ); |
|
1300 |
|
1301 iWapPage.Append( KParameterDelimeter ); |
|
1302 iWapPage.Append( KKeyInfoParameter ); |
|
1303 iWapPage.Append( keyInfo ); |
|
1304 |
|
1305 CleanupStack::PopAndDestroy(); |
|
1306 |
|
1307 } |
|
1308 |
|
1309 |
|
1310 // ----------------------------------------------------------------------------- |
|
1311 // CCMAppUI::AppendSWandProductVersionL |
|
1312 // |
|
1313 // ----------------------------------------------------------------------------- |
|
1314 // |
|
1315 |
|
1316 void CCMAppUi::AppendDeviceInfoL() |
|
1317 { |
|
1318 |
|
1319 const RMobilePhone::TMobilePhoneIdentityV1& phoneIdentity = iRegistrationMonitor->GetPhoneIdentity(); |
|
1320 |
|
1321 const TInt KManufLength = 128; |
|
1322 |
|
1323 // Device type (for example dType=NOKIAE60) |
|
1324 iWapPage.Append( KParameterDelimeter ); |
|
1325 iWapPage.Append( KDeviceTypeParameter ); |
|
1326 |
|
1327 _LIT(KManufacturer, "Nokia"); |
|
1328 |
|
1329 TBuf<KManufLength> manfacturer; |
|
1330 manfacturer.Append(phoneIdentity.iManufacturer); |
|
1331 |
|
1332 TBuf<KManufLength> model; |
|
1333 |
|
1334 if(manfacturer.MatchF(KManufacturer)==KErrNotFound) |
|
1335 model.Append( phoneIdentity.iManufacturer ); |
|
1336 |
|
1337 |
|
1338 model.Append( phoneIdentity.iModel ); |
|
1339 |
|
1340 HBufC16* param_manf = EscapeUtils::EscapeEncodeL(model, EscapeUtils::EEscapeUrlEncoded ); |
|
1341 iWapPage.Append( *param_manf ); |
|
1342 delete param_manf; |
|
1343 |
|
1344 |
|
1345 //iWapPage.Append( phoneIdentity.iModel ); |
|
1346 |
|
1347 // Add symbian os version, for example: dType=NOKIAE60(Symbian 9.1) |
|
1348 LOGSTRING("Reading OS versions"); |
|
1349 TVersionBuf s60Version; |
|
1350 TVersionBuf symbianVersion; |
|
1351 TRAPD( err, TVersionStrings::GetUserAgentVersionsL( s60Version, symbianVersion ) ); |
|
1352 LOGSTRING2( "Error: %i", err ); |
|
1353 if( err == KErrNone ) |
|
1354 { |
|
1355 TBuf<KMaxVersionBufLength> symbian; |
|
1356 symbian.Copy( symbianVersion ); |
|
1357 iWapPage.Append( KParenthesisOpen ); |
|
1358 iWapPage.Append( KSymbianOs ); |
|
1359 iWapPage.Append( symbian ); |
|
1360 iWapPage.Append( KParenthesisClose ); |
|
1361 } |
|
1362 |
|
1363 |
|
1364 if( iSwVersion.Length() > 0 ) |
|
1365 { |
|
1366 iWapPage.Append( KParameterDelimeter ); |
|
1367 iWapPage.Append( KSW ); |
|
1368 HBufC16* param_swversion = EscapeUtils::EscapeEncodeL(iSwVersion, EscapeUtils::EEscapeUrlEncoded ); |
|
1369 iWapPage.Append( *param_swversion ); |
|
1370 delete param_swversion; |
|
1371 } |
|
1372 LOGTEXT(iSwVersion); |
|
1373 |
|
1374 // Product model |
|
1375 if( iProductModel.Length() > 0 ) |
|
1376 { |
|
1377 iWapPage.Append( KParameterDelimeter ); |
|
1378 iWapPage.Append( KHW ); |
|
1379 iWapPage.Append( iProductModel ); |
|
1380 } |
|
1381 } |
|
1382 |
|
1383 |
|
1384 // ----------------------------------------------------------------------------- |
|
1385 // CCMAppUI::LaunchMiniBrowserL() |
|
1386 // |
|
1387 // ----------------------------------------------------------------------------- |
|
1388 // |
|
1389 |
|
1390 void CCMAppUi::LaunchMiniBrowserL() |
|
1391 { |
|
1392 // create a mini browser for downloading provisioned settings |
|
1393 // from a supporting service |
|
1394 // mini browser has to be a member object as it has to exist |
|
1395 // during the async http request-response cycle |
|
1396 LOGSTRING2( "opening mini-browser, using AP: %i", iEngine->IapId() ); |
|
1397 if( !iMiniBrowser ) |
|
1398 { |
|
1399 RSocketServ& socketServ = iEngine->SocketServ(); |
|
1400 RConnection& connection = iEngine->Connection(); |
|
1401 iMiniBrowser = CMiniBrowser::NewL( *this, socketServ, connection ); |
|
1402 } |
|
1403 |
|
1404 LOGSTRING( "Calling HttpGetL" ); |
|
1405 if( iEngine->ProxyDefined() ) |
|
1406 { |
|
1407 iMiniBrowser->HttpGetL( iWapPage, iEngine->ProxyIp(), iEngine->ProxyPort() ); |
|
1408 } |
|
1409 else |
|
1410 { |
|
1411 iMiniBrowser->HttpGetL( iWapPage ); |
|
1412 } |
|
1413 } |
|
1414 |
|
1415 |
|
1416 |
|
1417 // ----------------------------------------------------------------------------- |
|
1418 // CCMAppUI::LaunchS60WebBrowser() |
|
1419 // |
|
1420 // ----------------------------------------------------------------------------- |
|
1421 // |
|
1422 void CCMAppUi::LaunchS60WebBrowserL() |
|
1423 { |
|
1424 LOGSTRING2( "opening browser, using AP: %i", iAccessPoint ); |
|
1425 iEngine->Disconnect(); |
|
1426 |
|
1427 // Append access point |
|
1428 |
|
1429 #if ( !defined (__WINS__) && !defined (__WINSCW) ) |
|
1430 iAccessPoint = iEngine->ReturnIAPID(); |
|
1431 iWapPage.Append( KSpace ); |
|
1432 iWapPage.AppendNumUC( iAccessPoint ); |
|
1433 #endif |
|
1434 |
|
1435 |
|
1436 |
|
1437 TApaTaskList taskList( CEikonEnv::Static()->WsSession() ); |
|
1438 TApaTask task = taskList.FindApp( KCRUidBrowser ); |
|
1439 |
|
1440 if ( task.Exists() ) |
|
1441 { |
|
1442 TBuf8<1024> wapPage; |
|
1443 wapPage.Copy( iWapPage.Left( 1024 ) ); |
|
1444 LOGSTRING( "OpenWapBrowserL sending message to Browser" ); |
|
1445 task.SendMessage( TUid::Uid( 0 ), wapPage ); // Uid is not used |
|
1446 } |
|
1447 else |
|
1448 { |
|
1449 LOGSTRING( "OpenWapBrowserL Launching Browser" ); |
|
1450 RApaLsSession appArcSession; |
|
1451 User::LeaveIfError( appArcSession.Connect() ); |
|
1452 CleanupClosePushL( appArcSession ); |
|
1453 TThreadId tid; |
|
1454 LOGSTRING( "before startDocument" ); |
|
1455 LOGTEXT(iWapPage); |
|
1456 |
|
1457 appArcSession.StartDocument( iWapPage, KCRUidBrowser, tid ); |
|
1458 LOGSTRING( "Document started" ); |
|
1459 CleanupStack::PopAndDestroy( &appArcSession ); |
|
1460 } |
|
1461 |
|
1462 // Browser was started, we are free to exit |
|
1463 iStartingBrowser = ETrue; |
|
1464 //DelayedExit(); |
|
1465 Exit(); |
|
1466 } |
|
1467 |
|
1468 |
|
1469 // ----------------------------------------------------------------------------- |
|
1470 // CCMAppUI::AppendWebUtilParamsL() |
|
1471 // |
|
1472 // ----------------------------------------------------------------------------- |
|
1473 // |
|
1474 |
|
1475 void CCMAppUi::AppendWebUtilParamsL() |
|
1476 { |
|
1477 // language |
|
1478 // HttpFilterCommonStringsExt::GetLanguageString is introduced in S60 2.6 |
|
1479 RStringPool stringPool; |
|
1480 LOGSTRING("open string pool"); |
|
1481 stringPool.OpenL( HttpFilterCommonStringsExt::GetLanguageTable() ); |
|
1482 CleanupClosePushL( stringPool ); |
|
1483 LOGSTRING("GetLanguageString"); |
|
1484 RStringF languageString = HttpFilterCommonStringsExt::GetLocaleLanguage( stringPool ); |
|
1485 CleanupClosePushL( languageString ); |
|
1486 LOGSTRING("GetLanguageString - done"); |
|
1487 LOGTEXT( languageString.DesC() ); |
|
1488 const TPtrC8& language = languageString.DesC(); |
|
1489 LOGSTRING("languageString.DesC - done"); |
|
1490 LOGTEXT( language ); |
|
1491 if( language.Length() ) |
|
1492 { |
|
1493 const TInt KMaxLanguageLength(5); |
|
1494 TBuf<KMaxLanguageLength> lang; |
|
1495 lang.Copy( language.Left( KMaxLanguageLength ) ); |
|
1496 iWapPage.Append( KParameterDelimeter ); |
|
1497 iWapPage.Append( KLanguageParameter ); |
|
1498 iWapPage.Append( lang ); |
|
1499 } |
|
1500 CleanupStack::PopAndDestroy(); // languageString.Close |
|
1501 CleanupStack::PopAndDestroy(); // stringPool.Close |
|
1502 |
|
1503 // User Agent profile |
|
1504 // Example value: "http://nds1.nds.nokia.com/uaprof/N6600r100.xml" |
|
1505 LOGSTRING( "uaProf" ); |
|
1506 // Assume 128 chars is big enough |
|
1507 TBuf<128> uaProf; |
|
1508 CRepository* cenRep = CRepository::NewL( KCRUidWebUtils ); |
|
1509 CleanupStack::PushL( cenRep ); |
|
1510 TInt err = cenRep->Get( KWebUtilsUaProf, uaProf ); |
|
1511 CleanupStack::PopAndDestroy( cenRep ); |
|
1512 LOGSTRING2( "cenRep->Get err: %i", err ); |
|
1513 LOGTEXT( uaProf ); |
|
1514 if( uaProf.Length() ) |
|
1515 { |
|
1516 HBufC16* param = EscapeUtils::EscapeEncodeL( uaProf, EscapeUtils::EEscapeUrlEncoded ); |
|
1517 LOGSTRING( "converted:" ); |
|
1518 LOGTEXT( *param ); |
|
1519 if( param ) |
|
1520 { |
|
1521 iWapPage.Append( KParameterDelimeter ); |
|
1522 iWapPage.Append( KUAProfParameter ); |
|
1523 iWapPage.Append( *param ); |
|
1524 delete param; |
|
1525 } |
|
1526 } |
|
1527 |
|
1528 } |
|
1529 |
|
1530 // ----------------------------------------------------------------------------- |
|
1531 // CCMAppUI::OnlineHelpL() |
|
1532 // |
|
1533 // ----------------------------------------------------------------------------- |
|
1534 // |
|
1535 |
|
1536 void CCMAppUi::OnlineHelpL() |
|
1537 { |
|
1538 // Interactive option (silent mode) |
|
1539 iWapPage.Append( KParameterDelimeter ); |
|
1540 iWapPage.Append( KInteractiveSessionParameter ); |
|
1541 if( iAutoStart ) |
|
1542 { |
|
1543 iWapPage.Append( KNonInteractiveSession ); |
|
1544 } |
|
1545 else |
|
1546 { |
|
1547 iWapPage.Append( KInteractiveSession ); |
|
1548 } |
|
1549 |
|
1550 #ifdef _DEBUG |
|
1551 for( TInt i(0); i < iWapPage.Length(); i += 128 ) |
|
1552 { |
|
1553 LOGTEXT( iWapPage.Right( iWapPage.Length() - i ) ); |
|
1554 } |
|
1555 #endif |
|
1556 |
|
1557 if( iAutoStart ) |
|
1558 { |
|
1559 LaunchMiniBrowserL(); |
|
1560 } |
|
1561 else |
|
1562 { |
|
1563 LaunchS60WebBrowserL(); |
|
1564 } |
|
1565 } |
|
1566 |
|
1567 // ----------------------------------------------------------------------------- |
|
1568 // CCMAppUI::MiniBrowserRequestDoneL |
|
1569 // Called after MiniBrowser has handled a request for an URL |
|
1570 // (a call to HttpGetL resulted a successful http request-response) |
|
1571 // ----------------------------------------------------------------------------- |
|
1572 // |
|
1573 void CCMAppUi::MiniBrowserRequestDoneL() |
|
1574 { |
|
1575 LOGSTRING( "CCMAppUi::MiniBrowserRequestDoneL" ); |
|
1576 |
|
1577 // Leaves from here propagate to MiniBrowserUnhandledLeave (which causes app exit) |
|
1578 |
|
1579 // Check we have not exceed the limit for maximum number of redirects |
|
1580 if( iRedirectsLeft <= 0 ) |
|
1581 { |
|
1582 User::Leave( KErrOverflow ); |
|
1583 } |
|
1584 |
|
1585 iRedirectsLeft--; |
|
1586 |
|
1587 // Leaves with KErrNotFound if there is no valid report URL |
|
1588 HBufC* reportUrl = iMiniBrowser->GetReportUrlLC(); |
|
1589 LOGSTRING( "Calling HttpGetL" ); |
|
1590 if( iEngine->ProxyDefined() ) |
|
1591 { |
|
1592 iMiniBrowser->HttpGetL( *reportUrl, iEngine->ProxyIp(), iEngine->ProxyPort() ); |
|
1593 } |
|
1594 else |
|
1595 { |
|
1596 iMiniBrowser->HttpGetL( *reportUrl ); |
|
1597 } |
|
1598 CleanupStack::PopAndDestroy( reportUrl ); |
|
1599 } |
|
1600 |
|
1601 |
|
1602 // ----------------------------------------------------------------------------- |
|
1603 // CCMAppUI::MiniBrowserErrorL |
|
1604 // ----------------------------------------------------------------------------- |
|
1605 // |
|
1606 void CCMAppUi::MiniBrowserErrorL( const TInt aError ) |
|
1607 { |
|
1608 LOGSTRING2( "CCMAppUi::MiniBrowserErrorL: %i", aError ); |
|
1609 |
|
1610 // If there is no valid report url the KErrNotFound from GetReportUrlLC |
|
1611 // propagates to MiniBrowserUnhandledLeave and causes an Exit |
|
1612 HBufC* reportUrl = iMiniBrowser->GetReportUrlLC(); |
|
1613 if( iEngine->ProxyDefined() ) |
|
1614 { |
|
1615 iMiniBrowser->HttpGetL( *reportUrl, iEngine->ProxyIp(), iEngine->ProxyPort() ); |
|
1616 } |
|
1617 else |
|
1618 { |
|
1619 iMiniBrowser->HttpGetL( *reportUrl ); |
|
1620 } |
|
1621 CleanupStack::PopAndDestroy( reportUrl ); |
|
1622 // Keep compiler happy |
|
1623 (void)aError; |
|
1624 } |
|
1625 |
|
1626 // ----------------------------------------------------------------------------- |
|
1627 // CCMAppUI::MiniBrowserErrorL |
|
1628 // Called if a call to MiniBrowserRequestDoneL or MiniBrowserErrorL leaves |
|
1629 // ----------------------------------------------------------------------------- |
|
1630 // |
|
1631 void CCMAppUi::MiniBrowserUnhandledLeave( const TInt aError ) |
|
1632 { |
|
1633 LOGSTRING2( "CCMAppUi::MiniBrowserUnhandledLeave: %i", aError ); |
|
1634 //DelayedExit(); |
|
1635 Exit(); |
|
1636 // Keep compiler happy |
|
1637 (void)aError; |
|
1638 } |
|
1639 |
|
1640 // ----------------------------------------------------------------------------- |
|
1641 // CCMAppUI::CheckDefaultAccessPointL() |
|
1642 // Checks defaul access point for the browser |
|
1643 // (other items were commented in a header). |
|
1644 // ----------------------------------------------------------------------------- |
|
1645 // |
|
1646 TUint32 CCMAppUi::CheckDefaultAccessPointL() |
|
1647 { |
|
1648 LOGSTRING( "CCMAppUi::CheckDefaultAccessPointL()" ); |
|
1649 TInt errorCode( KErrNone ) ; |
|
1650 TUint32 accessPoint; |
|
1651 TInt defaultAccessPoint( KErrNotFound ); |
|
1652 CCommsDatabase* theDb; |
|
1653 CCommsDbTableView* theView; |
|
1654 CCommsDbTableView* theDefaultRoamingView; |
|
1655 |
|
1656 TUint32 returnValue( 0 ); |
|
1657 TInt selectionMode = 0; |
|
1658 |
|
1659 CRepository* browserRepository = CRepository::NewLC( KCRUidBrowser ); |
|
1660 User::LeaveIfError( browserRepository->Get( KBrowserDefaultAccessPoint, defaultAccessPoint ) ); |
|
1661 |
|
1662 // Also check with Selection mode if selection mode is always ask then go for User Access |
|
1663 User::LeaveIfError(browserRepository->Get( KBrowserAccessPointSelectionMode, selectionMode )); |
|
1664 |
|
1665 CleanupStack::PopAndDestroy( browserRepository ); |
|
1666 |
|
1667 if(selectionMode == 1) |
|
1668 User::Leave(KErrNotSupported); |
|
1669 |
|
1670 |
|
1671 theDb = CCommsDatabase::NewL( ); |
|
1672 CleanupStack::PushL( theDb ); |
|
1673 |
|
1674 theView = theDb->OpenViewMatchingUintLC( TPtrC( WAP_IP_BEARER ), |
|
1675 TPtrC( WAP_ACCESS_POINT_ID ), |
|
1676 defaultAccessPoint ); |
|
1677 |
|
1678 User::LeaveIfError( theView->GotoFirstRecord() ); |
|
1679 |
|
1680 theView->ReadUintL( TPtrC( WAP_IAP ), accessPoint); |
|
1681 returnValue = accessPoint; |
|
1682 iAccessPoint = defaultAccessPoint; |
|
1683 |
|
1684 CleanupStack::PopAndDestroy( theView ); |
|
1685 |
|
1686 // check type |
|
1687 theView = theDb->OpenViewMatchingUintLC( TPtrC(IAP), |
|
1688 TPtrC(COMMDB_ID), |
|
1689 accessPoint ); |
|
1690 errorCode = theView->GotoFirstRecord(); |
|
1691 if ( errorCode == KErrNone ) |
|
1692 { |
|
1693 TUint32 bearerId; |
|
1694 theView->ReadUintL( TPtrC(IAP_BEARER), bearerId ); |
|
1695 CleanupStack::PopAndDestroy( theView ); |
|
1696 |
|
1697 theView = theDb->OpenViewMatchingUintLC( TPtrC(OUTGOING_GPRS), |
|
1698 TPtrC(COMMDB_ID), |
|
1699 bearerId ); |
|
1700 errorCode = theView->GotoFirstRecord(); |
|
1701 if ( errorCode == KErrNone ) |
|
1702 { |
|
1703 TUint32 apType; |
|
1704 theView->ReadUintL( TPtrC(GPRS_AP_TYPE), apType ); |
|
1705 CleanupStack::PopAndDestroy( theView ); |
|
1706 LOGSTRING2( "apType:%i", apType ); |
|
1707 } |
|
1708 else |
|
1709 { |
|
1710 LOGSTRING2( "error in opening OUTGOING_GPRS:%i", errorCode ); |
|
1711 CleanupStack::PopAndDestroy( theView ); |
|
1712 } |
|
1713 } |
|
1714 else |
|
1715 { |
|
1716 LOGSTRING2( "error in opening WAP_IAP:%i", errorCode ); |
|
1717 CleanupStack::PopAndDestroy( theView ); |
|
1718 } |
|
1719 // type check done |
|
1720 |
|
1721 if( iNetworkStatus == CCMRegistrationMonitor::ERoaming ) |
|
1722 { |
|
1723 // check the name for roaming support |
|
1724 CApAccessPointItem* apItem = CApAccessPointItem::NewLC(); |
|
1725 CApDataHandler* apDataHandler = CApDataHandler::NewLC( *theDb ); |
|
1726 apDataHandler->AccessPointDataL( defaultAccessPoint, *apItem ); |
|
1727 const HBufC* apName = apItem->ReadConstLongTextL( EApGprsAccessPointName ); |
|
1728 // ownership of apName stays in apItem, so no delete here for apName |
|
1729 LOGSTRING( "default apn:" ); |
|
1730 LOGTEXT( *apName ); |
|
1731 // check if it ends with ".gprs" == roaming safe |
|
1732 TBuf<10> dotGprs; |
|
1733 dotGprs.Append( KDot ); |
|
1734 dotGprs.Append( KGprs ); |
|
1735 TInt offset = apName->Find( dotGprs ); |
|
1736 TInt expectedOffset = apName->Length() - dotGprs.Length(); |
|
1737 if( offset != expectedOffset ) |
|
1738 { |
|
1739 // we need to use a roaming safe version of the ap |
|
1740 // check if allready have made it |
|
1741 LOGSTRING( "Checking for existing KDefaultRoamingName" ); |
|
1742 theDefaultRoamingView = theDb->OpenViewMatchingTextLC( TPtrC( WAP_ACCESS_POINT ), |
|
1743 TPtrC( COMMDB_NAME ), |
|
1744 KDefaultRoamingName ); |
|
1745 errorCode = theDefaultRoamingView->GotoFirstRecord(); |
|
1746 if( errorCode == KErrNone ) |
|
1747 { |
|
1748 LOGSTRING( "found, removing it" ); |
|
1749 TUint32 defaultRoamingId; |
|
1750 theDefaultRoamingView->ReadUintL( TPtrC(COMMDB_ID), defaultRoamingId); |
|
1751 LOGSTRING( "accesspoint id read done" ); |
|
1752 |
|
1753 apDataHandler->RemoveAPL( defaultRoamingId ); |
|
1754 } |
|
1755 |
|
1756 LOGSTRING( "create it" ); |
|
1757 CApAccessPointItem* newAp = CApAccessPointItem::NewLC(); |
|
1758 |
|
1759 newAp->CopyFromL( *apItem ); |
|
1760 |
|
1761 const RMobilePhone::TMobilePhoneSubscriberId& imsi = iRegistrationMonitor->GetImsi(); |
|
1762 TBuf<KMaxAPNLength> newName; |
|
1763 newName.Append( *apName ); |
|
1764 newName.Append( KDot ); |
|
1765 newName.Append( KMNC0 ); |
|
1766 newName.Append( imsi.Mid(3,2) ); |
|
1767 newName.Append( KDot ); |
|
1768 newName.Append( KMCC ); |
|
1769 newName.Append( imsi.Mid(0,3) ); |
|
1770 newName.Append( KDot ); |
|
1771 newName.Append( KGprs ); |
|
1772 newAp->SetNamesL( KDefaultRoamingName ); |
|
1773 newAp->WriteTextL( EApWapAccessPointName, KDefaultRoamingName ); |
|
1774 newAp->WriteLongTextL( EApGprsAccessPointName, newName ); |
|
1775 LOGSTRING( "calling update" ); |
|
1776 TInt retries = KRetryCount; |
|
1777 TRAPD( err, apDataHandler->CreateFromDataL(*newAp) ); |
|
1778 while( (err == KErrLocked) && retries-- ) |
|
1779 { |
|
1780 User::After( KRetryWait ); |
|
1781 TRAP( err, apDataHandler->CreateFromDataL(*newAp) ); |
|
1782 } |
|
1783 if( err != KErrNone ) |
|
1784 { |
|
1785 User::Leave( err ); |
|
1786 } |
|
1787 LOGSTRING( "calling update done" ); |
|
1788 |
|
1789 newAp->ReadUint( EApWapIap, returnValue ); |
|
1790 newAp->ReadUint( EApWapAccessPointID, iAccessPoint ); |
|
1791 |
|
1792 LOGSTRING( "update done" ); |
|
1793 CleanupStack::PopAndDestroy( newAp ); |
|
1794 CleanupStack::PopAndDestroy( theDefaultRoamingView ); |
|
1795 } |
|
1796 CleanupStack::PopAndDestroy( apDataHandler ); |
|
1797 CleanupStack::PopAndDestroy( apItem ); |
|
1798 } |
|
1799 CleanupStack::PopAndDestroy( theDb ); |
|
1800 |
|
1801 |
|
1802 LOGSTRING2( "Check default access point returns %i", returnValue ); |
|
1803 LOGSTRING2( "iAccessPoint %i", iAccessPoint ); |
|
1804 |
|
1805 return returnValue; |
|
1806 } |
|
1807 |
|
1808 // ----------------------------------------------------------------------------- |
|
1809 // CCMAppUI::InitAccessPointL() |
|
1810 // Cheks the id of accesspoint which APN is initAccess |
|
1811 // (other items were commented in a header). |
|
1812 // ----------------------------------------------------------------------------- |
|
1813 // |
|
1814 TUint32 CCMAppUi::InitAccessPointL() |
|
1815 { |
|
1816 LOGSTRING( "CCMAppUi::InitAccessPointL()" ); |
|
1817 if(iInitAccessOn) |
|
1818 { |
|
1819 CCommsDatabase* theDb; |
|
1820 |
|
1821 theDb = CCommsDatabase::NewL(); |
|
1822 CleanupStack::PushL( theDb ); |
|
1823 |
|
1824 TUint32 initAP( 0 ); |
|
1825 |
|
1826 TBool value( EFalse ); |
|
1827 TRAPD( err, value = CheckInitAccessPointL(*theDb, initAP) ); |
|
1828 |
|
1829 if( value == EFalse ) |
|
1830 { |
|
1831 CreateInitAccessPointL( *theDb ); |
|
1832 TRAP( err, CheckInitAccessPointL( *theDb, initAP ) ); |
|
1833 } |
|
1834 else |
|
1835 { |
|
1836 LOGSTRING( "Init AP was ok" ); |
|
1837 } |
|
1838 |
|
1839 |
|
1840 CleanupStack::PopAndDestroy( theDb ); |
|
1841 |
|
1842 return( initAP ); |
|
1843 } |
|
1844 else |
|
1845 { |
|
1846 LOGSTRING( "CCMAppUi::InitAccessPointL Init Access feature off" ); |
|
1847 return KErrNone; |
|
1848 } |
|
1849 } |
|
1850 |
|
1851 // ----------------------------------------------------------------------------- |
|
1852 // CCMAppUI::CheckInitAccessPointL() |
|
1853 // Cheks the settings of accesspoint which APN is initAccess |
|
1854 // (other items were commented in a header). |
|
1855 // ----------------------------------------------------------------------------- |
|
1856 // |
|
1857 TBool CCMAppUi::CheckInitAccessPointL( CCommsDatabase& aDb, TUint32& aAccessPoint ) |
|
1858 { |
|
1859 LOGSTRING( "CCMAppUi::CheckInitAccessPointL" ); |
|
1860 if(iInitAccessOn) |
|
1861 { |
|
1862 CCommsDbTableView* theView; |
|
1863 CCommsDbTableView* iapView; |
|
1864 CCommsDbTableView* wapIpBearerView; |
|
1865 TInt errorCode; |
|
1866 TBool firstTime = ETrue; // crude solution |
|
1867 TUint32 tableId; |
|
1868 |
|
1869 TBuf<KMaxAPNLength> initAccess; |
|
1870 initAccess.Append( KInitAccess ); |
|
1871 |
|
1872 const RMobilePhone::TMobilePhoneSubscriberId& imsi = iRegistrationMonitor->GetImsi(); |
|
1873 if( iNetworkStatus == CCMRegistrationMonitor::ERoaming ) |
|
1874 { |
|
1875 initAccess.Append( KDot ); |
|
1876 initAccess.Append( KMNC0 ); |
|
1877 initAccess.Append( imsi.Mid(3,2) ); |
|
1878 initAccess.Append( KDot ); |
|
1879 initAccess.Append( KMCC ); |
|
1880 initAccess.Append( imsi.Mid(0,3) ); |
|
1881 initAccess.Append( KDot ); |
|
1882 initAccess.Append( KGprs ); |
|
1883 } |
|
1884 |
|
1885 theView = aDb.OpenViewMatchingTextLC( TPtrC( OUTGOING_GPRS), |
|
1886 TPtrC( GPRS_APN ), |
|
1887 initAccess ); |
|
1888 errorCode = theView->GotoFirstRecord(); |
|
1889 |
|
1890 FOREVER // will exit when no more records found or the first one not found or a valid found |
|
1891 { |
|
1892 if( !firstTime ) |
|
1893 { |
|
1894 LOGSTRING( "trying to get next record" ); |
|
1895 errorCode = theView->GotoNextRecord(); |
|
1896 if( errorCode != KErrNone ) |
|
1897 { |
|
1898 CleanupStack::PopAndDestroy( theView ); |
|
1899 return( EFalse ); |
|
1900 } |
|
1901 LOGSTRING( "checking next record" ); |
|
1902 } |
|
1903 firstTime = EFalse; |
|
1904 |
|
1905 if ( errorCode == KErrNone ) |
|
1906 { |
|
1907 theView->ReadUintL( TPtrC( COMMDB_ID ), tableId ); |
|
1908 iapView = aDb.OpenViewMatchingUintLC(TPtrC( IAP ), |
|
1909 TPtrC( IAP_SERVICE ), |
|
1910 tableId ); |
|
1911 errorCode = iapView->GotoFirstRecord(); |
|
1912 |
|
1913 if ( errorCode == KErrNone ) |
|
1914 { |
|
1915 iapView->ReadUintL( TPtrC( COMMDB_ID ), aAccessPoint ); |
|
1916 wapIpBearerView = aDb.OpenViewMatchingUintLC(TPtrC( WAP_IP_BEARER ), |
|
1917 TPtrC( WAP_IAP ), |
|
1918 aAccessPoint ); |
|
1919 errorCode = wapIpBearerView->GotoFirstRecord(); |
|
1920 if ( errorCode == KErrNone ) |
|
1921 { |
|
1922 wapIpBearerView->ReadUintL( TPtrC( WAP_ACCESS_POINT_ID ), iAccessPoint ); |
|
1923 } |
|
1924 else |
|
1925 { |
|
1926 LOGSTRING( "wapIpBearerView->GotoFirstRecord()" ); |
|
1927 CleanupStack::PopAndDestroy( wapIpBearerView ); // wapIpBearerView |
|
1928 CleanupStack::PopAndDestroy( iapView ); // iapView |
|
1929 continue; |
|
1930 } |
|
1931 CleanupStack::PopAndDestroy(); // wapIpBearerView |
|
1932 } |
|
1933 else |
|
1934 { |
|
1935 LOGSTRING( "iapView->GotoFirstRecord() failed" ); |
|
1936 CleanupStack::PopAndDestroy( iapView ); // iapView |
|
1937 continue; |
|
1938 } |
|
1939 |
|
1940 CleanupStack::PopAndDestroy( iapView ); // iapView |
|
1941 } |
|
1942 else |
|
1943 { |
|
1944 LOGSTRING( "theView->GotoFirstRecord() failed" ); |
|
1945 CleanupStack::PopAndDestroy( theView ); |
|
1946 return( EFalse ); |
|
1947 } |
|
1948 |
|
1949 if( iServer == KDefaultServerString ) |
|
1950 { |
|
1951 LOGSTRING( "checking that init access not modified" ); |
|
1952 // check also user name, prompt password, password, authentication, homepage |
|
1953 TBuf8<100> userName; |
|
1954 theView->ReadTextL( TPtrC(GPRS_IF_AUTH_NAME), userName ); |
|
1955 if( userName.Length() != 0 ) |
|
1956 { |
|
1957 LOGSTRING( "username length was not 0" ); |
|
1958 continue; |
|
1959 } |
|
1960 TBool promptPasswd; |
|
1961 theView->ReadBoolL( TPtrC(GPRS_IF_PROMPT_FOR_AUTH), promptPasswd ); |
|
1962 if( promptPasswd != EFalse ) |
|
1963 { |
|
1964 LOGSTRING( "promptPasswd was not EFalse" ); |
|
1965 continue; |
|
1966 } |
|
1967 TBuf8<100> passwd; |
|
1968 theView->ReadTextL( TPtrC(GPRS_IF_AUTH_PASS), passwd ); |
|
1969 if( passwd.Length() != 0 ) |
|
1970 { |
|
1971 LOGSTRING( "passwd length was not 0" ); |
|
1972 continue; |
|
1973 } |
|
1974 LOGSTRING( "init access not modified" ); |
|
1975 } |
|
1976 |
|
1977 CleanupStack::PopAndDestroy( theView ); |
|
1978 return( ETrue ); |
|
1979 } |
|
1980 } |
|
1981 else |
|
1982 { |
|
1983 LOGSTRING( "CCMAppUi::CheckInitAccessPointL Init Access feature off" ); |
|
1984 return EFalse; |
|
1985 } |
|
1986 } |
|
1987 |
|
1988 // ----------------------------------------------------------------------------- |
|
1989 // CCMAppUI::CreateInitAccessPointL( CCommsDatabase& aDb ) |
|
1990 // Creates the Init Access point to comms db |
|
1991 // ----------------------------------------------------------------------------- |
|
1992 // |
|
1993 TUint32 CCMAppUi::CreateInitAccessPointL( CCommsDatabase& aDb ) |
|
1994 { |
|
1995 if(iInitAccessOn) |
|
1996 { |
|
1997 CApDataHandler* apDataHandler = CApDataHandler::NewLC( aDb ); |
|
1998 CApAccessPointItem* apItem = CApAccessPointItem::NewLC(); |
|
1999 |
|
2000 TBuf<KMaxAPNLength> initAccess; |
|
2001 initAccess.Append( KInitAccess ); |
|
2002 |
|
2003 if( iNetworkStatus == CCMRegistrationMonitor::ERoaming ) |
|
2004 { |
|
2005 const RMobilePhone::TMobilePhoneSubscriberId& imsi = iRegistrationMonitor->GetImsi(); |
|
2006 initAccess.Append( KDot ); |
|
2007 initAccess.Append( KMNC0 ); |
|
2008 initAccess.Append( imsi.Mid(3,2) ); |
|
2009 initAccess.Append( KDot ); |
|
2010 initAccess.Append( KMCC ); |
|
2011 initAccess.Append( imsi.Mid(0,3) ); |
|
2012 initAccess.Append( KDot ); |
|
2013 initAccess.Append( KGprs ); |
|
2014 } |
|
2015 |
|
2016 if( iNetworkStatus == CCMRegistrationMonitor::ERoaming ) |
|
2017 { |
|
2018 apItem->SetNamesL( KInitAccessRoamingName ); |
|
2019 } |
|
2020 else |
|
2021 { |
|
2022 apItem->SetNamesL( KInitAccess ); |
|
2023 } |
|
2024 |
|
2025 apItem->WriteLongTextL( EApGprsAccessPointName, initAccess ); |
|
2026 |
|
2027 LOGSTRING( "CreateInitAccessPointL, setting bearer type" ); |
|
2028 apItem->SetBearerTypeL( EApBearerTypeGPRS ); |
|
2029 LOGSTRING( "CreateInitAccessPointL, setting isp type type" ); |
|
2030 apItem->WriteUint( EApIspIspType, EIspTypeInternetOnly ); |
|
2031 LOGSTRING( "CreateInitAccessPointL, creating" ); |
|
2032 apDataHandler->CreateFromDataL( *apItem ); |
|
2033 |
|
2034 CleanupStack::PopAndDestroy( apItem ); |
|
2035 CleanupStack::PopAndDestroy( apDataHandler ); |
|
2036 |
|
2037 return apItem->WapUid(); |
|
2038 } |
|
2039 else |
|
2040 { |
|
2041 LOGSTRING( "CCMAppUi::CreateInitAccessPointL Init Access feature off" ); |
|
2042 return KErrNone; |
|
2043 } |
|
2044 } |
|
2045 |
|
2046 // ----------------------------------------------------------------------------- |
|
2047 // CCMAppUI::ReadAccessPointFromPreferencesL() |
|
2048 // Reads the accesspoint value from Connection preferences table |
|
2049 // (other items were commented in a header). |
|
2050 // ----------------------------------------------------------------------------- |
|
2051 // |
|
2052 TInt CCMAppUi::ReadAccessPointFromPreferencesL() |
|
2053 { |
|
2054 LOGSTRING( "CCMAppUi::ReadAccessPointFromPreferencesL()" ); |
|
2055 TInt errorCode( KErrGeneral ); |
|
2056 TInt returnValue; |
|
2057 CCommsDatabase* theDb; |
|
2058 CCommsDbConnectionPrefTableView* thePrefView; |
|
2059 CCommsDbTableView* theView; |
|
2060 CCommsDbConnectionPrefTableView::TCommDbIapConnectionPref pref; |
|
2061 CCommsDbConnectionPrefTableView::TCommDbIapBearer bearer; |
|
2062 |
|
2063 theDb = CCommsDatabase::NewL( ); |
|
2064 CleanupStack::PushL( theDb ); |
|
2065 thePrefView = theDb-> |
|
2066 OpenConnectionPrefTableViewOnRankLC( ECommDbConnectionDirectionOutgoing, TUint( 1 )); |
|
2067 returnValue = thePrefView -> GotoFirstRecord(); |
|
2068 if ( returnValue == KErrNone ) |
|
2069 { |
|
2070 thePrefView->ReadConnectionPreferenceL( pref ); |
|
2071 bearer = pref.iBearer; |
|
2072 LOGSTRING2("ReadAccessPointFromPreferencesL: iap %i", bearer.iIapId ); |
|
2073 |
|
2074 theView = theDb->OpenViewMatchingUintLC( TPtrC( WAP_IP_BEARER ), |
|
2075 TPtrC( WAP_IAP ), |
|
2076 bearer.iIapId ); |
|
2077 errorCode = theView->GotoFirstRecord(); |
|
2078 if ( errorCode == KErrNone ) |
|
2079 { |
|
2080 theView->ReadUintL( TPtrC( WAP_ACCESS_POINT_ID ), iAccessPoint ); |
|
2081 } |
|
2082 |
|
2083 CleanupStack::PopAndDestroy( theView ); |
|
2084 CleanupStack::PopAndDestroy( thePrefView ); |
|
2085 CleanupStack::PopAndDestroy( theDb ); |
|
2086 } |
|
2087 |
|
2088 return returnValue; |
|
2089 } |
|
2090 |
|
2091 // ----------------------------------------------------------------------------- |
|
2092 // CCMAppUI::CheckIniFileSettings |
|
2093 // cheks what kind of information exsist in configuration managers ini file |
|
2094 // (other items were commented in a header). |
|
2095 // ----------------------------------------------------------------------------- |
|
2096 // |
|
2097 void CCMAppUi::CheckIniFileSettingsL() |
|
2098 { |
|
2099 LOGSTRING( "CCMAppUi::CheckIniFileSettingsL()" ); |
|
2100 TInt roaming(0); |
|
2101 |
|
2102 TInt errorCodeRoaming = GetIntValue( KOnlineSupportRoaming, roaming ); |
|
2103 LOGSTRING2("Errorcode roaming %i", errorCodeRoaming ); |
|
2104 |
|
2105 if ( errorCodeRoaming == KErrNone ) |
|
2106 { |
|
2107 iFirstStartInHomeNetwork = ETrue; |
|
2108 } |
|
2109 } |
|
2110 |
|
2111 |
|
2112 TInt CCMAppUi::StoreIntValue( const TUint32 aCrKey, const TInt aValue ) |
|
2113 { |
|
2114 return iRepository->Set( aCrKey, aValue ); |
|
2115 } |
|
2116 |
|
2117 TInt CCMAppUi::StoreStringValue( const TUint32 aCrKey, const TDesC& aValue ) |
|
2118 { |
|
2119 return iRepository->Set( aCrKey, aValue ); |
|
2120 } |
|
2121 |
|
2122 TInt CCMAppUi::GetIntValue( const TUint32 aCrKey, TInt& aValue ) |
|
2123 { |
|
2124 return iRepository->Get( aCrKey, aValue ); |
|
2125 } |
|
2126 |
|
2127 TInt CCMAppUi::GetStringValue( const TUint32 aCrKey, TDes& aValue ) |
|
2128 { |
|
2129 return iRepository->Get( aCrKey, aValue ); |
|
2130 } |
|
2131 |
|
2132 |
|
2133 // ----------------------------------------------------------------------------- |
|
2134 // CCMAppUI::ShowWaitDialogL |
|
2135 // Shows wait note |
|
2136 // (other items were commented in a header). |
|
2137 // ----------------------------------------------------------------------------- |
|
2138 // |
|
2139 void CCMAppUi::ShowWaitDialogL() |
|
2140 { |
|
2141 LOGSTRING( "Enter to CCMAppUi::ShowWaitDialogL"); |
|
2142 if( !iAutoStart ) |
|
2143 { |
|
2144 HBufC* msgText = CEikonEnv::Static()-> |
|
2145 AllocReadResourceLC( R_CONFMANAGER_WAITNOTE ); |
|
2146 |
|
2147 if (iCommonDialogMonitor) |
|
2148 { |
|
2149 iCommonDialogMonitor->Cancel(); |
|
2150 delete iCommonDialogMonitor; |
|
2151 iCommonDialogMonitor = NULL; |
|
2152 } |
|
2153 // instantiate the active object CGlobalConfirmationObserver |
|
2154 iCommonDialogMonitor = CCMDialogMonitor::NewL( *this ); |
|
2155 |
|
2156 iCommonDialogMonitor->SetDialogMode(CCMDialogMonitor::EWait); |
|
2157 // SetActive |
|
2158 iCommonDialogMonitor->Start(); |
|
2159 |
|
2160 if (!iGlobalWaitNote) |
|
2161 { |
|
2162 iGlobalWaitNote = CAknGlobalNote::NewL(); |
|
2163 } |
|
2164 |
|
2165 iWaitNoteId = iGlobalWaitNote->ShowNoteL( |
|
2166 iCommonDialogMonitor->iStatus, |
|
2167 EAknGlobalWaitNote, |
|
2168 *msgText ); |
|
2169 |
|
2170 CleanupStack::PopAndDestroy( msgText ); |
|
2171 } |
|
2172 LOGSTRING( "Exit from ShowWaitDialogL" ); |
|
2173 } |
|
2174 |
|
2175 // ----------------------------------------------------------------------------- |
|
2176 // CCMAppUI::StartUpOperationL() |
|
2177 // Shows wait note |
|
2178 // (other items were commented in a header). |
|
2179 // ----------------------------------------------------------------------------- |
|
2180 // |
|
2181 void CCMAppUi::StartUpOperationL() |
|
2182 { |
|
2183 LOGSTRING( "CCMAppUi::StartUpOperationL" ); |
|
2184 CheckIniFileSettingsL(); |
|
2185 |
|
2186 iApplicationStatus = EAppStatusMonitoring; |
|
2187 iRegistrationMonitor->StartMonitoring(); |
|
2188 |
|
2189 // Start time-out timer |
|
2190 StartTimeOut( KMonitoringTimeOut ); |
|
2191 LOGSTRING( "Monitoring started" ); |
|
2192 } |
|
2193 |
|
2194 // ----------------------------------------------------------------------------- |
|
2195 // CCMAppUi::SetServerString() |
|
2196 // Sets server string |
|
2197 // (other items were commented in a header). |
|
2198 // ----------------------------------------------------------------------------- |
|
2199 // |
|
2200 void CCMAppUi::SetServerString(const TDesC& aServer) |
|
2201 { |
|
2202 if (aServer.Length()>KMaxServerString) |
|
2203 { |
|
2204 iServer.Copy( TPtrC( aServer.Left( KMaxServerString ) ) ); |
|
2205 } |
|
2206 else |
|
2207 { |
|
2208 iServer.Copy( TPtrC( aServer ) ); |
|
2209 } |
|
2210 LOGTEXT (iServer); |
|
2211 } |
|
2212 |
|
2213 // ----------------------------------------------------------------------------- |
|
2214 // CCMAppUi::SetPageString() |
|
2215 // Sets page string |
|
2216 // (other items were commented in a header). |
|
2217 // ----------------------------------------------------------------------------- |
|
2218 // |
|
2219 void CCMAppUi::SetPageString(const TDesC& aPage) |
|
2220 { |
|
2221 if (aPage.Length() > KMaxPageString) |
|
2222 { |
|
2223 iPage = TPtrC( aPage.Left( KMaxPageString ) ); |
|
2224 } |
|
2225 else |
|
2226 { |
|
2227 iPage = TPtrC( aPage ); |
|
2228 } |
|
2229 LOGTEXT (iPage); |
|
2230 } |
|
2231 |
|
2232 // ----------------------------------------------------------------------------- |
|
2233 // CCMAppUi::SetConnectReason() |
|
2234 // Sets connect reason |
|
2235 // (other items were commented in a header). |
|
2236 // ----------------------------------------------------------------------------- |
|
2237 // |
|
2238 void CCMAppUi::SetConnectReason(TConnectReason aReason) |
|
2239 { |
|
2240 iConnectReason = aReason; |
|
2241 } |
|
2242 |
|
2243 // ----------------------------------------------------------------------------- |
|
2244 // CCMAppUi::SetQueryString() |
|
2245 // Sets query string |
|
2246 // (other items were commented in a header). |
|
2247 // ----------------------------------------------------------------------------- |
|
2248 // |
|
2249 void CCMAppUi::SetQueryString(const TDesC& aQuery) |
|
2250 { |
|
2251 if ( aQuery.Length() > KMaxQueryString ) |
|
2252 { |
|
2253 iQuery = TPtrC( aQuery.Left( KMaxQueryString ) ); |
|
2254 } |
|
2255 else |
|
2256 { |
|
2257 iQuery = TPtrC( aQuery ); |
|
2258 } |
|
2259 LOGTEXT (iQuery); |
|
2260 } |
|
2261 |
|
2262 // ----------------------------------------------------------------------------- |
|
2263 // CCMAppUI::ConnectionResultL |
|
2264 // ----------------------------------------------------------------------------- |
|
2265 // |
|
2266 void CCMAppUi::ConnectionResultL( const TInt aErrorCode ) |
|
2267 { |
|
2268 if( iApplicationStatus == EAppStatusClosing ) |
|
2269 { |
|
2270 return; |
|
2271 } |
|
2272 |
|
2273 if( iTimer->IsActive() ) |
|
2274 { |
|
2275 iTimer->Cancel(); |
|
2276 } |
|
2277 |
|
2278 iApplicationStatus = EAppStatusInactive; |
|
2279 |
|
2280 LOGSTRING( "CCMAppUi::ConnectionResultL" ); |
|
2281 LOGSTRING2( "iConnectingVia:%i", iConnectingVia ); |
|
2282 LOGSTRING2( "aErrrorCode:%i", aErrorCode ); |
|
2283 |
|
2284 |
|
2285 if( iConnectingVia == EConnectingViaUser ) // this was the last access point to test |
|
2286 { |
|
2287 if( aErrorCode != KErrNone ) |
|
2288 { |
|
2289 LOGSTRING( "ErrorNoteConnectionL" ); |
|
2290 ErrorNoteConnectionL(); |
|
2291 LOGSTRING( "RestoreSettings done" ); |
|
2292 //DelayedExit(); |
|
2293 Exit(); |
|
2294 return; |
|
2295 } |
|
2296 else |
|
2297 { |
|
2298 ReadAccessPointFromPreferencesL(); |
|
2299 } |
|
2300 } |
|
2301 |
|
2302 if( aErrorCode == KErrNone ) |
|
2303 { |
|
2304 if( iGlobalWaitNote ) |
|
2305 { |
|
2306 iGlobalWaitNote->CancelNoteL(iWaitNoteId); |
|
2307 delete iGlobalWaitNote; |
|
2308 iGlobalWaitNote = NULL; |
|
2309 } |
|
2310 /* |
|
2311 if( iConnectReason == CCMAppUi::EConnectReasonFirstBoot ) |
|
2312 { |
|
2313 TApaTaskList taskList( CEikonEnv::Static()->WsSession() ); |
|
2314 TApaTask task = taskList.FindApp( KUidConfigurationManager ); |
|
2315 if( iWaitDialog && !iWaitDialogProcessFinished ) |
|
2316 { |
|
2317 LOGSTRING("iWaitDialog->ProcessFinishedL()"); |
|
2318 iWaitDialogProcessFinished = ETrue; |
|
2319 iWaitDialog->ProcessFinishedL(); |
|
2320 } |
|
2321 |
|
2322 |
|
2323 task.BringToForeground(); |
|
2324 } |
|
2325 |
|
2326 // this test succeeded, open the browser |
|
2327 LOGSTRING( "Test succeeded, closing waitdialog" ) |
|
2328 if( iWaitDialog && !iWaitDialogProcessFinished ) |
|
2329 { |
|
2330 LOGSTRING("iWaitDialog->ProcessFinishedL()"); |
|
2331 iWaitDialogProcessFinished = ETrue; |
|
2332 iWaitDialog->ProcessFinishedL(); |
|
2333 }*/ |
|
2334 OpenWapBrowserL(); |
|
2335 } |
|
2336 else |
|
2337 { |
|
2338 // failed, continue to next test |
|
2339 iEngine->Disconnect(); |
|
2340 InitiateNextConnectionTestL(); |
|
2341 LOGSTRING( "InitiateNextConnectionTestL done" ); |
|
2342 } |
|
2343 } |
|
2344 |
|
2345 // ----------------------------------------------------------------------------- |
|
2346 // CCMAppUI::UnhandledLeave |
|
2347 // |
|
2348 // (other items were commented in a header). |
|
2349 // ----------------------------------------------------------------------------- |
|
2350 // |
|
2351 void CCMAppUi::UnhandledLeave( TInt aErrorCode ) |
|
2352 { |
|
2353 LOGSTRING2( "CCMAppUi::UnhandledLeave: %i", aErrorCode ); |
|
2354 |
|
2355 TRAP_IGNORE( ErrorNoteUnknownL( aErrorCode ) ); |
|
2356 //DelayedExit(); |
|
2357 Exit(); |
|
2358 } |
|
2359 |
|
2360 // ----------------------------------------------------------------------------- |
|
2361 // CCMAppUI::StatusChanged |
|
2362 // |
|
2363 // (other items were commented in a header). |
|
2364 // ----------------------------------------------------------------------------- |
|
2365 // |
|
2366 void CCMAppUi::RegistrationMonitoringDoneL( CCMRegistrationMonitor::TNetworkStatus aNetworkStatus ) |
|
2367 { |
|
2368 LOGSTRING2( "CCMAppUi::RegistrationMonitoringDoneL %i", aNetworkStatus ); |
|
2369 |
|
2370 iNetworkStatus = aNetworkStatus; |
|
2371 |
|
2372 switch( aNetworkStatus ) |
|
2373 { |
|
2374 case CCMRegistrationMonitor::EStatusUnknown: |
|
2375 case CCMRegistrationMonitor::ERequestCancelled: |
|
2376 case CCMRegistrationMonitor::ERoaming: |
|
2377 case CCMRegistrationMonitor::EHomenetwork: |
|
2378 { |
|
2379 iNetworkStatusOk = ETrue; |
|
2380 if( iApplicationStatus == EAppStatusClosing ) |
|
2381 { |
|
2382 return; |
|
2383 } |
|
2384 if( iTimer->IsActive() ) |
|
2385 { |
|
2386 iTimer->Cancel(); |
|
2387 } |
|
2388 iRegistrationMonitor->StopMonitoring(); |
|
2389 break; |
|
2390 } |
|
2391 default: |
|
2392 break; |
|
2393 }; |
|
2394 LOGSTRING( "Status changed" ); |
|
2395 InitiateNextConnectionTestL(); |
|
2396 } |
|
2397 |
|
2398 // ----------------------------------------------------------------------------- |
|
2399 // CCMAppUI::RegistrationReportErrorL |
|
2400 // |
|
2401 // (other items were commented in a header). |
|
2402 // ----------------------------------------------------------------------------- |
|
2403 // |
|
2404 void CCMAppUi::RegistrationReportErrorL( const CCMRegistrationMonitor::TMonitoringStatus aStatus, const TInt aError ) |
|
2405 { |
|
2406 LOGSTRING( "CCMAppUi::RegistrationReportErrorL " ); |
|
2407 LOGSTRING2( "Registration monitor failed: %i", aStatus ); |
|
2408 LOGSTRING2( "error: %i", aError ); |
|
2409 LOGSTRING2( "iApplicationStatus: %i", iApplicationStatus ); |
|
2410 |
|
2411 if( iApplicationStatus != EAppStatusClosing ) |
|
2412 { |
|
2413 iApplicationStatus = EAppStatusInactive; |
|
2414 if( aError == KErrCancel ) |
|
2415 { |
|
2416 //ErrorNoteNetworkL(); |
|
2417 ErrorNoteConnectionL(); |
|
2418 } |
|
2419 else |
|
2420 { |
|
2421 ErrorNoteUnknownL(aError); |
|
2422 } |
|
2423 //DelayedExit(); |
|
2424 Exit(); |
|
2425 } |
|
2426 // Keep compiler happy |
|
2427 (void)aStatus; |
|
2428 } |
|
2429 |
|
2430 // ----------------------------------------------------------------------------- |
|
2431 // CCMAppUI::DynInitMenuPaneL |
|
2432 // Takes care of menu handling. |
|
2433 // (other items were commented in a header). |
|
2434 // ----------------------------------------------------------------------------- |
|
2435 // |
|
2436 void CCMAppUi::DynInitMenuPaneL( |
|
2437 TInt /*aResourceId*/, |
|
2438 CEikMenuPane* /*aMenuPane*/ |
|
2439 ) |
|
2440 { |
|
2441 } |
|
2442 |
|
2443 // ----------------------------------------------------------------------------- |
|
2444 // CCMAppUI::HandleCommandL |
|
2445 // Handles commands |
|
2446 // (other items were commented in a header). |
|
2447 // ----------------------------------------------------------------------------- |
|
2448 // |
|
2449 void CCMAppUi::HandleCommandL( TInt /*aCommand*/ ) |
|
2450 { |
|
2451 } |
|
2452 |
|
2453 // ----------------------------------------------------------------------------- |
|
2454 // CCMAppUI::HandleKeyEventL |
|
2455 // Handles key events |
|
2456 // (other items were commented in a header). |
|
2457 // ----------------------------------------------------------------------------- |
|
2458 // |
|
2459 TKeyResponse CCMAppUi::HandleKeyEventL( |
|
2460 const TKeyEvent& /*aKeyEvent*/, // aKeyEvent Event to handled. |
|
2461 TEventCode /*aType*/) // aType Type of the key event. |
|
2462 { |
|
2463 return EKeyWasNotConsumed; |
|
2464 } |
|
2465 |
|
2466 |
|
2467 // ----------------------------------------------------------------------------- |
|
2468 // CCMAppUI::WaitDialogDismissedL |
|
2469 // Handles key events |
|
2470 // (other items were commented in a header). |
|
2471 // ----------------------------------------------------------------------------- |
|
2472 // |
|
2473 void CCMAppUi::WaitDialogDismissedL( TInt aButtonId ) |
|
2474 { |
|
2475 LOGSTRING2( "CCMAppUi::WaitDialogDismissedL %i", aButtonId ); |
|
2476 LOGSTRING2( "iApplicationStatus %i", iApplicationStatus ); |
|
2477 |
|
2478 if( iApplicationStatus == EAppStatusClosing ) |
|
2479 { |
|
2480 LOGSTRING("Already closing"); |
|
2481 return; |
|
2482 } |
|
2483 |
|
2484 if( iTimer->IsActive() ) |
|
2485 { |
|
2486 iTimer->Cancel(); |
|
2487 } |
|
2488 |
|
2489 if( aButtonId == EAknSoftkeyCancel /*EConfmSoftkeyCancel*/ |
|
2490 || aButtonId == EAknSoftkeyExit ) |
|
2491 { |
|
2492 // User pressed Cancel to iWaitDialog |
|
2493 LOGSTRING("EConfmSoftkeyCancel"); |
|
2494 |
|
2495 // iWaitDialog is already being destroyed, do not destroy again |
|
2496 //iWaitDialogProcessFinished = ETrue; |
|
2497 |
|
2498 iEngine->Disconnect(); |
|
2499 //DelayedExit(); |
|
2500 Exit(); |
|
2501 return; |
|
2502 } |
|
2503 |
|
2504 if ( iApplicationStatus == EAppStatusMonitoring ) |
|
2505 { |
|
2506 LOGSTRING("EAppStatusMonitoring"); |
|
2507 //DelayedExit(); |
|
2508 Exit(); |
|
2509 } |
|
2510 else if ( iApplicationStatus == EAppStatusConnecting ) |
|
2511 { |
|
2512 LOGSTRING("EAppStatusConnecting"); |
|
2513 iEngine->Disconnect(); |
|
2514 //DelayedExit(); |
|
2515 Exit(); |
|
2516 } |
|
2517 } |
|
2518 |
|
2519 // ----------------------------------------------------------------------------- |
|
2520 // CCMAppUI::HandleGainingForeground |
|
2521 // |
|
2522 // (other items were commented in a header). |
|
2523 // ----------------------------------------------------------------------------- |
|
2524 // |
|
2525 void CCMAppUi::HandleGainingForeground() |
|
2526 { |
|
2527 LOGSTRING( "CCMAppUi::HandleGainingForeground" ); |
|
2528 #ifndef _DEBUG // if urel -> hide application in silent mode |
|
2529 if( iAutoStart ) |
|
2530 { |
|
2531 // prevent user from switching to ServiceHelp application |
|
2532 // when using silent mode by always sending ServiceHelp to background |
|
2533 TApaTaskList taskList( CEikonEnv::Static()->WsSession() ); |
|
2534 TApaTask task = taskList.FindApp( KUidConfigurationManager ); |
|
2535 if( task.Exists() ) |
|
2536 { |
|
2537 task.SendToBackground(); |
|
2538 } |
|
2539 } |
|
2540 #endif |
|
2541 } |
|
2542 |
|
2543 // ----------------------------------------------------------------------------- |
|
2544 // CCMAppUI::HandleLosingForeground |
|
2545 // |
|
2546 // (other items were commented in a header). |
|
2547 // ----------------------------------------------------------------------------- |
|
2548 // |
|
2549 void CCMAppUi::HandleLosingForeground() |
|
2550 { |
|
2551 LOGSTRING( "CCMAppUi::HandleLosingForeground" ); |
|
2552 } |
|
2553 |
|
2554 void CCMAppUi::CommonDialogDismissedL( const CCMDialogMonitor::TDialogMode aDialog, const TInt aStatusCode ) |
|
2555 { |
|
2556 LOGSTRING( "CCMAppUi::CommonDialogDismissedL" ); |
|
2557 if( aDialog == CCMDialogMonitor::EConfirmation ) |
|
2558 { |
|
2559 if( aStatusCode == EAknSoftkeyYes ) |
|
2560 { |
|
2561 StartTimeOut( KStartUpTimeOut ); |
|
2562 ShowWaitDialogL(); |
|
2563 } |
|
2564 else |
|
2565 { |
|
2566 Exit(); |
|
2567 } |
|
2568 } |
|
2569 else if ( aDialog == CCMDialogMonitor::EWait ) |
|
2570 { |
|
2571 // cancel |
|
2572 WaitDialogDismissedL( aStatusCode ); |
|
2573 } |
|
2574 } |
|
2575 |
|
2576 |
|
2577 // ----------------------------------------------------------------------------- |
|
2578 // CCMAppUI::FetchProductModelAndSwVersionL |
|
2579 // |
|
2580 // (other items were commented in a header). |
|
2581 // ----------------------------------------------------------------------------- |
|
2582 // |
|
2583 void CCMAppUi::FetchProductModelAndSwVersionL() |
|
2584 { |
|
2585 LOGSTRING( "CCMAppUi::FetchProductModelAndSwVersionL - begin" ); |
|
2586 iSwVersion.Zero(); |
|
2587 iProductModel.Zero(); |
|
2588 |
|
2589 HBufC* tmpVersion = HBufC::NewLC( KSysUtilVersionTextLength ); |
|
2590 TPtr ptr( tmpVersion->Des() ); |
|
2591 User::LeaveIfError( SysUtil::GetSWVersion( ptr ) ); |
|
2592 LOGTEXT(ptr); |
|
2593 |
|
2594 _LIT(KVerStrStart,"V "); |
|
2595 _LIT(KVerStrEnd,"\n"); |
|
2596 |
|
2597 TInt pos1 = tmpVersion->Find(KVerStrStart); |
|
2598 TInt pos2 = tmpVersion->Find(KVerStrEnd); |
|
2599 TInt verlen = ((TDesC)(KVerStrStart)).Length(); |
|
2600 |
|
2601 if( pos1==KErrNotFound) // Version does not start with "V " |
|
2602 { |
|
2603 pos1=0; |
|
2604 verlen=0; |
|
2605 } |
|
2606 |
|
2607 if( (pos1!=KErrNotFound) |
|
2608 && (pos2!=KErrNotFound) |
|
2609 && (pos2 > (pos1 + verlen) ) |
|
2610 ) |
|
2611 { |
|
2612 pos2 -= (verlen + pos1); |
|
2613 TPtrC ptrSw = ptr.Mid(pos1+verlen,pos2); |
|
2614 iSwVersion.Append(ptrSw); |
|
2615 LOGTEXT( iSwVersion); |
|
2616 |
|
2617 TPtrC ptrSeek(ptr); |
|
2618 pos1 = ptrSeek.Find(KVerStrEnd); |
|
2619 if(pos1>=0) |
|
2620 { |
|
2621 ptrSeek.Set(ptrSeek.Mid(pos1+1)); |
|
2622 pos1 = ptrSeek.Find(KVerStrEnd); |
|
2623 if( pos1 >= 0 ) |
|
2624 { |
|
2625 ptrSeek.Set(ptrSeek.Mid(pos1+1)); |
|
2626 pos1 = ptrSeek.Find(KVerStrEnd); |
|
2627 if( pos1 < 0 ) |
|
2628 { |
|
2629 ptrSeek.Set(ptrSeek.Mid(1)); |
|
2630 iProductModel.Append(ptrSeek); |
|
2631 } |
|
2632 else if( pos1 > 0 ) |
|
2633 { |
|
2634 ptrSeek.Set(ptrSeek.Mid(1,pos1-1)); |
|
2635 iProductModel.Append(ptrSeek); |
|
2636 } |
|
2637 LOGTEXT(iProductModel); |
|
2638 } |
|
2639 } |
|
2640 |
|
2641 } |
|
2642 |
|
2643 CleanupStack::PopAndDestroy(); |
|
2644 LOGSTRING( "CCMAppUi::FetchProductModelAndSwVersionL - end" ); |
|
2645 } |
|
2646 |
|
2647 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
2648 // None |
|
2649 |
|
2650 |
|
2651 // End of File |