2007-04-29 17:35:43 +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
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
2008-05-30 17:47:24 +00:00
|
|
|
#include "main.h"
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
#include <QLayout>
|
|
|
|
//Added by qt3to4:
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
|
2018-06-05 10:52:57 +00:00
|
|
|
#include <QtDBus>
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2014-03-17 15:24:10 +00:00
|
|
|
#include <KLocalizedString>
|
2007-04-29 17:35:43 +00:00
|
|
|
#include <kconfig.h>
|
|
|
|
#include <kaboutdata.h>
|
2007-08-28 14:58:52 +00:00
|
|
|
#include <KPluginFactory>
|
|
|
|
#include <KPluginLoader>
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
#include "mouse.h"
|
|
|
|
#include "windows.h"
|
|
|
|
|
2007-08-28 14:58:52 +00:00
|
|
|
K_PLUGIN_FACTORY_DECLARATION(KWinOptionsFactory)
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
class KFocusConfigStandalone : public KFocusConfig
|
|
|
|
{
|
2007-08-28 14:58:52 +00:00
|
|
|
Q_OBJECT
|
2011-01-30 14:34:42 +00:00
|
|
|
public:
|
|
|
|
KFocusConfigStandalone(QWidget* parent, const QVariantList &)
|
2013-09-30 05:29:38 +00:00
|
|
|
: KFocusConfig(true, new KConfig("kwinrc"), parent)
|
2011-01-30 14:34:42 +00:00
|
|
|
{}
|
2007-04-29 17:35:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class KMovingConfigStandalone : public KMovingConfig
|
|
|
|
{
|
2007-08-28 14:58:52 +00:00
|
|
|
Q_OBJECT
|
2011-01-30 14:34:42 +00:00
|
|
|
public:
|
|
|
|
KMovingConfigStandalone(QWidget* parent, const QVariantList &)
|
2013-09-30 05:29:38 +00:00
|
|
|
: KMovingConfig(true, new KConfig("kwinrc"), parent)
|
2011-01-30 14:34:42 +00:00
|
|
|
{}
|
2007-04-29 17:35:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class KAdvancedConfigStandalone : public KAdvancedConfig
|
|
|
|
{
|
2007-08-28 14:58:52 +00:00
|
|
|
Q_OBJECT
|
2011-01-30 14:34:42 +00:00
|
|
|
public:
|
|
|
|
KAdvancedConfigStandalone(QWidget* parent, const QVariantList &)
|
2013-09-30 05:29:38 +00:00
|
|
|
: KAdvancedConfig(true, new KConfig("kwinrc"), parent)
|
2011-01-30 14:34:42 +00:00
|
|
|
{}
|
2007-04-29 17:35:43 +00:00
|
|
|
};
|
|
|
|
|
2007-08-28 14:58:52 +00:00
|
|
|
KWinOptions::KWinOptions(QWidget *parent, const QVariantList &)
|
2013-09-30 05:29:38 +00:00
|
|
|
: KCModule(parent)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2012-09-20 17:52:17 +00:00
|
|
|
mConfig = new KConfig("kwinrc");
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
QVBoxLayout *layout = new QVBoxLayout(this);
|
2019-03-01 07:15:28 +00:00
|
|
|
layout->setContentsMargins(0, 0, 0, 0);
|
2013-12-14 17:37:24 +00:00
|
|
|
tab = new QTabWidget(this);
|
2011-01-30 14:34:42 +00:00
|
|
|
layout->addWidget(tab);
|
|
|
|
|
2013-09-30 05:29:38 +00:00
|
|
|
mFocus = new KFocusConfig(false, mConfig, this);
|
2011-01-30 14:34:42 +00:00
|
|
|
mFocus->setObjectName(QLatin1String("KWin Focus Config"));
|
|
|
|
tab->addTab(mFocus, i18n("&Focus"));
|
|
|
|
connect(mFocus, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
|
|
|
|
|
2013-09-30 05:29:38 +00:00
|
|
|
mTitleBarActions = new KTitleBarActionsConfig(false, mConfig, this);
|
2011-01-30 14:34:42 +00:00
|
|
|
mTitleBarActions->setObjectName(QLatin1String("KWin TitleBar Actions"));
|
|
|
|
tab->addTab(mTitleBarActions, i18n("&Titlebar Actions"));
|
|
|
|
connect(mTitleBarActions, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
|
|
|
|
|
2013-09-30 05:29:38 +00:00
|
|
|
mWindowActions = new KWindowActionsConfig(false, mConfig, this);
|
2011-01-30 14:34:42 +00:00
|
|
|
mWindowActions->setObjectName(QLatin1String("KWin Window Actions"));
|
|
|
|
tab->addTab(mWindowActions, i18n("Window Actio&ns"));
|
|
|
|
connect(mWindowActions, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
|
|
|
|
|
2013-09-30 05:29:38 +00:00
|
|
|
mMoving = new KMovingConfig(false, mConfig, this);
|
2011-01-30 14:34:42 +00:00
|
|
|
mMoving->setObjectName(QLatin1String("KWin Moving"));
|
|
|
|
tab->addTab(mMoving, i18n("&Moving"));
|
|
|
|
connect(mMoving, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
|
|
|
|
|
2013-09-30 05:29:38 +00:00
|
|
|
mAdvanced = new KAdvancedConfig(false, mConfig, this);
|
2011-01-30 14:34:42 +00:00
|
|
|
mAdvanced->setObjectName(QLatin1String("KWin Advanced"));
|
|
|
|
tab->addTab(mAdvanced, i18n("Ad&vanced"));
|
|
|
|
connect(mAdvanced, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
|
|
|
|
|
|
|
|
KAboutData *about =
|
2014-04-28 15:11:20 +00:00
|
|
|
new KAboutData(QStringLiteral("kcmkwinoptions"), i18n("Window Behavior Configuration Module"),
|
2014-05-14 02:49:33 +00:00
|
|
|
QString(), QString(), KAboutLicense::GPL,
|
2013-09-30 05:27:48 +00:00
|
|
|
i18n("(c) 1997 - 2002 KWin and KControl Authors"));
|
|
|
|
|
|
|
|
about->addAuthor(i18n("Matthias Ettrich"), QString(), "ettrich@kde.org");
|
|
|
|
about->addAuthor(i18n("Waldo Bastian"), QString(), "bastian@kde.org");
|
|
|
|
about->addAuthor(i18n("Cristian Tibirna"), QString(), "tibirna@kde.org");
|
|
|
|
about->addAuthor(i18n("Matthias Kalle Dalheimer"), QString(), "kalle@kde.org");
|
|
|
|
about->addAuthor(i18n("Daniel Molkentin"), QString(), "molkentin@kde.org");
|
|
|
|
about->addAuthor(i18n("Wynn Wilkes"), QString(), "wynnw@caldera.com");
|
|
|
|
about->addAuthor(i18n("Pat Dowler"), QString(), "dowler@pt1B1106.FSH.UVic.CA");
|
|
|
|
about->addAuthor(i18n("Bernd Wuebben"), QString(), "wuebben@kde.org");
|
|
|
|
about->addAuthor(i18n("Matthias Hoelzer-Kluepfel"), QString(), "hoelzer@kde.org");
|
2011-01-30 14:34:42 +00:00
|
|
|
setAboutData(about);
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
KWinOptions::~KWinOptions()
|
|
|
|
{
|
2011-01-30 14:34:42 +00:00
|
|
|
delete mConfig;
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void KWinOptions::load()
|
|
|
|
{
|
2011-01-30 14:34:42 +00:00
|
|
|
mConfig->reparseConfiguration();
|
|
|
|
mFocus->load();
|
|
|
|
mTitleBarActions->load();
|
|
|
|
mWindowActions->load();
|
|
|
|
mMoving->load();
|
|
|
|
mAdvanced->load();
|
|
|
|
emit KCModule::changed(false);
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void KWinOptions::save()
|
|
|
|
{
|
2011-01-30 14:34:42 +00:00
|
|
|
mFocus->save();
|
|
|
|
mTitleBarActions->save();
|
|
|
|
mWindowActions->save();
|
|
|
|
mMoving->save();
|
|
|
|
mAdvanced->save();
|
|
|
|
|
|
|
|
emit KCModule::changed(false);
|
|
|
|
// Send signal to kwin
|
|
|
|
mConfig->sync();
|
|
|
|
// Send signal to all kwin instances
|
|
|
|
QDBusMessage message =
|
2008-01-30 16:08:23 +00:00
|
|
|
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
|
2011-01-30 14:34:42 +00:00
|
|
|
QDBusConnection::sessionBus().send(message);
|
2007-04-30 11:32:47 +00:00
|
|
|
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void KWinOptions::defaults()
|
|
|
|
{
|
2011-01-30 14:34:42 +00:00
|
|
|
mFocus->defaults();
|
|
|
|
mTitleBarActions->defaults();
|
|
|
|
mWindowActions->defaults();
|
|
|
|
mMoving->defaults();
|
|
|
|
mAdvanced->defaults();
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QString KWinOptions::quickHelp() const
|
|
|
|
{
|
2011-01-30 14:34:42 +00:00
|
|
|
return i18n("<p><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"
|
|
|
|
" policy for new windows.</p>"
|
|
|
|
" <p>Please note that this configuration will not take effect if you do not use"
|
|
|
|
" KWin as your window manager. If you do use a different window manager, please refer to its documentation"
|
|
|
|
" for how to customize window behavior.</p>");
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void KWinOptions::moduleChanged(bool state)
|
|
|
|
{
|
2011-01-30 14:34:42 +00:00
|
|
|
emit KCModule::changed(state);
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
2007-08-28 14:58:52 +00:00
|
|
|
KActionsOptions::KActionsOptions(QWidget *parent, const QVariantList &)
|
2013-09-30 05:29:38 +00:00
|
|
|
: KCModule(parent)
|
2007-04-29 17:35:43 +00:00
|
|
|
{
|
2012-09-20 17:52:17 +00:00
|
|
|
mConfig = new KConfig("kwinrc");
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
QVBoxLayout *layout = new QVBoxLayout(this);
|
2019-03-01 07:15:28 +00:00
|
|
|
layout->setContentsMargins(0, 0, 0, 0);
|
2013-12-14 17:37:24 +00:00
|
|
|
tab = new QTabWidget(this);
|
2011-01-30 14:34:42 +00:00
|
|
|
layout->addWidget(tab);
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2013-09-30 05:29:38 +00:00
|
|
|
mTitleBarActions = new KTitleBarActionsConfig(false, mConfig, this);
|
2011-01-30 14:34:42 +00:00
|
|
|
mTitleBarActions->setObjectName(QLatin1String("KWin TitleBar Actions"));
|
|
|
|
tab->addTab(mTitleBarActions, i18n("&Titlebar Actions"));
|
|
|
|
connect(mTitleBarActions, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2013-09-30 05:29:38 +00:00
|
|
|
mWindowActions = new KWindowActionsConfig(false, mConfig, this);
|
2011-01-30 14:34:42 +00:00
|
|
|
mWindowActions->setObjectName(QLatin1String("KWin Window Actions"));
|
|
|
|
tab->addTab(mWindowActions, i18n("Window Actio&ns"));
|
|
|
|
connect(mWindowActions, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
KActionsOptions::~KActionsOptions()
|
|
|
|
{
|
2011-01-30 14:34:42 +00:00
|
|
|
delete mConfig;
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void KActionsOptions::load()
|
|
|
|
{
|
2011-01-30 14:34:42 +00:00
|
|
|
mTitleBarActions->load();
|
|
|
|
mWindowActions->load();
|
|
|
|
emit KCModule::changed(false);
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void KActionsOptions::save()
|
|
|
|
{
|
2011-01-30 14:34:42 +00:00
|
|
|
mTitleBarActions->save();
|
|
|
|
mWindowActions->save();
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
emit KCModule::changed(false);
|
|
|
|
// Send signal to kwin
|
|
|
|
mConfig->sync();
|
|
|
|
// Send signal to all kwin instances
|
|
|
|
QDBusMessage message =
|
|
|
|
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
|
|
|
|
QDBusConnection::sessionBus().send(message);
|
2007-04-30 11:32:47 +00:00
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void KActionsOptions::defaults()
|
|
|
|
{
|
2011-01-30 14:34:42 +00:00
|
|
|
mTitleBarActions->defaults();
|
|
|
|
mWindowActions->defaults();
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void KActionsOptions::moduleChanged(bool state)
|
|
|
|
{
|
2011-01-30 14:34:42 +00:00
|
|
|
emit KCModule::changed(state);
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
2007-08-28 14:58:52 +00:00
|
|
|
K_PLUGIN_FACTORY_DEFINITION(KWinOptionsFactory,
|
2011-01-30 14:34:42 +00:00
|
|
|
registerPlugin<KActionsOptions>("kwinactions");
|
|
|
|
registerPlugin<KFocusConfigStandalone>("kwinfocus");
|
|
|
|
registerPlugin<KMovingConfigStandalone>("kwinmoving");
|
|
|
|
registerPlugin<KAdvancedConfigStandalone>("kwinadvanced");
|
|
|
|
registerPlugin<KWinOptions>("kwinoptions");
|
|
|
|
)
|
2007-08-28 14:58:52 +00:00
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
#include "main.moc"
|
2007-08-28 14:58:52 +00:00
|
|
|
#include "moc_main.cpp"
|