mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Fix bug #5735: Modifying a keyboard shortcut function entry clashes with its own shortcut key combination definition.
- Trim the saved lfun because there is a space added in the textfield, - check whether the action has changed before signaling that the shortcut already exists. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33713 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
b9b872f36a
commit
d8bb69e74e
@ -2645,7 +2645,7 @@ void PrefShortcuts::modifyShortcut()
|
||||
QTreeWidgetItem * item = shortcutsTW->currentItem();
|
||||
if (item->flags() & Qt::ItemIsSelectable) {
|
||||
shortcut_->lfunLE->setText(item->text(0));
|
||||
save_lfun_ = item->text(0);
|
||||
save_lfun_ = item->text(0).trimmed();
|
||||
shortcut_->shortcutWG->setText(item->text(1));
|
||||
KeySequence seq;
|
||||
seq.parse(fromqstr(item->data(1, Qt::UserRole).toString()));
|
||||
@ -2810,19 +2810,19 @@ void PrefShortcuts::shortcutOkPressed()
|
||||
|
||||
// make sure this key isn't already bound---and, if so, not unbound
|
||||
FuncCode const unbind = user_unbind_.getBinding(k).action;
|
||||
if (oldBinding.action != LFUN_UNKNOWN_ACTION && unbind == LFUN_UNKNOWN_ACTION)
|
||||
{
|
||||
docstring const action_string = makeCmdString(oldBinding);
|
||||
if (oldBinding.action != LFUN_UNKNOWN_ACTION && unbind == LFUN_UNKNOWN_ACTION
|
||||
&& save_lfun_ != toqstr(action_string)) {
|
||||
// FIXME Perhaps we should offer to over-write the old shortcut?
|
||||
// If so, we'll need to remove it from our list, etc.
|
||||
docstring const actionStr = makeCmdString(oldBinding);
|
||||
Alert::error(_("Failed to create shortcut"),
|
||||
bformat(_("Shortcut `%1$s' is already bound to:\n%2$s\n"
|
||||
"You need to remove that binding before creating a new one."),
|
||||
k.print(KeySequence::ForGui), actionStr));
|
||||
k.print(KeySequence::ForGui), action_string));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!save_lfun_.isEmpty() && new_lfun == save_lfun_)
|
||||
if (!save_lfun_.isEmpty())
|
||||
// real modification of the lfun's shortcut,
|
||||
// so remove the previous one
|
||||
removeShortcut();
|
||||
|
Loading…
Reference in New Issue
Block a user