open lock icon on basic chatrooms #LINQT-1903

This commit is contained in:
Gaelle Braud 2025-08-28 17:04:07 +02:00
parent 358125dfa6
commit afe81094ba
5 changed files with 48 additions and 29 deletions

View file

@ -53,7 +53,9 @@ ChatCore::ChatCore(const std::shared_ptr<linphone::ChatRoom> &chatRoom) : QObjec
mAvatarUri = ToolModel::getDisplayName(chatRoomAddress); mAvatarUri = ToolModel::getDisplayName(chatRoomAddress);
mPeerAddress = Utils::coreStringToAppString(chatRoomAddress->asStringUriOnly()); mPeerAddress = Utils::coreStringToAppString(chatRoomAddress->asStringUriOnly());
mIsGroupChat = false; mIsGroupChat = false;
mIsBasic = true;
} else { } else {
mIsBasic = false;
if (chatRoom->hasCapability((int)linphone::ChatRoom::Capabilities::OneToOne)) { if (chatRoom->hasCapability((int)linphone::ChatRoom::Capabilities::OneToOne)) {
auto participants = chatRoom->getParticipants(); auto participants = chatRoom->getParticipants();
if (participants.size() > 0) { if (participants.size() > 0) {

View file

@ -58,6 +58,7 @@ public:
Q_PROPERTY(bool isEncrypted READ isEncrypted CONSTANT) Q_PROPERTY(bool isEncrypted READ isEncrypted CONSTANT)
Q_PROPERTY(bool isReadOnly READ getIsReadOnly WRITE setIsReadOnly NOTIFY readOnlyChanged) Q_PROPERTY(bool isReadOnly READ getIsReadOnly WRITE setIsReadOnly NOTIFY readOnlyChanged)
Q_PROPERTY(bool isSecured READ isSecured WRITE setIsSecured NOTIFY isSecuredChanged) 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(QString sendingText READ getSendingText WRITE setSendingText NOTIFY sendingTextChanged)
Q_PROPERTY(bool ephemeralEnabled READ isEphemeralEnabled WRITE lEnableEphemeral NOTIFY ephemeralEnabledChanged) Q_PROPERTY(bool ephemeralEnabled READ isEphemeralEnabled WRITE lEnableEphemeral NOTIFY ephemeralEnabledChanged)
Q_PROPERTY( Q_PROPERTY(
@ -216,6 +217,7 @@ private:
// ChatRoom is secured if all its participants are // ChatRoom is secured if all its participants are
// EndToEndEncryptedAndVerified friends // EndToEndEncryptedAndVerified friends
bool mIsSecured = false; bool mIsSecured = false;
bool mIsBasic = false;
int mEphemeralLifetime = 0; int mEphemeralLifetime = 0;
QList<QSharedPointer<ChatMessageContentCore>> mFileList; QList<QSharedPointer<ChatMessageContentCore>> mFileList;
bool mIsMuted = false; bool mIsMuted = false;

View file

@ -310,6 +310,13 @@ ListView {
imageSource: AppIcons.clockCountDown imageSource: AppIcons.clockCountDown
} }
EffectImage { 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 visible: modelData != undefined && modelData?.core.muted
Layout.preferredWidth: visible ? 14 * DefaultStyle.dp : 0 Layout.preferredWidth: visible ? 14 * DefaultStyle.dp : 0
Layout.preferredHeight: 14 * DefaultStyle.dp Layout.preferredHeight: 14 * DefaultStyle.dp
@ -374,34 +381,35 @@ ListView {
chatroomPopup.close() chatroomPopup.close()
} }
} }
Rectangle { ColumnLayout {
Layout.fillWidth: true spacing: parent.spacing
visible: leaveButton.visible visible: modelData && !modelData.core.isReadOnly && modelData.core.isGroupChat
Layout.preferredHeight: Math.min(1, Math.round(1 * DefaultStyle.dp)) Rectangle {
color: DefaultStyle.main2_400 Layout.fillWidth: true
} Layout.preferredHeight: Math.min(1, Math.round(1 * DefaultStyle.dp))
IconLabelButton { color: DefaultStyle.main2_400
id: leaveButton }
//: "leave" IconLabelButton {
text: qsTr("chat_room_leave") //: "leave"
visible: modelData ? !modelData.core.isReadOnly && modelData.core.isGroupChat : false text: qsTr("chat_room_leave")
icon.source: AppIcons.trashCan icon.source: AppIcons.trashCan
spacing: Math.round(10 * DefaultStyle.dp) spacing: Math.round(10 * DefaultStyle.dp)
Layout.fillWidth: true Layout.fillWidth: true
onClicked: { onClicked: {
//: leave the conversation ? //: leave the conversation ?
mainWindow.showConfirmationLambdaPopup(qsTr("chat_list_leave_chat_popup_title"), 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 ? //: 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"), qsTr("chat_list_leave_chat_popup_message"),
"", "",
function(confirmed) { function(confirmed) {
if (confirmed) { if (confirmed) {
modelData.core.lLeave() modelData.core.lLeave()
chatroomPopup.close() chatroomPopup.close()
} }
}) })
}
style: ButtonStyle.hoveredBackground
} }
style: ButtonStyle.hoveredBackground
} }
Rectangle { Rectangle {
visible: deleteButton.visible visible: deleteButton.visible

View file

@ -1,6 +1,6 @@
import QtQuick import QtQuick
import QtQuick.Controls.Basic as Control import QtQuick.Controls.Basic as Control
import QtQuick.Dialogs import QtQuick.Dialogs
import QtQuick.Layouts import QtQuick.Layouts
import Linphone import Linphone
import UtilsCpp import UtilsCpp

View file

@ -100,7 +100,6 @@ FocusScope {
Text { Text {
text: mainItem.chat?.core.title || "" text: mainItem.chat?.core.title || ""
color: DefaultStyle.main2_600 color: DefaultStyle.main2_600
Layout.fillWidth: true
maximumLineCount: 1 maximumLineCount: 1
font { font {
pixelSize: Typography.h4.pixelSize pixelSize: Typography.h4.pixelSize
@ -108,6 +107,14 @@ FocusScope {
capitalization: Font.Capitalize 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 { EffectImage {
visible: mainItem.chat?.core.muted || false visible: mainItem.chat?.core.muted || false
Layout.preferredWidth: 20 * DefaultStyle.dp Layout.preferredWidth: 20 * DefaultStyle.dp