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

@ -308,6 +308,13 @@ ListView {
Layout.preferredHeight: 14 * DefaultStyle.dp Layout.preferredHeight: 14 * DefaultStyle.dp
colorizationColor: DefaultStyle.main2_400 colorizationColor: DefaultStyle.main2_400
imageSource: AppIcons.clockCountDown 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 { EffectImage {
visible: modelData != undefined && modelData?.core.muted visible: modelData != undefined && modelData?.core.muted
@ -374,17 +381,17 @@ ListView {
chatroomPopup.close() chatroomPopup.close()
} }
} }
ColumnLayout {
spacing: parent.spacing
visible: modelData && !modelData.core.isReadOnly && modelData.core.isGroupChat
Rectangle { Rectangle {
Layout.fillWidth: true Layout.fillWidth: true
visible: leaveButton.visible
Layout.preferredHeight: Math.min(1, Math.round(1 * DefaultStyle.dp)) Layout.preferredHeight: Math.min(1, Math.round(1 * DefaultStyle.dp))
color: DefaultStyle.main2_400 color: DefaultStyle.main2_400
} }
IconLabelButton { IconLabelButton {
id: leaveButton
//: "leave" //: "leave"
text: qsTr("chat_room_leave") text: qsTr("chat_room_leave")
visible: modelData ? !modelData.core.isReadOnly && modelData.core.isGroupChat : false
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
@ -403,6 +410,7 @@ ListView {
} }
style: ButtonStyle.hoveredBackground style: ButtonStyle.hoveredBackground
} }
}
Rectangle { Rectangle {
visible: deleteButton.visible visible: deleteButton.visible
Layout.fillWidth: true Layout.fillWidth: true

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