2002-01-16 12:26:03 +00:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Copyright (c) 2001 Waldo Bastian <bastian@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 <QLayout>
|
2005-07-28 14:59:42 +00:00
|
|
|
//Added by qt3to4:
|
|
|
|
#include <QVBoxLayout>
|
2002-01-16 12:26:03 +00:00
|
|
|
|
2006-07-02 18:31:00 +00:00
|
|
|
#include <QtDBus/QtDBus>
|
2002-01-16 12:26:03 +00:00
|
|
|
|
|
|
|
#include <kapplication.h>
|
|
|
|
#include <kglobal.h>
|
|
|
|
#include <klocale.h>
|
|
|
|
#include <kconfig.h>
|
|
|
|
#include <kgenericfactory.h>
|
2002-01-19 18:19:38 +00:00
|
|
|
#include <kaboutdata.h>
|
2003-04-06 21:32:24 +00:00
|
|
|
#include <kdialog.h>
|
2002-01-16 12:26:03 +00:00
|
|
|
|
|
|
|
#include "mouse.h"
|
|
|
|
#include "windows.h"
|
|
|
|
|
2002-09-16 19:03:20 +00:00
|
|
|
#include "main.h"
|
|
|
|
|
2005-10-22 19:12:01 +00:00
|
|
|
static KInstance *_kcmkwm = 0;
|
|
|
|
|
|
|
|
inline KInstance *inst() {
|
|
|
|
if (_kcmkwm)
|
|
|
|
return _kcmkwm;
|
|
|
|
_kcmkwm = new KInstance("kcmkwm");
|
|
|
|
return _kcmkwm;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-09-16 20:54:23 +00:00
|
|
|
extern "C"
|
|
|
|
{
|
2004-11-21 18:06:55 +00:00
|
|
|
KDE_EXPORT KCModule *create_kwinfocus(QWidget *parent, const char *name)
|
2002-09-16 20:54:23 +00:00
|
|
|
{
|
|
|
|
KConfig *c = new KConfig("kwinrc", false, true);
|
2005-10-22 19:12:01 +00:00
|
|
|
return new KFocusConfig(true, c, inst(), parent);
|
2002-09-16 20:54:23 +00:00
|
|
|
}
|
|
|
|
|
2004-11-21 18:06:55 +00:00
|
|
|
KDE_EXPORT KCModule *create_kwinactions(QWidget *parent, const char *name)
|
2002-09-16 20:54:23 +00:00
|
|
|
{
|
2005-10-22 19:12:01 +00:00
|
|
|
return new KActionsOptions( inst(), parent);
|
2002-09-16 20:54:23 +00:00
|
|
|
}
|
|
|
|
|
2004-11-21 18:06:55 +00:00
|
|
|
KDE_EXPORT KCModule *create_kwinmoving(QWidget *parent, const char *name)
|
2002-09-16 20:54:23 +00:00
|
|
|
{
|
|
|
|
KConfig *c = new KConfig("kwinrc", false, true);
|
2005-10-22 19:12:01 +00:00
|
|
|
return new KMovingConfig(true, c, inst(), parent);
|
2002-09-16 20:54:23 +00:00
|
|
|
}
|
|
|
|
|
2004-11-21 18:06:55 +00:00
|
|
|
KDE_EXPORT KCModule *create_kwinadvanced(QWidget *parent, const char *name)
|
2002-09-16 20:54:23 +00:00
|
|
|
{
|
|
|
|
KConfig *c = new KConfig("kwinrc", false, true);
|
2005-10-22 19:12:01 +00:00
|
|
|
return new KAdvancedConfig(true, c, inst(), parent);
|
2002-09-16 20:54:23 +00:00
|
|
|
}
|
2005-01-15 17:07:48 +00:00
|
|
|
|
2005-01-24 11:50:49 +00:00
|
|
|
KDE_EXPORT KCModule *create_kwintranslucency(QWidget *parent, const char *name)
|
2005-01-15 17:07:48 +00:00
|
|
|
{
|
|
|
|
KConfig *c = new KConfig("kwinrc", false, true);
|
2005-10-22 19:12:01 +00:00
|
|
|
return new KTranslucencyConfig(true, c, inst(), parent);
|
2005-01-15 17:07:48 +00:00
|
|
|
}
|
2002-09-16 20:54:23 +00:00
|
|
|
|
2004-11-21 18:06:55 +00:00
|
|
|
KDE_EXPORT KCModule *create_kwinoptions ( QWidget *parent, const char* name)
|
2002-09-16 20:54:23 +00:00
|
|
|
{
|
2005-10-22 19:12:01 +00:00
|
|
|
return new KWinOptions( inst(), parent);
|
2002-09-16 20:54:23 +00:00
|
|
|
}
|
2002-09-16 19:03:20 +00:00
|
|
|
}
|
2002-09-16 20:54:23 +00:00
|
|
|
|
2005-10-22 19:12:01 +00:00
|
|
|
KWinOptions::KWinOptions(KInstance *inst, QWidget *parent)
|
|
|
|
: KCModule(inst, parent)
|
2002-01-16 12:26:03 +00:00
|
|
|
{
|
2002-09-16 19:03:20 +00:00
|
|
|
mConfig = new KConfig("kwinrc", false, true);
|
|
|
|
|
|
|
|
QVBoxLayout *layout = new QVBoxLayout(this);
|
|
|
|
tab = new QTabWidget(this);
|
|
|
|
layout->addWidget(tab);
|
2002-01-16 12:26:03 +00:00
|
|
|
|
2005-10-22 19:12:01 +00:00
|
|
|
mFocus = new KFocusConfig(false, mConfig, inst, this);
|
|
|
|
mFocus->setObjectName("KWin Focus Config");
|
2003-04-06 21:32:24 +00:00
|
|
|
mFocus->layout()->setMargin( KDialog::marginHint() );
|
2002-09-16 19:03:20 +00:00
|
|
|
tab->addTab(mFocus, i18n("&Focus"));
|
|
|
|
connect(mFocus, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
|
|
|
|
|
2005-10-22 19:12:01 +00:00
|
|
|
mTitleBarActions = new KTitleBarActionsConfig(false, mConfig, inst, this);
|
|
|
|
mTitleBarActions->setObjectName("KWin TitleBar Actions");
|
2005-05-06 08:47:48 +00:00
|
|
|
mTitleBarActions->layout()->setMargin( KDialog::marginHint() );
|
|
|
|
tab->addTab(mTitleBarActions, i18n("&Titlebar Actions"));
|
|
|
|
connect(mTitleBarActions, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
|
|
|
|
|
2005-10-22 19:12:01 +00:00
|
|
|
mWindowActions = new KWindowActionsConfig(false, mConfig, inst, this);
|
|
|
|
mWindowActions->setObjectName("KWin Window Actions");
|
2005-05-06 08:47:48 +00:00
|
|
|
mWindowActions->layout()->setMargin( KDialog::marginHint() );
|
|
|
|
tab->addTab(mWindowActions, i18n("Window Actio&ns"));
|
|
|
|
connect(mWindowActions, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
|
2002-09-16 19:03:20 +00:00
|
|
|
|
2005-10-22 19:12:01 +00:00
|
|
|
mMoving = new KMovingConfig(false, mConfig, inst, this);
|
|
|
|
mMoving->setObjectName("KWin Moving");
|
2003-04-06 21:32:24 +00:00
|
|
|
mMoving->layout()->setMargin( KDialog::marginHint() );
|
2002-09-16 19:03:20 +00:00
|
|
|
tab->addTab(mMoving, i18n("&Moving"));
|
|
|
|
connect(mMoving, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
|
|
|
|
|
2005-10-22 19:12:01 +00:00
|
|
|
mAdvanced = new KAdvancedConfig(false, mConfig, inst, this);
|
|
|
|
mAdvanced->setObjectName("KWin Advanced");
|
2003-04-06 21:32:24 +00:00
|
|
|
mAdvanced->layout()->setMargin( KDialog::marginHint() );
|
2002-09-16 19:03:20 +00:00
|
|
|
tab->addTab(mAdvanced, i18n("Ad&vanced"));
|
|
|
|
connect(mAdvanced, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
|
2005-01-15 17:07:48 +00:00
|
|
|
|
2005-10-22 19:12:01 +00:00
|
|
|
mTranslucency = new KTranslucencyConfig(false, mConfig, inst, this);
|
|
|
|
mTranslucency->setObjectName("KWin Translucency");
|
2005-01-15 17:07:48 +00:00
|
|
|
mTranslucency->layout()->setMargin( KDialog::marginHint() );
|
|
|
|
tab->addTab(mTranslucency, i18n("&Translucency"));
|
|
|
|
connect(mTranslucency, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
|
|
|
|
|
2004-07-18 23:40:42 +00:00
|
|
|
KAboutData *about =
|
|
|
|
new KAboutData(I18N_NOOP("kcmkwinoptions"), I18N_NOOP("Window Behavior Configuration Module"),
|
|
|
|
0, 0, KAboutData::License_GPL,
|
|
|
|
I18N_NOOP("(c) 1997 - 2002 KWin and KControl Authors"));
|
|
|
|
|
|
|
|
about->addAuthor("Matthias Ettrich",0,"ettrich@kde.org");
|
|
|
|
about->addAuthor("Waldo Bastian",0,"bastian@kde.org");
|
|
|
|
about->addAuthor("Cristian Tibirna",0,"tibirna@kde.org");
|
|
|
|
about->addAuthor("Matthias Kalle Dalheimer",0,"kalle@kde.org");
|
|
|
|
about->addAuthor("Daniel Molkentin",0,"molkentin@kde.org");
|
|
|
|
about->addAuthor("Wynn Wilkes",0,"wynnw@caldera.com");
|
|
|
|
about->addAuthor("Pat Dowler",0,"dowler@pt1B1106.FSH.UVic.CA");
|
|
|
|
about->addAuthor("Bernd Wuebben",0,"wuebben@kde.org");
|
|
|
|
about->addAuthor("Matthias Hoelzer-Kluepfel",0,"hoelzer@kde.org");
|
|
|
|
setAboutData(about);
|
2002-01-16 12:26:03 +00:00
|
|
|
}
|
|
|
|
|
2002-09-16 19:03:20 +00:00
|
|
|
KWinOptions::~KWinOptions()
|
|
|
|
{
|
|
|
|
delete mConfig;
|
|
|
|
}
|
2002-01-16 12:26:03 +00:00
|
|
|
|
2002-09-16 19:03:20 +00:00
|
|
|
void KWinOptions::load()
|
|
|
|
{
|
2002-01-16 12:26:03 +00:00
|
|
|
mConfig->reparseConfiguration();
|
2002-09-16 19:03:20 +00:00
|
|
|
mFocus->load();
|
2005-05-06 08:47:48 +00:00
|
|
|
mTitleBarActions->load();
|
|
|
|
mWindowActions->load();
|
2002-09-16 19:03:20 +00:00
|
|
|
mMoving->load();
|
|
|
|
mAdvanced->load();
|
2005-01-15 17:07:48 +00:00
|
|
|
mTranslucency->load();
|
2003-11-08 23:43:53 +00:00
|
|
|
emit KCModule::changed( false );
|
2002-09-16 19:03:20 +00:00
|
|
|
}
|
2002-01-16 12:26:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
void KWinOptions::save()
|
|
|
|
{
|
|
|
|
mFocus->save();
|
2005-05-06 08:47:48 +00:00
|
|
|
mTitleBarActions->save();
|
|
|
|
mWindowActions->save();
|
2002-01-16 12:26:03 +00:00
|
|
|
mMoving->save();
|
|
|
|
mAdvanced->save();
|
2005-01-15 17:07:48 +00:00
|
|
|
mTranslucency->save();
|
2002-01-16 12:26:03 +00:00
|
|
|
|
2003-11-08 23:43:53 +00:00
|
|
|
emit KCModule::changed( false );
|
2002-01-16 12:26:03 +00:00
|
|
|
// Send signal to kwin
|
|
|
|
mConfig->sync();
|
2006-06-08 13:43:23 +00:00
|
|
|
#ifdef __GNUC__
|
|
|
|
#warning D-BUS TODO
|
|
|
|
// All these calls in kcmkwin modules should be actually kwin*, because of multihead.
|
|
|
|
#endif
|
2006-07-02 18:31:00 +00:00
|
|
|
QDBusInterface kwin( "org.kde.kwin", "/KWin", "org.kde.KWin" );
|
|
|
|
kwin.call( "reconfigure" );
|
2002-01-16 12:26:03 +00:00
|
|
|
}
|
|
|
|
|
2002-09-16 19:03:20 +00:00
|
|
|
|
|
|
|
void KWinOptions::defaults()
|
|
|
|
{
|
|
|
|
mFocus->defaults();
|
2005-05-06 08:47:48 +00:00
|
|
|
mTitleBarActions->defaults();
|
|
|
|
mWindowActions->defaults();
|
2002-09-16 19:03:20 +00:00
|
|
|
mMoving->defaults();
|
|
|
|
mAdvanced->defaults();
|
2005-01-15 17:07:48 +00:00
|
|
|
mTranslucency->defaults();
|
2002-09-16 19:03:20 +00:00
|
|
|
}
|
|
|
|
|
2002-01-16 12:26:03 +00:00
|
|
|
QString KWinOptions::quickHelp() const
|
|
|
|
{
|
|
|
|
return i18n("<h1>Window Behavior</h1> Here you can customize the way windows behave when being"
|
|
|
|
" moved, resized or clicked on. You can also specify a focus policy as well as a placement"
|
2002-01-23 02:32:52 +00:00
|
|
|
" policy for new windows."
|
2004-05-19 13:27:23 +00:00
|
|
|
" <p>Please note that this configuration will not take effect if you do not use"
|
2002-01-16 12:26:03 +00:00
|
|
|
" KWin as your window manager. If you do use a different window manager, please refer to its documentation"
|
|
|
|
" for how to customize window behavior.");
|
|
|
|
}
|
|
|
|
|
2002-09-16 19:03:20 +00:00
|
|
|
void KWinOptions::moduleChanged(bool state)
|
|
|
|
{
|
2003-11-08 23:43:53 +00:00
|
|
|
emit KCModule::changed(state);
|
2002-09-16 19:03:20 +00:00
|
|
|
}
|
2002-01-16 12:26:03 +00:00
|
|
|
|
|
|
|
|
2005-10-22 19:12:01 +00:00
|
|
|
KActionsOptions::KActionsOptions(KInstance *inst, QWidget *parent)
|
|
|
|
: KCModule(inst, parent)
|
2005-05-06 08:47:48 +00:00
|
|
|
{
|
|
|
|
mConfig = new KConfig("kwinrc", false, true);
|
|
|
|
|
|
|
|
QVBoxLayout *layout = new QVBoxLayout(this);
|
|
|
|
tab = new QTabWidget(this);
|
|
|
|
layout->addWidget(tab);
|
|
|
|
|
2005-10-22 19:12:01 +00:00
|
|
|
mTitleBarActions = new KTitleBarActionsConfig(false, mConfig, inst, this);
|
|
|
|
mTitleBarActions->setObjectName("KWin TitleBar Actions");
|
2005-05-06 08:47:48 +00:00
|
|
|
mTitleBarActions->layout()->setMargin( KDialog::marginHint() );
|
|
|
|
tab->addTab(mTitleBarActions, i18n("&Titlebar Actions"));
|
|
|
|
connect(mTitleBarActions, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
|
|
|
|
|
2005-10-22 19:12:01 +00:00
|
|
|
mWindowActions = new KWindowActionsConfig(false, mConfig, inst, this);
|
|
|
|
mWindowActions->setObjectName("KWin Window Actions");
|
2005-05-06 08:47:48 +00:00
|
|
|
mWindowActions->layout()->setMargin( KDialog::marginHint() );
|
|
|
|
tab->addTab(mWindowActions, i18n("Window Actio&ns"));
|
|
|
|
connect(mWindowActions, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
|
|
|
|
}
|
|
|
|
|
|
|
|
KActionsOptions::~KActionsOptions()
|
|
|
|
{
|
|
|
|
delete mConfig;
|
|
|
|
}
|
|
|
|
|
|
|
|
void KActionsOptions::load()
|
|
|
|
{
|
|
|
|
mTitleBarActions->load();
|
|
|
|
mWindowActions->load();
|
|
|
|
emit KCModule::changed( false );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void KActionsOptions::save()
|
|
|
|
{
|
|
|
|
mTitleBarActions->save();
|
|
|
|
mWindowActions->save();
|
|
|
|
|
|
|
|
emit KCModule::changed( false );
|
|
|
|
// Send signal to kwin
|
|
|
|
mConfig->sync();
|
2006-07-02 18:31:00 +00:00
|
|
|
QDBusInterface kwin( "org.kde.kwin", "/KWin", "org.kde.KWin" );
|
|
|
|
kwin.call( "reconfigure" );
|
2005-05-06 08:47:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void KActionsOptions::defaults()
|
|
|
|
{
|
|
|
|
mTitleBarActions->defaults();
|
|
|
|
mWindowActions->defaults();
|
|
|
|
}
|
|
|
|
|
|
|
|
void KActionsOptions::moduleChanged(bool state)
|
|
|
|
{
|
|
|
|
emit KCModule::changed(state);
|
|
|
|
}
|
|
|
|
|
2002-09-16 19:03:20 +00:00
|
|
|
#include "main.moc"
|