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