From 30867ca3324e86a9d41130e260177c926636e3a3 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Mon, 1 Apr 2024 18:00:27 +0800 Subject: [PATCH] Only show successful debug archive creation dialog if it has indeed been successful Signed-off-by: Claudio Cambra --- src/gui/generalsettings.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/gui/generalsettings.cpp b/src/gui/generalsettings.cpp index 4d86c7c06d260..2112d386d2b2d 100644 --- a/src/gui/generalsettings.cpp +++ b/src/gui/generalsettings.cpp @@ -107,7 +107,7 @@ QVector createDebugArchiveFileList() return list; } -void createDebugArchive(const QString &filename) +bool createDebugArchive(const QString &filename) { const auto fileInfo = QFileInfo(filename); const auto dirInfo = QFileInfo(fileInfo.dir().absolutePath()); @@ -117,7 +117,7 @@ void createDebugArchive(const QString &filename) QObject::tr("Failed to create debug archive"), QObject::tr("Could not create debug archive in selected location!") ); - return; + return false; } const auto entries = createDebugArchiveFileList(); @@ -138,7 +138,9 @@ void createDebugArchive(const QString &filename) zip.prepareWriting("__nextcloud_client_buildinfo.txt", {}, {}, buildInfo.size()); zip.writeData(buildInfo, buildInfo.size()); zip.finishWriting(buildInfo.size()); + return true; } + } namespace OCC { @@ -520,8 +522,13 @@ void GeneralSettings::slotCreateDebugArchive() return; } - createDebugArchive(filename); - QMessageBox::information(this, tr("Debug Archive Created"), tr("Debug archive is created at %1").arg(filename)); + if (createDebugArchive(filename)) { + QMessageBox::information( + this, + tr("Debug Archive Created"), + tr("Debug archive is created at %1").arg(filename) + ); + } } void GeneralSettings::slotShowLegalNotice()