Commit 3b432fea authored by Claudio Cambra's avatar Claudio Cambra
Browse files

Improve our use of and simplify the NavigationMouseArea

Mouse button navigation should now work in all the calendar views
parent 7813326f
Pipeline #180510 failed with stage
in 15 minutes and 26 seconds
// SPDX-FileCopyrightText: 2021 Felipe Kinoshita <kinofhek@gmail.com>
// SPDX-FileCopyrightText: 2022 Claudio Cambra <claudio.cambra@gmail.com>
// SPDX-License-Identifier: LGPL-2.0-or-later
import QtQuick 2.15
import QtQuick.Controls 2.15 as QQC2
MouseArea {
acceptedButtons: Qt.BackButton | Qt.ForwardButton
propagateComposedEvents: true
onClicked: {
if (mouse.button === Qt.BackButton) {
moveViewBackwardsAction.trigger();
} else if (mouse.button === Qt.ForwardButton) {
moveViewForwardsAction.trigger();
}
}
}
// SPDX-FileCopyrightText: 2021 Felipe Kinoshita <kinofhek@gmail.com>
// SPDX-License-Identifier: LGPL-2.0-or-later
import QtQuick 2.15
import QtQuick.Controls 2.15 as QQC2
import QtQuick.Layouts 1.15
import org.kde.kirigami 2.15 as Kirigami
import org.kde.kalendar 1.0 as Kalendar
import "dateutils.js" as DateUtils
MouseArea {
anchors.fill: parent
property int wheelDelta: 0
acceptedButtons: Qt.BackButton | Qt.ForwardButton
onClicked: {
if (mouse.button == Qt.BackButton) {
if (pageStack.currentItem.objectName === "monthView") {
pathView.decrementCurrentIndex();
monthPage.initialMonth = false;
} else if (pageStack.currentItem.objectName === "scheduleView") {
setToDate(DateUtils.addMonthsToDate(pathView.currentItem.firstDayOfMonth, -1));
}
} else if (mouse.button == Qt.ForwardButton) {
if (pageStack.currentItem.objectName === "monthView") {
pathView.incrementCurrentIndex();
monthPage.initialMonth = false;
} else if (pageStack.currentItem.objectName === "scheduleView") {
setToDate(DateUtils.addMonthsToDate(pathView.currentItem.firstDayOfMonth, 1))
}
}
}
}
......@@ -225,7 +225,5 @@ Kirigami.Page {
}
}
}
KeyboardNavigationMouseArea {}
}
......@@ -594,6 +594,4 @@ Kirigami.Page {
}
}
}
KeyboardNavigationMouseArea {}
}
......@@ -159,6 +159,8 @@ Kirigami.ApplicationWindow {
}
}
KBMNavigationMouseArea { anchors.fill: parent }
Connections {
target: KalendarApplication
function onOpenMonthView() {
......
......@@ -45,7 +45,7 @@ SPDX-License-Identifier: CC0-1.0
<file alias="TitleDateButton.qml">contents/ui/Controls/TitleDateButton.qml</file>
<file alias="IncidenceMouseArea.qml">contents/ui/Controls/IncidenceMouseArea.qml</file>
<file alias="KeyboardNavigationMouseArea.qml">contents/ui/Controls/KeyboardNavigationMouseArea.qml</file>
<file alias="KBMNavigationMouseArea.qml">contents/ui/Controls/KBMNavigationMouseArea.qml</file>
<file alias="DayMouseArea.qml">contents/ui/Controls/DayMouseArea.qml</file>
<file alias="ColoredCheckbox.qml">contents/ui/Controls/ColoredCheckbox.qml</file>
<file alias="Tag.qml">contents/ui/Controls/Tag.qml</file>
......
Supports Markdown
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