Commit d608432c authored by Ahmad Samir's avatar Ahmad Samir
Browse files

Port away from KDELibs4Support

Add explicit find_package() and #include's that are required and were
pulled in by KDELibs4Support.

krdb: remove one redundant #include, KColorUtils

kcm_fonts: send dbus message directly to org.kde.KDEPlatformTheme to
'refreshFonts'

kcm_style:
 - use KToolBar::emitToolbarStyleChanged() to notify of toolbar style changes

For the rest use the notifyKcmChange() private method to send the dbus
signal.

[1] https://invent.kde.org/frameworks/kdelibs4support/-/blob/master/src/kdeui/kglobalsettings.cpp#L860
parent 58c34db4
......@@ -34,11 +34,14 @@ include(KDEGitCommitHooks)
include(ECMConfiguredInstall)
include(ECMGenerateDBusServiceFile)
include(ECMQMLModules)
include(ECMGenerateExportHeader)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
Plasma DocTools Runner Notifications NotifyConfig Su NewStuff Wallet
IdleTime Declarative I18n KCMUtils TextWidgets KDELibs4Support Crash GlobalAccel
DBusAddons Wayland CoreAddons People ActivitiesStats Activities KIO Prison PlasmaQuick Package)
Plasma DocTools Runner Notifications NotifyConfig Su NewStuff Wallet IdleTime
Declarative I18n KCMUtils TextWidgets Crash GlobalAccel DBusAddons Wayland
CoreAddons People ActivitiesStats Activities KIO Prison PlasmaQuick Package
GuiAddons Archive ItemModels IconThemes UnitConversion ItemModels Init)
find_package(KDED CONFIG REQUIRED)
find_package(KF5NetworkManagerQt ${KF5_MIN_VERSION})
......@@ -122,6 +125,11 @@ find_package(QtWaylandScanner REQUIRED)
find_package(PlasmaWaylandProtocols REQUIRED)
find_package(Wayland REQUIRED COMPONENTS Client)
if(FONTCONFIG_FOUND)
# kfontinst
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS PrintSupport)
endif()
if(X11_FOUND)
find_package(XCB MODULE REQUIRED COMPONENTS XCB RANDR IMAGE)
set_package_properties(XCB PROPERTIES TYPE REQUIRED)
......
......@@ -24,6 +24,7 @@
#include <QAction>
#include <QIcon>
#include <QUrlQuery>
#include <KLocalizedString>
#include <KRun>
......
......@@ -2,6 +2,7 @@
add_definitions(-DTRANSLATION_DOMAIN=\"kcm_colors\")
set(kcm_colors_SRCS
../kcms-common_p.h
colors.cpp
colorsapplicator.cpp
colorsmodel.cpp
......@@ -46,6 +47,7 @@ set(plasma-apply-colorscheme_SRCS
plasma-apply-colorscheme.cpp
colorsapplicator.cpp
colorsmodel.cpp
../kcms-common_p.h
../krdb/krdb.cpp
)
......
......@@ -19,14 +19,12 @@
#include "colorssettings.h"
#include "colorsmodel.h"
#include "../kcms-common_p.h"
#include "../krdb/krdb.h"
#include <KColorScheme>
#include <KConfig>
#include <QDBusConnection>
#include <QDBusMessage>
static void copyEntry(KConfigGroup &from, KConfigGroup &to, const QString &entry)
{
if (from.hasKey(entry)) {
......@@ -139,11 +137,5 @@ void applyScheme(ColorsSettings *settings, ColorsModel *model)
}
runRdb(KRdbExportQtColors | KRdbExportGtkTheme | (applyToAlien ? KRdbExportColors : 0));
QDBusMessage message =
QDBusMessage::createSignal(QStringLiteral("/KGlobalSettings"), QStringLiteral("org.kde.KGlobalSettings"), QStringLiteral("notifyChange"));
message.setArguments({
0, // previous KGlobalSettings::PaletteChanged. This is now private API in khintsettings
0 // unused in palette changed but needed for the DBus signature
});
QDBusConnection::sessionBus().send(message);
notifyKcmChange(GlobalChangeType::PaletteChanged);
}
......@@ -11,7 +11,9 @@ xcursor/cursortheme.cpp
xcursor/xcursortheme.cpp
xcursor/previewwidget.cpp
xcursor/sortproxymodel.cpp
../kcms-common_p.h
)
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/xcursor/ )
########### next target ###############
......@@ -42,7 +44,6 @@ target_link_libraries(kcm_cursortheme
KF5::WindowSystem
KF5::KIOCore
KF5::KIOWidgets
KF5::KDELibs4Support
KF5::NewStuffCore
KF5::QuickAddons
PW::KWorkspace
......@@ -70,6 +71,7 @@ set(plasma-apply-cursortheme_SRCS
xcursor/themeapplicator.cpp
xcursor/thememodel.cpp
xcursor/xcursortheme.cpp
../kcms-common_p.h
../krdb/krdb.cpp
)
......@@ -82,7 +84,6 @@ target_link_libraries(plasma-apply-cursortheme
KF5::GuiAddons
KF5::I18n
KF5::KCMUtils
KF5::KDELibs4Support
KF5::WindowSystem
X11::X11
XCB::XCB
......
......@@ -23,6 +23,8 @@
#include "kcmcursortheme.h"
#include "krdb.h"
#include "../kcms-common_p.h"
#include "xcursor/cursortheme.h"
#include "xcursor/previewwidget.h"
#include "xcursor/sortproxymodel.h"
......@@ -30,7 +32,6 @@
#include "xcursor/thememodel.h"
#include <KAboutData>
#include <KGlobalSettings>
#include <KIO/CopyJob>
#include <KIO/DeleteJob>
#include <KIO/Job>
......@@ -325,7 +326,7 @@ void CursorThemeConfig::save()
}
removeThemes();
KGlobalSettings::self()->emitChange(KGlobalSettings::CursorChanged);
notifyKcmChange(GlobalChangeType::CursorChanged);
}
void CursorThemeConfig::load()
......
......@@ -18,11 +18,12 @@
#include "cursorthemesettings.h"
#include "../kcms-common_p.h"
#include "xcursor/themeapplicator.h"
#include "xcursor/thememodel.h"
#include "xcursor/cursortheme.h"
#include <KGlobalSettings>
#include <KLocalizedString>
#include <QApplication>
......@@ -76,8 +77,7 @@ int main(int argc, char **argv)
if (theme) {
settings->setCursorTheme(theme->name());
if (settings->save() && applyTheme(theme, theme->defaultCursorSize())) {
// Deprecation warning, since it looks like we genuinely need to do this to successfully propagate the settings
KGlobalSettings::self()->emitChange(KGlobalSettings::CursorChanged);
notifyKcmChange(GlobalChangeType::CursorChanged);
ts << i18n("Successfully applied the mouse cursor theme %1 to your current Plasma session", theme->title()) << endl;
} else {
ts << i18n("You have to restart the Plasma session for your newly applied mouse cursor theme to display correctly.") << endl;
......
......@@ -5,7 +5,14 @@ add_definitions(-DTRANSLATION_DOMAIN=\"kcm_fonts\")
include_directories(../kfontinst/lib)
set(kcm_fonts_PART_SRCS previewrenderengine.cpp previewimageprovider.cpp fonts.cpp fontsaasettings.cpp ../kfontinst/lib/FcEngine.cpp)
set(kcm_fonts_PART_SRCS
previewrenderengine.cpp
previewimageprovider.cpp
fonts.cpp
fontsaasettings.cpp
../kfontinst/lib/FcEngine.cpp
../kcms-common_p.h
)
if(X11_FOUND)
set(kcm_fonts_PART_SRCS ${kcm_fonts_PART_SRCS} ${libkxftconfig_SRCS})
......@@ -23,7 +30,7 @@ kconfig_add_kcfg_files(kcm_fonts_PART_SRCS fontssettings.kcfgc fontsaasettingsba
add_library(kcm_fonts MODULE ${kcm_fonts_PART_SRCS})
target_link_libraries(kcm_fonts KF5::I18n KF5::WindowSystem KF5::KCMUtils KF5::QuickAddons KF5::Declarative KF5::KDELibs4Support kfontinst krdb)
target_link_libraries(kcm_fonts KF5::I18n KF5::WindowSystem KF5::KCMUtils KF5::QuickAddons KF5::Declarative kfontinst krdb)
if(X11_FOUND)
target_link_libraries(kcm_fonts Qt::X11Extras X11::X11 X11::Xft XCB::IMAGE)
......
......@@ -27,6 +27,8 @@
#include "fonts.h"
#include <QApplication>
#include <QDBusConnection>
#include <QDBusMessage>
#include <QFontDatabase>
#include <QQmlEngine>
#include <QQuickItem>
......@@ -38,12 +40,12 @@
#include <KConfig>
#include <KConfigGroup>
#include <KFontChooserDialog>
#include <KGlobalSettings>
#include <KLocalizedString>
#include <KPluginFactory>
#include <KWindowSystem>
#include "krdb.h"
#include "../kcms-common_p.h"
#include "kxftconfig.h"
#include "previewimageprovider.h"
......@@ -159,7 +161,11 @@ void KFonts::save()
QApplication::processEvents();
#endif
KGlobalSettings::self()->emitChange(KGlobalSettings::FontChanged);
// Notify the world about the font changes
if (qEnvironmentVariableIsSet("KDE_FULL_SESSION")) {
QDBusMessage message = QDBusMessage::createSignal("/KDEPlatformTheme", "org.kde.KDEPlatformTheme", "refreshFonts");
QDBusConnection::sessionBus().send(message);
}
runRdb(KRdbExportXftSettings | KRdbExportGtkTheme);
}
......
......@@ -27,6 +27,7 @@
*/
#include "main.h"
#include "../kcms-common_p.h"
#include <QDBusConnection>
#include <QDBusMessage>
......@@ -157,6 +158,7 @@ void IconModule::save()
ManagedConfigModule::save();
if (needToExportToKDE4) {
// Is this still needed?
exportToKDE4();
}
......@@ -301,13 +303,8 @@ void IconModule::exportToKDE4()
}
// message kde4 apps that icon theme has changed
for (int i = 0; i < KIconLoader::LastGroup; i++) {
QDBusMessage message = QDBusMessage::createSignal(QStringLiteral("/KGlobalSettings"),
QStringLiteral("org.kde.KGlobalSettings"),
QStringLiteral("notifyChange"));
message.setArguments({4, // KGlobalSettings::IconChanged
KIconLoader::Group(i)});
QDBusConnection::sessionBus().send(message);
for (int i = 0; i < KIconLoader::LastGroup; ++i) {
notifyKcmChange(GlobalChangeType::IconChanged, KIconLoader::Group(i));
}
cachePathProcess->deleteLater();
......
......@@ -27,11 +27,13 @@
#include "KfiConstants.h"
#include "Misc.h"
#include "config-fontinst.h"
#include <KConfigGroup>
#include <KIO/FileCopyJob>
#include <KIO/StatJob>
#include <KJobWidgets>
#include <KSharedConfig>
#include <QCheckBox>
#include <QCloseEvent>
#include <QDBusServiceWatcher>
......@@ -47,9 +49,12 @@
#include <QStyleOption>
#include <QTemporaryDir>
#include <QTimer>
#include <QUrlQuery>
#include <QVBoxLayout>
#include <QX11Info>
#include <X11/Xlib.h>
#include <fontconfig/fontconfig.h>
#include <kio/global.h>
#include <sys/resource.h>
......
......@@ -40,7 +40,6 @@
#include <QTextStream>
#include <KColorScheme>
#include <KColorUtils>
#include <KConfig>
#include <KConfigGroup>
#include <KLocalizedString>
......
......@@ -20,6 +20,7 @@ configure_file (config-kcm.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kcm.h )
set(kcm_lookandfeel_SRCS
kcmmain.cpp
kcm.cpp
../kcms-common_p.h
)
if (X11_Xcursor_FOUND)
......@@ -52,7 +53,6 @@ target_link_libraries(kcm_lookandfeel
KF5::QuickAddons
KF5::KIOWidgets
KF5::Declarative
KF5::KDELibs4Support
PW::KWorkspace
krdb
)
......@@ -90,6 +90,7 @@ set(plasma-apply-lookandfeel_SRCS
# TODO: load kcm plugin instead of using code copy
kcm.cpp
lookandfeeldata.cpp
../kcms-common_p.h
)
if (X11_Xcursor_FOUND)
......@@ -115,7 +116,6 @@ target_link_libraries(plasma-apply-lookandfeel
KF5::QuickAddons
KF5::KIOWidgets
KF5::Declarative
KF5::KDELibs4Support
PW::KWorkspace
krdb
)
......
......@@ -6,6 +6,7 @@ set( kcmTest_SRCS
kcmtest.cpp
../kcm.cpp
../lookandfeeldata.cpp
../../kcms-common_p.h
)
if (X11_Xcursor_FOUND)
......@@ -33,7 +34,6 @@ target_link_libraries(kcmTest
KF5::QuickAddons
KF5::KIOWidgets
KF5::Declarative
KF5::KDELibs4Support
PW::KWorkspace
X11::X11
krdb
......
......@@ -20,15 +20,16 @@
#include "kcm.h"
#include "krdb.h"
#include "../kcms-common_p.h"
#include "config-kcm.h"
#include "config-workspace.h"
#include <KAboutData>
#include <KAutostart>
#include <KDialogJobUiDelegate>
#include <KGlobalSettings>
#include <KIO/ApplicationLauncherJob>
#include <KIconLoader>
#include <KMessageBox>
#include <KService>
#include <KSharedConfig>
......@@ -431,7 +432,7 @@ void KCMLookandFeel::setWidgetStyle(const QString &style)
m_configGroup.writeEntry("widgetStyle", style, KConfig::Notify);
m_configGroup.sync();
// FIXME: changing style on the fly breaks QQuickWidgets
KGlobalSettings::self()->emitChange(KGlobalSettings::StyleChanged);
notifyKcmChange(GlobalChangeType::StyleChanged);
}
}
......@@ -452,7 +453,7 @@ void KCMLookandFeel::setColors(const QString &scheme, const QString &colorFile)
configGroup.writeEntry("ColorScheme", scheme, KConfig::Notify);
configGroup.sync();
KGlobalSettings::self()->emitChange(KGlobalSettings::PaletteChanged);
notifyKcmChange(GlobalChangeType::PaletteChanged);
}
void KCMLookandFeel::setIcons(const QString &theme)
......@@ -519,7 +520,7 @@ void KCMLookandFeel::setCursorTheme(const QString themeName)
runRdb(0);
// Notify all applications that the cursor theme has changed
KGlobalSettings::self()->emitChange(KGlobalSettings::CursorChanged);
notifyKcmChange(GlobalChangeType::CursorChanged);
// Reload the standard cursors
QStringList names;
......
......@@ -4,6 +4,7 @@ add_definitions(-DTRANSLATION_DOMAIN=\"kcm_style\")
########### next target ###############
set(kcm_style_PART_SRCS
../kcms-common_p.h
styleconfdialog.cpp
kcmstyle.cpp
stylesmodel.cpp
......@@ -35,7 +36,6 @@ target_link_libraries(kcm_style
KF5::KCMUtils
KF5::I18n
KF5::KIOCore
KF5::KDELibs4Support
KF5::QuickAddons
KF5::Archive
KF5::NewStuff
......
......@@ -29,6 +29,7 @@
#include "kcmstyle.h"
#include "../kcms-common_p.h"
#include "styleconfdialog.h"
#include <KAboutData>
......@@ -36,6 +37,7 @@
#include <KLocalizedString>
#include <KPluginFactory>
#include <KPluginLoader>
#include <KToolBar>
#include <QDBusPendingReply>
#include <QDBusPendingCallWatcher>
......@@ -49,8 +51,6 @@
#include <QWidget>
#include <QWindow>
#include <KGlobalSettings>
#include "krdb.h"
#include "kded_interface.h"
......@@ -234,7 +234,7 @@ void KCMStyle::configure(const QString &title, const QString &styleName, QQuickI
emit styleReconfigured(styleName);
// For now, ask all KDE apps to recreate their styles to apply the setitngs
KGlobalSettings::self()->emitChange(KGlobalSettings::StyleChanged);
notifyKcmChange(GlobalChangeType::StyleChanged);
// When user edited a style, assume they want to use it, too
styleSettings()->setWidgetStyle(styleName);
......@@ -331,14 +331,18 @@ void KCMStyle::save()
// Now allow KDE apps to reconfigure themselves.
if (newStyleLoaded) {
KGlobalSettings::self()->emitChange(KGlobalSettings::StyleChanged);
notifyKcmChange(GlobalChangeType::StyleChanged);
}
if (m_effectsDirty) {
KGlobalSettings::self()->emitChange(KGlobalSettings::SettingsChanged, KGlobalSettings::SETTINGS_STYLE);
// ##### FIXME - Doesn't apply all settings correctly due to bugs in
// KApplication/KToolbar
KGlobalSettings::self()->emitChange(KGlobalSettings::ToolbarStyleChanged);
// This notifies listeners about:
// - GraphicEffectsLevel' config entry, (e.g. to set QPlatformTheme::ThemeHint::UiEffects)
// - ShowIconsOnPushButtons config entry, (e.g. to set QPlatformTheme::DialogButtonBoxButtonsHaveIcons)
notifyKcmChange(GlobalChangeType::SettingsChanged, GlobalSettingsCategory::SETTINGS_STYLE);
// FIXME - Doesn't apply all settings correctly due to bugs in KApplication/KToolbar.
// Is this ^ still an issue?
KToolBar::emitToolbarStyleChanged();
}
m_effectsDirty = false;
......
......@@ -29,6 +29,7 @@
#include <QIcon>
#include <QStandardPaths>
#include <QUrl>
#include <QUrlQuery>
#include <KActivities/ResourceInstance>
#include <KLocalizedString>
......
Supports Markdown
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