From 3e820f71c3b3fcdf585f7d2ce4f7af52414f16d5 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Tue, 2 Aug 2022 15:59:36 +0200 Subject: [PATCH] useractions: Don't offer opening KCMs if they weren't built Otherwise this add a few "Configure" entries to the window menu which do nothing. Signed-off-by: Victoria Fischer --- src/config-kwin.h.cmake | 1 + src/useractions.cpp | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/config-kwin.h.cmake b/src/config-kwin.h.cmake index 0b87ce2676..82aba0a2a6 100644 --- a/src/config-kwin.h.cmake +++ b/src/config-kwin.h.cmake @@ -1,6 +1,7 @@ #define KWIN_PLUGIN_VERSION_STRING "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}" #cmakedefine01 KWIN_BUILD_DECORATIONS +#cmakedefine01 KWIN_BUILD_KCMS #cmakedefine01 KWIN_BUILD_NOTIFICATIONS #cmakedefine01 KWIN_BUILD_SCREENLOCKER #cmakedefine01 KWIN_BUILD_TABBOX diff --git a/src/useractions.cpp b/src/useractions.cpp index a74f2fa353..4c8465bbd5 100644 --- a/src/useractions.cpp +++ b/src/useractions.cpp @@ -22,6 +22,8 @@ // in sync ////////////////////////////////////////////////////////////////////////////// +#include + #include "useractions.h" #include "composite.h" #include "cursor.h" @@ -279,6 +281,7 @@ void UserActionsMenu::init() setShortcut(m_shortcutOperation, QStringLiteral("Setup Window Shortcut")); m_shortcutOperation->setData(Options::SetupWindowShortcutOp); +#if KWIN_BUILD_KCMS QAction *action = advancedMenu->addAction(i18n("Configure Special &Window Settings...")); action->setIcon(QIcon::fromTheme(QStringLiteral("preferences-system-windows-actions"))); action->setData(Options::WindowRulesOp); @@ -316,6 +319,7 @@ void UserActionsMenu::init() p->start(); }); } +#endif m_maximizeOperation = m_menu->addAction(i18n("Ma&ximize")); m_maximizeOperation->setIcon(QIcon::fromTheme(QStringLiteral("window-maximize"))); @@ -328,9 +332,9 @@ void UserActionsMenu::init() setShortcut(m_minimizeOperation, QStringLiteral("Window Minimize")); m_minimizeOperation->setData(Options::MinimizeOp); - action = m_menu->addMenu(advancedMenu); - action->setText(i18n("&More Actions")); - action->setIcon(QIcon::fromTheme(QStringLiteral("overflow-menu"))); + QAction *overflowAction = m_menu->addMenu(advancedMenu); + overflowAction->setText(i18n("&More Actions")); + overflowAction->setIcon(QIcon::fromTheme(QStringLiteral("overflow-menu"))); m_closeOperation = m_menu->addAction(i18n("&Close")); m_closeOperation->setIcon(QIcon::fromTheme(QStringLiteral("window-close"))); @@ -405,8 +409,12 @@ void UserActionsMenu::menuAboutToShow() action->setText(i18n("&Extensions")); } - m_rulesOperation->setEnabled(m_window->supportsWindowRules()); - m_applicationRulesOperation->setEnabled(m_window->supportsWindowRules()); + if (m_rulesOperation) { + m_rulesOperation->setEnabled(m_window->supportsWindowRules()); + } + if (m_applicationRulesOperation) { + m_applicationRulesOperation->setEnabled(m_window->supportsWindowRules()); + } showHideActivityMenu(); }