┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Uwe Broulik <[email protected]>2026-01-09 17:01:27 +0100
committerKai Uwe Broulik <[email protected]>2026-01-31 15:07:30 +0000
commitd54fb877d7a875d1f1bcb37782410ba92ecc4890 (patch)
treea0d3e649af4d850d346f642aeadfc669f1523dfa
parent66676e7a705f7da841c29e11eb315cb5b0f54abd (diff)
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.
-rw-r--r--src/statusbar/mountpointobservercache.cpp11
1 files 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 <KMountPoint>
+#include <Solid/Device>
+#include <Solid/StorageAccess>
+
#include <QTimer>
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<Solid::StorageAccess>();
+ 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.