Bug 1175142

Summary: YaST Menu Bar Toplevel Shortcut Conflicts
Product: [openSUSE] openSUSE Tumbleweed Reporter: Stefan Hundhammer <shundhammer>
Component: YaST2Assignee: YaST Team <yast-internal>
Status: RESOLVED FIXED QA Contact: Jiri Srain <jsrain>
Severity: Normal    
Priority: P3 - Medium    
Version: Current   
Target Milestone: ---   
Hardware: All   
OS: Other   
URL: https://trello.com/c/fCUBIGGg
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Stefan Hundhammer 2020-08-12 09:01:53 UTC
With the new MenuBar widget (see bug #1175115) we now have keyboard shortcuts for the toplevel menu entries that may conflict with other widgets in the same dialog.

Our automatic shortcut resolver in libyui can right now handle only one shortcut per widget, but this MenuBar widget now has several ones.

We need support for multiple shortcuts per widget to avoid conflicts.
Comment 1 Stefan Hundhammer 2020-08-12 09:19:03 UTC
Example:


+------------------------------------+
| [F]ile   [V]iew   [O]ptions        |
|                                    |
|                                    |
|                                    |
|                                    |
|                                    |
|                     [O]k [C]ancel  |
+------------------------------------+


Here the "O" shortcut will conflict between "Options" and "Ok".

The libyui YShortcutManager can handle the YPushButton's shortcut well enough, but the YMenuBar needs 3 shortcuts: One for "File", one for "View", one for "Options" (i.e. for each of the toplevel menus).

We need to add support to the YShortcutManager for multiple shortcuts for each individual widget.

Right now, each widget redefines a method "shortcutProperty()" that returns the property name of whatever property holds the shortcut for the widget: Typically the label. So the YShortcutManager can fetch the shortcuts in a very generic way with 

  widget->getProperty( widget->shortcutProperty() );

and if it needs to be changed, it can set it with

  widget->setProperty( widget->shortcutProperty(), newValue );

This is all very generic with libyui's introspection methods; it does not need any special handling for new widget types.

Now, we need to extend that somehow to handle several of them; possibly with an index and (to avoid a gazillion changes for existing widgets) a method indicating if a widget type has several shortcuts.


Implementation Proposal
=======================

(just an idea, not a formal specification)


  bool YWidget::multipleShortcuts() { return false; }

  bool YMenuBar::multipleShortcuts() { return true; }

and then possibly

  std::vector<std::string> getShortcuts();
  void setShortcuts( const std::vector<std::string> &newShortcuts );

which would do nothing in the default implementation in YWidget, and use the toplevel item labels for YMenuBar.
Comment 2 Steffen Winterfeldt 2020-08-12 09:28:15 UTC
Adding to YaST Scrum board.
Comment 3 Stefan Hundhammer 2021-09-20 13:44:40 UTC
This was fixed in the meantime.