3
* Copyright (c) 2001 Waldo Bastian <bastian@kde.org>
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24
#include <QVBoxLayout>
26
#include <QtDBus/QtDBus>
28
#include <kapplication.h>
32
#include <kaboutdata.h>
34
#include <KPluginFactory>
35
#include <KPluginLoader>
40
K_PLUGIN_FACTORY_DECLARATION(KWinOptionsFactory)
42
class KFocusConfigStandalone : public KFocusConfig
46
KFocusConfigStandalone(QWidget* parent, const QVariantList &)
47
: KFocusConfig(true, new KConfig("kwinrc"), KWinOptionsFactory::componentData(), parent)
51
class KMovingConfigStandalone : public KMovingConfig
55
KMovingConfigStandalone(QWidget* parent, const QVariantList &)
56
: KMovingConfig(true, new KConfig("kwinrc"), KWinOptionsFactory::componentData(), parent)
60
class KAdvancedConfigStandalone : public KAdvancedConfig
64
KAdvancedConfigStandalone(QWidget* parent, const QVariantList &)
65
: KAdvancedConfig(true, new KConfig("kwinrc"), KWinOptionsFactory::componentData(), parent)
69
KWinOptions::KWinOptions(QWidget *parent, const QVariantList &)
70
: KCModule(KWinOptionsFactory::componentData(), parent)
72
mConfig = new KConfig("kwinrc", KConfig::IncludeGlobals);
74
QVBoxLayout *layout = new QVBoxLayout(this);
76
tab = new KTabWidget(this);
77
layout->addWidget(tab);
79
mFocus = new KFocusConfig(false, mConfig, componentData(), this);
80
mFocus->setObjectName(QLatin1String("KWin Focus Config"));
81
tab->addTab(mFocus, i18n("&Focus"));
82
connect(mFocus, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
84
mTitleBarActions = new KTitleBarActionsConfig(false, mConfig, componentData(), this);
85
mTitleBarActions->setObjectName(QLatin1String("KWin TitleBar Actions"));
86
tab->addTab(mTitleBarActions, i18n("&Titlebar Actions"));
87
connect(mTitleBarActions, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
89
mWindowActions = new KWindowActionsConfig(false, mConfig, componentData(), this);
90
mWindowActions->setObjectName(QLatin1String("KWin Window Actions"));
91
tab->addTab(mWindowActions, i18n("Window Actio&ns"));
92
connect(mWindowActions, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
94
mMoving = new KMovingConfig(false, mConfig, componentData(), this);
95
mMoving->setObjectName(QLatin1String("KWin Moving"));
96
tab->addTab(mMoving, i18n("&Moving"));
97
connect(mMoving, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
99
mAdvanced = new KAdvancedConfig(false, mConfig, componentData(), this);
100
mAdvanced->setObjectName(QLatin1String("KWin Advanced"));
101
tab->addTab(mAdvanced, i18n("Ad&vanced"));
102
connect(mAdvanced, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
105
new KAboutData(I18N_NOOP("kcmkwinoptions"), 0, ki18n("Window Behavior Configuration Module"),
106
0, KLocalizedString(), KAboutData::License_GPL,
107
ki18n("(c) 1997 - 2002 KWin and KControl Authors"));
109
about->addAuthor(ki18n("Matthias Ettrich"), KLocalizedString(), "ettrich@kde.org");
110
about->addAuthor(ki18n("Waldo Bastian"), KLocalizedString(), "bastian@kde.org");
111
about->addAuthor(ki18n("Cristian Tibirna"), KLocalizedString(), "tibirna@kde.org");
112
about->addAuthor(ki18n("Matthias Kalle Dalheimer"), KLocalizedString(), "kalle@kde.org");
113
about->addAuthor(ki18n("Daniel Molkentin"), KLocalizedString(), "molkentin@kde.org");
114
about->addAuthor(ki18n("Wynn Wilkes"), KLocalizedString(), "wynnw@caldera.com");
115
about->addAuthor(ki18n("Pat Dowler"), KLocalizedString(), "dowler@pt1B1106.FSH.UVic.CA");
116
about->addAuthor(ki18n("Bernd Wuebben"), KLocalizedString(), "wuebben@kde.org");
117
about->addAuthor(ki18n("Matthias Hoelzer-Kluepfel"), KLocalizedString(), "hoelzer@kde.org");
121
KWinOptions::~KWinOptions()
126
void KWinOptions::load()
128
mConfig->reparseConfiguration();
130
mTitleBarActions->load();
131
mWindowActions->load();
134
emit KCModule::changed(false);
138
void KWinOptions::save()
141
mTitleBarActions->save();
142
mWindowActions->save();
146
emit KCModule::changed(false);
147
// Send signal to kwin
149
// Send signal to all kwin instances
150
QDBusMessage message =
151
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
152
QDBusConnection::sessionBus().send(message);
158
void KWinOptions::defaults()
161
mTitleBarActions->defaults();
162
mWindowActions->defaults();
164
mAdvanced->defaults();
167
QString KWinOptions::quickHelp() const
169
return i18n("<p><h1>Window Behavior</h1> Here you can customize the way windows behave when being"
170
" moved, resized or clicked on. You can also specify a focus policy as well as a placement"
171
" policy for new windows.</p>"
172
" <p>Please note that this configuration will not take effect if you do not use"
173
" KWin as your window manager. If you do use a different window manager, please refer to its documentation"
174
" for how to customize window behavior.</p>");
177
void KWinOptions::moduleChanged(bool state)
179
emit KCModule::changed(state);
182
KActionsOptions::KActionsOptions(QWidget *parent, const QVariantList &)
183
: KCModule(KWinOptionsFactory::componentData(), parent)
185
mConfig = new KConfig("kwinrc", KConfig::IncludeGlobals);
187
QVBoxLayout *layout = new QVBoxLayout(this);
188
layout->setMargin(0);
189
tab = new KTabWidget(this);
190
layout->addWidget(tab);
192
mTitleBarActions = new KTitleBarActionsConfig(false, mConfig, componentData(), this);
193
mTitleBarActions->setObjectName(QLatin1String("KWin TitleBar Actions"));
194
tab->addTab(mTitleBarActions, i18n("&Titlebar Actions"));
195
connect(mTitleBarActions, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
197
mWindowActions = new KWindowActionsConfig(false, mConfig, componentData(), this);
198
mWindowActions->setObjectName(QLatin1String("KWin Window Actions"));
199
tab->addTab(mWindowActions, i18n("Window Actio&ns"));
200
connect(mWindowActions, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
203
KActionsOptions::~KActionsOptions()
208
void KActionsOptions::load()
210
mTitleBarActions->load();
211
mWindowActions->load();
212
emit KCModule::changed(false);
216
void KActionsOptions::save()
218
mTitleBarActions->save();
219
mWindowActions->save();
221
emit KCModule::changed(false);
222
// Send signal to kwin
224
// Send signal to all kwin instances
225
QDBusMessage message =
226
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
227
QDBusConnection::sessionBus().send(message);
232
void KActionsOptions::defaults()
234
mTitleBarActions->defaults();
235
mWindowActions->defaults();
238
void KActionsOptions::moduleChanged(bool state)
240
emit KCModule::changed(state);
243
K_PLUGIN_FACTORY_DEFINITION(KWinOptionsFactory,
244
registerPlugin<KActionsOptions>("kwinactions");
245
registerPlugin<KFocusConfigStandalone>("kwinfocus");
246
registerPlugin<KMovingConfigStandalone>("kwinmoving");
247
registerPlugin<KAdvancedConfigStandalone>("kwinadvanced");
248
registerPlugin<KWinOptions>("kwinoptions");
250
K_EXPORT_PLUGIN(KWinOptionsFactory("kcmkwm"))
253
#include "moc_main.cpp"