Commit 265456b1 authored by Arjen Hiemstra's avatar Arjen Hiemstra
Browse files

Use Shortcut for key navigation of the main image view

The list view supports key navigation but only if it has focus. This
means that as soon as any tool button or other item is clicked, the
focus is lost and key navigation stops working. To prevent that, we use
Shortcut as a method that doesn't need focus.

Left/right will now always move through the images. Space will now stop
the slideshow if it is currently running.
parent 1b02c9d2
......@@ -677,7 +677,6 @@ Kirigami.Page {
width: Kirigami.Units.gridUnit * 2
height: width
icon.name: "arrow-left"
Keys.forwardTo: [listView]
Accessible.name: i18n("Previous image")
onClicked: {
if (opacity === 0) return; // the best we can do without flicker unfortunately
......@@ -703,7 +702,6 @@ Kirigami.Page {
width: Kirigami.Units.gridUnit * 2
height: width
icon.name: "arrow-right"
Keys.forwardTo: [listView]
Accessible.name: i18n("Next image")
onClicked: {
if (opacity === 0) return;
......@@ -729,4 +727,23 @@ Kirigami.Page {
imagePath: listView.currentItem.currentImageSource
}
}
Shortcut {
sequence: "Left"
onActivated: listView.decrementCurrentIndex()
}
Shortcut {
sequence: "Right"
onActivated: listView.incrementCurrentIndex()
}
Shortcut {
sequence: "Space"
onActivated: {
if (slideshowManager.running) {
slideshowManager.stop()
}
}
}
}
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