From fb4ff765c9349db4e14e26eead5e2ceec673800b Mon Sep 17 00:00:00 2001 From: Matt Porter Date: Tue, 26 Jun 2018 13:01:22 -0400 Subject: Use PBAP data backed ContactsModel Convert ContactsView to use ContactsModel provided by libqtappfw. This now displays all contacts and associated phone number from the connected mobile phone's PBAP-connected contact database. Bug-AGL: SPEC-1436 Change-Id: I6a26e0c6627247736470e06ddbd611caa7de79b1 Signed-off-by: Matt Porter --- app/ContactsView.qml | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/app/ContactsView.qml b/app/ContactsView.qml index 3dabe3b..6a0382b 100644 --- a/app/ContactsView.qml +++ b/app/ContactsView.qml @@ -19,19 +19,22 @@ import QtQuick 2.6 import QtQuick.Layouts 1.3 import QtQuick.Controls 2.0 import AGL.Demo.Controls 1.0 -import NumberType 1.0 -import 'models' +import PhoneNumber 1.0 Item { id: root function display_type(type) { - if (type == NumberType.Mobile) { + if (type == PhoneNumber.CELL) { return "M" - } else if (type == NumberType.Work) { + } else if (type == PhoneNumber.WORK) { return "W" - } else if (type == NumberType.Home) { + } else if (type == PhoneNumber.HOME) { return "H" + } else if (type == PhoneNumber.FAX) { + return "F" + } else if (type == PhoneNumber.VOICE) { + return "V" } else { return "O" } @@ -41,7 +44,8 @@ Item { ListView { anchors.fill: parent - model: ContactsModel {} + model: ContactsModel + //cacheBuffer: 2880 delegate: MouseArea { width: ListView.view.width height: width / 3 @@ -57,21 +61,20 @@ Item { Layout.fillWidth: true color: '#59FF7F' font.pixelSize: 50 - text: name + text: model.modelData.name } - - Repeater { + Repeater { model: numbers delegate: Label { Layout.fillWidth: true font.pixelSize: 50 text: display_type(type) + ": " + number - } - } + } + } } } onClicked: { - root.call(model.name, model.numbers.get(0).number) + root.call(model.name, model.numbers[0].number) } } section.property: 'name' @@ -88,4 +91,3 @@ Item { } } } - -- cgit 1.2.3-korg