auto indentation qt

This commit is contained in:
gaelle 2025-02-25 12:14:19 +01:00
parent 311ad15a68
commit 586dca5cd0
3 changed files with 1551 additions and 1437 deletions

View file

@ -10,18 +10,15 @@ import UtilsCpp
AbstractSettingsLayout { AbstractSettingsLayout {
id: mainItem id: mainItem
width: parent?.width width: parent?.width
contentModel: [ contentModel: [{
{ "title": qsTr("Paramètres"),
title: qsTr("Paramètres"), "subTitle": "",
subTitle: "", "contentComponent": generalParametersComponent
contentComponent: generalParametersComponent }, {
}, "title": qsTr("Paramètres de compte"),
{ "subTitle": "",
title: qsTr("Paramètres de compte"), "contentComponent": advancedParametersComponent
subTitle: "", }]
contentComponent: advancedParametersComponent
}
]
property alias account: mainItem.model property alias account: mainItem.model
@ -32,13 +29,16 @@ AbstractSettingsLayout {
Connections { Connections {
target: account.core target: account.core
function onIsSavedChanged() { function onIsSavedChanged() {
if (account.core.isSaved) UtilsCpp.showInformationPopup(qsTr("Succès"), qsTr("Les changements ont été sauvegardés"), true, mainWindow) if (account.core.isSaved)
UtilsCpp.showInformationPopup(
qsTr("Succès"),
qsTr("Les changements ont été sauvegardés"), true,
mainWindow)
} }
} }
// General parameters // General parameters
///////////////////// /////////////////////
Component { Component {
id: generalParametersComponent id: generalParametersComponent
ColumnLayout { ColumnLayout {
@ -50,7 +50,9 @@ AbstractSettingsLayout {
propertyOwnerGui: account propertyOwnerGui: account
title: qsTr("URI du serveur de messagerie vocale") title: qsTr("URI du serveur de messagerie vocale")
Layout.fillWidth: true Layout.fillWidth: true
isValid: function(text) { return text.length == 0 || !text.endsWith(".") } // work around sdk crash when adress ends with . isValid: function (text) {
return text.length == 0 || !text.endsWith(".")
} // work around sdk crash when adress ends with .
toValidate: true toValidate: true
} }
DecoratedTextField { DecoratedTextField {
@ -65,7 +67,6 @@ AbstractSettingsLayout {
// Advanced parameters // Advanced parameters
///////////////////// /////////////////////
Component { Component {
id: advancedParametersComponent id: advancedParametersComponent
ColumnLayout { ColumnLayout {
@ -123,7 +124,9 @@ AbstractSettingsLayout {
propertyOwnerGui: account propertyOwnerGui: account
title: qsTr("Expiration (en seconde)") title: qsTr("Expiration (en seconde)")
canBeEmpty: false canBeEmpty: false
isValid: function(text) { return !isNaN(Number(text)) } isValid: function (text) {
return !isNaN(Number(text))
}
toValidate: true toValidate: true
} }
DecoratedTextField { DecoratedTextField {

View file

@ -5,8 +5,8 @@ import QtQuick.Controls.Basic as Control
import Linphone import Linphone
import UtilsCpp import UtilsCpp
import SettingsCpp import SettingsCpp
import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle import "qrc:/qt/qml/Linphone/view/Style/buttonStyle.js" as ButtonStyle
import 'qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js' as Utils import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils
AbstractMainPage { AbstractMainPage {
id: mainItem id: mainItem
@ -15,7 +15,7 @@ AbstractMainPage {
newItemIconSource: AppIcons.newCall newItemIconSource: AppIcons.newCall
property var selectedRowHistoryGui property var selectedRowHistoryGui
signal listViewUpdated() signal listViewUpdated
onVisibleChanged: if (!visible) { onVisibleChanged: if (!visible) {
goToCallHistory() goToCallHistory()
@ -29,12 +29,13 @@ AbstractMainPage {
} }
property AccountGui account: accountProxy.defaultAccount property AccountGui account: accountProxy.defaultAccount
property var state: account && account.core?.registrationState || 0 property var state: account && account.core?.registrationState || 0
property bool isRegistered: account ? account.core?.registrationState == LinphoneEnums.RegistrationState.Ok : false property bool isRegistered: account ? account.core?.registrationState
== LinphoneEnums.RegistrationState.Ok : false
property int selectedParticipantsCount property int selectedParticipantsCount
signal startGroupCallRequested() signal startGroupCallRequested
signal createCallFromSearchBarRequested() signal createCallFromSearchBarRequested
signal createContactRequested(string name, string address) signal createContactRequested(string name, string address)
signal openNumPadRequest() signal openNumPadRequest
property alias numericPadPopup: numericPadPopupItem property alias numericPadPopup: numericPadPopupItem
@ -49,21 +50,31 @@ AbstractMainPage {
} }
onSelectedRowHistoryGuiChanged: { onSelectedRowHistoryGuiChanged: {
if (selectedRowHistoryGui) rightPanelStackView.replace(contactDetailComp, Control.StackView.Immediate) if (selectedRowHistoryGui)
else rightPanelStackView.replace(emptySelection, Control.StackView.Immediate) rightPanelStackView.replace(contactDetailComp,
Control.StackView.Immediate)
else
rightPanelStackView.replace(emptySelection,
Control.StackView.Immediate)
} }
rightPanelStackView.initialItem: emptySelection rightPanelStackView.initialItem: emptySelection
rightPanelStackView.width: 360 * DefaultStyle.dp rightPanelStackView.width: 360 * DefaultStyle.dp
onNoItemButtonPressed: goToNewCall() onNoItemButtonPressed: goToNewCall()
showDefaultItem: listStackView.currentItem && listStackView.currentItem.objectName == "historyListItem" && listStackView.currentItem.listView.count === 0 || false showDefaultItem: listStackView.currentItem
&& listStackView.currentItem.objectName == "historyListItem"
&& listStackView.currentItem.listView.count === 0 || false
function goToNewCall() { function goToNewCall() {
if (listStackView.currentItem && listStackView.currentItem.objectName != "newCallItem") listStackView.push(newCallItem) if (listStackView.currentItem
&& listStackView.currentItem.objectName != "newCallItem")
listStackView.push(newCallItem)
} }
function goToCallHistory() { function goToCallHistory() {
if (listStackView.currentItem && listStackView.currentItem.objectName != "historyListItem") listStackView.replace(historyListItem) if (listStackView.currentItem
&& listStackView.currentItem.objectName != "historyListItem")
listStackView.replace(historyListItem)
} }
Dialog { Dialog {
@ -74,7 +85,8 @@ AbstractMainPage {
Dialog { Dialog {
id: deleteForUserPopup id: deleteForUserPopup
width: 278 * DefaultStyle.dp width: 278 * DefaultStyle.dp
text: qsTr("L'historique d'appel de l'utilisateur sera supprimé. Souhaitez-vous continuer ?") text: qsTr(
"L'historique d'appel de l'utilisateur sera supprimé. Souhaitez-vous continuer ?")
} }
leftPanelContent: Item { leftPanelContent: Item {
@ -89,7 +101,7 @@ AbstractMainPage {
clip: true clip: true
initialItem: historyListItem initialItem: historyListItem
focus: true focus: true
onActiveFocusChanged: if(activeFocus){ onActiveFocusChanged: if (activeFocus) {
currentItem.forceActiveFocus() currentItem.forceActiveFocus()
} }
} }
@ -114,7 +126,7 @@ AbstractMainPage {
Component { Component {
id: historyListItem id: historyListItem
FocusScope{ FocusScope {
objectName: "historyListItem" objectName: "historyListItem"
property alias listView: historyListView property alias listView: historyListView
ColumnLayout { ColumnLayout {
@ -156,7 +168,8 @@ AbstractMainPage {
Connections { Connections {
target: deleteHistoryPopup target: deleteHistoryPopup
onAccepted: { onAccepted: {
if (listStackView.currentItem.listView) listStackView.currentItem.listView.model.removeAllEntries() if (listStackView.currentItem.listView)
listStackView.currentItem.listView.model.removeAllEntries()
} }
} }
} }
@ -202,13 +215,14 @@ AbstractMainPage {
anchors.fill: parent anchors.fill: parent
anchors.rightMargin: 39 * DefaultStyle.dp anchors.rightMargin: 39 * DefaultStyle.dp
padding: 0 padding: 0
background: Item{} background: Item {}
contentItem: ColumnLayout { contentItem: ColumnLayout {
Text { Text {
visible: historyListView.count === 0 visible: historyListView.count === 0
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.topMargin: 137 * DefaultStyle.dp Layout.topMargin: 137 * DefaultStyle.dp
text: qsTr("Aucun appel%1").arg(searchBar.text.length != 0 ? " correspondant" : "") text: qsTr("Aucun appel%1").arg(
searchBar.text.length != 0 ? " correspondant" : "")
font { font {
pixelSize: 16 * DefaultStyle.dp pixelSize: 16 * DefaultStyle.dp
weight: 800 * DefaultStyle.dp weight: 800 * DefaultStyle.dp
@ -224,7 +238,9 @@ AbstractMainPage {
BusyIndicator { BusyIndicator {
anchors.horizontalCenter: historyListView.horizontalCenter anchors.horizontalCenter: historyListView.horizontalCenter
visible: historyListView.loading && historyListView.count === 0 && searchBar.text.length === 0 visible: historyListView.loading
&& historyListView.count === 0
&& searchBar.text.length === 0
height: visible ? historyListView.busyIndicatorSize : 0 height: visible ? historyListView.busyIndicatorSize : 0
width: historyListView.busyIndicatorSize width: historyListView.busyIndicatorSize
indicatorHeight: historyListView.busyIndicatorSize indicatorHeight: historyListView.busyIndicatorSize
@ -232,17 +248,19 @@ AbstractMainPage {
indicatorColor: DefaultStyle.main1_500_main indicatorColor: DefaultStyle.main1_500_main
} }
Connections{ Connections {
target: mainItem target: mainItem
function onListViewUpdated(){ function onListViewUpdated() {
historyListView.model.reload() historyListView.model.reload()
} }
} }
onCurrentIndexChanged: { onCurrentIndexChanged: {
mainItem.selectedRowHistoryGui = model.getAt(currentIndex) mainItem.selectedRowHistoryGui = model.getAt(
currentIndex)
} }
onCountChanged: { onCountChanged: {
mainItem.selectedRowHistoryGui = model.getAt(currentIndex) mainItem.selectedRowHistoryGui = model.getAt(
currentIndex)
} }
} }
} }
@ -264,11 +282,11 @@ AbstractMainPage {
Component { Component {
id: newCallItem id: newCallItem
FocusScope{ FocusScope {
objectName: "newCallItem" objectName: "newCallItem"
width: parent?.width width: parent?.width
height: parent?.height height: parent?.height
Control.StackView.onActivated:{ Control.StackView.onActivated: {
callContactsList.forceActiveFocus() callContactsList.forceActiveFocus()
} }
ColumnLayout { ColumnLayout {
@ -284,7 +302,8 @@ AbstractMainPage {
focus: true focus: true
KeyNavigation.down: listStackView KeyNavigation.down: listStackView
onClicked: { onClicked: {
console.debug("[CallPage]User: return to call history") console.debug(
"[CallPage]User: return to call history")
listStackView.pop() listStackView.pop()
listStackView.forceActiveFocus() listStackView.forceActiveFocus()
} }
@ -308,8 +327,9 @@ AbstractMainPage {
numPadPopup: numericPadPopupItem numPadPopup: numericPadPopupItem
groupCallVisible: true groupCallVisible: true
searchBarColor: DefaultStyle.grey_100 searchBarColor: DefaultStyle.grey_100
onContactClicked: (contact) => { onContactClicked: contact => {
mainWindow.startCallWithContact(contact, false, callContactsList) mainWindow.startCallWithContact(
contact, false, callContactsList)
} }
onGroupCallCreationRequested: { onGroupCallCreationRequested: {
console.log("groupe call requetsed") console.log("groupe call requetsed")
@ -317,7 +337,9 @@ AbstractMainPage {
} }
Connections { Connections {
target: mainItem target: mainItem
function onCreateCallFromSearchBarRequested(){ UtilsCpp.createCall(callContactsList.searchBar.text)} function onCreateCallFromSearchBarRequested() {
UtilsCpp.createCall(callContactsList.searchBar.text)
}
} }
} }
} }
@ -326,7 +348,7 @@ AbstractMainPage {
Component { Component {
id: groupCallItem id: groupCallItem
FocusScope{ FocusScope {
objectName: "groupCallItem" objectName: "groupCallItem"
Control.StackView.onActivated: { Control.StackView.onActivated: {
addParticipantsLayout.forceActiveFocus() addParticipantsLayout.forceActiveFocus()
@ -364,7 +386,9 @@ AbstractMainPage {
Layout.fillWidth: true Layout.fillWidth: true
} }
Text { Text {
text: qsTr("%1 participant%2 sélectionné").arg(mainItem.selectedParticipantsCount).arg(mainItem.selectedParticipantsCount > 1 ? "s" : "") text: qsTr("%1 participant%2 sélectionné").arg(
mainItem.selectedParticipantsCount).arg(
mainItem.selectedParticipantsCount > 1 ? "s" : "")
color: DefaultStyle.main2_500main color: DefaultStyle.main2_500main
maximumLineCount: 1 maximumLineCount: 1
font { font {
@ -397,7 +421,9 @@ AbstractMainPage {
font.weight: 700 * DefaultStyle.dp font.weight: 700 * DefaultStyle.dp
text: qsTr("Nom du groupe") text: qsTr("Nom du groupe")
} }
Item{Layout.fillWidth: true} Item {
Layout.fillWidth: true
}
Text { Text {
font.pixelSize: 12 * DefaultStyle.dp font.pixelSize: 12 * DefaultStyle.dp
font.weight: 300 * DefaultStyle.dp font.weight: 300 * DefaultStyle.dp
@ -410,29 +436,38 @@ AbstractMainPage {
Layout.rightMargin: 38 * DefaultStyle.dp Layout.rightMargin: 38 * DefaultStyle.dp
Layout.preferredHeight: 49 * DefaultStyle.dp Layout.preferredHeight: 49 * DefaultStyle.dp
focus: true focus: true
KeyNavigation.down: addParticipantsLayout//participantList.count > 0 ? participantList : searchbar KeyNavigation.down: addParticipantsLayout //participantList.count > 0 ? participantList : searchbar
} }
AddParticipantsForm { AddParticipantsForm {
id: addParticipantsLayout id: addParticipantsLayout
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
Layout.topMargin: 15 * DefaultStyle.dp Layout.topMargin: 15 * DefaultStyle.dp
onSelectedParticipantsCountChanged: mainItem.selectedParticipantsCount = selectedParticipantsCount onSelectedParticipantsCountChanged: mainItem.selectedParticipantsCount
= selectedParticipantsCount
focus: true focus: true
Connections { Connections {
target: mainItem target: mainItem
function onStartGroupCallRequested() { function onStartGroupCallRequested() {
if (groupCallName.text.length === 0) { if (groupCallName.text.length === 0) {
UtilsCpp.showInformationPopup(qsTr("Erreur"), qsTr("Un nom doit être donné à l'appel de groupe"), false) UtilsCpp.showInformationPopup(
} else if(!mainItem.isRegistered) { qsTr("Erreur"), qsTr(
UtilsCpp.showInformationPopup(qsTr("Erreur"), qsTr("Vous n'etes pas connecté"), false) "Un nom doit être donné à l'appel de groupe"),
false)
} else if (!mainItem.isRegistered) {
UtilsCpp.showInformationPopup(
qsTr("Erreur"),
qsTr("Vous n'etes pas connecté"),
false)
} else { } else {
mainItem.confInfoGui = Qt.createQmlObject('import Linphone mainItem.confInfoGui = Qt.createQmlObject(
ConferenceInfoGui{ 'import Linphone
}', mainItem) ConferenceInfoGui{
}', mainItem)
mainItem.confInfoGui.core.subject = groupCallName.text mainItem.confInfoGui.core.subject = groupCallName.text
mainItem.confInfoGui.core.isScheduled = false mainItem.confInfoGui.core.isScheduled = false
mainItem.confInfoGui.core.addParticipants(addParticipantsLayout.selectedParticipants) mainItem.confInfoGui.core.addParticipants(
addParticipantsLayout.selectedParticipants)
mainItem.confInfoGui.core.save() mainItem.confInfoGui.core.save()
} }
} }
@ -442,13 +477,15 @@ AbstractMainPage {
} }
} }
Component{ Component {
id: emptySelection id: emptySelection
Item{objectName: "emptySelection"} Item {
objectName: "emptySelection"
}
} }
Component { Component {
id: contactDetailComp id: contactDetailComp
FocusScope{ FocusScope {
width: parent?.width width: parent?.width
height: parent?.height height: parent?.height
CallHistoryLayout { CallHistoryLayout {
@ -459,10 +496,12 @@ AbstractMainPage {
visible: mainItem.selectedRowHistoryGui != undefined visible: mainItem.selectedRowHistoryGui != undefined
callHistoryGui: selectedRowHistoryGui callHistoryGui: selectedRowHistoryGui
property var contactObj: UtilsCpp.findFriendByAddress(specificAddress) property var contactObj: UtilsCpp.findFriendByAddress(
specificAddress)
contact: contactObj && contactObj.value || null contact: contactObj && contactObj.value || null
specificAddress: callHistoryGui && callHistoryGui.core.remoteAddress || "" specificAddress: callHistoryGui
&& callHistoryGui.core.remoteAddress || ""
buttonContent: PopupButton { buttonContent: PopupButton {
id: detailOptions id: detailOptions
@ -472,10 +511,11 @@ AbstractMainPage {
popup.contentItem: FocusScope { popup.contentItem: FocusScope {
implicitHeight: detailsButtons.implicitHeight implicitHeight: detailsButtons.implicitHeight
implicitWidth: detailsButtons.implicitWidth implicitWidth: detailsButtons.implicitWidth
Keys.onPressed: (event)=> { Keys.onPressed: event => {
if (event.key == Qt.Key_Left || event.key == Qt.Key_Escape) { if (event.key == Qt.Key_Left
|| event.key == Qt.Key_Escape) {
detailOptions.popup.close() detailOptions.popup.close()
event.accepted = true; event.accepted = true
} }
} }
ColumnLayout { ColumnLayout {
@ -483,17 +523,25 @@ AbstractMainPage {
anchors.fill: parent anchors.fill: parent
IconLabelButton { IconLabelButton {
Layout.fillWidth: true Layout.fillWidth: true
property bool isLdap: contactDetail.contact?.core?.isLdap || false property bool isLdap: contactDetail.contact?.core?.isLdap
property bool isCardDAV: contactDetail.contact?.core?.isCardDAV || false || false
text: contactDetail.contact ? qsTr("Voir le contact") : qsTr("Ajouter aux contacts") property bool isCardDAV: contactDetail.contact?.core?.isCardDAV
|| false
text: contactDetail.contact ? qsTr("Voir le contact") : qsTr(
"Ajouter aux contacts")
icon.source: AppIcons.plusCircle icon.source: AppIcons.plusCircle
icon.width: 32 * DefaultStyle.dp icon.width: 32 * DefaultStyle.dp
icon.height: 32 * DefaultStyle.dp icon.height: 32 * DefaultStyle.dp
visible: !isLdap && !isCardDAV visible: !isLdap && !isCardDAV
onClicked: { onClicked: {
detailOptions.close() detailOptions.close()
if (contactDetail.contact) mainWindow.displayContactPage(contactDetail.contactAddress) if (contactDetail.contact)
else mainItem.createContactRequested(contactDetail.contactName, contactDetail.contactAddress) mainWindow.displayContactPage(
contactDetail.contactAddress)
else
mainItem.createContactRequested(
contactDetail.contactName,
contactDetail.contactAddress)
} }
} }
IconLabelButton { IconLabelButton {
@ -504,9 +552,19 @@ AbstractMainPage {
icon.height: 32 * DefaultStyle.dp icon.height: 32 * DefaultStyle.dp
onClicked: { onClicked: {
detailOptions.close() detailOptions.close()
var success = UtilsCpp.copyToClipboard(mainItem.selectedRowHistoryGui && mainItem.selectedRowHistoryGui.core.remoteAddress) var success = UtilsCpp.copyToClipboard(
if (success) UtilsCpp.showInformationPopup(qsTr("Copié"), qsTr("L'adresse a été copiée dans le presse-papier"), true) mainItem.selectedRowHistoryGui
else UtilsCpp.showInformationPopup(qsTr("Erreur"), qsTr("Erreur lors de la copie de l'adresse"), false) && mainItem.selectedRowHistoryGui.core.remoteAddress)
if (success)
UtilsCpp.showInformationPopup(
qsTr("Copié"), qsTr(
"L'adresse a été copiée dans le presse-papier"),
true)
else
UtilsCpp.showInformationPopup(
qsTr("Erreur"), qsTr(
"Erreur lors de la copie de l'adresse"),
false)
} }
} }
// IconLabelButton { // IconLabelButton {
@ -534,7 +592,8 @@ AbstractMainPage {
Connections { Connections {
target: deleteForUserPopup target: deleteForUserPopup
function onAccepted() { function onAccepted() {
detailListView.model.removeEntriesWithFilter(detailListView.searchText) detailListView.model.removeEntriesWithFilter(
detailListView.searchText)
mainItem.listViewUpdated() mainItem.listViewUpdated()
} }
} }
@ -550,8 +609,8 @@ AbstractMainPage {
id: detailControl id: detailControl
Layout.preferredWidth: 360 * DefaultStyle.dp Layout.preferredWidth: 360 * DefaultStyle.dp
Layout.fillHeight: true Layout.fillHeight: true
// height: Math.min(430 * DefaultStyle.dp, detailListView.contentHeight) + topPadding + bottomPadding
// height: Math.min(430 * DefaultStyle.dp, detailListView.contentHeight) + topPadding + bottomPadding
background: Rectangle { background: Rectangle {
id: detailListBackground id: detailListBackground
anchors.fill: parent anchors.fill: parent
@ -570,7 +629,8 @@ AbstractMainPage {
BusyIndicator { BusyIndicator {
anchors.horizontalCenter: detailListView.horizontalCenter anchors.horizontalCenter: detailListView.horizontalCenter
visible: detailListView.loading && detailListView.count === 0 visible: detailListView.loading
&& detailListView.count === 0
height: visible ? detailListView.busyIndicatorSize : 0 height: visible ? detailListView.busyIndicatorSize : 0
width: detailListView.busyIndicatorSize width: detailListView.busyIndicatorSize
indicatorHeight: detailListView.busyIndicatorSize indicatorHeight: detailListView.busyIndicatorSize
@ -579,7 +639,7 @@ AbstractMainPage {
} }
delegate: Item { delegate: Item {
width:detailListView.width width: detailListView.width
height: 56 * DefaultStyle.dp height: 56 * DefaultStyle.dp
RowLayout { RowLayout {
anchors.fill: parent anchors.fill: parent
@ -591,42 +651,28 @@ AbstractMainPage {
RowLayout { RowLayout {
EffectImage { EffectImage {
id: statusIcon id: statusIcon
imageSource: modelData.core.status === LinphoneEnums.CallStatus.Declined imageSource: modelData.core.status
=== LinphoneEnums.CallStatus.Declined
|| modelData.core.status === LinphoneEnums.CallStatus.DeclinedElsewhere || modelData.core.status === LinphoneEnums.CallStatus.DeclinedElsewhere
|| modelData.core.status === LinphoneEnums.CallStatus.Aborted || modelData.core.status
|| modelData.core.status === LinphoneEnums.CallStatus.EarlyAborted === LinphoneEnums.CallStatus.Aborted
? AppIcons.arrowElbow || modelData.core.status === LinphoneEnums.CallStatus.EarlyAborted ? AppIcons.arrowElbow : modelData.core.isOutgoing ? AppIcons.arrowUpRight : AppIcons.arrowDownLeft
: modelData.core.isOutgoing colorizationColor: modelData.core.status === LinphoneEnums.CallStatus.Declined || modelData.core.status === LinphoneEnums.CallStatus.DeclinedElsewhere || modelData.core.status === LinphoneEnums.CallStatus.Aborted || modelData.core.status === LinphoneEnums.CallStatus.EarlyAborted || modelData.core.status === LinphoneEnums.CallStatus.Missed ? DefaultStyle.danger_500main : modelData.core.isOutgoing ? DefaultStyle.info_500_main : DefaultStyle.success_500main
? AppIcons.arrowUpRight
: AppIcons.arrowDownLeft
colorizationColor: modelData.core.status === LinphoneEnums.CallStatus.Declined
|| modelData.core.status === LinphoneEnums.CallStatus.DeclinedElsewhere
|| modelData.core.status === LinphoneEnums.CallStatus.Aborted
|| modelData.core.status === LinphoneEnums.CallStatus.EarlyAborted
|| modelData.core.status === LinphoneEnums.CallStatus.Missed
? DefaultStyle.danger_500main
: modelData.core.isOutgoing
? DefaultStyle.info_500_main
: DefaultStyle.success_500main
Layout.preferredWidth: 16 * DefaultStyle.dp Layout.preferredWidth: 16 * DefaultStyle.dp
Layout.preferredHeight: 16 * DefaultStyle.dp Layout.preferredHeight: 16 * DefaultStyle.dp
transform: Rotation { transform: Rotation {
angle: modelData.core.isOutgoing && (modelData.core.status === LinphoneEnums.CallStatus.Declined angle: modelData.core.isOutgoing
|| modelData.core.status === LinphoneEnums.CallStatus.DeclinedElsewhere && (modelData.core.status
|| modelData.core.status === LinphoneEnums.CallStatus.Aborted === LinphoneEnums.CallStatus.Declined
|| modelData.core.status === LinphoneEnums.CallStatus.EarlyAborted) ? 180 : 0 || modelData.core.status === LinphoneEnums.CallStatus.DeclinedElsewhere || modelData.core.status === LinphoneEnums.CallStatus.Aborted || modelData.core.status === LinphoneEnums.CallStatus.EarlyAborted) ? 180 : 0
origin { origin {
x: statusIcon.width/2 x: statusIcon.width / 2
y: statusIcon.height/2 y: statusIcon.height / 2
} }
} }
} }
Text { Text {
text: modelData.core.status === LinphoneEnums.CallStatus.Missed text: modelData.core.status === LinphoneEnums.CallStatus.Missed ? qsTr("Appel manqué") : modelData.core.isOutgoing ? qsTr("Appel sortant") : qsTr("Appel entrant")
? qsTr("Appel manqué")
: modelData.core.isOutgoing
? qsTr("Appel sortant")
: qsTr("Appel entrant")
font { font {
pixelSize: 14 * DefaultStyle.dp pixelSize: 14 * DefaultStyle.dp
weight: 400 * DefaultStyle.dp weight: 400 * DefaultStyle.dp
@ -634,8 +680,9 @@ AbstractMainPage {
} }
} }
Text { Text {
text: UtilsCpp.formatDate(modelData.core.date) text: UtilsCpp.formatDate(
color: modelData.core.status === LinphoneEnums.CallStatus.Missed? DefaultStyle.danger_500main : DefaultStyle.main2_500main modelData.core.date)
color: modelData.core.status === LinphoneEnums.CallStatus.Missed ? DefaultStyle.danger_500main : DefaultStyle.main2_500main
font { font {
pixelSize: 12 * DefaultStyle.dp pixelSize: 12 * DefaultStyle.dp
weight: 300 * DefaultStyle.dp weight: 300 * DefaultStyle.dp
@ -647,7 +694,8 @@ AbstractMainPage {
Layout.fillWidth: true Layout.fillWidth: true
} }
Text { Text {
text: UtilsCpp.formatElapsedTime(modelData.core.duration, false) text: UtilsCpp.formatElapsedTime(
modelData.core.duration, false)
font { font {
pixelSize: 12 * DefaultStyle.dp pixelSize: 12 * DefaultStyle.dp
weight: 300 * DefaultStyle.dp weight: 300 * DefaultStyle.dp
@ -657,7 +705,7 @@ AbstractMainPage {
} }
} }
} }
Item{ Item {
Layout.fillHeight: true Layout.fillHeight: true
} }
} }

View file

@ -6,7 +6,7 @@ import Linphone
import UtilsCpp import UtilsCpp
import EnumsToStringCpp import EnumsToStringCpp
import SettingsCpp import SettingsCpp
import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle import "qrc:/qt/qml/Linphone/view/Style/buttonStyle.js" as ButtonStyle
AbstractMainPage { AbstractMainPage {
id: mainItem id: mainItem
@ -15,28 +15,36 @@ AbstractMainPage {
newItemIconSource: AppIcons.plusCircle newItemIconSource: AppIcons.plusCircle
// disable left panel contact list interaction while a contact is being edited // disable left panel contact list interaction while a contact is being edited
property bool leftPanelEnabled: !rightPanelStackView.currentItem || rightPanelStackView.currentItem.objectName != "contactEdition" property bool leftPanelEnabled: !rightPanelStackView.currentItem
|| rightPanelStackView.currentItem.objectName
!= "contactEdition"
property FriendGui selectedContact property FriendGui selectedContact
property string initialFriendToDisplay property string initialFriendToDisplay
onInitialFriendToDisplayChanged: { onInitialFriendToDisplayChanged: {
if (initialFriendToDisplay != '' && contactList.selectContact(initialFriendToDisplay) != -1) initialFriendToDisplay = "" if (initialFriendToDisplay != '' && contactList.selectContact(
else if(initialFriendToDisplay != '') console.warn("Abstract not selected yet: ", initialFriendToDisplay) initialFriendToDisplay) != -1)
initialFriendToDisplay = ""
else if (initialFriendToDisplay != '')
console.warn("Abstract not selected yet: ", initialFriendToDisplay)
} }
onVisibleChanged: if (!visible) { onVisibleChanged: if (!visible) {
rightPanelStackView.clear() rightPanelStackView.clear()
contactList.resetSelections() contactList.resetSelections()
} }
function goToContactDetails(){ function goToContactDetails() {
if (selectedContact) { if (selectedContact) {
var firstItem = rightPanelStackView.get(0) var firstItem = rightPanelStackView.get(0)
if( firstItem && firstItem.objectName == "contactDetail")// Go directly to detail if (firstItem && firstItem.objectName == "contactDetail")
// Go directly to detail
rightPanelStackView.popToIndex(0) rightPanelStackView.popToIndex(0)
else{ else {
if(rightPanelStackView.depth >= 1) {// Replace in background and go back to it if (rightPanelStackView.depth >= 1) {
// Replace in background and go back to it
rightPanelStackView.replace(firstItem, contactDetail) rightPanelStackView.replace(firstItem, contactDetail)
rightPanelStackView.popToIndex(0) rightPanelStackView.popToIndex(0)
}else{// empty } else {
// empty
rightPanelStackView.push(contactDetail) rightPanelStackView.push(contactDetail)
} }
} }
@ -52,37 +60,49 @@ AbstractMainPage {
function createContact(name, address) { function createContact(name, address) {
var friendGui = Qt.createQmlObject('import Linphone var friendGui = Qt.createQmlObject('import Linphone
FriendGui{ FriendGui{
}', mainItem) }', mainItem)
friendGui.core.givenName = UtilsCpp.getGivenNameFromFullName(name) friendGui.core.givenName = UtilsCpp.getGivenNameFromFullName(name)
friendGui.core.familyName = UtilsCpp.getFamilyNameFromFullName(name) friendGui.core.familyName = UtilsCpp.getFamilyNameFromFullName(name)
friendGui.core.appendAddress(address) friendGui.core.appendAddress(address)
if (!rightPanelStackView.currentItem || rightPanelStackView.currentItem.objectName != "contactEdition") if (!rightPanelStackView.currentItem
rightPanelStackView.push(contactEdition, {"contact": friendGui, "title": qsTr("Nouveau contact"), "saveButtonText": qsTr("Créer")}) || rightPanelStackView.currentItem.objectName != "contactEdition")
rightPanelStackView.push(contactEdition, {
"contact": friendGui,
"title": qsTr("Nouveau contact"),
"saveButtonText": qsTr("Créer")
})
} }
function editContact(friendGui) { function editContact(friendGui) {
rightPanelStackView.push(contactEdition, {"contact": friendGui, "title": qsTr("Modifier contact"), "saveButtonText": qsTr("Enregistrer")}) rightPanelStackView.push(contactEdition, {
"contact": friendGui,
"title": qsTr("Modifier contact"),
"saveButtonText": qsTr("Enregistrer")
})
} }
// rightPanelStackView.initialItem: contactDetail // rightPanelStackView.initialItem: contactDetail
showDefaultItem: rightPanelStackView.depth == 0 && !contactList.haveContacts
showDefaultItem: rightPanelStackView.depth == 0 && !contactList.haveContacts && searchBar.text.length === 0 && searchBar.text.length === 0
function deleteContact(contact) { function deleteContact(contact) {
if (!contact) return if (!contact)
return
var mainWin = UtilsCpp.getMainWindow() var mainWin = UtilsCpp.getMainWindow()
mainWin.showConfirmationLambdaPopup("", mainWin.showConfirmationLambdaPopup(
qsTr("%1 sera supprimé des contacts. Voulez-vous continuer ?").arg(contact.core.fullName), "", qsTr(
"", "%1 sera supprimé des contacts. Voulez-vous continuer ?").arg(
function (confirmed) { contact.core.fullName), "", function (confirmed) {
if (confirmed) { if (confirmed) {
var name = contact.core.fullName var name = contact.core.fullName
contact.core.remove() contact.core.remove()
contactList.resetSelections() contactList.resetSelections()
UtilsCpp.showInformationPopup(qsTr("Supprimé"), qsTr("%1 a été supprimé").arg(name)) } UtilsCpp.showInformationPopup(
qsTr("Supprimé"),
qsTr("%1 a été supprimé").arg(name))
} }
) })
} }
Dialog { Dialog {
@ -96,11 +116,12 @@ AbstractMainPage {
modal: true modal: true
onAboutToHide: neverDisplayAgainCheckbox.checked = false onAboutToHide: neverDisplayAgainCheckbox.checked = false
title: qsTr("Augmenter la confiance") title: qsTr("Augmenter la confiance")
text: qsTr("Pour augmenter le niveau de confiance vous devez appeler les différents appareils de votre contact et valider un code.<br><br>Vous êtes sur le point dappeler “%1” voulez vous continuer ?").arg(verifyDevicePopup.deviceName) text: qsTr("Pour augmenter le niveau de confiance vous devez appeler les différents appareils de votre contact et valider un code.<br><br>Vous êtes sur le point dappeler “%1” voulez vous continuer ?").arg(
verifyDevicePopup.deviceName)
buttons: RowLayout { buttons: RowLayout {
RowLayout { RowLayout {
spacing: 7 * DefaultStyle.dp spacing: 7 * DefaultStyle.dp
CheckBox{ CheckBox {
id: neverDisplayAgainCheckbox id: neverDisplayAgainCheckbox
} }
Text { Text {
@ -112,7 +133,9 @@ AbstractMainPage {
} }
} }
} }
Item{Layout.fillWidth: true} Item {
Layout.fillWidth: true
}
RowLayout { RowLayout {
spacing: 15 * DefaultStyle.dp spacing: 15 * DefaultStyle.dp
BigButton { BigButton {
@ -124,8 +147,11 @@ AbstractMainPage {
style: ButtonStyle.main style: ButtonStyle.main
text: qsTr("Appeler") text: qsTr("Appeler")
onClicked: { onClicked: {
SettingsCpp.setDisplayDeviceCheckConfirmation(!neverDisplayAgainCheckbox.checked) SettingsCpp.setDisplayDeviceCheckConfirmation(
UtilsCpp.createCall(verifyDevicePopup.deviceAddress, {}, LinphoneEnums.MediaEncryption.Zrtp) !neverDisplayAgainCheckbox.checked)
UtilsCpp.createCall(verifyDevicePopup.deviceAddress,
{},
LinphoneEnums.MediaEncryption.Zrtp)
onClicked: verifyDevicePopup.close() onClicked: verifyDevicePopup.close()
} }
} }
@ -193,7 +219,8 @@ AbstractMainPage {
} }
Button { Button {
id: createContactButton id: createContactButton
visible: !rightPanelStackView.currentItem || rightPanelStackView.currentItem.objectName !== "contactEdition" visible: !rightPanelStackView.currentItem
|| rightPanelStackView.currentItem.objectName !== "contactEdition"
style: ButtonStyle.noBackground style: ButtonStyle.noBackground
icon.source: AppIcons.plusCircle icon.source: AppIcons.plusCircle
Layout.preferredWidth: 28 * DefaultStyle.dp Layout.preferredWidth: 28 * DefaultStyle.dp
@ -232,13 +259,14 @@ AbstractMainPage {
visible: !contactList.loading && !contactList.haveContacts visible: !contactList.loading && !contactList.haveContacts
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.topMargin: 137 * DefaultStyle.dp Layout.topMargin: 137 * DefaultStyle.dp
text: qsTr("Aucun contact%1").arg(searchBar.text.length !== 0 ? " correspondant" : "") text: qsTr("Aucun contact%1").arg(
searchBar.text.length !== 0 ? " correspondant" : "")
font { font {
pixelSize: 16 * DefaultStyle.dp pixelSize: 16 * DefaultStyle.dp
weight: 800 * DefaultStyle.dp weight: 800 * DefaultStyle.dp
} }
} }
AllContactListView{ AllContactListView {
id: contactList id: contactList
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
@ -246,15 +274,20 @@ AbstractMainPage {
searchBarText: searchBar.text searchBarText: searchBar.text
hideSuggestions: true hideSuggestions: true
showDefaultAddress: false showDefaultAddress: false
sourceFlags: LinphoneEnums.MagicSearchSource.Friends | LinphoneEnums.MagicSearchSource.FavoriteFriends | LinphoneEnums.MagicSearchSource.LdapServers | LinphoneEnums.MagicSearchSource.RemoteCardDAV sourceFlags: LinphoneEnums.MagicSearchSource.Friends
| LinphoneEnums.MagicSearchSource.FavoriteFriends
| LinphoneEnums.MagicSearchSource.LdapServers
| LinphoneEnums.MagicSearchSource.RemoteCardDAV
onHighlightedContactChanged: mainItem.selectedContact = highlightedContact onHighlightedContactChanged: mainItem.selectedContact = highlightedContact
onContactDeletionRequested: (contact) => { onContactDeletionRequested: contact => {
mainItem.deleteContact(contact) mainItem.deleteContact(
contact)
} }
onLoadingChanged: { onLoadingChanged: {
if(!loading && initialFriendToDisplay.length !== 0) { if (!loading && initialFriendToDisplay.length !== 0) {
Qt.callLater(function(){ Qt.callLater(function () {
if (selectContact(initialFriendToDisplay) != -1) initialFriendToDisplay = "" if (selectContact(initialFriendToDisplay) != -1)
initialFriendToDisplay = ""
}) })
} }
} }
@ -275,7 +308,7 @@ AbstractMainPage {
property string label property string label
property var icon property var icon
property alias content: contentControl.contentItem property alias content: contentControl.contentItem
signal titleIconClicked() signal titleIconClicked
RowLayout { RowLayout {
spacing: 10 * DefaultStyle.dp spacing: 10 * DefaultStyle.dp
Text { Text {
@ -292,7 +325,9 @@ AbstractMainPage {
style: ButtonStyle.noBackgroundOrange style: ButtonStyle.noBackgroundOrange
onClicked: contactDetailLayout.titleIconClicked() onClicked: contactDetailLayout.titleIconClicked()
} }
Item{Layout.fillWidth: true} Item {
Layout.fillWidth: true
}
RoundButton { RoundButton {
id: expandButton id: expandButton
style: ButtonStyle.noBackground style: ButtonStyle.noBackground
@ -323,11 +358,10 @@ AbstractMainPage {
button.onClicked: mainItem.editContact(mainItem.selectedContact) button.onClicked: mainItem.editContact(mainItem.selectedContact)
button.visible: !mainItem.selectedContact?.core.readOnly button.visible: !mainItem.selectedContact?.core.readOnly
property string contactAddress: contact ? contact.core.defaultAddress : "" property string contactAddress: contact ? contact.core.defaultAddress : ""
property var computedContactNameObj: UtilsCpp.getDisplayName(contactAddress) property var computedContactNameObj: UtilsCpp.getDisplayName(
contactAddress)
property string computedContactName: computedContactNameObj ? computedContactNameObj.value : "" property string computedContactName: computedContactNameObj ? computedContactNameObj.value : ""
property string contactName: contact property string contactName: contact ? contact.core.fullName : computedContactName
? contact.core.fullName
: computedContactName
component LabelButton: ColumnLayout { component LabelButton: ColumnLayout {
id: labelButton id: labelButton
// property alias image: buttonImg // property alias image: buttonImg
@ -359,7 +393,9 @@ AbstractMainPage {
height: 56 * DefaultStyle.dp height: 56 * DefaultStyle.dp
button.icon.width: 24 * DefaultStyle.dp button.icon.width: 24 * DefaultStyle.dp
button.icon.height: 24 * DefaultStyle.dp button.icon.height: 24 * DefaultStyle.dp
button.onClicked: mainWindow.startCallWithContact(contactDetail.contact, false, mainItem) button.onClicked: mainWindow.startCallWithContact(
contactDetail.contact,
false, mainItem)
} }
LabelButton { LabelButton {
button.icon.source: AppIcons.chatTeardropText button.icon.source: AppIcons.chatTeardropText
@ -369,7 +405,8 @@ AbstractMainPage {
height: 56 * DefaultStyle.dp height: 56 * DefaultStyle.dp
button.icon.width: 24 * DefaultStyle.dp button.icon.width: 24 * DefaultStyle.dp
button.icon.height: 24 * DefaultStyle.dp button.icon.height: 24 * DefaultStyle.dp
button.onClicked: console.debug("[ContactLayout.qml] TODO : open conversation") button.onClicked: console.debug(
"[ContactLayout.qml] TODO : open conversation")
} }
LabelButton { LabelButton {
button.icon.source: AppIcons.videoCamera button.icon.source: AppIcons.videoCamera
@ -378,7 +415,9 @@ AbstractMainPage {
height: 56 * DefaultStyle.dp height: 56 * DefaultStyle.dp
button.icon.width: 24 * DefaultStyle.dp button.icon.width: 24 * DefaultStyle.dp
button.icon.height: 24 * DefaultStyle.dp button.icon.height: 24 * DefaultStyle.dp
button.onClicked: mainWindow.startCallWithContact(contactDetail.contact, true, mainItem) button.onClicked: mainWindow.startCallWithContact(
contactDetail.contact,
true, mainItem)
} }
} }
bannerContent: [ bannerContent: [
@ -396,23 +435,11 @@ AbstractMainPage {
} }
Text { Text {
visible: contactDetail.contact visible: contactDetail.contact
property var mode : contactDetail.contact ? contactDetail.contact.core.consolidatedPresence : -1 property var mode: contactDetail.contact ? contactDetail.contact.core.consolidatedPresence : -1
horizontalAlignment: Text.AlignLeft horizontalAlignment: Text.AlignLeft
Layout.fillWidth: true Layout.fillWidth: true
text: mode === LinphoneEnums.ConsolidatedPresence.Online text: mode === LinphoneEnums.ConsolidatedPresence.Online ? qsTr("En ligne") : mode === LinphoneEnums.ConsolidatedPresence.Busy ? qsTr("Occupé") : mode === LinphoneEnums.ConsolidatedPresence.DoNotDisturb ? qsTr("Ne pas déranger") : qsTr("Hors ligne")
? qsTr("En ligne") color: mode === LinphoneEnums.ConsolidatedPresence.Online ? DefaultStyle.success_500main : mode === LinphoneEnums.ConsolidatedPresence.Busy ? DefaultStyle.warning_600 : mode === LinphoneEnums.ConsolidatedPresence.DoNotDisturb ? DefaultStyle.danger_500main : DefaultStyle.main2_500main
: mode === LinphoneEnums.ConsolidatedPresence.Busy
? qsTr("Occupé")
: mode === LinphoneEnums.ConsolidatedPresence.DoNotDisturb
? qsTr("Ne pas déranger")
: qsTr("Hors ligne")
color: mode === LinphoneEnums.ConsolidatedPresence.Online
? DefaultStyle.success_500main
: mode === LinphoneEnums.ConsolidatedPresence.Busy
? DefaultStyle.warning_600
: mode === LinphoneEnums.ConsolidatedPresence.DoNotDisturb
? DefaultStyle.danger_500main
: DefaultStyle.main2_500main
font.pixelSize: 14 * DefaultStyle.dp font.pixelSize: 14 * DefaultStyle.dp
} }
}, },
@ -420,7 +447,7 @@ AbstractMainPage {
visible: !contactDetail.useVerticalLayout visible: !contactDetail.useVerticalLayout
} }
] ]
secondLineContent: ActionsButtons{} secondLineContent: ActionsButtons {}
content: Flickable { content: Flickable {
contentWidth: parent.width contentWidth: parent.width
ColumnLayout { ColumnLayout {
@ -442,7 +469,7 @@ AbstractMainPage {
clip: true clip: true
spacing: 9 * DefaultStyle.dp spacing: 9 * DefaultStyle.dp
model: VariantList { model: VariantList {
model: (mainItem.selectedContact ? UtilsCpp.append(mainItem.selectedContact.core.addresses, mainItem.selectedContact.core.phoneNumbers): []) model: (mainItem.selectedContact ? UtilsCpp.append(mainItem.selectedContact.core.addresses, mainItem.selectedContact.core.phoneNumbers) : [])
} }
delegate: Item { delegate: Item {
property var listViewModelData: modelData property var listViewModelData: modelData
@ -485,7 +512,8 @@ AbstractMainPage {
style: ButtonStyle.noBackground style: ButtonStyle.noBackground
icon.source: AppIcons.phone icon.source: AppIcons.phone
onClicked: { onClicked: {
UtilsCpp.createCall(listViewModelData.address) UtilsCpp.createCall(
listViewModelData.address)
} }
} }
} }
@ -504,7 +532,9 @@ AbstractMainPage {
} }
} }
RoundedPane { RoundedPane {
visible: infoLayout.visible && companyText.text.length != 0 || jobText.text.length != 0 visible: infoLayout.visible
&& companyText.text.length != 0
|| jobText.text.length != 0
Layout.fillWidth: true Layout.fillWidth: true
topPadding: 17 * DefaultStyle.dp topPadding: 17 * DefaultStyle.dp
bottomPadding: 17 * DefaultStyle.dp bottomPadding: 17 * DefaultStyle.dp
@ -524,7 +554,8 @@ AbstractMainPage {
} }
Text { Text {
id: companyText id: companyText
text: mainItem.selectedContact && mainItem.selectedContact.core.organization text: mainItem.selectedContact
&& mainItem.selectedContact.core.organization
font { font {
pixelSize: 14 * DefaultStyle.dp pixelSize: 14 * DefaultStyle.dp
weight: 400 * DefaultStyle.dp weight: 400 * DefaultStyle.dp
@ -543,7 +574,8 @@ AbstractMainPage {
} }
Text { Text {
id: jobText id: jobText
text: mainItem.selectedContact && mainItem.selectedContact.core.job text: mainItem.selectedContact
&& mainItem.selectedContact.core.job
font { font {
pixelSize: 14 * DefaultStyle.dp pixelSize: 14 * DefaultStyle.dp
weight: 400 * DefaultStyle.dp weight: 400 * DefaultStyle.dp
@ -573,7 +605,9 @@ AbstractMainPage {
weight: Typography.p1.weight weight: Typography.p1.weight
} }
} }
Item{Layout.fillWidth: true} Item {
Layout.fillWidth: true
}
EffectImage { EffectImage {
Layout.preferredWidth: 24 * DefaultStyle.dp Layout.preferredWidth: 24 * DefaultStyle.dp
Layout.preferredHeight: 24 * DefaultStyle.dp Layout.preferredHeight: 24 * DefaultStyle.dp
@ -581,7 +615,8 @@ AbstractMainPage {
colorizationColor: DefaultStyle.main2_600 colorizationColor: DefaultStyle.main2_600
} }
} }
onClicked: console.debug("TODO : go to shared media") onClicked: console.debug(
"TODO : go to shared media")
} }
} }
ContactDetailLayout { ContactDetailLayout {
@ -611,7 +646,9 @@ AbstractMainPage {
ListView { ListView {
id: deviceList id: deviceList
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: Math.min(200 * DefaultStyle.dp, contentHeight) Layout.preferredHeight: Math.min(
200 * DefaultStyle.dp,
contentHeight)
clip: true clip: true
model: mainItem.selectedContact ? mainItem.selectedContact.core.devices : [] model: mainItem.selectedContact ? mainItem.selectedContact.core.devices : []
spacing: 16 * DefaultStyle.dp spacing: 16 * DefaultStyle.dp
@ -627,7 +664,9 @@ AbstractMainPage {
text: deviceDelegate.deviceName text: deviceDelegate.deviceName
font.pixelSize: 14 * DefaultStyle.dp font.pixelSize: 14 * DefaultStyle.dp
} }
Item{Layout.fillWidth: true} Item {
Layout.fillWidth: true
}
EffectImage { EffectImage {
visible: listViewModelData.securityLevel === LinphoneEnums.SecurityLevel.EndToEndEncryptedAndVerified visible: listViewModelData.securityLevel === LinphoneEnums.SecurityLevel.EndToEndEncryptedAndVerified
imageSource: AppIcons.trusted imageSource: AppIcons.trusted
@ -642,14 +681,20 @@ AbstractMainPage {
style: ButtonStyle.tertiary style: ButtonStyle.tertiary
text: qsTr("Vérifier") text: qsTr("Vérifier")
onClicked: { onClicked: {
if (SettingsCpp.getDisplayDeviceCheckConfirmation()) { if (SettingsCpp.getDisplayDeviceCheckConfirmation(
verifyDevicePopup.deviceName = deviceDelegate.deviceName )) {
verifyDevicePopup.deviceAddress = listViewModelData.address verifyDevicePopup.deviceName
= deviceDelegate.deviceName
verifyDevicePopup.deviceAddress
= listViewModelData.address
verifyDevicePopup.open() verifyDevicePopup.open()
} } else {
else { UtilsCpp.createCall(
UtilsCpp.createCall(listViewModelData.address, {}, LinphoneEnums.MediaEncryption.Zrtp) listViewModelData.address,
parent.callObj = UtilsCpp.getCallByAddress(listViewModelData.address) {},
LinphoneEnums.MediaEncryption.Zrtp)
parent.callObj = UtilsCpp.getCallByAddress(
listViewModelData.address)
} }
} }
} }
@ -667,7 +712,8 @@ AbstractMainPage {
Layout.preferredHeight: 50 * DefaultStyle.dp Layout.preferredHeight: 50 * DefaultStyle.dp
icon.source: AppIcons.pencil icon.source: AppIcons.pencil
text: qsTr("Éditer") text: qsTr("Éditer")
onClicked: mainItem.editContact(mainItem.selectedContact) onClicked: mainItem.editContact(
mainItem.selectedContact)
visible: !mainItem.selectedContact?.core.readOnly visible: !mainItem.selectedContact?.core.readOnly
style: ButtonStyle.noBackground style: ButtonStyle.noBackground
} }
@ -679,10 +725,14 @@ AbstractMainPage {
IconLabelButton { IconLabelButton {
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: 50 * DefaultStyle.dp Layout.preferredHeight: 50 * DefaultStyle.dp
icon.source: mainItem.selectedContact && mainItem.selectedContact.core.starred ? AppIcons.heartFill : AppIcons.heart icon.source: mainItem.selectedContact
text: mainItem.selectedContact && mainItem.selectedContact.core.starred ? qsTr("Retirer des favoris") : qsTr("Ajouter aux favoris") && mainItem.selectedContact.core.starred ? AppIcons.heartFill : AppIcons.heart
text: mainItem.selectedContact
&& mainItem.selectedContact.core.starred ? qsTr("Retirer des favoris") : qsTr("Ajouter aux favoris")
style: ButtonStyle.noBackground style: ButtonStyle.noBackground
onClicked: if (mainItem.selectedContact) mainItem.selectedContact.core.lSetStarred(!mainItem.selectedContact.core.starred) onClicked: if (mainItem.selectedContact)
mainItem.selectedContact.core.lSetStarred(
!mainItem.selectedContact.core.starred)
} }
Rectangle { Rectangle {
Layout.fillWidth: true Layout.fillWidth: true
@ -698,11 +748,24 @@ AbstractMainPage {
onClicked: { onClicked: {
if (mainItem.selectedContact) { if (mainItem.selectedContact) {
var vcard = mainItem.selectedContact.core.getVCard() var vcard = mainItem.selectedContact.core.getVCard()
var username = mainItem.selectedContact.core.givenName + mainItem.selectedContact.core.familyName var username = mainItem.selectedContact.core.givenName
var filepath = UtilsCpp.createVCardFile(username, vcard) + mainItem.selectedContact.core.familyName
if (filepath == "") UtilsCpp.showInformationPopup(qsTr("Erreur"), qsTr("La création du fichier vcard a échoué"), false) var filepath = UtilsCpp.createVCardFile(
else mainWindow.showInformationPopup(qsTr("VCard créée"), qsTr("VCard du contact enregistrée dans %1").arg(filepath)) username, vcard)
UtilsCpp.shareByEmail(qsTr("Partage de contact"), vcard, filepath) if (filepath == "")
UtilsCpp.showInformationPopup(
qsTr("Erreur"),
qsTr("La création du fichier vcard a échoué"),
false)
else
mainWindow.showInformationPopup(
qsTr(
"VCard créée"),
qsTr("VCard du contact enregistrée dans %1").arg(
filepath))
UtilsCpp.shareByEmail(
qsTr("Partage de contact"),
vcard, filepath)
} }
} }
} }
@ -742,14 +805,14 @@ AbstractMainPage {
text: qsTr("Supprimer ce contact") text: qsTr("Supprimer ce contact")
visible: !mainItem.selectedContact?.core.readOnly visible: !mainItem.selectedContact?.core.readOnly
onClicked: { onClicked: {
mainItem.deleteContact(mainItem.selectedContact) mainItem.deleteContact(
mainItem.selectedContact)
} }
style: ButtonStyle.noBackgroundRed style: ButtonStyle.noBackgroundRed
} }
} }
} }
Item{ Item {
Layout.fillHeight: true Layout.fillHeight: true
} }
} }
@ -764,7 +827,7 @@ AbstractMainPage {
property string objectName: "contactEdition" property string objectName: "contactEdition"
onCloseEdition: redirectAddress => { onCloseEdition: redirectAddress => {
goToContactDetails() goToContactDetails()
if(redirectAddress){ if (redirectAddress) {
initialFriendToDisplay = redirectAddress initialFriendToDisplay = redirectAddress
} }
} }