Warning, /pim/merkuro/src/contacts/qml/ContactChooserPage.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-FileCopyrightText: 2022 Carl Schwan <carl@carlschwan.eu> 0002 // SPDX-License-Identifier: LGPL-3.0-or-later 0003 0004 import QtQuick 0005 import QtQuick.Controls as Controls 0006 import QtQuick.Layouts 0007 0008 import org.kde.kirigami as Kirigami 0009 import org.kde.kirigamiaddons.delegates as Delegates 0010 import org.kde.merkuro.contact 0011 import './private' 0012 0013 ContactsPage { 0014 id: root 0015 signal addAttendee(var itemId, string email) 0016 signal removeAttendee(var itemId) 0017 0018 property var attendeeAkonadiIds 0019 0020 actions: Kirigami.Action { 0021 icon.name: "object-select-symbolic" 0022 text: i18n("Done") 0023 onTriggered: pageStack.pop() 0024 } 0025 contactDelegate: ContactListItem { 0026 height: Kirigami.Settings.isMobile ? Kirigami.Units.gridUnit * 3 : Kirigami.Units.gridUnit * 2 0027 name: model && model.display 0028 avatarIcon: model && model.decoration 0029 added: root.attendeeAkonadiIds.includes(model.itemId) 0030 0031 onClicked: if (added) { 0032 removeAttendee(itemId); 0033 } else { 0034 const allEmail = root.model.data(root.model.index(index, 0), ContactsModel.AllEmailsRole); 0035 if (allEmail.length > 1) { 0036 emailsView.model = allEmail; 0037 emailsView.itemId = model.itemId; 0038 emailPickerSheet.open(); 0039 } else if(allEmail.length === 1) { 0040 addAttendee(model.itemId, allEmail[0]) 0041 } else { 0042 addAttendee(model.itemId, undefined) 0043 } 0044 } 0045 } 0046 0047 Kirigami.OverlaySheet { 0048 id: emailPickerSheet 0049 0050 header: Kirigami.Heading { 0051 text: i18n("Select Email Address") 0052 } 0053 0054 ListView { 0055 id: emailsView 0056 property var itemId 0057 0058 implicitWidth: Kirigami.Units.gridUnit * 30 0059 model: [] 0060 0061 delegate: Delegates.RoundedItemDelegate { 0062 required property var modelData 0063 0064 text: modelData 0065 onClicked: { 0066 addAttendee(emailsView.itemId, modelData); 0067 emailPickerSheet.close(); 0068 } 0069 } 0070 } 0071 } 0072 0073 }