r15516 by fschmid - Fixed Bug #9372: "Items sent to the wrong Scrapbook folder"

scribus-commit scribus-commit at lists.scribus.net
Sun Oct 10 12:38:27 CEST 2010


Author: fschmid
Date: Sun Oct 10 10:38:27 2010
New Revision: 15516

URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=15516
Log:
Fixed Bug #9372: "Items sent to the wrong Scrapbook folder"

Modified:
    trunk/Scribus/scribus/actionmanager.cpp
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/scribus.h
    trunk/Scribus/scribus/ui/contextmenu.cpp
    trunk/Scribus/scribus/ui/scrapbookpalette.cpp
    trunk/Scribus/scribus/ui/scrapbookpalette.h

Modified: trunk/Scribus/scribus/actionmanager.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15516&path=/trunk/Scribus/scribus/actionmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/actionmanager.cpp (original)
+++ trunk/Scribus/scribus/actionmanager.cpp Sun Oct 10 10:38:27 2010
@@ -416,8 +416,8 @@
 	scrActions->insert(name, new ScrAction(loadIcon("16/go-down.png"), loadIcon("22/go-down.png"), "", defaultKey(name), mainWindow));
 	name="itemRaise";
 	scrActions->insert(name, new ScrAction(loadIcon("16/go-up.png"), loadIcon("22/go-up.png"), "", defaultKey(name), mainWindow));
-	name="itemSendToScrapbook";
-	scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
+//	name="itemSendToScrapbook";
+//	scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
 	name="itemSendToPattern";
 	scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
 	name="itemImageInfo";
@@ -488,7 +488,7 @@
 	connect( (*scrActions)["itemUngroup"], SIGNAL(triggered()), mainWindow, SLOT(UnGroupObj()) );
 	connect( (*scrActions)["itemPDFAnnotationProps"], SIGNAL(triggered()), mainWindow, SLOT(ModifyAnnot()) );
 	connect( (*scrActions)["itemPDFFieldProps"], SIGNAL(triggered()), mainWindow, SLOT(ModifyAnnot()) );
-	connect( (*scrActions)["itemSendToScrapbook"], SIGNAL(triggered()), mainWindow, SLOT(PutScrap()) );
+//	connect( (*scrActions)["itemSendToScrapbook"], SIGNAL(triggered()), mainWindow, SLOT(PutScrap()) );
 	connect( (*scrActions)["itemSendToPattern"], SIGNAL(triggered()), mainWindow, SLOT(PutToPatterns()) );
 	connect( (*scrActions)["itemAttributes"], SIGNAL(triggered()), mainWindow, SLOT(objectAttributes()) );
 	connect( (*scrActions)["itemShapeEdit"], SIGNAL(triggered()), mainWindow, SLOT(toggleNodeEdit()) );
@@ -1377,7 +1377,7 @@
 	(*scrActions)["itemRaiseToTop"]->setTexts( tr("Raise to &Top"));
 	(*scrActions)["itemLower"]->setTexts( tr("&Lower"));
 	(*scrActions)["itemRaise"]->setTexts( tr("&Raise"));
-	(*scrActions)["itemSendToScrapbook"]->setTexts( tr("Send to S&crapbook"));
+//	(*scrActions)["itemSendToScrapbook"]->setTexts( tr("Send to S&crapbook"));
 	(*scrActions)["itemSendToPattern"]->setTexts( tr("Send to Patterns"));
 	(*scrActions)["itemAttributes"]->setTexts( tr("&Attributes..."));
 	(*scrActions)["itemImageInfo"]->setTexts( tr("More Info..."));
@@ -1778,7 +1778,45 @@
 	itmenu->second << "typeEffectNormal" << "typeEffectUnderline" << "typeEffectUnderlineWords" << "typeEffectStrikeThrough" << "typeEffectAllCaps" << "typeEffectSmallCaps" << "typeEffectSuperscript" << "typeEffectSubscript" << "typeEffectOutline" << "typeEffectShadow" << "styleImageEffects" << "styleTabulators";
 	//Item
 	++itmenu;
