1 | /* |
2 | Copyright (C) 2002-2005, Jason Katz-Brown <jasonkb@mit.edu> |
3 | Copyright 2010 Stefan Majewsky <majewsky@gmx.net> |
4 | |
5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. |
9 | |
10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. |
14 | |
15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
18 | */ |
19 | |
20 | #include "config.h" |
21 | |
22 | #include <QLabel> |
23 | #include <QVBoxLayout> |
24 | #include <KDialog> |
25 | #include <KLocale> |
26 | |
27 | Config::Config(QWidget *parent) |
28 | : QFrame(parent) |
29 | { |
30 | startedUp = false; |
31 | } |
32 | |
33 | void Config::ctorDone() |
34 | { |
35 | startedUp = true; |
36 | } |
37 | |
38 | int Config::spacingHint() |
39 | { |
40 | return KDialog::spacingHint() / 2; |
41 | } |
42 | |
43 | int Config::marginHint() |
44 | { |
45 | return KDialog::marginHint(); |
46 | } |
47 | |
48 | void Config::changed() |
49 | { |
50 | if (startedUp) |
51 | emit modified(); |
52 | } |
53 | |
54 | MessageConfig::MessageConfig(const QString &text, QWidget *parent) |
55 | : Config(parent) |
56 | { |
57 | QVBoxLayout *layout = new QVBoxLayout(this); |
58 | layout->setMargin( marginHint() ); |
59 | layout->setSpacing( spacingHint() ); |
60 | layout->addWidget(new QLabel(text, this)); |
61 | } |
62 | |
63 | DefaultConfig::DefaultConfig(QWidget *parent) |
64 | : MessageConfig(i18n("No configuration options" ), parent) |
65 | { |
66 | } |
67 | |
68 | #include "config.moc" |
69 | |