Warning, /plasma-mobile/calindori/src/contents/ui/IncidenceEditor.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.3 as Kirigami
0011 import org.kde.calindori 0.1 as Calindori
0012 
0013 ColumnLayout {
0014     id: root
0015 
0016     property var incidenceData
0017     property var calendar
0018     property int incidenceType
0019     property alias description: description.text
0020     property alias location: location.text
0021     property alias incidenceStatus: statusCombo.currentValue
0022     property alias completed: completed.checked
0023     readonly property string canceledStatus: i18n("Canceled")
0024     readonly property string confirmedStatus: i18n("Confirmed")
0025     readonly property string tentativeStatus: i18n("Tentative")
0026 
0027     Kirigami.FormLayout {
0028         Layout.fillWidth: true
0029 
0030         Controls2.Label {
0031             id: calendarName
0032 
0033             text: root.calendar.name
0034             Kirigami.FormData.label: i18n("Calendar:")
0035         }
0036 
0037         Controls2.ComboBox {
0038             id: statusCombo
0039 
0040             visible: incidenceType === 0
0041             model: [
0042                 {"name": canceledStatus, "code": Calindori.IncidenceModel.StatusCanceled},
0043                 {"name": confirmedStatus, "code": Calindori.IncidenceModel.StatusConfirmed},
0044                 {"name": tentativeStatus, "code": Calindori.IncidenceModel.StatusTentative}
0045             ]
0046             textRole: "name"
0047             valueRole: "code"
0048             Layout.fillWidth: true
0049             Kirigami.FormData.label: i18n("Status:")
0050 
0051             Component.onCompleted: {
0052                 currentIndex = root.incidenceData ? indexOfValue(root.incidenceData.status) : indexOfValue(Calindori.IncidenceModel.StatusConfirmed);
0053             }
0054         }
0055 
0056         Controls2.TextField {
0057             id: location
0058 
0059             enabled: (incidenceType === 1 && root.completed) ? false : true
0060             text: root.incidenceData ? root.incidenceData.location : ""
0061             wrapMode: Text.WrapAnywhere
0062             Kirigami.FormData.label: i18n("Location:")
0063         }
0064 
0065         Controls2.TextField {
0066             id: description
0067 
0068             enabled: (incidenceType === 1 && root.completed) ? false : true
0069             wrapMode: Text.WrapAnywhere
0070             text: root.incidenceData ? root.incidenceData.description : ""
0071             Kirigami.FormData.label: i18n("Description:")
0072         }
0073         Controls2.CheckBox {
0074             id: completed
0075 
0076             visible: incidenceType === 1
0077             checked: root.incidenceData ? root.incidenceData.completed: false
0078             Kirigami.FormData.label: i18n("Completed:")
0079         }
0080     }
0081 
0082 }
0083