Warning, /plasma-mobile/calindori/src/contents/ui/AttendeePicker.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.5 as Controls2 0009 import QtQuick.Layouts 1.3 0010 import org.kde.kirigami 2.14 as Kirigami 0011 import org.kde.calindori 0.1 as Calindori 0012 import org.kde.people 1.0 as KPeople 0013 0014 Kirigami.OverlaySheet { 0015 id: root 0016 0017 property var selectedPersons: [] 0018 property var preEditEmails: [] 0019 0020 signal editorCompleted (var selectedUris) 0021 0022 header: Kirigami.SearchField { 0023 id: searchField 0024 0025 topInset: Kirigami.Units.smallSpacing 0026 bottomInset: Kirigami.Units.smallSpacing 0027 0028 onTextChanged: filterModel.setFilterFixedString(text) 0029 } 0030 0031 0032 contentItem: ListView { 0033 id: peopleList 0034 0035 clip: true 0036 0037 model: KPeople.PersonsSortFilterProxyModel { 0038 id: filterModel 0039 0040 filterCaseSensitivity: Qt.CaseInsensitive 0041 requiredProperties: ["email"] 0042 0043 0044 Component.onCompleted: { 0045 sourceModel = personsModel 0046 sort(0); 0047 } 0048 } 0049 0050 Kirigami.PlaceholderMessage { 0051 anchors.centerIn: parent 0052 icon.name: "user" 0053 text: i18n("No contacts found") 0054 visible: peopleList.count === 0 0055 } 0056 0057 delegate: Kirigami.DelegateRecycler { 0058 sourceComponent: contactListDelegate 0059 } 0060 0061 Component { 0062 id: contactListDelegate 0063 0064 Kirigami.BasicListItem { 0065 property var itemEmail: personData && personData.person && personData.person.contactCustomProperty("email") 0066 checkable: true 0067 enabled: model && root.preEditEmails.indexOf(itemEmail) === -1 0068 checked: model && root.selectedPersons && root.selectedPersons.indexOf(model.personUri) >= 0 0069 0070 onCheckedChanged: { 0071 if(!model) { 0072 return; 0073 } 0074 0075 if(checked) { 0076 var uris = root.selectedPersons; 0077 uris.push(model.personUri); 0078 root.selectedPersons = uris; 0079 } 0080 else { 0081 var uris = root.selectedPersons; 0082 uris.pop(model.personUri); 0083 root.selectedPersons = uris; 0084 } 0085 } 0086 0087 KPeople.PersonData { 0088 id: personData 0089 0090 personUri: model && model.personUri 0091 } 0092 0093 icon: model && model.decoration 0094 label: model && model.display 0095 subtitle: itemEmail 0096 } 0097 } 0098 0099 KPeople.PersonsModel { 0100 id: personsModel 0101 } 0102 } 0103 0104 footer: RowLayout { 0105 Item { 0106 Layout.fillWidth: true 0107 } 0108 0109 Controls2.ToolButton { 0110 text: i18n("Add") 0111 icon.name: 'contact-new-symbolic' 0112 0113 enabled: selectedPersons.length > 0 0114 0115 onClicked: { 0116 editorCompleted(root.selectedPersons); 0117 root.close(); 0118 } 0119 } 0120 0121 Controls2.ToolButton { 0122 text: i18n("Cancel") 0123 icon.name: 'dialog-cancel' 0124 0125 onClicked: { 0126 root.close(); 0127 } 0128 } 0129 } 0130 }