r21729 by jghali - #14546: File dialog does not retain filename when changing PDF export path

scribus-commit scribus-commit at lists.scribus.net
Fri Jan 13 20:34:23 UTC 2017


Author: jghali
Date: Fri Jan 13 20:34:23 2017
New Revision: 21729

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21729
Log:
#14546: File dialog does not retain filename when changing PDF export path

Modified:
    trunk/Scribus/scribus/ui/pdfexportdialog.cpp

Modified: trunk/Scribus/scribus/ui/pdfexportdialog.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21729&path=/trunk/Scribus/scribus/ui/pdfexportdialog.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/pdfexportdialog.cpp	(original)
+++ trunk/Scribus/scribus/ui/pdfexportdialog.cpp	Fri Jan 13 20:34:23 2017
@@ -233,9 +233,19 @@
 void PDFExportDialog::ChangeFile()
 {
 	PrefsContext* dirs = PrefsManager::instance()->prefsFile->getContext("dirs");
-	QString wdir = dirs->get("pdf", ".");
+	QString wdir  = dirs->get("pdf", ScPaths::userDocumentDir());
+
+	QString wfile = QDir::fromNativeSeparators(fileNameLineEdit->text()); 
+	if (!wfile.isEmpty())
+	{
+		QFileInfo fInfo(wfile);
+		QString absPath = fInfo.absolutePath(); // Yes, we mean the file directory here
+		if (QDir(absPath).exists())
+			wdir = wfile;
+	}
+
 	QString d = QFileDialog::getSaveFileName(this, tr("Save As"), wdir, tr("PDF Files (*.pdf);;All Files (*)"), 0, QFileDialog::DontConfirmOverwrite);
-	if (d.length()>0)
+	if (d.length() > 0)
 	{
 		QString fn(QDir::fromNativeSeparators(d));
 		dirs->set("pdf", fn.left(fn.lastIndexOf("/")));




More information about the scribus-commit mailing list