r19962 by fschmid - Make the static part of the "Windows" menue behave like all the other menues

scribus-commit scribus-commit at lists.scribus.net
Sat Apr 4 08:25:27 UTC 2015


Author: fschmid
Date: Sat Apr  4 08:25:27 2015
New Revision: 19962

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19962
Log:
Make the static part of the "Windows" menue behave like all the other menues

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

Modified: trunk/Scribus/scribus/menumanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19962&path=/trunk/Scribus/scribus/menumanager.cpp
==============================================================================
--- trunk/Scribus/scribus/menumanager.cpp (original)
+++ trunk/Scribus/scribus/menumanager.cpp Sat Apr  4 08:25:27 2015
@@ -271,6 +271,18 @@
 	}
 }
 
+void MenuManager::removeMenuItem(const QString& s, ScrAction *menuAction, const QString &parent)
+{
+	if (menuStrings.contains(parent))
+	{
+		if (menuStrings[parent].contains(s))
+		{
+			menuBarMenus[parent]->removeAction(menuAction);
+			menuStrings[parent].removeAll(s);
+		}
+	}
+}
+
 bool MenuManager::removeMenuItem(ScrAction *menuAction, const QString &parent)
 {
 	bool retVal=false;

Modified: trunk/Scribus/scribus/menumanager.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19962&path=/trunk/Scribus/scribus/menumanager.h
==============================================================================
--- trunk/Scribus/scribus/menumanager.h (original)
+++ trunk/Scribus/scribus/menumanager.h Sat Apr  4 08:25:27 2015
@@ -51,6 +51,7 @@
 
 		bool addMenuToWidgetOfAction(const QString &menuName, ScrAction *action);
 		bool createMenu(const QString &menuName, const QString &menuText = QString::null, const QString parent = QString::null, bool checkable = false, bool rememberMenu = false);
+		void removeMenuItem(const QString& s, ScrAction *menuAction, const QString &parent);
 		bool removeMenuItem(ScrAction *menuAction, const QString &parent);
 		void generateKeyManList(QStringList *actionNames);
 		void runMenuAtPos(const QString &, const QPoint);

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19962&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Sat Apr  4 08:25:27 2015
@@ -1192,6 +1192,7 @@
 	scrMenuMgr->addMenuItemString("toolsToolbarTools", "Windows");
 	scrMenuMgr->addMenuItemString("toolsToolbarPDF", "Windows");
 	scrMenuMgr->addMenuItemString("toolsToolbarView", "Windows");
+	scrMenuMgr->addMenuItemString("SEPARATOR", "Windows");
 	scrMenuMgr->addMenuItemStringstoMenuBar("Windows", scrActions);
 }
 
@@ -2329,8 +2330,14 @@
 
 void ScribusMainWindow::windowsMenuAboutToShow()
 {
-	scrWindowsActions.clear();
-	addDefaultWindowMenuItems();
+	if (!scrWindowsActions.isEmpty())
+	{
+		for (QMap<QString, QPointer<ScrAction> >::iterator it = scrWindowsActions.begin(); it != scrWindowsActions.end(); ++it)
+		{
+			scrMenuMgr->removeMenuItem(it.key(), it.value(), "Windows");
+		}
+		scrWindowsActions.clear();
+	}
 	QList<QMdiSubWindow *> windows = mdiArea->subWindowList();
 	bool windowsListNotEmpty=!windows.isEmpty();
 	scrActions["windowsCascade"]->setEnabled(windowsListNotEmpty);
@@ -2338,8 +2345,8 @@
 	if (windowsListNotEmpty)
 	{
 		int windowCount=static_cast<int>(windows.count());
-		if (windowCount>1)
-			scrMenuMgr->addMenuItemString("SEPARATOR", "Windows");
+	//	if (windowCount>1)
+	//		scrMenuMgr->addMenuItemString("SEPARATOR", "Windows");
 		for ( int i = 0; i < windowCount; ++i )
 		{
 			QString docInWindow(windows.at(i)->windowTitle());




More information about the scribus-commit mailing list