-	itmenu->second << "itemDuplicate" << "itemMulDuplicate" << "itemTransform" << "itemDelete" << "itemGroup" << "itemUngroup" << "itemLock" << "itemLockSize" << "itemImageIsVisible" << "itemUpdateImage" << "itemAdjustFrameToImage" << "itemAdjustImageToFrame" << "itemToggleInlineImage" << "itemExtendedImageProperties" << "itemPreviewLow" << "itemPreviewNormal" << "itemPreviewFull" << "itemRaise" << "itemLower" << "itemRaiseToTop" << "itemLowerToBottom" << "itemSendToScrapbook" << "itemSendToPattern" << "itemAttributes" << "itemPDFIsAnnotation" << "itemPDFIsBookmark" << "itemPDFAnnotationProps" << "itemPDFFieldProps" << "itemShapeEdit" << "itemConvertToBezierCurve" << "itemConvertToImageFrame" << "itemConvertToOutlines" << "itemConvertToPolygon" << "itemConvertToTextFrame" << "itemAttachTextToPath" << "itemDetachTextFromPath" << "itemCombinePolygons" << "itemSplitPolygons";
+	itmenu->second 
+		<< "itemDuplicate" 
+		<< "itemMulDuplicate" 
+		<< "itemTransform" 
+		<< "itemDelete" 
+		<< "itemGroup" 
+		<< "itemUngroup" 
+		<< "itemLock" 
+		<< "itemLockSize" 
+		<< "itemImageIsVisible" 
+		<< "itemUpdateImage" 
+		<< "itemAdjustFrameToImage" 
+		<< "itemAdjustImageToFrame" 
+		<< "itemToggleInlineImage" 
+		<< "itemExtendedImageProperties" 
+		<< "itemPreviewLow" 
+		<< "itemPreviewNormal" 
+		<< "itemPreviewFull" 
+		<< "itemRaise" 
+		<< "itemLower" 
+		<< "itemRaiseToTop" 
+		<< "itemLowerToBottom" 
+//		<< "itemSendToScrapbook" 
+		<< "itemSendToPattern" 
+		<< "itemAttributes" 
+		<< "itemPDFIsAnnotation" 
+		<< "itemPDFIsBookmark" 
+		<< "itemPDFAnnotationProps" 
+		<< "itemPDFFieldProps" 
+		<< "itemShapeEdit" 
+		<< "itemConvertToBezierCurve" 
+		<< "itemConvertToImageFrame" 
+		<< "itemConvertToOutlines" 
+		<< "itemConvertToPolygon" 
+		<< "itemConvertToTextFrame" 
+		<< "itemAttachTextToPath" 
+		<< "itemDetachTextFromPath" 
+		<< "itemCombinePolygons" 
+		<< "itemSplitPolygons";
 	//Insert
 	++itmenu;
 	itmenu->second

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15516&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Sun Oct 10 10:38:27 2010
@@ -307,6 +307,7 @@
 	scrRecentPasteActions.clear();
 	scrWindowsActions.clear();
 	scrLayersActions.clear();
+	scrScrapActions.clear();
 	scrMenuMgr = new ScMWMenuManager(menuBar());
 	prefsManager = PrefsManager::instance();
 	formatsManager = FormatsManager::instance();
@@ -735,7 +736,9 @@
 	scrMenuMgr->addMenuItem(scrActions["itemLowerToBottom"], "ItemLevel", false);
 	scrMenuMgr->createMenu("ItemLayer", tr("Send to La&yer"));
 	scrMenuMgr->addMenuToMenu("ItemLayer", "Item");
-	scrMenuMgr->addMenuItem(scrActions["itemSendToScrapbook"], "Item", false);
+	scrMenuMgr->createMenu("itemSendToScrapbook", tr("Send to Scrapbook"));
+	scrMenuMgr->addMenuToMenu("itemSendToScrapbook", "Item");
+//	scrMenuMgr->addMenuItem(scrActions["itemSendToScrapbook"], "Item", false);
 	scrMenuMgr->addMenuItem(scrActions["itemSendToPattern"], "Item", false);
 	scrMenuMgr->addMenuSeparator("Item");
 	scrMenuMgr->addMenuItem(scrActions["itemAdjustFrameToImage"], "Item", false);
@@ -2569,7 +2572,8 @@
 		scrActions["itemLower"]->setEnabled(false);
 		scrActions["itemRaiseToTop"]->setEnabled(false);
 		scrActions["itemLowerToBottom"]->setEnabled(false);
-		scrActions["itemSendToScrapbook"]->setEnabled(false);
+//		scrActions["itemSendToScrapbook"]->setEnabled(false);
+		scrMenuMgr->setMenuEnabled("itemSendToScrapbook", false);
 		scrActions["itemSendToPattern"]->setEnabled(false);
 		scrActions["itemAdjustFrameToImage"]->setEnabled(false);
 		scrActions["itemAdjustImageToFrame"]->setEnabled(false);
