mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-25 02:05:43 +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 <QFileInfo>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
#include <QPointer>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
|
|
||||||
using namespace BlackMisc;
|
using namespace BlackMisc;
|
||||||
@@ -100,6 +101,8 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
const CRemoteFile rf = this->getRemoteFileSelected();
|
const CRemoteFile rf = this->getRemoteFileSelected();
|
||||||
const QString downloadFileName = CFileUtils::appendFilePathsAndFixUnc(this->downloadDir(), rf.getName());
|
const QString downloadFileName = CFileUtils::appendFilePathsAndFixUnc(this->downloadDir(), rf.getName());
|
||||||
|
QPointer<CInstallXSwiftBusComponent> myself(this);
|
||||||
|
|
||||||
QFile downloadFile(downloadFileName);
|
QFile downloadFile(downloadFileName);
|
||||||
if (!downloadFile.exists())
|
if (!downloadFile.exists())
|
||||||
{
|
{
|
||||||
@@ -164,6 +167,7 @@ namespace BlackGui
|
|||||||
const CStatusMessage msg = CStatusMessage(this, CLogCategory::validation()).info(u"Uncompressed xSwiftBus in '%1'") << xSwiftBusDirectory;
|
const CStatusMessage msg = CStatusMessage(this, CLogCategory::validation()).info(u"Uncompressed xSwiftBus in '%1'") << xSwiftBusDirectory;
|
||||||
this->showOverlayMessagesWithConfirmation(msg, false, "Delete downloaded file?", [ = ]
|
this->showOverlayMessagesWithConfirmation(msg, false, "Delete downloaded file?", [ = ]
|
||||||
{
|
{
|
||||||
|
if (!myself) { return; }
|
||||||
QFile downloadFile(downloadFileName);
|
QFile downloadFile(downloadFileName);
|
||||||
if (!downloadFile.exists()) { return; } // removed in meantime
|
if (!downloadFile.exists()) { return; } // removed in meantime
|
||||||
const bool removed = downloadFile.remove();
|
const bool removed = downloadFile.remove();
|
||||||
|
|||||||
Reference in New Issue
Block a user