r21763 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:42:35 UTC 2017


Author: jghali
Date: Fri Feb 10 23:42:35 2017
New Revision: 21763

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

Modified:
    trunk/Scribus/scribus/ui/prefs_keyboardshortcuts.cpp

Modified: trunk/Scribus/scribus/ui/prefs_keyboardshortcuts.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21763&path=/trunk/Scribus/scribus/ui/prefs_keyboardshortcuts.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_keyboardshortcuts.cpp	(original)
+++ trunk/Scribus/scribus/ui/prefs_keyboardshortcuts.cpp	Fri Feb 10 23:42:35 2017
@@ -5,6 +5,7 @@
 for which a new license (GPL+exception) is in place.
 */
 
+#include <QDebug>
 #include <QDomDocument>
 #include <QFileDialog>
 #include <QInputDialog>
@@ -339,8 +340,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);
@@ -349,9 +359,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.toString(QKeySequence::NativeText));
+			lviToActionMap.insert(currLVI, actionName);
+			currLVI->setText(0, actionKeys.cleanMenuText);
+			currLVI->setText(1, actionKeys.keySequence.toString(QKeySequence::NativeText));
 			prevLVI=currLVI;
 		}
 	}
@@ -374,8 +384,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);
@@ -384,9 +403,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.toString(QKeySequence::NativeText));
+			lviToActionMap.insert(currLVI, actionName);
+			currLVI->setText(0, actionKeys.cleanMenuText);
+			currLVI->setText(1, actionKeys.keySequence.toString(QKeySequence::NativeText));
 			prevLVI=currLVI;
 		}
 	}




More information about the scribus-commit mailing list