X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt%2FGuiPrefs.cpp;h=a5f4014874772d747b61ddaa73e0c1b974705b66;hb=5cb80b867f4a59c3253487652ba74a29ad5b3f0f;hp=a2ac0c83eb0f59f912ad9fe4a121a30867e83150;hpb=4d31e20d7d790554aab655ae11c9cd0dd4a6d6f1;p=lyx.git diff --git a/src/frontends/qt/GuiPrefs.cpp b/src/frontends/qt/GuiPrefs.cpp index a2ac0c83eb..a5f4014874 100644 --- a/src/frontends/qt/GuiPrefs.cpp +++ b/src/frontends/qt/GuiPrefs.cpp @@ -3408,6 +3408,23 @@ bool PrefShortcuts::validateNewShortcut(FuncRequest const & func, // nothing to change return false; + // Check whether the key sequence is a prefix for other shortcuts. + if (oldBinding == FuncRequest::prefix) { + docstring const new_action_string = makeCmdString(func); + docstring const text = bformat(_("Shortcut `%1$s' is already a prefix for other commands.\n" + "Are you sure you want to unbind these commands and bind it to %2$s?"), + k.print(KeySequence::ForGui), new_action_string); + int ret = Alert::prompt(_("Redefine shortcut?"), + text, 0, 1, _("&Redefine"), _("&Cancel")); + if (ret != 0) + return false; + QString const sequence_text = toqstr(k.print(KeySequence::ForGui)); + QList items = shortcutsTW->findItems(sequence_text, + Qt::MatchFlags(Qt::MatchStartsWith | Qt::MatchRecursive), 1); + deactivateShortcuts(items); + return true; + } + // make sure this key isn't already bound---and, if so, prompt user // (exclude the lfun the user already wants to modify) docstring const action_string = makeCmdString(oldBinding);