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);
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) {

View file

@ -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<QSharedPointer<ChatMessageContentCore>> mFileList;
bool mIsMuted = false;

View file

@ -308,6 +308,13 @@ ListView {
Layout.preferredHeight: 14 * DefaultStyle.dp
colorizationColor: DefaultStyle.main2_400
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
@ -374,17 +381,17 @@ ListView {
chatroomPopup.close()
}
}
ColumnLayout {
spacing: parent.spacing
visible: modelData && !modelData.core.isReadOnly && modelData.core.isGroupChat
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
@ -403,6 +410,7 @@ ListView {
}
style: ButtonStyle.hoveredBackground
}
}
Rectangle {
visible: deleteButton.visible
Layout.fillWidth: true

View file

@ -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

View file

@ -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