Commit 24ee1aa9 authored by Ronan's avatar Ronan
Browse files

feat(ManageAccounts): can select default account

parent 7e089a9d
......@@ -83,6 +83,8 @@ Item {
mapToItem(item.parent, mouse.x, mouse.y)
)) {
if (_timeout != null) {
// Remove existing timeout to avoid the creation of
// many children.
Utils.clearTimeout(_timeout)
}
......@@ -91,7 +93,7 @@ Item {
//
// It's useful to ensure the window's context is not
// modified with the mouse event before the `onPressed`
// function.
// call.
//
// The timeout is destroyed with the `MouseArea` component.
_timeout = Utils.setTimeout.call(this, 0, item.pressed.bind(this))
......
......@@ -9,6 +9,5 @@ ListView {
ScrollBar.vertical: ForceScrollBar { }
boundsBehavior: Flickable.StopAtBounds
clip: true
highlightRangeMode: ListView.ApplyRange
spacing: 0
}
......@@ -12,6 +12,10 @@ ApplicationWindow {
loaderContent.source = 'qrc:/ui/views/MainWindow/' + view + '.qml'
}
function _manageAccounts () {
Utils.openWindow('ManageAccounts', window)
}
maximumHeight: 70
minimumHeight: 70
minimumWidth: 780
......@@ -53,13 +57,13 @@ ApplicationWindow {
MouseArea {
anchors.fill: contactDescription
onClicked: Utils.openWindow('ManageAccounts', window)
onClicked: _manageAccounts()
}
// User actions.
ActionButton {
Layout.preferredWidth: 1
onClicked: Utils.openWindow('ManageAccounts', window)
onClicked: _manageAccounts()
}
ActionButton {
......
......@@ -5,149 +5,161 @@ import QtQuick.Layouts 1.3
import Linphone 1.0
DialogPlus {
descriptionText: qsTr('manageAccountsDescription')
minimumHeight: 328
minimumWidth: 480
title: qsTr('manageAccountsTitle')
descriptionText: qsTr('manageAccountsDescription')
minimumHeight: 328
minimumWidth: 480
title: qsTr('manageAccountsTitle')
buttons: TextButtonA {
text: qsTr('validate')
}
buttons: TextButtonA {
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.
ScrollableListView {
// TODO: Remove, use C++ model instead.
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
id: accountsList
// TODO: Remove, use C++ model instead.
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
}
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' : ''
}
}
delegate: Item {
height: 34
width: parent.width
Rectangle {
anchors.fill: parent
color: isDefault ? '#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: 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'
}
}
}
// 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 }
}
}
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