open numeric from magic search bar

This commit is contained in:
Gaelle Braud 2024-08-13 12:09:18 +02:00
parent b2d75517e8
commit e4d6cb4dfd
3 changed files with 27 additions and 9 deletions

View file

@ -18,14 +18,15 @@ Item {
property var contextualMenuOpenedComponent: undefined property var contextualMenuOpenedComponent: undefined
signal addAccountRequest() signal addAccountRequest()
signal openNewCall() signal openNewCallRequest()
signal openCallHistory() signal openCallHistory()
signal openNumPadRequest()
signal displayContactRequested(string contactAddress) signal displayContactRequested(string contactAddress)
signal createContactRequested(string name, string address) signal createContactRequested(string name, string address)
function goToNewCall() { function goToNewCall() {
tabbar.currentIndex = 0 tabbar.currentIndex = 0
mainItem.openNewCall() mainItem.openNewCallRequest()
} }
function goToCallHistory() { function goToCallHistory() {
tabbar.currentIndex = 0 tabbar.currentIndex = 0
@ -139,6 +140,15 @@ Item {
Layout.fillWidth: true Layout.fillWidth: true
placeholderText: qsTr("Rechercher un contact, appeler ou envoyer un message...") placeholderText: qsTr("Rechercher un contact, appeler ou envoyer un message...")
focusedBorderColor: DefaultStyle.main1_500_main focusedBorderColor: DefaultStyle.main1_500_main
numericPadButton.visible: text.length === 0
numericPadButton.checkable: false
Connections {
target: magicSearchBar.numericPadButton
function onClicked() {
mainItem.goToNewCall()
mainItem.openNumPadRequest()
}
}
onTextChanged: { onTextChanged: {
if (text.length != 0) listPopup.open() if (text.length != 0) listPopup.open()
else listPopup.close() else listPopup.close()
@ -477,8 +487,9 @@ Item {
id: callPage id: callPage
Connections { Connections {
target: mainItem target: mainItem
function onOpenNewCall(){ callPage.goToNewCall()} function onOpenNewCallRequest(){ callPage.goToNewCall()}
function onOpenCallHistory(){ callPage.goToCallHistory()} function onOpenCallHistory(){ callPage.goToCallHistory()}
function onOpenNumPadRequest(){ callPage.openNumPadRequest()}
} }
onCreateContactRequested: (name, address) => { onCreateContactRequested: (name, address) => {
mainItem.createContact(name, address) mainItem.createContact(name, address)

View file

@ -101,10 +101,6 @@ FocusScope {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: 15 * DefaultStyle.dp anchors.rightMargin: 15 * DefaultStyle.dp
onCheckedChanged: {
if (checked) mainItem.numericPad.open()
else mainItem.numericPad.close()
}
} }
Button { Button {
id: clearTextButton id: clearTextButton

View file

@ -25,6 +25,7 @@ AbstractMainPage {
signal startGroupCallRequested() signal startGroupCallRequested()
signal createCallFromSearchBarRequested() signal createCallFromSearchBarRequested()
signal createContactRequested(string name, string address) signal createContactRequested(string name, string address)
signal openNumPadRequest()
Connections { Connections {
enabled: confInfoGui enabled: confInfoGui
@ -48,10 +49,10 @@ AbstractMainPage {
showDefaultItem: listStackView.currentItem.listView && listStackView.currentItem.listView.count === 0 && listStackView.currentItem.listView.model.sourceModel.count === 0 || false showDefaultItem: listStackView.currentItem.listView && listStackView.currentItem.listView.count === 0 && listStackView.currentItem.listView.model.sourceModel.count === 0 || false
function goToNewCall() { function goToNewCall() {
listStackView.push(newCallItem) if (listStackView.currentItem.objectName != "newCallItem") listStackView.push(newCallItem)
} }
function goToCallHistory() { function goToCallHistory() {
listStackView.pop() if (listStackView.currentItem.objectName != "historyListItem") listStackView.replace(historyListItem)
} }
Dialog { Dialog {
@ -106,6 +107,7 @@ AbstractMainPage {
id: numericPad id: numericPad
width: parent.width width: parent.width
height: parent.height height: parent.height
visible: false
onLaunchCall: { onLaunchCall: {
mainItem.createCallFromSearchBarRequested() mainItem.createCallFromSearchBarRequested()
// TODO : auto completion instead of sip linphone // TODO : auto completion instead of sip linphone
@ -471,6 +473,7 @@ AbstractMainPage {
Component { Component {
id: newCallItem id: newCallItem
FocusScope{ FocusScope{
objectName: "newCallItem"
width: parent?.width width: parent?.width
height: parent?.height height: parent?.height
Control.StackView.onActivated:{ Control.StackView.onActivated:{
@ -498,6 +501,14 @@ AbstractMainPage {
Connections { Connections {
target: mainItem target: mainItem
function onCreateCallFromSearchBarRequested(){ UtilsCpp.createCall(callContactsList.searchBar.text)} function onCreateCallFromSearchBarRequested(){ UtilsCpp.createCall(callContactsList.searchBar.text)}
function onOpenNumPadRequest(){ if (!callContactsList.searchBar.numericPadButton.checked) callContactsList.searchBar.numericPadButton.checked = true}
}
Binding {
target: numericPad
property: "visible"
value: true
when: callContactsList.searchBar.numericPadButton.checked
restoreMode: Binding.RestoreValue
} }
} }
} }