/*
* Copyright (C) 2016 The Qt Company Ltd.
* Copyright (C) 2017-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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import QtQuick 2.6
import QtQuick.Layouts 1.1
import QtQuick.Controls 2.0
import QtMultimedia 5.5
import AGL.Demo.Controls 1.0
import 'models'
Item {
id: root
Connections {
target: phone
onElapsedTimeChanged: {
callStateLabel.text = phone.elapsedTime
}
}
Connections {
target: telephony
onConnectedChanged: {
// FIXME: keep dialpad inactive until connected
}
onCallStateChanged: {
if (telephony.callState == "incoming") {
pbap.search(telephony.callClip)
rejectButton.active = true
callStateLabel.text = "Incoming call from " + telephony.callClip
} else if (telephony.callState == "dialing") {
callStateLabel.text = "Dialing " + telephony.callColp
} else if (telephony.callState == "active") {
rejectButton.active = false
} else if (telephony.callState == "disconnected") {
rejectButton.active = false
callButton.checked = false
callStateLabel.text = ""
}
}
}
Connections {
target: pbap
onSearchResults: {
if (name != "Not Found") {
if (telephony.callState == "incoming") {
callStateLabel.text = "Incoming call from " + name
} else if (telephony.callState == "dialing") {
callStateLabel.text = "Dialing " + name
}
}
}
}
function call(cname, cnumber) {
name.text = cname
var rawNumber = cnumber
number.text = rawNumber.replace(/-/g, '')
callButton.checked = true
}
ColumnLayout {
anchors.fill: parent
anchors.topMargin: 50
anchors.bottomMargin: 50
spacing: 20
ColumnLayout {
Layout.alignment: Qt.AlignHCenter
Label {
id: name
font.pixelSize: 40
color: '#59FF7F'
}
TextField {
id: number
readOnly: true
ImageButton {
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
offImage: './images/HMI_Phone_Back_Icon.svg'
onClicked: {
if (number.text.length > 0)
number.text = number.text