r23259 by jghali - Code style fixes

scribus-commit scribus-commit at lists.scribus.net
Wed Oct 16 01:41:09 UTC 2019


Author: jghali
Date: Wed Oct 16 01:41:09 2019
New Revision: 23259

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23259
Log:
Code style fixes

Modified:
    trunk/Scribus/scribus/plugins/import/pdf/importpdfplugin.cpp

Modified: trunk/Scribus/scribus/plugins/import/pdf/importpdfplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23259&path=/trunk/Scribus/scribus/plugins/import/pdf/importpdfplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pdf/importpdfplugin.cpp	(original)
+++ trunk/Scribus/scribus/plugins/import/pdf/importpdfplugin.cpp	Wed Oct 16 01:41:09 2019
@@ -160,15 +160,12 @@
 		PrefsContext* prefs = PrefsManager::instance().prefsFile->getPluginContext("importpdf");
 		QString wdir = prefs->get("wdir", ".");
 		CustomFDialog diaf(ScCore->primaryMainWindow(), wdir, QObject::tr("Open"), tr("All Supported Formats")+" (*.pdf *.PDF);;All Files (*)");
-		if (diaf.exec())
-		{
-			fileName = diaf.selectedFile();
-			prefs->set("wdir", fileName.left(fileName.lastIndexOf("/")));
-		}
-		else
+		if (diaf.exec() != QDialog::Accepted)
 			return false;
-	}
-	m_Doc=ScCore->primaryMainWindow()->doc;
+		fileName = diaf.selectedFile();
+		prefs->set("wdir", fileName.left(fileName.lastIndexOf("/")));
+	}
+	m_Doc =ScCore->primaryMainWindow()->doc;
 	UndoTransaction activeTransaction;
 	bool emptyDoc = (m_Doc == nullptr);
 	bool hasCurrentPage = (m_Doc && m_Doc->currentPage());
@@ -188,34 +185,32 @@
 	QStringList exts = QStringList() << "eps" << "epsf" << "epsi" << "eps2" << "eps3" << "epi" << "ept" << "ps" << "ai";
 	if (exts.contains(fi.suffix().toLower()))
 	{
-		if (ScCore->haveGS())
-		{
-			// Destill the eps/ps with ghostscript to get a clean pdf file
-			bool cancel = false;
-			QString errFile = getShortPathName(ScPaths::tempFileDir())+ "/ps.err";
-			cleanFile = getShortPathName(ScPaths::tempFileDir()) + "/" + fi.baseName() + ".pdf";
-			QStringList args;
-			args.append( "-q" );
-			args.append( "-dNOPAUSE" );
-			args.append( "-sDEVICE=pdfwrite" );
-			args.append( "-dBATCH" );
-			args.append( "-dSAFER" );
-			if (extensionIndicatesEPS(fi.suffix().toLower()))
-				args.append("-dEPSCrop");
-			args.append("-dCompatibilityLevel=1.4");
-			args.append( QString("-sOutputFile=%1").arg(QDir::toNativeSeparators(cleanFile)) );
-			args.append( QDir::toNativeSeparators(fileName) );
-			System(getShortPathName(PrefsManager::instance().ghostscriptExecutable()), args, errFile, errFile, &cancel);
-			args.clear();
-			isCleanedFile = true;
-		}
-		else
+		if (!ScCore->haveGS())
 		{
 			qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
 			ScMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, tr("The Import plugin cannot handle Postscript files"));
 			qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
 			return false;
 		}
+
+		// Destill the eps/ps with ghostscript to get a clean pdf file
+		bool cancel = false;
+		QString errFile = getShortPathName(ScPaths::tempFileDir())+ "/ps.err";
+		cleanFile = getShortPathName(ScPaths::tempFileDir()) + "/" + fi.baseName() + ".pdf";
+		QStringList args;
+		args.append( "-q" );
+		args.append( "-dNOPAUSE" );
+		args.append( "-sDEVICE=pdfwrite" );
+		args.append( "-dBATCH" );
+		args.append( "-dSAFER" );
+		if (extensionIndicatesEPS(fi.suffix().toLower()))
+			args.append("-dEPSCrop");
+		args.append("-dCompatibilityLevel=1.4");
+		args.append( QString("-sOutputFile=%1").arg(QDir::toNativeSeparators(cleanFile)) );
+		args.append( QDir::toNativeSeparators(fileName) );
+		System(getShortPathName(PrefsManager::instance().ghostscriptExecutable()), args, errFile, errFile, &cancel);
+		args.clear();
+		isCleanedFile = true;
 	}
 	bool ret = false;
 	PdfPlug *dia = new PdfPlug(m_Doc, flags);




More information about the scribus-commit mailing list