Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add confirmation box before forgetting a room #331

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions client/roomlistdock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <QtWidgets/QMenu>
#include <QtWidgets/QStyledItemDelegate>
#include <QtWidgets/QInputDialog>
#include <QtWidgets/QMessageBox>

#include "models/roomlistmodel.h"
#include "quaternionroom.h"
Expand Down Expand Up @@ -186,10 +187,15 @@ RoomListDock::RoomListDock(QWidget* parent)
forgetAction =
roomContextMenu->addAction(QIcon::fromTheme("irc-remove-operator"),
tr("Forget room"), this, [this] {
if (auto room = getSelectedRoom())
{
Q_ASSERT(room->connection());
room->connection()->forgetRoom(room->id());
if (auto room = getSelectedRoom()) {
QMessageBox confirmBox(QMessageBox::Question,
tr("Are you sure?"),
tr("Do you want to forget the room %1").arg(room->displayName()),
QMessageBox::Yes|QMessageBox::No, this);
if (confirmBox.exec() == QMessageBox::No)
;
else
room->connection()->forgetRoom(room->id());
}
});

Expand Down