[network/ruqola] src/widgets: Add background encrypted (Thanks Nuno for it)

Laurent Montel <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 72e21f8a505b08d7e72d9d1ae99211e35e665252 by Laurent Montel.
Committed on 07/08/2026 at 11:23.
Pushed by mlaurent into branch 'master'.

Add background encrypted (Thanks Nuno for it)

A  +-    --    src/widgets/icons/encrypt-background.png
M  +5    -2    src/widgets/room/messagelistview.cpp
M  +1    -0    src/widgets/room/messagelistview.h
M  +1    -0    src/widgets/ruqolawidget.qrc

https://invent.kde.org/network/ruqola/-/commit/72e21f8a505b08d7e72d9d1ae99211e35e665252

diff --git a/src/widgets/icons/encrypt-background.png b/src/widgets/icons/encrypt-background.png
new file mode 100644
index 0000000000..3356ee6502
Binary files /dev/null and b/src/widgets/icons/encrypt-background.png differ
diff --git a/src/widgets/room/messagelistview.cpp b/src/widgets/room/messagelistview.cpp
index 075057e7a3..d7ca341e1b 100644
--- a/src/widgets/room/messagelistview.cpp
+++ b/src/widgets/room/messagelistview.cpp
@@ -77,6 +77,7 @@ MessageListView::MessageListView(RocketChatAccount *account, Mode mode, QWidget
     , mCurrentRocketChatAccount(account)
     , mActionButtonsGenerator(new ActionButtonsGenerator(this))
     , mNewMessageIndicator(new NewMessageIndicator(viewport()))
+    , mEncryptedRoomBackground(QPixmap(u":/messages_icons/icons/encrypt-background.png"_s))
 {
     if (mCurrentRocketChatAccount) {
         mMessageListDelegate->setRocketChatAccount(mCurrentRocketChatAccount);
@@ -134,9 +135,11 @@ void MessageListView::resizeEvent(QResizeEvent *e)
 
 void MessageListView::paintEvent(QPaintEvent *e)
 {
+    QPainter p(viewport());
+    if (mRoom && mRoom->encrypted()) {
+        p.drawPixmap(width() - mEncryptedRoomBackground.width(), height() - mEncryptedRoomBackground.height(), mEncryptedRoomBackground);
+    }
     if (mRoom && (mRoom->numberMessages() == 0)) {
-        QPainter p(viewport());
-
         QFont font = p.font();
         font.setItalic(true);
         p.setFont(font);
diff --git a/src/widgets/room/messagelistview.h b/src/widgets/room/messagelistview.h
index 19fae4263f..d46cdcbb39 100644
--- a/src/widgets/room/messagelistview.h
+++ b/src/widgets/room/messagelistview.h
@@ -120,4 +120,5 @@ private:
     QPointer<RocketChatAccount> mCurrentRocketChatAccount;
     ActionButtonsGenerator *const mActionButtonsGenerator;
     NewMessageIndicator *const mNewMessageIndicator;
+    const QPixmap mEncryptedRoomBackground;
 };
diff --git a/src/widgets/ruqolawidget.qrc b/src/widgets/ruqolawidget.qrc
index 31090ae892..7dc0a38a1c 100644
--- a/src/widgets/ruqolawidget.qrc
+++ b/src/widgets/ruqolawidget.qrc
@@ -9,5 +9,6 @@
     <qresource prefix="/messages_icons">
         <file>icons/single-check.svg</file>
         <file>icons/double-check.svg</file>
+        <file>icons/encrypt-background.png</file>
     </qresource>
 </RCC>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.