summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Porter <mporter@konsulko.com>2018-06-22 15:27:59 -0400
committerMatt Porter <mporter@konsulko.com>2018-06-22 16:43:10 -0400
commita7fb49c552a96a4f4709363a708b722e66fd343e (patch)
tree41c51bfac487c25fdbaf19763e92dec8f509a97b
parent01a84d2d570eddcfaf0d38117dc0c20b6b25fed3 (diff)
Add support for PBAP RecentCallModel
Replace static data and history currently used in phone app with data populated the the BT PBAP binding. This data is parsed and exposed to QML by the RecentCallModel in libqtappfw. The recent call tab and the mini-recent call bar in the dialer tab now show actual call history from the connected mobile phone. Bug-AGL: SPEC-1436 Change-Id: I287a1daf54ee88985aac85d71215f7fa4e766556 Signed-off-by: Matt Porter <mporter@konsulko.com>
-rw-r--r--app/Dialer.qml9
-rw-r--r--app/Recents.qml18
-rw-r--r--app/main.cpp2
3 files changed, 14 insertions, 15 deletions
diff --git a/app/Dialer.qml b/app/Dialer.qml
index 29f251f..d88ddcc 100644
--- a/app/Dialer.qml
+++ b/app/Dialer.qml
@@ -160,7 +160,6 @@ Item {
var contact = {'name': name.text, 'number': number.text}
if (contact.name === '')
contact.name = 'Unknown'
- history.insert(0, contact)
if (telephony.callState == "incoming") {
telephony.answer()
} else {
@@ -192,7 +191,7 @@ Item {
Layout.preferredHeight: 130
orientation: Qt.Horizontal
clip: true
- model: CallHistoryModel { id: history }
+ model: RecentCallModel
delegate: MouseArea {
width: root.width / 2.5
@@ -207,17 +206,17 @@ Item {
Label {
Layout.fillWidth: true
color: '#59FF7F'
- text: model.name
+ text: model.modelData.name
}
Label {
Layout.fillWidth: true
font.pixelSize: 30
- text: model.number
+ text: model.modelData.number
}
}
}
- onClicked: root.call(model)
+ onClicked: root.call(model.modelData.name, model.modelData.number)
}
}
}
diff --git a/app/Recents.qml b/app/Recents.qml
index 848cdab..88fcf20 100644
--- a/app/Recents.qml
+++ b/app/Recents.qml
@@ -18,18 +18,18 @@ import QtQuick 2.6
import QtQuick.Layouts 1.1
import QtQuick.Controls 2.0
import AGL.Demo.Controls 1.0
-import CallType 1.0
+import RecentCall 1.0
import 'models'
Item {
id: root
function log_icon(type) {
- if (type == CallType.Missed) {
+ if (type == RecentCall.MISSED) {
return './images/ic_call_missed_48px.svg'
- } else if (type == CallType.Incoming) {
+ } else if (type == RecentCall.RECEIVED) {
return './images/ic_call_received_48px.svg'
- } else if (type == CallType.Outgoing) {
+ } else if (type == RecentCall.DIALED) {
return './images/ic_call_made_48px.svg'
}
}
@@ -40,7 +40,7 @@ Item {
anchors.fill: parent
anchors.margins: 100
- model: CallHistoryModel { id: history }
+ model: RecentCallModel
delegate: MouseArea {
width: ListView.view.width
@@ -49,7 +49,7 @@ Item {
anchors.fill: parent
spacing: 50
Image {
- source: log_icon(model.type)
+ source: log_icon(model.modelData.type)
Layout.preferredWidth: 150
Layout.preferredHeight: 150
}
@@ -63,17 +63,17 @@ Item {
Layout.fillWidth: true
color: '#59FF7F'
font.pixelSize: 50
- text: model.name
+ text: model.modelData.name
}
Label {
Layout.fillWidth: true
font.pixelSize: 50
- text: new Date(model.time).toLocaleString(Qt.locale(), "ddd MMM d 'at' HH':'mm")
+ text: new Date(model.modelData.datetime).toLocaleString(Qt.locale(), "ddd MMM d 'at' HH':'mm")
}
}
}
- onClicked: root.call(model.name, model.number)
+ onClicked: root.call(model.modelData.name, model.modelData.number)
}
}
}
diff --git a/app/main.cpp b/app/main.cpp
index e60cbe3..b1f1668 100644
--- a/app/main.cpp
+++ b/app/main.cpp
@@ -66,8 +66,8 @@ int main(int argc, char *argv[])
context->setContextProperty("telephony", telephony);
Phone *phone = new Phone(telephony);
context->setContextProperty("phone", phone);
- context->setContextProperty("pbap", new Pbap(bindingAddress));
QObject::connect(telephony, &Telephony::callStateChanged, phone, &Phone::onCallStateChanged);
+ context->setContextProperty("pbap", new Pbap(bindingAddress, context));
std::string token = secret.toStdString();
LibHomeScreen* hs = new LibHomeScreen();
QLibWindowmanager* qwm = new QLibWindowmanager();