Warning, /pim/itinerary/src/app/SheetDrawer.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2024 Mathis BrĂ¼chert <mbb@kaidan.im>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 import QtQuick
0008 import QtQuick.Layouts
0009 import QtQuick.Controls as QQC2
0010 import org.kde.kirigami as Kirigami
0011 import org.kde.kirigamiaddons.components as Components
0012 
0013 
0014 Item {
0015     id: root
0016 
0017     property Component contentItem
0018     property Component headerItem
0019     property Component footerItem
0020 
0021     signal closed()
0022     Component.onCompleted: {
0023         sheet.closed.connect(root.closed)
0024         drawer.closed.connect(root.closed)
0025 
0026     }
0027 
0028     function open() {
0029         if (Kirigami.Settings.isMobile) {
0030             drawer.open()
0031             drawer.drawerContentItem = contentItem.createObject(drawer)
0032             drawer.headerContentItem = headerItem.createObject(drawer)
0033         } else {
0034             sheet.open()
0035             sheet.contentItem = contentItem.createObject(sheet)
0036             sheet.header.contentItem = headerItem.createObject(sheet)
0037             if (root.footerItem)
0038                 sheet.footer.contentItem = footerItem.createObject(sheet)
0039         }
0040     }
0041 
0042     function close() {
0043         drawer.close()
0044         sheet.close()
0045     }
0046 
0047     Components.BottomDrawer {
0048         id: drawer
0049         parent: applicationWindow().overlay
0050     }
0051 
0052 
0053     QQC2.Dialog {
0054         id: sheet
0055         parent: applicationWindow().overlay
0056         background: Components.DialogRoundedBackground {}
0057         header: QQC2.Control {
0058             leftPadding: Kirigami.Units.largeSpacing + Kirigami.Units.smallSpacing
0059             rightPadding: Kirigami.Units.largeSpacing + Kirigami.Units.smallSpacing
0060             topPadding: Kirigami.Units.largeSpacing
0061             bottomPadding: 0
0062         }
0063         footer: QQC2.Control {
0064             leftPadding: Kirigami.Units.largeSpacing + Kirigami.Units.smallSpacing
0065             rightPadding: Kirigami.Units.largeSpacing + Kirigami.Units.smallSpacing
0066             topPadding: Kirigami.Units.largeSpacing
0067             bottomPadding: 0
0068         }
0069 
0070         x: Math.round((parent.width - width) / 2)
0071         y: Math.round((parent.height - height) / 2)
0072 
0073         width: Math.min(parent.width - Kirigami.Units.gridUnit * 4, Kirigami.Units.gridUnit * 30)
0074         height: Math.min(parent.height - Kirigami.Units.gridUnit * 4, implicitHeight)
0075 
0076         rightPadding: 0
0077         leftPadding: 0
0078         bottomPadding: 0
0079 
0080     }
0081 
0082 }