diff --git a/src/KeySequence.cpp b/src/KeySequence.cpp
index 576919bd16..5a7623b7f6 100644
--- a/src/KeySequence.cpp
+++ b/src/KeySequence.cpp
@@ -190,4 +190,13 @@ void KeySequence::clear()
}
+void KeySequence::removeKey()
+{
+ if (deleted_)
+ return;
+ sequence.pop_back();
+ modifiers.pop_back();
+}
+
+
} // namespace lyx
diff --git a/src/KeySequence.h b/src/KeySequence.h
index d720534536..c5b9527578 100644
--- a/src/KeySequence.h
+++ b/src/KeySequence.h
@@ -91,6 +91,9 @@ public:
/// clear in full
void clear();
+ /// remove last key in sequence
+ void removeKey();
+
bool deleted() const { return deleted_; }
/// length of sequence
diff --git a/src/frontends/qt4/CustomizedWidgets.cpp b/src/frontends/qt4/CustomizedWidgets.cpp
index bf5d4a7413..9dc1a9ab14 100644
--- a/src/frontends/qt4/CustomizedWidgets.cpp
+++ b/src/frontends/qt4/CustomizedWidgets.cpp
@@ -5,6 +5,7 @@
*
* \author Bo Peng
* \author Edwin Leuven
+ * \author Jürgen Spitzmüller
*
* Full author contact details are available in file CREDITS.
*/
@@ -84,6 +85,12 @@ KeySequence const ShortcutWidget::getKeySequence() const
}
+void ShortcutWidget::setKeySequence(lyx::KeySequence const s)
+{
+ keysequence_ = s;
+}
+
+
void ShortcutWidget::keyPressEvent(QKeyEvent * e)
{
int const keyQt = e->key();
@@ -139,6 +146,13 @@ void ShortcutWidget::appendToSequence(QKeyEvent * e)
keysequence_.addkey(sym, mod, lyx::NoModifier);
}
+
+void ShortcutWidget::removeFromSequence()
+{
+ keysequence_.removeKey();
+ setText(toqstr(keysequence_.print(KeySequence::ForGui)));
+}
+
} // namespace frontend
} // namespace lyx
diff --git a/src/frontends/qt4/CustomizedWidgets.h b/src/frontends/qt4/CustomizedWidgets.h
index 41b2d4c858..e02951189d 100644
--- a/src/frontends/qt4/CustomizedWidgets.h
+++ b/src/frontends/qt4/CustomizedWidgets.h
@@ -6,6 +6,7 @@
*
* \author Bo Peng
* \author Edwin Leuven
+ * \author Jürgen Spitzmüller
*
* Full author contact details are available in file CREDITS.
*/
@@ -32,6 +33,8 @@ public:
void reset();
bool eventFilter(QObject*, QEvent* e );
lyx::KeySequence const getKeySequence() const;
+ void setKeySequence(lyx::KeySequence const s);
+ void removeFromSequence();
protected Q_SLOTS:
bool event(QEvent* e);
void keyPressEvent(QKeyEvent * e);
diff --git a/src/frontends/qt4/GuiPrefs.cpp b/src/frontends/qt4/GuiPrefs.cpp
index 010aaf7493..90f338c287 100644
--- a/src/frontends/qt4/GuiPrefs.cpp
+++ b/src/frontends/qt4/GuiPrefs.cpp
@@ -2055,6 +2055,8 @@ PrefShortcuts::PrefShortcuts(GuiPreferences * form)
shortcut_, SLOT(reject()));
connect(shortcut_->clearPB, SIGNAL(clicked()),
this, SLOT(shortcut_clearPB_pressed()));
+ connect(shortcut_->removePB, SIGNAL(clicked()),
+ this, SLOT(shortcut_removePB_pressed()));
connect(shortcut_->okPB, SIGNAL(clicked()),
this, SLOT(shortcut_okPB_pressed()));
connect(shortcut_->cancelPB, SIGNAL(clicked()),
@@ -2268,6 +2270,9 @@ void PrefShortcuts::modifyShortcut()
if (item->flags() & Qt::ItemIsSelectable) {
shortcut_->lfunLE->setText(item->text(0));
shortcut_->shortcutWG->setText(item->text(1));
+ KeySequence seq;
+ seq.parse(fromqstr(item->data(1, Qt::UserRole).toString()));
+ shortcut_->shortcutWG->setKeySequence(seq);
shortcut_->shortcutWG->setFocus();
shortcut_->exec();
}
@@ -2430,6 +2435,12 @@ void PrefShortcuts::shortcut_clearPB_pressed()
}
+void PrefShortcuts::shortcut_removePB_pressed()
+{
+ shortcut_->shortcutWG->removeFromSequence();
+}
+
+
/////////////////////////////////////////////////////////////////////
//
// PrefIdentity
diff --git a/src/frontends/qt4/GuiPrefs.h b/src/frontends/qt4/GuiPrefs.h
index 453b1b105a..b2e6813199 100644
--- a/src/frontends/qt4/GuiPrefs.h
+++ b/src/frontends/qt4/GuiPrefs.h
@@ -452,6 +452,7 @@ public Q_SLOTS:
void shortcut_okPB_pressed();
void shortcut_cancelPB_pressed();
void shortcut_clearPB_pressed();
+ void shortcut_removePB_pressed();
void on_shortcutsTW_itemDoubleClicked();
private:
diff --git a/src/frontends/qt4/ui/ShortcutUi.ui b/src/frontends/qt4/ui/ShortcutUi.ui
index 88d2766801..bf191752d4 100644
--- a/src/frontends/qt4/ui/ShortcutUi.ui
+++ b/src/frontends/qt4/ui/ShortcutUi.ui
@@ -5,8 +5,8 @@
0
0
- 348
- 106
+ 421
+ 111
@@ -22,60 +22,7 @@
6
- -
-
-
- true
-
-
- Type shortcut after clicking on this field. You can reset the content with the 'Clear' button
-
-
-
-
-
-
- -
-
-
- Enter LyX function or command sequence
-
-
-
-
-
-
- -
-
-
- Clear current shortcut
-
-
- C&lear
-
-
-
- -
-
-
- &Function:
-
-
- lfunLE
-
-
-
- -
-
-
- &Shortcut:
-
-
- shortcutWG
-
-
-
- -
+
-
0
@@ -124,6 +71,69 @@
+ -
+
+
+ Enter LyX function or command sequence
+
+
+
+
+
+
+ -
+
+
+ Remove last key from the shortcut sequence
+
+
+ &Delete Key
+
+
+
+ -
+
+
+ Clear current shortcut
+
+
+ C&lear
+
+
+
+ -
+
+
+ &Shortcut:
+
+
+ shortcutWG
+
+
+
+ -
+
+
+ &Function:
+
+
+ lfunLE
+
+
+
+ -
+
+
+ true
+
+
+ Type shortcut after clicking on this field. You can reset the content with the 'Clear' button
+
+
+
+
+
+