KDevelop API Documentation

vcs/cvsservice/cvsdiffpage.cpp

Go to the documentation of this file.
00001 /*************************************************************************** 00002 * Copyright (C) 200?-2003 by KDevelop Authors * 00003 * www.kdevelop.org * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 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 // class CVSDiffPage 00034 00035 CVSDiffPage::CVSDiffPage( CvsService_stub *cvsService, 00036 QWidget *parent, const char *name, int ) 00037 : QWidget( parent, name? name : "logformdialog" ), 00038 // Leaving it anonymous let us to have multiple objects at the same time! 00039 DCOPObject(), // "CVSDiffPageDCOPIface" 00040 m_diffText( 0 ), m_cvsService( cvsService ), m_cvsDiffJob( 0 ) 00041 { 00042 QLayout *thisLayout = new QVBoxLayout( this ); 00043 // This should be replaced by the diff part 00044 // m_diffText = new QTextEdit( this, "difftextedit" ); 00045 // m_diffText->setReadOnly( true ); 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 // connectDCOPSignal( job.app(), job.obj(), "receivedStdout(QString)", "slotReceivedOutput(QString)", true ); 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 /*exitStatus*/ ) 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 // m_diffText->setText( diffText ); 00097 m_diffText->setDiff( diffText ); 00098 } 00099 else 00100 { 00101 KMessageBox::error( this, i18n("An error occured 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
KDE Logo
This file is part of the documentation for KDevelop Version 3.0.4.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Oct 6 17:39:14 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003