2007-04-29 17:35:43 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2004 Lubos Lunak <l.lunak@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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "kcm.h"
|
|
|
|
|
|
|
|
#include <QLayout>
|
|
|
|
//Added by qt3to4:
|
|
|
|
#include <QVBoxLayout>
|
2014-03-17 15:24:10 +00:00
|
|
|
#include <KLocalizedString>
|
2007-04-29 17:35:43 +00:00
|
|
|
#include <kaboutdata.h>
|
|
|
|
#include <QtDBus/QtDBus>
|
|
|
|
|
|
|
|
#include "ruleslist.h"
|
2007-08-28 13:05:35 +00:00
|
|
|
#include <KPluginFactory>
|
|
|
|
#include <KPluginLoader>
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2007-08-28 13:05:35 +00:00
|
|
|
K_PLUGIN_FACTORY(KCMRulesFactory,
|
2011-01-30 14:34:42 +00:00
|
|
|
registerPlugin<KWin::KCMRules>();
|
|
|
|
)
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
KCMRules::KCMRules(QWidget *parent, const QVariantList &)
|
2013-09-30 06:44:16 +00:00
|
|
|
: KCModule(parent)
|
2011-01-30 14:34:42 +00:00
|
|
|
, config("kwinrulesrc")
|
|
|
|
{
|
|
|
|
QVBoxLayout *layout = new QVBoxLayout(this);
|
2007-05-28 22:21:39 +00:00
|
|
|
layout->setMargin(0);
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
widget = new KCMRulesList(this);
|
|
|
|
layout->addWidget(widget);
|
|
|
|
connect(widget, SIGNAL(changed(bool)), SLOT(moduleChanged(bool)));
|
2014-04-28 15:11:20 +00:00
|
|
|
KAboutData *about = new KAboutData(QStringLiteral("kcmkwinrules"),
|
2013-09-30 06:43:40 +00:00
|
|
|
i18n("Window-Specific Settings Configuration Module"),
|
|
|
|
QString(), QString(), KAboutData::License_GPL, i18n("(c) 2004 KWin and KControl Authors"));
|
|
|
|
about->addAuthor(i18n("Lubos Lunak"), QString(), "l.lunak@kde.org");
|
2007-04-29 17:35:43 +00:00
|
|
|
setAboutData(about);
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
void KCMRules::load()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
config.reparseConfiguration();
|
|
|
|
widget->load();
|
2011-01-30 14:34:42 +00:00
|
|
|
emit KCModule::changed(false);
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
void KCMRules::save()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
widget->save();
|
2011-01-30 14:34:42 +00:00
|
|
|
emit KCModule::changed(false);
|
2007-04-29 17:35:43 +00:00
|
|
|
// Send signal to kwin
|
|
|
|
config.sync();
|
2007-04-30 11:32:47 +00:00
|
|
|
// Send signal to all kwin instances
|
|
|
|
QDBusMessage message =
|
2008-01-30 16:08:23 +00:00
|
|
|
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
|
2007-04-30 11:32:47 +00:00
|
|
|
QDBusConnection::sessionBus().send(message);
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
void KCMRules::defaults()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
widget->defaults();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
QString KCMRules::quickHelp() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-08-21 07:02:04 +00:00
|
|
|
return i18n("<p><h1>Window-specific Settings</h1> Here you can customize window settings specifically only"
|
2011-01-30 14:34:42 +00:00
|
|
|
" for some 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>");
|
|
|
|
}
|
|
|
|
|
|
|
|
void KCMRules::moduleChanged(bool state)
|
|
|
|
{
|
|
|
|
emit KCModule::changed(state);
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// i18n freeze :-/
|
|
|
|
#if 0
|
|
|
|
I18N_NOOP("Remember settings separately for every window")
|
|
|
|
I18N_NOOP("Show internal settings for remembering")
|
|
|
|
I18N_NOOP("Internal setting for remembering")
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#include "kcm.moc"
|