From ae53e505c472cf6e349e0f3cd6171d2e8d34126c Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Fri, 25 Mar 2016 01:58:00 +0200 Subject: [PATCH] Save image with correct extension --HG-- branch : feature --- src/app/valentina/dialogs/dialogpatternproperties.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/app/valentina/dialogs/dialogpatternproperties.cpp b/src/app/valentina/dialogs/dialogpatternproperties.cpp index 3970ae562..8664171fd 100644 --- a/src/app/valentina/dialogs/dialogpatternproperties.cpp +++ b/src/app/valentina/dialogs/dialogpatternproperties.cpp @@ -694,10 +694,14 @@ void DialogPatternProperties::SaveImage() QByteArray byteArray; byteArray.append(doc->GetImage().toUtf8()); QByteArray ba = QByteArray::fromBase64(byteArray); - QString extension = "." + doc->GetImageExtension(); - QString filename = QFileDialog::getSaveFileName(this, tr("Save File")); - QFile file(filename + extension); + QString filter = "Images (*" + extension + ")"; + QString filename = QFileDialog::getSaveFileName(this, tr("Save File"), "untitled", filter, &filter); + if (not filename.endsWith(extension.toUpper())) + { + filename.append(extension); + } + QFile file(filename); if (file.open(QIODevice::WriteOnly)) { file.write(ba);