--- a/idlehomescreen/widgetmanager/src/wmmaincontainer.cpp Tue Sep 14 20:58:58 2010 +0300
+++ b/idlehomescreen/widgetmanager/src/wmmaincontainer.cpp Wed Sep 15 12:00:00 2010 +0300
@@ -40,6 +40,8 @@
#include <AknsDrawUtils.h>
#include <aknenv.h>
#include <aknlists.h>
+#include <aknpopup.h>
+#include <badesca.h>
#include <eikclbd.h>
#include <aknsfld.h>
#include <AknsBasicBackgroundControlContext.h>
@@ -63,7 +65,7 @@
#include "wmlistbox.h"
#include "wmpersistentwidgetorder.h"
#include "wmdetailsdlg.h"
-#include "wmportalbutton.h"
+#include "wmstore.h"
#include "wmwidgetloaderao.h"
#include "wmconfiguration.h"
#include "wminstaller.h"
@@ -75,6 +77,31 @@
const TInt KTextLimit = 40; // Text-limit for find-field
const TInt KMinWidgets = 1; // minimum number of widgets to show findpane
+// ======== LOCAL FUNCTIONS ========
+
+// ----------------------------------------------------------------------------
+// CleanupResetAndDestroy()
+// ----------------------------------------------------------------------------
+//
+template<class T>
+static void CleanupResetAndDestroy( TAny* aObj )
+ {
+ if( aObj )
+ {
+ static_cast<T*>( aObj )->ResetAndDestroy();
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CleanupResetAndDestroyPushL
+// ----------------------------------------------------------------------------
+//
+template<class T>
+static void CleanupResetAndDestroyPushL(T& aArray)
+ {
+ CleanupStack::PushL( TCleanupItem( &CleanupResetAndDestroy<T>, &aArray ) );
+ }
+
// ---------------------------------------------------------
// CWmMainContainer::CWmMainContainer()
// ---------------------------------------------------------
@@ -86,7 +113,6 @@
iFindbox = NULL;
iFindPaneIsVisible = EFalse;
iBgContext = NULL;
- iFocusMode = ENowhere;
iClosingDown = ETrue;
}
@@ -96,6 +122,11 @@
//
CWmMainContainer::~CWmMainContainer()
{
+ if ( iSelectedStore )
+ {
+ delete iSelectedStore;
+ iSelectedStore = NULL;
+ }
TRAP_IGNORE(DeactivateFindPaneL(EFalse));
if ( iWidgetLoader )
@@ -108,11 +139,8 @@
Components().ResetAndDestroy();
iWidgetsList = NULL;
- iPortalButtonOne = NULL;
- iPortalButtonTwo = NULL;
iFindbox = NULL;
delete iBgContext;
- delete iConfiguration;
}
// ---------------------------------------------------------
@@ -179,9 +207,6 @@
// background context
iBgContext = CAknsBasicBackgroundControlContext::NewL(
KAknsIIDQsnBgScreen, ScreenRect() , ETrue);
-
- // load configuration
- iConfiguration = CWmConfiguration::NewL( iWmPlugin.ResourceLoader() );
// set up controls
InitializeControlsL( aRect );
@@ -211,52 +236,21 @@
{
TRect rect( Rect() );
- // determine layout type
- iLandscape = Layout_Meta_Data::IsLandscapeOrientation();
- iMirrored = Layout_Meta_Data::IsMirrored();
-
- // layout iPortalButtons
- if ( iConfiguration->PortalButtonCount() == 1 )
- {
- // one button
- TAknWindowLineLayout btnPane = AknLayoutScalable_Apps
- ::wgtman_btn_pane( iLandscape ? 1 : 0 ).LayoutLine();
- AknLayoutUtils::LayoutControl( iPortalButtonOne, rect, btnPane );
- }
- else
- {
- // two buttons
- TInt variety = (iLandscape ? 3 : 2);
- TAknWindowLineLayout oviBtnLayout = AknLayoutScalable_Apps
- ::wgtman_btn_pane( variety ).LayoutLine();
- TAknWindowLineLayout operatorBtnLayout = AknLayoutScalable_Apps
- ::wgtman_btn_pane_cp_01( variety ).LayoutLine();
-
- // button placement
- if ( iConfiguration->PortalButtonsMirrored() )
- {
- AknLayoutUtils::LayoutControl( iPortalButtonOne, rect, operatorBtnLayout );
- AknLayoutUtils::LayoutControl( iPortalButtonTwo, rect, oviBtnLayout );
- }
- else
- {
- AknLayoutUtils::LayoutControl( iPortalButtonOne, rect, oviBtnLayout );
- AknLayoutUtils::LayoutControl( iPortalButtonTwo, rect, operatorBtnLayout );
- }
- }
-
// layout iWidgetsList
- TAknWindowLineLayout listPane = AknLayoutScalable_Apps
- ::listscroll_wgtman_pane( iLandscape ? 1 : 0 ).LayoutLine();
if( iFindbox && iFindPaneIsVisible )
{
- TAknLayoutRect layoutRect;
- layoutRect.LayoutRect( rect, listPane );
- iWidgetsList->SetRect( layoutRect.Rect() );
+ iWidgetsList->SetRect( rect );
HandleFindSizeChanged();
}
else
{
+ TAknWindowLineLayout listPane;
+ listPane.il = rect.iTl.iX;
+ listPane.it = rect.iTl.iY;
+ listPane.ib = 0;
+ listPane.iH = rect.Height();
+ listPane.iW = rect.Width();
+ listPane.ir = ELayoutEmpty;
AknLayoutUtils::LayoutControl( iWidgetsList, rect, listPane );
}
@@ -287,28 +281,16 @@
{
return EKeyWasConsumed;
}
-
+
// Handle search keyevent
keyResponse = HandleSearchKeyEventL( aKeyEvent, aType );
-
- // Move focus between controls
- if ( keyResponse == EKeyWasNotConsumed )
- {
- keyResponse = MoveFocusByKeys( aKeyEvent, aType );
- }
-
+
// Handle list keyevent
if ( keyResponse == EKeyWasNotConsumed )
{
keyResponse = HandleListKeyEventL( aKeyEvent, aType );
}
- // Handle buttons keyevent
- if ( keyResponse == EKeyWasNotConsumed )
- {
- keyResponse = HandleButtonKeyEventL( aKeyEvent, aType );
- }
-
// Update ui if needed
if ( keyResponse == EKeyWasConsumed )
{
@@ -386,429 +368,33 @@
TKeyResponse keyResponse( EKeyWasNotConsumed );
// pass key event except backpace or delete key event to widgets list if focused
- if ( iWidgetsList->IsFocused() )
+ if ( ( aType == EEventKey ) && ( aKeyEvent.iCode == EKeyBackspace
+ || aKeyEvent.iCode == EKeyDelete ) )
{
- if ( ( aType == EEventKey ) && ( aKeyEvent.iCode == EKeyBackspace
- || aKeyEvent.iCode == EKeyDelete ) )
+ if( CanDoUninstall() )
{
- if( CanDoUninstall() )
- {
- UninstallWidgetL();
- }
- else
- {
- CWmWidgetData* data = iWidgetsList->WidgetData();
- if( data != NULL )
- iWmPlugin.ResourceLoader().InfoPopupL(
- R_QTN_WM_UNINST_NOT_ALLOWED, data->Name() );
- }
- keyResponse = EKeyWasConsumed;
+ UninstallWidgetL();
}
- else
+ else
{
- //passing to listbox handler
- keyResponse = iWidgetsList->OfferKeyEventL(
- aKeyEvent, aType );
+ CWmWidgetData* data = iWidgetsList->WidgetData();
+ if( data != NULL )
+ iWmPlugin.ResourceLoader().InfoPopupL(
+ R_QTN_WM_UNINST_NOT_ALLOWED, data->Name() );
}
+ keyResponse = EKeyWasConsumed;
}
-
- return keyResponse;
- }
-
-// ---------------------------------------------------------
-// CWmMainContainer::HandleButtonKeyEventL
-// ---------------------------------------------------------
-//
-TKeyResponse CWmMainContainer::HandleButtonKeyEventL(
- const TKeyEvent& aKeyEvent,
- TEventCode aType )
- {
- TKeyResponse keyResponse( EKeyWasNotConsumed );
-
- // pass key event to portal button if focused
- if ( iPortalButtonOne->IsFocused() )
+ else
{
- keyResponse = iPortalButtonOne->OfferKeyEventL(
- aKeyEvent, aType );
- }
-
- // pass key event to the other portal button if exists and focused
- if ( iPortalButtonTwo && iPortalButtonTwo->IsFocused() )
- {
- keyResponse = iPortalButtonTwo->OfferKeyEventL(
- aKeyEvent, aType );
+ //passing to listbox handler
+ keyResponse = iWidgetsList->OfferKeyEventL(
+ aKeyEvent, aType );
}
return keyResponse;
}
// ---------------------------------------------------------
-// CWmMainContainer::MoveFocusByKeys
-// ---------------------------------------------------------
-//
-TKeyResponse CWmMainContainer::MoveFocusByKeys(
- const TKeyEvent& aKeyEvent,
- TEventCode aType )
- {
- TKeyResponse keyResponse( EKeyWasNotConsumed );
-
- if ( iWidgetsList->IsFocused() )
- {
- // ------------------------------------
- // focus is in the WIDGETS LIST
- // ------------------------------------
- if ( !iLandscape &&
- aKeyEvent.iScanCode == EStdKeyUpArrow &&
- iWidgetsList->CurrentItemIndex() == 0 )
- {
- // widget list top -> up -> ovi button (portrait)
- if ( aType == EEventKey )
- SetFocusToPortalButton( OperatorButtonHigherPriority ( 0 ) );
- keyResponse = EKeyWasConsumed;
- }
- else if ( !iLandscape &&
- aKeyEvent.iScanCode == EStdKeyDownArrow &&
- iWidgetsList->CurrentItemIndex() ==
- iWidgetsList->Model()->NumberOfItems() - 1 )
- {
- // widget list bottom -> down -> ovi button (portrait)
- if ( aType == EEventKey )
- SetFocusToPortalButton( OperatorButtonHigherPriority ( 0 ) );
- keyResponse = EKeyWasConsumed;
- }
- else if ( iLandscape && !iMirrored &&
- aKeyEvent.iScanCode == EStdKeyRightArrow )
- {
- // widget list -> right -> ovi button (landscape normal)
- if ( aType == EEventKey )
- SetFocusToPortalButton( OperatorButtonHigherPriority ( 0 ) );
- keyResponse = EKeyWasConsumed;
- }
- else if ( iLandscape && iMirrored &&
- aKeyEvent.iScanCode == EStdKeyLeftArrow )
- {
- // widget list -> left -> ovi button (landscape mirrored)
- if ( aType == EEventKey )
- SetFocusToPortalButton( OperatorButtonHigherPriority ( 0 ) );
- keyResponse = EKeyWasConsumed;
- }
- }
- else if ( iPortalButtonOne->IsFocused() )
- {
- // ------------------------------------
- // focus is in the FIRST PORTAL BUTTON
- // ------------------------------------
- if ( !iLandscape &&
- aKeyEvent.iScanCode == EStdKeyDownArrow )
- {
- // left portal -> down -> widget list top (portrait)
- if ( aType == EEventKey )
- SetFocusToWidgetList( 0 );
- keyResponse = EKeyWasConsumed;
- }
- else if ( !iLandscape &&
- aKeyEvent.iScanCode == EStdKeyUpArrow )
- {
- // left portal -> up -> widget list bottom (portrait)
- if ( aType == EEventKey )
- SetFocusToWidgetList( iWidgetsList->Model()->NumberOfItems()-1 );
- keyResponse = EKeyWasConsumed;
- }
- else if ( !iLandscape && !iMirrored &&
- aKeyEvent.iScanCode == EStdKeyLeftArrow &&
- iConfiguration->PortalButtonCount() > 1 &&
- iConfiguration->PortalButtonsMirrored() )
- {
- // right portal -> left -> left portal
- // (portrait, operator button higher priority )
- if ( aType == EEventKey )
- SetFocusToPortalButton( 1 );
- keyResponse = EKeyWasConsumed;
- }
- else if ( !iLandscape && !iMirrored &&
- aKeyEvent.iScanCode == EStdKeyRightArrow &&
- iConfiguration->PortalButtonCount() > 1 &&
- !iConfiguration->PortalButtonsMirrored() )
- {
- // left portal -> right -> right portal (portrait normal)
- if ( aType == EEventKey )
- SetFocusToPortalButton( 1 );
- keyResponse = EKeyWasConsumed;
- }
- else if ( !iLandscape && iMirrored &&
- aKeyEvent.iScanCode == EStdKeyRightArrow &&
- iConfiguration->PortalButtonCount() > 1 &&
- iConfiguration->PortalButtonsMirrored() )
- {
- // right portal -> left -> left portal (portrait mirrored)
- if ( aType == EEventKey )
- SetFocusToPortalButton( 1 );
- keyResponse = EKeyWasConsumed;
- }
- else if ( !iLandscape && iMirrored &&
- aKeyEvent.iScanCode == EStdKeyLeftArrow &&
- iConfiguration->PortalButtonCount() > 1 &&
- !iConfiguration->PortalButtonsMirrored() )
- {
- // right portal -> left -> left portal (portrait mirrored)
- if ( aType == EEventKey )
- SetFocusToPortalButton( 1 );
- keyResponse = EKeyWasConsumed;
- }
- else if ( iLandscape && !iMirrored &&
- aKeyEvent.iScanCode == EStdKeyLeftArrow )
- {
- // upper portal -> left -> widget list (landscape normal)
- if ( aType == EEventKey )
- SetFocusToWidgetList();
- keyResponse = EKeyWasConsumed;
- }
- else if ( iLandscape && iMirrored &&
- aKeyEvent.iScanCode == EStdKeyRightArrow )
- {
- // upper portal -> right -> widget list (landscape mirrored)
- if ( aType == EEventKey )
- SetFocusToWidgetList();
- keyResponse = EKeyWasConsumed;
- }
- else if ( iLandscape &&
- aKeyEvent.iScanCode == EStdKeyUpArrow &&
- iConfiguration->PortalButtonCount() > 1 &&
- iConfiguration->PortalButtonsMirrored() )
- {
- // lower portal -> up -> upper portal
- // (landscape, operator button higher priority )
- if ( aType == EEventKey )
- SetFocusToPortalButton( 1 );
- keyResponse = EKeyWasConsumed;
- }
- else if ( iLandscape &&
- aKeyEvent.iScanCode == EStdKeyDownArrow &&
- iConfiguration->PortalButtonCount() > 1 &&
- !iConfiguration->PortalButtonsMirrored() )
- {
- // upper portal -> down -> lower portal (landscape)
- if ( aType == EEventKey )
- SetFocusToPortalButton( 1 );
- keyResponse = EKeyWasConsumed;
- }
- }
- else if ( iPortalButtonTwo && iPortalButtonTwo->IsFocused() )
- {
- // ------------------------------------
- // focus is in the SECOND PORTAL BUTTON
- // ------------------------------------
- if ( !iLandscape &&
- aKeyEvent.iScanCode == EStdKeyDownArrow )
- {
- // right portal -> down -> widget list top (portrait)
- if ( aType == EEventKey )
- SetFocusToWidgetList( 0 );
- keyResponse = EKeyWasConsumed;
- }
- else if ( !iLandscape &&
- aKeyEvent.iScanCode == EStdKeyUpArrow )
- {
- // right portal -> up -> widget list bottom (portrait)
- if ( aType == EEventKey )
- SetFocusToWidgetList( iWidgetsList->Model()->NumberOfItems()-1 );
- keyResponse = EKeyWasConsumed;
- }
- else if ( !iLandscape && !iMirrored &&
- aKeyEvent.iScanCode == EStdKeyRightArrow &&
- iConfiguration->PortalButtonCount() > 1 &&
- iConfiguration->PortalButtonsMirrored() )
- {
- // left portal -> right -> right portal
- // (portrait, operator button higher priority )
- if ( aType == EEventKey )
- SetFocusToPortalButton( 0 );
- keyResponse = EKeyWasConsumed;
- }
- else if ( !iLandscape && !iMirrored &&
- aKeyEvent.iScanCode == EStdKeyLeftArrow &&
- iConfiguration->PortalButtonCount() > 1 &&
- !iConfiguration->PortalButtonsMirrored() )
- {
- // right portal -> left -> left portal (portrait normal)
- if ( aType == EEventKey )
- SetFocusToPortalButton( 0 );
- keyResponse = EKeyWasConsumed;
- }
- else if ( !iLandscape && iMirrored &&
- aKeyEvent.iScanCode == EStdKeyLeftArrow &&
- iConfiguration->PortalButtonCount() > 1 &&
- iConfiguration->PortalButtonsMirrored() )
- {
- // left portal -> right -> right portal (portrait mirrored)
- if ( aType == EEventKey )
- SetFocusToPortalButton( 0 );
- keyResponse = EKeyWasConsumed;
- }
- else if ( !iLandscape && iMirrored &&
- aKeyEvent.iScanCode == EStdKeyRightArrow &&
- iConfiguration->PortalButtonCount() > 1 &&
- !iConfiguration->PortalButtonsMirrored() )
- {
- // left portal -> right -> right portal (portrait mirrored)
- if ( aType == EEventKey )
- SetFocusToPortalButton( 0 );
- keyResponse = EKeyWasConsumed;
- }
- else if ( iLandscape && !iMirrored &&
- aKeyEvent.iScanCode == EStdKeyLeftArrow )
- {
- // lower portal -> left -> widget list (landscape normal)
- if ( aType == EEventKey )
- SetFocusToWidgetList();
- keyResponse = EKeyWasConsumed;
- }
- else if ( iLandscape && iMirrored &&
- aKeyEvent.iScanCode == EStdKeyRightArrow )
- {
- // lower portal -> right -> widget list (landscape mirrored)
- if ( aType == EEventKey )
- SetFocusToWidgetList();
- keyResponse = EKeyWasConsumed;
- }
- else if ( iLandscape &&
- aKeyEvent.iScanCode == EStdKeyDownArrow &&
- iConfiguration->PortalButtonsMirrored() )
- {
- // upper portal -> down -> lower portal
- // ( landscape operator button higher priority )
- if ( aType == EEventKey )
- SetFocusToPortalButton( 0 );
- keyResponse = EKeyWasConsumed;
- }
- else if ( iLandscape &&
- aKeyEvent.iScanCode == EStdKeyUpArrow &&
- !iConfiguration->PortalButtonsMirrored() )
- {
- // lower portal -> up -> upper portal (landscape)
- if ( aType == EEventKey )
- SetFocusToPortalButton( 0 );
- keyResponse = EKeyWasConsumed;
- }
- }
- else
- {
- // ------------------------------------
- // focus is NOWHERE
- // ------------------------------------
- if ( aKeyEvent.iScanCode == EStdKeyUpArrow ||
- aKeyEvent.iScanCode == EStdKeyDownArrow )
- {
- // no focus -> key hit -> focus list
- if ( aType == EEventKey )
- {
- SetFocusToWidgetList();
- keyResponse = EKeyWasNotConsumed;
- }
- }
- }
-
- return keyResponse;
- }
-
-
-// ---------------------------------------------------------
-// CWmMainContainer::OperatorButtonHigherPriority
-// ---------------------------------------------------------
-//
-TInt CWmMainContainer::OperatorButtonHigherPriority( TInt aIndex )
- {
- TInt ret = aIndex;
- if ( iConfiguration->PortalButtonsMirrored() )
- {
- if ( aIndex == 0 )
- {
- ret = 1;
- }
- else if ( aIndex == 1 )
- {
- ret = 0;
- }
- }
- return ret;
- }
-
-// ---------------------------------------------------------
-// CWmMainContainer::SetFocusToPortalButton
-// ---------------------------------------------------------
-//
-void CWmMainContainer::SetFocusToPortalButton( TInt aIndex )
- {
- if ( aIndex != 0 && iPortalButtonTwo )
- {
- iWidgetsList->SetFocus(EFalse);
- iPortalButtonOne->SetFocus(EFalse);
- iPortalButtonTwo->SetFocus(ETrue);
- }
- else
- {
- iWidgetsList->SetFocus(EFalse);
- if ( iPortalButtonTwo )
- iPortalButtonTwo->SetFocus(EFalse);
- iPortalButtonOne->SetFocus(ETrue);
- }
- DrawDeferred();
- UpdateFocusMode();
- }
-
-// ---------------------------------------------------------
-// CWmMainContainer::SetFocusToWidgetList
-// ---------------------------------------------------------
-//
-void CWmMainContainer::SetFocusToWidgetList( TInt aIndex )
- {
- iPortalButtonOne->SetFocus(EFalse);
- if ( iPortalButtonTwo )
- iPortalButtonTwo->SetFocus(EFalse);
- if ( aIndex >= 0 && aIndex < iWidgetsList->Model()->NumberOfItems() )
- {
- iWidgetsList->SetCurrentItemIndex( aIndex );
- }
- iWidgetsList->SetFocus(ETrue);
- DrawDeferred();
- UpdateFocusMode();
- }
-
-// ---------------------------------------------------------
-// CWmMainContainer::UpdateFocusMode
-// ---------------------------------------------------------
-//
-void CWmMainContainer::UpdateFocusMode()
- {
- if ( iPortalButtonOne->IsFocused() )
- {
- // PORTAL BUTTON is focused
- iFocusMode = EPortal;
- }
- else if ( iPortalButtonTwo && iPortalButtonTwo->IsFocused() )
- {
- // SECOND PORTAL BUTTON is focused
- iFocusMode = EPortal;
- }
- else if( ( iFindPaneIsVisible ) &&
- ( iFindbox->IsFocused() || iWidgetsList->IsFocused() ) )
- {
- // FIND MODE
- iFocusMode = EFind;
- }
- else if ( iWidgetsList->IsFocused() )
- {
- // WIDGETS LIST is focused
- iFocusMode = EList;
- }
- else
- {
- // NO focus
- iFocusMode = ENowhere;
- }
- }
-
-// ---------------------------------------------------------
// CWmMainContainer::FindChildControlByPoint
// ---------------------------------------------------------
//
@@ -858,8 +444,6 @@
// Set focus to the control that was clicked
control->SetFocus( ETrue );
- // update focus mode accordingly
- UpdateFocusMode();
// repaint
DrawDeferred();
}
@@ -903,17 +487,6 @@
//
void CWmMainContainer::InitializeControlsL( const TRect& /*aRect*/ )
{
- // Create portal buttons
- iPortalButtonOne = CWmPortalButton::NewL( this, 0 );
- iPortalButtonOne->SetMopParent( this );
- AddControlL( iPortalButtonOne, EPortalOne );
- if ( iConfiguration->PortalButtonCount() > 1 )
- {
- iPortalButtonTwo = CWmPortalButton::NewL( this, 1 );
- iPortalButtonTwo->SetMopParent( this );
- AddControlL( iPortalButtonTwo, EPortalTwo );
- }
-
// Create widget list box
iWidgetsList = CWmListBox::NewL(
iWmPlugin,
@@ -935,8 +508,8 @@
CAknSearchField::EAdaptiveSearch,
0, KTextLimit );
AddControlL( iFindbox, EFindBox );
-
- UpdateFocusMode();
+ iFindbox->AddAdaptiveSearchTextObserverL(this);
+
StartLoadingWidgetsL();
}
@@ -1045,21 +618,13 @@
}
// ---------------------------------------------------------
-// CWmMainContainer::PortalSelected
-// ---------------------------------------------------------
-//
-TBool CWmMainContainer::PortalSelected()
- {
- return ( iFocusMode == EPortal );
- }
-
-// ---------------------------------------------------------
// CWmMainContainer::WidgetSelected
// ---------------------------------------------------------
//
TBool CWmMainContainer::WidgetSelected()
{
- return ( iFocusMode == EList ) || ( iFocusMode == EFind );
+ return (( iWidgetsList->IsFocused() || iWidgetsList->IsHighlightEnabled())?
+ ETrue : EFalse );
}
// ---------------------------------------------------------
@@ -1217,18 +782,6 @@
if ( iFindbox && !iFindPaneIsVisible &&
iWidgetsList->Model()->NumberOfItems() > KMinWidgets )
{
- // set focus
- if ( iWidgetsList->ItemDrawer()->Flags()
- & CListItemDrawer::ESingleClickDisabledHighlight )
- {
- ResetFocus();
- }
- else
- {
- iWidgetsList->SetFocus( ETrue, EDrawNow );
- }
-
-
// set column filter flag
TBitFlags32 bitFlag;
bitFlag.ClearAll(); // clear all columns
@@ -1263,14 +816,18 @@
}
iFindbox->SetFocus( ETrue );
iWidgetsList->SetFindPaneIsVisible( ETrue );
-
- // set soft key set
- CEikButtonGroupContainer* cbaGroup =
- CEikButtonGroupContainer::Current();
- cbaGroup->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_CANCEL__SELECT );
- cbaGroup->DrawNow();
-
- UpdateFocusMode();
+
+ if ( AknLayoutUtils::MSKEnabled() )
+ {
+ // set soft key set
+ CEikButtonGroupContainer* cbaGroup =
+ CEikButtonGroupContainer::Current();
+ TInt cbaResourceId = ( ( iWmPlugin.Configuration().StoreCount() > 0 )?
+ R_WM_SOFTKEYS_OPTIONS_CANCEL__STORE :
+ R_AVKON_SOFTKEYS_OPTIONS_CANCEL__SELECT );
+ cbaGroup->SetCommandSetL( cbaResourceId );
+ cbaGroup->DrawNow();
+ }
}
}
@@ -1298,17 +855,6 @@
m->RemoveFilter();
}
- //set focus
- if ( iWidgetsList->ItemDrawer()->Flags()
- & CListItemDrawer::ESingleClickDisabledHighlight )
- {
- ResetFocus();
- }
- else
- {
- iWidgetsList->SetFocus( ETrue, EDrawNow );
- }
-
iFindbox->MakeVisible( EFalse );
iFindPaneIsVisible = EFalse;
iWidgetsList->SetFindPaneIsVisible( EFalse );
@@ -1317,8 +863,9 @@
// set soft key set
CEikButtonGroupContainer* cbaGroup =
CEikButtonGroupContainer::Current();
- TInt cbaResourceId = ( AknLayoutUtils::MSKEnabled() ?
- R_AVKON_SOFTKEYS_OPTIONS_BACK__SELECT :
+ TInt cbaResourceId = ( ( AknLayoutUtils::MSKEnabled() &&
+ iWmPlugin.Configuration().StoreCount() > 0 )?
+ R_WM_SOFTKEYS_OPTIONS_BACK__STORE :
R_AVKON_SOFTKEYS_OPTIONS_BACK );
cbaGroup->SetCommandSetL( cbaResourceId );
@@ -1327,7 +874,6 @@
LayoutControls();
cbaGroup->DrawNow();
- UpdateFocusMode();
DrawNow();
}
}
@@ -1381,35 +927,32 @@
}
// ---------------------------------------------------------------------------
-// CWmMainContainer::OpenPortalL
+// CWmMainContainer::HandleStoreCommandL
// ---------------------------------------------------------------------------
//
-void CWmMainContainer::OpenPortalL()
+void CWmMainContainer::HandleStoreCommandL()
{
- if ( !iClosingDown )
- {
- // execute whichever of the portal buttons happens to be active
- if ( iPortalButtonOne->IsFocused() )
- iPortalButtonOne->ExecuteL();
- else if ( iPortalButtonTwo && iPortalButtonTwo->IsFocused() )
- iPortalButtonTwo->ExecuteL();
- else if ( !iPortalButtonTwo )
- iPortalButtonOne->ExecuteL();
+ delete iSelectedStore;
+ iSelectedStore = NULL;
+
+ const RPointerArray<CWmConfItem>& storeConfArray =
+ iWmPlugin.Configuration().StoreConfArray();
+
+ if ( storeConfArray.Count() == 1 )
+ {
+ iSelectedStore = CWmStore::NewL( *storeConfArray[0],
+ iWmPlugin.ResourceLoader() );
+
+ iSelectedStore->ExecuteL();
}
- }
-
-// ---------------------------------------------------------------------------
-// CWmMainContainer::SelectL
-// ---------------------------------------------------------------------------
-//
-void CWmMainContainer::SelectL()
- {
- if ( WidgetSelected() )
- AddWidgetToHomeScreenL();
- else if ( PortalSelected() )
- OpenPortalL();
+ else if ( storeConfArray.Count() > 1 )
+ {
+ DisplayAndLaunchStoresL();
+ }
else
- SetFocusToWidgetList();
+ {
+ // do nothing
+ }
}
// ---------------------------------------------------------------------------
@@ -1499,19 +1042,6 @@
{
AddWidgetToHomeScreenL();
}
- else
- {
- if ( iWidgetsList->ItemDrawer()->Flags()
- & CListItemDrawer::ESingleClickDisabledHighlight )
- {
- ResetFocus();
- }
- else
- {
- iWidgetsList->SetFocus( ETrue, EDrawNow );
- UpdateFocusMode();
- }
- }
}
}
@@ -1534,15 +1064,6 @@
}
// ----------------------------------------------------
-// CWmMainContainer::Configuration
-// ----------------------------------------------------
-//
-CWmConfiguration& CWmMainContainer::Configuration()
- {
- return *iConfiguration;
- }
-
-// ----------------------------------------------------
// CWmMainContainer::HandleFindSizeChanged
// ----------------------------------------------------
//
@@ -1572,44 +1093,6 @@
}
// ----------------------------------------------------
-// CWmMainContainer::ProcessForegroundEvent
-// ----------------------------------------------------
-//
-void CWmMainContainer::ProcessForegroundEvent( TBool aForeground )
- {
- if ( iFindbox && iFindPaneIsVisible &&
- iFindbox->IsFocused() )
- {
- // keep focus & do nothing
- }
- else if ( aForeground )
- {
- // set init state when wm comes to foreground.
- // remove focus from all controls when activating view.
- ResetFocus( EDrawNow );
- }
- }
-
-// ----------------------------------------------------
-// CWmMainContainer::ResetFocus
-// ----------------------------------------------------
-//
-void CWmMainContainer::ResetFocus( TDrawNow aDrawNow )
- {
- CCoeControl* control = NULL;
- CCoeControlArray::TCursor cursor = Components().Begin();
- while( ( control = cursor.Control<CCoeControl>() ) != NULL )
- {
- if( control->IsVisible() && control->IsFocused() )
- {
- control->SetFocus( EFalse, aDrawNow );
- }
- cursor.Next();
- }
- UpdateFocusMode();
- }
-
-// ----------------------------------------------------
// CWmMainContainer::WmListBox
// ----------------------------------------------------
//
@@ -1629,10 +1112,8 @@
if ( iFindbox && iFindPaneIsVisible &&
!iFindbox->IsFocused() && IsFocused() )
{
- // reset focus to find pane if its lost ( ou1cimx1#308019 )
- ResetFocus();
+ // set focus to find pane if its lost ( ou1cimx1#308019 )
iFindbox->SetFocus( ETrue );
- UpdateFocusMode();
}
}
@@ -1665,5 +1146,113 @@
}
}
+// ----------------------------------------------------------
+// CWmMainContainer::CleanupIconArray
+// ----------------------------------------------------------
+//
+void CWmMainContainer::CleanupIconArray( TAny* aIconArray )
+ {
+ CArrayPtrFlat<CGulIcon>* icons = (CArrayPtrFlat<CGulIcon>*)aIconArray;
+ icons->ResetAndDestroy();
+ delete icons;
+ }
+
+// ----------------------------------------------------
+// CWmMainContainer::DisplayAndLaunchStoresL
+// ----------------------------------------------------
+//
+void CWmMainContainer::DisplayAndLaunchStoresL()
+ {
+ // prepare stores
+ RPointerArray<CWmStore> storesArray;
+ CleanupResetAndDestroyPushL( storesArray );
+
+ const RPointerArray<CWmConfItem>& storeConfArray =
+ iWmPlugin.Configuration().StoreConfArray();
+
+ for( TInt i = 0; i < storeConfArray.Count(); i++ )
+ {
+ CWmStore* store = CWmStore::NewL( *storeConfArray[i],
+ iWmPlugin.ResourceLoader() );
+ CleanupStack::PushL( store );
+ storesArray.AppendL( store );
+ CleanupStack::Pop( store );
+ }
+
+ CEikFormattedCellListBox* listBox =
+ new (ELeave) CAknDoubleLargeGraphicPopupMenuStyleListBox();
+ CleanupStack::PushL( listBox );
+
+ CAknPopupList* popupList = CAknPopupList::NewL(
+ listBox, R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT,
+ AknPopupLayouts::EMenuDoubleLargeGraphicWindow );
+
+ CleanupStack::PushL( popupList );
+
+ listBox->ConstructL( popupList, EAknListBoxMenuList );
+ listBox->CreateScrollBarFrameL(ETrue);
+ listBox->ScrollBarFrame()->SetScrollBarVisibilityL(
+ CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto);
+
+ // set title
+ HBufC* title = StringLoader::LoadLC( R_QTN_WM_STORELIST_TITLE );
+ popupList->SetTitleL( *title );
+ CleanupStack::PopAndDestroy(); // title
+
+ // format str
+ _LIT( KFormatStr , "%d\t%S" );
+
+ // items array
+ CDesCArray* itemArray =
+ static_cast<CDesCArray*>( listBox->Model()->ItemTextArray( ) );
+
+ // create icons array
+ CArrayPtr<CGulIcon>* iconarray = new (ELeave) CArrayPtrFlat<CGulIcon>( 2 );
+ CleanupStack::PushL( TCleanupItem( CleanupIconArray, iconarray) );
+
+ for ( TInt i=0; i < storesArray.Count(); i++ )
+ {
+ // prepare icon
+ CGulIcon* icon = CGulIcon::NewL( storesArray[i]->StoreIcon(),
+ storesArray[i]->StoreMask() );
+ CleanupStack::PushL( icon );
+ icon->SetBitmapsOwnedExternally( ETrue );
+ iconarray->AppendL( icon );
+ CleanupStack::Pop( icon );
+
+ // add store to items array
+ HBufC* buf = HBufC::NewLC(
+ storesArray[i]->Heading().Length() +
+ KFormatStr().Length() );
+
+ TPtr ptr = buf->Des();
+ ptr.Format( KFormatStr(), i, &storesArray[i]->Heading() );
+ itemArray->AppendL( ptr );
+ CleanupStack::PopAndDestroy( buf );
+ }
+
+ CleanupStack::Pop(); // iconarray
+ listBox->ItemDrawer()->ColumnData()->SetIconArrayL( iconarray );
+
+ TBool result = popupList->ExecuteLD();
+ CleanupStack::Pop(); // popupList ( deleted in ExecuteLD)
+
+ TInt selection = listBox->CurrentItemIndex();
+ CleanupStack::PopAndDestroy(); // listBox
+
+ if ( result && selection >= 0 &&
+ selection < storesArray.Count() )
+ {
+ iSelectedStore = storesArray[selection];
+ if ( iSelectedStore )
+ {
+ storesArray.Remove( selection );
+ iSelectedStore->ExecuteL();
+ }
+ }
+
+ CleanupStack::PopAndDestroy(); //storesArray
+ }
+
// End of File