take contacts from kpeople

This commit is contained in:
Marco Martin 2015-05-05 19:15:38 +02:00
parent 6972b67c18
commit af40bd64b1
2 changed files with 102 additions and 1 deletions

View file

@ -44,6 +44,9 @@ install(DIRECTORY compositor/
PATTERN Messages.sh EXCLUDE
PATTERN dummydata EXCLUDE)
kpackage_install_package(phonebook org.kde.phone.phonebook genericqml)
install(FILES phonebook/metadata.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} RENAME org.kde.phone.dialer.desktop)
add_subdirectory(bin)
add_subdirectory(qmlcomponents)
add_subdirectory(services)

View file

@ -19,12 +19,110 @@
import QtQuick 2.0
import QtQuick.Layouts 1.1
import org.kde.people 1.0 as KPeople
import org.kde.kquickcontrolsaddons 2.0 as KQuickControlsAddons
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.extras 2.0 as PlasmaExtras
Item {
PlasmaComponents.Label {
anchors.centerIn: parent
text: i18n("No contacts")
visible: contactsModel.count == 0
}
}
ColumnLayout {
anchors.fill: parent
//visible: contactsModel.count > 0
PlasmaComponents.ToolBar {
Layout.fillWidth: true
tools: RowLayout {
id: toolBarLayout
PlasmaComponents.TextField {
id: searchField
clearButtonShown: true
Layout.fillWidth: true
Layout.fillHeight: true
placeholderText: i18n("Search...")
}
}
}
PlasmaExtras.ScrollArea {
Layout.fillWidth: true
Layout.fillHeight: true
ListView {
id: view
model: PlasmaCore.SortFilterModel {
id: filterModel
sourceModel: KPeople.PersonsModel {
id: contactsModel
}
sortRole: "display"
filterRole: "display"
filterRegExp: ".*"+searchField.text+".*"
sortOrder: Qt.AscendingOrder
}
section {
property: "display"
criteria: ViewSection.FirstCharacter
delegate: PlasmaComponents.ListItem {
id: sectionItem
sectionDelegate: true
PlasmaComponents.Label {
text: section
}
}
}
delegate: PlasmaComponents.ListItem {
RowLayout {
id: delegateLayout
KQuickControlsAddons.QPixmapItem {
id: avatarLabel
Layout.minimumWidth: units.iconSizes.medium
Layout.maximumWidth: Layout.minimumWidth
Layout.minimumHeight: Layout.minimumWidth
Layout.maximumHeight: Layout.minimumWidth
pixmap: model.decoration
fillMode: ExtraComponents.QPixmapItem.PreserveAspectFit
smooth: true
}
ColumnLayout {
Layout.fillHeight: true
Layout.fillWidth: true
PlasmaComponents.Label {
id: nickLabel
Layout.fillWidth: true
text: model.display
elide: Text.ElideRight
}
PlasmaComponents.Label {
id: dataLabel
Layout.fillWidth: true
text: "605-909-123"
elide: Text.ElideRight
}
}
}
MouseArea {
anchors.fill: parent
onClicked: call(12345)
}
}
}
}
}
}