Commit dea10dfd authored by Claudio Cambra's avatar Claudio Cambra
Browse files

Pressing Escape now closes dialog windows, overlay sheets, and incidence info

parent 30a03067
Pipeline #89027 passed with stage
in 2 minutes and 4 seconds
......@@ -54,6 +54,26 @@ Kirigami.ApplicationWindow {
pageStack.globalToolBar.canContainHandles: true
pageStack.globalToolBar.style: Kirigami.ApplicationHeaderStyle.ToolBar
pageStack.initialPage: Kirigami.Settings.isMobile ? scheduleViewComponent : monthViewComponent
QQC2.Action {
id: closeOverlayAction
shortcut: "Escape"
onTriggered: {
if(applicationWindow().overlay.children[0].visible) {
applicationWindow().overlay.children[0].visible = false;
return;
}
if(pageStack.layers.depth > 1) {
pageStack.layers.pop();
return;
}
if(contextDrawer.visible) {
contextDrawer.close();
return;
}
}
}
Component.onCompleted: {
switch (Config.lastOpenedView) {
......@@ -163,22 +183,26 @@ Kirigami.ApplicationWindow {
}
function onOpenSettings() {
pageStack.pushDialogLayer("qrc:/SettingsPage.qml", {
const openDialogWindow = pageStack.pushDialogLayer("qrc:/SettingsPage.qml", {
width: root.width
}, {
title: i18n("Configure"),
width: Kirigami.Units.gridUnit * 45,
height: Kirigami.Units.gridUnit * 35
})
});
openDialogWindow.Keys.escapePressed.connect(function() { openDialogWindow.closeDialog() })
}
function onOpenTagManager() {
pageStack.pushDialogLayer("qrc:/TagManagerPage.qml", {
const openDialogWindow = pageStack.pushDialogLayer("qrc:/TagManagerPage.qml", {
width: root.width
}, {
width: Kirigami.Units.gridUnit * 30,
height: Kirigami.Units.gridUnit * 30
})
});
openDialogWindow.Keys.escapePressed.connect(function() { openDialogWindow.closeDialog() })
}
function onOpenKCommandBarAction() {
......@@ -240,8 +264,6 @@ Kirigami.ApplicationWindow {
return i18n("Calendar");
}
pageStack.initialPage: Kirigami.Settings.isMobile ? scheduleViewComponent : monthViewComponent
menuBar: Loader {
id: menuLoader
active: Kirigami.Settings.hasPlatformMenuBar != undefined ?
......@@ -388,7 +410,7 @@ Kirigami.ApplicationWindow {
id: incidenceEditor
onAdded: CalendarManager.addIncidence(incidenceWrapper)
onEdited: CalendarManager.editIncidence(incidenceWrapper)
onCancel: pageStack.pop(monthViewComponent)
onCancel: pageStack.layers.pop()
}
Loader {
......@@ -427,6 +449,7 @@ Kirigami.ApplicationWindow {
onAdded: CalendarManager.addIncidence(incidenceWrapper)
onEdited: CalendarManager.editIncidence(incidenceWrapper)
onCancel: root.close()
Keys.onEscapePressed: root.close()
}
visible: true
......@@ -494,7 +517,7 @@ Kirigami.ApplicationWindow {
editorWindowedLoader.active = true
return editorWindowedLoader.item.incidenceEditor
} else {
pageStack.push(incidenceEditor);
pageStack.layers.push(incidenceEditor);
return incidenceEditor;
}
}
......
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