r24878 by craig - Rename fname variable to stop confusion of usage in href data

scribus-commit scribus-commit at lists.scribus.net
Mon Jan 31 21:33:36 UTC 2022


Author: craig
Date: Mon Jan 31 21:33:35 2022
New Revision: 24878

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24878
Log:
Rename fname variable to stop confusion of usage in href data

Modified:
    trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp

Modified: trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24878&path=/trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp	(original)
+++ trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp	Mon Jan 31 21:33:35 2022
@@ -1596,7 +1596,7 @@
 {
 	FPointArray clipPath;
 	QList<PageItem*> IElements;
-	QString fname = e.attribute("xlink:href");
+	QString hrefData = e.attribute("xlink:href"); //contains filename or xlink:href data:image/png embedded image
 	double baseX = m_Doc->currentPage()->xOffset();
 	double baseY = m_Doc->currentPage()->yOffset();
 	double x = e.attribute("x").isEmpty() ? 0.0 : parseUnit(e.attribute("x"));
@@ -1607,17 +1607,19 @@
 	parseClipPathAttr(e, clipPath);
 	int z = m_Doc->itemAdd(PageItem::ImageFrame, PageItem::Unspecified, baseX, baseY, w, h, 1, m_Doc->itemToolPrefs().imageFillColor, m_Doc->itemToolPrefs().imageStrokeColor);
 	PageItem* ite = m_Doc->Items->at(z);
-	if (!fname.isEmpty())
-	{
-		if (!fname.startsWith("data:"))
-			m_Doc->loadPict(fname, ite);
+	if (!hrefData.isEmpty())
+	{
+		//hrefData contains a filename
+		if (!hrefData.startsWith("data:"))
+			m_Doc->loadPict(hrefData, ite);
 		else
 		{
-			int startData = fname.indexOf(",");
-			QString dataType = fname.left(startData);
-			fname.remove(0, startData + 1);
+			//hrefData is embedded
+			int startData = hrefData.indexOf(",");
+			QString dataType = hrefData.left(startData);
+			hrefData.remove(0, startData + 1);
 			QByteArray ba;
-			ba.append(fname.toLatin1());
+			ba.append(hrefData.toLatin1());
 			if (dataType.contains("base64"))
 				ba = QByteArray::fromBase64(ba);
 			QTemporaryFile *tempFile = new QTemporaryFile(QDir::tempPath() + "/scribus_temp_svg_XXXXXX.png");




More information about the scribus-commit mailing list