~ubuntu-branches/ubuntu/gutsy/kdebase-workspace/gutsy

« back to all changes in this revision

Viewing changes to kicker/settings/positionconfig.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2007-09-05 20:45:14 UTC
  • Revision ID: james.westby@ubuntu.com-20070905204514-632hhspl0nvrc84i
Tags: upstream-3.93.0
ImportĀ upstreamĀ versionĀ 3.93.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  Copyright (c) 2005      Stefan Nikolaus <stefan.nikolaus@kdemail.net>
 
3
 *
 
4
 *  This program is free software; you can redistribute it and/or modify
 
5
 *  it under the terms of the GNU General Public License as published by
 
6
 *  the Free Software Foundation; either version 2 of the License, or
 
7
 *  (at your option) any later version.
 
8
 *
 
9
 *  This program is distributed in the hope that it will be useful,
 
10
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
 *  GNU General Public License for more details.
 
13
 *
 
14
 *  You should have received a copy of the GNU General Public License
 
15
 *  along with this program; if not, write to the Free Software
 
16
 */
 
17
 
 
18
#include <QLayout>
 
19
#include <QTimer>
 
20
 
 
21
#include <klocale.h>
 
22
#include <kdebug.h>
 
23
 
 
24
#include "positiontab_impl.h"
 
25
#include "kickerSettings.h"
 
26
#include "main.h"
 
27
 
 
28
#include "positionconfig.h"
 
29
#include "positionconfig.moc"
 
30
 
 
31
PositionConfig::PositionConfig(QWidget *parent, const char *name)
 
32
  : KCModule(parent, name)
 
33
{
 
34
    QVBoxLayout *layout = new QVBoxLayout(this);
 
35
    m_widget = new PositionTab(this);
 
36
    layout->addWidget(m_widget);
 
37
    layout->addStretch();
 
38
 
 
39
    setQuickHelp(KickerConfig::self()->quickHelp());
 
40
    setAboutData(KickerConfig::self()->aboutData());
 
41
 
 
42
    //addConfig(KickerSettings::self(), m_widget);
 
43
 
 
44
    connect(m_widget, SIGNAL(changed()),
 
45
            this, SLOT(changed()));
 
46
    connect(KickerConfig::self(), SIGNAL(aboutToNotifyKicker()),
 
47
            this, SLOT(aboutToNotifyKicker()));
 
48
 
 
49
    load();
 
50
    QTimer::singleShot(0, this, SLOT(notChanged()));
 
51
}
 
52
 
 
53
void PositionConfig::notChanged()
 
54
{
 
55
    emit changed(false);
 
56
}
 
57
 
 
58
void PositionConfig::load()
 
59
{
 
60
    m_widget->load();
 
61
    KCModule::load();
 
62
}
 
63
 
 
64
void PositionConfig::aboutToNotifyKicker()
 
65
{
 
66
    kDebug() << "PositionConfig::aboutToNotifyKicker()";
 
67
 
 
68
    // This slot is triggered by the signal,
 
69
    // which is send before Kicker is notified.
 
70
    // See comment in save().
 
71
    m_widget->save();
 
72
    KCModule::save();
 
73
}
 
74
 
 
75
void PositionConfig::save()
 
76
{
 
77
    // As we don't want to notify Kicker multiple times
 
78
    // we do not save the settings here. Instead the
 
79
    // KickerConfig object sends a signal before the
 
80
    // notification. On this signal all existing modules,
 
81
    // including this object, save their settings.
 
82
    KickerConfig::self()->notifyKicker();
 
83
}
 
84
 
 
85
void PositionConfig::defaults()
 
86
{
 
87
    m_widget->defaults();
 
88
    KCModule::defaults();
 
89
 
 
90
    // KConfigDialogManager may queue an changed(false) signal,
 
91
    // so we make sure, that the module is labeled as changed,
 
92
    // while we manage some of the widgets ourselves
 
93
    QTimer::singleShot(0, this, SLOT(changed()));
 
94
}