r18906 by fschmid - Fixed Bug #12141: Scribus can't open SLA.GZ files anymore

scribus-commit scribus-commit at lists.scribus.net
Thu Mar 13 21:29:07 UTC 2014


Author: fschmid
Date: Thu Mar 13 21:29:07 2014
New Revision: 18906

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18906
Log:
Fixed Bug #12141: Scribus can't open SLA.GZ files anymore

Added:
    trunk/Scribus/scribus/qtiocompressor.cpp
      - copied unchanged from r18903, trunk/Scribus/scribus/plugins/import/xar/qtiocompressor.cpp
    trunk/Scribus/scribus/qtiocompressor.h
      - copied unchanged from r18903, trunk/Scribus/scribus/plugins/import/xar/qtiocompressor.h
Modified:
    trunk/Scribus/scribus/CMakeLists.txt
    trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp
    trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
    trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.h
    trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
    trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
    trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.h
    trunk/Scribus/scribus/plugins/import/xar/CMakeLists.txt
    trunk/Scribus/scribus/plugins/import/xar/qtiocompressor.cpp
    trunk/Scribus/scribus/plugins/import/xar/qtiocompressor.h

Modified: trunk/Scribus/scribus/CMakeLists.txt
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18906&path=/trunk/Scribus/scribus/CMakeLists.txt
==============================================================================
--- trunk/Scribus/scribus/CMakeLists.txt (original)
+++ trunk/Scribus/scribus/CMakeLists.txt Thu Mar 13 21:29:07 2014
@@ -244,6 +244,7 @@
   pluginmanager.h
   prefsmanager.h
   pslib.h
+  qtiocompressor.h
   sampleitem.h
   scgtplugin.h
   schelptreemodel.h
@@ -622,6 +623,7 @@
   prefsreader.cpp
   prefstable.cpp
   pslib.cpp
+  qtiocompressor.cpp
   rawimage.cpp
   rc4.c
   sampleitem.cpp

Modified: trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18906&path=/trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp Thu Mar 13 21:29:07 2014
@@ -14,6 +14,7 @@
 #include "prefsmanager.h"
 #include "pageitem_latexframe.h"
 #include "pageitem_group.h"
+#include "qtiocompressor.h"
 #include "scconfig.h"
 #include "scclocale.h"
 #include "scribusdoc.h"
