kwin Library API Documentation

config.cpp

00001 /* 00002 * $Id: config.cpp,v 1.5 2003/06/30 08:16:14 aseigo Exp $ 00003 * 00004 * This file contains the B2 configuration widget 00005 * 00006 * Copyright (c) 2001 00007 * Karol Szwed <gallium@kde.org> 00008 * http://gallium.n3.net/ 00009 */ 00010 00011 #include "config.h" 00012 #include <kglobal.h> 00013 #include <qwhatsthis.h> 00014 #include <qvbox.h> 00015 #include <klocale.h> 00016 00017 00018 extern "C" 00019 { 00020 QObject* allocate_config( KConfig* conf, QWidget* parent ) 00021 { 00022 return(new B2Config(conf, parent)); 00023 } 00024 } 00025 00026 00027 /* NOTE: 00028 * 'conf' is a pointer to the kwindecoration modules open kwin config, 00029 * and is by default set to the "Style" group. 00030 * 00031 * 'parent' is the parent of the QObject, which is a VBox inside the 00032 * Configure tab in kwindecoration 00033 */ 00034 00035 B2Config::B2Config( KConfig* conf, QWidget* parent ) 00036 : QObject( parent ) 00037 { 00038 KGlobal::locale()->insertCatalogue("kwin_b2_config"); 00039 b2Config = new KConfig("kwinb2rc"); 00040 gb = new QVBox( parent ); 00041 cbColorBorder = new QCheckBox( 00042 i18n("Draw window frames using &titlebar colors"), gb ); 00043 QWhatsThis::add( cbColorBorder, 00044 i18n("When selected, the window decoration borders " 00045 "are drawn using the titlebar colors. Otherwise, they are " 00046 "drawn using normal border colors instead.") ); 00047 // Load configuration options 00048 load( conf ); 00049 00050 // Ensure we track user changes properly 00051 connect( cbColorBorder, SIGNAL(clicked()), this, SLOT(slotSelectionChanged()) ); 00052 00053 // Make the widgets visible in kwindecoration 00054 gb->show(); 00055 } 00056 00057 00058 B2Config::~B2Config() 00059 { 00060 delete cbColorBorder; 00061 delete gb; 00062 delete b2Config; 00063 } 00064 00065 00066 void B2Config::slotSelectionChanged() 00067 { 00068 emit changed(); 00069 } 00070 00071 00072 // Loads the configurable options from the kwinrc config file 00073 // It is passed the open config from kwindecoration to improve efficiency 00074 void B2Config::load( KConfig* /*conf*/ ) 00075 { 00076 b2Config->setGroup("General"); 00077 bool override = b2Config->readBoolEntry( "UseTitleBarBorderColors", false ); 00078 cbColorBorder->setChecked( override ); 00079 } 00080 00081 00082 // Saves the configurable options to the kwinrc config file 00083 void B2Config::save( KConfig* /*conf*/ ) 00084 { 00085 b2Config->setGroup("General"); 00086 b2Config->writeEntry( "UseTitleBarBorderColors", cbColorBorder->isChecked() ); 00087 // Ensure others trying to read this config get updated 00088 b2Config->sync(); 00089 } 00090 00091 00092 // Sets UI widget defaults which must correspond to style defaults 00093 void B2Config::defaults() 00094 { 00095 cbColorBorder->setChecked( false ); 00096 } 00097 00098 #include "config.moc" 00099 // vim: ts=4
KDE Logo
This file is part of the documentation for kwin Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Dec 16 19:08:40 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003