From 0a80cfd57d271dd44221467efb426675fa470356 Mon Sep 17 00:00:00 2001 From: tpearson Date: Tue, 28 Jun 2011 18:31:12 +0000 Subject: TQt4 port kvirc This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kvirc@1238719 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- src/modules/help/helpwindow.cpp | 134 ++++++++++++++++++++-------------------- 1 file changed, 67 insertions(+), 67 deletions(-) (limited to 'src/modules/help/helpwindow.cpp') diff --git a/src/modules/help/helpwindow.cpp b/src/modules/help/helpwindow.cpp index 9fc11427..73216c9e 100644 --- a/src/modules/help/helpwindow.cpp +++ b/src/modules/help/helpwindow.cpp @@ -32,12 +32,12 @@ #include "kvi_config.h" #include "kvi_styled_controls.h" -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include "kvi_valuelist.h" #include "kvi_sourcesdate.h" @@ -53,20 +53,20 @@ KviHelpWindow::KviHelpWindow(KviFrame * lpFrm,const char * name) if(!g_bIndexingDone) { - QString szDoclist,szDict; + TQString szDoclist,szDict; g_pApp->getLocalKvircDirectory(szDoclist,KviApp::Help,"help.doclist." KVI_SOURCES_DATE); g_pApp->getLocalKvircDirectory(szDict,KviApp::Help,"help.dict." KVI_SOURCES_DATE); - if ( QFileInfo( szDoclist ).exists() && QFileInfo( szDict ).exists() ) { + if ( TQFileInfo( szDoclist ).exists() && TQFileInfo( szDict ).exists() ) { g_pDocIndex->readDict(); } else { #ifdef COMPILE_USE_QT4 - QProgressDialog* pProgressDialog = new QProgressDialog( __tr2qs("Indexing help files"), __tr2qs("Cancel"), 0,100 ); + TQProgressDialog* pProgressDialog = new TQProgressDialog( __tr2qs("Indexing help files"), __tr2qs("Cancel"), 0,100 ); #else - QProgressDialog* pProgressDialog = new QProgressDialog( __tr2qs("Indexing help files"), __tr2qs("Cancel"), 100 ); + TQProgressDialog* pProgressDialog = new TQProgressDialog( __tr2qs("Indexing help files"), __tr2qs("Cancel"), 100 ); #endif - connect(g_pDocIndex,SIGNAL(indexingProgress(int)), pProgressDialog, SLOT(setProgress(int)) ); + connect(g_pDocIndex,TQT_SIGNAL(indexingProgress(int)), pProgressDialog, TQT_SLOT(setProgress(int)) ); g_pDocIndex->makeIndex(); g_pDocIndex->writeDict(); g_pDocIndex->writeDocumentList(); @@ -76,45 +76,45 @@ KviHelpWindow::KviHelpWindow(KviFrame * lpFrm,const char * name) } g_pHelpWindowList->append(this); - m_pSplitter = new QSplitter(Qt::Horizontal,this,"main_splitter"); + m_pSplitter = new TQSplitter(Qt::Horizontal,this,"main_splitter"); m_pHelpWidget = new KviHelpWidget(m_pSplitter,lpFrm); m_pToolBar=new KviTalVBox(m_pSplitter); - m_pTabWidget = new QTabWidget(m_pToolBar); + m_pTabWidget = new TQTabWidget(m_pToolBar); m_pIndexTab = new KviTalVBox(m_pTabWidget); m_pTabWidget->insertTab(m_pIndexTab,__tr2qs("Index")); KviTalHBox* pSearchBox = new KviTalHBox(m_pIndexTab); - m_pIndexSearch = new QLineEdit(pSearchBox); - connect( m_pIndexSearch, SIGNAL( textChanged(const QString&) ), - this, SLOT( searchInIndex(const QString&) ) ); - connect( m_pIndexSearch, SIGNAL( returnPressed() ), - this, SLOT( showIndexTopic() ) ); + m_pIndexSearch = new TQLineEdit(pSearchBox); + connect( m_pIndexSearch, TQT_SIGNAL( textChanged(const TQString&) ), + this, TQT_SLOT( searchInIndex(const TQString&) ) ); + connect( m_pIndexSearch, TQT_SIGNAL( returnPressed() ), + this, TQT_SLOT( showIndexTopic() ) ); KviStyledToolButton* pBtnRefreshIndex = new KviStyledToolButton(pSearchBox); pBtnRefreshIndex->setIconSet(*g_pIconManager->getBigIcon(KVI_REFRESH_IMAGE_NAME)); - connect(pBtnRefreshIndex,SIGNAL(clicked()),this,SLOT(refreshIndex())); - QToolTip::add( pBtnRefreshIndex, __tr2qs("Refresh index") ); + connect(pBtnRefreshIndex,TQT_SIGNAL(clicked()),this,TQT_SLOT(refreshIndex())); + TQToolTip::add( pBtnRefreshIndex, __tr2qs("Refresh index") ); m_pIndexListBox = new KviTalListBox(m_pIndexTab); - QStringList docList=g_pDocIndex->titlesList(); + TQStringList docList=g_pDocIndex->titlesList(); m_pIndexListBox->insertStringList(docList); - connect(m_pIndexListBox,SIGNAL(selected(int)),this,SLOT(indexSelected ( int ))); + connect(m_pIndexListBox,TQT_SIGNAL(selected(int)),this,TQT_SLOT(indexSelected ( int ))); m_pIndexListBox->sort(); m_pSearchTab = new KviTalVBox(m_pTabWidget); m_pTabWidget->insertTab(m_pSearchTab,__tr2qs("Search")); - m_pTermsEdit = new QLineEdit(m_pSearchTab); -/* connect( m_pTermsEdit, SIGNAL( textChanged(const QString&) ), - this, SLOT( searchInIndex(const QString&) ) );*/ - connect( m_pTermsEdit, SIGNAL( returnPressed() ), - this, SLOT( startSearch() ) ); + m_pTermsEdit = new TQLineEdit(m_pSearchTab); +/* connect( m_pTermsEdit, TQT_SIGNAL( textChanged(const TQString&) ), + this, TQT_SLOT( searchInIndex(const TQString&) ) );*/ + connect( m_pTermsEdit, TQT_SIGNAL( returnPressed() ), + this, TQT_SLOT( startSearch() ) ); m_pResultBox = new KviTalListBox(m_pSearchTab); - connect(m_pResultBox,SIGNAL(selected(int)),this,SLOT(searchSelected ( int ))); + connect(m_pResultBox,TQT_SIGNAL(selected(int)),this,TQT_SLOT(searchSelected ( int ))); KviValueList li; li.append(width()-80); @@ -149,17 +149,17 @@ void KviHelpWindow::refreshIndex() { m_pIndexListBox->clear(); #ifdef COMPILE_USE_QT4 - QProgressDialog* pProgressDialog = new QProgressDialog( __tr2qs("Indexing help files"), __tr2qs("Cancel"), 0,100 ); + TQProgressDialog* pProgressDialog = new TQProgressDialog( __tr2qs("Indexing help files"), __tr2qs("Cancel"), 0,100 ); #else - QProgressDialog* pProgressDialog = new QProgressDialog( __tr2qs("Indexing help files"), __tr2qs("Cancel"), 100 ); + TQProgressDialog* pProgressDialog = new TQProgressDialog( __tr2qs("Indexing help files"), __tr2qs("Cancel"), 100 ); #endif - connect(g_pDocIndex,SIGNAL(indexingProgress(int)), pProgressDialog, SLOT(setProgress(int)) ); + connect(g_pDocIndex,TQT_SIGNAL(indexingProgress(int)), pProgressDialog, TQT_SLOT(setProgress(int)) ); g_pDocIndex->makeIndex(); g_pDocIndex->writeDict(); g_pDocIndex->writeDocumentList(); delete pProgressDialog; g_bIndexingDone=TRUE; - QStringList docList=g_pDocIndex->titlesList(); + TQStringList docList=g_pDocIndex->titlesList(); m_pIndexListBox->insertStringList(docList); m_pIndexListBox->sort(); } @@ -167,54 +167,54 @@ void KviHelpWindow::refreshIndex() void KviHelpWindow::startSearch() { - QString str = m_pTermsEdit->text(); - str = str.replace( "\'", "\"" ); - str = str.replace( "`", "\"" ); - QString buf = str; - str = str.replace( "-", " " ); - str = str.replace( QRegExp( "\\s[\\S]?\\s" ), " " ); - m_terms = QStringList::split( " ", str ); - QStringList termSeq; - QStringList seqWords; - QStringList::iterator it = m_terms.begin(); + TQString str = m_pTermsEdit->text(); + str = str.tqreplace( "\'", "\"" ); + str = str.tqreplace( "`", "\"" ); + TQString buf = str; + str = str.tqreplace( "-", " " ); + str = str.tqreplace( TQRegExp( "\\s[\\S]?\\s" ), " " ); + m_terms = TQStringList::split( " ", str ); + TQStringList termSeq; + TQStringList seqWords; + TQStringList::iterator it = m_terms.begin(); for ( ; it != m_terms.end(); ++it ) { (*it) = (*it).simplifyWhiteSpace(); (*it) = (*it).lower(); - (*it) = (*it).replace( "\"", "" ); + (*it) = (*it).tqreplace( "\"", "" ); } - if ( str.contains( '\"' ) ) { + if ( str.tqcontains( '\"' ) ) { #ifdef COMPILE_USE_QT4 if ( (str.count( '\"' ))%2 == 0 ) { #else - if ( (str.contains( '\"' ))%2 == 0 ) { + if ( (str.tqcontains( '\"' ))%2 == 0 ) { #endif int beg = 0; int end = 0; - QString s; - beg = str.find( '\"', beg ); + TQString s; + beg = str.tqfind( '\"', beg ); while ( beg != -1 ) { beg++; - end = str.find( '\"', beg ); + end = str.tqfind( '\"', beg ); s = str.mid( beg, end - beg ); s = s.lower(); s = s.simplifyWhiteSpace(); - if ( s.contains( '*' ) ) { - QMessageBox::warning( this, tr( "Full Text Search" ), + if ( s.tqcontains( '*' ) ) { + TQMessageBox::warning( this, tr( "Full Text Search" ), tr( "Using a wildcard within phrases is not allowed." ) ); return; } - seqWords += QStringList::split( ' ', s ); + seqWords += TQStringList::split( ' ', s ); termSeq << s; - beg = str.find( '\"', end + 1); + beg = str.tqfind( '\"', end + 1); } } else { - QMessageBox::warning( this, tr( "Full Text Search" ), + TQMessageBox::warning( this, tr( "Full Text Search" ), tr( "The closing quotation mark is missing." ) ); return; } } #ifdef COMPILE_USE_QT4 - setCursor( Qt::WaitCursor ); + setCursor( TQt::WaitCursor ); #else setCursor( waitCursor ); #endif @@ -227,7 +227,7 @@ void KviHelpWindow::startSearch() m_terms.clear(); bool isPhrase = FALSE; - QString s = ""; + TQString s = ""; for ( int i = 0; i < (int)buf.length(); ++i ) { if ( buf[i] == '\"' ) { isPhrase = !isPhrase; @@ -247,13 +247,13 @@ void KviHelpWindow::startSearch() m_terms << s; #ifdef COMPILE_USE_QT4 - setCursor( Qt::ArrowCursor ); + setCursor( TQt::ArrowCursor ); #else setCursor( arrowCursor ); #endif } -QTextBrowser * KviHelpWindow::textBrowser() +TQTextBrowser * KviHelpWindow::textBrowser() { return m_pHelpWidget->textBrowser(); } @@ -261,16 +261,16 @@ QTextBrowser * KviHelpWindow::textBrowser() void KviHelpWindow::showIndexTopic() { if (m_pIndexSearch->text().isEmpty()|| !m_pIndexListBox->selectedItem()) return; - int i=g_pDocIndex->titlesList().findIndex(m_pIndexListBox->selectedItem()->text()); + int i=g_pDocIndex->titlesList().tqfindIndex(m_pIndexListBox->selectedItem()->text()); textBrowser()->setSource(g_pDocIndex->documentList()[ i ]); } -void KviHelpWindow::searchInIndex( const QString &s ) +void KviHelpWindow::searchInIndex( const TQString &s ) { KviTalListBoxItem *i = m_pIndexListBox->firstItem(); - QString sl = s.lower(); + TQString sl = s.lower(); while ( i ) { - QString t = i->text(); + TQString t = i->text(); if ( t.length() >= sl.length() && i->text().left(s.length()).lower() == sl ) { m_pIndexListBox->setCurrentItem( i ); @@ -283,29 +283,29 @@ void KviHelpWindow::searchInIndex( const QString &s ) void KviHelpWindow::indexSelected ( int index ) { - int i=g_pDocIndex->titlesList().findIndex(m_pIndexListBox->text(index)); + int i=g_pDocIndex->titlesList().tqfindIndex(m_pIndexListBox->text(index)); textBrowser()->setSource(g_pDocIndex->documentList()[ i ]); } void KviHelpWindow::searchSelected ( int index ) { - int i=g_pDocIndex->titlesList().findIndex(m_pResultBox->text(index)); + int i=g_pDocIndex->titlesList().tqfindIndex(m_pResultBox->text(index)); textBrowser()->setSource(g_pDocIndex->documentList()[ i ]); } -QPixmap * KviHelpWindow::myIconPtr() +TQPixmap * KviHelpWindow::myIconPtr() { return g_pIconManager->getSmallIcon(KVI_SMALLICON_MDIHELP); } -void KviHelpWindow::resizeEvent(QResizeEvent *e) +void KviHelpWindow::resizeEvent(TQResizeEvent *e) { m_pSplitter->setGeometry(0,0,width(),height()); } -QSize KviHelpWindow::sizeHint() const +TQSize KviHelpWindow::tqsizeHint() const { - return m_pHelpWidget->sizeHint(); + return m_pHelpWidget->tqsizeHint(); } void KviHelpWindow::fillCaptionBuffers() { -- cgit v1.2.1