@@ -2631,7 +2635,8 @@
 		scrActions["itemLower"]->setEnabled(true);
 		scrActions["itemRaiseToTop"]->setEnabled(true);
 		scrActions["itemLowerToBottom"]->setEnabled(true);
-		scrActions["itemSendToScrapbook"]->setEnabled(true);
+//		scrActions["itemSendToScrapbook"]->setEnabled(true);
+		scrMenuMgr->setMenuEnabled("itemSendToScrapbook", true);
 		scrActions["itemSendToPattern"]->setEnabled(true);
 		scrActions["itemAdjustFrameToImage"]->setEnabled(true);
 		scrActions["itemAdjustImageToFrame"]->setEnabled(true);
@@ -2685,7 +2690,8 @@
 		scrActions["itemLower"]->setEnabled(true);
 		scrActions["itemRaiseToTop"]->setEnabled(true);
 		scrActions["itemLowerToBottom"]->setEnabled(true);
-		scrActions["itemSendToScrapbook"]->setEnabled(true);
+//		scrActions["itemSendToScrapbook"]->setEnabled(true);
+		scrMenuMgr->setMenuEnabled("itemSendToScrapbook", true);
 		scrActions["itemSendToPattern"]->setEnabled(true);
 		scrActions["itemAdjustFrameToImage"]->setEnabled(true);
 		scrActions["itemAdjustImageToFrame"]->setEnabled(true);
@@ -2788,7 +2794,8 @@
 		scrActions["itemLower"]->setEnabled(true);
 		scrActions["itemRaiseToTop"]->setEnabled(true);
 		scrActions["itemLowerToBottom"]->setEnabled(true);
-		scrActions["itemSendToScrapbook"]->setEnabled(true);
+//		scrActions["itemSendToScrapbook"]->setEnabled(true);
+		scrMenuMgr->setMenuEnabled("itemSendToScrapbook", true);
 		scrActions["itemSendToPattern"]->setEnabled(true);
 		scrActions["itemAdjustFrameToImage"]->setEnabled(true);
 		scrActions["itemAdjustImageToFrame"]->setEnabled(true);
@@ -2858,7 +2865,8 @@
 		scrActions["itemLower"]->setEnabled(true);
 		scrActions["itemRaiseToTop"]->setEnabled(true);
 		scrActions["itemLowerToBottom"]->setEnabled(true);
-		scrActions["itemSendToScrapbook"]->setEnabled(true);
+//		scrActions["itemSendToScrapbook"]->setEnabled(true);
+		scrMenuMgr->setMenuEnabled("itemSendToScrapbook", true);
 		scrActions["itemSendToPattern"]->setEnabled(true);
 		scrActions["itemAdjustFrameToImage"]->setEnabled(true);
 		scrActions["itemAdjustImageToFrame"]->setEnabled(true);
@@ -2972,6 +2980,18 @@
 	{
 		actionManager->setPDFActions(view);
 		updateItemLayerList();
+		QStringList scrapNames = scrapbookPalette->getOpenScrapbooksNames();
+		scrapNames.removeAt(1);
+		for( QMap<QString, QPointer<ScrAction> >::Iterator it0s = scrScrapActions.begin(); it0s != scrScrapActions.end(); ++it0s )
+			scrMenuMgr->removeMenuItem((*it0s), "itemSendToScrapbook");
+		scrScrapActions.clear();
+		for (int i = 0; i < scrapNames.count(); i++)
+		{
+			ScrAction *act = new ScrAction( ScrAction::DataInt, QPixmap(), QPixmap(), scrapNames[i], QKeySequence(), this, i);
+			scrScrapActions.insert(scrapNames[i], act);
+			scrMenuMgr->addMenuItem(act, "itemSendToScrapbook", true);
+			connect(act, SIGNAL(triggeredData(int)), this, SLOT(PutScrap(int)));
+		}
 		//propertiesPalette->textFlowsAroundFrame->setChecked(currItem->textFlowsAroundFrame());
 		propertiesPalette->setTextFlowMode(currItem->textFlowMode());
 		scrActions["itemLock"]->setEnabled(true);
@@ -3003,7 +3023,8 @@
 			scrActions["itemRaiseToTop"]->setEnabled(false);
 			scrActions["itemRaise"]->setEnabled(false);
 			scrActions["itemLower"]->setEnabled(false);
-			scrActions["itemSendToScrapbook"]->setEnabled(!(currItem->isTableItem && currItem->isSingleSel));
+//			scrActions["itemSendToScrapbook"]->setEnabled(!(currItem->isTableItem && currItem->isSingleSel));
+			scrMenuMgr->setMenuEnabled("itemSendToScrapbook", !(currItem->isTableItem && currItem->isSingleSel));
 			scrActions["itemSendToPattern"]->setEnabled(!(currItem->isTableItem && currItem->isSingleSel));
 			scrActions["editCut"]->setEnabled(false);
 			scrActions["editClearContents"]->setEnabled(false);
@@ -3021,7 +3042,8 @@
 			scrActions["itemRaiseToTop"]->setEnabled(setter);
 			scrActions["itemRaise"]->setEnabled(setter);
 			scrActions["itemLower"]->setEnabled(setter);
-			scrActions["itemSendToScrapbook"]->setEnabled(setter);
+//			scrActions["itemSendToScrapbook"]->setEnabled(setter);
+			scrMenuMgr->setMenuEnabled("itemSendToScrapbook", setter);
 			scrActions["itemSendToPattern"]->setEnabled(setter);
 		}
 		scrActions["itemLock"]->setChecked(currItem->locked());
