[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-kimageshop
Subject:    =?utf-8?q?=5Bgraphics/krita=5D_libs/widgetutils=3A_Check_whether_the_shortcuts_file_exists_before_lo
From:       Halla Rempt <null () kde ! org>
Date:       2021-09-20 11:07:00
Message-ID: 20210920110700.2A6D31243239 () leptone ! kde ! org
[Download RAW message or body]

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@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);


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic