diff --git a/shell/osd.h b/shell/osd.h --- a/shell/osd.h +++ b/shell/osd.h @@ -22,6 +22,8 @@ #include #include +#include + namespace KDeclarative { class QmlObject; } @@ -35,7 +37,7 @@ Q_OBJECT Q_CLASSINFO("D-Bus Interface", "org.kde.osdService") public: - Osd(ShellCorona *corona); + Osd(KSharedConfig::Ptr config, ShellCorona *corona); ~Osd() override; public Q_SLOTS: @@ -70,6 +72,8 @@ KDeclarative::QmlObject *m_osdObject = nullptr; QTimer *m_osdTimer = nullptr; int m_timeout = 0; + + KSharedConfig::Ptr m_config; }; #endif // OSD_H diff --git a/shell/osd.cpp b/shell/osd.cpp --- a/shell/osd.cpp +++ b/shell/osd.cpp @@ -29,9 +29,10 @@ #include #include -Osd::Osd(ShellCorona *corona) +Osd::Osd(KSharedConfig::Ptr config, ShellCorona *corona) : QObject(corona) , m_osdPath(corona->lookAndFeelPackage().filePath("osdmainscript")) + , m_config(config) { QDBusConnection::sessionBus().registerObject(QStringLiteral("/org/kde/osdService"), this, QDBusConnection::ExportAllSlots | QDBusConnection::ExportAllSignals); } @@ -161,6 +162,10 @@ return false; } + if (m_config && !KConfigGroup(m_config, QStringLiteral("OSD")).readEntry(QStringLiteral("Enabled"), true)) { + return false; + } + if (!m_osdObject) { m_osdObject = new KDeclarative::QmlObject(this); } diff --git a/shell/shellcorona.cpp b/shell/shellcorona.cpp --- a/shell/shellcorona.cpp +++ b/shell/shellcorona.cpp @@ -217,7 +217,7 @@ }); } - new Osd(this); + new Osd(KSharedConfig::openConfig(), this); } ShellCorona::~ShellCorona()