From e4d6cb4dfd53f5a459f7463758722d4ca02144f7 Mon Sep 17 00:00:00 2001 From: Gaelle Braud Date: Tue, 13 Aug 2024 12:09:18 +0200 Subject: [PATCH] open numeric from magic search bar --- Linphone/view/App/Layout/MainLayout.qml | 17 ++++++++++++++--- Linphone/view/Item/SearchBar.qml | 4 ---- Linphone/view/Page/Main/CallPage.qml | 15 +++++++++++++-- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/Linphone/view/App/Layout/MainLayout.qml b/Linphone/view/App/Layout/MainLayout.qml index 120b886cb..8f76a6d4c 100644 --- a/Linphone/view/App/Layout/MainLayout.qml +++ b/Linphone/view/App/Layout/MainLayout.qml @@ -18,14 +18,15 @@ Item { property var contextualMenuOpenedComponent: undefined signal addAccountRequest() - signal openNewCall() + signal openNewCallRequest() signal openCallHistory() + signal openNumPadRequest() signal displayContactRequested(string contactAddress) signal createContactRequested(string name, string address) function goToNewCall() { tabbar.currentIndex = 0 - mainItem.openNewCall() + mainItem.openNewCallRequest() } function goToCallHistory() { tabbar.currentIndex = 0 @@ -139,6 +140,15 @@ Item { Layout.fillWidth: true placeholderText: qsTr("Rechercher un contact, appeler ou envoyer un message...") focusedBorderColor: DefaultStyle.main1_500_main + numericPadButton.visible: text.length === 0 + numericPadButton.checkable: false + Connections { + target: magicSearchBar.numericPadButton + function onClicked() { + mainItem.goToNewCall() + mainItem.openNumPadRequest() + } + } onTextChanged: { if (text.length != 0) listPopup.open() else listPopup.close() @@ -477,8 +487,9 @@ Item { id: callPage Connections { target: mainItem - function onOpenNewCall(){ callPage.goToNewCall()} + function onOpenNewCallRequest(){ callPage.goToNewCall()} function onOpenCallHistory(){ callPage.goToCallHistory()} + function onOpenNumPadRequest(){ callPage.openNumPadRequest()} } onCreateContactRequested: (name, address) => { mainItem.createContact(name, address) diff --git a/Linphone/view/Item/SearchBar.qml b/Linphone/view/Item/SearchBar.qml index 7e1acbe71..2761d4678 100644 --- a/Linphone/view/Item/SearchBar.qml +++ b/Linphone/view/Item/SearchBar.qml @@ -101,10 +101,6 @@ FocusScope { anchors.verticalCenter: parent.verticalCenter anchors.right: parent.right anchors.rightMargin: 15 * DefaultStyle.dp - onCheckedChanged: { - if (checked) mainItem.numericPad.open() - else mainItem.numericPad.close() - } } Button { id: clearTextButton diff --git a/Linphone/view/Page/Main/CallPage.qml b/Linphone/view/Page/Main/CallPage.qml index 3057f70bc..168cbaaa2 100644 --- a/Linphone/view/Page/Main/CallPage.qml +++ b/Linphone/view/Page/Main/CallPage.qml @@ -25,6 +25,7 @@ AbstractMainPage { signal startGroupCallRequested() signal createCallFromSearchBarRequested() signal createContactRequested(string name, string address) + signal openNumPadRequest() Connections { enabled: confInfoGui @@ -48,10 +49,10 @@ AbstractMainPage { showDefaultItem: listStackView.currentItem.listView && listStackView.currentItem.listView.count === 0 && listStackView.currentItem.listView.model.sourceModel.count === 0 || false function goToNewCall() { - listStackView.push(newCallItem) + if (listStackView.currentItem.objectName != "newCallItem") listStackView.push(newCallItem) } function goToCallHistory() { - listStackView.pop() + if (listStackView.currentItem.objectName != "historyListItem") listStackView.replace(historyListItem) } Dialog { @@ -106,6 +107,7 @@ AbstractMainPage { id: numericPad width: parent.width height: parent.height + visible: false onLaunchCall: { mainItem.createCallFromSearchBarRequested() // TODO : auto completion instead of sip linphone @@ -471,6 +473,7 @@ AbstractMainPage { Component { id: newCallItem FocusScope{ + objectName: "newCallItem" width: parent?.width height: parent?.height Control.StackView.onActivated:{ @@ -498,6 +501,14 @@ 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: numericPad + property: "visible" + value: true + when: callContactsList.searchBar.numericPadButton.checked + restoreMode: Binding.RestoreValue } } }