r16238 by fschmid - Fixed Bug #9526: SVG export crashes Scribus.

scribus-commit scribus-commit at lists.scribus.net
Mon Jan 10 21:33:51 CET 2011


Author: fschmid
Date: Mon Jan 10 20:33:51 2011
New Revision: 16238

URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=16238
Log:
Fixed Bug #9526: SVG export crashes Scribus.
Export our layers in a way that Inkscape recognizes them.

Modified:
    trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp

Modified: trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16238&path=/trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp Mon Jan 10 20:33:51 2011
@@ -28,7 +28,7 @@
 #include <QBuffer>
 #include <QList>
 #include <QCheckBox>
-#include <QSharedPointer>
+#include <QScopedPointer>
 
 #include "svgexplugin.h"
 
@@ -124,7 +124,7 @@
 	{
 		PrefsContext* prefs = PrefsManager::instance()->prefsFile->getPluginContext("svgex");
 		QString wdir = prefs->get("wdir", ".");
-		QSharedPointer<CustomFDialog> openDia( new CustomFDialog(doc->scMW(), wdir, QObject::tr("Save as"), QObject::tr("%1;;All Files (*)").arg(FormatsManager::instance()->extensionsForFormat(FormatsManager::SVG)), fdHidePreviewCheckBox) );
+		QScopedPointer<CustomFDialog> openDia( new CustomFDialog(doc->scMW(), wdir, QObject::tr("Save as"), QObject::tr("%1;;All Files (*)").arg(FormatsManager::instance()->extensionsForFormat(FormatsManager::SVG)), fdHidePreviewCheckBox) );
 		openDia->setSelection(getFileNameByPage(doc, doc->currentPage()->pageNr(), "svg"));
 		openDia->setExtension("svg");
 		openDia->setZipExtension("svgz");
@@ -157,7 +157,6 @@
 		Options.inlineImages = inlineImages->isChecked();
 		Options.exportPageBackground = exportBack->isChecked();
 		Options.compressFile = compress->isChecked();
-		openDia.clear();
 
 		if (fileName.isEmpty())
 			return true;
@@ -209,6 +208,7 @@
 	docElement.setAttribute("height", FToStr(pageHeight)+"pt");
 	docElement.setAttribute("viewBox", QString("0 0 %1 %2").arg(pageWidth).arg(pageHeight));
 	docElement.setAttribute("xmlns", "http://www.w3.org/2000/svg");
+	docElement.setAttribute("xmlns:inkscape","http://www.inkscape.org/namespaces/inkscape");
 	docElement.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink");
 	docElement.setAttribute("version","1.1");
 	if (!m_Doc->documentInfo().title().isEmpty())
@@ -292,6 +292,8 @@
 
 	layerGroup = docu.createElement("g");
 	layerGroup.setAttribute("id", layer.Name);
+	layerGroup.setAttribute("inkscape:label", layer.Name);
+	layerGroup.setAttribute("inkscape:groupmode", "layer");
 	if (layer.transparency != 1.0)
 		layerGroup.setAttribute("opacity", FToStr(layer.transparency));
 	for(int j = 0; j < Items.count(); ++j)




More information about the scribus-commit mailing list