8import QtQuick.Templates as T
10import org.kde.kirigami as Kirigami
11import "templates/private" as TP
12import "templates" as KT
71 property Item pageStack
78 property font font: Kirigami.Theme.defaultFont
83 property Locale locale
88 property T.MenuBar menuBar
107 property KT.AbstractApplicationHeader header
121 property bool controlsVisible:
true
132 property OverlayDrawer globalDrawer
141 property bool wideScreen: width >= Kirigami.Units.gridUnit * 60
184 property OverlayDrawer contextDrawer
191 default property alias __data: contentItemRoot.data
196 readonly
property Item contentItem: Item {
201 topMargin: controlsVisible ? (root.header ? root.header.height : 0) + (root.menuBar ? root.menuBar.height : 0) : 0
202 bottomMargin: controlsVisible && root.footer ? root.footer.height : 0
203 leftMargin: root.globalDrawer && root.globalDrawer.modal === false ? root.globalDrawer.contentItem.width * root.globalDrawer.position : 0
204 rightMargin: root.contextDrawer && root.contextDrawer.modal === false ? root.contextDrawer.contentItem.width * root.contextDrawer.position : 0
213 property color color: Kirigami.Theme.backgroundColor
218 property Item background
220 property alias overlay: overlayRoot
235 function showPassiveNotification(message, timeout, actionText, callBack) {
236 notificationsObject.showNotification(message, timeout, actionText, callBack);
243 function hidePassiveNotification(index = 0) {
244 notificationsObject.hideNotification(index);
251 function applicationWindow() {
259 menuBar.parent = root.contentItem
260 if (menuBar instanceof T.ToolBar) {
261 menuBar.position = T.ToolBar.Footer
262 }
else if (menuBar instanceof T.DialogButtonBox) {
263 menuBar.position = T.DialogButtonBox.Footer
265 menuBar.width =
Qt.binding(() => root.contentItem.width)
267 menuBar.y =
Qt.binding(() => -menuBar.height - (root.header.height ? root.header.height : 0))
273 header.parent = root.contentItem
274 if (header instanceof T.ToolBar) {
275 header.position = T.ToolBar.Header
276 }
else if (header instanceof T.DialogButtonBox) {
277 header.position = T.DialogButtonBox.Header
279 header.width =
Qt.binding(() => root.contentItem.width)
280 header.y =
Qt.binding(() => -header.height)
286 footer.parent = root.contentItem
287 if (footer instanceof T.ToolBar) {
288 footer.position = T.ToolBar.Footer
289 }
else if (footer instanceof T.DialogButtonBox) {
290 footer.position = T.DialogButtonBox.Footer
292 footer.width =
Qt.binding(() => root.contentItem.width)
293 footer.y =
Qt.binding(() => root.contentItem.height)
297 onBackgroundChanged: {
299 background.parent = root.contentItem
300 background.anchors.fill = background.parent
304 onPageStackChanged: pageStack.parent = root.contentItem;
307 LayoutMirroring.enabled:
Qt.application.layoutDirection ===
Qt.RightToLeft
308 LayoutMirroring.childrenInherit:
true
310 TP.PassiveNotificationsManager {
311 id: notificationsObject
312 anchors.bottom: parent.bottom
313 anchors.horizontalCenter: parent.horizontalCenter
319 parent: root.parent || root
332 onGlobalDrawerChanged: {
334 globalDrawer.parent =
Qt.binding(() => visible ? T.Overlay.overlay : null);
337 onContextDrawerChanged: {
339 contextDrawer.parent =
Qt.binding(() => visible ? T.Overlay.overlay : null);
345 globalDrawer.visible = globalDrawer.drawerOpen;
348 contextDrawer.visible = contextDrawer.drawerOpen;
352 implicitWidth: Kirigami.Settings.isMobile ? Kirigami.Units.gridUnit * 30 : Kirigami.Units.gridUnit * 55
353 implicitHeight: Kirigami.Settings.isMobile ? Kirigami.Units.gridUnit * 45 : Kirigami.Units.gridUnit * 40