D9812: [Icon Item] Treat sources starting with a slash as local file

Milian Wolff noreply at phabricator.kde.org
Thu Jan 11 10:01:02 UTC 2018


mwolff requested changes to this revision.
mwolff added a comment.
This revision now requires changes to proceed.


  lgtm in general, but can be cleaned up

INLINE COMMENTS

> iconitem.cpp:154
> +        // If a file:// URL or a absolute path is passed, take the image pointed by that from disk
> +        QUrl sourceUrl;
>          if (sourceString.startsWith(QLatin1String("file:"))) {

make this a `QString localFile;`

> iconitem.cpp:156
>          if (sourceString.startsWith(QLatin1String("file:"))) {
> -            const QUrl url(sourceString);
> +            sourceUrl = QUrl(sourceString);
> +        } else if (sourceString.startsWith(QLatin1Char('/'))) {

assign `localFile = QUrl(sourceString).toLocalFile();` here

> iconitem.cpp:158
> +        } else if (sourceString.startsWith(QLatin1Char('/'))) {
> +            sourceUrl = QUrl::fromLocalFile(sourceString);
> +        }

assign `localFile = sourceString;` here

> iconitem.cpp:163
>              m_icon = QIcon();
> -            m_imageIcon = QImage(url.toLocalFile());
> +            m_imageIcon = QImage(sourceUrl.toLocalFile());
>              m_svgIconName.clear();

use `localFile` here

REPOSITORY
  R242 Plasma Framework (Library)

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

To: broulik, #plasma, hein, mwolff
Cc: mwolff, plasma-devel, #frameworks, ZrenBot, progwolff, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20180111/50f2b49b/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list