Commit 5dedf82c authored by Ronan Abhamon's avatar Ronan Abhamon

fix(app): many fixes

parent 421eae38
...@@ -30,6 +30,30 @@ ...@@ -30,6 +30,30 @@
<source>webSites</source> <source>webSites</source>
<translation>WEB SITE(S)</translation> <translation>WEB SITE(S)</translation>
</message> </message>
<message>
<source>sipAccountsInput</source>
<translation>SIP Address</translation>
</message>
<message>
<source>emailsInput</source>
<translation>E-mail address</translation>
</message>
<message>
<source>addressInput</source>
<translation>Address</translation>
</message>
<message>
<source>webSitesInput</source>
<translation>URL</translation>
</message>
<message>
<source>removeContactDescription</source>
<translation>Do you really want remove this contact from your book?</translation>
</message>
<message>
<source>removeContactTitle</source>
<translation>Delete confirmation</translation>
</message>
</context> </context>
<context> <context>
<name>Contacts</name> <name>Contacts</name>
...@@ -126,13 +150,6 @@ ...@@ -126,13 +150,6 @@
<translation>Display tooltips to discover Linphone Desktop</translation> <translation>Display tooltips to discover Linphone Desktop</translation>
</message> </message>
</context> </context>
<context>
<name>ListForm</name>
<message>
<source>fillPlaceholder</source>
<translation></translation>
</message>
</context>
<context> <context>
<name>MainWindow</name> <name>MainWindow</name>
<message> <message>
......
...@@ -30,6 +30,30 @@ ...@@ -30,6 +30,30 @@
<source>webSites</source> <source>webSites</source>
<translation>SITE(S) WEB</translation> <translation>SITE(S) WEB</translation>
</message> </message>
<message>
<source>sipAccountsInput</source>
<translation>Adresse SIP</translation>
</message>
<message>
<source>emailsInput</source>
<translation>Adresse e-mail</translation>
</message>
<message>
<source>addressInput</source>
<translation>Adresse</translation>
</message>
<message>
<source>webSitesInput</source>
<translation>URL</translation>
</message>
<message>
<source>removeContactDescription</source>
<translation>Voulez-vous vraiment supprimer ce contact de votre carnet ?</translation>
</message>
<message>
<source>removeContactTitle</source>
<translation>Confirmation de la suppression</translation>
</message>
</context> </context>
<context> <context>
<name>Contacts</name> <name>Contacts</name>
...@@ -126,13 +150,6 @@ ...@@ -126,13 +150,6 @@
<translation>Afficher les tooltips pour découvrir Linphone Desktop</translation> <translation>Afficher les tooltips pour découvrir Linphone Desktop</translation>
</message> </message>
</context> </context>
<context>
<name>ListForm</name>
<message>
<source>fillPlaceholder</source>
<translation></translation>
</message>
</context>
<context> <context>
<name>MainWindow</name> <name>MainWindow</name>
<message> <message>
......
...@@ -5,129 +5,131 @@ import QtQuick.Layouts 1.3 ...@@ -5,129 +5,131 @@ import QtQuick.Layouts 1.3
import Linphone 1.0 import Linphone 1.0
ScrollableListView { ScrollableListView {
model: ListModel { id: chat
ListElement { $dateSection: 1465389121000; $outgoing: true; $timestamp: 1465389121000; $type: 'message'; $content: 'This is it: fefe efzzzzzzzzzz aaaaaaaaa erfeezffeefzfzefzefzezfefez wfef efef e efeffefe fee efefefeefef fefefefefe eff fefefe fefeffww.linphone.org' }
ListElement { $dateSection: 1465389121000; $timestamp: 1465389121000; $type: 'event'; $content: 'incoming_call' } model: ListModel {
ListElement { $dateSection: 1465389121000; $timestamp: 1465389421000; $type: 'message'; $content: 'Perfect!' } ListElement { $dateSection: 1465389121000; $outgoing: true; $timestamp: 1465389121000; $type: 'message'; $content: 'This is it: fefe efzzzzzzzzzz aaaaaaaaa erfeezffeefzfzefzefzezfefez wfef efef e efeffefe fee efefefeefef fefefefefe eff fefefe fefeffww.linphone.org' }
ListElement { $dateSection: 1465389121000; $timestamp: 1465389121000; $type: 'event'; $content: 'hangup' } ListElement { $dateSection: 1465389121000; $timestamp: 1465389133000; $type: 'event'; $content: 'incoming_call' }
ListElement { $dateSection: 1465994221000; $outgoing: true; $timestamp: 1465994221000; $type: 'message'; $content: 'You\'ve heard the expression, "Just believe it and it will come." Well, technically, that is true, however, \'believing\' is not just thinking that you can have it...' } ListElement { $dateSection: 1465389121000; $timestamp: 1465389439000; $type: 'message'; $content: 'Perfect!' }
ListElement { $dateSection: 1465994221000; $timestamp: 1465994221000; $type: 'event'; $content: 'lost_incoming_call' } ListElement { $dateSection: 1465389121000; $timestamp: 1465389500000; $type: 'event'; $content: 'hangup' }
} ListElement { $dateSection: 1465994221000; $outgoing: true; $timestamp: 1465924321000; $type: 'message'; $content: 'You\'ve heard the expression, "Just believe it and it will come." Well, technically, that is true, however, \'believing\' is not just thinking that you can have it...' }
ListElement { $dateSection: 1465994221000; $timestamp: 1465924391000; $type: 'event'; $content: 'lost_incoming_call' }
Component { }
id: sectionHeading
Component {
Item { id: sectionHeading
implicitHeight: text.height +
container.anchors.topMargin + Item {
container.anchors.bottomMargin implicitHeight: text.height +
width: parent.width container.anchors.topMargin +
container.anchors.bottomMargin
Item { width: parent.width
anchors.bottomMargin: 10
anchors.fill: parent Item {
anchors.leftMargin: 18 anchors.bottomMargin: 10
anchors.topMargin: 20 anchors.fill: parent
id: container anchors.leftMargin: 18
anchors.topMargin: 20
Text { id: container
color: '#434343'
font.bold: true Text {
id: text color: '#434343'
font.bold: true
// Cast section to integer because Qt convert the id: text
// $dateSection in string!!!
text: new Date(+section).toLocaleDateString( // Cast section to integer because Qt convert the
Qt.locale() // $dateSection in string!!!
) text: new Date(+section).toLocaleDateString(
} Qt.locale()
} )
} }
}
}
}
section.criteria: ViewSection.FullString
section.delegate: sectionHeading
section.property: '$dateSection'
delegate: Rectangle {
anchors.left: parent.left
anchors.leftMargin: 18
anchors.right: parent.right
anchors.rightMargin: 18
// Unable to use `height` property.
// The height is given by message height.
implicitHeight: layout.height + 10
width: parent.width
MouseArea {
anchors.fill: parent
hoverEnabled: true
onEntered: parent.state = 'hover'
onExited: parent.state = ''
} }
section.criteria: ViewSection.FullString RowLayout {
section.delegate: sectionHeading id: layout
section.property: '$dateSection' spacing: 0
delegate: Rectangle { // The height is computed with the message height.
anchors.left: parent.left // Unable to use `height` and `implicitHeight` property.
anchors.leftMargin: 18 width: parent.width
anchors.right: parent.right
anchors.rightMargin: 18 // Display time.
Text {
// Unable to use `height` property. Layout.alignment: Qt.AlignTop
// The height is given by message height. Layout.preferredHeight: 30
implicitHeight: layout.height + 10 Layout.preferredWidth: 50
width: parent.width color: '#898989'
font.bold: $type === 'event'
MouseArea { text: new Date($timestamp).toLocaleString(
anchors.fill: parent Qt.locale(),
hoverEnabled: true 'hh:mm'
onEntered: parent.state = 'hover' )
onExited: parent.state = '' verticalAlignment: Text.AlignVCenter
}
// Icons area.
Row {
Layout.alignment: Qt.AlignTop
Layout.preferredHeight: 30
Layout.preferredWidth: 54
spacing: 10
Icon {
anchors.verticalCenter: parent.verticalCenter
icon: ($type === 'event' && $content) || ''
iconSize: 16
} }
RowLayout { ActionButton {
id: layout anchors.verticalCenter: parent.verticalCenter
spacing: 0 icon: 'delete'
iconSize: 16
// The height is computed with the message height. id: removeAction
// Unable to use `height` and `implicitHeight` property. onClicked: chat.model.remove(index)
width: parent.width visible: false
// Display time.
Text {
Layout.alignment: Qt.AlignTop
Layout.preferredHeight: 30
Layout.preferredWidth: 50
color: '#898989'
font.bold: $type === 'event'
text: new Date($timestamp).toLocaleString(
Qt.locale(),
'hh:mm'
)
verticalAlignment: Text.AlignVCenter
}
// Icons area.
Row {
Layout.alignment: Qt.AlignTop
Layout.preferredHeight: 30
Layout.preferredWidth: 54
spacing: 10
Icon {
anchors.verticalCenter: parent.verticalCenter
icon: ($type === 'event' && $content) || ''
iconSize: 16
}
ActionButton {
anchors.verticalCenter: parent.verticalCenter
icon: 'delete'
iconSize: 16
id: removeAction
onClicked: console.log('remove item')
visible: false
}
}
// Display content.
Loader {
Layout.fillWidth: true
id: loader
source: $type === 'message'
? (
'qrc:/ui/modules/Linphone/Chat/' +
($outgoing ? 'Outgoing' : 'Incoming') +
'Message.qml'
) : 'qrc:/ui/modules/Linphone/Chat/Event.qml'
}
} }
}
// Display content.
Loader {
Layout.fillWidth: true
id: loader
source: $type === 'message'
? (
'qrc:/ui/modules/Linphone/Chat/' +
($outgoing ? 'Outgoing' : 'Incoming') +
'Message.qml'
) : 'qrc:/ui/modules/Linphone/Chat/Event.qml'
}
}
states: State { states: State {
name: 'hover' name: 'hover'
PropertyChanges { target: removeAction; visible: true } PropertyChanges { target: removeAction; visible: true }
}
} }
}
} }
...@@ -7,12 +7,17 @@ import Linphone.Styles 1.0 ...@@ -7,12 +7,17 @@ import Linphone.Styles 1.0
// =================================================================== // ===================================================================
RowLayout { RowLayout {
id: listForm
property alias model: values.model property alias model: values.model
property alias title: text.text property alias title: text.text
property string placeholder
function _addValue (value) { function _addValue (value) {
if (model.count === 0 || if (
model.get(model.count - 1).$value.length !== 0) { model.count === 0 ||
model.get(model.count - 1).$value.length !== 0
) {
model.append({ $value: value }) model.append({ $value: value })
} }
} }
...@@ -81,7 +86,7 @@ RowLayout { ...@@ -81,7 +86,7 @@ RowLayout {
font.pointSize: ListFormStyle.value.placeholder.fontSize font.pointSize: ListFormStyle.value.placeholder.fontSize
padding: textEdit.padding padding: textEdit.padding
text: textEdit.text.length === 0 && !textEdit.activeFocus text: textEdit.text.length === 0 && !textEdit.activeFocus
? qsTr('fillPlaceholder') ? listForm.placeholder
: '' : ''
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
} }
......
...@@ -4,6 +4,8 @@ import QtQuick.Layouts 1.3 ...@@ -4,6 +4,8 @@ import QtQuick.Layouts 1.3
import Linphone 1.0 import Linphone 1.0
import 'qrc:/ui/scripts/utils.js' as Utils
ColumnLayout { ColumnLayout {
spacing: 0 spacing: 0
...@@ -49,7 +51,15 @@ ColumnLayout { ...@@ -49,7 +51,15 @@ ColumnLayout {
ActionButton { ActionButton {
icon: 'delete' icon: 'delete'
onClicked: console.log('clicked!!!') onClicked: Utils.openConfirmDialog(this, {
descriptionText: qsTr('removeContactDescription'),
exitHandler: function (status) {
if (status) {
window.setView('Home')
}
},
title: qsTr('removeContactTitle')
})
} }
} }
} }
...@@ -76,6 +86,7 @@ ColumnLayout { ...@@ -76,6 +86,7 @@ ColumnLayout {
ListElement { $value: 'merinos@sip.linphone.org' } ListElement { $value: 'merinos@sip.linphone.org' }
ListElement { $value: 'elisabeth.pro@sip.linphone.org' } ListElement { $value: 'elisabeth.pro@sip.linphone.org' }
} }
placeholder: qsTr('sipAccountsInput')
} }
ListForm { ListForm {
...@@ -83,6 +94,7 @@ ColumnLayout { ...@@ -83,6 +94,7 @@ ColumnLayout {
model: ListModel { model: ListModel {
ListElement { $value: '312 East 10th Street - New York, NY 1009' } ListElement { $value: '312 East 10th Street - New York, NY 1009' }
} }
placeholder: qsTr('addressInput')
} }
ListForm { ListForm {
...@@ -91,6 +103,7 @@ ColumnLayout { ...@@ -91,6 +103,7 @@ ColumnLayout {
ListElement { $value: 'e.meri@gmail.com' } ListElement { $value: 'e.meri@gmail.com' }
ListElement { $value: 'toto@truc.machin' } ListElement { $value: 'toto@truc.machin' }
} }
placeholder: qsTr('emailsInput')
} }
ListForm { ListForm {
...@@ -99,6 +112,7 @@ ColumnLayout { ...@@ -99,6 +112,7 @@ ColumnLayout {
ListElement { $value: 'www.totogro.com' } ListElement { $value: 'www.totogro.com' }
ListElement { $value: 'www.404.unknown' } ListElement { $value: 'www.404.unknown' }
} }
placeholder: qsTr('webSitesInput')
} }
} }
} }
......
...@@ -44,15 +44,22 @@ ApplicationWindow { ...@@ -44,15 +44,22 @@ ApplicationWindow {
// User info. // User info.
ContactDescription { ContactDescription {
id: contactDescription
Layout.fillHeight: parent.height Layout.fillHeight: parent.height
Layout.preferredWidth: 200 Layout.preferredWidth: 200
sipAddress: 'e.miller@sip-linphone.org' sipAddress: 'e.miller@sip-linphone.org'
username: 'Edward Miller' username: 'Edward Miller'
} }
MouseArea {
anchors.fill: contactDescription
onClicked: Utils.openWindow('ManageAccounts', window)
}
// User actions. // User actions.
ActionButton { ActionButton {
Layout.preferredWidth: 16 Layout.preferredWidth: 1
onClicked: Utils.openWindow('ManageAccounts', window) onClicked: Utils.openWindow('ManageAccounts', window)
} }
......
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