From ef200fee47bfef9eaea91a72224079e6b34ae33f Mon Sep 17 00:00:00 2001 From: defnax Date: Fri, 4 Dec 2020 23:33:16 +0100 Subject: [PATCH] Added to show a message box when closing the boards post composer --- .../src/gui/Posted/PostedCreatePostDialog.cpp | 10 +++++++++- retroshare-gui/src/gui/Posted/PostedCreatePostDialog.h | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.cpp b/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.cpp index 326db324a..6bbfa3e37 100644 --- a/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.cpp +++ b/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.cpp @@ -54,7 +54,7 @@ PostedCreatePostDialog::PostedCreatePostDialog(RsPosted *posted, const RsGxsGrou Settings->loadWidgetInformation(this); connect(ui->submitButton, SIGNAL(clicked()), this, SLOT(createPost())); - connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(close())); + connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject())); connect(ui->addPicButton, SIGNAL(clicked() ), this , SLOT(addPicture())); connect(ui->RichTextEditWidget, SIGNAL(textSizeOk(bool)),ui->submitButton, SLOT(setEnabled(bool))); @@ -299,3 +299,11 @@ void PostedCreatePostDialog::on_removeButton_clicked() ui->removeButton->hide(); ui->stackedWidgetPicture->setCurrentIndex(0); } + +void PostedCreatePostDialog::reject() +{ + if(QMessageBox::warning(nullptr,tr("Close this window?"),tr("Do you really want to discard your post?"),QMessageBox::Yes,QMessageBox::No) == QMessageBox::No) + return; + + QDialog::reject(); +} diff --git a/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.h b/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.h index ba3defd06..a62fe46c6 100644 --- a/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.h +++ b/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.h @@ -52,6 +52,7 @@ private slots: void addPicture(); void on_removeButton_clicked(); void fileHashingFinished(QList hashedFiles); + void reject(); void setPage(int viewMode); private: