r18551 by fschmid - Restore old behaviour of the "Recent Files" menu, Part 2:

scribus-commit scribus-commit at lists.scribus.net
Sun Oct 13 10:08:41 UTC 2013


Author: fschmid
Date: Sun Oct 13 10:08:41 2013
New Revision: 18551

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18551
Log:
Restore old behaviour of the "Recent Files" menu, Part 2:
- Menu sorted with most recent file on top

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

Modified: trunk/Scribus/scribus/menumanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18551&path=/trunk/Scribus/scribus/menumanager.cpp
==============================================================================
--- trunk/Scribus/scribus/menumanager.cpp (original)
+++ trunk/Scribus/scribus/menumanager.cpp Sun Oct 13 10:08:41 2013
@@ -296,35 +296,35 @@
 }
 
 
-void MenuManager::addMenuItemStringstoSpecialMenu(const QString &menuName, const QHash<QString, QPointer<ScrAction> > &menuActions)
+void MenuManager::addMenuItemStringstoSpecialMenu(const QString &menuName, const QMap<QString, QPointer<ScrAction> > &menuActions)
 {
 	if (menuName=="FileOpenRecent" && recentFileMenu!=NULL)
 	{
-		for( QHash<QString, QPointer<ScrAction> >::ConstIterator it = menuActions.begin(); it!=menuActions.end(); ++it )
+		for( QMap<QString, QPointer<ScrAction> >::ConstIterator it = menuActions.begin(); it!=menuActions.end(); ++it )
 			recentFileMenu->addAction(*it);
 	}
 	else if (menuName=="Windows" && windowsMenu!=NULL)
 	{
-		for( QHash<QString, QPointer<ScrAction> >::ConstIterator it = menuActions.begin(); it!=menuActions.end(); ++it )
+		for( QMap<QString, QPointer<ScrAction> >::ConstIterator it = menuActions.begin(); it!=menuActions.end(); ++it )
 			windowsMenu->addAction(*it);
 	}
 	else if (menuName=="ItemSendToScrapbook" && itemSendtoScrapbookMenu!=NULL)
 	{
-		for( QHash<QString, QPointer<ScrAction> >::ConstIterator it = menuActions.begin(); it!=menuActions.end(); ++it )
+		for( QMap<QString, QPointer<ScrAction> >::ConstIterator it = menuActions.begin(); it!=menuActions.end(); ++it )
 		{
 			itemSendtoScrapbookMenu->addAction(*it);
 		}
 	}
 	else if (menuName=="ItemLayer" && itemLayerMenu!=NULL)
 	{
-		for( QHash<QString, QPointer<ScrAction> >::ConstIterator it = menuActions.begin(); it!=menuActions.end(); ++it )
+		for( QMap<QString, QPointer<ScrAction> >::ConstIterator it = menuActions.begin(); it!=menuActions.end(); ++it )
 		{
 			itemLayerMenu->addAction(*it);
 		}
 	}
 	else if (menuName=="EditPasteRecent" && editPasteRecentMenu!=NULL)
 	{
-		for( QHash<QString, QPointer<ScrAction> >::ConstIterator it = menuActions.begin(); it!=menuActions.end(); ++it )
+		for( QMap<QString, QPointer<ScrAction> >::ConstIterator it = menuActions.begin(); it!=menuActions.end(); ++it )
 		{
 			editPasteRecentMenu->addAction(*it);
 		}

Modified: trunk/Scribus/scribus/menumanager.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18551&path=/trunk/Scribus/scribus/menumanager.h
==============================================================================
--- trunk/Scribus/scribus/menumanager.h (original)
+++ trunk/Scribus/scribus/menumanager.h Sun Oct 13 10:08:41 2013
@@ -80,7 +80,7 @@
 		void addMenuItemString(const QString& s, const QString &parent);
 		void addMenuItemStringstoMenuBar(const QString &menuName, const QMap<QString, QPointer<ScrAction> > &menuActions);
 		void addMenuItemStringstoMenu(const QString &menuName, QMenu *menuToAddTo, const QMap<QString, QPointer<ScrAction> > &menuActions);
-		void addMenuItemStringstoSpecialMenu(const QString &menuName, const QHash<QString, QPointer<ScrAction> > &menuActions);
+		void addMenuItemStringstoSpecialMenu(const QString &menuName, const QMap<QString, QPointer<ScrAction> > &menuActions);
 		void clearMenuStrings(const QString &menuName);
 		void addMenuItemStringAfter(const QString &s, const QString &after, const QString &parent);
 	public slots:

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18551&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Sun Oct 13 10:08:41 2013
@@ -3666,7 +3666,7 @@
 	{
 		strippedName = localName = QDir::toNativeSeparators(RecentDocs[m]);
 		strippedName.remove(QDir::separator());
-		strippedName.prepend(QString("%1").arg(m+1));
+		strippedName.prepend(QString("%1").arg(m+1, 2, 10, QChar('0')));
 		scrRecentFileActions.insert(strippedName, new ScrAction(ScrAction::RecentFile, QPixmap(), QPixmap(), QString("%1 &%2").arg(m+1).arg(localName.replace("&","&&")), QKeySequence(), this, 0,0.0,RecentDocs[m]));
 		connect( scrRecentFileActions[strippedName], SIGNAL(triggeredData(QString)), this, SLOT(loadRecent(QString)) );
 //		scrMenuMgr->addMenuItem(scrRecentFileActions[strippedName], "FileOpenRecent", true);
@@ -3903,12 +3903,12 @@
 		Q_ASSERT(found);
 		scrLayersActions[QString("%1").arg((*it).ID)]->setChecked(true);
 
-		for( QHash<QString, QPointer<ScrAction> >::Iterator it = scrLayersActions.begin(); it!=scrLayersActions.end(); ++it )
+		for( QMap<QString, QPointer<ScrAction> >::Iterator it = scrLayersActions.begin(); it!=scrLayersActions.end(); ++it )
 		{
 			//scrMenuMgr->addMenuItem((*it), "ItemLayer", true);
 			connect( (*it), SIGNAL(triggeredData(int)), doc, SLOT(itemSelection_SendToLayer(int)) );
 		}
-		scrMenuMgr->addMenuItemStringstoSpecialMenu("ItemLayer", scrRecentFileActions);
+		scrMenuMgr->addMenuItemStringstoSpecialMenu("ItemLayer", scrLayersActions);
 
 	}
 }
@@ -3917,15 +3917,15 @@
 {
 	if (HaveDoc)
 	{
-		QHash<QString, QPointer<ScrAction> >::Iterator itend=scrLayersActions.end();
-		for( QHash<QString, QPointer<ScrAction> >::Iterator it = scrLayersActions.begin(); it!=itend; ++it )
+		QMap<QString, QPointer<ScrAction> >::Iterator itend=scrLayersActions.end();
+		for( QMap<QString, QPointer<ScrAction> >::Iterator it = scrLayersActions.begin(); it!=itend; ++it )
 		{
 			disconnect( (*it), SIGNAL(triggeredData(int)), 0, 0 );
 			(*it)->setChecked(false);
 		}
 		if (doc->m_Selection->count()>0 && doc->m_Selection->itemAt(0))
 			scrLayersActions[QString("%1").arg(doc->m_Selection->itemAt(0)->LayerID)]->setChecked(true);
-		for( QHash<QString, QPointer<ScrAction> >::Iterator it = scrLayersActions.begin(); it!=itend; ++it )
+		for( QMap<QString, QPointer<ScrAction> >::Iterator it = scrLayersActions.begin(); it!=itend; ++it )
 			connect( (*it), SIGNAL(triggeredData(int)), doc, SLOT(itemSelection_SendToLayer(int)) );
 	}
 }

Modified: trunk/Scribus/scribus/scribus.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18551&path=/trunk/Scribus/scribus/scribus.h
==============================================================================
--- trunk/Scribus/scribus/scribus.h (original)
+++ trunk/Scribus/scribus/scribus.h Sun Oct 13 10:08:41 2013
@@ -236,12 +236,12 @@
 	QProcess *ExternalApp;
 
 	QMap<QString, QPointer<ScrAction> > scrActions;
-	QHash<QString, QPointer<ScrAction> > scrRecentFileActions;
-	QHash<QString, QPointer<ScrAction> > scrWindowsActions;
-	QHash<QString, QPointer<ScrAction> > scrScrapActions;
-	QHash<QString, QPointer<ScrAction> > scrLayersActions;
-	QHash<QString, QPointer<ScrAction> > scrRecentPasteActions;
-	QHash<QString, QPointer<ScToolBar> > scrToolBars;
+	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;
 	QMultiHash<QString, QActionGroup*> scrActionGroups;
 	ScMWMenuManager* scrMenuMgr;
 	ActionManager* actionManager;




More information about the scribus-commit mailing list