anthonyfieroni added inline comments.

INLINE COMMENTS

> kio_tags.cpp:363
> +
> +        if (result.decodedUrl.contains(QStringLiteral("?//")) || 
> chopLastSection) {
> +            result.tag = result.tag.section(QDir::separator(), 0, -2);

Better reverse conditions

  if (chopLastSection ||...)

You don't need expensive call like contains

> kio_tags.cpp:380-381
>  
> -    QString tag;
> -    QString fileUrl;
> +            if (tag.startsWith(result.tag, Qt::CaseInsensitive)) {
> +                validTag = true;
> +            }

You can use boolean conditions rather than if statements, example

  validTag = validTag || tag.startWith(...)

Why?

1. if validTag is true startWith will not called
2. It's on one line (less and beauty code)

> kio_tags.h:101
> +        QUrl localUrl;
> +        KFileMetaData::UserMetaData metaData = 
> KFileMetaData::UserMetaData(QString());
> +        Query query;

metaData(QString{})

> kio_tags.h:106
>  
> -    QString decodeFileUrl(const QString& urlString);
> -    QString encodeFileUrl(const QString& url);
> +    ParseResult parseUrl(const QUrl& url, bool chopLastSection = false, bool 
> lazyValidation = false);
> +    QStringList m_unassignedTags;

Use enum rather than boolean trap

REPOSITORY
  R293 Baloo

REVISION DETAIL
  https://phabricator.kde.org/D8098

To: smithjd, #frameworks, vhanda, #dolphin, ngraham, dfaure
Cc: anthonyfieroni, dfaure, nicolasfella, ngraham

Reply via email to