[graphics/krita] libs/widgetutils: Check whether the shortcuts file exists before loading it
Halla Rempt
null at kde.org
Mon Sep 20 12:07:00 BST 2021
Git commit ad52cf5daaaf7605f70eb483f4fe9be295d239bf by Halla Rempt.
Committed on 20/09/2021 at 11:06.
Pushed by rempt into branch 'master'.
Check whether the shortcuts file exists before loading it
This solves the empty menu entries problem.
CCMAIL:kimageshop at kde.org
BUG:428453
M +5 -0 libs/widgetutils/kis_action_registry.cpp
M +5 -1 libs/widgetutils/xmlgui/kshortcutschemeseditor.cpp
https://invent.kde.org/graphics/krita/commit/ad52cf5daaaf7605f70eb483f4fe9be295d239bf
diff --git a/libs/widgetutils/kis_action_registry.cpp b/libs/widgetutils/kis_action_registry.cpp
index efcc018211..c02f3359cf 100644
--- a/libs/widgetutils/kis_action_registry.cpp
+++ b/libs/widgetutils/kis_action_registry.cpp
@@ -9,6 +9,7 @@
#include <QHash>
#include <QGlobalStatic>
#include <QFile>
+#include <QFileInfo>
#include <QDomElement>
#include <KSharedConfig>
#include <klocalizedstring.h>
@@ -188,6 +189,10 @@ KisActionRegistry::KisActionRegistry()
{
KConfigGroup cg = KSharedConfig::openConfig()->group("Shortcut Schemes");
QString schemeName = cg.readEntry("Current Scheme", "Default");
+ QString schemeFileName = KShortcutSchemesHelper::schemeFileLocations().value(schemeName);
+ if (!QFileInfo(schemeFileName).exists()) {
+ schemeName = "Default";
+ }
loadShortcutScheme(schemeName);
loadCustomShortcuts();
}
diff --git a/libs/widgetutils/xmlgui/kshortcutschemeseditor.cpp b/libs/widgetutils/xmlgui/kshortcutschemeseditor.cpp
index 9d897054c6..c35938dcd7 100644
--- a/libs/widgetutils/xmlgui/kshortcutschemeseditor.cpp
+++ b/libs/widgetutils/xmlgui/kshortcutschemeseditor.cpp
@@ -43,7 +43,11 @@ KShortcutSchemesEditor::KShortcutSchemesEditor(KisShortcutsDialog *parent)
auto schemeFileLocations = KShortcutSchemesHelper::schemeFileLocations();
schemes << schemeFileLocations.keys();
- const QString currentScheme = group.readEntry("Current Scheme", "Default");
+ QString currentScheme = group.readEntry("Current Scheme", "Default");
+ QString schemeFileName = KShortcutSchemesHelper::schemeFileLocations().value(currentScheme);
+ if (!QFileInfo(schemeFileName).exists()) {
+ currentScheme = "Default";
+ }
setMargin(0);
QLabel *schemesLabel = new QLabel(i18n("Shortcut Schemes:"), m_dialog);
More information about the kimageshop
mailing list