2
* Copyright (C) 1999-2002 Bernd Gehrmann
3
* bernd@mail.berlios.de
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.
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.
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.
23
#include <qbuttongroup.h>
24
#include <qcheckbox.h>
27
#include <qradiobutton.h>
31
WatchDialog::WatchDialog(ActionType action, QWidget *parent, const char *name)
32
: KDialogBase(parent, name, true, QString::null,
33
Ok | Cancel | Help, Ok, true)
35
setCaption( (action==Add)? i18n("CVS Watch Add") : i18n("CVS Watch Remove") );
37
QFrame* mainWidget = makeMainWidget();
39
QBoxLayout *layout = new QVBoxLayout(mainWidget, 0, spacingHint());
41
QLabel *textlabel = new QLabel
42
( (action==Add)? i18n("Add watches for the following events:")
43
: i18n("Remove watches for the following events:"), mainWidget );
44
layout->addWidget(textlabel, 0);
46
all_button = new QRadioButton(i18n("&All"), mainWidget);
47
all_button->setFocus();
48
all_button->setChecked(true);
49
layout->addWidget(all_button);
51
only_button = new QRadioButton(i18n("&Only:"), mainWidget);
52
layout->addWidget(only_button);
54
QGridLayout *eventslayout = new QGridLayout(layout);
55
eventslayout->addColSpacing(0, 20);
56
eventslayout->setColStretch(0, 0);
57
eventslayout->setColStretch(1, 1);
59
commitbox = new QCheckBox(i18n("&Commits"), mainWidget);
60
commitbox->setEnabled(false);
61
eventslayout->addWidget(commitbox, 0, 1);
63
editbox = new QCheckBox(i18n("&Edits"), mainWidget);
64
editbox->setEnabled(false);
65
eventslayout->addWidget(editbox, 1, 1);
67
uneditbox = new QCheckBox(i18n("&Unedits"), mainWidget);
68
uneditbox->setEnabled(false);
69
eventslayout->addWidget(uneditbox, 2, 1);
71
QButtonGroup* group = new QButtonGroup(mainWidget);
73
group->insert(all_button);
74
group->insert(only_button);
76
connect( only_button, SIGNAL(toggled(bool)),
77
commitbox, SLOT(setEnabled(bool)) );
78
connect( only_button, SIGNAL(toggled(bool)),
79
editbox, SLOT(setEnabled(bool)) );
80
connect( only_button, SIGNAL(toggled(bool)),
81
uneditbox, SLOT(setEnabled(bool)) );
87
WatchDialog::Events WatchDialog::events() const
90
if (all_button->isChecked())
94
if (commitbox->isChecked())
95
res = Events(res | Commits);
96
if (editbox->isChecked())
97
res = Events(res | Edits);
98
if (uneditbox->isChecked())
99
res = Events(res | Unedits);