summaryrefslogtreecommitdiffstats
path: root/src/kvilib/file
diff options
context:
space:
mode:
Diffstat (limited to 'src/kvilib/file')
-rw-r--r--src/kvilib/file/kvi_file.cpp32
-rw-r--r--src/kvilib/file/kvi_file.h32
-rw-r--r--src/kvilib/file/kvi_fileutils.cpp204
-rw-r--r--src/kvilib/file/kvi_fileutils.h58
-rw-r--r--src/kvilib/file/kvi_packagefile.cpp174
-rw-r--r--src/kvilib/file/kvi_packagefile.h62
6 files changed, 283 insertions, 279 deletions
diff --git a/src/kvilib/file/kvi_file.cpp b/src/kvilib/file/kvi_file.cpp
index 8ab1e739..227a4997 100644
--- a/src/kvilib/file/kvi_file.cpp
+++ b/src/kvilib/file/kvi_file.cpp
@@ -30,12 +30,12 @@
KviFile::KviFile()
-: QFile()
+: TQFile()
{
}
-KviFile::KviFile(const QString &name)
-: QFile(name)
+KviFile::KviFile(const TQString &name)
+: TQFile(name)
{
}
@@ -46,7 +46,7 @@ KviFile::~KviFile()
bool KviFile::openForReading()
{
#ifdef COMPILE_USE_QT4
- return open(QFile::ReadOnly);
+ return open(TQFile::ReadOnly);
#else
return open(IO_ReadOnly);
#endif
@@ -55,41 +55,41 @@ bool KviFile::openForReading()
bool KviFile::openForWriting(bool bAppend)
{
#ifdef COMPILE_USE_QT4
- return open(QFile::WriteOnly | (bAppend ? QFile::Append : QFile::Truncate));
+ return open(TQFile::WriteOnly | (bAppend ? TQFile::Append : TQFile::Truncate));
#else
return open(IO_WriteOnly | (bAppend ? IO_Append : IO_Truncate));
#endif
}
-bool KviFile::save(const QByteArray &bData)
+bool KviFile::save(const TQByteArray &bData)
{
if(!save((kvi_u32_t)(bData.size())))return false;
return (writeBlock(bData.data(),bData.size()) == ((int)(bData.size())));
}
-bool KviFile::load(QByteArray &bData)
+bool KviFile::load(TQByteArray &bData)
{
kvi_u32_t iLen;
if(!load(iLen))return false;
- bData.resize(iLen); // it is automatically null terminated in Qt 4.x... BLEAH :D
+ bData.resize(iLen); // it is automatically null terminated in TQt 4.x... BLEAH :D
if(readBlock((char *)(bData.data()),iLen) != iLen)return false;
return true;
}
#ifndef COMPILE_USE_QT4
-bool KviFile::save(const KviQCString &szData)
+bool KviFile::save(const KviTQCString &szData)
{
if(!save((kvi_u32_t)(szData.length())))return false;
return (writeBlock(szData.data(),szData.length()) == ((int)(szData.length())));
}
-bool KviFile::load(KviQCString &szData)
+bool KviFile::load(KviTQCString &szData)
{
kvi_u32_t iLen;
if(!load(iLen))return false;
- szData.resize(iLen + 1); // this would allocate one extra byte with Qt 4.x...
+ szData.resize(iLen + 1); // this would allocate one extra byte with TQt 4.x...
if(readBlock((char *)(szData.data()),iLen) != iLen)return false;
*(szData.data() + iLen) = 0;
return true;
@@ -98,22 +98,22 @@ bool KviFile::load(KviQCString &szData)
#endif
-bool KviFile::save(const QString &szData)
+bool KviFile::save(const TQString &szData)
{
- KviQCString c = KviQString::toUtf8(szData);
+ KviTQCString c = KviTQString::toUtf8(szData);
if(!save((kvi_u32_t)(c.length())))return false;
return (writeBlock(c.data(),c.length()) == ((int)(c.length())));
}
-bool KviFile::load(QString &szData)
+bool KviFile::load(TQString &szData)
{
kvi_u32_t iLen;
if(!load(iLen))return false;
- KviQCString tmp;
+ KviTQCString tmp;
tmp.resize(iLen + 1);
if(readBlock((char *)(tmp.data()),iLen) != iLen)return false;
*(tmp.data() + iLen) = 0;
- szData = QString::fromUtf8(tmp.data());
+ szData = TQString::fromUtf8(tmp.data());
return true;
}
diff --git a/src/kvilib/file/kvi_file.h b/src/kvilib/file/kvi_file.h
index 188a9dad..7cce041f 100644
--- a/src/kvilib/file/kvi_file.h
+++ b/src/kvilib/file/kvi_file.h
@@ -33,29 +33,33 @@
#include "kvi_inttypes.h"
#include "kvi_qcstring.h"
-#include <qfile.h>
+#include <tqfile.h>
#include <time.h>
#ifdef COMPILE_USE_QT4
#define kvi_file_offset_t qlonglong
#else
- #define kvi_file_offset_t QFile::Offset
+#ifdef USE_QT4
+ #define kvi_file_offset_t qint64
+#else // USE_QT4
+ #define kvi_file_offset_t TQFile::Offset
+#endif // USE_QT4
#endif
-class KVILIB_API KviFile : public QFile, public KviHeapObject
+class KVILIB_API KviFile : public TQFile, public KviHeapObject
{
public:
KviFile();
- KviFile(const QString &name);
+ KviFile(const TQString &name);
~KviFile();
public:
- // Wrappers portable across Qt 3.x and Qt 4.x
+ // Wrappers portable across TQt 3.x and TQt 4.x
bool openForReading();
bool openForWriting(bool bAppend = false);
#ifndef COMPILE_USE_QT4
- // Functions present in Qt 4.x but not Qt 3.x
+ // Functions present in TQt 4.x but not TQt 3.x
bool putChar(char c){ return putch(c) != -1; };
bool ungetChar(char c){ return ungetch(c) != -1; };
bool getChar(char * c){ *c = getch(); return *c != -1; };
@@ -64,7 +68,7 @@ public:
#endif
#ifdef COMPILE_USE_QT4
- // Missing functions in Qt 4.x
+ // Missing functions in TQt 4.x
quint64 writeBlock(const char * data,quint64 uLen){ return write(data,uLen); };
quint64 readBlock(char * data,quint64 uLen){ return read(data,uLen); };
#endif
@@ -98,16 +102,16 @@ public:
bool load(KviStr &szData);
#ifndef COMPILE_USE_QT4
- // Under Qt 4.x these collide with QByteArray
- bool save(const KviQCString &szData);
- bool load(KviQCString &szData);
+ // Under TQt 4.x these collide with TQByteArray
+ bool save(const KviTQCString &szData);
+ bool load(KviTQCString &szData);
#endif
- bool save(const QByteArray &bData);
- bool load(QByteArray &bData);
+ bool save(const TQByteArray &bData);
+ bool load(TQByteArray &bData);
- bool save(const QString &szData);
- bool load(QString &szData);
+ bool save(const TQString &szData);
+ bool load(TQString &szData);
bool skipFirst(char t,unsigned int maxdist = 0xffffffff);
bool skipFirst(const KviStr &t,unsigned int maxdist = 0xffffffff);
diff --git a/src/kvilib/file/kvi_fileutils.cpp b/src/kvilib/file/kvi_fileutils.cpp
index 648d9125..1ad09d60 100644
--- a/src/kvilib/file/kvi_fileutils.cpp
+++ b/src/kvilib/file/kvi_fileutils.cpp
@@ -31,18 +31,18 @@
#include "kvi_file.h"
#include "kvi_malloc.h"
-#include <qdir.h>
-#include <qfileinfo.h>
-#include <qglobal.h>
-#include <qtextcodec.h>
-#include <qtextstream.h>
+#include <tqdir.h>
+#include <tqfileinfo.h>
+#include <tqglobal.h>
+#include <tqtextcodec.h>
+#include <tqtextstream.h>
namespace KviFileUtils
{
/*
WORKING CODE BUT UNUSED FOR NOW
- bool readLine(QFile * f,QString &szBuffer,bool bClearBuffer)
+ bool readLine(TQFile * f,TQString &szBuffer,bool bClearBuffer)
{
// FIXME: Should this assume UTF8 encoding ?
char tmp_buf[256];
@@ -60,7 +60,7 @@ namespace KviFileUtils
if(tmp_buf[255] == '\r')cur_len--; //Ignore CR...
int lastlen = szBuffer.length();
szBuffer.setLength(lastlen + cur_len);
- QChar *p1 = szBuffer.unicode() + lastlen;
+ TQChar *p1 = szBuffer.tqunicode() + lastlen;
char * p2 = tmp_buf;
for(int i=0;i<cur_len;i++)*p1++ = *p2++;
cur_len = 0;
@@ -76,16 +76,16 @@ namespace KviFileUtils
if(tmp_buf[cur_len - 1] == '\r')cur_len--; //Ignore CR...
int lastlen = szBuffer.length();
szBuffer.setLength(lastlen + cur_len);
- QChar *p1 = szBuffer.unicode() + lastlen;
+ TQChar *p1 = szBuffer.tqunicode() + lastlen;
char * p2 = tmp_buf;
for(int i=0;i<cur_len;i++)*p1++ = *p2++;
}
return (ch == '\n'); //more data to read else a broken file or EOF
}
- bool loadFileStripCR(const QString &szPath,QString &szBuffer)
+ bool loadFileStripCR(const TQString &szPath,TQString &szBuffer)
{
- QFile f(szPath);
+ TQFile f(szPath);
if(!f.open(IO_ReadOnly))return false;
szBuffer = "";
while(readLine(&f,szBuffer,false))
@@ -97,18 +97,18 @@ namespace KviFileUtils
}
*/
- bool makeDir(const QString &szPath)
+ bool makeDir(const TQString &szPath)
{
- QDir d;
- QString dir = KviQString::trimmed(szPath);
+ TQDir d;
+ TQString dir = KviTQString::trimmed(szPath);
adjustFilePath(dir);
- QString createdDir;
+ TQString createdDir;
#ifdef COMPILE_ON_WINDOWS
#ifdef COMPILE_USE_QT4
int idx = dir.indexOf(':');
#else
- int idx = dir.find(':');
+ int idx = dir.tqfind(':');
#endif
if(idx == 1)
{
@@ -117,44 +117,44 @@ namespace KviFileUtils
}
#endif
- KviQString::stripLeft(dir,KVI_PATH_SEPARATOR_CHAR);
+ KviTQString::stripLeft(dir,KVI_PATH_SEPARATOR_CHAR);
while(!dir.isEmpty())
{
createdDir += KVI_PATH_SEPARATOR;
- createdDir += KviQString::getToken(dir,KVI_PATH_SEPARATOR_CHAR);
+ createdDir += KviTQString::getToken(dir,KVI_PATH_SEPARATOR_CHAR);
if(!directoryExists(createdDir))
{
if(!d.mkdir(createdDir))
{
- debug("Can't create directory %s",KviQString::toUtf8(createdDir).data());
+ debug("Can't create directory %s",KviTQString::toUtf8(createdDir).data());
return false;
}
}
- KviQString::stripLeft(dir,KVI_PATH_SEPARATOR_CHAR);
+ KviTQString::stripLeft(dir,KVI_PATH_SEPARATOR_CHAR);
}
return true;
}
bool makeDir(const char* path)
{
- QString szPath=QString::fromUtf8(path);
+ TQString szPath=TQString::fromUtf8(path);
return makeDir(szPath);
}
- bool renameFile(const QString &szSrc,const QString &szDst)
+ bool renameFile(const TQString &szSrc,const TQString &szDst)
{
- QDir d;
+ TQDir d;
return d.rename(szSrc,szDst);
}
bool renameFile(const char* path,const char* path2)
{
- QString szPath=QString::fromUtf8(path);
- QString szPath2=QString::fromUtf8(path2);
+ TQString szPath=TQString::fromUtf8(path);
+ TQString szPath2=TQString::fromUtf8(path2);
return renameFile(szPath,szPath2);
}
- bool copyFile(const QString &szSrc,const QString &szDst)
+ bool copyFile(const TQString &szSrc,const TQString &szDst)
{
KviFile f1(szSrc);
if(!f1.openForReading())return false;
@@ -183,139 +183,139 @@ namespace KviFileUtils
bool copyFile(const char* path,const char* path2)
{
- QString szPath=QString::fromUtf8(path);
- QString szPath2=QString::fromUtf8(path2);
+ TQString szPath=TQString::fromUtf8(path);
+ TQString szPath2=TQString::fromUtf8(path2);
return copyFile(szPath,szPath2);
}
- bool loadFile(const QString &szPath,QString &szBuffer,bool bUtf8)
+ bool loadFile(const TQString &szPath,TQString &szBuffer,bool bUtf8)
{
KviFile f(szPath);
if(!f.openForReading())return false;
if(bUtf8)
{
- QByteArray ba = f.readAll();
- szBuffer = QString::fromUtf8(ba.data(),ba.size());
+ TQByteArray ba = f.readAll();
+ szBuffer = TQString::fromUtf8(ba.data(),ba.size());
//debug("BUFFERLEN: %d",szBuffer.length());
} else {
- szBuffer = QString(f.readAll());
+ szBuffer = TQString(f.readAll());
}
return true;
}
- bool loadFile(const char* path,QString &szBuffer,bool bUtf8)
+ bool loadFile(const char* path,TQString &szBuffer,bool bUtf8)
{
- QString szPath=QString::fromUtf8(path);
+ TQString szPath=TQString::fromUtf8(path);
return loadFile(szPath,szBuffer,bUtf8);
}
- void adjustFilePath(QString &szPath)
+ void adjustFilePath(TQString &szPath)
{
#ifdef COMPILE_ON_WINDOWS
- szPath.replace('/',"\\");
+ szPath.tqreplace('/',"\\");
#ifdef COMPILE_USE_QT4
- szPath.replace("\\\\","\\");
+ szPath.tqreplace("\\\\","\\");
#else
- while(szPath.find("\\\\") != -1)szPath.replace("\\\\","\\");
+ while(szPath.tqfind("\\\\") != -1)szPath.tqreplace("\\\\","\\");
#endif
// FIXME: Use the default drive here ?
if(szPath.startsWith("\\"))szPath.prepend("C:");
#else
- szPath.replace('\\',"/");
+ szPath.tqreplace('\\',"/");
#ifdef COMPILE_USE_QT4
- szPath.replace("//","/");
+ szPath.tqreplace("//","/");
#else
- while(KviQString::find(szPath,"//") != -1)szPath.replace("//","/");
+ while(KviTQString::tqfind(szPath,"//") != -1)szPath.tqreplace("//","/");
#endif
// deal with windows paths
- if((szPath.length() > 2) && (szPath.at(0) != QChar('/')))
+ if((szPath.length() > 2) && (szPath.at(0) != TQChar('/')))
{
- if((szPath.at(1) == QChar(':')) && (szPath.at(2) == QChar('/')))
+ if((szPath.at(1) == TQChar(':')) && (szPath.at(2) == TQChar('/')))
{
szPath.remove(0,2);
}
}
#ifdef COMPILE_USE_QT4
- szPath=QDir::cleanPath(szPath);
+ szPath=TQDir::cleanPath(szPath);
#else
- szPath=QDir::cleanDirPath(szPath);
+ szPath=TQDir::cleanDirPath(szPath);
#endif
#endif
}
- bool directoryExists(const QString &szPath)
+ bool directoryExists(const TQString &szPath)
{
- QFileInfo f(szPath);
+ TQFileInfo f(szPath);
return (f.exists() && f.isDir());
}
bool directoryExists(const char* path)
{
- QString szPath=QString::fromUtf8(path);
- QFileInfo f(szPath);
+ TQString szPath=TQString::fromUtf8(path);
+ TQFileInfo f(szPath);
return (f.exists() && f.isDir());
}
- bool fileExists(const QString &szPath)
+ bool fileExists(const TQString &szPath)
{
- QFileInfo f(szPath);
+ TQFileInfo f(szPath);
return (f.exists() && f.isFile());
}
bool fileExists(const char* path)
{
- QString szPath=QString::fromUtf8(path);
+ TQString szPath=TQString::fromUtf8(path);
return fileExists(szPath);
}
- bool removeFile(const QString &szPath)
+ bool removeFile(const TQString &szPath)
{
- QDir d;
+ TQDir d;
return d.remove(szPath);
}
bool removeFile(const char* path)
{
- QString szPath=QString::fromUtf8(path);
+ TQString szPath=TQString::fromUtf8(path);
return removeFile(szPath);
}
- bool removeDir(const QString &szPath)
+ bool removeDir(const TQString &szPath)
{
- QDir d;
+ TQDir d;
return d.rmdir(szPath);
}
bool removeDir(const char* path)
{
- QString szPath=QString::fromUtf8(path);
+ TQString szPath=TQString::fromUtf8(path);
return removeDir(szPath);
}
- bool deleteDir(const QString &szPath)
+ bool deleteDir(const TQString &szPath)
{
- QDir d(szPath);
- QStringList sl = d.entryList(QDir::Dirs);
- QStringList::Iterator it;
+ TQDir d(szPath);
+ TQStringList sl = d.entryList(TQDir::Dirs);
+ TQStringList::Iterator it;
for(it=sl.begin();it != sl.end();it++)
{
- QString szSubdir = *it;
- if(!(KviQString::equalCS(szSubdir,"..") || KviQString::equalCS(szSubdir,".")))
+ TQString szSubdir = *it;
+ if(!(KviTQString::equalCS(szSubdir,"..") || KviTQString::equalCS(szSubdir,".")))
{
- QString szSubPath = szPath;
- KviQString::ensureLastCharIs(szSubPath,QChar(KVI_PATH_SEPARATOR_CHAR));
+ TQString szSubPath = szPath;
+ KviTQString::ensureLastCharIs(szSubPath,TQChar(KVI_PATH_SEPARATOR_CHAR));
szSubPath += szSubdir;
if(!KviFileUtils::deleteDir(szSubPath))
return false;
}
}
- sl = d.entryList(QDir::Files);
+ sl = d.entryList(TQDir::Files);
for(it=sl.begin();it != sl.end();it++)
{
- QString szFilePath = szPath;
- KviQString::ensureLastCharIs(szFilePath,QChar(KVI_PATH_SEPARATOR_CHAR));
+ TQString szFilePath = szPath;
+ KviTQString::ensureLastCharIs(szFilePath,TQChar(KVI_PATH_SEPARATOR_CHAR));
szFilePath += *it;
if(!KviFileUtils::removeFile(szFilePath))
return false;
@@ -324,39 +324,39 @@ namespace KviFileUtils
return KviFileUtils::removeDir(szPath);
}
- bool writeFile(const QString &szPath,const QString &szData,bool bAppend)
+ bool writeFile(const TQString &szPath,const TQString &szData,bool bAppend)
{
KviFile f(szPath);
if(!f.openForWriting(bAppend))return false;
- KviQCString szTmp = KviQString::toUtf8(szData);
+ KviTQCString szTmp = KviTQString::toUtf8(szData);
if(!szTmp.data())return true;
if(f.writeBlock(szTmp.data(),szTmp.length()) != ((int)(szTmp.length())))return false;
return true;
}
- bool writeFile(const char* path,const QString &szData,bool bAppend)
+ bool writeFile(const char* path,const TQString &szData,bool bAppend)
{
- QString szPath=QString::fromUtf8(path);
+ TQString szPath=TQString::fromUtf8(path);
return writeFile(szPath,szData,bAppend);
}
- bool writeFileLocal8Bit(const QString &szPath,const QString &szData,bool bAppend)
+ bool writeFileLocal8Bit(const TQString &szPath,const TQString &szData,bool bAppend)
{
KviFile f(szPath);
if(!f.openForWriting(bAppend))return false;
- KviQCString szTmp = QTextCodec::codecForLocale()->fromUnicode(szData);
+ KviTQCString szTmp = TQTextCodec::codecForLocale()->fromUnicode(szData);
if(!szTmp.data())return true;
if(f.writeBlock(szTmp.data(),szTmp.length()) != ((int)(szTmp.length())))return false;
return true;
}
- bool writeFileLocal8Bit(const char* path,const QString &szData,bool bAppend)
+ bool writeFileLocal8Bit(const char* path,const TQString &szData,bool bAppend)
{
- QString szPath=QString::fromUtf8(path);
+ TQString szPath=TQString::fromUtf8(path);
return writeFileLocal8Bit(szPath,szData,bAppend);
}
- bool readFile(const QString &szPath,QString &szBuffer,unsigned int uMaxSize)
+ bool readFile(const TQString &szPath,TQString &szBuffer,unsigned int uMaxSize)
{
KviFile f(szPath);
if(!f.openForReading())return false;
@@ -375,40 +375,40 @@ namespace KviFileUtils
return false;
}
buf[f.size()] = '\0';
- szBuffer = QString::fromUtf8(buf);
+ szBuffer = TQString::fromUtf8(buf);
delete[] buf;
return true;
}
- bool readFile(const char* path,QString &szBuffer,unsigned int uMaxSize)
+ bool readFile(const char* path,TQString &szBuffer,unsigned int uMaxSize)
{
- QString szPath=QString::fromUtf8(path);
+ TQString szPath=TQString::fromUtf8(path);
return readFile(szPath,szBuffer,uMaxSize);
}
- QString extractFileName(const QString &szFileNameWithPath)
+ TQString extractFileName(const TQString &szFileNameWithPath)
{
- return QFileInfo(szFileNameWithPath).fileName();
+ return TQFileInfo(szFileNameWithPath).fileName();
}
- QString extractFilePath(const QString &szFileNameWithPath)
+ TQString extractFilePath(const TQString &szFileNameWithPath)
{
- return QFileInfo(szFileNameWithPath).dirPath(true);
+ return TQFileInfo(szFileNameWithPath).dirPath(true);
}
- bool readLine(QFile * f,QString &szBuffer,bool bUtf8)
+ bool readLine(TQFile * f,TQString &szBuffer,bool bUtf8)
{
- QTextStream stream(f);
- stream.setEncoding(bUtf8 ? QTextStream::UnicodeUTF8 : QTextStream::Locale);
+ TQTextStream stream(f);
+ stream.setEncoding(bUtf8 ? TQTextStream::UnicodeUTF8 : TQTextStream::Locale);
szBuffer=stream.readLine();
return !szBuffer.isNull();
}
- bool readLines(QFile * f,QStringList &buffer,int iStartLine, int iCount, bool bUtf8)
+ bool readLines(TQFile * f,TQStringList &buffer,int iStartLine, int iCount, bool bUtf8)
{
- QTextStream stream( f );
- stream.setEncoding(bUtf8 ? QTextStream::UnicodeUTF8 : QTextStream::Locale);
+ TQTextStream stream( f );
+ stream.setEncoding(bUtf8 ? TQTextStream::UnicodeUTF8 : TQTextStream::Locale);
for(int i=0;i<iStartLine;i++)
stream.readLine();
@@ -424,21 +424,21 @@ namespace KviFileUtils
return buffer.count()!= 0;
}
- bool isReadable(const QString &szFname)
+ bool isReadable(const TQString &szFname)
{
- QFileInfo f(szFname);
+ TQFileInfo f(szFname);
return (f.exists() && f.isFile() && f.isReadable());
}
bool isReadable(const char* path)
{
- QString szPath=QString::fromUtf8(path);
+ TQString szPath=TQString::fromUtf8(path);
return isReadable(szPath);
}
- bool isAbsolutePath(const QString &szPath)
+ bool isAbsolutePath(const TQString &szPath)
{
- QFileInfo f(szPath);
+ TQFileInfo f(szPath);
return !f.isRelative();
}
};
@@ -448,18 +448,18 @@ static char hexchars[16] = { '0' , '1' , '2' , '3' , '4' , '5' , '6' , '7' , '8'
void kvi_encodeFileName(KviStr & path)
{
- QString szPath(path.ptr());
+ TQString szPath(path.ptr());
kvi_encodeFileName(szPath);
path=szPath;
}
-void kvi_encodeFileName(QString & path)
+void kvi_encodeFileName(TQString & path)
{
- QString src(path);
+ TQString src(path);
path="";
for(int i=0;i<src.length();i++)
{
- QChar cur=src[i];
+ TQChar cur=src[i];
if( ! (cur.isLetter() || cur.isDigit() || cur==' ' || cur=='_' || cur=='.' || cur=='#' || cur=='%') )
{
if(cur.row()!=0)
@@ -494,10 +494,10 @@ bool kvi_isAbsolutePath(const char *path)
//=================== kvi_readLine =====================//
-bool kvi_readLine(QFile *f,KviStr &str)
+bool kvi_readLine(TQFile *f,KviStr &str)
{
- QTextStream stream(f);
- QString szBuff=stream.readLine();
+ TQTextStream stream(f);
+ TQString szBuff=stream.readLine();
str=szBuff;
return szBuff.isNull() ? 1 : 0;
}
diff --git a/src/kvilib/file/kvi_fileutils.h b/src/kvilib/file/kvi_fileutils.h
index dcead8ae..bea07fed 100644
--- a/src/kvilib/file/kvi_fileutils.h
+++ b/src/kvilib/file/kvi_fileutils.h
@@ -26,8 +26,8 @@
#include "kvi_settings.h"
#include "kvi_string.h"
-#include <qfile.h>
-#include <qstringlist.h>
+#include <tqfile.h>
+#include <tqstringlist.h>
#include <time.h>
@@ -44,55 +44,55 @@
// #warning "or should it be availible only for dirbrowser module ?"
namespace KviFileUtils
{
- //extern KVILIB_API bool readLine(QFile * f,QString &szBuffer,bool bClearBuffer = true);
- //extern KVILIB_API bool loadFileStripCR(const QString &szPath,QString &szBuffer);
+ //extern KVILIB_API bool readLine(TQFile * f,TQString &szBuffer,bool bClearBuffer = true);
+ //extern KVILIB_API bool loadFileStripCR(const TQString &szPath,TQString &szBuffer);
// loads the file at szPath to szBuffer eventually converting from utf8
- extern KVILIB_API bool loadFile(const QString &szPath,QString &szBuffer,bool bUtf8 = true);
- extern KVILIB_API bool loadFile(const char* szPath,QString &szBuffer,bool bUtf8 = true);
+ extern KVILIB_API bool loadFile(const TQString &szPath,TQString &szBuffer,bool bUtf8 = true);
+ extern KVILIB_API bool loadFile(const char* szPath,TQString &szBuffer,bool bUtf8 = true);
// adjusts the file path to the current platform
- extern KVILIB_API void adjustFilePath(QString &szPath);
+ extern KVILIB_API void adjustFilePath(TQString &szPath);
// returns true if szPath points to an existing directory
- extern KVILIB_API bool directoryExists(const QString &szPath);
+ extern KVILIB_API bool directoryExists(const TQString &szPath);
extern KVILIB_API bool directoryExists(const char* path);
// returns true if szPath points to an existing file
- extern KVILIB_API bool fileExists(const QString &szPath);
+ extern KVILIB_API bool fileExists(const TQString &szPath);
extern KVILIB_API bool fileExists(const char* szPath);
// removes a file
- extern KVILIB_API bool removeFile(const QString &szPath);
+ extern KVILIB_API bool removeFile(const TQString &szPath);
extern KVILIB_API bool removeFile(const char* path);
// removes a dir (must be empty)
- extern KVILIB_API bool removeDir(const QString &szPath);
+ extern KVILIB_API bool removeDir(const TQString &szPath);
extern KVILIB_API bool removeDir(const char* path);
// removes a dir recursively
- extern KVILIB_API bool deleteDir(const QString &szPath);
+ extern KVILIB_API bool deleteDir(const TQString &szPath);
// writes a complete file (utf8 version)
- extern KVILIB_API bool writeFile(const QString &szPath,const QString &szData,bool bAppend = false);
- extern KVILIB_API bool writeFile(const char* path,const QString &szData,bool bAppend = false);
+ extern KVILIB_API bool writeFile(const TQString &szPath,const TQString &szData,bool bAppend = false);
+ extern KVILIB_API bool writeFile(const char* path,const TQString &szData,bool bAppend = false);
// writes a complete file (local 8 bit version)
- extern KVILIB_API bool writeFileLocal8Bit(const QString &szPath,const QString &szData,bool bAppend = false);
- extern KVILIB_API bool writeFileLocal8Bit(const char* path,const QString &szData,bool bAppend = false);
+ extern KVILIB_API bool writeFileLocal8Bit(const TQString &szPath,const TQString &szData,bool bAppend = false);
+ extern KVILIB_API bool writeFileLocal8Bit(const char* path,const TQString &szData,bool bAppend = false);
// reads a complete file and puts it in the string szBuffer, if the file is smaller than uMaxSize bytes
- extern KVILIB_API bool readFile(const QString &szPath,QString &szBuffer,unsigned int uMaxSize = 65535);
- extern KVILIB_API bool readFile(const char* path,QString &szBuffer,unsigned int uMaxSize = 65535);
+ extern KVILIB_API bool readFile(const TQString &szPath,TQString &szBuffer,unsigned int uMaxSize = 65535);
+ extern KVILIB_API bool readFile(const char* path,TQString &szBuffer,unsigned int uMaxSize = 65535);
// extracts the filename from a complete path (strips leading path)
- extern KVILIB_API QString extractFileName(const QString &szFileNameWithPath);
+ extern KVILIB_API TQString extractFileName(const TQString &szFileNameWithPath);
- extern KVILIB_API QString extractFilePath(const QString &szFileNameWithPath);
+ extern KVILIB_API TQString extractFilePath(const TQString &szFileNameWithPath);
// cp -f
- extern KVILIB_API bool copyFile(const QString &szSrc,const QString &szDst);
+ extern KVILIB_API bool copyFile(const TQString &szSrc,const TQString &szDst);
extern KVILIB_API bool copyFile(const char* src,const char* dst);
// mv
- extern KVILIB_API bool renameFile(const QString &szSrc,const QString &szDst);
+ extern KVILIB_API bool renameFile(const TQString &szSrc,const TQString &szDst);
extern KVILIB_API bool renameFile(const char* src,const char* dst);
// mkdir
- extern KVILIB_API bool makeDir(const QString &szPath);
+ extern KVILIB_API bool makeDir(const TQString &szPath);
extern KVILIB_API bool makeDir(const char* path);
// reads a text line, returns false if EOF is reached
- extern KVILIB_API bool readLine(QFile * f,QString &szBuffer,bool bUtf8 = true);
- extern KVILIB_API bool readLines(QFile * f,QStringList &buffer,int iStartLine = 0, int iCount = -1, bool bUtf8 = true);
- extern KVILIB_API bool isReadable(const QString &szFname);
- extern KVILIB_API bool isAbsolutePath(const QString &szPath);
+ extern KVILIB_API bool readLine(TQFile * f,TQString &szBuffer,bool bUtf8 = true);
+ extern KVILIB_API bool readLines(TQFile * f,TQStringList &buffer,int iStartLine = 0, int iCount = -1, bool bUtf8 = true);
+ extern KVILIB_API bool isReadable(const TQString &szFname);
+ extern KVILIB_API bool isAbsolutePath(const TQString &szPath);
};
// ALL THIS STUFF BELOW SHOULD DIE: IF YOU SEE IT, REPLACE WITH THE FUNCTIONS IN THE NAMESPACE ABOVE
@@ -103,10 +103,10 @@ KVILIB_API extern bool kvi_isAbsolutePath(const char *path);
// There is NO way to come back to the original string
// the algo is one-way only
KVILIB_API extern void kvi_encodeFileName(KviStr & path);
-KVILIB_API extern void kvi_encodeFileName(QString & path);
+KVILIB_API extern void kvi_encodeFileName(TQString & path);
// Reads a single line from the file and returns false if EOF was encountered.
-KVILIB_API extern bool kvi_readLine(QFile *f,KviStr &str);
+KVILIB_API extern bool kvi_readLine(TQFile *f,KviStr &str);
// Removes a file
#endif //_KVI_FILEUTILS_H_INCLUDED_
diff --git a/src/kvilib/file/kvi_packagefile.cpp b/src/kvilib/file/kvi_packagefile.cpp
index 3e7bcc17..5700f4e8 100644
--- a/src/kvilib/file/kvi_packagefile.cpp
+++ b/src/kvilib/file/kvi_packagefile.cpp
@@ -30,10 +30,10 @@
#include "kvi_locale.h"
#include "kvi_inttypes.h"
-#include <qprogressdialog.h>
-#include <qlabel.h>
+#include <tqprogressdialog.h>
+#include <tqlabel.h>
-#include <qdir.h>
+#include <tqdir.h>
#ifdef COMPILE_ZLIB_SUPPORT
#include <zlib.h>
@@ -98,7 +98,7 @@
// FieldData Variable FieldLen The data of the field, see below for defined values
// FieldData for FieldType 1 (file field)
-// Flags uint32 4 Bitmask. Bits: 1=FileIsDeflated
+// Flags uint32 4 Bittqmask. Bits: 1=FileIsDeflated
// Path UniString Variable A relative path expressed as utf8 string. \ AND / are considered to be separators
// Size uint32 4 Size of the following file data
// FilePayload Bytes Variable
@@ -111,9 +111,9 @@
KviPackageIOEngine::KviPackageIOEngine()
{
m_pProgressDialog = 0;
- m_pStringInfoFields = new KviPointerHashTable<QString,QString>();
+ m_pStringInfoFields = new KviPointerHashTable<TQString,TQString>();
m_pStringInfoFields->setAutoDelete(true);
- m_pBinaryInfoFields = new KviPointerHashTable<QString,QByteArray>();
+ m_pBinaryInfoFields = new KviPointerHashTable<TQString,TQByteArray>();
m_pBinaryInfoFields->setAutoDelete(true);
}
@@ -125,7 +125,7 @@ KviPackageIOEngine::~KviPackageIOEngine()
}
-bool KviPackageIOEngine::updateProgress(int iProgress,const QString &szLabel)
+bool KviPackageIOEngine::updateProgress(int iProgress,const TQString &szLabel)
{
if(!m_pProgressDialog)return true;
#ifdef COMPILE_USE_QT4
@@ -134,7 +134,7 @@ bool KviPackageIOEngine::updateProgress(int iProgress,const QString &szLabel)
m_pProgressDialog->setProgress(iProgress);
#endif
m_pProgressDialogLabel->setText(szLabel);
- qApp->processEvents();
+ tqApp->processEvents();
if(m_pProgressDialog->wasCanceled())
{
setLastError(__tr2qs("Operation cancelled"));
@@ -143,17 +143,17 @@ bool KviPackageIOEngine::updateProgress(int iProgress,const QString &szLabel)
return true;
}
-void KviPackageIOEngine::showProgressDialog(const QString &szCaption,int iTotalSteps)
+void KviPackageIOEngine::showProgressDialog(const TQString &szCaption,int iTotalSteps)
{
#ifdef COMPILE_USE_QT4
- m_pProgressDialog = new QProgressDialog(QString(""),__tr2qs("Cancel"),0,iTotalSteps,0);
+ m_pProgressDialog = new TQProgressDialog(TQString(""),__tr2qs("Cancel"),0,iTotalSteps,0);
m_pProgressDialog->setModal(true);
m_pProgressDialog->setWindowTitle(szCaption);
#else
- m_pProgressDialog = new QProgressDialog(QString(""),__tr2qs("Cancel"),iTotalSteps,0,"",true);
+ m_pProgressDialog = new TQProgressDialog(TQString(""),__tr2qs("Cancel"),iTotalSteps,0,"",true);
m_pProgressDialog->setCaption(szCaption);
#endif
- m_pProgressDialogLabel = new QLabel(m_pProgressDialog);
+ m_pProgressDialogLabel = new TQLabel(m_pProgressDialog);
m_pProgressDialogLabel->setMaximumSize(500,300);
m_pProgressDialog->setLabel(m_pProgressDialogLabel);
}
@@ -194,23 +194,23 @@ KviPackageWriter::~KviPackageWriter()
delete m_pDataFields;
}
-void KviPackageWriter::addInfoField(const QString &szName,const QString &szValue)
+void KviPackageWriter::addInfoField(const TQString &szName,const TQString &szValue)
{
- m_pStringInfoFields->replace(szName,new QString(szValue));
+ m_pStringInfoFields->tqreplace(szName,new TQString(szValue));
}
-void KviPackageWriter::addInfoField(const QString &szName,QByteArray * pValue)
+void KviPackageWriter::addInfoField(const TQString &szName,TQByteArray * pValue)
{
- m_pBinaryInfoFields->replace(szName,pValue);
+ m_pBinaryInfoFields->tqreplace(szName,pValue);
}
-bool KviPackageWriter::addFile(const QString &szLocalFileName,const QString &szTargetFileName,kvi_u32_t uAddFileFlags)
+bool KviPackageWriter::addFile(const TQString &szLocalFileName,const TQString &szTargetFileName,kvi_u32_t uAddFileFlags)
{
- QFileInfo fi(szLocalFileName);
+ TQFileInfo fi(szLocalFileName);
return addFileInternal(&fi,szLocalFileName,szTargetFileName,uAddFileFlags);
}
-bool KviPackageWriter::addFileInternal(const QFileInfo * fi,const QString &szLocalFileName,const QString &szTargetFileName,kvi_u32_t uAddFileFlags)
+bool KviPackageWriter::addFileInternal(const TQFileInfo * fi,const TQString &szLocalFileName,const TQString &szTargetFileName,kvi_u32_t uAddFileFlags)
{
if(!(fi->isFile() && fi->isReadable()))
return false;
@@ -231,42 +231,42 @@ bool KviPackageWriter::addFileInternal(const QFileInfo * fi,const QString &szLoc
return true;
}
-bool KviPackageWriter::addDirectory(const QString &szLocalDirectoryName,const QString &szTargetDirectoryPrefix,kvi_u32_t uAddFileFlags)
+bool KviPackageWriter::addDirectory(const TQString &szLocalDirectoryName,const TQString &szTargetDirectoryPrefix,kvi_u32_t uAddFileFlags)
{
- QDir d(szLocalDirectoryName);
+ TQDir d(szLocalDirectoryName);
#ifdef COMPILE_USE_QT4
- QDir::Filters iFlags;
+ TQDir::Filters iFlags;
#else
int iFlags;
#endif
- iFlags = QDir::Files | QDir::Readable;
+ iFlags = TQDir::Files | TQDir::Readable;
if(!(uAddFileFlags & FollowSymLinks))
- iFlags |= QDir::NoSymLinks;
+ iFlags |= TQDir::NoSymLinks;
- // QT4SUX: Because the QDir::entryInfoList() breaks really a lot of code by returning an object that behaves in a _totally_ different way.. it's also much slower
+ // QT4SUX: Because the TQDir::entryInfoList() breaks really a lot of code by returning an object that behaves in a _totally_ different way.. it's also much slower
#ifdef COMPILE_USE_QT4
int j;
- QFileInfoList sl = d.entryInfoList(iFlags);
+ TQFileInfoList sl = d.entryInfoList(iFlags);
for(j=0;j<sl.size();j++)
{
#else
- const QFileInfoList * sl = d.entryInfoList(iFlags);
+ const TQFileInfoList * sl = d.entryInfoList(iFlags);
if(!sl)return false;
- QFileInfoListIterator it(*sl);
- while(QFileInfo * fi = it.current())
+ TQFileInfoListIterator it(*sl);
+ while(TQFileInfo * fi = it.current())
{
#endif
- QString szSFileName = szLocalDirectoryName;
- KviQString::ensureLastCharIs(szSFileName,QChar(KVI_PATH_SEPARATOR_CHAR));
+ TQString szSFileName = szLocalDirectoryName;
+ KviTQString::ensureLastCharIs(szSFileName,TQChar(KVI_PATH_SEPARATOR_CHAR));
#ifdef COMPILE_USE_QT4
- QFileInfo slowCopy = sl.at(j);
+ TQFileInfo slowCopy = sl.at(j);
szSFileName += slowCopy.fileName();
#else
szSFileName += fi->fileName();
#endif
- QString szDFileName = szTargetDirectoryPrefix;
- KviQString::ensureLastCharIs(szDFileName,QChar(KVI_PATH_SEPARATOR_CHAR));
+ TQString szDFileName = szTargetDirectoryPrefix;
+ KviTQString::ensureLastCharIs(szDFileName,TQChar(KVI_PATH_SEPARATOR_CHAR));
#ifdef COMPILE_USE_QT4
szDFileName += slowCopy.fileName();
if(!addFileInternal(&slowCopy,szSFileName,szDFileName,uAddFileFlags))
@@ -280,28 +280,28 @@ bool KviPackageWriter::addDirectory(const QString &szLocalDirectoryName,const QS
++it;
#endif
}
- iFlags = QDir::Dirs | QDir::Readable;
+ iFlags = TQDir::Dirs | TQDir::Readable;
if(!(uAddFileFlags & FollowSymLinks))
- iFlags |= QDir::NoSymLinks;
+ iFlags |= TQDir::NoSymLinks;
sl = d.entryInfoList(iFlags);
#ifdef COMPILE_USE_QT4
for(j=0;j<sl.size();j++)
{
- QString szDir = sl.at(j).fileName();
+ TQString szDir = sl.at(j).fileName();
#else
if(!sl)return false;
- QFileInfoListIterator it2(*sl);
- while(QFileInfo * fi2 = it2.current())
+ TQFileInfoListIterator it2(*sl);
+ while(TQFileInfo * fi2 = it2.current())
{
- QString szDir = fi2->fileName();
+ TQString szDir = fi2->fileName();
#endif
- if(!KviQString::equalCS(szDir,"..") && !KviQString::equalCS(szDir,"."))
+ if(!KviTQString::equalCS(szDir,"..") && !KviTQString::equalCS(szDir,"."))
{
- QString szSDirName = szLocalDirectoryName;
- KviQString::ensureLastCharIs(szSDirName,QChar(KVI_PATH_SEPARATOR_CHAR));
+ TQString szSDirName = szLocalDirectoryName;
+ KviTQString::ensureLastCharIs(szSDirName,TQChar(KVI_PATH_SEPARATOR_CHAR));
szSDirName += szDir;
- QString szDDirName = szTargetDirectoryPrefix;
- KviQString::ensureLastCharIs(szDDirName,QChar(KVI_PATH_SEPARATOR_CHAR));
+ TQString szDDirName = szTargetDirectoryPrefix;
+ KviTQString::ensureLastCharIs(szDDirName,TQChar(KVI_PATH_SEPARATOR_CHAR));
szDDirName += szDir;
if(!addDirectory(szSDirName,szDDirName,uAddFileFlags))
return false;
@@ -320,8 +320,8 @@ bool KviPackageWriter::addDirectory(const QString &szLocalDirectoryName,const QS
bool KviPackageWriter::packFile(KviFile * pFile,DataField * pDataField)
{
- QString szProgressText;
- KviQString::sprintf(szProgressText,__tr2qs("Packaging file %Q"),&(pDataField->m_szFileLocalName));
+ TQString szProgressText;
+ KviTQString::sprintf(szProgressText,__tr2qs("Packaging file %Q"),&(pDataField->m_szFileLocalName));
if(!updateProgress(m_iCurrentProgress,szProgressText))
return false; // aborted
@@ -346,7 +346,7 @@ bool KviPackageWriter::packFile(KviFile * pFile,DataField * pDataField)
if(!pFile->save(uFlags))return writeError();
- KviQCString szTargetFileName = KviQString::toUtf8(pDataField->m_szFileTargetName);
+ KviTQCString szTargetFileName = KviTQString::toUtf8(pDataField->m_szFileTargetName);
// Path
if(!pFile->save(szTargetFileName))return writeError();
@@ -429,9 +429,9 @@ bool KviPackageWriter::packFile(KviFile * pFile,DataField * pDataField)
if((zstr.total_in % 2000000) == 0)
{
- QString szTmp;
- KviQString::sprintf(szTmp,QString(" (%d of %d bytes)"),zstr.total_in,uSize);
- QString szPrg = szProgressText + szTmp;
+ TQString szTmp;
+ KviTQString::sprintf(szTmp,TQString(" (%d of %d bytes)"),zstr.total_in,uSize);
+ TQString szPrg = szProgressText + szTmp;
if(!updateProgress(m_iCurrentProgress,szPrg))
return false; // aborted
}
@@ -499,9 +499,9 @@ bool KviPackageWriter::packFile(KviFile * pFile,DataField * pDataField)
iTotalFileSize += iReaded;
if((iTotalFileSize % 1000000) == 0)
{
- QString szTmp;
- KviQString::sprintf(szTmp,QString(" (%d of %d bytes)"),iTotalFileSize,uSize);
- QString szPrg = szProgressText + szTmp;
+ TQString szTmp;
+ KviTQString::sprintf(szTmp,TQString(" (%d of %d bytes)"),iTotalFileSize,uSize);
+ TQString szPrg = szProgressText + szTmp;
if(!updateProgress(m_iCurrentProgress,szPrg))
return false; // aborted
}
@@ -518,7 +518,7 @@ bool KviPackageWriter::packFile(KviFile * pFile,DataField * pDataField)
return true;
}
-bool KviPackageWriter::pack(const QString &szFileName,kvi_u32_t uPackFlags)
+bool KviPackageWriter::pack(const TQString &szFileName,kvi_u32_t uPackFlags)
{
m_iCurrentProgress = 0;
if(!(uPackFlags & NoProgressDialog))
@@ -533,7 +533,7 @@ bool KviPackageWriter::pack(const QString &szFileName,kvi_u32_t uPackFlags)
return bRet;
}
-bool KviPackageWriter::packInternal(const QString &szFileName,kvi_u32_t uPackFlags)
+bool KviPackageWriter::packInternal(const TQString &szFileName,kvi_u32_t uPackFlags)
{
KviFile f(szFileName);
@@ -572,8 +572,8 @@ bool KviPackageWriter::packInternal(const QString &szFileName,kvi_u32_t uPackFla
return false; // aborted
// InfoFields (string)
- KviPointerHashTableIterator<QString,QString> it(*m_pStringInfoFields);
- while(QString * s = it.current())
+ KviPointerHashTableIterator<TQString,TQString> it(*m_pStringInfoFields);
+ while(TQString * s = it.current())
{
if(!f.save(it.currentKey()))return writeError();
kvi_u32_t uType = KVI_PACKAGE_INFOFIELD_TYPE_STRING;
@@ -583,8 +583,8 @@ bool KviPackageWriter::packInternal(const QString &szFileName,kvi_u32_t uPackFla
}
// InfoFields (binary)
- KviPointerHashTableIterator<QString,QByteArray> it2(*m_pBinaryInfoFields);
- while(QByteArray * b = it2.current())
+ KviPointerHashTableIterator<TQString,TQByteArray> it2(*m_pBinaryInfoFields);
+ while(TQByteArray * b = it2.current())
{
if(!f.save(it2.currentKey()))return writeError();
kvi_u32_t uType = KVI_PACKAGE_INFOFIELD_TYPE_BINARYBUFFER;
@@ -646,7 +646,7 @@ KviPackageReader::~KviPackageReader()
{
}
-bool KviPackageReader::readHeaderInternal(KviFile * pFile,const QString &szLocalFileName)
+bool KviPackageReader::readHeaderInternal(KviFile * pFile,const TQString &szLocalFileName)
{
// read the PackageHeader
@@ -686,7 +686,7 @@ bool KviPackageReader::readHeaderInternal(KviFile * pFile,const QString &szLocal
kvi_u32_t uIdx = 0;
while(uIdx < uCount)
{
- QString szKey;
+ TQString szKey;
if(!pFile->load(szKey))return readError();
kvi_u32_t uFieldType;
if(!pFile->load(uFieldType))return readError();
@@ -694,20 +694,20 @@ bool KviPackageReader::readHeaderInternal(KviFile * pFile,const QString &szLocal
{
case KVI_PACKAGE_INFOFIELD_TYPE_STRING:
{
- QString szValue;
+ TQString szValue;
if(!pFile->load(szValue))return readError();
- m_pStringInfoFields->replace(szKey,new QString(szValue));
+ m_pStringInfoFields->tqreplace(szKey,new TQString(szValue));
}
break;
case KVI_PACKAGE_INFOFIELD_TYPE_BINARYBUFFER:
{
- QByteArray * pbValue = new QByteArray();
+ TQByteArray * pbValue = new TQByteArray();
if(!pFile->load(*pbValue))
{
delete pbValue;
return readError();
}
- m_pBinaryInfoFields->replace(szKey,pbValue);
+ m_pBinaryInfoFields->tqreplace(szKey,pbValue);
}
break;
default:
@@ -721,7 +721,7 @@ bool KviPackageReader::readHeaderInternal(KviFile * pFile,const QString &szLocal
}
-bool KviPackageReader::readHeader(const QString &szLocalFileName)
+bool KviPackageReader::readHeader(const TQString &szLocalFileName)
{
KviFile f(szLocalFileName);
if(!f.openForReading())
@@ -733,7 +733,7 @@ bool KviPackageReader::readHeader(const QString &szLocalFileName)
return readHeaderInternal(&f,szLocalFileName);
}
-bool KviPackageReader::unpackFile(KviFile * pFile,const QString &szUnpackPath)
+bool KviPackageReader::unpackFile(KviFile * pFile,const TQString &szUnpackPath)
{
// Flags
kvi_u32_t uFlags;
@@ -748,24 +748,24 @@ bool KviPackageReader::unpackFile(KviFile * pFile,const QString &szUnpackPath)
#endif
// Path
- QString szPath;
+ TQString szPath;
if(!pFile->load(szPath))return readError();
- QString szFileName = szUnpackPath;
- KviQString::ensureLastCharIs(szFileName,QChar(KVI_PATH_SEPARATOR_CHAR));
+ TQString szFileName = szUnpackPath;
+ KviTQString::ensureLastCharIs(szFileName,TQChar(KVI_PATH_SEPARATOR_CHAR));
szFileName += szPath;
// no attacks please :)
- szFileName.replace(QString("..\\"),QString(""));
- szFileName.replace(QString("..//"),QString(""));
+ szFileName.tqreplace(TQString("..\\"),TQString(""));
+ szFileName.tqreplace(TQString("..//"),TQString(""));
KviFileUtils::adjustFilePath(szFileName);
- int idx = KviQString::findRev(szFileName,QChar(KVI_PATH_SEPARATOR_CHAR));
+ int idx = KviTQString::tqfindRev(szFileName,TQChar(KVI_PATH_SEPARATOR_CHAR));
if(idx != -1)
{
- QString szPrefixPath = szFileName.left(idx);
+ TQString szPrefixPath = szFileName.left(idx);
if(!KviFileUtils::makeDir(szPrefixPath))
{
setLastError(__tr2qs("Failed to create the target directory"));
@@ -780,8 +780,8 @@ bool KviPackageReader::unpackFile(KviFile * pFile,const QString &szUnpackPath)
return false;
}
- QString szProgressText;
- KviQString::sprintf(szProgressText,__tr2qs("Unpacking file %Q"),&szFileName);
+ TQString szProgressText;
+ KviTQString::sprintf(szProgressText,__tr2qs("Unpacking file %Q"),&szFileName);
if(!updateProgress(pFile->pos(),szProgressText))
return false; // aborted
@@ -868,9 +868,9 @@ bool KviPackageReader::unpackFile(KviFile * pFile,const QString &szUnpackPath)
if((zstr.total_in % 2000000) == 0)
{
- QString szTmp;
- KviQString::sprintf(szTmp,QString(" (%d of %d bytes)"),zstr.total_in,uSize);
- QString szPrg = szProgressText + szTmp;
+ TQString szTmp;
+ KviTQString::sprintf(szTmp,TQString(" (%d of %d bytes)"),zstr.total_in,uSize);
+ TQString szPrg = szProgressText + szTmp;
if(!updateProgress(pFile->pos(),szPrg))
return false; // aborted
}
@@ -936,9 +936,9 @@ bool KviPackageReader::unpackFile(KviFile * pFile,const QString &szUnpackPath)
if((iTotalFileSize % 3000000) == 0)
{
- QString szTmp;
- KviQString::sprintf(szTmp,QString(" (%d of %d bytes)"),iTotalFileSize,uSize);
- QString szPrg = szProgressText + szTmp;
+ TQString szTmp;
+ KviTQString::sprintf(szTmp,TQString(" (%d of %d bytes)"),iTotalFileSize,uSize);
+ TQString szPrg = szProgressText + szTmp;
if(!updateProgress(pFile->pos(),szPrg))
return false; // aborted
}
@@ -958,22 +958,22 @@ bool KviPackageReader::unpackFile(KviFile * pFile,const QString &szUnpackPath)
return true;
}
-bool KviPackageReader::getStringInfoField(const QString &szName,QString &szBuffer)
+bool KviPackageReader::getStringInfoField(const TQString &szName,TQString &szBuffer)
{
- QString * pVal = m_pStringInfoFields->find(szName);
+ TQString * pVal = m_pStringInfoFields->tqfind(szName);
if(!pVal)return false;
szBuffer = *pVal;
return true;
}
-bool KviPackageReader::unpack(const QString &szLocalFileName,const QString &szUnpackPath,kvi_u32_t uUnpackFlags)
+bool KviPackageReader::unpack(const TQString &szLocalFileName,const TQString &szUnpackPath,kvi_u32_t uUnpackFlags)
{
bool bRet = unpackInternal(szLocalFileName,szUnpackPath,uUnpackFlags);
hideProgressDialog();
return bRet;
}
-bool KviPackageReader::unpackInternal(const QString &szLocalFileName,const QString &szUnpackPath,kvi_u32_t uUnpackFlags)
+bool KviPackageReader::unpackInternal(const TQString &szLocalFileName,const TQString &szUnpackPath,kvi_u32_t uUnpackFlags)
{
KviFile f(szLocalFileName);
diff --git a/src/kvilib/file/kvi_packagefile.h b/src/kvilib/file/kvi_packagefile.h
index 3e330554..c32329f1 100644
--- a/src/kvilib/file/kvi_packagefile.h
+++ b/src/kvilib/file/kvi_packagefile.h
@@ -27,14 +27,14 @@
#include "kvi_settings.h"
#include "kvi_qstring.h"
#include "kvi_pointerhashtable.h"
-#include "kvi_qcstring.h" // QByteArray anyway
-#include <qobject.h>
+#include "kvi_qcstring.h" // TQByteArray anyway
+#include <tqobject.h>
#include "kvi_pointerlist.h"
class KviFile;
-class QProgressDialog;
-class QLabel;
-class QFileInfo;
+class TQProgressDialog;
+class TQLabel;
+class TQFileInfo;
//
// This class is used for creating KVIrc package files.
@@ -47,20 +47,20 @@ public:
KviPackageIOEngine();
virtual ~KviPackageIOEngine();
protected:
- QString m_szLastError;
- KviPointerHashTable<QString,QString> * m_pStringInfoFields;
- KviPointerHashTable<QString,QByteArray> * m_pBinaryInfoFields;
- QProgressDialog * m_pProgressDialog;
- QLabel * m_pProgressDialogLabel;
+ TQString m_szLastError;
+ KviPointerHashTable<TQString,TQString> * m_pStringInfoFields;
+ KviPointerHashTable<TQString,TQByteArray> * m_pBinaryInfoFields;
+ TQProgressDialog * m_pProgressDialog;
+ TQLabel * m_pProgressDialogLabel;
public:
- const QString & lastError(){ return m_szLastError; };
- void setLastError(const QString &szLastError){ m_szLastError = szLastError; };
- KviPointerHashTable<QString,QString> * stringInfoFields(){ return m_pStringInfoFields; };
- KviPointerHashTable<QString,QByteArray> * binaryInfoFields(){ return m_pBinaryInfoFields; };
+ const TQString & lastError(){ return m_szLastError; };
+ void setLastError(const TQString &szLastError){ m_szLastError = szLastError; };
+ KviPointerHashTable<TQString,TQString> * stringInfoFields(){ return m_pStringInfoFields; };
+ KviPointerHashTable<TQString,TQByteArray> * binaryInfoFields(){ return m_pBinaryInfoFields; };
protected:
- void showProgressDialog(const QString &szCaption,int iTotalSteps);
+ void showProgressDialog(const TQString &szCaption,int iTotalSteps);
void hideProgressDialog();
- bool updateProgress(int iProgress,const QString &szLabel);
+ bool updateProgress(int iProgress,const TQString &szLabel);
bool writeError();
bool readError();
};
@@ -87,8 +87,8 @@ protected:
kvi_u32_t m_uWrittenFieldLength;
// data fields for the File DataFieldType
bool m_bFileAllowCompression;
- QString m_szFileLocalName;
- QString m_szFileTargetName;
+ TQString m_szFileLocalName;
+ TQString m_szFileTargetName;
};
KviPointerList<DataField> * m_pDataFields;
@@ -101,22 +101,22 @@ public:
NoCompression = 1,
FollowSymLinks = 2
};
- bool addFile(const QString &szLocalFileName,const QString &szTargetFileName,kvi_u32_t uAddFileFlags = 0);
- bool addDirectory(const QString &szLocalDirectoryName,const QString &szTargetDirectoryPrefix,kvi_u32_t uAddFileFlags = 0);
+ bool addFile(const TQString &szLocalFileName,const TQString &szTargetFileName,kvi_u32_t uAddFileFlags = 0);
+ bool addDirectory(const TQString &szLocalDirectoryName,const TQString &szTargetDirectoryPrefix,kvi_u32_t uAddFileFlags = 0);
// Adds an info field as a name=value pair
- void addInfoField(const QString &szName,const QString &szValue);
- void addInfoField(const QString &szName,QByteArray * pArray);
+ void addInfoField(const TQString &szName,const TQString &szValue);
+ void addInfoField(const TQString &szName,TQByteArray * pArray);
// Attempts to pack everything and store it as the specified file.
// There is no mandatory extension but you *should* use KVI_FILEEXTENSION_THEMEPACKAGE for themes
// and KVI_FILEEXTENSION_ADDONPACKAGE for addons. See kvi_fileextension.h
enum PackFlags {
NoProgressDialog = 1
};
- bool pack(const QString &szFileName,kvi_u32_t uPackFlags = 0);
+ bool pack(const TQString &szFileName,kvi_u32_t uPackFlags = 0);
private:
- bool packInternal(const QString &szFileName,kvi_u32_t uPackFlags = 0);
+ bool packInternal(const TQString &szFileName,kvi_u32_t uPackFlags = 0);
bool packFile(KviFile * pFile,DataField * pDataField);
- bool addFileInternal(const QFileInfo * fi,const QString &szLocalFileName,const QString &szTargetFileName,kvi_u32_t uAddFileFlags = 0);
+ bool addFileInternal(const TQFileInfo * fi,const TQString &szLocalFileName,const TQString &szTargetFileName,kvi_u32_t uAddFileFlags = 0);
};
class KVILIB_API KviPackageReader : public KviPackageIOEngine
@@ -125,16 +125,16 @@ public:
KviPackageReader();
virtual ~KviPackageReader();
public:
- bool readHeader(const QString &szLocalFileName);
+ bool readHeader(const TQString &szLocalFileName);
enum UnpackFlags {
NoProgressDialog = 1
};
- bool getStringInfoField(const QString &szName,QString &szBuffer);
- bool unpack(const QString &szLocalFileName,const QString &szUnpackPath,kvi_u32_t uUnpackFlags = 0);
+ bool getStringInfoField(const TQString &szName,TQString &szBuffer);
+ bool unpack(const TQString &szLocalFileName,const TQString &szUnpackPath,kvi_u32_t uUnpackFlags = 0);
private:
- bool unpackInternal(const QString &szLocalFileName,const QString &szUnpackPath,kvi_u32_t uUnpackFlags = 0);
- bool unpackFile(KviFile * pFile,const QString &szUnpackPath);
- bool readHeaderInternal(KviFile * pFile,const QString &szLocalFileName);
+ bool unpackInternal(const TQString &szLocalFileName,const TQString &szUnpackPath,kvi_u32_t uUnpackFlags = 0);
+ bool unpackFile(KviFile * pFile,const TQString &szUnpackPath);
+ bool readHeaderInternal(KviFile * pFile,const TQString &szLocalFileName);
};