Skip to content

Commit

Permalink
Only show successful debug archive creation dialog if it has indeed b…
Browse files Browse the repository at this point in the history
…een successful

Signed-off-by: Claudio Cambra <[email protected]>
  • Loading branch information
claucambra committed Apr 1, 2024
1 parent e5cef0d commit 4e713c3
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/gui/generalsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ QVector<ZipEntry> createDebugArchiveFileList()
return list;
}

void createDebugArchive(const QString &filename)
bool createDebugArchive(const QString &filename)

Check warning on line 110 in src/gui/generalsettings.cpp

View workflow job for this annotation

GitHub Actions / build

src/gui/generalsettings.cpp:110:6 [modernize-use-trailing-return-type]

use a trailing return type for this function
{
const auto fileInfo = QFileInfo(filename);
const auto dirInfo = QFileInfo(fileInfo.dir().absolutePath());
Expand All @@ -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();
Expand All @@ -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 {
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 4e713c3

Please sign in to comment.