41
|
1 |
/*
|
|
2 |
* Copyright (c) 2003 - 2010 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: VPN management main view
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
// INCLUDE FILES
|
|
21 |
#include <aknnotewrappers.h> // for warning & information notes
|
|
22 |
#include <AknWaitDialog.h>
|
|
23 |
#include <cmmanagerext.h>
|
|
24 |
#include <cmdestinationext.h>
|
|
25 |
#include <cmpluginvpndef.h>
|
|
26 |
#include <cmapplicationsettingsui.h>
|
|
27 |
#include <commdb.h>
|
|
28 |
#include <sysutil.h>
|
|
29 |
#include <ErrorUI.h>
|
|
30 |
#include <bautils.h>
|
|
31 |
#include <e32def.h>
|
|
32 |
#include <vpnmanagementuirsc.rsg>
|
|
33 |
#include "vpnuiloader.h"
|
|
34 |
#include "vpnmanagementuiview.h"
|
|
35 |
#include "vpnmanagementuipolicyview.h"
|
|
36 |
#include "vpnmanagementuiserverview.h"
|
|
37 |
#include "vpnmanagementuilogview.h"
|
|
38 |
#include "vpnmanagementuiserversettingsview.h"
|
|
39 |
#include "version.h"
|
|
40 |
#include "vpnmanagementuiserversettingscontainer.h"
|
|
41 |
|
|
42 |
#include "log_vpnmanagementui.h"
|
|
43 |
|
|
44 |
// CONSTANTS
|
|
45 |
|
|
46 |
|
|
47 |
using namespace CMManager;
|
|
48 |
|
|
49 |
|
|
50 |
// ================= MEMBER FUNCTIONS =======================
|
|
51 |
|
|
52 |
// ---------------------------------------------------------
|
|
53 |
// CVpnUiLoader::CVpnUiLoader()
|
|
54 |
// Constructor with parent
|
|
55 |
// ---------------------------------------------------------
|
|
56 |
//
|
|
57 |
CVpnUiLoader::CVpnUiLoader( CVpnManagementUiView* aUiView ):
|
|
58 |
iVpnManagementUiView(aUiView),
|
|
59 |
iResourceLoader(*iCoeEnv)
|
|
60 |
{
|
|
61 |
LOG_("CVpnUiLoader::CVpnUiLoader()");
|
|
62 |
ASSERT( aUiView );
|
|
63 |
}
|
|
64 |
|
|
65 |
// ---------------------------------------------------------
|
|
66 |
// CVpnUiLoader::~CVpnUiLoader()
|
|
67 |
// Destructor
|
|
68 |
// ---------------------------------------------------------
|
|
69 |
//
|
|
70 |
CVpnUiLoader::~CVpnUiLoader()
|
|
71 |
{
|
|
72 |
LOG_("CVpnUiLoader::~CVpnUiLoader()");
|
|
73 |
iVpnManagementUiView = NULL;
|
|
74 |
|
|
75 |
if(iVersionInfoInNaviPane)
|
|
76 |
{
|
|
77 |
delete iVersionInfoInNaviPane;
|
|
78 |
}
|
|
79 |
delete iVpnApiWrapper;
|
|
80 |
delete iWaitDialog;
|
|
81 |
iResourceLoader.Close();
|
|
82 |
}
|
|
83 |
|
|
84 |
// ---------------------------------------------------------
|
|
85 |
// CVpnUiLoader* CVpnUiLoader::NewL()
|
|
86 |
// ---------------------------------------------------------
|
|
87 |
//
|
|
88 |
CVpnUiLoader* CVpnUiLoader::NewL(
|
|
89 |
const TRect& aRect, TUid aViewId,
|
|
90 |
CVpnManagementUiView* aUiView )
|
|
91 |
{
|
|
92 |
CVpnUiLoader* self = NewLC( aRect, aViewId, aUiView );
|
|
93 |
CleanupStack::Pop();
|
|
94 |
return self;
|
|
95 |
}
|
|
96 |
|
|
97 |
// ---------------------------------------------------------
|
|
98 |
// CVpnUiLoader* CVpnUiLoader::NewLC()
|
|
99 |
// ---------------------------------------------------------
|
|
100 |
//
|
|
101 |
CVpnUiLoader* CVpnUiLoader::NewLC(
|
|
102 |
const TRect& aRect, TUid aViewId,
|
|
103 |
CVpnManagementUiView* aUiView )
|
|
104 |
{
|
|
105 |
CVpnUiLoader* self = new ( ELeave ) CVpnUiLoader( aUiView );
|
|
106 |
CleanupStack::PushL( self );
|
|
107 |
self->ConstructL( aRect, aViewId );
|
|
108 |
return self;
|
|
109 |
}
|
|
110 |
|
|
111 |
// ---------------------------------------------------------
|
|
112 |
// CVpnUiLoader::ConstructL()
|
|
113 |
// ---------------------------------------------------------
|
|
114 |
//
|
|
115 |
void CVpnUiLoader::ConstructL( const TRect& aRect, TUid aViewId )
|
|
116 |
{
|
|
117 |
LOG_("CVpnUiLoader::ConstructL() - begin");
|
|
118 |
|
|
119 |
//Initialization
|
|
120 |
iBackFromServerDefinition = EFalse;
|
|
121 |
iNewServerDefinition = EFalse;
|
|
122 |
iPolicyUpdate = EFalse;
|
|
123 |
|
|
124 |
CEikStatusPane* statusPane = STATIC_CAST(
|
|
125 |
CAknAppUi*, iEikonEnv->EikAppUi())->StatusPane();
|
|
126 |
|
|
127 |
// Fetch pointer to the default navi pane control
|
|
128 |
iNaviPane = static_cast<CAknNavigationControlContainer*> (
|
|
129 |
statusPane->ControlL( TUid::Uid(EEikStatusPaneUidNavi) ) );
|
|
130 |
|
|
131 |
iPreviousAppViewId = aViewId;
|
|
132 |
CreateWindowL();
|
|
133 |
|
|
134 |
User::LeaveIfError( iVpnExtApi.Connect() );
|
|
135 |
SetRect(aRect);
|
|
136 |
|
|
137 |
LOG(Log::Printf(_L("CVpnUiLoader::ConstructL() - end\n")));
|
|
138 |
}
|
|
139 |
|
|
140 |
// ---------------------------------------------------------
|
|
141 |
// CVpnUiLoader::FocusChanged(TDrawNow aDrawNow)
|
|
142 |
// Added here because FocusChanged need to be included
|
|
143 |
// in every control derived from CCoeControl that can have listbox
|
|
144 |
// ---------------------------------------------------------
|
|
145 |
//
|
|
146 |
void CVpnUiLoader::FocusChanged(TDrawNow aDrawNow)
|
|
147 |
{
|
|
148 |
if (iListBox)
|
|
149 |
{
|
|
150 |
iListBox->SetFocus(IsFocused(), aDrawNow);
|
|
151 |
}
|
|
152 |
}
|
|
153 |
|
|
154 |
// ---------------------------------------------------------
|
|
155 |
// CVpnUiLoader::ChangeViewL(TInt aNewTab, TInt aSelectionIndex)
|
|
156 |
// Called when the view tab is changed
|
|
157 |
// ---------------------------------------------------------
|
|
158 |
//
|
|
159 |
void CVpnUiLoader::ChangeViewL(TInt aNewTab, TInt aSelectionIndex)
|
|
160 |
{
|
|
161 |
LOG_1("CVpnUiLoader::ChangeViewL():%d", aNewTab);
|
|
162 |
switch (aNewTab)
|
|
163 |
{
|
|
164 |
|
|
165 |
case KChangeViewPrevious:
|
|
166 |
{
|
|
167 |
TVwsViewId currentViewId;
|
|
168 |
((CAknViewAppUi*)iAvkonAppUi)->GetActiveViewId(currentViewId);
|
|
169 |
|
|
170 |
if(iPreviousViewId == currentViewId.iViewUid)
|
|
171 |
{
|
|
172 |
((CAknViewAppUi*)iAvkonAppUi)->RegisterViewL(*iVpnManagementUiView);
|
|
173 |
((CAknViewAppUi*)iAvkonAppUi)->ActivateLocalViewL( KVpnManagementPluginUid );
|
|
174 |
}
|
|
175 |
else
|
|
176 |
{
|
|
177 |
((CAknViewAppUi*)iAvkonAppUi)->RegisterViewL(*iVpnManagementUiView);
|
|
178 |
((CAknViewAppUi*)iAvkonAppUi)->ActivateLocalViewL(
|
|
179 |
iPreviousViewId );
|
|
180 |
}
|
|
181 |
break;
|
|
182 |
}
|
|
183 |
case KChangeViewBack:
|
|
184 |
((CAknViewAppUi*)iAvkonAppUi)->RemoveView(KVpnManagementUiPolicyViewId);
|
|
185 |
iPolicyViewVisited = EFalse;
|
|
186 |
((CAknViewAppUi*)iAvkonAppUi)->RemoveView(KVpnManagementUiLogViewId);
|
|
187 |
iLogViewVisited = EFalse;
|
|
188 |
((CAknViewAppUi*)iAvkonAppUi)->RemoveView(KVpnManagementUiParametersViewId);
|
|
189 |
iServerSettingsViewVisited = EFalse;
|
|
190 |
((CAknViewAppUi*)iAvkonAppUi)->RemoveView(KVpnManagementUiServerViewId);
|
|
191 |
iServerViewVisited = EFalse;
|
|
192 |
((CAknViewAppUi*)iAvkonAppUi)->ActivateLocalViewL( iGsViewId.iViewUid );
|
|
193 |
if(iObserver)
|
|
194 |
{
|
|
195 |
iObserver->UiComplete(KUirEventNone);
|
|
196 |
}
|
|
197 |
break;
|
|
198 |
|
|
199 |
case KChangeViewPolicy: //Policy view
|
|
200 |
{
|
|
201 |
// the current view is saved so we
|
|
202 |
// know where to come back
|
|
203 |
TVwsViewId localCurrentViewId;
|
|
204 |
((CAknViewAppUi*)iAvkonAppUi)->GetActiveViewId(
|
|
205 |
localCurrentViewId );
|
|
206 |
|
|
207 |
iPreviousViewId = localCurrentViewId.iViewUid;
|
|
208 |
if ( iPolicyViewVisited == EFalse)
|
|
209 |
{
|
|
210 |
TRect rect;
|
|
211 |
iVpnManagementUiPolicyView = CVpnManagementUiPolicyView::NewL(
|
|
212 |
rect, *this);
|
|
213 |
((CAknViewAppUi*)iAvkonAppUi)->AddViewL(iVpnManagementUiPolicyView);
|
|
214 |
}
|
|
215 |
iPolicyViewVisited=ETrue;
|
|
216 |
((CAknViewAppUi*)iAvkonAppUi)->ActivateLocalViewL(
|
|
217 |
KVpnManagementUiPolicyViewId );
|
|
218 |
break;
|
|
219 |
}
|
|
220 |
case KChangeViewServer: //Policy server view
|
|
221 |
{
|
|
222 |
// the current view is saved so we
|
|
223 |
// know where to come back
|
|
224 |
TVwsViewId localCurrentViewId;
|
|
225 |
((CAknViewAppUi*)iAvkonAppUi)->GetActiveViewId(
|
|
226 |
localCurrentViewId );
|
|
227 |
|
|
228 |
iPreviousViewId = localCurrentViewId.iViewUid;
|
|
229 |
if ( iServerViewVisited == EFalse)
|
|
230 |
{
|
|
231 |
TRect rect;
|
|
232 |
iVpnManagementUiServerView = CVpnManagementUiServerView::NewL( rect, *this);
|
|
233 |
((CAknViewAppUi*)iAvkonAppUi)->AddViewL(iVpnManagementUiServerView);
|
|
234 |
}
|
|
235 |
iServerViewVisited = ETrue;
|
|
236 |
((CAknViewAppUi*)iAvkonAppUi)->ActivateLocalViewL(
|
|
237 |
KVpnManagementUiServerViewId );
|
|
238 |
break;
|
|
239 |
}
|
|
240 |
case KChangeViewLog: //Log view
|
|
241 |
{
|
|
242 |
// the current view is saved so we
|
|
243 |
// know where to come back
|
|
244 |
TVwsViewId localCurrentViewId;
|
|
245 |
((CAknViewAppUi*)iAvkonAppUi)->GetActiveViewId(
|
|
246 |
localCurrentViewId );
|
|
247 |
|
|
248 |
iPreviousViewId = localCurrentViewId.iViewUid;
|
|
249 |
if ( iLogViewVisited == EFalse)
|
|
250 |
{
|
|
251 |
TRect rect;
|
|
252 |
iVpnManagementUiLogView = CVpnManagementUiLogView::NewL( rect, *this);
|
|
253 |
((CAknViewAppUi*)iAvkonAppUi)->AddViewL(iVpnManagementUiLogView);
|
|
254 |
}
|
|
255 |
iLogViewVisited=ETrue;
|
|
256 |
((CAknViewAppUi*)iAvkonAppUi)->ActivateLocalViewL(
|
|
257 |
KVpnManagementUiLogViewId );
|
|
258 |
break;
|
|
259 |
}
|
|
260 |
|
|
261 |
case KChangeViewSettings: //VPN policy server parameters view
|
|
262 |
{
|
|
263 |
// the current view is saved so that close settings
|
|
264 |
// knows where to come back
|
|
265 |
TVwsViewId localCurrentViewId;
|
|
266 |
((CAknViewAppUi*)iAvkonAppUi)->GetActiveViewId(
|
|
267 |
localCurrentViewId );
|
|
268 |
|
|
269 |
iPreviousViewId = localCurrentViewId.iViewUid;
|
|
270 |
//Put selected server to CustomMessageId
|
|
271 |
if ( iServerSettingsViewVisited == EFalse)
|
|
272 |
{
|
|
273 |
TRect rect;
|
|
274 |
iVpnManagementUiParametersView = CServerSettingsView::NewL( rect, *this);
|
|
275 |
((CAknViewAppUi*)iAvkonAppUi)->AddViewL(iVpnManagementUiParametersView);
|
|
276 |
}
|
|
277 |
iServerSettingsViewVisited = ETrue;
|
|
278 |
((CAknViewAppUi*)iAvkonAppUi)->ActivateLocalViewL(
|
|
279 |
KVpnManagementUiParametersViewId,
|
|
280 |
TUid::Uid( aSelectionIndex), KNullDesC8 );
|
|
281 |
break;
|
|
282 |
}
|
|
283 |
|
|
284 |
default:
|
|
285 |
break;
|
|
286 |
}
|
|
287 |
}
|
|
288 |
|
|
289 |
// ----------------------------------------------------
|
|
290 |
// CVpnUiLoader::ActivateTitleL(TInt aCurrentTitle)
|
|
291 |
// Activates the VPN policies, VPN policy servers and
|
|
292 |
// VPN log views title
|
|
293 |
// ----------------------------------------------------
|
|
294 |
//
|
|
295 |
void CVpnUiLoader::ActivateTitleL(TInt aCurrentTitle)
|
|
296 |
{
|
|
297 |
CEikStatusPane* sp = STATIC_CAST(
|
|
298 |
CAknAppUi*, iEikonEnv->EikAppUi())->StatusPane();
|
|
299 |
// Fetch pointer to the default title pane control
|
|
300 |
CAknTitlePane* title = STATIC_CAST(
|
|
301 |
CAknTitlePane*, sp->ControlL(TUid::Uid(EEikStatusPaneUidTitle)) );
|
|
302 |
TResourceReader reader;
|
|
303 |
|
|
304 |
if ( aCurrentTitle == KViewTitleManagementView )
|
|
305 |
{
|
|
306 |
iCoeEnv->CreateResourceReaderLC( reader, R_VPN_MANAGEMENT_TITLE );
|
|
307 |
}
|
|
308 |
if ( aCurrentTitle == KViewTitlePolicyView )
|
|
309 |
{
|
|
310 |
iCoeEnv->CreateResourceReaderLC( reader, R_VPN_POLICIES_TITLE );
|
|
311 |
}
|
|
312 |
if ( aCurrentTitle == KViewTitleServerView )
|
|
313 |
{
|
|
314 |
iCoeEnv->CreateResourceReaderLC( reader, R_VPN_POLICY_SERVERS_TITLE );
|
|
315 |
}
|
|
316 |
if ( aCurrentTitle == KViewTitleLogView )
|
|
317 |
{
|
|
318 |
iCoeEnv->CreateResourceReaderLC( reader, R_VPN_LOG_TITLE );
|
|
319 |
}
|
|
320 |
|
|
321 |
title->SetFromResourceL( reader );
|
|
322 |
CleanupStack::PopAndDestroy(); // reader
|
|
323 |
}
|
|
324 |
|
|
325 |
void CVpnUiLoader::ActivateTitleL(TInt aCurrentTitle, TDes& aText)
|
|
326 |
{
|
|
327 |
CEikStatusPane* sp = STATIC_CAST(
|
|
328 |
CAknAppUi*, iEikonEnv->EikAppUi())->StatusPane();
|
|
329 |
// Fetch pointer to the default title pane control
|
|
330 |
CAknTitlePane* title = STATIC_CAST(
|
|
331 |
CAknTitlePane*, sp->ControlL(TUid::Uid(EEikStatusPaneUidTitle)) );
|
|
332 |
|
|
333 |
if ( aCurrentTitle == KViewTitleParametersView )
|
|
334 |
{
|
|
335 |
title->SetTextL(aText);
|
|
336 |
}
|
|
337 |
}
|
|
338 |
// ----------------------------------------------------
|
|
339 |
// CVpnUiLoader::ActivateNaviTextL()
|
|
340 |
// Activates the VPN log view Navipane text (Version information)
|
|
341 |
// ----------------------------------------------------
|
|
342 |
//
|
|
343 |
void CVpnUiLoader::ActivateNaviTextL()
|
|
344 |
{
|
|
345 |
// version information in navi pane text shown in VPN Log view
|
|
346 |
//TBuf<KVersionLine> version(KVersion);
|
|
347 |
HBufC* naviText = StringLoader::LoadLC(
|
|
348 |
R_VPN_NAVI_CLIENT_VERSION, KVersion/*version*/ );
|
|
349 |
TPtr naviDes=naviText->Des();
|
|
350 |
AknTextUtils::DisplayTextLanguageSpecificNumberConversion(naviDes);
|
|
351 |
iVersionInfoInNaviPane = iNaviPane->CreateMessageLabelL(*naviText);
|
|
352 |
CleanupStack::PopAndDestroy(); //naviText
|
|
353 |
}
|
|
354 |
|
|
355 |
// ---------------------------------------------------------
|
|
356 |
// CVpnUiLoader::PushNaviPaneL
|
|
357 |
// ---------------------------------------------------------
|
|
358 |
//
|
|
359 |
void CVpnUiLoader::PushNaviPaneL()
|
|
360 |
{
|
|
361 |
iNaviPane->PushL( *iVersionInfoInNaviPane );
|
|
362 |
}
|
|
363 |
|
|
364 |
// ---------------------------------------------------------
|
|
365 |
// CVpnUiLoader::PopNaviPane
|
|
366 |
// ---------------------------------------------------------
|
|
367 |
//
|
|
368 |
void CVpnUiLoader::PopNaviPane()
|
|
369 |
{
|
|
370 |
if(iVersionInfoInNaviPane)
|
|
371 |
{
|
|
372 |
delete iVersionInfoInNaviPane; //A control is popped from stack
|
|
373 |
iVersionInfoInNaviPane = NULL;
|
|
374 |
}
|
|
375 |
}
|
|
376 |
|
|
377 |
// ---------------------------------------------------------
|
|
378 |
// CVpnUiLoader::PushDefaultNaviPaneL
|
|
379 |
// ---------------------------------------------------------
|
|
380 |
//
|
|
381 |
void CVpnUiLoader::PushDefaultNaviPaneL()
|
|
382 |
{
|
|
383 |
iNaviPane->PushDefaultL();
|
|
384 |
}
|
|
385 |
|
|
386 |
// ---------------------------------------------------------
|
|
387 |
// CVpnUiLoader::HandleControlEventL(
|
|
388 |
// CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/)
|
|
389 |
// Cannot be changed to non-leaving function.
|
|
390 |
// L-function is required by the class definition, even if empty.
|
|
391 |
// ---------------------------------------------------------
|
|
392 |
//
|
|
393 |
void CVpnUiLoader::HandleControlEventL(
|
|
394 |
CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/)
|
|
395 |
{
|
|
396 |
}
|
|
397 |
|
|
398 |
// ---------------------------------------------------------
|
|
399 |
// CVpnUiLoader::OfferKeyEventL()
|
|
400 |
// ---------------------------------------------------------
|
|
401 |
//
|
|
402 |
TKeyResponse CVpnUiLoader::OfferKeyEventL(
|
|
403 |
const TKeyEvent& /*aKeyEvent*/, TEventCode /*aType*/)
|
|
404 |
{
|
|
405 |
// Listbox takes all event even if it doesn't use them
|
|
406 |
return EKeyWasNotConsumed;
|
|
407 |
}
|
|
408 |
|
|
409 |
// ----------------------------------------------------------
|
|
410 |
// AddResourceFileL()
|
|
411 |
// ----------------------------------------------------------
|
|
412 |
//
|
|
413 |
void CVpnUiLoader::AddResourceFileL(TBool aKeepOpen)
|
|
414 |
{
|
|
415 |
if (!iKeepOpen)
|
|
416 |
{
|
|
417 |
iKeepOpen = aKeepOpen;
|
|
418 |
_LIT(KResourceFile, "\\resource\\vpnmanagementuirsc.rsc");
|
|
419 |
TFileName resourceFileName(KResourceFile);
|
|
420 |
TFileName dllName;
|
|
421 |
Dll::FileName(dllName);
|
|
422 |
TBuf<2> drive = dllName.Left(2);
|
|
423 |
resourceFileName.Insert(0, drive);
|
|
424 |
|
|
425 |
// To enable loading of e.g. vpnmanagementuirsc.r**
|
|
426 |
BaflUtils::NearestLanguageFile(iCoeEnv->FsSession(), resourceFileName);
|
|
427 |
iResourceLoader.OpenL(resourceFileName);
|
|
428 |
LOG_("CVpnUiLoader::AddResourceFileL(");
|
|
429 |
}
|
|
430 |
}
|
|
431 |
// ----------------------------------------------------------
|
|
432 |
// ReleaseResource()
|
|
433 |
// ----------------------------------------------------------
|
|
434 |
//
|
|
435 |
void CVpnUiLoader::ReleaseResource(TBool aForceClose)
|
|
436 |
{
|
|
437 |
if(!iKeepOpen || aForceClose)
|
|
438 |
{
|
|
439 |
LOG_("CVpnUiLoader::ReleaseResource()");
|
|
440 |
iKeepOpen = EFalse;
|
|
441 |
iResourceLoader.Close();
|
|
442 |
}
|
|
443 |
}
|
|
444 |
// ---------------------------------------------------------
|
|
445 |
// CVpnUiLoader::DialogDismissedL
|
|
446 |
// ---------------------------------------------------------
|
|
447 |
//
|
|
448 |
void CVpnUiLoader::DialogDismissedL( TInt /*aButtonId*/ )
|
|
449 |
{
|
|
450 |
// The UI is left in an inactive state if the progress dialog is cancelled
|
|
451 |
// very quickly. Thus, we ensure that the UI ends up in an active
|
|
452 |
// state by activating the view that should be active.
|
|
453 |
TVwsViewId activeViewId;
|
|
454 |
((CAknViewAppUi*)iAvkonAppUi)->GetActiveViewId(activeViewId);
|
|
455 |
((CAknViewAppUi*)iAvkonAppUi)->ActivateLocalViewL(activeViewId.iViewUid);
|
|
456 |
|
|
457 |
if ( !iShowWaitNote )
|
|
458 |
{
|
|
459 |
iVpnApiWrapper->CancelSynchronise( );
|
|
460 |
}
|
|
461 |
}
|
|
462 |
|
|
463 |
// ---------------------------------------------------------
|
|
464 |
// CVpnUiLoader::ShowWaitNoteL
|
|
465 |
// ---------------------------------------------------------
|
|
466 |
//
|
|
467 |
void CVpnUiLoader::ShowWaitNoteL()
|
|
468 |
{
|
|
469 |
// Initialization (before the progress dialog is shown)
|
|
470 |
iWaitNoteStartTime.UniversalTime();
|
|
471 |
|
|
472 |
if ( iWaitDialog )
|
|
473 |
{
|
|
474 |
delete iWaitDialog;
|
|
475 |
iWaitDialog = NULL;
|
|
476 |
}
|
|
477 |
iWaitDialog = new ( ELeave ) CAknWaitDialog
|
|
478 |
( REINTERPRET_CAST(CEikDialog**,&iWaitDialog),ETrue );
|
|
479 |
iWaitDialog->PrepareLC( R_VPN_WAIT_NOTE );
|
|
480 |
iWaitDialog->SetTone( CAknNoteDialog::ENoTone );
|
|
481 |
iWaitDialog->SetCallback( this );
|
|
482 |
|
|
483 |
SetTextL();
|
|
484 |
|
|
485 |
iWaitDialog->RunLD();
|
|
486 |
iWaitDialog->DrawNow();
|
|
487 |
}
|
|
488 |
|
|
489 |
void CVpnUiLoader::DeleteWaitNoteL()
|
|
490 |
{
|
|
491 |
TInt error;
|
|
492 |
// Dismiss wait dialog
|
|
493 |
TRAP(error, iWaitDialog->ProcessFinishedL()); // deletes the wait dialog
|
|
494 |
if (error != KErrNone)
|
|
495 |
{
|
|
496 |
// on error destroy wait note by force.
|
|
497 |
delete iWaitDialog;
|
|
498 |
}
|
|
499 |
iWaitDialog = NULL;
|
|
500 |
iShowWaitNote = EFalse;
|
|
501 |
}
|
|
502 |
|
|
503 |
void CVpnUiLoader::SetTextL()
|
|
504 |
{
|
|
505 |
LOG(Log::Printf(_L("CVpnUiLoader::SetTextL()\n")));
|
|
506 |
|
|
507 |
|
|
508 |
HBufC* string = StringLoader::LoadLC( R_VPN_WAIT_IMPORTING_POLICY );
|
|
509 |
iWaitDialog->SetTextL( *string );
|
|
510 |
CleanupStack::PopAndDestroy( string );
|
|
511 |
|
|
512 |
}
|
|
513 |
|
|
514 |
|
|
515 |
void CVpnUiLoader::GetSelectionNameL( TDes& aText )
|
|
516 |
{
|
|
517 |
TCmSettingSelection selection = TCmSettingSelection();
|
|
518 |
|
|
519 |
//Reset update operation for Connecting via note
|
|
520 |
iPolicyUpdate = EFalse;
|
|
521 |
|
|
522 |
HBufC* name = NULL;
|
|
523 |
TInt err = KErrNone;
|
|
524 |
if ( selection.iResult == EDestination )
|
|
525 |
{
|
|
526 |
TRAP( err, (name = CServerSettingsContainer::GetDestinationNameL( selection.iId )));
|
|
527 |
}
|
|
528 |
else if ( selection.iResult == EConnectionMethod )
|
|
529 |
{
|
|
530 |
TRAP( err, (name = CServerSettingsContainer::GetConnectionMethodNameL( selection.iId )));
|
|
531 |
}
|
|
532 |
|
|
533 |
if ( name )
|
|
534 |
{
|
|
535 |
aText.Copy(*name);
|
|
536 |
}
|
|
537 |
delete name;
|
|
538 |
name = NULL;
|
|
539 |
}
|
|
540 |
|
|
541 |
|
|
542 |
// ---------------------------------------------------------
|
|
543 |
// CVpnUiLoader::FFSSpaceBelowCriticalLevelL
|
|
544 |
// ---------------------------------------------------------
|
|
545 |
//
|
|
546 |
TBool CVpnUiLoader::FFSSpaceBelowCriticalLevelL
|
|
547 |
( TBool aShowErrorNote, TInt aBytesToWrite /*=0*/ )
|
|
548 |
{
|
|
549 |
LOG_("CVpnUiLoader::FFSSpaceBelowCriticalLevelL() - begin");
|
|
550 |
|
|
551 |
TBool ret( EFalse );
|
|
552 |
if ( SysUtil::FFSSpaceBelowCriticalLevelL
|
|
553 |
( &(CCoeEnv::Static()->FsSession()), aBytesToWrite ) )
|
|
554 |
{
|
|
555 |
ret = ETrue;
|
|
556 |
if ( aShowErrorNote )
|
|
557 |
{
|
|
558 |
CErrorUI* errorUi = CErrorUI::NewLC( *(CCoeEnv::Static()) );
|
|
559 |
errorUi->ShowGlobalErrorNoteL( KErrDiskFull );
|
|
560 |
CleanupStack::PopAndDestroy(); // errorUi
|
|
561 |
}
|
|
562 |
}
|
|
563 |
|
|
564 |
LOG( Log::Printf(_L("CVpnUiLoader::FFSSpaceBelowCriticalLevelL() - end\n")));
|
|
565 |
|
|
566 |
return ret;
|
|
567 |
}
|
|
568 |
|
|
569 |
// ---------------------------------------------------------
|
|
570 |
// CVpnUiLoader::GetVpnManagementUiView()
|
|
571 |
//
|
|
572 |
// ---------------------------------------------------------
|
|
573 |
//
|
|
574 |
CAknView* CVpnUiLoader::GetVpnManagementUiView() const
|
|
575 |
{
|
|
576 |
return iVpnManagementUiView;
|
|
577 |
}
|
|
578 |
|
|
579 |
// ---------------------------------------------------------
|
|
580 |
// CVpnUiLoader::VpnApiWrapperL()
|
|
581 |
// ---------------------------------------------------------
|
|
582 |
//
|
|
583 |
CVpnApiWrapper& CVpnUiLoader::VpnApiWrapperL()
|
|
584 |
{
|
|
585 |
LOG_("CVpnUiLoader::VpnApiWrapperL()");
|
|
586 |
if (!iVpnApiWrapper)
|
|
587 |
iVpnApiWrapper = CVpnApiWrapper::NewL();
|
|
588 |
return *iVpnApiWrapper;
|
|
589 |
}
|
|
590 |
|
|
591 |
// ---------------------------------------------------------
|
|
592 |
// CVpnUiLoader::GsViewId()
|
|
593 |
// Called when the view tab is changed
|
|
594 |
// ---------------------------------------------------------
|
|
595 |
//
|
|
596 |
TVwsViewId CVpnUiLoader::GSViewId() const
|
|
597 |
{
|
|
598 |
return iGsViewId;
|
|
599 |
}
|
|
600 |
|
|
601 |
// ---------------------------------------------------------
|
|
602 |
// CVpnUiLoader::SetGsViewId( TVwsViewId )
|
|
603 |
// Called when the view tab is changed
|
|
604 |
// ---------------------------------------------------------
|
|
605 |
//
|
|
606 |
void CVpnUiLoader::SetGSViewId( TVwsViewId aGsViewUid )
|
|
607 |
{
|
|
608 |
iGsViewId = aGsViewUid;
|
|
609 |
}
|
|
610 |
|
|
611 |
// End of File
|