KDevelop API Documentation

vcs/subversion/subversion_core.cpp

Go to the documentation of this file.
00001 /* Copyright (C) 2003 00002 Mickael Marchand <marchand@kde.org> 00003 00004 This program is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 General Public License for more details. 00013 00014 You should have received a copy of the GNU General Public License 00015 along with this program; see the file COPYING. If not, write to 00016 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00017 Boston, MA 02111-1307, USA. 00018 */ 00019 00020 #include <kparts/part.h> 00021 #include <kdevcore.h> 00022 00023 #include "subversion_part.h" 00024 #include "subversion_core.h" 00025 #include "subversion_widget.h" 00026 #include <kdevmainwindow.h> 00027 #include "svn_co.h" 00028 #include <kurlrequester.h> 00029 #include <klineedit.h> 00030 #include <kio/job.h> 00031 #include <kdebug.h> 00032 #include <kdebugclasses.h> 00033 #include <kmainwindow.h> 00034 00035 using namespace KIO; 00036 00037 subversionCore::subversionCore(subversionPart *part) 00038 : QObject(this, "subversion core") { 00039 m_part = part; 00040 m_widget = new subversionWidget(part, 0 , "subversionprocesswidget"); 00041 } 00042 00043 subversionCore::~subversionCore() { 00044 if ( processWidget() ) { 00045 m_part->mainWindow()->removeView( m_widget ); 00046 delete m_widget; 00047 } 00048 } 00049 00050 subversionWidget *subversionCore::processWidget() const { 00051 return m_widget; 00052 } 00053 00054 void subversionCore::update( const KURL::List& list ) { 00055 KURL servURL = m_part->baseURL(); 00056 if ( servURL.isEmpty() ) servURL="svn+http://blah/"; 00057 if ( ! servURL.protocol().startsWith( "svn" ) ) { 00058 servURL.setProtocol( "svn+" + servURL.protocol() ); //make sure it starts with "svn" 00059 } 00060 kdDebug() << "servURL : " << servURL.prettyURL() << endl; 00061 for ( QValueListConstIterator<KURL> it = list.begin(); it != list.end() ; ++it ) { 00062 kdDebug() << "updating : " << (*it).prettyURL() << endl; 00063 QByteArray parms; 00064 QDataStream s( parms, IO_WriteOnly ); 00065 int cmd = 2; 00066 int rev = -1; 00067 s << cmd << *it << rev << QString( "HEAD" ); 00068 SimpleJob * job = KIO::special(servURL, parms, true); 00069 job->setWindow( m_part->mainWindow()->main() ); 00070 connect( job, SIGNAL( result( KIO::Job * ) ), this, SLOT( slotResult( KIO::Job * ) ) ); 00071 } 00072 } 00073 00074 void subversionCore::commit( const KURL::List& list ) { 00075 KURL servURL = m_part->baseURL(); 00076 if ( servURL.isEmpty() ) servURL="svn+http://blah/"; 00077 if ( ! servURL.protocol().startsWith( "svn" ) ) { 00078 servURL.setProtocol( "svn+" + servURL.protocol() ); //make sure it starts with "svn" 00079 } 00080 kdDebug() << "servURL : " << servURL.prettyURL() << endl; 00081 for ( QValueListConstIterator<KURL> it = list.begin(); it != list.end() ; ++it ) { 00082 kdDebug() << "commiting : " << (*it).prettyURL() << endl; 00083 QByteArray parms; 00084 QDataStream s( parms, IO_WriteOnly ); 00085 int cmd = 3; 00086 s << cmd << *it; 00087 SimpleJob * job = KIO::special(servURL, parms, true); 00088 job->setWindow( m_part->mainWindow()->main() ); 00089 connect( job, SIGNAL( result( KIO::Job * ) ), this, SLOT( slotResult( KIO::Job * ) ) ); 00090 } 00091 } 00092 00093 void subversionCore::checkout() { 00094 svn_co checkoutDlg; 00095 00096 if ( checkoutDlg.exec() == QDialog::Accepted ) { 00097 //checkout :) 00098 QByteArray parms; 00099 QDataStream s( parms, IO_WriteOnly ); 00100 KURL servURL ( checkoutDlg.serverURL->url() ); 00101 wcPath = checkoutDlg.localDir->url() + "/" + checkoutDlg.newDir->text(); 00102 int cmd = 1; 00103 int rev = -1; 00104 s << cmd << servURL << KURL( wcPath ) << rev << QString( "HEAD" ); 00105 servURL.setProtocol( "svn+" + servURL.protocol() ); //make sure it starts with "svn" 00106 SimpleJob * job = KIO::special(servURL,parms, true); 00107 job->setWindow( m_part->mainWindow()->main() ); 00108 connect( job, SIGNAL( result( KIO::Job * ) ), this, SLOT( slotEndCheckout( KIO::Job * ) ) ); 00109 } 00110 } 00111 00112 void subversionCore::slotEndCheckout( KIO::Job * job ) { 00113 if ( job->error() ) { 00114 job->showErrorDialog( m_part->mainWindow()->main() ); 00115 emit checkoutFinished( QString::null ); 00116 } else 00117 emit checkoutFinished(wcPath); 00118 } 00119 00120 void subversionCore::slotResult( KIO::Job * job ) { 00121 if ( job->error() ) 00122 job->showErrorDialog( m_part->mainWindow()->main() ); 00123 } 00124 00125 void subversionCore::createNewProject( const QString& dirName, const KURL& importURL, bool init ) { 00126 00127 } 00128 00129 #include "subversion_core.moc"
KDE Logo
This file is part of the documentation for KDevelop Version 3.0.4.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Oct 19 08:01:53 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003