r18311 by fschmid - Uniconvertor Importer: handle temp file correctly.

scribus-commit scribus-commit at lists.scribus.net
Mon Jun 10 19:10:44 UTC 2013


Author: fschmid
Date: Mon Jun 10 19:10:44 2013
New Revision: 18311

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18311
Log:
Uniconvertor Importer: handle temp file correctly.

Modified:
    trunk/Scribus/scribus/plugins/import/uniconvertor/uniconvplugin.cpp

Modified: trunk/Scribus/scribus/plugins/import/uniconvertor/uniconvplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18311&path=/trunk/Scribus/scribus/plugins/import/uniconvertor/uniconvplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/uniconvertor/uniconvplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/uniconvertor/uniconvplugin.cpp Mon Jun 10 19:10:44 2013
@@ -102,7 +102,7 @@
 	fmt.trName = name;
 	fmt.formatId = 0;
 	fmt.filter = name + " (" +  FormatsManager::instance()->extensionListForFormat( FormatsManager::UNICONV, 0)+")"; // QFileDialog filter
-	fmt.fileExtensions = QStringList() << "cdt" << "ccx" << "aff" << "sk" << "sk1" << "plt" << "dxf" << "dst" << "pes" << "exp" << "pcs";
+	fmt.fileExtensions = QStringList() << "cdt" << "ccx" << "cmx" <<"aff" << "sk" << "sk1" << "plt" << "dxf" << "dst" << "pes" << "exp" << "pcs";
 	fmt.load = true;
 	fmt.save = false;
 	//TODO: fmt.mimeTypes = QStringList(""); // MIME types
@@ -135,12 +135,10 @@
 
 	//Get a temporary filename ending in .svg (sadly
 	//uniconvertor has no other way of specifying the output format
-	QTemporaryFile *tempFile = 
-		new QTemporaryFile(QDir::tempPath() + "/scribus_uniconv_XXXXXX");
+	QTemporaryFile *tempFile = new QTemporaryFile(QDir::tempPath() + "/scribus_uniconv_XXXXXX.svg");
 	tempFile->open();
-	QString tempFileName = tempFile->fileName() + ".svg";
+	QString tempFileName = tempFile->fileName();
 	tempFile->close();
-	delete tempFile;
 
 	//prepare arguments for uniconvertor call
 	QStringList arguments;
@@ -160,6 +158,7 @@
 			"File->Preferences->External Tools may be incorrect or the "
 			"software has been uninstalled since preferences "
 			"were set. (%1)").arg(uniconv.errorString()));
+		delete tempFile;
 		return false;
 	}
 	if (!uniconv.waitForFinished(120000)) {
@@ -167,6 +166,7 @@
 		QMessageBox::warning(mw, CommonStrings::trWarning,
 			tr("Uniconvertor did not exit correctly: %1").arg(
 			uniconv.errorString()).arg(QString(uniconv.readAll())));
+		delete tempFile;
 		return false;
 	}
 	if (uniconv.exitCode()) {
@@ -174,6 +174,7 @@
 		QMessageBox::warning(mw, CommonStrings::trWarning,
 			tr("Uniconvertor failed to convert the file: %1").arg(
 				QString(uniconv.readAll())));
+		delete tempFile;
 		return false;
 	}
 	
@@ -181,9 +182,10 @@
 	const FileFormat *fmt = LoadSavePlugin::getFormatByExt("svg");
 	if (!fmt) {
 		QMessageBox::warning(mw, CommonStrings::trWarning, tr("The SVG Import plugin could not be found"), 1, 0, 0);
+		delete tempFile;
 		return false;
 	}
-	qDebug() << "Loading file!";
 	fmt->loadFile(tempFileName, flags);
+	delete tempFile;
 	return true;
 }




More information about the scribus-commit mailing list