Commit b3b0914d authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

Drop KDELibs4Support dependency, move KGlobalSettings usage

This process is blocking the whole startup of Plasma, so it should be as
lean as possible.

Reviewed by David Edmundson
parent 461243be
......@@ -33,8 +33,9 @@ add_executable(kapplymousetheme ${kapplymousetheme_SRCS} ${kcminput_backend_SRCS
target_link_libraries(kapplymousetheme
Qt5::Gui
Qt5::DBus
KF5::CoreAddons
KF5::ConfigCore
KF5::KDELibs4Support
${kcminput_backend_LIBS}
)
......
......@@ -19,9 +19,10 @@
#include "mousesettings.h"
#include "mousebackend.h"
#include <QDBusMessage>
#include <QDBusConnection>
#include <KSharedConfig>
#include <KConfigGroup>
#include <KGlobalSettings>
#include "../migrationlib/kdelibs4config.h"
......@@ -81,7 +82,29 @@ void MouseSettings::load(KConfig *config, MouseBackend *backend)
dragStartDist = group.readEntry("StartDragDist", 4);
wheelScrollLines = group.readEntry("WheelScrollLines", 3);
singleClick = group.readEntry("SingleClick", KDE_DEFAULT_SINGLECLICK);
singleClick = group.readEntry("SingleClick", true);
}
// see KGlobalSettings::emitChange
enum ChangeType { PaletteChanged = 0, FontChanged, StyleChanged,
SettingsChanged, IconChanged, CursorChanged,
ToolbarStyleChanged, ClipboardConfigChanged,
BlockShortcuts, NaturalSortingChanged
};
enum SettingsCategory { SETTINGS_MOUSE, SETTINGS_COMPLETION, SETTINGS_PATHS,
SETTINGS_POPUPMENU, SETTINGS_QT, SETTINGS_SHORTCUTS,
SETTINGS_LOCALE, SETTINGS_STYLE
};
static void emitChange(ChangeType changeType, int arg)
{
// see KGlobalSettings::emitChange
QDBusMessage message = QDBusMessage::createSignal("/KGlobalSettings", "org.kde.KGlobalSettings", "notifyChange");
QList<QVariant> args;
args.append(static_cast<int>(changeType));
args.append(arg);
message.setArguments(args);
QDBusConnection::sessionBus().send(message);
}
void MouseSettings::save(KConfig *config)
......@@ -112,5 +135,5 @@ void MouseSettings::save(KConfig *config)
Kdelibs4SharedConfig::syncConfigGroup(QLatin1String("Mouse"), "kcminputrc");
Kdelibs4SharedConfig::syncConfigGroup(QLatin1String("KDE"), "kdeglobals");
KGlobalSettings::self()->emitChange(KGlobalSettings::SettingsChanged, KGlobalSettings::SETTINGS_MOUSE);
emitChange(SettingsChanged, SETTINGS_MOUSE);
}
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