@@ -4457,7 +4479,8 @@
 		scrActions["itemLower"]->setEnabled(false);
 		scrActions["itemRaiseToTop"]->setEnabled(false);
 		scrActions["itemLowerToBottom"]->setEnabled(false);
-		scrActions["itemSendToScrapbook"]->setEnabled(false);
+//		scrActions["itemSendToScrapbook"]->setEnabled(false);
+		scrMenuMgr->setMenuEnabled("itemSendToScrapbook", false);
 		scrActions["itemSendToPattern"]->setEnabled(false);
 		scrActions["itemAdjustFrameToImage"]->setEnabled(false);
 		scrActions["itemAdjustImageToFrame"]->setEnabled(false);
@@ -6253,7 +6276,8 @@
 				scrActions["itemLower"]->setEnabled(true);
 				scrActions["itemRaiseToTop"]->setEnabled(true);
 				scrActions["itemLowerToBottom"]->setEnabled(true);
-				scrActions["itemSendToScrapbook"]->setEnabled(true);
+//				scrActions["itemSendToScrapbook"]->setEnabled(true);
+				scrMenuMgr->setMenuEnabled("itemSendToScrapbook", true);
 				scrActions["itemSendToPattern"]->setEnabled(true);
 				scrActions["itemAdjustFrameToImage"]->setEnabled(true);
 				scrActions["itemAdjustImageToFrame"]->setEnabled(true);
@@ -6301,7 +6325,8 @@
 			scrActions["itemLower"]->setEnabled(false);
 			scrActions["itemRaiseToTop"]->setEnabled(false);
 			scrActions["itemLowerToBottom"]->setEnabled(false);
-			scrActions["itemSendToScrapbook"]->setEnabled(false);
+//			scrActions["itemSendToScrapbook"]->setEnabled(false);
+			scrMenuMgr->setMenuEnabled("itemSendToScrapbook", false);
 			scrActions["itemSendToPattern"]->setEnabled(false);
 			scrActions["itemAdjustFrameToImage"]->setEnabled(false);
 			scrActions["itemAdjustImageToFrame"]->setEnabled(false);
@@ -8895,7 +8920,7 @@
 	}
 }
 
-void ScribusMainWindow::PutScrap()
+void ScribusMainWindow::PutScrap(int scID)
 {
 	ScriXmlDoc ss;
 	QString objectString = ss.WriteElem(doc, doc->m_Selection);
@@ -8917,7 +8942,7 @@
 		DOC = DOC.nextSibling();
 	}
 	objectString = docu.toString();
-	scrapbookPalette->ObjFromMenu(objectString);
+	scrapbookPalette->ObjFromMainMenu(objectString, scID);
 }
 
 void ScribusMainWindow::changeLayer(int )

Modified: trunk/Scribus/scribus/scribus.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15516&path=/trunk/Scribus/scribus/scribus.h
==============================================================================
--- trunk/Scribus/scribus/scribus.h (original)
+++ trunk/Scribus/scribus/scribus.h Sun Oct 10 10:38:27 2010
@@ -242,6 +242,7 @@
 	QMap<QString, QPointer<ScrAction> > scrActions;
 	QMap<QString, QPointer<ScrAction> > scrRecentFileActions;
 	QMap<QString, QPointer<ScrAction> > scrWindowsActions;
