summaryrefslogtreecommitdiff
path: root/src/qml/Main.qml
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/Main.qml')
-rw-r--r--src/qml/Main.qml168
1 files changed, 168 insertions, 0 deletions
diff --git a/src/qml/Main.qml b/src/qml/Main.qml
new file mode 100644
index 0000000..cef37e9
--- /dev/null
+++ b/src/qml/Main.qml
@@ -0,0 +1,168 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+// SPDX-FileCopyrightText: 2024 Alexander Kavon <me+kue@alexkavon.com>
+
+import QtQuick
+import QtQuick.Controls as QQC2
+import QtQuick.Layouts
+
+import org.kde.kirigami as Kirigami
+import org.kde.kirigamiaddons.statefulapp as StatefulApp
+
+import org.kde.kue
+import org.kde.kue.settings as Settings
+
+StatefulApp.StatefulWindow {
+ id: root
+
+ property int counter: 0
+
+ title: i18nc("@title:window", "Kue")
+
+ windowName: "Kue"
+
+ minimumWidth: Kirigami.Units.gridUnit * 20
+ minimumHeight: Kirigami.Units.gridUnit * 20
+
+ application: KueApplication {
+ configurationView: Settings.KueConfigurationView {}
+ }
+
+ // Connections {
+ // target: root.application
+
+ // function onIncrementCounter(): void {
+ // root.counter += 1;
+ // }
+ // }
+
+ // globalDrawer: Kirigami.GlobalDrawer {
+ // // isMenu: !Kirigami.Settings.isMobile
+ // actions: [
+ // Kirigami.Action {
+ // id: incrementCounterAction
+ // fromQAction: root.application.action("increment_counter")
+ // },
+ // Kirigami.Action {
+ // separator: true
+ // },
+ // Kirigami.Action {
+ // fromQAction: root.application.action("options_configure")
+ // },
+ // Kirigami.Action {
+ // fromQAction: root.application.action("options_configure_keybinding")
+ // },
+ // Kirigami.Action {
+ // separator: true
+ // },
+ // Kirigami.Action {
+ // id: aboutAction
+ // fromQAction: root.application.action("open_about_page")
+ // },
+ // Kirigami.Action {
+ // fromQAction: root.application.action("open_about_kde_page")
+ // },
+ // Kirigami.Action {
+ // fromQAction: root.application.action("file_quit")
+ // }
+ // ]
+ // }
+
+ pageStack.initialPage: KueApplication.loading ? loadingPage : mainPage
+
+ Component {
+ id: loadingPage
+ Kirigami.Page {
+ Kirigami.PlaceholderMessage {
+ anchors.centerIn: parent
+ text: i18n("Loading, please wait...")
+ }
+ }
+ }
+
+ Kirigami.ScrollablePage {
+ id: mainPage
+
+ title: i18nc("@title", "Kue")
+
+ supportsRefreshing: true
+
+ ListView {
+ model: KueApplication.descendantsProxyModel
+ highlight: Rectangle {
+ width: parent.width
+ color: "blue"
+ }
+ delegate: Kirigami.SwipeListItem {
+ id: task
+
+ required property bool completed
+
+ contentItem: RowLayout {
+ QQC2.CheckBox {
+ id: control
+ checked: task.completed
+ onCheckedChanged: {
+ if (control.checked != task.completed) {
+ task.completed = control.checked;
+ }
+ }
+ indicator: Rectangle {
+ implicitWidth: 30
+ implicitHeight: 30
+ x: control.leftPadding
+ y: parent.height / 2 - height / 2
+ border.color: control.down ? "darkblue" : "gray"
+ border.width: 2
+ Rectangle {
+ visible: control.checked
+ color: "red"
+ radius: 1
+ width: 15
+ height: 15
+ anchors.margins: 5
+ anchors.fill: parent
+ }
+ }
+ }
+
+ QQC2.TextField {
+ id: taskEdit
+ Layout.fillWidth: true
+ height: Math.max(implicitHeight, Kirigami.Units.iconSizes.smallMedium)
+ placeholderText: "Task Info..."
+ text: model.display + " : " + task.completed
+ wrapMode: TextInput.Wrap
+ background: Rectangle {
+ id: taskEditBg
+ border.color: "transparent"
+ color: "transparent"
+ Rectangle {
+ visible: taskEdit.activeFocus
+ anchors.bottom: taskEditBg.bottom
+ height: 2
+ width: parent.width
+ color: "green"
+ }
+ }
+ }
+
+ Kirigami.Icon {
+ source: "view-list-details"
+ visible: taskEdit.activeFocus
+ implicitHeight: 20
+ implicitWidth: 20
+ }
+ }
+ }
+ section {
+ property: "section"
+ delegate: Kirigami.ListSectionHeader {
+ required property string section
+
+ text: qsTr("Section %1").arg(parseInt(section) + 1)
+ width: ListView.view.width - ListView.view.leftMargin - ListView.view.rightMargin
+ }
+ }
+ }
+ }
+}