diff -r aecbbf00d063 -r d48ab3b357f1 uifw/AvKon/src/AknRadioButtonSettingPage.cpp --- a/uifw/AvKon/src/AknRadioButtonSettingPage.cpp Tue Aug 31 15:28:30 2010 +0300 +++ b/uifw/AvKon/src/AknRadioButtonSettingPage.cpp Wed Sep 01 12:16:19 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -75,13 +75,27 @@ * Extension flags. */ TBitFlags iFlags; + + /** + * Item that received pen down event + */ + TInt iPenDownOnItem; + + /** + * Is selection valid + */ + TBool iIsValidSelection; + }; // end of CAknRadioButtonSettingPageExtension class definition CAknRadioButtonSettingPageExtension::CAknRadioButtonSettingPageExtension( CCoeControl& aOwner ) : - iOldFocusedItemIndex(-1), iIsDragged( EFalse ) + iOldFocusedItemIndex( -1 ), + iIsDragged( EFalse ), + iPenDownOnItem ( KErrNotFound ), + iIsValidSelection( ETrue ) { if ( static_cast( aOwner.ControlEnv()->AppUi() )->IsSingleClickCompatible() ) @@ -229,6 +243,14 @@ switch ( aEventType ) { + case MEikListBoxObserver::EEventPenDownOnItem: + { + if ( iExtension ) + { + iExtension->iPenDownOnItem = ListBoxControl()->CurrentItemIndex(); + } + break; + } case MEikListBoxObserver::EEventItemSingleClicked: case MEikListBoxObserver::EEventItemDoubleClicked: { @@ -247,7 +269,9 @@ // Only in single click enabled applications. if ( iExtension && iExtension->iFlags.IsSet( - CAknRadioButtonSettingPageExtension::ESingleClickEnabled ) ) + CAknRadioButtonSettingPageExtension::ESingleClickEnabled ) && + iCurrentSelectionIndex >= 0 && + iCurrentSelectionIndex < ListBoxControl()->Model()->NumberOfItems() ) { ListBoxControl()->View()->SetCurrentItemIndex( iCurrentSelectionIndex ); @@ -285,8 +309,17 @@ } EXPORT_C void CAknRadioButtonSettingPage::SelectCurrentItemL() - { - iCurrentSelectionIndex = ListBoxControl()->CurrentItemIndex(); + { + if ( ListBoxControl()->IsHighlightEnabled() || + ( iExtension && iExtension->iIsValidSelection ) ) + { + iCurrentSelectionIndex = ListBoxControl()->CurrentItemIndex(); + } + else + { + ListBoxControl()->SetCurrentItemIndex ( iCurrentSelectionIndex ); + } + SetRadioButtonSelectionL( iCurrentSelectionIndex ); UpdateSettingL(); if( iSettingPageObserver ) @@ -454,7 +487,22 @@ TPointerEvent& event = const_cast( aPointerEvent ); event.iModifiers &= ~EModifierShift; event.iModifiers &= ~EModifierCtrl; - + + if ( iExtension ) + { + TInt index ( KErrNotFound ); + ListBoxControl()->View()->XYPosToItemIndex( + aPointerEvent.iPosition, index ); + if ( index == iExtension->iPenDownOnItem + && iExtension->iPenDownOnItem != KErrNotFound ) + { + iExtension->iIsValidSelection = ETrue; + } + else + { + iExtension->iIsValidSelection = EFalse; + } + } CAknListBoxSettingPage::HandlePointerEventL( aPointerEvent ); } @@ -477,10 +525,16 @@ EXPORT_C void CAknRadioButtonSettingPage::HandleResourceChange(TInt aType) { if( aType == KAknsMessageSkinChange ) - { - TRAP_IGNORE( InitialiseRadioButtonBitmapsL() ); - } - + { + TRAP_IGNORE( InitialiseRadioButtonBitmapsL() ); + } + else if( aType == KEikMessageFadeAllWindows ) + { + if ( iExtension ) + { + iExtension->iIsValidSelection = EFalse; + } + } CAknListBoxSettingPage::HandleResourceChange(aType); } @@ -498,4 +552,18 @@ { } +//--------------------------------------------------------------------------------------- +// CAknRadioButtonSettingPage::ProcessCommandL() +// Processes events from the softkeys. (Or translated from key events) +//--------------------------------------------------------------------------------------- +// +EXPORT_C void CAknRadioButtonSettingPage::ProcessCommandL( TInt aCommandId ) + { + if ( !EnableSingleClickHighlight( aCommandId ) ) + { + // no single click mode was enabled, just call the base class method + CAknSettingPage::ProcessCommandL( aCommandId ); + } + } + // End of File