mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-29 15:03:09 +00:00
change callback a bit
make the keypad on call ui send dtmf on the call
This commit is contained in:
parent
63300072c4
commit
ad195790e8
6 changed files with 78 additions and 20 deletions
|
|
@ -45,6 +45,11 @@ Item {
|
||||||
return '' + h + ':' + m + ':' + s;
|
return '' + h + ':' + m + ':' + s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onStatusChanged: {
|
||||||
|
if (status != 1) {
|
||||||
|
dialerButton.checked = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: activeCallUi
|
id: activeCallUi
|
||||||
|
|
@ -61,8 +66,9 @@ Item {
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.minimumHeight: parent.height/2
|
Layout.minimumHeight: parent.height/2
|
||||||
|
|
||||||
contentWidth: topContents.width;
|
contentWidth: topContents.width
|
||||||
contentHeight: topContents.height
|
contentHeight: topContents.height
|
||||||
|
interactive: status == 1;
|
||||||
Row {
|
Row {
|
||||||
id: topContents
|
id: topContents
|
||||||
Avatar {
|
Avatar {
|
||||||
|
|
@ -72,6 +78,12 @@ Item {
|
||||||
Dialpad {
|
Dialpad {
|
||||||
width: topFlickable.width
|
width: topFlickable.width
|
||||||
height: topFlickable.height
|
height: topFlickable.height
|
||||||
|
|
||||||
|
callback: function (string) {
|
||||||
|
if (voiceCallmanager.activeVoiceCall) {
|
||||||
|
voiceCallmanager.activeVoiceCall.sendDtmf(string);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,11 +51,6 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function fromContacts() {
|
|
||||||
console.log("Should get from contacts!");
|
|
||||||
status.text = "+41 76 555 5555"
|
|
||||||
}
|
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: dialPadArea
|
id: dialPadArea
|
||||||
|
|
||||||
|
|
@ -75,7 +70,15 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
Dialpad {
|
Dialpad {
|
||||||
|
callback: function (string) {
|
||||||
|
addNumber(string);
|
||||||
|
}
|
||||||
|
pressedCallback: function (string) {
|
||||||
|
voiceCallmanager.startDtmfTone(string);
|
||||||
|
}
|
||||||
|
releasedCallback: function (string) {
|
||||||
|
voiceCallmanager.stopDtmfTone();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
|
|
@ -104,7 +107,7 @@ Item {
|
||||||
enabled: status.text.length > 0
|
enabled: status.text.length > 0
|
||||||
opacity: enabled ? 1 : 0.5
|
opacity: enabled ? 1 : 0.5
|
||||||
source: "edit-clear"
|
source: "edit-clear"
|
||||||
callback: function() {
|
callback: function(text) {
|
||||||
if (status.text.length > 0) {
|
if (status.text.length > 0) {
|
||||||
status.text = status.text.substr(0, status.text.length - 1);
|
status.text = status.text.substr(0, status.text.length - 1);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,25 +36,53 @@ PlasmaComponents.Label {
|
||||||
|
|
||||||
property alias sub: longHold.text
|
property alias sub: longHold.text
|
||||||
property var callback
|
property var callback
|
||||||
|
property var pressedCallback
|
||||||
|
property var releasedCallback
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onPressed: voiceCallmanager.startDtmfTone(parent.text);
|
onPressed: {
|
||||||
onReleased: voiceCallmanager.stopDtmfTone();
|
if (pressedCallback) {
|
||||||
onCanceled: voiceCallmanager.stopDtmfTone();
|
pressedCallback(parent.text);
|
||||||
|
} else if (pad.pressedCallback) {
|
||||||
|
pad.pressedCallback(parent.text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onReleased: {
|
||||||
|
if (releasedCallback) {
|
||||||
|
releasedCallback(parent.text);
|
||||||
|
} else if (pad.releasedCallback) {
|
||||||
|
pad.releasedCallback(parent.text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onCanceled: {
|
||||||
|
if (releasedCallback) {
|
||||||
|
releasedCallback(parent.text);
|
||||||
|
} else if (pad.releasedCallback) {
|
||||||
|
pad.releasedCallback(parent.text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (callback) {
|
if (callback) {
|
||||||
callback();
|
callback(parent.text);
|
||||||
} else {
|
} else if (pad.callback) {
|
||||||
addNumber(parent.text);
|
pad.callback(parent.text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onPressAndHold: {
|
onPressAndHold: {
|
||||||
|
var text;
|
||||||
if (longHold.visible) {
|
if (longHold.visible) {
|
||||||
addNumber(longHold.text);
|
text = longHold.text;
|
||||||
} else {
|
} else {
|
||||||
addNumber(parent.text);
|
text = parent.text;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback) {
|
||||||
|
callback(text);
|
||||||
|
} else if (pad.callback) {
|
||||||
|
pad.callback(text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,8 @@ Item {
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
|
||||||
property var callback
|
property var callback
|
||||||
|
property var pressedCallback
|
||||||
|
property var releasedCallback
|
||||||
property string sub
|
property string sub
|
||||||
property alias source: icon.source
|
property alias source: icon.source
|
||||||
property alias text: label.text
|
property alias text: label.text
|
||||||
|
|
@ -55,17 +57,24 @@ Item {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (callback) {
|
if (callback) {
|
||||||
callback();
|
callback(parent.text);
|
||||||
} else {
|
} else {
|
||||||
addNumber(parent.text);
|
addNumber(parent.text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onPressAndHold: {
|
onPressAndHold: {
|
||||||
if (parent.sub.length > 0) {
|
var text;
|
||||||
addNumber(parent.sub);
|
if (longHold.visible) {
|
||||||
|
text = longHold.text;
|
||||||
} else {
|
} else {
|
||||||
addNumber(parent.text);
|
text = parent.text;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback) {
|
||||||
|
callback(text);
|
||||||
|
} else if (pad.callback) {
|
||||||
|
pad.callback(text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,10 @@ GridLayout {
|
||||||
id: pad
|
id: pad
|
||||||
columns: 3
|
columns: 3
|
||||||
|
|
||||||
|
property var callback
|
||||||
|
property var pressedCallback
|
||||||
|
property var releasedCallback
|
||||||
|
|
||||||
property int buttonHeight: parent.height / 6
|
property int buttonHeight: parent.height / 6
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
|
||||||
|
|
@ -116,6 +116,7 @@ ApplicationWindow {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
when: root.visible && root.status == 0
|
when: root.visible && root.status == 0
|
||||||
source: Qt.resolvedUrl("Dialer/Dialer.qml")
|
source: Qt.resolvedUrl("Dialer/Dialer.qml")
|
||||||
|
z: root.status == 0 ? 2 : 0
|
||||||
opacity: root.status == 0 ? 1 : 0
|
opacity: root.status == 0 ? 1 : 0
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
OpacityAnimator {
|
OpacityAnimator {
|
||||||
|
|
@ -130,6 +131,7 @@ ApplicationWindow {
|
||||||
when: root.status > 0
|
when: root.status > 0
|
||||||
source: Qt.resolvedUrl("Call/CallPage.qml")
|
source: Qt.resolvedUrl("Call/CallPage.qml")
|
||||||
opacity: root.status > 0 ? 1 : 0
|
opacity: root.status > 0 ? 1 : 0
|
||||||
|
z: root.status > 0 ? 2 : 0
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
OpacityAnimator {
|
OpacityAnimator {
|
||||||
duration: units.shortDuration
|
duration: units.shortDuration
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue