summary refs log tree commit diff
path: root/src/dialogs
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2020-07-16 20:19:28 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2020-07-16 20:19:28 +0200
commitaa34576dfd5781ddd9a97522ca15084f8195045f (patch)
tree84d877719b9d855efdb2fced271c49c8b97dbd3a /src/dialogs
parentFix autolinking breaking on single quotes in href attribute (diff)
downloadnheko-aa34576dfd5781ddd9a97522ca15084f8195045f.tar.xz
Warn before kicking,banning,inviting,etc
Diffstat (limited to 'src/dialogs')
-rw-r--r--src/dialogs/UserProfile.cpp11
-rw-r--r--src/dialogs/UserProfile.h1
2 files changed, 12 insertions, 0 deletions
diff --git a/src/dialogs/UserProfile.cpp b/src/dialogs/UserProfile.cpp

index 3415b127..086dbb40 100644 --- a/src/dialogs/UserProfile.cpp +++ b/src/dialogs/UserProfile.cpp
@@ -1,6 +1,7 @@ #include <QHBoxLayout> #include <QLabel> #include <QListWidget> +#include <QMessageBox> #include <QShortcut> #include <QVBoxLayout> @@ -97,6 +98,14 @@ UserProfile::UserProfile(QWidget *parent) if (utils::localUser() != user_id) req.invite = {user_id.toStdString()}; + if (QMessageBox::question( + this, + tr("Confirm DM"), + tr("Do you really want to invite %1 (%2) to a direct chat?") + .arg(cache::displayName(roomId_, user_id)) + .arg(user_id)) != QMessageBox::Yes) + return; + emit ChatPage::instance()->createRoom(req); }); @@ -199,6 +208,8 @@ UserProfile::init(const QString &userId, const QString &roomId) { resetToDefaults(); + this->roomId_ = roomId; + auto displayName = cache::displayName(roomId, userId); userIdLabel_->setText(userId); diff --git a/src/dialogs/UserProfile.h b/src/dialogs/UserProfile.h
index 81276d2a..8129fdcf 100644 --- a/src/dialogs/UserProfile.h +++ b/src/dialogs/UserProfile.h
@@ -53,6 +53,7 @@ private: void resetToDefaults(); Avatar *avatar_; + QString roomId_; QLabel *userIdLabel_; QLabel *displayNameLabel_;