diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7658934182..0401110aa9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,7 +5,7 @@ set(PROJECT_VERSION "5.18.80")
set(PROJECT_VERSION_MAJOR 5)
set(QT_MIN_VERSION "5.12.0")
-set(KF5_MIN_VERSION "5.66.0")
+set(KF5_MIN_VERSION "5.68.0")
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
diff --git a/kcmkwin/kwinoptions/actions.ui b/kcmkwin/kwinoptions/actions.ui
index 9a183320ae..a525bb7f7d 100644
--- a/kcmkwin/kwinoptions/actions.ui
+++ b/kcmkwin/kwinoptions/actions.ui
@@ -29,12 +29,12 @@
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
- coWin1
+ kcfg_CommandWindow1
-
-
+
In this row you can customize left click behavior when clicking into an inactive inner window ('inner' means: not titlebar, not frame).
@@ -69,12 +69,12 @@
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
- coWin2
+ kcfg_CommandWindow2
-
-
+
In this row you can customize middle click behavior when clicking into an inactive inner window ('inner' means: not titlebar, not frame).
@@ -109,12 +109,12 @@
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
- coWin3
+ kcfg_CommandWindow3
-
-
+
In this row you can customize right click behavior when clicking into an inactive inner window ('inner' means: not titlebar, not frame).
@@ -149,12 +149,12 @@
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
- coWinWheel
+ kcfg_CommandWindowWheel
-
-
+
In this row you can customize behavior when scrolling into an inactive inner window ('inner' means: not titlebar, not frame).
@@ -195,12 +195,12 @@
Mo&difier key:
- coAllKey
+ kcfg_CommandAllKey
-
-
+
Here you select whether holding the Meta key or Alt key will allow you to perform the following actions.
@@ -251,12 +251,12 @@
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
- coAll1
+ kcfg_CommandAll1
-
-
+
In this row you can customize left click behavior when clicking into the titlebar or the frame.
@@ -321,12 +321,12 @@
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
- coAll2
+ kcfg_CommandAll2
-
-
+
In this row you can customize middle click behavior when clicking into the titlebar or the frame.
@@ -391,12 +391,12 @@
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
- coAll3
+ kcfg_CommandAll3
-
-
+
In this row you can customize right click behavior when clicking into the titlebar or the frame.
@@ -461,12 +461,12 @@
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
- coAllW
+ kcfg_CommandAllWheel
-
-
+
Here you can customize KDE's behavior when scrolling with the mouse wheel in a window while pressing the modifier key.
diff --git a/kcmkwin/kwinoptions/kwinoptions_settings.kcfg b/kcmkwin/kwinoptions/kwinoptions_settings.kcfg
index 8a3a124aae..5ad052b043 100644
--- a/kcmkwin/kwinoptions/kwinoptions_settings.kcfg
+++ b/kcmkwin/kwinoptions/kwinoptions_settings.kcfg
@@ -58,5 +58,265 @@
true
+
+ Maximize
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Maximize
+
+
+
+
+
+
+
+
+ MaximizeVerticalOnly
+
+
+
+
+
+
+
+
+ MaximizeVerticalOnly
+
+
+
+
+
+
+
+
+
+
+
+
+ Raise
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Nothing
+
+
+
+
+
+
+
+
+
+
+
+
+
+ OperationsMenu
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Nothing
+
+
+
+
+
+
+
+
+
+
+
+
+ ActivateAndRaise
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Nothing
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ OperationsMenu
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ActivateRaisePassClick
+
+
+
+
+
+
+
+
+
+ ActivatePassClick
+
+
+
+
+
+
+
+
+
+ ActivatePassClick
+
+
+
+
+
+
+
+
+
+ Scroll
+
+
+
+
+
+
+
+
+ Alt
+
+
+
+
+
+
+
+ Move
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ToggleRaiseAndLower
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Resize
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Nothing
+
+
+
+
+
+
+
+
+
+
+
diff --git a/kcmkwin/kwinoptions/main.cpp b/kcmkwin/kwinoptions/main.cpp
index 9c0b317e42..d056e5a627 100644
--- a/kcmkwin/kwinoptions/main.cpp
+++ b/kcmkwin/kwinoptions/main.cpp
@@ -78,15 +78,17 @@ KWinOptions::KWinOptions(QWidget *parent, const QVariantList &)
tab->addTab(mFocus, i18n("&Focus"));
connect(mFocus, qOverload(&KCModule::changed), this, qOverload(&KCModule::changed));
- mTitleBarActions = new KTitleBarActionsConfig(false, mConfig, this);
+ mTitleBarActions = new KTitleBarActionsConfig(false, this);
mTitleBarActions->setObjectName(QLatin1String("KWin TitleBar Actions"));
tab->addTab(mTitleBarActions, i18n("Titlebar A&ctions"));
connect(mTitleBarActions, qOverload(&KCModule::changed), this, qOverload(&KCModule::changed));
+ connect(mTitleBarActions, qOverload(&KCModule::defaulted), this, qOverload(&KCModule::defaulted));
- mWindowActions = new KWindowActionsConfig(false, mConfig, this);
+ mWindowActions = new KWindowActionsConfig(false, this);
mWindowActions->setObjectName(QLatin1String("KWin Window Actions"));
tab->addTab(mWindowActions, i18n("W&indow Actions"));
connect(mWindowActions, qOverload(&KCModule::changed), this, qOverload(&KCModule::changed));
+ connect(mWindowActions, qOverload(&KCModule::defaulted), this, qOverload(&KCModule::defaulted));
mMoving = new KMovingConfig(false, this);
mMoving->setObjectName(QLatin1String("KWin Moving"));
@@ -149,8 +151,6 @@ void KWinOptions::save()
QDBusMessage message =
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
QDBusConnection::sessionBus().send(message);
-
-
}
@@ -173,11 +173,6 @@ QString KWinOptions::quickHelp() const
" for how to customize window behavior.
");
}
-void KWinOptions::moduleChanged(bool state)
-{
- emit KCModule::changed(state);
-}
-
KActionsOptions::KActionsOptions(QWidget *parent, const QVariantList &)
: KCModule(parent)
{
@@ -188,15 +183,17 @@ KActionsOptions::KActionsOptions(QWidget *parent, const QVariantList &)
tab = new QTabWidget(this);
layout->addWidget(tab);
- mTitleBarActions = new KTitleBarActionsConfig(false, mConfig, this);
+ mTitleBarActions = new KTitleBarActionsConfig(false, this);
mTitleBarActions->setObjectName(QLatin1String("KWin TitleBar Actions"));
tab->addTab(mTitleBarActions, i18n("&Titlebar Actions"));
connect(mTitleBarActions, qOverload(&KCModule::changed), this, qOverload(&KCModule::changed));
+ connect(mTitleBarActions, qOverload(&KCModule::defaulted), this, qOverload(&KCModule::defaulted));
- mWindowActions = new KWindowActionsConfig(false, mConfig, this);
+ mWindowActions = new KWindowActionsConfig(false, this);
mWindowActions->setObjectName(QLatin1String("KWin Window Actions"));
tab->addTab(mWindowActions, i18n("Window Actio&ns"));
connect(mWindowActions, qOverload(&KCModule::changed), this, qOverload(&KCModule::changed));
+ connect(mWindowActions, qOverload(&KCModule::defaulted), this, qOverload(&KCModule::defaulted));
}
KActionsOptions::~KActionsOptions()
@@ -208,10 +205,8 @@ void KActionsOptions::load()
{
mTitleBarActions->load();
mWindowActions->load();
- emit KCModule::changed(false);
}
-
void KActionsOptions::save()
{
mTitleBarActions->save();
@@ -224,16 +219,12 @@ void KActionsOptions::save()
QDBusMessage message =
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
QDBusConnection::sessionBus().send(message);
-
}
-
void KActionsOptions::defaults()
{
mTitleBarActions->defaults();
mWindowActions->defaults();
-
- emit defaulted(true);
}
void KActionsOptions::moduleChanged(bool state)
diff --git a/kcmkwin/kwinoptions/main.h b/kcmkwin/kwinoptions/main.h
index 903cd720c6..50a8bcd8af 100644
--- a/kcmkwin/kwinoptions/main.h
+++ b/kcmkwin/kwinoptions/main.h
@@ -49,12 +49,6 @@ public:
void defaults() override;
QString quickHelp() const override;
-
-protected Q_SLOTS:
-
- void moduleChanged(bool state);
-
-
private:
QTabWidget *tab;
diff --git a/kcmkwin/kwinoptions/mouse.cpp b/kcmkwin/kwinoptions/mouse.cpp
index 10626f88b3..8be4dc6ffc 100644
--- a/kcmkwin/kwinoptions/mouse.cpp
+++ b/kcmkwin/kwinoptions/mouse.cpp
@@ -32,8 +32,6 @@
#include
#include
-#include
-#include
#include
#include
#include
@@ -41,28 +39,17 @@
#include
+#include "kwinoptions_settings.h"
+
namespace
{
-char const * const cnf_Max[] = {
- "MaximizeButtonLeftClickCommand",
- "MaximizeButtonMiddleClickCommand",
- "MaximizeButtonRightClickCommand",
-};
-
-char const * const tbl_Max[] = {
- "Maximize",
- "Maximize (vertical only)",
- "Maximize (horizontal only)",
- ""
-};
-
QPixmap maxButtonPixmaps[3];
void createMaxButtonPixmaps()
{
- char const * maxButtonXpms[][3 + 13] = {
+ char const *maxButtonXpms[][3 + 13] = {
{
nullptr, nullptr, nullptr,
"...............",
@@ -142,49 +129,33 @@ void KTitleBarActionsConfig::paletteChanged()
{
createMaxButtonPixmaps();
for (int i=0; i<3; ++i) {
- m_ui->leftClickMaximizeButton->setItemIcon(i, maxButtonPixmaps[i]);
- m_ui->middleClickMaximizeButton->setItemIcon(i, maxButtonPixmaps[i]);
- m_ui->rightClickMaximizeButton->setItemIcon(i, maxButtonPixmaps[i]);
+ m_ui->kcfg_MaximizeButtonLeftClickCommand->setItemIcon(i, maxButtonPixmaps[i]);
+ m_ui->kcfg_MaximizeButtonMiddleClickCommand->setItemIcon(i, maxButtonPixmaps[i]);
+ m_ui->kcfg_MaximizeButtonRightClickCommand->setItemIcon(i, maxButtonPixmaps[i]);
}
}
-KTitleBarActionsConfig::KTitleBarActionsConfig(bool _standAlone, KConfig *_config, QWidget * parent)
- : KCModule(parent), config(_config), standAlone(_standAlone)
+KTitleBarActionsConfig::KTitleBarActionsConfig(bool _standAlone, QWidget *parent)
+ : KCModule(parent), standAlone(_standAlone)
, m_ui(new KWinMouseConfigForm(this))
{
+ addConfig(KWinOptionsSettings::self(), this);
+
// create the items for the maximize button actions
createMaxButtonPixmaps();
for (int i=0; i<3; ++i) {
- m_ui->leftClickMaximizeButton->addItem(maxButtonPixmaps[i], QString());
- m_ui->middleClickMaximizeButton->addItem(maxButtonPixmaps[i], QString());
- m_ui->rightClickMaximizeButton->addItem(maxButtonPixmaps[i], QString());
+ m_ui->kcfg_MaximizeButtonLeftClickCommand->addItem(maxButtonPixmaps[i], QString());
+ m_ui->kcfg_MaximizeButtonMiddleClickCommand->addItem(maxButtonPixmaps[i], QString());
+ m_ui->kcfg_MaximizeButtonRightClickCommand->addItem(maxButtonPixmaps[i], QString());
}
- createMaximizeButtonTooltips(m_ui->leftClickMaximizeButton);
- createMaximizeButtonTooltips(m_ui->middleClickMaximizeButton);
- createMaximizeButtonTooltips(m_ui->rightClickMaximizeButton);
-
- connect(m_ui->coTiDbl, SIGNAL(activated(int)), SLOT(changed()));
- connect(m_ui->coTiAct1, SIGNAL(activated(int)), SLOT(changed()));
- connect(m_ui->coTiAct2, SIGNAL(activated(int)), SLOT(changed()));
- connect(m_ui->coTiAct3, SIGNAL(activated(int)), SLOT(changed()));
- connect(m_ui->coTiAct4, SIGNAL(activated(int)), SLOT(changed()));
- connect(m_ui->coTiInAct1, SIGNAL(activated(int)), SLOT(changed()));
- connect(m_ui->coTiInAct2, SIGNAL(activated(int)), SLOT(changed()));
- connect(m_ui->coTiInAct3, SIGNAL(activated(int)), SLOT(changed()));
- connect(m_ui->leftClickMaximizeButton, SIGNAL(activated(int)), SLOT(changed()));
- connect(m_ui->middleClickMaximizeButton, SIGNAL(activated(int)), SLOT(changed()));
- connect(m_ui->rightClickMaximizeButton, SIGNAL(activated(int)), SLOT(changed()));
+ createMaximizeButtonTooltips(m_ui->kcfg_MaximizeButtonLeftClickCommand);
+ createMaximizeButtonTooltips(m_ui->kcfg_MaximizeButtonMiddleClickCommand);
+ createMaximizeButtonTooltips(m_ui->kcfg_MaximizeButtonRightClickCommand);
load();
}
-KTitleBarActionsConfig::~KTitleBarActionsConfig()
-{
- if (standAlone)
- delete config;
-}
-
void KTitleBarActionsConfig::createMaximizeButtonTooltips(KComboBox *combo)
{
combo->setItemData(0, i18n("Maximize"), Qt::ToolTipRole);
@@ -192,174 +163,6 @@ void KTitleBarActionsConfig::createMaximizeButtonTooltips(KComboBox *combo)
combo->setItemData(2, i18n("Maximize (horizontal only)"), Qt::ToolTipRole);
}
-// do NOT change the texts below, they are written to config file
-// and are not shown in the GUI
-// they have to match the order of items in GUI elements though
-const char* const tbl_TiDbl[] = {
- "Maximize",
- "Maximize (vertical only)",
- "Maximize (horizontal only)",
- "Minimize",
- "Shade",
- "Lower",
- "Close",
- "OnAllDesktops",
- "Nothing",
- ""
-};
-
-const char* const tbl_TiAc[] = {
- "Raise",
- "Lower",
- "Toggle raise and lower",
- "Minimize",
- "Shade",
- "Close",
- "Operations menu",
- "Nothing",
- ""
-};
-
-const char* const tbl_TiInAc[] = {
- "Activate and raise",
- "Activate and lower",
- "Activate",
- "Raise",
- "Lower",
- "Toggle raise and lower",
- "Minimize",
- "Shade",
- "Close",
- "Operations menu",
- "Nothing",
- ""
-};
-
-const char* const tbl_Win[] = {
- "Activate, raise and pass click",
- "Activate and pass click",
- "Activate",
- "Activate and raise",
- ""
-};
-
-const char* const tbl_WinWheel[] = {
- "Scroll",
- "Activate and scroll",
- "Activate, raise and scroll",
- ""
-};
-
-const char* const tbl_AllKey[] = {
- "Alt",
- "Meta",
- ""
-};
-
-const char* const tbl_All[] = {
- "Move",
- "Activate, raise and move",
- "Toggle raise and lower",
- "Resize",
- "Raise",
- "Lower",
- "Minimize",
- "Decrease Opacity",
- "Increase Opacity",
- "Nothing",
- ""
-};
-
-const char* const tbl_TiWAc[] = {
- "Raise/Lower",
- "Shade/Unshade",
- "Maximize/Restore",
- "Above/Below",
- "Previous/Next Desktop",
- "Change Opacity",
- "Nothing",
- ""
-};
-
-const char* const tbl_AllW[] = {
- "Raise/Lower",
- "Shade/Unshade",
- "Maximize/Restore",
- "Above/Below",
- "Previous/Next Desktop",
- "Change Opacity",
- "Nothing",
- ""
-};
-
-static const char* tbl_num_lookup(const char* const arr[], int pos)
-{
- for (int i = 0;
- arr[ i ][ 0 ] != '\0' && pos >= 0;
- ++i) {
- if (pos == 0)
- return arr[ i ];
- --pos;
- }
- abort(); // should never happen this way
-}
-
-static int tbl_txt_lookup(const char* const arr[], const char* txt)
-{
- int pos = 0;
- for (int i = 0;
- arr[ i ][ 0 ] != '\0';
- ++i) {
- if (qstricmp(txt, arr[ i ]) == 0)
- return pos;
- ++pos;
- }
- return 0;
-}
-
-void KTitleBarActionsConfig::setComboText(KComboBox* combo, const char*txt)
-{
- if (combo == m_ui->coTiDbl)
- combo->setCurrentIndex(tbl_txt_lookup(tbl_TiDbl, txt));
- else if (combo == m_ui->coTiAct1 || combo == m_ui->coTiAct2 || combo == m_ui->coTiAct3)
- combo->setCurrentIndex(tbl_txt_lookup(tbl_TiAc, txt));
- else if (combo == m_ui->coTiInAct1 || combo == m_ui->coTiInAct2 || combo == m_ui->coTiInAct3)
- combo->setCurrentIndex(tbl_txt_lookup(tbl_TiInAc, txt));
- else if (combo == m_ui->coTiAct4)
- combo->setCurrentIndex(tbl_txt_lookup(tbl_TiWAc, txt));
- else if (combo == m_ui->leftClickMaximizeButton ||
- combo == m_ui->middleClickMaximizeButton ||
- combo == m_ui->rightClickMaximizeButton) {
- combo->setCurrentIndex(tbl_txt_lookup(tbl_Max, txt));
- } else
- abort();
-}
-
-const char* KTitleBarActionsConfig::functionTiDbl(int i)
-{
- return tbl_num_lookup(tbl_TiDbl, i);
-}
-
-const char* KTitleBarActionsConfig::functionTiAc(int i)
-{
- return tbl_num_lookup(tbl_TiAc, i);
-}
-
-const char* KTitleBarActionsConfig::functionTiInAc(int i)
-{
- return tbl_num_lookup(tbl_TiInAc, i);
-}
-
-const char* KTitleBarActionsConfig::functionTiWAc(int i)
-{
- return tbl_num_lookup(tbl_TiWAc, i);
-}
-
-const char* KTitleBarActionsConfig::functionMax(int i)
-{
- return tbl_num_lookup(tbl_Max, i);
-}
-
void KTitleBarActionsConfig::showEvent(QShowEvent *ev)
{
if (!standAlone) {
@@ -378,131 +181,26 @@ void KTitleBarActionsConfig::changeEvent(QEvent *ev)
ev->accept();
}
-
-void KTitleBarActionsConfig::load()
-{
- KConfigGroup windowsConfig(config, "Windows");
- setComboText(m_ui->coTiDbl, windowsConfig.readEntry("TitlebarDoubleClickCommand", "Maximize").toLatin1());
- setComboText(m_ui->leftClickMaximizeButton, windowsConfig.readEntry(cnf_Max[0], tbl_Max[0]).toLatin1());
- setComboText(m_ui->middleClickMaximizeButton, windowsConfig.readEntry(cnf_Max[1], tbl_Max[1]).toLatin1());
- setComboText(m_ui->rightClickMaximizeButton, windowsConfig.readEntry(cnf_Max[2], tbl_Max[2]).toLatin1());
-
- KConfigGroup cg(config, "MouseBindings");
- setComboText(m_ui->coTiAct1, cg.readEntry("CommandActiveTitlebar1", "Raise").toLatin1());
- setComboText(m_ui->coTiAct2, cg.readEntry("CommandActiveTitlebar2", "Nothing").toLatin1());
- setComboText(m_ui->coTiAct3, cg.readEntry("CommandActiveTitlebar3", "Operations menu").toLatin1());
- setComboText(m_ui->coTiAct4, cg.readEntry("CommandTitlebarWheel", "Nothing").toLatin1());
- setComboText(m_ui->coTiInAct1, cg.readEntry("CommandInactiveTitlebar1", "Activate and raise").toLatin1());
- setComboText(m_ui->coTiInAct2, cg.readEntry("CommandInactiveTitlebar2", "Nothing").toLatin1());
- setComboText(m_ui->coTiInAct3, cg.readEntry("CommandInactiveTitlebar3", "Operations menu").toLatin1());
-}
-
void KTitleBarActionsConfig::save()
{
- KConfigGroup windowsConfig(config, "Windows");
- windowsConfig.writeEntry("TitlebarDoubleClickCommand", functionTiDbl(m_ui->coTiDbl->currentIndex()));
- windowsConfig.writeEntry(cnf_Max[0], functionMax(m_ui->leftClickMaximizeButton->currentIndex()));
- windowsConfig.writeEntry(cnf_Max[1], functionMax(m_ui->middleClickMaximizeButton->currentIndex()));
- windowsConfig.writeEntry(cnf_Max[2], functionMax(m_ui->rightClickMaximizeButton->currentIndex()));
-
- KConfigGroup cg(config, "MouseBindings");
- cg.writeEntry("CommandActiveTitlebar1", functionTiAc(m_ui->coTiAct1->currentIndex()));
- cg.writeEntry("CommandActiveTitlebar2", functionTiAc(m_ui->coTiAct2->currentIndex()));
- cg.writeEntry("CommandActiveTitlebar3", functionTiAc(m_ui->coTiAct3->currentIndex()));
- cg.writeEntry("CommandInactiveTitlebar1", functionTiInAc(m_ui->coTiInAct1->currentIndex()));
- cg.writeEntry("CommandTitlebarWheel", functionTiWAc(m_ui->coTiAct4->currentIndex()));
- cg.writeEntry("CommandInactiveTitlebar2", functionTiInAc(m_ui->coTiInAct2->currentIndex()));
- cg.writeEntry("CommandInactiveTitlebar3", functionTiInAc(m_ui->coTiInAct3->currentIndex()));
+ KCModule::save();
if (standAlone) {
- config->sync();
// Send signal to all kwin instances
QDBusMessage message =
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
QDBusConnection::sessionBus().send(message);
-
}
}
-void KTitleBarActionsConfig::defaults()
-{
- setComboText(m_ui->coTiDbl, "Maximize");
- setComboText(m_ui->coTiAct1, "Raise");
- setComboText(m_ui->coTiAct2, "Nothing");
- setComboText(m_ui->coTiAct3, "Operations menu");
- setComboText(m_ui->coTiAct4, "Nothing");
- setComboText(m_ui->coTiInAct1, "Activate and raise");
- setComboText(m_ui->coTiInAct2, "Nothing");
- setComboText(m_ui->coTiInAct3, "Operations menu");
- setComboText(m_ui->leftClickMaximizeButton, tbl_Max[0]);
- setComboText(m_ui->middleClickMaximizeButton, tbl_Max[1]);
- setComboText(m_ui->rightClickMaximizeButton, tbl_Max[2]);
-}
-
-
-KWindowActionsConfig::KWindowActionsConfig(bool _standAlone, KConfig *_config, QWidget * parent)
- : KCModule(parent), config(_config), standAlone(_standAlone)
+KWindowActionsConfig::KWindowActionsConfig(bool _standAlone, QWidget *parent)
+ : KCModule(parent), standAlone(_standAlone)
, m_ui(new KWinActionsConfigForm(this))
{
- connect(m_ui->coWin1, SIGNAL(activated(int)), SLOT(changed()));
- connect(m_ui->coWin2, SIGNAL(activated(int)), SLOT(changed()));
- connect(m_ui->coWin3, SIGNAL(activated(int)), SLOT(changed()));
- connect(m_ui->coWinWheel, SIGNAL(activated(int)), SLOT(changed()));
- connect(m_ui->coAllKey, SIGNAL(activated(int)), SLOT(changed()));
- connect(m_ui->coAll1, SIGNAL(activated(int)), SLOT(changed()));
- connect(m_ui->coAll2, SIGNAL(activated(int)), SLOT(changed()));
- connect(m_ui->coAll3, SIGNAL(activated(int)), SLOT(changed()));
- connect(m_ui->coAllW, SIGNAL(activated(int)), SLOT(changed()));
+ addConfig(KWinOptionsSettings::self(), this);
load();
}
-KWindowActionsConfig::~KWindowActionsConfig()
-{
- if (standAlone)
- delete config;
-}
-
-void KWindowActionsConfig::setComboText(KComboBox* combo, const char*txt)
-{
- if (combo == m_ui->coWin1 || combo == m_ui->coWin2 || combo == m_ui->coWin3)
- combo->setCurrentIndex(tbl_txt_lookup(tbl_Win, txt));
- else if (combo == m_ui->coWinWheel)
- combo->setCurrentIndex(tbl_txt_lookup(tbl_WinWheel, txt));
- else if (combo == m_ui->coAllKey)
- combo->setCurrentIndex(tbl_txt_lookup(tbl_AllKey, txt));
- else if (combo == m_ui->coAll1 || combo == m_ui->coAll2 || combo == m_ui->coAll3)
- combo->setCurrentIndex(tbl_txt_lookup(tbl_All, txt));
- else if (combo == m_ui->coAllW)
- combo->setCurrentIndex(tbl_txt_lookup(tbl_AllW, txt));
- else
- abort();
-}
-
-const char* KWindowActionsConfig::functionWin(int i)
-{
- return tbl_num_lookup(tbl_Win, i);
-}
-
-const char* KWindowActionsConfig::functionWinWheel(int i)
-{
- return tbl_num_lookup(tbl_WinWheel, i);
-}
-
-const char* KWindowActionsConfig::functionAllKey(int i)
-{
- return tbl_num_lookup(tbl_AllKey, i);
-}
-
-const char* KWindowActionsConfig::functionAll(int i)
-{
- return tbl_num_lookup(tbl_All, i);
-}
-
-const char* KWindowActionsConfig::functionAllW(int i)
-{
- return tbl_num_lookup(tbl_AllW, i);
-}
-
void KWindowActionsConfig::showEvent(QShowEvent *ev)
{
if (!standAlone) {
@@ -512,51 +210,14 @@ void KWindowActionsConfig::showEvent(QShowEvent *ev)
KCModule::showEvent(ev);
}
-void KWindowActionsConfig::load()
-{
- KConfigGroup cg(config, "MouseBindings");
- setComboText(m_ui->coWin1, cg.readEntry("CommandWindow1", "Activate, raise and pass click").toLatin1());
- setComboText(m_ui->coWin2, cg.readEntry("CommandWindow2", "Activate and pass click").toLatin1());
- setComboText(m_ui->coWin3, cg.readEntry("CommandWindow3", "Activate and pass click").toLatin1());
- setComboText(m_ui->coWinWheel, cg.readEntry("CommandWindowWheel", "Scroll").toLatin1());
- setComboText(m_ui->coAllKey, cg.readEntry("CommandAllKey", "Alt").toLatin1());
- setComboText(m_ui->coAll1, cg.readEntry("CommandAll1", "Move").toLatin1());
- setComboText(m_ui->coAll2, cg.readEntry("CommandAll2", "Toggle raise and lower").toLatin1());
- setComboText(m_ui->coAll3, cg.readEntry("CommandAll3", "Resize").toLatin1());
- setComboText(m_ui->coAllW, cg.readEntry("CommandAllWheel", "Nothing").toLatin1());
-}
-
void KWindowActionsConfig::save()
{
- KConfigGroup cg(config, "MouseBindings");
- cg.writeEntry("CommandWindow1", functionWin(m_ui->coWin1->currentIndex()));
- cg.writeEntry("CommandWindow2", functionWin(m_ui->coWin2->currentIndex()));
- cg.writeEntry("CommandWindow3", functionWin(m_ui->coWin3->currentIndex()));
- cg.writeEntry("CommandWindowWheel", functionWinWheel(m_ui->coWinWheel->currentIndex()));
- cg.writeEntry("CommandAllKey", functionAllKey(m_ui->coAllKey->currentIndex()));
- cg.writeEntry("CommandAll1", functionAll(m_ui->coAll1->currentIndex()));
- cg.writeEntry("CommandAll2", functionAll(m_ui->coAll2->currentIndex()));
- cg.writeEntry("CommandAll3", functionAll(m_ui->coAll3->currentIndex()));
- cg.writeEntry("CommandAllWheel", functionAllW(m_ui->coAllW->currentIndex()));
+ KCModule::save();
if (standAlone) {
- config->sync();
// Send signal to all kwin instances
QDBusMessage message =
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
QDBusConnection::sessionBus().send(message);
}
}
-
-void KWindowActionsConfig::defaults()
-{
- setComboText(m_ui->coWin1, "Activate, raise and pass click");
- setComboText(m_ui->coWin2, "Activate and pass click");
- setComboText(m_ui->coWin3, "Activate and pass click");
- setComboText(m_ui->coWinWheel, "Scroll");
- setComboText(m_ui->coAllKey, "Alt");
- setComboText(m_ui->coAll1, "Move");
- setComboText(m_ui->coAll2, "Toggle raise and lower");
- setComboText(m_ui->coAll3, "Resize");
- setComboText(m_ui->coAllW, "Nothing");
-}
diff --git a/kcmkwin/kwinoptions/mouse.h b/kcmkwin/kwinoptions/mouse.h
index 1dee6eb342..cbb5f43528 100644
--- a/kcmkwin/kwinoptions/mouse.h
+++ b/kcmkwin/kwinoptions/mouse.h
@@ -53,38 +53,20 @@ class KTitleBarActionsConfig : public KCModule
public:
- KTitleBarActionsConfig(bool _standAlone, KConfig *_config, QWidget *parent);
- ~KTitleBarActionsConfig() override;
+ KTitleBarActionsConfig(bool _standAlone, QWidget *parent);
- void load() override;
void save() override;
- void defaults() override;
protected:
void showEvent(QShowEvent *ev) override;
void changeEvent(QEvent *ev) override;
-public Q_SLOTS:
- void changed() {
- emit KCModule::changed(true);
- }
-
private:
-
- KConfig *config;
bool standAlone;
KWinMouseConfigForm *m_ui;
- const char* functionTiDbl(int);
- const char* functionTiAc(int);
- const char* functionTiWAc(int);
- const char* functionTiInAc(int);
- const char* functionMax(int);
-
- void setComboText(KComboBox* combo, const char* text);
void createMaximizeButtonTooltips(KComboBox* combo);
- const char* fixup(const char* s);
private Q_SLOTS:
void paletteChanged();
@@ -97,35 +79,17 @@ class KWindowActionsConfig : public KCModule
public:
- KWindowActionsConfig(bool _standAlone, KConfig *_config, QWidget *parent);
- ~KWindowActionsConfig() override;
+ KWindowActionsConfig(bool _standAlone, QWidget *parent);
- void load() override;
void save() override;
- void defaults() override;
protected:
void showEvent(QShowEvent *ev) override;
-public Q_SLOTS:
- void changed() {
- emit KCModule::changed(true);
- }
-
private:
- KConfig *config;
bool standAlone;
KWinActionsConfigForm *m_ui;
-
- const char* functionWin(int);
- const char* functionWinWheel(int);
- const char* functionAllKey(int);
- const char* functionAll(int);
- const char* functionAllW(int);
-
- void setComboText(KComboBox* combo, const char* text);
- const char* fixup(const char* s);
};
#endif
diff --git a/kcmkwin/kwinoptions/mouse.ui b/kcmkwin/kwinoptions/mouse.ui
index 4de09409b9..c600d313a9 100644
--- a/kcmkwin/kwinoptions/mouse.ui
+++ b/kcmkwin/kwinoptions/mouse.ui
@@ -26,12 +26,12 @@
&Double-click:
- coTiDbl
+ kcfg_TitlebarDoubleClickCommand
-
-
+
Behavior on <em>double</em> click into the titlebar.
@@ -88,12 +88,12 @@
Mouse &wheel:
- coTiAct4
+ kcfg_CommandTitlebarWheel
-
-
+
Behavior on <em>mouse wheel</em> scroll over the titlebar.
@@ -180,7 +180,7 @@
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
- coTiAct1
+ kcfg_CommandActiveTitlebar1
@@ -203,7 +203,7 @@
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
- coTiAct2
+ kcfg_CommandActiveTitlebar2
@@ -216,12 +216,12 @@
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
- coTiAct3
+ kcfg_CommandActiveTitlebar3
-
-
+
0
@@ -274,7 +274,7 @@
-
-
+
Behavior on <em>left</em> click into the titlebar or frame of an <em>inactive</em> window.
@@ -336,7 +336,7 @@
-
-
+
0
@@ -389,7 +389,7 @@
-
-
+
Behavior on <em>left</em> click into the titlebar or frame of an <em>inactive</em> window.
@@ -451,7 +451,7 @@
-
-
+
0
@@ -504,7 +504,7 @@
-
-
+
Behavior on <em>left</em> click into the titlebar or frame of an <em>inactive</em> window.
@@ -601,12 +601,12 @@
L&eft click:
- leftClickMaximizeButton
+ kcfg_MaximizeButtonLeftClickCommand
-
-
+
0
@@ -627,12 +627,12 @@
Middle c&lick:
- middleClickMaximizeButton
+ kcfg_MaximizeButtonMiddleClickCommand
-
-
+
0
@@ -653,12 +653,12 @@
Right clic&k:
- rightClickMaximizeButton
+ kcfg_MaximizeButtonRightClickCommand
-
-
+
0
@@ -696,17 +696,17 @@
- coTiDbl
- coTiAct4
- coTiAct1
- coTiInAct1
- coTiAct2
- coTiInAct2
- coTiAct3
- coTiInAct3
- leftClickMaximizeButton
- middleClickMaximizeButton
- rightClickMaximizeButton
+ kcfg_TitlebarDoubleClickCommand
+ kcfg_CommandTitlebarWheel
+ kcfg_CommandActiveTitlebar1
+ kcfg_CommandInactiveTitlebar1
+ kcfg_CommandActiveTitlebar2
+ kcfg_CommandInactiveTitlebar2
+ kcfg_CommandActiveTitlebar3
+ kcfg_CommandInactiveTitlebar3
+ kcfg_MaximizeButtonLeftClickCommand
+ kcfg_MaximizeButtonMiddleClickCommand
+ kcfg_MaximizeButtonRightClickCommand