From afe81094ba562307aa49b5d60b85d5bf4c7464ca Mon Sep 17 00:00:00 2001 From: Gaelle Braud Date: Thu, 28 Aug 2025 17:04:07 +0200 Subject: [PATCH] open lock icon on basic chatrooms #LINQT-1903 --- Linphone/core/chat/ChatCore.cpp | 2 + Linphone/core/chat/ChatCore.hpp | 2 + .../Control/Display/Chat/ChatListView.qml | 62 +++++++++++-------- .../Input/Chat/ChatDroppableTextArea.qml | 2 +- .../view/Page/Form/Chat/SelectedChatView.qml | 9 ++- 5 files changed, 48 insertions(+), 29 deletions(-) diff --git a/Linphone/core/chat/ChatCore.cpp b/Linphone/core/chat/ChatCore.cpp index 9e9cb59da..921576c8f 100644 --- a/Linphone/core/chat/ChatCore.cpp +++ b/Linphone/core/chat/ChatCore.cpp @@ -53,7 +53,9 @@ ChatCore::ChatCore(const std::shared_ptr &chatRoom) : QObjec mAvatarUri = ToolModel::getDisplayName(chatRoomAddress); mPeerAddress = Utils::coreStringToAppString(chatRoomAddress->asStringUriOnly()); mIsGroupChat = false; + mIsBasic = true; } else { + mIsBasic = false; if (chatRoom->hasCapability((int)linphone::ChatRoom::Capabilities::OneToOne)) { auto participants = chatRoom->getParticipants(); if (participants.size() > 0) { diff --git a/Linphone/core/chat/ChatCore.hpp b/Linphone/core/chat/ChatCore.hpp index baa02fa90..cfb696571 100644 --- a/Linphone/core/chat/ChatCore.hpp +++ b/Linphone/core/chat/ChatCore.hpp @@ -58,6 +58,7 @@ public: Q_PROPERTY(bool isEncrypted READ isEncrypted CONSTANT) Q_PROPERTY(bool isReadOnly READ getIsReadOnly WRITE setIsReadOnly NOTIFY readOnlyChanged) Q_PROPERTY(bool isSecured READ isSecured WRITE setIsSecured NOTIFY isSecuredChanged) + Q_PROPERTY(bool isBasic MEMBER mIsBasic CONSTANT) Q_PROPERTY(QString sendingText READ getSendingText WRITE setSendingText NOTIFY sendingTextChanged) Q_PROPERTY(bool ephemeralEnabled READ isEphemeralEnabled WRITE lEnableEphemeral NOTIFY ephemeralEnabledChanged) Q_PROPERTY( @@ -216,6 +217,7 @@ private: // ChatRoom is secured if all its participants are // EndToEndEncryptedAndVerified friends bool mIsSecured = false; + bool mIsBasic = false; int mEphemeralLifetime = 0; QList> mFileList; bool mIsMuted = false; diff --git a/Linphone/view/Control/Display/Chat/ChatListView.qml b/Linphone/view/Control/Display/Chat/ChatListView.qml index fa74ffb69..52a36b65b 100644 --- a/Linphone/view/Control/Display/Chat/ChatListView.qml +++ b/Linphone/view/Control/Display/Chat/ChatListView.qml @@ -310,6 +310,13 @@ ListView { imageSource: AppIcons.clockCountDown } EffectImage { + visible: modelData != undefined && modelData?.core.isBasic + Layout.preferredWidth: visible ? 14 * DefaultStyle.dp : 0 + Layout.preferredHeight: 14 * DefaultStyle.dp + colorizationColor: DefaultStyle.warning_500_main + imageSource: AppIcons.lockSimpleOpen + } + EffectImage { visible: modelData != undefined && modelData?.core.muted Layout.preferredWidth: visible ? 14 * DefaultStyle.dp : 0 Layout.preferredHeight: 14 * DefaultStyle.dp @@ -374,34 +381,35 @@ ListView { chatroomPopup.close() } } - Rectangle { - Layout.fillWidth: true - visible: leaveButton.visible - Layout.preferredHeight: Math.min(1, Math.round(1 * DefaultStyle.dp)) - color: DefaultStyle.main2_400 - } - IconLabelButton { - id: leaveButton - //: "leave" - text: qsTr("chat_room_leave") - visible: modelData ? !modelData.core.isReadOnly && modelData.core.isGroupChat : false - icon.source: AppIcons.trashCan - spacing: Math.round(10 * DefaultStyle.dp) - Layout.fillWidth: true - onClicked: { - //: leave the conversation ? - mainWindow.showConfirmationLambdaPopup(qsTr("chat_list_leave_chat_popup_title"), - //: You will not be able to send or receive messages in this conversation anymore. Do You want to continue ? - qsTr("chat_list_leave_chat_popup_message"), - "", - function(confirmed) { - if (confirmed) { - modelData.core.lLeave() - chatroomPopup.close() - } - }) + ColumnLayout { + spacing: parent.spacing + visible: modelData && !modelData.core.isReadOnly && modelData.core.isGroupChat + Rectangle { + Layout.fillWidth: true + Layout.preferredHeight: Math.min(1, Math.round(1 * DefaultStyle.dp)) + color: DefaultStyle.main2_400 + } + IconLabelButton { + //: "leave" + text: qsTr("chat_room_leave") + icon.source: AppIcons.trashCan + spacing: Math.round(10 * DefaultStyle.dp) + Layout.fillWidth: true + onClicked: { + //: leave the conversation ? + mainWindow.showConfirmationLambdaPopup(qsTr("chat_list_leave_chat_popup_title"), + //: You will not be able to send or receive messages in this conversation anymore. Do You want to continue ? + qsTr("chat_list_leave_chat_popup_message"), + "", + function(confirmed) { + if (confirmed) { + modelData.core.lLeave() + chatroomPopup.close() + } + }) + } + style: ButtonStyle.hoveredBackground } - style: ButtonStyle.hoveredBackground } Rectangle { visible: deleteButton.visible diff --git a/Linphone/view/Control/Input/Chat/ChatDroppableTextArea.qml b/Linphone/view/Control/Input/Chat/ChatDroppableTextArea.qml index 7e6ee32b9..16ea564c0 100644 --- a/Linphone/view/Control/Input/Chat/ChatDroppableTextArea.qml +++ b/Linphone/view/Control/Input/Chat/ChatDroppableTextArea.qml @@ -1,6 +1,6 @@ import QtQuick import QtQuick.Controls.Basic as Control - import QtQuick.Dialogs +import QtQuick.Dialogs import QtQuick.Layouts import Linphone import UtilsCpp diff --git a/Linphone/view/Page/Form/Chat/SelectedChatView.qml b/Linphone/view/Page/Form/Chat/SelectedChatView.qml index 023ce4686..78fa692db 100644 --- a/Linphone/view/Page/Form/Chat/SelectedChatView.qml +++ b/Linphone/view/Page/Form/Chat/SelectedChatView.qml @@ -100,7 +100,6 @@ FocusScope { Text { text: mainItem.chat?.core.title || "" color: DefaultStyle.main2_600 - Layout.fillWidth: true maximumLineCount: 1 font { pixelSize: Typography.h4.pixelSize @@ -108,6 +107,14 @@ FocusScope { capitalization: Font.Capitalize } } + EffectImage { + visible: mainItem.chat != undefined && mainItem.chat.core.isBasic + Layout.preferredWidth: visible ? 14 * DefaultStyle.dp : 0 + Layout.preferredHeight: 14 * DefaultStyle.dp + colorizationColor: DefaultStyle.warning_500_main + imageSource: AppIcons.lockSimpleOpen + } + Layout.fillWidth: true EffectImage { visible: mainItem.chat?.core.muted || false Layout.preferredWidth: 20 * DefaultStyle.dp