kwin Library API Documentation

kcm.cpp

00001 /*
00002  * Copyright (c) 2004 Lubos Lunak <l.lunak@kde.org>
00003  *
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU General Public License
00015  *  along with this program; if not, write to the Free Software
00016  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00017  */
00018 
00019 #include "kcm.h"
00020 
00021 #include <kglobal.h>
00022 #include <qlayout.h>
00023 #include <klocale.h>
00024 #include <kapplication.h>
00025 #include <dcopclient.h>
00026 #include <kaboutdata.h>
00027 
00028 #include "ruleslist.h"
00029 
00030 extern "C"
00031     KDE_EXPORT KCModule *create_kwinrules( QWidget *parent, const char *name )
00032     {
00033     //CT there's need for decision: kwm or kwin?
00034     KGlobal::locale()->insertCatalogue( "kcmkwinrules" );
00035     return new KWinInternal::KCMRules( parent, name );
00036     }
00037 
00038 namespace KWinInternal
00039 {
00040 
00041 KCMRules::KCMRules( QWidget *parent, const char *name )
00042 : KCModule( parent, name )
00043 , config( "kwinrulesrc" )
00044     {
00045     QVBoxLayout *layout = new QVBoxLayout( this );
00046     widget = new KCMRulesList( this );
00047     layout->addWidget( widget );
00048     connect( widget, SIGNAL( changed( bool )), SLOT( moduleChanged( bool )));
00049     KAboutData *about = new KAboutData(I18N_NOOP( "kcmkwinrules" ),
00050         I18N_NOOP( "Window-Specific Settings Configuration Module" ),
00051         0, 0, KAboutData::License_GPL, I18N_NOOP( "(c) 2004 KWin and KControl Authors" ));
00052     about->addAuthor("Lubos Lunak",0,"l.lunak@kde.org");
00053     setAboutData(about);
00054     }
00055 
00056 void KCMRules::load()
00057     {
00058     config.reparseConfiguration();
00059     widget->load();
00060     emit KCModule::changed( false );
00061     }
00062 
00063 void KCMRules::save()
00064     {
00065     widget->save();
00066     emit KCModule::changed( false );
00067     // Send signal to kwin
00068     config.sync();
00069     if( !kapp->dcopClient()->isAttached())
00070         kapp->dcopClient()->attach();
00071     kapp->dcopClient()->send("kwin*", "", "reconfigure()", "");
00072     }
00073 
00074 void KCMRules::defaults()
00075     {
00076     widget->defaults();
00077     }
00078 
00079 QString KCMRules::quickHelp() const
00080     {
00081     return i18n("<h1>Window-specific Settings</h1> Here you can customize window settings specifically only"
00082         " for some windows."
00083         " <p>Please note that this configuration will not take effect if you do not use"
00084         " KWin as your window manager. If you do use a different window manager, please refer to its documentation"
00085         " for how to customize window behavior.");
00086     }
00087 
00088 void KCMRules::moduleChanged( bool state )
00089     {
00090     emit KCModule::changed( state );
00091     }
00092 
00093 }
00094 
00095 // i18n freeze :-/
00096 #if 0
00097 I18N_NOOP("Remember settings separately for every window")
00098 I18N_NOOP("Show internal settings for remembering")
00099 I18N_NOOP("Internal setting for remembering")
00100 #endif
00101 
00102 
00103 #include "kcm.moc"
KDE Logo
This file is part of the documentation for kwin Library Version 3.4.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Jun 14 19:06:09 2006 by doxygen 1.4.4 written by Dimitri van Heesch, © 1997-2003