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
v3.5.13-sru
tpearson 14 years ago
parent 35ff2a942f
commit 25794f5046

@ -29,9 +29,9 @@
#include <kurl.h>
#include <kmimemagic.h>
#include <qfile.h>
#include <qbitarray.h>
#include <qvaluevector.h>
#include <tqfile.h>
#include <tqbitarray.h>
#include <tqvaluevector.h>
#include "msits.h"
#include "libchmurlfactory.h"
@ -60,7 +60,7 @@ extern "C"
}
}
ProtocolMSITS::ProtocolMSITS (const QCString &pool_socket, const QCString &app_socket)
ProtocolMSITS::ProtocolMSITS (const TQCString &pool_socket, const TQCString &app_socket)
: SlaveBase ("kio_msits", pool_socket, app_socket)
{
m_chmFile = 0;
@ -76,7 +76,7 @@ ProtocolMSITS::~ProtocolMSITS()
}
// A simple stat() wrapper
static bool isDirectory ( const QString & filename )
static bool isDirectory ( const TQString & filename )
{
return filename[filename.length() - 1] == '/';
}
@ -84,9 +84,9 @@ static bool isDirectory ( const QString & filename )
void ProtocolMSITS::get( const KURL& url )
{
QString htmdata, fileName;
TQString htmdata, fileName;
chmUnitInfo ui;
QByteArray buf;
TQByteArray buf;
kdDebug() << "kio_msits::get() " << url.path() << endl;
@ -137,11 +137,11 @@ void ProtocolMSITS::get( const KURL& url )
}
bool ProtocolMSITS::parseLoadAndLookup ( const KURL& url, QString& abspath )
bool ProtocolMSITS::parseLoadAndLookup ( const KURL& url, TQString& abspath )
{
kdDebug() << "ProtocolMSITS::parseLoadAndLookup (const KURL&) " << url.path() << endl;
int pos = url.path().find ("::");
int pos = url.path().tqfind ("::");
if ( pos == -1 )
{
@ -149,7 +149,7 @@ bool ProtocolMSITS::parseLoadAndLookup ( const KURL& url, QString& abspath )
return false;
}
QString filename = url.path().left (pos);
TQString filename = url.path().left (pos);
abspath = url.path().mid (pos + 2); // skip ::
// Some buggy apps add ms-its:/ to the path as well
@ -173,7 +173,7 @@ bool ProtocolMSITS::parseLoadAndLookup ( const KURL& url, QString& abspath )
// First try to open a temporary file
chmFile * tmpchm;
if ( (tmpchm = chm_open ( QFile::encodeName (filename))) == 0 )
if ( (tmpchm = chm_open ( TQFile::encodeName (filename))) == 0 )
{
error( KIO::ERR_COULD_NOT_READ, url.prettyURL() );
return false;
@ -193,7 +193,7 @@ bool ProtocolMSITS::parseLoadAndLookup ( const KURL& url, QString& abspath )
/*
* Shamelessly stolen from a KDE KIO tutorial
*/
static void app_entry(UDSEntry& e, unsigned int uds, const QString& str)
static void app_entry(UDSEntry& e, unsigned int uds, const TQString& str)
{
UDSAtom a;
a.m_uds = uds;
@ -212,7 +212,7 @@ static void app_entry(UDSEntry& e, unsigned int uds, const QString& str)
// internal function
// fills a directory item with its name and size
static void app_dir(UDSEntry& e, const QString & name)
static void app_dir(UDSEntry& e, const TQString & name)
{
e.clear();
app_entry(e, KIO::UDS_NAME, name);
@ -222,7 +222,7 @@ static void app_dir(UDSEntry& e, const QString & name)
// internal function
// fills a file item with its name and size
static void app_file(UDSEntry& e, const QString & name, size_t size)
static void app_file(UDSEntry& e, const TQString & name, size_t size)
{
e.clear();
app_entry(e, KIO::UDS_NAME, name);
@ -232,7 +232,7 @@ static void app_file(UDSEntry& e, const QString & name, size_t size)
void ProtocolMSITS::stat (const KURL & url)
{
QString fileName;
TQString fileName;
chmUnitInfo ui;
kdDebug() << "kio_msits::stat (const KURL& url) " << url.path() << endl;
@ -263,14 +263,14 @@ void ProtocolMSITS::stat (const KURL & url)
// A local CHMLIB enumerator
static int chmlib_enumerator (struct chmFile *, struct chmUnitInfo *ui, void *context)
{
((QValueVector<QString> *) context)->push_back (QString::fromLocal8Bit (ui->path));
((TQValueVector<TQString> *) context)->push_back (TQString::fromLocal8Bit (ui->path));
return CHM_ENUMERATOR_CONTINUE;
}
void ProtocolMSITS::listDir (const KURL & url)
{
QString filepath;
TQString filepath;
kdDebug() << "kio_msits::listDir (const KURL& url) " << url.path() << endl;
@ -287,7 +287,7 @@ void ProtocolMSITS::listDir (const KURL & url)
kdDebug() << "kio_msits::listDir: enumerating directory " << filepath << endl;
QValueVector<QString> listing;
TQValueVector<TQString> listing;
if ( chm_enumerate_dir ( m_chmFile,
filepath.local8Bit(),
@ -305,7 +305,7 @@ void ProtocolMSITS::listDir (const KURL & url)
for ( unsigned int i = 0; i < listing.size(); i++ )
{
// Strip the direcroty name
QString ename = listing[i].mid (striplength);
TQString ename = listing[i].mid (striplength);
if ( isDirectory ( ename ) )
app_dir(entry, ename);

@ -26,8 +26,8 @@
#include <kio/slavebase.h>
#include <kurl.h>
#include <qstring.h>
#include <qcstring.h>
#include <tqstring.h>
#include <tqcstring.h>
#include "config.h"
#include "chm_lib.h"
@ -36,7 +36,7 @@
class ProtocolMSITS : public KIO::SlaveBase
{
public:
ProtocolMSITS ( const QCString&, const QCString& );
ProtocolMSITS ( const TQCString&, const TQCString& );
virtual ~ProtocolMSITS();
virtual void get ( const KURL& );
@ -48,10 +48,10 @@ private:
// - parses the URL to get a file name and URL inside the file;
// - loads a new CHM file, if needed;
// - returns the parsed URL inside the file;
bool parseLoadAndLookup ( const KURL&, QString& abspath );
bool parseLoadAndLookup ( const KURL&, TQString& abspath );
// Resolve an object inside a CHM file
inline bool ResolveObject (const QString& fileName, chmUnitInfo *ui)
inline bool ResolveObject (const TQString& fileName, chmUnitInfo *ui)
{
return m_chmFile != NULL && ::chm_resolve_object(m_chmFile, fileName.utf8(), ui) == CHM_RESOLVE_SUCCESS;
}
@ -69,7 +69,7 @@ private:
}
// An opened file name, if presend
QString m_openedFile;
TQString m_openedFile;
// a CHM structure file pointer (from chmlib)
chmFile * m_chmFile;

@ -84,7 +84,7 @@ inline u_int64_t sr_int(unsigned char* byte, int* bit,
unsigned char s, unsigned char r, size_t& length)
{
u_int64_t ret;
unsigned char mask;
unsigned char tqmask;
int n, n_bits, num_bits, base, count;
length = 0;
size_t fflen;
@ -105,37 +105,37 @@ inline u_int64_t sr_int(unsigned char* byte, int* bit,
switch(num_bits){
case 0:
mask = 1;
tqmask = 1;
break;
case 1:
mask = 3;
tqmask = 3;
break;
case 2:
mask = 7;
tqmask = 7;
break;
case 3:
mask = 0xf;
tqmask = 0xf;
break;
case 4:
mask = 0x1f;
tqmask = 0x1f;
break;
case 5:
mask = 0x3f;
tqmask = 0x3f;
break;
case 6:
mask = 0x7f;
tqmask = 0x7f;
break;
case 7:
mask = 0xff;
tqmask = 0xff;
break;
default:
mask = 0xff;
tqmask = 0xff;
break;
}
mask <<= base;
tqmask <<= base;
ret = (ret << (num_bits+1)) |
(u_int64_t)((*byte & mask) >> base);
(u_int64_t)((*byte & tqmask) >> base);
if( n > *bit ){
++byte;

@ -33,7 +33,7 @@ LCHMFile::~ LCHMFile( )
delete m_impl;
}
bool LCHMFile::loadFile( const QString & archiveName )
bool LCHMFile::loadFile( const TQString & archiveName )
{
return m_impl->loadFile( archiveName );
}
@ -43,14 +43,14 @@ void LCHMFile::closeAll( )
m_impl->closeAll();
}
QString LCHMFile::title( ) const
TQString LCHMFile::title( ) const
{
return m_impl->title();
}
QString LCHMFile::homeUrl( ) const
TQString LCHMFile::homeUrl( ) const
{
QString url = m_impl->homeUrl();
TQString url = m_impl->homeUrl();
return url.isNull() ? "/" : url;
}
@ -79,27 +79,27 @@ bool LCHMFile::parseIndex( QT34VECTOR< LCHMParsedEntry > * indexes ) const
return m_impl->parseFileAndFillArray( m_impl->m_indexFile, indexes, true );
}
bool LCHMFile::getFileContentAsString( QString * str, const QString & url )
bool LCHMFile::getFileContentAsString( TQString * str, const TQString & url )
{
return m_impl->getFileContentAsString( str, url );
}
bool LCHMFile::getFileContentAsBinary( QByteArray * data, const QString & url )
bool LCHMFile::getFileContentAsBinary( TQByteArray * data, const TQString & url )
{
return m_impl->getFileContentAsBinary( data, url );
}
bool LCHMFile::enumerateFiles( QStringList * files )
bool LCHMFile::enumerateFiles( TQStringList * files )
{
return m_impl->enumerateFiles( files );
}
QString LCHMFile::getTopicByUrl( const QString & url )
TQString LCHMFile::getTopicByUrl( const TQString & url )
{
return m_impl->getTopicByUrl( url );
}
const QPixmap * LCHMFile::getBookIconPixmap( unsigned int imagenum )
const TQPixmap * LCHMFile::getBookIconPixmap( unsigned int imagenum )
{
return m_impl->getBookIconPixmap( imagenum );
}
@ -114,12 +114,12 @@ bool LCHMFile::setCurrentEncoding( const LCHMTextEncoding * encoding )
return m_impl->setCurrentEncoding( encoding );
}
QString LCHMFile::normalizeUrl( const QString & url ) const
TQString LCHMFile::normalizeUrl( const TQString & url ) const
{
return m_impl->normalizeUrl( url );
}
bool LCHMFile::getFileSize(unsigned int * size, const QString & url)
bool LCHMFile::getFileSize(unsigned int * size, const TQString & url)
{
return m_impl->getFileSize( size, url );
}

@ -22,22 +22,22 @@
#ifndef INCLUDE_LIBCHMFILE_H
#define INCLUDE_LIBCHMFILE_H
#include <qstring.h>
#include <qcstring.h>
#include <qlistview.h>
#include <qlistbox.h>
#include <qmap.h>
#include <qvaluevector.h>
#include <qtextcodec.h>
#include <tqstring.h>
#include <tqcstring.h>
#include <tqlistview.h>
#include <tqlistbox.h>
#include <tqmap.h>
#include <tqvaluevector.h>
#include <tqtextcodec.h>
#include "libchmtextencoding.h"
// Qt3/Qt4 compatibility: in Qt3 QVector stores pointers, not values - so QValueVector should be used.
// In Qt4 QVector stores values, so we can use QVector
#if defined (USE_QT_4)
#define QT34VECTOR QVector
// TQt3/TQt4 compatibility: in TQt3 TQVector stores pointers, not values - so TQValueVector should be used.
// In TQt4 TQVector stores values, so we can use TQVector
#if defined (USE_TQT_4)
#define QT34VECTOR TQVector
#else
#define QT34VECTOR QValueVector
#define QT34VECTOR TQValueVector
#endif
@ -56,10 +56,10 @@ namespace LCHMBookIcons
typedef struct
{
//! Entry name
QString name;
TQString name;
//! Entry URLs. The TOC entry should have only one URL; the index entry could have several.
QStringList urls;
TQStringList urls;
//! Associated image number. Used for TOC only; indexes does not have the image.
//! Use LCHMFile::getBookIconPixmap() to get associated pixmap icon
@ -91,7 +91,7 @@ class LCHMFile
* this one are present locally (like MSDN).
* \ingroup init
*/
bool loadFile( const QString& archiveName );
bool loadFile( const TQString& archiveName );
/*!
* \brief Closes all the files, and frees the appropriate data.
@ -104,7 +104,7 @@ class LCHMFile
* \return The name of the opened document, or an empty string if no .chm has been loaded.
* \ingroup information
*/
QString title() const;
TQString title() const;
/*!
* \brief Gets the URL of the default page in the chm archive.
@ -113,7 +113,7 @@ class LCHMFile
* returns "/".
* \ingroup information
*/
QString homeUrl() const;
TQString homeUrl() const;
/*!
* \brief Checks whether the Table of Contents is present in this file.
@ -161,7 +161,7 @@ class LCHMFile
bool parseIndex( QT34VECTOR< LCHMParsedEntry > * indexes ) const;
/*!
* \brief Retrieves the content from url in current chm file to QString.
* \brief Retrieves the content from url in current chm file to TQString.
* \param str A string where the retreived content should be stored.
* \param url An URL in chm file to retreive content from. Must be absolute.
* \return true if the content is successfully received; false otherwise.
@ -173,10 +173,10 @@ class LCHMFile
* \sa setCurrentEncoding() currentEncoding() getFileContentAsBinary()
* \ingroup dataretrieve
*/
bool getFileContentAsString( QString * str, const QString& url );
bool getFileContentAsString( TQString * str, const TQString& url );
/*!
* \brief Retrieves the content from url in current chm file to QByteArray.
* \brief Retrieves the content from url in current chm file to TQByteArray.
* \param data A data array where the retreived content should be stored.
* \param url An URL in chm file to retreive content from. Must be absolute.
* \return true if the content is successfully received; false otherwise.
@ -187,7 +187,7 @@ class LCHMFile
* \sa getFileContentAsString()
* \ingroup dataretrieve
*/
bool getFileContentAsBinary( QByteArray * data, const QString& url );
bool getFileContentAsBinary( TQByteArray * data, const TQString& url );
/*!
* \brief Retrieves the content size.
@ -197,7 +197,7 @@ class LCHMFile
*
* \ingroup dataretrieve
*/
bool getFileSize( unsigned int * size, const QString& url );
bool getFileSize( unsigned int * size, const TQString& url );
/*!
* \brief Obtains the list of all the files in current chm file archive.
@ -206,16 +206,16 @@ class LCHMFile
*
* \ingroup dataretrieve
*/
bool enumerateFiles( QStringList * files );
bool enumerateFiles( TQStringList * files );
/*!
* \brief Gets the Title of the HTML page referenced by url.
* \param url An URL in chm file to get title from. Must be absolute.
* \return The title, or QString::null if the URL cannot be found or not a HTML page.
* \return The title, or TQString() if the URL cannot be found or not a HTML page.
*
* \ingroup dataretrieve
*/
QString getTopicByUrl ( const QString& url );
TQString getTopicByUrl ( const TQString& url );
/*!
* \brief Gets the appropriate CHM pixmap icon.
@ -224,7 +224,7 @@ class LCHMFile
*
* \ingroup dataretrieve
*/
const QPixmap * getBookIconPixmap( unsigned int imagenum );
const TQPixmap * getBookIconPixmap( unsigned int imagenum );
/*!
* \brief Normalizes the URL, converting relatives, adding "/" in front and removing ..
@ -233,7 +233,7 @@ class LCHMFile
*
* \ingroup dataretrieve
*/
QString normalizeUrl( const QString& url ) const;
TQString normalizeUrl( const TQString& url ) const;
/*!
* \brief Gets the current CHM archive encoding (set or autodetected)
@ -270,7 +270,7 @@ class LCHMFile
* If there is no prefix, the word considered as required.
* \ingroup search
*/
bool searchQuery ( const QString& query, QStringList * results, unsigned int limit = 100 );
bool searchQuery ( const TQString& query, TQStringList * results, unsigned int limit = 100 );
//! Access to implementation
LCHMFileImpl * impl() { return m_impl; }

@ -19,7 +19,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#include <qregexp.h>
#include <tqregexp.h>
#include "libchmfile.h"
#include "libchmfileimpl.h"
@ -28,20 +28,20 @@
#define DEBUG_SEARCH(A)
static inline void validateWord ( QString & word, bool & query_valid )
static inline void validateWord ( TQString & word, bool & query_valid )
{
QRegExp rxvalid ("[^\\d\\w_\\.]+");
TQRegExp rxvalid ("[^\\d\\w_\\.]+");
QString orig = word;
TQString orig = word;
word.remove ( rxvalid );
if ( word != orig )
query_valid = false;
}
static inline void validateWords ( QStringList & wordlist, bool & query_valid )
static inline void validateWords ( TQStringList & wordlist, bool & query_valid )
{
QRegExp rxvalid ("[^\\d\\w_\\.]+");
TQRegExp rxvalid ("[^\\d\\w_\\.]+");
for ( unsigned int i = 0; i < wordlist.size(); i++ )
validateWord ( wordlist[i], query_valid );
@ -116,7 +116,7 @@ static inline void findNextWords ( QT34VECTOR<u_int64_t> & src, const QT34VECTOR
}
inline bool searchPhrase( LCHMFileImpl * impl, const QStringList & phrase, LCHMSearchProgressResults & results )
inline bool searchPhrase( LCHMFileImpl * impl, const TQStringList & phrase, LCHMSearchProgressResults & results )
{
// Accumulate the phrase data here.
LCHMSearchProgressResults phrasekeeper;
@ -173,11 +173,11 @@ inline bool searchPhrase( LCHMFileImpl * impl, const QStringList & phrase, LCHMS
bool LCHMFile::searchQuery( const QString& inquery, QStringList * searchresults, unsigned int limit )
bool LCHMFile::searchQuery( const TQString& inquery, TQStringList * searchresults, unsigned int limit )
{
QStringList words_must_exist, words_must_not_exist, words_highlight;
QT34VECTOR<QStringList> phrases_must_exist;
QString query = inquery;
TQStringList words_must_exist, words_must_not_exist, words_highlight;
QT34VECTOR<TQStringList> phrases_must_exist;
TQString query = inquery;
bool query_valid = true;
LCHMSearchProgressResults results;
int pos;
@ -196,15 +196,15 @@ bool LCHMFile::searchQuery( const QString& inquery, QStringList * searchresults,
* If there is no prefix, the word considered as required.
*/
QRegExp rxphrase( "\"(.*)\"" );
QRegExp rxword( "([^\\s]+)" );
TQRegExp rxphrase( "\"(.*)\"" );
TQRegExp rxword( "([^\\s]+)" );
rxphrase.setMinimal( TRUE );
// First, get the phrase queries
while ( (pos = rxphrase.search (query, 0)) != -1 )
{
// A phrase query found. Locate its boundaries, and parse it.
QStringList plist = QStringList::split ( QRegExp ("\\s+"), rxphrase.cap ( 1 ));
TQStringList plist = TQStringList::split ( TQRegExp ("\\s+"), rxphrase.cap ( 1 ));
validateWords ( plist, query_valid );
@ -218,8 +218,8 @@ bool LCHMFile::searchQuery( const QString& inquery, QStringList * searchresults,
while ( (pos = rxword.search (query, 0)) != -1 )
{
// A phrase query found. Locate its boundaries, and parse it.
QString word = rxword.cap ( 1 );
QChar type = '+';
TQString word = rxword.cap ( 1 );
TQChar type = '+';
if ( word[0] == '-' || word[0] == '+' )
{
@ -237,17 +237,17 @@ bool LCHMFile::searchQuery( const QString& inquery, QStringList * searchresults,
query.remove (pos, rxword.matchedLength());
}
#if defined (DUMP_SEARCH_QUERY)
#if defined (DUMP_SEARCH_TQUERY)
// Dump the search query
QString qdump;
TQString qdump;
for ( i = 0; i < phrases_must_exist.size(); i++ )
qdump += QString(" \"") + phrases_must_exist[i].join (" ") + QString ("\"");
qdump += TQString(" \"") + phrases_must_exist[i].join (" ") + TQString ("\"");
for ( i = 0; i < words_must_not_exist.size(); i++ )
qdump += QString (" -") + words_must_not_exist[i];
qdump += TQString (" -") + words_must_not_exist[i];
for ( i = 0; i < words_must_exist.size(); i++ )
qdump += QString (" +") + words_must_exist[i];
qdump += TQString (" +") + words_must_exist[i];
qDebug ("Search query dump: %s", qdump.ascii());
#endif

@ -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["Delta"] = QChar((unsigned short) 916);
m_entityDecodeMap["Pi"] = QChar((unsigned short) 928);
m_entityDecodeMap["Sigma"] = QChar((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["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["fnof"] = TQChar((unsigned short) 402);
m_entityDecodeMap["Delta"] = TQChar((unsigned short) 916);
m_entityDecodeMap["Pi"] = TQChar((unsigned short) 928);
m_entityDecodeMap["Sigma"] = TQChar((unsigned short) 931);
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"] = 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;

@ -34,7 +34,7 @@ class LCHMSearchProgressResult
inline LCHMSearchProgressResult() {}
inline LCHMSearchProgressResult( u_int32_t t, u_int32_t u ) : titleoff(t),urloff(u) {}
QValueVector<u_int64_t> offsets;
TQValueVector<u_int64_t> offsets;
u_int32_t titleoff;
u_int32_t urloff;
};
@ -51,25 +51,25 @@ class LCHMFileImpl
~LCHMFileImpl();
// Implementations for LCHMFile members
bool loadFile( const QString& archiveName );
bool loadFile( const TQString& archiveName );
void closeAll();
QString title() const { return encodeWithCurrentCodec( m_title ); }
QString homeUrl() const { return encodeWithCurrentCodec( m_home ); }
TQString title() const { return encodeWithCurrentCodec( m_title ); }
TQString homeUrl() const { return encodeWithCurrentCodec( m_home ); }
bool getFileContentAsString( QString * str, const QString& url, bool internal_encoding = false );
bool getFileContentAsBinary( QByteArray * data, const QString& url ) const;
bool getFileSize( unsigned int * size, const QString& url );
bool getFileContentAsString( TQString * str, const TQString& url, bool internal_encoding = false );
bool getFileContentAsBinary( TQByteArray * data, const TQString& url ) const;
bool getFileSize( unsigned int * size, const TQString& url );
bool enumerateFiles( QStringList * files );
QString getTopicByUrl ( const QString& url ) const;
bool enumerateFiles( TQStringList * files );
TQString getTopicByUrl ( const TQString& url ) const;
const QPixmap * getBookIconPixmap( unsigned int imagenum );
const TQPixmap * getBookIconPixmap( unsigned int imagenum );
bool setCurrentEncoding( const LCHMTextEncoding * encoding );
//! Parse the HHC or HHS file, and fill the context (asIndex is false) or index (asIndex is true) array.
bool parseFileAndFillArray (const QString& file, QT34VECTOR< LCHMParsedEntry > * data, bool asIndex );
bool parseFileAndFillArray (const TQString& file, QT34VECTOR< LCHMParsedEntry > * data, bool asIndex );
/*!
* \brief Fast search using the $FIftiMain file in the .chm.
@ -82,7 +82,7 @@ class LCHMFileImpl
* \param phrase_search Indicates that word offset information should be kept.
* \return true if the search found something, false otherwise.
*/
bool searchWord( const QString& word,
bool searchWord( const TQString& word,
bool wholeWords,
bool titlesOnly,
LCHMSearchProgressResults& results,
@ -95,46 +95,46 @@ class LCHMFileImpl
* The keys are the URLs and the values are the page titles.
*/
void getSearchResults( const LCHMSearchProgressResults& tempres,
QStringList * results,
TQStringList * results,
unsigned int limit_results = 500 );
//! Looks up fileName in the archive.
bool ResolveObject( const QString& fileName, chmUnitInfo *ui ) const;
bool ResolveObject( const TQString& fileName, chmUnitInfo *ui ) const;
//! Retrieves an uncompressed chunk of a file in the .chm.
size_t RetrieveObject(const chmUnitInfo *ui, unsigned char *buffer, LONGUINT64 fileOffset, LONGINT64 bufferSize) const;
//! Encode the string with the currently selected text codec, if possible. Or return as-is, if not.
inline QString encodeWithCurrentCodec (const QString& str) const
inline TQString encodeWithCurrentCodec (const TQString& str) const
{
return (m_textCodec ? m_textCodec->toUnicode (str) : str);
}
//! Encode the string with the currently selected text codec, if possible. Or return as-is, if not.
inline QString encodeWithCurrentCodec (const char * str) const
inline TQString encodeWithCurrentCodec (const char * str) const
{
return (m_textCodec ? m_textCodec->toUnicode (str) : (QString) str);
return (m_textCodec ? m_textCodec->toUnicode (str) : (TQString) str);
}
//! Encode the string from internal files with the currently selected text codec, if possible.
//! Or return as-is, if not.
inline QString encodeInternalWithCurrentCodec (const QString& str) const
inline TQString encodeInternalWithCurrentCodec (const TQString& str) const
{
return (m_textCodecForSpecialFiles ? m_textCodecForSpecialFiles->toUnicode (str) : str);
}
//! Encode the string from internal files with the currently selected text codec, if possible.
//! Or return as-is, if not.
inline QString encodeInternalWithCurrentCodec (const char * str) const
inline TQString encodeInternalWithCurrentCodec (const char * str) const
{
return (m_textCodecForSpecialFiles ? m_textCodecForSpecialFiles->toUnicode (str) : (QString) str);
return (m_textCodecForSpecialFiles ? m_textCodecForSpecialFiles->toUnicode (str) : (TQString) str);
}
//! Helper. Translates from Win32 encodings to generic wxWidgets ones.
const char * GetFontEncFromCharSet (const QString& font) const;
const char * GetFontEncFromCharSet (const TQString& font) const;
//! Helper. Returns the $FIftiMain offset of leaf node or 0.
u_int32_t GetLeafNodeOffset(const QString& text,
u_int32_t GetLeafNodeOffset(const TQString& text,
u_int32_t initalOffset,
u_int32_t buffSize,
u_int16_t treeDepth );
@ -168,23 +168,23 @@ class LCHMFileImpl
bool guessTextEncoding ();
//! Change the current CHM encoding for internal files and texts.
//! 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)
bool changeFileEncoding( const char *qtencoding );
//! Convert the word, so it has an appropriate encoding
QCString convertSearchWord ( const QString &src );
TQCString convertSearchWord ( const TQString &src );
/*!
* Helper procedure in TOC parsing, decodes the string between the quotes (first or last) with decoding HTML
* entities like &iacute;
*/
int findStringInQuotes (const QString& tag, int offset, QString& value, bool firstquote, bool decodeentities );
int findStringInQuotes (const TQString& tag, int offset, TQString& value, bool firstquote, bool decodeentities );
/*!
* Decodes Unicode HTML entities according to current encoding.
*/
QString decodeEntity (const QString& entity );
TQString decodeEntity (const TQString& entity );
/*!
* \brief Returns the list of all available text encodings.
@ -216,7 +216,7 @@ class LCHMFileImpl
/*!
* Normalizes path to search in internal arrays
*/
QString normalizeUrl (const QString& path ) const;
TQString normalizeUrl (const TQString& path ) const;
// Members
@ -225,36 +225,36 @@ class LCHMFileImpl
chmFile * m_chmFile;
//! Opened file name
QString m_filename;
TQString m_filename;
//! Home url, got from CHM file
QString m_home;
TQString m_home;
//! Context tree filename. Got from CHM file
QString m_topicsFile;
TQString m_topicsFile;
//! Index filename. Got from CHM file
QString m_indexFile;
TQString m_indexFile;
//! Chm Title. Got from CHM file
QString m_title;
TQString m_title;
// Localization stuff
//! LCID from CHM file, used in encoding detection
short m_detectedLCID;
//! font charset from CHM file, used in encoding detection
QString m_font;
TQString m_font;
//! Chosen text codec
QTextCodec * m_textCodec;
QTextCodec * m_textCodecForSpecialFiles;
TQTextCodec * m_textCodec;
TQTextCodec * m_textCodecForSpecialFiles;
//! Current encoding
const LCHMTextEncoding * m_currentEncoding;
//! Map to decode HTML entitles like &acute; based on current encoding
QMap<QString, QString> m_entityDecodeMap;
TQMap<TQString, TQString> m_entityDecodeMap;
//! TRUE if /#TOPICS, /#STRINGS, /#URLTBL and /#URLSTR are resolved, and the members below are valid
bool m_lookupTablesValid;
@ -282,5 +282,5 @@ class LCHMFileImpl
LCHMTocImageKeeper m_imagesKeeper;
//! Map url->topic
QMap< QString, QString > m_url2topics;
TQMap< TQString, TQString > m_url2topics;
};

@ -33,7 +33,7 @@ typedef struct LCHMTextEncoding
int winlcid; //! Windows LCID for this language
int wincodepage; //! Windows codepage for this language.
int wincharset; //! Windows charset.
const char * qtcodec; //! Qt text codec to use
const char * qtcodec; //! TQt text codec to use
};

@ -2103,7 +2103,7 @@ LCHMTocImageKeeper::LCHMTocImageKeeper( )
}
}
const QPixmap * LCHMTocImageKeeper::getImage( int id )
const TQPixmap * LCHMTocImageKeeper::getImage( int id )
{
if ( id < 0 || id > LCHMBookIcons::MAX_BUILTIN_ICONS )
qFatal("LCHMTocImageKeeper::getImage: requested image id (%d) is out of range (%d)", id, LCHMBookIcons::MAX_BUILTIN_ICONS );

@ -25,8 +25,8 @@ class LCHMTocImageKeeper
{
public:
LCHMTocImageKeeper();
const QPixmap * getImage( int id );
const TQPixmap * getImage( int id );
private:
QPixmap m_images[LCHMBookIcons::MAX_BUILTIN_ICONS];
TQPixmap m_images[LCHMBookIcons::MAX_BUILTIN_ICONS];
};

@ -19,18 +19,18 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#include <qdir.h>
#include <qstring.h>
#include <qregexp.h>
#include <tqdir.h>
#include <tqstring.h>
#include <tqregexp.h>
namespace LCHMUrlFactory
{
static inline bool isRemoteURL( const QString & url, QString & protocol )
static inline bool isRemoteURL( const TQString & url, TQString & protocol )
{
// Check whether the URL is external
QRegExp uriregex ( "^(\\w+):\\/\\/" );
QRegExp mailtoregex ( "^(mailto):" );
TQRegExp uriregex ( "^(\\w+):\\/\\/" );
TQRegExp mailtoregex ( "^(mailto):" );
// mailto: can also have different format, so handle it
if ( url.startsWith( "mailto:" ) )
@ -40,7 +40,7 @@ static inline bool isRemoteURL( const QString & url, QString & protocol )
}
else if ( uriregex.search ( url ) != -1 )
{
QString proto = uriregex.cap ( 1 ).lower();
TQString proto = TQString(uriregex.cap( 1 )).lower();
// Filter the URLs which need to be opened by a browser
if ( proto == "http"
@ -57,15 +57,15 @@ static inline bool isRemoteURL( const QString & url, QString & protocol )
}
// Some JS urls start with javascript://
static inline bool isJavascriptURL( const QString & url )
static inline bool isJavascriptURL( const TQString & url )
{
return url.startsWith ("javascript://");
}
// Parse urls like "ms-its:file name.chm::/topic.htm"
static inline bool isNewChmURL( const QString & url, QString & chmfile, QString & page )
static inline bool isNewChmURL( const TQString & url, TQString & chmfile, TQString & page )
{
QRegExp uriregex ( "^ms-its:(.*)::(.*)$" );
TQRegExp uriregex ( "^ms-its:(.*)::(.*)$" );
if ( uriregex.search ( url ) != -1 )
{
@ -78,15 +78,15 @@ static inline bool isNewChmURL( const QString & url, QString & chmfile, QString
return false;
}
static inline QString makeURLabsoluteIfNeeded( const QString & url )
static inline TQString makeURLabsoluteIfNeeded( const TQString & url )
{
QString p1, p2, newurl = url;
TQString p1, p2, newurl = url;
if ( !isRemoteURL (url, p1)
&& !isJavascriptURL (url)
&& !isNewChmURL (url, p1, p2) )
{
newurl = QDir::cleanDirPath (url);
newurl = TQDir::cleanDirPath (url);
// Normalize url, so it becomes absolute
if ( newurl[0] != '/' )
@ -100,20 +100,20 @@ static inline QString makeURLabsoluteIfNeeded( const QString & url )
// Returns a special string, which allows the kio-slave, or viewwindow-browser iteraction
// to regognize our own internal urls, which is necessary to show image-only pages.
static inline QString getInternalUriExtension()
static inline TQString getInternalUriExtension()
{
return ".KCHMVIEWER_SPECIAL_HANDLER";
}
static inline bool handleFileType( const QString& link, QString& generated )
static inline bool handleFileType( const TQString& link, TQString& generated )
{
QString intext = getInternalUriExtension();
TQString intext = getInternalUriExtension();
if ( !link.endsWith( intext ) )
return false;
QString filelink = link.left( link.length() - strlen( intext ) );
TQString filelink = link.left( link.length() - strlen( intext ) );
generated = "<html><body><img src=\"" + filelink + "\"></body></html>";
return true;
}

@ -19,9 +19,9 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#include <qdir.h>
#include <tqdir.h>
#include "qt34.h"
#include "tqt34.h"
LIBCHMCString::LIBCHMCString()
{
@ -29,10 +29,10 @@ LIBCHMCString::LIBCHMCString()
LIBCHMCString::LIBCHMCString(const char *string)
{
#if defined (USE_QT_4)
cs = QByteArray(string);
#if defined (USE_TQT_4)
cs = TQByteArray(string);
#else
cs = QCString(string);
cs = TQCString(string);
#endif
}
@ -45,16 +45,16 @@ const char *LIBCHMCString::toCString() const
void LIBCHMCString::clear()
{
#if defined (USE_QT_4)
cs = QByteArray();
#if defined (USE_TQT_4)
cs = TQByteArray();
#else
cs = QCString();
cs = TQCString();
#endif
}
bool LIBCHMCString::operator==(const QString &string) const
bool LIBCHMCString::operator==(const TQString &string) const
{
return QString(cs) == string;
return TQString(cs) == string;
}
uint LIBCHMCString::length() const
@ -77,9 +77,9 @@ char LIBCHMCString::at(uint i) const
return cs.at(i);
}
void LIBCHMCString::replace(uint index, uint len, const char *str)
void LIBCHMCString::tqreplace(uint index, uint len, const char *str)
{
cs.replace(index, len, str);
cs.tqreplace(index, len, str);
}
void LIBCHMCString::remove(uint index, uint len)
@ -89,7 +89,7 @@ void LIBCHMCString::remove(uint index, uint len)
LIBCHMCString LIBCHMCString::lower()
{
#if defined (USE_QT_4)
#if defined (USE_TQT_4)
return cs.toLower().data();
#else
return cs.lower().data();
@ -98,21 +98,21 @@ LIBCHMCString LIBCHMCString::lower()
LIBCHMRegExp::LIBCHMRegExp(const QString &regexp)
LIBCHMRegExp::LIBCHMRegExp(const TQString &regexp)
{
re = QRegExp(regexp);
re = TQRegExp(regexp);
}
int LIBCHMRegExp::search(const QString &str, int offset)
int LIBCHMRegExp::search(const TQString &str, int offset)
{
#if defined (USE_QT_4)
#if defined (USE_TQT_4)
return re.indexIn(str, offset);
#else
return re.search(str, offset);
#endif
}
QString LIBCHMRegExp::cap(int nth)
TQString LIBCHMRegExp::cap(int nth)
{
return re.cap(nth);
}
@ -134,19 +134,19 @@ LIBCHMString::LIBCHMString()
{
}
LIBCHMString::LIBCHMString(const QString &string)
LIBCHMString::LIBCHMString(const TQString &string)
{
s = string;
}
LIBCHMString::LIBCHMString(const char *string)
{
s = QString(string);
s = TQString(string);
}
QString LIBCHMString::lower() const
TQString LIBCHMString::lower() const
{
#if defined (USE_QT_4)
#if defined (USE_TQT_4)
return s.toLower();
#else
return s.lower();
@ -155,58 +155,58 @@ QString LIBCHMString::lower() const
const char *LIBCHMString::ascii() const
{
#if defined (USE_QT_4)
#if defined (USE_TQT_4)
return s.toAscii();
#else
return s.ascii();
#endif
}
int LIBCHMString::find(char c, int index) const
int LIBCHMString::tqfind(char c, int index) const
{
#if defined (USE_QT_4)
#if defined (USE_TQT_4)
return s.indexOf(c, index);
#else
return s.find(c, index);
return s.tqfind(c, index);
#endif
}
int LIBCHMString::find(const QChar &c, int index) const
int LIBCHMString::tqfind(const TQChar &c, int index) const
{
#if defined (USE_QT_4)
#if defined (USE_TQT_4)
return s.indexOf(c, index);
#else
return s.find(c, index);
return s.tqfind(c, index);
#endif
}
int LIBCHMString::find(const QString &string, int index, bool cs) const
int LIBCHMString::tqfind(const TQString &string, int index, bool cs) const
{
#if defined (USE_QT_4)
Qt::CaseSensitivity cse;
if (cs) cse = Qt::CaseSensitive;
else cse = Qt::CaseInsensitive;
#if defined (USE_TQT_4)
TQt::CaseSensitivity cse;
if (cs) cse = TQt::CaseSensitive;
else cse = TQt::CaseInsensitive;
return s.indexOf(string, index, cse);
#else
return s.find(string, index, cs);
return s.tqfind(string, index, cs);
#endif
}
int LIBCHMString::findRev(char c) const
int LIBCHMString::tqfindRev(char c) const
{
#if defined (USE_QT_4)
#if defined (USE_TQT_4)
return s.lastIndexOf(c);
#else
return s.findRev(c);
return s.tqfindRev(c);
#endif
}
QChar LIBCHMString::at(uint i) const
TQChar LIBCHMString::at(uint i) const
{
return s.at(i);
}
QString LIBCHMString::left(uint len) const
TQString LIBCHMString::left(uint len) const
{
return s.left(len);
}
@ -221,39 +221,39 @@ bool LIBCHMString::isEmpty() const
return s.isEmpty();
}
QString LIBCHMString::toString() const
TQString LIBCHMString::toString() const
{
return s;
}
bool LIBCHMString::operator==(const QString &string) const
bool LIBCHMString::operator==(const TQString &string) const
{
return s == string;
}
QString LIBCHMDir::cleanDirPath(const QString &dir)
TQString LIBCHMDir::cleanDirPath(const TQString &dir)
{
#if defined (USE_QT_4)
return QDir::cleanPath(dir);
#if defined (USE_TQT_4)
return TQDir::cleanPath(dir);
#else
return QDir::cleanDirPath(dir);
return TQDir::cleanDirPath(dir);
#endif
}
bool LIBCHMStringList::contains(const QStringList &list, const QString &string)
bool LIBCHMStringList::tqcontains(const TQStringList &list, const TQString &string)
{
return list.contains(string);
return list.tqcontains(string);
}
QStringList LIBCHMStringList::split(const QRegExp &regexp, const QString &string)
TQStringList LIBCHMStringList::split(const TQRegExp &regexp, const TQString &string)
{
#if defined (USE_QT_4)
return string.split(regexp, QString::SkipEmptyParts);
#if defined (USE_TQT_4)
return string.split(regexp, TQString::SkipEmptyParts);
#else
return QStringList::split(regexp, string);
return TQStringList::split(regexp, string);
#endif
}

@ -22,22 +22,22 @@
#ifndef INCLUDE_QT34_H
#define INCLUDE_QT34_H
#include <qregexp.h>
#include <qstring.h>
#include <tqregexp.h>
#include <tqstring.h>
// Qt3/Qt4 compatibility: in Qt3 QVector stores pointers, not values - so QValueVector should be used.
// In Qt4 QVector stores values, so we can use QVector
#if defined (USE_QT_4)
#define LIBCHMVector QVector
// TQt3/TQt4 compatibility: in TQt3 TQVector stores pointers, not values - so TQValueVector should be used.
// In TQt4 TQVector stores values, so we can use TQVector
#if defined (USE_TQT_4)
#define LIBCHMVector TQVector
#else
#include <qvaluevector.h>
#define LIBCHMVector QValueVector
#include <tqvaluevector.h>
#define LIBCHMVector TQValueVector
#endif
#if defined (USE_QT_4)
#define LIBCHMMemArray QVector
#if defined (USE_TQT_4)
#define LIBCHMMemArray TQVector
#else
#define LIBCHMMemArray QMemArray
#define LIBCHMMemArray TQMemArray
#endif
class LIBCHMCString
@ -50,74 +50,74 @@ class LIBCHMCString
void clear();
bool operator==(const QString &string) const;
bool operator==(const TQString &string) const;
uint length() const;
bool isEmpty() const;
void prepend(char c);
char at(uint i) const;
void replace(uint index, uint len, const char *str);
void tqreplace(uint index, uint len, const char *str);
void remove(uint index, uint len);
LIBCHMCString lower();
private:
#if defined (USE_QT_4)
QByteArray cs;
#if defined (USE_TQT_4)
TQByteArray cs;
#else
QCString cs;
TQCString cs;
#endif
};
class LIBCHMRegExp
{
public:
LIBCHMRegExp(const QString &regexp);
LIBCHMRegExp(const TQString &regexp);
int search(const QString &str, int offset = 0);
QString cap(int nth);
int search(const TQString &str, int offset = 0);
TQString cap(int nth);
void setMinimal(bool minimal);
int matchedLength() const;
private:
QRegExp re;
TQRegExp re;
};
class LIBCHMString
{
public:
LIBCHMString();
LIBCHMString(const QString &string);
LIBCHMString(const TQString &string);
LIBCHMString(const char *string);
QString lower() const;
TQString lower() const;
const char *ascii() const;
int find(char c, int index = -1) const;
int find(const QChar &c, int index) const;
int find(const QString &string, int index, bool cs) const;
int findRev(char c) const;
QChar at(uint i) const;
QString left(uint len) const;
int tqfind(char c, int index = -1) const;
int tqfind(const TQChar &c, int index) const;
int tqfind(const TQString &string, int index, bool cs) const;
int tqfindRev(char c) const;
TQChar at(uint i) const;
TQString left(uint len) const;
LIBCHMString mid(uint index, uint len = 0xffffffff) const;
bool isEmpty() const;
QString toString() const;
TQString toString() const;
bool operator==(const QString &string) const;
bool operator==(const TQString &string) const;
private:
QString s;
TQString s;
};
class LIBCHMDir
{
public:
static QString cleanDirPath(const QString &dir);
static TQString cleanDirPath(const TQString &dir);
};
class LIBCHMStringList
{
public:
static bool contains(const QStringList &list, const QString &string);
static QStringList split(const QRegExp &regexp, const QString &string);
static bool tqcontains(const TQStringList &list, const TQString &string);
static TQStringList split(const TQRegExp &regexp, const TQString &string);
};
#endif

@ -22,14 +22,14 @@
#ifndef FORWARD_DECLARATIONS_H
#define FORWARD_DECLARATIONS_H
class QComboBox;
class QListView;
class QListBox;
class QListViewItem;
class QListViewItemIterator;
class QLineEdit;
class QTabWidget;
class QToolButton;
class TQComboBox;
class TQListView;
class TQListBox;
class TQListViewItem;
class TQListViewItemIterator;
class TQLineEdit;
class TQTabWidget;
class TQToolButton;
class KCHMMainWindow;
class KCHMViewWindow;

@ -973,7 +973,7 @@ static const KCHMIconStorage::png_memory_image_t png_image_toolbakicons[] =
const QPixmap * KCHMIconStorage::getApplicationIcon( )
const TQPixmap * KCHMIconStorage::getApplicationIcon( )
{
static const char png_image_cr64_app_kchmviewer[] =
{
@ -1197,7 +1197,7 @@ const QPixmap * KCHMIconStorage::getApplicationIcon( )
if ( !m_iconApplication )
{
m_iconApplication = new QPixmap ();
m_iconApplication = new TQPixmap ();
if ( !m_iconApplication->loadFromData ((const uchar*)png_image_cr64_app_kchmviewer, sizeof(png_image_cr64_app_kchmviewer) - 1, "PNG") )
qFatal ("Could not load application icon");
}
@ -1206,7 +1206,7 @@ const QPixmap * KCHMIconStorage::getApplicationIcon( )
}
const QPixmap * KCHMIconStorage::getCloseWindowIcon( )
const TQPixmap * KCHMIconStorage::getCloseWindowIcon( )
{
static const char png_image_cancel[] =
{
@ -1253,7 +1253,7 @@ const QPixmap * KCHMIconStorage::getCloseWindowIcon( )
if ( !m_iconCloseWindow )
{
m_iconCloseWindow = new QPixmap ();
m_iconCloseWindow = new TQPixmap ();
if ( !m_iconCloseWindow->loadFromData ((const uchar*)png_image_cancel, sizeof(png_image_cancel) - 1, "PNG") )
qFatal ("Could not load cancel icon");
@ -1274,19 +1274,19 @@ KCHMIconStorage::KCHMIconStorage( )
KCHMIconStorage gIconStorage;
const QPixmap * KCHMIconStorage::getToolbarPixmap( pixmap_index_t pix )
const TQPixmap * KCHMIconStorage::getToolbarPixmap( pixmap_index_t pix )
{
return returnOrLoadImage ( (unsigned int) pix, png_image_toolbakicons + (pix - KCHMIconStorage::back));
}
const QPixmap * KCHMIconStorage::returnOrLoadImage( unsigned int id, const png_memory_image_t * image )
const TQPixmap * KCHMIconStorage::returnOrLoadImage( unsigned int id, const png_memory_image_t * image )
{
QMap<unsigned int, QPixmap*>::iterator it = m_iconMap.find (id);
TQMap<unsigned int, TQPixmap*>::iterator it = m_iconMap.tqfind (id);
if ( it == m_iconMap.end() )
{
m_iconMap[id] = new QPixmap ();
m_iconMap[id] = new TQPixmap ();
if ( !m_iconMap[id]->loadFromData ((const uchar*)image->data, image->size, "PNG") )
qFatal ("Could not load image %d", id);
}

@ -22,8 +22,8 @@
#ifndef ICON_STORAGE_H
#define ICON_STORAGE_H
#include <qmap.h>
#include <qpixmap.h>
#include <tqmap.h>
#include <tqpixmap.h>
class KCHMIconStorage
@ -54,16 +54,16 @@ class KCHMIconStorage
};
KCHMIconStorage();
const QPixmap * getToolbarPixmap (pixmap_index_t pix);
const QPixmap * getApplicationIcon();
const QPixmap * getCloseWindowIcon();
const TQPixmap * getToolbarPixmap (pixmap_index_t pix);
const TQPixmap * getApplicationIcon();
const TQPixmap * getCloseWindowIcon();
private:
const QPixmap * returnOrLoadImage (unsigned int id, const png_memory_image_t * image);
const TQPixmap * returnOrLoadImage (unsigned int id, const png_memory_image_t * image);
QMap<unsigned int, QPixmap*> m_iconMap;
QPixmap * m_iconApplication;
QPixmap * m_iconCloseWindow;
TQMap<unsigned int, TQPixmap*> m_iconMap;
TQPixmap * m_iconApplication;
TQPixmap * m_iconCloseWindow;
};
extern KCHMIconStorage gIconStorage;

@ -27,52 +27,52 @@
#include "kchmbookmarkwindow.moc"
KCHMBookmarkWindow::KCHMBookmarkWindow(QWidget *parent, const char *name)
: QWidget(parent, name)
KCHMBookmarkWindow::KCHMBookmarkWindow(TQWidget *tqparent, const char *name)
: TQWidget(tqparent, name)
{
QVBoxLayout * layout = new QVBoxLayout (this);
layout->setMargin (5);
TQVBoxLayout * tqlayout = new TQVBoxLayout (this);
tqlayout->setMargin (5);
m_bookmarkList = new KQListView (this);
m_bookmarkList->addColumn( "bookmark" ); // no need to i18n - the column is hidden
m_bookmarkList->header()->hide();
layout->addWidget (m_bookmarkList);
tqlayout->addWidget (m_bookmarkList);
new KCHMListItemTooltip( m_bookmarkList );
QHBoxLayout * hlayout = new QHBoxLayout (layout);
QPushButton * add = new QPushButton ( i18n( "&Add" ), this);
QPushButton * edit = new QPushButton ( i18n( "&Edit" ), this);
QPushButton * del = new QPushButton ( i18n( "&Del" ), this);
TQHBoxLayout * htqlayout = new TQHBoxLayout (tqlayout);
TQPushButton * add = new TQPushButton ( i18n( "&Add" ), this);
TQPushButton * edit = new TQPushButton ( i18n( "&Edit" ), this);
TQPushButton * del = new TQPushButton ( i18n( "&Del" ), this);
hlayout->addWidget (add);
hlayout->addWidget (edit);
hlayout->addWidget (del);
htqlayout->addWidget (add);
htqlayout->addWidget (edit);
htqlayout->addWidget (del);
connect( m_bookmarkList,
SIGNAL( doubleClicked ( QListViewItem *, const QPoint &, int) ),
TQT_SIGNAL( doubleClicked ( TQListViewItem *, const TQPoint &, int) ),
this,
SLOT( onDoubleClicked ( QListViewItem *, const QPoint &, int) ) );
TQT_SLOT( onDoubleClicked ( TQListViewItem *, const TQPoint &, int) ) );
connect( add,
SIGNAL( clicked () ),
TQT_SIGNAL( clicked () ),
this,
SLOT( onAddBookmarkPressed( ) ) );
TQT_SLOT( onAddBookmarkPressed( ) ) );
connect( del,
SIGNAL( clicked () ),
TQT_SIGNAL( clicked () ),
this,
SLOT( onDelBookmarkPressed( ) ) );
TQT_SLOT( onDelBookmarkPressed( ) ) );
connect( edit,
SIGNAL( clicked () ),
TQT_SIGNAL( clicked () ),
this,
SLOT( onEditBookmarkPressed( ) ) );
TQT_SLOT( onEditBookmarkPressed( ) ) );
connect( m_bookmarkList,
SIGNAL( contextMenuRequested( QListViewItem *, const QPoint& , int ) ),
TQT_SIGNAL( contextMenuRequested( TQListViewItem *, const TQPoint& , int ) ),
this,
SLOT( slotContextMenuRequested ( QListViewItem *, const QPoint &, int ) ) );
TQT_SLOT( slotContextMenuRequested ( TQListViewItem *, const TQPoint &, int ) ) );
m_menuBookmarks = 0;
m_contextMenu = 0;
@ -82,12 +82,12 @@ KCHMBookmarkWindow::KCHMBookmarkWindow(QWidget *parent, const char *name)
void KCHMBookmarkWindow::onAddBookmarkPressed( )
{
bool ok;
QString url = ::mainWindow->currentBrowser()->getOpenedPage();
QString title = ::mainWindow->chmFile()->getTopicByUrl(url);
QString name = QInputDialog::getText(
TQString url = ::mainWindow->currentBrowser()->getOpenedPage();
TQString title = ::mainWindow->chmFile()->getTopicByUrl(url);
TQString name = TQInputDialog::getText(
i18n( "%1 - add a bookmark") . arg(APP_NAME),
i18n( "Enter the name for this bookmark:" ),
QLineEdit::Normal,
TQLineEdit::Normal,
title,
&ok,
this);
@ -126,10 +126,10 @@ void KCHMBookmarkWindow::onEditBookmarkPressed( )
if ( item )
{
bool ok;
QString name = QInputDialog::getText(
TQString name = TQInputDialog::getText(
i18n( "%1 - edit the bookmark name") . arg(APP_NAME),
i18n( "Enter the name for this bookmark:" ),
QLineEdit::Normal,
TQLineEdit::Normal,
item->name,
&ok,
this);
@ -144,7 +144,7 @@ void KCHMBookmarkWindow::onEditBookmarkPressed( )
}
void KCHMBookmarkWindow::onDoubleClicked( QListViewItem * item, const QPoint &, int )
void KCHMBookmarkWindow::onDoubleClicked( TQListViewItem * item, const TQPoint &, int )
{
if ( !item )
return;
@ -171,7 +171,7 @@ void KCHMBookmarkWindow::restoreSettings( const KCHMSettings::bookmark_saved_set
void KCHMBookmarkWindow::saveSettings( KCHMSettings::bookmark_saved_settings_t & settings )
{
QListViewItemIterator it (m_bookmarkList);
TQListViewItemIterator it (m_bookmarkList);
settings.clear();
@ -182,9 +182,9 @@ void KCHMBookmarkWindow::saveSettings( KCHMSettings::bookmark_saved_settings_t &
}
}
void KCHMBookmarkWindow::invalidate( )
void KCHMBookmarkWindow::tqinvalidate( )
{
QListViewItemIterator it( m_bookmarkList );
TQListViewItemIterator it( m_bookmarkList );
for ( ; it.current(); it++ )
m_menuBookmarks->removeItem( ((KCHMBookmarkTreeViewItem *) it.current())->menuid );
@ -192,21 +192,21 @@ void KCHMBookmarkWindow::invalidate( )
m_bookmarkList->clear();
}
void KCHMBookmarkWindow::createMenu( KCHMMainWindow * parent )
void KCHMBookmarkWindow::createMenu( KCHMMainWindow * tqparent )
{
// Create the main Bookmark menu
m_menuBookmarks = new KQPopupMenu( parent );
parent->menuBar()->insertItem( i18n( "&Bookmarks"), m_menuBookmarks );
m_menuBookmarks = new KTQPopupMenu( tqparent );
tqparent->menuBar()->insertItem( i18n( "&Bookmarks"), m_menuBookmarks );
m_menuBookmarks->insertItem( i18n( "&Add bookmark"), this, SLOT(onAddBookmarkPressed()), CTRL+Key_B );
m_menuBookmarks->insertItem( i18n( "&Add bookmark"), this, TQT_SLOT(onAddBookmarkPressed()), CTRL+Key_B );
m_menuBookmarks->insertSeparator();
connect( m_menuBookmarks, SIGNAL( activated(int) ), this, SLOT ( onBookmarkSelected(int) ));
connect( m_menuBookmarks, TQT_SIGNAL( activated(int) ), this, TQT_SLOT ( onBookmarkSelected(int) ));
}
void KCHMBookmarkWindow::onBookmarkSelected( int bookmark )
{
QListViewItemIterator it( m_bookmarkList );
TQListViewItemIterator it( m_bookmarkList );
for ( ; it.current(); it++ )
{
@ -223,7 +223,7 @@ void KCHMBookmarkWindow::onBookmarkSelected( int bookmark )
}
}
void KCHMBookmarkWindow::slotContextMenuRequested( QListViewItem * item, const QPoint & point, int )
void KCHMBookmarkWindow::slotContextMenuRequested( TQListViewItem * item, const TQPoint & point, int )
{
if ( !m_contextMenu )
m_contextMenu = ::mainWindow->currentBrowser()->createListItemContextMenu( this );

@ -29,35 +29,36 @@
/**
@author Georgy Yunaev
*/
class KCHMBookmarkWindow : public QWidget
class KCHMBookmarkWindow : public TQWidget
{
Q_OBJECT
TQ_OBJECT
public:
KCHMBookmarkWindow(QWidget *parent = 0, const char *name = 0);
KCHMBookmarkWindow(TQWidget *tqparent = 0, const char *name = 0);
virtual ~KCHMBookmarkWindow() {};
void createMenu( KCHMMainWindow * parent );
void createMenu( KCHMMainWindow * tqparent );
void restoreSettings (const KCHMSettings::bookmark_saved_settings_t& settings);
void saveSettings (KCHMSettings::bookmark_saved_settings_t& settings);
void invalidate();
void tqinvalidate();
public slots:
void onAddBookmarkPressed ();
void slotContextMenuRequested ( QListViewItem *item, const QPoint &point, int column );
void slotContextMenuRequested ( TQListViewItem *item, const TQPoint &point, int column );
private slots:
void onBookmarkSelected( int );
void onDelBookmarkPressed( );
void onEditBookmarkPressed( );
void onDoubleClicked ( QListViewItem *, const QPoint &, int );
void onDoubleClicked ( TQListViewItem *, const TQPoint &, int );
private:
KQPopupMenu * m_menuBookmarks;
KTQPopupMenu * m_menuBookmarks;
KQListView * m_bookmarkList;
QString m_bookmarkFileName;
TQString m_bookmarkFileName;
bool m_listChanged;
KQPopupMenu * m_contextMenu;
KTQPopupMenu * m_contextMenu;
};
#endif

@ -32,8 +32,8 @@ const char * APP_PATHINUSERDIR = ".kchmviewer";
KCHMConfig::KCHMConfig()
{
QDir dir;
m_datapath = QDir::homeDirPath() + "/" + APP_PATHINUSERDIR;
TQDir dir;
m_datapath = TQDir::homeDirPath() + "/" + APP_PATHINUSERDIR;
dir.setPath (m_datapath);
@ -47,8 +47,8 @@ KCHMConfig::KCHMConfig()
m_HistoryStoreExtra = true;
m_useSearchEngine = SEARCH_USE_MINE;
m_QtBrowserPath = "viewurl-netscape.sh '%s'";
m_kdeUseQTextBrowser = false;
m_TQtBrowserPath = "viewurl-netscape.sh '%s'";
m_kdeUseTQTextBrowser = false;
m_kdeEnableJS = false;
m_kdeEnableJava = false;
m_kdeEnablePlugins = true;
@ -67,24 +67,24 @@ KCHMConfig::~KCHMConfig()
bool KCHMConfig::load()
{
QFile file (m_datapath + "/config");
TQFile file (m_datapath + "/config");
if ( !file.open (IO_ReadOnly) )
return false; // no error message - not actually a problem
QString line;
TQString line;
char readbuf[4096];
bool getting_history = false;
m_History.clear();
while ( file.readLine( readbuf, sizeof(readbuf) - 1 ) > 0 )
{
line = QString::fromUtf8( readbuf ).stripWhiteSpace();
line = TQString::fromUtf8( readbuf ).stripWhiteSpace();
// skip empty lines and comments
if ( line.isEmpty() || line[0] == '#' )
continue;
QRegExp rxsection ("^\\[(\\w+)\\]$"), rxkeypair ("^(\\w+)\\s*=\\s*(.*)$");
TQRegExp rxsection ("^\\[(\\w+)\\]$"), rxkeypair ("^(\\w+)\\s*=\\s*(.*)$");
if ( rxsection.search ( line ) != -1 )
{
@ -93,13 +93,13 @@ bool KCHMConfig::load()
else if ( rxsection.cap (1) == "history" )
getting_history = true;
else
qWarning ("Unknown configuration section: %s", rxsection.cap (1).ascii());
qWarning ("Unknown configuration section: %s", TQString(rxsection.cap(1)).ascii());
continue;
}
else if ( !getting_history && rxkeypair.search ( line ) != -1 )
{
QString key (rxkeypair.cap (1)), value (rxkeypair.cap(2));
TQString key (rxkeypair.cap (1)), value (rxkeypair.cap(2));
if ( key == "LoadLatestFileOnStartup" )
m_LoadLatestFileOnStartup = value.toInt() ? true : false;
@ -111,10 +111,10 @@ bool KCHMConfig::load()
m_HistorySize = value.toInt();
else if ( key == "HistoryStoreExtra" )
m_HistoryStoreExtra = value.toInt() ? true : false;
else if ( key == "QtBrowserPath" )
m_QtBrowserPath = value;
else if ( key == "kdeUseQTextBrowser" )
m_kdeUseQTextBrowser = value.toInt() ? true : false;
else if ( key == "TQtBrowserPath" )
m_TQtBrowserPath = value;
else if ( key == "kdeUseTQTextBrowser" )
m_kdeUseTQTextBrowser = value.toInt() ? true : false;
else if ( key == "kdeEnableJS" )
m_kdeEnableJS = value.toInt() ? true : false;
else if ( key == "kdeEnableJava" )
@ -148,15 +148,15 @@ bool KCHMConfig::load()
bool KCHMConfig::save( )
{
QFile file (m_datapath + "/config");
TQFile file (m_datapath + "/config");
if ( !file.open (IO_WriteOnly) )
{
qWarning ("Could not write settings into file %s: %s", file.name().ascii(), file.errorString().ascii());
qWarning ("Could not write settings into file %s: %s", TQString(file.name()).ascii(), TQString(file.errorString()).ascii());
return false;
}
QTextStream stream( &file );
stream.setEncoding( QTextStream::UnicodeUTF8 );
TQTextStream stream( &file );
stream.setEncoding( TQTextStream::UnicodeUTF8 );
stream << "[settings]\n";
stream << "LoadLatestFileOnStartup=" << m_LoadLatestFileOnStartup << "\n";
@ -165,8 +165,8 @@ bool KCHMConfig::save( )
stream << "HistorySize=" << m_HistorySize << "\n";
stream << "HistoryStoreExtra=" << m_HistoryStoreExtra << "\n";
stream << "QtBrowserPath=" << m_QtBrowserPath << "\n";
stream << "kdeUseQTextBrowser=" << m_kdeUseQTextBrowser << "\n";
stream << "TQtBrowserPath=" << m_TQtBrowserPath << "\n";
stream << "kdeUseTQTextBrowser=" << m_kdeUseTQTextBrowser << "\n";
stream << "kdeEnableJS=" << m_kdeEnableJS << "\n";
stream << "kdeEnableJava=" << m_kdeEnableJava << "\n";
stream << "kdeEnablePlugins=" << m_kdeEnablePlugins << "\n";
@ -187,9 +187,9 @@ bool KCHMConfig::save( )
return true;
}
void KCHMConfig::addFileToHistory( const QString & file )
void KCHMConfig::addFileToHistory( const TQString & file )
{
QStringList::Iterator itr = m_History.find( file );
TQStringList::Iterator itr = m_History.tqfind( file );
// check whether file already exists in history - more it forward
if ( itr != m_History.end() )
@ -206,7 +206,7 @@ void KCHMConfig::addFileToHistory( const QString & file )
}
// Remove a file from the front
QString filetoremove = m_History[0];
TQString filetoremove = m_History[0];
m_History.erase( m_History.begin() );
m_History.push_back( file );

@ -22,8 +22,8 @@
#ifndef KCHMCONFIG_H
#define KCHMCONFIG_H
#include <qstring.h>
#include <qstringlist.h>
#include <tqstring.h>
#include <tqstringlist.h>
extern const char * APP_PATHINUSERDIR;
@ -53,11 +53,11 @@ public:
bool load();
bool save();
void addFileToHistory ( const QString& file );
void addFileToHistory ( const TQString& file );
public:
QString m_datapath;
QString m_lastOpenedDir;
TQString m_datapath;
TQString m_lastOpenedDir;
bool m_LoadLatestFileOnStartup;
choose_action_t m_onNewChmClick;
@ -66,17 +66,17 @@ public:
bool m_HistoryStoreExtra;
use_search_engine m_useSearchEngine;
QString m_QtBrowserPath;
bool m_kdeUseQTextBrowser;
TQString m_TQtBrowserPath;
bool m_kdeUseTQTextBrowser;
bool m_kdeEnableJS;
bool m_kdeEnableJava;
bool m_kdeEnablePlugins;
bool m_kdeEnableRefresh;
bool m_advUseInternalEditor;
QString m_advExternalEditorPath;
TQString m_advExternalEditorPath;
QStringList m_History;
TQStringList m_History;
};
extern KCHMConfig appConfig;

@ -30,8 +30,8 @@
#include "kchmcontentswindow.moc"
KCHMContentsWindow::KCHMContentsWindow(QWidget *parent, const char *name)
: KQListView(parent, name)
KCHMContentsWindow::KCHMContentsWindow(TQWidget *tqparent, const char *name)
: KQListView(tqparent, name)
{
m_contextMenu = 0;
@ -42,11 +42,11 @@ KCHMContentsWindow::KCHMContentsWindow(QWidget *parent, const char *name)
header()->hide();
setShowToolTips( false );
connect( this, SIGNAL( onItem ( QListViewItem * ) ), this, SLOT( slotOnItem( QListViewItem * ) ) );
connect( this, TQT_SIGNAL( onItem ( TQListViewItem * ) ), this, TQT_SLOT( slotOnItem( TQListViewItem * ) ) );
connect( this,
SIGNAL( contextMenuRequested( QListViewItem *, const QPoint& , int ) ),
TQT_SIGNAL( contextMenuRequested( TQListViewItem *, const TQPoint& , int ) ),
this,
SLOT( slotContextMenuRequested ( QListViewItem *, const QPoint &, int ) ) );
TQT_SLOT( slotContextMenuRequested ( TQListViewItem *, const TQPoint &, int ) ) );
new KCHMListItemTooltip( this );
@ -56,7 +56,7 @@ KCHMContentsWindow::~KCHMContentsWindow()
{
}
void KCHMContentsWindow::slotContextMenuRequested( QListViewItem * item, const QPoint & point, int )
void KCHMContentsWindow::slotContextMenuRequested( TQListViewItem * item, const TQPoint & point, int )
{
if ( !m_contextMenu )
m_contextMenu = ::mainWindow->currentBrowser()->createListItemContextMenu( this );
@ -71,7 +71,7 @@ void KCHMContentsWindow::slotContextMenuRequested( QListViewItem * item, const Q
void KCHMContentsWindow::refillTableOfContents( )
{
QValueVector< LCHMParsedEntry > data;
TQValueVector< LCHMParsedEntry > data;
if ( !::mainWindow->chmFile()->parseTableOfContents( &data )
|| data.size() == 0 )
@ -83,10 +83,10 @@ void KCHMContentsWindow::refillTableOfContents( )
kchmFillListViewWithParsedData( this, data, &m_urlListMap );
}
KCHMIndTocItem * KCHMContentsWindow::getTreeItem( const QString & url )
KCHMIndTocItem * KCHMContentsWindow::getTreeItem( const TQString & url )
{
QString fixedstr = ::mainWindow->chmFile()->normalizeUrl( url );
QMap<QString, KCHMIndTocItem*>::const_iterator it = m_urlListMap.find( fixedstr );
TQString fixedstr = ::mainWindow->chmFile()->normalizeUrl( url );
TQMap<TQString, KCHMIndTocItem*>::const_iterator it = m_urlListMap.tqfind( fixedstr );
if ( it == m_urlListMap.end() )
return 0;

@ -31,22 +31,23 @@
class KCHMContentsWindow : public KQListView
{
Q_OBJECT
TQ_OBJECT
public:
KCHMContentsWindow( QWidget *parent = 0, const char *name = 0 );
KCHMContentsWindow( TQWidget *tqparent = 0, const char *name = 0 );
~KCHMContentsWindow();
QRect tip( const QPoint & p );
TQRect tip( const TQPoint & p );
void refillTableOfContents();
KCHMIndTocItem * getTreeItem( const QString& url );
KCHMIndTocItem * getTreeItem( const TQString& url );
public slots:
void slotContextMenuRequested ( QListViewItem *item, const QPoint &point, int column );
void slotContextMenuRequested ( TQListViewItem *item, const TQPoint &point, int column );
private:
KQPopupMenu * m_contextMenu;
QMap<QString, KCHMIndTocItem*> m_urlListMap;
KTQPopupMenu * m_contextMenu;
TQMap<TQString, KCHMIndTocItem*> m_urlListMap;
};
#endif /* INCLUDE_KCHMCONTENTSWINDOW_H */

@ -24,47 +24,47 @@
#include "kchmdialogchooseurlfromlist.h"
#include "kchmtreeviewitem.h"
KCHMDialogChooseUrlFromList::KCHMDialogChooseUrlFromList(const QStringList& urls, const QStringList& titles, QWidget* parent)
: QDialog(parent, 0, true)
KCHMDialogChooseUrlFromList::KCHMDialogChooseUrlFromList(const TQStringList& urls, const TQStringList& titles, TQWidget* tqparent)
: TQDialog(tqparent, 0, true)
{
QVBoxLayout * layout = new QVBoxLayout (this);
layout->setMargin (5);
TQVBoxLayout * tqlayout = new TQVBoxLayout (this);
tqlayout->setMargin (5);
QListView * m_urlsList = new QListView (this);
TQListView * m_urlsList = new TQListView (this);
m_urlsList->addColumn( i18n( "Topics" ) );
for ( unsigned int i = 0; i < urls.size(); i++ )
new KCHMSingleTreeViewItem (m_urlsList, titles[i], urls[i]);
layout->addWidget ( new QLabel( i18n( "Please select one of the topics below:"), this) );
layout->addWidget ( m_urlsList );
tqlayout->addWidget ( new TQLabel( i18n( "Please select one of the topics below:"), this) );
tqlayout->addWidget ( m_urlsList );
QHBoxLayout * hlayout = new QHBoxLayout (layout);
QPushButton * bok = new QPushButton( i18n( "&Ok" ), this);
QPushButton * bcancel = new QPushButton( i18n( "&Cancel" ), this);
TQHBoxLayout * htqlayout = new TQHBoxLayout (tqlayout);
TQPushButton * bok = new TQPushButton( i18n( "&Ok" ), this);
TQPushButton * bcancel = new TQPushButton( i18n( "&Cancel" ), this);
hlayout->addWidget (bok);
hlayout->addWidget (bcancel);
htqlayout->addWidget (bok);
htqlayout->addWidget (bcancel);
connect( m_urlsList, SIGNAL( doubleClicked ( QListViewItem *, const QPoint &, int) ), this, SLOT( onDoubleClicked ( QListViewItem *, const QPoint &, int) ) );
connect( m_urlsList, SIGNAL( currentChanged ( QListViewItem *) ), this, SLOT( onCurrentChanged ( QListViewItem *) ) );
connect( m_urlsList, TQT_SIGNAL( doubleClicked ( TQListViewItem *, const TQPoint &, int) ), this, TQT_SLOT( onDoubleClicked ( TQListViewItem *, const TQPoint &, int) ) );
connect( m_urlsList, TQT_SIGNAL( currentChanged ( TQListViewItem *) ), this, TQT_SLOT( onCurrentChanged ( TQListViewItem *) ) );
connect( bok, SIGNAL( clicked () ), this, SLOT( accept() ) );
connect( bcancel, SIGNAL( clicked () ), this, SLOT( reject() ) );
m_acceptedurl = QString::null;
connect( bok, TQT_SIGNAL( clicked () ), this, TQT_SLOT( accept() ) );
connect( bcancel, TQT_SIGNAL( clicked () ), this, TQT_SLOT( reject() ) );
m_acceptedurl = TQString();
}
void KCHMDialogChooseUrlFromList::onDoubleClicked( QListViewItem * , const QPoint &, int )
void KCHMDialogChooseUrlFromList::onDoubleClicked( TQListViewItem * , const TQPoint &, int )
{
accept();
}
void KCHMDialogChooseUrlFromList::onCurrentChanged( QListViewItem * item )
void KCHMDialogChooseUrlFromList::onCurrentChanged( TQListViewItem * item )
{
if ( item )
m_acceptedurl = ((KCHMSingleTreeViewItem *) item)->getUrl();
else
m_acceptedurl = QString::null;
m_acceptedurl = TQString();
}
#include "kchmdialogchooseurlfromlist.moc"

@ -22,26 +22,27 @@
#ifndef KCHMDIALOGCHOOSEURLFROMLIST_H
#define KCHMDIALOGCHOOSEURLFROMLIST_H
#include <qdialog.h>
#include <qlistview.h>
#include <tqdialog.h>
#include <tqlistview.h>
/**
@author tim
*/
class KCHMDialogChooseUrlFromList : public QDialog
class KCHMDialogChooseUrlFromList : public TQDialog
{
Q_OBJECT
TQ_OBJECT
public:
KCHMDialogChooseUrlFromList (const QStringList& urls, const QStringList& titles, QWidget* parent);
QString getSelectedItemUrl() { return m_acceptedurl; }
KCHMDialogChooseUrlFromList (const TQStringList& urls, const TQStringList& titles, TQWidget* tqparent);
TQString getSelectedItemUrl() { return m_acceptedurl; }
private slots:
void onDoubleClicked( QListViewItem * item, const QPoint &, int );
void onCurrentChanged ( QListViewItem * item);
void onDoubleClicked( TQListViewItem * item, const TQPoint &, int );
void onCurrentChanged ( TQListViewItem * item);
private:
QListView * m_urlsList;
QString m_acceptedurl;
TQListView * m_urlsList;
TQString m_acceptedurl;
};
#endif

@ -19,8 +19,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#include <qlayout.h>
#include <qheader.h>
#include <tqlayout.h>
#include <tqheader.h>
#include "libchmfile.h"
@ -31,13 +31,13 @@
#include "kchmindexwindow.moc"
KCHMIndexWindow::KCHMIndexWindow ( QWidget * parent, const char * name, WFlags f )
: QWidget (parent, name, f)
KCHMIndexWindow::KCHMIndexWindow ( TQWidget * tqparent, const char * name, WFlags f )
: TQWidget (tqparent, name, f)
{
QVBoxLayout * layout = new QVBoxLayout (this);
layout->setMargin (5);
TQVBoxLayout * tqlayout = new TQVBoxLayout (this);
tqlayout->setMargin (5);
m_indexFinder = new QLineEdit (this);
m_indexFinder = new TQLineEdit (this);
m_indexFinder->setFocus();
m_indexList = new KQListView (this);
@ -47,29 +47,29 @@ KCHMIndexWindow::KCHMIndexWindow ( QWidget * parent, const char * name, WFlags f
m_indexList->setShowToolTips(true);
//m_indexList->setSorting( 0, true );
layout->addWidget (m_indexFinder);
layout->addSpacing (10);
layout->addWidget (m_indexList);
tqlayout->addWidget (m_indexFinder);
tqlayout->addSpacing (10);
tqlayout->addWidget (m_indexList);
connect( m_indexFinder,
SIGNAL( textChanged (const QString &) ),
TQT_SIGNAL( textChanged (const TQString &) ),
this,
SLOT( onTextChanged(const QString &) ) );
TQT_SLOT( onTextChanged(const TQString &) ) );
connect( m_indexFinder,
SIGNAL( returnPressed() ),
TQT_SIGNAL( returnPressed() ),
this,
SLOT( onReturnPressed() ) );
TQT_SLOT( onReturnPressed() ) );
connect( m_indexList,
SIGNAL( doubleClicked ( QListViewItem *, const QPoint &, int) ),
TQT_SIGNAL( doubleClicked ( TQListViewItem *, const TQPoint &, int) ),
this,
SLOT( onDoubleClicked ( QListViewItem *, const QPoint &, int) ) );
TQT_SLOT( onDoubleClicked ( TQListViewItem *, const TQPoint &, int) ) );
connect( m_indexList,
SIGNAL( contextMenuRequested( QListViewItem *, const QPoint& , int ) ),
TQT_SIGNAL( contextMenuRequested( TQListViewItem *, const TQPoint& , int ) ),
this,
SLOT( slotContextMenuRequested ( QListViewItem *, const QPoint &, int ) ) );
TQT_SLOT( slotContextMenuRequested ( TQListViewItem *, const TQPoint &, int ) ) );
m_indexListFilled = false;
m_lastSelectedItem = 0;
@ -78,9 +78,9 @@ KCHMIndexWindow::KCHMIndexWindow ( QWidget * parent, const char * name, WFlags f
new KCHMListItemTooltip( m_indexList );
}
void KCHMIndexWindow::onTextChanged ( const QString & newvalue)
void KCHMIndexWindow::onTextChanged ( const TQString & newvalue)
{
m_lastSelectedItem = m_indexList->findItem (newvalue, 0, Qt::BeginsWith);
m_lastSelectedItem = m_indexList->tqfindItem (newvalue, 0, TQt::BeginsWith);
if ( m_lastSelectedItem )
{
@ -89,7 +89,7 @@ void KCHMIndexWindow::onTextChanged ( const QString & newvalue)
}
}
void KCHMIndexWindow::showEvent( QShowEvent * )
void KCHMIndexWindow::showEvent( TQShowEvent * )
{
if ( !::mainWindow->chmFile() || m_indexListFilled )
return;
@ -104,27 +104,27 @@ void KCHMIndexWindow::onReturnPressed( )
}
void KCHMIndexWindow::invalidate( )
void KCHMIndexWindow::tqinvalidate( )
{
m_indexList->clear();
m_indexListFilled = false;
}
void KCHMIndexWindow::onDoubleClicked( QListViewItem *item, const QPoint &, int )
void KCHMIndexWindow::onDoubleClicked( TQListViewItem *item, const TQPoint &, int )
{
if ( !item )
return;
KCHMIndTocItem * treeitem = (KCHMIndTocItem*) item;
QString url = treeitem->getUrl();
TQString url = treeitem->getUrl();
if ( !url )
return;
if ( url[0] == ':' ) // 'see also' link
{
m_lastSelectedItem = m_indexList->findItem (url.mid(1), 0);
m_lastSelectedItem = m_indexList->tqfindItem (url.mid(1), 0);
if ( m_lastSelectedItem )
{
m_indexList->ensureItemVisible (m_lastSelectedItem);
@ -135,7 +135,7 @@ void KCHMIndexWindow::onDoubleClicked( QListViewItem *item, const QPoint &, int
::mainWindow->openPage( url, OPF_CONTENT_TREE | OPF_ADD2HISTORY );
}
void KCHMIndexWindow::slotContextMenuRequested( QListViewItem * item, const QPoint & point, int )
void KCHMIndexWindow::slotContextMenuRequested( TQListViewItem * item, const TQPoint & point, int )
{
if ( !m_contextMenu )
m_contextMenu = ::mainWindow->currentBrowser()->createListItemContextMenu( this );
@ -151,7 +151,7 @@ void KCHMIndexWindow::slotContextMenuRequested( QListViewItem * item, const QPoi
void KCHMIndexWindow::refillIndex( )
{
QValueVector< LCHMParsedEntry > data;
TQValueVector< LCHMParsedEntry > data;
if ( !::mainWindow->chmFile()->parseIndex( &data )
|| data.size() == 0 )
@ -163,7 +163,7 @@ void KCHMIndexWindow::refillIndex( )
kchmFillListViewWithParsedData( m_indexList, data, 0 );
}
void KCHMIndexWindow::search( const QString & index )
void KCHMIndexWindow::search( const TQString & index )
{
if ( !::mainWindow->chmFile() )
return;

@ -23,39 +23,40 @@
#define KCHMINDEXWINDOW_H
#include <qlineedit.h>
#include <qlistview.h>
#include <tqlineedit.h>
#include <tqlistview.h>
/**
@author Georgy Yunaev
*/
class KCHMIndexWindow : public QWidget
class KCHMIndexWindow : public TQWidget
{
Q_OBJECT
TQ_OBJECT
public:
KCHMIndexWindow ( QWidget * parent = 0, const char * name = 0, WFlags f = 0 );
KCHMIndexWindow ( TQWidget * tqparent = 0, const char * name = 0, WFlags f = 0 );
void invalidate();
void search( const QString& index );
void tqinvalidate();
void search( const TQString& index );
public slots:
void slotContextMenuRequested ( QListViewItem *item, const QPoint &point, int column );
void slotContextMenuRequested ( TQListViewItem *item, const TQPoint &point, int column );
private slots:
void onTextChanged ( const QString & newvalue);
void onTextChanged ( const TQString & newvalue);
void onReturnPressed ();
void onDoubleClicked ( QListViewItem *, const QPoint &, int);
void onDoubleClicked ( TQListViewItem *, const TQPoint &, int);
private:
virtual void showEvent ( QShowEvent * );
virtual void showEvent ( TQShowEvent * );
void refillIndex();
QLineEdit * m_indexFinder;
TQLineEdit * m_indexFinder;
KQListView * m_indexList;
KQPopupMenu * m_contextMenu;
QListViewItem * m_lastSelectedItem;
KTQPopupMenu * m_contextMenu;
TQListViewItem * m_lastSelectedItem;
bool m_indexListFilled;
};

@ -24,29 +24,29 @@
KCHMKeyEventFilter gKeyEventFilter;
KCHMKeyEventFilter::KCHMKeyEventFilter()
: QObject()
: TQObject()
{
m_shiftPressed = false;
m_ctrlPressed = false;
}
bool KCHMKeyEventFilter::eventFilter( QObject *, QEvent *e )
bool KCHMKeyEventFilter::eventFilter( TQObject *, TQEvent *e )
{
// Handle KeyPress and KeyRelease events
if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease )
if ( e->type() == TQEvent::KeyPress || e->type() == TQEvent::KeyRelease )
{
bool * ptr = 0;
QKeyEvent *k = (QKeyEvent *) e;
TQKeyEvent *k = (TQKeyEvent *) e;
// We're interested only in Shift and Control
if ( k->key() == Qt::Key_Shift )
if ( k->key() == TQt::Key_Shift )
ptr = &m_shiftPressed;
else if ( k->key() == Qt::Key_Control )
else if ( k->key() == TQt::Key_Control )
ptr = &m_ctrlPressed;
// Set it
if ( ptr )
*ptr = e->type() == QEvent::KeyPress ? true : false;
*ptr = e->type() == TQEvent::KeyPress ? true : false;
}
return FALSE; // Standard event processing

@ -22,14 +22,14 @@
#ifndef INCLUDE_KCHMKEYEVENTFILTER_H
#define INCLUDE_KCHMKEYEVENTFILTER_H
#include <qobject.h>
#include <tqobject.h>
/*!*
* This class must be installed as a global event handler. Its responsibility
* is to intercept keyboard events, and store the Shift and Ctrl keys state information.
* Unfortunately it seems to be the only way to do it in Qt.
* Unfortunately it seems to be the only way to do it in TQt.
*/
class KCHMKeyEventFilter : public QObject
class KCHMKeyEventFilter : public TQObject
{
public:
KCHMKeyEventFilter();
@ -38,7 +38,7 @@ class KCHMKeyEventFilter : public QObject
bool isCtrlPressed() const { return m_ctrlPressed; }
private:
bool eventFilter( QObject *, QEvent *e );
bool eventFilter( TQObject *, TQEvent *e );
bool m_shiftPressed;
bool m_ctrlPressed;

@ -28,17 +28,17 @@
/**
@author tim
*/
class KCHMListItemTooltip : public QToolTip
class KCHMListItemTooltip : public TQToolTip
{
public:
KCHMListItemTooltip( KQListView *parent )
: QToolTip( parent->viewport() ) { m_pParent = parent; }
KCHMListItemTooltip( KQListView *tqparent )
: TQToolTip( tqparent->viewport() ) { m_pParent = tqparent; }
virtual ~KCHMListItemTooltip() {};
void maybeTip ( const QPoint & pos )
void maybeTip ( const TQPoint & pos )
{
QListViewItem *it = m_pParent->itemAt( pos );
TQListViewItem *it = m_pParent->itemAt( pos );
if ( !it )
return;
@ -47,13 +47,13 @@ class KCHMListItemTooltip : public QToolTip
int section = m_pParent->header()->sectionAt (pos.x ());
// Get the rect of the whole item (the row for the tip)
QRect itemRect = m_pParent->itemRect( it );
TQRect tqitemRect = m_pParent->tqitemRect( it );
// Get the rect of the whole section (the column for the tip)
QRect headerRect = m_pParent->header ()->sectionRect (section);
TQRect headerRect = m_pParent->header ()->sectionRect (section);
// "Intersect" row and column to get exact rect for the tip
QRect destRect( headerRect.left (), itemRect.top(), headerRect.width(), itemRect.height() );
TQRect destRect( headerRect.left (), tqitemRect.top(), headerRect.width(), tqitemRect.height() );
int item_width = it->width( m_pParent->fontMetrics(), m_pParent, 0 )
+ it->depth() * m_pParent->treeStepSize();

@ -28,8 +28,8 @@
#include "kde-qt.h"
#include <qaccel.h>
#include <qevent.h>
#include <tqaccel.h>
#include <tqevent.h>
#include "libchmfile.h"
#include "libchmfileimpl.h"
@ -82,9 +82,9 @@ KCHMMainWindow::KCHMMainWindow()
m_currentSettings = new KCHMSettings;
// Create the initial layout - a splitter with tab window in left, and text browser in right
m_windowSplitter = new QSplitter(this);
m_tabWidget = new KQTabWidget( m_windowSplitter );
// Create the initial tqlayout - a splitter with tab window in left, and text browser in right
m_windowSplitter = new TQSplitter(this);
m_tabWidget = new KTQTabWidget( m_windowSplitter );
m_viewWindowMgr = new KCHMViewWindowMgr( m_windowSplitter );
m_bookmarkWindow = new KCHMBookmarkWindow (m_tabWidget);
@ -96,7 +96,7 @@ KCHMMainWindow::KCHMMainWindow()
setCentralWidget( m_windowSplitter );
QValueList<int> sizes;
TQValueList<int> sizes;
sizes.push_back (SPLT_X_SIZE);
sizes.push_back (WND_X_SIZE - SPLT_X_SIZE);
m_windowSplitter->setSizes (sizes);
@ -108,13 +108,13 @@ KCHMMainWindow::KCHMMainWindow()
m_useShortAutotest = false;
#endif /* defined (ENABLE_AUTOTEST_SUPPORT) */
QAccel * accel = new QAccel( this );
accel->connectItem ( accel->insertItem ( Key_F11 ), this, SLOT ( slotToggleFullScreenMode() ) );
accel->connectItem ( accel->insertItem ( CTRL + Key_1), this, SLOT ( slotActivateContentTab() ) );
accel->connectItem ( accel->insertItem ( CTRL + Key_2), this, SLOT ( slotActivateIndexTab() ) );
accel->connectItem ( accel->insertItem ( CTRL + Key_3), this, SLOT ( slotActivateSearchTab() ) );
accel->connectItem ( accel->insertItem ( CTRL + Key_4), this, SLOT ( slotActivateBookmarkTab() ) );
accel->connectItem ( accel->insertItem ( Key_F3 ), m_searchToolbar, SLOT ( onBtnNextSearchResult() ) );
TQAccel * accel = new TQAccel( this );
accel->connectItem ( accel->insertItem ( Key_F11 ), this, TQT_SLOT ( slotToggleFullScreenMode() ) );
accel->connectItem ( accel->insertItem ( CTRL + Key_1), this, TQT_SLOT ( slotActivateContentTab() ) );
accel->connectItem ( accel->insertItem ( CTRL + Key_2), this, TQT_SLOT ( slotActivateIndexTab() ) );
accel->connectItem ( accel->insertItem ( CTRL + Key_3), this, TQT_SLOT ( slotActivateSearchTab() ) );
accel->connectItem ( accel->insertItem ( CTRL + Key_4), this, TQT_SLOT ( slotActivateBookmarkTab() ) );
accel->connectItem ( accel->insertItem ( Key_F3 ), m_searchToolbar, TQT_SLOT ( onBtnNextSearchResult() ) );
statusBar()->show();
setIcon( *gIconStorage.getApplicationIcon() );
@ -136,9 +136,9 @@ KCHMMainWindow::~KCHMMainWindow()
void KCHMMainWindow::slotOpenMenuItemActivated()
{
#if defined (USE_KDE)
QString fn = KFileDialog::getOpenFileName( appConfig.m_lastOpenedDir, i18n("*.chm|Compressed Help Manual (*.chm)"), this);
TQString fn = KFileDialog::getOpenFileName( appConfig.m_lastOpenedDir, i18n("*.chm|Compressed Help Manual (*.chm)"), this);
#else
QString fn = QFileDialog::getOpenFileName( appConfig.m_lastOpenedDir, i18n("Compressed Help Manual (*.chm)"), this);
TQString fn = TQFileDialog::getOpenFileName( appConfig.m_lastOpenedDir, i18n("Compressed Help Manual (*.chm)"), this);
#endif
if ( !fn.isEmpty() )
@ -153,7 +153,7 @@ void KCHMMainWindow::slotOpenMenuItemActivated()
}
bool KCHMMainWindow::loadChmFile ( const QString &fileName, bool call_open_page )
bool KCHMMainWindow::loadChmFile ( const TQString &fileName, bool call_open_page )
{
LCHMFile * new_chmfile = new LCHMFile();
@ -172,12 +172,12 @@ bool KCHMMainWindow::loadChmFile ( const QString &fileName, bool call_open_page
showInStatusBar( tr("Detected chm file charset: %1") . arg(m_chmFile->currentEncoding()->language) );
// Make the file name absolute; we'll need it later
QDir qd;
TQDir qd;
qd.setPath (fileName);
m_chmFilename = qd.absPath();
// Qt's 'dirname' does not work well
QFileInfo qf ( m_chmFilename );
// TQt's 'dirname' does not work well
TQFileInfo qf ( m_chmFilename );
appConfig.m_lastOpenedDir = qf.dirPath(true);
// Order the tabulations
@ -202,9 +202,9 @@ bool KCHMMainWindow::loadChmFile ( const QString &fileName, bool call_open_page
showOrHideIndexWindow( m_tabIndexPage );
showOrHideSearchWindow( m_tabSearchPage );
m_bookmarkWindow->invalidate();
m_navToolbar->updateIconStatus( false, false );
m_viewWindowMgr->invalidate();
m_bookmarkWindow->tqinvalidate();
m_navToolbar->updateIcontqStatus( false, false );
m_viewWindowMgr->tqinvalidate();
refreshCurrentBrowser();
if ( m_currentSettings->loadSettings (fileName) )
@ -232,7 +232,7 @@ bool KCHMMainWindow::loadChmFile ( const QString &fileName, bool call_open_page
}
// Restore the main window size
QValueList<int> sizes;
TQValueList<int> sizes;
sizes.push_back( m_currentSettings->m_window_size_splitter );
sizes.push_back( m_currentSettings->m_window_size_x - m_currentSettings->m_window_size_splitter );
@ -255,17 +255,17 @@ bool KCHMMainWindow::loadChmFile ( const QString &fileName, bool call_open_page
}
else
{
QMessageBox mbox(
TQMessageBox mbox(
i18n("%1 - failed to load the chm file") . arg(APP_NAME),
i18n("Unable to load the chm file %1") . arg(fileName),
QMessageBox::Critical,
QMessageBox::Ok,
QMessageBox::NoButton,
QMessageBox::NoButton);
TQMessageBox::Critical,
TQMessageBox::Ok,
TQMessageBox::NoButton,
TQMessageBox::NoButton);
mbox.exec();
statusBar()->message(
i18n("Could not load file %1").arg(fileName),
i18n("Could not load file %1").tqarg(fileName),
2000 );
delete new_chmfile;
return false;
@ -281,44 +281,44 @@ void KCHMMainWindow::slotPrintMenuItemActivated()
void KCHMMainWindow::slotAboutMenuItemActivated()
{
QString caption = i18n( "About %1" ) . arg(APP_NAME);
QString text = m_aboutDlgMenuText;
TQString caption = i18n( "About %1" ) . arg(APP_NAME);
TQString text = m_aboutDlgMenuText;
// It is quite funny that the argument order differs
#if defined (USE_KDE)
KMessageBox::about( this, text, caption );
#else
QMessageBox::about( this, caption, text );
TQMessageBox::about( this, caption, text );
#endif
}
void KCHMMainWindow::slotAboutQtMenuItemActivated()
{
QMessageBox::aboutQt( this, APP_NAME);
TQMessageBox::aboutTQt( this, APP_NAME);
}
void KCHMMainWindow::refreshCurrentBrowser( )
{
QString title = m_chmFile->title();
TQString title = m_chmFile->title();
if ( !title )
title = APP_NAME;
// KDE adds application name automatically, so we don't need it here
#if !defined (USE_KDE)
else
title = (QString) APP_NAME + " - " + title;
title = (TQString) APP_NAME + " - " + title;
#endif
setCaption ( title );
currentBrowser()->invalidate();
currentBrowser()->tqinvalidate();
if ( m_contentsWindow )
m_contentsWindow->refillTableOfContents();
}
void KCHMMainWindow::slotOnTreeClicked( QListViewItem * item )
void KCHMMainWindow::slotOnTreeClicked( TQListViewItem * item )
{
bool unused;
@ -330,7 +330,7 @@ void KCHMMainWindow::slotOnTreeClicked( QListViewItem * item )
}
void KCHMMainWindow::slotLinkClicked ( const QString & link, bool& follow_link )
void KCHMMainWindow::slotLinkClicked ( const TQString & link, bool& follow_link )
{
if ( link.isEmpty() )
return;
@ -351,9 +351,9 @@ void KCHMMainWindow::slotLinkClicked ( const QString & link, bool& follow_link )
}
bool KCHMMainWindow::openPage( const QString & srcurl, unsigned int flags )
bool KCHMMainWindow::openPage( const TQString & srcurl, unsigned int flags )
{
QString p1, p2, url = srcurl;
TQString p1, p2, url = srcurl;
if ( url == "/" )
url = m_chmFile->homeUrl();
@ -366,11 +366,11 @@ bool KCHMMainWindow::openPage( const QString & srcurl, unsigned int flags )
break;
case KCHMConfig::ACTION_ASK_USER:
if ( QMessageBox::question(this,
if ( TQMessageBox::question(this,
i18n("%1 - remote link clicked - %2") . arg(APP_NAME) . arg(p1),
i18n("A remote link %1 will start the external program to open it.\n\nDo you want to continue?").arg( url ),
i18n("A remote link %1 will start the external program to open it.\n\nDo you want to continue?").tqarg( url ),
i18n("&Yes"), i18n("&No"),
QString::null, 0, 1 ) )
TQString(), 0, 1 ) )
return false;
// no break! should continue to open.
@ -380,7 +380,7 @@ bool KCHMMainWindow::openPage( const QString & srcurl, unsigned int flags )
#if defined (USE_KDE)
new KRun ( url );
#else
run_process( appConfig.m_QtBrowserPath, url );
run_process( appConfig.m_TQtBrowserPath, url );
#endif
}
break;
@ -389,10 +389,10 @@ bool KCHMMainWindow::openPage( const QString & srcurl, unsigned int flags )
return false; // do not change the current page.
}
// Filter the URLs which do not need to be opened at all by Qt version
// Filter the URLs which do not need to be opened at all by TQt version
if ( LCHMUrlFactory::isJavascriptURL (url) )
{
QMessageBox::information( this,
TQMessageBox::information( this,
i18n( "%1 - JavsScript link clicked") . arg(APP_NAME),
i18n( "You have clicked a JavaScript link.\nTo prevent security-related issues JavaScript URLs are disabled in CHM files.") );
@ -401,23 +401,23 @@ bool KCHMMainWindow::openPage( const QString & srcurl, unsigned int flags )
if ( LCHMUrlFactory::isNewChmURL (url, p1, p2) && p1 != m_chmFilename )
{
if ( QMessageBox::question( this,
if ( TQMessageBox::question( this,
i18n( "%1 - link to a new CHM file clicked"). arg(APP_NAME),
i18n( "You have clicked a link, which leads to a new CHM file %1.\nThe current file will be closed.\n\nDo you want to continue?").arg( p1 ),
i18n( "You have clicked a link, which leads to a new CHM file %1.\nThe current file will be closed.\n\nDo you want to continue?").tqarg( p1 ),
i18n( "&Yes" ), i18n( "&No" ),
QString::null, 0, 1 ) )
TQString(), 0, 1 ) )
return false;
// Because chm file always contain relative link, and current filename is not changed,
// we need to form a new path
QFileInfo qfi( m_chmFilename );
QString newfilename = qfi.dirPath(true) + "/" + p1;
TQFileInfo qfi( m_chmFilename );
TQString newfilename = qfi.dirPath(true) + "/" + p1;
QStringList event_args;
TQStringList event_args;
event_args.push_back( newfilename );
event_args.push_back( p2 ); // url
qApp->postEvent( this, new KCHMUserEvent( "loadAndOpen", event_args ) );
tqApp->postEvent( this, new KCHMUserEvent( "loadAndOpen", event_args ) );
return false;
}
@ -427,7 +427,7 @@ bool KCHMMainWindow::openPage( const QString & srcurl, unsigned int flags )
// Store current page and position to add it to history if we change it
int hist_scrollpos = currentBrowser()->getScrollbarPosition();
QString hist_url = currentBrowser()->getOpenedPage();
TQString hist_url = currentBrowser()->getOpenedPage();
if ( vwnd->openUrl (url) )
{
@ -443,7 +443,7 @@ bool KCHMMainWindow::openPage( const QString & srcurl, unsigned int flags )
}
void KCHMMainWindow::showEvent( QShowEvent * )
void KCHMMainWindow::showEvent( TQShowEvent * )
{
if ( !m_FirstTimeShow )
return;
@ -465,61 +465,61 @@ void KCHMMainWindow::showEvent( QShowEvent * )
void KCHMMainWindow::setupToolbarsAndMenu( )
{
// Create a 'file' toolbar
QToolBar * toolbar = new QToolBar(this);
TQToolBar * toolbar = new TQToolBar(this);
toolbar->setLabel( i18n( "File Operations") );
QPixmap iconFileOpen (*gIconStorage.getToolbarPixmap(KCHMIconStorage::fileopen));
QToolButton * fileOpen = new QToolButton (iconFileOpen,
TQPixmap iconFileOpen (*gIconStorage.getToolbarPixmap(KCHMIconStorage::fileopen));
TQToolButton * fileOpen = new TQToolButton (iconFileOpen,
i18n( "Open File" ),
QString::null,
TQString(),
this,
SLOT( slotOpenMenuItemActivated() ),
TQT_SLOT( slotOpenMenuItemActivated() ),
toolbar);
QString fileOpenText = i18n( "Click this button to open an existing chm file." );
QWhatsThis::add( fileOpen, fileOpenText );
TQString fileOpenText = i18n( "Click this button to open an existing chm file." );
TQWhatsThis::add( fileOpen, fileOpenText );
QPixmap iconFilePrint (*gIconStorage.getToolbarPixmap(KCHMIconStorage::print));
QToolButton * filePrint = new QToolButton (iconFilePrint,
TQPixmap iconFilePrint (*gIconStorage.getToolbarPixmap(KCHMIconStorage::print));
TQToolButton * filePrint = new TQToolButton (iconFilePrint,
i18n( "Print File" ),
QString::null,
TQString(),
this,
SLOT( slotPrintMenuItemActivated() ),
TQT_SLOT( slotPrintMenuItemActivated() ),
toolbar);
QString filePrintText = i18n( "Click this button to print the current page");
QWhatsThis::add( filePrint, filePrintText );
TQString filePrintText = i18n( "Click this button to print the current page");
TQWhatsThis::add( filePrint, filePrintText );
// Setup the menu
KQPopupMenu * file = new KQPopupMenu( this );
KTQPopupMenu * file = new KTQPopupMenu( this );
menuBar()->insertItem( i18n( "&File"), file );
int id;
id = file->insertItem ( iconFileOpen, i18n( "&Open..."), this, SLOT( slotOpenMenuItemActivated() ), CTRL+Key_O );
file->setWhatsThis( id, fileOpenText );
id = file->insertItem ( iconFileOpen, i18n( "&Open..."), this, TQT_SLOT( slotOpenMenuItemActivated() ), CTRL+Key_O );
file->TQMenuData::setWhatsThis( id, fileOpenText );
id = file->insertItem( iconFilePrint, i18n( "&Print..."), this, SLOT( slotPrintMenuItemActivated() ), CTRL+Key_P );
file->setWhatsThis( id, filePrintText );
id = file->insertItem( iconFilePrint, i18n( "&Print..."), this, TQT_SLOT( slotPrintMenuItemActivated() ), CTRL+Key_P );
file->TQMenuData::setWhatsThis( id, filePrintText );
file->insertSeparator();
id = file->insertItem ( i18n( "E&xtract CHM content..."), this, SLOT( slotExtractCHM() ) );
file->setWhatsThis( id, i18n( "Click this button to extract the whole CHM file content into a specific directory") );
id = file->insertItem ( i18n( "E&xtract CHM content..."), this, TQT_SLOT( slotExtractCHM() ) );
file->TQMenuData::setWhatsThis( id, i18n( "Click this button to extract the whole CHM file content into a specific directory") );
file->insertSeparator();
m_menuHistory = new KQPopupMenu( file );
connect ( m_menuHistory, SIGNAL( activated(int) ), this, SLOT ( slotHistoryMenuItemActivated(int) ));
m_menuHistory = new KTQPopupMenu( file );
connect ( m_menuHistory, TQT_SIGNAL( activated(int) ), this, TQT_SLOT ( slotHistoryMenuItemActivated(int) ));
file->insertItem( i18n( "&Recent files"), m_menuHistory );
file->insertSeparator();
file->insertItem( i18n( "&Quit"), qApp, SLOT( closeAllWindows() ), CTRL+Key_Q );
file->insertItem( i18n( "&Quit"), tqApp, TQT_SLOT( closeAllWindows() ), CTRL+Key_Q );
KQPopupMenu * menu_edit = new KQPopupMenu( this );
KTQPopupMenu * menu_edit = new KTQPopupMenu( this );
menuBar()->insertItem( i18n( "&Edit"), menu_edit );
menu_edit->insertItem ( i18n( "&Copy"), this, SLOT( slotBrowserCopy()), CTRL+Key_C );
menu_edit->insertItem ( i18n( "&Select all"), this, SLOT( slotBrowserSelectAll()), CTRL+Key_A );
menu_edit->insertItem ( i18n( "&Copy"), this, TQT_SLOT( slotBrowserCopy()), CTRL+Key_C );
menu_edit->insertItem ( i18n( "&Select all"), this, TQT_SLOT( slotBrowserSelectAll()), CTRL+Key_A );
menu_edit->insertSeparator();
@ -535,18 +535,18 @@ void KCHMMainWindow::setupToolbarsAndMenu( )
// m_viewWindowMgr creates 'Window' menu
m_viewWindowMgr->createMenu( this );
KQPopupMenu * settings = new KQPopupMenu( this );
KTQPopupMenu * settings = new KTQPopupMenu( this );
menuBar()->insertItem( i18n( "&Settings"), settings );
settings->insertItem( i18n( "&Change settings..."), this, SLOT( slotChangeSettingsMenuItemActivated() ));
settings->insertItem( i18n( "&Change settings..."), this, TQT_SLOT( slotChangeSettingsMenuItemActivated() ));
#if defined(USE_KDE)
QPopupMenu *help = helpMenu( m_aboutDlgMenuText );
TQPopupMenu *help = helpMenu( m_aboutDlgMenuText );
#else
KQPopupMenu * help = new KQPopupMenu( this );
help->insertItem( i18n( "&About"), this, SLOT( slotAboutMenuItemActivated() ), Key_F1 );
help->insertItem( i18n( "About &Qt"), this, SLOT( slotAboutQtMenuItemActivated() ));
KTQPopupMenu * help = new KTQPopupMenu( this );
help->insertItem( i18n( "&About"), this, TQT_SLOT( slotAboutMenuItemActivated() ), Key_F1 );
help->insertItem( i18n( "About &TQt"), this, TQT_SLOT( slotAboutQtMenuItemActivated() ));
help->insertSeparator();
help->insertItem( i18n( "What's &This"), this, SLOT(whatsThis()), SHIFT+Key_F1 );
help->insertItem( i18n( "What's &This"), this, TQT_SLOT(whatsThis()), SHIFT+Key_F1 );
#endif
menuBar()->insertItem( i18n( "&Help"), help );
@ -563,9 +563,9 @@ void KCHMMainWindow::setTextEncoding( const LCHMTextEncoding * encoding )
m_chmFile->setCurrentEncoding( encoding );
m_searchToolbar->setChosenEncodingInMenu( encoding );
// Because updateView() will call view->invalidate(), which clears the view->getOpenedPage(),
// Because updateView() will call view->tqinvalidate(), which clears the view->getOpenedPage(),
// we have to make a copy of it.
QString url = currentBrowser()->getOpenedPage();
TQString url = currentBrowser()->getOpenedPage();
// Regenerate the content and index trees
refreshCurrentBrowser();
@ -600,7 +600,7 @@ void KCHMMainWindow::closeChmFile( )
}
void KCHMMainWindow::closeEvent ( QCloseEvent * e )
void KCHMMainWindow::closeEvent ( TQCloseEvent * e )
{
// Save the settings if we have something opened
if ( m_chmFile )
@ -610,13 +610,13 @@ void KCHMMainWindow::closeEvent ( QCloseEvent * e )
m_chmFile = 0;
}
QMainWindow::closeEvent ( e );
TQMainWindow::closeEvent ( e );
}
bool KCHMMainWindow::parseCmdLineArgs( )
{
QString filename = QString::null, search_query = QString::null;
QString search_index = QString::null, search_bookmark = QString::null;
TQString filename = TQString(), search_query = TQString();
TQString search_index = TQString(), search_bookmark = TQString();
bool do_autotest = false;
#if defined (USE_KDE)
@ -634,44 +634,44 @@ bool KCHMMainWindow::parseCmdLineArgs( )
if ( args->count() > 0 )
filename = args->arg(0);
#else
// argv[0] in Qt is still a program name
for ( int i = 1; i < qApp->argc(); i++ )
// argv[0] in TQt is still a program name
for ( int i = 1; i < tqApp->argc(); i++ )
{
if ( !strcmp (qApp->argv()[i], "--autotestmode") )
if ( !strcmp (tqApp->argv()[i], "--autotestmode") )
do_autotest = m_useShortAutotest = true;
else if ( !strcmp (qApp->argv()[i], "--shortautotestmode") )
else if ( !strcmp (tqApp->argv()[i], "--shortautotestmode") )
do_autotest = true;
else if ( !strcmp (qApp->argv()[i], "--search") )
search_query = qApp->argv()[++i];
else if ( !strcmp (qApp->argv()[i], "--sindex") )
search_index = qApp->argv()[++i];
else if ( !strcmp (qApp->argv()[i], "-h") || !strcmp (qApp->argv()[i], "--help") )
else if ( !strcmp (tqApp->argv()[i], "--search") )
search_query = tqApp->argv()[++i];
else if ( !strcmp (tqApp->argv()[i], "--sindex") )
search_index = tqApp->argv()[++i];
else if ( !strcmp (tqApp->argv()[i], "-h") || !strcmp (tqApp->argv()[i], "--help") )
{
fprintf (stderr, "Usage: %s [chmfile]\n", qApp->argv()[0]);
fprintf (stderr, "Usage: %s [chmfile]\n", tqApp->argv()[0]);
exit (1);
}
else
filename = qApp->argv()[i];
filename = tqApp->argv()[i];
}
#endif
if ( !filename.isEmpty() )
{
if ( !loadChmFile( QString::fromLocal8Bit( filename )) )
if ( !loadChmFile( TQString::fromLocal8Bit( filename )) )
return true; // skip the latest checks, but do not exit from the program
if ( !search_index.isEmpty() )
{
QStringList event_args;
TQStringList event_args;
event_args.push_back( search_index );
qApp->postEvent( this, new KCHMUserEvent( "findInIndex", event_args ) );
tqApp->postEvent( this, new KCHMUserEvent( "findInIndex", event_args ) );
}
if ( !search_query.isEmpty() )
{
QStringList event_args;
TQStringList event_args;
event_args.push_back( search_query );
qApp->postEvent( this, new KCHMUserEvent( "searchQuery", event_args ) );
tqApp->postEvent( this, new KCHMUserEvent( "searchQuery", event_args ) );
}
if ( do_autotest )
@ -729,9 +729,9 @@ void KCHMMainWindow::slotChangeSettingsMenuItemActivated()
dlg.m_groupKDEsettings->setEnabled ( false );
#endif
dlg.m_qtBrowserPath->setText ( appConfig.m_QtBrowserPath );
dlg.m_radioUseQtextBrowser->setChecked ( appConfig.m_kdeUseQTextBrowser );
dlg.m_radioUseKHTMLPart->setChecked ( !appConfig.m_kdeUseQTextBrowser );
dlg.m_qtBrowserPath->setText ( appConfig.m_TQtBrowserPath );
dlg.m_radioUseQtextBrowser->setChecked ( appConfig.m_kdeUseTQTextBrowser );
dlg.m_radioUseKHTMLPart->setChecked ( !appConfig.m_kdeUseTQTextBrowser );
dlg.m_enableJS->setChecked ( appConfig.m_kdeEnableJS );
dlg.m_enablePlugins->setChecked ( appConfig.m_kdeEnablePlugins );
@ -750,7 +750,7 @@ void KCHMMainWindow::slotChangeSettingsMenuItemActivated()
dlg.m_labelUseSearchEngineInternal->setBuddy( dlg.m_useSearchEngineInternal );
dlg.m_labelUseSearchEngineNew->setBuddy( dlg.m_useSearchEngineNew );
if ( dlg.exec() == QDialog::Accepted )
if ( dlg.exec() == TQDialog::Accepted )
{
appConfig.m_LoadLatestFileOnStartup = dlg.m_radioOnBeginOpenLast->isChecked();
appConfig.m_HistorySize = dlg.m_historySize->value();
@ -770,7 +770,7 @@ void KCHMMainWindow::slotChangeSettingsMenuItemActivated()
else
appConfig.m_onNewChmClick = KCHMConfig::ACTION_DONT_OPEN;
appConfig.m_QtBrowserPath = dlg.m_qtBrowserPath->text();
appConfig.m_TQtBrowserPath = dlg.m_qtBrowserPath->text();
// Check the changes
bool need_restart = false;
@ -799,24 +799,24 @@ void KCHMMainWindow::slotChangeSettingsMenuItemActivated()
appConfig.m_kdeEnableRefresh = dlg.m_enableRefresh->isChecked();
}
if ( appConfig.m_kdeUseQTextBrowser != dlg.m_radioUseQtextBrowser->isChecked() )
if ( appConfig.m_kdeUseTQTextBrowser != dlg.m_radioUseQtextBrowser->isChecked() )
{
need_restart = true;
appConfig.m_kdeUseQTextBrowser = dlg.m_radioUseQtextBrowser->isChecked();
appConfig.m_kdeUseTQTextBrowser = dlg.m_radioUseQtextBrowser->isChecked();
}
if ( dlg.m_useSearchEngineNew->isChecked()
&& appConfig.m_useSearchEngine == KCHMConfig::SEARCH_USE_CHM )
{
appConfig.m_useSearchEngine = KCHMConfig::SEARCH_USE_MINE;
m_searchWindow->invalidate();
m_searchWindow->tqinvalidate();
}
if ( dlg.m_useSearchEngineInternal->isChecked()
&& appConfig.m_useSearchEngine == KCHMConfig::SEARCH_USE_MINE )
{
appConfig.m_useSearchEngine = KCHMConfig::SEARCH_USE_CHM;
m_searchWindow->invalidate();
m_searchWindow->tqinvalidate();
}
appConfig.m_advExternalEditorPath = dlg.m_advExternalProgramName->text();
@ -826,7 +826,7 @@ void KCHMMainWindow::slotChangeSettingsMenuItemActivated()
appConfig.save();
if ( need_restart )
QMessageBox::information(
TQMessageBox::information(
this,
APP_NAME,
i18n( "Changing browser view options or search engine used\n"
@ -840,8 +840,8 @@ void KCHMMainWindow::setupSignals( )
#if defined(HAVE_SIGACTION)
struct sigaction sa;
memset ((char *)&sa, 0, sizeof(sa));
sigemptyset (&sa.sa_mask);
sigaddset (&sa.sa_mask, SIGCHLD);
sigemptyset (&sa.sa_tqmask);
sigaddset (&sa.sa_tqmask, SIGCHLD);
#ifdef SA_RESTART
sa.sa_flags = SA_RESTART;
@ -859,7 +859,7 @@ void KCHMMainWindow::slotHistoryMenuItemActivated( int item )
if ( item < 0 || item >= (signed) appConfig.m_History.size() )
qFatal ("KCHMMainWindow::slotHistoryMenuItemActivated: bad history menu id %d", item);
QString filename = appConfig.m_History[item];
TQString filename = appConfig.m_History[item];
// remove it, so it will be added again at the history top, and will not shitf anything.
// appConfig.m_History.remove ( appConfig.m_History.begin() + item);
@ -916,14 +916,14 @@ void KCHMMainWindow::showOrHideContextWindow( int tabindex )
// Handle clicking on m_contentsWindow element
connect( m_contentsWindow,
SIGNAL( clicked( QListViewItem* ) ),
TQT_SIGNAL( clicked( TQListViewItem* ) ),
this,
SLOT( slotOnTreeClicked( QListViewItem* ) ) );
TQT_SLOT( slotOnTreeClicked( TQListViewItem* ) ) );
connect( m_contentsWindow,
SIGNAL( doubleClicked ( QListViewItem *, const QPoint &, int ) ),
TQT_SIGNAL( doubleClicked ( TQListViewItem *, const TQPoint &, int ) ),
this,
SLOT( slotOnTreeDoubleClicked ( QListViewItem *, const QPoint &, int ) ) );
TQT_SLOT( slotOnTreeDoubleClicked ( TQListViewItem *, const TQPoint &, int ) ) );
m_tabWidget->insertTab (m_contentsWindow, i18n( "Contents" ), tabindex);
}
@ -932,7 +932,7 @@ void KCHMMainWindow::showOrHideContextWindow( int tabindex )
void KCHMMainWindow::showOrHideIndexWindow( int tabindex )
{
// Test whether to show/invalidate the index window
// Test whether to show/tqinvalidate the index window
if ( tabindex == -1 )
{
if ( m_indexWindow )
@ -950,7 +950,7 @@ void KCHMMainWindow::showOrHideIndexWindow( int tabindex )
m_tabWidget->insertTab (m_indexWindow, i18n( "Index" ), tabindex);
}
else
m_indexWindow->invalidate();
m_indexWindow->tqinvalidate();
}
}
@ -973,7 +973,7 @@ void KCHMMainWindow::showOrHideSearchWindow( int tabindex )
m_tabWidget->insertTab (m_searchWindow, i18n( "Search" ), tabindex);
}
else
m_searchWindow->invalidate();
m_searchWindow->tqinvalidate();
}
}
@ -1028,10 +1028,10 @@ void KCHMMainWindow::slotLocateInContentWindow( )
if ( treeitem )
{
KCHMIndTocItem * itemparent = treeitem;
KCHMIndTocItem * itemtqparent = treeitem;
while ( (itemparent = (KCHMIndTocItem*) itemparent->parent()) != 0 )
itemparent->setOpen(true);
while ( (itemtqparent = (KCHMIndTocItem*) itemtqparent->tqparent()) != 0 )
itemtqparent->setOpen(true);
m_contentsWindow->setCurrentItem (treeitem);
m_contentsWindow->ensureItemVisible (treeitem);
@ -1043,16 +1043,16 @@ void KCHMMainWindow::slotLocateInContentWindow( )
void KCHMMainWindow::slotExtractCHM( )
{
QStringList files;
TQStringList files;
#if defined (USE_KDE)
QString outdir = KFileDialog::getExistingDirectory (
QString::null,
TQString outdir = KFileDialog::getExistingDirectory (
TQString(),
this,
i18n("Choose a directory to store CHM content") );
#else
QString outdir = QFileDialog::getExistingDirectory (
QString::null,
TQString outdir = TQFileDialog::getExistingDirectory (
TQString(),
this,
0,
i18n("Choose a directory to store CHM content"),
@ -1068,7 +1068,7 @@ void KCHMMainWindow::slotExtractCHM( )
if ( !m_chmFile || !m_chmFile->enumerateFiles( &files ) )
return;
KQProgressModalDialog progress( i18n("Extracting CHM content"), i18n("Extracting files..."), i18n("Abort"), files.size(), this );
KTQProgressModalDialog progress( i18n("Extracting CHM content"), i18n("Extracting files..."), i18n("Abort"), files.size(), this );
for ( unsigned int i = 0; i < files.size(); i++ )
{
@ -1076,25 +1076,25 @@ void KCHMMainWindow::slotExtractCHM( )
if ( (i % 3) == 0 )
{
qApp->processEvents();
tqApp->processEvents();
if ( progress.wasCancelled() )
break;
}
// Extract the file
QByteArray buf;
TQByteArray buf;
if ( m_chmFile->getFileContentAsBinary( &buf, files[i] ) )
{
// Split filename to get the list of subdirectories
QStringList dirs = QStringList::split( '/', files[i] );
TQStringList dirs = TQStringList::split( '/', files[i] );
// Walk through the list of subdirectories, and create them if needed
// dirlevel is used to detect extra .. and prevent overwriting files
// outside the directory (like creating the file images/../../../../../etc/passwd
unsigned int i, dirlevel = 0;
QStringList dirlist;
TQStringList dirlist;
for ( i = 0; i < dirs.size() - 1; i++ )
{
@ -1111,7 +1111,7 @@ void KCHMMainWindow::slotExtractCHM( )
{
dirlist.push_back( dirs[i] );
QDir dir ( outdir + dirlist.join( "/" ) );
TQDir dir ( outdir + dirlist.join( "/" ) );
if ( !dir.exists() )
{
if ( !dir.mkdir( dir.path() ) )
@ -1120,8 +1120,8 @@ void KCHMMainWindow::slotExtractCHM( )
}
}
QString filename = outdir + dirlist.join( "/" ) + "/" + dirs[i];
QFile wf( filename );
TQString filename = outdir + dirlist.join( "/" ) + "/" + dirs[i];
TQFile wf( filename );
if ( !wf.open( IO_WriteOnly ) )
{
qWarning( "Could not write file %s\n", filename.ascii() );
@ -1158,7 +1158,7 @@ void KCHMMainWindow::slotBrowserChanged( KCHMViewWindow * newbrowser )
locateInContentTree( newbrowser->getOpenedPage() );
}
void KCHMMainWindow::locateInContentTree( const QString & url )
void KCHMMainWindow::locateInContentTree( const TQString & url )
{
if ( !m_contentsWindow )
return;
@ -1167,31 +1167,31 @@ void KCHMMainWindow::locateInContentTree( const QString & url )
if ( treeitem )
{
KCHMIndTocItem * itemparent = treeitem;
while ( (itemparent = (KCHMIndTocItem*) itemparent->parent()) != 0 )
itemparent->setOpen(true);
KCHMIndTocItem * itemtqparent = treeitem;
while ( (itemtqparent = (KCHMIndTocItem*) itemtqparent->tqparent()) != 0 )
itemtqparent->setOpen(true);
m_contentsWindow->setCurrentItem (treeitem);
m_contentsWindow->ensureItemVisible (treeitem);
}
}
void KCHMMainWindow::slotOnTreeDoubleClicked( QListViewItem * item, const QPoint &, int )
void KCHMMainWindow::slotOnTreeDoubleClicked( TQListViewItem * item, const TQPoint &, int )
{
// Open/close only existing item which have children
// Open/close only existing item which have tqchildren
if ( !item || item->childCount() == 0 )
return;
item->setOpen( !item->isOpen() );
item->repaint();
item->tqrepaint();
}
bool KCHMMainWindow::event( QEvent * e )
bool KCHMMainWindow::event( TQEvent * e )
{
if ( e->type() == QEvent::User )
if ( e->type() == TQEvent::User )
return handleUserEvent( (KCHMUserEvent*) e );
return QWidget::event( e );
return TQWidget::event( e );
}
bool KCHMMainWindow::handleUserEvent( const KCHMUserEvent * event )
@ -1201,8 +1201,8 @@ bool KCHMMainWindow::handleUserEvent( const KCHMUserEvent * event )
if ( event->m_args.size() != 1 && event->m_args.size() != 2 )
qFatal("handleUserEvent: event loadAndOpen must receive 1 or 2 args");
QString chmfile = event->m_args[0];
QString openurl = event->m_args.size() > 1 ? event->m_args[1] : "/";
TQString chmfile = event->m_args[0];
TQString openurl = event->m_args.size() > 1 ? event->m_args[1] : "/";
return loadChmFile( chmfile, false ) && openPage( openurl );
}
@ -1254,13 +1254,13 @@ void KCHMMainWindow::runAutoTest()
case STATE_INITIAL:
if ( m_contentsWindow && !m_useShortAutotest )
{
m_autotestlistiterator = QListViewItemIterator (m_contentsWindow);
m_autotestlistiterator = TQListViewItemIterator (m_contentsWindow);
m_autoteststate = STATE_CONTENTS_OPENNEXTPAGE;
}
else
m_autoteststate = STATE_OPEN_INDEX;
QTimer::singleShot (500, this, SLOT(runAutoTest()) );
TQTimer::singleShot (500, this, TQT_SLOT(runAutoTest()) );
break; // allow to finish the initialization sequence
case STATE_CONTENTS_OPENNEXTPAGE:
@ -1272,7 +1272,7 @@ void KCHMMainWindow::runAutoTest()
else
m_autoteststate = STATE_OPEN_INDEX;
QTimer::singleShot (50, this, SLOT(runAutoTest()) );
TQTimer::singleShot (50, this, TQT_SLOT(runAutoTest()) );
break;
case STATE_OPEN_INDEX:
@ -1280,11 +1280,11 @@ void KCHMMainWindow::runAutoTest()
m_tabWidget->setCurrentPage (1);
m_autoteststate = STATE_SHUTDOWN;
QTimer::singleShot (500, this, SLOT(runAutoTest()) );
TQTimer::singleShot (500, this, TQT_SLOT(runAutoTest()) );
break;
case STATE_SHUTDOWN:
qApp->quit();
tqApp->quit();
break;
default:

@ -44,29 +44,30 @@ static const unsigned int OPF_NEW_TAB = 1 << 2;
static const unsigned int OPF_BACKGROUND = 1 << 3;
//! Those events could be sent to main window to do useful things. See handleUserEvents()
class KCHMUserEvent : public QEvent
class KCHMUserEvent : public TQEvent
{
public:
KCHMUserEvent( const QString& action, const QStringList& args = QStringList())
: QEvent( QEvent::User ), m_action(action), m_args(args) {};
KCHMUserEvent( const TQString& action, const TQStringList& args = TQStringList())
: TQEvent( TQEvent::User ), m_action(action), m_args(args) {};
QString m_action;
QStringList m_args;
TQString m_action;
TQStringList m_args;
};
class KCHMMainWindow : public KQMainWindow
{
Q_OBJECT
TQ_OBJECT
public:
KCHMMainWindow();
~KCHMMainWindow();
bool openPage ( const QString &url, unsigned int flags = OPF_CONTENT_TREE );
bool openPage ( const TQString &url, unsigned int flags = OPF_CONTENT_TREE );
LCHMFile * chmFile() const { return m_chmFile; }
const QString& getOpenedFileName () { return m_chmFilename; }
const TQString& getOpenedFileName () { return m_chmFilename; }
KCHMViewWindow * currentBrowser() const;
KCHMContentsWindow * contentsWindow() const { return m_contentsWindow; }
@ -75,12 +76,12 @@ class KCHMMainWindow : public KQMainWindow
KCHMNavToolbar * navigationToolbar() const { return m_navToolbar; }
KCHMSearchWindow * searchWindow() const { return m_searchWindow; }
void showInStatusBar (const QString& text) { statusBar()->message( text, 2000 ); }
void showInStatusBar (const TQString& text) { statusBar()->message( text, 2000 ); }
void setTextEncoding (const LCHMTextEncoding * enc);
public slots:
void slotOnTreeClicked( QListViewItem *item );
void slotOnTreeDoubleClicked( QListViewItem *item, const QPoint &, int );
void slotOnTreeClicked( TQListViewItem *item );
void slotOnTreeDoubleClicked( TQListViewItem *item, const TQPoint &, int );
void slotAddBookmark ( );
void slotOpenPageInNewTab( );
@ -91,7 +92,7 @@ class KCHMMainWindow : public KQMainWindow
void slotBrowserChanged( KCHMViewWindow * newbrowser );
private slots:
void slotLinkClicked ( const QString & link, bool& follow_link );
void slotLinkClicked ( const TQString & link, bool& follow_link );
void slotOpenMenuItemActivated();
void slotPrintMenuItemActivated();
@ -119,12 +120,12 @@ class KCHMMainWindow : public KQMainWindow
private:
bool parseCmdLineArgs();
void showEvent( QShowEvent * );
void closeEvent ( QCloseEvent * e );
void showEvent( TQShowEvent * );
void closeEvent ( TQCloseEvent * e );
void setupSignals ();
void setupToolbarsAndMenu ( );
bool loadChmFile ( const QString &fileName, bool call_open_page = true );
bool loadChmFile ( const TQString &fileName, bool call_open_page = true );
void closeChmFile();
void refreshCurrentBrowser();
void updateHistoryMenu();
@ -134,13 +135,13 @@ class KCHMMainWindow : public KQMainWindow
void showOrHideSearchWindow( int tabindex );
// User events
bool event ( QEvent * e );
bool event ( TQEvent * e );
bool handleUserEvent( const KCHMUserEvent * event );
void locateInContentTree( const QString& url );
void locateInContentTree( const TQString& url );
QString m_chmFilename;
QString m_aboutDlgMenuText; // to show in KDE or Qt about dialogs
TQString m_chmFilename;
TQString m_aboutDlgMenuText; // to show in KDE or TQt about dialogs
KCHMViewWindowMgr * m_viewWindowMgr;
KCHMIndexWindow * m_indexWindow;
@ -148,8 +149,8 @@ class KCHMMainWindow : public KQMainWindow
KCHMBookmarkWindow * m_bookmarkWindow;
KCHMContentsWindow * m_contentsWindow;
KQTabWidget * m_tabWidget;
QSplitter * m_windowSplitter;
KTQTabWidget * m_tabWidget;
TQSplitter * m_windowSplitter;
KCHMSearchAndViewToolbar * m_searchToolbar;
KCHMNavToolbar * m_navToolbar;
@ -159,7 +160,7 @@ class KCHMMainWindow : public KQMainWindow
LCHMFile * m_chmFile;
bool m_FirstTimeShow;
KQPopupMenu * m_menuHistory;
KTQPopupMenu * m_menuHistory;
int m_tabContextPage;
int m_tabIndexPage;
@ -178,7 +179,7 @@ class KCHMMainWindow : public KQMainWindow
bool m_useShortAutotest;
auto_test_state_t m_autoteststate;
QListViewItemIterator m_autotestlistiterator;
TQListViewItemIterator m_autotestlistiterator;
private slots:
void runAutoTest();

@ -26,38 +26,38 @@
#include "iconstorage.h"
KCHMNavToolbar::KCHMNavToolbar( KCHMMainWindow *parent )
: QToolBar( parent )
KCHMNavToolbar::KCHMNavToolbar( KCHMMainWindow *tqparent )
: TQToolBar( tqparent )
{
// Initialize toolbar
setLabel( i18n( "Navigation") );
QPixmap iconBackward (*gIconStorage.getToolbarPixmap(KCHMIconStorage::back));
m_toolbarIconBackward = new QToolButton (iconBackward,
TQPixmap iconBackward (*gIconStorage.getToolbarPixmap(KCHMIconStorage::back));
m_toolbarIconBackward = new TQToolButton (iconBackward,
i18n( "Move backward in history"),
QString::null,
parent,
SLOT( slotNavigateBack() ),
TQString(),
tqparent,
TQT_SLOT( slotNavigateBack() ),
this);
QWhatsThis::add( m_toolbarIconBackward, i18n( "Click this button to move backward in browser history") );
TQWhatsThis::add( m_toolbarIconBackward, i18n( "Click this button to move backward in browser history") );
QPixmap iconForward (*gIconStorage.getToolbarPixmap(KCHMIconStorage::forward));
m_toolbarIconForward = new QToolButton (iconForward,
TQPixmap iconForward (*gIconStorage.getToolbarPixmap(KCHMIconStorage::forward));
m_toolbarIconForward = new TQToolButton (iconForward,
i18n( "Move forward in history"),
QString::null,
parent,
SLOT( slotNavigateForward() ),
TQString(),
tqparent,
TQT_SLOT( slotNavigateForward() ),
this);
QWhatsThis::add( m_toolbarIconForward, i18n( "Click this button to move forward in browser history") );
TQWhatsThis::add( m_toolbarIconForward, i18n( "Click this button to move forward in browser history") );
QPixmap iconHome = (*gIconStorage.getToolbarPixmap(KCHMIconStorage::gohome));
QToolButton * hb = new QToolButton (iconHome,
TQPixmap iconHome = (*gIconStorage.getToolbarPixmap(KCHMIconStorage::gohome));
TQToolButton * hb = new TQToolButton (iconHome,
i18n( "Go to the home page"),
QString::null,
parent,
SLOT( slotNavigateHome() ),
TQString(),
tqparent,
TQT_SLOT( slotNavigateHome() ),
this);
QWhatsThis::add( hb, i18n( "Click this button to move to the home page") );
TQWhatsThis::add( hb, i18n( "Click this button to move to the home page") );
}
@ -65,7 +65,7 @@ KCHMNavToolbar::~KCHMNavToolbar()
{
}
void KCHMNavToolbar::updateIconStatus( bool enable_backward, bool enable_forward )
void KCHMNavToolbar::updateIcontqStatus( bool enable_backward, bool enable_forward )
{
m_toolbarIconBackward->setEnabled( enable_backward );
m_toolbarIconForward->setEnabled ( enable_forward );

@ -24,19 +24,20 @@
#include "forwarddeclarations.h"
class KCHMNavToolbar : public QToolBar
class KCHMNavToolbar : public TQToolBar
{
Q_OBJECT
TQ_OBJECT
public:
KCHMNavToolbar( KCHMMainWindow *parent );
KCHMNavToolbar( KCHMMainWindow *tqparent );
~KCHMNavToolbar();
public slots:
void updateIconStatus( bool enable_backward, bool enable_forward );
void updateIcontqStatus( bool enable_backward, bool enable_forward );
private:
QToolButton * m_toolbarIconBackward;
QToolButton * m_toolbarIconForward;
TQToolButton * m_toolbarIconBackward;
TQToolButton * m_toolbarIconForward;
};
#endif /* INCLUDE_KCHMNAVHISTORY_H */

@ -19,7 +19,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#include <qapplication.h>
#include <tqapplication.h>
#include "kchmmainwindow.h"
#include "kchmsearchengine.h"
@ -49,8 +49,8 @@ KCHMSearchEngine::~KCHMSearchEngine()
void KCHMSearchEngine::processEvents( )
{
// Do it twice; some events generate other events
qApp->eventLoop()->processEvents( QEventLoop::ExcludeUserInput );
qApp->eventLoop()->processEvents( QEventLoop::ExcludeUserInput );
tqApp->eventLoop()->processEvents( TQEventLoop::ExcludeUserInput );
tqApp->eventLoop()->processEvents( TQEventLoop::ExcludeUserInput );
}
@ -65,27 +65,27 @@ bool KCHMSearchEngine::loadOrGenerateIndex( )
if ( m_Index )
return true;
QString indexfiledict = ::mainWindow->currentSettings()->searchIndexDictFilename();
QString indexfiledoc = ::mainWindow->currentSettings()->searchIndexDocFilename();
QStringList documents;
TQString indexfiledict = ::mainWindow->currentSettings()->searchIndexDictFilename();
TQString indexfiledoc = ::mainWindow->currentSettings()->searchIndexDocFilename();
TQStringList documents;
m_Index = new QtAs::Index( documents, appConfig.m_datapath );
m_Index->setDictionaryFile( indexfiledict );
m_Index->setDocListFile( indexfiledoc );
m_progressDlg = new QProgressDialog( 0 );
connect( m_progressDlg, SIGNAL( canceled() ), this, SLOT( cancelButtonPressed() ) );
m_progressDlg = new TQProgressDialog( 0 );
connect( m_progressDlg, TQT_SIGNAL( canceled() ), this, TQT_SLOT( cancelButtonPressed() ) );
connect( m_Index, SIGNAL( indexingProgress( int ) ), this, SLOT( setIndexingProgress( int ) ) );
connect( m_Index, TQT_SIGNAL( indexingProgress( int ) ), this, TQT_SLOT( setIndexingProgress( int ) ) );
KCHMShowWaitCursor waitcursor;
QFile f( indexfiledict );
TQFile f( indexfiledict );
if ( !f.exists() )
{
::mainWindow->statusBar()->message( tr( "Generating search index..." ) );
// Get the list of files in CHM archive
QStringList alldocuments;
TQStringList alldocuments;
m_progressDlg->setCaption( tr( "Generating search index..." ) );
m_progressDlg->setLabelText( tr( "Generating search index..." ) );
@ -103,7 +103,7 @@ bool KCHMSearchEngine::loadOrGenerateIndex( )
// Process the list keeping only HTML documents there
for ( unsigned int i = 0; i < alldocuments.size(); i++ )
if ( alldocuments[i].endsWith( ".html", false ) || alldocuments[i].endsWith( ".htm", false ) )
if ( alldocuments[i].tqendsWith( ".html", false ) || alldocuments[i].tqendsWith( ".htm", false ) )
documents.push_back( LCHMUrlFactory::makeURLabsoluteIfNeeded( alldocuments[i] ) );
m_Index->setDocList( documents );
@ -161,7 +161,7 @@ class SearchDataKeeper
bool isInPhrase() const { return m_inPhrase; }
void addTerm( const QString& term )
void addTerm( const TQString& term )
{
if ( !term.isEmpty() )
{
@ -173,36 +173,36 @@ class SearchDataKeeper
}
// Should contain all the search terms present in query, includind those from phrases. One element - one term .
QStringList terms;
TQStringList terms;
// Should contain phrases present in query without quotes. One element - one phrase.
QStringList phrases;
TQStringList phrases;
// Should contain all the terms present in all the phrases (but not outside).
QStringList phrasewords;
TQStringList phrasewords;
private:
bool m_inPhrase;
QStringList phrase_terms;
TQStringList phrase_terms;
};
bool KCHMSearchEngine::searchQuery( const QString & query, QStringList * results, unsigned int limit )
bool KCHMSearchEngine::searchQuery( const TQString & query, TQStringList * results, unsigned int limit )
{
// Characters which split the words. We need to make them separate tokens
QString splitChars = m_Index->getCharsSplit();
TQString splitChars = m_Index->getCharsSplit();
// Characters which are part of the word. We should keep them apart.
QString partOfWordChars = m_Index->getCharsPartOfWord();
TQString partOfWordChars = m_Index->getCharsPartOfWord();
SearchDataKeeper keeper;
// State machine variables
QString term;
TQString term;
for ( unsigned int i = 0; i < query.length(); i++ )
{
QChar ch = query[i].lower();
TQChar ch = query[i].lower();
// a quote either begins or ends the phrase
if ( ch == '"' )
@ -218,14 +218,14 @@ bool KCHMSearchEngine::searchQuery( const QString & query, QStringList * results
}
// If new char does not stop the word, add ot and continue
if ( ch.isLetterOrNumber() || partOfWordChars.find( ch ) != -1 )
if ( ch.isLetterOrNumber() || partOfWordChars.tqfind( ch ) != -1 )
{
term.append( ch );
continue;
}
// If it is a split char, add this term and split char as separate term
if ( splitChars.find( ch ) != -1 )
if ( splitChars.tqfind( ch ) != -1 )
{
// Add existing term if present
keeper.addTerm( term );
@ -236,21 +236,21 @@ bool KCHMSearchEngine::searchQuery( const QString & query, QStringList * results
// Just add the word; it is most likely a space or terminated by tokenizer.
keeper.addTerm( term );
term = QString::null;
term = TQString();
}
keeper.addTerm( term );
if ( keeper.isInPhrase() )
{
QMessageBox::warning( 0, i18n( "Search" ), i18n( "A closing quote character is missing." ) );
TQMessageBox::warning( 0, i18n( "Search" ), i18n( "A closing quote character is missing." ) );
return false;
}
KCHMShowWaitCursor waitcursor;
QStringList foundDocs = m_Index->query( keeper.terms, keeper.phrases, keeper.phrasewords );
TQStringList foundDocs = m_Index->query( keeper.terms, keeper.phrases, keeper.phrasewords );
for ( QStringList::iterator it = foundDocs.begin(); it != foundDocs.end() && limit > 0; ++it, limit-- )
for ( TQStringList::iterator it = foundDocs.begin(); it != foundDocs.end() && limit > 0; ++it, limit-- )
results->push_back( *it );
return true;

@ -22,27 +22,28 @@
#ifndef KCHMSEARCHENGINE_H
#define KCHMSEARCHENGINE_H
#include <qobject.h>
#include <qmap.h>
#include <qstring.h>
#include <qstringlist.h>
#include <qprogressdialog.h>
#include <tqobject.h>
#include <tqmap.h>
#include <tqstring.h>
#include <tqstringlist.h>
#include <tqprogressdialog.h>
#include "libchmfile.h"
namespace QtAs { class Index; };
class KCHMSearchEngine : public QObject
class KCHMSearchEngine : public TQObject
{
Q_OBJECT
TQ_OBJECT
public:
KCHMSearchEngine();
~KCHMSearchEngine();
bool loadOrGenerateIndex();
bool searchQuery ( const QString& query, QStringList * results, unsigned int limit = 100 );
bool searchQuery ( const TQString& query, TQStringList * results, unsigned int limit = 100 );
private slots:
@ -53,8 +54,8 @@ class KCHMSearchEngine : public QObject
void processEvents();
// Used during the index generation
QProgressDialog * m_progressDlg;
QStringList m_keywordDocuments;
TQProgressDialog * m_progressDlg;
TQStringList m_keywordDocuments;
QtAs::Index * m_Index;
};

@ -21,11 +21,11 @@
***************************************************************************/
#include <qfile.h>
#include <qdir.h>
#include <qstringlist.h>
#include <qdict.h>
#include <qapplication.h>
#include <tqfile.h>
#include <tqdir.h>
#include <tqstringlist.h>
#include <tqdict.h>
#include <tqapplication.h>
#include <ctype.h>
@ -45,7 +45,7 @@ static const char SPLIT_CHARACTERS[] = "!()*&^%#@[]{}':;,.?/|/?<>\\-+=~`";
static const char WORD_CHARACTERS[] = "$_";
int TermList::compareItems( QPtrCollection::Item i1, QPtrCollection::Item i2 )
int TermList::compareItems( TQPtrCollection::Item i1, TQPtrCollection::Item i2 )
{
if( ( (Term*)i1 )->frequency == ( (Term*)i2 )->frequency )
return 0;
@ -54,35 +54,35 @@ int TermList::compareItems( QPtrCollection::Item i1, QPtrCollection::Item i2 )
return 1;
}
QDataStream &operator>>( QDataStream &s, Document &l )
TQDataStream &operator>>( TQDataStream &s, Document &l )
{
s >> l.docNumber;
s >> l.frequency;
return s;
}
QDataStream &operator<<( QDataStream &s, const Document &l )
TQDataStream &operator<<( TQDataStream &s, const Document &l )
{
s << (Q_INT16)l.docNumber;
s << (Q_INT16)l.frequency;
s << (TQ_INT16)l.docNumber;
s << (TQ_INT16)l.frequency;
return s;
}
Index::Index( const QString &dp, const QString & )
: QObject( 0, 0 ), dict( 8999 ), docPath( dp )
Index::Index( const TQString &dp, const TQString & )
: TQObject( 0, 0 ), dict( 8999 ), docPath( dp )
{
lastWindowClosed = false;
connect( qApp, SIGNAL( lastWindowClosed() ),
this, SLOT( setLastWinClosed() ) );
connect( tqApp, TQT_SIGNAL( lastWindowClosed() ),
this, TQT_SLOT( setLastWinClosed() ) );
}
Index::Index( const QStringList &dl, const QString & )
: QObject( 0, 0 ), dict( 20011 )
Index::Index( const TQStringList &dl, const TQString & )
: TQObject( 0, 0 ), dict( 20011 )
{
docList = dl;
lastWindowClosed = false;
connect( qApp, SIGNAL( lastWindowClosed() ),
this, SLOT( setLastWinClosed() ) );
connect( tqApp, TQT_SIGNAL( lastWindowClosed() ),
this, TQT_SLOT( setLastWinClosed() ) );
}
void Index::setLastWinClosed()
@ -90,17 +90,17 @@ void Index::setLastWinClosed()
lastWindowClosed = true;
}
void Index::setDictionaryFile( const QString &f )
void Index::setDictionaryFile( const TQString &f )
{
dictFile = f;
}
void Index::setDocListFile( const QString &f )
void Index::setDocListFile( const TQString &f )
{
docListFile = f;
}
void Index::setDocList( const QStringList &lst )
void Index::setDocList( const TQStringList &lst )
{
docList = lst;
}
@ -110,7 +110,7 @@ bool Index::makeIndex()
if ( docList.isEmpty() )
return false;
QStringList::Iterator it = docList.begin();
TQStringList::Iterator it = docList.begin();
int steps = docList.count() / 100;
if ( !steps )
@ -136,7 +136,7 @@ bool Index::makeIndex()
}
void Index::insertInDict( const QString &str, int docNum )
void Index::insertInDict( const TQString &str, int docNum )
{
Entry *e = 0;
if ( dict.count() )
@ -156,10 +156,10 @@ void Index::insertInDict( const QString &str, int docNum )
}
bool Index::parseDocumentToStringlist( const QString & filename, QStringList & tokenlist )
bool Index::parseDocumentToStringlist( const TQString & filename, TQStringList & tokenlist )
{
QString parsedbuf, parseentity;
QString text;
TQString parsedbuf, parseentity;
TQString text;
if ( !::mainWindow->chmFile()->getFileContentAsString( &text, filename ) )
{
@ -183,19 +183,19 @@ bool Index::parseDocumentToStringlist( const QString & filename, QStringList & t
{
STATE_OUTSIDE_TAGS, // outside HTML tags; parse text
STATE_IN_HTML_TAG, // inside HTML tags; wait for end tag
STATE_IN_QUOTES, // inside HTML tags and inside quotes; wait for end quote (in var QuoteChar)
STATE_IN_TQUOTES, // inside HTML tags and inside quotes; wait for end quote (in var QuoteChar)
STATE_IN_HTML_ENTITY, // inside HTML entity; parse the entity
};
state_t state = STATE_OUTSIDE_TAGS;
QChar QuoteChar; // used in STATE_IN_QUOTES
TQChar QuoteChar; // used in STATE_IN_TQUOTES
for ( unsigned int j = 0; j < text.length(); j++ )
{
QChar ch = text[j];
TQChar ch = text[j];
if ( (j % 20000) == 0 )
qApp->processEvents( QEventLoop::ExcludeUserInput );
tqApp->tqprocessEvents( TQEventLoop::ExcludeUserInput );
if ( state == STATE_IN_HTML_TAG )
{
@ -203,7 +203,7 @@ bool Index::parseDocumentToStringlist( const QString & filename, QStringList & t
// Ignore everything until we see '>' (end of HTML tag) or quote char (quote start)
if ( ch == '"' || ch == '\'' )
{
state = STATE_IN_QUOTES;
state = STATE_IN_TQUOTES;
QuoteChar = ch;
}
else if ( ch == '>' )
@ -211,7 +211,7 @@ bool Index::parseDocumentToStringlist( const QString & filename, QStringList & t
continue;
}
else if ( state == STATE_IN_QUOTES )
else if ( state == STATE_IN_TQUOTES )
{
// We are inside quoted text inside HTML tag.
// Ignore everything until we see the quote character again
@ -252,7 +252,7 @@ bool Index::parseDocumentToStringlist( const QString & filename, QStringList & t
// Don't we have a space?
if ( parseentity.lower() != "nbsp" )
{
QString entity = ::mainWindow->chmFile()->impl()->decodeEntity( parseentity );
TQString entity = ::mainWindow->chmFile()->impl()->decodeEntity( parseentity );
if ( entity.isNull() )
{
@ -283,7 +283,7 @@ bool Index::parseDocumentToStringlist( const QString & filename, QStringList & t
if ( ch == '&' )
{
state = STATE_IN_HTML_ENTITY;
parseentity = QString::null;
parseentity = TQString();
continue;
}
@ -293,20 +293,20 @@ bool Index::parseDocumentToStringlist( const QString & filename, QStringList & t
// Ok, we have a valid character outside HTML tags, and probably some in buffer already.
// If it is char or letter, add it and continue
if ( ch.isLetterOrNumber() || m_charsword.find( ch ) != -1 )
if ( ch.isLetterOrNumber() || m_charsword.tqfind( ch ) != -1 )
{
parsedbuf.append( ch );
continue;
}
// If it is a split char, add the word to the dictionary, and then add the char itself.
if ( m_charssplit.find( ch ) != -1 )
if ( m_charssplit.tqfind( ch ) != -1 )
{
if ( !parsedbuf.isEmpty() )
tokenlist.push_back( parsedbuf.lower() );
tokenlist.push_back( ch.lower() );
parsedbuf = QString::null;
parsedbuf = TQString();
continue;
}
@ -315,7 +315,7 @@ tokenize_buf:
if ( !parsedbuf.isEmpty() )
{
tokenlist.push_back( parsedbuf.lower() );
parsedbuf = QString::null;
parsedbuf = TQString();
}
}
@ -327,22 +327,22 @@ tokenize_buf:
}
void Index::parseDocument( const QString &filename, int docNum )
void Index::parseDocument( const TQString &filename, int docNum )
{
QStringList terms;
TQStringList terms;
if ( !parseDocumentToStringlist( filename, terms ) )
return;
for ( QStringList::Iterator it = terms.begin(); it != terms.end(); ++it )
for ( TQStringList::Iterator it = terms.begin(); it != terms.end(); ++it )
insertInDict( *it, docNum );
}
void Index::writeDict()
{
QDictIterator<Entry> it( dict );
QFile f( dictFile );
TQDictIterator<Entry> it( dict );
TQFile f( dictFile );
if ( !f.open( IO_WriteOnly ) )
{
@ -350,7 +350,7 @@ void Index::writeDict()
return;
}
QDataStream s( &f );
TQDataStream s( &f );
s << (int) 1; // version
s << m_charssplit;
s << m_charsword;
@ -368,27 +368,27 @@ void Index::writeDict()
void Index::writeDocumentList()
{
QFile f( docListFile );
TQFile f( docListFile );
if ( !f.open( IO_WriteOnly ) )
{
qWarning( "Index::writeDocumentList: could not write dictionary file %s", docListFile.ascii() );
return;
}
QDataStream s( &f );
TQDataStream s( &f );
s << docList;
}
bool Index::readDict()
{
QFile f( dictFile );
TQFile f( dictFile );
if ( !f.open( IO_ReadOnly ) )
return false;
dict.clear();
QDataStream s( &f );
QString key;
TQDataStream s( &f );
TQString key;
int version;
QValueList<Document> docs;
TQValueList<Document> docs;
s >> version;
s >> m_charssplit;
@ -407,19 +407,19 @@ bool Index::readDict()
bool Index::readDocumentList()
{
QFile f( docListFile );
TQFile f( docListFile );
if ( !f.open( IO_ReadOnly ) )
return false;
QDataStream s( &f );
TQDataStream s( &f );
s >> docList;
return true;
}
QStringList Index::query( const QStringList &terms, const QStringList &termSeq, const QStringList &seqWords )
TQStringList Index::query( const TQStringList &terms, const TQStringList &termSeq, const TQStringList &seqWords )
{
TermList termList;
QStringList::ConstIterator it = terms.begin();
TQStringList::ConstIterator it = terms.begin();
for ( it = terms.begin(); it != terms.end(); ++it )
{
Entry *e = 0;
@ -431,7 +431,7 @@ QStringList Index::query( const QStringList &terms, const QStringList &termSeq,
}
else
{
return QStringList();
return TQStringList();
}
}
@ -440,18 +440,18 @@ QStringList Index::query( const QStringList &terms, const QStringList &termSeq,
Term *minTerm = termList.first();
if ( !termList.count() )
return QStringList();
return TQStringList();
termList.removeFirst();
QValueList<Document> minDocs = minTerm->documents;
QValueList<Document>::iterator C;
QValueList<Document>::ConstIterator It;
TQValueList<Document> minDocs = minTerm->documents;
TQValueList<Document>::iterator C;
TQValueList<Document>::ConstIterator It;
Term *t = termList.first();
for ( ; t; t = termList.next() )
{
QValueList<Document> docs = t->documents;
TQValueList<Document> docs = t->documents;
C = minDocs.begin();
while ( C != minDocs.end() )
@ -475,7 +475,7 @@ QStringList Index::query( const QStringList &terms, const QStringList &termSeq,
}
}
QStringList results;
TQStringList results;
qHeapSort( minDocs );
if ( termSeq.isEmpty() )
@ -486,7 +486,7 @@ QStringList Index::query( const QStringList &terms, const QStringList &termSeq,
return results;
}
QString fileName;
TQString fileName;
for ( C = minDocs.begin(); C != minDocs.end(); ++C )
{
@ -500,9 +500,9 @@ QStringList Index::query( const QStringList &terms, const QStringList &termSeq,
}
bool Index::searchForPhrases( const QStringList &phrases, const QStringList &words, const QString &filename )
bool Index::searchForPhrases( const TQStringList &phrases, const TQStringList &words, const TQString &filename )
{
QStringList parsed_document;
TQStringList parsed_document;
if ( !parseDocumentToStringlist( filename, parsed_document ) )
return false;
@ -510,12 +510,12 @@ bool Index::searchForPhrases( const QStringList &phrases, const QStringList &wor
miniDict.clear();
// Initialize the dictionary with the words in phrase(s)
for ( QStringList::ConstIterator cIt = words.begin(); cIt != words.end(); ++cIt )
for ( TQStringList::ConstIterator cIt = words.begin(); cIt != words.end(); ++cIt )
miniDict.insert( *cIt, new PosEntry( 0 ) );
// Fill the dictionary with the words from the document
unsigned int word_offset = 3;
for ( QStringList::ConstIterator it = parsed_document.begin(); it != parsed_document.end(); it++, word_offset++ )
for ( TQStringList::ConstIterator it = parsed_document.begin(); it != parsed_document.end(); it++, word_offset++ )
{
PosEntry * entry = miniDict[ *it ];
@ -525,33 +525,33 @@ bool Index::searchForPhrases( const QStringList &phrases, const QStringList &wor
// Dump it
/*
QDictIterator<PosEntry> it( miniDict );
TQDictIterator<PosEntry> it( miniDict );
for( ; it.current(); ++it )
{
QString text( it.currentKey() );
QValueList<uint> pos = miniDict[text]->positions;
TQString text( it.currentKey() );
TQValueList<uint> pos = miniDict[text]->positions;
for ( unsigned int i = 1; i < pos.size(); i++ )
text += " " + QString::number( pos[i] );
text += " " + TQString::number( pos[i] );
qDebug( "%s", text.ascii());
}
*/
QValueList<uint> first_word_positions;
TQValueList<uint> first_word_positions;
for ( QStringList::ConstIterator phrase_it = phrases.begin(); phrase_it != phrases.end(); phrase_it++ )
for ( TQStringList::ConstIterator phrase_it = phrases.begin(); phrase_it != phrases.end(); phrase_it++ )
{
QStringList phrasewords = QStringList::split( ' ', *phrase_it );
TQStringList phrasewords = TQStringList::split( ' ', *phrase_it );
first_word_positions = miniDict[ phrasewords[0] ]->positions;
for ( unsigned int j = 1; j < phrasewords.count(); ++j )
{
QValueList<uint> next_word_it = miniDict[ phrasewords[j] ]->positions;
QValueList<uint>::iterator dict_it = first_word_positions.begin();
TQValueList<uint> next_word_it = miniDict[ phrasewords[j] ]->positions;
TQValueList<uint>::iterator dict_it = first_word_positions.begin();
while ( dict_it != first_word_positions.end() )
{
if ( next_word_it.find( *dict_it + 1 ) != next_word_it.end() )
if ( next_word_it.tqfind( *dict_it + 1 ) != next_word_it.end() )
{
(*dict_it)++;
++dict_it;

@ -20,13 +20,13 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#ifndef QASSISTANTINDEX_H
#define QASSISTANTINDEX_H
#ifndef TQASSISTANTINDEX_H
#define TQASSISTANTINDEX_H
#include <qstringlist.h>
#include <qdict.h>
#include <qdatastream.h>
#include <qobject.h>
#include <tqstringlist.h>
#include <tqdict.h>
#include <tqdatastream.h>
#include <tqobject.h>
namespace QtAs
{
@ -55,43 +55,44 @@ struct Document
return frequency < doc.frequency;
}
Q_INT16 docNumber;
Q_INT16 frequency;
TQ_INT16 docNumber;
TQ_INT16 frequency;
};
QDataStream &operator>>( QDataStream &s, Document &l );
QDataStream &operator<<( QDataStream &s, const Document &l );
TQDataStream &operator>>( TQDataStream &s, Document &l );
TQDataStream &operator<<( TQDataStream &s, const Document &l );
class Index : public QObject
class Index : public TQObject
{
Q_OBJECT
TQ_OBJECT
public:
struct Entry
{
Entry( int d ) { documents.append( Document( d, 1 ) ); }
Entry( QValueList<Document> l ) : documents( l ) {}
QValueList<Document> documents;
Entry( TQValueList<Document> l ) : documents( l ) {}
TQValueList<Document> documents;
};
struct PosEntry
{
PosEntry( int p ) { positions.append( p ); }
QValueList<uint> positions;
TQValueList<uint> positions;
};
Index( const QString &dp, const QString &hp );
Index( const QStringList &dl, const QString &hp );
Index( const TQString &dp, const TQString &hp );
Index( const TQStringList &dl, const TQString &hp );
void writeDict();
bool readDict();
bool makeIndex();
QStringList query( const QStringList&, const QStringList&, const QStringList& );
TQStringList query( const TQStringList&, const TQStringList&, const TQStringList& );
void setDictionaryFile( const QString& );
void setDocListFile( const QString& );
void setDocList( const QStringList & );
QString getCharsSplit() const { return m_charssplit; }
QString getCharsPartOfWord() const { return m_charsword; }
void setDictionaryFile( const TQString& );
void setDocListFile( const TQString& );
void setDocList( const TQStringList & );
TQString getCharsSplit() const { return m_charssplit; }
TQString getCharsPartOfWord() const { return m_charsword; }
signals:
void indexingProgress( int );
@ -101,51 +102,51 @@ class Index : public QObject
private:
void setupDocumentList();
bool parseDocumentToStringlist( const QString& filename, QStringList& tokenlist );
void parseDocument( const QString& filename, int docnum );
void insertInDict( const QString&, int );
bool parseDocumentToStringlist( const TQString& filename, TQStringList& tokenlist );
void parseDocument( const TQString& filename, int docnum );
void insertInDict( const TQString&, int );
void writeDocumentList();
bool readDocumentList();
QStringList getWildcardTerms( const QString& );
QStringList split( const QString& );
QValueList<Document> setupDummyTerm( const QStringList& );
bool searchForPhrases( const QStringList &phrases, const QStringList &words, const QString &filename );
QStringList docList;
QDict<Entry> dict;
QDict<PosEntry> miniDict;
QString docPath;
QString dictFile;
QString docListFile;
TQStringList getWildcardTerms( const TQString& );
TQStringList split( const TQString& );
TQValueList<Document> setupDummyTerm( const TQStringList& );
bool searchForPhrases( const TQStringList &phrases, const TQStringList &words, const TQString &filename );
TQStringList docList;
TQDict<Entry> dict;
TQDict<PosEntry> miniDict;
TQString docPath;
TQString dictFile;
TQString docListFile;
bool lastWindowClosed;
// Those characters are splitters (i.e. split the word), but added themselves into dictionary too.
// This makes the dictionary MUCH larger, but ensure that for the piece of "window->print" both
// search for "print" and "->print" will find it.
QString m_charssplit;
TQString m_charssplit;
// Those characters are parts of word - for example, '_' is here, and search for _debug will find only _debug.
QString m_charsword;
TQString m_charsword;
};
struct Term
{
Term( const QString &t, int f, QValueList<Document> l ) : term( t ), frequency( f ), documents( l ) {}
Term( const TQString &t, int f, TQValueList<Document> l ) : term( t ), frequency( f ), documents( l ) {}
QString term;
TQString term;
int frequency;
QValueList<Document> documents;
TQValueList<Document> documents;
};
class TermList : public QPtrList<Term>
class TermList : public TQPtrList<Term>
{
public:
TermList() : QPtrList<Term>() {}
int compareItems( QPtrCollection::Item i1, QPtrCollection::Item i2 );
TermList() : TQPtrList<Term>() {}
int compareItems( TQPtrCollection::Item i1, TQPtrCollection::Item i2 );
};
};
#endif /* QASSISTANTINDEX_H */
#endif /* TQASSISTANTINDEX_H */

@ -19,13 +19,13 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#include <qtoolbutton.h>
#include <qcombobox.h>
#include <qlineedit.h>
#include <qtextedit.h>
#include <qaccel.h>
#include <qpopupmenu.h>
#include <qmenubar.h>
#include <tqtoolbutton.h>
#include <tqcombobox.h>
#include <tqlineedit.h>
#include <tqtextedit.h>
#include <tqaccel.h>
#include <tqpopupmenu.h>
#include <tqmenubar.h>
#include "libchmfile.h"
#include "libchmfileimpl.h"
@ -41,143 +41,143 @@
#include "kchmsearchtoolbar.moc"
static KQPopupMenu *menu_langlist, *menu_enclist;
static KTQPopupMenu *menu_langlist, *menu_enclist;
KCHMSearchAndViewToolbar::KCHMSearchAndViewToolbar( KCHMMainWindow * parent )
: QToolBar (parent)
KCHMSearchAndViewToolbar::KCHMSearchAndViewToolbar( KCHMMainWindow * tqparent )
: TQToolBar (tqparent)
{
// Toolbar label
setLabel( i18n( "Find in page") );
// Load the pixmaps
QPixmap iconPrev (*gIconStorage.getToolbarPixmap(KCHMIconStorage::findprev));
QPixmap iconNext (*gIconStorage.getToolbarPixmap(KCHMIconStorage::findnext));
QPixmap iconFontInc (*gIconStorage.getToolbarPixmap(KCHMIconStorage::view_increase));
QPixmap iconFontDec (*gIconStorage.getToolbarPixmap(KCHMIconStorage::view_decrease));
QPixmap iconViewSource (*gIconStorage.getToolbarPixmap(KCHMIconStorage::viewsource));
QPixmap iconAddBookmark (*gIconStorage.getToolbarPixmap(KCHMIconStorage::bookmark_add));
QPixmap iconNextPage (*gIconStorage.getToolbarPixmap(KCHMIconStorage::next_page));
QPixmap iconPrevPage (*gIconStorage.getToolbarPixmap(KCHMIconStorage::prev_page));
QPixmap iconLocateInContent (*gIconStorage.getToolbarPixmap(KCHMIconStorage::locate_in_content));
TQPixmap iconPrev (*gIconStorage.getToolbarPixmap(KCHMIconStorage::findprev));
TQPixmap iconNext (*gIconStorage.getToolbarPixmap(KCHMIconStorage::findnext));
TQPixmap iconFontInc (*gIconStorage.getToolbarPixmap(KCHMIconStorage::view_increase));
TQPixmap iconFontDec (*gIconStorage.getToolbarPixmap(KCHMIconStorage::view_decrease));
TQPixmap iconViewSource (*gIconStorage.getToolbarPixmap(KCHMIconStorage::viewsource));
TQPixmap iconAddBookmark (*gIconStorage.getToolbarPixmap(KCHMIconStorage::bookmark_add));
TQPixmap iconNextPage (*gIconStorage.getToolbarPixmap(KCHMIconStorage::next_page));
TQPixmap iconPrevPage (*gIconStorage.getToolbarPixmap(KCHMIconStorage::prev_page));
TQPixmap iconLocateInContent (*gIconStorage.getToolbarPixmap(KCHMIconStorage::locate_in_content));
// Create the combobox to enter the find text
m_findBox = new QComboBox (TRUE, this);
m_findBox = new TQComboBox (TRUE, this);
m_findBox->setMinimumWidth (200);
connect( m_findBox->lineEdit(), SIGNAL( returnPressed() ), this, SLOT( onReturnPressed() ) );
QWhatsThis::add( m_findBox, i18n( "Enter here the text to search in the current page.") );
connect( m_findBox->lineEdit(), TQT_SIGNAL( returnPressed() ), this, TQT_SLOT( onReturnPressed() ) );
TQWhatsThis::add( m_findBox, i18n( "Enter here the text to search in the current page.") );
QAccel *acc = new QAccel( this );
acc->connectItem( acc->insertItem(Key_F+CTRL), this, SLOT( onAccelFocusSearchField() ) );
TQAccel *acc = new TQAccel( this );
acc->connectItem( acc->insertItem(Key_F+CTRL), this, TQT_SLOT( onAccelFocusSearchField() ) );
// Button 'prevous search result'
m_buttonPrev = new QToolButton (iconPrev,
m_buttonPrev = new TQToolButton (iconPrev,
i18n( "Previous search result"),
QString::null,
TQString(),
this,
SLOT(onBtnPrevSearchResult()),
TQT_SLOT(onBtnPrevSearchResult()),
this);
QWhatsThis::add( m_buttonPrev, i18n( "Click this button to find previous search result.") );
TQWhatsThis::add( m_buttonPrev, i18n( "Click this button to find previous search result.") );
// Button 'next search result'
m_buttonNext = new QToolButton (iconNext,
m_buttonNext = new TQToolButton (iconNext,
i18n( "Next search result"),
QString::null,
TQString(),
this,
SLOT(onBtnNextSearchResult()),
TQT_SLOT(onBtnNextSearchResult()),
this);
QWhatsThis::add( m_buttonNext, i18n( "Click this button to find next search result.") );
TQWhatsThis::add( m_buttonNext, i18n( "Click this button to find next search result.") );
// Button 'locate in content'
m_buttonLocateInContent = new QToolButton( iconLocateInContent,
m_buttonLocateInContent = new TQToolButton( iconLocateInContent,
i18n( "Locate this topic in content window"),
QString::null,
TQString(),
this,
SLOT( onBtnLocateInContentWindow() ),
TQT_SLOT( onBtnLocateInContentWindow() ),
this );
QWhatsThis::add( m_buttonLocateInContent, i18n( "Click this button to find current topic in the content window, and open it.") );
TQWhatsThis::add( m_buttonLocateInContent, i18n( "Click this button to find current topic in the content window, and open it.") );
// Button 'increase font size'
m_buttonFontInc = new QToolButton (iconFontInc,
m_buttonFontInc = new TQToolButton (iconFontInc,
i18n( "Increase font size"),
QString::null,
TQString(),
this,
SLOT(onBtnFontInc()),
TQT_SLOT(onBtnFontInc()),
this);
QWhatsThis::add( m_buttonFontInc, i18n( "Click this button to increase the font size.") );
TQWhatsThis::add( m_buttonFontInc, i18n( "Click this button to increase the font size.") );
// Button 'decrease font size'
m_buttonFontDec = new QToolButton (iconFontDec,
m_buttonFontDec = new TQToolButton (iconFontDec,
i18n( "Decrease font size"),
QString::null,
TQString(),
this,
SLOT(onBtnFontDec()),
TQT_SLOT(onBtnFontDec()),
this);
QWhatsThis::add( m_buttonFontDec, i18n( "Click this button to decrease the font size.") );
TQWhatsThis::add( m_buttonFontDec, i18n( "Click this button to decrease the font size.") );
// Button 'view HTML source'
m_buttonViewSource = new QToolButton (iconViewSource,
m_buttonViewSource = new TQToolButton (iconViewSource,
i18n( "View HTML source"),
QString::null,
TQString(),
this,
SLOT(onBtnViewSource()),
TQT_SLOT(onBtnViewSource()),
this);
QWhatsThis::add( m_buttonViewSource, i18n( "Click this button to open a separate window with the page HTML source.") );
TQWhatsThis::add( m_buttonViewSource, i18n( "Click this button to open a separate window with the page HTML source.") );
// Button 'add a bookmark'
m_buttonAddBookmark = new QToolButton (iconAddBookmark,
m_buttonAddBookmark = new TQToolButton (iconAddBookmark,
i18n( "Add to bookmarks"),
QString::null,
TQString(),
this,
SLOT(onBtnAddBookmark()),
TQT_SLOT(onBtnAddBookmark()),
this);
QWhatsThis::add( m_buttonAddBookmark, i18n( "Click this button to add the current page to the bookmarks list.") );
TQWhatsThis::add( m_buttonAddBookmark, i18n( "Click this button to add the current page to the bookmarks list.") );
m_buttonPrevPageInTOC = new QToolButton( iconPrevPage,
m_buttonPrevPageInTOC = new TQToolButton( iconPrevPage,
i18n( "Prev page in TOC"),
QString::null,
TQString(),
this,
SLOT(onBtnPrevPageInToc()),
TQT_SLOT(onBtnPrevPageInToc()),
this);
QWhatsThis::add( m_buttonAddBookmark, i18n( "Click this button to go to previous page in Table Of Content.") );
TQWhatsThis::add( m_buttonAddBookmark, i18n( "Click this button to go to previous page in Table Of Content.") );
m_buttonNextPageInTOC = new QToolButton (iconNextPage,
m_buttonNextPageInTOC = new TQToolButton (iconNextPage,
i18n( "Next page in TOC"),
QString::null,
TQString(),
this,
SLOT(onBtnNextPageInToc()),
TQT_SLOT(onBtnNextPageInToc()),
this);
QWhatsThis::add( m_buttonAddBookmark, i18n( "Click this button to go to next page in Table of Content.") );
TQWhatsThis::add( m_buttonAddBookmark, i18n( "Click this button to go to next page in Table of Content.") );
// Create the approptiate menu entries in 'View' main menu
m_MenuView = new KQPopupMenu( parent );
parent->menuBar()->insertItem( i18n( "&View"), m_MenuView );
m_MenuView = new KTQPopupMenu( tqparent );
tqparent->menuBar()->insertItem( i18n( "&View"), m_MenuView );
m_MenuView->insertItem( i18n( "&Increase font"), this, SLOT(onBtnFontInc()), CTRL+Key_Plus );
m_MenuView->insertItem( i18n( "&Decrease font"), this, SLOT(onBtnFontDec()), CTRL+Key_Minus );
m_MenuView->insertItem( i18n( "&View HTML source"), this, SLOT(onBtnViewSource()), CTRL+Key_U );
m_MenuView->insertItem( i18n( "&Increase font"), this, TQT_SLOT(onBtnFontInc()), CTRL+Key_Plus );
m_MenuView->insertItem( i18n( "&Decrease font"), this, TQT_SLOT(onBtnFontDec()), CTRL+Key_Minus );
m_MenuView->insertItem( i18n( "&View HTML source"), this, TQT_SLOT(onBtnViewSource()), CTRL+Key_U );
m_MenuView->insertSeparator();
m_MenuView->insertItem( i18n( "&Bookmark this page"), this, SLOT(onBtnAddBookmark()), CTRL+Key_T );
m_MenuView->insertItem( i18n( "&Bookmark this page"), this, TQT_SLOT(onBtnAddBookmark()), CTRL+Key_T );
m_MenuView->insertSeparator();
m_menuShowFullscreenMenuID = m_MenuView->insertItem( i18n( "&Full screen"), this,
SLOT(onBtnFullScreen()), Key_F11 );
TQT_SLOT(onBtnFullScreen()), Key_F11 );
m_menuShowContentWindowMenuID = m_MenuView->insertItem( i18n( "&Show contents window"), this,
SLOT(onBtnToggleContentWindow()), Key_F9 );
TQT_SLOT(onBtnToggleContentWindow()), Key_F9 );
m_MenuView->insertItem( i18n( "&Locate in contents window"), this,
SLOT(onBtnLocateInContentWindow()), CTRL+Key_L );
TQT_SLOT(onBtnLocateInContentWindow()), CTRL+Key_L );
m_MenuView->setItemChecked( m_menuShowFullscreenMenuID, false );
m_MenuView->setItemChecked( m_menuShowContentWindowMenuID, true );
m_MenuView->insertSeparator();
// Create the language selection menu.
menu_langlist = new KQPopupMenu( parent );
KQPopupMenu * menu_sublang = 0;
menu_langlist = new KTQPopupMenu( tqparent );
KTQPopupMenu * menu_sublang = 0;
// Because the encoding menu is very large, it is not reasonable to have a slot for every item.
// It is simplier just to use a single slot for any menu item of this submenu.
connect (menu_langlist, SIGNAL( activated(int) ), this, SLOT ( onMenuActivated(int) ));
connect (menu_langlist, TQT_SIGNAL( activated(int) ), this, TQT_SLOT ( onMenuActivated(int) ));
// Add the language entries
const LCHMTextEncoding * enctable = LCHMFileImpl::getTextEncodingTable();
@ -196,8 +196,8 @@ KCHMSearchAndViewToolbar::KCHMSearchAndViewToolbar( KCHMMainWindow * parent )
// If the menu is already created, add to it
if ( !menu_sublang )
{
menu_sublang = new KQPopupMenu( menu_langlist );
connect (menu_sublang, SIGNAL( activated(int) ), this, SLOT ( onMenuActivated(int) ));
menu_sublang = new KTQPopupMenu( menu_langlist );
connect (menu_sublang, TQT_SIGNAL( activated(int) ), this, TQT_SLOT ( onMenuActivated(int) ));
}
menu_sublang->insertItem( item->sublanguage, idx );
@ -222,10 +222,10 @@ KCHMSearchAndViewToolbar::KCHMSearchAndViewToolbar( KCHMMainWindow * parent )
m_checkedLanguageInMenu = -1;
// Special menu for very smart people just to select codepage
QMap<QString,bool> addedCharsets;
menu_enclist = new KQPopupMenu( parent );
TQMap<TQString,bool> addedCharsets;
menu_enclist = new KTQPopupMenu( tqparent );
connect (menu_enclist, SIGNAL( activated(int) ), this, SLOT ( onMenuActivated(int) ));
connect (menu_enclist, TQT_SIGNAL( activated(int) ), this, TQT_SLOT ( onMenuActivated(int) ));
// Add the codepage entries
for ( idx = 0; (enctable + idx)->language; idx++ )
@ -233,7 +233,7 @@ KCHMSearchAndViewToolbar::KCHMSearchAndViewToolbar( KCHMMainWindow * parent )
const LCHMTextEncoding * item = enctable + idx;
// This menu is only for charsets, so we won't add duplicate charset twice
if ( addedCharsets.find( item->qtcodec ) != addedCharsets.end() )
if ( addedCharsets.tqfind( item->qtcodec ) != addedCharsets.end() )
continue;
addedCharsets[ item->qtcodec ] = true;
@ -242,7 +242,7 @@ KCHMSearchAndViewToolbar::KCHMSearchAndViewToolbar( KCHMMainWindow * parent )
m_MenuView->insertItem( i18n( "&Set codepage"), menu_enclist );
QWhatsThis::whatsThisButton( this );
TQWhatsThis::whatsThisButton( this );
}
void KCHMSearchAndViewToolbar::setEnabled( bool enable )
@ -277,7 +277,7 @@ void KCHMSearchAndViewToolbar::onBtnNextSearchResult( )
void KCHMSearchAndViewToolbar::search( bool search_forward )
{
QString searchexpr = m_findBox->lineEdit()->text();
TQString searchexpr = m_findBox->lineEdit()->text();
if ( searchexpr.isEmpty() )
return;
@ -297,23 +297,23 @@ void KCHMSearchAndViewToolbar::onBtnFontDec( )
void KCHMSearchAndViewToolbar::onBtnViewSource( )
{
QString text;
TQString text;
if ( !::mainWindow->chmFile()->getFileContentAsString( &text, ::mainWindow->currentBrowser()->getOpenedPage() ) )
return;
if ( appConfig.m_advUseInternalEditor )
{
QTextEdit * editor = new QTextEdit ( 0 );
editor->setTextFormat ( Qt::PlainText );
TQTextEdit * editor = new TQTextEdit ( 0 );
editor->setTextFormat ( TQt::PlainText );
editor->setText (text);
editor->setCaption ( QString(APP_NAME) + " - view HTML source of " + ::mainWindow->currentBrowser()->getOpenedPage() );
editor->setCaption ( TQString(APP_NAME) + " - view HTML source of " + ::mainWindow->currentBrowser()->getOpenedPage() );
editor->resize (800, 600);
editor->show();
}
else
{
QFile file;
TQFile file;
m_tempFileKeeper.generateTempFile( file );
file.writeBlock( text.utf8() );
@ -377,7 +377,7 @@ void KCHMSearchAndViewToolbar::onBtnNextPageInToc()
if ( !current )
return;
QListViewItemIterator lit( current );
TQListViewItemIterator lit( current );
lit++;
if ( lit.current() )
@ -397,7 +397,7 @@ void KCHMSearchAndViewToolbar::onBtnPrevPageInToc()
if ( !current )
return;
QListViewItemIterator lit( current );
TQListViewItemIterator lit( current );
lit--;
if ( lit.current() )

@ -31,11 +31,12 @@
/**
@author Georgy Yunaev
*/
class KCHMSearchAndViewToolbar : public QToolBar
class KCHMSearchAndViewToolbar : public TQToolBar
{
Q_OBJECT
TQ_OBJECT
public:
KCHMSearchAndViewToolbar (KCHMMainWindow *parent);
KCHMSearchAndViewToolbar (KCHMMainWindow *tqparent);
void setEnabled (bool enable);
void setChosenEncodingInMenu( const LCHMTextEncoding * encoding );
@ -63,17 +64,17 @@ class KCHMSearchAndViewToolbar : public QToolBar
private:
void search (bool forward);
KQPopupMenu * m_MenuView;
QComboBox * m_findBox;
QToolButton * m_buttonPrev;
QToolButton * m_buttonNext;
QToolButton * m_buttonFontInc;
QToolButton * m_buttonFontDec;
QToolButton * m_buttonViewSource;
QToolButton * m_buttonAddBookmark;
QToolButton * m_buttonNextPageInTOC;
QToolButton * m_buttonPrevPageInTOC;
QToolButton * m_buttonLocateInContent;
KTQPopupMenu * m_MenuView;
TQComboBox * m_findBox;
TQToolButton * m_buttonPrev;
TQToolButton * m_buttonNext;
TQToolButton * m_buttonFontInc;
TQToolButton * m_buttonFontDec;
TQToolButton * m_buttonViewSource;
TQToolButton * m_buttonAddBookmark;
TQToolButton * m_buttonNextPageInTOC;
TQToolButton * m_buttonPrevPageInTOC;
TQToolButton * m_buttonLocateInContent;
int m_checkedLanguageInMenu;
int m_checkedEncodingInMenu;
@ -81,7 +82,7 @@ class KCHMSearchAndViewToolbar : public QToolBar
int m_menuShowFullscreenMenuID;
int m_menuShowContentWindowMenuID;
KQTempFileKeeper m_tempFileKeeper;
KTQTempFileKeeper m_tempFileKeeper;
};
#endif

@ -31,36 +31,36 @@
#include "kchmsearchwindow.moc"
KCHMSearchWindow::KCHMSearchWindow( QWidget * parent, const char * name, WFlags f )
: QWidget (parent, name, f)
KCHMSearchWindow::KCHMSearchWindow( TQWidget * tqparent, const char * name, WFlags f )
: TQWidget (tqparent, name, f)
{
QVBoxLayout * layout = new QVBoxLayout (this);
layout->setMargin(6);
layout->setSpacing(6);
TQVBoxLayout * tqlayout = new TQVBoxLayout (this);
tqlayout->setMargin(6);
tqlayout->setSpacing(6);
// Labels <type words to search> and <help>
QHBoxLayout * labellayout = new QHBoxLayout();
labellayout->addWidget( new QLabel( i18n( "Type in word(s) to search for:"), this) );
labellayout->addStretch( 10 );
TQHBoxLayout * labeltqlayout = new TQHBoxLayout();
labeltqlayout->addWidget( new TQLabel( i18n( "Type in word(s) to search for:"), this) );
labeltqlayout->addStretch( 10 );
KCHMClickableLabel * helplink = new KCHMClickableLabel( i18n( "<a href=\"q\"><b>Help</b></a>"), this );
connect( helplink, SIGNAL( clicked() ), this, SLOT( onHelpClicked() ) );
helplink->setCursor( QCursor( Qt::PointingHandCursor ) );
connect( helplink, TQT_SIGNAL( clicked() ), this, TQT_SLOT( onHelpClicked() ) );
helplink->setCursor( TQCursor( TQt::PointingHandCursor ) );
labellayout->addWidget ( helplink );
layout->addLayout( labellayout );
labeltqlayout->addWidget ( helplink );
tqlayout->addLayout( labeltqlayout );
m_searchQuery = new QComboBox (TRUE, this);
m_searchQuery = new TQComboBox (TRUE, this);
m_searchQuery->setFocus();
m_searchQuery->setMaxCount (10);
m_searchQuery->setSizePolicy ( QSizePolicy ( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
m_searchQuery->tqsetSizePolicy ( TQSizePolicy ( TQSizePolicy::Expanding, TQSizePolicy::Fixed ) );
QPushButton * searchButton = new QPushButton ( i18n("Go"), this);
searchButton->setSizePolicy ( QSizePolicy ( QSizePolicy::Minimum, QSizePolicy::Fixed ) );
TQPushButton * searchButton = new TQPushButton ( i18n("Go"), this);
searchButton->tqsetSizePolicy ( TQSizePolicy ( TQSizePolicy::Minimum, TQSizePolicy::Fixed ) );
QHBoxLayout * hlayout = new QHBoxLayout ( layout );
hlayout->addWidget ( m_searchQuery );
hlayout->addWidget ( searchButton );
TQHBoxLayout * htqlayout = new TQHBoxLayout ( tqlayout );
htqlayout->addWidget ( m_searchQuery );
htqlayout->addWidget ( searchButton );
m_searchList = new KQListView (this);
m_searchList->addColumn( i18n( "Title" ) );
@ -68,34 +68,34 @@ KCHMSearchWindow::KCHMSearchWindow( QWidget * parent, const char * name, WFlags
m_searchList->setShowToolTips(true);
connect( searchButton,
SIGNAL( clicked () ),
TQT_SIGNAL( clicked () ),
this,
SLOT( onReturnPressed() ) );
TQT_SLOT( onReturnPressed() ) );
connect( m_searchQuery->lineEdit(),
SIGNAL( returnPressed() ),
TQT_SIGNAL( returnPressed() ),
this,
SLOT( onReturnPressed() ) );
TQT_SLOT( onReturnPressed() ) );
connect( m_searchList,
SIGNAL( doubleClicked ( QListViewItem *, const QPoint &, int) ),
TQT_SIGNAL( doubleClicked ( TQListViewItem *, const TQPoint &, int) ),
this,
SLOT( onDoubleClicked ( QListViewItem *, const QPoint &, int) ) );
TQT_SLOT( onDoubleClicked ( TQListViewItem *, const TQPoint &, int) ) );
connect( m_searchList,
SIGNAL( contextMenuRequested( QListViewItem *, const QPoint& , int ) ),
TQT_SIGNAL( contextMenuRequested( TQListViewItem *, const TQPoint& , int ) ),
this,
SLOT( slotContextMenuRequested ( QListViewItem *, const QPoint &, int ) ) );
TQT_SLOT( slotContextMenuRequested ( TQListViewItem *, const TQPoint &, int ) ) );
//layout->addSpacing (10);
layout->addWidget (m_searchList);
//tqlayout->addSpacing (10);
tqlayout->addWidget (m_searchList);
new KCHMListItemTooltip( m_searchList );
m_contextMenu = 0;
m_searchEngine = 0;
}
void KCHMSearchWindow::invalidate( )
void KCHMSearchWindow::tqinvalidate( )
{
m_searchList->clear();
m_searchQuery->clear();
@ -107,8 +107,8 @@ void KCHMSearchWindow::invalidate( )
void KCHMSearchWindow::onReturnPressed( )
{
QStringList results;
QString text = m_searchQuery->lineEdit()->text();
TQStringList results;
TQString text = m_searchQuery->lineEdit()->text();
if ( text.isEmpty() )
return;
@ -137,7 +137,7 @@ void KCHMSearchWindow::onReturnPressed( )
}
void KCHMSearchWindow::onDoubleClicked( QListViewItem *item, const QPoint &, int)
void KCHMSearchWindow::onDoubleClicked( TQListViewItem *item, const TQPoint &, int)
{
if ( !item )
return;
@ -165,19 +165,19 @@ void KCHMSearchWindow::onHelpClicked( )
{
if ( appConfig.m_useSearchEngine == KCHMConfig::SEARCH_USE_MINE )
{
QMessageBox::information ( this,
TQMessageBox::information ( this,
i18n( "How to use search"),
i18n( "<html><p>The improved search engine allows you to search for a word, symbol or phrase, which is set of words and symbols included in quotes. Only the documents which include all the terms speficide in th search query are shown; no prefixes needed.<p>Unlike MS CHM internal search index, my improved search engine indexes everything, including special symbols. Therefore it is possible to search (and find!) for something like <i>$q = new ChmFile();</i>. This search also fully supports Unicode, which means that you can search in non-English documents.<p>If you want to search for a quote symbol, use quotation mark instead. The engine treats a quote and a quotation mark as the same symbol, which allows to use them in phrases.</html>") );
i18n( "<html><p>The improved search engine allows you to search for a word, symbol or phrase, which is set of words and symbols included in quotes. Only the documents which include all the terms speficide in th search query are shown; no prefixes needed.<p>Unlike MS CHM internal search index, my improved search engine indexes everything, including special symbols. Therefore it is possible to search (and tqfind!) for something like <i>$q = new ChmFile();</i>. This search also fully supports Unicode, which means that you can search in non-English documents.<p>If you want to search for a quote symbol, use quotation mark instead. The engine treats a quote and a quotation mark as the same symbol, which allows to use them in phrases.</html>") );
}
else
{
QMessageBox::information ( this,
TQMessageBox::information ( this,
i18n( "How to use search"),
i18n( "The search query can contain a few prefixes.\nA set of words inside the quote marks mean that you are searching for exact phrase.\nA word with minus sign means that it should be absent in the search result.\nA word with plus mark or without any mark means that it must be present in the search result.\n\nNote that only letters and digits are indexed.\nYou cannot search for non-character symbols other than underscope, and those symbols will be removed from the search query.\nFor example, search for 'C' will give the same result as searching for 'C++'.") );
}
}
void KCHMSearchWindow::slotContextMenuRequested( QListViewItem * item, const QPoint & point, int )
void KCHMSearchWindow::slotContextMenuRequested( TQListViewItem * item, const TQPoint & point, int )
{
if ( !m_contextMenu )
m_contextMenu = ::mainWindow->currentBrowser()->createListItemContextMenu( this );
@ -206,14 +206,14 @@ bool KCHMSearchWindow::initSearchEngine( )
}
void KCHMSearchWindow::execSearchQueryInGui( const QString & query )
void KCHMSearchWindow::execSearchQueryInGui( const TQString & query )
{
m_searchQuery->lineEdit()->setText( query );
onReturnPressed();
}
bool KCHMSearchWindow::searchQuery( const QString & query, QStringList * results )
bool KCHMSearchWindow::searchQuery( const TQString & query, TQStringList * results )
{
if ( appConfig.m_useSearchEngine == KCHMConfig::SEARCH_USE_MINE )
{
@ -222,7 +222,7 @@ bool KCHMSearchWindow::searchQuery( const QString & query, QStringList * results
}
else if ( !::mainWindow->chmFile()->hasSearchTable() )
{
QMessageBox::information ( this,
TQMessageBox::information ( this,
i18n( "Search is not available" ),
i18n( "<p>The search feature is not avaiable for this chm file."
"<p>The old search engine depends on indexes present in chm files itself. Not every chm file has an index; it is set up"

@ -34,12 +34,13 @@
class KCHMSearchEngine;
class KCHMClickableLabel : public QLabel
class KCHMClickableLabel : public TQLabel
{
Q_OBJECT
TQ_OBJECT
public:
KCHMClickableLabel( const QString& label, QWidget * parent )
: QLabel( label, parent ) {};
KCHMClickableLabel( const TQString& label, TQWidget * tqparent )
: TQLabel( label, tqparent ) {};
virtual ~KCHMClickableLabel() {};
@ -47,37 +48,38 @@ class KCHMClickableLabel : public QLabel
void clicked();
protected:
virtual void mousePressEvent ( QMouseEvent * ) { emit clicked(); }
virtual void mousePressEvent ( TQMouseEvent * ) { emit clicked(); }
};
class KCHMSearchWindow : public QWidget
class KCHMSearchWindow : public TQWidget
{
Q_OBJECT
TQ_OBJECT
public:
KCHMSearchWindow ( QWidget * parent = 0, const char * name = 0, WFlags f = 0 );
KCHMSearchWindow ( TQWidget * tqparent = 0, const char * name = 0, WFlags f = 0 );
void invalidate();
void tqinvalidate();
void restoreSettings (const KCHMSettings::search_saved_settings_t& settings);
void saveSettings (KCHMSettings::search_saved_settings_t& settings);
void execSearchQueryInGui( const QString& query );
bool searchQuery( const QString& query, QStringList * results );
void execSearchQueryInGui( const TQString& query );
bool searchQuery( const TQString& query, TQStringList * results );
public slots:
void slotContextMenuRequested ( QListViewItem *item, const QPoint &point, int column );
void slotContextMenuRequested ( TQListViewItem *item, const TQPoint &point, int column );
private slots:
void onHelpClicked();
void onReturnPressed ();
void onDoubleClicked ( QListViewItem *, const QPoint &, int);
void onDoubleClicked ( TQListViewItem *, const TQPoint &, int);
private:
bool initSearchEngine();
private:
QComboBox * m_searchQuery;
TQComboBox * m_searchQuery;
KQListView * m_searchList;
KQPopupMenu * m_contextMenu;
KTQPopupMenu * m_contextMenu;
KCHMSearchEngine* m_searchEngine;
};

@ -19,15 +19,15 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#include <qfile.h>
#include <qfileinfo.h>
#include <qdatastream.h>
#include <tqfile.h>
#include <tqfileinfo.h>
#include <tqdatastream.h>
#include "kchmsettings.h"
#include "kchmconfig.h"
static Q_INT32 SETTINGS_MAGIC = 0xD8AB4E76;
static Q_INT32 SETTINGS_VERSION = 4;
static TQ_INT32 SETTINGS_MAGIC = 0xD8AB4E76;
static TQ_INT32 SETTINGS_VERSION = 4;
/*
* The order is important!
@ -54,8 +54,8 @@ enum marker_t
MARKER_END = 0x7FFF
};
// Helpers for serialization of SavedBookmark through QDataStream
static inline QDataStream& operator<< ( QDataStream& s, const KCHMSettings::SavedBookmark& b )
// Helpers for serialization of SavedBookmark through TQDataStream
static inline TQDataStream& operator<< ( TQDataStream& s, const KCHMSettings::SavedBookmark& b )
{
s << b.name;
s << b.url;
@ -63,7 +63,7 @@ static inline QDataStream& operator<< ( QDataStream& s, const KCHMSettings::Save
return s;
}
static inline QDataStream& operator>> ( QDataStream& s, KCHMSettings::SavedBookmark& b )
static inline TQDataStream& operator>> ( TQDataStream& s, KCHMSettings::SavedBookmark& b )
{
s >> b.name;
s >> b.url;
@ -71,8 +71,8 @@ static inline QDataStream& operator>> ( QDataStream& s, KCHMSettings::SavedBookm
return s;
}
// Helpers for serialization of SavedViewWindow through QDataStream
static inline QDataStream& operator<< ( QDataStream& s, const KCHMSettings::SavedViewWindow& b )
// Helpers for serialization of SavedViewWindow through TQDataStream
static inline TQDataStream& operator<< ( TQDataStream& s, const KCHMSettings::SavedViewWindow& b )
{
// Store the version first. Later we can increase it when adding new members.
s << 1;
@ -82,9 +82,9 @@ static inline QDataStream& operator<< ( QDataStream& s, const KCHMSettings::Save
return s;
}
static inline QDataStream& operator>> ( QDataStream& s, KCHMSettings::SavedViewWindow& b )
static inline TQDataStream& operator>> ( TQDataStream& s, KCHMSettings::SavedViewWindow& b )
{
Q_INT32 version;
TQ_INT32 version;
s >> version;
s >> b.url;
@ -106,7 +106,7 @@ KCHMSettings::KCHMSettings( )
}
bool KCHMSettings::loadSettings( const QString & filename )
bool KCHMSettings::loadSettings( const TQString & filename )
{
m_activetabsystem = 0;
m_activetabwindow = 0;
@ -116,11 +116,11 @@ bool KCHMSettings::loadSettings( const QString & filename )
m_bookmarks.clear();
m_viewwindows.clear();
QFileInfo finfo ( filename );
TQFileInfo finfo ( filename );
m_settingsFile = QString::null;
m_searchDictFile = QString::null;
m_searchDocFile = QString::null;
m_settingsFile = TQString();
m_searchDictFile = TQString();
m_searchDocFile = TQString();
if ( !finfo.size() )
return false;
@ -131,15 +131,15 @@ bool KCHMSettings::loadSettings( const QString & filename )
getFilenames( filename, &m_settingsFile, &m_searchDictFile, &m_searchDocFile );
QFile file( m_settingsFile );
TQFile file( m_settingsFile );
if ( !file.open (IO_ReadOnly) )
return false; // it's ok, file may not exist
QDataStream stream (&file);
TQDataStream stream (&file);
// Read and check header
Q_INT32 data;
TQ_INT32 data;
bool complete_read = false;
stream >> data; // magic
@ -224,14 +224,14 @@ bool KCHMSettings::loadSettings( const QString & filename )
bool KCHMSettings::saveSettings( )
{
QFile file( m_settingsFile );
TQFile file( m_settingsFile );
if ( !file.open (IO_WriteOnly) )
{
qWarning ("Could not write settings into file %s: %s", file.name().ascii(), file.errorString().ascii());
qWarning ("Could not write settings into file %s: %s", TQString(file.name()).ascii(), TQString(file.errorString()).ascii());
return false;
}
QDataStream stream (&file);
TQDataStream stream (&file);
// Save header
stream << SETTINGS_MAGIC;
@ -275,22 +275,22 @@ bool KCHMSettings::saveSettings( )
}
void KCHMSettings::removeSettings( const QString & filename )
void KCHMSettings::removeSettings( const TQString & filename )
{
QString settingsfile, dictfile, doclistfile;
TQString settingsfile, dictfile, doclistfile;
getFilenames( filename, &settingsfile, &dictfile, &doclistfile );
QFile::remove( settingsfile );
QFile::remove( dictfile );
QFile::remove( doclistfile );
TQFile::remove( settingsfile );
TQFile::remove( dictfile );
TQFile::remove( doclistfile );
}
void KCHMSettings::getFilenames(const QString & helpfilename, QString * settingsfile, QString * dictfile, QString * doclistfile )
void KCHMSettings::getFilenames(const TQString & helpfilename, TQString * settingsfile, TQString * dictfile, TQString * doclistfile )
{
QFileInfo finfo ( helpfilename );
QString prefix = appConfig.m_datapath + "/" + finfo.baseName();
TQFileInfo finfo ( helpfilename );
TQString prefix = appConfig.m_datapath + "/" + finfo.baseName();
*settingsfile = prefix + ".kchmviewer";
*dictfile = prefix + ".dict";

@ -22,15 +22,15 @@
#ifndef KCHMSETTINGS_H
#define KCHMSETTINGS_H
#include <qstring.h>
#include <qvaluelist.h>
#include <tqstring.h>
#include <tqvaluelist.h>
/**
@author Georgy Yunaev
*/
class SavedBookmark;
class QFileInfo;
class TQFileInfo;
class KCHMSettings
@ -38,21 +38,21 @@ class KCHMSettings
public:
KCHMSettings ();
bool loadSettings (const QString& filename);
bool loadSettings (const TQString& filename);
bool saveSettings ( );
void removeSettings ( const QString& filename );
void removeSettings ( const TQString& filename );
QString searchIndexDictFilename() const { return m_searchDictFile; }
QString searchIndexDocFilename() const { return m_searchDocFile; }
TQString searchIndexDictFilename() const { return m_searchDictFile; }
TQString searchIndexDocFilename() const { return m_searchDocFile; }
class SavedBookmark
{
public:
SavedBookmark() { scroll_y = 0; }
SavedBookmark (QString n, QString u, int y) : name(n), url(u), scroll_y(y) {};
SavedBookmark (TQString n, TQString u, int y) : name(n), url(u), scroll_y(y) {};
QString name;
QString url;
TQString name;
TQString url;
int scroll_y;
};
@ -60,16 +60,16 @@ class KCHMSettings
{
public:
SavedViewWindow() { scroll_y = 0; zoom = 0; }
SavedViewWindow (QString u, int y, int z) : url(u), scroll_y(y), zoom(z) {};
SavedViewWindow (TQString u, int y, int z) : url(u), scroll_y(y), zoom(z) {};
QString url;
TQString url;
int scroll_y;
int zoom;
};
typedef QValueList<QString> search_saved_settings_t;
typedef QValueList<SavedBookmark> bookmark_saved_settings_t;
typedef QValueList<SavedViewWindow> viewindow_saved_settings_t;
typedef TQValueList<TQString> search_saved_settings_t;
typedef TQValueList<SavedBookmark> bookmark_saved_settings_t;
typedef TQValueList<SavedViewWindow> viewindow_saved_settings_t;
int m_window_size_x;
int m_window_size_y;
@ -82,13 +82,13 @@ class KCHMSettings
viewindow_saved_settings_t m_viewwindows;
private:
void getFilenames(const QString & helpfilename, QString * settingsfile, QString * dictfile, QString * doclistfile );
void getFilenames(const TQString & helpfilename, TQString * settingsfile, TQString * dictfile, TQString * doclistfile );
unsigned int m_currentfilesize;
unsigned int m_currentfiledate;
QString m_settingsFile;
QString m_searchDictFile;
QString m_searchDocFile;
TQString m_settingsFile;
TQString m_searchDictFile;
TQString m_searchDocFile;
};
#endif

@ -9,279 +9,279 @@
#include "kchmsetupdialog.h"
#include <qvariant.h>
#include <qpushbutton.h>
#include <qtabwidget.h>
#include <qwidget.h>
#include <qbuttongroup.h>
#include <qradiobutton.h>
#include <qlabel.h>
#include <qspinbox.h>
#include <qcheckbox.h>
#include <qgroupbox.h>
#include <qlineedit.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <tqvariant.h>
#include <tqpushbutton.h>
#include <tqtabwidget.h>
#include <tqwidget.h>
#include <tqbuttongroup.h>
#include <tqradiobutton.h>
#include <tqlabel.h>
#include <tqspinbox.h>
#include <tqcheckbox.h>
#include <tqgroupbox.h>
#include <tqlineedit.h>
#include <tqlayout.h>
#include <tqtooltip.h>
#include <tqwhatsthis.h>
/*
* Constructs a KCHMSetupDialog as a child of 'parent', with the
* Constructs a KCHMSetupDialog as a child of 'tqparent', with the
* name 'name' and widget flags set to 'f'.
*
* The dialog will by default be modeless, unless you set 'modal' to
* TRUE to construct a modal dialog.
*/
KCHMSetupDialog::KCHMSetupDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
: QDialog( parent, name, modal, fl )
KCHMSetupDialog::KCHMSetupDialog( TQWidget* tqparent, const char* name, bool modal, WFlags fl )
: TQDialog( tqparent, name, modal, fl )
{
if ( !name )
setName( "MyDialog1" );
setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1, 0, 0, sizePolicy().hasHeightForWidth() ) );
tqsetSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)1, (TQSizePolicy::SizeType)1, 0, 0, sizePolicy().hasHeightForWidth() ) );
setSizeGripEnabled( FALSE );
setModal( TRUE );
MyDialog1Layout = new QVBoxLayout( this, 11, 6, "MyDialog1Layout");
MyDialog1Layout->setResizeMode( QLayout::Minimum );
MyDialog1Layout = new TQVBoxLayout( this, 11, 6, "MyDialog1Layout");
MyDialog1Layout->setResizeMode( TQLayout::Minimum );
tabWidget = new QTabWidget( this, "tabWidget" );
tabWidget = new TQTabWidget( this, "tabWidget" );
Widget8 = new QWidget( tabWidget, "Widget8" );
Widget8Layout = new QVBoxLayout( Widget8, 11, 6, "Widget8Layout");
Widget8 = new TQWidget( tabWidget, "Widget8" );
Widget8Layout = new TQVBoxLayout( Widget8, 11, 6, "Widget8Layout");
layout4 = new QHBoxLayout( 0, 0, 6, "layout4");
tqlayout4 = new TQHBoxLayout( 0, 0, 6, "tqlayout4");
buttonGroup1 = new QButtonGroup( Widget8, "buttonGroup1" );
buttonGroup1 = new TQButtonGroup( Widget8, "buttonGroup1" );
buttonGroup1->setColumnLayout(0, Qt::Vertical );
buttonGroup1->layout()->setSpacing( 6 );
buttonGroup1->layout()->setMargin( 11 );
buttonGroup1Layout = new QVBoxLayout( buttonGroup1->layout() );
buttonGroup1Layout->setAlignment( Qt::AlignTop );
buttonGroup1->tqlayout()->setSpacing( 6 );
buttonGroup1->tqlayout()->setMargin( 11 );
buttonGroup1Layout = new TQVBoxLayout( buttonGroup1->tqlayout() );
buttonGroup1Layout->tqsetAlignment( TQt::AlignTop );
m_radioOnBeginOpenDialog = new QRadioButton( buttonGroup1, "m_radioOnBeginOpenDialog" );
m_radioOnBeginOpenDialog = new TQRadioButton( buttonGroup1, "m_radioOnBeginOpenDialog" );
buttonGroup1Layout->addWidget( m_radioOnBeginOpenDialog );
m_radioOnBeginOpenLast = new QRadioButton( buttonGroup1, "m_radioOnBeginOpenLast" );
m_radioOnBeginOpenLast = new TQRadioButton( buttonGroup1, "m_radioOnBeginOpenLast" );
buttonGroup1Layout->addWidget( m_radioOnBeginOpenLast );
layout4->addWidget( buttonGroup1 );
tqlayout4->addWidget( buttonGroup1 );
buttonGroup2 = new QButtonGroup( Widget8, "buttonGroup2" );
buttonGroup2 = new TQButtonGroup( Widget8, "buttonGroup2" );
buttonGroup2->setColumnLayout(0, Qt::Vertical );
buttonGroup2->layout()->setSpacing( 6 );
buttonGroup2->layout()->setMargin( 11 );
buttonGroup2Layout = new QVBoxLayout( buttonGroup2->layout() );
buttonGroup2Layout->setAlignment( Qt::AlignTop );
buttonGroup2->tqlayout()->setSpacing( 6 );
buttonGroup2->tqlayout()->setMargin( 11 );
buttonGroup2Layout = new TQVBoxLayout( buttonGroup2->tqlayout() );
buttonGroup2Layout->tqsetAlignment( TQt::AlignTop );
layout3 = new QHBoxLayout( 0, 0, 6, "layout3");
tqlayout3 = new TQHBoxLayout( 0, 0, 6, "tqlayout3");
textLabel1 = new QLabel( buttonGroup2, "textLabel1" );
layout3->addWidget( textLabel1 );
textLabel1 = new TQLabel( buttonGroup2, "textLabel1" );
tqlayout3->addWidget( textLabel1 );
m_historySize = new QSpinBox( buttonGroup2, "m_historySize" );
m_historySize = new TQSpinBox( buttonGroup2, "m_historySize" );
m_historySize->setValue( 10 );
layout3->addWidget( m_historySize );
tqlayout3->addWidget( m_historySize );
textLabel2 = new QLabel( buttonGroup2, "textLabel2" );
layout3->addWidget( textLabel2 );
buttonGroup2Layout->addLayout( layout3 );
textLabel2 = new TQLabel( buttonGroup2, "textLabel2" );
tqlayout3->addWidget( textLabel2 );
buttonGroup2Layout->addLayout( tqlayout3 );
m_rememberHistoryInfo = new QCheckBox( buttonGroup2, "m_rememberHistoryInfo" );
m_rememberHistoryInfo = new TQCheckBox( buttonGroup2, "m_rememberHistoryInfo" );
buttonGroup2Layout->addWidget( m_rememberHistoryInfo );
layout4->addWidget( buttonGroup2 );
Widget8Layout->addLayout( layout4 );
tqlayout4->addWidget( buttonGroup2 );
Widget8Layout->addLayout( tqlayout4 );
groupBox1 = new QGroupBox( Widget8, "groupBox1" );
groupBox1 = new TQGroupBox( Widget8, "groupBox1" );
groupBox1->setColumnLayout(0, Qt::Vertical );
groupBox1->layout()->setSpacing( 6 );
groupBox1->layout()->setMargin( 11 );
groupBox1Layout = new QHBoxLayout( groupBox1->layout() );
groupBox1Layout->setAlignment( Qt::AlignTop );
groupBox1->tqlayout()->setSpacing( 6 );
groupBox1->tqlayout()->setMargin( 11 );
groupBox1Layout = new TQHBoxLayout( groupBox1->tqlayout() );
groupBox1Layout->tqsetAlignment( TQt::AlignTop );
buttonGroup4 = new QButtonGroup( groupBox1, "buttonGroup4" );
buttonGroup4 = new TQButtonGroup( groupBox1, "buttonGroup4" );
buttonGroup4->setColumnLayout(0, Qt::Vertical );
buttonGroup4->layout()->setSpacing( 6 );
buttonGroup4->layout()->setMargin( 11 );
buttonGroup4Layout = new QVBoxLayout( buttonGroup4->layout() );
buttonGroup4Layout->setAlignment( Qt::AlignTop );
buttonGroup4->tqlayout()->setSpacing( 6 );
buttonGroup4->tqlayout()->setMargin( 11 );
buttonGroup4Layout = new TQVBoxLayout( buttonGroup4->tqlayout() );
buttonGroup4Layout->tqsetAlignment( TQt::AlignTop );
m_radioExtLinkOpenAlways = new QRadioButton( buttonGroup4, "m_radioExtLinkOpenAlways" );
m_radioExtLinkOpenAlways = new TQRadioButton( buttonGroup4, "m_radioExtLinkOpenAlways" );
buttonGroup4Layout->addWidget( m_radioExtLinkOpenAlways );
m_radioExtLinkAsk = new QRadioButton( buttonGroup4, "m_radioExtLinkAsk" );
m_radioExtLinkAsk = new TQRadioButton( buttonGroup4, "m_radioExtLinkAsk" );
buttonGroup4Layout->addWidget( m_radioExtLinkAsk );
m_radioExtLinkOpenNever = new QRadioButton( buttonGroup4, "m_radioExtLinkOpenNever" );
m_radioExtLinkOpenNever = new TQRadioButton( buttonGroup4, "m_radioExtLinkOpenNever" );
buttonGroup4Layout->addWidget( m_radioExtLinkOpenNever );
groupBox1Layout->addWidget( buttonGroup4 );
buttonGroup5 = new QButtonGroup( groupBox1, "buttonGroup5" );
buttonGroup5 = new TQButtonGroup( groupBox1, "buttonGroup5" );
buttonGroup5->setColumnLayout(0, Qt::Vertical );
buttonGroup5->layout()->setSpacing( 6 );
buttonGroup5->layout()->setMargin( 11 );
buttonGroup5Layout = new QVBoxLayout( buttonGroup5->layout() );
buttonGroup5Layout->setAlignment( Qt::AlignTop );
buttonGroup5->tqlayout()->setSpacing( 6 );
buttonGroup5->tqlayout()->setMargin( 11 );
buttonGroup5Layout = new TQVBoxLayout( buttonGroup5->tqlayout() );
buttonGroup5Layout->tqsetAlignment( TQt::AlignTop );
m_radioNewChmOpenAlways = new QRadioButton( buttonGroup5, "m_radioNewChmOpenAlways" );
m_radioNewChmOpenAlways = new TQRadioButton( buttonGroup5, "m_radioNewChmOpenAlways" );
buttonGroup5Layout->addWidget( m_radioNewChmOpenAlways );
m_radioNewChmAsk = new QRadioButton( buttonGroup5, "m_radioNewChmAsk" );
m_radioNewChmAsk = new TQRadioButton( buttonGroup5, "m_radioNewChmAsk" );
buttonGroup5Layout->addWidget( m_radioNewChmAsk );
m_radioNewChmOpenNever = new QRadioButton( buttonGroup5, "m_radioNewChmOpenNever" );
m_radioNewChmOpenNever = new TQRadioButton( buttonGroup5, "m_radioNewChmOpenNever" );
buttonGroup5Layout->addWidget( m_radioNewChmOpenNever );
groupBox1Layout->addWidget( buttonGroup5 );
Widget8Layout->addWidget( groupBox1 );
tabWidget->insertTab( Widget8, QString::fromLatin1("") );
tabWidget->insertTab( Widget8, TQString::tqfromLatin1("") );
Widget9 = new QWidget( tabWidget, "Widget9" );
Widget9Layout = new QVBoxLayout( Widget9, 11, 6, "Widget9Layout");
Widget9 = new TQWidget( tabWidget, "Widget9" );
Widget9Layout = new TQVBoxLayout( Widget9, 11, 6, "Widget9Layout");
m_groupQtsettings = new QGroupBox( Widget9, "m_groupQtsettings" );
m_groupQtsettings = new TQGroupBox( Widget9, "m_groupQtsettings" );
m_groupQtsettings->setColumnLayout(0, Qt::Vertical );
m_groupQtsettings->layout()->setSpacing( 6 );
m_groupQtsettings->layout()->setMargin( 11 );
m_groupQtsettingsLayout = new QHBoxLayout( m_groupQtsettings->layout() );
m_groupQtsettingsLayout->setAlignment( Qt::AlignTop );
m_groupQtsettings->tqlayout()->setSpacing( 6 );
m_groupQtsettings->tqlayout()->setMargin( 11 );
m_groupQtsettingsLayout = new TQHBoxLayout( m_groupQtsettings->tqlayout() );
m_groupQtsettingsLayout->tqsetAlignment( TQt::AlignTop );
textLabel1_2 = new QLabel( m_groupQtsettings, "textLabel1_2" );
textLabel1_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)7, 0, 0, textLabel1_2->sizePolicy().hasHeightForWidth() ) );
textLabel1_2 = new TQLabel( m_groupQtsettings, "textLabel1_2" );
textLabel1_2->tqsetSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)5, (TQSizePolicy::SizeType)7, 0, 0, textLabel1_2->sizePolicy().hasHeightForWidth() ) );
textLabel1_2->setLineWidth( 1 );
textLabel1_2->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter ) );
textLabel1_2->tqsetAlignment( int( TQLabel::WordBreak | TQLabel::AlignVCenter ) );
m_groupQtsettingsLayout->addWidget( textLabel1_2 );
m_qtBrowserPath = new QLineEdit( m_groupQtsettings, "m_qtBrowserPath" );
m_qtBrowserPath->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 0, 0, m_qtBrowserPath->sizePolicy().hasHeightForWidth() ) );
m_qtBrowserPath = new TQLineEdit( m_groupQtsettings, "m_qtBrowserPath" );
m_qtBrowserPath->tqsetSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)1, (TQSizePolicy::SizeType)0, 0, 0, m_qtBrowserPath->sizePolicy().hasHeightForWidth() ) );
m_groupQtsettingsLayout->addWidget( m_qtBrowserPath );
Widget9Layout->addWidget( m_groupQtsettings );
m_groupKDEsettings = new QGroupBox( Widget9, "m_groupKDEsettings" );
m_groupKDEsettings = new TQGroupBox( Widget9, "m_groupKDEsettings" );
m_groupKDEsettings->setColumnLayout(0, Qt::Vertical );
m_groupKDEsettings->layout()->setSpacing( 6 );
m_groupKDEsettings->layout()->setMargin( 11 );
m_groupKDEsettingsLayout = new QHBoxLayout( m_groupKDEsettings->layout() );
m_groupKDEsettingsLayout->setAlignment( Qt::AlignTop );
m_groupKDEsettings->tqlayout()->setSpacing( 6 );
m_groupKDEsettings->tqlayout()->setMargin( 11 );
m_groupKDEsettingsLayout = new TQHBoxLayout( m_groupKDEsettings->tqlayout() );
m_groupKDEsettingsLayout->tqsetAlignment( TQt::AlignTop );
buttonGroup5_2 = new QButtonGroup( m_groupKDEsettings, "buttonGroup5_2" );
buttonGroup5_2 = new TQButtonGroup( m_groupKDEsettings, "buttonGroup5_2" );
buttonGroup5_2->setColumnLayout(0, Qt::Vertical );
buttonGroup5_2->layout()->setSpacing( 6 );
buttonGroup5_2->layout()->setMargin( 11 );
buttonGroup5_2Layout = new QVBoxLayout( buttonGroup5_2->layout() );
buttonGroup5_2Layout->setAlignment( Qt::AlignTop );
buttonGroup5_2->tqlayout()->setSpacing( 6 );
buttonGroup5_2->tqlayout()->setMargin( 11 );
buttonGroup5_2Layout = new TQVBoxLayout( buttonGroup5_2->tqlayout() );
buttonGroup5_2Layout->tqsetAlignment( TQt::AlignTop );
m_radioUseQtextBrowser = new QRadioButton( buttonGroup5_2, "m_radioUseQtextBrowser" );
m_radioUseQtextBrowser = new TQRadioButton( buttonGroup5_2, "m_radioUseQtextBrowser" );
buttonGroup5_2Layout->addWidget( m_radioUseQtextBrowser );
m_radioUseKHTMLPart = new QRadioButton( buttonGroup5_2, "m_radioUseKHTMLPart" );
m_radioUseKHTMLPart = new TQRadioButton( buttonGroup5_2, "m_radioUseKHTMLPart" );
buttonGroup5_2Layout->addWidget( m_radioUseKHTMLPart );
m_groupKDEsettingsLayout->addWidget( buttonGroup5_2 );
groupKhtmlSecurity = new QGroupBox( m_groupKDEsettings, "groupKhtmlSecurity" );
groupKhtmlSecurity = new TQGroupBox( m_groupKDEsettings, "groupKhtmlSecurity" );
groupKhtmlSecurity->setColumnLayout(0, Qt::Vertical );
groupKhtmlSecurity->layout()->setSpacing( 6 );
groupKhtmlSecurity->layout()->setMargin( 11 );
groupKhtmlSecurityLayout = new QGridLayout( groupKhtmlSecurity->layout() );
groupKhtmlSecurityLayout->setAlignment( Qt::AlignTop );
groupKhtmlSecurity->tqlayout()->setSpacing( 6 );
groupKhtmlSecurity->tqlayout()->setMargin( 11 );
groupKhtmlSecurityLayout = new TQGridLayout( groupKhtmlSecurity->tqlayout() );
groupKhtmlSecurityLayout->tqsetAlignment( TQt::AlignTop );
m_enableJS = new QCheckBox( groupKhtmlSecurity, "m_enableJS" );
m_enableJS = new TQCheckBox( groupKhtmlSecurity, "m_enableJS" );
groupKhtmlSecurityLayout->addWidget( m_enableJS, 0, 0 );
m_enablePlugins = new QCheckBox( groupKhtmlSecurity, "m_enablePlugins" );
m_enablePlugins = new TQCheckBox( groupKhtmlSecurity, "m_enablePlugins" );
groupKhtmlSecurityLayout->addWidget( m_enablePlugins, 0, 1 );
m_enableJava = new QCheckBox( groupKhtmlSecurity, "m_enableJava" );
m_enableJava = new TQCheckBox( groupKhtmlSecurity, "m_enableJava" );
groupKhtmlSecurityLayout->addWidget( m_enableJava, 1, 0 );
m_enableRefresh = new QCheckBox( groupKhtmlSecurity, "m_enableRefresh" );
m_enableRefresh = new TQCheckBox( groupKhtmlSecurity, "m_enableRefresh" );
groupKhtmlSecurityLayout->addWidget( m_enableRefresh, 1, 1 );
m_groupKDEsettingsLayout->addWidget( groupKhtmlSecurity );
Widget9Layout->addWidget( m_groupKDEsettings );
tabWidget->insertTab( Widget9, QString::fromLatin1("") );
tabWidget->insertTab( Widget9, TQString::tqfromLatin1("") );
TabPage = new QWidget( tabWidget, "TabPage" );
TabPageLayout = new QVBoxLayout( TabPage, 11, 6, "TabPageLayout");
TabPage = new TQWidget( tabWidget, "TabPage" );
TabPageLayout = new TQVBoxLayout( TabPage, 11, 6, "TabPageLayout");
buttonGroup7 = new QButtonGroup( TabPage, "buttonGroup7" );
buttonGroup7 = new TQButtonGroup( TabPage, "buttonGroup7" );
buttonGroup7->setColumnLayout(0, Qt::Vertical );
buttonGroup7->layout()->setSpacing( 6 );
buttonGroup7->layout()->setMargin( 11 );
buttonGroup7Layout = new QVBoxLayout( buttonGroup7->layout() );
buttonGroup7Layout->setAlignment( Qt::AlignTop );
buttonGroup7->tqlayout()->setSpacing( 6 );
buttonGroup7->tqlayout()->setMargin( 11 );
buttonGroup7Layout = new TQVBoxLayout( buttonGroup7->tqlayout() );
buttonGroup7Layout->tqsetAlignment( TQt::AlignTop );
m_advViewSourceInternal = new QRadioButton( buttonGroup7, "m_advViewSourceInternal" );
m_advViewSourceInternal = new TQRadioButton( buttonGroup7, "m_advViewSourceInternal" );
buttonGroup7Layout->addWidget( m_advViewSourceInternal );
m_advViewSourceExternal = new QRadioButton( buttonGroup7, "m_advViewSourceExternal" );
m_advViewSourceExternal = new TQRadioButton( buttonGroup7, "m_advViewSourceExternal" );
buttonGroup7Layout->addWidget( m_advViewSourceExternal );
layout4_2 = new QHBoxLayout( 0, 0, 6, "layout4_2");
tqlayout4_2 = new TQHBoxLayout( 0, 0, 6, "tqlayout4_2");
textLabel1_3 = new QLabel( buttonGroup7, "textLabel1_3" );
layout4_2->addWidget( textLabel1_3 );
textLabel1_3 = new TQLabel( buttonGroup7, "textLabel1_3" );
tqlayout4_2->addWidget( textLabel1_3 );
m_advExternalProgramName = new QLineEdit( buttonGroup7, "m_advExternalProgramName" );
layout4_2->addWidget( m_advExternalProgramName );
buttonGroup7Layout->addLayout( layout4_2 );
m_advExternalProgramName = new TQLineEdit( buttonGroup7, "m_advExternalProgramName" );
tqlayout4_2->addWidget( m_advExternalProgramName );
buttonGroup7Layout->addLayout( tqlayout4_2 );
TabPageLayout->addWidget( buttonGroup7 );
groupBox6 = new QButtonGroup( TabPage, "groupBox6" );
groupBox6 = new TQButtonGroup( TabPage, "groupBox6" );
groupBox6->setColumnLayout(0, Qt::Vertical );
groupBox6->layout()->setSpacing( 6 );
groupBox6->layout()->setMargin( 11 );
groupBox6Layout = new QGridLayout( groupBox6->layout() );
groupBox6Layout->setAlignment( Qt::AlignTop );
groupBox6->tqlayout()->setSpacing( 6 );
groupBox6->tqlayout()->setMargin( 11 );
groupBox6Layout = new TQGridLayout( groupBox6->tqlayout() );
groupBox6Layout->tqsetAlignment( TQt::AlignTop );
m_useSearchEngineInternal = new QRadioButton( groupBox6, "m_useSearchEngineInternal" );
m_useSearchEngineInternal = new TQRadioButton( groupBox6, "m_useSearchEngineInternal" );
groupBox6Layout->addWidget( m_useSearchEngineInternal, 1, 0 );
m_labelUseSearchEngineInternal = new QLabel( groupBox6, "m_labelUseSearchEngineInternal" );
m_labelUseSearchEngineInternal->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 10, 0, m_labelUseSearchEngineInternal->sizePolicy().hasHeightForWidth() ) );
m_labelUseSearchEngineInternal->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter ) );
m_labelUseSearchEngineInternal = new TQLabel( groupBox6, "m_labelUseSearchEngineInternal" );
m_labelUseSearchEngineInternal->tqsetSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)5, (TQSizePolicy::SizeType)5, 10, 0, m_labelUseSearchEngineInternal->sizePolicy().hasHeightForWidth() ) );
m_labelUseSearchEngineInternal->tqsetAlignment( int( TQLabel::WordBreak | TQLabel::AlignVCenter ) );
groupBox6Layout->addWidget( m_labelUseSearchEngineInternal, 1, 1 );
m_useSearchEngineNew = new QRadioButton( groupBox6, "m_useSearchEngineNew" );
m_useSearchEngineNew = new TQRadioButton( groupBox6, "m_useSearchEngineNew" );
groupBox6Layout->addWidget( m_useSearchEngineNew, 0, 0 );
m_labelUseSearchEngineNew = new QLabel( groupBox6, "m_labelUseSearchEngineNew" );
m_labelUseSearchEngineNew->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 10, 0, m_labelUseSearchEngineNew->sizePolicy().hasHeightForWidth() ) );
m_labelUseSearchEngineNew->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter ) );
m_labelUseSearchEngineNew = new TQLabel( groupBox6, "m_labelUseSearchEngineNew" );
m_labelUseSearchEngineNew->tqsetSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)5, (TQSizePolicy::SizeType)5, 10, 0, m_labelUseSearchEngineNew->sizePolicy().hasHeightForWidth() ) );
m_labelUseSearchEngineNew->tqsetAlignment( int( TQLabel::WordBreak | TQLabel::AlignVCenter ) );
groupBox6Layout->addWidget( m_labelUseSearchEngineNew, 0, 1 );
TabPageLayout->addWidget( groupBox6 );
tabWidget->insertTab( TabPage, QString::fromLatin1("") );
tabWidget->insertTab( TabPage, TQString::tqfromLatin1("") );
MyDialog1Layout->addWidget( tabWidget );
Layout1 = new QHBoxLayout( 0, 0, 6, "Layout1");
Layout1 = new TQHBoxLayout( 0, 0, 6, "Layout1");
buttonHelp = new QPushButton( this, "buttonHelp" );
buttonHelp = new TQPushButton( this, "buttonHelp" );
buttonHelp->setAutoDefault( TRUE );
Layout1->addWidget( buttonHelp );
Horizontal_Spacing2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
Horizontal_Spacing2 = new TQSpacerItem( 20, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
Layout1->addItem( Horizontal_Spacing2 );
buttonOk = new QPushButton( this, "buttonOk" );
buttonOk = new TQPushButton( this, "buttonOk" );
buttonOk->setAutoDefault( TRUE );
buttonOk->setDefault( TRUE );
Layout1->addWidget( buttonOk );
buttonCancel = new QPushButton( this, "buttonCancel" );
buttonCancel = new TQPushButton( this, "buttonCancel" );
buttonCancel->setAutoDefault( TRUE );
Layout1->addWidget( buttonCancel );
MyDialog1Layout->addLayout( Layout1 );
languageChange();
resize( QSize(654, 343).expandedTo(minimumSizeHint()) );
resize( TQSize(654, 343).expandedTo(tqminimumSizeHint()) );
clearWState( WState_Polished );
// signals and slots connections
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
connect( m_radioUseKHTMLPart, SIGNAL( toggled(bool) ), groupKhtmlSecurity, SLOT( setEnabled(bool) ) );
connect( m_advViewSourceExternal, SIGNAL( toggled(bool) ), m_advExternalProgramName, SLOT( setEnabled(bool) ) );
connect( m_radioUseQtextBrowser, SIGNAL( toggled(bool) ), groupKhtmlSecurity, SLOT( setDisabled(bool) ) );
connect( buttonOk, TQT_SIGNAL( clicked() ), this, TQT_SLOT( accept() ) );
connect( buttonCancel, TQT_SIGNAL( clicked() ), this, TQT_SLOT( reject() ) );
connect( m_radioUseKHTMLPart, TQT_SIGNAL( toggled(bool) ), groupKhtmlSecurity, TQT_SLOT( setEnabled(bool) ) );
connect( m_advViewSourceExternal, TQT_SIGNAL( toggled(bool) ), m_advExternalProgramName, TQT_SLOT( setEnabled(bool) ) );
connect( m_radioUseQtextBrowser, TQT_SIGNAL( toggled(bool) ), groupKhtmlSecurity, TQT_SLOT( setDisabled(bool) ) );
// tab order
setTabOrder( m_advViewSourceInternal, m_advViewSourceExternal );
@ -316,7 +316,7 @@ KCHMSetupDialog::KCHMSetupDialog( QWidget* parent, const char* name, bool modal,
*/
KCHMSetupDialog::~KCHMSetupDialog()
{
// no need to delete child widgets, Qt does it all for us
// no need to delete child widgets, TQt does it all for us
}
/*
@ -329,62 +329,62 @@ void KCHMSetupDialog::languageChange()
buttonGroup1->setTitle( tr( "If no arguments given on load" ) );
m_radioOnBeginOpenDialog->setText( tr( "Open the 'open CHM file' dialog" ) );
m_radioOnBeginOpenLast->setText( tr( "Open the &last used CHM file, if exist" ) );
m_radioOnBeginOpenLast->setAccel( QKeySequence( tr( "Alt+L" ) ) );
m_radioOnBeginOpenLast->setAccel( TQKeySequence( tr( "Alt+L" ) ) );
buttonGroup2->setTitle( tr( "History" ) );
textLabel1->setText( tr( "Store history information for" ) );
m_historySize->setPrefix( QString::null );
m_historySize->setPrefix( TQString() );
textLabel2->setText( tr( "latest files" ) );
m_rememberHistoryInfo->setText( tr( "R&emember extra information for history files" ) );
m_rememberHistoryInfo->setAccel( QKeySequence( tr( "Alt+E" ) ) );
QToolTip::add( m_rememberHistoryInfo, tr( "Remembers the information about the files, which were opened. Remembers last opened page, search history, font size, bookmarks and so on." ) );
m_rememberHistoryInfo->setAccel( TQKeySequence( tr( "Alt+E" ) ) );
TQToolTip::add( m_rememberHistoryInfo, tr( "Remembers the information about the files, which were opened. Remembers last opened page, search history, font size, bookmarks and so on." ) );
groupBox1->setTitle( tr( "CHM security settings" ) );
buttonGroup4->setTitle( tr( "When external link clicked" ) );
m_radioExtLinkOpenAlways->setText( tr( "Alwa&ys open it in external browser" ) );
m_radioExtLinkOpenAlways->setAccel( QKeySequence( tr( "Alt+Y" ) ) );
m_radioExtLinkOpenAlways->setAccel( TQKeySequence( tr( "Alt+Y" ) ) );
m_radioExtLinkAsk->setText( tr( "Ask for confirmation" ) );
m_radioExtLinkOpenNever->setText( tr( "Do not open the link" ) );
m_radioExtLinkOpenNever->setAccel( QKeySequence( QString::null ) );
m_radioExtLinkOpenNever->setAccel( TQKeySequence( TQString() ) );
buttonGroup5->setTitle( tr( "When link pointed to a new CHM file clicked" ) );
m_radioNewChmOpenAlways->setText( tr( "Always open a new CHM file" ) );
m_radioNewChmAsk->setText( tr( "Ask for confirmation" ) );
m_radioNewChmOpenNever->setText( tr( "Do not open a new CHM file" ) );
tabWidget->changeTab( Widget8, tr( "General behavior" ) );
m_groupQtsettings->setTitle( tr( "Qt version settings" ) );
m_groupQtsettings->setTitle( tr( "TQt version settings" ) );
textLabel1_2->setText( tr( "Enter the path to the program, which will be used as a browser for external links. A <i>%s</i> symbol will be replaced by the URL clicked." ) );
m_groupKDEsettings->setTitle( tr( "KDE version settings" ) );
buttonGroup5_2->setTitle( tr( "To show HTML content, use" ) );
m_radioUseQtextBrowser->setText( tr( "&QTextBrowser-based widget" ) );
m_radioUseQtextBrowser->setAccel( QKeySequence( tr( "Alt+Q" ) ) );
m_radioUseQtextBrowser->setText( tr( "&TQTextBrowser-based widget" ) );
m_radioUseQtextBrowser->setAccel( TQKeySequence( tr( "Alt+Q" ) ) );
m_radioUseKHTMLPart->setText( tr( "&KHTMLPart-based widget" ) );
m_radioUseKHTMLPart->setAccel( QKeySequence( tr( "Alt+K" ) ) );
m_radioUseKHTMLPart->setAccel( TQKeySequence( tr( "Alt+K" ) ) );
groupKhtmlSecurity->setTitle( tr( "KHTMLPart security" ) );
m_enableJS->setText( tr( "Enable Java&Script" ) );
m_enableJS->setAccel( QKeySequence( tr( "Alt+S" ) ) );
m_enableJS->setAccel( TQKeySequence( tr( "Alt+S" ) ) );
m_enablePlugins->setText( tr( "Enable &plugins" ) );
m_enablePlugins->setAccel( QKeySequence( tr( "Alt+P" ) ) );
m_enablePlugins->setAccel( TQKeySequence( tr( "Alt+P" ) ) );
m_enableJava->setText( tr( "Enable &Java" ) );
m_enableJava->setAccel( QKeySequence( tr( "Alt+J" ) ) );
m_enableJava->setAccel( TQKeySequence( tr( "Alt+J" ) ) );
m_enableRefresh->setText( tr( "Enable &refresh" ) );
m_enableRefresh->setAccel( QKeySequence( tr( "Alt+R" ) ) );
m_enableRefresh->setAccel( TQKeySequence( tr( "Alt+R" ) ) );
tabWidget->changeTab( Widget9, tr( "Version-specific settings" ) );
buttonGroup7->setTitle( tr( "View HTML source command uses" ) );
m_advViewSourceInternal->setText( tr( "Built-in HTML source viewer" ) );
m_advViewSourceInternal->setAccel( QKeySequence( QString::null ) );
m_advViewSourceInternal->setAccel( TQKeySequence( TQString() ) );
m_advViewSourceExternal->setText( tr( "E&xternal program, specified below" ) );
m_advViewSourceExternal->setAccel( QKeySequence( tr( "Alt+X" ) ) );
m_advViewSourceExternal->setAccel( TQKeySequence( tr( "Alt+X" ) ) );
textLabel1_3->setText( tr( "External program:" ) );
groupBox6->setTitle( tr( "Search engine to use" ) );
m_useSearchEngineInternal->setText( QString::null );
m_useSearchEngineInternal->setText( TQString() );
m_labelUseSearchEngineInternal->setText( tr( "Use the search based on internal CHM index. This engine cannot search for any symbols except underscode, does not support multibyte languages, and is not always available." ) );
m_useSearchEngineNew->setText( QString::null );
m_useSearchEngineNew->setText( TQString() );
m_labelUseSearchEngineNew->setText( tr( "Use new kchmviewer internal search engine (recommended). This engine indexes symbols, so it is possible to search for special symbols (like \"C++\"). All languages are supported. The index will be generated before the first search." ) );
tabWidget->changeTab( TabPage, tr( "Advanced" ) );
buttonHelp->setText( tr( "&Help" ) );
buttonHelp->setAccel( QKeySequence( tr( "F1" ) ) );
buttonHelp->setAccel( TQKeySequence( tr( "F1" ) ) );
buttonOk->setText( tr( "&OK" ) );
buttonOk->setAccel( QKeySequence( QString::null ) );
buttonOk->setAccel( TQKeySequence( TQString() ) );
buttonCancel->setText( tr( "&Cancel" ) );
buttonCancel->setAccel( QKeySequence( QString::null ) );
buttonCancel->setAccel( TQKeySequence( TQString() ) );
}
void KCHMSetupDialog::m_radioUseKHTMLPart_toggled(bool)

@ -1,10 +1,10 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>KCHMSetupDialog</class>
<widget class="QDialog">
<widget class="TQDialog">
<property name="name">
<cstring>MyDialog1</cstring>
</property>
<property name="geometry">
<property name="tqgeometry">
<rect>
<x>0</x>
<y>0</y>
@ -42,11 +42,11 @@
<property name="resizeMode">
<enum>Minimum</enum>
</property>
<widget class="QTabWidget">
<widget class="TQTabWidget">
<property name="name">
<cstring>tabWidget</cstring>
</property>
<widget class="QWidget">
<widget class="TQWidget">
<property name="name">
<cstring>Widget8</cstring>
</property>
@ -57,15 +57,15 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLayoutWidget">
<widget class="TQLayoutWidget">
<property name="name">
<cstring>layout4</cstring>
<cstring>tqlayout4</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QButtonGroup">
<widget class="TQButtonGroup">
<property name="name">
<cstring>buttonGroup1</cstring>
</property>
@ -76,7 +76,7 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QRadioButton">
<widget class="TQRadioButton">
<property name="name">
<cstring>m_radioOnBeginOpenDialog</cstring>
</property>
@ -84,7 +84,7 @@
<string>Open the 'open CHM file' dialog</string>
</property>
</widget>
<widget class="QRadioButton">
<widget class="TQRadioButton">
<property name="name">
<cstring>m_radioOnBeginOpenLast</cstring>
</property>
@ -97,7 +97,7 @@
</widget>
</vbox>
</widget>
<widget class="QButtonGroup">
<widget class="TQButtonGroup">
<property name="name">
<cstring>buttonGroup2</cstring>
</property>
@ -108,15 +108,15 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLayoutWidget">
<widget class="TQLayoutWidget">
<property name="name">
<cstring>layout3</cstring>
<cstring>tqlayout3</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel">
<widget class="TQLabel">
<property name="name">
<cstring>textLabel1</cstring>
</property>
@ -124,7 +124,7 @@
<string>Store history information for</string>
</property>
</widget>
<widget class="QSpinBox">
<widget class="TQSpinBox">
<property name="name">
<cstring>m_historySize</cstring>
</property>
@ -135,7 +135,7 @@
<number>10</number>
</property>
</widget>
<widget class="QLabel">
<widget class="TQLabel">
<property name="name">
<cstring>textLabel2</cstring>
</property>
@ -145,7 +145,7 @@
</widget>
</hbox>
</widget>
<widget class="QCheckBox">
<widget class="TQCheckBox">
<property name="name">
<cstring>m_rememberHistoryInfo</cstring>
</property>
@ -163,7 +163,7 @@
</widget>
</hbox>
</widget>
<widget class="QGroupBox">
<widget class="TQGroupBox">
<property name="name">
<cstring>groupBox1</cstring>
</property>
@ -174,7 +174,7 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QButtonGroup">
<widget class="TQButtonGroup">
<property name="name">
<cstring>buttonGroup4</cstring>
</property>
@ -185,7 +185,7 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QRadioButton">
<widget class="TQRadioButton">
<property name="name">
<cstring>m_radioExtLinkOpenAlways</cstring>
</property>
@ -196,7 +196,7 @@
<string>Alt+Y</string>
</property>
</widget>
<widget class="QRadioButton">
<widget class="TQRadioButton">
<property name="name">
<cstring>m_radioExtLinkAsk</cstring>
</property>
@ -204,7 +204,7 @@
<string>Ask for confirmation</string>
</property>
</widget>
<widget class="QRadioButton">
<widget class="TQRadioButton">
<property name="name">
<cstring>m_radioExtLinkOpenNever</cstring>
</property>
@ -217,7 +217,7 @@
</widget>
</vbox>
</widget>
<widget class="QButtonGroup">
<widget class="TQButtonGroup">
<property name="name">
<cstring>buttonGroup5</cstring>
</property>
@ -228,7 +228,7 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QRadioButton">
<widget class="TQRadioButton">
<property name="name">
<cstring>m_radioNewChmOpenAlways</cstring>
</property>
@ -236,7 +236,7 @@
<string>Always open a new CHM file</string>
</property>
</widget>
<widget class="QRadioButton">
<widget class="TQRadioButton">
<property name="name">
<cstring>m_radioNewChmAsk</cstring>
</property>
@ -244,7 +244,7 @@
<string>Ask for confirmation</string>
</property>
</widget>
<widget class="QRadioButton">
<widget class="TQRadioButton">
<property name="name">
<cstring>m_radioNewChmOpenNever</cstring>
</property>
@ -258,7 +258,7 @@
</widget>
</vbox>
</widget>
<widget class="QWidget">
<widget class="TQWidget">
<property name="name">
<cstring>Widget9</cstring>
</property>
@ -269,7 +269,7 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QGroupBox">
<widget class="TQGroupBox">
<property name="name">
<cstring>m_groupQtsettings</cstring>
</property>
@ -280,7 +280,7 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel">
<widget class="TQLabel">
<property name="name">
<cstring>textLabel1_2</cstring>
</property>
@ -298,11 +298,11 @@
<property name="text">
<string>Enter the path to the program, which will be used as a browser for external links. A &lt;i&gt;%s&lt;/i&gt; symbol will be replaced by the URL clicked.</string>
</property>
<property name="alignment">
<property name="tqalignment">
<set>WordBreak|AlignVCenter</set>
</property>
</widget>
<widget class="QLineEdit">
<widget class="TQLineEdit">
<property name="name">
<cstring>m_qtBrowserPath</cstring>
</property>
@ -317,7 +317,7 @@
</widget>
</hbox>
</widget>
<widget class="QGroupBox">
<widget class="TQGroupBox">
<property name="name">
<cstring>m_groupKDEsettings</cstring>
</property>
@ -328,7 +328,7 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QButtonGroup">
<widget class="TQButtonGroup">
<property name="name">
<cstring>buttonGroup5_2</cstring>
</property>
@ -339,7 +339,7 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QRadioButton">
<widget class="TQRadioButton">
<property name="name">
<cstring>m_radioUseQtextBrowser</cstring>
</property>
@ -350,7 +350,7 @@
<string>Alt+Q</string>
</property>
</widget>
<widget class="QRadioButton">
<widget class="TQRadioButton">
<property name="name">
<cstring>m_radioUseKHTMLPart</cstring>
</property>
@ -363,7 +363,7 @@
</widget>
</vbox>
</widget>
<widget class="QGroupBox">
<widget class="TQGroupBox">
<property name="name">
<cstring>groupKhtmlSecurity</cstring>
</property>
@ -374,7 +374,7 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QCheckBox" row="0" column="0">
<widget class="TQCheckBox" row="0" column="0">
<property name="name">
<cstring>m_enableJS</cstring>
</property>
@ -385,7 +385,7 @@
<string>Alt+S</string>
</property>
</widget>
<widget class="QCheckBox" row="0" column="1">
<widget class="TQCheckBox" row="0" column="1">
<property name="name">
<cstring>m_enablePlugins</cstring>
</property>
@ -396,7 +396,7 @@
<string>Alt+P</string>
</property>
</widget>
<widget class="QCheckBox" row="1" column="0">
<widget class="TQCheckBox" row="1" column="0">
<property name="name">
<cstring>m_enableJava</cstring>
</property>
@ -407,7 +407,7 @@
<string>Alt+J</string>
</property>
</widget>
<widget class="QCheckBox" row="1" column="1">
<widget class="TQCheckBox" row="1" column="1">
<property name="name">
<cstring>m_enableRefresh</cstring>
</property>
@ -424,7 +424,7 @@
</widget>
</vbox>
</widget>
<widget class="QWidget">
<widget class="TQWidget">
<property name="name">
<cstring>TabPage</cstring>
</property>
@ -435,7 +435,7 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QButtonGroup">
<widget class="TQButtonGroup">
<property name="name">
<cstring>buttonGroup7</cstring>
</property>
@ -446,7 +446,7 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QRadioButton">
<widget class="TQRadioButton">
<property name="name">
<cstring>m_advViewSourceInternal</cstring>
</property>
@ -457,7 +457,7 @@
<string></string>
</property>
</widget>
<widget class="QRadioButton">
<widget class="TQRadioButton">
<property name="name">
<cstring>m_advViewSourceExternal</cstring>
</property>
@ -468,15 +468,15 @@
<string>Alt+X</string>
</property>
</widget>
<widget class="QLayoutWidget">
<widget class="TQLayoutWidget">
<property name="name">
<cstring>layout4</cstring>
<cstring>tqlayout4</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel">
<widget class="TQLabel">
<property name="name">
<cstring>textLabel1_3</cstring>
</property>
@ -484,7 +484,7 @@
<string>External program:</string>
</property>
</widget>
<widget class="QLineEdit">
<widget class="TQLineEdit">
<property name="name">
<cstring>m_advExternalProgramName</cstring>
</property>
@ -493,7 +493,7 @@
</widget>
</vbox>
</widget>
<widget class="QButtonGroup">
<widget class="TQButtonGroup">
<property name="name">
<cstring>groupBox6</cstring>
</property>
@ -504,7 +504,7 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QRadioButton" row="1" column="0">
<widget class="TQRadioButton" row="1" column="0">
<property name="name">
<cstring>m_useSearchEngineInternal</cstring>
</property>
@ -512,7 +512,7 @@
<string></string>
</property>
</widget>
<widget class="QLabel" row="1" column="1">
<widget class="TQLabel" row="1" column="1">
<property name="name">
<cstring>m_labelUseSearchEngineInternal</cstring>
</property>
@ -527,11 +527,11 @@
<property name="text">
<string>Use the search based on internal CHM index. This engine cannot search for any symbols except underscode, does not support multibyte languages, and is not always available.</string>
</property>
<property name="alignment">
<property name="tqalignment">
<set>WordBreak|AlignVCenter</set>
</property>
</widget>
<widget class="QRadioButton" row="0" column="0">
<widget class="TQRadioButton" row="0" column="0">
<property name="name">
<cstring>m_useSearchEngineNew</cstring>
</property>
@ -539,7 +539,7 @@
<string></string>
</property>
</widget>
<widget class="QLabel" row="0" column="1">
<widget class="TQLabel" row="0" column="1">
<property name="name">
<cstring>m_labelUseSearchEngineNew</cstring>
</property>
@ -554,7 +554,7 @@
<property name="text">
<string>Use new kchmviewer internal search engine (recommended). This engine indexes symbols, so it is possible to search for special symbols (like "C++"). All languages are supported. The index will be generated before the first search.</string>
</property>
<property name="alignment">
<property name="tqalignment">
<set>WordBreak|AlignVCenter</set>
</property>
</widget>
@ -563,7 +563,7 @@
</vbox>
</widget>
</widget>
<widget class="QLayoutWidget">
<widget class="TQLayoutWidget">
<property name="name">
<cstring>Layout1</cstring>
</property>
@ -577,7 +577,7 @@
<property name="spacing">
<number>6</number>
</property>
<widget class="QPushButton">
<widget class="TQPushButton">
<property name="name">
<cstring>buttonHelp</cstring>
</property>
@ -601,14 +601,14 @@
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<property name="tqsizeHint">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
<widget class="QPushButton">
<widget class="TQPushButton">
<property name="name">
<cstring>buttonOk</cstring>
</property>
@ -625,7 +625,7 @@
<bool>true</bool>
</property>
</widget>
<widget class="QPushButton">
<widget class="TQPushButton">
<property name="name">
<cstring>buttonCancel</cstring>
</property>
@ -703,8 +703,8 @@
<tabstop>buttonOk</tabstop>
<tabstop>buttonCancel</tabstop>
</tabstops>
<slots>
<Q_SLOTS>
<slot>m_radioUseKHTMLPart_toggled( bool )</slot>
</slots>
<layoutdefaults spacing="6" margin="11"/>
</Q_SLOTS>
<tqlayoutdefaults spacing="6" margin="11"/>
</UI>

@ -19,9 +19,9 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#include <qcstring.h>
#include <qimage.h>
#include <qdir.h>
#include <tqcstring.h>
#include <tqimage.h>
#include <tqdir.h>
#include "libchmfile.h"
#include "libchmurlfactory.h"
@ -33,15 +33,15 @@
KCHMSourceFactory::KCHMSourceFactory (KCHMViewWindow * viewwindow)
: QMimeSourceFactory()
: TQMimeSourceFactory()
{
m_viewWindow = viewwindow;
}
const QMimeSource * KCHMSourceFactory::data( const QString & abs_name ) const
const TQMimeSource * KCHMSourceFactory::data( const TQString & abs_name ) const
{
QString data, file, path = abs_name;
TQString data, file, path = abs_name;
// Retreive the data from chm file
LCHMFile * chm = ::mainWindow->chmFile();
@ -49,7 +49,7 @@ const QMimeSource * KCHMSourceFactory::data( const QString & abs_name ) const
if ( !chm )
return 0;
int pos = path.find ('#');
int pos = path.tqfind ('#');
if ( pos != -1 )
path = path.left (pos);
@ -58,37 +58,37 @@ const QMimeSource * KCHMSourceFactory::data( const QString & abs_name ) const
// to generate the HTML page, and set it.
if ( LCHMUrlFactory::handleFileType( path, data ) )
{
((QMimeSourceFactory*)this)->setText (path, data);
((TQMimeSourceFactory*)this)->setText (path, data);
}
else if ( path.endsWith (".htm") || path.endsWith (".html") )
{
if ( chm->getFileContentAsString( &data, path ) )
((QMimeSourceFactory*)this)->setText (path, data);
((TQMimeSourceFactory*)this)->setText (path, data);
}
else
{
// treat as image
QImage img;
QByteArray buf;
TQImage img;
TQByteArray buf;
QString fpath = KCHMViewWindow_QTextBrowser::decodeUrl( path );
TQString fpath = KCHMViewWindow_QTextBrowser::decodeUrl( path );
if ( chm->getFileContentAsBinary( &buf, fpath ) )
{
if ( img.loadFromData ( (const uchar *) buf.data(), buf.size() ) )
((QMimeSourceFactory*)this)->setImage (path, img);
((TQMimeSourceFactory*)this)->setImage (path, img);
}
else
{
((QMimeSourceFactory*)this)->setImage( path, img );
((TQMimeSourceFactory*)this)->setImage( path, img );
qWarning( "Could not resolve file %s\n", path.ascii() );
}
}
return QMimeSourceFactory::data (path);
return TQMimeSourceFactory::data (path);
}
QString KCHMSourceFactory::makeAbsolute ( const QString & abs_or_rel_name, const QString & ) const
TQString KCHMSourceFactory::makeAbsolute ( const TQString & abs_or_rel_name, const TQString & ) const
{
return m_viewWindow->makeURLabsolute ( abs_or_rel_name, false );
}

@ -22,19 +22,19 @@
#ifndef KCHMSOURCEFACTORY_H
#define KCHMSOURCEFACTORY_H
#include <qmime.h>
#include <tqmime.h>
#include "forwarddeclarations.h"
/**
@author Georgy Yunaev
*/
class KCHMSourceFactory : public QMimeSourceFactory
class KCHMSourceFactory : public TQMimeSourceFactory
{
public:
KCHMSourceFactory (KCHMViewWindow * viewwindow);
virtual const QMimeSource * data ( const QString & abs_name ) const;
virtual QString makeAbsolute ( const QString & abs_or_rel_name, const QString & context ) const;
virtual const TQMimeSource * data ( const TQString & abs_name ) const;
virtual TQString makeAbsolute ( const TQString & abs_or_rel_name, const TQString & context ) const;
private:
KCHMViewWindow * m_viewWindow;

@ -19,8 +19,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#include <qstringlist.h>
#include <qstyle.h>
#include <tqstringlist.h>
#include <tqstyle.h>
#include "kchmtreeviewitem.h"
#include "kchmmainwindow.h"
@ -28,16 +28,16 @@
#include "iconstorage.h"
KCHMIndTocItem::KCHMIndTocItem( QListViewItem * parent, QListViewItem * after, QString name, QString aurl, int image) : QListViewItem(parent, after, name), url(aurl), image_number(image)
KCHMIndTocItem::KCHMIndTocItem( TQListViewItem * tqparent, TQListViewItem * after, TQString name, TQString aurl, int image) : TQListViewItem(tqparent, after, name), url(aurl), image_number(image)
{
}
KCHMIndTocItem::KCHMIndTocItem( QListView * parent, QListViewItem * after, QString name, QString aurl, int image) : QListViewItem(parent, after, name), url(aurl), image_number(image)
KCHMIndTocItem::KCHMIndTocItem( TQListView * tqparent, TQListViewItem * after, TQString name, TQString aurl, int image) : TQListViewItem(tqparent, after, name), url(aurl), image_number(image)
{
}
const QPixmap * KCHMIndTocItem::pixmap( int i ) const
const TQPixmap * KCHMIndTocItem::pixmap( int i ) const
{
int imagenum;
@ -58,24 +58,24 @@ const QPixmap * KCHMIndTocItem::pixmap( int i ) const
}
QString KCHMIndTocItem::getUrl( ) const
TQString KCHMIndTocItem::getUrl( ) const
{
if ( url.find ('|') == -1 )
if ( url.tqfind ('|') == -1 )
return url;
// Create a dialog with URLs, and show it, so user can select an URL he/she wants.
QStringList urls = QStringList::split ('|', url);
QStringList titles;
TQStringList urls = TQStringList::split ('|', url);
TQStringList titles;
LCHMFile * xchm = ::mainWindow->chmFile();
for ( unsigned int i = 0; i < urls.size(); i++ )
{
QString title = xchm->getTopicByUrl (urls[i]);
TQString title = xchm->getTopicByUrl (urls[i]);
if ( !title )
{
qWarning ("Could not get item name for url '%s'", urls[i].ascii());
titles.push_back(QString::null);
titles.push_back(TQString());
}
else
titles.push_back(title);
@ -83,62 +83,62 @@ QString KCHMIndTocItem::getUrl( ) const
KCHMDialogChooseUrlFromList dlg (urls, titles, ::mainWindow);
if ( dlg.exec() == QDialog::Accepted )
if ( dlg.exec() == TQDialog::Accepted )
return dlg.getSelectedItemUrl();
return QString::null;
return TQString();
}
void KCHMIndTocItem::paintBranches( QPainter * p, const QColorGroup & cg, int w, int y, int h )
void KCHMIndTocItem::paintBranches( TQPainter * p, const TQColorGroup & cg, int w, int y, int h )
{
if ( image_number != LCHMBookIcons::IMAGE_INDEX )
QListViewItem::paintBranches(p, cg, w, y, h);
TQListViewItem::paintBranches(p, cg, w, y, h);
else
{
// Too bad that listView()->paintEmptyArea( p, QRect( 0, 0, w, h ) ) is protected.
// Too bad that listView()->paintEmptyArea( p, TQRect( 0, 0, w, h ) ) is protected.
// Taken from qt-x11-free-3.0.4/src/widgets/qlistview.cpp
QStyleOption opt( 0, 0 );
QStyle::SFlags how = QStyle::Style_Default | QStyle::Style_Enabled;
TQStyleOption opt( 0, 0 );
TQStyle::SFlags how = TQStyle::Style_Default | TQStyle::Style_Enabled;
listView()->style().drawComplexControl( QStyle::CC_ListView,
p, listView(), QRect( 0, 0, w, h ), cg,
how, QStyle::SC_ListView, QStyle::SC_None,
listView()->tqstyle().tqdrawComplexControl( TQStyle::CC_ListView,
p, listView(), TQRect( 0, 0, w, h ), cg,
how, TQStyle::SC_ListView, TQStyle::SC_None,
opt );
}
}
void KCHMIndTocItem::paintCell( QPainter * p, const QColorGroup & cg, int column, int width, int align )
void KCHMIndTocItem::paintCell( TQPainter * p, const TQColorGroup & cg, int column, int width, int align )
{
QColorGroup newcg ( cg );
QColor c = newcg.text();
TQColorGroup newcg ( cg );
TQColor c = newcg.text();
if ( url.find ('|') != -1 )
newcg.setColor( QColorGroup::Text, Qt::red );
if ( url.tqfind ('|') != -1 )
newcg.setColor( TQColorGroup::Text, TQt::red );
else if ( url[0] == ':' )
newcg.setColor( QColorGroup::Text, Qt::lightGray );
newcg.setColor( TQColorGroup::Text, TQt::lightGray );
else
{
QListViewItem::paintCell( p, cg, column, width, align );
TQListViewItem::paintCell( p, cg, column, width, align );
return;
}
QListViewItem::paintCell( p, newcg, column, width, align );
newcg.setColor( QColorGroup::Text, c );
TQListViewItem::paintCell( p, newcg, column, width, align );
newcg.setColor( TQColorGroup::Text, c );
}
void KCHMIndTocItem::setOpen( bool open )
{
if ( image_number != LCHMBookIcons::IMAGE_INDEX || open )
QListViewItem::setOpen (open);
TQListViewItem::setOpen (open);
}
void kchmFillListViewWithParsedData( QListView * list, const QValueVector< LCHMParsedEntry >& data, QMap<QString, KCHMIndTocItem*> * map )
void kchmFillListViewWithParsedData( TQListView * list, const TQValueVector< LCHMParsedEntry >& data, TQMap<TQString, KCHMIndTocItem*> * map )
{
QValueVector< KCHMIndTocItem *> lastchild;
QValueVector< KCHMIndTocItem *> rootentry;
TQValueVector< KCHMIndTocItem *> lastchild;
TQValueVector< KCHMIndTocItem *> rootentry;
if ( map )
map->clear();
@ -161,7 +161,7 @@ void kchmFillListViewWithParsedData( QListView * list, const QValueVector< LCHMP
// Create the node
KCHMIndTocItem * item;
QString url = data[i].urls.join ("|");
TQString url = data[i].urls.join ("|");
if ( indent == 0 )
item = new KCHMIndTocItem( list, lastchild[indent], data[i].name, url, data[i].imageid );
@ -202,7 +202,7 @@ void kchmFillListViewWithParsedData( QListView * list, const QValueVector< LCHMP
}
int real_indent = indent - root_indent_offset;
QString url = urls.join ("|");
TQString url = urls.join ("|");
if ( real_indent == 0 )
{
@ -241,7 +241,7 @@ void kchmFillListViewWithParsedData( QListView * list, const QValueVector< LCHMP
qDebug ("CHMFile::ParseAndFillTopicsTree: <object> tag is parsed, but both name and url are empty.");
}
name = QString::null;
name = TQString();
urls.clear();
in_object = false;
imagenum = defaultimagenum;

@ -22,8 +22,8 @@
#ifndef CTREEVIEWITEM_H
#define CTREEVIEWITEM_H
#include <qlistview.h>
#include <qvaluevector.h>
#include <tqlistview.h>
#include <tqvaluevector.h>
#include "libchmfile.h"
@ -31,70 +31,70 @@
@author Georgy Yunaev
*/
//! This is a list item used both in Index and Table Of Content trees
class KCHMIndTocItem : public QListViewItem
class KCHMIndTocItem : public TQListViewItem
{
public:
KCHMIndTocItem( QListViewItem* parent, QListViewItem* after, QString name, QString aurl, int image);
KCHMIndTocItem( QListView* parent, QListViewItem* after, QString name, QString url, int image);
KCHMIndTocItem( TQListViewItem* tqparent, TQListViewItem* after, TQString name, TQString aurl, int image);
KCHMIndTocItem( TQListView* tqparent, TQListViewItem* after, TQString name, TQString url, int image);
QString getUrl() const;
TQString getUrl() const;
virtual void setOpen ( bool open );
private:
virtual void paintBranches ( QPainter * p, const QColorGroup & cg, int w, int y, int h );
virtual void paintCell ( QPainter * p, const QColorGroup & cg, int column, int width, int align );
virtual const QPixmap * pixmap( int i ) const;
virtual void paintBranches ( TQPainter * p, const TQColorGroup & cg, int w, int y, int h );
virtual void paintCell ( TQPainter * p, const TQColorGroup & cg, int column, int width, int align );
virtual const TQPixmap * pixmap( int i ) const;
QString url;
TQString url;
int image_number;
};
class KCMSearchTreeViewItem : public QListViewItem
class KCMSearchTreeViewItem : public TQListViewItem
{
public:
KCMSearchTreeViewItem (QListView* parent, QString name, QString loc, QString url)
: QListViewItem (parent, name, loc)
KCMSearchTreeViewItem (TQListView* tqparent, TQString name, TQString loc, TQString url)
: TQListViewItem (tqparent, name, loc)
{
this->url = url;
}
QString getUrl() const { return url; }
TQString getUrl() const { return url; }
private:
QString url;
TQString url;
};
class KCHMSingleTreeViewItem : public QListViewItem
class KCHMSingleTreeViewItem : public TQListViewItem
{
public:
KCHMSingleTreeViewItem (QListView* parent, QString name, QString url)
: QListViewItem (parent, name)
KCHMSingleTreeViewItem (TQListView* tqparent, TQString name, TQString url)
: TQListViewItem (tqparent, name)
{
this->url = url;
}
QString getUrl() const { return url; }
TQString getUrl() const { return url; }
private:
QString url;
TQString url;
};
class KCHMBookmarkTreeViewItem : public QListViewItem
class KCHMBookmarkTreeViewItem : public TQListViewItem
{
public:
KCHMBookmarkTreeViewItem (QListView* parent, QString n, QString u, int s)
: QListViewItem (parent, n), url(u), name(n), scroll_y(s) { menuid = 0; }
KCHMBookmarkTreeViewItem (TQListView* tqparent, TQString n, TQString u, int s)
: TQListViewItem (tqparent, n), url(u), name(n), scroll_y(s) { menuid = 0; }
QString url;
QString name;
TQString url;
TQString name;
int scroll_y;
int menuid;
};
void kchmFillListViewWithParsedData( QListView * list, const QValueVector< LCHMParsedEntry >& data, QMap<QString, KCHMIndTocItem*> * map );
void kchmFillListViewWithParsedData( TQListView * list, const TQValueVector< LCHMParsedEntry >& data, TQMap<TQString, KCHMIndTocItem*> * map );
#endif

@ -19,11 +19,11 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
// Do not use tr() or i18n() in this file - this class is not derived from QObject.
// Do not use tr() or i18n() in this file - this class is not derived from TQObject.
#include <qregexp.h>
#include <qstring.h>
#include <qdir.h>
#include <tqregexp.h>
#include <tqstring.h>
#include <tqdir.h>
#include "libchmfile.h"
#include "libchmurlfactory.h"
@ -35,25 +35,25 @@
#include "kchmnavtoolbar.h"
KCHMViewWindow::KCHMViewWindow( QTabWidget * parent )
KCHMViewWindow::KCHMViewWindow( TQTabWidget * tqparent )
{
invalidate();
tqinvalidate();
m_contextMenu = 0;
m_contextMenuLink = 0;
m_historyMaxSize = 25;
m_parentTabWidget = parent;
m_parentTabWidget = tqparent;
}
KCHMViewWindow::~KCHMViewWindow()
{
}
void KCHMViewWindow::invalidate( )
void KCHMViewWindow::tqinvalidate( )
{
m_base_url = "/";
m_openedPage = QString::null;
m_newTabLinkKeeper = QString::null;
m_openedPage = TQString();
m_newTabLinkKeeper = TQString();
m_historyCurrentPos = 0;
m_history.clear();
@ -63,30 +63,30 @@ void KCHMViewWindow::invalidate( )
QString KCHMViewWindow::makeURLabsolute ( const QString & url, bool set_as_base )
TQString KCHMViewWindow::makeURLabsolute ( const TQString & url, bool set_as_base )
{
QString p1, p2, newurl = url;
TQString p1, p2, newurl = url;
if ( !LCHMUrlFactory::isRemoteURL (url, p1)
&& !LCHMUrlFactory::isJavascriptURL (url)
&& !LCHMUrlFactory::isNewChmURL (url, p1, p2) )
{
newurl = QDir::cleanDirPath (url);
newurl = TQDir::cleanDirPath (url);
// Normalize url, so it becomes absolute
if ( newurl[0] != '/' )
newurl = m_base_url + "/" + newurl;
newurl = QDir::cleanDirPath (newurl);
newurl = TQDir::cleanDirPath (newurl);
if ( set_as_base )
{
m_base_url = newurl;
// and set up new baseurl
int i = newurl.findRev('/');
int i = newurl.tqfindRev('/');
if ( i != -1 )
m_base_url = QDir::cleanDirPath (newurl.left (i + 1));
m_base_url = TQDir::cleanDirPath (newurl.left (i + 1));
}
}
@ -94,19 +94,19 @@ QString KCHMViewWindow::makeURLabsolute ( const QString & url, bool set_as_base
return newurl;
}
bool KCHMViewWindow::openUrl ( const QString& origurl )
bool KCHMViewWindow::openUrl ( const TQString& origurl )
{
QString chmfile, page, newurl = origurl;
TQString chmfile, page, newurl = origurl;
if ( !origurl )
return true;
// URL could be a complete ms-its link. The file should be already loaded (for QTextBrowser),
// URL could be a complete ms-its link. The file should be already loaded (for TQTextBrowser),
// or will be loaded (for kio slave). We care only about the path component.
if ( LCHMUrlFactory::isNewChmURL( newurl, chmfile, page ) )
{
// If a new chm file is opened here, and we do not use KCHMLPart, we better abort
if ( chmfile != ::mainWindow->getOpenedFileName() && appConfig.m_kdeUseQTextBrowser )
if ( chmfile != ::mainWindow->getOpenedFileName() && appConfig.m_kdeUseTQTextBrowser )
qFatal("KCHMViewWindow::openUrl(): opened new chm file %s while current is %s",
chmfile.ascii(), ::mainWindow->getOpenedFileName().ascii() );
@ -119,7 +119,7 @@ bool KCHMViewWindow::openUrl ( const QString& origurl )
if ( openPage (newurl) )
{
m_newTabLinkKeeper = QString::null;
m_newTabLinkKeeper = TQString();
m_openedPage = newurl;
mainWindow->viewWindowMgr()->setTabName( this );
@ -129,36 +129,36 @@ bool KCHMViewWindow::openUrl ( const QString& origurl )
return false;
}
void KCHMViewWindow::handleStartPageAsImage( QString & link )
void KCHMViewWindow::handleStartPageAsImage( TQString & link )
{
// Handle pics
if ( link.endsWith( ".jpg", false )
|| link.endsWith( ".jpeg", false )
|| link.endsWith( ".gif", false )
|| link.endsWith( ".png", false )
|| link.endsWith( ".bmp", false ) )
if ( link.tqendsWith( ".jpg", false )
|| link.tqendsWith( ".jpeg", false )
|| link.tqendsWith( ".gif", false )
|| link.tqendsWith( ".png", false )
|| link.tqendsWith( ".bmp", false ) )
link += LCHMUrlFactory::getInternalUriExtension();
}
KQPopupMenu * KCHMViewWindow::createStandardContextMenu( QWidget * parent )
KTQPopupMenu * KCHMViewWindow::createStandardContextMenu( TQWidget * tqparent )
{
KQPopupMenu * contextMenu = new KQPopupMenu( parent );
KTQPopupMenu * contextMenu = new KTQPopupMenu( tqparent );
contextMenu->insertItem ( "&Copy", ::mainWindow, SLOT(slotBrowserCopy()) );
contextMenu->insertItem ( "&Select all", ::mainWindow, SLOT(slotBrowserSelectAll()) );
contextMenu->insertItem ( "&Copy", ::mainWindow, TQT_SLOT(slotBrowserCopy()) );
contextMenu->insertItem ( "&Select all", ::mainWindow, TQT_SLOT(slotBrowserSelectAll()) );
return contextMenu;
}
KQPopupMenu * KCHMViewWindow::getContextMenu( const QString & link, QWidget * parent )
KTQPopupMenu * KCHMViewWindow::getContextMenu( const TQString & link, TQWidget * tqparent )
{
if ( link.isNull() )
{
// standard context menu
if ( !m_contextMenu )
m_contextMenu = createStandardContextMenu( parent );
m_contextMenu = createStandardContextMenu( tqparent );
return m_contextMenu;
}
@ -168,12 +168,12 @@ KQPopupMenu * KCHMViewWindow::getContextMenu( const QString & link, QWidget * pa
// standard context menu
if ( !m_contextMenuLink )
{
m_contextMenuLink = createStandardContextMenu( parent );
m_contextMenuLink = createStandardContextMenu( tqparent );
m_contextMenuLink->insertSeparator();
m_contextMenuLink->insertItem ( "&Open this link in a new tab", ::mainWindow, SLOT(slotOpenPageInNewTab()), QKeySequence("Shift+Enter") );
m_contextMenuLink->insertItem ( "&Open this link in a new tab", ::mainWindow, TQT_SLOT(slotOpenPageInNewTab()), TQKeySequence("Shift+Enter") );
m_contextMenuLink->insertItem ( "&Open this link in a new background tab", ::mainWindow, SLOT(slotOpenPageInNewBackgroundTab()), QKeySequence("Ctrl+Enter") );
m_contextMenuLink->insertItem ( "&Open this link in a new background tab", ::mainWindow, TQT_SLOT(slotOpenPageInNewBackgroundTab()), TQKeySequence("Ctrl+Enter") );
}
setTabKeeper( link );
@ -181,9 +181,9 @@ KQPopupMenu * KCHMViewWindow::getContextMenu( const QString & link, QWidget * pa
}
}
QString KCHMViewWindow::getTitle() const
TQString KCHMViewWindow::getTitle() const
{
QString title = ::mainWindow->chmFile()->getTopicByUrl( m_openedPage );
TQString title = ::mainWindow->chmFile()->getTopicByUrl( m_openedPage );
if ( title.isEmpty() )
title = m_openedPage;
@ -247,7 +247,7 @@ void KCHMViewWindow::navigateHome( )
::mainWindow->openPage( ::mainWindow->chmFile()->homeUrl() );
}
void KCHMViewWindow::addNavigationHistory( const QString & url, int scrollpos )
void KCHMViewWindow::addNavigationHistory( const TQString & url, int scrollpos )
{
// shred the 'forward' history
if ( m_historyCurrentPos < m_history.size() )
@ -274,30 +274,30 @@ void KCHMViewWindow::updateNavigationToolbar( )
if ( mainWindow )
{
mainWindow->navigationToolbar()->updateIconStatus(
mainWindow->navigationToolbar()->updateIcontqStatus(
m_historyCurrentPos > 0,
m_historyCurrentPos < (m_history.size() - 1) );
}
}
KQPopupMenu * KCHMViewWindow::createListItemContextMenu( QWidget * w )
KTQPopupMenu * KCHMViewWindow::createListItemContextMenu( TQWidget * w )
{
KQPopupMenu * contextMenu = new KQPopupMenu( w );
KTQPopupMenu * contextMenu = new KTQPopupMenu( w );
contextMenu->insertItem ( "&Open this link in a new tab",
::mainWindow,
SLOT( slotOpenPageInNewTab() ),
QKeySequence( "Shift+Enter" ) );
TQT_SLOT( slotOpenPageInNewTab() ),
TQKeySequence( "Shift+Enter" ) );
contextMenu->insertItem ( "&Open this link in a new background tab",
::mainWindow,
SLOT( slotOpenPageInNewBackgroundTab() ),
QKeySequence( "Ctrl+Enter" ) );
TQT_SLOT( slotOpenPageInNewBackgroundTab() ),
TQKeySequence( "Ctrl+Enter" ) );
return contextMenu;
}
void KCHMViewWindow::setTabKeeper( const QString & link )
void KCHMViewWindow::setTabKeeper( const TQString & link )
{
// If we clicked on relative link, make sure we convert it to absolute right now,
// because later we will not have access to this view window variables
@ -305,8 +305,8 @@ void KCHMViewWindow::setTabKeeper( const QString & link )
if ( m_newTabLinkKeeper[0] == '#' && !m_openedPage.isEmpty() )
{
// Clean up opened page URL
int pos = m_openedPage.find ('#');
QString fixedpath = pos == -1 ? m_openedPage : m_openedPage.left (pos);
int pos = m_openedPage.tqfind ('#');
TQString fixedpath = pos == -1 ? m_openedPage : m_openedPage.left (pos);
m_newTabLinkKeeper = fixedpath + m_newTabLinkKeeper;
}

@ -31,27 +31,27 @@
class KCHMViewWindow
{
public:
KCHMViewWindow ( QTabWidget * parent );
KCHMViewWindow ( TQTabWidget * tqparent );
virtual ~KCHMViewWindow();
//! Open a page from current chm archive
bool openUrl (const QString& url );
bool openUrl (const TQString& url );
QString getBaseUrl() const { return m_base_url; }
QString getOpenedPage() const { return m_openedPage; }
QString getNewTabLink() const { return m_newTabLinkKeeper; }
QString makeURLabsolute ( const QString &url, bool set_as_base = true );
TQString getBaseUrl() const { return m_base_url; }
TQString getOpenedPage() const { return m_openedPage; }
TQString getNewTabLink() const { return m_newTabLinkKeeper; }
TQString makeURLabsolute ( const TQString &url, bool set_as_base = true );
public:
// virtual members, which should be implemented by viewers
//! Invalidate current view, doing all the cleanups etc.
virtual void invalidate();
virtual void tqinvalidate();
//! Popups the print dialog, and prints the current page on the printer.
virtual bool printCurrentPage() = 0;
//! Continues the find-in-page search forward or backward
virtual void searchWord( const QString & word, bool forward = true, bool casesensitive = false ) = 0;
//! Continues the tqfind-in-page search forward or backward
virtual void searchWord( const TQString & word, bool forward = true, bool casesensitive = false ) = 0;
//! Return current ZoomFactor.
virtual int getZoomFactor() const = 0;
@ -62,8 +62,8 @@ public:
//! Relatively changes ZoomFactor. Most common values are -1 and 1.
virtual void addZoomFactor (int value) = 0;
virtual QObject * getQObject() = 0;
virtual QWidget * getQWidget() = 0;
virtual TQObject * getTQObject() = 0;
virtual TQWidget * getTQWidget() = 0;
/*!
* Return current scrollbar position in view window. Saved on program exit.
@ -82,7 +82,7 @@ public:
virtual void clipCopy() = 0;
//! Returns the window title
virtual QString getTitle() const;
virtual TQString getTitle() const;
//! Navigation stuff
virtual void navigateBack();
@ -91,15 +91,15 @@ public:
//! Navigation auxiliary stuff
virtual void setHistoryMaxSize (unsigned int size) { m_historyMaxSize = size; }
virtual void addNavigationHistory( const QString & url, int scrollpos );
virtual void addNavigationHistory( const TQString & url, int scrollpos );
virtual void updateNavigationToolbar();
/*!
* Used by contents window (and probably by other windows in future) to show
* context menu in listviews. Put here to futher reuse code in index and search windows.
*/
KQPopupMenu * createListItemContextMenu ( QWidget * w );
void setTabKeeper ( const QString& link );
KTQPopupMenu * createListItemContextMenu ( TQWidget * w );
void setTabKeeper ( const TQString& link );
protected: /* signals */
@ -108,49 +108,49 @@ protected: /* signals */
* If linkClicked() return false, the current page should NOT change.
* Otherwise it should be changed to the new link value.
*/
virtual void signalLinkClicked ( const QString & newlink, bool& follow_link ) = 0;
virtual void signalLinkClicked ( const TQString & newlink, bool& follow_link ) = 0;
protected:
virtual bool openPage ( const QString& url ) = 0;
virtual void handleStartPageAsImage( QString& link );
virtual bool openPage ( const TQString& url ) = 0;
virtual void handleStartPageAsImage( TQString& link );
KQPopupMenu * getContextMenu( const QString& link, QWidget * parent );
KQPopupMenu * createStandardContextMenu( QWidget * parent );
KTQPopupMenu * getContextMenu( const TQString& link, TQWidget * tqparent );
KTQPopupMenu * createStandardContextMenu( TQWidget * tqparent );
//! History
class KCHMUrlHistory
{
public:
KCHMUrlHistory() { scrollbarpos = 0; }
KCHMUrlHistory( const QString& _url, int _scrollbarpos )
KCHMUrlHistory( const TQString& _url, int _scrollbarpos )
: url(_url), scrollbarpos(_scrollbarpos) {};
const QString& getUrl() const { return url; }
const TQString& getUrl() const { return url; }
int getScrollPosition() const { return scrollbarpos; }
void setScrollPosition( int pos ) { scrollbarpos = pos; }
private:
QString url;
TQString url;
int scrollbarpos;
};
unsigned int m_historyMaxSize;
unsigned int m_historyCurrentPos;
QValueList<KCHMUrlHistory> m_history;
TQValueList<KCHMUrlHistory> m_history;
KQPopupMenu * m_contextMenu;
KQPopupMenu * m_contextMenuLink;
KTQPopupMenu * m_contextMenu;
KTQPopupMenu * m_contextMenuLink;
// This member keeps a "open new tab" link between getContextMenu() call and appropriate
// slot call
QString m_newTabLinkKeeper;
TQString m_newTabLinkKeeper;
QString m_openedPage;
QString m_lastOpenedPage;
QString m_base_url;
TQString m_openedPage;
TQString m_lastOpenedPage;
TQString m_base_url;
QTabWidget * m_parentTabWidget;
TQTabWidget * m_parentTabWidget;
};
#endif

@ -19,10 +19,10 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#include <qprinter.h>
#include <qpainter.h>
#include <qsimplerichtext.h>
#include <qpaintdevicemetrics.h>
#include <tqprinter.h>
#include <tqpainter.h>
#include <tqsimplerichtext.h>
#include <tqpaintdevicemetrics.h>
#include "kde-qt.h"
#include "kchmmainwindow.h"
@ -39,15 +39,15 @@
*/
#define KEEP_ALL_OPENED_DATA_IN_SOURCE_FACTORY
KCHMViewWindow_QTextBrowser::KCHMViewWindow_QTextBrowser( QTabWidget * parent )
: QTextBrowser ( parent ), KCHMViewWindow ( parent )
KCHMViewWindow_QTextBrowser::KCHMViewWindow_QTextBrowser( TQTabWidget * tqparent )
: TQTextBrowser ( tqparent ), KCHMViewWindow ( tqparent )
{
m_zoomfactor = 0;
m_sourcefactory = 0;
invalidate();
tqinvalidate();
setTextFormat ( Qt::RichText );
connect( this, SIGNAL( linkClicked (const QString &) ), this, SLOT( slotLinkClicked(const QString &) ) );
setTextFormat ( TQt::RichText );
connect( this, TQT_SIGNAL( linkClicked (const TQString &) ), this, TQT_SLOT( slotLinkClicked(const TQString &) ) );
}
@ -56,7 +56,7 @@ KCHMViewWindow_QTextBrowser::~KCHMViewWindow_QTextBrowser()
delete m_sourcefactory;
}
bool KCHMViewWindow_QTextBrowser::openPage (const QString& url)
bool KCHMViewWindow_QTextBrowser::openPage (const TQString& url)
{
// If we're using a memory saving scheme, we destroy MimeSourceFactory (including all the stored data)
// when opening a new page. It saves some memory, but spends more time while looking for already loaded
@ -71,13 +71,13 @@ bool KCHMViewWindow_QTextBrowser::openPage (const QString& url)
return true;
}
void KCHMViewWindow_QTextBrowser::setSource ( const QString & name )
void KCHMViewWindow_QTextBrowser::setSource ( const TQString & name )
{
if ( m_allowSourceChange )
{
// Do URI decoding, qtextbrowser does stupid job.
QString fixedname = decodeUrl( name );
QTextBrowser::setSource (fixedname);
TQString fixedname = decodeUrl( name );
TQTextBrowser::setSource (fixedname);
}
else
m_allowSourceChange = true;
@ -88,12 +88,12 @@ void KCHMViewWindow_QTextBrowser::setZoomFactor( int zoom )
m_zoomfactor = zoom;
if ( zoom < 0 )
QTextBrowser::zoomOut( -zoom );
TQTextBrowser::zoomOut( -zoom );
else if ( zoom > 0 )
QTextBrowser::zoomIn( zoom);
TQTextBrowser::zoomIn( zoom);
}
void KCHMViewWindow_QTextBrowser::invalidate( )
void KCHMViewWindow_QTextBrowser::tqinvalidate( )
{
delete m_sourcefactory;
m_sourcefactory = new KCHMSourceFactory (this);
@ -102,10 +102,10 @@ void KCHMViewWindow_QTextBrowser::invalidate( )
m_allowSourceChange = true;
m_searchLastIndex = 0;
m_searchLastParagraph = 0;
m_searchText = QString::null;
m_searchText = TQString();
reload();
KCHMViewWindow::invalidate( );
KCHMViewWindow::tqinvalidate( );
}
int KCHMViewWindow_QTextBrowser::getScrollbarPosition( )
@ -123,7 +123,7 @@ void KCHMViewWindow_QTextBrowser::addZoomFactor( int value )
setZoomFactor( value);
}
void KCHMViewWindow_QTextBrowser::slotLinkClicked( const QString & newlink )
void KCHMViewWindow_QTextBrowser::slotLinkClicked( const TQString & newlink )
{
emit signalLinkClicked (newlink, m_allowSourceChange);
}
@ -131,44 +131,44 @@ void KCHMViewWindow_QTextBrowser::slotLinkClicked( const QString & newlink )
bool KCHMViewWindow_QTextBrowser::printCurrentPage( )
{
#if !defined (QT_NO_PRINTER)
QPrinter printer( QPrinter::HighResolution );
#if !defined (TQT_NO_PRINTER)
TQPrinter printer( TQPrinter::HighResolution );
printer.setFullPage(TRUE);
if ( printer.setup( this ) )
{
QPainter p( &printer );
TQPainter p( &printer );
if( !p.isActive() ) // starting printing failed
return false;
QPaintDeviceMetrics metrics(p.device());
TQPaintDeviceMetrics metrics(p.device());
int dpiy = metrics.logicalDpiY();
int margin = (int) ( (2/2.54)*dpiy ); // 2 cm margins
QRect body( margin, margin, metrics.width() - 2*margin, metrics.height() - 2*margin );
QSimpleRichText richText( text(),
QFont(),
TQRect body( margin, margin, metrics.width() - 2*margin, metrics.height() - 2*margin );
TQSimpleRichText richText( text(),
TQFont(),
context(),
styleSheet(),
mimeSourceFactory(),
body.height() );
richText.setWidth( &p, body.width() );
QRect view( body );
TQRect view( body );
int page = 1;
do
{
richText.draw( &p, body.left(), body.top(), view, colorGroup() );
richText.draw( &p, body.left(), body.top(), view, tqcolorGroup() );
view.moveBy( 0, body.height() );
p.translate( 0 , -body.height() );
p.drawText( view.right() - p.fontMetrics().width( QString::number(page) ),
view.bottom() + p.fontMetrics().ascent() + 5, QString::number(page) );
p.drawText( view.right() - p.fontMetrics().width( TQString::number(page) ),
view.bottom() + p.fontMetrics().ascent() + 5, TQString::number(page) );
if ( view.top() >= richText.height() )
break;
QString msg = i18n( "Printing (page %1)...") .arg(page);
TQString msg = i18n( "Printing (page %1)...") .tqarg(page);
::mainWindow->showInStatusBar( msg );
printer.newPage();
@ -183,18 +183,18 @@ bool KCHMViewWindow_QTextBrowser::printCurrentPage( )
::mainWindow->showInStatusBar( i18n( "Printing aborted") );
return false;
#else /* QT_NO_PRINTER */
#else /* TQT_NO_PRINTER */
QMessageBox::warning( this,
TQMessageBox::warning( this,
i18n( "%1 - could not print") . arg(APP_NAME),
i18n( "Could not print.\nYour Qt library has been compiled without printing support");
i18n( "Could not print.\nYour TQt library has been compiled without printing support");
return false;
#endif /* QT_NO_PRINTER */
#endif /* TQT_NO_PRINTER */
}
void KCHMViewWindow_QTextBrowser::searchWord( const QString & word, bool forward, bool )
void KCHMViewWindow_QTextBrowser::searchWord( const TQString & word, bool forward, bool )
{
if ( m_searchText == word )
{
@ -207,7 +207,7 @@ void KCHMViewWindow_QTextBrowser::searchWord( const QString & word, bool forward
m_searchText = word;
}
if ( find (m_searchText, false, false, forward, &m_searchLastParagraph, &m_searchLastIndex) )
if ( tqfind (m_searchText, false, false, forward, &m_searchLastParagraph, &m_searchLastIndex) )
::mainWindow->showInStatusBar( i18n( "Search failed") );
}
@ -222,15 +222,15 @@ void KCHMViewWindow_QTextBrowser::clipCopy( )
}
// Shamelessly stolen from Qt
QString KCHMViewWindow_QTextBrowser::decodeUrl( const QString &input )
// Shamelessly stolen from TQt
TQString KCHMViewWindow_QTextBrowser::decodeUrl( const TQString &input )
{
QString temp;
TQString temp;
int i = 0;
int len = input.length();
int a, b;
QChar c;
TQChar c;
while (i < len)
{
c = input[i];
@ -247,7 +247,7 @@ QString KCHMViewWindow_QTextBrowser::decodeUrl( const QString &input )
else if (b >= 'a' && b <= 'f') b = b - 'a' + 10;
else if (b >= 'A' && b <= 'F') b = b - 'A' + 10;
temp.append( (QChar)((a << 4) | b ) );
temp.append( (TQChar)((a << 4) | b ) );
}
else
{
@ -260,9 +260,9 @@ QString KCHMViewWindow_QTextBrowser::decodeUrl( const QString &input )
return temp;
}
QPopupMenu * KCHMViewWindow_QTextBrowser::createPopupMenu( const QPoint & pos )
TQPopupMenu * KCHMViewWindow_QTextBrowser::createPopupMenu( const TQPoint & pos )
{
KQPopupMenu * menu = getContextMenu( anchorAt( pos ), this );
KTQPopupMenu * menu = getContextMenu( anchorAt( pos ), this );
menu->exec( mapToGlobal( contentsToViewport( pos ) ) );
return 0;
}

@ -19,8 +19,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#ifndef KCHMVIEWWINDOW_QTEXTBROWSER_H
#define KCHMVIEWWINDOW_QTEXTBROWSER_H
#ifndef KCHMVIEWWINDOW_TQTEXTBROWSER_H
#define KCHMVIEWWINDOW_TQTEXTBROWSER_H
#include "kde-qt.h"
@ -30,18 +30,19 @@
/**
@author Georgy Yunaev
*/
class KCHMViewWindow_QTextBrowser : public QTextBrowser, public KCHMViewWindow
class KCHMViewWindow_QTextBrowser : public TQTextBrowser, public KCHMViewWindow
{
Q_OBJECT
TQ_OBJECT
public:
KCHMViewWindow_QTextBrowser( QTabWidget * parent );
KCHMViewWindow_QTextBrowser( TQTabWidget * tqparent );
~KCHMViewWindow_QTextBrowser();
//! Open a page from current chm archive
virtual bool openPage (const QString& url);
virtual bool openPage (const TQString& url);
//! Invalidate current view, doing all the cleanups etc.
virtual void invalidate();
virtual void tqinvalidate();
//! Return current ZoomFactor.
virtual int getZoomFactor() const { return m_zoomfactor; }
@ -55,8 +56,8 @@ public:
//! Popups the print dialog, and prints the current page on the printer.
virtual bool printCurrentPage();
//! Initiates the find-in-page search, if succeed, cursor moved to the first entry
virtual void searchWord( const QString & word, bool forward = true, bool casesensitive = false );
//! Initiates the tqfind-in-page search, if succeed, cursor moved to the first entry
virtual void searchWord( const TQString & word, bool forward = true, bool casesensitive = false );
//! Select the content of the whole page
virtual void clipSelectAll();
@ -74,10 +75,10 @@ public:
//! Sets the scrollbar position.
virtual void setScrollbarPosition(int pos);
virtual QObject * getQObject() { return this; }
virtual QWidget * getQWidget() { return this; }
virtual TQObject * getTQObject() { return TQT_TQOBJECT(this); }
virtual TQWidget * getTQWidget() { return TQT_TQWIDGET(this); }
static QString decodeUrl( const QString &url );
static TQString decodeUrl( const TQString &url );
signals:
/*!
@ -85,23 +86,23 @@ signals:
* If signalLinkClicked() sets follow_link to false, the current page should NOT change.
* Otherwise it should be changed to the new link value.
*/
void signalLinkClicked ( const QString & newlink, bool& follow_link );
void signalLinkClicked ( const TQString & newlink, bool& follow_link );
private slots:
virtual void slotLinkClicked (const QString & newlink);
virtual void slotLinkClicked (const TQString & newlink);
private:
QPopupMenu * createPopupMenu ( const QPoint & pos );
void setSource ( const QString & name );
TQPopupMenu * createPopupMenu ( const TQPoint & pos );
void setSource ( const TQString & name );
int m_zoomfactor;
bool m_allowSourceChange;
int m_searchLastIndex;
int m_searchLastParagraph;
QString m_searchText;
TQString m_searchText;
KCHMSourceFactory * m_sourcefactory;
};
#endif /* KCHMVIEWWINDOW_QTEXTBROWSER_H */
#endif /* KCHMVIEWWINDOW_TQTEXTBROWSER_H */

@ -19,7 +19,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#include <qaccel.h>
#include <tqaccel.h>
#include "kchmconfig.h"
#include "kchmmainwindow.h"
@ -34,22 +34,22 @@
#endif
KCHMViewWindowMgr::KCHMViewWindowMgr( QWidget *parent )
: QTabWidget( parent ) //QTabWidget
KCHMViewWindowMgr::KCHMViewWindowMgr( TQWidget *tqparent )
: TQTabWidget( tqparent ) //TQTabWidget
{
m_MenuWindow = 0;
// on current tab changed
connect( this, SIGNAL( currentChanged(QWidget *) ), this, SLOT( onTabChanged(QWidget *) ) );
connect( this, TQT_SIGNAL( currentChanged(TQWidget *) ), this, TQT_SLOT( onTabChanged(TQWidget *) ) );
// Create an iconset for the button
QIconSet iset( *gIconStorage.getCloseWindowIcon() );
TQIconSet iset( *gIconStorage.getCloseWindowIcon() );
// Create a pushbutton
m_closeButton = new QPushButton( iset, QString::null, this );
m_closeButton = new TQPushButton( iset, TQString(), this );
m_closeButton->setFlat( true );
m_closeButton->setEnabled( false );
connect( m_closeButton, SIGNAL( clicked() ), this, SLOT( closeCurrentWindow() ) );
connect( m_closeButton, TQT_SIGNAL( clicked() ), this, TQT_SLOT( closeCurrentWindow() ) );
setCornerWidget( m_closeButton, TopRight);
}
@ -58,20 +58,20 @@ KCHMViewWindowMgr::~KCHMViewWindowMgr( )
{
}
void KCHMViewWindowMgr::createMenu( KCHMMainWindow * parent )
void KCHMViewWindowMgr::createMenu( KCHMMainWindow * tqparent )
{
// Create the approptiate menu entries in 'View' main menu
m_MenuWindow = new KQPopupMenu( parent );
parent->menuBar()->insertItem( i18n( "&Window"), m_MenuWindow );
m_MenuWindow = new KTQPopupMenu( tqparent );
tqparent->menuBar()->insertItem( i18n( "&Window"), m_MenuWindow );
m_menuIdClose = m_MenuWindow->insertItem( i18n( "&Close"), this, SLOT( closeCurrentWindow()), CTRL+Key_W );
m_menuIdClose = m_MenuWindow->insertItem( i18n( "&Close"), this, TQT_SLOT( closeCurrentWindow()), CTRL+Key_W );
m_MenuWindow->insertSeparator();
//connect( m_MenuWindow, SIGNAL( activated(int) ), this, SLOT ( onCloseWindow(int) ));
connect( m_MenuWindow, SIGNAL( activated(int) ), this, SLOT ( onActiveWindow(int) ));
//connect( m_MenuWindow, TQT_SIGNAL( activated(int) ), this, TQT_SLOT ( onCloseWindow(int) ));
connect( m_MenuWindow, TQT_SIGNAL( activated(int) ), this, TQT_SLOT ( onActiveWindow(int) ));
}
void KCHMViewWindowMgr::invalidate()
void KCHMViewWindowMgr::tqinvalidate()
{
deleteAllWindows();
addNewTab( true );
@ -80,10 +80,10 @@ void KCHMViewWindowMgr::invalidate()
KCHMViewWindow * KCHMViewWindowMgr::current()
{
QWidget * w = currentPage();
TQWidget * w = currentPage();
WindowsIterator it;
if ( !w || (it = m_Windows.find( w )) == m_Windows.end() )
if ( !w || (it = m_Windows.tqfind( w )) == m_Windows.end() )
qFatal( "KCHMViewWindowMgr::current called without any windows!" );
return it.data().window;
@ -94,13 +94,13 @@ KCHMViewWindow * KCHMViewWindowMgr::addNewTab( bool set_active )
KCHMViewWindow * viewvnd;
#if defined (USE_KDE)
if ( !appConfig.m_kdeUseQTextBrowser )
if ( !appConfig.m_kdeUseTQTextBrowser )
viewvnd = new KCHMViewWindow_KHTMLPart( this );
else
#endif
viewvnd = new KCHMViewWindow_QTextBrowser( this );
QWidget * widget = viewvnd->getQWidget();
TQWidget * widget = viewvnd->getTQWidget();
m_Windows[widget].window = viewvnd;
m_Windows[widget].menuitem = 0;
m_Windows[widget].widget = widget;
@ -114,7 +114,7 @@ KCHMViewWindow * KCHMViewWindowMgr::addNewTab( bool set_active )
showPage( widget );
// Handle clicking on link in browser window
connect( viewvnd->getQObject(), SIGNAL( signalLinkClicked (const QString &, bool &) ), ::mainWindow, SLOT( slotLinkClicked(const QString &, bool &) ) );
connect( viewvnd->getTQObject(), TQT_SIGNAL( signalLinkClicked (const TQString &, bool &) ), ::mainWindow, TQT_SLOT( slotLinkClicked(const TQString &, bool &) ) );
return viewvnd;
}
@ -128,18 +128,18 @@ void KCHMViewWindowMgr::deleteAllWindows( )
void KCHMViewWindowMgr::setTabName( KCHMViewWindow * window )
{
WindowsIterator it = m_Windows.find( window->getQWidget() );
WindowsIterator it = m_Windows.tqfind( window->getTQWidget() );
if ( it == m_Windows.end() )
qFatal( "KCHMViewWindowMgr::setTabName called with unknown window!" );
QString title = window->getTitle();
TQString title = window->getTitle();
// Trim too long string
if ( title.length() > 25 )
title = title.left( 22 ) + "...";
setTabLabel( window->getQWidget(), title );
setTabLabel( window->getTQWidget(), title );
if ( it.data().menuitem == 0 )
{
@ -154,14 +154,14 @@ void KCHMViewWindowMgr::setTabName( KCHMViewWindow * window )
else
menuid = m_Windows.size();
QString menutitle = "&" + QString::number(menuid) + " " + title;
TQString menutitle = "&" + TQString::number(menuid) + " " + title;
it.data().menuitem = menuid;
m_MenuWindow->insertItem(menutitle, menuid);
updateTabAccel();
}
else
{
QString menutitle = "&" + QString::number(it.data().menuitem) + " " + title;
TQString menutitle = "&" + TQString::number(it.data().menuitem) + " " + title;
m_MenuWindow->changeItem( it.data().menuitem, menutitle );
}
@ -174,10 +174,10 @@ void KCHMViewWindowMgr::closeCurrentWindow( )
if ( m_Windows.size() == 1 )
return;
QWidget * w = currentPage();
TQWidget * w = currentPage();
WindowsIterator it;
if ( !w || (it = m_Windows.find( w )) == m_Windows.end() )
if ( !w || (it = m_Windows.tqfind( w )) == m_Windows.end() )
qFatal( "KCHMViewWindowMgr::closeCurrentWindow called without any windows!" );
closeWindow( it.data() );
@ -185,7 +185,7 @@ void KCHMViewWindowMgr::closeCurrentWindow( )
void KCHMViewWindowMgr::closeWindow( const tab_window_t & tab )
{
WindowsIterator it = m_Windows.find( tab.widget );
WindowsIterator it = m_Windows.tqfind( tab.widget );
if ( it == m_Windows.end() )
qFatal( "KCHMViewWindowMgr::closeWindow called with unknown widget!" );
@ -224,7 +224,7 @@ void KCHMViewWindowMgr::onActiveWindow(int id)
if ( it.data().menuitem != id )
continue;
QWidget *widget = it.data().widget;
TQWidget *widget = it.data().widget;
showPage(widget);
break;
}
@ -252,8 +252,8 @@ void KCHMViewWindowMgr::saveSettings( KCHMSettings::viewindow_saved_settings_t &
for ( int i = 0; i < count(); i++ )
{
QWidget * p = page( i );
WindowsIterator it = m_Windows.find( p );
TQWidget * p = page( i );
WindowsIterator it = m_Windows.tqfind( p );
if ( it == m_Windows.end() )
qFatal( "KCHMViewWindowMgr::saveSettings: could not find widget!" );
@ -272,9 +272,9 @@ void KCHMViewWindowMgr::updateCloseButtons( )
m_closeButton->setEnabled( m_Windows.size() > 1 );
}
void KCHMViewWindowMgr::onTabChanged( QWidget * newtab )
void KCHMViewWindowMgr::onTabChanged( TQWidget * newtab )
{
WindowsIterator it = m_Windows.find( newtab );
WindowsIterator it = m_Windows.tqfind( newtab );
if ( it == m_Windows.end() )
qFatal( "KCHMViewWindowMgr::onTabChanged called with unknown widget!" );
@ -304,7 +304,7 @@ void KCHMViewWindowMgr::updateTabAccel()
}
}
QKeySequence KCHMViewWindowMgr::key(int i)
TQKeySequence KCHMViewWindowMgr::key(int i)
{
switch (i)
{

@ -26,13 +26,14 @@
#include "forwarddeclarations.h"
#include "kchmsettings.h"
#include <qvaluevector.h>
#include <tqvaluevector.h>
class KCHMViewWindowMgr : public QTabWidget
class KCHMViewWindowMgr : public TQTabWidget
{
Q_OBJECT
TQ_OBJECT
public:
KCHMViewWindowMgr( QWidget *parent = 0 );
KCHMViewWindowMgr( TQWidget *tqparent = 0 );
~KCHMViewWindowMgr( );
// Returns a handle to a currently viewed window.
@ -45,10 +46,10 @@ class KCHMViewWindowMgr : public QTabWidget
// Sets the tab name and updates Windows menu
void setTabName( KCHMViewWindow* window );
void invalidate();
void tqinvalidate();
// Creates a Window menu
void createMenu( KCHMMainWindow * parent );
void createMenu( KCHMMainWindow * tqparent );
// Saves and restores current settings between sessions
void restoreSettings( const KCHMSettings::viewindow_saved_settings_t& settings );
@ -58,7 +59,7 @@ class KCHMViewWindowMgr : public QTabWidget
void closeCurrentWindow();
protected slots:
void onTabChanged( QWidget * newtab );
void onTabChanged( TQWidget * newtab );
void onCloseWindow( int id );
void onActiveWindow( int id );
void updateCloseButtons();
@ -66,7 +67,7 @@ class KCHMViewWindowMgr : public QTabWidget
private:
typedef struct
{
QWidget * widget;
TQWidget * widget;
KCHMViewWindow * window;
int menuitem;
} tab_window_t;
@ -74,16 +75,16 @@ class KCHMViewWindowMgr : public QTabWidget
void closeWindow( const tab_window_t& tab );
void deleteAllWindows();
void updateTabAccel();
QKeySequence key(int);
TQKeySequence key(int);
QMap<QWidget*,tab_window_t> m_Windows;
typedef QMap<QWidget*,tab_window_t>::iterator WindowsIterator;
TQMap<TQWidget*,tab_window_t> m_Windows;
typedef TQMap<TQWidget*,tab_window_t>::iterator WindowsIterator;
QValueList<int> m_idSlot;
typedef QValueList<int>::iterator IdIterator;
TQValueList<int> m_idSlot;
typedef TQValueList<int>::iterator IdIterator;
QPushButton * m_closeButton;
KQPopupMenu * m_MenuWindow;
TQPushButton * m_closeButton;
KTQPopupMenu * m_MenuWindow;
int m_menuIdClose;
};

@ -22,17 +22,17 @@
#include "kde-qt.h"
#if defined (USE_KDE)
KQListView::KQListView( QWidget * parent, const char * name, int )
: KListView (parent, name)
KQListView::KQListView( TQWidget * tqparent, const char * name, int )
: KListView (tqparent, name)
#else
KQListView::KQListView( QWidget * parent, const char * name, int f )
: QListView (parent, name, f)
KQListView::KQListView( TQWidget * tqparent, const char * name, int f )
: TQListView (tqparent, name, f)
#endif
{
}
#if defined (USE_KDE)
KQProgressModalDialog::KQProgressModalDialog ( const QString & captionText, const QString & labelText, const QString & cancelButtonText, int totalSteps, QWidget * creator )
KTQProgressModalDialog::KTQProgressModalDialog ( const TQString & captionText, const TQString & labelText, const TQString & cancelButtonText, int totalSteps, TQWidget * creator )
: KProgressDialog( creator, 0, captionText, labelText, true )
{
setAllowCancel( true );
@ -43,8 +43,8 @@ KQProgressModalDialog::KQProgressModalDialog ( const QString & captionText, cons
setMinimumDuration( 1 );
}
#else
KQProgressModalDialog::KQProgressModalDialog ( const QString & captionText, const QString & labelText, const QString & cancelButtonText, int totalSteps, QWidget * creator )
: QProgressDialog( labelText, cancelButtonText, totalSteps, creator, 0, false )
KTQProgressModalDialog::KTQProgressModalDialog ( const TQString & captionText, const TQString & labelText, const TQString & cancelButtonText, int totalSteps, TQWidget * creator )
: TQProgressDialog( labelText, cancelButtonText, totalSteps, creator, 0, false )
{
setCaption( captionText );
setMinimumDuration( 1 );

@ -19,15 +19,15 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#ifndef KDE_QT_H
#define KDE_QT_H
#ifndef KDE_TQT_H
#define KDE_TQT_H
#include "config.h"
#if defined (USE_KDE)
#define KQ_CLASSNAME(name) K##name
#define KQ_DECLARECLASS(name) class KQ##name : public K##name
#define KTQ_CLASSNAME(name) K##name
#define KTQ_DECLARECLASS(name) class KQ##name : public K##name
#include <kapplication.h>
#include <kmainwindow.h>
@ -46,63 +46,63 @@
#else /* !USE_KDE */
#define KQ_CLASSNAME(name) Q##name
#define KTQ_CLASSNAME(name) Q##name
#include <qapplication.h>
#include <qmainwindow.h>
#include <qstring.h>
#include <qstatusbar.h>
#include <qlistview.h>
#include <qfiledialog.h>
#include <qmenubar.h>
#include <qtabwidget.h>
#include <qmessagebox.h>
#include <qprogressdialog.h>
#include <tqapplication.h>
#include <tqmainwindow.h>
#include <tqstring.h>
#include <statusbar.h>
#include <tqlistview.h>
#include <tqfiledialog.h>
#include <tqmenubar.h>
#include <tqtabwidget.h>
#include <tqmessagebox.h>
#include <tqprogressdialog.h>
#define i18n(A) tr(A)
#endif /* USE_KDE */
/* common non-wrapped UI classes */
#include <qsplitter.h>
#include <qtoolbutton.h>
#include <qheader.h>
#include <qtextbrowser.h>
#include <qlayout.h>
#include <qlabel.h>
#include <qcombobox.h>
#include <qpushbutton.h>
#include <tqsplitter.h>
#include <tqtoolbutton.h>
#include <tqheader.h>
#include <tqtextbrowser.h>
#include <tqlayout.h>
#include <tqlabel.h>
#include <tqcombobox.h>
#include <tqpushbutton.h>
/* common utility classes */
#include <qwhatsthis.h>
#include <qstring.h>
#include <qtextedit.h>
#include <qfile.h>
#include <qdir.h>
#include <qregexp.h>
#include <qtimer.h>
#include <qmap.h>
#include <qeventloop.h>
class KQMainWindow : public KQ_CLASSNAME(MainWindow)
#include <tqwhatsthis.h>
#include <tqstring.h>
#include <tqtextedit.h>
#include <tqfile.h>
#include <tqdir.h>
#include <tqregexp.h>
#include <tqtimer.h>
#include <tqmap.h>
#include <tqeventloop.h>
class KQMainWindow : public KTQ_CLASSNAME(MainWindow)
{
public:
KQMainWindow ( QWidget * parent, const char * name, WFlags f )
: KQ_CLASSNAME(MainWindow) (parent, name, f) {};
KQMainWindow ( TQWidget * tqparent, const char * name, WFlags f )
: KTQ_CLASSNAME(MainWindow) (tqparent, name, f) {};
};
class KQListView : public KQ_CLASSNAME(ListView)
class KQListView : public KTQ_CLASSNAME(ListView)
{
public:
KQListView(QWidget *parent = 0, const char *name = 0, int f = 0);
KQListView(TQWidget *tqparent = 0, const char *name = 0, int f = 0);
};
class KQProgressModalDialog : public KQ_CLASSNAME(ProgressDialog)
class KTQProgressModalDialog : public KTQ_CLASSNAME(ProgressDialog)
{
public:
KQProgressModalDialog ( const QString & captionText, const QString & labelText, const QString & cancelButtonText, int totalSteps, QWidget * creator = 0 );
KTQProgressModalDialog ( const TQString & captionText, const TQString & labelText, const TQString & cancelButtonText, int totalSteps, TQWidget * creator = 0 );
// Seems like people have fun making classes incompatible
#if defined (USE_KDE)
@ -113,36 +113,36 @@ class KQProgressModalDialog : public KQ_CLASSNAME(ProgressDialog)
#endif
};
class KQTabWidget : public KQ_CLASSNAME(TabWidget)
class KTQTabWidget : public KTQ_CLASSNAME(TabWidget)
{
public:
KQTabWidget (QWidget *parent = 0, const char *name = 0, int f = 0)
: KQ_CLASSNAME(TabWidget) (parent, name, f) {};
KTQTabWidget (TQWidget *tqparent = 0, const char *name = 0, int f = 0)
: KTQ_CLASSNAME(TabWidget) (tqparent, name, f) {};
};
class KQPopupMenu : public KQ_CLASSNAME(PopupMenu)
class KTQPopupMenu : public KTQ_CLASSNAME(PopupMenu)
{
public:
KQPopupMenu (QWidget *parent = 0 )
: KQ_CLASSNAME(PopupMenu) (parent) {};
KTQPopupMenu (TQWidget *tqparent = 0 )
: KTQ_CLASSNAME(PopupMenu) (tqparent) {};
};
#include <qinputdialog.h>
#include <qcheckbox.h>
#include <qtextedit.h>
#include <qradiobutton.h>
#include <qspinbox.h>
#include <qgroupbox.h>
#include <qbuttongroup.h>
#include <qtooltip.h>
#include <tqinputdialog.h>
#include <tqcheckbox.h>
#include <tqtextedit.h>
#include <tqradiobutton.h>
#include <tqspinbox.h>
#include <tqgroupbox.h>
#include <tqbuttongroup.h>
#include <tqtooltip.h>
class KCHMShowWaitCursor
{
public:
KCHMShowWaitCursor() { QApplication::setOverrideCursor( QCursor(Qt::WaitCursor) ); }
~KCHMShowWaitCursor() { QApplication::restoreOverrideCursor(); }
KCHMShowWaitCursor() { TQApplication::setOverrideCursor( TQCursor(TQt::WaitCursor) ); }
~KCHMShowWaitCursor() { TQApplication::restoreOverrideCursor(); }
};
#endif /* KDE_QT_H */
#endif /* KDE_TQT_H */

@ -26,8 +26,8 @@
#include "kchmsearchwindow.h"
KCHMDCOPIface::KCHMDCOPIface(QObject *parent, const char *name)
: QObject(parent, name), DCOPObject( "KCHMDCOPIface" )
KCHMDCOPIface::KCHMDCOPIface(TQObject *tqparent, const char *name)
: TQObject(tqparent, name), DCOPObject( "KCHMDCOPIface" )
{
}
@ -37,50 +37,50 @@ KCHMDCOPIface::~KCHMDCOPIface()
}
void KCHMDCOPIface::loadHelpFile( const QString & filename, const QString & page2open )
void KCHMDCOPIface::loadHelpFile( const TQString & filename, const TQString & page2open )
{
QStringList args;
TQStringList args;
args.push_back( filename );
args.push_back( page2open );
qApp->postEvent( ::mainWindow, new KCHMUserEvent( "loadAndOpen", args ) );
tqApp->postEvent( ::mainWindow, new KCHMUserEvent( "loadAndOpen", args ) );
}
void KCHMDCOPIface::openPage( const QString & page2open )
void KCHMDCOPIface::openPage( const TQString & page2open )
{
QStringList args;
TQStringList args;
args.push_back( page2open );
qApp->postEvent( ::mainWindow, new KCHMUserEvent( "openPage", args ) );
tqApp->postEvent( ::mainWindow, new KCHMUserEvent( "openPage", args ) );
}
void KCHMDCOPIface::guiFindInIndex( const QString & word )
void KCHMDCOPIface::guiFindInIndex( const TQString & word )
{
QStringList args;
TQStringList args;
args.push_back( word );
qApp->postEvent( ::mainWindow, new KCHMUserEvent( "findInIndex", args ) );
tqApp->postEvent( ::mainWindow, new KCHMUserEvent( "findInIndex", args ) );
}
void KCHMDCOPIface::guiSearchQuery( const QString & query )
void KCHMDCOPIface::guiSearchQuery( const TQString & query )
{
QStringList args;
TQStringList args;
args.push_back( query );
qApp->postEvent( ::mainWindow, new KCHMUserEvent( "searchQuery", args ) );
tqApp->postEvent( ::mainWindow, new KCHMUserEvent( "searchQuery", args ) );
}
QStringList KCHMDCOPIface::searchQuery( const QString & query )
TQStringList KCHMDCOPIface::searchQuery( const TQString & query )
{
QStringList results;
TQStringList results;
if ( ::mainWindow->searchWindow()->searchQuery( query, &results ) )
return results;
else
return QStringList();
return TQStringList();
}

@ -22,37 +22,38 @@
#ifndef KCHMDCOPIFACE_H
#define KCHMDCOPIFACE_H
#include <qobject.h>
#include <tqobject.h>
#include <dcopobject.h>
#include <qstring.h>
#include <qstringlist.h>
#include <tqstring.h>
#include <tqstringlist.h>
class KCHMDCOPIface : public QObject, public DCOPObject
class KCHMDCOPIface : public TQObject, public DCOPObject
{
Q_OBJECT
// TQ_OBJECT
K_DCOP
public:
KCHMDCOPIface( QObject *parent = 0, const char *name = 0 );
KCHMDCOPIface( TQObject *tqparent = 0, const char *name = 0 );
~KCHMDCOPIface();
k_dcop:
//! Loads a CHM file \a filename , and opens the URL \a url. Use URL "/" to open default homepage
void loadHelpFile( const QString& filename, const QString& url );
void loadHelpFile( const TQString& filename, const TQString& url );
//! Opens a specific \a url inside the loaded CHM file
void openPage( const QString& url );
void openPage( const TQString& url );
//! Tries to find word in index, opening the index window and scrolling it there
void guiFindInIndex( const QString& word );
void guiFindInIndex( const TQString& word );
//! Executes a search in GUI. \a query contains the complete search query.
void guiSearchQuery( const QString& query );
void guiSearchQuery( const TQString& query );
//! Executes a search; GUI is not involved and user sees nothing.
//! \a query contains the complete search query.
//! Returns a list of URLs, or empty array if nothing os
QStringList searchQuery( const QString& query );
TQStringList searchQuery( const TQString& query );
};
#endif

@ -12,11 +12,11 @@
static const char* const KCHMDCOPIface_ftable[6][3] = {
{ "void", "loadHelpFile(QString,QString)", "loadHelpFile(QString filename,QString url)" },
{ "void", "openPage(QString)", "openPage(QString url)" },
{ "void", "guiFindInIndex(QString)", "guiFindInIndex(QString word)" },
{ "void", "guiSearchQuery(QString)", "guiSearchQuery(QString query)" },
{ "QStringList", "searchQuery(QString)", "searchQuery(QString query)" },
{ "void", "loadHelpFile(TQString,TQString)", "loadHelpFile(TQString filename,TQString url)" },
{ "void", "openPage(TQString)", "openPage(TQString url)" },
{ "void", "guiFindInIndex(TQString)", "guiFindInIndex(TQString word)" },
{ "void", "guiSearchQuery(TQString)", "guiSearchQuery(TQString query)" },
{ TQSTRINGLIST_OBJECT_NAME_STRING, "searchQuery(TQString)", "searchQuery(TQString query)" },
{ 0, 0, 0 }
};
static const int KCHMDCOPIface_ftable_hiddens[5] = {
@ -27,46 +27,46 @@ static const int KCHMDCOPIface_ftable_hiddens[5] = {
0,
};
bool KCHMDCOPIface::process(const QCString &fun, const QByteArray &data, QCString& replyType, QByteArray &replyData)
bool KCHMDCOPIface::process(const TQCString &fun, const TQByteArray &data, TQCString& replyType, TQByteArray &replyData)
{
if ( fun == KCHMDCOPIface_ftable[0][1] ) { // void loadHelpFile(QString,QString)
QString arg0;
QString arg1;
QDataStream arg( data, IO_ReadOnly );
if ( fun == KCHMDCOPIface_ftable[0][1] ) { // void loadHelpFile(TQString,TQString)
TQString arg0;
TQString arg1;
TQDataStream arg( data, IO_ReadOnly );
if (arg.atEnd()) return false;
arg >> arg0;
if (arg.atEnd()) return false;
arg >> arg1;
replyType = KCHMDCOPIface_ftable[0][0];
loadHelpFile(arg0, arg1 );
} else if ( fun == KCHMDCOPIface_ftable[1][1] ) { // void openPage(QString)
QString arg0;
QDataStream arg( data, IO_ReadOnly );
} else if ( fun == KCHMDCOPIface_ftable[1][1] ) { // void openPage(TQString)
TQString arg0;
TQDataStream arg( data, IO_ReadOnly );
if (arg.atEnd()) return false;
arg >> arg0;
replyType = KCHMDCOPIface_ftable[1][0];
openPage(arg0 );
} else if ( fun == KCHMDCOPIface_ftable[2][1] ) { // void guiFindInIndex(QString)
QString arg0;
QDataStream arg( data, IO_ReadOnly );
} else if ( fun == KCHMDCOPIface_ftable[2][1] ) { // void guiFindInIndex(TQString)
TQString arg0;
TQDataStream arg( data, IO_ReadOnly );
if (arg.atEnd()) return false;
arg >> arg0;
replyType = KCHMDCOPIface_ftable[2][0];
guiFindInIndex(arg0 );
} else if ( fun == KCHMDCOPIface_ftable[3][1] ) { // void guiSearchQuery(QString)
QString arg0;
QDataStream arg( data, IO_ReadOnly );
} else if ( fun == KCHMDCOPIface_ftable[3][1] ) { // void guiSearchQuery(TQString)
TQString arg0;
TQDataStream arg( data, IO_ReadOnly );
if (arg.atEnd()) return false;
arg >> arg0;
replyType = KCHMDCOPIface_ftable[3][0];
guiSearchQuery(arg0 );
} else if ( fun == KCHMDCOPIface_ftable[4][1] ) { // QStringList searchQuery(QString)
QString arg0;
QDataStream arg( data, IO_ReadOnly );
} else if ( fun == KCHMDCOPIface_ftable[4][1] ) { // TQStringList searchQuery(TQString)
TQString arg0;
TQDataStream arg( data, IO_ReadOnly );
if (arg.atEnd()) return false;
arg >> arg0;
replyType = KCHMDCOPIface_ftable[4][0];
QDataStream _replyStream( replyData, IO_WriteOnly );
TQDataStream _replyStream( replyData, IO_WriteOnly );
_replyStream << searchQuery(arg0 );
} else {
return DCOPObject::process( fun, data, replyType, replyData );
@ -87,7 +87,7 @@ QCStringList KCHMDCOPIface::functions()
for ( int i = 0; KCHMDCOPIface_ftable[i][2]; i++ ) {
if (KCHMDCOPIface_ftable_hiddens[i])
continue;
QCString func = KCHMDCOPIface_ftable[i][0];
TQCString func = KCHMDCOPIface_ftable[i][0];
func += ' ';
func += KCHMDCOPIface_ftable[i][2];
funcs << func;

@ -19,7 +19,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#include <qclipboard.h>
#include <tqclipboard.h>
#include <khtmlview.h>
#include <kfinddialog.h>
@ -32,25 +32,25 @@
#include "kchmviewwindow_khtmlpart.moc"
QWidget * KCHMViewWindow_KHTMLPart::getQWidget()
TQWidget * KCHMViewWindow_KHTMLPart::getTQWidget()
{
return view();
}
KCHMViewWindow_KHTMLPart::KCHMViewWindow_KHTMLPart( QTabWidget * parent )
: KHTMLPart ( parent ), KCHMViewWindow ( parent )
KCHMViewWindow_KHTMLPart::KCHMViewWindow_KHTMLPart( TQTabWidget * tqparent )
: KHTMLPart ( tqparent ), KCHMViewWindow ( tqparent )
{
m_zoomfactor = 0;
m_currentEncoding = 0;
m_searchForward = true;
invalidate();
tqinvalidate();
connect( browserExtension(), SIGNAL( openURLRequest( const KURL &, const KParts::URLArgs & ) ),
this, SLOT ( onOpenURLRequest( const KURL &, const KParts::URLArgs & )) );
connect( browserExtension(), TQT_SIGNAL( openURLRequest( const KURL &, const KParts::URLArgs & ) ),
this, TQT_SLOT ( onOpenURLRequest( const KURL &, const KParts::URLArgs & )) );
connect( this, SIGNAL ( popupMenu ( const QString &, const QPoint &) ),
this, SLOT ( onPopupMenu ( const QString &, const QPoint &) ) );
connect( this, TQT_SIGNAL ( popupMenu ( const TQString &, const TQPoint &) ),
this, TQT_SLOT ( onPopupMenu ( const TQString &, const TQPoint &) ) );
}
@ -58,7 +58,7 @@ KCHMViewWindow_KHTMLPart::~KCHMViewWindow_KHTMLPart()
{
}
bool KCHMViewWindow_KHTMLPart::openPage (const QString& url)
bool KCHMViewWindow_KHTMLPart::openPage (const TQString& url)
{
// Set or change the encoding
if ( m_currentEncoding != ::mainWindow->chmFile()->currentEncoding() )
@ -67,7 +67,7 @@ bool KCHMViewWindow_KHTMLPart::openPage (const QString& url)
setEncoding ( m_currentEncoding->qtcodec, TRUE );
}
QString fullurl = "ms-its:" + ::mainWindow->getOpenedFileName() + "::" + url;
TQString fullurl = "ms-its:" + ::mainWindow->getOpenedFileName() + "::" + url;
openURL ( KURL(fullurl) );
return true;
@ -81,18 +81,18 @@ void KCHMViewWindow_KHTMLPart::setZoomFactor( int zoom )
KHTMLPart::setZoomFactor ( 100 + (m_zoomfactor * 10) );
}
void KCHMViewWindow_KHTMLPart::invalidate( )
void KCHMViewWindow_KHTMLPart::tqinvalidate( )
{
m_zoomfactor = 0;
m_searchForward = true;
m_searchText = QString::null;
m_searchText = TQString();
setJScriptEnabled ( appConfig.m_kdeEnableJS );
setJavaEnabled ( appConfig.m_kdeEnableJava );
setMetaRefreshEnabled ( appConfig.m_kdeEnableRefresh );
setPluginsEnabled ( appConfig.m_kdeEnablePlugins );
KCHMViewWindow::invalidate( );
KCHMViewWindow::tqinvalidate( );
}
int KCHMViewWindow_KHTMLPart::getScrollbarPosition( )
@ -116,7 +116,7 @@ bool KCHMViewWindow_KHTMLPart::printCurrentPage()
return true;
}
void KCHMViewWindow_KHTMLPart::searchWord( const QString & word, bool forward, bool )
void KCHMViewWindow_KHTMLPart::searchWord( const TQString & word, bool forward, bool )
{
if ( word != m_searchText || forward != m_searchForward )
{
@ -135,7 +135,7 @@ void KCHMViewWindow_KHTMLPart::onOpenURLRequest( const KURL & url, const KParts:
emit signalLinkClicked ( url.prettyURL(), sourcechange );
}
void KCHMViewWindow_KHTMLPart::slotLinkClicked( const QString & newlink )
void KCHMViewWindow_KHTMLPart::slotLinkClicked( const TQString & newlink )
{
bool notused;
emit signalLinkClicked (newlink, notused);
@ -149,15 +149,15 @@ void KCHMViewWindow_KHTMLPart::clipSelectAll()
void KCHMViewWindow_KHTMLPart::clipCopy()
{
QString text = selectedText();
TQString text = selectedText();
if ( !text.isEmpty() )
QApplication::clipboard()->setText( text );
TQApplication::tqclipboard()->setText( text );
}
void KCHMViewWindow_KHTMLPart::onPopupMenu ( const QString &url, const QPoint & point )
void KCHMViewWindow_KHTMLPart::onPopupMenu ( const TQString &url, const TQPoint & point )
{
KQPopupMenu * menu = getContextMenu( url, view() );
KTQPopupMenu * menu = getContextMenu( url, view() );
menu->exec( point );
}

@ -28,29 +28,33 @@
#include "kchmsourcefactory.h"
#include "libchmtextencoding.h"
#ifdef Q_MOC_RUN
#define USE_KDE
#endif // Q_MOC_RUN
/**
@author Georgy Yunaev
*/
/*
* For Qt-only version, we cannot compile KCHMViewWindow_KHTMLPart. However,
* we cannot just exclude it, because it would not generate a MOC file for a KDE
* version. Therefore we declare it, and compile the .moc file, but do not provide
* For TQt-only version, we cannot compile KCHMViewWindow_KHTMLPart. However,
* we cannot just exclude it, because it would not generate a TQMOC file for a KDE
* version. Therefore we declare it, and compile the .tqmoc file, but do not provide
* the class methods.
*/
#if defined (USE_KDE)
class KCHMViewWindow_KHTMLPart : public KHTMLPart, public KCHMViewWindow
{
Q_OBJECT
TQ_OBJECT
public:
KCHMViewWindow_KHTMLPart( QTabWidget * parent );
KCHMViewWindow_KHTMLPart( TQTabWidget * tqparent );
~KCHMViewWindow_KHTMLPart();
//! Open a page from current chm archive
virtual bool openPage (const QString& url);
virtual bool openPage (const TQString& url);
//! Invalidate current view, doing all the cleanups etc.
virtual void invalidate();
virtual void tqinvalidate();
//! Return current ZoomFactor.
virtual int getZoomFactor() const { return m_zoomfactor; }
@ -64,8 +68,8 @@ public:
//! Popups the print dialog, and prints the current page on the printer.
virtual bool printCurrentPage();
//! Initiates the find-in-page search, if succeed, cursor moved to the first entry
virtual void searchWord( const QString & word, bool forward = true, bool casesensitive = false );
//! Initiates the tqfind-in-page search, if succeed, cursor moved to the first entry
virtual void searchWord( const TQString & word, bool forward = true, bool casesensitive = false );
//! Select the content of the whole page
virtual void clipSelectAll();
@ -83,8 +87,8 @@ public:
//! Sets the scrollbar position.
virtual void setScrollbarPosition(int pos);
virtual QObject * getQObject() { return this; }
virtual QWidget * getQWidget();
virtual TQObject * getTQObject() { return this; }
virtual TQWidget * getTQWidget();
signals:
/*!
@ -92,19 +96,19 @@ signals:
* If signalLinkClicked() sets follow_link to false, the current page should NOT change.
* Otherwise it should be changed to the new link value.
*/
void signalLinkClicked ( const QString & newlink, bool& follow_link );
void signalLinkClicked ( const TQString & newlink, bool& follow_link );
private slots:
virtual void slotLinkClicked ( const QString & newlink);
virtual void slotLinkClicked ( const TQString & newlink);
virtual void onOpenURLRequest( const KURL &, const KParts::URLArgs & );
virtual void onPopupMenu ( const QString & url, const QPoint & point );
virtual void onPopupMenu ( const TQString & url, const TQPoint & point );
private:
void setSource ( const QString & name );
void setSource ( const TQString & name );
int m_zoomfactor;
bool m_searchForward;
QString m_searchText;
TQString m_searchText;
const LCHMTextEncoding * m_currentEncoding;
};

@ -22,14 +22,14 @@
#include <stdlib.h>
#include <unistd.h>
static bool run_process( const QString& command, const QString& filename )
static bool run_process( const TQString& command, const TQString& filename )
{
QString safefilename = filename;
QString preparedcommand = command;
TQString safefilename = filename;
TQString preparedcommand = command;
// To be safe, URL should contain no quotes, apostrofes and \0 symbols
safefilename.remove (QRegExp ("['\"\0]"));
preparedcommand.replace( "%s", safefilename );
safefilename.remove (TQRegExp ("['\"\0]"));
preparedcommand.tqreplace( "%s", safefilename );
// And run an external command with fork()s
switch ( fork() )
@ -39,12 +39,12 @@ static bool run_process( const QString& command, const QString& filename )
case 0: // child
if ( fork() != 0 )
exit(0); // exit immediately - our child is now has init as his parent
exit(0); // exit immediately - our child is now has init as his tqparent
system( preparedcommand.ascii() );
exit (0);
default: // parent
default: // tqparent
break;
}

@ -27,7 +27,7 @@
#include "kqtempfile.h"
KQTempFileKeeper::KQTempFileKeeper( )
KTQTempFileKeeper::KTQTempFileKeeper( )
{
#if defined(WIN32)
m_tempDir = ::GetTempDirectory();
@ -43,19 +43,19 @@ KQTempFileKeeper::KQTempFileKeeper( )
m_fileNumber = 1;
}
KQTempFileKeeper::~ KQTempFileKeeper( )
KTQTempFileKeeper::~ KTQTempFileKeeper( )
{
destroyTempFiles();
}
bool KQTempFileKeeper::generateTempFile( QFile & file, const QString & tempdir )
bool KTQTempFileKeeper::generateTempFile( TQFile & file, const TQString & tempdir )
{
QString usetempdir = ((tempdir != QString::null) ? tempdir : m_tempDir) + "/";
TQString usetempdir = ((tempdir != TQString()) ? tempdir : m_tempDir) + "/";
while( 1 )
{
char fnbuf[128];
sprintf( fnbuf, "KQTEMPFILE%d-%d-%d.tmp", (int) getpid(), (int) time(0), m_fileNumber++ );
sprintf( fnbuf, "KTQTEMPFILE%d-%d-%d.tmp", (int) getpid(), (int) time(0), m_fileNumber++ );
file.setName( usetempdir + fnbuf );
if ( file.open( IO_WriteOnly ) )
@ -65,8 +65,8 @@ bool KQTempFileKeeper::generateTempFile( QFile & file, const QString & tempdir )
return true;
}
void KQTempFileKeeper::destroyTempFiles( )
void KTQTempFileKeeper::destroyTempFiles( )
{
for ( unsigned int i = 0; i < m_tempFiles.size(); i++ )
QFile::remove( m_tempFiles[i] );
TQFile::remove( m_tempFiles[i] );
}

@ -19,35 +19,35 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#ifndef KQTEMPFILE_H
#define KQTEMPFILE_H
#ifndef KTQTEMPFILE_H
#define KTQTEMPFILE_H
#include <qvaluevector.h>
#include <qfile.h>
#include <tqvaluevector.h>
#include <tqfile.h>
/*
* This class generates temp file names in race condition-safe way,
* returns QFile and filename pairs, keeps the track of opened temp files,
* returns TQFile and filename pairs, keeps the track of opened temp files,
* and deletes them when program exist.
*/
class KQTempFileKeeper
class KTQTempFileKeeper
{
public:
KQTempFileKeeper();
~KQTempFileKeeper();
KTQTempFileKeeper();
~KTQTempFileKeeper();
//! Generates a temporary file name, and creates it on disk at the same time.
//! Returns the file. If tempdir is not empty, it is used as temp directory.
bool generateTempFile( QFile& file, const QString& tempdir = QString::null );
bool generateTempFile( TQFile& file, const TQString& tempdir = TQString() );
//! Closes and removes all the files from disk
void destroyTempFiles();
private:
QValueVector<QString> m_tempFiles;
QString m_tempDir;
TQValueVector<TQString> m_tempFiles;
TQString m_tempDir;
unsigned int m_fileNumber;
};
#endif /* KQTEMPFILE_H */
#endif /* KTQTEMPFILE_H */

@ -64,7 +64,7 @@ int main( int argc, char ** argv )
KApplication app;
#else
QApplication app( argc, argv );
TQApplication app( argc, argv );
#endif
appConfig.load();
@ -79,15 +79,15 @@ int main( int argc, char ** argv )
if ( !client->attach() )
qWarning("DCOP attach failed");
//QCString realAppId = client->registerAs( kapp->name() );
QCString realAppId = client->registerAs( "kchmviewer" );
//TQCString realAppId = client->registerAs( kapp->name() );
TQCString realAppId = client->registerAs( "kchmviewer" );
#endif
mainWindow = new KCHMMainWindow();
mainWindow->show();
#if !defined(USE_KDE)
app.connect( &app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()) );
app.connect( &app, TQT_SIGNAL(lastWindowClosed()), &app, TQT_SLOT(quit()) );
#else
app.setMainWidget( mainWindow );
#endif

Loading…
Cancel
Save