686 // Not a popup then, handle some keys in clever ways |
686 // Not a popup then, handle some keys in clever ways |
687 |
687 |
688 // Save the currently selected item (if exclusive choice) |
688 // Save the currently selected item (if exclusive choice) |
689 TInt oldSelected = iModel->SelectedElement(); |
689 TInt oldSelected = iModel->SelectedElement(); |
690 TInt oldCurrentIndex = -1; |
690 TInt oldCurrentIndex = -1; |
|
691 #ifdef RD_JAVA_S60_RELEASE_9_2 |
|
692 TBool wasHighlighted = EFalse; |
|
693 #endif // RD_JAVA_S60_RELEASE_9_2 |
691 |
694 |
692 if (iListBox) |
695 if (iListBox) |
693 { |
696 { |
|
697 #ifdef RD_JAVA_S60_RELEASE_9_2 |
|
698 wasHighlighted = iListBox->GetHighlight(); |
|
699 #endif // RD_JAVA_S60_RELEASE_9_2 |
|
700 |
694 oldCurrentIndex = iListBox->View()->CurrentItemIndex(); |
701 oldCurrentIndex = iListBox->View()->CurrentItemIndex(); |
695 // Let the listbox take a shot at the key |
702 // Let the listbox take a shot at the key |
696 resp = iListBox->OfferKeyEventL(aKeyEvent, aType); |
703 resp = iListBox->OfferKeyEventL(aKeyEvent, aType); |
|
704 |
|
705 #ifdef RD_JAVA_S60_RELEASE_9_2 |
|
706 wasHighlighted = (iListBox->GetHighlight() && !wasHighlighted) ? EFalse : ETrue; |
|
707 #endif // RD_JAVA_S60_RELEASE_9_2 |
697 } |
708 } |
698 |
709 |
699 // If click (enter) on an already selected item in an exclusive choice, |
710 // If click (enter) on an already selected item in an exclusive choice, |
700 // do not consume the key. This allows the form to display a context menu |
711 // do not consume the key. This allows the form to display a context menu. |
|
712 // Choicegroup element need to be focused and selected |
701 if ((iType == MMIDChoiceGroup::EExclusive) && |
713 if ((iType == MMIDChoiceGroup::EExclusive) && |
702 ((aKeyEvent.iCode == EKeyOK) || (aKeyEvent.iCode == EKeyEnter)) && |
714 ((aKeyEvent.iCode == EKeyOK) || (aKeyEvent.iCode == EKeyEnter)) && |
703 ((oldSelected != -1) || (oldSelected == -1 && oldCurrentIndex == -1)) && |
715 ((oldSelected != -1) || (oldSelected == -1 && oldCurrentIndex == -1)) && |
704 (oldSelected == iModel->SelectedElement())) |
716 (oldSelected == iModel->SelectedElement()) |
|
717 #ifdef RD_JAVA_S60_RELEASE_9_2 |
|
718 && (wasHighlighted && iListBox->GetHighlight()) |
|
719 #endif // RD_JAVA_S60_RELEASE_9_2 |
|
720 ) |
705 { |
721 { |
706 // Do not consume the key, so that form can pop a menu |
722 // Do not consume the key, so that form can pop a menu |
707 CMIDDisplayable& displayable = iItem->Form()->CurrentDisplayable(); |
723 CMIDDisplayable& displayable = iItem->Form()->CurrentDisplayable(); |
708 TInt cntOpt = displayable.NumCommandsForOkOptionsMenu(); |
724 TInt cntOpt = displayable.NumCommandsForOkOptionsMenu(); |
709 |
725 |
721 |
737 |
722 resp = EKeyWasConsumed; |
738 resp = EKeyWasConsumed; |
723 } |
739 } |
724 else |
740 else |
725 { |
741 { |
|
742 TInt numScreenOrHelpCommands = displayable.NumCommandsForScreenOrHelpOptionsMenu(); |
|
743 |
726 // if ( cntOpt > 1 ) will run menu, else execute ProcessCommandL( CommandOffset ) |
744 // if ( cntOpt > 1 ) will run menu, else execute ProcessCommandL( CommandOffset ) |
727 if (cntOpt > 1) |
745 if (cntOpt > 1) |
728 { |
746 { |
729 displayable.MenuHandler()->ShowMenuL(CMIDMenuHandler::EOkMenu); |
747 displayable.MenuHandler()->ShowMenuL(CMIDMenuHandler::EOkMenu); |
|
748 resp = EKeyWasConsumed; |
|
749 } |
|
750 else if (cntOpt == 0 && numScreenOrHelpCommands > 1) |
|
751 { |
|
752 // If there is more than one screen command on form |
|
753 // and there is no ok/item commands then show menu |
|
754 displayable.MenuHandler()->ShowMenuL(CMIDMenuHandler::EOptionsMenu); |
730 resp = EKeyWasConsumed; |
755 resp = EKeyWasConsumed; |
731 } |
756 } |
732 else if (command && command->CommandType() != MMIDCommand::EBack && |
757 else if (command && command->CommandType() != MMIDCommand::EBack && |
733 command->CommandType() != MMIDCommand::ECancel) |
758 command->CommandType() != MMIDCommand::ECancel) |
734 { |
759 { |
1172 { |
1197 { |
1173 // Get color from skin |
1198 // Get color from skin |
1174 TRgb rgb = AKN_LAF_COLOR(215); |
1199 TRgb rgb = AKN_LAF_COLOR(215); |
1175 TInt textColor; |
1200 TInt textColor; |
1176 |
1201 |
1177 // Set color for text according to item highlight |
|
1178 // (logical color constants are defined in lcdui.h) |
|
1179 if (iItem && iItem->IsHighlighted()) |
1202 if (iItem && iItem->IsHighlighted()) |
1180 { |
1203 { |
1181 textColor = KHighlightedItemTextColor; |
1204 textColor = EAknsCIQsnTextColorsCG8; |
1182 } |
1205 } |
1183 else |
1206 else |
1184 { |
1207 { |
1185 textColor = KNonHighlightedItemTextColor; |
1208 textColor = EAknsCIQsnTextColorsCG6; |
1186 } |
1209 } |
1187 |
1210 |
1188 AknsUtils::GetCachedColor(AknsUtils::SkinInstance(), |
1211 AknsUtils::GetCachedColor(AknsUtils::SkinInstance(), |
1189 rgb, KAknsIIDQsnTextColors, textColor); |
1212 rgb, KAknsIIDQsnTextColors, textColor); |
1190 iPopupTextLayout.DrawText(SystemGc(), aText, ETrue, rgb); |
1213 iPopupTextLayout.DrawText(SystemGc(), aText, ETrue, rgb); |