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 <claudio.cambra@nextcloud.com>
  • Loading branch information
claucambra authored and camilasan committed Apr 23, 2024
1 parent f288fdf commit 4a4ce04
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)
{
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 4a4ce04

Please sign in to comment.