linphone-desktop/Linphone/view/Page/Layout/Settings/CarddavSettingsLayout.qml
Julien Wadel c908f0d42c Fix blinkink text fields.
Remove storing core from GUI on fields. Core should never be stored in GUI because they are managed by CPP and not QML.
Fix crashes on account settings.
Add missing exception verbosing.
2024-12-18 18:44:14 +01:00

120 lines
3.1 KiB
QML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import QtCore
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls.Basic as Control
import QtQuick.Dialogs
import Linphone
import SettingsCpp 1.0
import UtilsCpp
AbstractSettingsLayout {
id: mainItem
width: parent?.width
contentModel: [
{
title: qsTr("Carnet d'adresse CardDAV"),
subTitle: qsTr("Ajouter un carnet dadresse CardDAV pour synchroniser vos contacts Linphone avec un carnet dadresse tiers."),
contentComponent: cardDavParametersComponent
}
]
topbarOptionalComponent: topBar
property alias carddavGui: mainItem.model
property bool isNew: false
onSave: {
if (carddavGui.core.isValid()) {
carddavGui.core.save()
} else {
UtilsCpp.showInformationPopup(qsTr("Erreur"), qsTr("Vérifiez que toutes les informations ont été saisies."), false, mainWindow)
}
}
Connections {
target: carddavGui.core
function onSaved(success) {
if (success)
UtilsCpp.showInformationPopup(qsTr("Succès"), qsTr("Le carnet d'adresse CardDAV est synchronisé."), true, mainWindow)
else
UtilsCpp.showInformationPopup(qsTr("Erreur"), qsTr("Erreur de synchronisation!"), false, mainWindow)
}
}
Component {
id: topBar
RowLayout {
spacing: 20 * DefaultStyle.dp
Button {
background: Item{}
icon.source: AppIcons.trashCan
icon.width: 32 * DefaultStyle.dp
icon.height: 32 * DefaultStyle.dp
contentImageColor: DefaultStyle.main2_600
visible: !isNew
onClicked: {
var mainWin = UtilsCpp.getMainWindow()
mainWin.showConfirmationLambdaPopup("",
qsTr("Supprimer le carnet d'adresse CardDAV ?"),
"",
function (confirmed) {
if (confirmed) {
carddavGui.core.remove()
mainItem.container.pop()
}
}
)
}
}
}
}
Component {
id: cardDavParametersComponent
ColumnLayout {
Layout.fillWidth: true
spacing: 20 * DefaultStyle.dp
Layout.rightMargin: 44 * DefaultStyle.dp
Layout.topMargin: 20 * DefaultStyle.dp
Layout.leftMargin: 64 * DefaultStyle.dp
DecoratedTextField {
propertyName: "displayName"
propertyOwnerGui: carddavGui
title: qsTr("Nom daffichage")
canBeEmpty: false
toValidate: true
Layout.fillWidth: true
}
DecoratedTextField {
propertyName: "uri"
propertyOwnerGui: carddavGui
title: qsTr("URL du serveur")
canBeEmpty: false
toValidate: true
Layout.fillWidth: true
}
DecoratedTextField {
propertyName: "username"
propertyOwnerGui: carddavGui
title: qsTr("Nom dutilisateur")
toValidate: true
Layout.fillWidth: true
}
DecoratedTextField {
propertyName: "password"
hidden: true
propertyOwnerGui: carddavGui
title: qsTr("Mot de passe")
toValidate: true
Layout.fillWidth: true
}
DecoratedTextField {
propertyName: "realm"
propertyOwnerGui: carddavGui
title: qsTr("Domaine dauthentification")
toValidate: true
Layout.fillWidth: true
}
SwitchSetting {
titleText: qsTr("Stocker ici les contacts nouvellement crées")
propertyName: "storeNewFriendsInIt"
propertyOwnerGui: carddavGui
}
}
}
}