diff options
author | Matt Porter <mporter@konsulko.com> | 2018-05-18 14:42:52 -0400 |
---|---|---|
committer | Matt Porter <mporter@konsulko.com> | 2018-05-21 11:20:36 -0400 |
commit | b00822fe8b233f33adca86f93e5c1b90050983aa (patch) | |
tree | 50d78108535f2659e398d198564b28fd6462b8a0 /app/ContactsView.qml | |
parent | 4e454de545544526cbea9d787df9ba76cb99d889 (diff) |
contacts: handle multiple numbers and types
The current contact model has a few fixed fields for
phone numbers and only one is displayed and able to be
dialed from the contacts view. Update the model to support
an array of tuples indicating each phone number and type
of phone number (mobile, home, work, other) associated
with a contact entry. Also, update the ContactsView so
we see all phone numbers for a given contact.
Bug-AGL: SPEC-1435
Change-Id: Ie883d3f06c0e4102e79546395dbb1712741bac8b
Signed-off-by: Matt Porter <mporter@konsulko.com>
Diffstat (limited to 'app/ContactsView.qml')
-rw-r--r-- | app/ContactsView.qml | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/app/ContactsView.qml b/app/ContactsView.qml index 2a00cf5..8d37590 100644 --- a/app/ContactsView.qml +++ b/app/ContactsView.qml @@ -1,5 +1,6 @@ /* * Copyright (C) 2016 The Qt Company Ltd. + * Copyright (C) 2018 Konsulko Group * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,14 +16,27 @@ */ import QtQuick 2.6 -import QtQuick.Layouts 1.1 +import QtQuick.Layouts 1.3 import QtQuick.Controls 2.0 import AGL.Demo.Controls 1.0 +import NumberType 1.0 import 'models' Item { id: root + function display_type(type) { + if (type == NumberType.Mobile) { + return "M" + } else if (type == NumberType.Work) { + return "W" + } else if (type == NumberType.Home) { + return "H" + } else { + return "O" + } + } + signal call(var contact) signal cancel @@ -47,11 +61,11 @@ Item { model: ContactsModel {} delegate: MouseArea { width: ListView.view.width - height: width / 5 + height: width / 3 RowLayout { anchors.fill: parent anchors.leftMargin: 200 - spacing: 20 + spacing: 100 Image { source: './images/HMI_ContactScreen_ImageHolder-01.svg' } @@ -59,14 +73,18 @@ Item { Label { Layout.fillWidth: true color: '#59FF7F' - text: model.name + font.pixelSize: 50 + text: name } - Label { - Layout.fillWidth: true - font.pixelSize: 30 - text: model.number - } + Repeater { + model: numbers + delegate: Label { + Layout.fillWidth: true + font.pixelSize: 50 + text: display_type(type) + ": " + number + } + } } } onClicked: { |