1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
/*
* Copyright (c) 2003 Christian Loose <christian.loose@hamburg.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "watchersdlg.h"
#include <tqlayout.h>
#include <tqtable.h>
#include <kconfig.h>
#include <klineedit.h>
#include <klocale.h>
#include "misc.h"
#include "cvsservice_stub.h"
#include "progressdlg.h"
WatchersDialog::WatchersDialog(KConfig& cfg, TQWidget* tqparent, const char* name)
: KDialogBase(tqparent, name, false, TQString(),
Close, ButtonCode(0), true)
, partConfig(cfg)
{
TQFrame* mainWidget = makeMainWidget();
TQBoxLayout *tqlayout = new TQVBoxLayout(mainWidget, 0, spacingHint());
table = new TQTable(mainWidget, "watchersTable");
table->setNumCols(5);
table->setSelectionMode(TQTable::NoSelection);
table->setColumnMovingEnabled(false);
table->setRowMovingEnabled(false);
table->setReadOnly(true);
table->setDragEnabled(false);
table->setSorting(true);
table->verticalHeader()->hide();
table->setLeftMargin(0);
TQHeader* header = table->horizontalHeader();
header->setLabel(0, i18n("File"));
header->setLabel(1, i18n("Watcher"));
header->setLabel(2, i18n("Edit"));
header->setLabel(3, i18n("Unedit"));
header->setLabel(4, i18n("Commit"));
tqlayout->addWidget(table, 1);
setWFlags(TQt::WDestructiveClose | getWFlags());
TQSize size = configDialogSize(partConfig, "WatchersDialog");
resize(size);
}
WatchersDialog::~WatchersDialog()
{
saveDialogSize(partConfig, "WatchersDialog");
}
bool WatchersDialog::parseWatchers(CvsService_stub* cvsService,
const TQStringList& files)
{
setCaption(i18n("CVS Watchers"));
DCOPRef job = cvsService->watchers(files);
if( !cvsService->ok() )
return false;
ProgressDialog dlg(this, "Watchers", job, "watchers", i18n("CVS Watchers"));
if( !dlg.execute() )
return false;
TQString line;
int numRows = 0;
while( dlg.getLine(line) )
{
// parse the output line
TQStringList list = splitLine(line);
// ignore empty lines and unknown files
if( list.isEmpty() || list[0] == "?" )
continue;
// add a new row to the table
table->setNumRows(numRows + 1);
table->setText(numRows, 0, list[0]);
table->setText(numRows, 1, list[1]);
TQCheckTableItem* item = new TQCheckTableItem(table, "");
item->setChecked(list.contains("edit"));
table->setItem(numRows, 2, item);
item = new TQCheckTableItem(table, "");
item->setChecked(list.contains("unedit"));
table->setItem(numRows, 3, item);
item = new TQCheckTableItem(table, "");
item->setChecked(list.contains("commit"));
table->setItem(numRows, 4, item);
++numRows;
}
return true;
}
|