任务栏右键关闭可以关闭正在忙碌的备份还原工具的bug

This commit is contained in:
zhaominyong 2022-02-24 12:19:06 +08:00
parent 7b49452e03
commit 20ad966234
3 changed files with 14 additions and 4 deletions

View File

@ -8,7 +8,7 @@
#include <QtDBus>
#include <QMessageBox>
#include <QDesktopWidget>
#include <signal.h>
#include <unistd.h>
#include "qtsingleapplication/qtsingleapplication.h"
#include "../common/utils.h"
@ -176,3 +176,4 @@ void centerToScreen(QWidget* widget)
int y = widget->height();
widget->move(desk_x / 2 - x / 2 + desk_rect.left(), desk_y / 2 - y / 2 + desk_rect.top());
}

View File

@ -335,7 +335,7 @@ void MainDialog::umountBackupPartition()
intf.umountBackupPartition();
}
void MainDialog::closeBtn()
void MainDialog::closeEvent(QCloseEvent *e)
{
if (GlobelBackupInfo::inst().isBusy()) {
// 系统正忙,请稍等
@ -343,13 +343,20 @@ void MainDialog::closeBtn()
QObject::tr("It's busy, please wait"),
QObject::tr("Ok"));
e->ignore();
return;
}
if (GlobelBackupInfo::inst().hasBackupPartition())
umountBackupPartition();
this->close();
qApp->quit();
e->accept();
}
void MainDialog::closeBtn()
{
if (this->close()) {
qApp->quit();
}
}

View File

@ -21,6 +21,8 @@ public:
MainDialog(QWidget *parent = nullptr);
~MainDialog();
void closeEvent(QCloseEvent *e);
public slots:
void sltMessageReceived(const QString &msg);
void closeBtn();