cvsdiffpage.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include <qtextedit.h>
00013 #include <qlayout.h>
00014 #include <qregexp.h>
00015 #include <qdir.h>
00016 #include <qstringlist.h>
00017
00018 #include <kmessagebox.h>
00019 #include <kcursor.h>
00020 #include <klocale.h>
00021 #include <kdebug.h>
00022
00023 #include <cvsjob_stub.h>
00024 #include <cvsservice_stub.h>
00025
00026 #include "cvsoptions.h"
00027 #include "cvsdiffpage.h"
00028
00029 #include "diffwidget.h"
00030
00032
00034
00035 CVSDiffPage::CVSDiffPage( CvsService_stub *cvsService,
00036 QWidget *parent, const char *name, int )
00037
00038 : DCOPObject(),
00039 QWidget( parent, name? name : "logformdialog" ),
00040 m_diffText( 0 ), m_cvsService( cvsService ), m_cvsDiffJob( 0 )
00041 {
00042 QLayout *thisLayout = new QVBoxLayout( this );
00043
00044
00045
00046 m_diffText = new DiffWidget( this, "difftextedit" );
00047
00048 thisLayout->add( m_diffText );
00049 }
00050
00052
00053 CVSDiffPage::~CVSDiffPage()
00054 {
00055 kdDebug(9006) << "CVSDiffPage::~CVSDiffPage()" << endl;
00056 cancel();
00057 delete m_cvsDiffJob;
00058 }
00059
00061
00062 void CVSDiffPage::startDiff( const QString &fileName, const QString &v1, const QString &v2 )
00063 {
00064 kdDebug(9006) << "CVSDiffPage::startDiff()" << endl;
00065
00066 if ( v1.isEmpty() || v2.isEmpty() )
00067 {
00068 KMessageBox::error( this, i18n("Error: passed revisions are empty!"), i18n( "Error During Diff") );
00069 return;
00070 }
00071
00072 CvsOptions *options = CvsOptions::instance();
00073 DCOPRef job = m_cvsService->diff( fileName, v1, v2, options->diffOptions(), options->contextLines() );
00074 m_cvsDiffJob = new CvsJob_stub( job.app(), job.obj() );
00075
00076 kdDebug(9006) << "Running command : " << m_cvsDiffJob->cvsCommand() << endl;
00077 connectDCOPSignal( job.app(), job.obj(), "jobExited(bool, int)", "slotJobExited(bool, int)", true );
00078
00079 bool success = m_cvsDiffJob->execute();
00080 if (!success)
00081 {
00082 kdDebug(9006) << "Argh ... cannot start the diff job!" << endl;
00083 }
00084 }
00085
00087
00088 void CVSDiffPage::slotJobExited( bool normalExit, int )
00089 {
00090 kdDebug(9006) << "CVSDiffPage::slotJobExited(bool, int)" << endl;
00091
00092 if (normalExit)
00093 {
00094 QString diffText = m_cvsDiffJob->output().join( "\n" );
00095 kdDebug(9006) << "*** Received: " << diffText << endl;
00096
00097 m_diffText->setDiff( diffText );
00098 }
00099 else
00100 {
00101 KMessageBox::error( this, i18n("An error occurred during diffing."), i18n( "Error During Diff"));
00102 }
00103 }
00104
00106
00107 void CVSDiffPage::slotReceivedOutput( QString someOutput )
00108 {
00109 kdDebug(9006) << "CVSDiffPage::slotReceivedOutput(QString)" << endl;
00110 kdDebug(9006) << "OUTPUT: " << someOutput << endl;
00111 }
00112
00114
00115 void CVSDiffPage::slotReceivedErrors( QString someErrors )
00116 {
00117 kdDebug(9006) << "CVSDiffPage::slotReceivedErrors(QString)" << endl;
00118 kdDebug(9006) << "ERRORS: " << someErrors << endl;
00119 }
00120
00122
00123 void CVSDiffPage::cancel()
00124 {
00125 if (m_cvsDiffJob && m_cvsDiffJob->isRunning())
00126 m_cvsDiffJob->cancel();
00127 }
00128
00129 #include "cvsdiffpage.moc"
00130
00131
This file is part of the documentation for KDevelop Version 3.1.2.