plasma: replace KMimeType::iconNameForUrl() with KIO::pixmapForUrl()

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2024-05-30 02:27:38 +03:00
parent 201fd428a4
commit da20c01ce3
2 changed files with 11 additions and 19 deletions

View file

@ -35,14 +35,10 @@
namespace Quicklaunch { namespace Quicklaunch {
// KUrl::url() takes care of improperly escaped characters and
// resolves pure paths into file:/// URLs
LauncherData::LauncherData(const KUrl& url) LauncherData::LauncherData(const KUrl& url)
: : m_url(url.url())
// KUrl::url() takes care of improperly escaped characters and
// resolves pure paths into file:/// URLs
m_url(url.url()),
m_name(),
m_description(),
m_icon()
{ {
if (m_url.isLocalFile() && if (m_url.isLocalFile() &&
KDesktopFile::isDesktopFile(m_url.toLocalFile())) { KDesktopFile::isDesktopFile(m_url.toLocalFile())) {
@ -67,12 +63,8 @@ LauncherData::LauncherData(const KUrl& url)
} }
LauncherData::LauncherData() LauncherData::LauncherData()
: {
m_url(), }
m_name(),
m_description(),
m_icon()
{}
KUrl LauncherData::url() const KUrl LauncherData::url() const
{ {
@ -96,11 +88,12 @@ QString LauncherData::icon() const
bool LauncherData::operator==(const LauncherData& other) const bool LauncherData::operator==(const LauncherData& other) const
{ {
return return (
m_url == other.m_url && m_url == other.m_url &&
m_name == other.m_name && m_name == other.m_name &&
m_description == other.m_description && m_description == other.m_description &&
m_icon == other.m_icon; m_icon == other.m_icon
);
} }
bool LauncherData::operator!=(const LauncherData& other) const bool LauncherData::operator!=(const LauncherData& other) const
@ -113,8 +106,7 @@ void LauncherData::populateMimeData(QMimeData *mimeData)
// Use the bookmarks API to do the heavy lifting // Use the bookmarks API to do the heavy lifting
KBookmark::List bookmarkList; KBookmark::List bookmarkList;
KBookmark bookmark = KBookmark bookmark = KBookmark::standaloneBookmark(m_name, m_url, m_icon);
KBookmark::standaloneBookmark(m_name, m_url, m_icon);
bookmark.setDescription(m_description); bookmark.setDescription(m_description);

View file

@ -29,7 +29,7 @@
#include <KIcon> #include <KIcon>
#include <KProtocolInfo> #include <KProtocolInfo>
#include <KUriFilter> #include <KUriFilter>
#include <kio/global.h>
LocationsRunner::LocationsRunner(QObject *parent, const QVariantList& args) LocationsRunner::LocationsRunner(QObject *parent, const QVariantList& args)
: Plasma::AbstractRunner(parent, args) : Plasma::AbstractRunner(parent, args)
@ -55,7 +55,7 @@ void LocationsRunner::match(Plasma::RunnerContext &context)
match.setText(i18n("Open %1", term)); match.setText(i18n("Open %1", term));
if (type == Plasma::RunnerContext::File) { if (type == Plasma::RunnerContext::File) {
match.setIcon(KIcon(KMimeType::iconNameForUrl(KUrl(term)))); match.setIcon(KIcon(KIO::pixmapForUrl(KUrl(term))));
} else { } else {
match.setIcon(KIcon("system-file-manager")); match.setIcon(KIcon("system-file-manager"));
} }