summaryrefslogtreecommitdiffstats
path: root/cervisia/watchersdlg.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitbd9e6617827818fd043452c08c606f07b78014a0 (patch)
tree425bb4c3168f9c02f10150f235d2cb998dcc6108 /cervisia/watchersdlg.cpp
downloadtdesdk-bd9e6617827818fd043452c08c606f07b78014a0.tar.gz
tdesdk-bd9e6617827818fd043452c08c606f07b78014a0.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdesdk@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'cervisia/watchersdlg.cpp')
-rw-r--r--cervisia/watchersdlg.cpp121
1 files changed, 121 insertions, 0 deletions
diff --git a/cervisia/watchersdlg.cpp b/cervisia/watchersdlg.cpp
new file mode 100644
index 00000000..d7d849bd
--- /dev/null
+++ b/cervisia/watchersdlg.cpp
@@ -0,0 +1,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 <qlayout.h>
+#include <qtable.h>
+#include <kconfig.h>
+#include <klineedit.h>
+#include <klocale.h>
+
+#include "misc.h"
+#include "cvsservice_stub.h"
+#include "progressdlg.h"
+
+
+WatchersDialog::WatchersDialog(KConfig& cfg, QWidget* parent, const char* name)
+ : KDialogBase(parent, name, false, QString::null,
+ Close, ButtonCode(0), true)
+ , partConfig(cfg)
+{
+ QFrame* mainWidget = makeMainWidget();
+
+ QBoxLayout *layout = new QVBoxLayout(mainWidget, 0, spacingHint());
+
+ table = new QTable(mainWidget, "watchersTable");
+ table->setNumCols(5);
+ table->setSelectionMode(QTable::NoSelection);
+ table->setColumnMovingEnabled(false);
+ table->setRowMovingEnabled(false);
+ table->setReadOnly(true);
+ table->setDragEnabled(false);
+ table->setSorting(true);
+ table->verticalHeader()->hide();
+ table->setLeftMargin(0);
+
+ QHeader* 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"));
+
+ layout->addWidget(table, 1);
+
+ setWFlags(Qt::WDestructiveClose | getWFlags());
+
+ QSize size = configDialogSize(partConfig, "WatchersDialog");
+ resize(size);
+}
+
+
+WatchersDialog::~WatchersDialog()
+{
+ saveDialogSize(partConfig, "WatchersDialog");
+}
+
+
+bool WatchersDialog::parseWatchers(CvsService_stub* cvsService,
+ const QStringList& 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;
+
+ QString line;
+ int numRows = 0;
+ while( dlg.getLine(line) )
+ {
+ // parse the output line
+ QStringList 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]);
+
+ QCheckTableItem* item = new QCheckTableItem(table, "");
+ item->setChecked(list.contains("edit"));
+ table->setItem(numRows, 2, item);
+
+ item = new QCheckTableItem(table, "");
+ item->setChecked(list.contains("unedit"));
+ table->setItem(numRows, 3, item);
+
+ item = new QCheckTableItem(table, "");
+ item->setChecked(list.contains("commit"));
+ table->setItem(numRows, 4, item);
+
+ ++numRows;
+ }
+
+ return true;
+}