linphone-desktop/linphone-app/ui/modules/Linphone/Menus/SipAddressesMenu.qml
Julien Wadel 3a560324f8 - Add an option to enable standard and secure chats feature ('app' section)
- Fix history buttons that should not appear if chat room mode is not activated
- Allow to use a secure chat room to be used when calling (set by context : encrypted call/secure chat enabled)
- Replace a warning log by info while creating a chat room.
- Fix missing qml variables.
- Change Contact Edit and SIP Addresses selections to start a standard chat or a secure one.
- Simplify encryption activation on call parameters with enableEncryption()
2021-10-20 20:24:39 +02:00

114 lines
2.8 KiB
QML

import QtQuick 2.7
import Common 1.0
import Linphone.Styles 1.0
// =============================================================================
Item {
id: sipAddressesMenu
// ---------------------------------------------------------------------------
property alias relativeTo: menu.relativeTo
property alias relativeX: menu.relativeX
property alias relativeY: menu.relativeY
property var sipAddresses: []
// ---------------------------------------------------------------------------
function open (isSecure) {
var length = sipAddresses.length
if (!length) {
return
}
if (length === 1) {
return sipAddressesMenu.sipAddressClicked(sipAddresses[0], isSecure)
}
menu.isSecure = isSecure
menu.open()
}
function _fillModel () {
model.clear()
sipAddresses.forEach(function (sipAddress) {
model.append({ $sipAddress: sipAddress })
})
}
// ---------------------------------------------------------------------------
signal sipAddressClicked (string sipAddress, bool isSecure)
// ---------------------------------------------------------------------------
onSipAddressesChanged: _fillModel()
// ---------------------------------------------------------------------------
DropDownDynamicMenu {
id: menu
property bool isSecure : false
parent: sipAddressesMenu.parent
entryHeight: SipAddressesMenuStyle.entry.height
maxMenuHeight: SipAddressesMenuStyle.maxHeight
ScrollableListView {
id: list
spacing: SipAddressesMenuStyle.spacing
width: SipAddressesMenuStyle.entry.width
model: ListModel {
id: model
Component.onCompleted: _fillModel()
}
delegate: Rectangle {
height: menu.entryHeight
width: parent.width
color: mouseArea.pressed
? SipAddressesMenuStyle.entry.color.pressed
: (
mouseArea.containsMouse
? SipAddressesMenuStyle.entry.color.hovered
: SipAddressesMenuStyle.entry.color.normal
)
Text {
anchors {
left: parent.left
leftMargin: SipAddressesMenuStyle.entry.leftMargin
right: parent.right
rightMargin: SipAddressesMenuStyle.entry.rightMargin
}
color: SipAddressesMenuStyle.entry.text.color
elide: Text.ElideRight
font.pointSize: SipAddressesMenuStyle.entry.text.pointSize
height: parent.height
text: $sipAddress
verticalAlignment: Text.AlignVCenter
}
MouseArea {
id: mouseArea
anchors.fill: parent
onClicked: {
menu.close()
sipAddressesMenu.sipAddressClicked($sipAddress, menu.isSecure)
}
}
}
}
}
}