diff --git a/generators/chm/kio-msits/msits.cpp b/generators/chm/kio-msits/msits.cpp index 09c2ebfa9..15f202b94 100644 --- a/generators/chm/kio-msits/msits.cpp +++ b/generators/chm/kio-msits/msits.cpp @@ -127,7 +127,7 @@ bool ProtocolMSITS::parseLoadAndLookup ( const KUrl& url, QString& abspath ) { kDebug() << "ProtocolMSITS::parseLoadAndLookup (const KUrl&) " << url.path() << endl; - int pos = url.path().find ("::"); + int pos = url.path().indexOf ("::"); if ( pos == -1 ) { diff --git a/generators/chm/lib/kchmtreeviewitem.cpp b/generators/chm/lib/kchmtreeviewitem.cpp index a65d8e70f..663b6ccd5 100644 --- a/generators/chm/lib/kchmtreeviewitem.cpp +++ b/generators/chm/lib/kchmtreeviewitem.cpp @@ -109,7 +109,7 @@ void KCHMMainTreeViewItem::paintCell( QPainter * p, const QColorGroup & cg, int QColorGroup newcg ( cg ); QColor c = newcg.text(); - if ( url.find ('|') != -1 ) + if ( url.indexOf ('|') != -1 ) newcg.setColor( QColorGroup::Text, Qt::red ); else if ( url[0] == ':' ) newcg.setColor( QColorGroup::Text, Qt::lightGray ); diff --git a/generators/chm/lib/kchmurl.cpp b/generators/chm/lib/kchmurl.cpp index b608151cd..f8f0de783 100644 --- a/generators/chm/lib/kchmurl.cpp +++ b/generators/chm/lib/kchmurl.cpp @@ -9,7 +9,7 @@ namespace KCHMUrl // Check whether the URL is external QRegExp uriregex ( "^(\\w+):\\/\\/" ); - if ( uriregex.search ( url ) != -1 ) + if ( uriregex.indexIn ( url ) != -1 ) { QString proto = uriregex.cap ( 1 ).toLower(); @@ -34,7 +34,7 @@ namespace KCHMUrl { QRegExp uriregex ( "^ms-its:(.*)::(.*)$" ); - if ( uriregex.search ( url ) != -1 ) + if ( uriregex.indexIn ( url ) != -1 ) { chmfile = uriregex.cap ( 1 ); page = uriregex.cap ( 2 ); diff --git a/generators/chm/lib/xchmfile.cpp b/generators/chm/lib/xchmfile.cpp index 4ff5dfaf9..a6d777c70 100644 --- a/generators/chm/lib/xchmfile.cpp +++ b/generators/chm/lib/xchmfile.cpp @@ -175,11 +175,11 @@ inline int CHMFile::findStringInQuotes (const QString& tag, int offset, QString& m_entityDecodeMap["quot"] = "\""; // double quote m_entityDecodeMap["apos"] = "'"; // single quote } - int qbegin = tag.find ('"', offset); + int qbegin = tag.indexOf ('"', offset); if ( qbegin == -1 ) qFatal ("CHMFile::findStringInQuotes: cannot find first quote in tag: '%s'", tag.ascii()); - int qend = firstquote ? tag.find ('"', qbegin + 1) : tag.findRev ('"'); + int qend = firstquote ? tag.indexOf ('"', qbegin + 1) : tag.lastIndexOf ('"'); if ( qend == -1 || qend <= qbegin ) qFatal ("CHMFile::findStringInQuotes: cannot find last quote in tag: '%s'", tag.ascii()); @@ -350,7 +350,7 @@ bool CHMFile::ParseHhcAndFillTree (const QString& file, QDomDocument *tree, bool int stringlen = src.length(); while ( pos < stringlen - && (pos = src.find ('<', pos)) != -1 ) + && (pos = src.indexOf ('<', pos)) != -1 ) { int i, word_end = 0; @@ -360,8 +360,8 @@ bool CHMFile::ParseHhcAndFillTree (const QString& file, QDomDocument *tree, bool 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.indexOf (src[i], i+1); + if ( nextpos == -1 && (nextpos = src.indexOf ('>', i+1)) == -1 ) { qWarning ("CHMFile::ParseHhcAndFillTree: corrupted TOC: %s", src.mid(i).ascii()); return false; @@ -385,7 +385,7 @@ bool CHMFile::ParseHhcAndFillTree (const QString& file, QDomDocument *tree, bool // qDebug ("tag: '%s', tagword: '%s'\n", tag.ascii(), tagword.ascii()); // - a topic entry - if ( tagword == "object" && tag.find ("text/sitemap", 0, false) != -1 ) + if ( tagword == "object" && tag.indexOf ("text/sitemap", 0, Qt::CaseInsensitive) != -1 ) in_object = true; else if ( tagword == "/object" && in_object ) { @@ -454,14 +454,14 @@ bool CHMFile::ParseHhcAndFillTree (const QString& file, QDomDocument *tree, bool QString name_pattern = "name=", value_pattern = "value="; QString pname, pvalue; - if ( (offset = tag.find (name_pattern, 0, FALSE)) == -1 ) + if ( (offset = tag.indexOf (name_pattern, 0, Qt::CaseInsensitive)) == -1 ) qFatal ("CHMFile::ParseAndFillTopicsTree: bad tag '%s': no name=\n", tag.ascii()); // offset+5 skips 'name=' offset = findStringInQuotes (tag, offset + name_pattern.length(), pname, TRUE, FALSE); pname = pname.toLower(); - if ( (offset = tag.find (value_pattern, offset, FALSE)) == -1 ) + if ( (offset = tag.indexOf (value_pattern, offset, Qt::CaseInsensitive)) == -1 ) qFatal ("CHMFile::ParseAndFillTopicsTree: bad tag '%s': no value=\n", tag.ascii()); // offset+6 skips 'value=' @@ -537,7 +537,7 @@ bool CHMFile::ParseHhcAndFillTree (const QString& file, K3ListView *tree, bool a int stringlen = src.length(); while ( pos < stringlen - && (pos = src.find ('<', pos)) != -1 ) + && (pos = src.indexOf ('<', pos)) != -1 ) { int i, word_end = 0; @@ -547,8 +547,8 @@ bool CHMFile::ParseHhcAndFillTree (const QString& file, K3ListView *tree, bool a 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.indexOf (src[i], i+1); + if ( nextpos == -1 && (nextpos = src.indexOf ('>', i+1)) == -1 ) { qWarning ("CHMFile::ParseHhcAndFillTree: corrupted TOC: %s", src.mid(i).ascii()); return false; @@ -572,7 +572,7 @@ bool CHMFile::ParseHhcAndFillTree (const QString& file, K3ListView *tree, bool a //qDebug ("tag: '%s', tagword: '%s'\n", tag.ascii(), tagword.ascii()); // - a topic entry - if ( tagword == "object" && tag.find ("text/sitemap", 0, false) != -1 ) + if ( tagword == "object" && tag.indexOf ("text/sitemap", 0, Qt::CaseInsensitive) != -1 ) in_object = true; else if ( tagword == "/object" && in_object ) { @@ -630,14 +630,14 @@ bool CHMFile::ParseHhcAndFillTree (const QString& file, K3ListView *tree, bool a QString name_pattern = "name=", value_pattern = "value="; QString pname, pvalue; - if ( (offset = tag.find (name_pattern, 0, FALSE)) == -1 ) + if ( (offset = tag.indexOf (name_pattern, 0, Qt::CaseInsensitive)) == -1 ) qFatal ("CHMFile::ParseAndFillTopicsTree: bad tag '%s': no name=\n", tag.ascii()); // offset+5 skips 'name=' offset = findStringInQuotes (tag, offset + name_pattern.length(), pname, TRUE, FALSE); pname = pname.toLower(); - if ( (offset = tag.find (value_pattern, offset, FALSE)) == -1 ) + if ( (offset = tag.indexOf (value_pattern, offset, Qt::CaseInsensitive)) == -1 ) qFatal ("CHMFile::ParseAndFillTopicsTree: bad tag '%s': no value=\n", tag.ascii()); // offset+6 skips 'value=' @@ -1354,7 +1354,7 @@ QString CHMFile::getTopicByUrl( const QString & search_url ) return QString::null; unsigned char buf[COMMON_BUF_LEN]; - int pos = search_url.find ('#'); + int pos = search_url.indexOf ('#'); QString fixedurl = pos == -1 ? search_url : search_url.left (pos); for ( unsigned int i = 0; i < m_chmTOPICS.length; i += TOPICS_ENTRY_LEN ) diff --git a/part.cpp b/part.cpp index 158915091..b62780593 100644 --- a/part.cpp +++ b/part.cpp @@ -123,7 +123,8 @@ Part::Part(QWidget *parentWidget, const char *widgetName, // widgets: [] splitter [] - m_splitter = new QSplitter( parentWidget, widgetName ); + m_splitter = new QSplitter( parentWidget ); + m_splitter->setObjectName( QLatin1String( widgetName ) ); m_splitter->setOpaqueResize( true ); m_splitter->setChildrenCollapsible( false ); setWidget( m_splitter ); diff --git a/shell/shell.cpp b/shell/shell.cpp index 9d2b883ff..3cacee6e2 100644 --- a/shell/shell.cpp +++ b/shell/shell.cpp @@ -229,9 +229,9 @@ QStringList* Shell::fileFormats() { tmp=pattern.front().trimmed(); extensions.append(tmp); - if (tmp.find(".gz", -3) == -1) + if (tmp.indexOf(".gz", -3) == -1) extensions.append(tmp+".gz"); - if ((bzip2Available) && (tmp.find(".bz2", -4) == -1)) + if ((bzip2Available) && (tmp.indexOf(".bz2", -4) == -1)) extensions.append(tmp+".bz2"); pattern.pop_front(); } diff --git a/ui/minibar.cpp b/ui/minibar.cpp index c071d9097..623504e75 100644 --- a/ui/minibar.cpp +++ b/ui/minibar.cpp @@ -98,7 +98,7 @@ MiniBar::MiniBar( QWidget * parent, KPDFDocument * document ) gridLayout->addMultiCellWidget( m_progressWidget, 0, 0, 0, 4 ); // bottom: left prev_page button m_prevButton = new HoverButton( this ); - m_prevButton->setIconSet( SmallIconSet("1leftarrow") ); + m_prevButton->setIcon( SmallIconSet("1leftarrow") ); gridLayout->addWidget( m_prevButton, 1, 0 ); // bottom: left lineEdit (current page box) m_pagesEdit = new PagesEdit( this ); @@ -110,7 +110,7 @@ MiniBar::MiniBar( QWidget * parent, KPDFDocument * document ) gridLayout->addWidget( m_pagesButton, 1, 3 ); // bottom: right next_page button m_nextButton = new HoverButton( this ); - m_nextButton->setIconSet( SmallIconSet("1rightarrow") ); + m_nextButton->setIcon( SmallIconSet("1rightarrow") ); gridLayout->addWidget( m_nextButton, 1, 4 ); horLayout->addLayout( gridLayout ); @@ -261,9 +261,11 @@ void MiniBar::slotEmitPrevPage() /** ProgressWidget **/ ProgressWidget::ProgressWidget( MiniBar * parent ) - : QWidget( parent, "progress", Qt::WNoAutoErase ), + : QWidget( parent ), m_miniBar( parent ), m_progressPercentage( -1 ) { + setObjectName( "progress" ); + setAttribute( Qt::WA_OpaquePaintEvent, true ); setFixedHeight( 4 ); setMouseTracking( true ); } @@ -426,7 +428,7 @@ void HoverButton::leaveEvent( QPaintEvent * e ) void HoverButton::paintEvent( QPaintEvent * e ) { - if ( hasMouse() ) + if ( testAttribute( Qt::WA_UnderMouse ) ) { QPushButton::paintEvent( e ); } diff --git a/ui/newstuff.cpp b/ui/newstuff.cpp index 331df304a..eb605aced 100644 --- a/ui/newstuff.cpp +++ b/ui/newstuff.cpp @@ -58,13 +58,13 @@ class ExtendImageWidget : public QWidget { public: ExtendImageWidget( const QPixmap & pix, QWidget * parent ) - : QWidget( parent, "", Qt::WNoAutoErase ), m_pixmap( pix ) + : QWidget( parent ), m_pixmap( pix ) { // adjust size hint setFixedWidth( pix.width() ); setMinimumHeight( pix.height() ); // paint all own pixels - setBackgroundMode( Qt::NoBackground ); + setAttribute( Qt::WA_OpaquePaintEvent, true ); // create the tile image from last line of pixmap m_tile.resize( pix.width(), 1 ); copyBlt( &m_tile, 0,0, &pix, 0,pix.height()-2, pix.width(),1 ); @@ -459,7 +459,8 @@ NewStuffDialog::NewStuffDialog( QWidget * parentWidget ) // add widgets to the control panel QLabel * label1 = new QLabel( i18n("Show:"), panelFrame ); panelLayout->addWidget( label1, 0, 0 ); - d->typeCombo = new QComboBox( false, panelFrame ); + d->typeCombo = new QComboBox( panelFrame ); + d->typeCombo->setEditable( false ); panelLayout->addWidget( d->typeCombo, 0, 1 ); d->typeCombo->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Minimum ); d->typeCombo->setMinimumWidth( 150 ); @@ -469,7 +470,8 @@ NewStuffDialog::NewStuffDialog( QWidget * parentWidget ) QLabel * label2 = new QLabel( i18n("Order by:"), panelFrame ); panelLayout->addWidget( label2, 0, 2 ); - d->sortCombo = new QComboBox( false, panelFrame ); + d->sortCombo = new QComboBox( panelFrame ); + d->sortCombo->setEditable( false ); panelLayout->addWidget( d->sortCombo, 0, 3 ); d->sortCombo->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Minimum ); d->sortCombo->setMinimumWidth( 100 ); diff --git a/ui/pageview.cpp b/ui/pageview.cpp index 683a5843b..2c6b962e4 100644 --- a/ui/pageview.cpp +++ b/ui/pageview.cpp @@ -1755,7 +1755,7 @@ void PageView::updateZoom( ZoomMode newZoomMode ) { case ZoomFixed:{ //ZoomFixed case QString z = d->aZoom->currentText(); - newFactor = KGlobal::locale()->readNumber( z.remove( z.find( '%' ), 1 ) ) / 100.0; + newFactor = KGlobal::locale()->readNumber( z.remove( z.indexOf( '%' ), 1 ) ) / 100.0; }break; case ZoomIn: newFactor += (newFactor > 0.99) ? ( newFactor > 1.99 ? 0.5 : 0.2 ) : 0.1; diff --git a/ui/pageviewutils.cpp b/ui/pageviewutils.cpp index c355d9264..0185f2a39 100644 --- a/ui/pageviewutils.cpp +++ b/ui/pageviewutils.cpp @@ -275,7 +275,7 @@ void ToolBarButton::mouseMoveEvent( QMouseEvent * e ) void ToolBarButton::paintEvent( QPaintEvent * e ) { // if the button is pressed or we're hovering it, use QPushButton style - if ( isOn() || m_hovering ) + if ( isChecked() || m_hovering ) { QPushButton::paintEvent( e ); return; @@ -624,9 +624,9 @@ void PageViewToolBar::slotButtonClicked() QLinkedList< ToolBarButton * >::iterator it = d->buttons.begin(), end = d->buttons.end(); for ( ; it != end; ++it ) if ( *it != button ) - (*it)->setOn( false ); + (*it)->setChecked( false ); // emit signal (-1 if button has been unselected) - emit toolSelected( button->isOn() ? button->buttonID() : -1 ); + emit toolSelected( button->isChecked() ? button->buttonID() : -1 ); } }