Warning, /plasma-mobile/plasma-phonebook/src/contents/ui/ContactsPage.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-FileCopyrightText: 2015 Martin Klapetek <mklapetek@kde.org> 0003 * SPDX-FileCopyrightText: 2019 Linus Jahn <lnj@kaidan.im> 0004 * SPDX-FileCopyrightText: 2019 Jonah BrĂ¼chert <jbb@kaidan.im> 0005 * 0006 * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0007 */ 0008 0009 import QtQuick 0010 import QtQuick.Controls as Controls 0011 import QtQuick.Layouts 0012 0013 import org.kde.kirigami as Kirigami 0014 import org.kde.kirigamiaddons.delegates as Delegates 0015 import org.kde.people as KPeople 0016 0017 import org.kde.phonebook 0018 0019 import "components" 0020 0021 Kirigami.ScrollablePage { 0022 id: root 0023 title: i18n("Phonebook") 0024 globalToolBarStyle: Kirigami.ApplicationHeaderStyle.None 0025 0026 titleDelegate: ColumnLayout { 0027 Kirigami.AbstractApplicationHeader { 0028 id: applicationHeader 0029 0030 Layout.margins: 0 0031 Layout.preferredHeight: pageStack.globalToolBar.preferredHeight 0032 Layout.maximumHeight: pageStack.globalToolBar.preferredHeight 0033 Layout.fillWidth: true 0034 0035 RowLayout { 0036 anchors.fill: parent 0037 0038 Kirigami.SearchField { 0039 Layout.margins: Kirigami.Units.mediumSpacing 0040 Layout.rightMargin: 0 0041 Layout.fillWidth: true 0042 id: searchField 0043 onTextChanged: filterModel.setFilterFixedString(text) 0044 } 0045 0046 Controls.ToolButton { 0047 Layout.margins: Kirigami.Units.mediumSpacing 0048 Layout.leftMargin: 0 0049 icon.name: "overflow-menu" 0050 onClicked: { 0051 optionsDrawer.open() 0052 optionsDrawer.x = 0; 0053 } 0054 0055 BottomDrawer { 0056 id: optionsDrawer 0057 parent: applicationWindow().overlay 0058 drawerContentItem: ColumnLayout { 0059 Repeater { 0060 model: root.actions 0061 delegate: Delegates.RoundedItemDelegate { 0062 required property var modelData 0063 required property int index 0064 0065 text: modelData.text 0066 icon: modelData.icon 0067 0068 Layout.fillWidth: true 0069 0070 onClicked: { 0071 modelData.triggered() 0072 optionsDrawer.close() 0073 optionsDrawer.interactive = false 0074 } 0075 } 0076 } 0077 0078 Item { 0079 Layout.fillHeight: true 0080 } 0081 } 0082 } 0083 } 0084 } 0085 } 0086 } 0087 0088 actions: Kirigami.Action { 0089 icon.name: "document-import" 0090 text: i18n("Import contacts") 0091 onTriggered: { 0092 importer.startImport() 0093 } 0094 } 0095 0096 ActionButton { 0097 parent: overlay 0098 x: root.width - width - margin 0099 y: root.height - height - pageStack.globalToolBar.preferredHeight - margin 0100 singleAction: Kirigami.Action { 0101 text: i18n("add Contact") 0102 icon.name: "list-add" 0103 onTriggered: pageStack.pushDialogLayer(Qt.resolvedUrl("AddContactPage.qml"), {state: "create"}) 0104 } 0105 } 0106 0107 ListView { 0108 id: contactsList 0109 0110 property bool delegateSelected: false 0111 property string numberToCall 0112 0113 reuseItems: true 0114 0115 currentIndex: -1 0116 0117 section.property: "display" 0118 section.criteria: ViewSection.FirstCharacter 0119 section.delegate: Kirigami.ListSectionHeader {text: section} 0120 clip: true 0121 model: KPeople.PersonsSortFilterProxyModel { 0122 id: filterModel 0123 filterRole: Qt.DisplayRole 0124 sortRole: Qt.DisplayRole 0125 filterCaseSensitivity: Qt.CaseInsensitive 0126 0127 sourceModel: KPeople.PersonsModel { 0128 id: contactsModel 0129 } 0130 Component.onCompleted: sort(0) 0131 } 0132 0133 Kirigami.PlaceholderMessage { 0134 anchors.centerIn: parent 0135 text: i18n("No contacts") 0136 icon.name: "contact-new" 0137 visible: contactsList.count === 0 0138 } 0139 0140 delegate: ContactListItem { 0141 height: Kirigami.Units.gridUnit * 3 0142 name: model && model.display 0143 imageProviderUri: model && model.photoImageProviderUri 0144 0145 onClicked: { 0146 pageStack.push("qrc:/DetailPage.qml", { 0147 personUri: model.personUri 0148 }) 0149 ContactController.lastPersonUri = model.personUri; 0150 } 0151 } 0152 } 0153 }