+	QMap<QString, QPointer<ScrAction> > scrScrapActions;
 	QMap<QString, QPointer<ScrAction> > scrLayersActions;
 	QMap<QString, QPointer<ScrAction> > scrRecentPasteActions;
 	QMap<QString, QPointer<ScToolBar> > scrToolBars;
@@ -285,7 +286,7 @@
 	//void doDeHyphenate();
 	void slotTest();
 	void slotTest2();
-	void PutScrap();
+	void PutScrap(int scID);
 	void PutToPatterns();
 	void changeLayer(int);
 	void showLayer();

Modified: trunk/Scribus/scribus/ui/contextmenu.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15516&path=/trunk/Scribus/scribus/ui/contextmenu.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/contextmenu.cpp (original)
+++ trunk/Scribus/scribus/ui/contextmenu.cpp Sun Oct 10 10:38:27 2010
@@ -25,8 +25,10 @@
 #include "prefsmanager.h"
 #include "scmimedata.h"
 #include "scraction.h"
+#include "scrapbookpalette.h"
 #include "scribus.h"
 #include "scribusdoc.h"
+#include "ui/scmwmenumanager.h"
 #include "undomanager.h"
 #include "canvasmode_legacy.h"
 
@@ -90,6 +92,7 @@
 	QMenu *menuInfo = new QMenu(this);
 	QMenu *menuLayer = new QMenu(this);
 	QMenu *menuLevel = new QMenu(this);
+	QMenu *menuScrap = new QMenu(this);
 	QMenu *menuPDF = new QMenu(this);
 	QMenu *menuResolution = new QMenu(this);
 	
@@ -281,7 +284,16 @@
 	
 	if (selectedItemCount>0)
 	{
-		addAction(m_AP->scrActions["itemSendToScrapbook"]);
+//		QStringList scrapNames = m_AP->scrapbookPalette->getOpenScrapbooksNames();
+//		scrapNames.removeAt(1);
+//		for (int i = 0; i < scrapNames.count(); i++)
+//		{
+//			menuScrap->addAction(scrapNames[i], m_AP, SLOT(PutScrap(int)));
+//		}
+		QAction *actSc = addMenu(m_AP->scrMenuMgr->getLocalPopupMenu("itemSendToScrapbook"));
+		actSc->setText( ScribusView::tr("Send to Scrapbook"));
+
+//		addAction(m_AP->scrActions["itemSendToScrapbook"]);
 		addAction(m_AP->scrActions["itemSendToPattern"]);
 		//<-- Add Layer Items
 		if (m_doc->layerCount() > 1)

Modified: trunk/Scribus/scribus/ui/scrapbookpalette.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15516&path=/trunk/Scribus/scribus/ui/scrapbookpalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/scrapbookpalette.cpp (original)
+++ trunk/Scribus/scribus/ui/scrapbookpalette.cpp Sun Oct 10 10:38:27 2010
@@ -66,6 +66,7 @@
 	setIconSize(QSize(60, 60));
 	objectMap.clear();
 	ScFilename = "";
+	visibleName = "";
 	canWrite = true;
 }
 
@@ -714,8 +715,10 @@
 	Frame3 = new QToolBox( this );
 	activeBView = new BibView(this);
 	Frame3->addItem(activeBView, tr("Main"));
+	activeBView->visibleName = tr("Main");
 	tempBView = new BibView(this);
 	Frame3->addItem(tempBView, tr("Copied Items"));
+	tempBView->visibleName = tr("Copied Items");
 	tempCount = 0;
 	actItem = 0;
 	BiblioLayout->addWidget( Frame3 );
@@ -753,6 +756,7 @@
 				Frame3->addItem(activeBView, QIcon(loadIcon("16/lock.png")), d.dirName());
 			activeBView->ReadContents(fileName);
 			activeBView->ScFilename = fileName;
+			activeBView->visibleName = d.dirName();
 			activeBView->scrollToTop();
 		}
 	}
@@ -776,6 +780,18 @@
 			BibView* bv = (BibView*)Frame3->widget(a);
 			ret.append(bv->ScFilename);
 		}
+	}
+	return ret;
+}
+
+QStringList Biblio::getOpenScrapbooksNames()
+{
+	QStringList ret;
+	ret.clear();
+	for (int a = 0; a < Frame3->count(); a++)
+	{
+		BibView* bv = (BibView*)Frame3->widget(a);
+		ret.append(bv->visibleName);
 	}
 	return ret;
 }
