feat(ui/modules/Linphone/SmartSearchBar): handle click on entries

This commit is contained in:
Ronan Abhamon 2017-01-09 15:04:54 +01:00
parent 208c28a982
commit 83dfe7835c
3 changed files with 28 additions and 7 deletions

View file

@ -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)
}

View file

@ -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)
}
}
}
// -------------------------------------------------------------------

View file

@ -167,6 +167,13 @@ ApplicationWindow {
})
}
onLaunchVideoCall: CallsWindow.show()
onEntryClicked: {
window.ensureCollapsed()
window.setView(entry.contact ? 'ContactEdit' : 'Conversation', {
sipAddress: entry.sipAddress
})
}
}
}
}