r17016 by fschmid - Fixed Bug 9456: "don't use the copy paste buffer when duplicating an object"

scribus-commit scribus-commit at lists.scribus.net
Wed Nov 23 16:59:43 UTC 2011


Author: fschmid
Date: Wed Nov 23 16:59:42 2011
New Revision: 17016

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17016
Log:
Fixed Bug 9456: "don't use the copy paste buffer when duplicating an object"

Modified:
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/scribus.h

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17016&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Wed Nov 23 16:59:42 2011
@@ -301,6 +301,7 @@
 	previewDinUse = false;
 	printDinUse = false;
 	internalCopy = false;
+	internalCopyBuffer = "";
 	m_doc = new ScribusDoc();
 	m_doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
 	m_doc->setPage(100, 100, 0, 0, 0, 0, 0, 0, false, false);
@@ -4975,18 +4976,26 @@
 				return;
 			ScriXmlDoc ss;
 			QString BufferS = ss.WriteElem(doc, doc->m_Selection);
-			if ((prefsManager->appPrefs.scrapbookPrefs.doCopyToScrapbook) && (!internalCopy))
-			{
-				scrapbookPalette->ObjFromCopyAction(BufferS, currItem->itemName());
-				rebuildRecentPasteMenu();
-			}
-			ScElemMimeData* mimeData = new ScElemMimeData();
-			mimeData->setScribusElem(BufferS);
-			mimeData->setText(BufferS);
-			QApplication::clipboard()->setMimeData(mimeData, QClipboard::Clipboard);
-		}
-		scrActions["editPaste"]->setEnabled(true);
-		scrMenuMgr->setMenuEnabled("EditPasteRecent", scrapbookPalette->tempBView->objectMap.count() != 0);
+			if (!internalCopy)
+			{
+				if ((prefsManager->appPrefs.scrapbookPrefs.doCopyToScrapbook) && (!internalCopy))
+				{
+					scrapbookPalette->ObjFromCopyAction(BufferS, currItem->itemName());
+					rebuildRecentPasteMenu();
+				}
+				ScElemMimeData* mimeData = new ScElemMimeData();
+				mimeData->setScribusElem(BufferS);
+				mimeData->setText(BufferS);
+				QApplication::clipboard()->setMimeData(mimeData, QClipboard::Clipboard);
+			}
+			else
+				internalCopyBuffer = BufferS;
+		}
+		if (!internalCopy)
+		{
+			scrActions["editPaste"]->setEnabled(true);
+			scrMenuMgr->setMenuEnabled("EditPasteRecent", scrapbookPalette->tempBView->objectMap.count() != 0);
+		}
 	}
 }
 
@@ -5113,7 +5122,7 @@
 		}
 		else
 		{
-			if (ScMimeData::clipboardHasScribusElem() || ScMimeData::clipboardHasScribusFragment())
+			if (ScMimeData::clipboardHasScribusElem() || ScMimeData::clipboardHasScribusFragment() || internalCopy)
 			{
 				view->Deselect(true);
 				uint ac = doc->Items->count();
@@ -5121,8 +5130,13 @@
 				bool savedAlignGuides = doc->SnapGuides;
 				doc->useRaster = false;
 				doc->SnapGuides = false;
-				QString buffer  = ScMimeData::clipboardScribusElem();
-				slotElemRead(buffer, doc->currentPage()->xOffset(), doc->currentPage()->yOffset(), false, true, doc, view);
+				if (internalCopy)
+					slotElemRead(internalCopyBuffer, doc->currentPage()->xOffset(), doc->currentPage()->yOffset(), false, true, doc, view);
+				else
+				{
+					QString buffer  = ScMimeData::clipboardScribusElem();
+					slotElemRead(buffer, doc->currentPage()->xOffset(), doc->currentPage()->yOffset(), false, true, doc, view);
+				}
 				// update style lists:
 				styleManager->setDoc(doc);
 				propertiesPalette->unsetDoc();
@@ -7390,6 +7404,7 @@
 	doc->useRaster = savedAlignGrid;
 	doc->SnapGuides = savedAlignGuides;
 	internalCopy = false;
+	internalCopyBuffer = "";
 	view->DrawNew();
 }
 

Modified: trunk/Scribus/scribus/scribus.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17016&path=/trunk/Scribus/scribus/scribus.h
==============================================================================
--- trunk/Scribus/scribus/scribus.h (original)
+++ trunk/Scribus/scribus/scribus.h Wed Nov 23 16:59:42 2011
@@ -183,6 +183,7 @@
 	void restoreDeletePage(SimpleState *state, bool isUndo);
 	struct CopyContentsBuffer contentsBuffer;
 	bool internalCopy;
+	QString internalCopyBuffer;
 	int  HaveDoc;
 	PrefsContext* dirs;
 	/** \brief view is the main widget which represents your working area. The View




More information about the scribus-commit mailing list