@@ -130,11 +131,14 @@
 	QByteArray docBytes("");
 	if(fileName.right(2) == "gz")
 	{
-		if (!ScGzFile::readFromFile(fileName, docBytes, 4096))
-		{
-			// FIXME: Needs better error return
+		QFile file(fileName);
+		QtIOCompressor compressor(&file);
+		compressor.setStreamFormat(QtIOCompressor::GzipFormat);
+		compressor.open(QIODevice::ReadOnly);
+		docBytes = compressor.read(1024);
+		compressor.close();
+		if (docBytes.isEmpty())
 			return false;
-		}
 	}
 	else
 	{
@@ -151,11 +155,14 @@
 	QByteArray docBytes("");
 	if(fileName.right(2) == "gz")
 	{
-		if (!ScGzFile::readFromFile(fileName, docBytes))
-		{
-			// FIXME: Needs better error return
+		QFile file(fileName);
+		QtIOCompressor compressor(&file);
+		compressor.setStreamFormat(QtIOCompressor::GzipFormat);
+		compressor.open(QIODevice::ReadOnly);
+		docBytes = compressor.readAll();
+		compressor.close();
+		if (docBytes.isEmpty())
 			return QString::null;
-		}
 	}
 	else
 	{

Modified: trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18906&path=/trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp Thu Mar 13 21:29:07 2014
@@ -15,6 +15,7 @@
 #include "pageitem_latexframe.h"
 #include "pageitem_table.h"
 #include "prefsmanager.h"
+#include "qtiocompressor.h"
 #include "scclocale.h"
 #include "scconfig.h"
 #include "sccolorengine.h"
@@ -115,11 +116,14 @@
 	QByteArray docBytes("");
 	if(fileName.right(2) == "gz")
 	{
-		if (!ScGzFile::readFromFile(fileName, docBytes, 4096))
-		{
-			// FIXME: Needs better error return
+		QFile file(fileName);
+		QtIOCompressor compressor(&file);
+		compressor.setStreamFormat(QtIOCompressor::GzipFormat);
+		compressor.open(QIODevice::ReadOnly);
+		docBytes = compressor.read(1024);
+		compressor.close();
+		if (docBytes.isEmpty())
 			return false;
-		}
 	}
 	else
 	{
@@ -148,12 +152,15 @@
 	QIODevice* ioDevice = 0;
 	if(fileName.right(2) == "gz")
 	{
-		ioDevice = new ScGzFile(fileName);
-		if (!ioDevice->open(QIODevice::ReadOnly))
-		{
-			delete ioDevice;
+		aFile.setFileName(fileName);
+		QtIOCompressor *compressor = new QtIOCompressor(&aFile);
+		compressor->setStreamFormat(QtIOCompressor::GzipFormat);
+		if (!compressor->open(QIODevice::ReadOnly))
+		{
+			delete compressor;
 			return NULL;
 		}
+		ioDevice = compressor;
 	}
 	else
 	{

Modified: trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18906&path=/trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.h
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.h (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.h Thu Mar 13 21:29:07 2014
@@ -131,6 +131,7 @@
 
 		int itemCount;
 		int itemCountM;
+		QFile aFile;
 };
 
 extern "C" PLUGIN_API int scribus134format_getPluginAPIVersion();

Modified: trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18906&path=/trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp Thu Mar 13 21:29:07 2014
@@ -13,6 +13,7 @@
 #include "ui/missing.h"
 #include "pageitem_group.h"
 #include "prefsmanager.h"
+#include "qtiocompressor.h"
 #include "scconfig.h"
 #include "scribusdoc.h"
 #include "scribusview.h"
@@ -111,11 +112,14 @@
 	QByteArray docBytes("");
 	if(fileName.right(2) == "gz")
 	{
-		if (!ScGzFile::readFromFile(fileName, docBytes, 4096))
-		{
-			// FIXME: Needs better error return
+		QFile file(fileName);
+		QtIOCompressor compressor(&file);
+		compressor.setStreamFormat(QtIOCompressor::GzipFormat);
+		compressor.open(QIODevice::ReadOnly);
+		docBytes = compressor.read(1024);
+		compressor.close();
+		if (docBytes.isEmpty())
 			return false;
-		}
 	}
 	else
 	{
@@ -132,11 +136,14 @@
 	QByteArray docBytes("");
 	if(fileName.right(2) == "gz")
 	{
-		if (!ScGzFile::readFromFile(fileName, docBytes))
-		{
-			// FIXME: Needs better error return
+		QFile file(fileName);
+		QtIOCompressor compressor(&file);
+		compressor.setStreamFormat(QtIOCompressor::GzipFormat);
+		compressor.open(QIODevice::ReadOnly);
+		docBytes = compressor.readAll();
+		compressor.close();
+		if (docBytes.isEmpty())
 			return QString::null;
-		}
 	}
 	else
 	{

Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18906&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp Thu Mar 13 21:29:07 2014
@@ -16,6 +16,7 @@
 #include "pageitem_latexframe.h"
 #include "pageitem_noteframe.h"
 #include "prefsmanager.h"
+#include "qtiocompressor.h"
 #include "scclocale.h"
 #include "scconfig.h"
 #include "sccolorengine.h"
@@ -123,11 +124,14 @@
 	QByteArray docBytes("");
 	if(fileName.right(2) == "gz")
 	{
-		if (!ScGzFile::readFromFile(fileName, docBytes, 1024))
-		{
-			// FIXME: Needs better error return
+		QFile file(fileName);
+		QtIOCompressor compressor(&file);
+		compressor.setStreamFormat(QtIOCompressor::GzipFormat);
+		compressor.open(QIODevice::ReadOnly);
+		docBytes = compressor.read(1024);
+		compressor.close();
+		if (docBytes.isEmpty())
 			return false;
-		}
 	}
 	else
 	{
@@ -152,12 +156,15 @@
 	QIODevice* ioDevice = 0;
 	if(fileName.right(2) == "gz")
 	{
-		ioDevice = new ScGzFile(fileName);
-		if (!ioDevice->open(QIODevice::ReadOnly))
-		{
-			delete ioDevice;
+		aFile.setFileName(fileName);
+		QtIOCompressor *compressor = new QtIOCompressor(&aFile);
+		compressor->setStreamFormat(QtIOCompressor::GzipFormat);
+		if (!compressor->open(QIODevice::ReadOnly))
+		{
+			delete compressor;
 			return NULL;
 		}
+		ioDevice = compressor;
 	}
 	else
 	{

Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18906&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.h
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.h (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.h Thu Mar 13 21:29:07 2014
@@ -214,6 +214,7 @@
 		double GrY;
 		QString clipPath;
 		bool isNewFormat;
+		QFile aFile;
 };
 
 extern "C" PLUGIN_API int scribus150format_getPluginAPIVersion();

Modified: trunk/Scribus/scribus/plugins/import/xar/CMakeLists.txt
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18906&path=/trunk/Scribus/scribus/plugins/import/xar/CMakeLists.txt
==============================================================================
--- trunk/Scribus/scribus/plugins/import/xar/CMakeLists.txt (original)
+++ trunk/Scribus/scribus/plugins/import/xar/CMakeLists.txt Thu Mar 13 21:29:07 2014
@@ -4,13 +4,13 @@
 )
 
 SET(IMPORTXAR_PLUGIN_MOC_CLASSES
-	qtiocompressor.h
+#	qtiocompressor.h
 	importxar.h
 	importxarplugin.h
 )
 
 SET(IMPORTXAR_PLUGIN_SOURCES
-	qtiocompressor.cpp
+#	qtiocompressor.cpp
 	importxar.cpp
 	importxarplugin.cpp
 )




More information about the scribus-commit mailing list