mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-19 14:50:53 +01:00
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).
This commit is contained in:
@@ -95,13 +95,13 @@ void ProjectPrintWindow::launchDialog(QETProject *project, QPrinter::OutputForma
|
|||||||
QString ProjectPrintWindow::docName(QETProject *project)
|
QString ProjectPrintWindow::docName(QETProject *project)
|
||||||
{
|
{
|
||||||
QString doc_name;
|
QString doc_name;
|
||||||
if (!project->title().isEmpty()) {
|
if (!project->filePath().isEmpty()) {
|
||||||
doc_name = project->title();
|
doc_name = QFileInfo(project->filePath()).baseName();
|
||||||
} else if (!project->filePath().isEmpty()) {
|
} else if (!project->title().isEmpty()) {
|
||||||
doc_name = QFileInfo(project->filePath()).baseName();
|
doc_name = project->title();
|
||||||
|
doc_name = QET::stringToFileName(doc_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
doc_name = QET::stringToFileName(doc_name);
|
|
||||||
if (doc_name.isEmpty()) {
|
if (doc_name.isEmpty()) {
|
||||||
doc_name = tr("projet", "string used to generate a filename");
|
doc_name = tr("projet", "string used to generate a filename");
|
||||||
}
|
}
|
||||||
@@ -666,7 +666,7 @@ QList<Diagram *> ProjectPrintWindow::selectedDiagram() const
|
|||||||
|
|
||||||
void ProjectPrintWindow::exportToPDF()
|
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()) {
|
if (file_name.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user