r17529 by craig - Allow FileUnzip to extract to a specific path, rename tempImageFile to tempFile, its not just image related

scribus-commit scribus-commit at lists.scribus.net
Thu May 31 20:02:39 UTC 2012


Author: craig
Date: Thu May 31 20:02:39 2012
New Revision: 17529

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17529
Log:
Allow FileUnzip to extract to a specific path, rename tempImageFile to tempFile, its not just image related

Modified:
    trunk/Scribus/scribus/fileunzip.cpp
    trunk/Scribus/scribus/fileunzip.h

Modified: trunk/Scribus/scribus/fileunzip.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17529&path=/trunk/Scribus/scribus/fileunzip.cpp
==============================================================================
--- trunk/Scribus/scribus/fileunzip.cpp (original)
+++ trunk/Scribus/scribus/fileunzip.cpp Thu May 31 20:02:39 2012
@@ -84,17 +84,22 @@
 	zipFile = zipFilePath;
 }
 
-QString FileUnzip::getFile(QString name)
+QString FileUnzip::getFile(QString name, QString path)
 {
 	QString pwd = QDir::currentPath();
-	QTemporaryFile *tempImageFile = new QTemporaryFile(QDir::tempPath() + "/scribus_temp_zip_XXXXXX.dat");
-	if (tempImageFile == NULL)
+	QString outDir;
+	if (path.isNull())
+		outDir = QDir::tempPath();
+	else
+		outDir=path;
+	QTemporaryFile *tempFile = new QTemporaryFile(outDir + "/scribus_temp_zip_XXXXXX.dat");
+	if (tempFile == NULL)
 		return NULL;
-	tempImageFile->open();
-	QString fname = getLongPathName(tempImageFile->fileName());
-	tempImageFile->close();
-	tempFileList.append(tempImageFile);
-	QDir::setCurrent(QDir::tempPath());
+	tempFile->open();
+	QString fname = getLongPathName(tempFile->fileName());
+	tempFile->close();
+	tempFileList.append(tempFile);
+	QDir::setCurrent(outDir);
 	unzFile uf = unzOpenFile(zipFile);
 	int ret = do_extract_onefile(uf, name, fname, NULL);
 	unzClose(uf);

Modified: trunk/Scribus/scribus/fileunzip.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17529&path=/trunk/Scribus/scribus/fileunzip.h
==============================================================================
--- trunk/Scribus/scribus/fileunzip.h (original)
+++ trunk/Scribus/scribus/fileunzip.h Thu May 31 20:02:39 2012
@@ -48,7 +48,7 @@
 public:
 	FileUnzip(QString zipFilePath);
 	~FileUnzip();
-	QString getFile(QString name);
+	QString getFile(QString name, QString path=QString::null);
 };
 
 #endif




More information about the scribus-commit mailing list