r18582 by craig - #11801: Fix scrapbook menu creation process, move to newer API

scribus-commit scribus-commit at lists.scribus.net
Wed Oct 30 20:28:42 UTC 2013


Author: craig
Date: Wed Oct 30 20:28:42 2013
New Revision: 18582

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18582
Log:
#11801: Fix scrapbook menu creation process, move to newer API

Modified:
    trunk/Scribus/scribus/menumanager.cpp
    trunk/Scribus/scribus/menumanager.h
    trunk/Scribus/scribus/plugins/scriptplugin/scriptercore.cpp
    trunk/Scribus/scribus/scribus.cpp

Modified: trunk/Scribus/scribus/menumanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18582&path=/trunk/Scribus/scribus/menumanager.cpp
==============================================================================
--- trunk/Scribus/scribus/menumanager.cpp (original)
+++ trunk/Scribus/scribus/menumanager.cpp Wed Oct 30 20:28:42 2013
@@ -33,7 +33,6 @@
 	recentFileMenu=NULL;
 	editPasteRecentMenu=NULL;
 	itemLayerMenu=NULL;
-	itemSendtoScrapbookMenu=NULL;
 	windowsMenu=NULL;
 	m_undoMenu=new QMenu("undo");
 	m_redoMenu=new QMenu("redo");
@@ -200,10 +199,6 @@
 							{
 								rememberedMenus.insert(menuStrings[menuName].at(i), subMenu);
 							}
