r21762 by jghali - do not attempt to display actions with no text in keyboard shortcut prefs

scribus-commit scribus-commit at lists.scribus.net
Fri Feb 10 23:38:52 UTC 2017


Author: jghali
Date: Fri Feb 10 23:38:52 2017
New Revision: 21762

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21762
Log:
do not attempt to display actions with no text in keyboard shortcut prefs

Modified:
    branches/Version14x/Scribus/scribus/tabkeyboardshortcutswidget.cpp

Modified: branches/Version14x/Scribus/scribus/tabkeyboardshortcutswidget.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21762&path=/branches/Version14x/Scribus/scribus/tabkeyboardshortcutswidget.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/tabkeyboardshortcutswidget.cpp	(original)
+++ branches/Version14x/Scribus/scribus/tabkeyboardshortcutswidget.cpp	Fri Feb 10 23:38:52 2017
@@ -377,8 +377,17 @@
 		first=true;
 		currLVI=0;
 		prevLVI=0;
-		for ( QStringList::Iterator it = itmenu->second.begin(); it != itmenu->second.end(); ++it )
-		{
+		for (int i = 0; i < itmenu->second.count(); ++i)
+		{
+			QString actionName = itmenu->second.at(i);
+			if (!keyMap.contains(actionName))
+			{
+				qDebug() << "The action " << actionName << " is not defined in shortcut map";
+				continue;
+			}
+			const Keys &actionKeys = keyMap[actionName];
+			if (actionKeys.cleanMenuText.isEmpty())
+				continue;
 			if (first)
 			{
 				currLVI = new QTreeWidgetItem(currMenuLVI);
@@ -387,10 +396,10 @@
 			else
 				currLVI = new QTreeWidgetItem(currMenuLVI, prevLVI);
 			Q_CHECK_PTR(currLVI);
-			lviToActionMap.insert(currLVI, *it);
-			currLVI->setText(0, keyMap[*it].cleanMenuText);
-			currLVI->setText(1, keyMap[*it].keySequence);
-			prevLVI=currLVI;
+			lviToActionMap.insert(currLVI, actionName);
+			currLVI->setText(0, actionKeys.cleanMenuText);
+			currLVI->setText(1, actionKeys.keySequence);
+			prevLVI = currLVI;
 		}
 	}
 	//Non menu actions
@@ -412,8 +421,17 @@
 		first=true;
 		currLVI=0;
 		prevLVI=0;
-		for ( QStringList::Iterator it = itmenu->second.begin(); it != itmenu->second.end(); ++it )
-		{
+		for (int i = 0; i < itmenu->second.count(); ++i)
+		{
+			QString actionName = itmenu->second.at(i);
+			if (!keyMap.contains(actionName))
+			{
+				qDebug() << "The action " << actionName << " is not defined in shortcut map";
+				continue;
+			}
+			const Keys &actionKeys = keyMap[actionName];
+			if (actionKeys.cleanMenuText.isEmpty())
+				continue;
 			if (first)
 			{
 				currLVI=new QTreeWidgetItem(currMenuLVI);
@@ -422,9 +440,9 @@
 			else
 				currLVI=new QTreeWidgetItem(currMenuLVI, prevLVI);
 			Q_CHECK_PTR(currLVI);
-			lviToActionMap.insert(currLVI, *it);
-			currLVI->setText(0, keyMap[*it].cleanMenuText);
-			currLVI->setText(1, keyMap[*it].keySequence);
+			lviToActionMap.insert(currLVI, actionName);
+			currLVI->setText(0, actionKeys.cleanMenuText);
+			currLVI->setText(1, actionKeys.keySequence);
 			prevLVI=currLVI;
 		}
 	}




More information about the scribus-commit mailing list