summaryrefslogtreecommitdiffstats
path: root/tar
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-07-03 02:49:54 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-07-03 02:49:54 +0000
commit6ffad5a006df848f5e9a80ca31e5faec8ed65e62 (patch)
tree3757770dc3586efff30fdfe30f7e36b64ab883f1 /tar
parent1359f43e963c10d08c6c78f4806da291ca216bfe (diff)
downloadkrusader-6ffad5a006df848f5e9a80ca31e5faec8ed65e62.tar.gz
krusader-6ffad5a006df848f5e9a80ca31e5faec8ed65e62.zip
TQt4 port krusader
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/krusader@1239136 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'tar')
-rw-r--r--tar/ktartest.cpp28
-rw-r--r--tar/tar.cc70
-rw-r--r--tar/tar.h10
3 files changed, 54 insertions, 54 deletions
diff --git a/tar/ktartest.cpp b/tar/ktartest.cpp
index a82e6db..bfbb216 100644
--- a/tar/ktartest.cpp
+++ b/tar/ktartest.cpp
@@ -1,13 +1,13 @@
#include "ktar.h"
#include <stdio.h>
-#include <qfile.h>
+#include <tqfile.h>
#include <kinstance.h>
#include <kdebug.h>
-void recursive_print( const KTarDirectory * dir, const QString & path )
+void recursive_print( const KTarDirectory * dir, const TQString & path )
{
- QStringList l = dir->entries();
- QStringList::Iterator it = l.begin();
+ TQStringList l = dir->entries();
+ TQStringList::Iterator it = l.begin();
for( ; it != l.end(); ++it )
{
const KTarEntry* entry = dir->entry( (*it) );
@@ -37,7 +37,7 @@ int main( int argc, char** argv )
}
KInstance instance("ktartest");
- QString command = argv[1];
+ TQString command = argv[1];
kdDebug() << "main: command=" << command << endl;
if ( command == "list" )
{
@@ -81,19 +81,19 @@ int main( int argc, char** argv )
Q_ASSERT( e && e->isFile() );
const KTarFile* f = (KTarFile*)e;
- QByteArray arr( f->data() );
+ TQByteArray arr( f->data() );
printf("SIZE=%i\n",arr.size() );
- QString str( arr );
+ TQString str( arr );
printf("DATA=%s\n", str.latin1());
/*
- // This is what KGzipDev::readAll could do, if QIODevice::readAll was virtual....
- QByteArray array(1024);
+ // This is what KGzipDev::readAll could do, if TQIODevice::readAll was virtual....
+ TQByteArray array(1024);
int n;
while ( ( n = dev.readBlock( array.data(), array.size() ) ) )
{
kdDebug() << "readBlock returned " << n << endl << endl;
- QCString s(array,n+1); // Terminate with 0 before printing
+ TQCString s(array,n+1); // Terminate with 0 before printing
printf("%s", s.data());
}
dev.close();
@@ -151,9 +151,9 @@ int main( int argc, char** argv )
Q_ASSERT( e && e->isFile() );
const KTarFile* f = (KTarFile*)e;
- QByteArray arr( f->data() );
+ TQByteArray arr( f->data() );
printf("SIZE=%i\n",arr.size() );
- QString str( arr );
+ TQString str( arr );
printf("DATA=%s\n", str.latin1());
tar.close();
@@ -172,7 +172,7 @@ int main( int argc, char** argv )
// Generate long filenames of each possible length bigger than 98...
for (int i = 98; i < 500 ; i++ )
{
- QString str, num;
+ TQString str, num;
str.fill( 'a', i-10 );
num.setNum( i );
num = num.rightJustify( 10, '0' );
@@ -186,7 +186,7 @@ int main( int argc, char** argv )
}
else if ( command == "bytearray" )
{
- QFile file( argv[2] );
+ TQFile file( argv[2] );
if ( !file.open( IO_ReadOnly ) )
return 1;
KTarGz tar( &file );
diff --git a/tar/tar.cc b/tar/tar.cc
index 77f70db..d63b777 100644
--- a/tar/tar.cc
+++ b/tar/tar.cc
@@ -4,9 +4,9 @@
#include <stdlib.h>
#include <unistd.h>
-#include <qfile.h>
-#include <qfileinfo.h>
-#include <qptrqueue.h>
+#include <tqfile.h>
+#include <tqfileinfo.h>
+#include <tqptrqueue.h>
#include <kurl.h>
#include <kdebug.h>
#include <kinstance.h>
@@ -46,7 +46,7 @@ int kdemain( int argc, char **argv ) {
return 0;
}
-ArchiveProtocol::ArchiveProtocol( const QCString &pool, const QCString &app ) : SlaveBase( "tar", pool, app ) {
+ArchiveProtocol::ArchiveProtocol( const TQCString &pool, const TQCString &app ) : SlaveBase( "tar", pool, app ) {
kdDebug( 7109 ) << "ArchiveProtocol::ArchiveProtocol" << endl;
m_archiveFile = 0L;
}
@@ -61,25 +61,25 @@ void ArchiveProtocol::put( const KURL& url, int, bool, bool resume ){
return;
}
- QByteArray tempBuffer;
- QPtrQueue<QByteArray> buffer;
+ TQByteArray tempBuffer;
+ TQPtrQueue<TQByteArray> buffer;
buffer.setAutoDelete(true);
int readResult=0;
int size = 0;
- QByteArray* temp;
+ TQByteArray* temp;
do{
dataReq();
- temp = new QByteArray();
+ temp = new TQByteArray();
readResult = readData(*temp);
buffer.enqueue(temp);
size += temp->size();
} while( readResult > 0 );
- QString filename = url.path().mid(m_archiveName.length()+1);
+ TQString filename = url.path().mid(m_archiveName.length()+1);
if( !m_archiveFile->prepareWriting(filename,user,group,size) ){
error(ERR_UNSUPPORTED_ACTION,
- i18n("Writing to %1 is not supported").arg(filename) );
+ i18n("Writing to %1 is not supported").tqarg(filename) );
return;
}
while( (temp=buffer.dequeue()) ){
@@ -91,13 +91,13 @@ void ArchiveProtocol::put( const KURL& url, int, bool, bool resume ){
}
void ArchiveProtocol::mkdir(const KURL& url,int){
- QString filename = url.path().mid(m_archiveName.length()+1);
+ TQString filename = url.path().mid(m_archiveName.length()+1);
m_archiveFile->writeDir(filename,user,group);
finished();
}
-bool ArchiveProtocol::checkNewFile( const KURL & url, QString & path ) {
- QString fullPath = url.path();
+bool ArchiveProtocol::checkNewFile( const KURL & url, TQString & path ) {
+ TQString fullPath = url.path();
kdDebug( 7109 ) << "ArchiveProtocol::checkNewFile " << fullPath << endl;
@@ -105,7 +105,7 @@ bool ArchiveProtocol::checkNewFile( const KURL & url, QString & path ) {
if ( m_archiveFile && m_archiveName == fullPath.left( m_archiveName.length() ) ) {
// Has it changed ?
struct stat statbuf;
- if ( ::stat( QFile::encodeName( m_archiveName ), &statbuf ) == 0 ) {
+ if ( ::stat( TQFile::encodeName( m_archiveName ), &statbuf ) == 0 ) {
if ( m_mtime == statbuf.st_mtime ) {
path = fullPath.mid( m_archiveName.length() );
kdDebug( 7109 ) << "ArchiveProtocol::checkNewFile returning " << path << endl;
@@ -124,23 +124,23 @@ bool ArchiveProtocol::checkNewFile( const KURL & url, QString & path ) {
// Find where the tar file is in the full path
int pos = 0;
- QString archiveFile;
- path = QString::null;
+ TQString archiveFile;
+ path = TQString();
int len = fullPath.length();
if ( len != 0 && fullPath[ len - 1 ] != '/' )
fullPath += '/';
kdDebug( 7109 ) << "the full path is " << fullPath << endl;
- while ( ( pos = fullPath.find( '/', pos + 1 ) ) != -1 ) {
- QString tryPath = fullPath.left( pos );
+ while ( ( pos = fullPath.tqfind( '/', pos + 1 ) ) != -1 ) {
+ TQString tryPath = fullPath.left( pos );
kdDebug( 7109 ) << fullPath << " trying " << tryPath << endl;
struct stat statbuf;
- if ( ::stat( QFile::encodeName( tryPath ), &statbuf ) == 0 && !S_ISDIR( statbuf.st_mode ) ) {
+ if ( ::stat( TQFile::encodeName( tryPath ), &statbuf ) == 0 && !S_ISDIR( statbuf.st_mode ) ) {
archiveFile = tryPath;
m_mtime = statbuf.st_mtime;
- user = QFileInfo(archiveFile).owner();
- group = QFileInfo(archiveFile).group();
+ user = TQFileInfo(archiveFile).owner();
+ group = TQFileInfo(archiveFile).group();
path = fullPath.mid( pos + 1 );
kdDebug( 7109 ) << "fullPath=" << fullPath << " path=" << path << endl;
len = path.length();
@@ -148,7 +148,7 @@ bool ArchiveProtocol::checkNewFile( const KURL & url, QString & path ) {
if ( path[ len - 1 ] == '/' )
path.truncate( len - 1 );
} else
- path = QString::fromLatin1( "/" );
+ path = TQString::tqfromLatin1( "/" );
kdDebug( 7109 ) << "Found. archiveFile=" << archiveFile << " path=" << path << endl;
break;
}
@@ -224,9 +224,9 @@ void ArchiveProtocol::createUDSEntry( const KArchiveEntry * archiveEntry, UDSEnt
void ArchiveProtocol::listDir( const KURL & url ) {
kdDebug( 7109 ) << "ArchiveProtocol::listDir " << url.url() << endl;
- QString path;
+ TQString path;
if ( !checkNewFile( url, path ) ) {
- QCString _path( QFile::encodeName( url.path() ) );
+ TQCString _path( TQFile::encodeName( url.path() ) );
kdDebug( 7109 ) << "Checking (stat) on " << _path << endl;
struct stat buff;
if ( ::stat( _path.data(), &buff ) == -1 || !S_ISDIR( buff.st_mode ) ) {
@@ -246,9 +246,9 @@ void ArchiveProtocol::listDir( const KURL & url ) {
}
if ( path.isEmpty() ) {
- KURL redir( url.protocol() + QString::fromLatin1( ":/" ) );
+ KURL redir( url.protocol() + TQString::tqfromLatin1( ":/" ) );
kdDebug( 7109 ) << "url.path()==" << url.path() << endl;
- redir.setPath( url.path() + QString::fromLatin1( "/" ) );
+ redir.setPath( url.path() + TQString::tqfromLatin1( "/" ) );
kdDebug( 7109 ) << "ArchiveProtocol::listDir: redirection " << redir.url() << endl;
redirection( redir );
finished();
@@ -259,7 +259,7 @@ void ArchiveProtocol::listDir( const KURL & url ) {
const KArchiveDirectory* root = m_archiveFile->directory();
const KArchiveDirectory* dir;
if ( !path.isEmpty() && path != "/" ) {
- kdDebug( 7109 ) << QString( "Looking for entry %1" ).arg( path ) << endl;
+ kdDebug( 7109 ) << TQString( "Looking for entry %1" ).tqarg( path ) << endl;
const KArchiveEntry* e = root->entry( path );
if ( !e ) {
error( KIO::ERR_DOES_NOT_EXIST, url.prettyURL() );
@@ -274,11 +274,11 @@ void ArchiveProtocol::listDir( const KURL & url ) {
dir = root;
}
- QStringList l = dir->entries();
+ TQStringList l = dir->entries();
totalSize( l.count() );
UDSEntry entry;
- QStringList::Iterator it = l.begin();
+ TQStringList::Iterator it = l.begin();
for ( ; it != l.end(); ++it ) {
kdDebug( 7109 ) << ( *it ) << endl;
const KArchiveEntry* archiveEntry = dir->entry( ( *it ) );
@@ -296,12 +296,12 @@ void ArchiveProtocol::listDir( const KURL & url ) {
}
void ArchiveProtocol::stat( const KURL & url ) {
- QString path;
+ TQString path;
UDSEntry entry;
if ( !checkNewFile( url, path ) ) {
// We may be looking at a real directory - this happens
// when pressing up after being in the root of an archive
- QCString _path( QFile::encodeName( url.path() ) );
+ TQCString _path( TQFile::encodeName( url.path() ) );
kdDebug( 7109 ) << "ArchiveProtocol::stat (stat) on " << _path << endl;
struct stat buff;
if ( ::stat( _path.data(), &buff ) == -1 || !S_ISDIR( buff.st_mode ) ) {
@@ -333,7 +333,7 @@ void ArchiveProtocol::stat( const KURL & url ) {
const KArchiveDirectory* root = m_archiveFile->directory();
const KArchiveEntry* archiveEntry;
if ( path.isEmpty() ) {
- path = QString::fromLatin1( "/" );
+ path = TQString::tqfromLatin1( "/" );
archiveEntry = root;
} else {
archiveEntry = root->entry( path );
@@ -352,7 +352,7 @@ void ArchiveProtocol::stat( const KURL & url ) {
void ArchiveProtocol::get( const KURL & url ) {
kdDebug( 7109 ) << "ArchiveProtocol::get" << url.url() << endl;
- QString path;
+ TQString path;
if ( !checkNewFile( url, path ) ) {
error( KIO::ERR_DOES_NOT_EXIST, url.prettyURL() );
return ;
@@ -381,7 +381,7 @@ void ArchiveProtocol::get( const KURL & url ) {
totalSize( archiveFileEntry->size() );
- QByteArray completeData = archiveFileEntry->data();
+ TQByteArray completeData = archiveFileEntry->data();
KMimeMagicResult * result = KMimeMagic::self() ->findBufferFileType( completeData, path );
kdDebug( 7109 ) << "Emitting mimetype " << result->mimeType() << endl;
@@ -390,7 +390,7 @@ void ArchiveProtocol::get( const KURL & url ) {
data( completeData );
processedSize( archiveFileEntry->size() );
- data( QByteArray() );
+ data( TQByteArray() );
finished();
}
diff --git a/tar/tar.h b/tar/tar.h
index 0f7062e..5b41ce1 100644
--- a/tar/tar.h
+++ b/tar/tar.h
@@ -25,7 +25,7 @@
class ArchiveProtocol : public KIO::SlaveBase {
public:
- ArchiveProtocol( const QCString &pool, const QCString &app );
+ ArchiveProtocol( const TQCString &pool, const TQCString &app );
virtual ~ArchiveProtocol();
virtual void listDir( const KURL & url );
@@ -36,12 +36,12 @@ public:
protected:
void createUDSEntry( const KArchiveEntry * tarEntry, KIO::UDSEntry & entry );
- bool checkNewFile( const KURL & url, QString & path );
+ bool checkNewFile( const KURL & url, TQString & path );
KArchive * m_archiveFile;
- QString m_archiveName;
- QString user;
- QString group;
+ TQString m_archiveName;
+ TQString user;
+ TQString group;
time_t m_mtime;
};