mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-05-02 10:16:24 +00:00
feat(ManageAccounts): can select default account
This commit is contained in:
parent
7e089a9d4d
commit
24ee1aa938
4 changed files with 158 additions and 141 deletions
|
|
@ -83,6 +83,8 @@ Item {
|
||||||
mapToItem(item.parent, mouse.x, mouse.y)
|
mapToItem(item.parent, mouse.x, mouse.y)
|
||||||
)) {
|
)) {
|
||||||
if (_timeout != null) {
|
if (_timeout != null) {
|
||||||
|
// Remove existing timeout to avoid the creation of
|
||||||
|
// many children.
|
||||||
Utils.clearTimeout(_timeout)
|
Utils.clearTimeout(_timeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -91,7 +93,7 @@ Item {
|
||||||
//
|
//
|
||||||
// It's useful to ensure the window's context is not
|
// It's useful to ensure the window's context is not
|
||||||
// modified with the mouse event before the `onPressed`
|
// modified with the mouse event before the `onPressed`
|
||||||
// function.
|
// call.
|
||||||
//
|
//
|
||||||
// The timeout is destroyed with the `MouseArea` component.
|
// The timeout is destroyed with the `MouseArea` component.
|
||||||
_timeout = Utils.setTimeout.call(this, 0, item.pressed.bind(this))
|
_timeout = Utils.setTimeout.call(this, 0, item.pressed.bind(this))
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,5 @@ ListView {
|
||||||
ScrollBar.vertical: ForceScrollBar { }
|
ScrollBar.vertical: ForceScrollBar { }
|
||||||
boundsBehavior: Flickable.StopAtBounds
|
boundsBehavior: Flickable.StopAtBounds
|
||||||
clip: true
|
clip: true
|
||||||
highlightRangeMode: ListView.ApplyRange
|
|
||||||
spacing: 0
|
spacing: 0
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,10 @@ ApplicationWindow {
|
||||||
loaderContent.source = 'qrc:/ui/views/MainWindow/' + view + '.qml'
|
loaderContent.source = 'qrc:/ui/views/MainWindow/' + view + '.qml'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _manageAccounts () {
|
||||||
|
Utils.openWindow('ManageAccounts', window)
|
||||||
|
}
|
||||||
|
|
||||||
maximumHeight: 70
|
maximumHeight: 70
|
||||||
minimumHeight: 70
|
minimumHeight: 70
|
||||||
minimumWidth: 780
|
minimumWidth: 780
|
||||||
|
|
@ -53,13 +57,13 @@ ApplicationWindow {
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: contactDescription
|
anchors.fill: contactDescription
|
||||||
onClicked: Utils.openWindow('ManageAccounts', window)
|
onClicked: _manageAccounts()
|
||||||
}
|
}
|
||||||
|
|
||||||
// User actions.
|
// User actions.
|
||||||
ActionButton {
|
ActionButton {
|
||||||
Layout.preferredWidth: 1
|
Layout.preferredWidth: 1
|
||||||
onClicked: Utils.openWindow('ManageAccounts', window)
|
onClicked: _manageAccounts()
|
||||||
}
|
}
|
||||||
|
|
||||||
ActionButton {
|
ActionButton {
|
||||||
|
|
|
||||||
|
|
@ -5,149 +5,161 @@ import QtQuick.Layouts 1.3
|
||||||
import Linphone 1.0
|
import Linphone 1.0
|
||||||
|
|
||||||
DialogPlus {
|
DialogPlus {
|
||||||
descriptionText: qsTr('manageAccountsDescription')
|
descriptionText: qsTr('manageAccountsDescription')
|
||||||
minimumHeight: 328
|
minimumHeight: 328
|
||||||
minimumWidth: 480
|
minimumWidth: 480
|
||||||
title: qsTr('manageAccountsTitle')
|
title: qsTr('manageAccountsTitle')
|
||||||
|
|
||||||
buttons: TextButtonA {
|
buttons: TextButtonA {
|
||||||
text: qsTr('validate')
|
text: qsTr('validate')
|
||||||
}
|
onClicked: exit(0)
|
||||||
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
// TODO: Compute list max.
|
// TODO: Compute list max.
|
||||||
ScrollableListView {
|
ScrollableListView {
|
||||||
anchors.fill: parent
|
id: accounts
|
||||||
id: accountsList
|
|
||||||
|
|
||||||
// TODO: Remove, use C++ model instead.
|
anchors.fill: parent
|
||||||
model: ListModel {
|
|
||||||
ListElement {
|
|
||||||
presence: 'connected'
|
|
||||||
sipAddress: 'jim.williams.zzzz.yyyy.kkkk.sip.linphone.org'
|
|
||||||
isDefault: false
|
|
||||||
}
|
|
||||||
ListElement {
|
|
||||||
presence: 'connected'
|
|
||||||
sipAddress: 'toto.lala.sip.linphone.org'
|
|
||||||
isDefault: false
|
|
||||||
}
|
|
||||||
ListElement {
|
|
||||||
presence: 'disconnected'
|
|
||||||
sipAddress: 'machin.truc.sip.linphone.org'
|
|
||||||
isDefault: true
|
|
||||||
}
|
|
||||||
ListElement {
|
|
||||||
presence: 'absent'
|
|
||||||
sipAddress: 'hey.listen.sip.linphone.org'
|
|
||||||
isDefault: false
|
|
||||||
}
|
|
||||||
ListElement {
|
|
||||||
presence: 'do_not_disturb'
|
|
||||||
sipAddress: 'valentin.cognito.sip.linphone.org'
|
|
||||||
isDefault: false
|
|
||||||
}
|
|
||||||
ListElement {
|
|
||||||
presence: 'do_not_disturb'
|
|
||||||
sipAddress: 'charles.henri.sip.linphone.org'
|
|
||||||
isDefault: false
|
|
||||||
}
|
|
||||||
ListElement {
|
|
||||||
presence: 'disconnected'
|
|
||||||
sipAddress: 'yesyes.nono.sip.linphone.org'
|
|
||||||
isDefault: false
|
|
||||||
}
|
|
||||||
ListElement {
|
|
||||||
presence: 'connected'
|
|
||||||
sipAddress: 'nsa.sip.linphone.org'
|
|
||||||
isDefault: false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
delegate: Item {
|
|
||||||
height: 34
|
|
||||||
width: parent.width
|
|
||||||
|
|
||||||
Rectangle {
|
// TODO: Remove, use C++ model instead.
|
||||||
anchors.fill: parent
|
model: model1
|
||||||
color: isDefault ? '#EAEAEA' : 'transparent'
|
|
||||||
id: accountLine
|
|
||||||
|
|
||||||
RowLayout {
|
delegate: Item {
|
||||||
anchors.fill: parent
|
function isDefaultAccount () {
|
||||||
spacing: 15
|
return accounts.currentIndex === index
|
||||||
anchors.leftMargin: 15
|
|
||||||
anchors.rightMargin: 15
|
|
||||||
|
|
||||||
// Default account.
|
|
||||||
Item {
|
|
||||||
Layout.fillHeight: parent.height
|
|
||||||
Layout.preferredWidth: 20
|
|
||||||
|
|
||||||
Image {
|
|
||||||
anchors.fill: parent
|
|
||||||
fillMode: Image.PreserveAspectFit
|
|
||||||
source: isDefault ? 'qrc:/imgs/valid.svg' : ''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sip account.
|
|
||||||
Item {
|
|
||||||
Layout.fillHeight: parent.height
|
|
||||||
Layout.fillWidth: true
|
|
||||||
|
|
||||||
Text {
|
|
||||||
anchors.fill: parent
|
|
||||||
clip: true
|
|
||||||
color: '#59575A'
|
|
||||||
text: sipAddress;
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Presence.
|
|
||||||
Item {
|
|
||||||
Layout.fillHeight: parent.height
|
|
||||||
Layout.preferredWidth: 20
|
|
||||||
|
|
||||||
Image {
|
|
||||||
anchors.fill: parent
|
|
||||||
fillMode: Image.PreserveAspectFit
|
|
||||||
source: 'qrc:/imgs/led_' + presence + '.svg'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update presence.
|
|
||||||
Item {
|
|
||||||
Layout.fillHeight: parent.height
|
|
||||||
Layout.preferredWidth: 160
|
|
||||||
|
|
||||||
TransparentComboBox {
|
|
||||||
anchors.fill: parent
|
|
||||||
model: ListModel {
|
|
||||||
ListElement { key: qsTr('onlinePresence'); value: 1 }
|
|
||||||
ListElement { key: qsTr('busyPresence'); value: 2 }
|
|
||||||
ListElement { key: qsTr('beRightBackPresence'); value: 3 }
|
|
||||||
ListElement { key: qsTr('awayPresence'); value: 4 }
|
|
||||||
ListElement { key: qsTr('onThePhonePresence'); value: 5 }
|
|
||||||
ListElement { key: qsTr('outToLunchPresence'); value: 6 }
|
|
||||||
ListElement { key: qsTr('doNotDisturbPresence'); value: 7 }
|
|
||||||
ListElement { key: qsTr('movedPresence'); value: 8 }
|
|
||||||
ListElement { key: qsTr('usingAnotherMessagingServicePresence'); value: 9 }
|
|
||||||
ListElement { key: qsTr('offlinePresence'); value: 10 }
|
|
||||||
}
|
|
||||||
textRole: 'key'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
height: 34
|
||||||
|
width: parent.width
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
color: isDefaultAccount() ? '#EAEAEA' : 'transparent'
|
||||||
|
id: accountLine
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
anchors.fill: parent
|
||||||
|
spacing: 15
|
||||||
|
anchors.leftMargin: 15
|
||||||
|
anchors.rightMargin: 15
|
||||||
|
|
||||||
|
// Default account.
|
||||||
|
Item {
|
||||||
|
Layout.fillHeight: parent.height
|
||||||
|
Layout.preferredWidth: 20
|
||||||
|
|
||||||
|
Image {
|
||||||
|
anchors.fill: parent
|
||||||
|
fillMode: Image.PreserveAspectFit
|
||||||
|
source: isDefaultAccount() ? 'qrc:/imgs/valid.svg' : ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sip account.
|
||||||
|
Item {
|
||||||
|
Layout.fillHeight: parent.height
|
||||||
|
Layout.fillWidth: true
|
||||||
|
|
||||||
|
Text {
|
||||||
|
anchors.fill: parent
|
||||||
|
clip: true
|
||||||
|
color: '#59575A'
|
||||||
|
text: sipAddress;
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: accounts.currentIndex = index
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Presence.
|
||||||
|
Item {
|
||||||
|
Layout.fillHeight: parent.height
|
||||||
|
Layout.preferredWidth: 20
|
||||||
|
|
||||||
|
Image {
|
||||||
|
anchors.fill: parent
|
||||||
|
fillMode: Image.PreserveAspectFit
|
||||||
|
source: 'qrc:/imgs/led_' + presence + '.svg'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update presence.
|
||||||
|
Item {
|
||||||
|
Layout.fillHeight: parent.height
|
||||||
|
Layout.preferredWidth: 160
|
||||||
|
|
||||||
|
TransparentComboBox {
|
||||||
|
anchors.fill: parent
|
||||||
|
model: model2
|
||||||
|
textRole: 'key'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// =================================================================
|
||||||
|
// TMP
|
||||||
|
// =================================================================
|
||||||
|
|
||||||
|
ListModel {
|
||||||
|
id: model1
|
||||||
|
|
||||||
|
ListElement {
|
||||||
|
presence: 'connected'
|
||||||
|
sipAddress: 'jim.williams.zzzz.yyyy.kkkk.sip.linphone.org'
|
||||||
|
}
|
||||||
|
ListElement {
|
||||||
|
presence: 'connected'
|
||||||
|
sipAddress: 'toto.lala.sip.linphone.org'
|
||||||
|
}
|
||||||
|
ListElement {
|
||||||
|
presence: 'disconnected'
|
||||||
|
sipAddress: 'machin.truc.sip.linphone.org'
|
||||||
|
}
|
||||||
|
ListElement {
|
||||||
|
presence: 'absent'
|
||||||
|
sipAddress: 'hey.listen.sip.linphone.org'
|
||||||
|
}
|
||||||
|
ListElement {
|
||||||
|
presence: 'do_not_disturb'
|
||||||
|
sipAddress: 'valentin.cognito.sip.linphone.org'
|
||||||
|
}
|
||||||
|
ListElement {
|
||||||
|
presence: 'do_not_disturb'
|
||||||
|
sipAddress: 'charles.henri.sip.linphone.org'
|
||||||
|
}
|
||||||
|
ListElement {
|
||||||
|
presence: 'disconnected'
|
||||||
|
sipAddress: 'yesyes.nono.sip.linphone.org'
|
||||||
|
}
|
||||||
|
ListElement {
|
||||||
|
presence: 'connected'
|
||||||
|
sipAddress: 'nsa.sip.linphone.org'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ListModel {
|
||||||
|
id: model2
|
||||||
|
|
||||||
|
ListElement { key: qsTr('onlinePresence'); value: 1 }
|
||||||
|
ListElement { key: qsTr('busyPresence'); value: 2 }
|
||||||
|
ListElement { key: qsTr('beRightBackPresence'); value: 3 }
|
||||||
|
ListElement { key: qsTr('awayPresence'); value: 4 }
|
||||||
|
ListElement { key: qsTr('onThePhonePresence'); value: 5 }
|
||||||
|
ListElement { key: qsTr('outToLunchPresence'); value: 6 }
|
||||||
|
ListElement { key: qsTr('doNotDisturbPresence'); value: 7 }
|
||||||
|
ListElement { key: qsTr('movedPresence'); value: 8 }
|
||||||
|
ListElement { key: qsTr('usingAnotherMessagingServicePresence'); value: 9 }
|
||||||
|
ListElement { key: qsTr('offlinePresence'); value: 10 }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue