26 #include <cmapplicationsettingsui.h> |
26 #include <cmapplicationsettingsui.h> |
27 #include <commdb.h> |
27 #include <commdb.h> |
28 #include <sysutil.h> |
28 #include <sysutil.h> |
29 #include <ErrorUI.h> |
29 #include <ErrorUI.h> |
30 #include <bautils.h> |
30 #include <bautils.h> |
31 #include <e32def.h> |
|
32 #include <vpnmanagementuirsc.rsg> |
31 #include <vpnmanagementuirsc.rsg> |
33 #include "vpnuiloader.h" |
32 #include "vpnuiloader.h" |
34 #include "vpnmanagementuiview.h" |
33 #include "vpnmanagementuiview.h" |
35 #include "vpnmanagementuipolicyview.h" |
34 #include "vpnmanagementuipolicyview.h" |
36 #include "vpnmanagementuiserverview.h" |
35 #include "vpnmanagementuiserverview.h" |
69 // |
68 // |
70 CVpnUiLoader::~CVpnUiLoader() |
69 CVpnUiLoader::~CVpnUiLoader() |
71 { |
70 { |
72 LOG_("CVpnUiLoader::~CVpnUiLoader()"); |
71 LOG_("CVpnUiLoader::~CVpnUiLoader()"); |
73 iVpnManagementUiView = NULL; |
72 iVpnManagementUiView = NULL; |
74 |
73 |
|
74 delete iVpnManagementUiParametersView; |
|
75 delete iVpnManagementUiServerView; |
|
76 |
75 if(iVersionInfoInNaviPane) |
77 if(iVersionInfoInNaviPane) |
76 { |
78 { |
77 delete iVersionInfoInNaviPane; |
79 delete iVersionInfoInNaviPane; |
78 } |
80 } |
79 delete iVpnApiWrapper; |
81 delete iVpnApiWrapper; |
114 // |
116 // |
115 void CVpnUiLoader::ConstructL( const TRect& aRect, TUid aViewId ) |
117 void CVpnUiLoader::ConstructL( const TRect& aRect, TUid aViewId ) |
116 { |
118 { |
117 LOG_("CVpnUiLoader::ConstructL() - begin"); |
119 LOG_("CVpnUiLoader::ConstructL() - begin"); |
118 |
120 |
|
121 AddResourceFileL(); |
119 //Initialization |
122 //Initialization |
120 iBackFromServerDefinition = EFalse; |
123 iBackFromServerDefinition = EFalse; |
121 iNewServerDefinition = EFalse; |
124 iNewServerDefinition = EFalse; |
122 iPolicyUpdate = EFalse; |
125 iPolicyUpdate = EFalse; |
123 |
126 |
128 iNaviPane = static_cast<CAknNavigationControlContainer*> ( |
131 iNaviPane = static_cast<CAknNavigationControlContainer*> ( |
129 statusPane->ControlL( TUid::Uid(EEikStatusPaneUidNavi) ) ); |
132 statusPane->ControlL( TUid::Uid(EEikStatusPaneUidNavi) ) ); |
130 |
133 |
131 iPreviousAppViewId = aViewId; |
134 iPreviousAppViewId = aViewId; |
132 CreateWindowL(); |
135 CreateWindowL(); |
133 |
136 iVpnManagementUiServerView = CVpnManagementUiServerView::NewL( |
134 User::LeaveIfError( iVpnExtApi.Connect() ); |
137 aRect, *this); |
|
138 iVpnManagementUiParametersView = CServerSettingsView::NewL( aRect, *this); |
|
139 |
135 SetRect(aRect); |
140 SetRect(aRect); |
136 |
141 |
137 LOG(Log::Printf(_L("CVpnUiLoader::ConstructL() - end\n"))); |
142 LOG(Log::Printf(_L("CVpnUiLoader::ConstructL() - end\n"))); |
138 } |
143 } |
139 |
144 |
179 iPreviousViewId ); |
184 iPreviousViewId ); |
180 } |
185 } |
181 break; |
186 break; |
182 } |
187 } |
183 case KChangeViewBack: |
188 case KChangeViewBack: |
184 ((CAknViewAppUi*)iAvkonAppUi)->RemoveView(KVpnManagementUiPolicyViewId); |
189 ((CAknViewAppUi*)iAvkonAppUi)->RemoveView(KVpnManagementUiPolicyViewId); |
185 iPolicyViewVisited = EFalse; |
190 iPolicyViewVisited = EFalse; |
186 ((CAknViewAppUi*)iAvkonAppUi)->RemoveView(KVpnManagementUiLogViewId); |
191 ((CAknViewAppUi*)iAvkonAppUi)->RemoveView(KVpnManagementUiLogViewId); |
187 iLogViewVisited = EFalse; |
192 iLogViewVisited = EFalse; |
188 ((CAknViewAppUi*)iAvkonAppUi)->RemoveView(KVpnManagementUiParametersViewId); |
193 ((CAknViewAppUi*)iAvkonAppUi)->RemoveView(KVpnManagementUiParametersViewId); |
189 iServerSettingsViewVisited = EFalse; |
|
190 ((CAknViewAppUi*)iAvkonAppUi)->RemoveView(KVpnManagementUiServerViewId); |
194 ((CAknViewAppUi*)iAvkonAppUi)->RemoveView(KVpnManagementUiServerViewId); |
191 iServerViewVisited = EFalse; |
|
192 ((CAknViewAppUi*)iAvkonAppUi)->ActivateLocalViewL( iGsViewId.iViewUid ); |
195 ((CAknViewAppUi*)iAvkonAppUi)->ActivateLocalViewL( iGsViewId.iViewUid ); |
193 if(iObserver) |
196 if(iObserver) |
194 { |
197 { |
195 iObserver->UiComplete(KUirEventNone); |
198 iObserver->UiComplete(KUirEventNone); |
196 } |
199 } |
224 TVwsViewId localCurrentViewId; |
227 TVwsViewId localCurrentViewId; |
225 ((CAknViewAppUi*)iAvkonAppUi)->GetActiveViewId( |
228 ((CAknViewAppUi*)iAvkonAppUi)->GetActiveViewId( |
226 localCurrentViewId ); |
229 localCurrentViewId ); |
227 |
230 |
228 iPreviousViewId = localCurrentViewId.iViewUid; |
231 iPreviousViewId = localCurrentViewId.iViewUid; |
229 if ( iServerViewVisited == EFalse) |
232 |
230 { |
233 ((CAknViewAppUi*)iAvkonAppUi)->AddViewL(iVpnManagementUiServerView); |
231 TRect rect; |
|
232 iVpnManagementUiServerView = CVpnManagementUiServerView::NewL( rect, *this); |
|
233 ((CAknViewAppUi*)iAvkonAppUi)->AddViewL(iVpnManagementUiServerView); |
|
234 } |
|
235 iServerViewVisited = ETrue; |
|
236 ((CAknViewAppUi*)iAvkonAppUi)->ActivateLocalViewL( |
234 ((CAknViewAppUi*)iAvkonAppUi)->ActivateLocalViewL( |
237 KVpnManagementUiServerViewId ); |
235 KVpnManagementUiServerViewId ); |
238 break; |
236 break; |
239 } |
237 } |
240 case KChangeViewLog: //Log view |
238 case KChangeViewLog: //Log view |
265 TVwsViewId localCurrentViewId; |
263 TVwsViewId localCurrentViewId; |
266 ((CAknViewAppUi*)iAvkonAppUi)->GetActiveViewId( |
264 ((CAknViewAppUi*)iAvkonAppUi)->GetActiveViewId( |
267 localCurrentViewId ); |
265 localCurrentViewId ); |
268 |
266 |
269 iPreviousViewId = localCurrentViewId.iViewUid; |
267 iPreviousViewId = localCurrentViewId.iViewUid; |
270 //Put selected server to CustomMessageId |
268 //Put selected server to CustomMessageId |
271 if ( iServerSettingsViewVisited == EFalse) |
269 ((CAknViewAppUi*)iAvkonAppUi)->AddViewL(iVpnManagementUiParametersView); |
272 { |
|
273 TRect rect; |
|
274 iVpnManagementUiParametersView = CServerSettingsView::NewL( rect, *this); |
|
275 ((CAknViewAppUi*)iAvkonAppUi)->AddViewL(iVpnManagementUiParametersView); |
|
276 } |
|
277 iServerSettingsViewVisited = ETrue; |
|
278 ((CAknViewAppUi*)iAvkonAppUi)->ActivateLocalViewL( |
270 ((CAknViewAppUi*)iAvkonAppUi)->ActivateLocalViewL( |
279 KVpnManagementUiParametersViewId, |
271 KVpnManagementUiParametersViewId, |
280 TUid::Uid( aSelectionIndex), KNullDesC8 ); |
272 TUid::Uid( aSelectionIndex), KNullDesC8 ); |
281 break; |
273 break; |
282 } |
274 } |
451 // very quickly. Thus, we ensure that the UI ends up in an active |
443 // very quickly. Thus, we ensure that the UI ends up in an active |
452 // state by activating the view that should be active. |
444 // state by activating the view that should be active. |
453 TVwsViewId activeViewId; |
445 TVwsViewId activeViewId; |
454 ((CAknViewAppUi*)iAvkonAppUi)->GetActiveViewId(activeViewId); |
446 ((CAknViewAppUi*)iAvkonAppUi)->GetActiveViewId(activeViewId); |
455 ((CAknViewAppUi*)iAvkonAppUi)->ActivateLocalViewL(activeViewId.iViewUid); |
447 ((CAknViewAppUi*)iAvkonAppUi)->ActivateLocalViewL(activeViewId.iViewUid); |
456 |
|
457 if ( !iShowWaitNote ) |
|
458 { |
|
459 iVpnApiWrapper->CancelSynchronise( ); |
|
460 } |
|
461 } |
448 } |
462 |
449 |
463 // --------------------------------------------------------- |
450 // --------------------------------------------------------- |
464 // CVpnUiLoader::ShowWaitNoteL |
451 // CVpnUiLoader::ShowWaitNoteL |
465 // --------------------------------------------------------- |
452 // --------------------------------------------------------- |
466 // |
453 // |
467 void CVpnUiLoader::ShowWaitNoteL() |
454 void CVpnUiLoader::ShowWaitNoteL() |
468 { |
455 { |
469 // Initialization (before the progress dialog is shown) |
456 // Initialization (before the progress dialog is shown) |
|
457 iTextToShow = EConnectingVia; // "Connecting via '%U'" |
470 iWaitNoteStartTime.UniversalTime(); |
458 iWaitNoteStartTime.UniversalTime(); |
471 |
459 |
472 if ( iWaitDialog ) |
460 if ( iWaitDialog ) |
473 { |
461 { |
474 delete iWaitDialog; |
462 delete iWaitDialog; |
495 { |
483 { |
496 // on error destroy wait note by force. |
484 // on error destroy wait note by force. |
497 delete iWaitDialog; |
485 delete iWaitDialog; |
498 } |
486 } |
499 iWaitDialog = NULL; |
487 iWaitDialog = NULL; |
500 iShowWaitNote = EFalse; |
|
501 } |
488 } |
502 |
489 |
503 void CVpnUiLoader::SetTextL() |
490 void CVpnUiLoader::SetTextL() |
504 { |
491 { |
505 LOG(Log::Printf(_L("CVpnUiLoader::SetTextL()\n"))); |
492 LOG(Log::Printf(_L("CVpnUiLoader::SetTextL()\n"))); |
506 |
493 |
507 |
494 TTime now; |
508 HBufC* string = StringLoader::LoadLC( R_VPN_WAIT_IMPORTING_POLICY ); |
495 now.UniversalTime(); |
|
496 |
|
497 TTimeIntervalSeconds secondsPassed; |
|
498 now.SecondsFrom(iWaitNoteStartTime, secondsPassed); |
|
499 |
|
500 if (secondsPassed.Int() < KSecondsToShowConnectingVia) |
|
501 { |
|
502 iTextToShow = EConnectingVia; //0 |
|
503 } |
|
504 else |
|
505 { |
|
506 iTextToShow = EProcessingStepN; //1 |
|
507 iStateCodeToShow = 0; |
|
508 } |
|
509 |
|
510 if (iTextToShow == EConnectingVia) |
|
511 { |
|
512 HBufC* string = StringLoader::LoadLC( R_VPN_CONNECTING_VIA_AP, iSelectionName ); |
509 iWaitDialog->SetTextL( *string ); |
513 iWaitDialog->SetTextL( *string ); |
510 CleanupStack::PopAndDestroy( string ); |
514 CleanupStack::PopAndDestroy( string ); |
511 |
515 } |
|
516 else |
|
517 { |
|
518 HBufC* string = StringLoader::LoadLC( R_VPN_WAIT_POLICY_DL_PROCESSING, iStateCodeToShow ); |
|
519 iWaitDialog->SetTextL( *string ); |
|
520 CleanupStack::PopAndDestroy( string ); |
|
521 } |
512 } |
522 } |
513 |
523 |
514 |
524 |
515 void CVpnUiLoader::GetSelectionNameL( TDes& aText ) |
525 void CVpnUiLoader::GetSelectionNameL( TDes& aText ) |
516 { |
526 { |