Commit 09624c71 authored by David Edmundson's avatar David Edmundson

Don't special case file URLs when processing .desktop files

At first glance this looks faster, as we skip KIO for a simple stat(),
but as the result isn't cached we do file lookups on every single mouse

This also has the side effect of not blocking Plasma when stat-ing a
file on a disconnected remote drive.

CCBUG: 379994

Test Plan:
Created two .desktop files one pointing to a dir, another to a file.
One had the arrow to expand the folder, the other did not.

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision:
parent b46cd1ed
......@@ -1113,13 +1113,7 @@ bool FolderModel::isDir(const QModelIndex &index, const KDirModel *dirModel) con
if (file.readType() == QLatin1String("Link")) {
const QUrl url(file.readUrl());
if (url.isLocalFile()) {
const QString path = url.adjusted(QUrl::StripTrailingSlash).toLocalFile();
if (QT_STAT(QFile::encodeName(path).constData(), &buf) == 0) {
return S_ISDIR(buf.st_mode);
} else if (!m_isDirCache.contains(item.url()) && KProtocolInfo::protocolClass(url.scheme()) == QStringLiteral(":local")) {
if (!m_isDirCache.contains(item.url()) && KProtocolInfo::protocolClass(url.scheme()) == QStringLiteral(":local")) {
KIO::StatJob *job = KIO::stat(url, KIO::HideProgressInfo);
job->setProperty("org.kde.plasma.folder_url", item.url());
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment