summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Porter <mporter@konsulko.com>2018-06-26 13:01:22 -0400
committerMatt Porter <mporter@konsulko.com>2018-06-26 13:17:06 -0400
commitfb4ff765c9349db4e14e26eead5e2ceec673800b (patch)
treeb7297030511b28ee9ee865865f689448fce1c1d1
parent82dc532eea611ea203ca2c3ee94db7056d941d61 (diff)
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 <mporter@konsulko.com>
-rw-r--r--app/ContactsView.qml28
1 files 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 {
}
}
}
-