summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2016-09-14 02:02:38 +0300
committerMaxim Monastirsky <momonasmon@gmail.com>2016-09-13 23:06:38 +0000
commit74fd959945dbbfbc3dcc331a08ff8fc7c6410295 (patch)
treedbabc8792b2d774cb8d7d456bb3b2765a73484e4 /cui
parentebe46f14a266f7e538bc8b8fa6b9f7d78c5e308d (diff)
tdf#74377 Keyboard shortcuts for context menus
Configurable through the options dialog. The default behavior depends on the current vclplug (hide for gtk2/3 and OS X, show otherwise). Menus currently affected by this change: - SfxDispatcher based context menus - chart2 context menus - vcl's Edit control context menu - Several MenuBarManager based toolbar dropdowns. Change-Id: Iad9fb99dc90e01c17cba9c07c1a2b262b920e11d Reviewed-on: https://gerrit.libreoffice.org/28849 Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com> Tested-by: Maxim Monastirsky <momonasmon@gmail.com>
Diffstat (limited to 'cui')
-rw-r--r--cui/source/options/optgdlg.cxx17
-rw-r--r--cui/source/options/optgdlg.hxx1
-rw-r--r--cui/uiconfig/ui/optviewpage.ui36
3 files changed, 53 insertions, 1 deletions
diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index 0371321bc041..4c59db28ebe3 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -630,6 +630,7 @@ OfaViewTabPage::OfaViewTabPage(vcl::Window* pParent, const SfxItemSet& rSet)
get(m_pAAPointLimitLabel, "aafrom");
get(m_pAAPointLimit, "aanf");
get(m_pMenuIconsLB, "menuicons");
+ get(m_pContextMenuShortcutsLB, "contextmenushortcuts");
get(m_pFontShowCB, "showfontpreview");
get(m_pUseHardwareAccell, "useaccel");
get(m_pUseAntiAliase, "useaa");
@@ -711,6 +712,7 @@ void OfaViewTabPage::dispose()
m_pAAPointLimitLabel.clear();
m_pAAPointLimit.clear();
m_pMenuIconsLB.clear();
+ m_pContextMenuShortcutsLB.clear();
m_pFontShowCB.clear();
m_pUseHardwareAccell.clear();
m_pUseAntiAliase.clear();
@@ -867,6 +869,16 @@ bool OfaViewTabPage::FillItemSet( SfxItemSet* )
bAppearanceChanged = true;
}
+ if(m_pContextMenuShortcutsLB->IsValueChangedFromSaved())
+ {
+ aMenuOpt.SetContextMenuShortcuts(m_pContextMenuShortcutsLB->GetSelectEntryPos() == 0 ?
+ TRISTATE_INDET :
+ static_cast<TriState>(m_pContextMenuShortcutsLB->GetSelectEntryPos() - 1));
+ bModified = true;
+ bMenuOptModified = true;
+ bAppearanceChanged = true;
+ }
+
// #i95644# if disabled, do not use value, see in ::Reset()
if(m_pUseHardwareAccell->IsEnabled())
{
@@ -994,6 +1006,11 @@ void OfaViewTabPage::Reset( const SfxItemSet* )
m_pMenuIconsLB->SelectEntryPos(aMenuOpt.GetMenuIconsState() == 2 ? 0 : aMenuOpt.GetMenuIconsState() + 1);
m_pMenuIconsLB->SaveValue();
+ TriState eContextMenuShortcuts = aMenuOpt.GetContextMenuShortcuts();
+ bool bContextMenuShortcutsNonDefault = eContextMenuShortcuts == TRISTATE_FALSE || eContextMenuShortcuts == TRISTATE_TRUE;
+ m_pContextMenuShortcutsLB->SelectEntryPos(bContextMenuShortcutsNonDefault ? eContextMenuShortcuts + 1 : 0);
+ m_pContextMenuShortcutsLB->SaveValue();
+
{ // #i95644# HW accel (unified to disable mechanism)
if(pCanvasSettings->IsHardwareAccelerationAvailable())
{
diff --git a/cui/source/options/optgdlg.hxx b/cui/source/options/optgdlg.hxx
index 9ec785123266..b204930eb035 100644
--- a/cui/source/options/optgdlg.hxx
+++ b/cui/source/options/optgdlg.hxx
@@ -89,6 +89,7 @@ private:
VclPtr<MetricField> m_pAAPointLimit;
VclPtr<ListBox> m_pMenuIconsLB;
+ VclPtr<ListBox> m_pContextMenuShortcutsLB;
VclPtr<CheckBox> m_pFontShowCB;
diff --git a/cui/uiconfig/ui/optviewpage.ui b/cui/uiconfig/ui/optviewpage.ui
index 834b8000d450..66296b77aea6 100644
--- a/cui/uiconfig/ui/optviewpage.ui
+++ b/cui/uiconfig/ui/optviewpage.ui
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.20.0 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<object class="GtkAdjustment" id="adjustment1">
@@ -195,6 +195,40 @@
<property name="top_attach">0</property>
</packing>
</child>
+ <child>
+ <object class="GtkComboBoxText" id="contextmenushortcuts">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <items>
+ <item translatable="yes">Automatic</item>
+ <item translatable="yes">Hide</item>
+ <item translatable="yes">Show</item>
+ </items>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label10">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_top">6</property>
+ <property name="margin_bottom">6</property>
+ <property name="label" translatable="yes">Shortcuts in context menus:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">contextmenushortcuts</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">2</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</object>
</child>
</object>