summaryrefslogtreecommitdiffstats
path: root/kwin/kcmkwin/kwinoptions/main.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit4aed2c8219774f5d797760606b8489a92ddc5163 (patch)
tree3f8c130f7d269626bf6a9447407ef6c35954426a /kwin/kcmkwin/kwinoptions/main.cpp
downloadtdebase-4aed2c8219774f5d797760606b8489a92ddc5163.tar.gz
tdebase-4aed2c8219774f5d797760606b8489a92ddc5163.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kwin/kcmkwin/kwinoptions/main.cpp')
-rw-r--r--kwin/kcmkwin/kwinoptions/main.cpp262
1 files changed, 262 insertions, 0 deletions
diff --git a/kwin/kcmkwin/kwinoptions/main.cpp b/kwin/kcmkwin/kwinoptions/main.cpp
new file mode 100644
index 000000000..fbc70e4c8
--- /dev/null
+++ b/kwin/kcmkwin/kwinoptions/main.cpp
@@ -0,0 +1,262 @@
+/*
+ *
+ * Copyright (c) 2001 Waldo Bastian <[email protected]>
+ *
+ * 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.
+ */
+
+#include <qlayout.h>
+
+#include <dcopclient.h>
+
+#include <kapplication.h>
+#include <kglobal.h>
+#include <klocale.h>
+#include <kconfig.h>
+#include <kgenericfactory.h>
+#include <kaboutdata.h>
+#include <kdialog.h>
+
+#include "mouse.h"
+#include "windows.h"
+
+#include "main.h"
+
+extern "C"
+{
+ KDE_EXPORT KCModule *create_kwinfocus(QWidget *parent, const char *name)
+ {
+ //CT there's need for decision: kwm or kwin?
+ KGlobal::locale()->insertCatalogue("kcmkwm");
+ KConfig *c = new KConfig("kwinrc", false, true);
+ return new KFocusConfig(true, c, parent, name);
+ }
+
+ KDE_EXPORT KCModule *create_kwinactions(QWidget *parent, const char *name)
+ {
+ //CT there's need for decision: kwm or kwin?
+ KGlobal::locale()->insertCatalogue("kcmkwm");
+ return new KActionsOptions( parent, name);
+ }
+
+ KDE_EXPORT KCModule *create_kwinmoving(QWidget *parent, const char *name)
+ {
+ //CT there's need for decision: kwm or kwin?
+ KGlobal::locale()->insertCatalogue("kcmkwm");
+ KConfig *c = new KConfig("kwinrc", false, true);
+ return new KMovingConfig(true, c, parent, name);
+ }
+
+ KDE_EXPORT KCModule *create_kwinadvanced(QWidget *parent, const char *name)
+ {
+ //CT there's need for decision: kwm or kwin?
+ KGlobal::locale()->insertCatalogue("kcmkwm");
+ KConfig *c = new KConfig("kwinrc", false, true);
+ return new KAdvancedConfig(true, c, parent, name);
+ }
+
+ KDE_EXPORT KCModule *create_kwintranslucency(QWidget *parent, const char *name)
+ {
+ //CT there's need for decision: kwm or kwin?
+ KGlobal::locale()->insertCatalogue("kcmkwm");
+ KConfig *c = new KConfig("kwinrc", false, true);
+ return new KTranslucencyConfig(true, c, parent, name);
+ }
+
+ KDE_EXPORT KCModule *create_kwinoptions ( QWidget *parent, const char* name)
+ {
+ //CT there's need for decision: kwm or kwin?
+ KGlobal::locale()->insertCatalogue("kcmkwm");
+ return new KWinOptions( parent, name);
+ }
+}
+
+KWinOptions::KWinOptions(QWidget *parent, const char *name)
+ : KCModule(parent, name)
+{
+ mConfig = new KConfig("kwinrc", false, true);
+
+ QVBoxLayout *layout = new QVBoxLayout(this);
+ tab = new QTabWidget(this);
+ layout->addWidget(tab);
+
+ mFocus = new KFocusConfig(false, mConfig, this, "KWin Focus Config");
+ mFocus->layout()->setMargin( KDialog::marginHint() );
+ tab->addTab(mFocus, i18n("&Focus"));
+ connect(mFocus, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
+
+ mTitleBarActions = new KTitleBarActionsConfig(false, mConfig, this, "KWin TitleBar Actions");
+ mTitleBarActions->layout()->setMargin( KDialog::marginHint() );
+ tab->addTab(mTitleBarActions, i18n("&Titlebar Actions"));
+ connect(mTitleBarActions, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
+
+ mWindowActions = new KWindowActionsConfig(false, mConfig, this, "KWin Window Actions");
+ mWindowActions->layout()->setMargin( KDialog::marginHint() );
+ tab->addTab(mWindowActions, i18n("Window Actio&ns"));
+ connect(mWindowActions, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
+
+ mMoving = new KMovingConfig(false, mConfig, this, "KWin Moving");
+ mMoving->layout()->setMargin( KDialog::marginHint() );
+ tab->addTab(mMoving, i18n("&Moving"));
+ connect(mMoving, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
+
+ mAdvanced = new KAdvancedConfig(false, mConfig, this, "KWin Advanced");
+ mAdvanced->layout()->setMargin( KDialog::marginHint() );
+ tab->addTab(mAdvanced, i18n("Ad&vanced"));
+ connect(mAdvanced, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
+
+ mTranslucency = new KTranslucencyConfig(false, mConfig, this, "KWin Translucency");
+ mTranslucency->layout()->setMargin( KDialog::marginHint() );
+ tab->addTab(mTranslucency, i18n("&Translucency"));
+ connect(mTranslucency, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
+
+ 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,"[email protected]");
+ about->addAuthor("Waldo Bastian",0,"[email protected]");
+ about->addAuthor("Cristian Tibirna",0,"[email protected]");
+ about->addAuthor("Matthias Kalle Dalheimer",0,"[email protected]");
+ about->addAuthor("Daniel Molkentin",0,"[email protected]");
+ about->addAuthor("Wynn Wilkes",0,"[email protected]");
+ about->addAuthor("Pat Dowler",0,"[email protected]");
+ about->addAuthor("Bernd Wuebben",0,"[email protected]");
+ about->addAuthor("Matthias Hoelzer-Kluepfel",0,"[email protected]");
+ setAboutData(about);
+}
+
+KWinOptions::~KWinOptions()
+{
+ delete mConfig;
+}
+
+void KWinOptions::load()
+{
+ mConfig->reparseConfiguration();
+ mFocus->load();
+ mTitleBarActions->load();
+ mWindowActions->load();
+ mMoving->load();
+ mAdvanced->load();
+ mTranslucency->load();
+ emit KCModule::changed( false );
+}
+
+
+void KWinOptions::save()
+{
+ mFocus->save();
+ mTitleBarActions->save();
+ mWindowActions->save();
+ mMoving->save();
+ mAdvanced->save();
+ mTranslucency->save();
+
+ emit KCModule::changed( false );
+ // Send signal to kwin
+ mConfig->sync();
+ if ( !kapp->dcopClient()->isAttached() )
+ kapp->dcopClient()->attach();
+ kapp->dcopClient()->send("kwin*", "", "reconfigure()", "");
+}
+
+
+void KWinOptions::defaults()
+{
+ mFocus->defaults();
+ mTitleBarActions->defaults();
+ mWindowActions->defaults();
+ mMoving->defaults();
+ mAdvanced->defaults();
+ mTranslucency->defaults();
+}
+
+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"
+ " policy for new windows."
+ " <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.");
+}
+
+void KWinOptions::moduleChanged(bool state)
+{
+ emit KCModule::changed(state);
+}
+
+
+KActionsOptions::KActionsOptions(QWidget *parent, const char *name)
+ : KCModule(parent, name)
+{
+ mConfig = new KConfig("kwinrc", false, true);
+
+ QVBoxLayout *layout = new QVBoxLayout(this);
+ tab = new QTabWidget(this);
+ layout->addWidget(tab);
+
+ mTitleBarActions = new KTitleBarActionsConfig(false, mConfig, this, "KWin TitleBar Actions");
+ mTitleBarActions->layout()->setMargin( KDialog::marginHint() );
+ tab->addTab(mTitleBarActions, i18n("&Titlebar Actions"));
+ connect(mTitleBarActions, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
+
+ mWindowActions = new KWindowActionsConfig(false, mConfig, this, "KWin Window Actions");
+ 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();
+ if ( !kapp->dcopClient()->isAttached() )
+ kapp->dcopClient()->attach();
+ kapp->dcopClient()->send("kwin*", "", "reconfigure()", "");
+}
+
+
+void KActionsOptions::defaults()
+{
+ mTitleBarActions->defaults();
+ mWindowActions->defaults();
+}
+
+void KActionsOptions::moduleChanged(bool state)
+{
+ emit KCModule::changed(state);
+}
+
+#include "main.moc"