|
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: Header file for Ui class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CCMAPPUI_H |
|
21 #define CCMAPPUI_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <eikapp.h> |
|
25 #include <eikdoc.h> |
|
26 #include <e32std.h> |
|
27 #include <coeccntx.h> |
|
28 #include <aknappui.h> |
|
29 #include <FavouritesLimits.h> // for KFavouritesMaxUrl |
|
30 #include <sysutil.h> |
|
31 #include <ApDataHandler.h> // for creating new Init Access |
|
32 #include <ApAccessPointItem.h> // for creating new Init Access |
|
33 |
|
34 #include "MCMSocketsEngineNotifier.h" |
|
35 #include "MCMRegisterationStatusNotifier.h" |
|
36 #include "MiniBrowserObserver.h" |
|
37 #include "mcmdialogstatusnotifier.h" |
|
38 #include "ccmdialogmonitor.h" |
|
39 |
|
40 |
|
41 // CONSTANTS |
|
42 //Maximun length of WAP address |
|
43 const TInt KMaximumLengthOfWapAddress = KFavouritesMaxUrl; |
|
44 const TInt KMaxServerString = 20; |
|
45 const TInt KMaxPageString = 20; |
|
46 const TInt KMaxQueryString = 256; |
|
47 |
|
48 // MACROS |
|
49 // None |
|
50 |
|
51 // DATA TYPES |
|
52 // None |
|
53 |
|
54 // FUNCTION PROTOTYPES |
|
55 // None |
|
56 |
|
57 // FORWARD DECLARATIONS |
|
58 class CRepository; |
|
59 class CCMRegistrationMonitor; |
|
60 class CCMSocketsEngine; |
|
61 class CMiniBrowser; |
|
62 class CCMDialogMonitor; |
|
63 class CAknGlobalConfirmationQuery; |
|
64 class CAknGlobalNote; |
|
65 // CLASS DECLARATION |
|
66 |
|
67 /** |
|
68 * CCMAppUi application class. |
|
69 * |
|
70 * @lib ConfManager.app |
|
71 * @since 2.0 |
|
72 */ |
|
73 class CCMAppUi : public CAknAppUi, |
|
74 /*public MProgressDialogCallback,*/ |
|
75 public MCMSocketsEngineNotifier, |
|
76 public MCMRegisterationStatusNotifier, |
|
77 public MCoeForegroundObserver, |
|
78 public MMiniBrowserObserver, |
|
79 public MCMDialogStatusNotifier |
|
80 { |
|
81 public: // Constructors and destructor |
|
82 CCMAppUi(); |
|
83 |
|
84 /** |
|
85 * Destructor. |
|
86 */ |
|
87 ~CCMAppUi(); |
|
88 |
|
89 public: // New methods |
|
90 |
|
91 /** |
|
92 * ApplicationStatus used when the timer expires |
|
93 */ |
|
94 enum TApplicationStatus |
|
95 { |
|
96 EAppStatusMonitoring, |
|
97 EAppStatusConnecting, |
|
98 EAppStatusWaitingDisconnect, |
|
99 EAppStatusInactive, |
|
100 EAppStatusStartingUp, |
|
101 /*(if the app is closed immediately, it crashes after calling the destructor. |
|
102 Seems like CAknMessageQueryDialog releases some of it's resources after some |
|
103 kind of delay and this causes the crash) |
|
104 */ |
|
105 EAppStatusClosing |
|
106 }; |
|
107 |
|
108 /** |
|
109 * ApplicationStatus used when the timer expires |
|
110 */ |
|
111 enum TConnectingVia |
|
112 { |
|
113 EConnectingViaNull, // Initial state, no connection has been tried yet |
|
114 EConnectingViaInit, // Trying to connect via Init Access |
|
115 EConnectingViaDefault, // Trying to connect via Browser default AP |
|
116 EConnectingViaUser // Trying to connect via AP asked from user |
|
117 }; |
|
118 |
|
119 |
|
120 /** |
|
121 * ConnectReason used to inform help-portal |
|
122 */ |
|
123 enum TConnectReason |
|
124 { |
|
125 EConnectReasonUnknown = 0, |
|
126 EConnectReasonFirstBoot = 1, |
|
127 EConnectReasonNewSim = 2, |
|
128 EConnectReasonUserTriggered = 3, |
|
129 EConnectReasonApplicationTriggered = 4, |
|
130 EConnectReasonRemoteTriggered = 5 |
|
131 }; |
|
132 |
|
133 /** |
|
134 * Activates confirmation dialog |
|
135 * @since 2.0 |
|
136 */ |
|
137 void ConfirmationDialogL(); |
|
138 |
|
139 /** |
|
140 * Activates error note |
|
141 * @since 2.0 |
|
142 * @return void |
|
143 */ |
|
144 void ErrorNoteConnectionL(); |
|
145 |
|
146 /** |
|
147 * Activates error note, displaying the error value |
|
148 * @since 2.0 |
|
149 * @param aError errorvalue, will displayed in the note |
|
150 * @return void |
|
151 */ |
|
152 void ErrorNoteUnknownL( TInt aError ); |
|
153 |
|
154 /** |
|
155 * StartUp starting sequence. |
|
156 * @since 2.0 |
|
157 * @return errorcode. |
|
158 */ |
|
159 TInt StartUpStartL(); |
|
160 |
|
161 /** |
|
162 * Checks if there is accesspoint available |
|
163 * @since 2.0 |
|
164 * @return errorcode |
|
165 */ |
|
166 TInt CheckSettingsL(); |
|
167 |
|
168 /** |
|
169 * opens wap browser |
|
170 * @since 2.0 |
|
171 * @return void |
|
172 */ |
|
173 void OpenWapBrowserL( ); |
|
174 |
|
175 /** |
|
176 * Checks if there is defaul accesspoint available |
|
177 * @since 2.0 |
|
178 * @returns ID of the accesspoint or KErrNotFound |
|
179 */ |
|
180 TUint32 CheckDefaultAccessPointL(); |
|
181 |
|
182 /** |
|
183 * Checks if there is init accesspoint available |
|
184 * @since 2.0 |
|
185 * @returns ID of the accesspoint or KErrNotFound |
|
186 */ |
|
187 TUint32 InitAccessPointL(); |
|
188 |
|
189 /** |
|
190 * Checks the settings of init access point |
|
191 * @since 2.0 |
|
192 * @param aDb Commsdb connection |
|
193 * @param aAccessPoint id of the AP to be checked |
|
194 * @returns ETrue if the AP was ok, EFalse if not |
|
195 */ |
|
196 TBool CheckInitAccessPointL( CCommsDatabase& aDb, TUint32& aAccessPoint ); |
|
197 |
|
198 /** |
|
199 * Creates the init accesspoint |
|
200 * @since 2.0 |
|
201 * @param aDb Commsdb connection |
|
202 * @returns ID of the accesspoint or KErrNotFound |
|
203 */ |
|
204 TUint32 CreateInitAccessPointL( CCommsDatabase& aDb ); |
|
205 |
|
206 /** |
|
207 * Initiates next test |
|
208 * @since 2.0 |
|
209 * @returns void |
|
210 */ |
|
211 void InitiateNextConnectionTestL(); |
|
212 |
|
213 /** |
|
214 * Checks if init access is ok in the comms db |
|
215 * if not creates one and cheks again |
|
216 * if init access AP is ok initiates the init access test |
|
217 * otherwise returns EFalse |
|
218 * @since 2.0 |
|
219 * @returns ETrue if connection test was initiated, EFalse if not |
|
220 */ |
|
221 TBool TryInitAccessL(); |
|
222 |
|
223 /** |
|
224 * Checks if browser default access is ok in the comms db |
|
225 * if so initiates the default access test |
|
226 * otherwise returns EFalse |
|
227 * @since 2.0 |
|
228 * @returns ETrue if connection test was initiated or EFalse |
|
229 */ |
|
230 TBool TryDefaultAccessL(); |
|
231 |
|
232 /** |
|
233 * Prompts the user to select an ap to test |
|
234 * @since 2.0 |
|
235 * @returns ETrue if connection test was initiated or EFalse |
|
236 */ |
|
237 TBool TryUserAccessL(); |
|
238 |
|
239 /** |
|
240 * Reads the accesspoint id from the preferences table and changes |
|
241 * iAccessPoint to refer to the id in the WAP_ACCESS_POINT table. |
|
242 * @since 2.0 |
|
243 * @returns ID of the accesspoint or KErrNotFound |
|
244 */ |
|
245 TInt ReadAccessPointFromPreferencesL(); |
|
246 |
|
247 /** |
|
248 * function checks the settings in the ini file |
|
249 * @since 2.0 |
|
250 * @return void |
|
251 */ |
|
252 void CheckIniFileSettingsL(); |
|
253 |
|
254 /** |
|
255 * Shows wait Dialog |
|
256 * @since 2.0 |
|
257 * @return void |
|
258 */ |
|
259 void ShowWaitDialogL(); |
|
260 |
|
261 /** |
|
262 * Starts the real functionality of the configuration Manager |
|
263 * @since 2.0 |
|
264 * @return void |
|
265 */ |
|
266 void StartUpOperationL(); |
|
267 |
|
268 /** |
|
269 * Sets server string (http://<server>.help-portal.com) |
|
270 * @param aServer the server string, max length KMaxServerString |
|
271 * @since 2.0 |
|
272 * @return void |
|
273 */ |
|
274 void SetServerString(const TDesC& aServer); |
|
275 |
|
276 /** |
|
277 * Sets page string (http://server.help-portal.com/<page>) |
|
278 * @param aPage the page string, max length KMaxPageString |
|
279 * @since 2.0 |
|
280 * @return void |
|
281 */ |
|
282 void SetPageString(const TDesC& aPage); |
|
283 |
|
284 /** |
|
285 * Sets connect reason |
|
286 * @param aReason the connect reason |
|
287 * @since 2.0 |
|
288 * @return void |
|
289 */ |
|
290 void SetConnectReason(TConnectReason aReason); |
|
291 |
|
292 /** |
|
293 * Sets query string |
|
294 * @param aQuery the query string, max length KMaxQueryString |
|
295 * @since 2.0 |
|
296 * @return void |
|
297 */ |
|
298 void SetQueryString(const TDesC& aQuery); |
|
299 |
|
300 /** |
|
301 * Sets iAtBoot |
|
302 * @param aAtBoot if ETrue indicates that Support is started as part |
|
303 * of boot process |
|
304 * @return voi |
|
305 */ |
|
306 void SetAtBoot( TBool aAtBoot); |
|
307 |
|
308 /** |
|
309 * Fetch product model and sw version |
|
310 * @since 2.0 |
|
311 * @return void |
|
312 */ |
|
313 void FetchProductModelAndSwVersionL(); |
|
314 |
|
315 |
|
316 /** |
|
317 * Exit application. The implementation depends on the platform. |
|
318 * On 3.0 a short delay is needed on exit because dialogs do not release |
|
319 * all resources when ExecuteLD function completes. The delay is needed |
|
320 * since the app panics on exit if all resources has not been freed. |
|
321 */ |
|
322 void DelayedExit(); |
|
323 |
|
324 public: //Functions from base classes |
|
325 |
|
326 /** |
|
327 * TimerExpired function was replaced by TimeOutCallBack |
|
328 * after replacing class CCMTimer with CPeriodic. Calls DoTimeOutCallBack. |
|
329 * @return TInt KErrNone in case everything was Ok. |
|
330 */ |
|
331 static TInt TimeOutCallBack( TAny* aCCMAppUi ); |
|
332 |
|
333 /** |
|
334 * The functionality from TimerExpired function was moved here |
|
335 */ |
|
336 void DoTimeOutCallBackL(); |
|
337 |
|
338 /** |
|
339 Starts a time-out period of aTimeOut micro seconds. Calls TimeOutCallBack |
|
340 after that. |
|
341 */ |
|
342 void StartTimeOut( const TInt aTimeOut ); |
|
343 |
|
344 /** |
|
345 * From MCMSocketsEngineNotifier notifies the connection result |
|
346 * @since 2.0 |
|
347 * @param aErrorCode error code of the connection test |
|
348 * @return void |
|
349 */ |
|
350 void ConnectionResultL( TInt aErrorCode ); |
|
351 |
|
352 /** |
|
353 * A method for CCMSocketEngine to tell that a unhandled |
|
354 * leave has occurred during it's RunL handling. |
|
355 * Displays a Unknown Error note |
|
356 * @param aErrorCode the errorcode of the unhandled leave |
|
357 * @return voi |
|
358 */ |
|
359 void UnhandledLeave( TInt aErrorCode ); |
|
360 |
|
361 /** |
|
362 * From MCMRegisterationStatusNotifier |
|
363 * @param aNetworkStatus |
|
364 */ |
|
365 void RegistrationMonitoringDoneL( CCMRegistrationMonitor::TNetworkStatus aNetworkStatus ); |
|
366 |
|
367 /** |
|
368 * From MCMRegisterationStatusNotifier |
|
369 * @param aStatus |
|
370 * @param aError |
|
371 */ |
|
372 void RegistrationReportErrorL( const CCMRegistrationMonitor::TMonitoringStatus aStatus, const TInt aError ); |
|
373 |
|
374 /** |
|
375 * From CEikAppui |
|
376 * Handles commandline params |
|
377 * @since 2.0 |
|
378 * @param aCommand see sdk help |
|
379 * @param aDocumentName see sdk help |
|
380 * @return void |
|
381 */ |
|
382 TBool ProcessCommandParametersL( TApaCommand aCommand, TFileName& aDocumentName ); |
|
383 |
|
384 /** |
|
385 * From CEikAppui |
|
386 * Handles commandline params |
|
387 * @since 2.0 |
|
388 * @param aCommand see sdk help |
|
389 * @param aDocumentName see sdk help |
|
390 * @param aTail see sdk help |
|
391 * @return void |
|
392 */ |
|
393 TBool ProcessCommandParametersL( TApaCommand aCommand, TFileName& aDocumentName, const TDesC8& aTail ); |
|
394 |
|
395 /** |
|
396 * takes care of wait dialog command handling. |
|
397 * @since 2.0 |
|
398 * @param aCommand command |
|
399 * @return void |
|
400 */ |
|
401 void WaitDialogDismissedL( TInt aButtonId ); |
|
402 |
|
403 public: // from MMiniBrowserObserver |
|
404 |
|
405 /** |
|
406 Called after MiniBrowser has handled a request for an URL |
|
407 (a call to HttpGetL successfully done) |
|
408 */ |
|
409 void MiniBrowserRequestDoneL(); |
|
410 |
|
411 /** |
|
412 Called if RunL of CMiniBrowser leaves. |
|
413 @param aError The leave code. |
|
414 */ |
|
415 void MiniBrowserErrorL( const TInt aError ); |
|
416 |
|
417 /** |
|
418 Called if a call to MiniBrowserRequestDoneL or MiniBrowserErrorL leaves |
|
419 @param aError The leave code |
|
420 */ |
|
421 void MiniBrowserUnhandledLeave( const TInt aError ); |
|
422 |
|
423 public: // from MCoeForegroundObserver |
|
424 void HandleGainingForeground(); |
|
425 void HandleLosingForeground(); |
|
426 |
|
427 public: // from MCMDialogStatusNotifier |
|
428 void CommonDialogDismissedL( const CCMDialogMonitor::TDialogMode aDialog, const TInt aStatusCode ); |
|
429 |
|
430 private: // Functions from base classes |
|
431 |
|
432 |
|
433 /** |
|
434 * Checks if network connections are allowed. The current implementation |
|
435 * checks the value of KCoreAppUIsNetworkConnectionAllowed central |
|
436 * repository key in KCRUidCoreApplicationUIs. |
|
437 * @return TBool ETrue if network connections are allowed |
|
438 */ |
|
439 TBool IsNetworkConnectionsAllowedL(); |
|
440 |
|
441 /** |
|
442 * From MEikMenuObserver takes care of menu handling. |
|
443 * @since 2.0 |
|
444 * @param aResourceId resourceid |
|
445 * @param aMenuPane menu |
|
446 * @return void |
|
447 */ |
|
448 void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); |
|
449 |
|
450 /** |
|
451 * From CEikAppUi takes care of command handling. |
|
452 * @since 2.0 |
|
453 * @param aCommand command |
|
454 * @return void |
|
455 */ |
|
456 void HandleCommandL( TInt aCommand ); |
|
457 |
|
458 /** |
|
459 * From CEikAppUi handles key events. |
|
460 * @since 1.0 |
|
461 * @param aKeyEvent key event |
|
462 * @param aType event type code |
|
463 * @return Response code (EKeyWasConsumed, EKeyWasNotConsumed). |
|
464 */ |
|
465 virtual TKeyResponse HandleKeyEventL |
|
466 ( |
|
467 const TKeyEvent& aKeyEvent, TEventCode aType |
|
468 ); |
|
469 |
|
470 /** |
|
471 For storing an integer value. |
|
472 */ |
|
473 TInt StoreIntValue( const TUint32 aCrKey, const TInt aValue ); |
|
474 |
|
475 /** |
|
476 For storing a string value. |
|
477 */ |
|
478 TInt StoreStringValue( const TUint32 aCrKey, const TDesC& aValue ); |
|
479 |
|
480 /** |
|
481 For restoring an integer value that was stored by using StoreIntValue. |
|
482 */ |
|
483 TInt GetIntValue( const TUint32 aCrKey, TInt& aValue ); |
|
484 |
|
485 /** |
|
486 For restoring a string value that was stored by using StoreStringValue. |
|
487 */ |
|
488 TInt GetStringValue( const TUint32 aCrKey, TDes& aValue ); |
|
489 |
|
490 /** |
|
491 Appends the domain to be used for redirecting browser (for example |
|
492 www.help-portal.com) |
|
493 @param aUrl The descriptor the domain is appended to. |
|
494 */ |
|
495 void AppendDomainL( TDes& aUrl ); |
|
496 |
|
497 /** |
|
498 Clear Service Activation Information if there are any, online support should not read |
|
499 */ |
|
500 void DeleteServiceActivationInfoL(); |
|
501 |
|
502 /** |
|
503 Append Token And Nonce Value to WAPPage |
|
504 */ |
|
505 void AppendTokenAndNonceValL(); |
|
506 |
|
507 /** |
|
508 Append Device Information to URL |
|
509 */ |
|
510 void AppendDeviceInfoL(); |
|
511 |
|
512 /** |
|
513 Create Minibrowser and Launch |
|
514 */ |
|
515 void LaunchMiniBrowserL(); |
|
516 |
|
517 /* |
|
518 Launch s60 Web browser using command line parameters |
|
519 */ |
|
520 void LaunchS60WebBrowserL(); |
|
521 |
|
522 /* |
|
523 Append parameters to URL required from Server |
|
524 */ |
|
525 void AppendWebUtilParamsL(); |
|
526 |
|
527 /* |
|
528 Create Online Help for settings based on Autostart value |
|
529 Can be either Silent or Non Silent. |
|
530 In case of Silent settings are downloaded settings silently |
|
531 connecting to browser in background |
|
532 In case of Non-Silent Browser will be opened with display of |
|
533 webpage where user can select settings based on his wish |
|
534 */ |
|
535 void OnlineHelpL(); |
|
536 |
|
537 private: |
|
538 /** |
|
539 * By default EPOC constructor is private. |
|
540 */ |
|
541 void ConstructL(); |
|
542 |
|
543 private: //Data |
|
544 |
|
545 // RegistrarionMonitor |
|
546 CCMRegistrationMonitor* iRegistrationMonitor; |
|
547 // Sockets engine |
|
548 CCMSocketsEngine* iEngine; |
|
549 // Timer |
|
550 CPeriodic* iTimer; |
|
551 // WAP page address |
|
552 TBuf <KMaximumLengthOfWapAddress> iWapPage; |
|
553 // if this is true the application has changed the preferences |
|
554 TBool iPreferencesChanged; |
|
555 // If this is true the phone is in homenetwork |
|
556 TBool iNetworkStatusOk; |
|
557 // This is set to true if the phone has been started before while it |
|
558 //hasn't been registered to it's homenetwork and now the phone has |
|
559 //been started in the homenetework. |
|
560 TBool iFirstStartInHomeNetwork; |
|
561 // if this is true the application knows that the confirmation dialog will be showed |
|
562 TBool iShowConfirmation; |
|
563 /** Id for the current AccessPoint this id refers to the WAP_ACCESS_POINT table. */ |
|
564 TUint32 iAccessPoint; |
|
565 // Application status |
|
566 TApplicationStatus iApplicationStatus; |
|
567 // This is for the initAccess |
|
568 TBool iInitAccessPointUsed; |
|
569 |
|
570 // Connection reason (EConnectReasonUnknown if not started with parameters) |
|
571 TConnectReason iConnectReason; |
|
572 // Page string (http://<server>.help-portal.com/) |
|
573 TBuf<KMaxServerString> iServer; |
|
574 // Page string (http://server.help-portal.com/<page>) |
|
575 TBuf<KMaxPageString> iPage; |
|
576 // SW version |
|
577 TBuf<KSysUtilVersionTextLength> iSwVersion; |
|
578 // Product model |
|
579 TBuf<KSysUtilVersionTextLength> iProductModel; |
|
580 // Query string |
|
581 TBuf<KMaxQueryString> iQuery; |
|
582 |
|
583 // Tells by which AP the connection is tried, so that the state machine in |
|
584 // TimerExpired can try the next AP if the current did not work |
|
585 TConnectingVia iConnectingVia; |
|
586 // The number to show in wait dialog |
|
587 TInt iWaitDialogProgressVal; |
|
588 |
|
589 // Last configured IMSI from ini file |
|
590 RMobilePhone::TMobilePhoneSubscriberId iLastConfIMSI; |
|
591 |
|
592 CCMRegistrationMonitor::TNetworkStatus iNetworkStatus; |
|
593 |
|
594 /** Tells if the application was started in auto start (quiet) mode */ |
|
595 TBool iAutoStart; |
|
596 /** Tells if we should override need for initAccess in order to use TOKEN (TokenOverride). |
|
597 set to ETrue to append TOKEN and tValid parameters even if not using initAccess */ |
|
598 TBool iTokenOverride; |
|
599 /** Tells if we started Browser (needed in considering whether a long exit delay is needed) */ |
|
600 TBool iStartingBrowser; |
|
601 |
|
602 CRepository* iRepository; |
|
603 |
|
604 /*! |
|
605 Note that iMiniBrowser must have an opened RSocketServ handle and an |
|
606 opened and started RConnection handle until it is destroyed. This means |
|
607 that it has to be deleted after iEngine (iMiniBrowser uses the RSocketServ |
|
608 and RConnection handles of iEngine). |
|
609 */ |
|
610 CMiniBrowser* iMiniBrowser; |
|
611 |
|
612 CCMDialogMonitor* iCommonDialogMonitor; |
|
613 /*! |
|
614 To prevent infinite redirects in silent mode |
|
615 */ |
|
616 TInt iRedirectsLeft; |
|
617 |
|
618 CAknGlobalConfirmationQuery* iGlobalConfirmationQuery; |
|
619 CAknGlobalNote* iGlobalWaitNote; |
|
620 TInt iWaitNoteId; |
|
621 TInt iInitAccessOn; |
|
622 }; |
|
623 |
|
624 #endif // CCMAPPUI_H |
|
625 |
|
626 // End of File |