author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 15 Sep 2010 13:20:54 +0300 | |
branch | RCL_3 |
changeset 46 | 29c8f9bc68e1 |
parent 41 | e06095241a65 |
child 49 | 5960d2d03390 |
permissions | -rw-r--r-- |
41 | 1 |
/* |
2 |
* Copyright (c) 2005-2009 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 <aknViewAppUi.h> |
|
22 |
#include <avkon.hrh> |
|
23 |
#include <vpnmanagementuirsc.rsg> |
|
24 |
#include <settingsinternalcrkeys.h> |
|
25 |
#include <centralrepository.h> |
|
26 |
#include <bautils.h> |
|
27 |
#include <vpnmanagementui.mbg> |
|
28 |
#include "vpnmanagementui.hrh" |
|
29 |
#include "vpnuiloader.h" |
|
30 |
#include "vpnmanagementuiview.h" |
|
31 |
#include "vpnmanagementuicontainer.h" |
|
32 |
#include "vpnmanagementuiviewid.h" |
|
33 |
#include "log_vpnmanagementui.h" |
|
34 |
||
35 |
/** MSK control Id. */ |
|
36 |
const TInt KVpnMSKControlId = 3; |
|
37 |
||
38 |
||
39 |
// ROM folder |
|
40 |
||
41 |
// Name of the MBM file containing icons |
|
42 |
_LIT( KFileIcons, "vpnmanagementui.mbm"); |
|
43 |
||
44 |
// Constants |
|
45 |
enum TVpnUiCommands |
|
46 |
{ |
|
47 |
KVpnUiPolicyViewListItemId, |
|
48 |
KVpnUiServerViewListItemId, |
|
49 |
KVpnUiLogViewListItemId |
|
50 |
}; |
|
51 |
||
52 |
// ================= MEMBER FUNCTIONS ======================= |
|
53 |
||
54 |
// --------------------------------------------------------------------------- |
|
55 |
// CVpnManagementUiView::CVpnManagementUiView() |
|
56 |
// --------------------------------------------------------------------------- |
|
57 |
// |
|
58 |
CVpnManagementUiView::CVpnManagementUiView() |
|
59 |
{ |
|
60 |
} |
|
61 |
||
62 |
// --------------------------------------------------------------------------- |
|
63 |
// CVpnManagementUiView::~CVpnManagementUiView() |
|
64 |
// Destructor |
|
65 |
// --------------------------------------------------------------------------- |
|
66 |
// |
|
67 |
CVpnManagementUiView::~CVpnManagementUiView() |
|
68 |
{ |
|
69 |
LOG_("CVpnManagementUiView::~CVpnManagementUiView entered"); |
|
70 |
if ( iContainer ) |
|
71 |
{ |
|
72 |
AppUi()->RemoveFromViewStack(*this, iContainer); |
|
73 |
delete iContainer; |
|
74 |
} |
|
46
29c8f9bc68e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
41
diff
changeset
|
75 |
delete iLoader; |
29c8f9bc68e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
41
diff
changeset
|
76 |
delete iCaption; |
41 | 77 |
LOG_("CVpnManagementUiView::~CVpnManagementUiView() exited"); |
78 |
} |
|
79 |
||
80 |
||
81 |
// --------------------------------------------------------------------------- |
|
82 |
// CVpnManagementUiView::NewL() |
|
83 |
// --------------------------------------------------------------------------- |
|
84 |
// |
|
85 |
CVpnManagementUiView* CVpnManagementUiView::NewL() |
|
86 |
{ |
|
87 |
LOG_("CVpnManagementUiView::NewL() entered"); |
|
88 |
CVpnManagementUiView* self = NewLC(); |
|
89 |
CleanupStack::Pop(); |
|
90 |
LOG_("CVpnManagementUiView::NewL() exited"); |
|
91 |
return self; |
|
92 |
} |
|
93 |
||
94 |
// --------------------------------------------------------------------------- |
|
95 |
// CVpnManagementUiView::NewLC() |
|
96 |
// --------------------------------------------------------------------------- |
|
97 |
// |
|
98 |
CVpnManagementUiView* CVpnManagementUiView::NewLC() |
|
99 |
{ |
|
100 |
LOG_("CVpnManagementUiView::NewLC() entered"); |
|
101 |
CVpnManagementUiView* self = new ( ELeave ) CVpnManagementUiView(); |
|
102 |
CleanupStack::PushL( self ); |
|
103 |
self->ConstructL(); |
|
104 |
return self; |
|
105 |
} |
|
106 |
||
107 |
||
108 |
// --------------------------------------------------------------------------- |
|
109 |
// CVpnManagementUiView::ConstructL() |
|
110 |
// --------------------------------------------------------------------------- |
|
111 |
// |
|
112 |
void CVpnManagementUiView::ConstructL() |
|
113 |
{ |
|
114 |
LOG_("CVpnManagementUiView::ConstructL() entered"); |
|
115 |
iLoader = CVpnUiLoader::NewL(iAvkonViewAppUi->ClientRect(), |
|
116 |
KVpnManagementPluginUid, this ); |
|
46
29c8f9bc68e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
41
diff
changeset
|
117 |
|
29c8f9bc68e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
41
diff
changeset
|
118 |
iLoader->AddResourceFileL(); |
29c8f9bc68e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
41
diff
changeset
|
119 |
BaseConstructL( R_VPNUI_MANAGEMENT_VIEW ); |
29c8f9bc68e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
41
diff
changeset
|
120 |
iCaption = StringLoader::LoadL( R_VPN_MANAGEMENT_TITLE_BUF ); |
41 | 121 |
iLoader->ReleaseResource(); |
46
29c8f9bc68e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
41
diff
changeset
|
122 |
|
41 | 123 |
LOG_("CVpnManagementUiView::ConstructL() exited"); |
124 |
} |
|
125 |
||
126 |
// --------------------------------------------------------------------------- |
|
127 |
// void CVpnManagementUiView::GetCaptionL( TDes& aCaption ) const |
|
128 |
// --------------------------------------------------------------------------- |
|
129 |
void CVpnManagementUiView::GetCaptionL( TDes& aCaption ) const |
|
130 |
{ |
|
131 |
LOG_("CVpnManagementUiView::GetCaptionL() entered"); |
|
46
29c8f9bc68e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
41
diff
changeset
|
132 |
|
29c8f9bc68e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
41
diff
changeset
|
133 |
__ASSERT_DEBUG(iCaption != NULL, User::Invariant()); |
29c8f9bc68e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
41
diff
changeset
|
134 |
|
29c8f9bc68e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
41
diff
changeset
|
135 |
if (aCaption.MaxLength() < iCaption->Length()) |
29c8f9bc68e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
41
diff
changeset
|
136 |
{ |
29c8f9bc68e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
41
diff
changeset
|
137 |
aCaption = iCaption->Left(aCaption.MaxLength()); |
29c8f9bc68e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
41
diff
changeset
|
138 |
} |
29c8f9bc68e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
41
diff
changeset
|
139 |
else |
29c8f9bc68e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
41
diff
changeset
|
140 |
{ |
29c8f9bc68e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
41
diff
changeset
|
141 |
aCaption = *iCaption; |
29c8f9bc68e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
41
diff
changeset
|
142 |
} |
41 | 143 |
LOG_("CVpnManagementUiView::GetCaptionL() exited"); |
144 |
} |
|
145 |
||
146 |
// --------------------------------------------------------------------------- |
|
147 |
// TUid CVpnManagementUiView::Id() |
|
148 |
// --------------------------------------------------------------------------- |
|
149 |
// |
|
150 |
TUid CVpnManagementUiView::Id() const |
|
151 |
{ |
|
152 |
LOG_("CVpnManagementUiView::Id called"); |
|
153 |
return KVpnManagementPluginUid; |
|
154 |
} |
|
155 |
||
156 |
// --------------------------------------------------------------------------- |
|
157 |
// CVpnManagementUiView::HandleCommandL() |
|
158 |
// Handles commands directed to this class. |
|
159 |
// --------------------------------------------------------------------------- |
|
160 |
// |
|
161 |
void CVpnManagementUiView::HandleCommandL(TInt aCommand) |
|
162 |
{ |
|
163 |
LOG_1("CVpnManagementUiView::HandleCommandL():%d", aCommand); |
|
164 |
switch ( aCommand ) |
|
165 |
{ |
|
166 |
case EAknSoftkeyBack: |
|
167 |
{ |
|
46
29c8f9bc68e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
41
diff
changeset
|
168 |
iLoader->ChangeViewL( KChangeViewBack ); |
29c8f9bc68e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
41
diff
changeset
|
169 |
iLoader->ReleaseResource(ETrue); |
41 | 170 |
break; |
171 |
} |
|
172 |
case EAknCmdExit: |
|
173 |
{ |
|
174 |
((CAknViewAppUi*)iAvkonAppUi)->HandleCommandL( EAknCmdExit ); |
|
175 |
break; |
|
176 |
} |
|
177 |
case EVpnUiCmdOpen: |
|
178 |
{ |
|
179 |
HandleListBoxSelectionL(); |
|
180 |
break; |
|
181 |
} |
|
182 |
||
183 |
#ifdef __SERIES60_HELP |
|
184 |
case EAknCmdHelp: |
|
185 |
{ |
|
186 |
HlpLauncher::LaunchHelpApplicationL( |
|
187 |
iEikonEnv->WsSession(), AppUi()->AppHelpContextL() ); |
|
188 |
break; |
|
189 |
} |
|
190 |
#endif //__SERIES60_HELP |
|
191 |
||
192 |
default: |
|
193 |
{ |
|
194 |
AppUi()->HandleCommandL( aCommand ); |
|
195 |
break; |
|
196 |
} |
|
197 |
} |
|
198 |
} |
|
199 |
||
200 |
||
201 |
||
202 |
// --------------------------------------------------------------------------- |
|
203 |
// CVpnManagementUiView::HandleClientRectChange() |
|
204 |
// --------------------------------------------------------------------------- |
|
205 |
// |
|
206 |
void CVpnManagementUiView::HandleClientRectChange() |
|
207 |
{ |
|
208 |
if ( iContainer ) |
|
209 |
{ |
|
210 |
iContainer->SetRect( ClientRect() ); |
|
211 |
} |
|
212 |
} |
|
213 |
||
214 |
// --------------------------------------------------------------------------- |
|
215 |
// CVpnManagementUiView::DoActivateL() |
|
216 |
// --------------------------------------------------------------------------- |
|
217 |
// |
|
218 |
void CVpnManagementUiView::DoActivateL( |
|
219 |
const TVwsViewId& aPrevViewId,TUid /*aCustomMessageId*/, |
|
220 |
const TDesC8& /*aCustomMessage*/) |
|
221 |
{ |
|
222 |
LOG_("CVpnManagementUiView::DoActivateL() entered"); |
|
223 |
iLoader->AddResourceFileL(ETrue); |
|
224 |
if ( iLoader->GSViewId().iViewUid.iUid == 0 ) |
|
225 |
{ |
|
226 |
//must be prepared to application switch, so it stores |
|
227 |
//only the parent view (General Settings Main View) |
|
228 |
iLoader->SetGSViewId( aPrevViewId ); |
|
229 |
||
230 |
} |
|
231 |
if ( iContainer ) |
|
232 |
{ |
|
233 |
((CAknViewAppUi*)iAvkonAppUi)->RemoveFromViewStack( |
|
234 |
*this, iContainer ); |
|
235 |
} |
|
236 |
iContainer = new (ELeave) CVpnManagementUiContainer( |
|
237 |
*this, *iLoader ); |
|
238 |
||
239 |
iContainer->SetMopParent( this ); |
|
240 |
iContainer->ConstructL( ClientRect() ); |
|
241 |
iLoader->ActivateTitleL( KViewTitleManagementView ); |
|
242 |
iLoader->PushDefaultNaviPaneL(); |
|
243 |
||
244 |
((CAknViewAppUi*)iAvkonAppUi)->AddToStackL( *this, iContainer ); |
|
245 |
iContainer->DrawListBoxL( iCurrentItem, iTopItemIndex ); |
|
246 |
||
247 |
//Listbox observer is set here, instead create listbox |
|
248 |
iContainer->iListBox->SetListBoxObserver(this); |
|
249 |
||
250 |
// Add MiddleSoftKey |
|
251 |
CEikButtonGroupContainer* cbaGroup = Cba(); |
|
252 |
if (cbaGroup) |
|
253 |
{ |
|
254 |
HBufC* text = StringLoader::LoadLC(R_MSK_OPEN); |
|
255 |
cbaGroup->AddCommandToStackL( |
|
256 |
KVpnMSKControlId, EVpnUiCmdOpen, text->Des()); |
|
257 |
CleanupStack::PopAndDestroy(text); |
|
258 |
} |
|
259 |
LOG_("CVpnManagementUiView::DoActivateL() exited"); |
|
260 |
} |
|
261 |
||
262 |
// --------------------------------------------------------------------------- |
|
263 |
// CVpnManagementUiView::HandleCommandL() |
|
264 |
// --------------------------------------------------------------------------- |
|
265 |
// |
|
266 |
void CVpnManagementUiView::DoDeactivate() |
|
267 |
{ |
|
268 |
LOG_("CVpnManagementUiView::DoDeactivate() entered"); |
|
269 |
if ( iContainer ) |
|
270 |
{ |
|
271 |
AppUi()->RemoveFromViewStack( *this, iContainer ); |
|
272 |
||
273 |
delete iContainer; |
|
274 |
iContainer = NULL; |
|
275 |
} |
|
276 |
LOG_("CVpnManagementUiView::DoDeactivate() exited"); |
|
277 |
} |
|
278 |
||
279 |
// --------------------------------------------------------------------------- |
|
280 |
// CVpnManagementUiView::HandleListBoxEventL |
|
281 |
// --------------------------------------------------------------------------- |
|
282 |
||
283 |
void CVpnManagementUiView::HandleListBoxEventL(CEikListBox* /*aListBox*/, |
|
284 |
TListBoxEvent aEventType) |
|
285 |
{ |
|
286 |
switch (aEventType) |
|
287 |
{ |
|
288 |
case EEventEnterKeyPressed: |
|
289 |
case EEventItemSingleClicked: |
|
290 |
HandleListBoxSelectionL(); |
|
291 |
break; |
|
292 |
default: |
|
293 |
break; |
|
294 |
} |
|
295 |
} |
|
296 |
||
297 |
// --------------------------------------------------------------------------- |
|
298 |
// CVpnManagementUiView::HandleListBoxSelectionL() |
|
299 |
// --------------------------------------------------------------------------- |
|
300 |
// |
|
301 |
void CVpnManagementUiView::HandleListBoxSelectionL() |
|
302 |
{ |
|
303 |
ASSERT(iContainer && iContainer->iListBox && iLoader); |
|
304 |
iCurrentItem = iContainer->iListBox->CurrentItemIndex(); |
|
305 |
iTopItemIndex = iContainer->iListBox->TopItemIndex(); |
|
306 |
switch (iCurrentItem) |
|
307 |
{ |
|
308 |
case KVpnUiPolicyViewListItemId: |
|
309 |
iLoader->ChangeViewL(KChangeViewPolicy); |
|
310 |
break; |
|
311 |
||
312 |
||
313 |
case KVpnUiServerViewListItemId: |
|
314 |
iLoader->ChangeViewL(KChangeViewServer); |
|
315 |
break; |
|
316 |
||
317 |
||
318 |
case KVpnUiLogViewListItemId: |
|
319 |
iLoader->ChangeViewL(KChangeViewLog); |
|
320 |
break; |
|
321 |
||
322 |
default: |
|
323 |
LOG_("CVpnManagementUiView::HandleListBoxSelectionL default"); |
|
324 |
break; |
|
325 |
} |
|
326 |
} |
|
327 |
||
328 |
||
329 |
||
330 |
void CVpnManagementUiView::NotifySynchroniseServerCompleteL(TInt aResult) |
|
331 |
{ |
|
332 |
if ( aResult != KErrNone) |
|
333 |
LOG_1("CVpnManagementUiView::NotifySynchroniseServerCompleteL:%d", aResult); |
|
334 |
} |
|
335 |
||
336 |
// --------------------------------------------------------------------------- |
|
337 |
// CVpnManagementUiView::HasBitmap |
|
338 |
// --------------------------------------------------------------------------- |
|
339 |
TBool CVpnManagementUiView::HasBitmap() const |
|
340 |
{ |
|
341 |
LOG_("CVpnManagementUiView::HasBitmap() called"); |
|
342 |
return EFalse; |
|
343 |
} |
|
344 |
||
345 |
// --------------------------------------------------------------------------- |
|
346 |
// CVpnManagementUiView::GetBitmapL |
|
347 |
// --------------------------------------------------------------------------- |
|
348 |
void CVpnManagementUiView::GetBitmapL( CFbsBitmap* /*aBitmap*/, |
|
349 |
CFbsBitmap* /*aMask*/ ) const |
|
350 |
{ |
|
351 |
LOG_("CVpnManagementUiView::GetBitmapL() entered"); |
|
352 |
//no bitmap |
|
353 |
User::Leave( KErrNotFound ); |
|
354 |
LOG_("CVpnManagementUiView::GetBitmapL() exited"); |
|
355 |
} |
|
356 |
||
357 |
// --------------------------------------------------------------------------- |
|
358 |
// CVpnManagementUiView::PluginProviderCategory |
|
359 |
// --------------------------------------------------------------------------- |
|
360 |
TInt CVpnManagementUiView::PluginProviderCategory() const |
|
361 |
{ |
|
362 |
LOG_("CVpnManagementUiView::PluginProviderCategory() called"); |
|
363 |
return EGSPluginProviderOEM; |
|
364 |
} |
|
365 |
||
366 |
// --------------------------------------------------------------------------- |
|
367 |
// CVpnManagementUiView::CreateIconL |
|
368 |
// --------------------------------------------------------------------------- |
|
369 |
CGulIcon* CVpnManagementUiView::CreateIconL( const TUid aIconType ) |
|
370 |
{ |
|
371 |
LOG_("CVpnManagementUiView::CreateIconL() entered"); |
|
372 |
||
373 |
TFileName iconsFileName; |
|
374 |
TFileName dllName; |
|
375 |
Dll::FileName(dllName); |
|
376 |
TBuf<2> drive = dllName.Left(2); |
|
377 |
iconsFileName.Insert(0, drive); |
|
378 |
||
379 |
||
380 |
iconsFileName.Append( KDC_APP_BITMAP_DIR ); |
|
381 |
iconsFileName.Append( KFileIcons ); |
|
382 |
||
383 |
CGulIcon* icon; |
|
384 |
||
385 |
if( aIconType == KGSIconTypeLbxItem ) |
|
386 |
{ |
|
387 |
icon = AknsUtils::CreateGulIconL( |
|
388 |
AknsUtils::SkinInstance(), |
|
389 |
KAknsIIDQgnPropSetConnVpn, |
|
390 |
iconsFileName, |
|
391 |
EMbmVpnmanagementuiQgn_prop_set_conn_vpn, |
|
392 |
EMbmVpnmanagementuiQgn_prop_set_conn_vpn_mask ); |
|
393 |
} |
|
394 |
else |
|
395 |
{ |
|
396 |
icon = CGSPluginInterface::CreateIconL( aIconType ); |
|
397 |
} |
|
398 |
LOG_("CVpnManagementUiView::CreateIconL() exited"); |
|
399 |
return icon; |
|
400 |
} |
|
401 |
||
402 |
// --------------------------------------------------------------------------- |
|
403 |
// CVpnManagementUiView::Visible |
|
404 |
// --------------------------------------------------------------------------- |
|
405 |
TBool CVpnManagementUiView::Visible() const |
|
406 |
{ |
|
407 |
LOG_("CVpnManagementUiView::Visible() entered"); |
|
408 |
TInt vpnSupported( 0 ); |
|
409 |
TInt readError(0); |
|
410 |
TRAPD(loadError, |
|
411 |
{ |
|
412 |
CRepository* repository = CRepository::NewL(KCRUidCommunicationSettings); |
|
413 |
readError = repository->Get(KSettingsVPNSupported, vpnSupported); |
|
414 |
delete repository; |
|
415 |
}); |
|
416 |
LOG_1("CVpnManagementUiView::Visible():%d exited", vpnSupported); |
|
417 |
return (vpnSupported && !readError && !loadError) ? ETrue : EFalse; |
|
418 |
} |
|
419 |
||
420 |
// --------------------------------------------------------------------------- |
|
421 |
// CVpnManagementUiView::PluginUid |
|
422 |
// --------------------------------------------------------------------------- |
|
423 |
TUid CVpnManagementUiView::PluginUid() const |
|
424 |
{ |
|
425 |
LOG_("CVpnManagementUiView::PluginUid() called"); |
|
426 |
return KVpnManagementPluginUid; |
|
427 |
} |
|
428 |
||
429 |
// End of File |
|
430 |