diff --git a/discover/qml/DiscoverWindow.qml b/discover/qml/DiscoverWindow.qml --- a/discover/qml/DiscoverWindow.qml +++ b/discover/qml/DiscoverWindow.qml @@ -20,6 +20,7 @@ readonly property Component topSourcesComp: Qt.createComponent("qrc:/qml/SourcesPage.qml") readonly property Component phoneWindow: Qt.createComponent("qrc:/qml/DiscoverWindow_PlasmaPhone.qml") readonly property QtObject stack: loader.item.stack + readonly property bool goBackEnabled: window.navigationEnabled && window.stack.depth>1 property Component currentTopLevel: defaultStartup ? topBrowsingComp : loadingComponent property bool defaultStartup: true property bool navigationEnabled: true @@ -37,6 +38,11 @@ loader.item.clearSearch(); } + function goBack() { + if (window.goBackEnabled) + window.stack.pop().destroy(2000) + } + Component { id: loadingComponent Item { @@ -152,11 +158,16 @@ Layout.fillWidth: true } - Main { - id: main + MouseArea { Layout.fillWidth: true Layout.fillHeight: true - currentTopLevel: window.currentTopLevel + acceptedButtons: Qt.BackButton + onClicked: window.goBack() + Main { + id: main + anchors.fill: parent + currentTopLevel: window.currentTopLevel + } } } } diff --git a/discover/qml/MuonToolbar.qml b/discover/qml/MuonToolbar.qml --- a/discover/qml/MuonToolbar.qml +++ b/discover/qml/MuonToolbar.qml @@ -61,10 +61,10 @@ action: Action { shortcut: "Alt+Up" iconName: "go-previous" - enabled: window.navigationEnabled && window.stack.depth>1 + enabled: window.goBackEnabled tooltip: i18n("Back") - onTriggered: { window.stack.pop().destroy(2000) } + onTriggered: { window.goBack() } } }