Verified Commit 75f64730 authored by Rinigus Saar's avatar Rinigus Saar Committed by Jonah Brüchert

refactor pages to be shown as pages, not layers

By pushing pages into the stack, we can swipe out the dialog
page (Settings, Bookmarks, ...) if we wish.

The browser page (index=0) is made to fill column width with all
other pages required to specify 'Kirigami.ColumnView.fillWidth:
false' in their properties. This ensures that the width of the
pages is adjusted correctly in narrow and wide modes.

The browser page is pinned as well. So, in wide mode, all pushed
pages will be shown on the top of each other.

When the browser page becomes current, all other pages are popped
out from the stack.
parent aeb22a06
......@@ -22,18 +22,19 @@
import QtQuick 2.3
import QtQuick.Layouts 1.0
import org.kde.kirigami 2.4 as Kirigami
import org.kde.kirigami 2.7 as Kirigami
Kirigami.ScrollablePage {
// id: options
title: i18n("Bookmarks")
Kirigami.ColumnView.fillWidth: false
Component {
id: delegateComponent
UrlDelegate {
onClicked: pageStack.layers.pop()
onClicked: pageStack.pop()
onRemoved: browserManager.removeBookmark(url);
}
}
......
......@@ -22,18 +22,19 @@
import QtQuick 2.3
import QtQuick.Layouts 1.0
import org.kde.kirigami 2.4 as Kirigami
import org.kde.kirigami 2.7 as Kirigami
import org.kde.mobile.angelfish 1.0
Kirigami.ScrollablePage {
id: history
title: i18n("History")
Kirigami.ColumnView.fillWidth: false
Component {
id: delegateComponent
UrlDelegate {
onClicked: pageStack.layers.pop()
onClicked: pageStack.pop()
onRemoved: browserManager.removeFromHistory(url);
}
}
......
......@@ -74,7 +74,7 @@ Item {
Kirigami.Theme.inherit: true
onClicked: {
pageStack.layers.push("Tabs.qml")
pageStack.push(Qt.resolvedUrl("Tabs.qml"))
}
}
......
......@@ -23,7 +23,7 @@ import QtQuick 2.3
import QtQuick.Controls 2.4 as Controls
import QtQuick.Layouts 1.11
import org.kde.kirigami 2.2 as Kirigami
import org.kde.kirigami 2.7 as Kirigami
Kirigami.ScrollablePage {
......@@ -33,6 +33,7 @@ Kirigami.ScrollablePage {
bottomPadding: 0
leftPadding: 0
rightPadding: 0
Kirigami.ColumnView.fillWidth: false
background: Rectangle {
Kirigami.Theme.colorSet: Kirigami.Theme.View
......
......@@ -26,16 +26,15 @@ import QtQuick.Controls 2.0 as Controls
import QtQuick.Layouts 1.0
import org.kde.kirigami 2.0 as Kirigami
import org.kde.kirigami 2.7 as Kirigami
// import org.kde.plasma.components 2.0 as PlasmaComponents
// import org.kde.plasma.extras 2.0 as PlasmaExtras
Kirigami.ScrollablePage {
id: tabsRoot
title: i18n("Tabs")
Kirigami.ColumnView.fillWidth: false
property int itemHeight: Math.round(itemWidth/ 3 * 2)
property int itemWidth: Kirigami.Units.gridUnit * 9
......@@ -108,7 +107,7 @@ Kirigami.ScrollablePage {
tabs.currentIndex = index;
//tabs.positionViewAtIndex(index, ListView.Beginning);
//tabs.positionViewAtEnd();
pageStack.layers.pop()
pageStack.pop()
}
}
......@@ -153,7 +152,7 @@ Kirigami.ScrollablePage {
//addressBar.forceActiveFocus();
//addressBar.selectAll();
tabs.currentIndex = tabs.count - 1;
pageStack.layers.pop()
pageStack.pop()
}
}
}
......
......@@ -84,9 +84,14 @@ Kirigami.ApplicationWindow {
browserManager.addToHistory(request);
}
// Only show ToolBar if a layer is open
property bool layerShown : pageStack.layers.depth > 1
pageStack.globalToolBar.style: layerShown ? Kirigami.ApplicationHeaderStyle.Auto : Kirigami.ApplicationHeaderStyle.None
pageStack.globalToolBar.showNavigationButtons: {
if (pageStack.depth <= 1)
return Kirigami.ApplicationHeaderStyle.None;
if (pageStack.currentIndex === pageStack.depth - 1)
return Kirigami.ApplicationHeaderStyle.ShowBackButton;
// not used so far, but maybe in future
return (Kirigami.ApplicationHeaderStyle.ShowBackButton | Kirigami.ApplicationHeaderStyle.ShowForwardButton);
}
globalDrawer: Kirigami.GlobalDrawer {
id: globalDrawer
......@@ -97,7 +102,7 @@ Kirigami.ApplicationWindow {
Kirigami.Action {
icon.name: "tab-duplicate"
onTriggered: {
pageStack.layers.push("Tabs.qml")
pageStack.push(Qt.resolvedUrl("Tabs.qml"))
}
text: i18n("Tabs")
},
......@@ -111,14 +116,14 @@ Kirigami.ApplicationWindow {
Kirigami.Action {
icon.name: "bookmarks"
onTriggered: {
pageStack.layers.push("Bookmarks.qml")
pageStack.push(Qt.resolvedUrl("Bookmarks.qml"))
}
text: i18n("Bookmarks")
},
Kirigami.Action {
icon.name: "view-history"
onTriggered: {
pageStack.layers.push("History.qml")
pageStack.push(Qt.resolvedUrl("History.qml"))
}
text: i18n("History")
},
......@@ -126,7 +131,7 @@ Kirigami.ApplicationWindow {
icon.name: "configure"
text: i18n("Settings")
onTriggered: {
pageStack.layers.push("Settings.qml")
pageStack.push(Qt.resolvedUrl("Settings.qml"))
}
}
]
......@@ -145,6 +150,9 @@ Kirigami.ApplicationWindow {
rightPadding: 0
topPadding: 0
bottomPadding: 0
globalToolBarStyle: Kirigami.ApplicationHeaderStyle.None
Kirigami.ColumnView.fillWidth: true
Kirigami.ColumnView.pinned: true
Kirigami.ColumnView.preventStealing: true
property bool privateMode: false
......@@ -359,4 +367,14 @@ Kirigami.ApplicationWindow {
}
}
}
Connections {
target: webBrowser.pageStack
onCurrentIndexChanged: {
// drop all sub pages as soon as the browser window is the
// focussed one
if (webBrowser.pageStack.currentIndex === 0)
webBrowser.pageStack.pop();
}
}
}
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