Do not allow closing ScanProgressDialog

BUG: 393275
This commit is contained in:
Andrius Štikonas 2018-04-19 14:29:22 +03:00
parent 3054fa1599
commit 2482eba7de
2 changed files with 10 additions and 3 deletions

View File

@ -18,6 +18,8 @@
#include "gui/scanprogressdialog.h" #include "gui/scanprogressdialog.h"
#include <QCloseEvent>
#include <KLocalizedString> #include <KLocalizedString>
ScanProgressDialog::ScanProgressDialog(QWidget* parent) : ScanProgressDialog::ScanProgressDialog(QWidget* parent) :
@ -30,6 +32,11 @@ ScanProgressDialog::ScanProgressDialog(QWidget* parent) :
setAttribute(Qt::WA_ShowModal, true); setAttribute(Qt::WA_ShowModal, true);
} }
void ScanProgressDialog::closeEvent(QCloseEvent* e)
{
e->ignore();
}
void ScanProgressDialog::setDeviceName(const QString& d) void ScanProgressDialog::setDeviceName(const QString& d)
{ {
if (d.isEmpty()) if (d.isEmpty())
@ -40,7 +47,7 @@ void ScanProgressDialog::setDeviceName(const QString& d)
void ScanProgressDialog::showEvent(QShowEvent* e) void ScanProgressDialog::showEvent(QShowEvent* e)
{ {
setCancelButton(0); setCancelButton(nullptr);
QProgressDialog::showEvent(e); QProgressDialog::showEvent(e);
} }

View File

@ -15,8 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.* * along with this program. If not, see <http://www.gnu.org/licenses/>.*
*************************************************************************/ *************************************************************************/
#if !defined(SCANPROGRESSDIALOG_H) #ifndef SCANPROGRESSDIALOG_H
#define SCANPROGRESSDIALOG_H #define SCANPROGRESSDIALOG_H
#include <QProgressDialog> #include <QProgressDialog>
@ -34,6 +33,7 @@ public:
void setDeviceName(const QString& d); void setDeviceName(const QString& d);
protected: protected:
void closeEvent(QCloseEvent* e) override;
void showEvent(QShowEvent* e) override; void showEvent(QShowEvent* e) override;
}; };