Fix numeric pad buttons : link search bars with a numeric pad popup.
This commit is contained in:
parent
ea8d2aafe7
commit
0b91d8c986
4 changed files with 20 additions and 30 deletions
|
|
@ -18,9 +18,9 @@ FocusScope {
|
|||
property alias numericPadButton: dialerButton
|
||||
readonly property bool hasActiveFocus: textField.activeFocus
|
||||
property alias color: backgroundItem.color
|
||||
|
||||
onVisibleChanged: if (!visible && numericPadPopup) numericPadPopup.close()
|
||||
|
||||
|
||||
signal openNumericPadRequested()// Useful for redirection before displaying numeric pad.
|
||||
|
||||
function clearText() {
|
||||
textField.text = ""
|
||||
}
|
||||
|
|
@ -28,8 +28,6 @@ FocusScope {
|
|||
Connections {
|
||||
enabled: numericPadPopup != undefined
|
||||
target: numericPadPopup ? numericPadPopup : null
|
||||
function onAboutToHide() { mainItem.numericPadButton.checked = false }
|
||||
function onAboutToShow() { mainItem.numericPadButton.checked = true }
|
||||
function onButtonPressed(text) {
|
||||
console.log("text", text)
|
||||
textField.text += text
|
||||
|
|
@ -89,8 +87,7 @@ FocusScope {
|
|||
Button {
|
||||
id: dialerButton
|
||||
visible: numericPadPopup != undefined && textField.text.length === 0
|
||||
checkable: true
|
||||
checked: false
|
||||
checked: numericPadPopup?.visible || false
|
||||
background: Rectangle {
|
||||
color: "transparent"
|
||||
}
|
||||
|
|
@ -102,6 +99,12 @@ FocusScope {
|
|||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 15 * DefaultStyle.dp
|
||||
onClicked: {
|
||||
if(!checked){
|
||||
mainItem.openNumericPadRequested()
|
||||
mainItem.numericPadPopup.open()
|
||||
} else mainItem.numericPadPopup.close()
|
||||
}
|
||||
}
|
||||
Button {
|
||||
id: clearTextButton
|
||||
|
|
|
|||
|
|
@ -157,13 +157,9 @@ Item {
|
|||
focusedBorderColor: DefaultStyle.main1_500_main
|
||||
numericPadButton.visible: text.length === 0
|
||||
numericPadButton.checkable: false
|
||||
Connections {
|
||||
target: magicSearchBar.numericPadButton
|
||||
function onClicked() {
|
||||
mainItem.goToNewCall()
|
||||
mainItem.openNumPadRequest()
|
||||
}
|
||||
}
|
||||
|
||||
onOpenNumericPadRequested:mainItem.goToNewCall()
|
||||
|
||||
Connections {
|
||||
target: mainItem
|
||||
function onCallCreated() {
|
||||
|
|
@ -609,6 +605,9 @@ Item {
|
|||
onCreateContactRequested: (name, address) => {
|
||||
mainItem.createContact(name, address)
|
||||
}
|
||||
Component.onCompleted: {
|
||||
magicSearchBar.numericPadPopup = callPage.numericPadPopup
|
||||
}
|
||||
}
|
||||
ContactPage{
|
||||
id: contactPage
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ AbstractMainPage {
|
|||
signal createCallFromSearchBarRequested()
|
||||
signal createContactRequested(string name, string address)
|
||||
signal openNumPadRequest()
|
||||
|
||||
property alias numericPadPopup: numericPadPopupItem
|
||||
|
||||
Connections {
|
||||
enabled: confInfoGui
|
||||
|
|
@ -111,7 +113,7 @@ AbstractMainPage {
|
|||
anchors.right: parent.right
|
||||
height: 402 * DefaultStyle.dp
|
||||
NumericPadPopup {
|
||||
id: numericPadPopup
|
||||
id: numericPadPopupItem
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
visible: false
|
||||
|
|
@ -479,7 +481,7 @@ AbstractMainPage {
|
|||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
focus: true
|
||||
numPadPopup: numericPadPopup
|
||||
numPadPopup: numericPadPopupItem
|
||||
groupCallVisible: true
|
||||
searchBarColor: DefaultStyle.grey_100
|
||||
onContactClicked: (contact) => {
|
||||
|
|
@ -492,13 +494,6 @@ AbstractMainPage {
|
|||
Connections {
|
||||
target: mainItem
|
||||
function onCreateCallFromSearchBarRequested(){ UtilsCpp.createCall(callContactsList.searchBar.text)}
|
||||
function onOpenNumPadRequest(){ if (!callContactsList.searchBar.numericPadButton.checked) callContactsList.searchBar.numericPadButton.checked = true}
|
||||
}
|
||||
Binding {
|
||||
target: numericPadPopup
|
||||
property: "visible"
|
||||
value: true
|
||||
when: callContactsList.searchBar.numericPadButton.checked
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -596,13 +596,6 @@ AbstractWindow {
|
|||
)
|
||||
}
|
||||
numPadPopup: numPadPopup
|
||||
Binding {
|
||||
target: numPadPopup
|
||||
property: "visible"
|
||||
value: true
|
||||
when: newCallForm.searchBar.numericPadButton.checked
|
||||
restoreMode: Binding.RestoreValue
|
||||
}
|
||||
|
||||
NumericPadPopup {
|
||||
id: numPadPopup
|
||||
|
|
|
|||
Loading…
Reference in a new issue