~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to kdm/kcm/background.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * This file is part of the KDE project, module kcmdisplay.
 
3
 * Copyright (C) 1999 Geert Jansen <g.t.jansen@stud.tue.nl>
 
4
 *
 
5
 * Modified 2000.07.14 by Brad Hughes <bhughes@trolltech.com>
 
6
 * Improve layout and consistency with KDesktop's background selection
 
7
 *
 
8
 * Based on old backgnd.cpp:
 
9
 *
 
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
 
15
 *
 
16
 * You can Freely distribute this program under the GNU General Public
 
17
 * License. See the file "COPYING" for the exact licensing terms.
 
18
 */
 
19
 
 
20
#include "background.h"
 
21
 
 
22
#include <config-workspace.h>
 
23
 
 
24
#include "../background/bgdialog.h"
 
25
 
 
26
#include <KLocale>
 
27
#include <KConfig>
 
28
 
 
29
#include <QCheckBox>
 
30
#include <QVBoxLayout>
 
31
 
 
32
extern KConfig *config;
 
33
 
 
34
KBackground::KBackground(KSharedConfigPtr backgroundConfig, QWidget *parent)
 
35
    : QWidget(parent), m_simpleConf(backgroundConfig)
 
36
{
 
37
 
 
38
    // Enabling checkbox
 
39
    m_pCBEnable = new QCheckBox(i18n("E&nable background"), this);
 
40
    m_pCBEnable->setWhatsThis(i18n(
 
41
        "If this is checked, KDM will use the settings below for the background."
 
42
        " If it is disabled, you have to look after the background yourself."
 
43
        " This is done by running some program (possibly xsetroot) in the script"
 
44
        " specified in the Setup= option in kdmrc (usually Xsetup)."));
 
45
    m_background = new BGDialog(this, m_simpleConf);
 
46
 
 
47
    connect(m_background, SIGNAL(changed(bool)), SIGNAL(changed()));
 
48
 
 
49
    // Top layout
 
50
    QVBoxLayout *top = new QVBoxLayout(this);
 
51
    top->setMargin(KDialog::marginHint());
 
52
    top->setSpacing(KDialog::spacingHint());
 
53
    top->addWidget(m_pCBEnable);
 
54
    top->addWidget(m_background);
 
55
    top->addStretch();
 
56
    connect(m_pCBEnable, SIGNAL(toggled(bool)), SLOT(slotEnableChanged()));
 
57
}
 
58
 
 
59
KBackground::~KBackground()
 
60
{
 
61
}
 
62
 
 
63
void KBackground::slotEnableChanged()
 
64
{
 
65
    bool en = m_pCBEnable->isChecked();
 
66
    m_background->setEnabled(en);
 
67
    emit changed();
 
68
}
 
69
 
 
70
void KBackground::load()
 
71
{
 
72
    m_pCBEnable->setChecked(config->group("X-*-Greeter").readEntry("UseBackground", true));
 
73
    m_background->load();
 
74
    slotEnableChanged();
 
75
}
 
76
 
 
77
 
 
78
void KBackground::save()
 
79
{
 
80
    config->group("X-*-Greeter").writeEntry("UseBackground", m_pCBEnable->isChecked());
 
81
    m_background->save();
 
82
}
 
83
 
 
84
void KBackground::defaults()
 
85
{
 
86
    m_pCBEnable->setChecked(true);
 
87
    slotEnableChanged();
 
88
    m_background->defaults();
 
89
}
 
90
 
 
91
#include "background.moc"