diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-28 18:31:12 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-28 18:31:12 +0000 |
commit | 0a80cfd57d271dd44221467efb426675fa470356 (patch) | |
tree | 6f503a31aa078eaf8fa015cf1749808529d49fc9 /src/modules/help | |
parent | 3329e5a804e28ef3f5eb51d1e7affdd5a508e8f2 (diff) | |
download | kvirc-0a80cfd57d271dd44221467efb426675fa470356.tar.gz kvirc-0a80cfd57d271dd44221467efb426675fa470356.zip |
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
Diffstat (limited to 'src/modules/help')
-rw-r--r-- | src/modules/help/helpwidget.cpp | 64 | ||||
-rw-r--r-- | src/modules/help/helpwidget.h | 29 | ||||
-rw-r--r-- | src/modules/help/helpwindow.cpp | 134 | ||||
-rw-r--r-- | src/modules/help/helpwindow.h | 29 | ||||
-rwxr-xr-x | src/modules/help/index.cpp | 176 | ||||
-rwxr-xr-x | src/modules/help/index.h | 71 | ||||
-rw-r--r-- | src/modules/help/libkvihelp.cpp | 14 |
7 files changed, 260 insertions, 257 deletions
diff --git a/src/modules/help/helpwidget.cpp b/src/modules/help/helpwidget.cpp index 4036a0dd..67ee30b0 100644 --- a/src/modules/help/helpwidget.cpp +++ b/src/modules/help/helpwidget.cpp @@ -32,61 +32,61 @@ #include "helpwindow.h" #include "kvi_fileutils.h" -#include <qtoolbutton.h> -#include <qlineedit.h> -#include <qtooltip.h> -#include <qtimer.h> -#include <qclipboard.h> +#include <tqtoolbutton.h> +#include <tqlineedit.h> +#include <tqtooltip.h> +#include <tqtimer.h> +#include <tqclipboard.h> extern Index * g_pDocIndex; extern KviPointerList<KviHelpWindow> * g_pHelpWindowList; extern KviPointerList<KviHelpWidget> * g_pHelpWidgetList; -KviHelpWidget::KviHelpWidget(QWidget * par,KviFrame * lpFrm,bool bIsStandalone) -: QWidget(par,"help_widget") +KviHelpWidget::KviHelpWidget(TQWidget * par,KviFrame * lpFrm,bool bIsStandalone) +: TQWidget(par,"help_widget") { if(bIsStandalone)g_pHelpWidgetList->append(this); m_bIsStandalone = bIsStandalone; -//#warning "Re enable this when using Qt 3.0 : QProcess " - m_pTextBrowser = new QTextBrowser(this,"text_browser"); - m_pTextBrowser->setFrameStyle(QFrame::StyledPanel|QFrame::Sunken); +//#warning "Re enable this when using TQt 3.0 : TQProcess " + m_pTextBrowser = new TQTextBrowser(this,"text_browser"); + m_pTextBrowser->setFrameStyle(TQFrame::StyledPanel|TQFrame::Sunken); #ifndef COMPILE_USE_QT4 - m_pTextBrowser->setFocusPolicy(QWidget::NoFocus); + m_pTextBrowser->setFocusPolicy(TQ_NoFocus); #endif m_pToolBar = new KviTalHBox(this); m_pBtnIndex = new KviStyledToolButton(m_pToolBar); m_pBtnIndex->setIconSet(*g_pIconManager->getBigIcon(KVI_BIGICON_HELPINDEX)); - connect(m_pBtnIndex,SIGNAL(clicked()),this,SLOT(showIndex())); + connect(m_pBtnIndex,TQT_SIGNAL(clicked()),this,TQT_SLOT(showIndex())); //m_pBtnIndex->setUsesBigPixmap(true); m_pBtnBackward = new KviStyledToolButton(m_pToolBar); m_pBtnBackward->setIconSet(*g_pIconManager->getBigIcon(KVI_BIGICON_HELPBACK)); - connect(m_pBtnBackward,SIGNAL(clicked()),m_pTextBrowser,SLOT(backward())); + connect(m_pBtnBackward,TQT_SIGNAL(clicked()),m_pTextBrowser,TQT_SLOT(backward())); m_pBtnBackward->setEnabled(false); //m_pBtnBackward->setUsesBigPixmap(true); m_pBtnForward = new KviStyledToolButton(m_pToolBar); m_pBtnForward->setIconSet(*g_pIconManager->getBigIcon(KVI_BIGICON_HELPFORWARD)); - connect(m_pBtnForward,SIGNAL(clicked()),m_pTextBrowser,SLOT(forward())); + connect(m_pBtnForward,TQT_SIGNAL(clicked()),m_pTextBrowser,TQT_SLOT(forward())); m_pBtnForward->setEnabled(false); //m_pBtnForward->setUsesBigPixmap(true); - QWidget* pSpacer=new QWidget(m_pToolBar); + TQWidget* pSpacer=new TQWidget(m_pToolBar); if(bIsStandalone) { - QToolButton * b = new KviStyledToolButton(m_pToolBar); + TQToolButton * b = new KviStyledToolButton(m_pToolBar); b->setIconSet(*g_pIconManager->getBigIcon(KVI_BIGICON_HELPCLOSE)); - connect(b,SIGNAL(clicked()),this,SLOT(doClose())); + connect(b,TQT_SIGNAL(clicked()),this,TQT_SLOT(doClose())); //b->setUsesBigPixmap(true); } m_pToolBar->setStretchFactor(pSpacer,1); - connect(m_pTextBrowser,SIGNAL(backwardAvailable(bool)),m_pBtnBackward,SLOT(setEnabled(bool))); - connect(m_pTextBrowser,SIGNAL(forwardAvailable(bool)),m_pBtnForward,SLOT(setEnabled(bool))); + connect(m_pTextBrowser,TQT_SIGNAL(backwardAvailable(bool)),m_pBtnBackward,TQT_SLOT(setEnabled(bool))); + connect(m_pTextBrowser,TQT_SIGNAL(forwardAvailable(bool)),m_pBtnForward,TQT_SLOT(setEnabled(bool))); m_pTextBrowser->viewport()->installEventFilter(this); @@ -100,15 +100,15 @@ KviHelpWidget::~KviHelpWidget() void KviHelpWidget::showIndex() { #ifdef COMPILE_USE_QT4 - m_pTextBrowser->setSource(QUrl("index.html")); + m_pTextBrowser->setSource(TQUrl("index.html")); #else m_pTextBrowser->setSource("index.html"); #endif } -void KviHelpWidget::resizeEvent(QResizeEvent *e) +void KviHelpWidget::resizeEvent(TQResizeEvent *e) { - int hght = m_pToolBar->sizeHint().height(); + int hght = m_pToolBar->tqsizeHint().height(); if(hght < 40)hght = 40; m_pToolBar->setGeometry(0,0,width(),hght); m_pTextBrowser->setGeometry(0,hght,width(),height() - hght); @@ -116,10 +116,10 @@ void KviHelpWidget::resizeEvent(QResizeEvent *e) void KviHelpWidget::doClose() { - // hack needed to workaround "QToolBar::emulateButtonClicked()" + // hack needed to workaround "TQToolBar::emulateButtonClicked()" // that refers to the "this" pointer after this slot has been // called (from the "too-small-toolbar-for-all-items-popup") - QTimer::singleShot(0,this,SLOT(suicide())); + TQTimer::singleShot(0,this,TQT_SLOT(suicide())); } void KviHelpWidget::suicide() @@ -128,25 +128,25 @@ void KviHelpWidget::suicide() delete this; } -QSize KviHelpWidget::sizeHint() const +TQSize KviHelpWidget::tqsizeHint() const { - int wdth = m_pTextBrowser->sizeHint().width(); - if(m_pToolBar->sizeHint().width() > wdth)wdth = m_pToolBar->sizeHint().width(); - QSize s(wdth,m_pTextBrowser->sizeHint().height() + m_pToolBar->sizeHint().height()); + int wdth = m_pTextBrowser->tqsizeHint().width(); + if(m_pToolBar->tqsizeHint().width() > wdth)wdth = m_pToolBar->tqsizeHint().width(); + TQSize s(wdth,m_pTextBrowser->tqsizeHint().height() + m_pToolBar->tqsizeHint().height()); return s; } -bool KviHelpWidget::eventFilter(QObject * o, QEvent *e) +bool KviHelpWidget::eventFilter(TQObject * o, TQEvent *e) { - QClipboard *cb = QApplication::clipboard(); + TQClipboard *cb = TQApplication::tqclipboard(); - if(e->type() == QEvent::MouseButtonRelease) { + if(e->type() == TQEvent::MouseButtonRelease) { if(m_pTextBrowser->hasSelectedText()) { cb->setText(m_pTextBrowser->selectedText()); } } - return QWidget::eventFilter(o,e); + return TQWidget::eventFilter(o,e); } diff --git a/src/modules/help/helpwidget.h b/src/modules/help/helpwidget.h index e00f8bcf..9e2c1c49 100644 --- a/src/modules/help/helpwidget.h +++ b/src/modules/help/helpwidget.h @@ -23,38 +23,39 @@ // #include "kvi_tal_hbox.h" -#include <qtextbrowser.h> +#include <tqtextbrowser.h> #include "index.h" -#include <qprogressbar.h> +#include <tqprogressbar.h> class KviFrame; -class QToolButton; -class QLineEdit; +class TQToolButton; +class TQLineEdit; //class KviProcess; -class KviHelpWidget : public QWidget +class KviHelpWidget : public TQWidget { Q_OBJECT + TQ_OBJECT public: - KviHelpWidget(QWidget *par,KviFrame * lpFrm,bool bIsStandalone = false); + KviHelpWidget(TQWidget *par,KviFrame * lpFrm,bool bIsStandalone = false); ~KviHelpWidget(); private: - QToolButton * m_pBtnIndex; - QToolButton * m_pBtnBackward; - QToolButton * m_pBtnForward; + TQToolButton * m_pBtnIndex; + TQToolButton * m_pBtnBackward; + TQToolButton * m_pBtnForward; KviTalHBox * m_pToolBar; - QTextBrowser * m_pTextBrowser; + TQTextBrowser * m_pTextBrowser; bool m_bIsStandalone; protected: - virtual void resizeEvent(QResizeEvent *e); - bool eventFilter(QObject *, QEvent *); + virtual void resizeEvent(TQResizeEvent *e); + bool eventFilter(TQObject *, TQEvent *); protected slots: void doClose(); void showIndex(); void suicide(); public: - virtual QSize sizeHint() const; - QTextBrowser * textBrowser() { return m_pTextBrowser; } + virtual TQSize tqsizeHint() const; + TQTextBrowser * textBrowser() { return m_pTextBrowser; } }; 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 <qfileinfo.h> -#include <qsplitter.h> -#include <qlineedit.h> -#include <qmessagebox.h> -#include <qregexp.h> -#include <qtooltip.h> +#include <tqfileinfo.h> +#include <tqsplitter.h> +#include <tqlineedit.h> +#include <tqmessagebox.h> +#include <tqregexp.h> +#include <tqtooltip.h> #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<int> 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() { diff --git a/src/modules/help/helpwindow.h b/src/modules/help/helpwindow.h index 70f27af6..300116f8 100644 --- a/src/modules/help/helpwindow.h +++ b/src/modules/help/helpwindow.h @@ -25,47 +25,48 @@ #include "kvi_window.h" #include "kvi_string.h" #include "kvi_tal_vbox.h" -#include <qtabwidget.h> +#include <tqtabwidget.h> #include "kvi_tal_listbox.h" -#include <qlineedit.h> -#include <qprogressdialog.h> +#include <tqlineedit.h> +#include <tqprogressdialog.h> class KviHelpWidget; -class QTextBrowser; +class TQTextBrowser; class KviHelpWindow : public KviWindow { Q_OBJECT + TQ_OBJECT public: KviHelpWindow(KviFrame * lpFrm,const char * name); ~KviHelpWindow(); protected: KviHelpWidget * m_pHelpWidget; KviTalVBox * m_pToolBar; - QTabWidget * m_pTabWidget; + TQTabWidget * m_pTabWidget; KviTalVBox * m_pIndexTab; KviTalVBox * m_pSearchTab; KviTalListBox * m_pIndexListBox; - QLineEdit * m_pIndexSearch; - QStringList m_foundDocs; - QStringList m_terms; + TQLineEdit * m_pIndexSearch; + TQStringList m_foundDocs; + TQStringList m_terms; KviTalListBox * m_pResultBox; - QLineEdit * m_pTermsEdit; + TQLineEdit * m_pTermsEdit; public: KviHelpWidget * helpWidget(){ return m_pHelpWidget; }; protected: - virtual QPixmap * myIconPtr(); + virtual TQPixmap * myIconPtr(); virtual void fillCaptionBuffers(); - virtual void resizeEvent(QResizeEvent *e); + virtual void resizeEvent(TQResizeEvent *e); virtual void saveProperties(KviConfig * cfg); virtual void loadProperties(KviConfig * cfg); public: - virtual QSize sizeHint() const; - QTextBrowser * textBrowser(); + virtual TQSize tqsizeHint() const; + TQTextBrowser * textBrowser(); public slots: void indexSelected ( int ); - void searchInIndex( const QString &s ); + void searchInIndex( const TQString &s ); void showIndexTopic(); void startSearch(); void searchSelected ( int index ); diff --git a/src/modules/help/index.cpp b/src/modules/help/index.cpp index 659ff44c..ba5e72f3 100755 --- a/src/modules/help/index.cpp +++ b/src/modules/help/index.cpp @@ -1,11 +1,11 @@ #include "index.h" #include "kvi_file.h" -#include <qdir.h> -#include <qstringlist.h> +#include <tqdir.h> +#include <tqstringlist.h> #include "kvi_pointerhashtable.h" -#include <qapplication.h> -#include <qtextstream.h> +#include <tqapplication.h> +#include <tqtextstream.h> #include <ctype.h> @@ -18,43 +18,43 @@ int kvi_compare(const Term * p1,const Term * p2) 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 &hp ) +Index::Index( const TQString &dp, const TQString &hp ) - : QObject( 0, 0 ), dict( 8999 ), docPath( dp ) + : TQObject( 0, 0 ), dict( 8999 ), docPath( dp ) { alreadyHaveDocList = FALSE; 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 &hp ) +Index::Index( const TQStringList &dl, const TQString &hp ) - : QObject( 0, 0 ), dict( 8999 ) + : TQObject( 0, 0 ), dict( 8999 ) { docList = dl; alreadyHaveDocList = TRUE; lastWindowClosed = FALSE; - connect( qApp, SIGNAL( lastWindowClosed() ), - this, SLOT( setLastWinClosed() ) ); + connect( tqApp, TQT_SIGNAL( lastWindowClosed() ), + this, TQT_SLOT( setLastWinClosed() ) ); } @@ -69,7 +69,7 @@ void Index::setLastWinClosed() -void Index::setDictionaryFile( const QString &f ) +void Index::setDictionaryFile( const TQString &f ) { @@ -79,7 +79,7 @@ void Index::setDictionaryFile( const QString &f ) -void Index::setDocListFile( const QString &f ) +void Index::setDocListFile( const TQString &f ) { docListFile = f; } @@ -93,7 +93,7 @@ int Index::makeIndex() if ( docList.isEmpty() ) return 1; dict.clear(); - QStringList::Iterator it = docList.begin(); + TQStringList::Iterator it = docList.begin(); int steps = docList.count() / 100; if ( !steps ) steps++; @@ -118,10 +118,10 @@ void Index::setupDocumentList() { docList.clear(); titleList.clear(); - QDir d( docPath ); - QString szCur; - QStringList lst = d.entryList( "*.html" ); - QStringList::ConstIterator it = lst.begin(); + TQDir d( docPath ); + TQString szCur; + TQStringList lst = d.entryList( "*.html" ); + TQStringList::ConstIterator it = lst.begin(); for ( ; it != lst.end(); ++it ) { szCur=docPath + "/" + *it; @@ -132,7 +132,7 @@ void Index::setupDocumentList() -void Index::insertInDict( const QString &str, int docNum ) +void Index::insertInDict( const TQString &str, int docNum ) { if ( strcmp( str, "amp" ) == 0 || strcmp( str, "nbsp" ) == 0 ) return; @@ -152,28 +152,28 @@ void Index::insertInDict( const QString &str, int docNum ) -void Index::parseDocument( const QString &filename, int docNum ) +void Index::parseDocument( const TQString &filename, int docNum ) { KviFile file( filename ); if ( !file.openForReading() ) { qWarning( "can not open file " + filename ); return; } - QTextStream s( &file ); - QString text = s.read(); + TQTextStream s( &file ); + TQString text = s.read(); if (text.isNull()) return; bool valid = TRUE; - const QChar *buf = text.unicode(); - QChar str[64]; - QChar c = buf[0]; + const TQChar *buf = text.tqunicode(); + TQChar str[64]; + TQChar c = buf[0]; int j = 0; int i = 0; while ( (uint)j < text.length() ) { if ( c == '<' || c == '&' ) { valid = FALSE; if ( i > 1 ) - insertInDict( QString(str,i), docNum ); + insertInDict( TQString(str,i), docNum ); i = 0; c = buf[++j]; continue; @@ -202,7 +202,7 @@ void Index::parseDocument( const QString &filename, int docNum ) if ( i > 1 ) - insertInDict( QString(str,i), docNum ); + insertInDict( TQString(str,i), docNum ); i = 0; @@ -214,7 +214,7 @@ void Index::parseDocument( const QString &filename, int docNum ) if ( i > 1 ) - insertInDict( QString(str,i), docNum ); + insertInDict( TQString(str,i), docNum ); file.close(); @@ -226,7 +226,7 @@ void Index::writeDict() { - KviPointerHashTableIterator<QString,Entry> it( dict ); + KviPointerHashTableIterator<TQString,Entry> it( dict ); KviFile f( dictFile ); @@ -234,7 +234,7 @@ void Index::writeDict() return; - QDataStream s( &f ); + TQDataStream s( &f ); for( ; it.current(); ++it ) { @@ -260,14 +260,14 @@ void Index::writeDocumentList() KviFile f( docListFile ); if ( !f.openForWriting() ) return; - QTextStream s( &f ); - QString docs = docList.join("[#item#]"); + TQTextStream s( &f ); + TQString docs = docList.join("[#item#]"); s << docs; KviFile f1( docListFile+".titles" ); if ( !f1.openForWriting() ) return; - QTextStream s1( &f1 ); + TQTextStream s1( &f1 ); docs = titleList.join("[#item#]"); s1 << docs; } @@ -281,8 +281,8 @@ void Index::readDict() if ( !f.openForReading() ) return; dict.clear(); - QDataStream s( &f ); - QString key; + TQDataStream s( &f ); + TQString key; KviValueList<Document> docs; while ( !s.atEnd() ) { s >> key; @@ -301,21 +301,21 @@ void Index::readDocumentList() KviFile f( docListFile ); if ( !f.openForReading() ) return; - QTextStream s( &f ); - docList = QStringList::split("[#item#]",s.read()); + TQTextStream s( &f ); + docList = TQStringList::split("[#item#]",s.read()); //reading titles KviFile f1( docListFile+".titles" ); if ( !f1.openForReading() ) return; - QTextStream s1( &f1 ); - titleList = QStringList::split("[#item#]",s1.read()); + TQTextStream s1( &f1 ); + titleList = TQStringList::split("[#item#]",s1.read()); // debug(titleList); } -QStringList Index::query( const QStringList &terms, const QStringList &termSeq, const QStringList &seqWords ) +TQStringList Index::query( const TQStringList &terms, const TQStringList &termSeq, const TQStringList &seqWords ) { @@ -323,13 +323,13 @@ QStringList Index::query( const QStringList &terms, const QStringList &termSeq, - QStringList::ConstIterator it = terms.begin(); + TQStringList::ConstIterator it = terms.begin(); for ( it = terms.begin(); it != terms.end(); ++it ) { Entry *e = 0; - if ( (*it).contains( '*' ) ) { + if ( (*it).tqcontains( '*' ) ) { KviValueList<Document> wcts = setupDummyTerm( getWildcardTerms( *it ) ); @@ -343,7 +343,7 @@ QStringList Index::query( const QStringList &terms, const QStringList &termSeq, } else { - return QStringList(); + return TQStringList(); } @@ -357,7 +357,7 @@ QStringList Index::query( const QStringList &terms, const QStringList &termSeq, if ( !termList.count() ) - return QStringList(); + return TQStringList(); termList.removeFirst(); @@ -409,7 +409,7 @@ QStringList Index::query( const QStringList &terms, const QStringList &termSeq, - QStringList results; + TQStringList results; #ifndef COMPILE_USE_QT4 qHeapSort( minDocs ); @@ -426,7 +426,7 @@ QStringList Index::query( const QStringList &terms, const QStringList &termSeq, - QString fileName; + TQString fileName; for ( C = minDocs.begin(); C != minDocs.end(); ++C ) { @@ -444,7 +444,7 @@ QStringList Index::query( const QStringList &terms, const QStringList &termSeq, -QString Index::getDocumentTitle( const QString &fileName ) +TQString Index::getDocumentTitle( const TQString &fileName ) { @@ -458,19 +458,19 @@ QString Index::getDocumentTitle( const QString &fileName ) } - QTextStream s( &file ); + TQTextStream s( &file ); - QString text = s.read(); + TQString text = s.read(); - int start = text.find( "<title>", 0, FALSE ) + 7; + int start = text.tqfind( "<title>", 0, FALSE ) + 7; - int end = text.find( "</title>", 0, FALSE ); + int end = text.tqfind( "</title>", 0, FALSE ); - QString title = ( end - start <= 0 ? tr("Untitled") : text.mid( start, end - start ) ); + TQString title = ( end - start <= 0 ? tr("Untitled") : text.mid( start, end - start ) ); return title; @@ -478,22 +478,22 @@ QString Index::getDocumentTitle( const QString &fileName ) -QStringList Index::getWildcardTerms( const QString &term ) +TQStringList Index::getWildcardTerms( const TQString &term ) { - QStringList lst; + TQStringList lst; - QStringList terms = split( term ); + TQStringList terms = split( term ); #ifdef COMPILE_USE_QT4 - QStringList::Iterator iter; + TQStringList::Iterator iter; #else - KviValueList<QString>::iterator iter; + KviValueList<TQString>::iterator iter; #endif - KviPointerHashTableIterator<QString,Entry> it( dict ); + KviPointerHashTableIterator<TQString,Entry> it( dict ); for( ; it.current(); ++it ) { @@ -501,7 +501,7 @@ QStringList Index::getWildcardTerms( const QString &term ) bool found = FALSE; - QString text( it.currentKey() ); + TQString text( it.currentKey() ); for ( iter = terms.begin(); iter != terms.end(); ++iter ) { @@ -521,11 +521,11 @@ QStringList Index::getWildcardTerms( const QString &term ) } - index = text.find( *iter, index ); + index = text.tqfind( *iter, index ); if ( *iter == terms.last() && index != (int)text.length()-1 ) { - index = text.findRev( *iter ); + index = text.tqfindRev( *iter ); if ( index != (int)text.length() - (int)(*iter).length() ) { @@ -569,15 +569,15 @@ QStringList Index::getWildcardTerms( const QString &term ) -QStringList Index::split( const QString &str ) +TQStringList Index::split( const TQString &str ) { - QStringList lst; + TQStringList lst; int j = 0; - int i = str.find( '*', j ); + int i = str.tqfind( '*', j ); @@ -593,7 +593,7 @@ QStringList Index::split( const QString &str ) j = i + 1; - i = str.find( '*', j ); + i = str.tqfind( '*', j ); } @@ -613,13 +613,13 @@ QStringList Index::split( const QString &str ) -KviValueList<Document> Index::setupDummyTerm( const QStringList &terms ) +KviValueList<Document> Index::setupDummyTerm( const TQStringList &terms ) { TermList termList; - QStringList::ConstIterator it = terms.begin(); + TQStringList::ConstIterator it = terms.begin(); for ( ; it != terms.end(); ++it ) { @@ -663,7 +663,7 @@ KviValueList<Document> Index::setupDummyTerm( const QStringList &terms ) for ( docIt = docs.begin(); docIt != docs.end(); ++docIt ) { - if ( maxList.findIndex( *docIt ) == -1 ) + if ( maxList.tqfindIndex( *docIt ) == -1 ) maxList.append( *docIt ); @@ -679,7 +679,7 @@ KviValueList<Document> Index::setupDummyTerm( const QStringList &terms ) -void Index::buildMiniDict( const QString &str ) +void Index::buildMiniDict( const TQString &str ) { @@ -693,7 +693,7 @@ void Index::buildMiniDict( const QString &str ) -bool Index::searchForPattern( const QStringList &patterns, const QStringList &words, const QString &fileName ) +bool Index::searchForPattern( const TQStringList &patterns, const TQStringList &words, const TQString &fileName ) { @@ -713,7 +713,7 @@ bool Index::searchForPattern( const QStringList &patterns, const QStringList &wo miniDict.clear(); - QStringList::ConstIterator cIt = words.begin(); + TQStringList::ConstIterator cIt = words.begin(); for ( ; cIt != words.end(); ++cIt ) @@ -721,17 +721,17 @@ bool Index::searchForPattern( const QStringList &patterns, const QStringList &wo - QTextStream s( &file ); + TQTextStream s( &file ); - QString text = s.read(); + TQString text = s.read(); bool valid = TRUE; - const QChar *buf = text.unicode(); + const TQChar *buf = text.tqunicode(); - QChar str[64]; + TQChar str[64]; - QChar c = buf[0]; + TQChar c = buf[0]; int j = 0; @@ -745,7 +745,7 @@ bool Index::searchForPattern( const QStringList &patterns, const QStringList &wo if ( i > 1 ) - buildMiniDict( QString(str,i) ); + buildMiniDict( TQString(str,i) ); i = 0; @@ -783,7 +783,7 @@ bool Index::searchForPattern( const QStringList &patterns, const QStringList &wo if ( i > 1 ) - buildMiniDict( QString(str,i) ); + buildMiniDict( TQString(str,i) ); i = 0; @@ -795,15 +795,15 @@ bool Index::searchForPattern( const QStringList &patterns, const QStringList &wo if ( i > 1 ) - buildMiniDict( QString(str,i) ); + buildMiniDict( TQString(str,i) ); file.close(); - QStringList::ConstIterator patIt = patterns.begin(); + TQStringList::ConstIterator patIt = patterns.begin(); - QStringList wordLst; + TQStringList wordLst; KviValueList<uint> a, b; @@ -811,7 +811,7 @@ bool Index::searchForPattern( const QStringList &patterns, const QStringList &wo for ( ; patIt != patterns.end(); ++patIt ) { - wordLst = QStringList::split( ' ', *patIt ); + wordLst = TQStringList::split( ' ', *patIt ); a = miniDict[ wordLst[0] ]->positions; @@ -823,7 +823,7 @@ bool Index::searchForPattern( const QStringList &patterns, const QStringList &wo while ( aIt != a.end() ) { - if ( b.find( *aIt + 1 ) != b.end() ) { + if ( b.tqfind( *aIt + 1 ) != b.end() ) { (*aIt)++; diff --git a/src/modules/help/index.h b/src/modules/help/index.h index 9debcb3e..fe41eea3 100755 --- a/src/modules/help/index.h +++ b/src/modules/help/index.h @@ -1,15 +1,15 @@ /********************************************************************** ** Copyright (C) 2000-2003 Trolltech AS. All rights reserved. ** -** This file is part of the Qt Assistant. +** This file is part of the TQt Assistant. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** -** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition -** licenses may use this file in accordance with the Qt Commercial License +** Licensees holding valid TQt Enterprise Edition or TQt Professional Edition +** licenses may use this file in accordance with the TQt Commercial License ** Agreement provided with the Software. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE @@ -17,7 +17,7 @@ ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** See http://www.trolltech.com/pricing.html or email [email protected] for -** information about Qt Commercial License Agreements. +** information about TQt Commercial License Agreements. ** ** Contact [email protected] if any conditions of this licensing are ** not clear to you. @@ -29,12 +29,12 @@ #ifndef INDEX_H #define INDEX_H -#include <qstringlist.h> +#include <tqstringlist.h> #include "kvi_pointerhashtable.h" #include "kvi_pointerlist.h" #include "kvi_valuelist.h" -#include <qdatastream.h> -#include <qobject.h> +#include <tqdatastream.h> +#include <tqobject.h> struct Document { Document( int d, int f ) : docNumber( d ), frequency( f ) {} @@ -51,16 +51,17 @@ struct Document { bool operator>( const Document &doc ) const { 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 ) ); } @@ -71,47 +72,47 @@ public: PosEntry( int p ) { positions.append( p ); } KviValueList<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(); void readDict(); int makeIndex(); - QStringList query( const QStringList&, const QStringList&, const QStringList& ); - QString getDocumentTitle( const QString& ); - void setDictionaryFile( const QString& ); - void setDocListFile( const QString& ); + TQStringList query( const TQStringList&, const TQStringList&, const TQStringList& ); + TQString getDocumentTitle( const TQString& ); + void setDictionaryFile( const TQString& ); + void setDocListFile( const TQString& ); void writeDocumentList(); void readDocumentList(); void setupDocumentList(); - const QStringList& documentList() { return docList; }; - const QStringList& titlesList() { return titleList; }; + const TQStringList& documentList() { return docList; }; + const TQStringList& titlesList() { return titleList; }; signals: void indexingProgress( int ); private slots: void setLastWinClosed(); private: - void parseDocument( const QString&, int ); - void insertInDict( const QString&, int ); - QStringList getWildcardTerms( const QString& ); - QStringList split( const QString& ); - KviValueList<Document> setupDummyTerm( const QStringList& ); - bool searchForPattern( const QStringList&, const QStringList&, const QString& ); - void buildMiniDict( const QString& ); - QStringList docList; - QStringList titleList; - KviPointerHashTable<QString,Entry> dict; - KviPointerHashTable<QString,PosEntry> miniDict; + void parseDocument( const TQString&, int ); + void insertInDict( const TQString&, int ); + TQStringList getWildcardTerms( const TQString& ); + TQStringList split( const TQString& ); + KviValueList<Document> setupDummyTerm( const TQStringList& ); + bool searchForPattern( const TQStringList&, const TQStringList&, const TQString& ); + void buildMiniDict( const TQString& ); + TQStringList docList; + TQStringList titleList; + KviPointerHashTable<TQString,Entry> dict; + KviPointerHashTable<TQString,PosEntry> miniDict; uint wordNum; - QString docPath; - QString dictFile, docListFile; + TQString docPath; + TQString dictFile, docListFile; bool alreadyHaveDocList; bool lastWindowClosed; }; struct Term { - Term( const QString &t, int f, KviValueList<Document> l ) + Term( const TQString &t, int f, KviValueList<Document> l ) : term( t ), frequency( f ), documents( l ) {} - QString term; + TQString term; int frequency; KviValueList<Document>documents; }; diff --git a/src/modules/help/libkvihelp.cpp b/src/modules/help/libkvihelp.cpp index c8da3c33..af594088 100644 --- a/src/modules/help/libkvihelp.cpp +++ b/src/modules/help/libkvihelp.cpp @@ -34,11 +34,11 @@ #include "kvi_frame.h" #ifdef COMPILE_USE_QT4 - #include <q3mimefactory.h> + #include <tq3mimefactory.h> #endif -#include <qsplitter.h> +#include <tqsplitter.h> Index * g_pDocIndex = 0; KviPointerList<KviHelpWidget> * g_pHelpWidgetList = 0; KviPointerList<KviHelpWindow> * g_pHelpWindowList = 0; @@ -141,7 +141,7 @@ static bool help_kvs_cmd_search(KviKvsModuleCommandCall * c) static bool help_kvs_cmd_open(KviKvsModuleCommandCall * c) { - QString doc; + TQString doc; KVSM_PARAMETERS_BEGIN(c) KVSM_PARAMETER("document",KVS_PT_STRING,KVS_PF_OPTIONAL,doc) KVSM_PARAMETERS_END(c) @@ -149,7 +149,7 @@ static bool help_kvs_cmd_open(KviKvsModuleCommandCall * c) #ifdef COMPILE_USE_QT4 Q3MimeSourceFactory * f = Q3MimeSourceFactory::defaultFactory(); #else - QMimeSourceFactory * f = QMimeSourceFactory::defaultFactory(); + TQMimeSourceFactory * f = TQMimeSourceFactory::defaultFactory(); #endif if(f) { @@ -157,7 +157,7 @@ static bool help_kvs_cmd_open(KviKvsModuleCommandCall * c) doc = "nohelpavailable.html"; } - if(!c->switches()->find('n',"new")) + if(!c->switches()->tqfind('n',"new")) { KviHelpWidget * w = (KviHelpWidget *)c->window()->frame()->child("help_widget","KviHelpWidget"); if(w) @@ -166,7 +166,7 @@ static bool help_kvs_cmd_open(KviKvsModuleCommandCall * c) return true; } } - if(c->switches()->find('m',"mdi")) + if(c->switches()->tqfind('m',"mdi")) { KviHelpWindow *w = new KviHelpWindow(c->window()->frame(),"Help browser"); w->textBrowser()->setSource(doc); @@ -185,7 +185,7 @@ static bool help_kvs_cmd_open(KviKvsModuleCommandCall * c) static bool help_module_init(KviModule * m) { - QString szHelpDir,szDocList; + TQString szHelpDir,szDocList; g_pApp->getLocalKvircDirectory(szDocList,KviApp::Help,"help.doclist." KVI_SOURCES_DATE); g_pApp->getGlobalKvircDirectory(szHelpDir,KviApp::Help); |