@@ -848,6 +864,7 @@
 			Frame3->addItem(activeBView, QIcon(loadIcon("16/lock.png")), d.dirName());
 		activeBView->ReadContents(fileName);
 		activeBView->ScFilename = fileName;
+		activeBView->visibleName = d.dirName();
 		Frame3->setCurrentWidget(activeBView);
 		d.cdUp();
 		dirs->set("scrap_load", d.absolutePath());
@@ -888,6 +905,7 @@
 			Frame3->addItem(activeBView, QIcon(loadIcon("16/lock.png")), d.dirName());
 		activeBView->ReadContents(fileName);
 		activeBView->ScFilename = fileName;
+		activeBView->visibleName = d.dirName();
 		Frame3->setCurrentWidget(activeBView);
 		d.cdUp();
 		dirs->set("scrap_load", d.absolutePath());
@@ -1645,6 +1663,53 @@
 	}
 }
 
+void Biblio::ObjFromMainMenu(QString text, int scrapID)
+{
+	QString nam = "";
+	QString tmp;
+	int scID = scrapID;
+	if (scID > 0)
+		scID++;
+	BibView* actBView = (BibView*)Frame3->widget(scID);
+	if (!actBView->canWrite)
+		return;
+	nam = getObjectName(text);
+	if (nam.isEmpty())
+		nam = tr("Object") + tmp.setNum(actBView->objectMap.count());
+	if (actBView->objectMap.contains(nam))
+		nam += "("+ tmp.setNum(tempCount) + ")";
+	qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
+	Query *dia = new Query(this, "tt", 1, 0, tr("&Name:"), tr("New Entry"));
+	dia->setEditText(nam, true);
+	dia->setTestList(actBView->objectMap.keys());
+	if (dia->exec())
+	{
+		nam = dia->getEditText();
+	}
+	else
+	{
+		delete dia;
+		return;
+	}
+	delete dia;
+	QString ff = text;
+	actBView->checkAndChange(ff, QDir::cleanPath(QDir::convertSeparators(actBView->ScFilename + "/" + nam + ".sce")), QDir::cleanPath(QDir::convertSeparators(actBView->ScFilename)));
+	ScPreview *pre = new ScPreview();
+	QPixmap pm = QPixmap::fromImage(pre->createPreview(ff));
+	actBView->AddObj(nam, QDir::cleanPath(QDir::convertSeparators(actBView->ScFilename + "/" + nam + ".sce")), pm);
+	if (PrefsManager::instance()->appPrefs.scrapbookPrefs.writePreviews)
+		pm.save(QDir::cleanPath(QDir::convertSeparators(actBView->ScFilename + "/" + nam +".png")), "PNG");
+	pm = pm.scaled(60, 60, Qt::KeepAspectRatio, Qt::SmoothTransformation);
+	QPixmap pm2(60, 60);
+	pm2.fill(palette().color(QPalette::Base));
+	QPainter p;
+	p.begin(&pm2);
+	p.drawPixmap(30 - pm.width() / 2, 30 - pm.height() / 2, pm);
+	p.end();
+	new QListWidgetItem(QIcon(pm2), nam, actBView);
+	delete pre;
+}
+
 void Biblio::CleanUpTemp()
 {
 	QMap<QString,BibView::Elem>::Iterator it;

Modified: trunk/Scribus/scribus/ui/scrapbookpalette.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15516&path=/trunk/Scribus/scribus/ui/scrapbookpalette.h
==============================================================================
--- trunk/Scribus/scribus/ui/scrapbookpalette.h (original)
+++ trunk/Scribus/scribus/ui/scrapbookpalette.h Sun Oct 10 10:38:27 2010
@@ -44,6 +44,7 @@
 	};
 	QMap<QString,Elem> objectMap;
 	QString ScFilename;
+	QString visibleName;
 	bool canWrite;
 
 signals:
@@ -83,6 +84,7 @@
 	void installEventFilter(QObject *);
 	void setOpenScrapbooks(QStringList &fileNames);
 	QStringList getOpenScrapbooks();
+	QStringList getOpenScrapbooksNames();
 	QString getObjectName(QString &text);
 	BibView* tempBView;
 	BibView* activeBView;
@@ -92,6 +94,7 @@
 	void languageChange();
 	void ObjFromFile(QString path, int testResult);
 	void ObjFromMenu(QString text);
+	void ObjFromMainMenu(QString text, int scrapID);
 
 private slots:
 	void handleDoubleClick(QListWidgetItem *ite);




More information about the scribus-commit mailing list