Commit 715e497d authored by Mikhail Zolotukhin's avatar Mikhail Zolotukhin

[Gtk Config] Port cursor theme sync to KConfigWatcher

Summary:
Port from deprecated dbus signal to KConfigWatcher.

Depends on: D27942

Test Plan:
1. Apply D27942
2. Restart kded5
3. Apply any cursor theme from KCM
4. Check if GTK applications heve the changed cursor

Reviewers: #plasma, ngraham

Reviewed By: ngraham

Subscribers: ngraham, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D27943
parent c8b68ae7
......@@ -39,7 +39,8 @@ GtkConfig::GtkConfig(QObject *parent, const QVariantList&) :
configValueProvider(new ConfigValueProvider()),
themePreviewer(new ThemePreviewer(this)),
kdeglobalsConfigWatcher(KConfigWatcher::create(KSharedConfig::openConfig(QStringLiteral("kdeglobals")))),
kwinConfigWatcher(KConfigWatcher::create(KSharedConfig::openConfig(QStringLiteral("kwinrc"))))
kwinConfigWatcher(KConfigWatcher::create(KSharedConfig::openConfig(QStringLiteral("kwinrc")))),
kcminputConfigWatcher(KConfigWatcher::create(KSharedConfig::openConfig(QStringLiteral("kcminputrc"))))
{
QDBusConnection dbus = QDBusConnection::sessionBus();
dbus.registerService(QStringLiteral("org.kde.GtkConfig"));
......@@ -49,6 +50,7 @@ GtkConfig::GtkConfig(QObject *parent, const QVariantList&) :
connect(KIconLoader::global(), &KIconLoader::iconChanged, this, &GtkConfig::setIconTheme);
connect(kdeglobalsConfigWatcher.data(), &KConfigWatcher::configChanged, this, &GtkConfig::onKdeglobalsSettingsChange);
connect(kwinConfigWatcher.data(), &KConfigWatcher::configChanged, this, &GtkConfig::onKWinSettingsChange);
connect(kcminputConfigWatcher.data(), &KConfigWatcher::configChanged, this, &GtkConfig::onKCMInputSettingsChange);
dbus.connect(
QString(),
QStringLiteral("/KGlobalSettings"),
......@@ -211,9 +213,7 @@ void GtkConfig::onGlobalSettingsChange(int settingsChangeType, int arg) const
SettingsChangeType changeType = static_cast<SettingsChangeType>(settingsChangeType);
SettingsCategory settingsCategory = static_cast<SettingsCategory>(arg);
if (changeType == SettingsChangeType::Cursor) {
setCursorTheme();
} else if (changeType == SettingsChangeType::Settings && settingsCategory == SettingsCategory::Style) {
if (changeType == SettingsChangeType::Settings && settingsCategory == SettingsCategory::Style) {
setIconsOnButtons();
setIconsInMenus();
setToolbarStyle();
......@@ -240,4 +240,13 @@ void GtkConfig::onKWinSettingsChange(const KConfigGroup &group, const QByteArray
}
}
void GtkConfig::onKCMInputSettingsChange(const KConfigGroup& group, const QByteArrayList& names) const
{
if (group.name() == QStringLiteral("Mouse")
&& names.contains("cursorTheme")) {
setCursorTheme();
}
}
#include "gtkconfig.moc"
......@@ -86,10 +86,12 @@ public Q_SLOTS:
void onGlobalSettingsChange(int settingsChangeType, int arg) const;
void onKdeglobalsSettingsChange(const KConfigGroup &group, const QByteArrayList &names) const;
void onKWinSettingsChange(const KConfigGroup &group, const QByteArrayList &names) const;
void onKCMInputSettingsChange(const KConfigGroup &group, const QByteArrayList &names) const;
private:
QScopedPointer<ConfigValueProvider> configValueProvider;
QScopedPointer<ThemePreviewer> themePreviewer;
KConfigWatcher::Ptr kdeglobalsConfigWatcher;
KConfigWatcher::Ptr kwinConfigWatcher;
KConfigWatcher::Ptr kcminputConfigWatcher;
};
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