[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    Re: KDE/kdelibs/kio
From:       David Faure <faure () kde ! org>
Date:       2006-02-27 23:04:52
Message-ID: 200602280004.53720.faure () kde ! org
[Download RAW message or body]

On Monday 27 February 2006 23:57, Oswald Buddenhagen wrote:
> On Mon, Feb 27, 2006 at 08:11:36PM +0100, David Faure wrote:
> > On Monday 27 February 2006 20:07, Christian Ehrlicher wrote:
> > > --- trunk/KDE/kdelibs/kio/kfile/kpropertiesdialog.cpp #514261:514262
> > > @@ -735,8 +735,8 @@
> > >    {
> > >      QString path;
> > >      if ( !m_bFromTemplate ) {
> > > -      isTrash = ( properties->kurl().protocol().find( "trash", 0, false)==0 );
> > > -      if ( properties->kurl().protocol().find("device", 0, false)==0)
> > > +      isTrash = ( properties->kurl().protocol().indexOf( "trash", 0, Qt::CaseInsensitive)==0 );
> > > +      if ( properties->kurl().protocol().indexOf("device", 0, Qt::CaseInsensitive)==0)
> > 
> > Actually this was only meant as a case-insensitive comparison;
> > kurl().protocol().lower() == "trash" would be simpler.
> > 
> ... and probably slower, as it constructs a temp string. 

But iterating over the whole string to look for a substring sounds slow and useless too,
when all we need is case insensitive comparison.

> i don't suppose 
> it matters in this case, but one should keep such things in mind when
> "simplifying" code.

Using find() to mean equals() is a much bigger problem (readability).

> damn, why doesn't qt provide QString::equals({const QString &|const
> QLatin1String &|const char *}, Qt::CaseSensitivity cs) methods? or does
> it and they just happen to be named differently?

Right I'm missing that too. Could be an argument to compare(), in fact.

-- 
David Faure, faure@kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic