Warning, /plasma-mobile/calindori/src/contents/ui/TodosCardView.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-FileCopyrightText: 2020 Dimitris Kardarakos <dimkard@posteo.net> 0003 * 0004 * SPDX-License-Identifier: GPL-3.0-or-later 0005 */ 0006 0007 import QtQuick 2.7 0008 import QtQuick.Controls 2.0 as Controls2 0009 import QtQuick.Layouts 1.3 0010 import org.kde.kirigami 2.12 as Kirigami 0011 import org.kde.calindori 0.1 as Calindori 0012 0013 Kirigami.ScrollablePage { 0014 id: root 0015 0016 property date todoDt 0017 property var calendar 0018 0019 title: i18n("Tasks") 0020 leftPadding: 0 0021 rightPadding: 0 0022 visible: Kirigami.Settings.isMobile || (!Kirigami.Settings.isMobile && !pageStack.lastVisibleItem.hasOwnProperty("isEditorPage")) 0023 0024 actions.main: Kirigami.Action { 0025 id: mainAction 0026 0027 icon.name: "resource-calendar-insert" 0028 text: i18n("Create Task") 0029 onTriggered: pageStack.push(todoEditor, {startDt: todoDt}) 0030 } 0031 0032 Kirigami.PlaceholderMessage { 0033 anchors.centerIn: parent 0034 icon.name: "view-calendar-tasks" 0035 width: parent.width - (Kirigami.Units.largeSpacing * 4) 0036 visible: cardsListview.count == 0 0037 text: !isNaN(todoDt) ? i18n("No tasks scheduled for %1", todoDt.toLocaleDateString(_appLocale, Locale.ShortFormat)) : i18n("No tasks scheduled") 0038 helpfulAction: mainAction 0039 } 0040 0041 Kirigami.CardsListView { 0042 id: cardsListview 0043 0044 model: todosModel 0045 enabled: count > 0 && (root.state !== "deleting") 0046 clip: true 0047 0048 delegate: TodoCard { 0049 id: cardDelegate 0050 0051 dataModel: model 0052 0053 actions: [ 0054 Kirigami.Action { 0055 text: i18n("Delete") 0056 icon.name: "delete" 0057 0058 onTriggered: { 0059 deleteMsg.taskUid = model.uid; 0060 deleteMsg.taskSummary = model.summary; 0061 root.state = "deleting"; 0062 } 0063 }, 0064 0065 Kirigami.Action { 0066 text: i18n("Edit") 0067 icon.name: "editor" 0068 0069 onTriggered: pageStack.push(todoEditor, { startDt: model.dtstart, uid: model.uid, incidenceData: model }) 0070 } 0071 ] 0072 } 0073 } 0074 0075 footer: Kirigami.InlineMessage { 0076 id: deleteMsg 0077 0078 property string taskUid 0079 property string taskSummary 0080 0081 text: i18n("Task %1 will be deleted", taskSummary) 0082 visible: false 0083 0084 actions: [ 0085 Kirigami.Action { 0086 text: i18n("Delete") 0087 0088 onTriggered: { 0089 Calindori.CalendarController.removeTodo(root.calendar, {"uid": deleteMsg.taskUid}); 0090 root.state = ""; 0091 } 0092 }, 0093 0094 Kirigami.Action { 0095 text: i18n("Cancel") 0096 0097 onTriggered: root.state = "" 0098 } 0099 ] 0100 } 0101 0102 Calindori.IncidenceModel { 0103 id: todosModel 0104 0105 appLocale: _appLocale 0106 filterDt: root.todoDt 0107 filterMode: 6 0108 } 0109 0110 Component { 0111 id: todoEditor 0112 TodoEditorPage { 0113 onEditcompleted: pageStack.pop() 0114 } 0115 } 0116 0117 states: [ 0118 State { 0119 name: "" 0120 PropertyChanges { target: deleteMsg; visible: false } 0121 }, 0122 State { 0123 name: "deleting" 0124 PropertyChanges { target: deleteMsg; visible: true } 0125 } 0126 ] 0127 }