r15524 by fschmid - Backported fix for Bug #9372: "Items sent to the wrong Scrapbook folder"
scribus-commit
scribus-commit at lists.scribus.net
Sun Oct 10 23:36:57 CEST 2010
Author: fschmid
Date: Sun Oct 10 21:36:57 2010
New Revision: 15524
URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=15524
Log:
Backported fix for Bug #9372: "Items sent to the wrong Scrapbook folder"
Modified:
branches/Version135/Scribus/scribus/actionmanager.cpp
branches/Version135/Scribus/scribus/contextmenu.cpp
branches/Version135/Scribus/scribus/scrapbookpalette.cpp
branches/Version135/Scribus/scribus/scrapbookpalette.h
branches/Version135/Scribus/scribus/scribus.cpp
branches/Version135/Scribus/scribus/scribus.h
Modified: branches/Version135/Scribus/scribus/actionmanager.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15524&path=/branches/Version135/Scribus/scribus/actionmanager.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/actionmanager.cpp (original)
+++ branches/Version135/Scribus/scribus/actionmanager.cpp Sun Oct 10 21:36:57 2010
@@ -404,8 +404,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";
@@ -477,7 +477,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()) );
@@ -1353,7 +1353,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..."));
@@ -1759,7 +1759,7 @@
itmenu->second << "typeEffectNormal" << "typeEffectUnderline" << "typeEffectUnderlineWords" << "typeEffectStrikeThrough" << "typeEffectAllCaps" << "typeEffectSmallCaps" << "typeEffectSuperscript" << "typeEffectSubscript" << "typeEffectOutline" << "typeEffectShadow" << "styleImageEffects" << "styleTabulators";
//Item
++itmenu;
- itmenu->second << "itemDuplicate" << "itemMulDuplicate" << "itemDelete" << "itemGroup" << "itemUngroup" << "itemLock" << "itemLockSize" << "itemImageIsVisible" << "itemUpdateImage" << "itemAdjustFrameToImage" << "itemAdjustImageToFrame" << "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" << "itemDelete" << "itemGroup" << "itemUngroup" << "itemLock" << "itemLockSize" << "itemImageIsVisible" << "itemUpdateImage" << "itemAdjustFrameToImage" << "itemAdjustImageToFrame" << "itemExtendedImageProperties" << "itemPreviewLow" << "itemPreviewNormal" << "itemPreviewFull" << "itemRaise" << "itemLower" << "itemRaiseToTop" << "itemLowerToBottom" << "itemSendToPattern" << "itemAttributes" << "itemPDFIsAnnotation" << "itemPDFIsBookmark" << "itemPDFAnnotationProps" << "itemPDFFieldProps" << "itemShapeEdit" << "itemConvertToBezierCurve" << "itemConvertToImageFrame" << "itemConvertToOutlines" << "itemConvertToPolygon" << "itemConvertToTextFrame" << "itemAttachTextToPath" << "itemDetachTextFromPath" << "itemCombinePolygons" << "itemSplitPolygons";
//Insert
++itmenu;
itmenu->second
Modified: branches/Version135/Scribus/scribus/contextmenu.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15524&path=/branches/Version135/Scribus/scribus/contextmenu.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/contextmenu.cpp (original)
+++ branches/Version135/Scribus/scribus/contextmenu.cpp Sun Oct 10 21:36:57 2010
@@ -22,8 +22,10 @@
#include <QWidgetAction>
#include "contextmenu.h"
+#include "menumanager.h"
#include "prefsmanager.h"
#include "scmimedata.h"
+#include "scrapbookpalette.h"
#include "scraction.h"
#include "scribus.h"
#include "scribusdoc.h"
@@ -272,7 +274,9 @@
if (selectedItemCount>0)
{
- addAction(m_AP->scrActions["itemSendToScrapbook"]);
+// addAction(m_AP->scrActions["itemSendToScrapbook"]);
+ QAction *actSc = addMenu(m_AP->scrMenuMgr->getLocalPopupMenu("itemSendToScrapbook"));
+ actSc->setText( ScribusView::tr("Send to Scrapbook"));
addAction(m_AP->scrActions["itemSendToPattern"]);
//<-- Add Layer Items
if (m_doc->layerCount() > 1)
Modified: branches/Version135/Scribus/scribus/scrapbookpalette.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15524&path=/branches/Version135/Scribus/scribus/scrapbookpalette.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/scrapbookpalette.cpp (original)
+++ branches/Version135/Scribus/scribus/scrapbookpalette.cpp Sun Oct 10 21:36:57 2010
@@ -66,6 +66,7 @@
setIconSize(QSize(60, 60));
objectMap.clear();
ScFilename = "";
+ visibleName = "";
canWrite = true;
}
@@ -558,8 +559,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 );
@@ -596,6 +599,7 @@
Frame3->addItem(activeBView, QIcon(loadIcon("16/lock.png")), d.dirName());
activeBView->ReadContents(fileName);
activeBView->ScFilename = fileName;
+ activeBView->visibleName = d.dirName();
activeBView->scrollToTop();
}
}
@@ -727,6 +731,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());
@@ -1239,6 +1244,18 @@
return result;
}
+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;
+ }
+
void Biblio::ObjFromMenu(QString text)
{
QString nam = "";
@@ -1409,6 +1426,60 @@
}
}
+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);
+ if (dia->exec())
+ {
+ nam = dia->getEditText();
+ while (activeBView->objectMap.contains(nam))
+ {
+ if (!dia->exec())
+ {
+ delete dia;
+ return;
+ }
+ 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 = pre->createPreview(ff);
+ actBView->AddObj(nam, QDir::cleanPath(QDir::convertSeparators(actBView->ScFilename + "/" + nam + ".sce")), pm);
+ 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: branches/Version135/Scribus/scribus/scrapbookpalette.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15524&path=/branches/Version135/Scribus/scribus/scrapbookpalette.h
==============================================================================
--- branches/Version135/Scribus/scribus/scrapbookpalette.h (original)
+++ branches/Version135/Scribus/scribus/scrapbookpalette.h Sun Oct 10 21:36:57 2010
@@ -44,6 +44,7 @@
};
QMap<QString,Elem> objectMap;
QString ScFilename;
+ QString visibleName;
bool canWrite;
signals:
@@ -82,6 +83,7 @@
void installEventFilter(QObject *);
void setOpenScrapbooks(QStringList &fileNames);
QStringList getOpenScrapbooks();
+ QStringList getOpenScrapbooksNames();
QString getObjectName(QString &text);
BibView* tempBView;
BibView* activeBView;
@@ -90,6 +92,7 @@
public slots:
void languageChange();
void ObjFromMenu(QString text);
+ void ObjFromMainMenu(QString text, int scrapID);
private slots:
void handleDoubleClick(QListWidgetItem *ite);
Modified: branches/Version135/Scribus/scribus/scribus.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15524&path=/branches/Version135/Scribus/scribus/scribus.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/scribus.cpp (original)
+++ branches/Version135/Scribus/scribus/scribus.cpp Sun Oct 10 21:36:57 2010
@@ -293,6 +293,7 @@
scrRecentPasteActions.clear();
scrWindowsActions.clear();
scrLayersActions.clear();
+ scrScrapActions.clear();
scrMenuMgr = new MenuManager(menuBar());
prefsManager = PrefsManager::instance();
formatsManager = FormatsManager::instance();
@@ -722,7 +723,8 @@
scrMenuMgr->createMenu("ItemLayer", tr("Send to La&yer"));
scrMenuMgr->addMenuToMenu("ItemLayer", "Item");
layerMenuName="ItemLayer";
- scrMenuMgr->addMenuItem(scrActions["itemSendToScrapbook"], "Item");
+ scrMenuMgr->createMenu("itemSendToScrapbook", tr("Send to Scrapbook"));
+ scrMenuMgr->addMenuToMenu("itemSendToScrapbook", "Item");
scrMenuMgr->addMenuItem(scrActions["itemSendToPattern"], "Item");
scrMenuMgr->addMenuSeparator("Item");
scrMenuMgr->addMenuItem(scrActions["itemAdjustFrameToImage"], "Item");
@@ -3250,6 +3252,18 @@
if (docSelectionCount != 0)
{
actionManager->setPDFActions(view);
+ 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");
+ connect(act, SIGNAL(triggeredData(int)), this, SLOT(PutScrap(int)));
+ }
updateItemLayerList();
//propertiesPalette->textFlowsAroundFrame->setChecked(currItem->textFlowsAroundFrame());
propertiesPalette->setTextFlowMode(currItem->textFlowMode());
@@ -3281,7 +3295,7 @@
scrActions["itemRaiseToTop"]->setEnabled(false);
scrActions["itemRaise"]->setEnabled(false);
scrActions["itemLower"]->setEnabled(false);
- 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);
@@ -3297,7 +3311,7 @@
scrActions["itemRaiseToTop"]->setEnabled(setter);
scrActions["itemRaise"]->setEnabled(setter);
scrActions["itemLower"]->setEnabled(setter);
- scrActions["itemSendToScrapbook"]->setEnabled(setter);
+ scrMenuMgr->setMenuEnabled("itemSendToScrapbook", setter);
scrActions["itemSendToPattern"]->setEnabled(setter);
}
scrActions["itemLock"]->setChecked(currItem->locked());
@@ -8801,7 +8815,7 @@
}
}
-void ScribusMainWindow::PutScrap()
+void ScribusMainWindow::PutScrap(int scID)
{
ScriXmlDoc ss;
QString objectString = ss.WriteElem(doc, view, doc->m_Selection);
@@ -8823,7 +8837,7 @@
DOC = DOC.nextSibling();
}
objectString = docu.toString();
- scrapbookPalette->ObjFromMenu(objectString);
+ scrapbookPalette->ObjFromMainMenu(objectString, scID);
}
void ScribusMainWindow::changeLayer(int )
Modified: branches/Version135/Scribus/scribus/scribus.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15524&path=/branches/Version135/Scribus/scribus/scribus.h
==============================================================================
--- branches/Version135/Scribus/scribus/scribus.h (original)
+++ branches/Version135/Scribus/scribus/scribus.h Sun Oct 10 21:36:57 2010
@@ -238,6 +238,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;
@@ -281,7 +282,7 @@
//void doDeHyphenate();
void slotTest();
void slotTest2();
- void PutScrap();
+ void PutScrap(int scID);
void PutToPatterns();
void changeLayer(int);
void showLayer();
More information about the scribus-commit
mailing list