Commit a62cd97d authored by Christian Loose's avatar Christian Loose
Browse files

Added new startJob() method to ProtocolView

that uses the new cvs DCOP service

svn path=/trunk/kdesdk/cervisia/; revision=197022
parent 4d78ea93
2003-01-02 Christian Loose <christian.loose@hamburg.de>
* Added new startJob() method to ProtocolView
that uses the new cvs DCOP service
2002-12-31 Christian Loose <christian.loose@hamburg.de>
* Separate GUI from functionality for AnnotateDialog
......
......@@ -6,9 +6,9 @@ AM_CPPFLAGS = -UQT_NO_COMPAT -D_BSD_SOURCE
bin_PROGRAMS = cervisia
kde_module_LTLIBRARIES = libcervisiapart.la
libcervisiapart_la_SOURCES = updateview.cpp protocolview.cpp watchdlg.cpp \
settingsdlg.cpp changelogdlg.cpp historydlg.cpp repositorydlg.cpp \
commitdlg.cpp checkoutdlg.cpp updatedlg.cpp \
libcervisiapart_la_SOURCES = updateview.cpp protocolview.cpp protocolview.skel \
watchdlg.cpp settingsdlg.cpp changelogdlg.cpp historydlg.cpp \
repositorydlg.cpp commitdlg.cpp checkoutdlg.cpp updatedlg.cpp \
tagdlg.cpp mergedlg.cpp \
logdlg.cpp logtree.cpp loglist.cpp diffdlg.cpp resolvedlg.cpp diffview.cpp \
annotatedlg.cpp annotateview.cpp progressdlg.cpp progressdlg.skel \
......
......@@ -16,6 +16,7 @@
#include <qdir.h>
#include <qpopupmenu.h>
#include <dcopref.h>
#include <kconfig.h>
#include <kglobalsettings.h>
#include <klocale.h>
......@@ -93,6 +94,30 @@ bool ProtocolView::startJob(const QString &sandbox, const QString &repository,
}
bool ProtocolView::startJob(DCOPRef& cvsJob)
{
// get command line and add it to output buffer
QString cmdLine = cvsJob.call("cvsCommand");
buf += cmdLine;
buf += '\n';
processOutput();
// establish connections to the signals of the cvs job
connectDCOPSignal(cvsJob.app(), cvsJob.obj(), "jobExited(bool, int)",
"slotJobExited(bool, int)", true);
connectDCOPSignal(cvsJob.app(), cvsJob.obj(), "receivedStdout(QString)",
"slotReceivedOutput(QString)", true);
connectDCOPSignal(cvsJob.app(), cvsJob.obj(), "receivedStderr(QString)",
"slotReceivedOutput(QString)", true);
// disconnect 3rd party slots from our signals
disconnect( SIGNAL(receivedLine(QString)) );
disconnect( SIGNAL(jobFinished(bool)) );
return (bool)cvsJob.call("execute");
}
void ProtocolView::cancelJob()
{
childproc->kill();
......@@ -129,6 +154,35 @@ void ProtocolView::childExited()
}
void ProtocolView::slotReceivedOutput(QString buffer)
{
buf += buffer;
processOutput();
}
void ProtocolView::slotJobExited(bool normalExit, int status)
{
QString msg;
if( normalExit )
{
if( status )
msg = i18n("[Exited with status %1]\n").arg(status);
else
msg = i18n("[Finished]\n");
}
else
msg = i18n("[Aborted]\n");
buf += '\n';
buf += msg;
processOutput();
emit jobFinished(normalExit && !status);
}
void ProtocolView::processOutput()
{
int pos;
......
......@@ -16,14 +16,16 @@
#define PROTOCOLVIEW_H
#include <qtextedit.h>
#include <dcopobject.h>
class DCOPRef;
class KProcess;
class KShellProcess;
class ProtocolView : public QTextEdit
class ProtocolView : public QTextEdit, public DCOPObject
{
K_DCOP
Q_OBJECT
public:
......@@ -31,6 +33,11 @@ public:
~ProtocolView();
bool startJob(const QString &sandbox, const QString &repository, const QString &cmdline);
bool startJob(DCOPRef& cvsJob);
k_dcop:
void slotReceivedOutput(QString buffer);
void slotJobExited(bool normalExit, int status);
signals:
void receivedLine(QString line);
......@@ -44,7 +51,7 @@ private slots:
void receivedOutput(KProcess *proc, char *buffer, int buflen);
void childExited();
void cancelJob();
private:
void processOutput();
void appendLine(const QString &line);
......
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