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 <victoria.fischer@mbition.io>
This commit is contained in:
Kai Uwe Broulik 2022-08-02 15:59:36 +02:00 committed by Kai Uwe Broulik
parent 62008e7b62
commit 3e820f71c3
2 changed files with 14 additions and 5 deletions

View file

@ -1,6 +1,7 @@
#define KWIN_PLUGIN_VERSION_STRING "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}" #define KWIN_PLUGIN_VERSION_STRING "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}"
#cmakedefine01 KWIN_BUILD_DECORATIONS #cmakedefine01 KWIN_BUILD_DECORATIONS
#cmakedefine01 KWIN_BUILD_KCMS
#cmakedefine01 KWIN_BUILD_NOTIFICATIONS #cmakedefine01 KWIN_BUILD_NOTIFICATIONS
#cmakedefine01 KWIN_BUILD_SCREENLOCKER #cmakedefine01 KWIN_BUILD_SCREENLOCKER
#cmakedefine01 KWIN_BUILD_TABBOX #cmakedefine01 KWIN_BUILD_TABBOX

View file

@ -22,6 +22,8 @@
// in sync // in sync
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
#include <config-kwin.h>
#include "useractions.h" #include "useractions.h"
#include "composite.h" #include "composite.h"
#include "cursor.h" #include "cursor.h"
@ -279,6 +281,7 @@ void UserActionsMenu::init()
setShortcut(m_shortcutOperation, QStringLiteral("Setup Window Shortcut")); setShortcut(m_shortcutOperation, QStringLiteral("Setup Window Shortcut"));
m_shortcutOperation->setData(Options::SetupWindowShortcutOp); m_shortcutOperation->setData(Options::SetupWindowShortcutOp);
#if KWIN_BUILD_KCMS
QAction *action = advancedMenu->addAction(i18n("Configure Special &Window Settings...")); QAction *action = advancedMenu->addAction(i18n("Configure Special &Window Settings..."));
action->setIcon(QIcon::fromTheme(QStringLiteral("preferences-system-windows-actions"))); action->setIcon(QIcon::fromTheme(QStringLiteral("preferences-system-windows-actions")));
action->setData(Options::WindowRulesOp); action->setData(Options::WindowRulesOp);
@ -316,6 +319,7 @@ void UserActionsMenu::init()
p->start(); p->start();
}); });
} }
#endif
m_maximizeOperation = m_menu->addAction(i18n("Ma&ximize")); m_maximizeOperation = m_menu->addAction(i18n("Ma&ximize"));
m_maximizeOperation->setIcon(QIcon::fromTheme(QStringLiteral("window-maximize"))); m_maximizeOperation->setIcon(QIcon::fromTheme(QStringLiteral("window-maximize")));
@ -328,9 +332,9 @@ void UserActionsMenu::init()
setShortcut(m_minimizeOperation, QStringLiteral("Window Minimize")); setShortcut(m_minimizeOperation, QStringLiteral("Window Minimize"));
m_minimizeOperation->setData(Options::MinimizeOp); m_minimizeOperation->setData(Options::MinimizeOp);
action = m_menu->addMenu(advancedMenu); QAction *overflowAction = m_menu->addMenu(advancedMenu);
action->setText(i18n("&More Actions")); overflowAction->setText(i18n("&More Actions"));
action->setIcon(QIcon::fromTheme(QStringLiteral("overflow-menu"))); overflowAction->setIcon(QIcon::fromTheme(QStringLiteral("overflow-menu")));
m_closeOperation = m_menu->addAction(i18n("&Close")); m_closeOperation = m_menu->addAction(i18n("&Close"));
m_closeOperation->setIcon(QIcon::fromTheme(QStringLiteral("window-close"))); m_closeOperation->setIcon(QIcon::fromTheme(QStringLiteral("window-close")));
@ -405,8 +409,12 @@ void UserActionsMenu::menuAboutToShow()
action->setText(i18n("&Extensions")); action->setText(i18n("&Extensions"));
} }
m_rulesOperation->setEnabled(m_window->supportsWindowRules()); if (m_rulesOperation) {
m_applicationRulesOperation->setEnabled(m_window->supportsWindowRules()); m_rulesOperation->setEnabled(m_window->supportsWindowRules());
}
if (m_applicationRulesOperation) {
m_applicationRulesOperation->setEnabled(m_window->supportsWindowRules());
}
showHideActivityMenu(); showHideActivityMenu();
} }