KWin
Loading...
Searching...
No Matches
mouseclick_config.cpp
Go to the documentation of this file.
1/*
2 KWin - the KDE window manager
3 This file is part of the KDE project.
4
5 SPDX-FileCopyrightText: 2012 Filip Wieladek <wattos@gmail.com>
6
7 SPDX-License-Identifier: GPL-2.0-or-later
8*/
9#include "mouseclick_config.h"
10
11#include <config-kwin.h>
12
13// KConfigSkeleton
14#include "mouseclickconfig.h"
15#include <kwineffects_interface.h>
16
17#include <QAction>
18
19#include <KActionCollection>
20#include <KGlobalAccel>
21#include <KLocalizedString>
22#include <KPluginFactory>
23
24#include <QWidget>
25
26K_PLUGIN_CLASS(KWin::MouseClickEffectConfig)
27
28namespace KWin
29{
30
31MouseClickEffectConfig::MouseClickEffectConfig(QObject *parent, const KPluginMetaData &data)
32 : KCModule(parent, data)
33{
34 m_ui.setupUi(widget());
35
36 connect(m_ui.editor, &KShortcutsEditor::keyChange, this, &KCModule::markAsChanged);
37
38 // Shortcut config. The shortcut belongs to the component "kwin"!
39 m_actionCollection = new KActionCollection(this, QStringLiteral("kwin"));
40 m_actionCollection->setComponentDisplayName(i18n("KWin"));
41
42 QAction *a = m_actionCollection->addAction(QStringLiteral("ToggleMouseClick"));
43 a->setText(i18n("Toggle Mouse Click Effect"));
44 a->setProperty("isConfigurationAction", true);
45 KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << (Qt::META | Qt::Key_Asterisk));
46 KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << (Qt::META | Qt::Key_Asterisk));
47
48 m_ui.editor->addCollection(m_actionCollection);
49
50 MouseClickConfig::instance(KWIN_CONFIG);
51 addConfig(MouseClickConfig::self(), widget());
52}
53
55{
56 KCModule::save();
57 m_ui.editor->save(); // undo() will restore to this state from now on
58 OrgKdeKwinEffectsInterface interface(QStringLiteral("org.kde.KWin"),
59 QStringLiteral("/Effects"),
60 QDBusConnection::sessionBus());
61 interface.reconfigureEffect(QStringLiteral("mouseclick"));
62}
63
64} // namespace
65
66#include "mouseclick_config.moc"
67
68#include "moc_mouseclick_config.cpp"
MouseClickEffectConfig(QObject *parent, const KPluginMetaData &data)