2 * This file is part of the KDE project, module kcmdisplay.
3 * Copyright (C) 1999 Geert Jansen <g.t.jansen@stud.tue.nl>
5 * Modified 2000.07.14 by Brad Hughes <bhughes@trolltech.com>
6 * Improve layout and consistency with KDesktop's background selection
8 * Based on old backgnd.cpp:
10 * Copyright (c) Martin R. Jones 1996
11 * Converted to a kcc module by Matthias Hoelzer 1997
12 * Gradient backgrounds by Mark Donohoe 1997
13 * Pattern backgrounds by Stephan Kulow 1998
14 * Randomizing & dnd & new display modes by Matej Koss 1998
16 * You can Freely distribute this program under the GNU General Public
17 * License. See the file "COPYING" for the exact licensing terms.
20 #include "background.h"
22 #include <config-workspace.h>
24 #include "../background/bgdialog.h"
28 #include <KConfigGroup>
31 #include <QVBoxLayout>
33 extern KConfig
*config
;
35 KBackground::KBackground(QWidget
*parent
)
40 m_pCBEnable
= new QCheckBox( i18n("E&nable background"), this );
41 m_pCBEnable
->setWhatsThis(
42 i18n("If this is checked, KDM will use the settings below for the background."
43 " If it is disabled, you have to look after the background yourself."
44 " This is done by running some program (possibly xsetroot) in the script"
45 " specified in the Setup= option in kdmrc (usually Xsetup).") );
46 m_simpleConf
= KSharedConfig::openConfig( config
->group( "X-*-Greeter" ).readEntry( "BackgroundCfg", KDE_CONFDIR
"/kdm/backgroundrc" ) );
47 m_background
= new BGDialog( this, m_simpleConf
, true );
49 connect( m_background
, SIGNAL(changed( bool )), SIGNAL(changed()) );
52 QVBoxLayout
*top
= new QVBoxLayout( this );
53 top
->setMargin( KDialog::marginHint() );
54 top
->setSpacing( KDialog::spacingHint() );
55 top
->addWidget( m_pCBEnable
);
56 top
->addWidget( m_background
);
58 connect( m_pCBEnable
, SIGNAL(toggled( bool )), SLOT(slotEnableChanged()) );
61 KBackground::~KBackground()
65 void KBackground::slotEnableChanged()
67 bool en
= m_pCBEnable
->isChecked();
68 m_background
->setEnabled( en
);
72 void KBackground::makeReadOnly()
74 m_pCBEnable
->setEnabled( false );
75 m_background
->makeReadOnly();
78 void KBackground::load()
80 m_pCBEnable
->setChecked( config
->group( "X-*-Greeter" ).readEntry( "UseBackground", true ) );
86 void KBackground::save()
88 config
->group( "X-*-Greeter" ).writeEntry( "UseBackground", m_pCBEnable
->isChecked() );
93 void KBackground::defaults()
95 m_pCBEnable
->setChecked( true );
97 m_background
->defaults();
100 #include "background.moc"