[education/rkward] rkward/windows: Fix displaying selected color scheme

Nicolas Fella null at kde.org
Thu Mar 31 06:42:09 BST 2022


Git commit 6e0756091b9fa170141a465f1df779d93c46732e by Nicolas Fella.
Committed on 30/03/2022 at 23:06.
Pushed by tfry into branch 'master'.

Fix displaying selected color scheme

Currently when selecting a non-default color scheme and restarting the
app the scheme is applied correctly, but the menu shows the default
scheme as active.

This fixes the issue for KF5 >= 5.93. With older KF5 it works as before

M  +6    -1    rkward/windows/rktoplevelwindowgui.cpp

https://invent.kde.org/education/rkward/commit/6e0756091b9fa170141a465f1df779d93c46732e

diff --git a/rkward/windows/rktoplevelwindowgui.cpp b/rkward/windows/rktoplevelwindowgui.cpp
index 51584853..8103ce7d 100644
--- a/rkward/windows/rktoplevelwindowgui.cpp
+++ b/rkward/windows/rktoplevelwindowgui.cpp
@@ -27,6 +27,7 @@
 #include <KHelpMenu>
 #include <KColorSchemeManager>
 #include <KActionMenu>
+#include <kconfigwidgets_version.h>
 
 #include <QWhatsThis>
 #include <QDomDocument>
@@ -106,7 +107,11 @@ RKTopLevelWindowGUI::RKTopLevelWindowGUI(KXmlGuiWindow *for_window) : QObject(fo
 	KStandardAction::configureToolbars (this, SLOT (configureToolbars()), actionCollection ());
 	// Color scheme action. NOTE: selection is non-permanent for KF5 <= 5.87.0, auto-saved afterwards. Apparently, auto-save cannot be implemented for earlier versions within a few lines of code
 	KColorSchemeManager *manager = new KColorSchemeManager(this);
-	actionCollection()->addAction(QStringLiteral("colorscheme_menu"), manager->createSchemeSelectionMenu(QString(), this));
+#if KCONFIGWIDGETS_VERSION < QT_VERSION_CHECK(5, 67, 0)
+	actionCollection()->addAction(QStringLiteral("colorscheme_menu"), manager->createSchemeSelectionMenu(QString(), this))
+#else
+	actionCollection()->addAction(QStringLiteral("colorscheme_menu"), manager->createSchemeSelectionMenu(this));
+#endif
 	// our "status bar" is inlined, and always visible. Action below would only hide and show a useless proxy
 	// KF6 TODO: Still needed at all?
 	QAction *a = for_window->action("options_show_statusbar");


More information about the rkward-tracker mailing list