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
This commit is contained in:
Hartmnt 2024-02-15 17:28:51 +00:00
parent cd7b8ef19f
commit f63b7b42db
3 changed files with 23 additions and 3 deletions

View File

@ -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();

View File

@ -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();

View File

@ -1034,6 +1034,14 @@ the channel's context menu.</string>
<string>Joins the channel of this user.</string>
</property>
</action>
<action name="qaUserMove">
<property name="text">
<string>M&amp;ove To Own Channel</string>
</property>
<property name="toolTip">
<string>Moves this user to your current channel.</string>
</property>
</action>
<action name="qaUserLocalIgnoreTTS">
<property name="checkable">
<bool>true</bool>