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

Use DCOP stubs to access the methods of the cvs DCOP service

svn path=/trunk/kdesdk/cervisia/; revision=198614
parent ed7764e6
......@@ -22,14 +22,15 @@
#include "annotatedlg.h"
#include "progressdlg.h"
#include "cvsservice_stub.h"
#include "cvsjob_stub.h"
struct AnnotateController::Private
{
typedef QMap<QString, QString> RevisionCommentMap;
RevisionCommentMap comments; // maps comment to a revision
RevisionCommentMap comments; // maps comment to a revision
DCOPRef* cvsService;
CvsService_stub* cvsService;
AnnotateDialog* dialog;
ProgressDialog* progress;
......@@ -39,7 +40,7 @@ struct AnnotateController::Private
};
AnnotateController::AnnotateController(AnnotateDialog* dialog, DCOPRef* cvsService)
AnnotateController::AnnotateController(AnnotateDialog* dialog, CvsService_stub* cvsService)
: d(new Private)
{
// initialize private data
......@@ -76,11 +77,10 @@ void AnnotateController::showDialog(const QString& fileName, const QString& revi
bool AnnotateController::Private::execute(const QString& fileName, const QString& revision)
{
DCOPReply job = cvsService->call("annotate(QString, QString)", fileName, revision);
if( !job.isValid() )
DCOPRef job = cvsService->annotate(fileName, revision);
if( !cvsService->ok() )
return false;
progress = new ProgressDialog(dialog, "Annotate", job, "annotate", i18n("CVS Annotate"));
return progress->execute();
......
......@@ -17,14 +17,14 @@
#include <qstring.h>
class AnnotateDialog;
class DCOPRef;
class CvsService_stub;
class QWidget;
class AnnotateController
{
public:
AnnotateController(AnnotateDialog* dialog, DCOPRef* cvsService);
AnnotateController(AnnotateDialog* dialog, CvsService_stub* cvsService);
~AnnotateController();
void showDialog(const QString& fileName, const QString& revision = "");
......
......@@ -50,6 +50,7 @@
#include "settingsdlg.h"
#include "changelogdlg.h"
#include "misc.h"
#include "cvsservice_stub.h"
#include "cervisiapart.h"
#include "version.h"
......@@ -116,13 +117,14 @@ CervisiaPart::CervisiaPart( QWidget *parentWidget, const char *widgetName,
}
// create a reference to the service
cvsService.setRef(appId, "CvsService");
cvsService = new CvsService_stub(appId, "CvsService");
}
CervisiaPart::~CervisiaPart()
{
// stop the cvs DCOP service
cvsService.send("quit");
// stop the cvs DCOP service and delete reference
cvsService->quit();
delete cvsService;
}
KConfig *CervisiaPart::config()
......@@ -820,14 +822,9 @@ void CervisiaPart::updateOrStatus(bool noact, const QString &extraopt)
// TODO: cleanup when update is also handled by DCOP service
if( noact )
{
DCOPRef cvsJob;
QString files = joinLine(list);
DCOPReply job = cvsService.call("status(QString, bool)", files, opt_updateRecursive);
if( job.isValid() )
cvsJob = job;
else
return;
DCOPRef cvsJob = cvsService->status(files, opt_updateRecursive);
// get command line from cvs job
QString cmdline;
......@@ -998,7 +995,7 @@ void CervisiaPart::slotAnnotate()
// Non-modal dialog
AnnotateDialog *l = new AnnotateDialog();
AnnotateController ctl(l, &cvsService);
AnnotateController ctl(l, cvsService);
ctl.showDialog(filename);
}
......@@ -1507,9 +1504,9 @@ void CervisiaPart::slotJobFinished(bool)
void CervisiaPart::openSandbox(const QString &dirname)
{
// change the working copy directory for the cvs DCOP service
DCOPReply opened = cvsService.call("setWorkingCopy(QString)", dirname);
bool opened = cvsService->setWorkingCopy(dirname);
if( !opened.isValid() || !opened )
if( !cvsService->ok() || !opened )
{
KMessageBox::sorry(widget(),
i18n("This is not a CVS directory.\n"
......@@ -1529,19 +1526,11 @@ void CervisiaPart::openSandbox(const QString &dirname)
repository = "";
// get path of sandbox for recent sandbox menu
DCOPReply sandboxPath = cvsService.call("workingCopy()");
if( !sandboxPath.isValid() )
return;
else
sandboxPath.get<QString>(sandbox);
sandbox = cvsService->workingCopy();
recent->addURL( KURL::fromPathOrURL(sandbox) );
// get repository for the caption of the window
DCOPReply repositoryLocation = cvsService.call("repository()");
if( !repositoryLocation.isValid() )
return;
else
repositoryLocation.get<QString>(repository);
repository = cvsService->repository();
emit setWindowCaption(sandbox + "(" + repository + ")");
QDir::setCurrent(sandbox);
......
......@@ -15,7 +15,6 @@
#ifndef CERVISIAPART_H
#define CERVISIAPART_H
#include <dcopref.h>
#include <kparts/part.h>
#include <kparts/browserextension.h>
#include <kparts/genericfactory.h>
......@@ -32,7 +31,7 @@ class UpdateView;
class ProtocolView;
class KAboutData;
class KRecentFilesAction;
class CvsService_stub;
/**
* An embeddable Cervisia viewer.
......@@ -164,8 +163,8 @@ private:
//for the Open Recent directories
KRecentFilesAction *recent;
DCOPRef cvsService;
CvsService_stub* cvsService;
};
typedef KParts::GenericFactory<CervisiaPart> CervisiaFactory;
......
......@@ -28,6 +28,7 @@
#include <kprocess.h>
#include <krfcdate.h>
#include "cvsservice_stub.h"
#include "annotatedlg.h"
#include "annotatectl.h"
#include "diffdlg.h"
......@@ -43,6 +44,7 @@ LogDialog::Options *LogDialog::options = 0;
LogDialog::LogDialog(QWidget *parent, const char *name)
: KDialogBase(parent, name, false, QString::null,
Close | Help | User1 | User2, Close, true)
, cvsService(0)
{
QFrame* mainWidget = makeMainWidget();
......@@ -192,7 +194,7 @@ void LogDialog::saveOptions(KConfig *config)
}
bool LogDialog::parseCvsLog(DCOPRef& service, const QString& fileName)
bool LogDialog::parseCvsLog(CvsService_stub* service, const QString& fileName)
{
QString tag, rev, author, comment;
QDateTime date;
......@@ -205,15 +207,13 @@ bool LogDialog::parseCvsLog(DCOPRef& service, const QString& fileName)
// get sandbox and repository from cvs DCOP service for diffClicked()
// FIXME: get rid when DiffDialog is moved to DCOP service
DCOPReply sandboxPath = cvsService.call("workingCopy()");
sandboxPath.get<QString>(sandbox);
DCOPReply repositoryLocation = cvsService.call("repository()");
repositoryLocation.get<QString>(repository);
sandbox = cvsService->workingCopy();
repository = cvsService->repository();
setCaption(i18n("CVS Log: %1").arg(filename));
DCOPReply job = cvsService.call("log(QString)", filename);
if( !job.isValid() )
DCOPRef job = cvsService->log(filename);
if( !cvsService->ok() )
return false;
ProgressDialog dlg(this, "Logging", job, "log", i18n("CVS Log"));
......@@ -405,7 +405,7 @@ void LogDialog::diffClicked()
void LogDialog::annotateClicked()
{
AnnotateDialog *l = new AnnotateDialog();
AnnotateController ctl(l, &cvsService);
AnnotateController ctl(l, cvsService);
ctl.showDialog(filename, selectionA);
}
......
......@@ -15,7 +15,6 @@
#ifndef LOGDLG_H
#define LOGDLG_H
#include <dcopref.h>
#include <kdialogbase.h>
#include <qdatetime.h>
......@@ -31,7 +30,7 @@ class QComboBox;
class QLabel;
class QTabWidget;
class QTextEdit;
class CvsService_stub;
class RevisionInfo
{
......@@ -63,7 +62,7 @@ public:
virtual ~LogDialog();
bool parseCvsLog(DCOPRef& service, const QString& fileName);
bool parseCvsLog(CvsService_stub* service, const QString& fileName);
static void loadOptions(KConfig *config);
static void saveOptions(KConfig *config);
......@@ -100,7 +99,7 @@ private:
QTextEdit *tagsbox[2];
QComboBox *tagcombo[2];
DCOPRef cvsService;
CvsService_stub* cvsService;
};
#endif
......
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