summaryrefslogtreecommitdiffstats
path: root/lib/libchmfile/libchmfileimpl.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-29 19:00:37 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-29 19:00:37 +0000
commit25794f504692e5a36c490438814e9dfda8aaa2dd (patch)
tree8061e6d27b5bc9042afdff177872779c4e8c9015 /lib/libchmfile/libchmfileimpl.cpp
parent35ff2a942f63b5201c04f41c3097e61cdd7817e9 (diff)
downloadkchmviewer-25794f504692e5a36c490438814e9dfda8aaa2dd.tar.gz
kchmviewer-25794f504692e5a36c490438814e9dfda8aaa2dd.zip
TQt4 port kchmviewer
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kchmviewer@1234150 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'lib/libchmfile/libchmfileimpl.cpp')
-rw-r--r--lib/libchmfile/libchmfileimpl.cpp252
1 files changed, 126 insertions, 126 deletions
diff --git a/lib/libchmfile/libchmfileimpl.cpp b/lib/libchmfile/libchmfileimpl.cpp
index 6f1e052..71907c5 100644
--- a/lib/libchmfile/libchmfileimpl.cpp
+++ b/lib/libchmfile/libchmfileimpl.cpp
@@ -22,9 +22,9 @@
#include <sys/types.h>
-#include <qcursor.h>
-#include <qfile.h>
-#include <qapplication.h>
+#include <tqcursor.h>
+#include <tqfile.h>
+#include <tqapplication.h>
#include "config.h"
#include "chm_lib.h"
@@ -46,15 +46,15 @@
class KCHMShowWaitCursor
{
public:
- KCHMShowWaitCursor () { QApplication::setOverrideCursor( QCursor(Qt::WaitCursor) ); }
- ~KCHMShowWaitCursor () { QApplication::restoreOverrideCursor(); }
+ KCHMShowWaitCursor () { TQApplication::setOverrideCursor( TQCursor(TQt::WaitCursor) ); }
+ ~KCHMShowWaitCursor () { TQApplication::restoreOverrideCursor(); }
};
LCHMFileImpl::LCHMFileImpl( )
{
m_chmFile = NULL;
- m_home = m_filename = m_home = m_topicsFile = m_indexFile = m_font = QString::null;
+ m_home = m_filename = m_home = m_topicsFile = m_indexFile = m_font = TQString();
m_entityDecodeMap.clear();
m_textCodec = 0;
m_textCodecForSpecialFiles = 0;
@@ -69,9 +69,9 @@ LCHMFileImpl::~ LCHMFileImpl( )
}
-bool LCHMFileImpl::loadFile( const QString & archiveName )
+bool LCHMFileImpl::loadFile( const TQString & archiveName )
{
- QString filename;
+ TQString filename;
// If the file has a file:// prefix, remove it
if ( archiveName.startsWith( "file://" ) )
@@ -82,7 +82,7 @@ bool LCHMFileImpl::loadFile( const QString & archiveName )
if( m_chmFile )
closeAll();
- m_chmFile = chm_open( QFile::encodeName(filename) );
+ m_chmFile = chm_open( TQFile::encodeName(filename) );
if ( m_chmFile == NULL )
return false;
@@ -129,7 +129,7 @@ void LCHMFileImpl::closeAll( )
chm_close( m_chmFile );
m_chmFile = NULL;
- m_home = m_filename = m_home = m_topicsFile = m_indexFile = m_font = QString::null;
+ m_home = m_filename = m_home = m_topicsFile = m_indexFile = m_font = TQString();
m_entityDecodeMap.clear();
m_textCodec = 0;
m_textCodecForSpecialFiles = 0;
@@ -138,7 +138,7 @@ void LCHMFileImpl::closeAll( )
}
-QString LCHMFileImpl::decodeEntity( const QString & entity )
+TQString LCHMFileImpl::decodeEntity( const TQString & entity )
{
// Set up m_entityDecodeMap characters according to current textCodec
if ( m_entityDecodeMap.isEmpty() )
@@ -247,49 +247,49 @@ QString LCHMFileImpl::decodeEntity( const QString & entity )
m_entityDecodeMap["reg"] = encodeWithCurrentCodec ("\256"); // registered sign
m_entityDecodeMap["nbsp"] = encodeWithCurrentCodec ("\240"); // non breaking space
- m_entityDecodeMap["fnof"] = QChar((unsigned short) 402);
+ m_entityDecodeMap["fnof"] = TQChar((unsigned short) 402);
- m_entityDecodeMap["Delta"] = QChar((unsigned short) 916);
- m_entityDecodeMap["Pi"] = QChar((unsigned short) 928);
- m_entityDecodeMap["Sigma"] = QChar((unsigned short) 931);
+ m_entityDecodeMap["Delta"] = TQChar((unsigned short) 916);
+ m_entityDecodeMap["Pi"] = TQChar((unsigned short) 928);
+ m_entityDecodeMap["Sigma"] = TQChar((unsigned short) 931);
- m_entityDecodeMap["beta"] = QChar((unsigned short) 946);
- m_entityDecodeMap["gamma"] = QChar((unsigned short) 947);
- m_entityDecodeMap["delta"] = QChar((unsigned short) 948);
- m_entityDecodeMap["eta"] = QChar((unsigned short) 951);
- m_entityDecodeMap["theta"] = QChar((unsigned short) 952);
- m_entityDecodeMap["lambda"] = QChar((unsigned short) 955);
- m_entityDecodeMap["mu"] = QChar((unsigned short) 956);
- m_entityDecodeMap["nu"] = QChar((unsigned short) 957);
- m_entityDecodeMap["pi"] = QChar((unsigned short) 960);
- m_entityDecodeMap["rho"] = QChar((unsigned short) 961);
+ m_entityDecodeMap["beta"] = TQChar((unsigned short) 946);
+ m_entityDecodeMap["gamma"] = TQChar((unsigned short) 947);
+ m_entityDecodeMap["delta"] = TQChar((unsigned short) 948);
+ m_entityDecodeMap["eta"] = TQChar((unsigned short) 951);
+ m_entityDecodeMap["theta"] = TQChar((unsigned short) 952);
+ m_entityDecodeMap["lambda"] = TQChar((unsigned short) 955);
+ m_entityDecodeMap["mu"] = TQChar((unsigned short) 956);
+ m_entityDecodeMap["nu"] = TQChar((unsigned short) 957);
+ m_entityDecodeMap["pi"] = TQChar((unsigned short) 960);
+ m_entityDecodeMap["rho"] = TQChar((unsigned short) 961);
- m_entityDecodeMap["lsquo"] = QChar((unsigned short) 8216);
- m_entityDecodeMap["rsquo"] = QChar((unsigned short) 8217);
- m_entityDecodeMap["rdquo"] = QChar((unsigned short) 8221);
- m_entityDecodeMap["bdquo"] = QChar((unsigned short) 8222);
- m_entityDecodeMap["trade"] = QChar((unsigned short) 8482);
- m_entityDecodeMap["ldquo"] = QChar((unsigned short) 8220);
- m_entityDecodeMap["ndash"] = QChar((unsigned short) 8211);
- m_entityDecodeMap["mdash"] = QChar((unsigned short) 8212);
- m_entityDecodeMap["bull"] = QChar((unsigned short) 8226);
- m_entityDecodeMap["hellip"] = QChar((unsigned short) 8230);
- m_entityDecodeMap["emsp"] = QChar((unsigned short) 8195);
- m_entityDecodeMap["rarr"] = QChar((unsigned short) 8594);
- m_entityDecodeMap["rArr"] = QChar((unsigned short) 8658);
- m_entityDecodeMap["crarr"] = QChar((unsigned short) 8629);
- m_entityDecodeMap["le"] = QChar((unsigned short) 8804);
- m_entityDecodeMap["ge"] = QChar((unsigned short) 8805);
- m_entityDecodeMap["lte"] = QChar((unsigned short) 8804); // wrong, but used somewhere
- m_entityDecodeMap["gte"] = QChar((unsigned short) 8805); // wrong, but used somewhere
- m_entityDecodeMap["dagger"] = QChar((unsigned short) 8224);
- m_entityDecodeMap["Dagger"] = QChar((unsigned short) 8225);
- m_entityDecodeMap["euro"] = QChar((unsigned short) 8364);
- m_entityDecodeMap["asymp"] = QChar((unsigned short) 8776);
- m_entityDecodeMap["isin"] = QChar((unsigned short) 8712);
- m_entityDecodeMap["notin"] = QChar((unsigned short) 8713);
- m_entityDecodeMap["prod"] = QChar((unsigned short) 8719);
- m_entityDecodeMap["ne"] = QChar((unsigned short) 8800);
+ m_entityDecodeMap["lsquo"] = TQChar((unsigned short) 8216);
+ m_entityDecodeMap["rsquo"] = TQChar((unsigned short) 8217);
+ m_entityDecodeMap["rdquo"] = TQChar((unsigned short) 8221);
+ m_entityDecodeMap["bdquo"] = TQChar((unsigned short) 8222);
+ m_entityDecodeMap["trade"] = TQChar((unsigned short) 8482);
+ m_entityDecodeMap["ldquo"] = TQChar((unsigned short) 8220);
+ m_entityDecodeMap["ndash"] = TQChar((unsigned short) 8211);
+ m_entityDecodeMap["mdash"] = TQChar((unsigned short) 8212);
+ m_entityDecodeMap["bull"] = TQChar((unsigned short) 8226);
+ m_entityDecodeMap["hellip"] = TQChar((unsigned short) 8230);
+ m_entityDecodeMap["emsp"] = TQChar((unsigned short) 8195);
+ m_entityDecodeMap["rarr"] = TQChar((unsigned short) 8594);
+ m_entityDecodeMap["rArr"] = TQChar((unsigned short) 8658);
+ m_entityDecodeMap["crarr"] = TQChar((unsigned short) 8629);
+ m_entityDecodeMap["le"] = TQChar((unsigned short) 8804);
+ m_entityDecodeMap["ge"] = TQChar((unsigned short) 8805);
+ m_entityDecodeMap["lte"] = TQChar((unsigned short) 8804); // wrong, but used somewhere
+ m_entityDecodeMap["gte"] = TQChar((unsigned short) 8805); // wrong, but used somewhere
+ m_entityDecodeMap["dagger"] = TQChar((unsigned short) 8224);
+ m_entityDecodeMap["Dagger"] = TQChar((unsigned short) 8225);
+ m_entityDecodeMap["euro"] = TQChar((unsigned short) 8364);
+ m_entityDecodeMap["asymp"] = TQChar((unsigned short) 8776);
+ m_entityDecodeMap["isin"] = TQChar((unsigned short) 8712);
+ m_entityDecodeMap["notin"] = TQChar((unsigned short) 8713);
+ m_entityDecodeMap["prod"] = TQChar((unsigned short) 8719);
+ m_entityDecodeMap["ne"] = TQChar((unsigned short) 8800);
m_entityDecodeMap["amp"] = "&"; // ampersand
m_entityDecodeMap["gt"] = ">"; // greater than
@@ -311,19 +311,19 @@ QString LCHMFileImpl::decodeEntity( const QString & entity )
if ( !valid )
{
qWarning ( "LCHMFileImpl::decodeEntity: could not decode HTML entity '%s'", entity.ascii() );
- return QString::null;
+ return TQString();
}
- return (QString) (QChar( ascode ));
+ return (TQString) (TQChar( ascode ));
}
else
{
- QMap<QString, QString>::const_iterator it = m_entityDecodeMap.find( entity );
+ TQMap<TQString, TQString>::const_iterator it = m_entityDecodeMap.tqfind( entity );
if ( it == m_entityDecodeMap.end() )
{
qWarning ("LCHMFileImpl::decodeEntity: could not decode HTML entity '%s'", entity.ascii());
- return QString::null;
+ return TQString();
}
return *it;
@@ -331,14 +331,14 @@ QString LCHMFileImpl::decodeEntity( const QString & entity )
}
-inline int LCHMFileImpl::findStringInQuotes (const QString& tag, int offset, QString& value, bool firstquote, bool decodeentities)
+inline int LCHMFileImpl::findStringInQuotes (const TQString& tag, int offset, TQString& value, bool firstquote, bool decodeentities)
{
- int qbegin = tag.find ('"', offset);
+ int qbegin = tag.tqfind ('"', offset);
if ( qbegin == -1 )
qFatal ("LCHMFileImpl::findStringInQuotes: cannot find first quote in <param> tag: '%s'", tag.ascii());
- int qend = firstquote ? tag.find ('"', qbegin + 1) : tag.findRev ('"');
+ int qend = firstquote ? tag.tqfind ('"', qbegin + 1) : tag.tqfindRev ('"');
if ( qend == -1 || qend <= qbegin )
qFatal ("LCHMFileImpl::findStringInQuotes: cannot find last quote in <param> tag: '%s'", tag.ascii());
@@ -346,7 +346,7 @@ inline int LCHMFileImpl::findStringInQuotes (const QString& tag, int offset, QSt
// If we do not need to decode HTML entities, just return.
if ( decodeentities )
{
- QString htmlentity = QString::null;
+ TQString htmlentity = TQString();
bool fill_entity = false;
value.reserve (qend - qbegin); // to avoid multiple memory allocations
@@ -365,13 +365,13 @@ inline int LCHMFileImpl::findStringInQuotes (const QString& tag, int offset, QSt
if ( tag[i] == ';' ) // HTML entity ends
{
// If entity is an ASCII code, just decode it
- QString decode = decodeEntity( htmlentity );
+ TQString decode = decodeEntity( htmlentity );
if ( decode.isNull() )
break;
value.append ( decode );
- htmlentity = QString::null;
+ htmlentity = TQString();
fill_entity = false;
}
else
@@ -386,7 +386,7 @@ inline int LCHMFileImpl::findStringInQuotes (const QString& tag, int offset, QSt
}
-bool LCHMFileImpl::searchWord (const QString& text,
+bool LCHMFileImpl::searchWord (const TQString& text,
bool wholeWords,
bool titlesOnly,
LCHMSearchProgressResults& results,
@@ -397,7 +397,7 @@ bool LCHMFileImpl::searchWord (const QString& text,
if ( text.isEmpty() || !m_searchAvailable )
return false;
- QString searchword = (QString) convertSearchWord (text);
+ TQString searchword = (TQString) convertSearchWord (text);
#define FTS_HEADER_LEN 0x32
unsigned char header[FTS_HEADER_LEN];
@@ -425,11 +425,11 @@ bool LCHMFileImpl::searchWord (const QString& text,
u_int16_t tree_depth = UINT16ARRAY(cursor16);
unsigned char word_len, pos;
- QString word;
+ TQString word;
u_int32_t i = sizeof(u_int16_t);
u_int16_t free_space;
- QMemArray<unsigned char> buffer(node_len);
+ TQMemArray<unsigned char> buffer(node_len);
node_offset = GetLeafNodeOffset (searchword, node_offset, node_len, tree_depth);
@@ -505,7 +505,7 @@ bool LCHMFileImpl::searchWord (const QString& text,
loc_codes_r, results, phrase_search);
}
- else if ( QString::compare (searchword, word.mid(0, searchword.length())) < -1 )
+ else if ( TQString::compare (searchword, word.mid(0, searchword.length())) < -1 )
break;
}
}
@@ -516,7 +516,7 @@ bool LCHMFileImpl::searchWord (const QString& text,
}
-bool LCHMFileImpl::ResolveObject(const QString& fileName, chmUnitInfo *ui) const
+bool LCHMFileImpl::ResolveObject(const TQString& fileName, chmUnitInfo *ui) const
{
return m_chmFile != NULL
&& ::chm_resolve_object(m_chmFile, fileName.ascii(), ui) ==
@@ -537,7 +537,7 @@ size_t LCHMFileImpl::RetrieveObject(const chmUnitInfo *ui, unsigned char *buffer
}
-inline u_int32_t LCHMFileImpl::GetLeafNodeOffset(const QString& text,
+inline u_int32_t LCHMFileImpl::GetLeafNodeOffset(const TQString& text,
u_int32_t initialOffset,
u_int32_t buffSize,
u_int16_t treeDepth)
@@ -546,8 +546,8 @@ inline u_int32_t LCHMFileImpl::GetLeafNodeOffset(const QString& text,
unsigned char* cursor16, *cursor32;
unsigned char word_len, pos;
u_int32_t i = sizeof(u_int16_t);
- QMemArray<unsigned char> buffer(buffSize);
- QString word;
+ TQMemArray<unsigned char> buffer(buffSize);
+ TQString word;
while(--treeDepth)
{
@@ -607,7 +607,7 @@ inline bool LCHMFileImpl::ProcessWLC (u_int64_t wlc_count, u_int64_t wlc_size,
int wlc_bit = 7;
u_int64_t index = 0, count;
size_t length, off = 0;
- QMemArray<unsigned char> buffer (wlc_size);
+ TQMemArray<unsigned char> buffer (wlc_size);
unsigned char *cursor32;
unsigned char entry[TOPICS_ENTRY_LEN];
@@ -682,7 +682,7 @@ bool LCHMFileImpl::getInfoFromWindows()
u_int32_t entries = get_int32_le( (u_int32_t *)(buffer) );
u_int32_t entry_size = get_int32_le( (u_int32_t *)(buffer + 0x04) );
- QByteArray uptr(entries * entry_size);
+ TQByteArray uptr(entries * entry_size);
unsigned char* raw = (unsigned char*) uptr.data();
if ( !RetrieveObject (&ui, raw, 8, entries * entry_size) )
@@ -706,7 +706,7 @@ bool LCHMFileImpl::getInfoFromWindows()
size = RetrieveObject(&ui, buffer, factor * 4096, BUF_SIZE);
if ( size && off_title )
- m_title = QString ((const char*) (buffer + off_title % 4096));
+ m_title = TQString ((const char*) (buffer + off_title % 4096));
if ( factor != off_home / 4096)
{
@@ -715,7 +715,7 @@ bool LCHMFileImpl::getInfoFromWindows()
}
if ( size && off_home )
- m_home = QString("/") + QString( (const char*) buffer + off_home % 4096);
+ m_home = TQString("/") + TQString( (const char*) buffer + off_home % 4096);
if ( factor != off_hhc / 4096)
{
@@ -724,7 +724,7 @@ bool LCHMFileImpl::getInfoFromWindows()
}
if ( size && off_hhc )
- m_topicsFile = QString("/") + QString ((const char*) buffer + off_hhc % 4096);
+ m_topicsFile = TQString("/") + TQString ((const char*) buffer + off_hhc % 4096);
if ( factor != off_hhk / 4096)
{
@@ -733,7 +733,7 @@ bool LCHMFileImpl::getInfoFromWindows()
}
if ( size && off_hhk )
- m_indexFile = QString("/") + QString((const char*) buffer + off_hhk % 4096);
+ m_indexFile = TQString("/") + TQString((const char*) buffer + off_hhk % 4096);
}
}
return true;
@@ -775,7 +775,7 @@ bool LCHMFileImpl::getInfoFromSystem()
cursor = buffer + index;
if(m_topicsFile.isEmpty())
- m_topicsFile = QString("/") + QString((const char*) buffer + index + 2);
+ m_topicsFile = TQString("/") + TQString((const char*) buffer + index + 2);
break;
@@ -784,7 +784,7 @@ bool LCHMFileImpl::getInfoFromSystem()
cursor = buffer + index;
if(m_indexFile.isEmpty())
- m_indexFile = QString("/") + QString ((const char*)buffer + index + 2);
+ m_indexFile = TQString("/") + TQString ((const char*)buffer + index + 2);
break;
case 2:
@@ -792,13 +792,13 @@ bool LCHMFileImpl::getInfoFromSystem()
cursor = buffer + index;
if(m_home.isEmpty() || m_home == "/")
- m_home = QString("/") + QString ((const char*) buffer + index + 2);
+ m_home = TQString("/") + TQString ((const char*) buffer + index + 2);
break;
case 3:
index += 2;
cursor = buffer + index;
- m_title = QString((const char*) (buffer + index + 2));
+ m_title = TQString((const char*) (buffer + index + 2));
break;
case 4:
@@ -815,8 +815,8 @@ bool LCHMFileImpl::getInfoFromSystem()
cursor = buffer + index;
if(m_topicsFile.isEmpty()) {
- QString topicAttempt = "/", tmp;
- topicAttempt += QString ((const char*) buffer +index +2);
+ TQString topicAttempt = "/", tmp;
+ topicAttempt += TQString ((const char*) buffer +index +2);
tmp = topicAttempt + ".hhc";
@@ -834,7 +834,7 @@ bool LCHMFileImpl::getInfoFromSystem()
index += 2;
cursor = buffer + index;
- m_font = QString ((const char*) buffer + index + 2);
+ m_font = TQString ((const char*) buffer + index + 2);
break;
default:
@@ -850,7 +850,7 @@ bool LCHMFileImpl::getInfoFromSystem()
}
-QCString LCHMFileImpl::convertSearchWord( const QString & src )
+TQCString LCHMFileImpl::convertSearchWord( const TQString & src )
{
static const char * searchwordtable[128] =
{
@@ -865,9 +865,9 @@ QCString LCHMFileImpl::convertSearchWord( const QString & src )
};
if ( !m_textCodec )
- return (QCString) src.lower();
+ return (TQCString) src.lower();
- QCString dest = m_textCodec->fromUnicode (src);
+ TQCString dest = m_textCodec->fromUnicode (src);
for ( unsigned int i = 0; i < dest.size(); i++ )
{
@@ -875,7 +875,7 @@ QCString LCHMFileImpl::convertSearchWord( const QString & src )
{
int index = dest[i] & 0x7F;
if ( searchwordtable[index] )
- dest.replace (i, 1, searchwordtable[index]);
+ dest.tqreplace (i, 1, searchwordtable[index]);
else
dest.remove (i, 1);
}
@@ -887,15 +887,15 @@ QCString LCHMFileImpl::convertSearchWord( const QString & src )
void LCHMFileImpl::getSearchResults( const LCHMSearchProgressResults& tempres,
- QStringList * results,
+ TQStringList * results,
unsigned int limit_results )
{
unsigned char combuf [COMMON_BUF_LEN];
- QMap<u_int32_t, u_int32_t> urlsmap; // used to prevent duplicated urls
+ TQMap<u_int32_t, u_int32_t> urlsmap; // used to prevent duplicated urls
for ( unsigned int i = 0; i < tempres.size(); i++ )
{
- if ( urlsmap.find (tempres[i].urloff) != urlsmap.end() )
+ if ( urlsmap.tqfind (tempres[i].urloff) != urlsmap.end() )
continue;
urlsmap[tempres[i].urloff] = 1;
@@ -912,10 +912,10 @@ void LCHMFileImpl::getSearchResults( const LCHMSearchProgressResults& tempres,
}
-QString LCHMFileImpl::normalizeUrl( const QString & path ) const
+TQString LCHMFileImpl::normalizeUrl( const TQString & path ) const
{
- int pos = path.find ('#');
- QString fixedpath = pos == -1 ? path : path.left (pos);
+ int pos = path.tqfind ('#');
+ TQString fixedpath = pos == -1 ? path : path.left (pos);
return LCHMUrlFactory::makeURLabsoluteIfNeeded( fixedpath );
}
@@ -925,9 +925,9 @@ QString LCHMFileImpl::normalizeUrl( const QString & path ) const
* FIXME: <OBJECT type="text/sitemap"><param name="Merge" value="hhaxref.chm::/HHOCX_c.hhc"></OBJECT>
* (from htmlhelp.chm)
*/
-bool LCHMFileImpl::parseFileAndFillArray( const QString & file, QT34VECTOR< LCHMParsedEntry > * data, bool asIndex )
+bool LCHMFileImpl::parseFileAndFillArray( const TQString & file, QT34VECTOR< LCHMParsedEntry > * data, bool asIndex )
{
- QString src;
+ TQString src;
const int MAX_NEST_DEPTH = 256;
if ( !getFileContentAsString( &src, file ) || src.isEmpty() )
@@ -937,11 +937,11 @@ bool LCHMFileImpl::parseFileAndFillArray( const QString & file, QT34VECTOR< LCHM
/*
// Save the index for debugging purposes
- QFile outfile( "parsed.htm" );
+ TQFile outfile( "parsed.htm" );
if ( outfile.open( IO_WriteOnly ) )
{
- QTextStream textstream( &outfile );
+ TQTextStream textstream( &outfile );
textstream << src;
outfile.close();
}
@@ -957,7 +957,7 @@ bool LCHMFileImpl::parseFileAndFillArray( const QString & file, QT34VECTOR< LCHM
// Split the HHC file by HTML tags
int stringlen = src.length();
- while ( pos < stringlen && (pos = src.find ('<', pos)) != -1 )
+ while ( pos < stringlen && (pos = src.tqfind ('<', pos)) != -1 )
{
int i, word_end = 0;
@@ -967,8 +967,8 @@ bool LCHMFileImpl::parseFileAndFillArray( const QString & file, QT34VECTOR< LCHM
if ( (src[i] == '"' || src[i] == '\'') )
{
// find where quote ends, either by another quote, or by '>' symbol (some people don't know HTML)
- int nextpos = src.find (src[i], i+1);
- if ( nextpos == -1 && (nextpos = src.find ('>', i+1)) == -1 )
+ int nextpos = src.tqfind (src[i], i+1);
+ if ( nextpos == -1 && (nextpos = src.tqfind ('>', i+1)) == -1 )
{
qWarning ("LCHMFileImpl::ParseHhcAndFillTree: corrupted TOC: %s", src.mid(i).ascii());
return false;
@@ -982,7 +982,7 @@ bool LCHMFileImpl::parseFileAndFillArray( const QString & file, QT34VECTOR< LCHM
word_end = i;
}
- QString tagword, tag = src.mid (pos, i - pos);
+ TQString tagword, tag = src.mid (pos, i - pos);
if ( word_end )
tagword = src.mid (pos, word_end - pos).lower();
@@ -992,7 +992,7 @@ bool LCHMFileImpl::parseFileAndFillArray( const QString & file, QT34VECTOR< LCHM
//qDebug ("tag: '%s', tagword: '%s'\n", tag.ascii(), tagword.ascii());
// <OBJECT type="text/sitemap"> - a topic entry
- if ( tagword == "object" && tag.find ("text/sitemap", 0, false) != -1 )
+ if ( tagword == "object" && tag.tqfind ("text/sitemap", 0, false) != -1 )
in_object = true;
else if ( tagword == "/object" && in_object )
{
@@ -1021,7 +1021,7 @@ bool LCHMFileImpl::parseFileAndFillArray( const QString & file, QT34VECTOR< LCHM
qDebug ("LCHMFileImpl::ParseAndFillTopicsTree: <object> tag is parsed, but both name and url are empty.");
}
- entry.name = QString::null;
+ entry.name = TQString();
entry.urls.clear();
entry.imageid = defaultimagenum;
in_object = false;
@@ -1030,17 +1030,17 @@ bool LCHMFileImpl::parseFileAndFillArray( const QString & file, QT34VECTOR< LCHM
{
// <param name="Name" value="First Page">
int offset; // strlen("param ")
- QString name_pattern = "name=", value_pattern = "value=";
- QString pname, pvalue;
+ TQString name_pattern = "name=", value_pattern = "value=";
+ TQString pname, pvalue;
- if ( (offset = tag.find (name_pattern, 0, FALSE)) == -1 )
+ if ( (offset = tag.tqfind (name_pattern, 0, FALSE)) == -1 )
qFatal ("LCHMFileImpl::ParseAndFillTopicsTree: bad <param> tag '%s': no name=\n", tag.ascii());
// offset+5 skips 'name='
offset = findStringInQuotes (tag, offset + name_pattern.length(), pname, TRUE, FALSE);
pname = pname.lower();
- if ( (offset = tag.find (value_pattern, offset, FALSE)) == -1 )
+ if ( (offset = tag.tqfind (value_pattern, offset, FALSE)) == -1 )
qFatal ("LCHMFileImpl::ParseAndFillTopicsTree: bad <param> tag '%s': no value=\n", tag.ascii());
// offset+6 skips 'value='
@@ -1057,9 +1057,9 @@ bool LCHMFileImpl::parseFileAndFillArray( const QString & file, QT34VECTOR< LCHM
else if ( pname == "local" )
{
// Check for URL duplication
- QString url = LCHMUrlFactory::makeURLabsoluteIfNeeded( pvalue );
+ TQString url = LCHMUrlFactory::makeURLabsoluteIfNeeded( pvalue );
- if ( entry.urls.find( url ) == entry.urls.end() )
+ if ( entry.urls.tqfind( url ) == entry.urls.end() )
entry.urls.push_back( url );
}
else if ( pname == "see also" && asIndex && entry.name != pvalue )
@@ -1097,7 +1097,7 @@ bool LCHMFileImpl::parseFileAndFillArray( const QString & file, QT34VECTOR< LCHM
}
-bool LCHMFileImpl::getFileContentAsBinary( QByteArray * data, const QString & url ) const
+bool LCHMFileImpl::getFileContentAsBinary( TQByteArray * data, const TQString & url ) const
{
chmUnitInfo ui;
@@ -1113,9 +1113,9 @@ bool LCHMFileImpl::getFileContentAsBinary( QByteArray * data, const QString & ur
}
-bool LCHMFileImpl::getFileContentAsString( QString * str, const QString & url, bool internal_encoding )
+bool LCHMFileImpl::getFileContentAsString( TQString * str, const TQString & url, bool internal_encoding )
{
- QByteArray buf;
+ TQByteArray buf;
if ( getFileContentAsBinary( &buf, url ) )
{
@@ -1126,7 +1126,7 @@ bool LCHMFileImpl::getFileContentAsString( QString * str, const QString & url, b
buf.resize( length + 1 );
buf [length] = '\0';
- *str = internal_encoding ? (QString)((const char*) buf) : encodeWithCurrentCodec((const char*) buf);
+ *str = internal_encoding ? (TQString)((const char*) buf) : encodeWithCurrentCodec((const char*) buf);
return true;
}
}
@@ -1135,12 +1135,12 @@ bool LCHMFileImpl::getFileContentAsString( QString * str, const QString & url, b
}
-QString LCHMFileImpl::getTopicByUrl( const QString & url ) const
+TQString LCHMFileImpl::getTopicByUrl( const TQString & url ) const
{
- QMap< QString, QString >::const_iterator it = m_url2topics.find( url );
+ TQMap< TQString, TQString >::const_iterator it = m_url2topics.tqfind( url );
if ( it == m_url2topics.end() )
- return QString::null;
+ return TQString();
return it.data();
}
@@ -1148,17 +1148,17 @@ QString LCHMFileImpl::getTopicByUrl( const QString & url ) const
static int chm_enumerator_callback( struct chmFile*, struct chmUnitInfo *ui, void *context )
{
- ((QStringList*) context)->push_back( ui->path );
+ ((TQStringList*) context)->push_back( ui->path );
return CHM_ENUMERATOR_CONTINUE;
}
-bool LCHMFileImpl::enumerateFiles( QStringList * files )
+bool LCHMFileImpl::enumerateFiles( TQStringList * files )
{
files->clear();
return chm_enumerate( m_chmFile, CHM_ENUMERATE_ALL, chm_enumerator_callback, files );
}
-const QPixmap * LCHMFileImpl::getBookIconPixmap( unsigned int imagenum )
+const TQPixmap * LCHMFileImpl::getBookIconPixmap( unsigned int imagenum )
{
return m_imagesKeeper.getImage( imagenum );
}
@@ -1188,7 +1188,7 @@ bool LCHMFileImpl::guessTextEncoding( )
bool LCHMFileImpl::changeFileEncoding( const char *qtencoding )
{
- // Encoding could be either simple Qt codepage, or set like CP1251/KOI8, which allows to
+ // Encoding could be either simple TQt codepage, or set like CP1251/KOI8, which allows to
// set up encodings separately for text (first) and internal files (second)
const char * p = strchr( qtencoding, '/' );
if ( p )
@@ -1197,7 +1197,7 @@ bool LCHMFileImpl::changeFileEncoding( const char *qtencoding )
strcpy( buf, qtencoding );
buf[p - qtencoding] = '\0';
- m_textCodec = QTextCodec::codecForName( buf );
+ m_textCodec = TQTextCodec::codecForName( buf );
if ( !m_textCodec )
{
@@ -1205,7 +1205,7 @@ bool LCHMFileImpl::changeFileEncoding( const char *qtencoding )
return false;
}
- m_textCodecForSpecialFiles = QTextCodec::codecForName( p + 1 );
+ m_textCodecForSpecialFiles = TQTextCodec::codecForName( p + 1 );
if ( !m_textCodecForSpecialFiles )
{
@@ -1215,7 +1215,7 @@ bool LCHMFileImpl::changeFileEncoding( const char *qtencoding )
}
else
{
- m_textCodecForSpecialFiles = m_textCodec = QTextCodec::codecForName (qtencoding);
+ m_textCodecForSpecialFiles = m_textCodec = TQTextCodec::codecForName (qtencoding);
if ( !m_textCodec )
{
@@ -1235,7 +1235,7 @@ void LCHMFileImpl::fillTopicsUrlMap()
return;
// Read those tables
- QByteArray topics( m_chmTOPICS.length ), urltbl( m_chmURLTBL.length ), urlstr( m_chmURLSTR.length ), strings( m_chmSTRINGS.length );
+ TQByteArray topics( m_chmTOPICS.length ), urltbl( m_chmURLTBL.length ), urlstr( m_chmURLSTR.length ), strings( m_chmSTRINGS.length );
if ( !RetrieveObject( &m_chmTOPICS, (unsigned char*) topics.data(), 0, m_chmTOPICS.length )
|| !RetrieveObject( &m_chmURLTBL, (unsigned char*) urltbl.data(), 0, m_chmURLTBL.length )
@@ -1249,7 +1249,7 @@ void LCHMFileImpl::fillTopicsUrlMap()
u_int32_t off_url = get_int32_le( (u_int32_t *)(topics.data() + i + 8) );
off_url = get_int32_le( (u_int32_t *)( urltbl.data() + off_url + 8) ) + 8;
- QString url = LCHMUrlFactory::makeURLabsoluteIfNeeded( (const char*) urlstr.data() + off_url );
+ TQString url = LCHMUrlFactory::makeURLabsoluteIfNeeded( (const char*) urlstr.data() + off_url );
if ( off_title < strings.size() )
m_url2topics[url] = encodeWithCurrentCodec ( (const char*) strings.data() + off_title );
@@ -1259,7 +1259,7 @@ void LCHMFileImpl::fillTopicsUrlMap()
}
-bool LCHMFileImpl::getFileSize(unsigned int * size, const QString & url)
+bool LCHMFileImpl::getFileSize(unsigned int * size, const TQString & url)
{
chmUnitInfo ui;