diff --git a/applets/icon/plugin/icon_p.cpp b/applets/icon/plugin/icon_p.cpp index e3dbf788c..f09f61cce 100644 --- a/applets/icon/plugin/icon_p.cpp +++ b/applets/icon/plugin/icon_p.cpp @@ -38,6 +38,7 @@ #include #include +#include #include IconPrivate::IconPrivate() { @@ -47,6 +48,23 @@ IconPrivate::~IconPrivate() { } void IconPrivate::setUrl(const QUrl &url) +{ + if (url.isLocalFile()) { + setUrlInternal(url); + } else { + KIO::StatJob *statJob = KIO::mostLocalUrl(url, KIO::HideProgressInfo); + + connect(statJob, &KJob::result, [=](KJob *job) { + if (!job->error()) { + setUrlInternal(static_cast(job)->mostLocalUrl()); + } + }); + + statJob->start(); + } +} + +void IconPrivate::setUrlInternal(const QUrl &url) { m_url = url; diff --git a/applets/icon/plugin/icon_p.h b/applets/icon/plugin/icon_p.h index 5341330f4..1628dd99c 100644 --- a/applets/icon/plugin/icon_p.h +++ b/applets/icon/plugin/icon_p.h @@ -59,6 +59,8 @@ Q_SIGNALS: void jumpListActionsChanged(const QVariantList &jumpListActions); private: + void setUrlInternal(const QUrl &url); + QUrl m_url; QString m_name; QString m_icon;