r17370 by jghali - #10622: copy/paste of embedded bitmaps doesn't work

scribus-commit scribus-commit at lists.scribus.net
Sun Mar 11 02:58:13 UTC 2012


Author: jghali
Date: Sun Mar 11 02:58:13 2012
New Revision: 17370

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17370
Log:
#10622: copy/paste of embedded bitmaps doesn't work

Modified:
    branches/Version14x/Scribus/scribus/pageitem_desaxe.cpp

Modified: branches/Version14x/Scribus/scribus/pageitem_desaxe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17370&path=/branches/Version14x/Scribus/scribus/pageitem_desaxe.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/pageitem_desaxe.cpp (original)
+++ branches/Version14x/Scribus/scribus/pageitem_desaxe.cpp Sun Mar 11 02:58:13 2012
@@ -456,6 +456,44 @@
 
 class LoadPicture_body : public Action_body
 {
+	void begin (const Xml_string& tagname, Xml_attr attr)
+	{
+		PageItem* item = this->dig->top<PageItem>();
+		if (item->itemType() != PageItem::ImageFrame)
+			return;
+
+		bool    isInlineImage  = parseBool(attr.value("isInlineImage", QString()));
+		QString inlineImageExt = attr.value("inlineImageExt", QString());
+		if (!isInlineImage || inlineImageExt.isEmpty())
+			return;
+
+		QString imageData = attr.value("ImageData", QString());
+		if (imageData.isEmpty())
+			return;
+
+		QByteArray inlineImageData;
+		inlineImageData.append(imageData);
+		if (inlineImageData.size() <= 0)
+			return;
+
+		item->tempImageFile = new QTemporaryFile(QDir::tempPath() + "/scribus_temp_XXXXXX." + inlineImageExt);
+		item->tempImageFile->open();
+		QString tempFileName = getLongPathName(item->tempImageFile->fileName());
+		item->tempImageFile->close();
+
+		inlineImageData = qUncompress(QByteArray::fromBase64(inlineImageData));
+
+		QFile imageFile(tempFileName);
+		if (imageFile.open(QIODevice::WriteOnly))
+		{
+			imageFile.write(inlineImageData);
+			imageFile.close();
+
+			item->isInlineImage = true;
+			item->Pfile = tempFileName;
+		}
+	}
+
 	void end (const Xml_string& /*tagname*/)
 	{
 		PageItem* item = this->dig->top<PageItem>();




More information about the scribus-commit mailing list