summaryrefslogtreecommitdiffstats
path: root/kbabel/catalogmanager/libsvn/svnhandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kbabel/catalogmanager/libsvn/svnhandler.cpp')
-rw-r--r--kbabel/catalogmanager/libsvn/svnhandler.cpp152
1 files changed, 76 insertions, 76 deletions
diff --git a/kbabel/catalogmanager/libsvn/svnhandler.cpp b/kbabel/catalogmanager/libsvn/svnhandler.cpp
index 8117fe62..1ac98f66 100644
--- a/kbabel/catalogmanager/libsvn/svnhandler.cpp
+++ b/kbabel/catalogmanager/libsvn/svnhandler.cpp
@@ -37,13 +37,13 @@
#include <sys/stat.h>
#include <time.h>
// Qt include files
-#include <qdir.h>
-#include <qfile.h>
-#include <qfileinfo.h>
-#include <qregexp.h>
-#include <qstring.h>
-#include <qstringlist.h>
-#include <qdom.h>
+#include <tqdir.h>
+#include <tqfile.h>
+#include <tqfileinfo.h>
+#include <tqregexp.h>
+#include <tqstring.h>
+#include <tqstringlist.h>
+#include <tqdom.h>
// KDE include files
#include <kapplication.h>
#include <klocale.h>
@@ -54,17 +54,17 @@
// project specific include files
#include "svnhandler.h"
-SVNHandler::SVNHandler( const QString& poBaseDir, const QString& potBaseDir )
+SVNHandler::SVNHandler( const TQString& poBaseDir, const TQString& potBaseDir )
{
setPOBaseDir( poBaseDir );
setPOTBaseDir( potBaseDir );
_autoUpdateTemplates = false;
}
-void SVNHandler::setPOBaseDir( const QString& dir )
+void SVNHandler::setPOBaseDir( const TQString& dir )
{
// check if '.svn/entries' exists in the PO base directory
- if ( QFileInfo( dir + "/.svn/entries" ).exists( ) ) {
+ if ( TQFileInfo( dir + "/.svn/entries" ).exists( ) ) {
_isPORepository = true;
_poBaseDir = dir;
} else
@@ -72,10 +72,10 @@ void SVNHandler::setPOBaseDir( const QString& dir )
emit signalIsPORepository( _isPORepository );
}
-void SVNHandler::setPOTBaseDir( const QString& dir )
+void SVNHandler::setPOTBaseDir( const TQString& dir )
{
// check if '.svn/entries' exists in the POT base directory
- if ( QFileInfo( dir + "/.svn/entries" ).exists( ) ) {
+ if ( TQFileInfo( dir + "/.svn/entries" ).exists( ) ) {
_isPOTRepository = true;
_potBaseDir = dir;
} else
@@ -83,7 +83,7 @@ void SVNHandler::setPOTBaseDir( const QString& dir )
emit signalIsPOTRepository( _isPOTRepository );
}
-QString SVNHandler::fileStatus( const FileStatus status ) const
+TQString SVNHandler::fileStatus( const FileStatus status ) const
{
switch ( status ) {
case NO_REPOSITORY:
@@ -115,19 +115,19 @@ QString SVNHandler::fileStatus( const FileStatus status ) const
}
}
-SVNHandler::FileStatus SVNHandler::fstatus( const QString& filename ) const
+SVNHandler::FileStatus SVNHandler::fstatus( const TQString& filename ) const
{
// no valid repository
if ( !_isPORepository )
return NO_REPOSITORY;
- QString fn( filename );
- fn = fn.remove( QRegExp( "/$" ) );
+ TQString fn( filename );
+ fn = fn.remove( TQRegExp( "/$" ) );
- QFileInfo info( fn );
+ TQFileInfo info( fn );
// check if '.svn/entries' exists.
- QFile entries( info.dir( true ).path( ) + "/.svn/entries" );
+ TQFile entries( info.dir( true ).path( ) + "/.svn/entries" );
if ( !entries.exists() )
return NOT_IN_SVN;
@@ -140,12 +140,12 @@ SVNHandler::FileStatus SVNHandler::fstatus( const QString& filename ) const
if( !proc.start( KProcess::Block, KProcess::Stdout ) )
return ERROR_IN_WC;
- QDomDocument doc;
- QString errorMsg;
+ TQDomDocument doc;
+ TQString errorMsg;
int errorLine, errorCol;
- QDomNodeList nodelist;
- QDomNode node;
- QDomElement entry, wcStatus;
+ TQDomNodeList nodelist;
+ TQDomNode node;
+ TQDomElement entry, wcStatus;
// Parse the output.
if ( !doc.setContent( out.getOutput(), &errorMsg, &errorLine, &errorCol ) ) {
@@ -211,11 +211,11 @@ no_status_xml:
}
entries.close();
- QDomElement element;
+ TQDomElement element;
// File name that we are searching
- const QString findName = info.fileName();
+ const TQString findName = info.fileName();
// The entries are <entry> elements, so we have to check them
- QDomNode child = doc.documentElement().firstChild();
+ TQDomNode child = doc.documentElement().firstChild();
for ( ; !child.isNull() ; child = child.nextSibling() )
{
if ( !child.isElement() )
@@ -226,7 +226,7 @@ no_status_xml:
// Should not happend with svn 1.1.x
continue;
}
- const QString name = element.attribute("name");
+ const TQString name = element.attribute("name");
if ( name == findName )
break;
}
@@ -239,7 +239,7 @@ no_status_xml:
// ### TODO: should we check the attribute kind to be file and not dir?
// ### TODO: what do copy and move add here?
- const QString onSchedule = element.attribute( "schedule" );
+ const TQString onSchedule = element.attribute( "schedule" );
if ( onSchedule == "delete" )
return LOCALLY_REMOVED;
else if ( onSchedule == "added" )
@@ -250,15 +250,15 @@ no_status_xml:
}
// Note: we do not check the property time stamp
- const QString textTimeStamp( element.attribute( "text-time" ) );
+ const TQString textTimeStamp( element.attribute( "text-time" ) );
// calculate the UTC time from the file's last modified date
struct stat st;
- lstat( QFile::encodeName(fn), &st );
+ lstat( TQFile::encodeName(fn), &st );
struct tm * tm_p = gmtime( &st.st_mtime );
const int year = tm_p->tm_year + 1900;
const int month = tm_p->tm_mon + 1;
- QString fileTime;
+ TQString fileTime;
fileTime.sprintf( "%04i-%02i-%02iT%02i:%02i:%02i.000000Z",
year, month, tm_p->tm_mday, tm_p->tm_hour, tm_p->tm_min, tm_p->tm_sec );
//kdDebug() << "File: " << filename << " SVN time: " << textTimeStamp << " File time: " << fileTime << endl;
@@ -269,19 +269,19 @@ no_status_xml:
}
-QString SVNHandler::svnStatus( const QString& filename ) const
+TQString SVNHandler::svnStatus( const TQString& filename ) const
{
return map[filename];
}
-void SVNHandler::execSVNCommand( QWidget* parent, SVN::Command cmd, const QString& filename, bool templates, KSharedConfig* config)
+void SVNHandler::execSVNCommand( TQWidget* parent, SVN::Command cmd, const TQString& filename, bool templates, KSharedConfig* config)
{
// Unlike cvs, svn works also from outside the repository(as long as the path is in a repository of course!)
// ### FIXME: wrong, svn commit cannot work if the current directory is not a SVN one
- execSVNCommand( parent, cmd, QStringList( filename ), templates, config );
+ execSVNCommand( parent, cmd, TQStringList( filename ), templates, config );
}
-void SVNHandler::execSVNCommand( QWidget* parent, SVN::Command cmd, const QStringList& files, bool templates, KSharedConfig* config )
+void SVNHandler::execSVNCommand( TQWidget* parent, SVN::Command cmd, const TQStringList& files, bool templates, KSharedConfig* config )
{
if ( !_isPORepository ) {
// This message box should never be visible but who knows... ;-)
@@ -290,9 +290,9 @@ void SVNHandler::execSVNCommand( QWidget* parent, SVN::Command cmd, const QStrin
return;
}
- // ### TODO: instead of making a QString, use KProcess directly, so that it cares about quoting.
+ // ### TODO: instead of making a TQString, use KProcess directly, so that it cares about quoting.
// ### TODO: use KProcess::setWorkingDirectory instead of using "cd" (therefore allowing to use KProcess without a shell.)
- QString command("cd " + (templates ? _potBaseDir : _poBaseDir) + " && svn ");
+ TQString command("cd " + (templates ? _potBaseDir : _poBaseDir) + " && svn ");
switch ( cmd ) {
case SVN::Update:
command += "update --non-interactive";
@@ -315,15 +315,15 @@ void SVNHandler::execSVNCommand( QWidget* parent, SVN::Command cmd, const QStrin
command += "info"; // Does not allow --non-interactive (at least svn 1.1.4).
}
- QRegExp rx;
+ TQRegExp rx;
if (templates)
rx.setPattern(_potBaseDir + "/?");
else
rx.setPattern(_poBaseDir + "/?");
- QStringList::ConstIterator it;
+ TQStringList::ConstIterator it;
for ( it = files.begin( ); it != files.end( ); ++it ) {
- QString temp = *it;
+ TQString temp = *it;
temp.remove(rx);
command += " \'" + temp + "\'";
}
@@ -336,7 +336,7 @@ void SVNHandler::setAutoUpdateTemplates( bool update )
_autoUpdateTemplates = update;
}
-void SVNHandler::showDialog( QWidget* parent, SVN::Command cmd, const QStringList& files, const QString& commandLine, KSharedConfig* config )
+void SVNHandler::showDialog( TQWidget* parent, SVN::Command cmd, const TQStringList& files, const TQString& commandLine, KSharedConfig* config )
{
SVNDialog * dia = new SVNDialog( cmd, parent, config );
dia->setFiles( files );
@@ -359,7 +359,7 @@ void SVNHandler::showDialog( QWidget* parent, SVN::Command cmd, const QStringLis
emit signalFilesCommitted( files );
}
-bool SVNHandler::isInSvn( const QString& path )
+bool SVNHandler::isInSvn( const TQString& path )
{
if ( path.isEmpty() )
return false;
@@ -375,57 +375,57 @@ bool SVNHandler::isInSvn( const QString& path )
* - for a file: check if there is a corresponding file in .svn/text-base/
*/
- const QFileInfo info( path );
+ const TQFileInfo info( path );
if ( info.isDir() ) {
// It is a directory, so find a .svn/entries file
- QDir dir( path );
+ TQDir dir( path );
return dir.exists( ".svn/entries", true );
}
else {
// It is a file, so find the corresponding file in .svn/text-base
- QDir dir( info.dirPath() );
+ TQDir dir( info.dirPath() );
if ( ! dir.cd( ".svn/text-base" ) ) {
// There is not even a .svn/text-base directory, so the file is not under control
return false;
}
- const QString textBaseFilename( info.fileName() + ".svn-base" );
+ const TQString textBaseFilename( info.fileName() + ".svn-base" );
return dir.exists( textBaseFilename, true );
}
}
-void SVNHandler::checkToAdd( const QStringList& files )
+void SVNHandler::checkToAdd( const TQStringList& files )
{
if ( files.isEmpty( ) )
return;
- QStringList toBeAdded;
+ TQStringList toBeAdded;
- QStringList::ConstIterator it;
+ TQStringList::ConstIterator it;
for ( it = files.begin( ); it != files.end( ); ++it ) {
// check for every entry if it needs to be added
if ( ! isInSvn( *it ) ) {
- QFileInfo info( *it );
- QString temp; // will hold the dir path
+ TQFileInfo info( *it );
+ TQString temp; // will hold the dir path
if ( info.isDir( ) ) {
toBeAdded << *it;
temp = *it;
} else {
toBeAdded << *it;
- temp = QFileInfo( *it ).dirPath( true );
+ temp = TQFileInfo( *it ).dirPath( true );
}
// ### TODO: does SVN really needs this or does it do it automatically?
// check recursivlely if parent dirs have to be added as well
while ( ! isInSvn( temp ) && toBeAdded.findIndex( temp ) == -1 ) {
toBeAdded << temp;
- temp = QFileInfo( temp ).dirPath( true );
+ temp = TQFileInfo( temp ).dirPath( true );
}
}
}
// remove an old command
- _addCommand = QString();
+ _addCommand = TQString();
// ### TODO: does SVN really need this?
// make sure the directories are added before the files
@@ -434,38 +434,38 @@ void SVNHandler::checkToAdd( const QStringList& files )
// ### TODO: try to make this better
// create a command line for adding the files and dirs
for ( it = toBeAdded.begin( ); it != toBeAdded.end( ); ++it ) {
- QFileInfo info( *it );
+ TQFileInfo info( *it );
_addCommand += "cd " + info.dirPath( true ) + " && svn add " + info.fileName( ) + "; ";
}
}
// ### TODO: convert to SVN
-void SVNHandler::processStatusOutput( const QString& status )
+void SVNHandler::processStatusOutput( const TQString& status )
{
if ( !_isPORepository )
return;
#if 0
// at first we need to extract the name of the base directory on the server
- QFile f( _poBaseDir + "/SVN/Root" ); // ### FIXME
+ TQFile f( _poBaseDir + "/SVN/Root" ); // ### FIXME
if ( !f.open( IO_ReadOnly ) )
return;
- QTextStream stream( &f );
+ TQTextStream stream( &f );
// extract the string after the last colon in the first line
- QString basedir = stream.readLine( ).section( ':', -1 );
+ TQString basedir = stream.readLine( ).section( ':', -1 );
f.close( );
// divide the complete status output in little chunks for every file
- QStringList entries = QStringList::split( QRegExp( "={67,67}" ), status );
- QStringList::Iterator it;
+ TQStringList entries = TQStringList::split( TQRegExp( "={67,67}" ), status );
+ TQStringList::Iterator it;
for ( it = entries.begin( ); it != entries.end( ); ++it ) {
- QString entr = *it;
+ TQString entr = *it;
// translate the filename from repository to local
- QRegExp rx( basedir + ".*,v" );
+ TQRegExp rx( basedir + ".*,v" );
int pos = entr.find( rx );
- QString file = _poBaseDir + entr.mid( pos + basedir.length( ),
+ TQString file = _poBaseDir + entr.mid( pos + basedir.length( ),
rx.matchedLength( ) - basedir.length( ) - 2 );
entr = "<qt>" + entr + "</qt>";
@@ -477,16 +477,16 @@ void SVNHandler::processStatusOutput( const QString& status )
#endif
}
-void SVNHandler::processDiff( QString output )
+void SVNHandler::processDiff( TQString output )
{
- output.remove( QRegExp( "\\[ .* \\]$" ));
- output.remove( QRegExp( "^" + i18n("[ Starting command ]" ).replace("[","\\[").replace("]","\\]")));
+ output.remove( TQRegExp( "\\[ .* \\]$" ));
+ output.remove( TQRegExp( "^" + i18n("[ Starting command ]" ).replace("[","\\[").replace("]","\\]")));
KTempFile tmpFile;
*(tmpFile.textStream()) << output;
tmpFile.close();
- QString error;
+ TQString error;
if ( KApplication::startServiceByName( "Kompare", tmpFile.name(), &error ) )
KMessageBox::error( 0, error );
}
@@ -516,10 +516,10 @@ void SVNOutputCollector::setProcess( KProcess* p )
m_process = p;
if( p ) {
- connect( p, SIGNAL(receivedStdout(KProcess*, char*, int)),
- this, SLOT(slotGatherStdout(KProcess*, char*, int)) );
- connect( p, SIGNAL(receivedStderr(KProcess*, char*, int)),
- this, SLOT(slotGatherStderr(KProcess*, char*, int)) );
+ connect( p, TQT_SIGNAL(receivedStdout(KProcess*, char*, int)),
+ this, TQT_SLOT(slotGatherStdout(KProcess*, char*, int)) );
+ connect( p, TQT_SIGNAL(receivedStderr(KProcess*, char*, int)),
+ this, TQT_SLOT(slotGatherStderr(KProcess*, char*, int)) );
}
m_gatheredOutput.truncate( 0 );
@@ -529,14 +529,14 @@ void SVNOutputCollector::setProcess( KProcess* p )
void SVNOutputCollector::slotGatherStderr( KProcess*, char* data, int len )
{
- m_gatheredOutput.append( QString::fromLocal8Bit( data, len ) );
- m_stderrOutput.append( QString::fromLocal8Bit( data, len ) );
+ m_gatheredOutput.append( TQString::fromLocal8Bit( data, len ) );
+ m_stderrOutput.append( TQString::fromLocal8Bit( data, len ) );
}
void SVNOutputCollector::slotGatherStdout( KProcess*, char* data, int len )
{
- m_gatheredOutput.append( QString::fromLocal8Bit( data, len ) );
- m_stdoutOutput.append( QString::fromLocal8Bit( data, len ) );
+ m_gatheredOutput.append( TQString::fromLocal8Bit( data, len ) );
+ m_stdoutOutput.append( TQString::fromLocal8Bit( data, len ) );
}
#include "svnhandler.moc"