Commit 24ee1aa9 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(ManageAccounts): can select default account

parent 7e089a9d
...@@ -83,6 +83,8 @@ Item { ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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 ...@@ -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 {
anchors.fill: parent
// TODO: Compute list max.
ScrollableListView {
id: accounts
Item { anchors.fill: parent
anchors.fill: parent
// TODO: Compute list max. // TODO: Remove, use C++ model instead.
ScrollableListView { model: model1
delegate: Item {
function isDefaultAccount () {
return accounts.currentIndex === index
}
height: 34
width: parent.width
Rectangle {
anchors.fill: parent
color: isDefaultAccount() ? '#EAEAEA' : 'transparent'
id: accountLine
RowLayout {
anchors.fill: parent anchors.fill: parent
id: accountsList spacing: 15
anchors.leftMargin: 15
// TODO: Remove, use C++ model instead. anchors.rightMargin: 15
model: ListModel {
ListElement { // Default account.
presence: 'connected' Item {
sipAddress: 'jim.williams.zzzz.yyyy.kkkk.sip.linphone.org' Layout.fillHeight: parent.height
isDefault: false Layout.preferredWidth: 20
}
ListElement { Image {
presence: 'connected' anchors.fill: parent
sipAddress: 'toto.lala.sip.linphone.org' fillMode: Image.PreserveAspectFit
isDefault: false source: isDefaultAccount() ? 'qrc:/imgs/valid.svg' : ''
} }
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 // Sip account.
width: parent.width Item {
Layout.fillHeight: parent.height
Rectangle { Layout.fillWidth: true
anchors.fill: parent
color: isDefault ? '#EAEAEA' : 'transparent' Text {
id: accountLine anchors.fill: parent
clip: true
RowLayout { color: '#59575A'
anchors.fill: parent text: sipAddress;
spacing: 15 verticalAlignment: Text.AlignVCenter
anchors.leftMargin: 15
anchors.rightMargin: 15 MouseArea {
anchors.fill: parent
// Default account. cursorShape: Qt.PointingHandCursor
Item { onClicked: accounts.currentIndex = index
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'
}
}
}
} }
}
} }
// 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 }
}
} }
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