summaryrefslogtreecommitdiffstats
path: root/kbabel/catalogmanager/libcvs/cvshandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kbabel/catalogmanager/libcvs/cvshandler.cpp')
-rw-r--r--kbabel/catalogmanager/libcvs/cvshandler.cpp124
1 files changed, 62 insertions, 62 deletions
diff --git a/kbabel/catalogmanager/libcvs/cvshandler.cpp b/kbabel/catalogmanager/libcvs/cvshandler.cpp
index d3f2ae18..66eeac0a 100644
--- a/kbabel/catalogmanager/libcvs/cvshandler.cpp
+++ b/kbabel/catalogmanager/libcvs/cvshandler.cpp
@@ -37,12 +37,12 @@
#include <time.h>
#include <unistd.h>
// Qt include files
-#include <qdir.h>
-#include <qfile.h>
-#include <qfileinfo.h>
-#include <qregexp.h>
-#include <qstring.h>
-#include <qstringlist.h>
+#include <tqdir.h>
+#include <tqfile.h>
+#include <tqfileinfo.h>
+#include <tqregexp.h>
+#include <tqstring.h>
+#include <tqstringlist.h>
// KDE include files
#include <kapplication.h>
#include <klocale.h>
@@ -52,17 +52,17 @@
#include "cvshandler.h"
-CVSHandler::CVSHandler( const QString& poBaseDir, const QString& potBaseDir )
+CVSHandler::CVSHandler( const TQString& poBaseDir, const TQString& potBaseDir )
{
setPOBaseDir( poBaseDir );
setPOTBaseDir( potBaseDir );
_autoUpdateTemplates = false;
}
-void CVSHandler::setPOBaseDir( const QString& dir )
+void CVSHandler::setPOBaseDir( const TQString& dir )
{
// check if 'CVS/Entries' exists in the PO base directory
- if ( QFileInfo( dir + "/CVS/Entries" ).exists( ) ) {
+ if ( TQFileInfo( dir + "/CVS/Entries" ).exists( ) ) {
_isPORepository = true;
_poBaseDir = dir;
} else
@@ -70,10 +70,10 @@ void CVSHandler::setPOBaseDir( const QString& dir )
emit signalIsPORepository( _isPORepository );
}
-void CVSHandler::setPOTBaseDir( const QString& dir )
+void CVSHandler::setPOTBaseDir( const TQString& dir )
{
// check if 'CVS/Entries' exists in the POT base directory
- if ( QFileInfo( dir + "/CVS/Entries" ).exists( ) ) {
+ if ( TQFileInfo( dir + "/CVS/Entries" ).exists( ) ) {
_isPOTRepository = true;
_potBaseDir = dir;
} else
@@ -81,7 +81,7 @@ void CVSHandler::setPOTBaseDir( const QString& dir )
emit signalIsPOTRepository( _isPOTRepository );
}
-QString CVSHandler::fileStatus( const FileStatus status ) const
+TQString CVSHandler::fileStatus( const FileStatus status ) const
{
switch ( status ) {
case NO_REPOSITORY:
@@ -111,29 +111,29 @@ QString CVSHandler::fileStatus( const FileStatus status ) const
}
}
-CVSHandler::FileStatus CVSHandler::fstatus( const QString& filename ) const
+CVSHandler::FileStatus CVSHandler::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 'CVS/Entries' exists and can be read
- QFile entries( info.dir( true ).path( ) + "/CVS/Entries" );
+ TQFile entries( info.dir( true ).path( ) + "/CVS/Entries" );
if ( !entries.open( IO_ReadOnly ) )
return NOT_IN_CVS; // we already know that it's a repository
// ### FIXME: it does not take care of CVS/Entries.Log
// a line in CVS/Entries has the following format:
// [D]/NAME/REVISION/[CONFLICT+]TIMESTAMP/OPTIONS/TAGDATE
- QRegExp rx( QString( "^D?/%1/" ).arg( info.fileName( ) ) );
+ TQRegExp rx( TQString( "^D?/%1/" ).arg( info.fileName( ) ) );
- QString temp;
- QTextStream stream( &entries );
+ TQString temp;
+ TQTextStream stream( &entries );
bool isInRepository = false;
while ( !stream.atEnd() ) {
@@ -149,11 +149,11 @@ CVSHandler::FileStatus CVSHandler::fstatus( const QString& filename ) const
if ( !isInRepository )
return NOT_IN_CVS;
- const QStringList fields = QStringList::split( '/', temp, true );
+ const TQStringList fields = TQStringList::split( '/', temp, true );
// bool isDir = ( fields[0] == "D" );
- const QString cvsname( fields[1] );
- const QString revision( fields[2] );
- const QString timestamp( fields[3] );
+ const TQString cvsname( fields[1] );
+ const TQString revision( fields[2] );
+ const TQString timestamp( fields[3] );
// ignore the other fields for now
if ( revision == "0" && timestamp == "dummy timestamp" )
@@ -167,9 +167,9 @@ CVSHandler::FileStatus CVSHandler::fstatus( const QString& filename ) const
// 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 );
- QString ftime = QString( asctime( tm_p ) );
+ TQString ftime = TQString( asctime( tm_p ) );
ftime.truncate( ftime.length( ) - 1 );
if ( ftime != timestamp )
return LOCALLY_MODIFIED;
@@ -177,12 +177,12 @@ CVSHandler::FileStatus CVSHandler::fstatus( const QString& filename ) const
return UP_TO_DATE;
}
-QString CVSHandler::cvsStatus( const QString& filename ) const
+TQString CVSHandler::cvsStatus( const TQString& filename ) const
{
return map[filename];
}
-void CVSHandler::execCVSCommand( QWidget* parent, CVS::Command cmd, const QString& filename, bool templates, KSharedConfig* config )
+void CVSHandler::execCVSCommand( TQWidget* parent, CVS::Command cmd, const TQString& filename, bool templates, KSharedConfig* config )
{
if ( !_isPORepository ) {
// This message box should never be visible but who knows... ;-)
@@ -191,16 +191,16 @@ void CVSHandler::execCVSCommand( QWidget* parent, CVS::Command cmd, const QStrin
return;
}
- QFileInfo info( filename );
+ TQFileInfo info( filename );
if ( !info.isDir( ) ) {
- execCVSCommand( parent, cmd, QStringList( filename ), templates, config );
+ execCVSCommand( parent, cmd, TQStringList( filename ), templates, config );
return;
}
- // ### FIXME: instead of making a QString, use KProcess directly, so that it cares about quoting.
+ // ### FIXME: instead of making a TQString, use KProcess directly, so that it cares about quoting.
// ### FIXME: use KProcess::setWorkingDirectory instead of using "cd" (therefore allowing to use KProcess without a shell.)
// it's a dir
- QString command( "cd " + filename + " && cvs " );
+ TQString command( "cd " + filename + " && cvs " );
switch ( cmd ) {
case CVS::Update:
command += "update -dP";
@@ -208,7 +208,7 @@ void CVSHandler::execCVSCommand( QWidget* parent, CVS::Command cmd, const QStrin
case CVS::Commit:
// The cvs client does not care about the encoding, so we cannot set anything here
command += "commit -F @LOG@FILE@";
- checkToAdd( QStringList( filename ) );
+ checkToAdd( TQStringList( filename ) );
break;
case CVS::Status:
command += "status";
@@ -218,10 +218,10 @@ void CVSHandler::execCVSCommand( QWidget* parent, CVS::Command cmd, const QStrin
break;
}
- showDialog( parent, cmd, QStringList( filename ), command, config );
+ showDialog( parent, cmd, TQStringList( filename ), command, config );
}
-void CVSHandler::execCVSCommand( QWidget* parent, CVS::Command cmd, const QStringList& files, bool templates, KSharedConfig* config )
+void CVSHandler::execCVSCommand( TQWidget* parent, CVS::Command cmd, const TQStringList& files, bool templates, KSharedConfig* config )
{
if ( !_isPORepository ) {
// This message box should never be visible but who knows... ;-)
@@ -230,9 +230,9 @@ void CVSHandler::execCVSCommand( QWidget* parent, CVS::Command cmd, const QStrin
return;
}
- // ### FIXME: instead of making a QString, use KProcess directly, so that it cares about quoting.
+ // ### FIXME: instead of making a TQString, use KProcess directly, so that it cares about quoting.
// ### FIXME: use KProcess::setWorkingDirectory instead of using "cd" (therefore allowing to use KProcess without a shell.)
- QString command("cd " + (templates ? _potBaseDir : _poBaseDir) + " && cvs ");
+ TQString command("cd " + (templates ? _potBaseDir : _poBaseDir) + " && cvs ");
switch ( cmd ) {
case CVS::Update:
command += "update -dP";
@@ -249,15 +249,15 @@ void CVSHandler::execCVSCommand( QWidget* parent, CVS::Command cmd, const QStrin
break;
}
- 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 + "\'";
}
@@ -270,7 +270,7 @@ void CVSHandler::setAutoUpdateTemplates( bool update )
_autoUpdateTemplates = update;
}
-void CVSHandler::showDialog( QWidget* parent, CVS::Command cmd, const QStringList& files, const QString& commandLine, KSharedConfig* config )
+void CVSHandler::showDialog( TQWidget* parent, CVS::Command cmd, const TQStringList& files, const TQString& commandLine, KSharedConfig* config )
{
CVSDialog * dia = new CVSDialog( cmd, parent, config );
dia->setFiles( files );
@@ -293,30 +293,30 @@ void CVSHandler::showDialog( QWidget* parent, CVS::Command cmd, const QStringLis
emit signalFilesCommitted( files );
}
-void CVSHandler::checkToAdd( const QStringList& files )
+void CVSHandler::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 ( fstatus( *it ) == NOT_IN_CVS ) {
- 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 );
}
// check recursivlely if parent dirs have to be added as well
while ( fstatus( temp ) == NOT_IN_CVS && toBeAdded.findIndex( temp ) == -1 ) {
toBeAdded << temp;
- temp = QFileInfo( temp ).dirPath( true );
+ temp = TQFileInfo( temp ).dirPath( true );
}
}
}
@@ -329,36 +329,36 @@ void CVSHandler::checkToAdd( const QStringList& files )
// 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 ) + " && cvs add " + info.fileName( ) + "; ";
}
}
-void CVSHandler::processStatusOutput( const QString& status )
+void CVSHandler::processStatusOutput( const TQString& status )
{
if ( !_isPORepository )
return;
// at first we need to extract the name of the base directory on the server
- QFile f( _poBaseDir + "/CVS/Root" );
+ TQFile f( _poBaseDir + "/CVS/Root" );
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>";
@@ -369,16 +369,16 @@ void CVSHandler::processStatusOutput( const QString& status )
}
}
-void CVSHandler::processDiff( QString output )
+void CVSHandler::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 );
}