Commit 88aabf06 authored by David Edmundson's avatar David Edmundson

Block shortcuts when recording key sequences

Otherwise you can't select alt+a as a shortcut without triggering the
nmenomic generated shortcut on the "add application" button.

Testing done:
- clicked "Add custom shortcut", pressed alt+a, it was recorded
successfully

- focussed "Add custom shortcut", pressed alt+a, the relevant shortcut
activated

Note that isRecording was already declared, but not defined, which is
why it looks like my diff misses something.

BUG: 425979
parent 93d82d5b
......@@ -83,6 +83,13 @@ RowLayout {
}
}
Keys.onShortcutOverride: {
if (_helper.isRecording) {
_helper.keyPressed(event.key, event.modifiers);
event.accepted = true;
}
}
Keys.onPressed: {
_helper.keyPressed(event.key, event.modifiers);
event.accepted = true;
......
......@@ -237,7 +237,10 @@ void KeySequenceHelper::setCheckAgainstShortcutTypes(KeySequenceHelper::Shortcut
Q_EMIT checkAgainstShortcutTypesChanged();
}
bool KeySequenceHelper::isRecording() const
{
return d->isRecording;
}
void KeySequenceHelper::clearKeySequence()
{
......@@ -251,6 +254,7 @@ void KeySequenceHelperPrivate::startRecording()
oldKeySequence = keySequence;
keySequence = QKeySequence();
isRecording = true;
emit q->isRecordingChanged();
grabbedWindow = QQuickRenderControl::renderWindowFor(q->window());
if (!grabbedWindow) {
grabbedWindow = q->window();
......@@ -265,6 +269,8 @@ void KeySequenceHelper::doneRecording()
{
d->modifierlessTimeout.stop();
d->isRecording = false;
emit isRecordingChanged();
d->stealActions.clear();
if (d->grabbedWindow) {
d->grabbedWindow->setKeyboardGrabEnabled(false);
......
......@@ -51,6 +51,12 @@ class KeySequenceHelper : public QQuickItem
NOTIFY checkAgainstShortcutTypesChanged
)
Q_PROPERTY(
bool isRecording
READ isRecording
NOTIFY isRecordingChanged
)
public:
enum ShortcutType {
......@@ -116,6 +122,7 @@ Q_SIGNALS:
void shortcutDisplayChanged(const QString &string);
void captureFinished();
void checkAgainstShortcutTypesChanged();
void isRecordingChanged();
public Q_SLOTS:
void captureKeySequence();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment