From 3e95b51af66bada15a9381edc21047174235c3fa Mon Sep 17 00:00:00 2001 From: Lars Biskupek Date: Mon, 22 Feb 2021 12:50:49 +0100 Subject: [PATCH] Modifications to SaveFile-Dialog for "Save As PDF" Fixed a typo that prevented existing PDF files from being displayed in SaveFileDialog for PDFs. The way the file name for the PDF is generated has changed. If the project has already been saved, the PDF has the same file name (with .pdf of course); If not, the file name is generated from the project title (= same behavior as Save as - dialog for a .qet project file). --- sources/print/projectprintwindow.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sources/print/projectprintwindow.cpp b/sources/print/projectprintwindow.cpp index 3218feadb..37954a26e 100644 --- a/sources/print/projectprintwindow.cpp +++ b/sources/print/projectprintwindow.cpp @@ -95,13 +95,13 @@ void ProjectPrintWindow::launchDialog(QETProject *project, QPrinter::OutputForma QString ProjectPrintWindow::docName(QETProject *project) { QString doc_name; - if (!project->title().isEmpty()) { - doc_name = project->title(); - } else if (!project->filePath().isEmpty()) { - doc_name = QFileInfo(project->filePath()).baseName(); + if (!project->filePath().isEmpty()) { + doc_name = QFileInfo(project->filePath()).baseName(); + } else if (!project->title().isEmpty()) { + doc_name = project->title(); + doc_name = QET::stringToFileName(doc_name); } - doc_name = QET::stringToFileName(doc_name); if (doc_name.isEmpty()) { doc_name = tr("projet", "string used to generate a filename"); } @@ -666,7 +666,7 @@ QList ProjectPrintWindow::selectedDiagram() const void ProjectPrintWindow::exportToPDF() { - auto file_name = QFileDialog::getSaveFileName(this, tr("Exporter sous : "), m_printer->outputFileName(), tr("Fichier (*.pdf)")); + auto file_name = QFileDialog::getSaveFileName(this, tr("Exporter sous : "), m_printer->outputFileName(), tr("Fichier (*.pdf)")); if (file_name.isEmpty()) { return; }