From d54fb877d7a875d1f1bcb37782410ba92ecc4890 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Fri, 9 Jan 2026 17:01:27 +0100 Subject: mountpointobservercache: Use Solid for determining mountpoint KFilePlacesModel already has all the devices, so we can use it rather than having KMountPoint query the list of mounts all the time. --- src/statusbar/mountpointobservercache.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/statusbar/mountpointobservercache.cpp b/src/statusbar/mountpointobservercache.cpp index a7d74764d..e1c08fec5 100644 --- a/src/statusbar/mountpointobservercache.cpp +++ b/src/statusbar/mountpointobservercache.cpp @@ -10,6 +10,9 @@ #include +#include +#include + #include class MountPointObserverCacheSingleton @@ -40,9 +43,11 @@ MountPointObserver *MountPointObserverCache::observerForUrl(const QUrl &url) // If the url is a local path we can extract the root dir by checking the mount points. if (url.isLocalFile()) { // Try to share the observer with other paths that have the same mount point. - KMountPoint::Ptr mountPoint = KMountPoint::currentMountPoints().findByPath(url.toLocalFile()); - if (mountPoint) { - cachedObserverUrl = QUrl::fromLocalFile(mountPoint->mountPoint()); + // Use Solid (rather than KMountPoint) which will likely already have the info from KFilePlacesModel. + const auto device = Solid::Device::storageAccessFromPath(url.toLocalFile()); + const auto *deviceAccess = device.as(); + if (deviceAccess) { + cachedObserverUrl = QUrl::fromLocalFile(deviceAccess->filePath()); } else { // Even if determining the mount point failed, the observer might still // be able to retrieve information about the url. -- cgit v1.3