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 QTabWidget(this);
77 layout
->addWidget(tab
);
79 mFocus
= new KFocusConfig(false, mConfig
, componentData(), this);
80 mFocus
->setObjectName("KWin Focus Config");
81 mFocus
->layout()->setMargin( KDialog::marginHint() );
82 tab
->addTab(mFocus
, i18n("&Focus"));
83 connect(mFocus
, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
85 mTitleBarActions
= new KTitleBarActionsConfig(false, mConfig
, componentData(), this);
86 mTitleBarActions
->setObjectName("KWin TitleBar Actions");
87 mTitleBarActions
->layout()->setMargin( KDialog::marginHint() );
88 tab
->addTab(mTitleBarActions
, i18n("&Titlebar Actions"));
89 connect(mTitleBarActions
, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
91 mWindowActions
= new KWindowActionsConfig(false, mConfig
, componentData(), this);
92 mWindowActions
->setObjectName("KWin Window Actions");
93 mWindowActions
->layout()->setMargin( KDialog::marginHint() );
94 tab
->addTab(mWindowActions
, i18n("Window Actio&ns"));
95 connect(mWindowActions
, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
97 mMoving
= new KMovingConfig(false, mConfig
, componentData(), this);
98 mMoving
->setObjectName("KWin Moving");
99 mMoving
->layout()->setMargin( KDialog::marginHint() );
100 tab
->addTab(mMoving
, i18n("&Moving"));
101 connect(mMoving
, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
103 mAdvanced
= new KAdvancedConfig(false, mConfig
, componentData(), this);
104 mAdvanced
->setObjectName("KWin Advanced");
105 mAdvanced
->layout()->setMargin( KDialog::marginHint() );
106 tab
->addTab(mAdvanced
, i18n("Ad&vanced"));
107 connect(mAdvanced
, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
110 new KAboutData(I18N_NOOP("kcmkwinoptions"), 0, ki18n("Window Behavior Configuration Module"),
111 0, KLocalizedString(), KAboutData::License_GPL
,
112 ki18n("(c) 1997 - 2002 KWin and KControl Authors"));
114 about
->addAuthor(ki18n("Matthias Ettrich"),KLocalizedString(),"ettrich@kde.org");
115 about
->addAuthor(ki18n("Waldo Bastian"),KLocalizedString(),"bastian@kde.org");
116 about
->addAuthor(ki18n("Cristian Tibirna"),KLocalizedString(),"tibirna@kde.org");
117 about
->addAuthor(ki18n("Matthias Kalle Dalheimer"),KLocalizedString(),"kalle@kde.org");
118 about
->addAuthor(ki18n("Daniel Molkentin"),KLocalizedString(),"molkentin@kde.org");
119 about
->addAuthor(ki18n("Wynn Wilkes"),KLocalizedString(),"wynnw@caldera.com");
120 about
->addAuthor(ki18n("Pat Dowler"),KLocalizedString(),"dowler@pt1B1106.FSH.UVic.CA");
121 about
->addAuthor(ki18n("Bernd Wuebben"),KLocalizedString(),"wuebben@kde.org");
122 about
->addAuthor(ki18n("Matthias Hoelzer-Kluepfel"),KLocalizedString(),"hoelzer@kde.org");
126 KWinOptions::~KWinOptions()
131 void KWinOptions::load()
133 mConfig
->reparseConfiguration();
135 mTitleBarActions
->load();
136 mWindowActions
->load();
139 emit
KCModule::changed( false );
143 void KWinOptions::save()
146 mTitleBarActions
->save();
147 mWindowActions
->save();
151 emit
KCModule::changed( false );
152 // Send signal to kwin
154 // Send signal to all kwin instances
155 QDBusMessage message
=
156 QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
157 QDBusConnection::sessionBus().send(message
);
163 void KWinOptions::defaults()
166 mTitleBarActions
->defaults();
167 mWindowActions
->defaults();
169 mAdvanced
->defaults();
172 QString
KWinOptions::quickHelp() const
174 return i18n("<p><h1>Window Behavior</h1> Here you can customize the way windows behave when being"
175 " moved, resized or clicked on. You can also specify a focus policy as well as a placement"
176 " policy for new windows.</p>"
177 " <p>Please note that this configuration will not take effect if you do not use"
178 " KWin as your window manager. If you do use a different window manager, please refer to its documentation"
179 " for how to customize window behavior.</p>");
182 void KWinOptions::moduleChanged(bool state
)
184 emit
KCModule::changed(state
);
187 KActionsOptions::KActionsOptions(QWidget
*parent
, const QVariantList
&)
188 : KCModule(KWinOptionsFactory::componentData(), parent
)
190 mConfig
= new KConfig( "kwinrc", KConfig::IncludeGlobals
);
192 QVBoxLayout
*layout
= new QVBoxLayout(this);
193 layout
->setMargin(0);
194 tab
= new QTabWidget(this);
195 layout
->addWidget(tab
);
197 mTitleBarActions
= new KTitleBarActionsConfig(false, mConfig
, componentData(), this);
198 mTitleBarActions
->setObjectName("KWin TitleBar Actions");
199 mTitleBarActions
->layout()->setMargin( KDialog::marginHint() );
200 tab
->addTab(mTitleBarActions
, i18n("&Titlebar Actions"));
201 connect(mTitleBarActions
, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
203 mWindowActions
= new KWindowActionsConfig(false, mConfig
, componentData(), this);
204 mWindowActions
->setObjectName("KWin Window Actions");
205 mWindowActions
->layout()->setMargin( KDialog::marginHint() );
206 tab
->addTab(mWindowActions
, i18n("Window Actio&ns"));
207 connect(mWindowActions
, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
210 KActionsOptions::~KActionsOptions()
215 void KActionsOptions::load()
217 mTitleBarActions
->load();
218 mWindowActions
->load();
219 emit
KCModule::changed( false );
223 void KActionsOptions::save()
225 mTitleBarActions
->save();
226 mWindowActions
->save();
228 emit
KCModule::changed( false );
229 // Send signal to kwin
231 // Send signal to all kwin instances
232 QDBusMessage message
=
233 QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
234 QDBusConnection::sessionBus().send(message
);
239 void KActionsOptions::defaults()
241 mTitleBarActions
->defaults();
242 mWindowActions
->defaults();
245 void KActionsOptions::moduleChanged(bool state
)
247 emit
KCModule::changed(state
);
250 K_PLUGIN_FACTORY_DEFINITION(KWinOptionsFactory
,
251 registerPlugin
<KActionsOptions
>("kwinactions");
252 registerPlugin
<KFocusConfigStandalone
>("kwinfocus");
253 registerPlugin
<KMovingConfigStandalone
>("kwinmoving");
254 registerPlugin
<KAdvancedConfigStandalone
>("kwinadvanced");
255 registerPlugin
<KWinOptions
>("kwinoptions");
257 K_EXPORT_PLUGIN(KWinOptionsFactory("kcmkwm"))
260 #include "moc_main.cpp"