diff options
Diffstat (limited to 'src/fileaccess.cpp')
-rw-r--r-- | src/fileaccess.cpp | 505 |
1 files changed, 244 insertions, 261 deletions
diff --git a/src/fileaccess.cpp b/src/fileaccess.cpp index 8d4ce17..6c58569 100644 --- a/src/fileaccess.cpp +++ b/src/fileaccess.cpp @@ -14,18 +14,18 @@ #include <kio/global.h> #include <kmessagebox.h> #include "optiondialog.h" -#include <qlayout.h> -#include <qlabel.h> -#include <qapplication.h> -#include <qpushbutton.h> +#include <tqlayout.h> +#include <tqlabel.h> +#include <tqapplication.h> +#include <tqpushbutton.h> -#include <qeventloop.h> +#include <tqeventloop.h> #include "common.h" #include <ktempfile.h> -#include <qdir.h> -#include <qregexp.h> -#include <qtextstream.h> +#include <tqdir.h> +#include <tqregexp.h> +#include <tqtextstream.h> #include <vector> #include <klocale.h> @@ -46,7 +46,7 @@ ProgressDialog* g_pProgressDialog=0; -FileAccess::FileAccess( const QString& name, bool bWantToWrite ) +FileAccess::FileAccess( const TQString& name, bool bWantToWrite ) { setFile( name, bWantToWrite ); } @@ -55,9 +55,9 @@ FileAccess::FileAccess() { m_bValidData = false; m_size = 0; - m_creationTime = QDateTime(); - m_accessTime = QDateTime(); - m_modificationTime = QDateTime(); + m_creationTime = TQDateTime(); + m_accessTime = TQDateTime(); + m_modificationTime = TQDateTime(); m_bReadable = false; m_bWritable = false; m_bExecutable = false; @@ -77,15 +77,15 @@ FileAccess::~FileAccess() } } -void FileAccess::setFile( const QString& name, bool bWantToWrite ) +void FileAccess::setFile( const TQString& name, bool bWantToWrite ) { m_url = KURL::fromPathOrURL( name ); m_bValidData = false; m_size = 0; - m_creationTime = QDateTime(); - m_accessTime = QDateTime(); - m_modificationTime = QDateTime(); + m_creationTime = TQDateTime(); + m_accessTime = TQDateTime(); + m_modificationTime = TQDateTime(); m_bReadable = false; m_bWritable = false; m_bExecutable = false; @@ -111,16 +111,16 @@ void FileAccess::setFile( const QString& name, bool bWantToWrite ) // 1. When the local file exists and the remote location is wanted nevertheless. (unlikely) // 2. When the local file doesn't exist and should be written to. - bool bExistsLocal = QDir().exists(name); + bool bExistsLocal = TQDir().exists(name); if ( m_url.isLocalFile() || !m_url.isValid() || bExistsLocal ) // assuming that invalid means relative { - QString localName = name; + TQString localName = name; if ( !bExistsLocal && m_url.isLocalFile() && name.left(5).lower()=="file:" ) { localName = m_url.path(); // I want the path without preceding "file:" } - QFileInfo fi( localName ); -#if defined(Q_WS_WIN) + TQFileInfo fi( localName ); +#if defined(TQ_WS_WIN) // On some windows machines in a network this takes very long. // and it's not so important anyway. m_bReadable = true; @@ -151,15 +151,15 @@ void FileAccess::setFile( const QString& name, bool bWantToWrite ) m_url.setPath( m_absFilePath ); } - if ( !m_bExists && m_absFilePath.contains("@@") ) + if ( !m_bExists && m_absFilePath.tqcontains("@@") ) { // Try reading a clearcase file m_localCopy = FileAccess::tempFileName(); - QString cmd = "cleartool get -to \"" + m_localCopy + "\" \"" + m_absFilePath + "\""; + TQString cmd = "cleartool get -to \"" + m_localCopy + "\" \"" + m_absFilePath + "\""; ::system( cmd.local8Bit() ); - QFileInfo fi( m_localCopy ); -#if defined(Q_WS_WIN) + TQFileInfo fi( m_localCopy ); +#if defined(TQ_WS_WIN) m_bReadable = true;//fi.isReadable(); m_bWritable = true;//fi.isWritable(); m_bExecutable = false;//fi.isExecutable(); @@ -196,7 +196,7 @@ void FileAccess::setFile( const QString& name, bool bWantToWrite ) } } -void FileAccess::addPath( const QString& txt ) +void FileAccess::addPath( const TQString& txt ) { if ( m_url.isValid() ) { @@ -205,13 +205,13 @@ void FileAccess::addPath( const QString& txt ) } else { - QString slash = (txt.isEmpty() || txt[0]=='/') ? "" : "/"; + TQString slash = (txt.isEmpty() || txt[0]=='/') ? "" : "/"; setFile( absFilePath() + slash + txt ); } } /* Filetype: - S_IFMT 0170000 bitmask for the file type bitfields + S_IFMT 0170000 bittqmask for the file type bitfields S_IFSOCK 0140000 socket S_IFLNK 0120000 symbolic link S_IFREG 0100000 regular file @@ -224,15 +224,15 @@ void FileAccess::addPath( const QString& txt ) S_ISVTX 0001000 sticky bit (see below) Access: - S_IRWXU 00700 mask for file owner permissions + S_IRWXU 00700 tqmask for file owner permissions S_IRUSR 00400 owner has read permission S_IWUSR 00200 owner has write permission S_IXUSR 00100 owner has execute permission - S_IRWXG 00070 mask for group permissions + S_IRWXG 00070 tqmask for group permissions S_IRGRP 00040 group has read permission S_IWGRP 00020 group has write permission S_IXGRP 00010 group has execute permission - S_IRWXO 00007 mask for permissions for others (not in group) + S_IRWXO 00007 tqmask for permissions for others (not in group) S_IROTH 00004 others have read permission S_IWOTH 00002 others have write permisson S_IXOTH 00001 others have execute permission @@ -294,7 +294,7 @@ void FileAccess::setUdsEntry( const KIO::UDSEntry& e ) m_bSymLink = !m_linkTarget.isEmpty(); if ( m_name.isEmpty() ) { - int pos = m_path.findRev('/') + 1; + int pos = m_path.tqfindRev('/') + 1; m_name = m_path.mid( pos ); } m_bHidden = m_name[0]=='.'; @@ -314,28 +314,28 @@ bool FileAccess::isReadable() const { return m_bReadable; } bool FileAccess::isWritable() const { return m_bWritable; } bool FileAccess::isExecutable() const { return m_bExecutable; } bool FileAccess::isHidden() const { return m_bHidden; } -QString FileAccess::readLink() const { return m_linkTarget; } -QString FileAccess::absFilePath() const{ return m_absFilePath; } // Full abs path -QString FileAccess::fileName() const { return m_name; } // Just the name-part of the path, without parent directories -QString FileAccess::filePath() const { return m_path; } // The path-string that was used during construction -QString FileAccess::prettyAbsPath() const { return isLocal() ? m_absFilePath : m_url.prettyURL(); } +TQString FileAccess::readLink() const { return m_linkTarget; } +TQString FileAccess::absFilePath() const{ return m_absFilePath; } // Full abs path +TQString FileAccess::fileName() const { return m_name; } // Just the name-part of the path, without tqparent directories +TQString FileAccess::filePath() const { return m_path; } // The path-string that was used during construction +TQString FileAccess::prettyAbsPath() const { return isLocal() ? m_absFilePath : m_url.prettyURL(); } -QDateTime FileAccess::created() const +TQDateTime FileAccess::created() const { return ( m_creationTime.isValid() ? m_creationTime : m_modificationTime ); } -QDateTime FileAccess::lastModified() const +TQDateTime FileAccess::lastModified() const { return m_modificationTime; } -QDateTime FileAccess::lastRead() const +TQDateTime FileAccess::lastRead() const { return ( m_accessTime.isValid() ? m_accessTime : m_modificationTime ); } -static bool interruptableReadFile( QFile& f, void* pDestBuffer, unsigned long maxLength ) +static bool interruptableReadFile( TQFile& f, void* pDestBuffer, unsigned long maxLength ) { ProgressProxy pp; const unsigned long maxChunkSize = 100000; @@ -360,13 +360,13 @@ bool FileAccess::readFile( void* pDestBuffer, unsigned long maxLength ) { if ( !m_localCopy.isEmpty() ) { - QFile f( m_localCopy ); + TQFile f( m_localCopy ); if ( f.open( IO_ReadOnly ) ) return interruptableReadFile(f, pDestBuffer, maxLength);// maxLength == f.readBlock( (char*)pDestBuffer, maxLength ); } else if (m_bLocal) { - QFile f( filePath() ); + TQFile f( filePath() ); if ( f.open( IO_ReadOnly ) ) return interruptableReadFile(f, pDestBuffer, maxLength); //maxLength == f.readBlock( (char*)pDestBuffer, maxLength ); @@ -384,7 +384,7 @@ bool FileAccess::writeFile( const void* pSrcBuffer, unsigned long length ) ProgressProxy pp; if (m_bLocal) { - QFile f( filePath() ); + TQFile f( filePath() ); if ( f.open( IO_WriteOnly ) ) { const unsigned long maxChunkSize = 100000; @@ -407,11 +407,11 @@ bool FileAccess::writeFile( const void* pSrcBuffer, unsigned long length ) if ( isExecutable() ) // value is true if the old file was executable { // Preserve attributes - struct stat srcFileStatus; - int statResult = ::stat( filePath().ascii(), &srcFileStatus ); + struct stat srcFiletqStatus; + int statResult = ::stat( filePath().ascii(), &srcFiletqStatus ); if (statResult==0) { - ::chmod ( filePath().ascii(), srcFileStatus.st_mode | S_IXUSR ); + ::chmod ( filePath().ascii(), srcFiletqStatus.st_mode | S_IXUSR ); } } #endif @@ -427,13 +427,13 @@ bool FileAccess::writeFile( const void* pSrcBuffer, unsigned long length ) return false; } -bool FileAccess::copyFile( const QString& dest ) +bool FileAccess::copyFile( const TQString& dest ) { FileAccessJobHandler jh( this ); return jh.copyFile( dest ); // Handles local and remote copying. } -bool FileAccess::rename( const QString& dest ) +bool FileAccess::rename( const TQString& dest ) { FileAccessJobHandler jh( this ); return jh.rename( dest ); @@ -443,7 +443,7 @@ bool FileAccess::removeFile() { if ( isLocal() ) { - return QDir().remove( absFilePath() ); + return TQDir().remove( absFilePath() ); } else { @@ -452,13 +452,13 @@ bool FileAccess::removeFile() } } -bool FileAccess::removeFile( const QString& name ) // static +bool FileAccess::removeFile( const TQString& name ) // static { return FileAccess(name).removeFile(); } bool FileAccess::listDir( t_DirectoryList* pDirList, bool bRecursive, bool bFindHidden, - const QString& filePattern, const QString& fileAntiPattern, const QString& dirAntiPattern, + const TQString& filePattern, const TQString& fileAntiPattern, const TQString& dirAntiPattern, bool bFollowDirLinks, bool bUseCvsIgnore ) { FileAccessJobHandler jh( this ); @@ -466,34 +466,34 @@ bool FileAccess::listDir( t_DirectoryList* pDirList, bool bRecursive, bool bFind dirAntiPattern, bFollowDirLinks, bUseCvsIgnore ); } -QString FileAccess::tempFileName() +TQString FileAccess::tempFileName() { #ifdef KREPLACEMENTS_H - QString fileName; + TQString fileName; #ifdef _WIN32 - QString tmpDir = getenv("TEMP"); + TQString tmpDir = getenv("TEMP"); #else - QString tmpDir = "/tmp"; + TQString tmpDir = "/tmp"; #endif for(int i=0; ;++i) { // short filenames for WIN98 because for system() the command must not exceed 120 characters. #ifdef _WIN32 - if ( QApplication::winVersion() & Qt::WV_DOS_based ) // Win95, 98, ME - fileName = tmpDir + "\\" + QString::number(i); + if ( TQApplication::winVersion() & TQt::WV_DOS_based ) // Win95, 98, ME + fileName = tmpDir + "\\" + TQString::number(i); else - fileName = tmpDir + "/kdiff3_" + QString::number(_getpid()) + "_" + QString::number(i) +".tmp"; + fileName = tmpDir + "/kdiff3_" + TQString::number(_getpid()) + "_" + TQString::number(i) +".tmp"; #else - fileName = tmpDir + "/kdiff3_" + QString::number(getpid()) + "_" + QString::number(i) +".tmp"; + fileName = tmpDir + "/kdiff3_" + TQString::number(getpid()) + "_" + TQString::number(i) +".tmp"; #endif if ( ! FileAccess::exists(fileName) && - QFile(fileName).open(IO_WriteOnly) ) // open, truncate and close the file, true if successful + TQFile(fileName).open(IO_WriteOnly) ) // open, truncate and close the file, true if successful { break; } } - return QDir::convertSeparators(fileName+".2"); + return TQDir::convertSeparators(fileName+".2"); #else // using KDE @@ -505,7 +505,7 @@ QString FileAccess::tempFileName() #endif } -bool FileAccess::removeTempFile( const QString& name ) // static +bool FileAccess::removeTempFile( const TQString& name ) // static { if (name.endsWith(".2")) FileAccess(name.left(name.length()-2)).removeFile(); @@ -513,19 +513,19 @@ bool FileAccess::removeTempFile( const QString& name ) // static } -bool FileAccess::makeDir( const QString& dirName ) +bool FileAccess::makeDir( const TQString& dirName ) { FileAccessJobHandler fh(0); return fh.mkDir( dirName ); } -bool FileAccess::removeDir( const QString& dirName ) +bool FileAccess::removeDir( const TQString& dirName ) { FileAccessJobHandler fh(0); return fh.rmDir( dirName ); } -bool FileAccess::symLink( const QString& linkTarget, const QString& linkLocation ) +bool FileAccess::symLink( const TQString& linkTarget, const TQString& linkLocation ) { #ifdef _WIN32 return false; @@ -536,7 +536,7 @@ bool FileAccess::symLink( const QString& linkTarget, const QString& linkLocation #endif } -bool FileAccess::exists( const QString& name ) +bool FileAccess::exists( const TQString& name ) { FileAccess fa( name ); return fa.exists(); @@ -548,11 +548,11 @@ long FileAccess::sizeForReading() if ( m_size == 0 && !isLocal() ) { // Size couldn't be determined. Copy the file to a local temp place. - QString localCopy = tempFileName(); + TQString localCopy = tempFileName(); bool bSuccess = copyFile( localCopy ); if ( bSuccess ) { - QFileInfo fi( localCopy ); + TQFileInfo fi( localCopy ); m_size = fi.size(); m_localCopy = localCopy; return m_size; @@ -566,17 +566,17 @@ long FileAccess::sizeForReading() return m_size; } -QString FileAccess::getStatusText() +TQString FileAccess::getStatusText() { return m_statusText; } -QString FileAccess::cleanDirPath( const QString& path ) // static +TQString FileAccess::cleanDirPath( const TQString& path ) // static { KURL url(path); if ( url.isLocalFile() || ! url.isValid() ) { - return QDir().cleanDirPath( path ); + return TQDir().cleanDirPath( path ); } else { @@ -584,12 +584,12 @@ QString FileAccess::cleanDirPath( const QString& path ) // static } } -bool FileAccess::createBackup( const QString& bakExtension ) +bool FileAccess::createBackup( const TQString& bakExtension ) { if ( exists() ) { // First rename the existing file to the bak-file. If a bak-file file exists, delete that. - QString bakName = absFilePath() + bakExtension; + TQString bakName = absFilePath() + bakExtension; FileAccess bakFile( bakName, true /*bWantToWrite*/ ); if ( bakFile.exists() ) { @@ -620,12 +620,12 @@ FileAccessJobHandler::FileAccessJobHandler( FileAccess* pFileAccess ) bool FileAccessJobHandler::stat( int detail, bool bWantToWrite ) { m_bSuccess = false; - m_pFileAccess->m_statusText = QString(); + m_pFileAccess->m_statusText = TQString(); KIO::StatJob* pStatJob = KIO::stat( m_pFileAccess->m_url, ! bWantToWrite, detail, false ); - connect( pStatJob, SIGNAL(result(KIO::Job*)), this, SLOT(slotStatResult(KIO::Job*))); + connect( pStatJob, TQT_SIGNAL(result(KIO::Job*)), this, TQT_SLOT(slotStatResult(KIO::Job*))); - g_pProgressDialog->enterEventLoop( pStatJob, i18n("Getting file status: %1").arg(m_pFileAccess->prettyAbsPath()) ); + g_pProgressDialog->enterEventLoop( pStatJob, i18n("Getting file status: %1").tqarg(m_pFileAccess->prettyAbsPath()) ); return m_bSuccess; } @@ -662,20 +662,20 @@ bool FileAccessJobHandler::get(void* pDestBuffer, long maxLength ) m_pTransferBuffer = (char*)pDestBuffer; m_maxLength = maxLength; m_bSuccess = false; - m_pFileAccess->m_statusText = QString(); + m_pFileAccess->m_statusText = TQString(); - connect( pJob, SIGNAL(result(KIO::Job*)), this, SLOT(slotSimpleJobResult(KIO::Job*))); - connect( pJob, SIGNAL(data(KIO::Job*,const QByteArray &)), this, SLOT(slotGetData(KIO::Job*, const QByteArray&))); - connect( pJob, SIGNAL(percent(KIO::Job*,unsigned long)), this, SLOT(slotPercent(KIO::Job*, unsigned long))); + connect( pJob, TQT_SIGNAL(result(KIO::Job*)), this, TQT_SLOT(slotSimpleJobResult(KIO::Job*))); + connect( pJob, TQT_SIGNAL(data(KIO::Job*,const TQByteArray &)), this, TQT_SLOT(slotGetData(KIO::Job*, const TQByteArray&))); + connect( pJob, TQT_SIGNAL(percent(KIO::Job*,unsigned long)), this, TQT_SLOT(slotPercent(KIO::Job*, unsigned long))); - g_pProgressDialog->enterEventLoop( pJob, i18n("Reading file: %1").arg(m_pFileAccess->prettyAbsPath()) ); + g_pProgressDialog->enterEventLoop( pJob, i18n("Reading file: %1").tqarg(m_pFileAccess->prettyAbsPath()) ); return m_bSuccess; } else return true; } -void FileAccessJobHandler::slotGetData( KIO::Job* pJob, const QByteArray& newData ) +void FileAccessJobHandler::slotGetData( KIO::Job* pJob, const TQByteArray& newData ) { if ( pJob->error() ) { @@ -698,20 +698,20 @@ bool FileAccessJobHandler::put(const void* pSrcBuffer, long maxLength, bool bOve m_pTransferBuffer = (char*)pSrcBuffer; m_maxLength = maxLength; m_bSuccess = false; - m_pFileAccess->m_statusText = QString(); + m_pFileAccess->m_statusText = TQString(); - connect( pJob, SIGNAL(result(KIO::Job*)), this, SLOT(slotPutJobResult(KIO::Job*))); - connect( pJob, SIGNAL(dataReq(KIO::Job*, QByteArray&)), this, SLOT(slotPutData(KIO::Job*, QByteArray&))); - connect( pJob, SIGNAL(percent(KIO::Job*,unsigned long)), this, SLOT(slotPercent(KIO::Job*, unsigned long))); + connect( pJob, TQT_SIGNAL(result(KIO::Job*)), this, TQT_SLOT(slotPutJobResult(KIO::Job*))); + connect( pJob, TQT_SIGNAL(dataReq(KIO::Job*, TQByteArray&)), this, TQT_SLOT(slotPutData(KIO::Job*, TQByteArray&))); + connect( pJob, TQT_SIGNAL(percent(KIO::Job*,unsigned long)), this, TQT_SLOT(slotPercent(KIO::Job*, unsigned long))); - g_pProgressDialog->enterEventLoop( pJob, i18n("Writing file: %1").arg(m_pFileAccess->prettyAbsPath()) ); + g_pProgressDialog->enterEventLoop( pJob, i18n("Writing file: %1").tqarg(m_pFileAccess->prettyAbsPath()) ); return m_bSuccess; } else return true; } -void FileAccessJobHandler::slotPutData( KIO::Job* pJob, QByteArray& data ) +void FileAccessJobHandler::slotPutData( KIO::Job* pJob, TQByteArray& data ) { if ( pJob->error() ) { @@ -721,7 +721,7 @@ void FileAccessJobHandler::slotPutData( KIO::Job* pJob, QByteArray& data ) { long maxChunkSize = 100000; long length = min2( maxChunkSize, m_maxLength - m_transferredBytes ); - bool bSuccess = data.resize( length ); + bool bSuccess = data.tqresize( length ); if ( bSuccess ) { if ( length>0 ) @@ -752,47 +752,47 @@ void FileAccessJobHandler::slotPutJobResult(KIO::Job* pJob) g_pProgressDialog->exitEventLoop(); // Close the dialog, return from exec() } -bool FileAccessJobHandler::mkDir( const QString& dirName ) +bool FileAccessJobHandler::mkDir( const TQString& dirName ) { KURL dirURL = KURL::fromPathOrURL( dirName ); if ( dirName.isEmpty() ) return false; else if ( dirURL.isLocalFile() ) { - return QDir().mkdir( dirURL.path() ); + return TQDir().mkdir( dirURL.path() ); } else { m_bSuccess = false; KIO::SimpleJob* pJob = KIO::mkdir( dirURL ); - connect( pJob, SIGNAL(result(KIO::Job*)), this, SLOT(slotSimpleJobResult(KIO::Job*))); + connect( pJob, TQT_SIGNAL(result(KIO::Job*)), this, TQT_SLOT(slotSimpleJobResult(KIO::Job*))); - g_pProgressDialog->enterEventLoop( pJob, i18n("Making directory: %1").arg(dirName) ); + g_pProgressDialog->enterEventLoop( pJob, i18n("Making directory: %1").tqarg(dirName) ); return m_bSuccess; } } -bool FileAccessJobHandler::rmDir( const QString& dirName ) +bool FileAccessJobHandler::rmDir( const TQString& dirName ) { KURL dirURL = KURL::fromPathOrURL( dirName ); if ( dirName.isEmpty() ) return false; else if ( dirURL.isLocalFile() ) { - return QDir().rmdir( dirURL.path() ); + return TQDir().rmdir( dirURL.path() ); } else { m_bSuccess = false; KIO::SimpleJob* pJob = KIO::rmdir( dirURL ); - connect( pJob, SIGNAL(result(KIO::Job*)), this, SLOT(slotSimpleJobResult(KIO::Job*))); + connect( pJob, TQT_SIGNAL(result(KIO::Job*)), this, TQT_SLOT(slotSimpleJobResult(KIO::Job*))); - g_pProgressDialog->enterEventLoop(pJob, i18n("Removing directory: %1").arg(dirName)); + g_pProgressDialog->enterEventLoop(pJob, i18n("Removing directory: %1").tqarg(dirName)); return m_bSuccess; } } -bool FileAccessJobHandler::removeFile( const QString& fileName ) +bool FileAccessJobHandler::removeFile( const TQString& fileName ) { if ( fileName.isEmpty() ) return false; @@ -800,14 +800,14 @@ bool FileAccessJobHandler::removeFile( const QString& fileName ) { m_bSuccess = false; KIO::SimpleJob* pJob = KIO::file_delete( KURL::fromPathOrURL(fileName), false ); - connect( pJob, SIGNAL(result(KIO::Job*)), this, SLOT(slotSimpleJobResult(KIO::Job*))); + connect( pJob, TQT_SIGNAL(result(KIO::Job*)), this, TQT_SLOT(slotSimpleJobResult(KIO::Job*))); - g_pProgressDialog->enterEventLoop( pJob, i18n("Removing file: %1").arg(fileName) ); + g_pProgressDialog->enterEventLoop( pJob, i18n("Removing file: %1").tqarg(fileName) ); return m_bSuccess; } } -bool FileAccessJobHandler::symLink( const QString& linkTarget, const QString& linkLocation ) +bool FileAccessJobHandler::symLink( const TQString& linkTarget, const TQString& linkLocation ) { if ( linkTarget.isEmpty() || linkLocation.isEmpty() ) return false; @@ -815,26 +815,26 @@ bool FileAccessJobHandler::symLink( const QString& linkTarget, const QString& li { m_bSuccess = false; KIO::CopyJob* pJob = KIO::link( KURL::fromPathOrURL(linkTarget), KURL::fromPathOrURL(linkLocation), false ); - connect( pJob, SIGNAL(result(KIO::Job*)), this, SLOT(slotSimpleJobResult(KIO::Job*))); + connect( pJob, TQT_SIGNAL(result(KIO::Job*)), this, TQT_SLOT(slotSimpleJobResult(KIO::Job*))); g_pProgressDialog->enterEventLoop( pJob, - i18n("Creating symbolic link: %1 -> %2").arg(linkLocation).arg(linkTarget) ); + i18n("Creating symbolic link: %1 -> %2").tqarg(linkLocation).tqarg(linkTarget) ); return m_bSuccess; } } -bool FileAccessJobHandler::rename( const QString& dest ) +bool FileAccessJobHandler::rename( const TQString& dest ) { if ( dest.isEmpty() ) return false; KURL kurl = KURL::fromPathOrURL( dest ); if ( !kurl.isValid() ) - kurl = KURL::fromPathOrURL( QDir().absFilePath(dest) ); // assuming that invalid means relative + kurl = KURL::fromPathOrURL( TQDir().absFilePath(dest) ); // assuming that invalid means relative if ( m_pFileAccess->isLocal() && kurl.isLocalFile() ) { - return QDir().rename( m_pFileAccess->absFilePath(), kurl.path() ); + return TQDir().rename( m_pFileAccess->absFilePath(), kurl.path() ); } else { @@ -844,11 +844,11 @@ bool FileAccessJobHandler::rename( const QString& dest ) int permissions=-1; m_bSuccess = false; KIO::FileCopyJob* pJob = KIO::file_move( m_pFileAccess->m_url, kurl, permissions, bOverwrite, bResume, bShowProgress ); - connect( pJob, SIGNAL(result(KIO::Job*)), this, SLOT(slotSimpleJobResult(KIO::Job*))); - connect( pJob, SIGNAL(percent(KIO::Job*,unsigned long)), this, SLOT(slotPercent(KIO::Job*, unsigned long))); + connect( pJob, TQT_SIGNAL(result(KIO::Job*)), this, TQT_SLOT(slotSimpleJobResult(KIO::Job*))); + connect( pJob, TQT_SIGNAL(percent(KIO::Job*,unsigned long)), this, TQT_SLOT(slotPercent(KIO::Job*, unsigned long))); g_pProgressDialog->enterEventLoop( pJob, - i18n("Renaming file: %1 -> %2").arg(m_pFileAccess->prettyAbsPath()).arg(dest) ); + i18n("Renaming file: %1 -> %2").tqarg(m_pFileAccess->prettyAbsPath()).tqarg(dest) ); return m_bSuccess; } } @@ -868,11 +868,11 @@ void FileAccessJobHandler::slotSimpleJobResult(KIO::Job* pJob) // Copy local or remote files. -bool FileAccessJobHandler::copyFile( const QString& dest ) +bool FileAccessJobHandler::copyFile( const TQString& dest ) { ProgressProxy pp; KURL destUrl = KURL::fromPathOrURL( dest ); - m_pFileAccess->m_statusText = QString(); + m_pFileAccess->m_statusText = TQString(); if ( ! m_pFileAccess->isLocal() || ! destUrl.isLocalFile() ) // if either url is nonlocal { bool bOverwrite = false; @@ -881,54 +881,51 @@ bool FileAccessJobHandler::copyFile( const QString& dest ) int permissions = (m_pFileAccess->isExecutable()?0111:0)+(m_pFileAccess->isWritable()?0222:0)+(m_pFileAccess->isReadable()?0444:0); m_bSuccess = false; KIO::FileCopyJob* pJob = KIO::file_copy ( m_pFileAccess->m_url, destUrl, permissions, bOverwrite, bResume, bShowProgress ); - connect( pJob, SIGNAL(result(KIO::Job*)), this, SLOT(slotSimpleJobResult(KIO::Job*))); - connect( pJob, SIGNAL(percent(KIO::Job*,unsigned long)), this, SLOT(slotPercent(KIO::Job*, unsigned long))); + connect( pJob, TQT_SIGNAL(result(KIO::Job*)), this, TQT_SLOT(slotSimpleJobResult(KIO::Job*))); + connect( pJob, TQT_SIGNAL(percent(KIO::Job*,unsigned long)), this, TQT_SLOT(slotPercent(KIO::Job*, unsigned long))); g_pProgressDialog->enterEventLoop( pJob, - i18n("Copying file: %1 -> %2").arg(m_pFileAccess->prettyAbsPath()).arg(dest) ); + i18n("Copying file: %1 -> %2").tqarg(m_pFileAccess->prettyAbsPath()).tqarg(dest) ); return m_bSuccess; // Note that the KIO-slave preserves the original date, if this is supported. } // Both files are local: - QString srcName = m_pFileAccess->absFilePath(); - QString destName = dest; - QFile srcFile( srcName ); - QFile destFile( destName ); + TQString srcName = m_pFileAccess->absFilePath(); + TQString destName = dest; + TQFile srcFile( srcName ); + TQFile destFile( destName ); bool bReadSuccess = srcFile.open( IO_ReadOnly ); if ( bReadSuccess == false ) { - m_pFileAccess->m_statusText = i18n("Error during file copy operation: Opening file for reading failed. Filename: %1").arg(srcName); + m_pFileAccess->m_statusText = i18n("Error during file copy operation: Opening file for reading failed. Filename: %1").tqarg(srcName); return false; } bool bWriteSuccess = destFile.open( IO_WriteOnly ); if ( bWriteSuccess == false ) { - m_pFileAccess->m_statusText = i18n("Error during file copy operation: Opening file for writing failed. Filename: %1").arg(destName); + m_pFileAccess->m_statusText = i18n("Error during file copy operation: Opening file for writing failed. Filename: %1").tqarg(destName); return false; } -#if QT_VERSION==230 - typedef long Q_LONG; -#endif std::vector<char> buffer(100000); - Q_LONG bufSize = buffer.size(); - Q_LONG srcSize = srcFile.size(); + TQ_LONG bufSize = buffer.size(); + TQ_LONG srcSize = srcFile.size(); while ( srcSize > 0 && !pp.wasCancelled() ) { - Q_LONG readSize = srcFile.readBlock( &buffer[0], min2( srcSize, bufSize ) ); + TQ_LONG readSize = srcFile.readBlock( &buffer[0], min2( srcSize, bufSize ) ); if ( readSize==-1 || readSize==0 ) { - m_pFileAccess->m_statusText = i18n("Error during file copy operation: Reading failed. Filename: %1").arg(srcName); + m_pFileAccess->m_statusText = i18n("Error during file copy operation: Reading failed. Filename: %1").tqarg(srcName); return false; } srcSize -= readSize; while ( readSize > 0 ) { - Q_LONG writeSize = destFile.writeBlock( &buffer[0], readSize ); + TQ_LONG writeSize = destFile.writeBlock( &buffer[0], readSize ); if ( writeSize==-1 || writeSize==0 ) { - m_pFileAccess->m_statusText = i18n("Error during file copy operation: Writing failed. Filename: %1").arg(destName); + m_pFileAccess->m_statusText = i18n("Error during file copy operation: Writing failed. Filename: %1").tqarg(destName); return false; } readSize -= writeSize; @@ -941,40 +938,40 @@ bool FileAccessJobHandler::copyFile( const QString& dest ) // Update the times of the destFile #ifdef _WIN32 - struct _stat srcFileStatus; - int statResult = ::_stat( srcName.ascii(), &srcFileStatus ); + struct _stat srcFiletqStatus; + int statResult = ::_stat( srcName.ascii(), &srcFiletqStatus ); if (statResult==0) { _utimbuf destTimes; - destTimes.actime = srcFileStatus.st_atime;/* time of last access */ - destTimes.modtime = srcFileStatus.st_mtime;/* time of last modification */ + destTimes.actime = srcFiletqStatus.st_atime;/* time of last access */ + destTimes.modtime = srcFiletqStatus.st_mtime;/* time of last modification */ _utime ( destName.ascii(), &destTimes ); - _chmod ( destName.ascii(), srcFileStatus.st_mode ); + _chmod ( destName.ascii(), srcFiletqStatus.st_mode ); } #else - struct stat srcFileStatus; - int statResult = ::stat( srcName.ascii(), &srcFileStatus ); + struct stat srcFiletqStatus; + int statResult = ::stat( srcName.ascii(), &srcFiletqStatus ); if (statResult==0) { utimbuf destTimes; - destTimes.actime = srcFileStatus.st_atime;/* time of last access */ - destTimes.modtime = srcFileStatus.st_mtime;/* time of last modification */ + destTimes.actime = srcFiletqStatus.st_atime;/* time of last access */ + destTimes.modtime = srcFiletqStatus.st_mtime;/* time of last modification */ utime ( destName.ascii(), &destTimes ); - chmod ( destName.ascii(), srcFileStatus.st_mode ); + chmod ( destName.ascii(), srcFiletqStatus.st_mode ); } #endif return true; } -bool wildcardMultiMatch( const QString& wildcard, const QString& testString, bool bCaseSensitive ) +bool wildcardMultiMatch( const TQString& wildcard, const TQString& testString, bool bCaseSensitive ) { - QStringList sl = QStringList::split( ";", wildcard ); + TQStringList sl = TQStringList::split( ";", wildcard ); - for ( QStringList::Iterator it = sl.begin(); it != sl.end(); ++it ) + for ( TQStringList::Iterator it = sl.begin(); it != sl.end(); ++it ) { - QRegExp pattern( *it, bCaseSensitive, true /*wildcard mode*/); + TQRegExp pattern( *it, bCaseSensitive, true /*wildcard mode*/); if ( pattern.exactMatch( testString ) ) return true; } @@ -993,17 +990,17 @@ class CvsIgnoreList public: CvsIgnoreList(){} void init(FileAccess& dir, bool bUseLocalCvsIgnore ); - bool matches(const QString& fileName, bool bCaseSensitive ) const; + bool matches(const TQString& fileName, bool bCaseSensitive ) const; private: - void addEntriesFromString(const QString& str); - void addEntriesFromFile(const QString& name); - void addEntry(const QString& entry); - - QStringList m_exactPatterns; - QStringList m_startPatterns; - QStringList m_endPatterns; - QStringList m_generalPatterns; + void addEntriesFromString(const TQString& str); + void addEntriesFromFile(const TQString& name); + void addEntry(const TQString& entry); + + TQStringList m_exactPatterns; + TQStringList m_startPatterns; + TQStringList m_endPatterns; + TQStringList m_generalPatterns; }; @@ -1013,9 +1010,9 @@ void CvsIgnoreList::init( FileAccess& dir, bool bUseLocalCvsIgnore ) ".nse_depinfo #* .#* cvslog.* ,* CVS CVS.adm .del-* *.a *.olb *.o *.obj " "*.so *.Z *~ *.old *.elc *.ln *.bak *.BAK *.orig *.rej *.exe _$* *$"; - addEntriesFromString(QString::fromLatin1(ignorestr)); - addEntriesFromFile(QDir::homeDirPath() + "/.cvsignore"); - addEntriesFromString(QString::fromLocal8Bit(::getenv("CVSIGNORE"))); + addEntriesFromString(TQString::tqfromLatin1(ignorestr)); + addEntriesFromFile(TQDir::homeDirPath() + "/.cvsignore"); + addEntriesFromString(TQString::fromLocal8Bit(::getenv("CVSIGNORE"))); if (bUseLocalCvsIgnore) { @@ -1035,7 +1032,7 @@ void CvsIgnoreList::init( FileAccess& dir, bool bUseLocalCvsIgnore ) { if (pos>pos1) { - addEntry( QString::fromLatin1( &buf[pos1], pos-pos1 ) ); + addEntry( TQString::tqfromLatin1( &buf[pos1], pos-pos1 ) ); } ++pos1; } @@ -1047,11 +1044,11 @@ void CvsIgnoreList::init( FileAccess& dir, bool bUseLocalCvsIgnore ) } -void CvsIgnoreList::addEntriesFromString(const QString& str) +void CvsIgnoreList::addEntriesFromString(const TQString& str) { int posLast(0); int pos; - while ((pos = str.find(' ', posLast)) >= 0) + while ((pos = str.tqfind(' ', posLast)) >= 0) { if (pos > posLast) addEntry(str.mid(posLast, pos - posLast)); @@ -1063,13 +1060,13 @@ void CvsIgnoreList::addEntriesFromString(const QString& str) } -void CvsIgnoreList::addEntriesFromFile(const QString &name) +void CvsIgnoreList::addEntriesFromFile(const TQString &name) { - QFile file(name); + TQFile file(name); if( file.open(IO_ReadOnly) ) { - QTextStream stream(&file); + TQTextStream stream(&file); while( !stream.eof() ) { addEntriesFromString(stream.readLine()); @@ -1077,9 +1074,9 @@ void CvsIgnoreList::addEntriesFromFile(const QString &name) } } -void CvsIgnoreList::addEntry(const QString& pattern) +void CvsIgnoreList::addEntry(const TQString& pattern) { - if (pattern != QString("!")) + if (pattern != TQString("!")) { if (pattern.isEmpty()) return; @@ -1090,13 +1087,13 @@ void CvsIgnoreList::addEntry(const QString& pattern) // Count number of '*' and '?' unsigned int nofMetaCharacters = 0; - const QChar* pos; - pos = pattern.unicode(); - const QChar* posEnd; + const TQChar* pos; + pos = pattern.tqunicode(); + const TQChar* posEnd; posEnd=pos + pattern.length(); while (pos < posEnd) { - if( *pos==QChar('*') || *pos==QChar('?') ) ++nofMetaCharacters; + if( *pos==TQChar('*') || *pos==TQChar('?') ) ++nofMetaCharacters; ++pos; } @@ -1106,11 +1103,11 @@ void CvsIgnoreList::addEntry(const QString& pattern) } else if ( nofMetaCharacters==1 ) { - if ( pattern.constref(0) == QChar('*') ) + if ( pattern.constref(0) == TQChar('*') ) { m_endPatterns.append( pattern.right( pattern.length() - 1) ); } - else if (pattern.constref(pattern.length() - 1) == QChar('*')) + else if (pattern.constref(pattern.length() - 1) == TQChar('*')) { m_startPatterns.append( pattern.left( pattern.length() - 1) ); } @@ -1133,15 +1130,15 @@ void CvsIgnoreList::addEntry(const QString& pattern) } } -bool CvsIgnoreList::matches(const QString& text, bool bCaseSensitive ) const +bool CvsIgnoreList::matches(const TQString& text, bool bCaseSensitive ) const { - if (m_exactPatterns.find(text) != m_exactPatterns.end()) + if (m_exactPatterns.tqfind(text) != m_exactPatterns.end()) { return true; } - QStringList::ConstIterator it; - QStringList::ConstIterator itEnd; + TQStringList::ConstIterator it; + TQStringList::ConstIterator itEnd; for ( it=m_startPatterns.begin(), itEnd=m_startPatterns.end(); it != itEnd; ++it) { if (text.startsWith(*it)) @@ -1159,7 +1156,7 @@ bool CvsIgnoreList::matches(const QString& text, bool bCaseSensitive ) const } /* - for (QValueList<QCString>::const_iterator it(m_generalPatterns.begin()), + for (TQValueList<TQCString>::const_iterator it(m_generalPatterns.begin()), itEnd(m_generalPatterns.end()); it != itEnd; ++it) { @@ -1173,23 +1170,17 @@ bool CvsIgnoreList::matches(const QString& text, bool bCaseSensitive ) const for ( it = m_generalPatterns.begin(); it != m_generalPatterns.end(); ++it ) { - QRegExp pattern( *it, bCaseSensitive, true /*wildcard mode*/); -#if QT_VERSION==230 - int len=0; - if ( pattern.match( text, 0, &len )!=-1 && len==text.length()) - return true; -#else + TQRegExp pattern( *it, bCaseSensitive, true /*wildcard mode*/); if ( pattern.exactMatch( text ) ) return true; -#endif } return false; } -static QString nicePath( const QFileInfo& fi ) +static TQString nicePath( const TQFileInfo& fi ) { - QString fp = fi.filePath(); + TQString fp = fi.filePath(); if ( fp.length()>2 && fp[0] == '.' && fp[1] == '/' ) { return fp.mid(2); @@ -1208,8 +1199,8 @@ static bool cvsIgnoreExists( t_DirectoryList* pDirList ) return false; } -bool FileAccessJobHandler::listDir( t_DirectoryList* pDirList, bool bRecursive, bool bFindHidden, const QString& filePattern, - const QString& fileAntiPattern, const QString& dirAntiPattern, bool bFollowDirLinks, bool bUseCvsIgnore ) +bool FileAccessJobHandler::listDir( t_DirectoryList* pDirList, bool bRecursive, bool bFindHidden, const TQString& filePattern, + const TQString& fileAntiPattern, const TQString& dirAntiPattern, bool bFollowDirLinks, bool bUseCvsIgnore ) { ProgressProxy pp; m_pDirList = pDirList; @@ -1228,19 +1219,19 @@ bool FileAccessJobHandler::listDir( t_DirectoryList* pDirList, bool bRecursive, if( m_pFileAccess->isLocal() ) { - QString currentPath = QDir::currentDirPath(); - m_bSuccess = QDir::setCurrent( m_pFileAccess->absFilePath() ); + TQString currentPath = TQDir::currentDirPath(); + m_bSuccess = TQDir::setCurrent( m_pFileAccess->absFilePath() ); if ( m_bSuccess ) { #ifndef _WIN32 m_bSuccess = true; - QDir dir( "." ); + TQDir dir( "." ); - dir.setSorting( QDir::Name | QDir::DirsFirst ); - dir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden ); + dir.setSorting( TQDir::Name | TQDir::DirsFirst ); + dir.setFilter( TQDir::Files | TQDir::Dirs | TQDir::Hidden ); dir.setMatchAllDirs( true ); - const QFileInfoList *fiList = dir.entryInfoList(); + const TQFileInfoList *fiList = dir.entryInfoList(); if ( fiList == 0 ) { // No Permission to read directory or other error. @@ -1248,10 +1239,10 @@ bool FileAccessJobHandler::listDir( t_DirectoryList* pDirList, bool bRecursive, } else { - QFileInfoListIterator it( *fiList ); // create list iterator + TQFileInfoListIterator it( *fiList ); // create list iterator for ( ; it.current() != 0; ++it ) // for each file... { - QFileInfo* fi = it.current(); + TQFileInfo* fi = it.current(); if ( fi->fileName() == "." || fi->fileName()==".." ) continue; @@ -1259,25 +1250,25 @@ bool FileAccessJobHandler::listDir( t_DirectoryList* pDirList, bool bRecursive, } } #else - QString pattern ="*.*"; + TQString pattern ="*.*"; WIN32_FIND_DATA findData; WIN32_FIND_DATAA& findDataA=*(WIN32_FIND_DATAA*)&findData; // Needed for Win95 - HANDLE searchHandle = QT_WA_INLINE( + HANDLE searchHandle = TQT_WA_INLINE( FindFirstFile( (TCHAR*)pattern.ucs2(), &findData ), FindFirstFileA( pattern.local8Bit(), &findDataA ) ); if ( searchHandle != INVALID_HANDLE_VALUE ) { - QString absPath = m_pFileAccess->absFilePath(); - QString relPath = m_pFileAccess->filePath(); + TQString absPath = m_pFileAccess->absFilePath(); + TQString relPath = m_pFileAccess->filePath(); bool bFirst=true; while( ! pp.wasCancelled() ) { if (!bFirst) { - if ( ! QT_WA_INLINE( + if ( ! TQT_WA_INLINE( FindNextFile(searchHandle,&findData), FindNextFileA(searchHandle,&findDataA)) ) break; @@ -1289,11 +1280,11 @@ bool FileAccessJobHandler::listDir( t_DirectoryList* pDirList, bool bRecursive, FILETIME ft; SYSTEMTIME t; FileTimeToLocalFileTime( &findData.ftLastWriteTime, &ft ); FileTimeToSystemTime(&ft,&t); - fa.m_modificationTime = QDateTime( QDate(t.wYear, t.wMonth, t.wDay), QTime(t.wHour, t.wMinute, t.wSecond) ); + fa.m_modificationTime = TQDateTime( TQDate(t.wYear, t.wMonth, t.wDay), TQTime(t.wHour, t.wMinute, t.wSecond) ); FileTimeToLocalFileTime( &findData.ftLastAccessTime, &ft ); FileTimeToSystemTime(&ft,&t); - fa.m_accessTime = QDateTime( QDate(t.wYear, t.wMonth, t.wDay), QTime(t.wHour, t.wMinute, t.wSecond) ); + fa.m_accessTime = TQDateTime( TQDate(t.wYear, t.wMonth, t.wDay), TQTime(t.wHour, t.wMinute, t.wSecond) ); FileTimeToLocalFileTime( &findData.ftCreationTime, &ft ); FileTimeToSystemTime(&ft,&t); - fa.m_creationTime = QDateTime( QDate(t.wYear, t.wMonth, t.wDay), QTime(t.wHour, t.wMinute, t.wSecond) ); + fa.m_creationTime = TQDateTime( TQDate(t.wYear, t.wMonth, t.wDay), TQTime(t.wHour, t.wMinute, t.wSecond) ); int a = findData.dwFileAttributes; fa.m_bWritable = ( a & FILE_ATTRIBUTE_READONLY) == 0; @@ -1309,9 +1300,9 @@ bool FileAccessJobHandler::listDir( t_DirectoryList* pDirList, bool bRecursive, fa.m_bSymLink = false; fa.m_fileType = 0; - fa.m_name = QT_WA_INLINE( - QString::fromUcs2((const ushort*)findData.cFileName), - QString::fromLocal8Bit(findDataA.cFileName) + fa.m_name = TQT_WA_INLINE( + TQString::fromUcs2((const ushort*)findData.cFileName), + TQString::fromLocal8Bit(findDataA.cFileName) ); fa.m_path = fa.m_name; @@ -1324,12 +1315,12 @@ bool FileAccessJobHandler::listDir( t_DirectoryList* pDirList, bool bRecursive, } else { - QDir::setCurrent( currentPath ); // restore current path + TQDir::setCurrent( currentPath ); // restore current path return false; } #endif } - QDir::setCurrent( currentPath ); // restore current path + TQDir::setCurrent( currentPath ); // restore current path } else { @@ -1341,19 +1332,19 @@ bool FileAccessJobHandler::listDir( t_DirectoryList* pDirList, bool bRecursive, m_bSuccess = false; if ( pListJob!=0 ) { - connect( pListJob, SIGNAL( entries( KIO::Job *, const KIO::UDSEntryList& ) ), - this, SLOT( slotListDirProcessNewEntries( KIO::Job *, const KIO::UDSEntryList& )) ); - connect( pListJob, SIGNAL( result( KIO::Job* )), - this, SLOT( slotSimpleJobResult(KIO::Job*) ) ); + connect( pListJob, TQT_SIGNAL( entries( KIO::Job *, const KIO::UDSEntryList& ) ), + this, TQT_SLOT( slotListDirProcessNewEntries( KIO::Job *, const KIO::UDSEntryList& )) ); + connect( pListJob, TQT_SIGNAL( result( KIO::Job* )), + this, TQT_SLOT( slotSimpleJobResult(KIO::Job*) ) ); - connect( pListJob, SIGNAL( infoMessage(KIO::Job*, const QString&)), - this, SLOT( slotListDirInfoMessage(KIO::Job*, const QString&) )); + connect( pListJob, TQT_SIGNAL( infoMessage(KIO::Job*, const TQString&)), + this, TQT_SLOT( slotListDirInfoMessage(KIO::Job*, const TQString&) )); // This line makes the transfer via fish unreliable.:-( - //connect( pListJob, SIGNAL(percent(KIO::Job*,unsigned long)), this, SLOT(slotPercent(KIO::Job*, unsigned long))); + //connect( pListJob, TQT_SIGNAL(percent(KIO::Job*,unsigned long)), this, TQT_SLOT(slotPercent(KIO::Job*, unsigned long))); g_pProgressDialog->enterEventLoop( pListJob, - i18n("Listing directory: %1").arg(m_pFileAccess->prettyAbsPath()) ); + i18n("Listing directory: %1").tqarg(m_pFileAccess->prettyAbsPath()) ); } } @@ -1374,7 +1365,7 @@ bool FileAccessJobHandler::listDir( t_DirectoryList* pDirList, bool bRecursive, { t_DirectoryList::iterator i2=i; ++i2; - QString fn = i->fileName(); + TQString fn = i->fileName(); if ( (!bFindHidden && i->isHidden() ) || (i->isFile() && @@ -1429,7 +1420,7 @@ bool FileAccessJobHandler::listDir( t_DirectoryList* pDirList, bool bRecursive, void FileAccessJobHandler::slotListDirProcessNewEntries( KIO::Job *, const KIO::UDSEntryList& l ) { - KURL parentUrl( m_pFileAccess->m_absFilePath ); + KURL tqparentUrl( m_pFileAccess->m_absFilePath ); KIO::UDSEntryList::ConstIterator i; for ( i=l.begin(); i!=l.end(); ++i ) @@ -1440,7 +1431,7 @@ void FileAccessJobHandler::slotListDirProcessNewEntries( KIO::Job *, const KIO:: if ( fa.filePath() != "." && fa.filePath() != ".." ) { - fa.m_url = parentUrl; + fa.m_url = tqparentUrl; fa.m_url.addPath( fa.filePath() ); fa.m_absFilePath = fa.m_url.url(); m_pDirList->push_back( fa ); @@ -1448,7 +1439,7 @@ void FileAccessJobHandler::slotListDirProcessNewEntries( KIO::Job *, const KIO:: } } -void FileAccessJobHandler::slotListDirInfoMessage( KIO::Job*, const QString& msg ) +void FileAccessJobHandler::slotListDirInfoMessage( KIO::Job*, const TQString& msg ) { g_pProgressDialog->setInformation( msg, 0.0 ); } @@ -1459,32 +1450,32 @@ void FileAccessJobHandler::slotPercent( KIO::Job*, unsigned long percent ) } -ProgressDialog::ProgressDialog( QWidget* pParent ) -: QDialog( pParent, 0, true ) +ProgressDialog::ProgressDialog( TQWidget* pParent ) +: TQDialog( pParent, 0, true ) { m_bStayHidden = false; - QVBoxLayout* layout = new QVBoxLayout(this); + TQVBoxLayout* tqlayout = new TQVBoxLayout(this); - m_pInformation = new QLabel( " ", this ); - layout->addWidget( m_pInformation ); + m_pInformation = new TQLabel( " ", this ); + tqlayout->addWidget( m_pInformation ); m_pProgressBar = new KProgress(1000, this); - layout->addWidget( m_pProgressBar ); + tqlayout->addWidget( m_pProgressBar ); - m_pSubInformation = new QLabel( " ", this); - layout->addWidget( m_pSubInformation ); + m_pSubInformation = new TQLabel( " ", this); + tqlayout->addWidget( m_pSubInformation ); m_pSubProgressBar = new KProgress(1000, this); - layout->addWidget( m_pSubProgressBar ); + tqlayout->addWidget( m_pSubProgressBar ); - m_pSlowJobInfo = new QLabel( " ", this); - layout->addWidget( m_pSlowJobInfo ); + m_pSlowJobInfo = new TQLabel( " ", this); + tqlayout->addWidget( m_pSlowJobInfo ); - QHBoxLayout* hlayout = new QHBoxLayout( layout ); - hlayout->addStretch(1); - m_pAbortButton = new QPushButton( i18n("&Cancel"), this); - hlayout->addWidget( m_pAbortButton ); - connect( m_pAbortButton, SIGNAL(clicked()), this, SLOT(slotAbort()) ); + TQHBoxLayout* htqlayout = new TQHBoxLayout( tqlayout ); + htqlayout->addStretch(1); + m_pAbortButton = new TQPushButton( i18n("&Cancel"), this); + htqlayout->addWidget( m_pAbortButton ); + connect( m_pAbortButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotAbort()) ); m_progressDelayTimer = 0; resize( 400, 100 ); @@ -1531,7 +1522,7 @@ void ProgressDialog::pop( bool bRedrawUpdate ) } } -void ProgressDialog::setInformation(const QString& info, double dCurrent, bool bRedrawUpdate ) +void ProgressDialog::setInformation(const TQString& info, double dCurrent, bool bRedrawUpdate ) { if ( m_progressStack.empty() ) return; @@ -1550,7 +1541,7 @@ void ProgressDialog::setInformation(const QString& info, double dCurrent, bool b recalc(bRedrawUpdate); } -void ProgressDialog::setInformation(const QString& info, bool bRedrawUpdate ) +void ProgressDialog::setInformation(const TQString& info, bool bRedrawUpdate ) { if ( m_progressStack.empty() ) return; @@ -1618,10 +1609,10 @@ void ProgressDialog::setSubRangeTransformation( double dMin, double dMax ) pld.m_dSubRangeMax = dMax; } -void qt_enter_modal(QWidget*); -void qt_leave_modal(QWidget*); +void qt_enter_modal(TQWidget*); +void qt_leave_modal(TQWidget*); -void ProgressDialog::enterEventLoop( KIO::Job* pJob, const QString& jobInfo ) +void ProgressDialog::enterEventLoop( KIO::Job* pJob, const TQString& jobInfo ) { m_pJob = pJob; m_pSlowJobInfo->setText(""); @@ -1630,13 +1621,9 @@ void ProgressDialog::enterEventLoop( KIO::Job* pJob, const QString& jobInfo ) m_progressDelayTimer = startTimer( 3000 ); /* 3 s delay */ // instead of using exec() the eventloop is entered and exited often without hiding/showing the window. -#if QT_VERSION==230 - //qApp->enter_loop(); -#else qt_enter_modal(this); - qApp->eventLoop()->enterLoop(); + tqApp->eventLoop()->enterLoop(); qt_leave_modal(this); -#endif } void ProgressDialog::exitEventLoop() @@ -1644,7 +1631,7 @@ void ProgressDialog::exitEventLoop() killTimer( m_progressDelayTimer ); m_progressDelayTimer = 0; m_pJob = 0; - qApp->eventLoop()->exitLoop(); + tqApp->eventLoop()->exitLoop(); } void ProgressDialog::recalc( bool bUpdate ) @@ -1673,24 +1660,20 @@ void ProgressDialog::recalc( bool bUpdate ) if ( !m_bStayHidden && !isVisible() ) show(); - qApp->processEvents(); + tqApp->processEvents(); m_t1.restart(); } } -#include <qtimer.h> +#include <tqtimer.h> void ProgressDialog::show() { killTimer( m_progressDelayTimer ); m_progressDelayTimer = 0; - if ( !isVisible() && (parentWidget()==0 || parentWidget()->isVisible()) ) + if ( !isVisible() && (tqparentWidget()==0 || tqparentWidget()->isVisible()) ) { -#if QT_VERSION==230 - QWidget::show(); -#else - QDialog::show(); -#endif + TQDialog::show(); } } @@ -1698,8 +1681,8 @@ void ProgressDialog::hide() { killTimer( m_progressDelayTimer ); m_progressDelayTimer = 0; - // Calling QDialog::hide() directly doesn't always work. (?) - QTimer::singleShot( 100, this, SLOT(delayedHide()) ); + // Calling TQDialog::hide() directly doesn't always work. (?) + TQTimer::singleShot( 100, this, TQT_SLOT(delayedHide()) ); } void ProgressDialog::delayedHide() @@ -1709,7 +1692,7 @@ void ProgressDialog::delayedHide() m_pJob->kill(false); m_pJob = 0; } - QDialog::hide(); + TQDialog::hide(); m_pInformation->setText( "" ); //m_progressStack.clear(); @@ -1723,7 +1706,7 @@ void ProgressDialog::delayedHide() void ProgressDialog::reject() { m_bWasCancelled = true; - QDialog::reject(); + TQDialog::reject(); } void ProgressDialog::slotAbort() @@ -1735,14 +1718,14 @@ bool ProgressDialog::wasCancelled() { if( m_t2.elapsed()>100 ) { - qApp->processEvents(); + tqApp->processEvents(); m_t2.restart(); } return m_bWasCancelled; } -void ProgressDialog::timerEvent(QTimerEvent*) +void ProgressDialog::timerEvent(TQTimerEvent*) { if( !isVisible() ) { @@ -1762,12 +1745,12 @@ ProgressProxy::~ProgressProxy() g_pProgressDialog->pop(false); } -void ProgressProxy::setInformation( const QString& info, bool bRedrawUpdate ) +void ProgressProxy::setInformation( const TQString& info, bool bRedrawUpdate ) { g_pProgressDialog->setInformation( info, bRedrawUpdate ); } -void ProgressProxy::setInformation( const QString& info, double dCurrent, bool bRedrawUpdate ) +void ProgressProxy::setInformation( const TQString& info, double dCurrent, bool bRedrawUpdate ) { g_pProgressDialog->setInformation( info, dCurrent, bRedrawUpdate ); } |