branch | RCL_3 |
changeset 102 | ba63c83f4716 |
parent 93 | b01126ce0bec |
93:b01126ce0bec | 102:ba63c83f4716 |
---|---|
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> |
|
45 #include <eikclbd.h> |
43 #include <eikclbd.h> |
46 #include <aknsfld.h> |
44 #include <aknsfld.h> |
47 #include <AknsBasicBackgroundControlContext.h> |
45 #include <AknsBasicBackgroundControlContext.h> |
48 #include <apgcli.h> |
46 #include <apgcli.h> |
49 #include <widgetmanager.mbg> |
47 #include <widgetmanager.mbg> |
63 #include "wmresourceloader.h" |
61 #include "wmresourceloader.h" |
64 #include "widgetmanager.hrh" |
62 #include "widgetmanager.hrh" |
65 #include "wmlistbox.h" |
63 #include "wmlistbox.h" |
66 #include "wmpersistentwidgetorder.h" |
64 #include "wmpersistentwidgetorder.h" |
67 #include "wmdetailsdlg.h" |
65 #include "wmdetailsdlg.h" |
68 #include "wmstore.h" |
66 #include "wmportalbutton.h" |
69 #include "wmwidgetloaderao.h" |
67 #include "wmwidgetloaderao.h" |
70 #include "wmconfiguration.h" |
68 #include "wmconfiguration.h" |
71 #include "wminstaller.h" |
69 #include "wminstaller.h" |
72 |
70 |
73 #include <hscontentcontroller.h> // content control api |
71 #include <hscontentcontroller.h> // content control api |
74 #include <hscontentinfoarray.h> // content control api |
72 #include <hscontentinfoarray.h> // content control api |
75 |
73 |
76 // CONSTANTS |
74 // CONSTANTS |
77 const TInt KTextLimit = 40; // Text-limit for find-field |
75 const TInt KTextLimit = 40; // Text-limit for find-field |
78 const TInt KMinWidgets = 1; // minimum number of widgets to show findpane |
76 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 } |
|
104 |
77 |
105 // --------------------------------------------------------- |
78 // --------------------------------------------------------- |
106 // CWmMainContainer::CWmMainContainer() |
79 // CWmMainContainer::CWmMainContainer() |
107 // --------------------------------------------------------- |
80 // --------------------------------------------------------- |
108 // |
81 // |
111 { |
84 { |
112 iWidgetsList = NULL; |
85 iWidgetsList = NULL; |
113 iFindbox = NULL; |
86 iFindbox = NULL; |
114 iFindPaneIsVisible = EFalse; |
87 iFindPaneIsVisible = EFalse; |
115 iBgContext = NULL; |
88 iBgContext = NULL; |
89 iFocusMode = ENowhere; |
|
116 iClosingDown = ETrue; |
90 iClosingDown = ETrue; |
117 } |
91 } |
118 |
92 |
119 // --------------------------------------------------------- |
93 // --------------------------------------------------------- |
120 // CWmMainContainer::~CWmMainContainer() |
94 // CWmMainContainer::~CWmMainContainer() |
121 // --------------------------------------------------------- |
95 // --------------------------------------------------------- |
122 // |
96 // |
123 CWmMainContainer::~CWmMainContainer() |
97 CWmMainContainer::~CWmMainContainer() |
124 { |
98 { |
125 if ( iSelectedStore ) |
|
126 { |
|
127 delete iSelectedStore; |
|
128 iSelectedStore = NULL; |
|
129 } |
|
130 TRAP_IGNORE(DeactivateFindPaneL(EFalse)); |
99 TRAP_IGNORE(DeactivateFindPaneL(EFalse)); |
131 |
100 |
132 if ( iWidgetLoader ) |
101 if ( iWidgetLoader ) |
133 { |
102 { |
134 iWidgetLoader->SetObserver( NULL ); |
103 iWidgetLoader->SetObserver( NULL ); |
137 |
106 |
138 RemoveCtrlsFromStack(); |
107 RemoveCtrlsFromStack(); |
139 Components().ResetAndDestroy(); |
108 Components().ResetAndDestroy(); |
140 |
109 |
141 iWidgetsList = NULL; |
110 iWidgetsList = NULL; |
111 iPortalButtonOne = NULL; |
|
112 iPortalButtonTwo = NULL; |
|
142 iFindbox = NULL; |
113 iFindbox = NULL; |
143 delete iBgContext; |
114 delete iBgContext; |
115 delete iConfiguration; |
|
144 } |
116 } |
145 |
117 |
146 // --------------------------------------------------------- |
118 // --------------------------------------------------------- |
147 // CWmMainContainer::NewL |
119 // CWmMainContainer::NewL |
148 // --------------------------------------------------------- |
120 // --------------------------------------------------------- |
205 CreateWindowL(); |
177 CreateWindowL(); |
206 |
178 |
207 // background context |
179 // background context |
208 iBgContext = CAknsBasicBackgroundControlContext::NewL( |
180 iBgContext = CAknsBasicBackgroundControlContext::NewL( |
209 KAknsIIDQsnBgScreen, ScreenRect() , ETrue); |
181 KAknsIIDQsnBgScreen, ScreenRect() , ETrue); |
182 |
|
183 // load configuration |
|
184 iConfiguration = CWmConfiguration::NewL( iWmPlugin.ResourceLoader() ); |
|
210 |
185 |
211 // set up controls |
186 // set up controls |
212 InitializeControlsL( aRect ); |
187 InitializeControlsL( aRect ); |
213 |
188 |
214 // set size and activate |
189 // set size and activate |
234 // |
209 // |
235 void CWmMainContainer::LayoutControls() |
210 void CWmMainContainer::LayoutControls() |
236 { |
211 { |
237 TRect rect( Rect() ); |
212 TRect rect( Rect() ); |
238 |
213 |
214 // determine layout type |
|
215 iLandscape = Layout_Meta_Data::IsLandscapeOrientation(); |
|
216 iMirrored = Layout_Meta_Data::IsMirrored(); |
|
217 |
|
218 // layout iPortalButtons |
|
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 } |
|
226 else |
|
227 { |
|
228 // two buttons |
|
229 TInt variety = (iLandscape ? 3 : 2); |
|
230 TAknWindowLineLayout oviBtnLayout = AknLayoutScalable_Apps |
|
231 ::wgtman_btn_pane( variety ).LayoutLine(); |
|
232 TAknWindowLineLayout operatorBtnLayout = AknLayoutScalable_Apps |
|
233 ::wgtman_btn_pane_cp_01( variety ).LayoutLine(); |
|
234 |
|
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 |
|
239 // layout iWidgetsList |
248 // layout iWidgetsList |
249 TAknWindowLineLayout listPane = AknLayoutScalable_Apps |
|
250 ::listscroll_wgtman_pane( iLandscape ? 1 : 0 ).LayoutLine(); |
|
240 if( iFindbox && iFindPaneIsVisible ) |
251 if( iFindbox && iFindPaneIsVisible ) |
241 { |
252 { |
242 iWidgetsList->SetRect( rect ); |
253 TAknLayoutRect layoutRect; |
254 layoutRect.LayoutRect( rect, listPane ); |
|
255 iWidgetsList->SetRect( layoutRect.Rect() ); |
|
243 HandleFindSizeChanged(); |
256 HandleFindSizeChanged(); |
244 } |
257 } |
245 else |
258 else |
246 { |
259 { |
247 TAknWindowLineLayout listPane; |
|
248 listPane.il = rect.iTl.iX; |
|
249 listPane.it = rect.iTl.iY; |
|
250 listPane.ib = 0; |
|
251 listPane.iH = rect.Height(); |
|
252 listPane.iW = rect.Width(); |
|
253 listPane.ir = ELayoutEmpty; |
|
254 AknLayoutUtils::LayoutControl( iWidgetsList, rect, listPane ); |
260 AknLayoutUtils::LayoutControl( iWidgetsList, rect, listPane ); |
255 } |
261 } |
256 |
262 |
257 DrawDeferred(); |
263 DrawDeferred(); |
258 } |
264 } |
279 aKeyEvent.iModifiers&EModifierNumLock && |
285 aKeyEvent.iModifiers&EModifierNumLock && |
280 aKeyEvent.iModifiers&EModifierAutorepeatable ) |
286 aKeyEvent.iModifiers&EModifierAutorepeatable ) |
281 { |
287 { |
282 return EKeyWasConsumed; |
288 return EKeyWasConsumed; |
283 } |
289 } |
284 |
290 |
285 // Handle search keyevent |
291 // Handle search keyevent |
286 keyResponse = HandleSearchKeyEventL( aKeyEvent, aType ); |
292 keyResponse = HandleSearchKeyEventL( aKeyEvent, aType ); |
287 |
293 |
294 // Move focus between controls |
|
295 if ( keyResponse == EKeyWasNotConsumed ) |
|
296 { |
|
297 keyResponse = MoveFocusByKeys( aKeyEvent, aType ); |
|
298 } |
|
299 |
|
288 // Handle list keyevent |
300 // Handle list keyevent |
289 if ( keyResponse == EKeyWasNotConsumed ) |
301 if ( keyResponse == EKeyWasNotConsumed ) |
290 { |
302 { |
291 keyResponse = HandleListKeyEventL( aKeyEvent, aType ); |
303 keyResponse = HandleListKeyEventL( aKeyEvent, aType ); |
304 } |
|
305 |
|
306 // Handle buttons keyevent |
|
307 if ( keyResponse == EKeyWasNotConsumed ) |
|
308 { |
|
309 keyResponse = HandleButtonKeyEventL( aKeyEvent, aType ); |
|
292 } |
310 } |
293 |
311 |
294 // Update ui if needed |
312 // Update ui if needed |
295 if ( keyResponse == EKeyWasConsumed ) |
313 if ( keyResponse == EKeyWasConsumed ) |
296 { |
314 { |
366 TEventCode aType ) |
384 TEventCode aType ) |
367 { |
385 { |
368 TKeyResponse keyResponse( EKeyWasNotConsumed ); |
386 TKeyResponse keyResponse( EKeyWasNotConsumed ); |
369 |
387 |
370 // pass key event except backpace or delete key event to widgets list if focused |
388 // pass key event except backpace or delete key event to widgets list if focused |
371 if ( ( aType == EEventKey ) && ( aKeyEvent.iCode == EKeyBackspace |
389 if ( iWidgetsList->IsFocused() ) |
372 || aKeyEvent.iCode == EKeyDelete ) ) |
390 { |
373 { |
391 if ( ( aType == EEventKey ) && ( aKeyEvent.iCode == EKeyBackspace |
374 if( CanDoUninstall() ) |
392 || aKeyEvent.iCode == EKeyDelete ) ) |
375 { |
393 { |
376 UninstallWidgetL(); |
394 if( CanDoUninstall() ) |
377 } |
395 { |
378 else |
396 UninstallWidgetL(); |
379 { |
397 } |
380 CWmWidgetData* data = iWidgetsList->WidgetData(); |
398 else |
381 if( data != NULL ) |
399 { |
382 iWmPlugin.ResourceLoader().InfoPopupL( |
400 CWmWidgetData* data = iWidgetsList->WidgetData(); |
383 R_QTN_WM_UNINST_NOT_ALLOWED, data->Name() ); |
401 if( data != NULL ) |
384 } |
402 iWmPlugin.ResourceLoader().InfoPopupL( |
385 keyResponse = EKeyWasConsumed; |
403 R_QTN_WM_UNINST_NOT_ALLOWED, data->Name() ); |
386 } |
404 } |
387 else |
405 keyResponse = EKeyWasConsumed; |
388 { |
406 } |
389 //passing to listbox handler |
407 else |
390 keyResponse = iWidgetsList->OfferKeyEventL( |
408 { |
391 aKeyEvent, aType ); |
409 //passing to listbox handler |
410 keyResponse = iWidgetsList->OfferKeyEventL( |
|
411 aKeyEvent, aType ); |
|
412 } |
|
392 } |
413 } |
393 |
414 |
394 return keyResponse; |
415 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 } |
|
395 } |
809 } |
396 |
810 |
397 // --------------------------------------------------------- |
811 // --------------------------------------------------------- |
398 // CWmMainContainer::FindChildControlByPoint |
812 // CWmMainContainer::FindChildControlByPoint |
399 // --------------------------------------------------------- |
813 // --------------------------------------------------------- |
442 } |
856 } |
443 |
857 |
444 // Set focus to the control that was clicked |
858 // Set focus to the control that was clicked |
445 control->SetFocus( ETrue ); |
859 control->SetFocus( ETrue ); |
446 |
860 |
861 // update focus mode accordingly |
|
862 UpdateFocusMode(); |
|
447 // repaint |
863 // repaint |
448 DrawDeferred(); |
864 DrawDeferred(); |
449 } |
865 } |
450 |
866 |
451 // stylus popup should not be opened when uninstalling. |
867 // stylus popup should not be opened when uninstalling. |
485 // CWmMainContainer::InitializeControlsL |
901 // CWmMainContainer::InitializeControlsL |
486 // --------------------------------------------------------- |
902 // --------------------------------------------------------- |
487 // |
903 // |
488 void CWmMainContainer::InitializeControlsL( const TRect& /*aRect*/ ) |
904 void CWmMainContainer::InitializeControlsL( const TRect& /*aRect*/ ) |
489 { |
905 { |
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 |
|
490 // Create widget list box |
917 // Create widget list box |
491 iWidgetsList = CWmListBox::NewL( |
918 iWidgetsList = CWmListBox::NewL( |
492 iWmPlugin, |
919 iWmPlugin, |
493 TRect(), |
920 TRect(), |
494 this ); |
921 this ); |
507 iFindbox = CAknSearchField::NewL( *this, |
934 iFindbox = CAknSearchField::NewL( *this, |
508 CAknSearchField::EAdaptiveSearch, |
935 CAknSearchField::EAdaptiveSearch, |
509 0, KTextLimit ); |
936 0, KTextLimit ); |
510 AddControlL( iFindbox, EFindBox ); |
937 AddControlL( iFindbox, EFindBox ); |
511 iFindbox->AddAdaptiveSearchTextObserverL(this); |
938 iFindbox->AddAdaptiveSearchTextObserverL(this); |
512 |
939 |
940 UpdateFocusMode(); |
|
513 StartLoadingWidgetsL(); |
941 StartLoadingWidgetsL(); |
514 } |
942 } |
515 |
943 |
516 // --------------------------------------------------------- |
944 // --------------------------------------------------------- |
517 // CWmMainContainer::HandleWidgetListChanged |
945 // CWmMainContainer::HandleWidgetListChanged |
616 return ((iWidgetLoader && iWidgetLoader->IsLoading()) ? |
1044 return ((iWidgetLoader && iWidgetLoader->IsLoading()) ? |
617 ETrue : EFalse); |
1045 ETrue : EFalse); |
618 } |
1046 } |
619 |
1047 |
620 // --------------------------------------------------------- |
1048 // --------------------------------------------------------- |
1049 // CWmMainContainer::PortalSelected |
|
1050 // --------------------------------------------------------- |
|
1051 // |
|
1052 TBool CWmMainContainer::PortalSelected() |
|
1053 { |
|
1054 return ( iFocusMode == EPortal ); |
|
1055 } |
|
1056 |
|
1057 // --------------------------------------------------------- |
|
621 // CWmMainContainer::WidgetSelected |
1058 // CWmMainContainer::WidgetSelected |
622 // --------------------------------------------------------- |
1059 // --------------------------------------------------------- |
623 // |
1060 // |
624 TBool CWmMainContainer::WidgetSelected() |
1061 TBool CWmMainContainer::WidgetSelected() |
625 { |
1062 { |
626 return (( iWidgetsList->IsFocused() || iWidgetsList->IsHighlightEnabled())? |
1063 return ( iFocusMode == EList ) || ( iFocusMode == EFind ); |
627 ETrue : EFalse ); |
|
628 } |
1064 } |
629 |
1065 |
630 // --------------------------------------------------------- |
1066 // --------------------------------------------------------- |
631 // CWmMainContainer::CanDoAdd |
1067 // CWmMainContainer::CanDoAdd |
632 // --------------------------------------------------------- |
1068 // --------------------------------------------------------- |
780 void CWmMainContainer::ActivateFindPaneL( TBool aActivateAdaptive ) |
1216 void CWmMainContainer::ActivateFindPaneL( TBool aActivateAdaptive ) |
781 { |
1217 { |
782 if ( iFindbox && !iFindPaneIsVisible && |
1218 if ( iFindbox && !iFindPaneIsVisible && |
783 iWidgetsList->Model()->NumberOfItems() > KMinWidgets ) |
1219 iWidgetsList->Model()->NumberOfItems() > KMinWidgets ) |
784 { |
1220 { |
1221 // set focus |
|
1222 if ( iWidgetsList->ItemDrawer()->Flags() |
|
1223 & CListItemDrawer::ESingleClickDisabledHighlight ) |
|
1224 { |
|
1225 ResetFocus(); |
|
1226 } |
|
1227 else |
|
1228 { |
|
1229 iWidgetsList->SetFocus( ETrue, EDrawNow ); |
|
1230 } |
|
1231 |
|
1232 |
|
785 // set column filter flag |
1233 // set column filter flag |
786 TBitFlags32 bitFlag; |
1234 TBitFlags32 bitFlag; |
787 bitFlag.ClearAll(); // clear all columns |
1235 bitFlag.ClearAll(); // clear all columns |
788 bitFlag.Assign( 1,1 ); // turn on column at index one |
1236 bitFlag.Assign( 1,1 ); // turn on column at index one |
789 iFindbox->SetListColumnFilterFlags( bitFlag ); |
1237 iFindbox->SetListColumnFilterFlags( bitFlag ); |
814 { |
1262 { |
815 iFindbox->ShowAdaptiveSearchGrid(); |
1263 iFindbox->ShowAdaptiveSearchGrid(); |
816 } |
1264 } |
817 iFindbox->SetFocus( ETrue ); |
1265 iFindbox->SetFocus( ETrue ); |
818 iWidgetsList->SetFindPaneIsVisible( ETrue ); |
1266 iWidgetsList->SetFindPaneIsVisible( ETrue ); |
819 |
1267 |
820 if ( AknLayoutUtils::MSKEnabled() ) |
1268 // set soft key set |
821 { |
1269 CEikButtonGroupContainer* cbaGroup = |
822 // set soft key set |
1270 CEikButtonGroupContainer::Current(); |
823 CEikButtonGroupContainer* cbaGroup = |
1271 cbaGroup->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_CANCEL__SELECT ); |
824 CEikButtonGroupContainer::Current(); |
1272 cbaGroup->DrawNow(); |
825 TInt cbaResourceId = ( ( iWmPlugin.Configuration().StoreCount() > 0 )? |
1273 |
826 R_WM_SOFTKEYS_OPTIONS_CANCEL__STORE : |
1274 UpdateFocusMode(); |
827 R_AVKON_SOFTKEYS_OPTIONS_CANCEL__SELECT ); |
|
828 cbaGroup->SetCommandSetL( cbaResourceId ); |
|
829 cbaGroup->DrawNow(); |
|
830 } |
|
831 } |
1275 } |
832 } |
1276 } |
833 |
1277 |
834 // --------------------------------------------------------------------------- |
1278 // --------------------------------------------------------------------------- |
835 // CWmMainContainer::DeactivateFindPaneL |
1279 // CWmMainContainer::DeactivateFindPaneL |
853 { |
1297 { |
854 m->Filter()->ResetFilteringL(); |
1298 m->Filter()->ResetFilteringL(); |
855 m->RemoveFilter(); |
1299 m->RemoveFilter(); |
856 } |
1300 } |
857 |
1301 |
1302 //set focus |
|
1303 if ( iWidgetsList->ItemDrawer()->Flags() |
|
1304 & CListItemDrawer::ESingleClickDisabledHighlight ) |
|
1305 { |
|
1306 ResetFocus(); |
|
1307 } |
|
1308 else |
|
1309 { |
|
1310 iWidgetsList->SetFocus( ETrue, EDrawNow ); |
|
1311 } |
|
1312 |
|
858 iFindbox->MakeVisible( EFalse ); |
1313 iFindbox->MakeVisible( EFalse ); |
859 iFindPaneIsVisible = EFalse; |
1314 iFindPaneIsVisible = EFalse; |
860 iWidgetsList->SetFindPaneIsVisible( EFalse ); |
1315 iWidgetsList->SetFindPaneIsVisible( EFalse ); |
861 |
1316 |
862 |
1317 |
863 // set soft key set |
1318 // set soft key set |
864 CEikButtonGroupContainer* cbaGroup = |
1319 CEikButtonGroupContainer* cbaGroup = |
865 CEikButtonGroupContainer::Current(); |
1320 CEikButtonGroupContainer::Current(); |
866 TInt cbaResourceId = ( ( AknLayoutUtils::MSKEnabled() && |
1321 TInt cbaResourceId = ( AknLayoutUtils::MSKEnabled() ? |
867 iWmPlugin.Configuration().StoreCount() > 0 )? |
1322 R_AVKON_SOFTKEYS_OPTIONS_BACK__SELECT : |
868 R_WM_SOFTKEYS_OPTIONS_BACK__STORE : |
|
869 R_AVKON_SOFTKEYS_OPTIONS_BACK ); |
1323 R_AVKON_SOFTKEYS_OPTIONS_BACK ); |
870 cbaGroup->SetCommandSetL( cbaResourceId ); |
1324 cbaGroup->SetCommandSetL( cbaResourceId ); |
871 |
1325 |
872 if (aLayout) //no need to draw UI if exiting list |
1326 if (aLayout) //no need to draw UI if exiting list |
873 { |
1327 { |
874 LayoutControls(); |
1328 LayoutControls(); |
875 cbaGroup->DrawNow(); |
1329 cbaGroup->DrawNow(); |
876 |
1330 |
1331 UpdateFocusMode(); |
|
877 DrawNow(); |
1332 DrawNow(); |
878 } |
1333 } |
879 } |
1334 } |
880 } |
1335 } |
881 |
1336 |
925 } |
1380 } |
926 } |
1381 } |
927 } |
1382 } |
928 |
1383 |
929 // --------------------------------------------------------------------------- |
1384 // --------------------------------------------------------------------------- |
930 // CWmMainContainer::HandleStoreCommandL |
1385 // CWmMainContainer::OpenPortalL |
931 // --------------------------------------------------------------------------- |
1386 // --------------------------------------------------------------------------- |
932 // |
1387 // |
933 void CWmMainContainer::HandleStoreCommandL() |
1388 void CWmMainContainer::OpenPortalL() |
934 { |
1389 { |
935 delete iSelectedStore; |
1390 if ( !iClosingDown ) |
936 iSelectedStore = NULL; |
1391 { |
937 |
1392 // execute whichever of the portal buttons happens to be active |
938 const RPointerArray<CWmConfItem>& storeConfArray = |
1393 if ( iPortalButtonOne->IsFocused() ) |
939 iWmPlugin.Configuration().StoreConfArray(); |
1394 iPortalButtonOne->ExecuteL(); |
940 |
1395 else if ( iPortalButtonTwo && iPortalButtonTwo->IsFocused() ) |
941 if ( storeConfArray.Count() == 1 ) |
1396 iPortalButtonTwo->ExecuteL(); |
942 { |
1397 else if ( !iPortalButtonTwo ) |
943 iSelectedStore = CWmStore::NewL( *storeConfArray[0], |
1398 iPortalButtonOne->ExecuteL(); |
944 iWmPlugin.ResourceLoader() ); |
1399 } |
945 |
1400 } |
946 iSelectedStore->ExecuteL(); |
1401 |
947 } |
1402 // --------------------------------------------------------------------------- |
948 else if ( storeConfArray.Count() > 1 ) |
1403 // CWmMainContainer::SelectL |
949 { |
1404 // --------------------------------------------------------------------------- |
950 DisplayAndLaunchStoresL(); |
1405 // |
951 } |
1406 void CWmMainContainer::SelectL() |
1407 { |
|
1408 if ( WidgetSelected() ) |
|
1409 AddWidgetToHomeScreenL(); |
|
1410 else if ( PortalSelected() ) |
|
1411 OpenPortalL(); |
|
952 else |
1412 else |
953 { |
1413 SetFocusToWidgetList(); |
954 // do nothing |
|
955 } |
|
956 } |
1414 } |
957 |
1415 |
958 // --------------------------------------------------------------------------- |
1416 // --------------------------------------------------------------------------- |
959 // CWmMainContainer::ShowHelpL |
1417 // CWmMainContainer::ShowHelpL |
960 // --------------------------------------------------------------------------- |
1418 // --------------------------------------------------------------------------- |
1040 |
1498 |
1041 if ( dlg && dlg->ExecuteLD() == ECbaAddToHs ) |
1499 if ( dlg && dlg->ExecuteLD() == ECbaAddToHs ) |
1042 { |
1500 { |
1043 AddWidgetToHomeScreenL(); |
1501 AddWidgetToHomeScreenL(); |
1044 } |
1502 } |
1503 else |
|
1504 { |
|
1505 if ( iWidgetsList->ItemDrawer()->Flags() |
|
1506 & CListItemDrawer::ESingleClickDisabledHighlight ) |
|
1507 { |
|
1508 ResetFocus(); |
|
1509 } |
|
1510 else |
|
1511 { |
|
1512 iWidgetsList->SetFocus( ETrue, EDrawNow ); |
|
1513 UpdateFocusMode(); |
|
1514 } |
|
1515 } |
|
1045 } |
1516 } |
1046 } |
1517 } |
1047 |
1518 |
1048 // ---------------------------------------------------- |
1519 // ---------------------------------------------------- |
1049 // CWmMainContainer::SetClosingDown |
1520 // CWmMainContainer::SetClosingDown |
1059 // ---------------------------------------------------- |
1530 // ---------------------------------------------------- |
1060 // |
1531 // |
1061 TBool CWmMainContainer::ClosingDown() |
1532 TBool CWmMainContainer::ClosingDown() |
1062 { |
1533 { |
1063 return iClosingDown; |
1534 return iClosingDown; |
1535 } |
|
1536 |
|
1537 // ---------------------------------------------------- |
|
1538 // CWmMainContainer::Configuration |
|
1539 // ---------------------------------------------------- |
|
1540 // |
|
1541 CWmConfiguration& CWmMainContainer::Configuration() |
|
1542 { |
|
1543 return *iConfiguration; |
|
1064 } |
1544 } |
1065 |
1545 |
1066 // ---------------------------------------------------- |
1546 // ---------------------------------------------------- |
1067 // CWmMainContainer::HandleFindSizeChanged |
1547 // CWmMainContainer::HandleFindSizeChanged |
1068 // ---------------------------------------------------- |
1548 // ---------------------------------------------------- |
1091 |
1571 |
1092 iWidgetsList->DrawNow(); |
1572 iWidgetsList->DrawNow(); |
1093 } |
1573 } |
1094 |
1574 |
1095 // ---------------------------------------------------- |
1575 // ---------------------------------------------------- |
1576 // CWmMainContainer::ProcessForegroundEvent |
|
1577 // ---------------------------------------------------- |
|
1578 // |
|
1579 void CWmMainContainer::ProcessForegroundEvent( TBool aForeground ) |
|
1580 { |
|
1581 if ( iFindbox && iFindPaneIsVisible && |
|
1582 iFindbox->IsFocused() ) |
|
1583 { |
|
1584 // keep focus & do nothing |
|
1585 } |
|
1586 else if ( aForeground ) |
|
1587 { |
|
1588 // set init state when wm comes to foreground. |
|
1589 // remove focus from all controls when activating view. |
|
1590 ResetFocus( EDrawNow ); |
|
1591 } |
|
1592 } |
|
1593 |
|
1594 // ---------------------------------------------------- |
|
1595 // CWmMainContainer::ResetFocus |
|
1596 // ---------------------------------------------------- |
|
1597 // |
|
1598 void CWmMainContainer::ResetFocus( TDrawNow aDrawNow ) |
|
1599 { |
|
1600 CCoeControl* control = NULL; |
|
1601 CCoeControlArray::TCursor cursor = Components().Begin(); |
|
1602 while( ( control = cursor.Control<CCoeControl>() ) != NULL ) |
|
1603 { |
|
1604 if( control->IsVisible() && control->IsFocused() ) |
|
1605 { |
|
1606 control->SetFocus( EFalse, aDrawNow ); |
|
1607 } |
|
1608 cursor.Next(); |
|
1609 } |
|
1610 UpdateFocusMode(); |
|
1611 } |
|
1612 |
|
1613 // ---------------------------------------------------- |
|
1096 // CWmMainContainer::WmListBox |
1614 // CWmMainContainer::WmListBox |
1097 // ---------------------------------------------------- |
1615 // ---------------------------------------------------- |
1098 // |
1616 // |
1099 CWmListBox& CWmMainContainer::WmListBox() |
1617 CWmListBox& CWmMainContainer::WmListBox() |
1100 { |
1618 { |
1110 CCoeControl::FocusChanged( aDrawNow ); |
1628 CCoeControl::FocusChanged( aDrawNow ); |
1111 |
1629 |
1112 if ( iFindbox && iFindPaneIsVisible && |
1630 if ( iFindbox && iFindPaneIsVisible && |
1113 !iFindbox->IsFocused() && IsFocused() ) |
1631 !iFindbox->IsFocused() && IsFocused() ) |
1114 { |
1632 { |
1115 // set focus to find pane if its lost ( ou1cimx1#308019 ) |
1633 // reset focus to find pane if its lost ( ou1cimx1#308019 ) |
1634 ResetFocus(); |
|
1116 iFindbox->SetFocus( ETrue ); |
1635 iFindbox->SetFocus( ETrue ); |
1636 UpdateFocusMode(); |
|
1117 } |
1637 } |
1118 } |
1638 } |
1119 |
1639 |
1120 // ---------------------------------------------------- |
1640 // ---------------------------------------------------- |
1121 // CWmMainContainer::AdaptiveSearchTextChanged |
1641 // CWmMainContainer::AdaptiveSearchTextChanged |
1144 m->Filter()->HandleItemArrayChangeL(); |
1664 m->Filter()->HandleItemArrayChangeL(); |
1145 } |
1665 } |
1146 } |
1666 } |
1147 } |
1667 } |
1148 |
1668 |
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 |
|
1257 // End of File |
1669 // End of File |
1258 |
1670 |