1/* 2 * SPDX-FileCopyrightText: 2019 Dimitris Kardarakos <dimkard@posteo.net> 3 * 4 * SPDX-License-Identifier: GPL-3.0-or-later 5 */ 6 7import QtQuick 2.7 8import QtQuick.Controls 2.0 as Controls2 9import QtQuick.Layouts 1.3 10import org.kde.kirigami 2.0 as Kirigami 11 12Kirigami.OverlaySheet { 13 id: datePickerSheet 14 15 property alias selectedDate: calendarMonth.selectedDate 16 property string headerText 17 18 signal datePicked 19 20 21 header: Kirigami.Heading { 22 level:1 23 text: datePickerSheet.headerText 24 } 25 26 ColumnLayout { 27 Layout.preferredWidth: calendarMonth.dayRectWidth * 8 28 29 PickerMonthView { 30 id: calendarMonth 31 32 Layout.fillWidth: true 33 } 34 35 RowLayout { 36 spacing: Kirigami.Units.largeSpacing 37 Layout.alignment : Qt.AlignHCenter 38 39 RowLayout { 40 spacing: 0 41 42 Controls2.ToolButton { 43 icon.name: "go-previous" 44 45 onClicked: calendarMonth.previousMonth() 46 } 47 48 Controls2.ToolButton { 49 text: "Previous" 50 51 onClicked: calendarMonth.previousMonth() 52 } 53 } 54 55 RowLayout { 56 spacing: 0 57 58 Controls2.ToolButton { 59 text: "Next" 60 61 onClicked: calendarMonth.nextMonth() 62 } 63 64 Controls2.ToolButton { 65 icon.name: "go-next" 66 67 onClicked: calendarMonth.nextMonth() 68 } 69 } 70 } 71 } 72 73 footer: RowLayout { 74 75 Item { 76 Layout.fillWidth: true 77 } 78 79 Controls2.ToolButton { 80 text: "OK" 81 82 onClicked: { 83 datePickerSheet.datePicked(); 84 datePickerSheet.close(); 85 } 86 } 87 88 Controls2.ToolButton { 89 text: "Cancel" 90 91 onClicked: datePickerSheet.close() 92 } 93 } 94} 95