- // Try to share the observer with other paths that have the same mount point.
- QString mountPointPath;
- KMountPoint::Ptr mountPoint = KMountPoint::currentMountPoints().findByPath(path);
- if (mountPoint) {
- mountPointPath = mountPoint->mountPoint();
+ QUrl cachedObserverUrl;
+ // 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());
+ } else {
+ // Even if determining the mount point failed, the observer might still
+ // be able to retrieve information about the url.
+ cachedObserverUrl = url.toLocalFile();
+ }