mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-31 02:49:21 +00:00
Add phone keypad on main window and use it in smart search bar. Add a backup text on smartsearch bar in order to avoid losing text when focus change (in the case of we want to get it).
118 lines
2.7 KiB
QML
118 lines
2.7 KiB
QML
import QtQuick 2.7
|
|
import QtQuick.Layouts 1.3
|
|
|
|
import Common 1.0
|
|
import Linphone.Styles 1.0
|
|
|
|
// =============================================================================
|
|
|
|
Item {
|
|
id: button
|
|
|
|
property string text: ''
|
|
property bool showVoicemail: false
|
|
property string auxSymbol: ''
|
|
|
|
signal sendDtmf(var dtmf)
|
|
|
|
function activateEvent(key){
|
|
var keyString = String.fromCharCode(key)
|
|
if( keyString == text || keyString == auxSymbol){
|
|
actionButton.toggled = true;
|
|
sendDtmf(keyString)
|
|
}
|
|
}
|
|
// ---------------------------------------------------------------------------
|
|
Timer{
|
|
id: untoggledTimer
|
|
interval: 100
|
|
repeat: false
|
|
onTriggered: actionButton.toggled = false
|
|
}
|
|
ActionButton {
|
|
id: actionButton
|
|
onToggledChanged: if(toggled) untoggledTimer.start()
|
|
anchors.fill: parent
|
|
colorSet: TelKeypadStyle.button.colorSet
|
|
backgroundRadius: width/2
|
|
isCustom: true
|
|
property bool doNotSend: false
|
|
Timer{
|
|
id: longPress
|
|
interval: 500
|
|
onTriggered: { if(actionButton.doNotSend){
|
|
actionButton.doNotSend = false
|
|
}else{
|
|
if( button.auxSymbol != '' && actionButton.hovered) {
|
|
actionButton.doNotSend = true;
|
|
button.sendDtmf(button.auxSymbol)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
onPressed: {actionButton.doNotSend = false;longPress.start()}
|
|
onReleased: { if(actionButton.doNotSend)
|
|
actionButton.doNotSend = false
|
|
else {
|
|
actionButton.doNotSend = true;
|
|
button.sendDtmf(button.text)
|
|
}
|
|
}
|
|
|
|
ColumnLayout {
|
|
anchors.fill: parent
|
|
spacing: 0
|
|
anchors.topMargin: 5
|
|
anchors.bottomMargin: 5
|
|
|
|
RowLayout{
|
|
Layout.fillHeight: true
|
|
Layout.fillWidth: true
|
|
Layout.alignment: Qt.AlignCenter
|
|
Layout.leftMargin: 5
|
|
Layout.rightMargin: 5
|
|
spacing: 0
|
|
Text {
|
|
id: charText
|
|
Layout.fillHeight: true
|
|
Layout.fillWidth: true
|
|
color: TelKeypadStyle.button.text.color
|
|
elide: Text.ElideRight
|
|
|
|
font {
|
|
bold: true
|
|
pointSize: TelKeypadStyle.button.text.pointSize
|
|
}
|
|
|
|
text: button.text
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
verticalAlignment: Text.AlignVCenter
|
|
}
|
|
Icon{
|
|
icon: TelKeypadStyle.voicemail.icon
|
|
iconSize: charText.height/2
|
|
overwriteColor: TelKeypadStyle.button.text.color
|
|
visible: button.showVoicemail
|
|
}
|
|
}
|
|
Text {
|
|
visible: text != ''
|
|
Layout.fillHeight: true
|
|
Layout.fillWidth: true
|
|
color: TelKeypadStyle.button.text.color
|
|
elide: Text.ElideRight
|
|
|
|
font {
|
|
bold: true
|
|
pointSize: TelKeypadStyle.button.text.pointSize
|
|
}
|
|
|
|
text: auxSymbol
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
verticalAlignment: Text.AlignVCenter
|
|
}
|
|
}
|
|
}
|
|
}
|