2007-04-29 17:35:43 +00:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Copyright (c) 1998 Matthias Ettrich <ettrich@kde.org>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
2008-05-30 17:47:24 +00:00
|
|
|
#include "mouse.h"
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
#include <QLabel>
|
2009-10-30 08:10:35 +00:00
|
|
|
#include <KComboBox>
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
#include <QLayout>
|
|
|
|
#include <QSizePolicy>
|
|
|
|
#include <QBitmap>
|
|
|
|
|
2007-09-01 15:58:40 +00:00
|
|
|
#include <QGroupBox>
|
2007-04-29 17:35:43 +00:00
|
|
|
#include <QPixmap>
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
#include <QHBoxLayout>
|
2008-08-25 02:22:56 +00:00
|
|
|
#include <QFormLayout>
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
#include <kconfig.h>
|
2014-02-15 18:57:22 +00:00
|
|
|
#include <kconfiggroup.h>
|
2013-11-01 11:29:05 +00:00
|
|
|
#include <QDebug>
|
2007-09-07 14:33:31 +00:00
|
|
|
#include <kcolorscheme.h>
|
2007-04-29 17:35:43 +00:00
|
|
|
#include <kseparator.h>
|
2018-06-05 10:52:57 +00:00
|
|
|
#include <QtDBus>
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2019-07-09 19:19:26 +00:00
|
|
|
#include <cstdlib>
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
namespace
|
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
char const * const cnf_Max[] = {
|
2011-01-30 14:34:42 +00:00
|
|
|
"MaximizeButtonLeftClickCommand",
|
|
|
|
"MaximizeButtonMiddleClickCommand",
|
|
|
|
"MaximizeButtonRightClickCommand",
|
2007-04-29 17:35:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
char const * const tbl_Max[] = {
|
2011-01-30 14:34:42 +00:00
|
|
|
"Maximize",
|
|
|
|
"Maximize (vertical only)",
|
|
|
|
"Maximize (horizontal only)",
|
|
|
|
""
|
|
|
|
};
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
QPixmap maxButtonPixmaps[3];
|
|
|
|
|
|
|
|
void createMaxButtonPixmaps()
|
|
|
|
{
|
2011-01-30 14:34:42 +00:00
|
|
|
char const * maxButtonXpms[][3 + 13] = {
|
|
|
|
{
|
Use nullptr everywhere
Summary:
Because KWin is a very old project, we use three kinds of null pointer
literals: 0, NULL, and nullptr. Since C++11, it's recommended to use
nullptr keyword.
This change converts all usages of 0 and NULL literal to nullptr. Even
though it breaks git history, we need to do it in order to have consistent
code as well to ease code reviews (it's very tempting for some people to
add unrelated changes to their patches, e.g. converting NULL to nullptr).
Test Plan: Compiles.
Reviewers: #kwin, davidedmundson, romangg
Reviewed By: #kwin, davidedmundson, romangg
Subscribers: romangg, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D23618
2019-09-19 14:46:54 +00:00
|
|
|
nullptr, nullptr, nullptr,
|
2011-01-30 14:34:42 +00:00
|
|
|
"...............",
|
|
|
|
".......#.......",
|
|
|
|
"......###......",
|
|
|
|
".....#####.....",
|
|
|
|
"..#....#....#..",
|
|
|
|
".##....#....##.",
|
|
|
|
"###############",
|
|
|
|
".##....#....##.",
|
|
|
|
"..#....#....#..",
|
|
|
|
".....#####.....",
|
|
|
|
"......###......",
|
|
|
|
".......#.......",
|
|
|
|
"..............."
|
|
|
|
},
|
|
|
|
{
|
Use nullptr everywhere
Summary:
Because KWin is a very old project, we use three kinds of null pointer
literals: 0, NULL, and nullptr. Since C++11, it's recommended to use
nullptr keyword.
This change converts all usages of 0 and NULL literal to nullptr. Even
though it breaks git history, we need to do it in order to have consistent
code as well to ease code reviews (it's very tempting for some people to
add unrelated changes to their patches, e.g. converting NULL to nullptr).
Test Plan: Compiles.
Reviewers: #kwin, davidedmundson, romangg
Reviewed By: #kwin, davidedmundson, romangg
Subscribers: romangg, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D23618
2019-09-19 14:46:54 +00:00
|
|
|
nullptr, nullptr, nullptr,
|
2011-01-30 14:34:42 +00:00
|
|
|
"...............",
|
|
|
|
".......#.......",
|
|
|
|
"......###......",
|
|
|
|
".....#####.....",
|
|
|
|
".......#.......",
|
|
|
|
".......#.......",
|
|
|
|
".......#.......",
|
|
|
|
".......#.......",
|
|
|
|
".......#.......",
|
|
|
|
".....#####.....",
|
|
|
|
"......###......",
|
|
|
|
".......#.......",
|
|
|
|
"..............."
|
|
|
|
},
|
|
|
|
{
|
Use nullptr everywhere
Summary:
Because KWin is a very old project, we use three kinds of null pointer
literals: 0, NULL, and nullptr. Since C++11, it's recommended to use
nullptr keyword.
This change converts all usages of 0 and NULL literal to nullptr. Even
though it breaks git history, we need to do it in order to have consistent
code as well to ease code reviews (it's very tempting for some people to
add unrelated changes to their patches, e.g. converting NULL to nullptr).
Test Plan: Compiles.
Reviewers: #kwin, davidedmundson, romangg
Reviewed By: #kwin, davidedmundson, romangg
Subscribers: romangg, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D23618
2019-09-19 14:46:54 +00:00
|
|
|
nullptr, nullptr, nullptr,
|
2011-01-30 14:34:42 +00:00
|
|
|
"...............",
|
|
|
|
"...............",
|
|
|
|
"...............",
|
|
|
|
"...............",
|
|
|
|
"..#.........#..",
|
|
|
|
".##.........##.",
|
|
|
|
"###############",
|
|
|
|
".##.........##.",
|
|
|
|
"..#.........#..",
|
|
|
|
"...............",
|
|
|
|
"...............",
|
|
|
|
"...............",
|
|
|
|
"..............."
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2019-07-10 13:04:52 +00:00
|
|
|
QByteArray baseColor(". c " + KColorScheme(QPalette::Active, KColorScheme::View).background().color().name().toLatin1());
|
|
|
|
QByteArray textColor("# c " + KColorScheme(QPalette::Active, KColorScheme::View).foreground().color().name().toLatin1());
|
2011-01-30 14:34:42 +00:00
|
|
|
for (int t = 0; t < 3; ++t) {
|
|
|
|
maxButtonXpms[t][0] = "15 13 2 1";
|
|
|
|
maxButtonXpms[t][1] = baseColor.constData();
|
|
|
|
maxButtonXpms[t][2] = textColor.constData();
|
|
|
|
maxButtonPixmaps[t] = QPixmap(maxButtonXpms[t]);
|
|
|
|
maxButtonPixmaps[t].setMask(maxButtonPixmaps[t].createHeuristicMask());
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
2012-09-24 02:28:33 +00:00
|
|
|
KWinMouseConfigForm::KWinMouseConfigForm(QWidget *parent)
|
|
|
|
: QWidget(parent)
|
|
|
|
{
|
2012-10-27 21:11:22 +00:00
|
|
|
setupUi(parent);
|
2012-09-24 02:28:33 +00:00
|
|
|
}
|
|
|
|
|
2012-09-24 03:02:12 +00:00
|
|
|
KWinActionsConfigForm::KWinActionsConfigForm(QWidget *parent)
|
|
|
|
: QWidget(parent)
|
|
|
|
{
|
2012-10-27 21:11:22 +00:00
|
|
|
setupUi(parent);
|
2012-09-24 03:02:12 +00:00
|
|
|
}
|
2012-09-24 02:28:33 +00:00
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
void KTitleBarActionsConfig::paletteChanged()
|
|
|
|
{
|
2011-01-30 14:34:42 +00:00
|
|
|
createMaxButtonPixmaps();
|
2012-09-24 02:28:33 +00:00
|
|
|
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]);
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-09-30 05:29:38 +00:00
|
|
|
KTitleBarActionsConfig::KTitleBarActionsConfig(bool _standAlone, KConfig *_config, QWidget * parent)
|
|
|
|
: KCModule(parent), config(_config), standAlone(_standAlone)
|
2012-09-24 02:28:33 +00:00
|
|
|
, m_ui(new KWinMouseConfigForm(this))
|
2007-04-29 17:35:43 +00:00
|
|
|
{
|
2012-09-24 02:28:33 +00:00
|
|
|
// create the items for the maximize button actions
|
2011-01-30 14:34:42 +00:00
|
|
|
createMaxButtonPixmaps();
|
2012-09-24 02:28:33 +00:00
|
|
|
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());
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2012-09-24 02:28:33 +00:00
|
|
|
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()));
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
load();
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
KTitleBarActionsConfig::~KTitleBarActionsConfig()
|
|
|
|
{
|
2011-01-30 14:34:42 +00:00
|
|
|
if (standAlone)
|
|
|
|
delete config;
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
2012-09-24 02:28:33 +00:00
|
|
|
void KTitleBarActionsConfig::createMaximizeButtonTooltips(KComboBox *combo)
|
|
|
|
{
|
|
|
|
combo->setItemData(0, i18n("Maximize"), Qt::ToolTipRole);
|
|
|
|
combo->setItemData(1, i18n("Maximize (vertical only)"), Qt::ToolTipRole);
|
|
|
|
combo->setItemData(2, i18n("Maximize (horizontal only)"), Qt::ToolTipRole);
|
|
|
|
}
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
// 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",
|
2010-10-02 18:25:41 +00:00
|
|
|
"Close",
|
2007-04-29 17:35:43 +00:00
|
|
|
"OnAllDesktops",
|
|
|
|
"Nothing",
|
2011-01-30 14:34:42 +00:00
|
|
|
""
|
|
|
|
};
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
const char* const tbl_TiAc[] = {
|
|
|
|
"Raise",
|
|
|
|
"Lower",
|
|
|
|
"Toggle raise and lower",
|
2011-05-18 18:51:17 +00:00
|
|
|
"Minimize",
|
|
|
|
"Shade",
|
2009-08-25 04:10:11 +00:00
|
|
|
"Close",
|
2011-05-18 18:51:17 +00:00
|
|
|
"Operations menu",
|
2009-08-25 04:10:11 +00:00
|
|
|
"Nothing",
|
2011-01-30 14:34:42 +00:00
|
|
|
""
|
|
|
|
};
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
const char* const tbl_TiInAc[] = {
|
|
|
|
"Activate and raise",
|
|
|
|
"Activate and lower",
|
|
|
|
"Activate",
|
|
|
|
"Raise",
|
|
|
|
"Lower",
|
2011-05-18 18:51:17 +00:00
|
|
|
"Toggle raise and lower",
|
|
|
|
"Minimize",
|
|
|
|
"Shade",
|
2009-08-25 04:10:11 +00:00
|
|
|
"Close",
|
2011-05-18 18:51:17 +00:00
|
|
|
"Operations menu",
|
2007-04-29 17:35:43 +00:00
|
|
|
"Nothing",
|
2011-01-30 14:34:42 +00:00
|
|
|
""
|
|
|
|
};
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
const char* const tbl_Win[] = {
|
|
|
|
"Activate, raise and pass click",
|
|
|
|
"Activate and pass click",
|
|
|
|
"Activate",
|
|
|
|
"Activate and raise",
|
2011-01-30 14:34:42 +00:00
|
|
|
""
|
|
|
|
};
|
|
|
|
|
2009-05-06 06:38:54 +00:00
|
|
|
const char* const tbl_WinWheel[] = {
|
|
|
|
"Scroll",
|
|
|
|
"Activate and scroll",
|
|
|
|
"Activate, raise and scroll",
|
2011-01-30 14:34:42 +00:00
|
|
|
""
|
|
|
|
};
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
const char* const tbl_AllKey[] = {
|
|
|
|
"Alt",
|
[kcmkwin/options] Improve the look of the KWin options KCM UIs
Summary:
Apply the KDE HIG, use form layouts, make desktop files consistent and make the KCMs look better.
{F7323519}
{F7330485}
{F7330486}
{F7302318}
{F7302319}
Test Plan: Open the {nav Window Behavior} KCMs. All options should still work
Reviewers: #kwin, #plasma, #vdg, ngraham, zzag
Reviewed By: #kwin, #plasma, #vdg, ngraham, zzag
Subscribers: ngraham, davidedmundson, zzag, #vdg, #plasma, kwin, #kwin
Tags: #kwin
Maniphest Tasks: T10273
Differential Revision: https://phabricator.kde.org/D23615
2019-09-05 17:41:27 +00:00
|
|
|
"Meta",
|
2011-01-30 14:34:42 +00:00
|
|
|
""
|
|
|
|
};
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
const char* const tbl_All[] = {
|
|
|
|
"Move",
|
|
|
|
"Activate, raise and move",
|
|
|
|
"Toggle raise and lower",
|
|
|
|
"Resize",
|
|
|
|
"Raise",
|
|
|
|
"Lower",
|
|
|
|
"Minimize",
|
2011-08-19 20:48:38 +00:00
|
|
|
"Decrease Opacity",
|
|
|
|
"Increase Opacity",
|
2007-04-29 17:35:43 +00:00
|
|
|
"Nothing",
|
2011-01-30 14:34:42 +00:00
|
|
|
""
|
|
|
|
};
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2014-09-27 18:30:49 +00:00
|
|
|
const char* const tbl_TiWAc[] = {
|
2007-04-29 17:35:43 +00:00
|
|
|
"Raise/Lower",
|
|
|
|
"Shade/Unshade",
|
|
|
|
"Maximize/Restore",
|
|
|
|
"Above/Below",
|
|
|
|
"Previous/Next Desktop",
|
|
|
|
"Change Opacity",
|
|
|
|
"Nothing",
|
2011-01-30 14:34:42 +00:00
|
|
|
""
|
|
|
|
};
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2014-09-27 18:30:49 +00:00
|
|
|
const char* const tbl_AllW[] = {
|
2007-04-29 17:35:43 +00:00
|
|
|
"Raise/Lower",
|
|
|
|
"Shade/Unshade",
|
|
|
|
"Maximize/Restore",
|
|
|
|
"Above/Below",
|
|
|
|
"Previous/Next Desktop",
|
|
|
|
"Change Opacity",
|
|
|
|
"Nothing",
|
2011-01-30 14:34:42 +00:00
|
|
|
""
|
|
|
|
};
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
static const char* tbl_num_lookup(const char* const arr[], int pos)
|
2007-04-29 17:35:43 +00:00
|
|
|
{
|
2011-01-30 14:34:42 +00:00
|
|
|
for (int i = 0;
|
|
|
|
arr[ i ][ 0 ] != '\0' && pos >= 0;
|
|
|
|
++i) {
|
|
|
|
if (pos == 0)
|
2007-04-29 17:35:43 +00:00
|
|
|
return arr[ i ];
|
|
|
|
--pos;
|
|
|
|
}
|
|
|
|
abort(); // should never happen this way
|
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
static int tbl_txt_lookup(const char* const arr[], const char* txt)
|
2007-04-29 17:35:43 +00:00
|
|
|
{
|
|
|
|
int pos = 0;
|
2011-01-30 14:34:42 +00:00
|
|
|
for (int i = 0;
|
|
|
|
arr[ i ][ 0 ] != '\0';
|
|
|
|
++i) {
|
|
|
|
if (qstricmp(txt, arr[ i ]) == 0)
|
2007-04-29 17:35:43 +00:00
|
|
|
return pos;
|
|
|
|
++pos;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KTitleBarActionsConfig::setComboText(KComboBox* combo, const char*txt)
|
2007-04-29 17:35:43 +00:00
|
|
|
{
|
2012-09-24 02:28:33 +00:00
|
|
|
if (combo == m_ui->coTiDbl)
|
2011-01-30 14:34:42 +00:00
|
|
|
combo->setCurrentIndex(tbl_txt_lookup(tbl_TiDbl, txt));
|
2012-09-24 02:28:33 +00:00
|
|
|
else if (combo == m_ui->coTiAct1 || combo == m_ui->coTiAct2 || combo == m_ui->coTiAct3)
|
2011-01-30 14:34:42 +00:00
|
|
|
combo->setCurrentIndex(tbl_txt_lookup(tbl_TiAc, txt));
|
2012-09-24 02:28:33 +00:00
|
|
|
else if (combo == m_ui->coTiInAct1 || combo == m_ui->coTiInAct2 || combo == m_ui->coTiInAct3)
|
2011-01-30 14:34:42 +00:00
|
|
|
combo->setCurrentIndex(tbl_txt_lookup(tbl_TiInAc, txt));
|
2012-09-24 02:28:33 +00:00
|
|
|
else if (combo == m_ui->coTiAct4)
|
2011-01-30 14:34:42 +00:00
|
|
|
combo->setCurrentIndex(tbl_txt_lookup(tbl_TiWAc, txt));
|
2012-09-24 02:28:33 +00:00
|
|
|
else if (combo == m_ui->leftClickMaximizeButton ||
|
|
|
|
combo == m_ui->middleClickMaximizeButton ||
|
|
|
|
combo == m_ui->rightClickMaximizeButton) {
|
2011-01-30 14:34:42 +00:00
|
|
|
combo->setCurrentIndex(tbl_txt_lookup(tbl_Max, txt));
|
|
|
|
} else
|
2007-04-29 17:35:43 +00:00
|
|
|
abort();
|
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
const char* KTitleBarActionsConfig::functionTiDbl(int i)
|
2007-04-29 17:35:43 +00:00
|
|
|
{
|
2011-01-30 14:34:42 +00:00
|
|
|
return tbl_num_lookup(tbl_TiDbl, i);
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
const char* KTitleBarActionsConfig::functionTiAc(int i)
|
2007-04-29 17:35:43 +00:00
|
|
|
{
|
2011-01-30 14:34:42 +00:00
|
|
|
return tbl_num_lookup(tbl_TiAc, i);
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
const char* KTitleBarActionsConfig::functionTiInAc(int i)
|
2007-04-29 17:35:43 +00:00
|
|
|
{
|
2011-01-30 14:34:42 +00:00
|
|
|
return tbl_num_lookup(tbl_TiInAc, i);
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const char* KTitleBarActionsConfig::functionTiWAc(int i)
|
|
|
|
{
|
2011-01-30 14:34:42 +00:00
|
|
|
return tbl_num_lookup(tbl_TiWAc, i);
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
const char* KTitleBarActionsConfig::functionMax(int i)
|
2007-04-29 17:35:43 +00:00
|
|
|
{
|
2011-01-30 14:34:42 +00:00
|
|
|
return tbl_num_lookup(tbl_Max, i);
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KTitleBarActionsConfig::showEvent(QShowEvent *ev)
|
2009-12-14 03:18:43 +00:00
|
|
|
{
|
2011-01-30 14:34:42 +00:00
|
|
|
if (!standAlone) {
|
2009-12-14 03:18:43 +00:00
|
|
|
// Workaround KCModule::showEvent() calling load(), see bug 163817
|
2011-01-30 14:34:42 +00:00
|
|
|
QWidget::showEvent(ev);
|
2009-12-14 03:18:43 +00:00
|
|
|
return;
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
KCModule::showEvent(ev);
|
2009-12-14 03:18:43 +00:00
|
|
|
}
|
|
|
|
|
2014-02-15 18:57:22 +00:00
|
|
|
void KTitleBarActionsConfig::changeEvent(QEvent *ev)
|
|
|
|
{
|
|
|
|
if (ev->type() == QEvent::PaletteChange) {
|
|
|
|
paletteChanged();
|
|
|
|
}
|
|
|
|
ev->accept();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
void KTitleBarActionsConfig::load()
|
|
|
|
{
|
2011-01-30 14:34:42 +00:00
|
|
|
KConfigGroup windowsConfig(config, "Windows");
|
2019-07-10 13:04:52 +00:00
|
|
|
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());
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
KConfigGroup cg(config, "MouseBindings");
|
2019-07-10 13:04:52 +00:00
|
|
|
setComboText(m_ui->coTiAct1, cg.readEntry("CommandActiveTitlebar1", "Raise").toLatin1());
|
2019-09-14 08:58:12 +00:00
|
|
|
setComboText(m_ui->coTiAct2, cg.readEntry("CommandActiveTitlebar2", "Nothing").toLatin1());
|
2019-07-10 13:04:52 +00:00
|
|
|
setComboText(m_ui->coTiAct3, cg.readEntry("CommandActiveTitlebar3", "Operations menu").toLatin1());
|
2019-09-14 08:58:12 +00:00
|
|
|
setComboText(m_ui->coTiAct4, cg.readEntry("CommandTitlebarWheel", "Nothing").toLatin1());
|
2019-07-10 13:04:52 +00:00
|
|
|
setComboText(m_ui->coTiInAct1, cg.readEntry("CommandInactiveTitlebar1", "Activate and raise").toLatin1());
|
2019-09-14 08:58:12 +00:00
|
|
|
setComboText(m_ui->coTiInAct2, cg.readEntry("CommandInactiveTitlebar2", "Nothing").toLatin1());
|
2019-07-10 13:04:52 +00:00
|
|
|
setComboText(m_ui->coTiInAct3, cg.readEntry("CommandInactiveTitlebar3", "Operations menu").toLatin1());
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void KTitleBarActionsConfig::save()
|
|
|
|
{
|
2011-01-30 14:34:42 +00:00
|
|
|
KConfigGroup windowsConfig(config, "Windows");
|
2012-09-24 02:28:33 +00:00
|
|
|
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()));
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
KConfigGroup cg(config, "MouseBindings");
|
2012-09-24 02:28:33 +00:00
|
|
|
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()));
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
if (standAlone) {
|
|
|
|
config->sync();
|
|
|
|
// Send signal to all kwin instances
|
|
|
|
QDBusMessage message =
|
|
|
|
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
|
|
|
|
QDBusConnection::sessionBus().send(message);
|
|
|
|
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void KTitleBarActionsConfig::defaults()
|
|
|
|
{
|
2015-06-05 16:03:05 +00:00
|
|
|
setComboText(m_ui->coTiDbl, "Maximize");
|
2012-09-24 02:28:33 +00:00
|
|
|
setComboText(m_ui->coTiAct1, "Raise");
|
2019-09-14 08:58:12 +00:00
|
|
|
setComboText(m_ui->coTiAct2, "Nothing");
|
2012-09-24 02:28:33 +00:00
|
|
|
setComboText(m_ui->coTiAct3, "Operations menu");
|
2019-09-14 08:58:12 +00:00
|
|
|
setComboText(m_ui->coTiAct4, "Nothing");
|
2012-09-24 02:28:33 +00:00
|
|
|
setComboText(m_ui->coTiInAct1, "Activate and raise");
|
2019-09-14 08:58:12 +00:00
|
|
|
setComboText(m_ui->coTiInAct2, "Nothing");
|
2012-09-24 02:28:33 +00:00
|
|
|
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]);
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-09-30 05:29:38 +00:00
|
|
|
KWindowActionsConfig::KWindowActionsConfig(bool _standAlone, KConfig *_config, QWidget * parent)
|
|
|
|
: KCModule(parent), config(_config), standAlone(_standAlone)
|
2012-09-24 03:02:12 +00:00
|
|
|
, m_ui(new KWinActionsConfigForm(this))
|
2007-04-29 17:35:43 +00:00
|
|
|
{
|
2012-09-24 03:02:12 +00:00
|
|
|
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()));
|
2011-01-30 14:34:42 +00:00
|
|
|
load();
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
KWindowActionsConfig::~KWindowActionsConfig()
|
|
|
|
{
|
2011-01-30 14:34:42 +00:00
|
|
|
if (standAlone)
|
|
|
|
delete config;
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KWindowActionsConfig::setComboText(KComboBox* combo, const char*txt)
|
2007-04-29 17:35:43 +00:00
|
|
|
{
|
2012-09-24 03:02:12 +00:00
|
|
|
if (combo == m_ui->coWin1 || combo == m_ui->coWin2 || combo == m_ui->coWin3)
|
2011-01-30 14:34:42 +00:00
|
|
|
combo->setCurrentIndex(tbl_txt_lookup(tbl_Win, txt));
|
2012-09-24 03:02:12 +00:00
|
|
|
else if (combo == m_ui->coWinWheel)
|
2011-01-30 14:34:42 +00:00
|
|
|
combo->setCurrentIndex(tbl_txt_lookup(tbl_WinWheel, txt));
|
2012-09-24 03:02:12 +00:00
|
|
|
else if (combo == m_ui->coAllKey)
|
2011-01-30 14:34:42 +00:00
|
|
|
combo->setCurrentIndex(tbl_txt_lookup(tbl_AllKey, txt));
|
2012-09-24 03:02:12 +00:00
|
|
|
else if (combo == m_ui->coAll1 || combo == m_ui->coAll2 || combo == m_ui->coAll3)
|
2011-01-30 14:34:42 +00:00
|
|
|
combo->setCurrentIndex(tbl_txt_lookup(tbl_All, txt));
|
2012-09-24 03:02:12 +00:00
|
|
|
else if (combo == m_ui->coAllW)
|
2011-01-30 14:34:42 +00:00
|
|
|
combo->setCurrentIndex(tbl_txt_lookup(tbl_AllW, txt));
|
2007-04-29 17:35:43 +00:00
|
|
|
else
|
|
|
|
abort();
|
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
const char* KWindowActionsConfig::functionWin(int i)
|
2007-04-29 17:35:43 +00:00
|
|
|
{
|
2011-01-30 14:34:42 +00:00
|
|
|
return tbl_num_lookup(tbl_Win, i);
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
const char* KWindowActionsConfig::functionWinWheel(int i)
|
2009-05-06 06:38:54 +00:00
|
|
|
{
|
2011-01-30 14:34:42 +00:00
|
|
|
return tbl_num_lookup(tbl_WinWheel, i);
|
2009-05-06 06:38:54 +00:00
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
const char* KWindowActionsConfig::functionAllKey(int i)
|
2007-04-29 17:35:43 +00:00
|
|
|
{
|
2011-01-30 14:34:42 +00:00
|
|
|
return tbl_num_lookup(tbl_AllKey, i);
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
const char* KWindowActionsConfig::functionAll(int i)
|
2007-04-29 17:35:43 +00:00
|
|
|
{
|
2011-01-30 14:34:42 +00:00
|
|
|
return tbl_num_lookup(tbl_All, i);
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const char* KWindowActionsConfig::functionAllW(int i)
|
|
|
|
{
|
2011-01-30 14:34:42 +00:00
|
|
|
return tbl_num_lookup(tbl_AllW, i);
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KWindowActionsConfig::showEvent(QShowEvent *ev)
|
2009-12-14 03:18:43 +00:00
|
|
|
{
|
2011-01-30 14:34:42 +00:00
|
|
|
if (!standAlone) {
|
|
|
|
QWidget::showEvent(ev);
|
2009-12-14 03:18:43 +00:00
|
|
|
return;
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
KCModule::showEvent(ev);
|
2009-12-14 03:18:43 +00:00
|
|
|
}
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
void KWindowActionsConfig::load()
|
|
|
|
{
|
2011-01-30 14:34:42 +00:00
|
|
|
KConfigGroup cg(config, "MouseBindings");
|
2019-07-10 13:04:52 +00:00
|
|
|
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());
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void KWindowActionsConfig::save()
|
|
|
|
{
|
2011-01-30 14:34:42 +00:00
|
|
|
KConfigGroup cg(config, "MouseBindings");
|
2012-09-24 03:02:12 +00:00
|
|
|
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()));
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
if (standAlone) {
|
|
|
|
config->sync();
|
|
|
|
// Send signal to all kwin instances
|
|
|
|
QDBusMessage message =
|
|
|
|
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
|
|
|
|
QDBusConnection::sessionBus().send(message);
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void KWindowActionsConfig::defaults()
|
|
|
|
{
|
2012-09-24 03:02:12 +00:00
|
|
|
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");
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|