From f63b7b42db3a16424aa85abbe5af35c0166ea868 Mon Sep 17 00:00:00 2001 From: Hartmnt Date: Thu, 15 Feb 2024 17:28:51 +0000 Subject: [PATCH] FEAT(client): Add "Move To Own Channel" action to user context menu Previously, there was no way to move users from channel to channel using only the keyboard. For accessibility reasons, that was not ideal. This commit adds a new action to the user context menu allowing to move the selected user to your own channel (given enough permissions). While this is a decent workaround, the end goal will be to remove this action and replace it with a dedicated dialog to choose the channel a user will be moved to. See #4642 --- src/mumble/MainWindow.cpp | 17 ++++++++++++++--- src/mumble/MainWindow.h | 1 + src/mumble/MainWindow.ui | 8 ++++++++ 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/mumble/MainWindow.cpp b/src/mumble/MainWindow.cpp index d4255dbe9..556ab0ee6 100644 --- a/src/mumble/MainWindow.cpp +++ b/src/mumble/MainWindow.cpp @@ -1662,10 +1662,9 @@ void MainWindow::qmUser_aboutToShow() { qmUser->clear(); - if (self && p && !isSelf) { + if (self && p && !isSelf && self->cChannel != p->cChannel) { qmUser->addAction(qaUserJoin); - qaUserJoin->setEnabled(self->cChannel != p->cChannel); - + qmUser->addAction(qaUserMove); qmUser->addSeparator(); } @@ -2344,6 +2343,18 @@ void MainWindow::on_qaUserJoin_triggered() { } } +void MainWindow::on_qaUserMove_triggered() { + const ClientUser *user = getContextMenuUser(); + + if (user) { + const Channel *channel = ClientUser::get(Global::get().uiSession)->cChannel; + + if (channel) { + Global::get().sh->joinChannel(user->uiSession, channel->iId); + } + } +} + void MainWindow::on_qaChannelListen_triggered() { Channel *c = getContextMenuChannel(); diff --git a/src/mumble/MainWindow.h b/src/mumble/MainWindow.h index 00daee90e..dccdfd126 100644 --- a/src/mumble/MainWindow.h +++ b/src/mumble/MainWindow.h @@ -260,6 +260,7 @@ public slots: void qmChannel_aboutToShow(); void on_qaChannelJoin_triggered(); void on_qaUserJoin_triggered(); + void on_qaUserMove_triggered(); void on_qaChannelListen_triggered(); void on_qaChannelAdd_triggered(); void on_qaChannelRemove_triggered(); diff --git a/src/mumble/MainWindow.ui b/src/mumble/MainWindow.ui index ad6c98108..da0346153 100644 --- a/src/mumble/MainWindow.ui +++ b/src/mumble/MainWindow.ui @@ -1034,6 +1034,14 @@ the channel's context menu. Joins the channel of this user. + + + M&ove To Own Channel + + + Moves this user to your current channel. + + true