-							if (menuStrings[menuName].at(i)=="ItemSendToScrapbook")
-							{
-								itemSendtoScrapbookMenu=subMenu;
-							}
 							else if (menuStrings[menuName].at(i)=="ItemLayer")
 							{
 								itemLayerMenu=subMenu;
@@ -231,6 +226,18 @@
 
 void MenuManager::addMenuItemStringstoSpecialMenu(const QString &menuName, const QMap<QString, QPointer<ScrAction> > &menuActions)
 {
+	if (rememberedMenus.contains(menuName))
+	{
+		if (rememberedMenus.value(menuName)!=NULL)
+		{
+			if (menuName=="ItemSendToScrapbook")
+			{
+				for( QMap<QString, QPointer<ScrAction> >::ConstIterator it = menuActions.begin(); it!=menuActions.end(); ++it )
+					rememberedMenus.value(menuName)->addAction(*it);
+			}
+		}
+	}
+	else
 	if (menuName=="FileOpenRecent" && recentFileMenu!=NULL)
 	{
 		for( QMap<QString, QPointer<ScrAction> >::ConstIterator it = menuActions.begin(); it!=menuActions.end(); ++it )
@@ -241,13 +248,6 @@
 		for( QMap<QString, QPointer<ScrAction> >::ConstIterator it = menuActions.begin(); it!=menuActions.end(); ++it )
 			windowsMenu->addAction(*it);
 	}
-	else if (menuName=="ItemSendToScrapbook" && itemSendtoScrapbookMenu!=NULL)
-	{
-		for( QMap<QString, QPointer<ScrAction> >::ConstIterator it = menuActions.begin(); it!=menuActions.end(); ++it )
-		{
-			itemSendtoScrapbookMenu->addAction(*it);
-		}
-	}
 	else if (menuName=="ItemLayer" && itemLayerMenu!=NULL)
 	{
 		for( QMap<QString, QPointer<ScrAction> >::ConstIterator it = menuActions.begin(); it!=menuActions.end(); ++it )
@@ -279,10 +279,6 @@
 	else if (menuName=="Windows" && windowsMenu!=NULL)
 	{
 		windowsMenu->clear();
-	}
-	else if (menuName=="ItemSendToScrapbook" && itemSendtoScrapbookMenu!=NULL)
-	{
-		itemSendtoScrapbookMenu->clear();
 	}
 	else if (menuName=="ItemLayer" && itemLayerMenu!=NULL)
 	{

Modified: trunk/Scribus/scribus/menumanager.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18582&path=/trunk/Scribus/scribus/menumanager.h
==============================================================================
--- trunk/Scribus/scribus/menumanager.h (original)
+++ trunk/Scribus/scribus/menumanager.h Wed Oct 30 20:28:42 2013
@@ -90,7 +90,6 @@
 	QMenu *recentFileMenu;
 	QMenu *editPasteRecentMenu;
 	QMenu *itemLayerMenu;
-	QMenu *itemSendtoScrapbookMenu;
 	QMenu *windowsMenu;
 	//some hacks to keep undo menu functioning for now
 	QMenu *m_undoMenu;

Modified: trunk/Scribus/scribus/plugins/scriptplugin/scriptercore.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18582&path=/trunk/Scribus/scribus/plugins/scriptplugin/scriptercore.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/scriptercore.cpp (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/scriptercore.cpp Wed Oct 30 20:28:42 2013
@@ -147,31 +147,6 @@
 	}
 	menuMgr->addMenuItemStringstoRememberedMenu("RecentScripts", scrRecentScriptActions);
 }
-
-/*
-void ScripterCore::buildRecentScriptsMenu()
-{
-	RecentScripts = SavedRecentScripts;
-	scrRecentScriptActions.clear();
-	if (SavedRecentScripts.count() != 0)
-	{
-		uint max = qMin(PrefsManager::instance()->appPrefs.uiPrefs.recentDocCount, SavedRecentScripts.count());
-		for (uint m = 0; m < max; ++m)
-		{
-			QFileInfo fd(SavedRecentScripts[m]);
-			if (fd.exists())
-			{
-				QString strippedName=SavedRecentScripts[m];
-				strippedName.remove(QDir::separator());
-				scrRecentScriptActions.insert(strippedName, new ScrAction( ScrAction::RecentScript, SavedRecentScripts[m], QKeySequence(), this));
-				connect( scrRecentScriptActions[strippedName], SIGNAL(triggeredData(QString)), this, SLOT(RecentScript(QString)) );
-				menuMgr->addMenuItemString(strippedName, "RecentScripts");
-			}
-		}
-		menuMgr->addMenuItemStringstoRememberedMenu("RecentScripts", scrRecentScriptActions);
-	}
-}
-*/
 
 void ScripterCore::FinishScriptRun()
 {

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18582&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Wed Oct 30 20:28:42 2013
@@ -827,7 +827,7 @@
 //	scrMenuMgr->addMenuToMenu("ItemLayer", "Item");
 	scrMenuMgr->createMenu("SendTo", tr("Send to"), "Item");
 	scrMenuMgr->addMenuItemString("SendTo", "Item");
-	scrMenuMgr->createMenu("ItemSendToScrapbook", tr("Scrapbook"));
+	scrMenuMgr->createMenu("ItemSendToScrapbook", tr("Scrapbook"),"",false,true);
 	scrMenuMgr->addMenuItemString("ItemSendToScrapbook", "SendTo");
 //	scrMenuMgr->addMenuToMenu("itemSendToScrapbook", "SendTo");
 	scrMenuMgr->addMenuItemString("itemSendToPattern", "SendTo");
@@ -3308,15 +3308,17 @@
 		updateItemLayerList();
 		QStringList scrapNames = scrapbookPalette->getOpenScrapbooksNames();
 		scrapNames.removeAt(1);
-		scrMenuMgr->clearMenuStrings("itemSendToScrapbook");
+		scrMenuMgr->clearMenuStrings("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);
 			connect(act, SIGNAL(triggeredData(int)), this, SLOT(PutScrap(int)));
-		}
-		scrMenuMgr->addMenuItemStringstoSpecialMenu("ItemSendToScrapbook", scrScrapActions);
+			scrMenuMgr->addMenuItemString(scrapNames[i], "ItemSendToScrapbook");
+		}
+		scrMenuMgr->addMenuItemStringstoRememberedMenu("ItemSendToScrapbook", scrScrapActions);
+
 		//propertiesPalette->textFlowsAroundFrame->setChecked(currItem->textFlowsAroundFrame());
 		propertiesPalette->setTextFlowMode(currItem->textFlowMode());
 		scrActions["itemLock"]->setEnabled(true);




More information about the scribus-commit mailing list