diff --git a/decorations/decoratedclient.cpp b/decorations/decoratedclient.cpp
--- a/decorations/decoratedclient.cpp
+++ b/decorations/decoratedclient.cpp
@@ -18,6 +18,7 @@
along with this program. If not, see .
*********************************************************************/
#include "decoratedclient.h"
+#include "decorationbridge.h"
#include "decorationpalette.h"
#include "decorationrenderer.h"
#include "abstract_client.h"
@@ -220,6 +221,10 @@
void DecoratedClientImpl::requestShowToolTip(const QString &text)
{
+ if (!DecorationBridge::self()->showToolTips()) {
+ return;
+ }
+
m_toolTipText = text;
int wakeUpDelay = QApplication::style()->styleHint(QStyle::SH_ToolTip_WakeUpDelay);
diff --git a/decorations/decorationbridge.h b/decorations/decorationbridge.h
--- a/decorations/decorationbridge.h
+++ b/decorations/decorationbridge.h
@@ -61,6 +61,10 @@
return m_blur;
}
+ bool showToolTips() const {
+ return m_showToolTips;
+ }
+
void reconfigure();
const QSharedPointer &settings() const {
@@ -75,9 +79,11 @@
void findTheme(const QVariantMap &map);
void initPlugin();
QString readTheme() const;
+ void readDecorationOptions();
KPluginFactory *m_factory;
KSharedConfig::Ptr m_lnfConfig;
bool m_blur;
+ bool m_showToolTips;
QString m_plugin;
QString m_defaultTheme;
QString m_theme;
diff --git a/decorations/decorationbridge.cpp b/decorations/decorationbridge.cpp
--- a/decorations/decorationbridge.cpp
+++ b/decorations/decorationbridge.cpp
@@ -65,14 +65,17 @@
: KDecoration2::DecorationBridge(parent)
, m_factory(nullptr)
, m_blur(false)
+ , m_showToolTips(false)
, m_settings()
, m_noPlugin(false)
{
KConfigGroup cg(KSharedConfig::openConfig(), "KDE");
// try to extract the proper defaults file from a lookandfeel package
const QString looknfeel = cg.readEntry(QStringLiteral("LookAndFeelPackage"), "org.kde.breeze.desktop");
m_lnfConfig = KSharedConfig::openConfig(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("plasma/look-and-feel/") + looknfeel + QStringLiteral("/contents/defaults")));
+
+ readDecorationOptions();
}
DecorationBridge::~DecorationBridge()
@@ -101,6 +104,11 @@
return kwinApp()->config()->group(s_pluginName).readEntry("theme", cg.readEntry("theme", m_defaultTheme));
}
+void DecorationBridge::readDecorationOptions()
+{
+ m_showToolTips = kwinApp()->config()->group(s_pluginName).readEntry("ShowToolTips", true);
+}
+
void DecorationBridge::init()
{
using namespace KWayland::Server;
@@ -156,6 +164,8 @@
void DecorationBridge::reconfigure()
{
+ readDecorationOptions();
+
if (m_noPlugin != readNoPlugin()) {
m_noPlugin = !m_noPlugin;
// no plugin setting changed
diff --git a/kcmkwin/kwindecoration/kcm.h b/kcmkwin/kwindecoration/kcm.h
--- a/kcmkwin/kwindecoration/kcm.h
+++ b/kcmkwin/kwindecoration/kcm.h
@@ -57,6 +57,7 @@
Q_PROPERTY(QAbstractListModel *rightButtonsModel READ rightButtonsModel NOTIFY buttonsChanged)
Q_PROPERTY(QAbstractListModel *availableButtonsModel READ availableButtonsModel CONSTANT)
Q_PROPERTY(bool closeOnDoubleClickOnMenu READ closeOnDoubleClickOnMenu WRITE setCloseOnDoubleClickOnMenu NOTIFY closeOnDoubleClickOnMenuChanged)
+ Q_PROPERTY(bool showToolTips READ showToolTips WRITE setShowToolTips NOTIFY showToolTipsChanged)
public:
KCMKWinDecoration(QObject *parent, const QVariantList &arguments);
@@ -69,19 +70,22 @@
int borderSize() const;
int theme() const;
bool closeOnDoubleClickOnMenu() const;
+ bool showToolTips() const;
void setBorderSize(int index);
void setBorderSize(KDecoration2::BorderSize size);
void setTheme(int index);
void setCloseOnDoubleClickOnMenu(bool enable);
+ void setShowToolTips(bool show);
Q_INVOKABLE void getNewStuff(QQuickItem *context);
Q_SIGNALS:
void themeChanged();
void buttonsChanged();
void borderSizeChanged();
void closeOnDoubleClickOnMenuChanged();
+ void showToolTipsChanged();
public Q_SLOTS:
void load() override;
@@ -107,6 +111,7 @@
KDecoration2::BorderSize borderSize;
int themeIndex;
bool closeOnDoubleClickOnMenu;
+ bool showToolTips;
DecorationButtonsList buttonsOnLeft;
DecorationButtonsList buttonsOnRight;
};
diff --git a/kcmkwin/kwindecoration/kcm.cpp b/kcmkwin/kwindecoration/kcm.cpp
--- a/kcmkwin/kwindecoration/kcm.cpp
+++ b/kcmkwin/kwindecoration/kcm.cpp
@@ -50,11 +50,13 @@
const QString s_configTheme { QStringLiteral("theme") };
const QString s_configBorderSize { QStringLiteral("BorderSize") };
const QString s_configCloseOnDoubleClickOnMenu { QStringLiteral("CloseOnDoubleClickOnMenu") };
+const QString s_configShowToolTips { QStringLiteral("ShowToolTips") };
const QString s_configDecoButtonsOnLeft { QStringLiteral("ButtonsOnLeft") };
const QString s_configDecoButtonsOnRight { QStringLiteral("ButtonsOnRight") };
const KDecoration2::BorderSize s_defaultBorderSize = KDecoration2::BorderSize::Normal;
const bool s_defaultCloseOnDoubleClickOnMenu = false;
+const bool s_defaultShowToolTips = true;
const DecorationButtonsList s_defaultDecoButtonsOnLeft {
KDecoration2::DecorationButtonType::Menu,
@@ -83,7 +85,7 @@
, m_leftButtonsModel(new KDecoration2::Preview::ButtonsModel(DecorationButtonsList(), this))
, m_rightButtonsModel(new KDecoration2::Preview::ButtonsModel(DecorationButtonsList(), this))
, m_availableButtonsModel(new KDecoration2::Preview::ButtonsModel(this))
- , m_savedSettings{ s_defaultBorderSize, -2 /* for setTheme() */, false, s_defaultDecoButtonsOnLeft, s_defaultDecoButtonsOnRight }
+ , m_savedSettings{ s_defaultBorderSize, -2 /* for setTheme() */, false, s_defaultShowToolTips, s_defaultDecoButtonsOnLeft, s_defaultDecoButtonsOnRight }
, m_currentSettings(m_savedSettings)
{
auto about = new KAboutData(QStringLiteral("kcm_kwindecoration"),
@@ -160,6 +162,7 @@
setTheme(themeIndex);
setCloseOnDoubleClickOnMenu(config.readEntry(s_configCloseOnDoubleClickOnMenu, s_defaultCloseOnDoubleClickOnMenu));
+ setShowToolTips(config.readEntry(s_configShowToolTips, s_defaultShowToolTips));
const QString defaultSizeName = Utils::borderSizeToString(s_defaultBorderSize);
setBorderSize(Utils::stringToBorderSize(config.readEntry(s_configBorderSize, defaultSizeName)));
@@ -192,6 +195,7 @@
}
config.writeEntry(s_configCloseOnDoubleClickOnMenu, m_currentSettings.closeOnDoubleClickOnMenu);
+ config.writeEntry(s_configShowToolTips, m_currentSettings.showToolTips);
config.writeEntry(s_configBorderSize, Utils::borderSizeToString(m_currentSettings.borderSize));
config.writeEntry(s_configDecoButtonsOnLeft, Utils::buttonsToString(m_currentSettings.buttonsOnLeft));
config.writeEntry(s_configDecoButtonsOnRight, Utils::buttonsToString(m_currentSettings.buttonsOnRight));
@@ -217,6 +221,7 @@
setTheme(themeIndex);
setBorderSize(s_defaultBorderSize);
setCloseOnDoubleClickOnMenu(s_defaultCloseOnDoubleClickOnMenu);
+ setShowToolTips(s_defaultShowToolTips);
m_leftButtonsModel->replace(s_defaultDecoButtonsOnLeft);
m_rightButtonsModel->replace(s_defaultDecoButtonsOnRight);
@@ -230,6 +235,7 @@
m_currentSettings.buttonsOnRight = m_rightButtonsModel->buttons();
setNeedsSave(m_savedSettings.closeOnDoubleClickOnMenu != m_currentSettings.closeOnDoubleClickOnMenu
+ || m_savedSettings.showToolTips != m_currentSettings.showToolTips
|| m_savedSettings.borderSize != m_currentSettings.borderSize
|| m_savedSettings.themeIndex != m_currentSettings.themeIndex
|| m_savedSettings.buttonsOnLeft != m_currentSettings.buttonsOnLeft
@@ -276,6 +282,11 @@
return m_currentSettings.closeOnDoubleClickOnMenu;
}
+bool KCMKWinDecoration::showToolTips() const
+{
+ return m_currentSettings.showToolTips;
+}
+
void KCMKWinDecoration::setBorderSize(int index)
{
setBorderSize(Utils::getBorderSizeNames().keys().at(index));
@@ -312,4 +323,14 @@
updateNeedsSave();
}
+void KCMKWinDecoration::setShowToolTips(bool show)
+{
+ if (m_currentSettings.showToolTips == show) {
+ return;
+ }
+ m_currentSettings.showToolTips = show;
+ emit showToolTipsChanged();
+ updateNeedsSave();
+}
+
#include "kcm.moc"
diff --git a/kcmkwin/kwindecoration/package/contents/ui/main.qml b/kcmkwin/kwindecoration/package/contents/ui/main.qml
--- a/kcmkwin/kwindecoration/package/contents/ui/main.qml
+++ b/kcmkwin/kwindecoration/package/contents/ui/main.qml
@@ -120,6 +120,13 @@
showCloseButton: true
visible: false
}
+
+ Controls.CheckBox {
+ id: showToolTipsCheckBox
+ text: i18nc("checkbox label", "Show decoration button tooltips")
+ checked: kcm.showToolTips
+ onToggled: kcm.showToolTips = checked
+ }
}
}
}