[network/ruqola] src/widgets/room/delegate/messagelistlayout: Adapt layout when we have encrypted message
Laurent Montel <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 9f61dae94a97aa11759f0fe3b16ff77e01e33f67 by Laurent Montel.
Committed on 10/08/2026 at 17:38.
Pushed by mlaurent into branch 'master'.
Adapt layout when we have encrypted message
M +8 -2 src/widgets/room/delegate/messagelistlayout/messagelistcompactlayout.cpp
M +3 -1 src/widgets/room/delegate/messagelistlayout/messagelistcozylayout.cpp
M +8 -2 src/widgets/room/delegate/messagelistlayout/messagelistnormallayout.cpp
https://invent.kde.org/network/ruqola/-/commit/9f61dae94a97aa11759f0fe3b16ff77e01e33f67
diff --git a/src/widgets/room/delegate/messagelistlayout/messagelistcompactlayout.cpp b/src/widgets/room/delegate/messagelistlayout/messagelistcompactlayout.cpp
index fe0b2ba48c..8c7aa11281 100644
--- a/src/widgets/room/delegate/messagelistlayout/messagelistcompactlayout.cpp
+++ b/src/widgets/room/delegate/messagelistlayout/messagelistcompactlayout.cpp
@@ -169,9 +169,15 @@ MessageListLayoutBase::Layout MessageListCompactLayout::doLayout(const QStyleOpt
layout.showIgnoreMessage = index.data(MessagesModel::ShowIgnoredMessage).toBool();
}
layout.addReactionRect = QRect(textLeft + textSize.width() + margin, senderRectY, iconSize, iconSize);
- layout.replyToThreadRect = QRect(textLeft + textSize.width() + 2 * margin + iconSize, senderRectY, iconSize, iconSize);
+ if (!message->isEncryptedMessage()) {
+ layout.replyToThreadRect = QRect(layout.addReactionRect.left() + margin + iconSize, senderRectY, iconSize, iconSize);
+ }
#if HAVE_TEXT_TO_SPEECH
- layout.textToSpeechIconRect = QRect(textLeft + textSize.width() + 3 * margin + iconSize * 2, senderRectY, iconSize, iconSize);
+ layout.textToSpeechIconRect =
+ QRect(message->isEncryptedMessage() ? layout.addReactionRect.left() + margin + iconSize : layout.replyToThreadRect.left() + margin + iconSize,
+ senderRectY,
+ iconSize,
+ iconSize);
#endif
layout.timeStampPos = QPoint(option.rect.width() - timeSize.width() - margin / 2, layout.baseLine);
layout.timeStampRect = QRect(QPoint(layout.timeStampPos.x(), senderRectY), timeSize);
diff --git a/src/widgets/room/delegate/messagelistlayout/messagelistcozylayout.cpp b/src/widgets/room/delegate/messagelistlayout/messagelistcozylayout.cpp
index 5b5df12695..0922037430 100644
--- a/src/widgets/room/delegate/messagelistlayout/messagelistcozylayout.cpp
+++ b/src/widgets/room/delegate/messagelistlayout/messagelistcozylayout.cpp
@@ -176,7 +176,9 @@ MessageListLayoutBase::Layout MessageListCozyLayout::doLayout(const QStyleOption
}
layout.addReactionRect = QRect(textLeft + textSize.width() + margin, senderRectY, iconSize, iconSize);
- layout.replyToThreadRect = QRect(textLeft + textSize.width() + 2 * margin + iconSize, senderRectY, iconSize, iconSize);
+ if (!message->isEncryptedMessage()) {
+ layout.replyToThreadRect = QRect(textLeft + textSize.width() + 2 * margin + iconSize, senderRectY, iconSize, iconSize);
+ }
#if HAVE_TEXT_TO_SPEECH
layout.textToSpeechIconRect = QRect(textLeft + textSize.width() + 3 * margin + iconSize * 2, senderRectY, iconSize, iconSize);
#endif
diff --git a/src/widgets/room/delegate/messagelistlayout/messagelistnormallayout.cpp b/src/widgets/room/delegate/messagelistlayout/messagelistnormallayout.cpp
index d733a7cf02..2245f9f549 100644
--- a/src/widgets/room/delegate/messagelistlayout/messagelistnormallayout.cpp
+++ b/src/widgets/room/delegate/messagelistlayout/messagelistnormallayout.cpp
@@ -234,12 +234,18 @@ MessageListLayoutBase::Layout MessageListNormalLayout::doLayout(const QStyleOpti
}
layout.addReactionRect = QRect(textLeft + textSize.width() + margin, layout.textRect.y(), iconSize, iconSize);
- layout.replyToThreadRect = QRect(textLeft + textSize.width() + 2 * margin + iconSize, layout.textRect.y(), iconSize, iconSize);
+ if (!message->isEncryptedMessage()) {
+ layout.replyToThreadRect = QRect(layout.addReactionRect.left() + margin + iconSize, layout.textRect.y(), iconSize, iconSize);
+ }
if (layout.sameSenderAsPreviousMessage) {
layout.addReactionRect.moveTop(layout.textRect.y());
}
#if HAVE_TEXT_TO_SPEECH
- layout.textToSpeechIconRect = QRect(textLeft + textSize.width() + 3 * margin + iconSize * 2, layout.textRect.y(), iconSize, iconSize);
+ layout.textToSpeechIconRect =
+ QRect(message->isEncryptedMessage() ? layout.addReactionRect.left() + margin + iconSize : layout.replyToThreadRect.left() + margin + iconSize,
+ layout.textRect.y(),
+ iconSize,
+ iconSize);
#endif
// Right edge available to laid-out content (a half-margin gutter is kept clear).