diff --git a/dialer/src/qml/Call/CallPage.qml b/dialer/src/qml/Call/CallPage.qml index 38b6caaa..981ca193 100644 --- a/dialer/src/qml/Call/CallPage.qml +++ b/dialer/src/qml/Call/CallPage.qml @@ -74,11 +74,6 @@ Kirigami.Page { Dialpad { width: topFlickable.width height: topFlickable.height - - callback: function (string) { - //TODO -// ofonoWrapper.sendToneToCall(string); - } } } diff --git a/dialer/src/qml/DialerPage.qml b/dialer/src/qml/DialerPage.qml index 3fbe834f..34f2f4fe 100644 --- a/dialer/src/qml/DialerPage.qml +++ b/dialer/src/qml/DialerPage.qml @@ -54,27 +54,14 @@ Kirigami.Page { Layout.minimumHeight: units.gridUnit * 3 Layout.maximumHeight: Layout.minimumHeight font.pixelSize: units.gridUnit * 2.3 + + text: dialerUtils.formatNumber(dialPad.number) } Dialpad { + id: dialPad Layout.fillWidth: true Layout.fillHeight: true - - callback: function (string) { - var newText = status.text + string - status.text = dialerUtils.formatNumber(newText); - } - deleteCallback: function () { - var newText = status.text.slice(0, -1) - status.text = dialerUtils.formatNumber(newText); - } - pressedCallback: function (string) { - // TODO - // ofonoWrapper.startTone(string); - } - releasedCallback: function (string) { - // ofonoWrapper.stopTone(); - } } } } diff --git a/dialer/src/qml/Dialpad/DialerButton.qml b/dialer/src/qml/Dialpad/DialerButton.qml index c45e282c..200fd265 100644 --- a/dialer/src/qml/Dialpad/DialerButton.qml +++ b/dialer/src/qml/Dialpad/DialerButton.qml @@ -31,6 +31,8 @@ Item { Layout.fillWidth: true Layout.fillHeight: true + signal clicked(string text) + property string text property string sub property string display @@ -55,30 +57,12 @@ Item { id: mouse anchors.fill: parent - onPressed: { - if (pad.pressedCallback) { - pad.pressedCallback(parent.text); - } - } - onReleased: { - if (pad.releasedCallback) { - pad.releasedCallback(parent.text); - } - } - onCanceled: { - if (pad.releasedCallback) { - pad.releasedCallback(parent.text); - } - } - onClicked: { - if (pad.callback) { - pad.callback(parent.text); - } - } + onClicked: root.clicked(parent.text) + onPressAndHold: { var text = parent.sub.length > 0 ? parent.sub : parent.text - if (pad.callback && text.length === 1) { - pad.callback(text); + if (text.length === 1) { + root.clicked(text); } } } diff --git a/dialer/src/qml/Dialpad/DialerIconButton.qml b/dialer/src/qml/Dialpad/DialerIconButton.qml index ba83af95..726618cf 100644 --- a/dialer/src/qml/Dialpad/DialerIconButton.qml +++ b/dialer/src/qml/Dialpad/DialerIconButton.qml @@ -31,9 +31,9 @@ Item { Layout.fillWidth: true Layout.fillHeight: true + signal pressed() + property var callback - property var pressedCallback - property var releasedCallback property string sub property alias source: icon.source property alias text: label.text @@ -72,27 +72,6 @@ Item { MouseArea { id: mouse anchors.fill: parent - onClicked: { - if (callback) { - callback(parent.text); - } else { - addNumber(parent.text); - } - } - - onPressAndHold: { - var text; - if (longHold.visible) { - text = longHold.text; - } else { - text = parent.text; - } - - if (callback) { - callback(text); - } else if (pad.callback) { - pad.callback(text); - } - } + onClicked: buttonRoot.pressed() } } diff --git a/dialer/src/qml/Dialpad/Dialpad.qml b/dialer/src/qml/Dialpad/Dialpad.qml index c68b9245..06d98a03 100644 --- a/dialer/src/qml/Dialpad/Dialpad.qml +++ b/dialer/src/qml/Dialpad/Dialpad.qml @@ -31,31 +31,29 @@ GridLayout { Layout.leftMargin: Kirigami.Units.largeSpacing * 2 Layout.rightMargin: Kirigami.Units.largeSpacing * 2 - property var callback - property var pressedCallback - property var releasedCallback - property var deleteCallback + property string number - DialerButton { id: one; text: "1" } - DialerButton { text: "2"; sub: "ABC" } - DialerButton { text: "3"; sub: "DEF" } + DialerButton { id: one; text: "1"; onClicked: pad.number += text } + DialerButton { text: "2"; sub: "ABC"; onClicked: pad.number += text } + DialerButton { text: "3"; sub: "DEF"; onClicked: pad.number += text } - DialerButton { text: "4"; sub: "GHI" } - DialerButton { text: "5"; sub: "JKL" } - DialerButton { text: "6"; sub: "MNO" } + DialerButton { text: "4"; sub: "GHI"; onClicked: pad.number += text } + DialerButton { text: "5"; sub: "JKL"; onClicked: pad.number += text } + DialerButton { text: "6"; sub: "MNO"; onClicked: pad.number += text } - DialerButton { text: "7"; sub: "PQRS" } - DialerButton { text: "8"; sub: "TUV" } - DialerButton { text: "9"; sub: "WXYZ" } + DialerButton { text: "7"; sub: "PQRS"; onClicked: pad.number += text } + DialerButton { text: "8"; sub: "TUV"; onClicked: pad.number += text } + DialerButton { text: "9"; sub: "WXYZ"; onClicked: pad.number += text } - DialerButton { display: "*"; text: "*"; special: true; } - DialerButton { text: "0"; subdisplay: "+"; sub: "+"; } - DialerButton { display: "#"; text: "#"; special: true; } + DialerButton { display: "*"; text: "*"; special: true; onClicked: pad.number += text } + DialerButton { text: "0"; subdisplay: "+"; sub: "+"; onClicked: pad.number += text } + DialerButton { display: "#"; text: "#"; special: true; onClicked: pad.number += text } Item { Layout.fillWidth: true Layout.fillHeight: true } + DialerIconButton { id: callButton Layout.fillWidth: true @@ -65,9 +63,7 @@ GridLayout { opacity: enabled ? 1 : 0.5 source: "call-start" size: Kirigami.Units.gridUnit * 3 - callback: function() { - call(status.text); - } + onPressed: call(status.text) } DialerIconButton { id: delButton @@ -78,6 +74,8 @@ GridLayout { opacity: enabled ? 1 : 0.5 source: "edit-clear" size: Kirigami.Units.gridUnit * 2 - callback: pad.deleteCallback + onPressed: { + pad.number = pad.number.slice(0, -1) + } } }