branch | RCL_3 |
changeset 93 | b01126ce0bec |
parent 88 | 3321d3e205b6 |
child 102 | ba63c83f4716 |
88:3321d3e205b6 | 93:b01126ce0bec |
---|---|
38 #include <AknsSkinInstance.h> |
38 #include <AknsSkinInstance.h> |
39 #include <AknIconUtils.h> |
39 #include <AknIconUtils.h> |
40 #include <AknsDrawUtils.h> |
40 #include <AknsDrawUtils.h> |
41 #include <aknenv.h> |
41 #include <aknenv.h> |
42 #include <aknlists.h> |
42 #include <aknlists.h> |
43 #include <aknpopup.h> |
|
44 #include <badesca.h> |
|
43 #include <eikclbd.h> |
45 #include <eikclbd.h> |
44 #include <aknsfld.h> |
46 #include <aknsfld.h> |
45 #include <AknsBasicBackgroundControlContext.h> |
47 #include <AknsBasicBackgroundControlContext.h> |
46 #include <apgcli.h> |
48 #include <apgcli.h> |
47 #include <widgetmanager.mbg> |
49 #include <widgetmanager.mbg> |
61 #include "wmresourceloader.h" |
63 #include "wmresourceloader.h" |
62 #include "widgetmanager.hrh" |
64 #include "widgetmanager.hrh" |
63 #include "wmlistbox.h" |
65 #include "wmlistbox.h" |
64 #include "wmpersistentwidgetorder.h" |
66 #include "wmpersistentwidgetorder.h" |
65 #include "wmdetailsdlg.h" |
67 #include "wmdetailsdlg.h" |
66 #include "wmportalbutton.h" |
68 #include "wmstore.h" |
67 #include "wmwidgetloaderao.h" |
69 #include "wmwidgetloaderao.h" |
68 #include "wmconfiguration.h" |
70 #include "wmconfiguration.h" |
69 #include "wminstaller.h" |
71 #include "wminstaller.h" |
70 |
72 |
71 #include <hscontentcontroller.h> // content control api |
73 #include <hscontentcontroller.h> // content control api |
72 #include <hscontentinfoarray.h> // content control api |
74 #include <hscontentinfoarray.h> // content control api |
73 |
75 |
74 // CONSTANTS |
76 // CONSTANTS |
75 const TInt KTextLimit = 40; // Text-limit for find-field |
77 const TInt KTextLimit = 40; // Text-limit for find-field |
76 const TInt KMinWidgets = 1; // minimum number of widgets to show findpane |
78 const TInt KMinWidgets = 1; // minimum number of widgets to show findpane |
79 |
|
80 // ======== LOCAL FUNCTIONS ======== |
|
81 |
|
82 // ---------------------------------------------------------------------------- |
|
83 // CleanupResetAndDestroy() |
|
84 // ---------------------------------------------------------------------------- |
|
85 // |
|
86 template<class T> |
|
87 static void CleanupResetAndDestroy( TAny* aObj ) |
|
88 { |
|
89 if( aObj ) |
|
90 { |
|
91 static_cast<T*>( aObj )->ResetAndDestroy(); |
|
92 } |
|
93 } |
|
94 |
|
95 // ---------------------------------------------------------------------------- |
|
96 // CleanupResetAndDestroyPushL |
|
97 // ---------------------------------------------------------------------------- |
|
98 // |
|
99 template<class T> |
|
100 static void CleanupResetAndDestroyPushL(T& aArray) |
|
101 { |
|
102 CleanupStack::PushL( TCleanupItem( &CleanupResetAndDestroy<T>, &aArray ) ); |
|
103 } |
|
77 |
104 |
78 // --------------------------------------------------------- |
105 // --------------------------------------------------------- |
79 // CWmMainContainer::CWmMainContainer() |
106 // CWmMainContainer::CWmMainContainer() |
80 // --------------------------------------------------------- |
107 // --------------------------------------------------------- |
81 // |
108 // |
84 { |
111 { |
85 iWidgetsList = NULL; |
112 iWidgetsList = NULL; |
86 iFindbox = NULL; |
113 iFindbox = NULL; |
87 iFindPaneIsVisible = EFalse; |
114 iFindPaneIsVisible = EFalse; |
88 iBgContext = NULL; |
115 iBgContext = NULL; |
89 iFocusMode = ENowhere; |
|
90 iClosingDown = ETrue; |
116 iClosingDown = ETrue; |
91 } |
117 } |
92 |
118 |
93 // --------------------------------------------------------- |
119 // --------------------------------------------------------- |
94 // CWmMainContainer::~CWmMainContainer() |
120 // CWmMainContainer::~CWmMainContainer() |
95 // --------------------------------------------------------- |
121 // --------------------------------------------------------- |
96 // |
122 // |
97 CWmMainContainer::~CWmMainContainer() |
123 CWmMainContainer::~CWmMainContainer() |
98 { |
124 { |
125 if ( iSelectedStore ) |
|
126 { |
|
127 delete iSelectedStore; |
|
128 iSelectedStore = NULL; |
|
129 } |
|
99 TRAP_IGNORE(DeactivateFindPaneL(EFalse)); |
130 TRAP_IGNORE(DeactivateFindPaneL(EFalse)); |
100 |
131 |
101 if ( iWidgetLoader ) |
132 if ( iWidgetLoader ) |
102 { |
133 { |
103 iWidgetLoader->SetObserver( NULL ); |
134 iWidgetLoader->SetObserver( NULL ); |
106 |
137 |
107 RemoveCtrlsFromStack(); |
138 RemoveCtrlsFromStack(); |
108 Components().ResetAndDestroy(); |
139 Components().ResetAndDestroy(); |
109 |
140 |
110 iWidgetsList = NULL; |
141 iWidgetsList = NULL; |
111 iPortalButtonOne = NULL; |
|
112 iPortalButtonTwo = NULL; |
|
113 iFindbox = NULL; |
142 iFindbox = NULL; |
114 delete iBgContext; |
143 delete iBgContext; |
115 delete iConfiguration; |
|
116 } |
144 } |
117 |
145 |
118 // --------------------------------------------------------- |
146 // --------------------------------------------------------- |
119 // CWmMainContainer::NewL |
147 // CWmMainContainer::NewL |
120 // --------------------------------------------------------- |
148 // --------------------------------------------------------- |
177 CreateWindowL(); |
205 CreateWindowL(); |
178 |
206 |
179 // background context |
207 // background context |
180 iBgContext = CAknsBasicBackgroundControlContext::NewL( |
208 iBgContext = CAknsBasicBackgroundControlContext::NewL( |
181 KAknsIIDQsnBgScreen, ScreenRect() , ETrue); |
209 KAknsIIDQsnBgScreen, ScreenRect() , ETrue); |
182 |
|
183 // load configuration |
|
184 iConfiguration = CWmConfiguration::NewL( iWmPlugin.ResourceLoader() ); |
|
185 |
210 |
186 // set up controls |
211 // set up controls |
187 InitializeControlsL( aRect ); |
212 InitializeControlsL( aRect ); |
188 |
213 |
189 // set size and activate |
214 // set size and activate |
209 // |
234 // |
210 void CWmMainContainer::LayoutControls() |
235 void CWmMainContainer::LayoutControls() |
211 { |
236 { |
212 TRect rect( Rect() ); |
237 TRect rect( Rect() ); |
213 |
238 |
214 // determine layout type |
239 // layout iWidgetsList |
215 iLandscape = Layout_Meta_Data::IsLandscapeOrientation(); |
240 if( iFindbox && iFindPaneIsVisible ) |
216 iMirrored = Layout_Meta_Data::IsMirrored(); |
241 { |
217 |
242 iWidgetsList->SetRect( rect ); |
218 // layout iPortalButtons |
243 HandleFindSizeChanged(); |
219 if ( iConfiguration->PortalButtonCount() == 1 ) |
|
220 { |
|
221 // one button |
|
222 TAknWindowLineLayout btnPane = AknLayoutScalable_Apps |
|
223 ::wgtman_btn_pane( iLandscape ? 1 : 0 ).LayoutLine(); |
|
224 AknLayoutUtils::LayoutControl( iPortalButtonOne, rect, btnPane ); |
|
225 } |
244 } |
226 else |
245 else |
227 { |
246 { |
228 // two buttons |
247 TAknWindowLineLayout listPane; |
229 TInt variety = (iLandscape ? 3 : 2); |
248 listPane.il = rect.iTl.iX; |
230 TAknWindowLineLayout oviBtnLayout = AknLayoutScalable_Apps |
249 listPane.it = rect.iTl.iY; |
231 ::wgtman_btn_pane( variety ).LayoutLine(); |
250 listPane.ib = 0; |
232 TAknWindowLineLayout operatorBtnLayout = AknLayoutScalable_Apps |
251 listPane.iH = rect.Height(); |
233 ::wgtman_btn_pane_cp_01( variety ).LayoutLine(); |
252 listPane.iW = rect.Width(); |
234 |
253 listPane.ir = ELayoutEmpty; |
235 // button placement |
|
236 if ( iConfiguration->PortalButtonsMirrored() ) |
|
237 { |
|
238 AknLayoutUtils::LayoutControl( iPortalButtonOne, rect, operatorBtnLayout ); |
|
239 AknLayoutUtils::LayoutControl( iPortalButtonTwo, rect, oviBtnLayout ); |
|
240 } |
|
241 else |
|
242 { |
|
243 AknLayoutUtils::LayoutControl( iPortalButtonOne, rect, oviBtnLayout ); |
|
244 AknLayoutUtils::LayoutControl( iPortalButtonTwo, rect, operatorBtnLayout ); |
|
245 } |
|
246 } |
|
247 |
|
248 // layout iWidgetsList |
|
249 TAknWindowLineLayout listPane = AknLayoutScalable_Apps |
|
250 ::listscroll_wgtman_pane( iLandscape ? 1 : 0 ).LayoutLine(); |
|
251 if( iFindbox && iFindPaneIsVisible ) |
|
252 { |
|
253 TAknLayoutRect layoutRect; |
|
254 layoutRect.LayoutRect( rect, listPane ); |
|
255 iWidgetsList->SetRect( layoutRect.Rect() ); |
|
256 HandleFindSizeChanged(); |
|
257 } |
|
258 else |
|
259 { |
|
260 AknLayoutUtils::LayoutControl( iWidgetsList, rect, listPane ); |
254 AknLayoutUtils::LayoutControl( iWidgetsList, rect, listPane ); |
261 } |
255 } |
262 |
256 |
263 DrawDeferred(); |
257 DrawDeferred(); |
264 } |
258 } |
285 aKeyEvent.iModifiers&EModifierNumLock && |
279 aKeyEvent.iModifiers&EModifierNumLock && |
286 aKeyEvent.iModifiers&EModifierAutorepeatable ) |
280 aKeyEvent.iModifiers&EModifierAutorepeatable ) |
287 { |
281 { |
288 return EKeyWasConsumed; |
282 return EKeyWasConsumed; |
289 } |
283 } |
290 |
284 |
291 // Handle search keyevent |
285 // Handle search keyevent |
292 keyResponse = HandleSearchKeyEventL( aKeyEvent, aType ); |
286 keyResponse = HandleSearchKeyEventL( aKeyEvent, aType ); |
293 |
287 |
294 // Move focus between controls |
|
295 if ( keyResponse == EKeyWasNotConsumed ) |
|
296 { |
|
297 keyResponse = MoveFocusByKeys( aKeyEvent, aType ); |
|
298 } |
|
299 |
|
300 // Handle list keyevent |
288 // Handle list keyevent |
301 if ( keyResponse == EKeyWasNotConsumed ) |
289 if ( keyResponse == EKeyWasNotConsumed ) |
302 { |
290 { |
303 keyResponse = HandleListKeyEventL( aKeyEvent, aType ); |
291 keyResponse = HandleListKeyEventL( aKeyEvent, aType ); |
304 } |
|
305 |
|
306 // Handle buttons keyevent |
|
307 if ( keyResponse == EKeyWasNotConsumed ) |
|
308 { |
|
309 keyResponse = HandleButtonKeyEventL( aKeyEvent, aType ); |
|
310 } |
292 } |
311 |
293 |
312 // Update ui if needed |
294 // Update ui if needed |
313 if ( keyResponse == EKeyWasConsumed ) |
295 if ( keyResponse == EKeyWasConsumed ) |
314 { |
296 { |
384 TEventCode aType ) |
366 TEventCode aType ) |
385 { |
367 { |
386 TKeyResponse keyResponse( EKeyWasNotConsumed ); |
368 TKeyResponse keyResponse( EKeyWasNotConsumed ); |
387 |
369 |
388 // pass key event except backpace or delete key event to widgets list if focused |
370 // pass key event except backpace or delete key event to widgets list if focused |
389 if ( iWidgetsList->IsFocused() ) |
371 if ( ( aType == EEventKey ) && ( aKeyEvent.iCode == EKeyBackspace |
390 { |
372 || aKeyEvent.iCode == EKeyDelete ) ) |
391 if ( ( aType == EEventKey ) && ( aKeyEvent.iCode == EKeyBackspace |
373 { |
392 || aKeyEvent.iCode == EKeyDelete ) ) |
374 if( CanDoUninstall() ) |
393 { |
375 { |
394 if( CanDoUninstall() ) |
376 UninstallWidgetL(); |
395 { |
377 } |
396 UninstallWidgetL(); |
378 else |
397 } |
379 { |
398 else |
380 CWmWidgetData* data = iWidgetsList->WidgetData(); |
399 { |
381 if( data != NULL ) |
400 CWmWidgetData* data = iWidgetsList->WidgetData(); |
382 iWmPlugin.ResourceLoader().InfoPopupL( |
401 if( data != NULL ) |
383 R_QTN_WM_UNINST_NOT_ALLOWED, data->Name() ); |
402 iWmPlugin.ResourceLoader().InfoPopupL( |
384 } |
403 R_QTN_WM_UNINST_NOT_ALLOWED, data->Name() ); |
385 keyResponse = EKeyWasConsumed; |
404 } |
386 } |
405 keyResponse = EKeyWasConsumed; |
387 else |
406 } |
388 { |
407 else |
389 //passing to listbox handler |
408 { |
390 keyResponse = iWidgetsList->OfferKeyEventL( |
409 //passing to listbox handler |
391 aKeyEvent, aType ); |
410 keyResponse = iWidgetsList->OfferKeyEventL( |
|
411 aKeyEvent, aType ); |
|
412 } |
|
413 } |
392 } |
414 |
393 |
415 return keyResponse; |
394 return keyResponse; |
416 } |
|
417 |
|
418 // --------------------------------------------------------- |
|
419 // CWmMainContainer::HandleButtonKeyEventL |
|
420 // --------------------------------------------------------- |
|
421 // |
|
422 TKeyResponse CWmMainContainer::HandleButtonKeyEventL( |
|
423 const TKeyEvent& aKeyEvent, |
|
424 TEventCode aType ) |
|
425 { |
|
426 TKeyResponse keyResponse( EKeyWasNotConsumed ); |
|
427 |
|
428 // pass key event to portal button if focused |
|
429 if ( iPortalButtonOne->IsFocused() ) |
|
430 { |
|
431 keyResponse = iPortalButtonOne->OfferKeyEventL( |
|
432 aKeyEvent, aType ); |
|
433 } |
|
434 |
|
435 // pass key event to the other portal button if exists and focused |
|
436 if ( iPortalButtonTwo && iPortalButtonTwo->IsFocused() ) |
|
437 { |
|
438 keyResponse = iPortalButtonTwo->OfferKeyEventL( |
|
439 aKeyEvent, aType ); |
|
440 } |
|
441 |
|
442 return keyResponse; |
|
443 } |
|
444 |
|
445 // --------------------------------------------------------- |
|
446 // CWmMainContainer::MoveFocusByKeys |
|
447 // --------------------------------------------------------- |
|
448 // |
|
449 TKeyResponse CWmMainContainer::MoveFocusByKeys( |
|
450 const TKeyEvent& aKeyEvent, |
|
451 TEventCode aType ) |
|
452 { |
|
453 TKeyResponse keyResponse( EKeyWasNotConsumed ); |
|
454 |
|
455 if ( iWidgetsList->IsFocused() ) |
|
456 { |
|
457 // ------------------------------------ |
|
458 // focus is in the WIDGETS LIST |
|
459 // ------------------------------------ |
|
460 if ( !iLandscape && |
|
461 aKeyEvent.iScanCode == EStdKeyUpArrow && |
|
462 iWidgetsList->CurrentItemIndex() == 0 ) |
|
463 { |
|
464 // widget list top -> up -> ovi button (portrait) |
|
465 if ( aType == EEventKey ) |
|
466 SetFocusToPortalButton( OperatorButtonHigherPriority ( 0 ) ); |
|
467 keyResponse = EKeyWasConsumed; |
|
468 } |
|
469 else if ( !iLandscape && |
|
470 aKeyEvent.iScanCode == EStdKeyDownArrow && |
|
471 iWidgetsList->CurrentItemIndex() == |
|
472 iWidgetsList->Model()->NumberOfItems() - 1 ) |
|
473 { |
|
474 // widget list bottom -> down -> ovi button (portrait) |
|
475 if ( aType == EEventKey ) |
|
476 SetFocusToPortalButton( OperatorButtonHigherPriority ( 0 ) ); |
|
477 keyResponse = EKeyWasConsumed; |
|
478 } |
|
479 else if ( iLandscape && !iMirrored && |
|
480 aKeyEvent.iScanCode == EStdKeyRightArrow ) |
|
481 { |
|
482 // widget list -> right -> ovi button (landscape normal) |
|
483 if ( aType == EEventKey ) |
|
484 SetFocusToPortalButton( OperatorButtonHigherPriority ( 0 ) ); |
|
485 keyResponse = EKeyWasConsumed; |
|
486 } |
|
487 else if ( iLandscape && iMirrored && |
|
488 aKeyEvent.iScanCode == EStdKeyLeftArrow ) |
|
489 { |
|
490 // widget list -> left -> ovi button (landscape mirrored) |
|
491 if ( aType == EEventKey ) |
|
492 SetFocusToPortalButton( OperatorButtonHigherPriority ( 0 ) ); |
|
493 keyResponse = EKeyWasConsumed; |
|
494 } |
|
495 } |
|
496 else if ( iPortalButtonOne->IsFocused() ) |
|
497 { |
|
498 // ------------------------------------ |
|
499 // focus is in the FIRST PORTAL BUTTON |
|
500 // ------------------------------------ |
|
501 if ( !iLandscape && |
|
502 aKeyEvent.iScanCode == EStdKeyDownArrow ) |
|
503 { |
|
504 // left portal -> down -> widget list top (portrait) |
|
505 if ( aType == EEventKey ) |
|
506 SetFocusToWidgetList( 0 ); |
|
507 keyResponse = EKeyWasConsumed; |
|
508 } |
|
509 else if ( !iLandscape && |
|
510 aKeyEvent.iScanCode == EStdKeyUpArrow ) |
|
511 { |
|
512 // left portal -> up -> widget list bottom (portrait) |
|
513 if ( aType == EEventKey ) |
|
514 SetFocusToWidgetList( iWidgetsList->Model()->NumberOfItems()-1 ); |
|
515 keyResponse = EKeyWasConsumed; |
|
516 } |
|
517 else if ( !iLandscape && !iMirrored && |
|
518 aKeyEvent.iScanCode == EStdKeyLeftArrow && |
|
519 iConfiguration->PortalButtonCount() > 1 && |
|
520 iConfiguration->PortalButtonsMirrored() ) |
|
521 { |
|
522 // right portal -> left -> left portal |
|
523 // (portrait, operator button higher priority ) |
|
524 if ( aType == EEventKey ) |
|
525 SetFocusToPortalButton( 1 ); |
|
526 keyResponse = EKeyWasConsumed; |
|
527 } |
|
528 else if ( !iLandscape && !iMirrored && |
|
529 aKeyEvent.iScanCode == EStdKeyRightArrow && |
|
530 iConfiguration->PortalButtonCount() > 1 && |
|
531 !iConfiguration->PortalButtonsMirrored() ) |
|
532 { |
|
533 // left portal -> right -> right portal (portrait normal) |
|
534 if ( aType == EEventKey ) |
|
535 SetFocusToPortalButton( 1 ); |
|
536 keyResponse = EKeyWasConsumed; |
|
537 } |
|
538 else if ( !iLandscape && iMirrored && |
|
539 aKeyEvent.iScanCode == EStdKeyRightArrow && |
|
540 iConfiguration->PortalButtonCount() > 1 && |
|
541 iConfiguration->PortalButtonsMirrored() ) |
|
542 { |
|
543 // right portal -> left -> left portal (portrait mirrored) |
|
544 if ( aType == EEventKey ) |
|
545 SetFocusToPortalButton( 1 ); |
|
546 keyResponse = EKeyWasConsumed; |
|
547 } |
|
548 else if ( !iLandscape && iMirrored && |
|
549 aKeyEvent.iScanCode == EStdKeyLeftArrow && |
|
550 iConfiguration->PortalButtonCount() > 1 && |
|
551 !iConfiguration->PortalButtonsMirrored() ) |
|
552 { |
|
553 // right portal -> left -> left portal (portrait mirrored) |
|
554 if ( aType == EEventKey ) |
|
555 SetFocusToPortalButton( 1 ); |
|
556 keyResponse = EKeyWasConsumed; |
|
557 } |
|
558 else if ( iLandscape && !iMirrored && |
|
559 aKeyEvent.iScanCode == EStdKeyLeftArrow ) |
|
560 { |
|
561 // upper portal -> left -> widget list (landscape normal) |
|
562 if ( aType == EEventKey ) |
|
563 SetFocusToWidgetList(); |
|
564 keyResponse = EKeyWasConsumed; |
|
565 } |
|
566 else if ( iLandscape && iMirrored && |
|
567 aKeyEvent.iScanCode == EStdKeyRightArrow ) |
|
568 { |
|
569 // upper portal -> right -> widget list (landscape mirrored) |
|
570 if ( aType == EEventKey ) |
|
571 SetFocusToWidgetList(); |
|
572 keyResponse = EKeyWasConsumed; |
|
573 } |
|
574 else if ( iLandscape && |
|
575 aKeyEvent.iScanCode == EStdKeyUpArrow && |
|
576 iConfiguration->PortalButtonCount() > 1 && |
|
577 iConfiguration->PortalButtonsMirrored() ) |
|
578 { |
|
579 // lower portal -> up -> upper portal |
|
580 // (landscape, operator button higher priority ) |
|
581 if ( aType == EEventKey ) |
|
582 SetFocusToPortalButton( 1 ); |
|
583 keyResponse = EKeyWasConsumed; |
|
584 } |
|
585 else if ( iLandscape && |
|
586 aKeyEvent.iScanCode == EStdKeyDownArrow && |
|
587 iConfiguration->PortalButtonCount() > 1 && |
|
588 !iConfiguration->PortalButtonsMirrored() ) |
|
589 { |
|
590 // upper portal -> down -> lower portal (landscape) |
|
591 if ( aType == EEventKey ) |
|
592 SetFocusToPortalButton( 1 ); |
|
593 keyResponse = EKeyWasConsumed; |
|
594 } |
|
595 } |
|
596 else if ( iPortalButtonTwo && iPortalButtonTwo->IsFocused() ) |
|
597 { |
|
598 // ------------------------------------ |
|
599 // focus is in the SECOND PORTAL BUTTON |
|
600 // ------------------------------------ |
|
601 if ( !iLandscape && |
|
602 aKeyEvent.iScanCode == EStdKeyDownArrow ) |
|
603 { |
|
604 // right portal -> down -> widget list top (portrait) |
|
605 if ( aType == EEventKey ) |
|
606 SetFocusToWidgetList( 0 ); |
|
607 keyResponse = EKeyWasConsumed; |
|
608 } |
|
609 else if ( !iLandscape && |
|
610 aKeyEvent.iScanCode == EStdKeyUpArrow ) |
|
611 { |
|
612 // right portal -> up -> widget list bottom (portrait) |
|
613 if ( aType == EEventKey ) |
|
614 SetFocusToWidgetList( iWidgetsList->Model()->NumberOfItems()-1 ); |
|
615 keyResponse = EKeyWasConsumed; |
|
616 } |
|
617 else if ( !iLandscape && !iMirrored && |
|
618 aKeyEvent.iScanCode == EStdKeyRightArrow && |
|
619 iConfiguration->PortalButtonCount() > 1 && |
|
620 iConfiguration->PortalButtonsMirrored() ) |
|
621 { |
|
622 // left portal -> right -> right portal |
|
623 // (portrait, operator button higher priority ) |
|
624 if ( aType == EEventKey ) |
|
625 SetFocusToPortalButton( 0 ); |
|
626 keyResponse = EKeyWasConsumed; |
|
627 } |
|
628 else if ( !iLandscape && !iMirrored && |
|
629 aKeyEvent.iScanCode == EStdKeyLeftArrow && |
|
630 iConfiguration->PortalButtonCount() > 1 && |
|
631 !iConfiguration->PortalButtonsMirrored() ) |
|
632 { |
|
633 // right portal -> left -> left portal (portrait normal) |
|
634 if ( aType == EEventKey ) |
|
635 SetFocusToPortalButton( 0 ); |
|
636 keyResponse = EKeyWasConsumed; |
|
637 } |
|
638 else if ( !iLandscape && iMirrored && |
|
639 aKeyEvent.iScanCode == EStdKeyLeftArrow && |
|
640 iConfiguration->PortalButtonCount() > 1 && |
|
641 iConfiguration->PortalButtonsMirrored() ) |
|
642 { |
|
643 // left portal -> right -> right portal (portrait mirrored) |
|
644 if ( aType == EEventKey ) |
|
645 SetFocusToPortalButton( 0 ); |
|
646 keyResponse = EKeyWasConsumed; |
|
647 } |
|
648 else if ( !iLandscape && iMirrored && |
|
649 aKeyEvent.iScanCode == EStdKeyRightArrow && |
|
650 iConfiguration->PortalButtonCount() > 1 && |
|
651 !iConfiguration->PortalButtonsMirrored() ) |
|
652 { |
|
653 // left portal -> right -> right portal (portrait mirrored) |
|
654 if ( aType == EEventKey ) |
|
655 SetFocusToPortalButton( 0 ); |
|
656 keyResponse = EKeyWasConsumed; |
|
657 } |
|
658 else if ( iLandscape && !iMirrored && |
|
659 aKeyEvent.iScanCode == EStdKeyLeftArrow ) |
|
660 { |
|
661 // lower portal -> left -> widget list (landscape normal) |
|
662 if ( aType == EEventKey ) |
|
663 SetFocusToWidgetList(); |
|
664 keyResponse = EKeyWasConsumed; |
|
665 } |
|
666 else if ( iLandscape && iMirrored && |
|
667 aKeyEvent.iScanCode == EStdKeyRightArrow ) |
|
668 { |
|
669 // lower portal -> right -> widget list (landscape mirrored) |
|
670 if ( aType == EEventKey ) |
|
671 SetFocusToWidgetList(); |
|
672 keyResponse = EKeyWasConsumed; |
|
673 } |
|
674 else if ( iLandscape && |
|
675 aKeyEvent.iScanCode == EStdKeyDownArrow && |
|
676 iConfiguration->PortalButtonsMirrored() ) |
|
677 { |
|
678 // upper portal -> down -> lower portal |
|
679 // ( landscape operator button higher priority ) |
|
680 if ( aType == EEventKey ) |
|
681 SetFocusToPortalButton( 0 ); |
|
682 keyResponse = EKeyWasConsumed; |
|
683 } |
|
684 else if ( iLandscape && |
|
685 aKeyEvent.iScanCode == EStdKeyUpArrow && |
|
686 !iConfiguration->PortalButtonsMirrored() ) |
|
687 { |
|
688 // lower portal -> up -> upper portal (landscape) |
|
689 if ( aType == EEventKey ) |
|
690 SetFocusToPortalButton( 0 ); |
|
691 keyResponse = EKeyWasConsumed; |
|
692 } |
|
693 } |
|
694 else |
|
695 { |
|
696 // ------------------------------------ |
|
697 // focus is NOWHERE |
|
698 // ------------------------------------ |
|
699 if ( aKeyEvent.iScanCode == EStdKeyUpArrow || |
|
700 aKeyEvent.iScanCode == EStdKeyDownArrow ) |
|
701 { |
|
702 // no focus -> key hit -> focus list |
|
703 if ( aType == EEventKey ) |
|
704 { |
|
705 SetFocusToWidgetList(); |
|
706 keyResponse = EKeyWasNotConsumed; |
|
707 } |
|
708 } |
|
709 } |
|
710 |
|
711 return keyResponse; |
|
712 } |
|
713 |
|
714 |
|
715 // --------------------------------------------------------- |
|
716 // CWmMainContainer::OperatorButtonHigherPriority |
|
717 // --------------------------------------------------------- |
|
718 // |
|
719 TInt CWmMainContainer::OperatorButtonHigherPriority( TInt aIndex ) |
|
720 { |
|
721 TInt ret = aIndex; |
|
722 if ( iConfiguration->PortalButtonsMirrored() ) |
|
723 { |
|
724 if ( aIndex == 0 ) |
|
725 { |
|
726 ret = 1; |
|
727 } |
|
728 else if ( aIndex == 1 ) |
|
729 { |
|
730 ret = 0; |
|
731 } |
|
732 } |
|
733 return ret; |
|
734 } |
|
735 |
|
736 // --------------------------------------------------------- |
|
737 // CWmMainContainer::SetFocusToPortalButton |
|
738 // --------------------------------------------------------- |
|
739 // |
|
740 void CWmMainContainer::SetFocusToPortalButton( TInt aIndex ) |
|
741 { |
|
742 if ( aIndex != 0 && iPortalButtonTwo ) |
|
743 { |
|
744 iWidgetsList->SetFocus(EFalse); |
|
745 iPortalButtonOne->SetFocus(EFalse); |
|
746 iPortalButtonTwo->SetFocus(ETrue); |
|
747 } |
|
748 else |
|
749 { |
|
750 iWidgetsList->SetFocus(EFalse); |
|
751 if ( iPortalButtonTwo ) |
|
752 iPortalButtonTwo->SetFocus(EFalse); |
|
753 iPortalButtonOne->SetFocus(ETrue); |
|
754 } |
|
755 DrawDeferred(); |
|
756 UpdateFocusMode(); |
|
757 } |
|
758 |
|
759 // --------------------------------------------------------- |
|
760 // CWmMainContainer::SetFocusToWidgetList |
|
761 // --------------------------------------------------------- |
|
762 // |
|
763 void CWmMainContainer::SetFocusToWidgetList( TInt aIndex ) |
|
764 { |
|
765 iPortalButtonOne->SetFocus(EFalse); |
|
766 if ( iPortalButtonTwo ) |
|
767 iPortalButtonTwo->SetFocus(EFalse); |
|
768 if ( aIndex >= 0 && aIndex < iWidgetsList->Model()->NumberOfItems() ) |
|
769 { |
|
770 iWidgetsList->SetCurrentItemIndex( aIndex ); |
|
771 } |
|
772 iWidgetsList->SetFocus(ETrue); |
|
773 DrawDeferred(); |
|
774 UpdateFocusMode(); |
|
775 } |
|
776 |
|
777 // --------------------------------------------------------- |
|
778 // CWmMainContainer::UpdateFocusMode |
|
779 // --------------------------------------------------------- |
|
780 // |
|
781 void CWmMainContainer::UpdateFocusMode() |
|
782 { |
|
783 if ( iPortalButtonOne->IsFocused() ) |
|
784 { |
|
785 // PORTAL BUTTON is focused |
|
786 iFocusMode = EPortal; |
|
787 } |
|
788 else if ( iPortalButtonTwo && iPortalButtonTwo->IsFocused() ) |
|
789 { |
|
790 // SECOND PORTAL BUTTON is focused |
|
791 iFocusMode = EPortal; |
|
792 } |
|
793 else if( ( iFindPaneIsVisible ) && |
|
794 ( iFindbox->IsFocused() || iWidgetsList->IsFocused() ) ) |
|
795 { |
|
796 // FIND MODE |
|
797 iFocusMode = EFind; |
|
798 } |
|
799 else if ( iWidgetsList->IsFocused() ) |
|
800 { |
|
801 // WIDGETS LIST is focused |
|
802 iFocusMode = EList; |
|
803 } |
|
804 else |
|
805 { |
|
806 // NO focus |
|
807 iFocusMode = ENowhere; |
|
808 } |
|
809 } |
395 } |
810 |
396 |
811 // --------------------------------------------------------- |
397 // --------------------------------------------------------- |
812 // CWmMainContainer::FindChildControlByPoint |
398 // CWmMainContainer::FindChildControlByPoint |
813 // --------------------------------------------------------- |
399 // --------------------------------------------------------- |
856 } |
442 } |
857 |
443 |
858 // Set focus to the control that was clicked |
444 // Set focus to the control that was clicked |
859 control->SetFocus( ETrue ); |
445 control->SetFocus( ETrue ); |
860 |
446 |
861 // update focus mode accordingly |
|
862 UpdateFocusMode(); |
|
863 // repaint |
447 // repaint |
864 DrawDeferred(); |
448 DrawDeferred(); |
865 } |
449 } |
866 |
450 |
867 // stylus popup should not be opened when uninstalling. |
451 // stylus popup should not be opened when uninstalling. |
901 // CWmMainContainer::InitializeControlsL |
485 // CWmMainContainer::InitializeControlsL |
902 // --------------------------------------------------------- |
486 // --------------------------------------------------------- |
903 // |
487 // |
904 void CWmMainContainer::InitializeControlsL( const TRect& /*aRect*/ ) |
488 void CWmMainContainer::InitializeControlsL( const TRect& /*aRect*/ ) |
905 { |
489 { |
906 // Create portal buttons |
|
907 iPortalButtonOne = CWmPortalButton::NewL( this, 0 ); |
|
908 iPortalButtonOne->SetMopParent( this ); |
|
909 AddControlL( iPortalButtonOne, EPortalOne ); |
|
910 if ( iConfiguration->PortalButtonCount() > 1 ) |
|
911 { |
|
912 iPortalButtonTwo = CWmPortalButton::NewL( this, 1 ); |
|
913 iPortalButtonTwo->SetMopParent( this ); |
|
914 AddControlL( iPortalButtonTwo, EPortalTwo ); |
|
915 } |
|
916 |
|
917 // Create widget list box |
490 // Create widget list box |
918 iWidgetsList = CWmListBox::NewL( |
491 iWidgetsList = CWmListBox::NewL( |
919 iWmPlugin, |
492 iWmPlugin, |
920 TRect(), |
493 TRect(), |
921 this ); |
494 this ); |
933 // search field |
506 // search field |
934 iFindbox = CAknSearchField::NewL( *this, |
507 iFindbox = CAknSearchField::NewL( *this, |
935 CAknSearchField::EAdaptiveSearch, |
508 CAknSearchField::EAdaptiveSearch, |
936 0, KTextLimit ); |
509 0, KTextLimit ); |
937 AddControlL( iFindbox, EFindBox ); |
510 AddControlL( iFindbox, EFindBox ); |
938 |
511 iFindbox->AddAdaptiveSearchTextObserverL(this); |
939 UpdateFocusMode(); |
512 |
940 StartLoadingWidgetsL(); |
513 StartLoadingWidgetsL(); |
941 } |
514 } |
942 |
515 |
943 // --------------------------------------------------------- |
516 // --------------------------------------------------------- |
944 // CWmMainContainer::HandleWidgetListChanged |
517 // CWmMainContainer::HandleWidgetListChanged |
1043 return ((iWidgetLoader && iWidgetLoader->IsLoading()) ? |
616 return ((iWidgetLoader && iWidgetLoader->IsLoading()) ? |
1044 ETrue : EFalse); |
617 ETrue : EFalse); |
1045 } |
618 } |
1046 |
619 |
1047 // --------------------------------------------------------- |
620 // --------------------------------------------------------- |
1048 // CWmMainContainer::PortalSelected |
|
1049 // --------------------------------------------------------- |
|
1050 // |
|
1051 TBool CWmMainContainer::PortalSelected() |
|
1052 { |
|
1053 return ( iFocusMode == EPortal ); |
|
1054 } |
|
1055 |
|
1056 // --------------------------------------------------------- |
|
1057 // CWmMainContainer::WidgetSelected |
621 // CWmMainContainer::WidgetSelected |
1058 // --------------------------------------------------------- |
622 // --------------------------------------------------------- |
1059 // |
623 // |
1060 TBool CWmMainContainer::WidgetSelected() |
624 TBool CWmMainContainer::WidgetSelected() |
1061 { |
625 { |
1062 return ( iFocusMode == EList ) || ( iFocusMode == EFind ); |
626 return (( iWidgetsList->IsFocused() || iWidgetsList->IsHighlightEnabled())? |
627 ETrue : EFalse ); |
|
1063 } |
628 } |
1064 |
629 |
1065 // --------------------------------------------------------- |
630 // --------------------------------------------------------- |
1066 // CWmMainContainer::CanDoAdd |
631 // CWmMainContainer::CanDoAdd |
1067 // --------------------------------------------------------- |
632 // --------------------------------------------------------- |
1215 void CWmMainContainer::ActivateFindPaneL( TBool aActivateAdaptive ) |
780 void CWmMainContainer::ActivateFindPaneL( TBool aActivateAdaptive ) |
1216 { |
781 { |
1217 if ( iFindbox && !iFindPaneIsVisible && |
782 if ( iFindbox && !iFindPaneIsVisible && |
1218 iWidgetsList->Model()->NumberOfItems() > KMinWidgets ) |
783 iWidgetsList->Model()->NumberOfItems() > KMinWidgets ) |
1219 { |
784 { |
1220 // set focus |
|
1221 if ( iWidgetsList->ItemDrawer()->Flags() |
|
1222 & CListItemDrawer::ESingleClickDisabledHighlight ) |
|
1223 { |
|
1224 ResetFocus(); |
|
1225 } |
|
1226 else |
|
1227 { |
|
1228 iWidgetsList->SetFocus( ETrue, EDrawNow ); |
|
1229 } |
|
1230 |
|
1231 |
|
1232 // set column filter flag |
785 // set column filter flag |
1233 TBitFlags32 bitFlag; |
786 TBitFlags32 bitFlag; |
1234 bitFlag.ClearAll(); // clear all columns |
787 bitFlag.ClearAll(); // clear all columns |
1235 bitFlag.Assign( 1,1 ); // turn on column at index one |
788 bitFlag.Assign( 1,1 ); // turn on column at index one |
1236 iFindbox->SetListColumnFilterFlags( bitFlag ); |
789 iFindbox->SetListColumnFilterFlags( bitFlag ); |
1261 { |
814 { |
1262 iFindbox->ShowAdaptiveSearchGrid(); |
815 iFindbox->ShowAdaptiveSearchGrid(); |
1263 } |
816 } |
1264 iFindbox->SetFocus( ETrue ); |
817 iFindbox->SetFocus( ETrue ); |
1265 iWidgetsList->SetFindPaneIsVisible( ETrue ); |
818 iWidgetsList->SetFindPaneIsVisible( ETrue ); |
1266 |
819 |
1267 // set soft key set |
820 if ( AknLayoutUtils::MSKEnabled() ) |
1268 CEikButtonGroupContainer* cbaGroup = |
821 { |
1269 CEikButtonGroupContainer::Current(); |
822 // set soft key set |
1270 cbaGroup->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_CANCEL__SELECT ); |
823 CEikButtonGroupContainer* cbaGroup = |
1271 cbaGroup->DrawNow(); |
824 CEikButtonGroupContainer::Current(); |
1272 |
825 TInt cbaResourceId = ( ( iWmPlugin.Configuration().StoreCount() > 0 )? |
1273 UpdateFocusMode(); |
826 R_WM_SOFTKEYS_OPTIONS_CANCEL__STORE : |
827 R_AVKON_SOFTKEYS_OPTIONS_CANCEL__SELECT ); |
|
828 cbaGroup->SetCommandSetL( cbaResourceId ); |
|
829 cbaGroup->DrawNow(); |
|
830 } |
|
1274 } |
831 } |
1275 } |
832 } |
1276 |
833 |
1277 // --------------------------------------------------------------------------- |
834 // --------------------------------------------------------------------------- |
1278 // CWmMainContainer::DeactivateFindPaneL |
835 // CWmMainContainer::DeactivateFindPaneL |
1296 { |
853 { |
1297 m->Filter()->ResetFilteringL(); |
854 m->Filter()->ResetFilteringL(); |
1298 m->RemoveFilter(); |
855 m->RemoveFilter(); |
1299 } |
856 } |
1300 |
857 |
1301 //set focus |
|
1302 if ( iWidgetsList->ItemDrawer()->Flags() |
|
1303 & CListItemDrawer::ESingleClickDisabledHighlight ) |
|
1304 { |
|
1305 ResetFocus(); |
|
1306 } |
|
1307 else |
|
1308 { |
|
1309 iWidgetsList->SetFocus( ETrue, EDrawNow ); |
|
1310 } |
|
1311 |
|
1312 iFindbox->MakeVisible( EFalse ); |
858 iFindbox->MakeVisible( EFalse ); |
1313 iFindPaneIsVisible = EFalse; |
859 iFindPaneIsVisible = EFalse; |
1314 iWidgetsList->SetFindPaneIsVisible( EFalse ); |
860 iWidgetsList->SetFindPaneIsVisible( EFalse ); |
1315 |
861 |
1316 |
862 |
1317 // set soft key set |
863 // set soft key set |
1318 CEikButtonGroupContainer* cbaGroup = |
864 CEikButtonGroupContainer* cbaGroup = |
1319 CEikButtonGroupContainer::Current(); |
865 CEikButtonGroupContainer::Current(); |
1320 TInt cbaResourceId = ( AknLayoutUtils::MSKEnabled() ? |
866 TInt cbaResourceId = ( ( AknLayoutUtils::MSKEnabled() && |
1321 R_AVKON_SOFTKEYS_OPTIONS_BACK__SELECT : |
867 iWmPlugin.Configuration().StoreCount() > 0 )? |
868 R_WM_SOFTKEYS_OPTIONS_BACK__STORE : |
|
1322 R_AVKON_SOFTKEYS_OPTIONS_BACK ); |
869 R_AVKON_SOFTKEYS_OPTIONS_BACK ); |
1323 cbaGroup->SetCommandSetL( cbaResourceId ); |
870 cbaGroup->SetCommandSetL( cbaResourceId ); |
1324 |
871 |
1325 if (aLayout) //no need to draw UI if exiting list |
872 if (aLayout) //no need to draw UI if exiting list |
1326 { |
873 { |
1327 LayoutControls(); |
874 LayoutControls(); |
1328 cbaGroup->DrawNow(); |
875 cbaGroup->DrawNow(); |
1329 |
876 |
1330 UpdateFocusMode(); |
|
1331 DrawNow(); |
877 DrawNow(); |
1332 } |
878 } |
1333 } |
879 } |
1334 } |
880 } |
1335 |
881 |
1379 } |
925 } |
1380 } |
926 } |
1381 } |
927 } |
1382 |
928 |
1383 // --------------------------------------------------------------------------- |
929 // --------------------------------------------------------------------------- |
1384 // CWmMainContainer::OpenPortalL |
930 // CWmMainContainer::HandleStoreCommandL |
1385 // --------------------------------------------------------------------------- |
931 // --------------------------------------------------------------------------- |
1386 // |
932 // |
1387 void CWmMainContainer::OpenPortalL() |
933 void CWmMainContainer::HandleStoreCommandL() |
1388 { |
934 { |
1389 if ( !iClosingDown ) |
935 delete iSelectedStore; |
1390 { |
936 iSelectedStore = NULL; |
1391 // execute whichever of the portal buttons happens to be active |
937 |
1392 if ( iPortalButtonOne->IsFocused() ) |
938 const RPointerArray<CWmConfItem>& storeConfArray = |
1393 iPortalButtonOne->ExecuteL(); |
939 iWmPlugin.Configuration().StoreConfArray(); |
1394 else if ( iPortalButtonTwo && iPortalButtonTwo->IsFocused() ) |
940 |
1395 iPortalButtonTwo->ExecuteL(); |
941 if ( storeConfArray.Count() == 1 ) |
1396 else if ( !iPortalButtonTwo ) |
942 { |
1397 iPortalButtonOne->ExecuteL(); |
943 iSelectedStore = CWmStore::NewL( *storeConfArray[0], |
1398 } |
944 iWmPlugin.ResourceLoader() ); |
1399 } |
945 |
1400 |
946 iSelectedStore->ExecuteL(); |
1401 // --------------------------------------------------------------------------- |
947 } |
1402 // CWmMainContainer::SelectL |
948 else if ( storeConfArray.Count() > 1 ) |
1403 // --------------------------------------------------------------------------- |
949 { |
1404 // |
950 DisplayAndLaunchStoresL(); |
1405 void CWmMainContainer::SelectL() |
951 } |
1406 { |
|
1407 if ( WidgetSelected() ) |
|
1408 AddWidgetToHomeScreenL(); |
|
1409 else if ( PortalSelected() ) |
|
1410 OpenPortalL(); |
|
1411 else |
952 else |
1412 SetFocusToWidgetList(); |
953 { |
954 // do nothing |
|
955 } |
|
1413 } |
956 } |
1414 |
957 |
1415 // --------------------------------------------------------------------------- |
958 // --------------------------------------------------------------------------- |
1416 // CWmMainContainer::ShowHelpL |
959 // CWmMainContainer::ShowHelpL |
1417 // --------------------------------------------------------------------------- |
960 // --------------------------------------------------------------------------- |
1497 |
1040 |
1498 if ( dlg && dlg->ExecuteLD() == ECbaAddToHs ) |
1041 if ( dlg && dlg->ExecuteLD() == ECbaAddToHs ) |
1499 { |
1042 { |
1500 AddWidgetToHomeScreenL(); |
1043 AddWidgetToHomeScreenL(); |
1501 } |
1044 } |
1502 else |
|
1503 { |
|
1504 if ( iWidgetsList->ItemDrawer()->Flags() |
|
1505 & CListItemDrawer::ESingleClickDisabledHighlight ) |
|
1506 { |
|
1507 ResetFocus(); |
|
1508 } |
|
1509 else |
|
1510 { |
|
1511 iWidgetsList->SetFocus( ETrue, EDrawNow ); |
|
1512 UpdateFocusMode(); |
|
1513 } |
|
1514 } |
|
1515 } |
1045 } |
1516 } |
1046 } |
1517 |
1047 |
1518 // ---------------------------------------------------- |
1048 // ---------------------------------------------------- |
1519 // CWmMainContainer::SetClosingDown |
1049 // CWmMainContainer::SetClosingDown |
1529 // ---------------------------------------------------- |
1059 // ---------------------------------------------------- |
1530 // |
1060 // |
1531 TBool CWmMainContainer::ClosingDown() |
1061 TBool CWmMainContainer::ClosingDown() |
1532 { |
1062 { |
1533 return iClosingDown; |
1063 return iClosingDown; |
1534 } |
|
1535 |
|
1536 // ---------------------------------------------------- |
|
1537 // CWmMainContainer::Configuration |
|
1538 // ---------------------------------------------------- |
|
1539 // |
|
1540 CWmConfiguration& CWmMainContainer::Configuration() |
|
1541 { |
|
1542 return *iConfiguration; |
|
1543 } |
1064 } |
1544 |
1065 |
1545 // ---------------------------------------------------- |
1066 // ---------------------------------------------------- |
1546 // CWmMainContainer::HandleFindSizeChanged |
1067 // CWmMainContainer::HandleFindSizeChanged |
1547 // ---------------------------------------------------- |
1068 // ---------------------------------------------------- |
1570 |
1091 |
1571 iWidgetsList->DrawNow(); |
1092 iWidgetsList->DrawNow(); |
1572 } |
1093 } |
1573 |
1094 |
1574 // ---------------------------------------------------- |
1095 // ---------------------------------------------------- |
1575 // CWmMainContainer::ProcessForegroundEvent |
|
1576 // ---------------------------------------------------- |
|
1577 // |
|
1578 void CWmMainContainer::ProcessForegroundEvent( TBool aForeground ) |
|
1579 { |
|
1580 if ( iFindbox && iFindPaneIsVisible && |
|
1581 iFindbox->IsFocused() ) |
|
1582 { |
|
1583 // keep focus & do nothing |
|
1584 } |
|
1585 else if ( aForeground ) |
|
1586 { |
|
1587 // set init state when wm comes to foreground. |
|
1588 // remove focus from all controls when activating view. |
|
1589 ResetFocus( EDrawNow ); |
|
1590 } |
|
1591 } |
|
1592 |
|
1593 // ---------------------------------------------------- |
|
1594 // CWmMainContainer::ResetFocus |
|
1595 // ---------------------------------------------------- |
|
1596 // |
|
1597 void CWmMainContainer::ResetFocus( TDrawNow aDrawNow ) |
|
1598 { |
|
1599 CCoeControl* control = NULL; |
|
1600 CCoeControlArray::TCursor cursor = Components().Begin(); |
|
1601 while( ( control = cursor.Control<CCoeControl>() ) != NULL ) |
|
1602 { |
|
1603 if( control->IsVisible() && control->IsFocused() ) |
|
1604 { |
|
1605 control->SetFocus( EFalse, aDrawNow ); |
|
1606 } |
|
1607 cursor.Next(); |
|
1608 } |
|
1609 UpdateFocusMode(); |
|
1610 } |
|
1611 |
|
1612 // ---------------------------------------------------- |
|
1613 // CWmMainContainer::WmListBox |
1096 // CWmMainContainer::WmListBox |
1614 // ---------------------------------------------------- |
1097 // ---------------------------------------------------- |
1615 // |
1098 // |
1616 CWmListBox& CWmMainContainer::WmListBox() |
1099 CWmListBox& CWmMainContainer::WmListBox() |
1617 { |
1100 { |
1627 CCoeControl::FocusChanged( aDrawNow ); |
1110 CCoeControl::FocusChanged( aDrawNow ); |
1628 |
1111 |
1629 if ( iFindbox && iFindPaneIsVisible && |
1112 if ( iFindbox && iFindPaneIsVisible && |
1630 !iFindbox->IsFocused() && IsFocused() ) |
1113 !iFindbox->IsFocused() && IsFocused() ) |
1631 { |
1114 { |
1632 // reset focus to find pane if its lost ( ou1cimx1#308019 ) |
1115 // set focus to find pane if its lost ( ou1cimx1#308019 ) |
1633 ResetFocus(); |
|
1634 iFindbox->SetFocus( ETrue ); |
1116 iFindbox->SetFocus( ETrue ); |
1635 UpdateFocusMode(); |
|
1636 } |
1117 } |
1637 } |
1118 } |
1638 |
1119 |
1639 // ---------------------------------------------------- |
1120 // ---------------------------------------------------- |
1640 // CWmMainContainer::AdaptiveSearchTextChanged |
1121 // CWmMainContainer::AdaptiveSearchTextChanged |
1663 m->Filter()->HandleItemArrayChangeL(); |
1144 m->Filter()->HandleItemArrayChangeL(); |
1664 } |
1145 } |
1665 } |
1146 } |
1666 } |
1147 } |
1667 |
1148 |
1149 // ---------------------------------------------------------- |
|
1150 // CWmMainContainer::CleanupIconArray |
|
1151 // ---------------------------------------------------------- |
|
1152 // |
|
1153 void CWmMainContainer::CleanupIconArray( TAny* aIconArray ) |
|
1154 { |
|
1155 CArrayPtrFlat<CGulIcon>* icons = (CArrayPtrFlat<CGulIcon>*)aIconArray; |
|
1156 icons->ResetAndDestroy(); |
|
1157 delete icons; |
|
1158 } |
|
1159 |
|
1160 // ---------------------------------------------------- |
|
1161 // CWmMainContainer::DisplayAndLaunchStoresL |
|
1162 // ---------------------------------------------------- |
|
1163 // |
|
1164 void CWmMainContainer::DisplayAndLaunchStoresL() |
|
1165 { |
|
1166 // prepare stores |
|
1167 RPointerArray<CWmStore> storesArray; |
|
1168 CleanupResetAndDestroyPushL( storesArray ); |
|
1169 |
|
1170 const RPointerArray<CWmConfItem>& storeConfArray = |
|
1171 iWmPlugin.Configuration().StoreConfArray(); |
|
1172 |
|
1173 for( TInt i = 0; i < storeConfArray.Count(); i++ ) |
|
1174 { |
|
1175 CWmStore* store = CWmStore::NewL( *storeConfArray[i], |
|
1176 iWmPlugin.ResourceLoader() ); |
|
1177 CleanupStack::PushL( store ); |
|
1178 storesArray.AppendL( store ); |
|
1179 CleanupStack::Pop( store ); |
|
1180 } |
|
1181 |
|
1182 CEikFormattedCellListBox* listBox = |
|
1183 new (ELeave) CAknDoubleLargeGraphicPopupMenuStyleListBox(); |
|
1184 CleanupStack::PushL( listBox ); |
|
1185 |
|
1186 CAknPopupList* popupList = CAknPopupList::NewL( |
|
1187 listBox, R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT, |
|
1188 AknPopupLayouts::EMenuDoubleLargeGraphicWindow ); |
|
1189 |
|
1190 CleanupStack::PushL( popupList ); |
|
1191 |
|
1192 listBox->ConstructL( popupList, EAknListBoxMenuList ); |
|
1193 listBox->CreateScrollBarFrameL(ETrue); |
|
1194 listBox->ScrollBarFrame()->SetScrollBarVisibilityL( |
|
1195 CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto); |
|
1196 |
|
1197 // set title |
|
1198 HBufC* title = StringLoader::LoadLC( R_QTN_WM_STORELIST_TITLE ); |
|
1199 popupList->SetTitleL( *title ); |
|
1200 CleanupStack::PopAndDestroy(); // title |
|
1201 |
|
1202 // format str |
|
1203 _LIT( KFormatStr , "%d\t%S" ); |
|
1204 |
|
1205 // items array |
|
1206 CDesCArray* itemArray = |
|
1207 static_cast<CDesCArray*>( listBox->Model()->ItemTextArray( ) ); |
|
1208 |
|
1209 // create icons array |
|
1210 CArrayPtr<CGulIcon>* iconarray = new (ELeave) CArrayPtrFlat<CGulIcon>( 2 ); |
|
1211 CleanupStack::PushL( TCleanupItem( CleanupIconArray, iconarray) ); |
|
1212 |
|
1213 for ( TInt i=0; i < storesArray.Count(); i++ ) |
|
1214 { |
|
1215 // prepare icon |
|
1216 CGulIcon* icon = CGulIcon::NewL( storesArray[i]->StoreIcon(), |
|
1217 storesArray[i]->StoreMask() ); |
|
1218 CleanupStack::PushL( icon ); |
|
1219 icon->SetBitmapsOwnedExternally( ETrue ); |
|
1220 iconarray->AppendL( icon ); |
|
1221 CleanupStack::Pop( icon ); |
|
1222 |
|
1223 // add store to items array |
|
1224 HBufC* buf = HBufC::NewLC( |
|
1225 storesArray[i]->Heading().Length() + |
|
1226 KFormatStr().Length() ); |
|
1227 |
|
1228 TPtr ptr = buf->Des(); |
|
1229 ptr.Format( KFormatStr(), i, &storesArray[i]->Heading() ); |
|
1230 itemArray->AppendL( ptr ); |
|
1231 CleanupStack::PopAndDestroy( buf ); |
|
1232 } |
|
1233 |
|
1234 CleanupStack::Pop(); // iconarray |
|
1235 listBox->ItemDrawer()->ColumnData()->SetIconArrayL( iconarray ); |
|
1236 |
|
1237 TBool result = popupList->ExecuteLD(); |
|
1238 CleanupStack::Pop(); // popupList ( deleted in ExecuteLD) |
|
1239 |
|
1240 TInt selection = listBox->CurrentItemIndex(); |
|
1241 CleanupStack::PopAndDestroy(); // listBox |
|
1242 |
|
1243 if ( result && selection >= 0 && |
|
1244 selection < storesArray.Count() ) |
|
1245 { |
|
1246 iSelectedStore = storesArray[selection]; |
|
1247 if ( iSelectedStore ) |
|
1248 { |
|
1249 storesArray.Remove( selection ); |
|
1250 iSelectedStore->ExecuteL(); |
|
1251 } |
|
1252 } |
|
1253 |
|
1254 CleanupStack::PopAndDestroy(); //storesArray |
|
1255 } |
|
1256 |
|
1668 // End of File |
1257 // End of File |
1669 |
1258 |