summaryrefslogtreecommitdiffstats
path: root/src/kvilib/file/kvi_packagefile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/kvilib/file/kvi_packagefile.cpp')
-rw-r--r--src/kvilib/file/kvi_packagefile.cpp174
1 files changed, 87 insertions, 87 deletions
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);