~ubuntu-branches/ubuntu/intrepid/kdesdk/intrepid-updates

« back to all changes in this revision

Viewing changes to cervisia/watchdlg.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2008-05-28 10:11:43 UTC
  • mto: This revision was merged to the branch mainline in revision 37.
  • Revision ID: james.westby@ubuntu.com-20080528101143-gzc3styjz1b70zxu
Tags: upstream-4.0.80
ImportĀ upstreamĀ versionĀ 4.0.80

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* 
2
 
 *  Copyright (C) 1999-2002 Bernd Gehrmann
3
 
 *                          bernd@mail.berlios.de
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
 
 
21
 
#include "watchdlg.h"
22
 
 
23
 
#include <qbuttongroup.h>
24
 
#include <qcheckbox.h>
25
 
#include <qlabel.h>
26
 
#include <qlayout.h>
27
 
#include <qradiobutton.h>
28
 
#include <klocale.h>
29
 
 
30
 
 
31
 
WatchDialog::WatchDialog(ActionType action, QWidget *parent, const char *name)
32
 
    : KDialogBase(parent, name, true, QString::null,
33
 
                  Ok | Cancel | Help, Ok, true)
34
 
{
35
 
    setCaption( (action==Add)? i18n("CVS Watch Add") : i18n("CVS Watch Remove") );
36
 
 
37
 
    QFrame* mainWidget = makeMainWidget();
38
 
 
39
 
    QBoxLayout *layout = new QVBoxLayout(mainWidget, 0, spacingHint());
40
 
 
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);
45
 
 
46
 
    all_button = new QRadioButton(i18n("&All"), mainWidget);
47
 
    all_button->setFocus();
48
 
    all_button->setChecked(true);
49
 
    layout->addWidget(all_button);
50
 
    
51
 
    only_button = new QRadioButton(i18n("&Only:"), mainWidget);
52
 
    layout->addWidget(only_button);
53
 
 
54
 
    QGridLayout *eventslayout = new QGridLayout(layout);
55
 
    eventslayout->addColSpacing(0, 20);
56
 
    eventslayout->setColStretch(0, 0);
57
 
    eventslayout->setColStretch(1, 1);
58
 
    
59
 
    commitbox = new QCheckBox(i18n("&Commits"), mainWidget);
60
 
    commitbox->setEnabled(false);
61
 
    eventslayout->addWidget(commitbox, 0, 1);
62
 
    
63
 
    editbox = new QCheckBox(i18n("&Edits"), mainWidget);
64
 
    editbox->setEnabled(false);
65
 
    eventslayout->addWidget(editbox, 1, 1);
66
 
 
67
 
    uneditbox = new QCheckBox(i18n("&Unedits"), mainWidget);
68
 
    uneditbox->setEnabled(false);
69
 
    eventslayout->addWidget(uneditbox, 2, 1);
70
 
 
71
 
    QButtonGroup* group = new QButtonGroup(mainWidget);
72
 
    group->hide();
73
 
    group->insert(all_button);
74
 
    group->insert(only_button);
75
 
 
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)) );
82
 
 
83
 
    setHelp("watches");
84
 
}
85
 
 
86
 
 
87
 
WatchDialog::Events WatchDialog::events() const
88
 
{
89
 
    Events res = None;
90
 
    if (all_button->isChecked())
91
 
        res = All;
92
 
    else
93
 
        {
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);
100
 
        }
101
 
    return res;
102
 
}
103
 
 
104
 
 
105
 
// Local Variables:
106
 
// c-basic-offset: 4
107
 
// End: