linphone-desktop/tests/ui/modules/Linphone/SmartSearchBar.qml
Ronan Abhamon 01ba4d78eb feat(app):
- many fixes
  - method `setView` of `MainWindow` update the menus/buttons of the interface.
  - ...
2016-12-21 17:26:16 +01:00

115 lines
2.6 KiB
QML

import QtQuick 2.7
import QtQuick.Layouts 1.3
import Common 1.0
import Linphone 1.0
import LinphoneUtils 1.0
// =============================================================================
SearchBox {
id: searchBox
delegate: Rectangle {
id: searchBoxEntry
height: searchBox.entryHeight
width: parent.width
Rectangle {
id: indicator
anchors.left: parent.left
color: 'transparent'
height: parent.height
width: 5
}
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
RowLayout {
anchors {
fill: parent
leftMargin: 22
rightMargin: 10
}
spacing: 15
// ---------------------------------------------------------------------
// Contact or address info
// ---------------------------------------------------------------------
Avatar {
id: avatar
Layout.preferredHeight: 30
Layout.preferredWidth: 30
image: $entry.vcard && $entry.vcard.avatar
presenceLevel: $entry.presenceLevel != null ? $entry.presenceLevel : -1
username: LinphoneUtils.getContactUsername($entry.sipAddress || $entry)
}
Text {
Layout.fillWidth: true
color: '#4B5964'
elide: Text.ElideRight
font {
bold: true
pointSize: 9
}
text: $entry.vcard ? $entry.vcard.username : $entry.sipAddress
}
// ---------------------------------------------------------------------
// Actions
// ---------------------------------------------------------------------
ActionBar {
iconSize: 36
ActionButton {
icon: 'video_call'
onClicked: CallsWindow.show()
}
ActionButton {
icon: 'call'
onClicked: CallsWindow.show()
}
ActionButton {
icon: 'chat'
onClicked: {
searchBox.hideMenu()
window.ensureCollapsed()
window.setView('Conversation', {
sipAddress: $entry.sipAddress || $entry.vcard.sipAddresses[0] // FIXME: Display menu if many addresses.
})
}
}
}
}
}
// -------------------------------------------------------------------------
states: State {
when: mouseArea.containsMouse
PropertyChanges {
color: '#D0D8DE'
target: searchBoxEntry
}
PropertyChanges {
color: '#FF5E00'
target: indicator
}
}
}
}