Skip to content

Commit

Permalink
feat: add confirmation box before forgetting a room
Browse files Browse the repository at this point in the history
  • Loading branch information
marcdeop committed Nov 25, 2018
1 parent 72bf171 commit 0cd58be
Showing 1 changed file with 10 additions and 4 deletions.
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

0 comments on commit 0cd58be

Please sign in to comment.