mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
Myself guard for message confirmation
This commit is contained in:
committed by
Mat Sutcliffe
parent
eca5a36afd
commit
861fe2e401
@@ -22,6 +22,7 @@
|
||||
#include <QFileInfo>
|
||||
#include <QStandardPaths>
|
||||
#include <QTimer>
|
||||
#include <QPointer>
|
||||
#include <QDesktopServices>
|
||||
|
||||
using namespace BlackMisc;
|
||||
@@ -100,6 +101,8 @@ namespace BlackGui
|
||||
{
|
||||
const CRemoteFile rf = this->getRemoteFileSelected();
|
||||
const QString downloadFileName = CFileUtils::appendFilePathsAndFixUnc(this->downloadDir(), rf.getName());
|
||||
QPointer<CInstallXSwiftBusComponent> myself(this);
|
||||
|
||||
QFile downloadFile(downloadFileName);
|
||||
if (!downloadFile.exists())
|
||||
{
|
||||
@@ -164,6 +167,7 @@ namespace BlackGui
|
||||
const CStatusMessage msg = CStatusMessage(this, CLogCategory::validation()).info(u"Uncompressed xSwiftBus in '%1'") << xSwiftBusDirectory;
|
||||
this->showOverlayMessagesWithConfirmation(msg, false, "Delete downloaded file?", [ = ]
|
||||
{
|
||||
if (!myself) { return; }
|
||||
QFile downloadFile(downloadFileName);
|
||||
if (!downloadFile.exists()) { return; } // removed in meantime
|
||||
const bool removed = downloadFile.remove();
|
||||
|
||||
Reference in New Issue
Block a user