r24946 by craig - #16754: Put current version of Scribus keyset file on top of preferences

scribus-commit scribus-commit at lists.scribus.net
Fri Feb 18 15:50:39 UTC 2022


Author: craig
Date: Fri Feb 18 15:50:38 2022
New Revision: 24946

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24946
Log:
#16754: Put current version of Scribus keyset file on top of preferences
UI list

Modified:
    trunk/Scribus/resources/keysets/CMakeLists.txt
    trunk/Scribus/scribus/ui/prefs_keyboardshortcuts.cpp

Modified: trunk/Scribus/resources/keysets/CMakeLists.txt
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24946&path=/trunk/Scribus/resources/keysets/CMakeLists.txt
==============================================================================
--- trunk/Scribus/resources/keysets/CMakeLists.txt	(original)
+++ trunk/Scribus/resources/keysets/CMakeLists.txt	Fri Feb 18 15:50:38 2022
@@ -7,5 +7,6 @@
 pageplusx3.xml
 pagestream.xml
 scribus15.xml
-  DESTINATION ${SHAREDIR}keysets
+scribus17.xml
+DESTINATION ${SHAREDIR}keysets
 )

Modified: trunk/Scribus/scribus/ui/prefs_keyboardshortcuts.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24946&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 18 15:50:38 2022
@@ -12,6 +12,7 @@
 #include <QMessageBox>
 
 #include "actionmanager.h"
+#include "api/api_application.h"
 #include "commonstrings.h"
 #include "iconmanager.h"
 #include "pluginmanager.h"
@@ -247,24 +248,22 @@
 QStringList Prefs_KeyboardShortcuts::scanForSets()
 {
 	keySetList.clear();
-	QString location(ScPaths::instance().shareDir());
-	QDir keySetsDir(QDir::toNativeSeparators(location+"keysets/"), "*.xml", QDir::Name, QDir::Files | QDir::NoSymLinks);
+	QString location(ScPaths::instance().shareDir()+"keysets/");
+	QDir keySetsDir(QDir::toNativeSeparators(location), "*.xml", QDir::Name, QDir::Files | QDir::NoSymLinks);
 	if ((!keySetsDir.exists()) || (keySetsDir.count() <= 0))
 		return QStringList();
 
 	QStringList appNames;
 	for (uint fileCounter = 0; fileCounter < keySetsDir.count(); ++fileCounter)
 	{
-		QString filename(QDir::toNativeSeparators(location+"keysets/"+keySetsDir[fileCounter]));
-
-		QDomDocument doc( "keymapentries" );
-		QFile file( filename );
+		QString filename(QDir::toNativeSeparators(location+keySetsDir[fileCounter]));
+		QDomDocument doc("keymapentries");
+		QFile file(filename);
 		if (!file.open( QIODevice::ReadOnly))
 			continue;
 		QString errorMsg;
 		int eline;
 		int ecol;
-
 		if (!doc.setContent( &file, &errorMsg, &eline, &ecol ))
 		{
 			qDebug("%s", QString("Could not open key set file: %1\nError:%2 at line: %3, row: %4").arg(keySetsDir[fileCounter], errorMsg).arg(eline).arg(ecol).toLatin1().constData());
@@ -276,8 +275,11 @@
 		QDomElement docElem = doc.documentElement();
 		if (docElem.tagName() == "shortcutset" && docElem.hasAttribute("name"))
 		{
-			QDomAttr nameAttr = docElem.attributeNode( "name" );
-			appNames.append(nameAttr.value());
+			QDomAttr nameAttr = docElem.attributeNode("name");
+			if(nameAttr.value().contains(ScribusAPI::getVersionScribus().remove(".svn")))
+				appNames.prepend(nameAttr.value());
+			else
+				appNames.append(nameAttr.value());
 			keySetList.insert(nameAttr.value(), filename);
 		}
 	}




More information about the scribus-commit mailing list