From 4b1dc57d3b5a0691e3d28b2dc11ebe35ff8c41e6 Mon Sep 17 00:00:00 2001 From: Guillaume Munch Date: Tue, 5 Jul 2016 21:38:24 +0200 Subject: [PATCH] Better error message when try to bind a Hidden LFUN (cherry picked from commit 1f2d7f4db93aa76ae54e75efb52d9359b4ea289f) --- src/frontends/qt4/GuiPrefs.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/frontends/qt4/GuiPrefs.cpp b/src/frontends/qt4/GuiPrefs.cpp index 9095c92cf4..1c9a1bc34b 100644 --- a/src/frontends/qt4/GuiPrefs.cpp +++ b/src/frontends/qt4/GuiPrefs.cpp @@ -3130,6 +3130,15 @@ bool PrefShortcuts::validateNewShortcut(FuncRequest const & func, return false; } + // It is not currently possible to bind Hidden lfuns such as self-insert. In + // the future, to remove this limitation, see GuiPrefs::insertShortcutItem + // and how it is used in GuiPrefs::shortcutOkPressed. + if (lyxaction.getActionType(func.action()) == LyXAction::Hidden) { + Alert::error(_("Failed to create shortcut"), + _("This LyX function is hidden and cannot be bound.")); + return false; + } + if (k.length() == 0) { Alert::error(_("Failed to create shortcut"), _("Invalid or empty key sequence")); @@ -3194,9 +3203,6 @@ void PrefShortcuts::shortcutOkPressed() shortcutsTW->setCurrentItem(item); shortcutsTW->scrollToItem(item); } else { - // FIXME: The error message could be more explicit. This can happen in - // particular if the user wants to introduce a LFUN which is Hidden such - // as self-insert. Alert::error(_("Failed to create shortcut"), _("Can not insert shortcut to the list")); return;