r14768 by fschmid - Allow dropping of objects from the scrapbook onto an empty Scribus main window. (to be completed for .sce, .sml and .shape)

scribus-commit scribus-commit at lists.scribus.net
Fri Feb 19 16:10:39 CET 2010


Revision: 14768
Author: fschmid
Date: 2010-02-19T15:03:26.434018Z
Commit message: Allow dropping of objects from the scrapbook onto an empty Scribus main window. (to be completed for .sce, .sml and .shape)

Changeset: 
M  /trunk/Scribus/scribus/ui/scrapbookpalette.cpp

Diffs:
Index: scribus/ui/scrapbookpalette.cpp
===================================================================
--- scribus/ui/scrapbookpalette.cpp	(revision 14767)
+++ scribus/ui/scrapbookpalette.cpp	(revision 14768)
@@ -74,6 +74,8 @@
 	QStringList vectorFiles = LoadSavePlugin::getExtensionsForPreview(FORMATID_ODGIMPORT);
 	QString dt = objectMap[currentItem()->text()].Data;
 	QFileInfo fi(dt);
+	QMimeData *mimeData = new QMimeData;
+	QList<QUrl> urlList;
 	if (fi.suffix().toLower() == "sml")
 	{
 		QByteArray cf;
@@ -82,6 +84,7 @@
 		StencilReader *pre = new StencilReader();
 		dt = pre->createObjects(f);
 		delete pre;
+		mimeData->setText(dt);
 	}
 	else if (fi.suffix().toLower() == "shape")
 	{
@@ -91,13 +94,15 @@
 		StencilReader *pre = new StencilReader();
 		dt = pre->createShape(f);
 		delete pre;
+		mimeData->setText(dt);
 	}
 	else if (fi.suffix().toLower() == "sce")
 	{
 		if ( fi.exists() )
 		{
 			QUrl ur = QUrl::fromLocalFile(dt);
-			dt = ur.toString();
+			urlList.append(ur);
+			mimeData->setUrls(urlList);
 		}
 	}
 	else if (vectorFiles.contains(fi.suffix().toLower()))
@@ -105,11 +110,10 @@
 		if ( fi.exists() )
 		{
 			QUrl ur = QUrl::fromLocalFile(dt);
-			dt = ur.toString();
+			urlList.append(ur);
+			mimeData->setUrls(urlList);
 		}
 	}
-	QMimeData *mimeData = new QMimeData;
-	mimeData->setText(dt);
 	QDrag *drag = new QDrag(this);
 	drag->setMimeData(mimeData);
 	drag->setDragCursor(objectMap[currentItem()->text()].Preview, Qt::CopyAction);




More information about the scribus-commit mailing list