Commit 0bc65846 authored by Carl Schwan's avatar Carl Schwan 🚴
Browse files

Add phone number selection



Signed-off-by: Carl Schwan's avatarCarl Schwan <carl@carlschwan.eu>
parent 463f23a1
Pipeline #174520 passed with stage
in 3 minutes and 9 seconds
......@@ -65,6 +65,12 @@ Kirigami.ScrollablePage {
Qt.openUrlExternally("sms:" + number)
}
Component {
id: callPopup
PhoneNumberDialog {}
}
ColumnLayout {
spacing: 0
Header {
......@@ -104,16 +110,18 @@ Kirigami.ScrollablePage {
iconName: "call-start"
visible: addressee.phoneNumbers.length > 0
onTriggered: {
applicationWindow().showPassiveNotification(i18n("Call support is not implemented yet"));
//const model = addressee.phoneNumbers
//if (addressee.phoneNumbers.length === 1) {
// page.callNumber(model[0].normalizedNumber)
//} else {
// var pop = callPopup.createObject(page, {numbers: addressee.phoneNumbers, title: i18n("Select number to call")})
// pop.onNumberSelected.connect(number => callNumber(number))
// pop.open()
//}
const model = addressee.phoneNumbers;
if (addressee.phoneNumbers.length === 1) {
page.callNumber(model[0].normalizedNumber);
} else {
const pop = callPopup.createObject(page, {
numbers: addressee.phoneNumbers,
title: i18n("Select number to call")
});
pop.onNumberSelected.connect(number => callNumber(number));
pop.open();
}
}
},
Kirigami.Action {
......@@ -121,19 +129,18 @@ Kirigami.ScrollablePage {
iconName: "mail-message"
visible: addressee.phoneNumbers.length > 0
onTriggered: {
applicationWindow().showPassiveNotification(i18n("SMS support is not implemented yet"));
//var model = addressee.phoneNumbers
//if (addressee.phoneNumbers.length === 1) {
// page.sendSms(model[0].normalizedNumber)
//} else {
// var pop = callPopup.createObject(page, {
// numbers: addressee.phoneNumbers,
// title: i18n("Select number to send message to"),
// })
// pop.onNumberSelected.connect(number => sendSms(number))
// pop.open()
//}
const model = addressee.phoneNumbers;
if (addressee.phoneNumbers.length === 1) {
page.sendSms(model[0].normalizedNumber);
} else {
const pop = callPopup.createObject(page, {
numbers: addressee.phoneNumbers,
title: i18n("Select number to send message to"),
});
pop.onNumberSelected.connect(number => sendSms(number));
pop.open();
}
}
},
Kirigami.Action {
......
// SPDX-FileCopyrightText: 2021 Nicolas Fella <nicolas.fella@gmx.de>
// SPDX-License-Identifier: LGPL-2.0-or-later
import QtQuick 2.6
import QtQuick.Controls 2.13
import QtQuick.Layouts 1.2
import org.kde.kirigami 2.10 as Kirigami
Kirigami.OverlaySheet {
id: root
property alias numbers: list.model
property alias title: heading.text
signal numberSelected(string number)
header: Kirigami.Heading {
id: heading
}
ListView {
id: list
implicitWidth: Kirigami.Units.gridUnit * 20
model: 4
delegate: Kirigami.BasicListItem {
text: modelData.typeLabel
subtitle: modelData.number
onClicked: {
close()
root.numberSelected(modelData.normalizedNumber)
}
}
}
}
......@@ -65,6 +65,7 @@ SPDX-License-Identifier: CC0-1.0
<file alias="CalendarItemMenu.qml">contents/ui/CalendarItemMenu.qml</file>
<file alias="RecurringIncidenceChangeSheet.qml">contents/ui/RecurringIncidenceChangeSheet.qml</file>
<file alias="ResizerSeparator.qml">contents/ui/ResizerSeparator.qml</file>
<file alias="PhoneNumberDialog.qml">contents/ui/PhoneNumberDialog.qml</file>
<file alias="fallbackBackground.png">contents/resources/fallbackBackground.png</file>
</qresource>
</RCC>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment