From 83dfe7835c21c599485776ed41e46ea71691e92b Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Mon, 9 Jan 2017 15:04:54 +0100 Subject: [PATCH] feat(ui/modules/Linphone/SmartSearchBar): handle click on entries --- tests/ui/modules/Common/SearchBox.qml | 6 +----- tests/ui/modules/Linphone/SmartSearchBar.qml | 22 ++++++++++++++++++-- tests/ui/views/App/MainWindow/MainWindow.qml | 7 +++++++ 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/tests/ui/modules/Common/SearchBox.qml b/tests/ui/modules/Common/SearchBox.qml index 496e33a9a..fcbe25e0b 100644 --- a/tests/ui/modules/Common/SearchBox.qml +++ b/tests/ui/modules/Common/SearchBox.qml @@ -52,11 +52,7 @@ Item { } function _filter (text) { - Utils.assert( - model.setFilter != null, - '`model.setFilter` must be defined.' - ) - + Utils.assert(model.setFilter != null, '`model.setFilter` must be defined.') model.setFilter(text) } diff --git a/tests/ui/modules/Linphone/SmartSearchBar.qml b/tests/ui/modules/Linphone/SmartSearchBar.qml index 6daf7eea9..3c63c94de 100644 --- a/tests/ui/modules/Linphone/SmartSearchBar.qml +++ b/tests/ui/modules/Linphone/SmartSearchBar.qml @@ -17,12 +17,16 @@ SearchBox { signal launchCall (string sipAddress) signal launchVideoCall (string sipAddress) + signal entryClicked (var entry) + // --------------------------------------------------------------------------- // Header. // --------------------------------------------------------------------------- header: MouseArea { - readonly property string interpretableSipAddress: SipAddressesModel.interpretUrl(searchBox.filter) + readonly property string interpretableSipAddress: SipAddressesModel.interpretUrl( + searchBox.filter + ) height: { var height = SmartSearchBarStyle.header.addButtonHeight @@ -31,7 +35,7 @@ SearchBox { width: parent.width // Workaround to handle mouse. - // Without it, the mouse can be given to items list when it is hover header. + // Without it, the mouse can be given to items list when mouse is hover header. hoverEnabled: true Column { @@ -195,6 +199,20 @@ SearchBox { Layout.fillHeight: true Layout.fillWidth: true entry: $entry + + MouseArea { + anchors.fill: parent + + cursorShape: containsMouse + ? Qt.PointingHandCursor + : Qt.ArrowCursor + hoverEnabled: true + + onClicked: { + searchBox.hideMenu() + searchBox.entryClicked($entry) + } + } } // ------------------------------------------------------------------- diff --git a/tests/ui/views/App/MainWindow/MainWindow.qml b/tests/ui/views/App/MainWindow/MainWindow.qml index e7041a771..c6a6a3a78 100644 --- a/tests/ui/views/App/MainWindow/MainWindow.qml +++ b/tests/ui/views/App/MainWindow/MainWindow.qml @@ -167,6 +167,13 @@ ApplicationWindow { }) } onLaunchVideoCall: CallsWindow.show() + + onEntryClicked: { + window.ensureCollapsed() + window.setView(entry.contact ? 'ContactEdit' : 'Conversation', { + sipAddress: entry.sipAddress + }) + } } } }