summaryrefslogtreecommitdiffstats
path: root/src/kchmsearchengine.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-29 19:00:37 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-29 19:00:37 +0000
commit25794f504692e5a36c490438814e9dfda8aaa2dd (patch)
tree8061e6d27b5bc9042afdff177872779c4e8c9015 /src/kchmsearchengine.cpp
parent35ff2a942f63b5201c04f41c3097e61cdd7817e9 (diff)
downloadkchmviewer-25794f504692e5a36c490438814e9dfda8aaa2dd.tar.gz
kchmviewer-25794f504692e5a36c490438814e9dfda8aaa2dd.zip
TQt4 port kchmviewer
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kchmviewer@1234150 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/kchmsearchengine.cpp')
-rw-r--r--src/kchmsearchengine.cpp56
1 files changed, 28 insertions, 28 deletions
diff --git a/src/kchmsearchengine.cpp b/src/kchmsearchengine.cpp
index 6bd6c5e..cf79e2b 100644
--- a/src/kchmsearchengine.cpp
+++ b/src/kchmsearchengine.cpp
@@ -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;