Commit 57c99ecf authored by David Redondo's avatar David Redondo 🏎 Committed by Christoph Cullmann
Browse files

ColorSchemeChooser improvements

Since KF 5.67 KColorSchemeManager has a system theme option that reacts to
system theme changes so we don't need to read the system color scheme if the
user didn't set a custom scheme. Also use the proper term "Color Scheme"
instead of "Color Theme".
parent 5a204c22
......@@ -30,11 +30,13 @@
#include <QModelIndex>
#include <QStandardPaths>
#include <QStringList>
#include <QtGlobal>
#include <KActionCollection>
#include <KActionMenu>
#include <KColorSchemeManager>
#include <KConfigGroup>
#include <kconfigwidgets_version.h>
#include <KLocalizedString>
#include <KSharedConfig>
......@@ -57,7 +59,7 @@ KateColorSchemeChooser::KateColorSchemeChooser(QObject *parent)
setMenu(selectionMenu->menu());
menu()->setIcon(QIcon::fromTheme(QStringLiteral("preferences-desktop-color")));
menu()->setTitle(i18n("&Color Theme"));
menu()->setTitle(i18n("&Color Scheme"));
}
QString KateColorSchemeChooser::loadCurrentScheme() const
......@@ -77,6 +79,7 @@ void KateColorSchemeChooser::saveCurrentScheme(const QString &name)
QString KateColorSchemeChooser::currentDesktopDefaultScheme() const
{
#if KCONFIGWIDGETS_VERSION < QT_VERSION_CHECK(5, 67, 0)
KSharedConfigPtr config = KSharedConfig::openConfig(QStringLiteral("kdeglobals"));
KConfigGroup group(config, "General");
const QString scheme = group.readEntry("ColorScheme", QStringLiteral("Breeze"));
......@@ -85,6 +88,10 @@ QString KateColorSchemeChooser::currentDesktopDefaultScheme() const
KSharedConfigPtr schemeFile = KSharedConfig::openConfig(path, KConfig::SimpleConfig);
const QString name = KConfigGroup(schemeFile, "General").readEntry("Name", scheme);
return name;
#else
return QString();
#endif
}
QString KateColorSchemeChooser::currentSchemeName() const
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment