Commit 08668f3d authored by Christian Loose's avatar Christian Loose

Use DCOP service to retrieve Tags and Branches for TagDialog,

MergeDialog und UpdateDialog

svn path=/trunk/kdesdk/cervisia/; revision=199032
parent cbead455
2003-01-11 Christian Loose <christian.loose@hamburg.de>
* Added help button to CommitDialog
* Use DCOP service to retrieve Tags and Branches for TagDialog,
MergeDialog und UpdateDialog
2003-01-09 Christian Loose <christian.loose@hamburg.de>
......
......@@ -750,7 +750,7 @@ void CervisiaPart::slotStatus()
void CervisiaPart::slotUpdateToTag()
{
UpdateDialog *l = new UpdateDialog(sandbox, repository, widget() );
UpdateDialog *l = new UpdateDialog(cvsService, widget() );
if (l->exec())
{
......@@ -786,7 +786,7 @@ void CervisiaPart::slotRevert()
void CervisiaPart::slotMerge()
{
MergeDialog *l = new MergeDialog(sandbox, repository, widget() );
MergeDialog *l = new MergeDialog(cvsService, widget() );
if (l->exec())
{
......@@ -1304,7 +1304,7 @@ void CervisiaPart::createOrDeleteTag(TagDialog::ActionType action)
if (list.isEmpty())
return;
TagDialog *l = new TagDialog(action, sandbox, repository, widget());
TagDialog *l = new TagDialog(action, cvsService, widget());
if (l->exec())
{
......
......@@ -24,14 +24,14 @@
#include <klocale.h>
#include "misc.h"
#include "cvsservice_stub.h"
MergeDialog::MergeDialog(const QString &sbox, const QString &repo,
MergeDialog::MergeDialog(CvsService_stub* service,
QWidget *parent, const char *name)
: KDialogBase(parent, name, true, i18n("CVS Merge"),
Ok | Cancel, Ok, true),
sandbox(sbox),
repository(repo)
cvsService(service)
{
int const iComboBoxMinWidth(30 * fontMetrics().width('0'));
int const iWidgetIndent(style().pixelMetric(QStyle::PM_ExclusiveIndicatorWidth, 0) + 6);
......@@ -121,7 +121,7 @@ QString MergeDialog::tag2() const
void MergeDialog::tagButtonClicked()
{
QStringList const listTags(::fetchTags(sandbox, repository, this));
QStringList const listTags(::fetchTags(cvsService, this));
tag1_combo->clear();
tag1_combo->insertStringList(listTags);
tag2_combo->clear();
......@@ -132,7 +132,7 @@ void MergeDialog::tagButtonClicked()
void MergeDialog::branchButtonClicked()
{
branch_combo->clear();
branch_combo->insertStringList(::fetchBranches(sandbox, repository, this));
branch_combo->insertStringList(::fetchBranches(cvsService, this));
}
......
......@@ -22,6 +22,7 @@
class QComboBox;
class QPushButton;
class QRadioButton;
class CvsService_stub;
class MergeDialog : public KDialogBase
......@@ -29,7 +30,7 @@ class MergeDialog : public KDialogBase
Q_OBJECT
public:
MergeDialog( const QString &sbox, const QString &repo,
MergeDialog( CvsService_stub* service,
QWidget *parent=0, const char *name=0 );
bool byBranch() const;
......@@ -43,8 +44,7 @@ private slots:
void branchButtonClicked();
private:
QString sandbox, repository;
CvsService_stub* cvsService;
QRadioButton *bybranch_button, *bytags_button;
QComboBox *branch_combo, *tag1_combo, *tag2_combo;
......
......@@ -28,13 +28,14 @@
#include "config.h"
#include "cervisiapart.h"
#include "cvsprogressdlg.h"
#include "cvsservice_stub.h"
#include "progressdlg.h"
namespace
{
QStringList const fetchBranchesAndTags(QString const& rsSearchedType,
QString const& rsSandbox,
QString const& rsRepository,
CvsService_stub* cvsService,
QWidget* pParentWidget);
}
......@@ -150,24 +151,20 @@ QString cvsClient( QString sRepository )
}
QStringList const fetchBranches(QString const& rsSandbox,
QString const& rsRepository,
QStringList const fetchBranches(CvsService_stub* cvsService,
QWidget* pParentWidget)
{
return fetchBranchesAndTags(QString::fromLatin1("branch"),
rsSandbox,
rsRepository,
cvsService,
pParentWidget);
}
QStringList const fetchTags(QString const& rsSandbox,
QString const& rsRepository,
QStringList const fetchTags(CvsService_stub* cvsService,
QWidget* pParentWidget)
{
return fetchBranchesAndTags(QString::fromLatin1("revision"),
rsSandbox,
rsRepository,
cvsService,
pParentWidget);
}
......@@ -235,20 +232,21 @@ QTextCodec *detectCodec(const QString &fileName)
namespace
{
QStringList const fetchBranchesAndTags(QString const& rsSearchedType,
QString const& rsSandbox,
QString const& rsRepository,
CvsService_stub* cvsService,
QWidget* pParentWidget)
{
QString const sCmdLine(::cvsClient(rsRepository) + QString::fromLatin1(" status -v"));
CvsProgressDialog stProgressDialog("Status", pParentWidget);
stProgressDialog.setCaption(i18n("CVS Status"));
QStringList listBranchesOrTags;
if (stProgressDialog.execCommand(rsSandbox, rsRepository, sCmdLine, QString::null))
DCOPRef job = cvsService->status(QString::null, true, true);
if( !cvsService->ok() )
return listBranchesOrTags;
ProgressDialog dlg(pParentWidget, "Status", job, QString::null, i18n("CVS Status"));
if (dlg.execute())
{
QString sLine;
while (stProgressDialog.getOneLine(&sLine))
while (dlg.getLine(sLine))
{
int pos1, pos2, pos3;
if (sLine.isEmpty() || sLine[0] != '\t')
......
......@@ -21,6 +21,7 @@ class QString;
class QStringList;
class QTextCodec;
class QWidget;
class CvsService_stub;
void chomp(QCString *line);
......@@ -35,11 +36,9 @@ QTextCodec *detectCodec(const QString &fileName);
bool isValidTag(const QString &str);
QString cvsClient(QString sRepository);
QStringList const fetchBranches(QString const& rsSandbox,
QString const& rsRepository,
QStringList const fetchBranches(CvsService_stub* cvsService,
QWidget* pParentWidget);
QStringList const fetchTags(QString const& rsSandbox,
QString const& rsRepository,
QStringList const fetchTags(CvsService_stub* cvsService,
QWidget* pParentWidget);
......
......@@ -24,15 +24,15 @@
#include <kmessagebox.h>
#include "misc.h"
#include "cvsservice_stub.h"
TagDialog::TagDialog(ActionType action, const QString &sbox, const QString &repo,
TagDialog::TagDialog(ActionType action, CvsService_stub* service,
QWidget *parent, const char *name)
: KDialogBase(parent, name, true, QString::null,
Ok | Cancel | Help, Ok, true),
act(action),
sandbox(sbox),
repository(repo),
cvsService(service),
branchtag_button(0),
forcetag_button(0)
{
......@@ -128,7 +128,7 @@ void TagDialog::slotOk()
void TagDialog::tagButtonClicked()
{
tag_combo->clear();
tag_combo->insertStringList(::fetchTags(sandbox, repository, this));
tag_combo->insertStringList(::fetchTags(cvsService, this));
}
......
......@@ -22,6 +22,7 @@
class QCheckBox;
class QComboBox;
class QLineEdit;
class CvsService_stub;
class TagDialog : public KDialogBase
......@@ -31,7 +32,7 @@ class TagDialog : public KDialogBase
public:
enum ActionType { Create, Delete };
TagDialog( ActionType action, const QString &sbox, const QString &repo,
TagDialog( ActionType action, CvsService_stub* service,
QWidget *parent=0, const char *name=0 );
bool branchTag() const;
......@@ -46,7 +47,7 @@ private slots:
private:
ActionType act;
QString sandbox, repository;
CvsService_stub* cvsService;
QCheckBox *branchtag_button;
QCheckBox *forcetag_button;
......
......@@ -24,14 +24,14 @@
#include <klocale.h>
#include "misc.h"
#include "cvsservice_stub.h"
UpdateDialog::UpdateDialog(const QString &sbox, const QString &repo,
UpdateDialog::UpdateDialog(CvsService_stub* service,
QWidget *parent, const char *name)
: KDialogBase(parent, name, true, i18n("CVS Update"),
Ok | Cancel, Ok, true),
sandbox(sbox),
repository(repo)
cvsService(service)
{
int const iComboBoxMinWidth(40 * fontMetrics().width('0'));
int const iWidgetIndent(style().pixelMetric(QStyle::PM_ExclusiveIndicatorWidth, 0) + 6);
......@@ -117,14 +117,14 @@ QString UpdateDialog::date() const
void UpdateDialog::tagButtonClicked()
{
tag_combo->clear();
tag_combo->insertStringList(::fetchTags(sandbox, repository, this));
tag_combo->insertStringList(::fetchTags(cvsService, this));
}
void UpdateDialog::branchButtonClicked()
{
branch_combo->clear();
branch_combo->insertStringList(::fetchBranches(sandbox, repository, this));
branch_combo->insertStringList(::fetchBranches(cvsService, this));
}
......
......@@ -23,6 +23,7 @@ class QComboBox;
class QPushButton;
class QRadioButton;
class KLineEdit;
class CvsService_stub;
class UpdateDialog : public KDialogBase
......@@ -30,7 +31,7 @@ class UpdateDialog : public KDialogBase
Q_OBJECT
public:
UpdateDialog( const QString &sbox, const QString &repo,
UpdateDialog( CvsService_stub* service,
QWidget *parent=0, const char *name=0 );
bool byTag() const;
......@@ -43,8 +44,7 @@ private slots:
void branchButtonClicked();
private:
QString sandbox, repository;
CvsService_stub* cvsService;
QRadioButton *bytag_button, *bybranch_button, *bydate_button;
QComboBox *tag_combo, *branch_combo;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment