2002-01-16 12:26:03 +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
|
2005-12-21 06:45:09 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2002-01-16 12:26:03 +00:00
|
|
|
*/
|
|
|
|
|
2006-05-11 08:04:23 +00:00
|
|
|
#include <QLabel>
|
|
|
|
#include <QComboBox>
|
2005-07-28 14:59:42 +00:00
|
|
|
|
2006-05-11 08:04:23 +00:00
|
|
|
#include <QLayout>
|
2005-07-28 14:59:42 +00:00
|
|
|
#include <q3grid.h>
|
2006-05-13 16:33:18 +00:00
|
|
|
#include <QSizePolicy>
|
|
|
|
#include <QBitmap>
|
2006-05-11 08:04:23 +00:00
|
|
|
#include <QToolTip>
|
2005-07-28 14:59:42 +00:00
|
|
|
#include <Q3GroupBox>
|
|
|
|
//Added by qt3to4:
|
|
|
|
#include <QPixmap>
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
#include <QHBoxLayout>
|
2002-01-16 12:26:03 +00:00
|
|
|
|
|
|
|
#include <klocale.h>
|
2002-07-07 00:38:19 +00:00
|
|
|
#include <kapplication.h>
|
2002-01-16 12:26:03 +00:00
|
|
|
#include <kconfig.h>
|
|
|
|
#include <kdialog.h>
|
|
|
|
#include <kglobalsettings.h>
|
|
|
|
#include <kseparator.h>
|
2006-07-02 18:31:00 +00:00
|
|
|
#include <QtDBus/QtDBus>
|
2002-01-16 12:26:03 +00:00
|
|
|
|
|
|
|
#include <X11/X.h>
|
|
|
|
#include <X11/Xlib.h>
|
|
|
|
#include <X11/Xutil.h>
|
|
|
|
|
2002-09-24 17:01:49 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
2002-01-16 12:26:03 +00:00
|
|
|
#include "mouse.h"
|
|
|
|
#include "mouse.moc"
|
|
|
|
|
2007-02-23 14:38:01 +00:00
|
|
|
|
2004-08-28 15:27:22 +00:00
|
|
|
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] = {
|
|
|
|
{0, 0, 0,
|
|
|
|
"...............",
|
|
|
|
".......#.......",
|
|
|
|
"......###......",
|
|
|
|
".....#####.....",
|
|
|
|
"..#....#....#..",
|
|
|
|
".##....#....##.",
|
|
|
|
"###############",
|
|
|
|
".##....#....##.",
|
|
|
|
"..#....#....#..",
|
|
|
|
".....#####.....",
|
|
|
|
"......###......",
|
|
|
|
".......#.......",
|
|
|
|
"..............."},
|
|
|
|
{0, 0, 0,
|
|
|
|
"...............",
|
|
|
|
".......#.......",
|
|
|
|
"......###......",
|
|
|
|
".....#####.....",
|
|
|
|
".......#.......",
|
|
|
|
".......#.......",
|
|
|
|
".......#.......",
|
|
|
|
".......#.......",
|
|
|
|
".......#.......",
|
|
|
|
".....#####.....",
|
|
|
|
"......###......",
|
|
|
|
".......#.......",
|
|
|
|
"..............."},
|
|
|
|
{0, 0, 0,
|
|
|
|
"...............",
|
|
|
|
"...............",
|
|
|
|
"...............",
|
|
|
|
"...............",
|
|
|
|
"..#.........#..",
|
|
|
|
".##.........##.",
|
|
|
|
"###############",
|
|
|
|
".##.........##.",
|
|
|
|
"..#.........#..",
|
|
|
|
"...............",
|
|
|
|
"...............",
|
|
|
|
"...............",
|
|
|
|
"..............."},
|
|
|
|
};
|
|
|
|
|
2007-02-23 14:38:01 +00:00
|
|
|
QString baseColor(". c " + KGlobalSettings::baseColor().name());
|
|
|
|
QString textColor("# c " + KGlobalSettings::textColor().name());
|
2004-08-28 15:27:22 +00:00
|
|
|
for (int t = 0; t < 3; ++t)
|
|
|
|
{
|
|
|
|
maxButtonXpms[t][0] = "15 13 2 1";
|
2007-02-23 14:38:01 +00:00
|
|
|
maxButtonXpms[t][1] = baseColor.toAscii();
|
|
|
|
maxButtonXpms[t][2] = textColor.toAscii();
|
2004-08-28 15:27:22 +00:00
|
|
|
maxButtonPixmaps[t] = QPixmap(maxButtonXpms[t]);
|
|
|
|
maxButtonPixmaps[t].setMask(maxButtonPixmaps[t].createHeuristicMask());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
2005-05-06 08:47:48 +00:00
|
|
|
void KTitleBarActionsConfig::paletteChanged()
|
2004-08-28 15:27:22 +00:00
|
|
|
{
|
|
|
|
createMaxButtonPixmaps();
|
|
|
|
for (int b = 0; b < 3; ++b)
|
|
|
|
for (int t = 0; t < 3; ++t)
|
2006-04-12 15:13:31 +00:00
|
|
|
coMax[b]->setItemIcon(t, maxButtonPixmaps[t]);
|
2004-08-28 15:27:22 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2007-01-29 17:14:20 +00:00
|
|
|
KTitleBarActionsConfig::KTitleBarActionsConfig (bool _standAlone, KConfig *_config, const KComponentData &inst, QWidget * parent)
|
2005-10-22 19:12:01 +00:00
|
|
|
: KCModule(inst, parent), config(_config), standAlone(_standAlone)
|
2002-01-16 12:26:03 +00:00
|
|
|
{
|
|
|
|
QString strWin1, strWin2, strWin3, strAllKey, strAll1, strAll2, strAll3;
|
2005-07-28 14:59:42 +00:00
|
|
|
Q3Grid *grid;
|
|
|
|
Q3GroupBox *box;
|
2002-01-16 12:26:03 +00:00
|
|
|
QLabel *label;
|
2005-05-06 15:20:49 +00:00
|
|
|
QString strMouseButton1, strMouseButton3, strMouseWheel;
|
|
|
|
QString txtButton1, txtButton3, txtButton4;
|
2002-01-16 12:26:03 +00:00
|
|
|
QStringList items;
|
|
|
|
bool leftHandedMouse = ( KGlobalSettings::mouseSettings().handed == KGlobalSettings::KMouseSettings::LeftHanded);
|
|
|
|
|
2006-04-12 15:34:39 +00:00
|
|
|
QVBoxLayout *layout = new QVBoxLayout(this);
|
|
|
|
layout->setMargin(0);
|
|
|
|
layout->setSpacing(KDialog::spacingHint());
|
|
|
|
|
2002-01-16 12:26:03 +00:00
|
|
|
/** Titlebar doubleclick ************/
|
|
|
|
|
2006-04-12 15:13:31 +00:00
|
|
|
QHBoxLayout *hlayout = new QHBoxLayout();
|
|
|
|
layout->addLayout( hlayout );
|
2002-01-16 12:26:03 +00:00
|
|
|
|
|
|
|
label = new QLabel(i18n("&Titlebar double-click:"), this);
|
|
|
|
hlayout->addWidget(label);
|
2005-07-28 14:59:42 +00:00
|
|
|
label->setWhatsThis( i18n("Here you can customize mouse click behavior when double clicking on the"
|
2002-01-16 12:26:03 +00:00
|
|
|
" titlebar of a window.") );
|
|
|
|
|
|
|
|
QComboBox* combo = new QComboBox(this);
|
2006-04-12 15:13:31 +00:00
|
|
|
combo->addItem(i18n("Maximize"));
|
|
|
|
combo->addItem(i18n("Maximize (vertical only)"));
|
|
|
|
combo->addItem(i18n("Maximize (horizontal only)"));
|
|
|
|
combo->addItem(i18n("Minimize"));
|
|
|
|
combo->addItem(i18n("Shade"));
|
|
|
|
combo->addItem(i18n("Lower"));
|
|
|
|
combo->addItem(i18n("On All Desktops"));
|
|
|
|
combo->addItem(i18n("Nothing"));
|
2002-01-16 12:26:03 +00:00
|
|
|
combo->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed));
|
2002-07-07 00:38:19 +00:00
|
|
|
connect(combo, SIGNAL(activated(int)), SLOT(changed()));
|
2002-01-16 12:26:03 +00:00
|
|
|
hlayout->addWidget(combo);
|
|
|
|
coTiDbl = combo;
|
2005-07-28 14:59:42 +00:00
|
|
|
combo->setWhatsThis( i18n("Behavior on <em>double</em> click into the titlebar."));
|
2002-01-16 12:26:03 +00:00
|
|
|
|
|
|
|
label->setBuddy(combo);
|
|
|
|
|
2005-05-06 15:20:49 +00:00
|
|
|
/** Mouse Wheel Events **************/
|
2006-04-12 15:13:31 +00:00
|
|
|
QHBoxLayout *hlayoutW = new QHBoxLayout();
|
|
|
|
layout->addLayout( hlayoutW );
|
2005-05-06 15:20:49 +00:00
|
|
|
strMouseWheel = i18n("Titlebar wheel event:");
|
|
|
|
label = new QLabel(strMouseWheel, this);
|
|
|
|
hlayoutW->addWidget(label);
|
|
|
|
txtButton4 = i18n("Handle mouse wheel events");
|
2005-07-28 14:59:42 +00:00
|
|
|
label->setWhatsThis( txtButton4);
|
2005-05-06 15:20:49 +00:00
|
|
|
|
|
|
|
// Titlebar and frame mouse Wheel
|
|
|
|
QComboBox* comboW = new QComboBox(this);
|
2006-04-12 15:13:31 +00:00
|
|
|
comboW->addItem(i18n("Raise/Lower"));
|
|
|
|
comboW->addItem(i18n("Shade/Unshade"));
|
|
|
|
comboW->addItem(i18n("Maximize/Restore"));
|
|
|
|
comboW->addItem(i18n("Keep Above/Below"));
|
|
|
|
comboW->addItem(i18n("Move to Previous/Next Desktop"));
|
|
|
|
comboW->addItem(i18n("Change Opacity"));
|
|
|
|
comboW->addItem(i18n("Nothing"));
|
2005-05-06 15:20:49 +00:00
|
|
|
comboW->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed));
|
|
|
|
connect(comboW, SIGNAL(activated(int)), SLOT(changed()));
|
|
|
|
hlayoutW->addWidget(comboW);
|
|
|
|
coTiAct4 = comboW;
|
2005-07-28 14:59:42 +00:00
|
|
|
comboW->setWhatsThis( txtButton4);
|
2005-05-06 15:20:49 +00:00
|
|
|
label->setBuddy(comboW);
|
|
|
|
|
2002-01-16 12:26:03 +00:00
|
|
|
/** Titlebar and frame **************/
|
|
|
|
|
2005-07-28 14:59:42 +00:00
|
|
|
box = new Q3GroupBox( 1, Qt::Horizontal, i18n("Titlebar && Frame"), this, "Titlebar and Frame");
|
2002-01-16 12:26:03 +00:00
|
|
|
box->layout()->setMargin(KDialog::marginHint());
|
|
|
|
box->layout()->setSpacing(KDialog::spacingHint());
|
|
|
|
layout->addWidget(box);
|
2005-07-28 14:59:42 +00:00
|
|
|
box->setWhatsThis( i18n("Here you can customize mouse click behavior when clicking on the"
|
2002-01-16 12:26:03 +00:00
|
|
|
" titlebar or the frame of a window.") );
|
|
|
|
|
2005-07-28 14:59:42 +00:00
|
|
|
grid = new Q3Grid(4, Qt::Vertical, box);
|
2002-01-16 12:26:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
new QLabel(grid); // dummy
|
|
|
|
|
2002-07-01 10:43:57 +00:00
|
|
|
strMouseButton1 = i18n("Left button:");
|
2002-01-16 12:26:03 +00:00
|
|
|
txtButton1 = i18n("In this row you can customize left click behavior when clicking into"
|
|
|
|
" the titlebar or the frame.");
|
|
|
|
|
2002-07-01 10:43:57 +00:00
|
|
|
strMouseButton3 = i18n("Right button:");
|
2002-01-16 12:26:03 +00:00
|
|
|
txtButton3 = i18n("In this row you can customize right click behavior when clicking into"
|
|
|
|
" the titlebar or the frame." );
|
|
|
|
|
|
|
|
if ( leftHandedMouse )
|
|
|
|
{
|
|
|
|
qSwap(strMouseButton1, strMouseButton3);
|
|
|
|
qSwap(txtButton1, txtButton3);
|
|
|
|
}
|
|
|
|
|
|
|
|
label = new QLabel(strMouseButton1, grid);
|
2005-07-28 14:59:42 +00:00
|
|
|
label->setWhatsThis( txtButton1);
|
2002-01-16 12:26:03 +00:00
|
|
|
|
2002-07-01 10:43:57 +00:00
|
|
|
label = new QLabel(i18n("Middle button:"), grid);
|
2005-07-28 14:59:42 +00:00
|
|
|
label->setWhatsThis( i18n("In this row you can customize middle click behavior when clicking into"
|
2002-01-16 12:26:03 +00:00
|
|
|
" the titlebar or the frame.") );
|
|
|
|
|
|
|
|
label = new QLabel(strMouseButton3, grid);
|
2005-07-28 14:59:42 +00:00
|
|
|
label->setWhatsThis( txtButton3);
|
2002-01-16 12:26:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
label = new QLabel(i18n("Active"), grid);
|
2005-07-28 14:59:42 +00:00
|
|
|
label->setAlignment(Qt::AlignCenter);
|
|
|
|
label->setWhatsThis( i18n("In this column you can customize mouse clicks into the titlebar"
|
2002-01-16 12:26:03 +00:00
|
|
|
" or the frame of an active window.") );
|
|
|
|
|
|
|
|
// Titlebar and frame, active, mouse button 1
|
|
|
|
combo = new QComboBox(grid);
|
2006-04-12 15:13:31 +00:00
|
|
|
combo->addItem(i18n("Raise"));
|
|
|
|
combo->addItem(i18n("Lower"));
|
|
|
|
combo->addItem(i18n("Operations Menu"));
|
|
|
|
combo->addItem(i18n("Toggle Raise & Lower"));
|
|
|
|
combo->addItem(i18n("Nothing"));
|
2002-07-07 00:38:19 +00:00
|
|
|
connect(combo, SIGNAL(activated(int)), SLOT(changed()));
|
2002-01-16 12:26:03 +00:00
|
|
|
coTiAct1 = combo;
|
|
|
|
|
|
|
|
txtButton1 = i18n("Behavior on <em>left</em> click into the titlebar or frame of an "
|
|
|
|
"<em>active</em> window.");
|
|
|
|
|
|
|
|
txtButton3 = i18n("Behavior on <em>right</em> click into the titlebar or frame of an "
|
|
|
|
"<em>active</em> window.");
|
|
|
|
|
|
|
|
// Be nice to left handed users
|
|
|
|
if ( leftHandedMouse ) qSwap(txtButton1, txtButton3);
|
|
|
|
|
2005-07-28 14:59:42 +00:00
|
|
|
combo->setWhatsThis( txtButton1);
|
2002-01-16 12:26:03 +00:00
|
|
|
|
|
|
|
// Titlebar and frame, active, mouse button 2
|
|
|
|
|
|
|
|
items << i18n("Raise")
|
|
|
|
<< i18n("Lower")
|
2002-07-01 10:43:57 +00:00
|
|
|
<< i18n("Operations Menu")
|
2002-07-31 18:00:57 +00:00
|
|
|
<< i18n("Toggle Raise & Lower")
|
2002-01-16 12:26:03 +00:00
|
|
|
<< i18n("Nothing")
|
|
|
|
<< i18n("Shade");
|
|
|
|
|
|
|
|
combo = new QComboBox(grid);
|
2006-04-12 15:13:31 +00:00
|
|
|
combo->addItems(items);
|
2002-07-07 00:38:19 +00:00
|
|
|
connect(combo, SIGNAL(activated(int)), SLOT(changed()));
|
2002-01-16 12:26:03 +00:00
|
|
|
coTiAct2 = combo;
|
2005-07-28 14:59:42 +00:00
|
|
|
combo->setWhatsThis( i18n("Behavior on <em>middle</em> click into the titlebar or frame of an <em>active</em> window."));
|
2002-01-16 12:26:03 +00:00
|
|
|
|
|
|
|
// Titlebar and frame, active, mouse button 3
|
|
|
|
combo = new QComboBox(grid);
|
2006-04-12 15:13:31 +00:00
|
|
|
combo->addItems(items);
|
2002-07-07 00:38:19 +00:00
|
|
|
connect(combo, SIGNAL(activated(int)), SLOT(changed()));
|
2002-01-16 12:26:03 +00:00
|
|
|
coTiAct3 = combo;
|
2005-07-28 14:59:42 +00:00
|
|
|
combo->setWhatsThis( txtButton3 );
|
2002-01-16 12:26:03 +00:00
|
|
|
|
|
|
|
txtButton1 = i18n("Behavior on <em>left</em> click into the titlebar or frame of an "
|
|
|
|
"<em>inactive</em> window.");
|
|
|
|
|
|
|
|
txtButton3 = i18n("Behavior on <em>right</em> click into the titlebar or frame of an "
|
|
|
|
"<em>inactive</em> window.");
|
|
|
|
|
|
|
|
// Be nice to left handed users
|
|
|
|
if ( leftHandedMouse ) qSwap(txtButton1, txtButton3);
|
|
|
|
|
|
|
|
label = new QLabel(i18n("Inactive"), grid);
|
2005-07-28 14:59:42 +00:00
|
|
|
label->setAlignment(Qt::AlignCenter);
|
|
|
|
label->setWhatsThis( i18n("In this column you can customize mouse clicks into the titlebar"
|
2002-01-16 12:26:03 +00:00
|
|
|
" or the frame of an inactive window.") );
|
|
|
|
|
|
|
|
items.clear();
|
2002-07-31 18:00:57 +00:00
|
|
|
items << i18n("Activate & Raise")
|
|
|
|
<< i18n("Activate & Lower")
|
2002-01-16 12:26:03 +00:00
|
|
|
<< i18n("Activate")
|
2003-09-16 19:34:03 +00:00
|
|
|
<< i18n("Shade")
|
|
|
|
<< i18n("Operations Menu")
|
|
|
|
<< i18n("Raise")
|
|
|
|
<< i18n("Lower")
|
|
|
|
<< i18n("Nothing");
|
2002-01-16 12:26:03 +00:00
|
|
|
|
|
|
|
combo = new QComboBox(grid);
|
2006-04-12 15:13:31 +00:00
|
|
|
combo->addItems(items);
|
2002-07-07 00:38:19 +00:00
|
|
|
connect(combo, SIGNAL(activated(int)), SLOT(changed()));
|
2002-01-16 12:26:03 +00:00
|
|
|
coTiInAct1 = combo;
|
2005-07-28 14:59:42 +00:00
|
|
|
combo->setWhatsThis( txtButton1);
|
2002-01-16 12:26:03 +00:00
|
|
|
|
|
|
|
combo = new QComboBox(grid);
|
2006-04-12 15:13:31 +00:00
|
|
|
combo->addItems(items);
|
2002-07-07 00:38:19 +00:00
|
|
|
connect(combo, SIGNAL(activated(int)), SLOT(changed()));
|
2002-01-16 12:26:03 +00:00
|
|
|
coTiInAct2 = combo;
|
2005-07-28 14:59:42 +00:00
|
|
|
combo->setWhatsThis( i18n("Behavior on <em>middle</em> click into the titlebar or frame of an <em>inactive</em> window."));
|
2002-01-16 12:26:03 +00:00
|
|
|
|
|
|
|
combo = new QComboBox(grid);
|
2006-04-12 15:13:31 +00:00
|
|
|
combo->addItems(items);
|
2002-07-07 00:38:19 +00:00
|
|
|
connect(combo, SIGNAL(activated(int)), SLOT(changed()));
|
2002-01-16 12:26:03 +00:00
|
|
|
coTiInAct3 = combo;
|
2005-07-28 14:59:42 +00:00
|
|
|
combo->setWhatsThis( txtButton3);
|
2002-01-16 12:26:03 +00:00
|
|
|
|
2004-08-28 15:27:22 +00:00
|
|
|
/** Maximize Button ******************/
|
|
|
|
|
2005-07-28 14:59:42 +00:00
|
|
|
box = new Q3GroupBox(1, Qt::Vertical, i18n("Maximize Button"), this, "Maximize Button");
|
2004-08-28 15:27:22 +00:00
|
|
|
box->layout()->setMargin(KDialog::marginHint());
|
|
|
|
box->layout()->setSpacing(KDialog::spacingHint());
|
|
|
|
layout->addWidget(box);
|
2005-07-28 14:59:42 +00:00
|
|
|
box->setWhatsThis(
|
2004-08-28 15:27:22 +00:00
|
|
|
i18n("Here you can customize behavior when clicking on the maximize button.") );
|
|
|
|
|
|
|
|
QString strMouseButton[] = {
|
|
|
|
i18n("Left button:"),
|
|
|
|
i18n("Middle button:"),
|
|
|
|
i18n("Right button:")};
|
|
|
|
|
|
|
|
QString txtButton[] = {
|
|
|
|
i18n("Behavior on <em>left</em> click onto the maximize button." ),
|
|
|
|
i18n("Behavior on <em>middle</em> click onto the maximize button." ),
|
|
|
|
i18n("Behavior on <em>right</em> click onto the maximize button." )};
|
|
|
|
|
|
|
|
if ( leftHandedMouse ) // Be nice to lefties
|
|
|
|
{
|
|
|
|
qSwap(strMouseButton[0], strMouseButton[2]);
|
|
|
|
qSwap(txtButton[0], txtButton[2]);
|
|
|
|
}
|
|
|
|
|
|
|
|
createMaxButtonPixmaps();
|
|
|
|
for (int b = 0; b < 3; ++b)
|
|
|
|
{
|
|
|
|
if (b != 0) new QWidget(box); // Spacer
|
|
|
|
|
|
|
|
QLabel * label = new QLabel(strMouseButton[b], box);
|
2005-07-28 14:59:42 +00:00
|
|
|
label->setWhatsThis( txtButton[b] );
|
2004-08-28 15:27:22 +00:00
|
|
|
label ->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Minimum ));
|
|
|
|
|
|
|
|
coMax[b] = new ToolTipComboBox(box, tbl_Max);
|
2006-04-12 15:13:31 +00:00
|
|
|
for (int t = 0; t < 3; ++t) coMax[b]->addItem(maxButtonPixmaps[t], QString());
|
2004-08-28 15:27:22 +00:00
|
|
|
connect(coMax[b], SIGNAL(activated(int)), SLOT(changed()));
|
|
|
|
connect(coMax[b], SIGNAL(activated(int)), coMax[b], SLOT(changed()));
|
2005-07-28 14:59:42 +00:00
|
|
|
coMax[b]->setWhatsThis( txtButton[b] );
|
2004-08-28 15:27:22 +00:00
|
|
|
coMax[b]->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Minimum ));
|
|
|
|
}
|
|
|
|
|
2007-02-23 14:38:01 +00:00
|
|
|
connect(kapp, SIGNAL(kdisplayPaletteChanged()), SLOT(paletteChanged()));
|
2004-08-28 15:27:22 +00:00
|
|
|
|
2005-05-06 08:47:48 +00:00
|
|
|
layout->addStretch();
|
|
|
|
|
|
|
|
load();
|
|
|
|
}
|
|
|
|
|
|
|
|
KTitleBarActionsConfig::~KTitleBarActionsConfig()
|
|
|
|
{
|
|
|
|
if (standAlone)
|
|
|
|
delete config;
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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",
|
|
|
|
"OnAllDesktops",
|
|
|
|
"Nothing",
|
|
|
|
"" };
|
|
|
|
|
|
|
|
const char* const tbl_TiAc[] = {
|
|
|
|
"Raise",
|
|
|
|
"Lower",
|
|
|
|
"Operations menu",
|
|
|
|
"Toggle raise and lower",
|
|
|
|
"Nothing",
|
|
|
|
"Shade",
|
|
|
|
"" };
|
|
|
|
|
|
|
|
const char* const tbl_TiInAc[] = {
|
|
|
|
"Activate and raise",
|
|
|
|
"Activate and lower",
|
|
|
|
"Activate",
|
|
|
|
"Shade",
|
|
|
|
"Operations menu",
|
|
|
|
"Raise",
|
|
|
|
"Lower",
|
|
|
|
"Nothing",
|
|
|
|
"" };
|
|
|
|
|
|
|
|
const char* const tbl_Win[] = {
|
|
|
|
"Activate, raise and pass click",
|
|
|
|
"Activate and pass click",
|
|
|
|
"Activate",
|
|
|
|
"Activate and raise",
|
|
|
|
"" };
|
|
|
|
|
|
|
|
const char* const tbl_AllKey[] = {
|
|
|
|
"Meta",
|
|
|
|
"Alt",
|
|
|
|
"" };
|
|
|
|
|
|
|
|
const char* const tbl_All[] = {
|
|
|
|
"Move",
|
|
|
|
"Activate, raise and move",
|
|
|
|
"Toggle raise and lower",
|
|
|
|
"Resize",
|
|
|
|
"Raise",
|
|
|
|
"Lower",
|
|
|
|
"Minimize",
|
|
|
|
"Nothing",
|
|
|
|
"" };
|
|
|
|
|
2005-05-06 15:20:49 +00:00
|
|
|
const char* tbl_TiWAc[] = {
|
|
|
|
"Raise/Lower",
|
|
|
|
"Shade/Unshade",
|
|
|
|
"Maximize/Restore",
|
|
|
|
"Above/Below",
|
|
|
|
"Previous/Next Desktop",
|
|
|
|
"Change Opacity",
|
|
|
|
"Nothing",
|
|
|
|
"" };
|
|
|
|
|
|
|
|
const char* tbl_AllW[] = {
|
|
|
|
"Raise/Lower",
|
|
|
|
"Shade/Unshade",
|
|
|
|
"Maximize/Restore",
|
|
|
|
"Above/Below",
|
|
|
|
"Previous/Next Desktop",
|
|
|
|
"Change Opacity",
|
|
|
|
"Nothing",
|
|
|
|
"" };
|
|
|
|
|
2005-05-06 08:47:48 +00:00
|
|
|
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( QComboBox* combo, const char*txt )
|
|
|
|
{
|
|
|
|
if( combo == coTiDbl )
|
2006-03-06 16:25:27 +00:00
|
|
|
combo->setCurrentIndex( tbl_txt_lookup( tbl_TiDbl, txt ));
|
2005-05-06 08:47:48 +00:00
|
|
|
else if( combo == coTiAct1 || combo == coTiAct2 || combo == coTiAct3 )
|
2006-03-06 16:25:27 +00:00
|
|
|
combo->setCurrentIndex( tbl_txt_lookup( tbl_TiAc, txt ));
|
2005-05-06 08:47:48 +00:00
|
|
|
else if( combo == coTiInAct1 || combo == coTiInAct2 || combo == coTiInAct3 )
|
2006-03-06 16:25:27 +00:00
|
|
|
combo->setCurrentIndex( tbl_txt_lookup( tbl_TiInAc, txt ));
|
2005-05-06 15:20:49 +00:00
|
|
|
else if( combo == coTiAct4 )
|
2006-03-06 16:25:27 +00:00
|
|
|
combo->setCurrentIndex( tbl_txt_lookup( tbl_TiWAc, txt ));
|
2005-05-06 08:47:48 +00:00
|
|
|
else if( combo == coMax[0] || combo == coMax[1] || combo == coMax[2] )
|
|
|
|
{
|
2006-03-06 16:25:27 +00:00
|
|
|
combo->setCurrentIndex( tbl_txt_lookup( tbl_Max, txt ));
|
2005-05-06 08:47:48 +00:00
|
|
|
static_cast<ToolTipComboBox *>(combo)->changed();
|
|
|
|
}
|
|
|
|
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 );
|
|
|
|
}
|
|
|
|
|
2005-05-06 15:20:49 +00:00
|
|
|
const char* KTitleBarActionsConfig::functionTiWAc(int i)
|
|
|
|
{
|
|
|
|
return tbl_num_lookup( tbl_TiWAc, i );
|
|
|
|
}
|
|
|
|
|
2005-05-06 08:47:48 +00:00
|
|
|
const char* KTitleBarActionsConfig::functionMax( int i )
|
|
|
|
{
|
|
|
|
return tbl_num_lookup( tbl_Max, i );
|
|
|
|
}
|
|
|
|
|
|
|
|
void KTitleBarActionsConfig::load()
|
|
|
|
{
|
2007-02-21 02:59:04 +00:00
|
|
|
KConfigGroup windowsConfig(config, "Windows");
|
|
|
|
setComboText(coTiDbl, windowsConfig.readEntry("TitlebarDoubleClickCommand","Shade").toAscii());
|
2005-05-06 08:47:48 +00:00
|
|
|
for (int t = 0; t < 3; ++t)
|
2007-02-21 02:59:04 +00:00
|
|
|
setComboText(coMax[t],windowsConfig.readEntry(cnf_Max[t], tbl_Max[t]).toAscii());
|
|
|
|
|
|
|
|
KConfigGroup cg(config, "MouseBindings");
|
|
|
|
setComboText(coTiAct1,cg.readEntry("CommandActiveTitlebar1","Raise").toAscii());
|
|
|
|
setComboText(coTiAct2,cg.readEntry("CommandActiveTitlebar2","Lower").toAscii());
|
|
|
|
setComboText(coTiAct3,cg.readEntry("CommandActiveTitlebar3","Operations menu").toAscii());
|
|
|
|
setComboText(coTiAct4,cg.readEntry("CommandTitlebarWheel","Nothing").toAscii());
|
|
|
|
setComboText(coTiInAct1,cg.readEntry("CommandInactiveTitlebar1","Activate and raise").toAscii());
|
|
|
|
setComboText(coTiInAct2,cg.readEntry("CommandInactiveTitlebar2","Activate and lower").toAscii());
|
|
|
|
setComboText(coTiInAct3,cg.readEntry("CommandInactiveTitlebar3","Operations menu").toAscii());
|
2005-05-06 08:47:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void KTitleBarActionsConfig::save()
|
|
|
|
{
|
2007-02-21 02:59:04 +00:00
|
|
|
KConfigGroup windowsConfig(config, "Windows");
|
|
|
|
windowsConfig.writeEntry("TitlebarDoubleClickCommand", functionTiDbl( coTiDbl->currentIndex() ) );
|
2005-05-06 08:47:48 +00:00
|
|
|
for (int t = 0; t < 3; ++t)
|
2007-02-21 02:59:04 +00:00
|
|
|
windowsConfig.writeEntry(cnf_Max[t], functionMax(coMax[t]->currentIndex()));
|
|
|
|
|
|
|
|
KConfigGroup cg(config, "MouseBindings");
|
|
|
|
cg.writeEntry("CommandActiveTitlebar1", functionTiAc(coTiAct1->currentIndex()));
|
|
|
|
cg.writeEntry("CommandActiveTitlebar2", functionTiAc(coTiAct2->currentIndex()));
|
|
|
|
cg.writeEntry("CommandActiveTitlebar3", functionTiAc(coTiAct3->currentIndex()));
|
|
|
|
cg.writeEntry("CommandInactiveTitlebar1", functionTiInAc(coTiInAct1->currentIndex()));
|
|
|
|
cg.writeEntry("CommandTitlebarWheel", functionTiWAc(coTiAct4->currentIndex()));
|
|
|
|
cg.writeEntry("CommandInactiveTitlebar2", functionTiInAc(coTiInAct2->currentIndex()));
|
|
|
|
cg.writeEntry("CommandInactiveTitlebar3", functionTiInAc(coTiInAct3->currentIndex()));
|
2005-05-06 08:47:48 +00:00
|
|
|
|
|
|
|
if (standAlone)
|
|
|
|
{
|
|
|
|
config->sync();
|
2007-02-23 14:38:01 +00:00
|
|
|
QDBusInterface kwin( "org.kde.kwin", "/KWin", "org.kde.KWin" );
|
|
|
|
kwin.call( "reconfigure" );
|
2005-05-06 08:47:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void KTitleBarActionsConfig::defaults()
|
|
|
|
{
|
|
|
|
setComboText(coTiDbl, "Shade");
|
|
|
|
setComboText(coTiAct1,"Raise");
|
|
|
|
setComboText(coTiAct2,"Lower");
|
|
|
|
setComboText(coTiAct3,"Operations menu");
|
2005-05-06 15:20:49 +00:00
|
|
|
setComboText(coTiAct4,"Nothing");
|
2005-05-06 08:47:48 +00:00
|
|
|
setComboText(coTiInAct1,"Activate and raise");
|
|
|
|
setComboText(coTiInAct2,"Activate and lower");
|
|
|
|
setComboText(coTiInAct3,"Operations menu");
|
|
|
|
for (int t = 0; t < 3; ++t)
|
|
|
|
setComboText(coMax[t], tbl_Max[t]);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-01-29 17:14:20 +00:00
|
|
|
KWindowActionsConfig::KWindowActionsConfig (bool _standAlone, KConfig *_config, const KComponentData &inst, QWidget * parent)
|
2005-10-22 19:12:01 +00:00
|
|
|
: KCModule(inst, parent), config(_config), standAlone(_standAlone)
|
2005-05-06 08:47:48 +00:00
|
|
|
{
|
2005-05-06 15:20:49 +00:00
|
|
|
QString strWin1, strWin2, strWin3, strAllKey, strAll1, strAll2, strAll3, strAllW;
|
2005-07-28 14:59:42 +00:00
|
|
|
Q3Grid *grid;
|
|
|
|
Q3GroupBox *box;
|
2005-05-06 08:47:48 +00:00
|
|
|
QLabel *label;
|
|
|
|
QString strMouseButton1, strMouseButton3;
|
|
|
|
QString txtButton1, txtButton3;
|
|
|
|
QStringList items;
|
|
|
|
bool leftHandedMouse = ( KGlobalSettings::mouseSettings().handed == KGlobalSettings::KMouseSettings::LeftHanded);
|
2006-04-12 15:34:39 +00:00
|
|
|
|
|
|
|
QVBoxLayout *layout = new QVBoxLayout(this);
|
|
|
|
layout->setMargin(0);
|
|
|
|
layout->setSpacing(KDialog::spacingHint());
|
2005-05-06 08:47:48 +00:00
|
|
|
|
2002-01-16 12:26:03 +00:00
|
|
|
/** Inactive inner window ******************/
|
|
|
|
|
2005-07-28 14:59:42 +00:00
|
|
|
box = new Q3GroupBox(1, Qt::Horizontal, i18n("Inactive Inner Window"), this, "Inactive Inner Window");
|
2002-01-16 12:26:03 +00:00
|
|
|
box->layout()->setMargin(KDialog::marginHint());
|
|
|
|
box->layout()->setSpacing(KDialog::spacingHint());
|
|
|
|
layout->addWidget(box);
|
2005-07-28 14:59:42 +00:00
|
|
|
box->setWhatsThis( i18n("Here you can customize mouse click behavior when clicking on an inactive"
|
2002-01-16 12:26:03 +00:00
|
|
|
" inner window ('inner' means: not titlebar, not frame).") );
|
|
|
|
|
2005-07-28 14:59:42 +00:00
|
|
|
grid = new Q3Grid(3, Qt::Vertical, box);
|
2002-01-16 12:26:03 +00:00
|
|
|
|
2002-07-01 10:43:57 +00:00
|
|
|
strMouseButton1 = i18n("Left button:");
|
2002-01-16 12:26:03 +00:00
|
|
|
txtButton1 = i18n("In this row you can customize left click behavior when clicking into"
|
|
|
|
" the titlebar or the frame.");
|
|
|
|
|
2002-07-01 10:43:57 +00:00
|
|
|
strMouseButton3 = i18n("Right button:");
|
2002-01-16 12:26:03 +00:00
|
|
|
txtButton3 = i18n("In this row you can customize right click behavior when clicking into"
|
|
|
|
" the titlebar or the frame." );
|
|
|
|
|
|
|
|
if ( leftHandedMouse )
|
|
|
|
{
|
|
|
|
qSwap(strMouseButton1, strMouseButton3);
|
|
|
|
qSwap(txtButton1, txtButton3);
|
|
|
|
}
|
|
|
|
|
|
|
|
strWin1 = i18n("In this row you can customize left click behavior when clicking into"
|
|
|
|
" an inactive inner window ('inner' means: not titlebar, not frame).");
|
|
|
|
|
|
|
|
strWin3 = i18n("In this row you can customize right click behavior when clicking into"
|
|
|
|
" an inactive inner window ('inner' means: not titlebar, not frame).");
|
|
|
|
|
|
|
|
// Be nice to lefties
|
|
|
|
if ( leftHandedMouse ) qSwap(strWin1, strWin3);
|
|
|
|
|
|
|
|
label = new QLabel(strMouseButton1, grid);
|
2005-07-28 14:59:42 +00:00
|
|
|
label->setWhatsThis( strWin1 );
|
2002-01-16 12:26:03 +00:00
|
|
|
|
2002-07-01 10:43:57 +00:00
|
|
|
label = new QLabel(i18n("Middle button:"), grid);
|
2002-01-16 12:26:03 +00:00
|
|
|
strWin2 = i18n("In this row you can customize middle click behavior when clicking into"
|
|
|
|
" an inactive inner window ('inner' means: not titlebar, not frame).");
|
2005-07-28 14:59:42 +00:00
|
|
|
label->setWhatsThis( strWin2 );
|
2002-01-16 12:26:03 +00:00
|
|
|
|
|
|
|
label = new QLabel(strMouseButton3, grid);
|
2005-07-28 14:59:42 +00:00
|
|
|
label->setWhatsThis( strWin3 );
|
2002-01-16 12:26:03 +00:00
|
|
|
|
|
|
|
items.clear();
|
2002-07-31 18:00:57 +00:00
|
|
|
items << i18n("Activate, Raise & Pass Click")
|
|
|
|
<< i18n("Activate & Pass Click")
|
2002-01-16 12:26:03 +00:00
|
|
|
<< i18n("Activate")
|
2002-07-31 18:00:57 +00:00
|
|
|
<< i18n("Activate & Raise");
|
2002-01-16 12:26:03 +00:00
|
|
|
|
2005-05-06 08:47:48 +00:00
|
|
|
QComboBox* combo = new QComboBox(grid);
|
2006-04-12 15:13:31 +00:00
|
|
|
combo->addItems(items);
|
2002-07-07 00:38:19 +00:00
|
|
|
connect(combo, SIGNAL(activated(int)), SLOT(changed()));
|
2002-01-16 12:26:03 +00:00
|
|
|
coWin1 = combo;
|
2005-07-28 14:59:42 +00:00
|
|
|
combo->setWhatsThis( strWin1 );
|
2002-01-16 12:26:03 +00:00
|
|
|
|
|
|
|
combo = new QComboBox(grid);
|
2006-04-12 15:13:31 +00:00
|
|
|
combo->addItems(items);
|
2002-07-07 00:38:19 +00:00
|
|
|
connect(combo, SIGNAL(activated(int)), SLOT(changed()));
|
2002-01-16 12:26:03 +00:00
|
|
|
coWin2 = combo;
|
2005-07-28 14:59:42 +00:00
|
|
|
combo->setWhatsThis( strWin2 );
|
2002-01-16 12:26:03 +00:00
|
|
|
|
|
|
|
combo = new QComboBox(grid);
|
2006-04-12 15:13:31 +00:00
|
|
|
combo->addItems(items);
|
2002-07-07 00:38:19 +00:00
|
|
|
connect(combo, SIGNAL(activated(int)), SLOT(changed()));
|
2002-01-16 12:26:03 +00:00
|
|
|
coWin3 = combo;
|
2005-07-28 14:59:42 +00:00
|
|
|
combo->setWhatsThis( strWin3 );
|
2002-01-16 12:26:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
/** Inner window, titlebar and frame **************/
|
|
|
|
|
2005-07-28 14:59:42 +00:00
|
|
|
box = new Q3GroupBox(1, Qt::Horizontal, i18n("Inner Window, Titlebar && Frame"), this, "Inner Window, Titlebar and Frame");
|
2002-01-16 12:26:03 +00:00
|
|
|
box->layout()->setMargin(KDialog::marginHint());
|
|
|
|
box->layout()->setSpacing(KDialog::spacingHint());
|
|
|
|
layout->addWidget(box);
|
2005-07-28 14:59:42 +00:00
|
|
|
box->setWhatsThis( i18n("Here you can customize KDE's behavior when clicking somewhere into"
|
2002-01-16 12:26:03 +00:00
|
|
|
" a window while pressing a modifier key."));
|
|
|
|
|
2005-07-28 14:59:42 +00:00
|
|
|
grid = new Q3Grid(5, Qt::Vertical, box);
|
2002-01-16 12:26:03 +00:00
|
|
|
|
|
|
|
// Labels
|
2002-07-01 10:43:57 +00:00
|
|
|
label = new QLabel(i18n("Modifier key:"), grid);
|
2002-01-16 12:26:03 +00:00
|
|
|
|
|
|
|
strAllKey = i18n("Here you select whether holding the Meta key or Alt key "
|
|
|
|
"will allow you to perform the following actions.");
|
2005-07-28 14:59:42 +00:00
|
|
|
label->setWhatsThis( strAllKey );
|
2002-01-16 12:26:03 +00:00
|
|
|
|
|
|
|
|
2002-07-01 10:43:57 +00:00
|
|
|
strMouseButton1 = i18n("Modifier key + left button:");
|
2002-01-16 12:26:03 +00:00
|
|
|
strAll1 = i18n("In this row you can customize left click behavior when clicking into"
|
|
|
|
" the titlebar or the frame.");
|
|
|
|
|
2002-07-01 10:43:57 +00:00
|
|
|
strMouseButton3 = i18n("Modifier key + right button:");
|
2002-01-16 12:26:03 +00:00
|
|
|
strAll3 = i18n("In this row you can customize right click behavior when clicking into"
|
|
|
|
" the titlebar or the frame." );
|
|
|
|
|
|
|
|
if ( leftHandedMouse )
|
|
|
|
{
|
|
|
|
qSwap(strMouseButton1, strMouseButton3);
|
|
|
|
qSwap(strAll1, strAll3);
|
|
|
|
}
|
|
|
|
|
|
|
|
label = new QLabel(strMouseButton1, grid);
|
2005-07-28 14:59:42 +00:00
|
|
|
label->setWhatsThis( strAll1);
|
2002-01-16 12:26:03 +00:00
|
|
|
|
2002-07-01 10:43:57 +00:00
|
|
|
label = new QLabel(i18n("Modifier key + middle button:"), grid);
|
2002-02-26 13:17:35 +00:00
|
|
|
strAll2 = i18n("Here you can customize KDE's behavior when middle clicking into a window"
|
|
|
|
" while pressing the modifier key.");
|
2005-07-28 14:59:42 +00:00
|
|
|
label->setWhatsThis( strAll2 );
|
2002-02-26 13:17:35 +00:00
|
|
|
|
2002-01-16 12:26:03 +00:00
|
|
|
label = new QLabel(strMouseButton3, grid);
|
2005-07-28 14:59:42 +00:00
|
|
|
label->setWhatsThis( strAll3);
|
2002-01-16 12:26:03 +00:00
|
|
|
|
2005-05-06 15:20:49 +00:00
|
|
|
label = new QLabel(i18n("Modifier key + mouse wheel:"), grid);
|
|
|
|
strAllW = i18n("Here you can customize KDE's behavior when scrolling with the mouse wheel"
|
|
|
|
" in a window while pressing the modifier key.");
|
2005-07-28 14:59:42 +00:00
|
|
|
label->setWhatsThis( strAllW);
|
2005-05-06 15:20:49 +00:00
|
|
|
|
2002-01-16 12:26:03 +00:00
|
|
|
// Combo's
|
|
|
|
combo = new QComboBox(grid);
|
2006-04-12 15:13:31 +00:00
|
|
|
combo->addItem(i18n("Meta"));
|
|
|
|
combo->addItem(i18n("Alt"));
|
2002-07-07 00:38:19 +00:00
|
|
|
connect(combo, SIGNAL(activated(int)), SLOT(changed()));
|
2002-01-16 12:26:03 +00:00
|
|
|
coAllKey = combo;
|
2005-07-28 14:59:42 +00:00
|
|
|
combo->setWhatsThis( strAllKey );
|
2002-01-16 12:26:03 +00:00
|
|
|
|
|
|
|
items.clear();
|
|
|
|
items << i18n("Move")
|
2003-09-16 19:34:03 +00:00
|
|
|
<< i18n("Activate, Raise and Move")
|
2002-07-31 18:00:57 +00:00
|
|
|
<< i18n("Toggle Raise & Lower")
|
2002-01-16 12:26:03 +00:00
|
|
|
<< i18n("Resize")
|
|
|
|
<< i18n("Raise")
|
|
|
|
<< i18n("Lower")
|
2003-09-16 19:34:03 +00:00
|
|
|
<< i18n("Minimize")
|
2002-01-16 12:26:03 +00:00
|
|
|
<< i18n("Nothing");
|
|
|
|
|
|
|
|
combo = new QComboBox(grid);
|
2006-04-12 15:13:31 +00:00
|
|
|
combo->addItems(items);
|
2002-07-07 00:38:19 +00:00
|
|
|
connect(combo, SIGNAL(activated(int)), SLOT(changed()));
|
2002-01-16 12:26:03 +00:00
|
|
|
coAll1 = combo;
|
2005-07-28 14:59:42 +00:00
|
|
|
combo->setWhatsThis( strAll1 );
|
2002-01-16 12:26:03 +00:00
|
|
|
|
|
|
|
combo = new QComboBox(grid);
|
2006-04-12 15:13:31 +00:00
|
|
|
combo->addItems(items);
|
2002-07-07 00:38:19 +00:00
|
|
|
connect(combo, SIGNAL(activated(int)), SLOT(changed()));
|
2002-01-16 12:26:03 +00:00
|
|
|
coAll2 = combo;
|
2005-07-28 14:59:42 +00:00
|
|
|
combo->setWhatsThis( strAll2 );
|
2002-01-16 12:26:03 +00:00
|
|
|
|
|
|
|
combo = new QComboBox(grid);
|
2006-04-12 15:13:31 +00:00
|
|
|
combo->addItems(items);
|
2002-07-07 00:38:19 +00:00
|
|
|
connect(combo, SIGNAL(activated(int)), SLOT(changed()));
|
2002-01-16 12:26:03 +00:00
|
|
|
coAll3 = combo;
|
2005-07-28 14:59:42 +00:00
|
|
|
combo->setWhatsThis( strAll3 );
|
2002-01-16 12:26:03 +00:00
|
|
|
|
2005-05-06 15:20:49 +00:00
|
|
|
combo = new QComboBox(grid);
|
2006-04-12 15:13:31 +00:00
|
|
|
combo->addItem(i18n("Raise/Lower"));
|
|
|
|
combo->addItem(i18n("Shade/Unshade"));
|
|
|
|
combo->addItem(i18n("Maximize/Restore"));
|
|
|
|
combo->addItem(i18n("Keep Above/Below"));
|
|
|
|
combo->addItem(i18n("Move to Previous/Next Desktop"));
|
|
|
|
combo->addItem(i18n("Change Opacity"));
|
|
|
|
combo->addItem(i18n("Nothing"));
|
2005-05-06 15:20:49 +00:00
|
|
|
connect(combo, SIGNAL(activated(int)), SLOT(changed()));
|
|
|
|
coAllW = combo;
|
2005-07-28 14:59:42 +00:00
|
|
|
combo->setWhatsThis( strAllW );
|
2005-05-06 15:20:49 +00:00
|
|
|
|
2002-01-16 12:26:03 +00:00
|
|
|
layout->addStretch();
|
|
|
|
|
|
|
|
load();
|
|
|
|
}
|
|
|
|
|
2005-05-06 08:47:48 +00:00
|
|
|
KWindowActionsConfig::~KWindowActionsConfig()
|
2002-07-07 00:38:19 +00:00
|
|
|
{
|
2002-09-16 20:54:23 +00:00
|
|
|
if (standAlone)
|
|
|
|
delete config;
|
2002-07-07 00:38:19 +00:00
|
|
|
}
|
|
|
|
|
2005-05-06 08:47:48 +00:00
|
|
|
void KWindowActionsConfig::setComboText( QComboBox* combo, const char*txt )
|
2002-01-16 12:26:03 +00:00
|
|
|
{
|
2005-05-06 08:47:48 +00:00
|
|
|
if( combo == coWin1 || combo == coWin2 || combo == coWin3 )
|
2006-03-06 16:25:27 +00:00
|
|
|
combo->setCurrentIndex( tbl_txt_lookup( tbl_Win, txt ));
|
2002-09-24 16:03:45 +00:00
|
|
|
else if( combo == coAllKey )
|
2006-03-06 16:25:27 +00:00
|
|
|
combo->setCurrentIndex( tbl_txt_lookup( tbl_AllKey, txt ));
|
2002-09-24 16:03:45 +00:00
|
|
|
else if( combo == coAll1 || combo == coAll2 || combo == coAll3 )
|
2006-03-06 16:25:27 +00:00
|
|
|
combo->setCurrentIndex( tbl_txt_lookup( tbl_All, txt ));
|
2005-05-06 15:20:49 +00:00
|
|
|
else if( combo == coAllW )
|
2006-03-06 16:25:27 +00:00
|
|
|
combo->setCurrentIndex( tbl_txt_lookup( tbl_AllW, txt ));
|
2002-09-24 16:03:45 +00:00
|
|
|
else
|
|
|
|
abort();
|
2002-01-16 12:26:03 +00:00
|
|
|
}
|
|
|
|
|
2005-05-06 08:47:48 +00:00
|
|
|
const char* KWindowActionsConfig::functionWin( int i )
|
2002-01-16 12:26:03 +00:00
|
|
|
{
|
2002-09-24 16:03:45 +00:00
|
|
|
return tbl_num_lookup( tbl_Win, i );
|
2002-01-16 12:26:03 +00:00
|
|
|
}
|
2002-09-24 16:03:45 +00:00
|
|
|
|
2005-05-06 08:47:48 +00:00
|
|
|
const char* KWindowActionsConfig::functionAllKey( int i )
|
2002-01-16 12:26:03 +00:00
|
|
|
{
|
2002-09-24 16:03:45 +00:00
|
|
|
return tbl_num_lookup( tbl_AllKey, i );
|
2002-01-16 12:26:03 +00:00
|
|
|
}
|
|
|
|
|
2005-05-06 08:47:48 +00:00
|
|
|
const char* KWindowActionsConfig::functionAll( int i )
|
2002-09-24 16:03:45 +00:00
|
|
|
{
|
|
|
|
return tbl_num_lookup( tbl_All, i );
|
|
|
|
}
|
2002-01-16 12:26:03 +00:00
|
|
|
|
2005-05-06 15:20:49 +00:00
|
|
|
const char* KWindowActionsConfig::functionAllW(int i)
|
|
|
|
{
|
|
|
|
return tbl_num_lookup( tbl_AllW, i );
|
|
|
|
}
|
|
|
|
|
2005-05-06 08:47:48 +00:00
|
|
|
void KWindowActionsConfig::load()
|
2004-08-28 15:27:22 +00:00
|
|
|
{
|
2007-02-21 02:59:04 +00:00
|
|
|
KConfigGroup cg(config, "MouseBindings");
|
|
|
|
setComboText(coWin1,cg.readEntry("CommandWindow1","Activate, raise and pass click").toAscii());
|
|
|
|
setComboText(coWin2,cg.readEntry("CommandWindow2","Activate and pass click").toAscii());
|
|
|
|
setComboText(coWin3,cg.readEntry("CommandWindow3","Activate and pass click").toAscii());
|
|
|
|
setComboText(coAllKey,cg.readEntry("CommandAllKey","Alt").toAscii());
|
|
|
|
setComboText(coAll1,cg.readEntry("CommandAll1","Move").toAscii());
|
|
|
|
setComboText(coAll2,cg.readEntry("CommandAll2","Toggle raise and lower").toAscii());
|
|
|
|
setComboText(coAll3,cg.readEntry("CommandAll3","Resize").toAscii());
|
|
|
|
setComboText(coAllW,cg.readEntry("CommandAllWheel","Nothing").toAscii());
|
2002-01-16 12:26:03 +00:00
|
|
|
}
|
|
|
|
|
2005-05-06 08:47:48 +00:00
|
|
|
void KWindowActionsConfig::save()
|
2002-01-16 12:26:03 +00:00
|
|
|
{
|
2007-02-21 02:59:04 +00:00
|
|
|
KConfigGroup cg(config, "MouseBindings");
|
|
|
|
cg.writeEntry("CommandWindow1", functionWin(coWin1->currentIndex()));
|
|
|
|
cg.writeEntry("CommandWindow2", functionWin(coWin2->currentIndex()));
|
|
|
|
cg.writeEntry("CommandWindow3", functionWin(coWin3->currentIndex()));
|
|
|
|
cg.writeEntry("CommandAllKey", functionAllKey(coAllKey->currentIndex()));
|
|
|
|
cg.writeEntry("CommandAll1", functionAll(coAll1->currentIndex()));
|
|
|
|
cg.writeEntry("CommandAll2", functionAll(coAll2->currentIndex()));
|
|
|
|
cg.writeEntry("CommandAll3", functionAll(coAll3->currentIndex()));
|
|
|
|
cg.writeEntry("CommandAllWheel", functionAllW(coAllW->currentIndex()));
|
2002-09-16 20:54:23 +00:00
|
|
|
|
|
|
|
if (standAlone)
|
|
|
|
{
|
|
|
|
config->sync();
|
2007-02-23 14:38:01 +00:00
|
|
|
QDBusInterface kwin( "org.kde.kwin", "/KWin", "org.kde.KWin" );
|
|
|
|
kwin.call( "reconfigure" );
|
2002-09-16 20:54:23 +00:00
|
|
|
}
|
2002-01-16 12:26:03 +00:00
|
|
|
}
|
|
|
|
|
2005-05-06 08:47:48 +00:00
|
|
|
void KWindowActionsConfig::defaults()
|
2002-01-16 12:26:03 +00:00
|
|
|
{
|
|
|
|
setComboText(coWin1,"Activate, raise and pass click");
|
|
|
|
setComboText(coWin2,"Activate and pass click");
|
|
|
|
setComboText(coWin3,"Activate and pass click");
|
2002-03-02 13:50:26 +00:00
|
|
|
setComboText(coAllKey,"Alt");
|
2002-01-16 12:26:03 +00:00
|
|
|
setComboText (coAll1,"Move");
|
|
|
|
setComboText(coAll2,"Toggle raise and lower");
|
|
|
|
setComboText(coAll3,"Resize");
|
2005-05-06 15:20:49 +00:00
|
|
|
setComboText(coAllW,"Nothing");
|
2002-01-16 12:26:03 +00:00
|
|
|
}
|