[network/ruqola] src/widgets/dialogs: Continue to implement menu

Laurent Montel <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 34623405f9379a2814c8e2a8a230ef1cfc218ee6 by Laurent Montel.
Committed on 19/07/2026 at 12:06.
Pushed by mlaurent into branch 'master'.

Continue to implement menu

M  +20   -2    src/widgets/dialogs/directchannelinfowidget.cpp
M  +8    -2    src/widgets/dialogs/directchannelinfowidget.h

https://invent.kde.org/network/ruqola/-/commit/34623405f9379a2814c8e2a8a230ef1cfc218ee6

diff --git a/src/widgets/dialogs/directchannelinfowidget.cpp b/src/widgets/dialogs/directchannelinfowidget.cpp
index 4230981a7e..065bff97af 100644
--- a/src/widgets/dialogs/directchannelinfowidget.cpp
+++ b/src/widgets/dialogs/directchannelinfowidget.cpp
@@ -8,6 +8,7 @@
 #include "common/resizablepixmaplabel.h"
 #include "connection.h"
 #include "rocketchataccount.h"
+#include "room/usersinroommenu.h"
 #include "ruqolawidgets_debug.h"
 #include "user.h"
 #include "users/userinfojob.h"
@@ -16,13 +17,14 @@
 #include <QFormLayout>
 #include <QLabel>
 #include <QPushButton>
+#include <QToolButton>
 
 using namespace Qt::Literals::StringLiterals;
 DirectChannelInfoWidget::DirectChannelInfoWidget(RocketChatAccount *account, QWidget *parent)
     : QWidget(parent)
     , mAvatar(new ResizablePixmapLabel(this))
     , mFormLayout(new QFormLayout)
-    , mDirectChannelActionWidget(new DirectChannelActionWidget(this))
+    , mDirectChannelActionWidget(new DirectChannelActionWidget(account, this))
     , mRocketChatAccount(account)
 {
     mFormLayout->setObjectName(u"mFormLayout"_s);
@@ -223,10 +225,13 @@ void DirectChannelInfoWidget::setUser(const User &user)
     }
     // mDirectChannelActionWidget->setVisible(user.userId() != mRocketChatAccount->userId());
     mDirectChannelActionWidget->setVisible(false); // TODO
+    mDirectChannelActionWidget->setUser(user);
 }
 
-DirectChannelActionWidget::DirectChannelActionWidget(QWidget *parent)
+DirectChannelActionWidget::DirectChannelActionWidget(RocketChatAccount *account, QWidget *parent)
     : QWidget(parent)
+    , mToolButton(new QToolButton(this))
+    , mRocketChatAccount(account)
 {
     auto actionLayout = new QHBoxLayout(this);
     actionLayout->setObjectName(u"mainLayout"_s);
@@ -241,8 +246,21 @@ DirectChannelActionWidget::DirectChannelActionWidget(QWidget *parent)
     reportButton->setObjectName(u"reportButton"_s);
     actionLayout->addWidget(reportButton);
     connect(reportButton, &QPushButton::clicked, this, &DirectChannelActionWidget::reportUser);
+
+    mToolButton->setObjectName(u"mToolButton"_s);
+    mToolButton->setPopupMode(QToolButton::InstantPopup);
 }
 
 DirectChannelActionWidget::~DirectChannelActionWidget() = default;
 
+void DirectChannelActionWidget::setUser(const User &user)
+{
+    auto menu = new UsersInRoomMenu(mRocketChatAccount, this);
+    menu->setParentWidget(this);
+    menu->setUserId(user.userId());
+    menu->setUserName(user.userName());
+    // TODO add room
+    mToolButton->setMenu(menu->createMenu());
+}
+
 #include "moc_directchannelinfowidget.cpp"
diff --git a/src/widgets/dialogs/directchannelinfowidget.h b/src/widgets/dialogs/directchannelinfowidget.h
index 7ce277f9b1..f56981949e 100644
--- a/src/widgets/dialogs/directchannelinfowidget.h
+++ b/src/widgets/dialogs/directchannelinfowidget.h
@@ -15,16 +15,22 @@ class User;
 class QFormLayout;
 class RocketChatAccount;
 class ResizablePixmapLabel;
-
+class QToolButton;
 class LIBRUQOLAWIDGETS_TESTS_EXPORT DirectChannelActionWidget : public QWidget
 {
     Q_OBJECT
 public:
-    explicit DirectChannelActionWidget(QWidget *parent = nullptr);
+    explicit DirectChannelActionWidget(RocketChatAccount *account, QWidget *parent = nullptr);
     ~DirectChannelActionWidget() override;
+    void setUser(const User &user);
+
 Q_SIGNALS:
     void ignoreUser();
     void reportUser();
+
+private:
+    QToolButton *const mToolButton;
+    RocketChatAccount *const mRocketChatAccount;
 };
 
 class LIBRUQOLAWIDGETS_TESTS_EXPORT DirectChannelInfoWidget : public QWidget
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.