1 | /* This file is part of the KDE libraries |
2 | Copyright (C) 2004 George Staikos <staikos@kde.org> |
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 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
17 | */ |
18 | |
19 | #include "kbetterthankdialog.h" |
20 | #include <kicon.h> |
21 | |
22 | KBetterThanKDialog::KBetterThanKDialog( QWidget *parent ) |
23 | : QDialog( parent ) |
24 | { |
25 | setupUi( this ); |
26 | connect(_allowOnce, SIGNAL(clicked()), this, SLOT(allowOnceClicked())); |
27 | connect(_allowAlways, SIGNAL(clicked()), this, SLOT(allowAlwaysClicked())); |
28 | connect(_deny, SIGNAL(clicked()), this, SLOT(denyClicked())); |
29 | connect(_denyForever, SIGNAL(clicked()), this, SLOT(denyForeverClicked())); |
30 | |
31 | init(); |
32 | } |
33 | |
34 | void KBetterThanKDialog::init() |
35 | { |
36 | _allowOnce->setIcon(KIcon("dialog-ok" )); |
37 | _allowAlways->setIcon(KIcon("dialog-ok" )); |
38 | _deny->setIcon(KIcon("dialog-cancel" )); |
39 | _denyForever->setIcon(KIcon("dialog-cancel" )); |
40 | |
41 | _allowOnce->setFocus(); |
42 | } |
43 | |
44 | void KBetterThanKDialog::setLabel( const QString & label ) |
45 | { |
46 | _label->setText(label); |
47 | } |
48 | |
49 | void KBetterThanKDialog::accept() |
50 | { |
51 | setResult(0); |
52 | } |
53 | |
54 | void KBetterThanKDialog::reject() |
55 | { |
56 | QDialog::reject(); |
57 | setResult(2); |
58 | } |
59 | |
60 | void KBetterThanKDialog::allowOnceClicked() |
61 | { |
62 | done(0); |
63 | } |
64 | |
65 | void KBetterThanKDialog::allowAlwaysClicked() |
66 | { |
67 | done(1); |
68 | } |
69 | |
70 | void KBetterThanKDialog::denyClicked() |
71 | { |
72 | done(2); |
73 | } |
74 | |
75 | void KBetterThanKDialog::denyForeverClicked() |
76 | { |
77 | done(3); |
78 | } |
79 | |
80 | #include "kbetterthankdialog.moc" |
81 | |