From b00822fe8b233f33adca86f93e5c1b90050983aa Mon Sep 17 00:00:00 2001 From: Matt Porter Date: Fri, 18 May 2018 14:42:52 -0400 Subject: 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 --- app/ContactsView.qml | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) (limited to 'app/ContactsView.qml') 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: { -- cgit 1.2.3-korg