From 4051004a5e79d91b29dda6a18f64e0765ce3f032 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Sat, 2 Sep 2023 01:57:07 +0300 Subject: [PATCH] kio: checkDesktopFile() function optimization KFileItem::isRegularFile() is a simple mode (member) check while KFileItem::mostLocalUrl() does some dirty work Signed-off-by: Ivailo Monev --- kfile/kurlnavigator.cpp | 4 ---- kio/kio/kfileitem.cpp | 10 +++++----- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/kfile/kurlnavigator.cpp b/kfile/kurlnavigator.cpp index ea09a041..19b07f50 100644 --- a/kfile/kurlnavigator.cpp +++ b/kfile/kurlnavigator.cpp @@ -902,7 +902,6 @@ bool KUrlNavigator::showFullPath() const return d->m_showFullPath; } - void KUrlNavigator::setActive(bool active) { if (active != d->m_active) { @@ -1024,9 +1023,6 @@ void KUrlNavigator::setFocus() } } - - - void KUrlNavigator::keyPressEvent(QKeyEvent* event) { if (isUrlEditable() && (event->key() == Qt::Key_Escape)) { diff --git a/kio/kio/kfileitem.cpp b/kio/kio/kfileitem.cpp index 4049e03f..eef37ae3 100644 --- a/kio/kio/kfileitem.cpp +++ b/kio/kio/kfileitem.cpp @@ -750,6 +750,11 @@ QString KFileItem::iconName() const */ static bool checkDesktopFile(const KFileItem &item, bool _determineMimeType) { + // only regular files + if (!item.isRegularFile()) { + return false; + } + // only local files bool isLocal = false; const KUrl url = item.mostLocalUrl(isLocal); @@ -757,11 +762,6 @@ static bool checkDesktopFile(const KFileItem &item, bool _determineMimeType) return false; } - // only regular files - if (!item.isRegularFile()) { - return false; - } - // only if readable if (!item.isReadable()) { return false;