From 9240207ef5d6f711d6ffb57ee39752773bfbcaac Mon Sep 17 00:00:00 2001 From: Gaelle Braud Date: Wed, 3 Jul 2024 15:51:23 +0200 Subject: [PATCH] fixes --- Linphone/view/Item/Contact/ContactEdition.qml | 39 +++++++++++++++++-- Linphone/view/Item/Contact/ContactsList.qml | 5 ++- Linphone/view/Item/Form/LoginForm.qml | 18 ++++++--- Linphone/view/Layout/FormItemLayout.qml | 1 + Linphone/view/Page/Main/ContactPage.qml | 14 +++++-- 5 files changed, 63 insertions(+), 14 deletions(-) diff --git a/Linphone/view/Item/Contact/ContactEdition.qml b/Linphone/view/Item/Contact/ContactEdition.qml index 75b6f8531..0ab4f9e29 100644 --- a/Linphone/view/Item/Contact/ContactEdition.qml +++ b/Linphone/view/Item/Contact/ContactEdition.qml @@ -27,6 +27,16 @@ RightPanelLayout { property string oldPictureUri signal closeEdition() + Dialog { + id: confirmDialog + onAccepted: { + mainItem.contact.core.undo() + mainItem.closeEdition() + } + width: 278 * DefaultStyle.dp + text: qsTr("Les changements seront annulés. Souhaitez-vous continuer ?") + } + headerContent: [ Text { anchors.left: parent.left @@ -49,9 +59,7 @@ RightPanelLayout { icon.width: 24 * DefaultStyle.dp icon.height: 24 * DefaultStyle.dp onClicked: { - // contact.core.pictureUri = mainItem.oldPictureUri - mainItem.contact.core.undo() - mainItem.closeEdition() + confirmDialog.open() } } ] @@ -119,11 +127,15 @@ RightPanelLayout { ColumnLayout { spacing: 20 * DefaultStyle.dp FormItemLayout { + id: givenName + enableErrorText: true label: qsTr("Prénom") contentItem: TextField { + id: givenNameEdit initialText: contact.core.givenName onEditingFinished: contact.core.givenName = text backgroundColor: DefaultStyle.grey_0 + backgroundBorderColor: givenName.errorTextItem.opacity != 0 ? DefaultStyle.danger_500main : DefaultStyle.grey_200 } } FormItemLayout { @@ -160,6 +172,7 @@ RightPanelLayout { anchors.rightMargin: 10 * DefaultStyle.dp spacing: 20 * DefaultStyle.dp Repeater { + id: addressesList model: VariantList { model: mainItem.contact && mainItem.contact.core.addresses || [] } @@ -200,6 +213,10 @@ RightPanelLayout { if (text.length != 0) mainItem.contact.core.appendAddress(text) text = "" } + onFocusChanged: if (!focus && text.length != 0) { + mainItem.contact.core.appendAddress(text) + text = "" + } } } Item { @@ -253,6 +270,12 @@ RightPanelLayout { Layout.preferredHeight: 24 * DefaultStyle.dp } } + ErrorText { + id: addressesErrorText + wrapMode: Qt.WordWrap + elide: Text.ElideRight + Layout.fillWidth: true + } Item{Layout.fillHeight: true} } Control.ScrollBar.vertical: Control.ScrollBar{ @@ -275,13 +298,21 @@ RightPanelLayout { Layout.bottomMargin: 100 * DefaultStyle.dp Layout.preferredWidth: 165 * DefaultStyle.dp Layout.alignment: Qt.AlignHCenter - enabled: mainItem.contact && mainItem.contact.core.givenName.length > 0 && mainItem.contact.core.allAddresses.length > 0 + enabled: mainItem.contact && mainItem.contact.core.allAddresses.length > 0 text: mainItem.saveButtonText leftPadding: 20 * DefaultStyle.dp rightPadding: 20 * DefaultStyle.dp topPadding: 11 * DefaultStyle.dp bottomPadding: 11 * DefaultStyle.dp onClicked: { + if (givenNameEdit.text.length === 0) { + givenName.errorMessage = qsTr("Veuillez saisir un prénom") + return + } + if (addressesList.count === 0) { + addressesErrorText.text = qsTr("Veuillez saisir une adresse ou un numéro de téléphone") + return + } mainItem.contact.core.save() mainItem.closeEdition() } diff --git a/Linphone/view/Item/Contact/ContactsList.qml b/Linphone/view/Item/Contact/ContactsList.qml index 9b3979ffd..bca3e345a 100644 --- a/Linphone/view/Item/Contact/ContactsList.qml +++ b/Linphone/view/Item/Contact/ContactsList.qml @@ -197,8 +197,9 @@ ListView { Button { background: Item{} contentItem: RowLayout { - Image { - source: modelData.core.starred ? AppIcons.heartFill : AppIcons.heart + EffectImage { + imageSource: modelData.core.starred ? AppIcons.heartFill : AppIcons.heart + colorizationColor: modelData.core.starred ? DefaultStyle.danger_500main : DefaultStyle.main2_600 fillMode: Image.PreserveAspectFit width: 24 * DefaultStyle.dp height: 24 * DefaultStyle.dp diff --git a/Linphone/view/Item/Form/LoginForm.qml b/Linphone/view/Item/Form/LoginForm.qml index 55c66d646..fbffc47c0 100644 --- a/Linphone/view/Item/Form/LoginForm.qml +++ b/Linphone/view/Item/Form/LoginForm.qml @@ -11,7 +11,7 @@ ColumnLayout { FormItemLayout { id: username - label: "Username" + label: qsTr("Nom d'utilisateur") mandatory: true enableErrorText: true contentItem: TextField { @@ -22,6 +22,10 @@ ColumnLayout { when: errorText.opacity != 0 value: DefaultStyle.danger_500main } + Binding on backgroundBorderColor { + when: username.errorTextItem.opacity != 0 + value: DefaultStyle.danger_500main + } Binding on color { when: errorText.opacity != 0 value: DefaultStyle.danger_500main @@ -32,7 +36,7 @@ ColumnLayout { Layout.preferredHeight: password.implicitHeight FormItemLayout { id: password - label: "Password" + label: qsTr("Mot de passe") mandatory: true enableErrorText: true contentItem: TextField { @@ -44,6 +48,10 @@ ColumnLayout { when: errorText.opacity != 0 value: DefaultStyle.danger_500main } + Binding on backgroundBorderColor { + when: password.errorTextItem.opacity != 0 + value: DefaultStyle.danger_500main + } Binding on color { when: errorText.opacity != 0 value: DefaultStyle.danger_500main @@ -119,9 +127,9 @@ ColumnLayout { if (usernameEdit.text.length == 0 || passwordEdit.text.length == 0) { if (usernameEdit.text.length == 0) - username.errorMessage = qsTr("You must enter a username") + username.errorMessage = qsTr("Veuillez saisir un nom d'utilisateur") if (passwordEdit.text.length == 0) - password.errorMessage = qsTr("You must enter a password") + password.errorMessage = qsTr("Veuillez saisir un mot de passe") return } LoginPageCpp.login(usernameEdit.text, passwordEdit.text) @@ -141,7 +149,7 @@ ColumnLayout { } contentItem: Text { color: DefaultStyle.main2_500main - text: "Forgotten password?" + text: qsTr("Mot de passe oublié ?") font{ underline: true pixelSize: 13 * DefaultStyle.dp diff --git a/Linphone/view/Layout/FormItemLayout.qml b/Linphone/view/Layout/FormItemLayout.qml index 6a3933ff4..0f928852a 100644 --- a/Linphone/view/Layout/FormItemLayout.qml +++ b/Linphone/view/Layout/FormItemLayout.qml @@ -10,6 +10,7 @@ ColumnLayout { property string label: "" property bool mandatory: false + property alias errorTextItem: errorText property alias errorMessage: errorText.text property bool enableErrorText: false property bool errorTextVisible: errorText.opacity > 0 diff --git a/Linphone/view/Page/Main/ContactPage.qml b/Linphone/view/Page/Main/ContactPage.qml index 92d42dbb7..e3aa3e3c8 100644 --- a/Linphone/view/Page/Main/ContactPage.qml +++ b/Linphone/view/Page/Main/ContactPage.qml @@ -59,7 +59,11 @@ AbstractMainPage { id: dialog property var contact text: (contact ? contact.core.displayName : "Contact") + " is about to be deleted. Do you want to continue ?" - onAccepted: contact.core.remove() + onAccepted: { + var name = contact.core.displayName + contact.core.remove() + UtilsCpp.showInformationPopup(qsTr("Supprimé"), qsTr("%1 a été supprimé").arg(name)) + } } Popup { @@ -188,6 +192,7 @@ AbstractMainPage { spacing: 38 * DefaultStyle.dp SearchBar { id: searchBar + visible: contactList.count > 0 Layout.leftMargin: leftPanel.leftMargin Layout.rightMargin: leftPanel.rightMargin Layout.topMargin: 18 * DefaultStyle.dp @@ -213,16 +218,18 @@ AbstractMainPage { // anchors.fill: parent spacing: 15 * DefaultStyle.dp Text { + visible: contactList.count === 0 && favoriteList.count === 0 + Layout.alignment: Qt.AlignHCenter + Layout.topMargin: 137 * DefaultStyle.dp text: qsTr("Aucun contact") font { pixelSize: 16 * DefaultStyle.dp weight: 800 * DefaultStyle.dp } - visible: contactList.count === 0 && favoriteList.count === 0 - Layout.alignment: Qt.AlignHCenter } ColumnLayout { visible: favoriteList.contentHeight > 0 + onVisibleChanged: if (visible && !favoriteList.visible) favoriteList.visible = true Layout.leftMargin: leftPanel.leftMargin Layout.rightMargin: leftPanel.rightMargin spacing: 18 * DefaultStyle.dp @@ -271,6 +278,7 @@ AbstractMainPage { } ColumnLayout { visible: contactList.count > 0 + onVisibleChanged: if (visible && !contactList.visible) contactList.visible = true Layout.leftMargin: leftPanel.leftMargin Layout.rightMargin: leftPanel.rightMargin spacing: 16 * DefaultStyle.dp