1 /* |
|
2 * Copyright (c) 2002 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: |
|
15 * Defines CApSelPopupList for access point selection. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "APSettingsHandlerUIVariant.hrh" |
|
22 |
|
23 #include <ApListItem.h> |
|
24 #include <apsetui.rsg> |
|
25 #include <featmgr.h> |
|
26 |
|
27 #include "ApSelectorListBoxModel.h" |
|
28 #include "ApSettingsModel.h" |
|
29 #include "ApSettingsHandlerUI.hrh" |
|
30 #include "ApSelPopupList.h" |
|
31 #include "ApsettingshandleruiImpl.h" |
|
32 |
|
33 |
|
34 #include "ApSettingsHandlerLogger.h" |
|
35 |
|
36 #include <ApProtHandler.h> // for protection of settings |
|
37 |
|
38 #include <AknsUtils.h> |
|
39 #include <apsettings.mbg> |
|
40 #include <data_caging_path_literals.hrh> |
|
41 |
|
42 |
|
43 // CONSTANTS |
|
44 // Drive and file name of the MBM file containing icons for Protection |
|
45 _LIT( KFileIcons, "z:ApSettings.mbm" ); |
|
46 |
|
47 |
|
48 // ================= MEMBER FUNCTIONS ======================= |
|
49 |
|
50 // --------------------------------------------------------- |
|
51 // CApSelPopupList::NewL |
|
52 // --------------------------------------------------------- |
|
53 // |
|
54 CApSelPopupList* CApSelPopupList::NewL( CApSettingsModel& aModel, |
|
55 CApSettingsHandlerImpl& aHandler, |
|
56 TInt& aCurrentSelectionIndex, |
|
57 TInt& aPreferredUid, |
|
58 TSelectionMenuType aSelMenuType, |
|
59 TInt aIspFilter, TInt aBearerFilter, |
|
60 TInt aSortType, TUint32& aEventStore, |
|
61 CDesCArrayFlat* aItemArray, |
|
62 TBool aNeedsNone, |
|
63 TBool aNoEdit, |
|
64 TInt aReqIpvType, |
|
65 TVpnFilterType aVpnFilterType |
|
66 ) |
|
67 { |
|
68 APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::NewL") |
|
69 CApSelPopupList* self = |
|
70 new ( ELeave ) CApSelPopupList( aModel, aHandler, |
|
71 aCurrentSelectionIndex, |
|
72 aPreferredUid, aSelMenuType, |
|
73 aIspFilter, aBearerFilter, |
|
74 aSortType, aItemArray, |
|
75 aEventStore, aNeedsNone, |
|
76 aNoEdit, |
|
77 aReqIpvType, |
|
78 aVpnFilterType |
|
79 ); |
|
80 // till that point, object is only partially constructed! |
|
81 |
|
82 APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::NewL") |
|
83 return self; |
|
84 } |
|
85 |
|
86 |
|
87 |
|
88 |
|
89 |
|
90 // --------------------------------------------------------- |
|
91 // CApSelPopupList::NewL |
|
92 // --------------------------------------------------------- |
|
93 // |
|
94 CApSelPopupList* CApSelPopupList::NewL( CApSettingsModel& aModel, |
|
95 CApSettingsHandlerImpl& aHandler, |
|
96 TInt& aCurrentSelectionIndex, |
|
97 TInt& aPreferredUid, |
|
98 TSelectionMenuType aSelMenuType, |
|
99 TInt aIspFilter, TInt aBearerFilter, |
|
100 TInt aSortType, TUint32& aEventStore, |
|
101 CDesCArrayFlat* aItemArray, |
|
102 TBool aNeedsNone, |
|
103 TInt aReqIpvType, |
|
104 TVpnFilterType aVpnFilterType, |
|
105 TBool aIncludeEasyWlan, |
|
106 TBool aNoEdit |
|
107 ) |
|
108 { |
|
109 APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::NewL2") |
|
110 |
|
111 CApSelPopupList* self = |
|
112 new ( ELeave ) CApSelPopupList( aModel, aHandler, |
|
113 aCurrentSelectionIndex, |
|
114 aPreferredUid, aSelMenuType, |
|
115 aIspFilter, aBearerFilter, |
|
116 aSortType, aItemArray, |
|
117 aEventStore, aNeedsNone, |
|
118 aReqIpvType, |
|
119 aVpnFilterType, |
|
120 aIncludeEasyWlan, |
|
121 aNoEdit |
|
122 ); |
|
123 // till that point, object is only partially constructed! |
|
124 |
|
125 APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::NewL2") |
|
126 return self; |
|
127 } |
|
128 |
|
129 |
|
130 |
|
131 // --------------------------------------------------------- |
|
132 // CApSelPopupList::ConstructL |
|
133 // --------------------------------------------------------- |
|
134 // |
|
135 void CApSelPopupList::ConstructL() |
|
136 { |
|
137 APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::ConstructL") |
|
138 |
|
139 FeatureManager::InitializeLibL(); |
|
140 iHelpSupported = FeatureManager::FeatureSupported( KFeatureIdHelp ); |
|
141 iProtectionSupported = FeatureManager::FeatureSupported( |
|
142 KFeatureIdSettingsProtection ); |
|
143 FeatureManager::UnInitializeLib(); |
|
144 |
|
145 CAknRadioButtonSettingPage::ConstructL(); |
|
146 iList = ListBoxControl(); |
|
147 iModel = new( ELeave )CApSelectorListboxModel( |
|
148 CApSelectorListboxModel::EGraphicOnOff ); |
|
149 iList->Model()->SetItemTextArray( iModel ); |
|
150 if ( iProtectionSupported ) |
|
151 { |
|
152 TInt offset = LoadIconsL(); |
|
153 iModel->SetOwnIconOffset( offset ); |
|
154 } |
|
155 FillListBoxWithDataL(); |
|
156 iDataModel->Database()->AddObserverL( this ); |
|
157 |
|
158 if ( !iModel->Count() ) |
|
159 { |
|
160 // no ap defined, ask query if editable, |
|
161 // show note if not |
|
162 if ( iNoEdit ) |
|
163 { |
|
164 // show note first, |
|
165 ShowNoteL( R_APUI_VIEW_NO_IAP_DEFINED_INFO ); |
|
166 // then simply go back: |
|
167 iDoExit = ETrue; |
|
168 } |
|
169 else |
|
170 { |
|
171 if ( !AskQueryL( R_APUI_IAP_CREATE_NEW ) ) |
|
172 { // do not create, simply go back |
|
173 iDoExit = ETrue; |
|
174 } |
|
175 else |
|
176 { // create new AP |
|
177 // just ket it pass, later in it will be handled in CheckIfEmptyL() |
|
178 } |
|
179 } |
|
180 } |
|
181 |
|
182 APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::ConstructL") |
|
183 } |
|
184 |
|
185 |
|
186 |
|
187 // Destructor |
|
188 CApSelPopupList::~CApSelPopupList() |
|
189 { |
|
190 APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::~CApSelPopupList") |
|
191 |
|
192 if ( iDataModel ) |
|
193 { |
|
194 if ( iDataModel->Database() ) |
|
195 { |
|
196 // must remove observer here as there is a chance that we do not exit |
|
197 // through the standard way but through Leave(KErrLeaveWithoutAlert)... |
|
198 iDataModel->Database()->RemoveObserver( this ); |
|
199 } |
|
200 } |
|
201 |
|
202 if ( iModel ) |
|
203 { |
|
204 iModel->ResetAndDestroy(); |
|
205 delete iModel; |
|
206 } |
|
207 |
|
208 APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::~CApSelPopupList") |
|
209 } |
|
210 |
|
211 |
|
212 |
|
213 // Constructor |
|
214 CApSelPopupList::CApSelPopupList( |
|
215 CApSettingsModel& aModel, |
|
216 CApSettingsHandlerImpl& aHandler, |
|
217 TInt& aIndex, TInt& aPreferredUid, |
|
218 TSelectionMenuType aSelMenuType, |
|
219 TInt aIspFilter, TInt aBearerFilter, |
|
220 TInt aSortType, CDesCArrayFlat* aItemArray, |
|
221 TUint32& aEventStore, TBool aNeedsNone, |
|
222 TBool aNoEdit, |
|
223 TInt aReqIpvType, |
|
224 TVpnFilterType aVpnFilterType |
|
225 ) |
|
226 :CAknRadioButtonSettingPage( R_POPUP_LIST_SETTING_PAGE, |
|
227 aIndex, aItemArray ), |
|
228 iDataModel( &aModel ), |
|
229 iSelected( &aPreferredUid ), |
|
230 iBearerFilter( aBearerFilter ), |
|
231 iIspFilter( aIspFilter ), |
|
232 iSortType( aSortType ), |
|
233 iSelMenuType( aSelMenuType ), |
|
234 iHandler( &aHandler ), |
|
235 iEventStore( &aEventStore ), |
|
236 iPreferredUid( aPreferredUid ), |
|
237 iNeedsNone( aNeedsNone ), |
|
238 iNeedUnlock( EFalse ), |
|
239 iReqIpvType( aReqIpvType ), |
|
240 iVpnFilterType( aVpnFilterType ), |
|
241 iVariant( aHandler.iExt->iVariant ), |
|
242 iIncludeEasyWlan( EFalse ), |
|
243 iNoEdit( aNoEdit ) |
|
244 { |
|
245 } |
|
246 |
|
247 |
|
248 |
|
249 |
|
250 CApSelPopupList::CApSelPopupList( |
|
251 CApSettingsModel& aModel, |
|
252 CApSettingsHandlerImpl& aHandler, |
|
253 TInt& aIndex, TInt& aPreferredUid, |
|
254 TSelectionMenuType aSelMenuType, |
|
255 TInt aIspFilter, TInt aBearerFilter, |
|
256 TInt aSortType, CDesCArrayFlat* aItemArray, |
|
257 TUint32& aEventStore, TBool aNeedsNone, |
|
258 TInt aReqIpvType, |
|
259 TVpnFilterType aVpnFilterType, |
|
260 TBool aIncludeEasyWlan, |
|
261 TBool aNoEdit |
|
262 ) |
|
263 :CAknRadioButtonSettingPage( R_POPUP_LIST_SETTING_PAGE, |
|
264 aIndex, aItemArray ), |
|
265 iDataModel( &aModel ), |
|
266 iSelected( &aPreferredUid ), |
|
267 iBearerFilter( aBearerFilter ), |
|
268 iIspFilter( aIspFilter ), |
|
269 iSortType( aSortType ), |
|
270 iSelMenuType( aSelMenuType ), |
|
271 iHandler( &aHandler ), |
|
272 iEventStore( &aEventStore ), |
|
273 iPreferredUid( aPreferredUid ), |
|
274 iNeedsNone( aNeedsNone ), |
|
275 iNeedUnlock( EFalse ), |
|
276 iReqIpvType( aReqIpvType ), |
|
277 iVpnFilterType( aVpnFilterType ), |
|
278 iVariant( aHandler.iExt->iVariant ), |
|
279 iIncludeEasyWlan( aIncludeEasyWlan ), |
|
280 iInitialised( EFalse ), |
|
281 iNoEdit( aNoEdit ) |
|
282 { |
|
283 } |
|
284 |
|
285 |
|
286 |
|
287 |
|
288 // --------------------------------------------------------- |
|
289 // CApSelPopupList::SetHighlighted() |
|
290 // called when needs to change the highlighting |
|
291 // --------------------------------------------------------- |
|
292 // |
|
293 void CApSelPopupList::SetHighlighted() |
|
294 { |
|
295 APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::SetHighlighted") |
|
296 |
|
297 TInt err( KErrNone ); |
|
298 TInt idx = iModel->Item4Uid( iPreferredUid, err ); |
|
299 |
|
300 // if UID exists, set as current, else set 0 as current. |
|
301 iList->SetCurrentItemIndexAndDraw( err == KErrNone ? idx : 0); |
|
302 |
|
303 APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::SetHighlighted") |
|
304 } |
|
305 |
|
306 |
|
307 // --------------------------------------------------------- |
|
308 // CApSelPopupList::GetHelpContext() |
|
309 // --------------------------------------------------------- |
|
310 // |
|
311 void CApSelPopupList::GetHelpContext(TCoeHelpContext& aContext) const |
|
312 { |
|
313 APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::GetHelpContext") |
|
314 |
|
315 aContext.iMajor = iHandler->iHelpMajor; |
|
316 |
|
317 APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::GetHelpContext") |
|
318 } |
|
319 |
|
320 |
|
321 // --------------------------------------------------------- |
|
322 // CApSelPopupList::HandleApDbEventL |
|
323 // called by the active access point framework |
|
324 // --------------------------------------------------------- |
|
325 // |
|
326 void CApSelPopupList::HandleApDbEventL( TEvent anEvent ) |
|
327 { |
|
328 APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::HandleApDbEventL") |
|
329 |
|
330 switch ( anEvent ) |
|
331 { |
|
332 case EDbChanged: |
|
333 { |
|
334 FillListBoxWithDataL(); |
|
335 break; |
|
336 } |
|
337 case EDbClosing: |
|
338 { |
|
339 break; |
|
340 } |
|
341 case EDbAvailable: |
|
342 { |
|
343 if ( iNeedUnlock ) |
|
344 { |
|
345 FillListBoxWithDataL(); |
|
346 } |
|
347 break; |
|
348 } |
|
349 default: |
|
350 { |
|
351 __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) ); |
|
352 break; |
|
353 } |
|
354 } |
|
355 |
|
356 APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::HandleApDbEventL") |
|
357 } |
|
358 |
|
359 |
|
360 // --------------------------------------------------------- |
|
361 // CApSelPopupList::ActivateL() |
|
362 // called after the dialog is shown |
|
363 // used to handle empty list - query |
|
364 // --------------------------------------------------------- |
|
365 // |
|
366 void CApSelPopupList::ActivateL() |
|
367 { |
|
368 APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::ActivateL") |
|
369 |
|
370 CAknRadioButtonSettingPage::ActivateL(); |
|
371 |
|
372 if (iDoExit) |
|
373 { |
|
374 User::Leave(KErrNone); |
|
375 return; |
|
376 } |
|
377 |
|
378 // put empty list checking & required actions here. |
|
379 CheckIfEmptyL(); |
|
380 |
|
381 APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::ActivateL") |
|
382 } |
|
383 |
|
384 |
|
385 |
|
386 // --------------------------------------------------------- |
|
387 // CApSelPopupList::SelectCurrentItemL() |
|
388 // called after the setting had been changed |
|
389 // --------------------------------------------------------- |
|
390 // |
|
391 void CApSelPopupList::SelectCurrentItemL() |
|
392 { |
|
393 APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::SelectCurrentItemL") |
|
394 |
|
395 CAknRadioButtonSettingPage::SelectCurrentItemL(); |
|
396 TInt idx = iList->CurrentItemIndex(); |
|
397 if ( idx >= 0 ) |
|
398 { |
|
399 *iSelected = iModel->At( idx )->Uid(); |
|
400 } |
|
401 |
|
402 APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::SelectCurrentItemL") |
|
403 } |
|
404 |
|
405 |
|
406 |
|
407 // --------------------------------------------------------- |
|
408 // CApSelPopupList::OkToExitL( TInt aButtonId ) |
|
409 // called by framework when the OK button is pressed |
|
410 // --------------------------------------------------------- |
|
411 // |
|
412 TBool CApSelPopupList::OkToExitL( TInt aButtonId ) |
|
413 { |
|
414 APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::OkToExitL") |
|
415 |
|
416 // Translate the button presses into commands for the appui & current |
|
417 // view to handle. |
|
418 // This is a very good thing, that aButtonId is a TInt, |
|
419 // but the caller ( CAknSettingPage ) simply uses a TBool. |
|
420 // The value of ETrue means the button usually for Yes, Ok, Options, etc |
|
421 // and EFalse means Back, Cancel, etc. |
|
422 // so we must act according to a boolean value and not |
|
423 // according to the real button id... |
|
424 TBool IsAccepted = aButtonId; |
|
425 |
|
426 if ( IsAccepted ) |
|
427 { |
|
428 TInt idx = iList->CurrentItemIndex(); |
|
429 if ( idx >= 0 ) |
|
430 { |
|
431 *iSelected = iModel->At( idx )->Uid(); |
|
432 } |
|
433 } |
|
434 |
|
435 APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::OkToExitL") |
|
436 return ETrue; |
|
437 } |
|
438 |
|
439 |
|
440 |
|
441 // --------------------------------------------------------- |
|
442 // CApSelPopupList::FillListBoxWithDataL() |
|
443 // called when listbox needs to be filled with data |
|
444 // --------------------------------------------------------- |
|
445 // |
|
446 void CApSelPopupList::FillListBoxWithDataL() |
|
447 { |
|
448 APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::FillListBoxWithDataL") |
|
449 |
|
450 iPreferredLine = iList->CurrentItemIndex(); |
|
451 if ( iPreferredLine < 0 ) |
|
452 { |
|
453 iPreferredLine = 0; |
|
454 } |
|
455 |
|
456 TBool isLocked(EFalse); |
|
457 iNeedUnlock = EFalse; |
|
458 iDataModel->AllListItemDataL( isLocked, *iModel, iIspFilter, |
|
459 iBearerFilter, iSortType, iReqIpvType, |
|
460 iVpnFilterType, iIncludeEasyWlan ); |
|
461 if ( isLocked ) |
|
462 { |
|
463 iNeedUnlock = ETrue; |
|
464 } |
|
465 |
|
466 iList->View()->SetDisableRedraw( ETrue ); |
|
467 |
|
468 if ( iNeedsNone ) |
|
469 { |
|
470 HBufC* buf = iEikonEnv->AllocReadResourceLC( R_APUI_VIEW_AP_NONE ); |
|
471 CApListItem* NoneItem = CApListItem::NewLC |
|
472 ( |
|
473 EIspTypeInternetAndWAP, KApNoneUID, |
|
474 *buf, |
|
475 EApBearerTypeHSCSD |
|
476 ); |
|
477 iModel->InsertL( 0, NoneItem ); |
|
478 // as InsertL passes ownership of item to array, |
|
479 // remove from cleanupstack |
|
480 CleanupStack::Pop(); // NoneItem, as ownership is passed to array |
|
481 CleanupStack::PopAndDestroy(); // buf, as item has copied it... |
|
482 } |
|
483 |
|
484 iList->HandleItemAdditionL(); |
|
485 |
|
486 iList->View()->SetDisableRedraw( EFalse ); |
|
487 iList->HandleItemAdditionL(); |
|
488 |
|
489 SetSelectedL(); |
|
490 iPreferredUid = *iSelected; |
|
491 |
|
492 SetHighlighted(); |
|
493 |
|
494 SizeChanged(); |
|
495 DrawNow(); |
|
496 |
|
497 CheckAndSetDataValidity(); |
|
498 UpdateCbaL(); |
|
499 |
|
500 APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::FillListBoxWithDataL") |
|
501 } |
|
502 |
|
503 |
|
504 // --------------------------------------------------------- |
|
505 // CApSelPopupList::SetSelectedL() |
|
506 // --------------------------------------------------------- |
|
507 // |
|
508 void CApSelPopupList::SetSelectedL() |
|
509 { |
|
510 APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::SetSelectedL") |
|
511 |
|
512 TInt i( 0 ); |
|
513 TInt idx( 0 );//set something that does no harm... |
|
514 TInt count = iModel->Count(); |
|
515 for( i=0; i<count; i++ ) |
|
516 { |
|
517 if ( iModel->At( i )->Uid() == TUint32( *iSelected ) ) |
|
518 { |
|
519 idx = i; |
|
520 i = count; |
|
521 } |
|
522 } |
|
523 iList->SetCurrentItemIndexAndDraw( idx ); |
|
524 SelectCurrentItemL(); |
|
525 |
|
526 APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::SetSelectedL") |
|
527 } |
|
528 |
|
529 |
|
530 // --------------------------------------------------------- |
|
531 // CApSelPopupList::CheckIfEmptyL() |
|
532 // --------------------------------------------------------- |
|
533 // |
|
534 void CApSelPopupList::CheckIfEmptyL() |
|
535 { |
|
536 APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::CheckIfEmptyL") |
|
537 |
|
538 if ( !iModel->Count() ) |
|
539 { |
|
540 // no ap defined, create new AP |
|
541 ProcessCommandL( EApSelCmdNewBlank ); |
|
542 } |
|
543 iInitialised = ETrue; |
|
544 |
|
545 APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::CheckIfEmptyL") |
|
546 } |
|
547 |
|
548 |
|
549 |
|
550 // --------------------------------------------------------- |
|
551 // CApSelPopupList::DynInitMenuPaneL |
|
552 // --------------------------------------------------------- |
|
553 // |
|
554 void CApSelPopupList::DynInitMenuPaneL( TInt aResourceId, |
|
555 CEikMenuPane* aMenuPane ) |
|
556 { |
|
557 APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::DynInitMenuPaneL") |
|
558 |
|
559 CAknSettingPage::DynInitMenuPaneL( aResourceId, aMenuPane ); |
|
560 |
|
561 TInt itemCount = iList->Model()->NumberOfItems(); |
|
562 TInt idx = iList->CurrentItemIndex(); |
|
563 TUint32 itemUid(0); |
|
564 if ( itemCount ) |
|
565 { |
|
566 itemUid = iModel->At( idx )->Uid(); |
|
567 } |
|
568 |
|
569 if ( iHandler->iModel->Need2DeleteSelect( aResourceId, itemCount ) ) |
|
570 { |
|
571 aMenuPane->DeleteMenuItem( EApSelCmdSelect ); |
|
572 } |
|
573 |
|
574 if ( iHandler->iModel->Need2DeleteOpen( aResourceId, itemCount, |
|
575 itemUid, iNeedsNone ) ) |
|
576 { |
|
577 aMenuPane->DeleteMenuItem( EApSelCmdOpen ); |
|
578 } |
|
579 if ( iHandler->iModel->Need2DeleteDeleteL( aResourceId, itemCount, |
|
580 itemUid, iNeedsNone ) ) |
|
581 { |
|
582 aMenuPane->DeleteMenuItem( EApSelCmdDelete ); |
|
583 } |
|
584 |
|
585 if ( iHandler->iModel->Need2DeleteNewUseExisting( |
|
586 aResourceId, itemCount ) ) |
|
587 { |
|
588 aMenuPane->DeleteMenuItem( EApSelCmdNewUseExisting ); |
|
589 } |
|
590 if ( iHandler->iModel->Need2DeleteNewL( aResourceId ) ) |
|
591 { |
|
592 aMenuPane->DeleteMenuItem( EApSelCmdNewBlank ); |
|
593 } |
|
594 |
|
595 if ( iHandler->iModel->Need2DeleteHelp( aResourceId ) ) |
|
596 { |
|
597 aMenuPane->DeleteMenuItem( EAknCmdHelp ); |
|
598 } |
|
599 |
|
600 if ( aResourceId == R_APSETTINGSUI_MENU_SELECT_NORMAL ) |
|
601 { |
|
602 if ( iSelMenuType == EApSettingsSelMenuSelectOnly ) |
|
603 { |
|
604 // Disallow other menues by deleting them |
|
605 aMenuPane->DeleteMenuItem( EApSelCmdExit ); |
|
606 } |
|
607 } |
|
608 |
|
609 APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::DynInitMenuPaneL") |
|
610 } |
|
611 |
|
612 |
|
613 // From MEikCommandObserver |
|
614 // --------------------------------------------------------- |
|
615 // CApSelPopupList::ProcessCommandL |
|
616 // --------------------------------------------------------- |
|
617 // |
|
618 void CApSelPopupList::ProcessCommandL( TInt aCommandId ) |
|
619 { |
|
620 APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::ProcessCommandL") |
|
621 |
|
622 if ( MenuShowing() ) |
|
623 { |
|
624 HideMenu(); |
|
625 } |
|
626 |
|
627 switch ( aCommandId ) |
|
628 { |
|
629 case EAknSoftkeyOptions: |
|
630 { |
|
631 DisplayMenuL(); |
|
632 break; |
|
633 } |
|
634 case EAknSoftkeyBack: |
|
635 { |
|
636 AttemptExitL( EFalse ); |
|
637 break; |
|
638 } |
|
639 case EAknSoftkeyCancel: |
|
640 { |
|
641 *iEventStore |= KApUiEventShutDownRequested; |
|
642 AttemptExitL( EFalse ); |
|
643 break; |
|
644 } |
|
645 case EAknSoftkeyOk: |
|
646 case EApSelCmdSelect: |
|
647 { |
|
648 *iEventStore |= KApUiEventSelected; |
|
649 |
|
650 TUint32 currUid = iModel->At( iList->CurrentItemIndex() )->Uid(); |
|
651 if( iPreferredUid != currUid ) |
|
652 { |
|
653 iPreferredUid = currUid; |
|
654 SetHighlighted(); |
|
655 } |
|
656 |
|
657 CAknRadioButtonSettingPage::SelectCurrentItemL(); |
|
658 AttemptExitL( ETrue ); |
|
659 break; |
|
660 } |
|
661 case EApSelCmdOpen: |
|
662 {// as we must be standing on an item, it must exist... |
|
663 // So no problem on iModel->At( ...) |
|
664 iPreferredUid = iModel->At( iList->CurrentItemIndex() )->Uid(); |
|
665 iHandler->DoRunViewerL( iPreferredUid ); |
|
666 SetHighlighted(); |
|
667 break; |
|
668 } |
|
669 case EApSelCmdNew: |
|
670 { |
|
671 break; // starts a submenu, nothing to do here |
|
672 } |
|
673 case EApSelCmdNewBlank: |
|
674 { |
|
675 iPreferredUid = iHandler->HandleApBlankNewL( |
|
676 iBearerFilter, iIspFilter ); |
|
677 SetHighlighted(); |
|
678 break; |
|
679 } |
|
680 case EApSelCmdNewUseExisting: |
|
681 { |
|
682 TUint32 currid = iModel->At( iList->CurrentItemIndex() )->Uid(); |
|
683 iPreferredUid = iHandler->HandleDuplicateL( currid ); |
|
684 SetHighlighted(); |
|
685 break; |
|
686 } |
|
687 case EApSelCmdDelete: |
|
688 { |
|
689 // As it might have been started by the Clear key, |
|
690 // we must check if there is any... |
|
691 TInt cnt = iModel->Count(); |
|
692 if ( ( iNeedsNone & ( cnt > 1 ) ) || ( !iNeedsNone && cnt ) ) |
|
693 { |
|
694 // as we must be standing on an item, it must exists... |
|
695 // So no problem on iModel->At( ...) |
|
696 if ( iList->CurrentItemIndex() < ( iModel->Count()-1 ) ) |
|
697 {// move to next one if possible |
|
698 iPreferredUid = iModel->At( |
|
699 iList->CurrentItemIndex()+1 )->Uid(); |
|
700 } |
|
701 else |
|
702 { // if it is the last, move to previous if possible. |
|
703 // if not, set to 0 |
|
704 if ( iModel->Count()> 1 ) |
|
705 {// move to prev. one if possible |
|
706 iPreferredUid = iModel->At( |
|
707 iList->CurrentItemIndex()-1 )->Uid(); |
|
708 } |
|
709 else |
|
710 { |
|
711 iPreferredUid = 0; |
|
712 } |
|
713 } |
|
714 iHandler->HandleApDeleteCmdL( |
|
715 iModel->At( iList->CurrentItemIndex() )->Uid(), |
|
716 iModel->Count() == (1+iNeedsNone) ); |
|
717 } |
|
718 break; |
|
719 } |
|
720 case EAknCmdHelp: |
|
721 { |
|
722 if ( iHelpSupported ) |
|
723 { |
|
724 iDataModel->LaunchHelpL(); |
|
725 } |
|
726 break; |
|
727 } |
|
728 default: |
|
729 { |
|
730 // silently ignore it |
|
731 break; |
|
732 } |
|
733 } |
|
734 // check if user wants to Exit.... |
|
735 if ( *iEventStore & KApUiEventExitRequested ) |
|
736 { |
|
737 if ( iInitialised ) |
|
738 { |
|
739 AttemptExitL( EFalse ); |
|
740 } |
|
741 else |
|
742 { |
|
743 *iEventStore |= KApUiEventInternal; |
|
744 User::Leave(KLeaveWithoutAlert); |
|
745 } |
|
746 } |
|
747 else |
|
748 { |
|
749 switch ( aCommandId ) |
|
750 { |
|
751 case EApSelCmdExit: |
|
752 { |
|
753 *iEventStore |= KApUiEventExitRequested; |
|
754 AttemptExitL( EFalse ); |
|
755 break; |
|
756 } |
|
757 case EEikCmdExit: |
|
758 { |
|
759 *iEventStore |= KApUiEventShutDownRequested; |
|
760 AttemptExitL( EFalse ); |
|
761 break; |
|
762 } |
|
763 default: |
|
764 { |
|
765 break; |
|
766 } |
|
767 } |
|
768 } |
|
769 |
|
770 APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::ProcessCommandL") |
|
771 } |
|
772 |
|
773 |
|
774 // From MEikListBoxObserver |
|
775 void CApSelPopupList::HandleListBoxEventL( CEikListBox* aListBox, |
|
776 MEikListBoxObserver::TListBoxEvent aEventType ) |
|
777 { |
|
778 APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::HandleListBoxEventL") |
|
779 |
|
780 switch ( aEventType ) |
|
781 { |
|
782 case EEventEnterKeyPressed: |
|
783 case EEventItemDoubleClicked: |
|
784 case EEventItemSingleClicked: |
|
785 { |
|
786 ProcessCommandL( EApSelCmdSelect ); |
|
787 break; |
|
788 } |
|
789 case EEventEditingStarted: |
|
790 { |
|
791 break; |
|
792 } |
|
793 case EEventEditingStopped: |
|
794 { |
|
795 break; |
|
796 } |
|
797 default: |
|
798 { |
|
799 CAknRadioButtonSettingPage::HandleListBoxEventL( aListBox, aEventType ); |
|
800 }; |
|
801 }; |
|
802 |
|
803 APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::HandleListBoxEventL") |
|
804 } |
|
805 |
|
806 |
|
807 // From CCoeControl |
|
808 // --------------------------------------------------------- |
|
809 // CApSelPopupList::OfferKeyEventL |
|
810 // --------------------------------------------------------- |
|
811 // |
|
812 TKeyResponse CApSelPopupList::OfferKeyEventL( const TKeyEvent& aKeyEvent, |
|
813 TEventCode aType) |
|
814 { |
|
815 APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::OfferKeyEventL") |
|
816 |
|
817 TKeyResponse retval; |
|
818 |
|
819 if ( aType == EEventKey ) |
|
820 { |
|
821 if ( ( aKeyEvent.iCode == EKeyDelete ) || |
|
822 ( aKeyEvent.iCode == EKeyBackspace ) ) |
|
823 { |
|
824 if (!iNoEdit) |
|
825 { |
|
826 ProcessCommandL( EApSelCmdDelete ); |
|
827 } |
|
828 retval = EKeyWasConsumed; |
|
829 } |
|
830 else |
|
831 { |
|
832 if ( ( aKeyEvent.iCode == EKeyOK || aKeyEvent.iCode == EKeyEnter ) && |
|
833 ( ( iSelMenuType == EApSettingsSelMenuSelectOnly ) || |
|
834 ( iSelMenuType == EApSettingsSelMenuSelectNormal ) ) ) |
|
835 { // process only if command is available... |
|
836 ProcessCommandL( EApSelCmdSelect ); |
|
837 retval = EKeyWasConsumed; |
|
838 } |
|
839 else |
|
840 { |
|
841 retval = CAknRadioButtonSettingPage::OfferKeyEventL( |
|
842 aKeyEvent, aType ); |
|
843 } |
|
844 } |
|
845 } |
|
846 else |
|
847 { |
|
848 retval = CAknRadioButtonSettingPage::OfferKeyEventL( aKeyEvent, aType ); |
|
849 } |
|
850 |
|
851 APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::OfferKeyEventL") |
|
852 return retval; |
|
853 } |
|
854 |
|
855 |
|
856 |
|
857 |
|
858 // --------------------------------------------------------- |
|
859 // CApSelPopupList::LoadIconsL |
|
860 // --------------------------------------------------------- |
|
861 // |
|
862 TInt CApSelPopupList::LoadIconsL() |
|
863 { |
|
864 APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::LoadIconsL") |
|
865 |
|
866 CArrayPtr< CGulIcon >* icons = |
|
867 iList->ItemDrawer()->FormattedCellData()->IconArray(); |
|
868 |
|
869 TInt count = icons->Count(); |
|
870 |
|
871 MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance(); |
|
872 |
|
873 TParse mbmFile; |
|
874 User::LeaveIfError( mbmFile.Set( KFileIcons, &KDC_APP_BITMAP_DIR, NULL ) ); |
|
875 |
|
876 icons->AppendL( AknsUtils::CreateGulIconL( |
|
877 skinInstance, |
|
878 KAknsIIDQgnPropWmlGprs, |
|
879 mbmFile.FullName(), |
|
880 EMbmApsettingsQgn_prop_wml_gprs, |
|
881 EMbmApsettingsQgn_prop_wml_gprs_mask ) ); |
|
882 |
|
883 icons->AppendL( AknsUtils::CreateGulIconL( |
|
884 skinInstance, |
|
885 KAknsIIDQgnPropWmlCsd, |
|
886 mbmFile.FullName(), |
|
887 EMbmApsettingsQgn_prop_wml_csd, |
|
888 EMbmApsettingsQgn_prop_wml_csd_mask ) ); |
|
889 |
|
890 icons->AppendL( AknsUtils::CreateGulIconL( |
|
891 skinInstance, |
|
892 KAknsIIDQgnPropWmlHscsd, |
|
893 mbmFile.FullName(), |
|
894 EMbmApsettingsQgn_prop_wml_hscsd, |
|
895 EMbmApsettingsQgn_prop_wml_hscsd_mask ) ); |
|
896 |
|
897 icons->AppendL( AknsUtils::CreateGulIconL( |
|
898 skinInstance, |
|
899 KAknsIIDQgnPropWmlSms, |
|
900 mbmFile.FullName(), |
|
901 EMbmApsettingsQgn_prop_wml_sms, |
|
902 EMbmApsettingsQgn_prop_wml_sms_mask ) ); |
|
903 |
|
904 icons->AppendL( AknsUtils::CreateGulIconL( |
|
905 skinInstance, |
|
906 KAknsIIDQgnPropWlanBearer, |
|
907 mbmFile.FullName(), |
|
908 EMbmApsettingsQgn_prop_wlan_bearer, |
|
909 EMbmApsettingsQgn_prop_wlan_bearer_mask ) ); |
|
910 |
|
911 icons->AppendL( AknsUtils::CreateGulIconL( |
|
912 skinInstance, |
|
913 KAknsIIDQgnPropWlanBearer, |
|
914 mbmFile.FullName(), |
|
915 EMbmApsettingsQgn_prop_wlan_easy, |
|
916 EMbmApsettingsQgn_prop_wlan_easy_mask ) ); |
|
917 |
|
918 icons->AppendL( AknsUtils::CreateGulIconL( |
|
919 skinInstance, |
|
920 KAknsIIDQgnIndiSettProtectedAdd, |
|
921 mbmFile.FullName(), |
|
922 EMbmApsettingsQgn_indi_sett_protected_add, |
|
923 EMbmApsettingsQgn_indi_sett_protected_add_mask ) ); |
|
924 |
|
925 APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::LoadIconsL") |
|
926 return count; |
|
927 } |
|
928 |
|
929 |
|
930 |
|
931 |
|
932 // --------------------------------------------------------- |
|
933 // CApSelPopupList::HandleResourceChange |
|
934 // --------------------------------------------------------- |
|
935 // |
|
936 void CApSelPopupList::HandleResourceChange(TInt aType) |
|
937 { |
|
938 APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::HandleResourceChange") |
|
939 |
|
940 if ( aType == KAknsMessageSkinChange ) |
|
941 { |
|
942 iList->HandleResourceChange( aType ); |
|
943 if ( iProtectionSupported ) |
|
944 { |
|
945 TRAP_IGNORE( LoadIconsL() ); |
|
946 } |
|
947 SizeChanged(); |
|
948 } |
|
949 |
|
950 CAknRadioButtonSettingPage::HandleResourceChange( aType ); |
|
951 |
|
952 APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::HandleResourceChange") |
|
953 } |
|
954 |
|
955 // End of File |
|