From 114a878c64ce6f8223cfd22d76a20eb16d177e5e Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: 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/kdevelop@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- vcs/cvsservice/editorsdialog.cpp | 134 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 vcs/cvsservice/editorsdialog.cpp (limited to 'vcs/cvsservice/editorsdialog.cpp') diff --git a/vcs/cvsservice/editorsdialog.cpp b/vcs/cvsservice/editorsdialog.cpp new file mode 100644 index 00000000..12319102 --- /dev/null +++ b/vcs/cvsservice/editorsdialog.cpp @@ -0,0 +1,134 @@ +/*************************************************************************** + * Copyright (C) 2004 by Robert Gruber * + * rgruber@users.sourceforge.net * + * * + * 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. * + * * + ***************************************************************************/ + +#include +#include +#include +#include +#include + +#include +#include + +#include "editorsdialog.h" + +//dcop connection to cervisia +#include +#include + +EditorsDialog::EditorsDialog(CvsService_stub *cvsService, QWidget *parent, const char *name) + : DCOPObject( "CvsEditorsDCOPIface"), EditorsDialogBase(parent, name, TRUE, Qt::WDestructiveClose), + m_cvsService(cvsService), m_cvsJob(0) +{ +} + +EditorsDialog::~EditorsDialog() +{ + kdDebug(9006) << "EditorsDialog::~EditorsDialog"<< endl; + + if (m_cvsJob && m_cvsJob->isRunning()) { + m_cvsJob->cancel(); + } + if (m_cvsJob) + delete m_cvsJob; +} + +void EditorsDialog::startjob(QString strDir) +{ + kdDebug(9006) << "EditorsDialog::start() workDir = " << strDir << endl; + + DCOPRef job = m_cvsService->editors( strDir ); + m_cvsJob = new CvsJob_stub( job.app(), job.obj() ); + + // establish connections to the signals of the cvs m_job + connectDCOPSignal( job.app(), job.obj(), "jobExited(bool, int)", "slotJobExited(bool, int)", true ); + // We'll read the ouput directly from the job ... + connectDCOPSignal( job.app(), job.obj(), "receivedStdout(QString)", "slotReceivedOutput(QString)", true ); + + kdDebug(9006) << "Running: " << m_cvsJob->cvsCommand() << endl; + m_cvsJob->execute(); +} + +void EditorsDialog::slotJobExited( bool normalExit, int exitStatus ) +{ + if (!normalExit) + { + KMessageBox::sorry( this, i18n("Log failed with exitStatus == %1").arg( exitStatus), i18n("Log Failed") ); + return; + } + + static QRegExp re("([^\\s]+)\\s([^\\s]+)\\s([^\\s]+)\\s([^\\s]+)\\s([^\\s]+)\\s" + "([^\\s]+)\\s([^\\s]+)\\s([^\\s]+)\\s([^\\s]+)\\s(.*)"); + static QRegExp subre("([^\\s]+)\\s([^\\s]+)\\s([^\\s]+)\\s([^\\s]+)\\s" + "([^\\s]+)\\s([^\\s]+)\\s([^\\s]+)\\s([^\\s]+)\\s(.*)"); + QString lastfilename; + + QStringList lines = QStringList::split( "\n", m_output ); + int found = 0; + for (size_t i=0; iappend( ""+i18n("File")+": "+file+"" ); + m_textBrowser->append( ""+i18n("User")+": "+locker ); + m_textBrowser->append( ""+i18n("Date")+": "+date ); + m_textBrowser->append( "
" ); + found++; + + lastfilename = file; + } else { + if (subre.exactMatch(s)) { + QString file = lastfilename; + QString locker = subre.cap( 1 ); + QString date = subre.cap(4)+" "+subre.cap(3)+" "+subre.cap(6)+" "+subre.cap(5); + + m_textBrowser->append( ""+i18n("File")+": "+file+"" ); + m_textBrowser->append( ""+i18n("User")+": "+locker ); + m_textBrowser->append( ""+i18n("Date")+": "+date ); + m_textBrowser->append( "
" ); + found++; + } + } + } + + if (!found) + m_textBrowser->append(i18n("No files from your query are marked as being edited.")); + + m_textBrowser->source(); + + if (m_cvsJob) { + disconnectDCOPSignal( m_cvsJob->app(), m_cvsJob->obj(), "jobExited(bool, int)", "slotJobExited(bool, int)" ); + delete m_cvsJob; + m_cvsJob=NULL; + } +} + +void EditorsDialog::slotReceivedOutput( QString someOutput ) +{ + kdDebug(9006) << "OUTPUT: " << someOutput << endl; + + m_output += someOutput; //append the whole output into one large QStrin +} + +/////////////////////////////////////////////////////////////////////////////// + +void EditorsDialog::slotReceivedErrors( QString someErrors ) +{ + kdDebug(9006) << "ERRORS: " << someErrors << endl; +} + +#include "editorsdialog.moc" -- cgit v1.2.3