Commit 22c45feb authored by Pino Toscano's avatar Pino Toscano
Browse files

less qt3_support

svn path=/branches/work/kde4/playground/graphics/okular/; revision=524154
parent 61788d97
......@@ -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 )
{
......
......@@ -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 );
......
......@@ -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 );
......
......@@ -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 <param> 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 <param> 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());
// <OBJECT type="text/sitemap"> - 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 <param> 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 <param> 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());
// <OBJECT type="text/sitemap"> - 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 <param> 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 <param> 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 )
......
......@@ -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 );
......
......@@ -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();
}
......
......@@ -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 );
}
......
......@@ -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 );
......
......@@ -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;
......
......@@ -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 );
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment