fixing save accepting .pres and no .pres extension in the name

This commit is contained in:
Chris Cochrun 2022-11-30 11:25:49 -06:00
parent 37c7038f6f
commit 5e7fde14c6
2 changed files with 9 additions and 2 deletions

View file

@ -122,7 +122,7 @@ Kirigami.ApplicationWindow {
defaultSuffix: ".pres"
selectExisting: false
onAccepted: {
save(saveFileDialog.fileUrl + ".pres");
save(saveFileDialog.fileUrl);
}
onRejected: {
print("Canceled")

View file

@ -557,7 +557,14 @@ bool ServiceItemModel::save(QUrl file) {
QString filename = file.toString().right(file.toString().size() - 7);
qDebug() << filename;
KTar tar(filename, "application/zstd");
QString tarname;
if (filename.endsWith(".pres")) {
qDebug() << "Perfect just go with it!";
tarname = filename;
} else
tarname = filename + ".pres";
KTar tar(tarname, "application/zstd");
if (tar.open(QIODevice::WriteOnly)) {
qDebug() << tar.isOpen();