diff options
Diffstat (limited to 'src/modules')
| -rw-r--r-- | src/modules/help/helpwidget.cpp | 10 | ||||
| -rw-r--r-- | src/modules/help/helpwindow.cpp | 41 | ||||
| -rwxr-xr-x | src/modules/help/index.cpp | 45 | ||||
| -rwxr-xr-x | src/modules/help/index.h | 4 |
4 files changed, 52 insertions, 48 deletions
diff --git a/src/modules/help/helpwidget.cpp b/src/modules/help/helpwidget.cpp index c6f8639ff..482b7ad92 100644 --- a/src/modules/help/helpwidget.cpp +++ b/src/modules/help/helpwidget.cpp @@ -43,12 +43,14 @@ extern KviPointerList<KviHelpWindow> * g_pHelpWindowList; extern KviPointerList<KviHelpWidget> * g_pHelpWidgetList; KviHelpWidget::KviHelpWidget(QWidget * par,KviFrame * lpFrm,bool bIsStandalone) -: QWidget(par,"help_widget") +: QWidget(par) { + setObjectName("help_widget"); if(bIsStandalone)g_pHelpWidgetList->append(this); m_bIsStandalone = bIsStandalone; - m_pTextBrowser = new QTextBrowser(this,"text_browser"); + m_pTextBrowser = new QTextBrowser(this); + m_pTextBrowser->setObjectName("text_browser"); m_pTextBrowser->setFrameStyle(QFrame::StyledPanel|QFrame::Sunken); m_pTextBrowser->setFocusPolicy(Qt::NoFocus); m_pToolBar = new KviTalHBox(this); @@ -132,8 +134,8 @@ bool KviHelpWidget::eventFilter(QObject * o, QEvent *e) QClipboard *cb = QApplication::clipboard(); if(e->type() == QEvent::MouseButtonRelease) { - if(m_pTextBrowser->hasSelectedText()) { - cb->setText(m_pTextBrowser->selectedText()); + if(m_pTextBrowser->textCursor().hasSelection()) { + cb->setText(m_pTextBrowser->textCursor().selectedText()); } } diff --git a/src/modules/help/helpwindow.cpp b/src/modules/help/helpwindow.cpp index b93bf5de8..7c8b1c02a 100644 --- a/src/modules/help/helpwindow.cpp +++ b/src/modules/help/helpwindow.cpp @@ -70,7 +70,8 @@ KviHelpWindow::KviHelpWindow(KviFrame * lpFrm,const char * name) } g_pHelpWindowList->append(this); - m_pSplitter = new QSplitter(Qt::Horizontal,this,"main_splitter"); + m_pSplitter = new QSplitter(Qt::Horizontal,this); + m_pSplitter->setObjectName("main_splitter"); m_pHelpWidget = new KviHelpWidget(m_pSplitter,lpFrm); m_pToolBar=new KviTalVBox(m_pSplitter); @@ -78,7 +79,7 @@ KviHelpWindow::KviHelpWindow(KviFrame * lpFrm,const char * name) m_pTabWidget = new QTabWidget(m_pToolBar); m_pIndexTab = new KviTalVBox(m_pTabWidget); - m_pTabWidget->insertTab(m_pIndexTab,__tr2qs("Index")); + m_pTabWidget->addTab(m_pIndexTab,__tr2qs("Index")); KviTalHBox* pSearchBox = new KviTalHBox(m_pIndexTab); m_pIndexSearch = new QLineEdit(pSearchBox); @@ -90,7 +91,7 @@ KviHelpWindow::KviHelpWindow(KviFrame * lpFrm,const char * name) KviStyledToolButton* pBtnRefreshIndex = new KviStyledToolButton(pSearchBox); pBtnRefreshIndex->setIcon(*g_pIconManager->getBigIcon(KVI_REFRESH_IMAGE_NAME)); connect(pBtnRefreshIndex,SIGNAL(clicked()),this,SLOT(refreshIndex())); - QToolTip::add( pBtnRefreshIndex, __tr2qs("Refresh index") ); + pBtnRefreshIndex->setToolTip(__tr2qs("Refresh index") ); m_pIndexListBox = new KviTalListBox(m_pIndexTab); QStringList docList=g_pDocIndex->titlesList(); @@ -99,7 +100,7 @@ KviHelpWindow::KviHelpWindow(KviFrame * lpFrm,const char * name) m_pIndexListBox->sort(); m_pSearchTab = new KviTalVBox(m_pTabWidget); - m_pTabWidget->insertTab(m_pSearchTab,__tr2qs("Search")); + m_pTabWidget->addTab(m_pSearchTab,__tr2qs("Search")); m_pTermsEdit = new QLineEdit(m_pSearchTab); /* connect( m_pTermsEdit, SIGNAL( textChanged(const QString&) ), @@ -162,13 +163,13 @@ void KviHelpWindow::startSearch() QString buf = str; str = str.replace( "-", " " ); str = str.replace( QRegExp( "\\s[\\S]?\\s" ), " " ); - m_terms = QStringList::split( " ", str ); + m_terms = str.split(" ",QString::SkipEmptyParts); QStringList termSeq; QStringList seqWords; QStringList::iterator it = m_terms.begin(); for ( ; it != m_terms.end(); ++it ) { - (*it) = (*it).simplifyWhiteSpace(); - (*it) = (*it).lower(); + (*it) = (*it).simplified(); + (*it) = (*it).toLower(); (*it) = (*it).replace( "\"", "" ); } if ( str.contains( '\"' ) ) { @@ -176,21 +177,21 @@ void KviHelpWindow::startSearch() int beg = 0; int end = 0; QString s; - beg = str.find( '\"', beg ); + beg = str.indexOf( '\"', beg ); while ( beg != -1 ) { beg++; - end = str.find( '\"', beg ); + end = str.indexOf( '\"', beg ); s = str.mid( beg, end - beg ); - s = s.lower(); - s = s.simplifyWhiteSpace(); + s = s.toLower(); + s = s.simplified(); if ( s.contains( '*' ) ) { QMessageBox::warning( this, tr( "Full Text Search" ), tr( "Using a wildcard within phrases is not allowed." ) ); return; } - seqWords += QStringList::split( ' ', s ); + seqWords += s.split( ' ', QString::SkipEmptyParts ); termSeq << s; - beg = str.find( '\"', end + 1); + beg = str.indexOf( '\"', end + 1); } } else { QMessageBox::warning( this, tr( "Full Text Search" ), @@ -212,12 +213,12 @@ void KviHelpWindow::startSearch() for ( int i = 0; i < (int)buf.length(); ++i ) { if ( buf[i] == '\"' ) { isPhrase = !isPhrase; - s = s.simplifyWhiteSpace(); + s = s.simplified(); if ( !s.isEmpty() ) m_terms << s; s = ""; } else if ( buf[i] == ' ' && !isPhrase ) { - s = s.simplifyWhiteSpace(); + s = s.simplified(); if ( !s.isEmpty() ) m_terms << s; s = ""; @@ -237,18 +238,18 @@ 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().indexOf(m_pIndexListBox->selectedItem()->text()); textBrowser()->setSource(QUrl(g_pDocIndex->documentList()[ i ])); } void KviHelpWindow::searchInIndex( const QString &s ) { KviTalListBoxItem *i = m_pIndexListBox->firstItem(); - QString sl = s.lower(); + QString sl = s.toLower(); while ( i ) { QString t = i->text(); if ( t.length() >= sl.length() && - i->text().left(s.length()).lower() == sl ) { + i->text().left(s.length()).toLower() == sl ) { m_pIndexListBox->setCurrentItem( i ); m_pIndexListBox->setTopItem(m_pIndexListBox->index(i)); break; @@ -259,13 +260,13 @@ 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().indexOf(m_pIndexListBox->text(index)); textBrowser()->setSource(QUrl(g_pDocIndex->documentList()[ i ])); } void KviHelpWindow::searchSelected ( int index ) { - int i=g_pDocIndex->titlesList().findIndex(m_pResultBox->text(index)); + int i=g_pDocIndex->titlesList().indexOf(m_pResultBox->text(index)); textBrowser()->setSource(QUrl(g_pDocIndex->documentList()[ i ])); } diff --git a/src/modules/help/index.cpp b/src/modules/help/index.cpp index 8cc7f3ed3..d5e6961fe 100755 --- a/src/modules/help/index.cpp +++ b/src/modules/help/index.cpp @@ -53,13 +53,13 @@ QDataStream &operator>>( QDataStream &s, Document &l ) QDataStream &operator<<( QDataStream &s, const Document &l ) { - s << (Q_INT16)l.docNumber; - s << (Q_INT16)l.frequency; + s << (qint16)l.docNumber; + s << (qint16)l.frequency; return s; } Index::Index( const QString &dp, const QString &hp ) -: QObject( 0, 0 ), dict( 8999 ), docPath( dp ) +: QObject( 0), dict( 8999 ), docPath( dp ) { alreadyHaveDocList = FALSE; lastWindowClosed = FALSE; @@ -67,7 +67,7 @@ Index::Index( const QString &dp, const QString &hp ) } Index::Index( const QStringList &dl, const QString &hp ) -: QObject( 0, 0 ), dict( 8999 ) +: QObject( 0), dict( 8999 ) { docList = dl; alreadyHaveDocList = TRUE; @@ -116,7 +116,7 @@ void Index::setupDocumentList() titleList.clear(); QDir d( docPath ); QString szCur; - QStringList lst = d.entryList( "*.html" ); + QStringList lst = d.entryList( QStringList("*.html") ); QStringList::ConstIterator it = lst.begin(); for ( ; it != lst.end(); ++it ) { @@ -151,7 +151,7 @@ void Index::parseDocument( const QString &filename, int docNum ) return; } QTextStream s( &file ); - QString text = s.read(); + QString text = s.readAll(); if (text.isNull()) return; bool valid = TRUE; const QChar *buf = text.unicode(); @@ -180,7 +180,7 @@ void Index::parseDocument( const QString &filename, int docNum ) } if ( ( c.isLetterOrNumber() || c == '_' ) && i < 63 ) { - str[i] = c.lower(); + str[i] = c.toLower(); ++i; } else { if ( i > 1 ) insertInDict( QString(str,i), docNum ); @@ -250,13 +250,13 @@ void Index::readDocumentList() KviFile f( docListFile ); if ( !f.openForReading() ) return; QTextStream s( &f ); - docList = QStringList::split("[#item#]",s.read()); + docList = s.readAll().split("[#item#]",QString::SkipEmptyParts,Qt::CaseInsensitive); //reading titles KviFile f1( docListFile+".titles" ); if ( !f1.openForReading() ) return; QTextStream s1( &f1 ); - titleList = QStringList::split("[#item#]",s1.read()); + titleList = s1.readAll().split("[#item#]",QString::SkipEmptyParts,Qt::CaseInsensitive); // qDebug(titleList); } @@ -306,7 +306,7 @@ QStringList Index::query( const QStringList &terms, const QStringList &termSeq, } } - if ( !found ) C = minDocs.remove( C ); + if ( !found ) C = minDocs.erase( C ); else ++C; } } @@ -340,10 +340,10 @@ QString Index::getDocumentTitle( const QString &fileName ) } QTextStream s( &file ); - QString text = s.read(); + QString text = s.readAll(); - int start = text.find( "<title>", 0, FALSE ) + 7; - int end = text.find( "</title>", 0, FALSE ); + int start = text.indexOf( "<title>", 0, Qt::CaseInsensitive ) + 7; + int end = text.indexOf( "</title>", 0, Qt::CaseInsensitive); QString title = ( end - start <= 0 ? tr("Untitled") : text.mid( start, end - start ) ); @@ -373,10 +373,10 @@ QStringList Index::getWildcardTerms( const QString &term ) break; } - index = text.find( *iter, index ); + index = text.indexOf( *iter, index,Qt::CaseInsensitive ); if ( *iter == terms.last() && index != (int)text.length()-1 ) { - index = text.findRev( *iter ); + index = text.lastIndexOf( *iter,-1,Qt::CaseInsensitive ); if ( index != (int)text.length() - (int)(*iter).length() ) { found = FALSE; @@ -405,7 +405,7 @@ QStringList Index::split( const QString &str ) { QStringList lst; int j = 0; - int i = str.find( '*', j ); + int i = str.indexOf( '*', j ); while ( i != -1 ) { if ( i > j && i <= (int)str.length() ) { @@ -414,7 +414,7 @@ QStringList Index::split( const QString &str ) } j = i + 1; - i = str.find( '*', j ); + i = str.indexOf( '*', j ); } int l = str.length() - 1; @@ -453,7 +453,7 @@ KviValueList<Document> Index::setupDummyTerm( const QStringList &terms ) while ( t ) { KviValueList<Document> docs = t->documents; for ( docIt = docs.begin(); docIt != docs.end(); ++docIt ) { - if ( maxList.findIndex( *docIt ) == -1 ) + if ( maxList.indexOf( *docIt ) == -1 ) maxList.append( *docIt ); } t = termList.next(); @@ -486,7 +486,7 @@ bool Index::searchForPattern( const QStringList &patterns, const QStringList &wo miniDict.insert( *cIt, new PosEntry( 0 ) ); QTextStream s( &file ); - QString text = s.read(); + QString text = s.readAll(); bool valid = TRUE; const QChar *buf = text.unicode(); QChar str[64]; @@ -514,7 +514,7 @@ bool Index::searchForPattern( const QStringList &patterns, const QStringList &wo } if ( ( c.isLetterOrNumber() || c == '_' ) && i < 63 ) { - str[i] = c.lower(); + str[i] = c.toLower(); ++i; } else { if ( i > 1 ) buildMiniDict( QString(str,i) ); @@ -535,7 +535,8 @@ bool Index::searchForPattern( const QStringList &patterns, const QStringList &wo KviValueList<uint>::iterator aIt; for ( ; patIt != patterns.end(); ++patIt ) { - wordLst = QStringList::split( ' ', *patIt ); + QString tmp=*patIt; + wordLst = tmp.split( ' '); a = miniDict[ wordLst[0] ]->positions; for ( int j = 1; j < (int)wordLst.count(); ++j ) { @@ -547,7 +548,7 @@ bool Index::searchForPattern( const QStringList &patterns, const QStringList &wo (*aIt)++; ++aIt; } else { - aIt = a.remove( aIt ); + aIt = a.erase( aIt ); } } } diff --git a/src/modules/help/index.h b/src/modules/help/index.h index f262fdeae..c2ede4756 100755 --- a/src/modules/help/index.h +++ b/src/modules/help/index.h @@ -49,8 +49,8 @@ struct Document { bool operator>( const Document &doc ) const { return frequency < doc.frequency; } - Q_INT16 docNumber; - Q_INT16 frequency; + qint16 docNumber; + qint16 frequency; }; QDataStream &operator>>( QDataStream &s, Document &l ); |
