Commit 95ce08e7 authored by Ronan Abhamon's avatar Ronan Abhamon

fix(ui/modules/Linphone/SmartSearchBar): handle correctly mouse hover header

parent c5427180
...@@ -17,9 +17,11 @@ SearchBox { ...@@ -17,9 +17,11 @@ SearchBox {
signal launchCall (string sipAddress) signal launchCall (string sipAddress)
signal launchVideoCall (string sipAddress) signal launchVideoCall (string sipAddress)
// ---------------------------------------------------------------------------
// Header.
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
header: Column { header: MouseArea {
readonly property string interpretableSipAddress: SipAddressesModel.interpretUrl(searchBox.filter) readonly property string interpretableSipAddress: SipAddressesModel.interpretUrl(searchBox.filter)
height: { height: {
...@@ -28,123 +30,130 @@ SearchBox { ...@@ -28,123 +30,130 @@ SearchBox {
} }
width: parent.width width: parent.width
spacing: 0 // Workaround to handle mouse.
// Without it, the mouse can be given to items list when it is hover header.
hoverEnabled: true
// ------------------------------------------------------------------------- Column {
// Default contact. anchors.fill: parent
// -------------------------------------------------------------------------
Loader { spacing: 0
id: defaultContact
height: searchBox.entryHeight // -----------------------------------------------------------------------
width: parent.width // Default contact.
// -----------------------------------------------------------------------
visible: interpretableSipAddress.length > 0 Loader {
id: defaultContact
sourceComponent: Rectangle { height: searchBox.entryHeight
anchors.fill: parent width: parent.width
color: SmartSearchBarStyle.entry.color.normal
RowLayout { visible: interpretableSipAddress.length > 0
anchors {
fill: parent
rightMargin: SmartSearchBarStyle.entry.rightMargin
}
spacing: 0
Contact { sourceComponent: Rectangle {
id: contact anchors.fill: parent
color: SmartSearchBarStyle.entry.color.normal
Layout.fillHeight: true RowLayout {
Layout.fillWidth: true anchors {
entry: Object ({ fill: parent
sipAddress: interpretableSipAddress rightMargin: SmartSearchBarStyle.entry.rightMargin
}) }
} spacing: 0
ActionBar { Contact {
iconSize: SmartSearchBarStyle.entry.iconSize id: contact
ActionButton { Layout.fillHeight: true
icon: 'video_call' Layout.fillWidth: true
onClicked: { entry: Object ({
searchBox.hideMenu() sipAddress: interpretableSipAddress
searchBox.launchVideoCall(interpretableSipAddress) })
}
} }
ActionButton { ActionBar {
icon: 'call' iconSize: SmartSearchBarStyle.entry.iconSize
onClicked: {
searchBox.hideMenu() ActionButton {
searchBox.launchCall(interpretableSipAddress) icon: 'video_call'
onClicked: {
searchBox.hideMenu()
searchBox.launchVideoCall(interpretableSipAddress)
}
}
ActionButton {
icon: 'call'
onClicked: {
searchBox.hideMenu()
searchBox.launchCall(interpretableSipAddress)
}
} }
}
ActionButton { ActionButton {
icon: 'chat' icon: 'chat'
onClicked: { onClicked: {
searchBox.hideMenu() searchBox.hideMenu()
searchBox.launchChat(interpretableSipAddress) searchBox.launchChat(interpretableSipAddress)
}
} }
} }
} }
} }
} }
}
// ------------------------------------------------------------------------- // -----------------------------------------------------------------------
// Add contact button. // Add contact button.
// ------------------------------------------------------------------------- // -----------------------------------------------------------------------
MouseArea { MouseArea {
id: addContactButton id: addContactButton
height: SmartSearchBarStyle.header.addButtonHeight height: SmartSearchBarStyle.header.addButtonHeight
width: parent.width width: parent.width
onClicked: { onClicked: {
searchBox.hideMenu() searchBox.hideMenu()
searchBox.addContact(interpretableSipAddress) searchBox.addContact(interpretableSipAddress)
} }
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
color: parent.pressed color: parent.pressed
? SmartSearchBarStyle.header.color.pressed ? SmartSearchBarStyle.header.color.pressed
: SmartSearchBarStyle.header.color.normal : SmartSearchBarStyle.header.color.normal
Text { Text {
anchors { anchors {
left: parent.left left: parent.left
leftMargin: SmartSearchBarStyle.header.leftMargin leftMargin: SmartSearchBarStyle.header.leftMargin
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
} }
font { font {
bold: true bold: true
pointSize: SmartSearchBarStyle.header.text.fontSize pointSize: SmartSearchBarStyle.header.text.fontSize
}
color: addContactButton.pressed
? SmartSearchBarStyle.header.text.color.pressed
: SmartSearchBarStyle.header.text.color.normal
text: qsTr('addContact')
} }
color: addContactButton.pressed
? SmartSearchBarStyle.header.text.color.pressed
: SmartSearchBarStyle.header.text.color.normal
text: qsTr('addContact')
}
Icon { Icon {
anchors { anchors {
right: parent.right right: parent.right
rightMargin: SmartSearchBarStyle.header.rightMargin rightMargin: SmartSearchBarStyle.header.rightMargin
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
}
icon: 'contact_add'
iconSize: SmartSearchBarStyle.header.iconSize
} }
icon: 'contact_add'
iconSize: SmartSearchBarStyle.header.iconSize
} }
} }
} }
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Entries. // Entries.
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment