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
|
2003-09-16 19:34:03 +00:00
|
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
2002-01-16 12:26:03 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <qlabel.h>
|
|
|
|
#include <qcombobox.h>
|
|
|
|
#include <qwhatsthis.h>
|
|
|
|
#include <qlayout.h>
|
|
|
|
#include <qvgroupbox.h>
|
|
|
|
#include <qgrid.h>
|
|
|
|
#include <qsizepolicy.h>
|
|
|
|
|
|
|
|
#include <dcopclient.h>
|
|
|
|
#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>
|
|
|
|
|
|
|
|
#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"
|
|
|
|
|
|
|
|
|
2002-09-16 20:54:23 +00:00
|
|
|
KActionsConfig::KActionsConfig (bool _standAlone, KConfig *_config, QWidget * parent, const char *)
|
|
|
|
: KCModule(parent, "kcmkwm"), config(_config), standAlone(_standAlone)
|
2002-01-16 12:26:03 +00:00
|
|
|
{
|
|
|
|
QString strWin1, strWin2, strWin3, strAllKey, strAll1, strAll2, strAll3;
|
2003-04-06 21:32:24 +00:00
|
|
|
QVBoxLayout *layout = new QVBoxLayout(this, 0, KDialog::spacingHint());
|
2002-01-16 12:26:03 +00:00
|
|
|
QGrid *grid;
|
|
|
|
QGroupBox *box;
|
|
|
|
QLabel *label;
|
|
|
|
QString strMouseButton1, strMouseButton3;
|
|
|
|
QString txtButton1, txtButton3;
|
|
|
|
QStringList items;
|
|
|
|
bool leftHandedMouse = ( KGlobalSettings::mouseSettings().handed == KGlobalSettings::KMouseSettings::LeftHanded);
|
|
|
|
|
|
|
|
/** Titlebar doubleclick ************/
|
|
|
|
|
|
|
|
QHBoxLayout *hlayout = new QHBoxLayout(layout);
|
|
|
|
|
|
|
|
label = new QLabel(i18n("&Titlebar double-click:"), this);
|
|
|
|
hlayout->addWidget(label);
|
|
|
|
QWhatsThis::add( label, i18n("Here you can customize mouse click behavior when double clicking on the"
|
|
|
|
" titlebar of a window.") );
|
|
|
|
|
|
|
|
QComboBox* combo = new QComboBox(this);
|
|
|
|
combo->insertItem(i18n("Maximize"));
|
|
|
|
combo->insertItem(i18n("Maximize (vertical only)"));
|
|
|
|
combo->insertItem(i18n("Maximize (horizontal only)"));
|
2003-09-16 19:34:03 +00:00
|
|
|
combo->insertItem(i18n("Minimize"));
|
2002-01-16 12:26:03 +00:00
|
|
|
combo->insertItem(i18n("Shade"));
|
|
|
|
combo->insertItem(i18n("Lower"));
|
2003-09-16 19:34:03 +00:00
|
|
|
combo->insertItem(i18n("On All Desktops"));
|
|
|
|
combo->insertItem(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;
|
|
|
|
QWhatsThis::add(combo, i18n("Behavior on <em>double</em> click into the titlebar."));
|
|
|
|
|
|
|
|
label->setBuddy(combo);
|
|
|
|
|
|
|
|
/** Titlebar and frame **************/
|
|
|
|
|
2002-07-31 18:00:57 +00:00
|
|
|
box = new QVGroupBox( 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);
|
|
|
|
QWhatsThis::add( box, i18n("Here you can customize mouse click behavior when clicking on the"
|
|
|
|
" titlebar or the frame of a window.") );
|
|
|
|
|
|
|
|
grid = new QGrid(4, Qt::Vertical, box);
|
|
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
QWhatsThis::add( label, txtButton1);
|
|
|
|
|
2002-07-01 10:43:57 +00:00
|
|
|
label = new QLabel(i18n("Middle button:"), grid);
|
2002-01-16 12:26:03 +00:00
|
|
|
QWhatsThis::add( label, i18n("In this row you can customize middle click behavior when clicking into"
|
|
|
|
" the titlebar or the frame.") );
|
|
|
|
|
|
|
|
label = new QLabel(strMouseButton3, grid);
|
|
|
|
QWhatsThis::add( label, txtButton3);
|
|
|
|
|
|
|
|
|
|
|
|
label = new QLabel(i18n("Active"), grid);
|
|
|
|
label->setAlignment(AlignCenter);
|
|
|
|
QWhatsThis::add( label, i18n("In this column you can customize mouse clicks into the titlebar"
|
|
|
|
" or the frame of an active window.") );
|
|
|
|
|
|
|
|
// Titlebar and frame, active, mouse button 1
|
|
|
|
combo = new QComboBox(grid);
|
|
|
|
combo->insertItem(i18n("Raise"));
|
|
|
|
combo->insertItem(i18n("Lower"));
|
2002-04-23 13:02:02 +00:00
|
|
|
combo->insertItem(i18n("Operations Menu"));
|
2002-07-31 18:00:57 +00:00
|
|
|
combo->insertItem(i18n("Toggle Raise & Lower"));
|
2003-09-16 19:34:03 +00:00
|
|
|
combo->insertItem(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);
|
|
|
|
|
|
|
|
QWhatsThis::add(combo, txtButton1);
|
|
|
|
|
|
|
|
// 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);
|
|
|
|
combo->insertStringList(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;
|
|
|
|
QWhatsThis::add(combo, i18n("Behavior on <em>middle</em> click into the titlebar or frame of an <em>active</em> window."));
|
|
|
|
|
|
|
|
// Titlebar and frame, active, mouse button 3
|
|
|
|
combo = new QComboBox(grid);
|
|
|
|
combo->insertStringList(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;
|
|
|
|
QWhatsThis::add(combo, txtButton3 );
|
|
|
|
|
|
|
|
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);
|
|
|
|
label->setAlignment(AlignCenter);
|
|
|
|
QWhatsThis::add( label, i18n("In this column you can customize mouse clicks into the titlebar"
|
|
|
|
" 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);
|
|
|
|
combo->insertStringList(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;
|
|
|
|
QWhatsThis::add(combo, txtButton1);
|
|
|
|
|
|
|
|
combo = new QComboBox(grid);
|
|
|
|
combo->insertStringList(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;
|
|
|
|
QWhatsThis::add(combo, i18n("Behavior on <em>middle</em> click into the titlebar or frame of an <em>inactive</em> window."));
|
|
|
|
|
|
|
|
combo = new QComboBox(grid);
|
|
|
|
combo->insertStringList(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;
|
|
|
|
QWhatsThis::add(combo, txtButton3);
|
|
|
|
|
|
|
|
/** Inactive inner window ******************/
|
|
|
|
|
2002-04-01 23:28:24 +00:00
|
|
|
box = new QVGroupBox(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);
|
|
|
|
QWhatsThis::add( box, i18n("Here you can customize mouse click behavior when clicking on an inactive"
|
|
|
|
" inner window ('inner' means: not titlebar, not frame).") );
|
|
|
|
|
|
|
|
grid = new QGrid(3, Qt::Vertical, box);
|
|
|
|
|
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);
|
|
|
|
QWhatsThis::add( label, strWin1 );
|
|
|
|
|
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).");
|
|
|
|
QWhatsThis::add( label, strWin2 );
|
|
|
|
|
|
|
|
label = new QLabel(strMouseButton3, grid);
|
|
|
|
QWhatsThis::add( label, strWin3 );
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
combo = new QComboBox(grid);
|
|
|
|
combo->insertStringList(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;
|
|
|
|
QWhatsThis::add( combo, strWin1 );
|
|
|
|
|
|
|
|
combo = new QComboBox(grid);
|
|
|
|
combo->insertStringList(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;
|
|
|
|
QWhatsThis::add( combo, strWin2 );
|
|
|
|
|
|
|
|
combo = new QComboBox(grid);
|
|
|
|
combo->insertStringList(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;
|
|
|
|
QWhatsThis::add( combo, strWin3 );
|
|
|
|
|
|
|
|
|
|
|
|
/** Inner window, titlebar and frame **************/
|
|
|
|
|
2002-07-31 18:00:57 +00:00
|
|
|
box = new QVGroupBox(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);
|
|
|
|
QWhatsThis::add( box, i18n("Here you can customize KDE's behavior when clicking somewhere into"
|
|
|
|
" a window while pressing a modifier key."));
|
|
|
|
|
|
|
|
grid = new QGrid(4, Qt::Vertical, box);
|
|
|
|
|
|
|
|
// 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.");
|
|
|
|
QWhatsThis::add( label, strAllKey );
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
QWhatsThis::add( label, strAll1);
|
|
|
|
|
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.");
|
|
|
|
QWhatsThis::add( label, strAll2 );
|
|
|
|
|
2002-01-16 12:26:03 +00:00
|
|
|
label = new QLabel(strMouseButton3, grid);
|
|
|
|
QWhatsThis::add( label, strAll3);
|
|
|
|
|
|
|
|
// Combo's
|
|
|
|
combo = new QComboBox(grid);
|
|
|
|
combo->insertItem(i18n("Meta"));
|
|
|
|
combo->insertItem(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;
|
|
|
|
QWhatsThis::add( combo, strAllKey );
|
|
|
|
|
|
|
|
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);
|
|
|
|
combo->insertStringList(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;
|
|
|
|
QWhatsThis::add( combo, strAll1 );
|
|
|
|
|
|
|
|
combo = new QComboBox(grid);
|
|
|
|
combo->insertStringList(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;
|
|
|
|
QWhatsThis::add( combo, strAll2 );
|
|
|
|
|
|
|
|
combo = new QComboBox(grid);
|
|
|
|
combo->insertStringList(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;
|
|
|
|
QWhatsThis::add( combo, strAll3 );
|
|
|
|
|
|
|
|
layout->addStretch();
|
|
|
|
|
|
|
|
load();
|
|
|
|
}
|
|
|
|
|
2002-07-07 00:38:19 +00:00
|
|
|
KActionsConfig::~KActionsConfig()
|
|
|
|
{
|
2002-09-16 20:54:23 +00:00
|
|
|
if (standAlone)
|
|
|
|
delete config;
|
2002-07-07 00:38:19 +00:00
|
|
|
}
|
|
|
|
|
2002-09-24 16:03:45 +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* tbl_TiDbl[] = {
|
|
|
|
"Maximize",
|
|
|
|
"Maximize (vertical only)",
|
|
|
|
"Maximize (horizontal only)",
|
2003-09-16 19:34:03 +00:00
|
|
|
"Minimize",
|
2002-09-24 16:03:45 +00:00
|
|
|
"Shade",
|
|
|
|
"Lower",
|
2003-09-16 19:34:03 +00:00
|
|
|
"OnAllDesktops",
|
|
|
|
"Nothing",
|
2002-09-24 16:03:45 +00:00
|
|
|
"" };
|
|
|
|
|
|
|
|
const char* tbl_TiAc[] = {
|
|
|
|
"Raise",
|
|
|
|
"Lower",
|
|
|
|
"Operations menu",
|
|
|
|
"Toggle raise and lower",
|
|
|
|
"Nothing",
|
|
|
|
"Shade",
|
|
|
|
"" };
|
|
|
|
|
|
|
|
const char* tbl_TiInAc[] = {
|
|
|
|
"Activate and raise",
|
|
|
|
"Activate and lower",
|
|
|
|
"Activate",
|
|
|
|
"Shade",
|
2003-09-16 19:34:03 +00:00
|
|
|
"Operations menu",
|
|
|
|
"Raise",
|
|
|
|
"Lower",
|
|
|
|
"Nothing",
|
2002-09-24 16:03:45 +00:00
|
|
|
"" };
|
|
|
|
|
|
|
|
const char* tbl_Win[] = {
|
|
|
|
"Activate, raise and pass click",
|
|
|
|
"Activate and pass click",
|
|
|
|
"Activate",
|
|
|
|
"Activate and raise",
|
|
|
|
"" };
|
|
|
|
|
|
|
|
const char* tbl_AllKey[] = {
|
|
|
|
"Meta",
|
|
|
|
"Alt",
|
|
|
|
"" };
|
|
|
|
|
|
|
|
const char* tbl_All[] = {
|
|
|
|
"Move",
|
2003-09-16 19:34:03 +00:00
|
|
|
"Activate, raise and move",
|
2002-09-24 16:03:45 +00:00
|
|
|
"Toggle raise and lower",
|
|
|
|
"Resize",
|
|
|
|
"Raise",
|
|
|
|
"Lower",
|
2003-09-16 19:34:03 +00:00
|
|
|
"Minimize",
|
2002-09-24 16:03:45 +00:00
|
|
|
"Nothing",
|
|
|
|
"" };
|
|
|
|
|
|
|
|
static const char* tbl_num_lookup( const char* arr[], int pos )
|
2002-08-22 18:07:34 +00:00
|
|
|
{
|
2002-09-24 16:03:45 +00:00
|
|
|
for( int i = 0;
|
|
|
|
arr[ i ][ 0 ] != '\0' && pos >= 0;
|
|
|
|
++i )
|
|
|
|
{
|
|
|
|
if( pos == 0 )
|
|
|
|
return arr[ i ];
|
|
|
|
--pos;
|
|
|
|
}
|
|
|
|
abort(); // should never happen this way
|
2002-08-22 18:07:34 +00:00
|
|
|
}
|
|
|
|
|
2002-09-24 16:03:45 +00:00
|
|
|
static int tbl_txt_lookup( const char* 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;
|
2002-01-16 12:26:03 +00:00
|
|
|
}
|
2002-09-24 16:03:45 +00:00
|
|
|
return 0;
|
2002-01-16 12:26:03 +00:00
|
|
|
}
|
|
|
|
|
2002-09-24 16:03:45 +00:00
|
|
|
void KActionsConfig::setComboText( QComboBox* combo, const char*txt )
|
2002-01-16 12:26:03 +00:00
|
|
|
{
|
2002-09-24 16:03:45 +00:00
|
|
|
if( combo == coTiDbl )
|
|
|
|
combo->setCurrentItem( tbl_txt_lookup( tbl_TiDbl, txt ));
|
|
|
|
else if( combo == coTiAct1 || combo == coTiAct2 || combo == coTiAct3 )
|
|
|
|
combo->setCurrentItem( tbl_txt_lookup( tbl_TiAc, txt ));
|
|
|
|
else if( combo == coTiInAct1 || combo == coTiInAct2 || combo == coTiInAct3 )
|
|
|
|
combo->setCurrentItem( tbl_txt_lookup( tbl_TiInAc, txt ));
|
|
|
|
else if( combo == coWin1 || combo == coWin2 || combo == coWin3 )
|
|
|
|
combo->setCurrentItem( tbl_txt_lookup( tbl_Win, txt ));
|
|
|
|
else if( combo == coAllKey )
|
|
|
|
combo->setCurrentItem( tbl_txt_lookup( tbl_AllKey, txt ));
|
|
|
|
else if( combo == coAll1 || combo == coAll2 || combo == coAll3 )
|
|
|
|
combo->setCurrentItem( tbl_txt_lookup( tbl_All, txt ));
|
|
|
|
else
|
|
|
|
abort();
|
2002-01-16 12:26:03 +00:00
|
|
|
}
|
|
|
|
|
2002-09-24 16:03:45 +00:00
|
|
|
const char* KActionsConfig::functionTiDbl( int i )
|
2002-01-16 12:26:03 +00:00
|
|
|
{
|
2002-09-24 16:03:45 +00:00
|
|
|
return tbl_num_lookup( tbl_TiDbl, i );
|
2002-01-16 12:26:03 +00:00
|
|
|
}
|
2002-09-24 16:03:45 +00:00
|
|
|
|
|
|
|
const char* KActionsConfig::functionTiAc( int i )
|
2002-01-16 12:26:03 +00:00
|
|
|
{
|
2002-09-24 16:03:45 +00:00
|
|
|
return tbl_num_lookup( tbl_TiAc, i );
|
2002-01-16 12:26:03 +00:00
|
|
|
}
|
2002-09-24 16:03:45 +00:00
|
|
|
|
|
|
|
const char* KActionsConfig::functionTiInAc( int i )
|
2002-01-16 12:26:03 +00:00
|
|
|
{
|
2002-09-24 16:03:45 +00:00
|
|
|
return tbl_num_lookup( tbl_TiInAc, i );
|
2002-01-16 12:26:03 +00:00
|
|
|
}
|
2002-09-24 16:03:45 +00:00
|
|
|
|
|
|
|
const char* KActionsConfig::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
|
|
|
|
|
|
|
const char* KActionsConfig::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
|
|
|
}
|
|
|
|
|
2002-09-24 16:03:45 +00:00
|
|
|
const char* KActionsConfig::functionAll( int i )
|
|
|
|
{
|
|
|
|
return tbl_num_lookup( tbl_All, i );
|
|
|
|
}
|
2002-01-16 12:26:03 +00:00
|
|
|
|
|
|
|
void KActionsConfig::load()
|
|
|
|
{
|
|
|
|
config->setGroup("Windows");
|
|
|
|
setComboText(coTiDbl, config->readEntry("TitlebarDoubleClickCommand","Shade").ascii());
|
|
|
|
|
|
|
|
config->setGroup( "MouseBindings");
|
|
|
|
setComboText(coTiAct1,config->readEntry("CommandActiveTitlebar1","Raise").ascii());
|
|
|
|
setComboText(coTiAct2,config->readEntry("CommandActiveTitlebar2","Lower").ascii());
|
|
|
|
setComboText(coTiAct3,config->readEntry("CommandActiveTitlebar3","Operations menu").ascii());
|
|
|
|
setComboText(coTiInAct1,config->readEntry("CommandInactiveTitlebar1","Activate and raise").ascii());
|
|
|
|
setComboText(coTiInAct2,config->readEntry("CommandInactiveTitlebar2","Activate and lower").ascii());
|
2003-09-16 19:34:03 +00:00
|
|
|
setComboText(coTiInAct3,config->readEntry("CommandInactiveTitlebar3","Operations menu").ascii());
|
2002-01-16 12:26:03 +00:00
|
|
|
setComboText(coWin1,config->readEntry("CommandWindow1","Activate, raise and pass click").ascii());
|
|
|
|
setComboText(coWin2,config->readEntry("CommandWindow2","Activate and pass click").ascii());
|
|
|
|
setComboText(coWin3,config->readEntry("CommandWindow3","Activate and pass click").ascii());
|
2002-03-02 13:50:26 +00:00
|
|
|
setComboText(coAllKey,config->readEntry("CommandAllKey","Alt").ascii());
|
2002-01-16 12:26:03 +00:00
|
|
|
setComboText(coAll1,config->readEntry("CommandAll1","Move").ascii());
|
|
|
|
setComboText(coAll2,config->readEntry("CommandAll2","Toggle raise and lower").ascii());
|
|
|
|
setComboText(coAll3,config->readEntry("CommandAll3","Resize").ascii());
|
|
|
|
}
|
|
|
|
|
|
|
|
void KActionsConfig::save()
|
|
|
|
{
|
|
|
|
config->setGroup("Windows");
|
|
|
|
config->writeEntry("TitlebarDoubleClickCommand", functionTiDbl( coTiDbl->currentItem() ) );
|
|
|
|
|
|
|
|
config->setGroup("MouseBindings");
|
|
|
|
config->writeEntry("CommandActiveTitlebar1", functionTiAc(coTiAct1->currentItem()));
|
|
|
|
config->writeEntry("CommandActiveTitlebar2", functionTiAc(coTiAct2->currentItem()));
|
|
|
|
config->writeEntry("CommandActiveTitlebar3", functionTiAc(coTiAct3->currentItem()));
|
|
|
|
config->writeEntry("CommandInactiveTitlebar1", functionTiInAc(coTiInAct1->currentItem()));
|
|
|
|
config->writeEntry("CommandInactiveTitlebar2", functionTiInAc(coTiInAct2->currentItem()));
|
|
|
|
config->writeEntry("CommandInactiveTitlebar3", functionTiInAc(coTiInAct3->currentItem()));
|
|
|
|
config->writeEntry("CommandWindow1", functionWin(coWin1->currentItem()));
|
|
|
|
config->writeEntry("CommandWindow2", functionWin(coWin2->currentItem()));
|
|
|
|
config->writeEntry("CommandWindow3", functionWin(coWin3->currentItem()));
|
|
|
|
config->writeEntry("CommandAllKey", functionAllKey(coAllKey->currentItem()));
|
|
|
|
config->writeEntry("CommandAll1", functionAll(coAll1->currentItem()));
|
|
|
|
config->writeEntry("CommandAll2", functionAll(coAll2->currentItem()));
|
|
|
|
config->writeEntry("CommandAll3", functionAll(coAll3->currentItem()));
|
2002-09-16 20:54:23 +00:00
|
|
|
|
|
|
|
if (standAlone)
|
|
|
|
{
|
|
|
|
config->sync();
|
|
|
|
if ( !kapp->dcopClient()->isAttached() )
|
2002-07-07 00:38:19 +00:00
|
|
|
kapp->dcopClient()->attach();
|
2002-09-16 20:54:23 +00:00
|
|
|
kapp->dcopClient()->send("kwin*", "", "reconfigure()", "");
|
|
|
|
}
|
2002-01-16 12:26:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void KActionsConfig::defaults()
|
|
|
|
{
|
2002-09-16 20:54:23 +00:00
|
|
|
setComboText(coTiDbl, "Shade");
|
2002-01-16 12:26:03 +00:00
|
|
|
setComboText(coTiAct1,"Raise");
|
|
|
|
setComboText(coTiAct2,"Lower");
|
|
|
|
setComboText(coTiAct3,"Operations menu");
|
|
|
|
setComboText(coTiInAct1,"Activate and raise");
|
|
|
|
setComboText(coTiInAct2,"Activate and lower");
|
2003-09-16 19:34:03 +00:00
|
|
|
setComboText(coTiInAct3,"Operations menu");
|
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");
|
|
|
|
}
|