You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
112 lines
3.0 KiB
112 lines
3.0 KiB
15 years ago
|
/* vi: ts=8 sts=4 sw=4
|
||
|
*
|
||
|
* This file is part of the KDE project, module kcmdisplay.
|
||
|
* Copyright (C) 1999 Geert Jansen <g.t.jansen@stud.tue.nl>
|
||
|
*
|
||
|
* Modified 2000.07.14 by Brad Hughes <bhughes@trolltech.com>
|
||
14 years ago
|
* Improve layout and consistency with KDesktop's background selection
|
||
15 years ago
|
*
|
||
|
* Based on old backgnd.cpp:
|
||
|
*
|
||
|
* Copyright (c) Martin R. Jones 1996
|
||
|
* Converted to a kcc module by Matthias Hoelzer 1997
|
||
|
* Gradient backgrounds by Mark Donohoe 1997
|
||
|
* Pattern backgrounds by Stephan Kulow 1998
|
||
|
* Randomizing & dnd & new display modes by Matej Koss 1998
|
||
|
*
|
||
|
* You can Freely distribute this program under the GNU General Public
|
||
|
* License. See the file "COPYING" for the exact licensing terms.
|
||
|
*/
|
||
|
|
||
|
#include <config.h>
|
||
|
|
||
|
#include <unistd.h>
|
||
|
#include <sys/types.h>
|
||
|
|
||
15 years ago
|
#include <tqgroupbox.h>
|
||
13 years ago
|
#include <tqlayout.h>
|
||
15 years ago
|
#include <tqwhatsthis.h>
|
||
15 years ago
|
|
||
|
#include <kdebug.h>
|
||
|
#include <klocale.h>
|
||
|
#include <dcopclient.h>
|
||
|
#include "../background/bgsettings.h"
|
||
|
#include "../background/bgdialog.h"
|
||
|
#include "background.h"
|
||
15 years ago
|
#include <tqcheckbox.h>
|
||
15 years ago
|
#include <ksimpleconfig.h>
|
||
|
#include <kdialog.h>
|
||
|
|
||
|
extern KSimpleConfig *config;
|
||
|
|
||
15 years ago
|
KBackground::KBackground(TQWidget *parent, const char *name)
|
||
|
: TQWidget(parent, name)
|
||
15 years ago
|
{
|
||
|
|
||
|
// Enabling checkbox
|
||
15 years ago
|
m_pCBEnable = new TQCheckBox( i18n("E&nable background"), this );
|
||
|
TQWhatsThis::add( m_pCBEnable,
|
||
13 years ago
|
i18n("If this is checked, TDM will use the settings below for the background."
|
||
15 years ago
|
" If it is disabled, you have to look after the background yourself."
|
||
|
" This is done by running some program (possibly xsetroot) in the script"
|
||
13 years ago
|
" specified in the Setup= option in tdmrc (usually Xsetup).") );
|
||
15 years ago
|
config->setGroup( "X-*-Greeter" );
|
||
13 years ago
|
m_simpleConf=new KSimpleConfig(config->readEntry( "BackgroundCfg",KDE_CONFDIR "/tdm/backgroundrc" ) );
|
||
15 years ago
|
m_background = new BGDialog( this, m_simpleConf, false );
|
||
|
|
||
15 years ago
|
connect(m_background, TQT_SIGNAL(changed(bool)), TQT_SIGNAL(changed(bool)));
|
||
15 years ago
|
|
||
14 years ago
|
// Top layout
|
||
15 years ago
|
TQVBoxLayout *top = new TQVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint() );
|
||
15 years ago
|
top->addWidget(m_pCBEnable);
|
||
|
top->addWidget(m_background);
|
||
|
top->addStretch();
|
||
15 years ago
|
connect( m_pCBEnable, TQT_SIGNAL(toggled( bool )), TQT_SLOT(slotEnableChanged()) );
|
||
15 years ago
|
}
|
||
|
|
||
|
KBackground::~KBackground()
|
||
|
{
|
||
|
delete m_simpleConf;
|
||
|
}
|
||
|
|
||
|
void KBackground::slotEnableChanged()
|
||
|
{
|
||
|
bool en = m_pCBEnable->isChecked();
|
||
|
m_background->setEnabled( en );
|
||
|
emit changed ( true );
|
||
|
}
|
||
|
|
||
|
void KBackground::makeReadOnly()
|
||
|
{
|
||
|
m_pCBEnable->setEnabled(false);
|
||
|
m_background->makeReadOnly();
|
||
|
}
|
||
|
|
||
|
void KBackground::load()
|
||
|
{
|
||
|
m_pCBEnable->setChecked( config->readBoolEntry( "UseBackground", true ) );
|
||
|
m_background->load(false);
|
||
|
slotEnableChanged();
|
||
|
emit changed(false);
|
||
|
}
|
||
|
|
||
|
|
||
|
void KBackground::save()
|
||
|
{
|
||
|
kdDebug() << "Saving stuff..." << endl;
|
||
|
config->writeEntry( "UseBackground", m_pCBEnable->isChecked() );
|
||
|
m_background->save();
|
||
|
emit changed(false);
|
||
|
}
|
||
|
|
||
|
|
||
|
void KBackground::defaults()
|
||
|
{
|
||
|
m_pCBEnable->setChecked( true );
|
||
|
slotEnableChanged();
|
||
|
m_background->defaults();
|
||
|
emit changed(true);
|
||
|
}
|
||
|
|
||
|
#include "background.moc"
|