Warning, /plasma-mobile/calindori/src/contents/ui/Attendees.qml is written in an unsupported language. File is not indexed.

0001 /*
0002 * SPDX-FileCopyrightText: 2021 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.14 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 ColumnLayout {
0014     id: root
0015 
0016     property var attendeesModel
0017     property var incidenceData
0018 
0019     Controls2.ToolButton {
0020         text: i18n("Add")
0021         icon.name: 'contact-new-symbolic'
0022 
0023         onClicked: {
0024             if (!Calindori.CalendarController.activeCalendar.isExternal) {
0025                 msg.text = i18n("Attendee management is available only in external calendars that are synchronized online");
0026                 msg.visible = true;
0027                 return;
0028             }
0029 
0030             if (!Calindori.CalendarController.activeCalendar.ownerName || !Calindori.CalendarController.activeCalendar.ownerEmail) {
0031                 msg.text = i18n("Please set the calendar owner details in the application settings");
0032                 msg.visible = true;
0033                 return;
0034             }
0035 
0036             msg.visible = false;
0037             attendeeEditor.preEditEmails = attendeesModel.emails();
0038             attendeeEditor.selectedPersons = [];
0039             attendeeEditor.open();
0040         }
0041 
0042     }
0043 
0044     Kirigami.Separator {
0045         Layout.fillWidth: true
0046     }
0047 
0048     RowLayout {
0049         visible: attendeesList.count !== 0
0050         Kirigami.Icon {
0051             source: "meeting-organizer"
0052         }
0053 
0054         Controls2.Label {
0055             text: incidenceData ? incidenceData.organizerName : Calindori.CalendarController.activeCalendar.ownerName
0056             wrapMode: Text.WordWrap
0057             Layout.fillWidth: true
0058         }
0059     }
0060 
0061     Kirigami.Separator {
0062         visible: attendeesList.count !== 0
0063         Layout.fillWidth: true
0064     }
0065 
0066     Repeater {
0067         id: attendeesList
0068 
0069         model: attendeesModel
0070 
0071         delegate: Kirigami.SwipeListItem {
0072             contentItem: RowLayout {
0073                 Kirigami.Icon {
0074                     source: model.statusIcon
0075                 }
0076 
0077                 Controls2.Label {
0078                     text: model.name
0079                     wrapMode: Text.WordWrap
0080                 }
0081             }
0082 
0083             Layout.fillWidth: true
0084 
0085             actions: [
0086                 Kirigami.Action {
0087                     id: removeAttendee
0088 
0089                     iconName: "delete"
0090                     enabled: Calindori.CalendarController.activeCalendar.isExternal && Calindori.CalendarController.activeCalendar.ownerName && Calindori.CalendarController.activeCalendar.ownerEmail
0091 
0092                     onTriggered: attendeesModel.removeItem(model.index)
0093                 },
0094 
0095                 Kirigami.Action {
0096                     id: editAttendee
0097 
0098                     iconName: "document-edit"
0099                     enabled: Calindori.CalendarController.activeCalendar.isExternal && Calindori.CalendarController.activeCalendar.ownerName && Calindori.CalendarController.activeCalendar.ownerEmail
0100 
0101                     onTriggered: {
0102                         infoEditor.attendeeModelRow = model;
0103                         infoEditor.open();
0104                     }
0105                 }
0106             ]
0107         }
0108     }
0109 
0110     Kirigami.PlaceholderMessage {
0111         width: parent.width - (Kirigami.Units.largeSpacing * 4)
0112         visible: attendeesList.count === 0
0113         icon.name: "meeting-attending"
0114         text: i18n("No attendees yet")
0115     }
0116 
0117     AttendeePicker {
0118         id: attendeeEditor
0119 
0120         onEditorCompleted: attendeesModel.addPersons(selectedUris)
0121     }
0122 
0123     Kirigami.InlineMessage {
0124         id: msg
0125 
0126         showCloseButton: true
0127         visible: false
0128         Layout.fillWidth: true
0129     }
0130 
0131     Kirigami.OverlaySheet {
0132         id: infoEditor
0133 
0134         property var attendeeModelRow
0135 
0136         header: Kirigami.Heading {
0137             level: 1
0138             text: infoEditor.attendeeModelRow && infoEditor.attendeeModelRow.name ? infoEditor.attendeeModelRow.name : ""
0139         }
0140 
0141         contentItem: AttendeeRoleEditor {
0142             attendeeModelRow: infoEditor.attendeeModelRow
0143         }
0144 
0145         footer: RowLayout {
0146             Item {
0147                 Layout.fillWidth: true
0148             }
0149 
0150             Controls2.ToolButton {
0151                 text: i18n("Close")
0152 
0153                 onClicked: infoEditor.close()
0154             }
0155         }
0156     }
0157 }