┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphinmainwindow.cpp
diff options
context:
space:
mode:
authorVladislav Kachegov <[email protected]>2025-05-23 12:46:54 +0300
committerFelix Ernst <[email protected]>2025-06-01 00:58:47 +0200
commit3e4d9ca10c33746cb545e930886491e6a1227e6e (patch)
tree1f6b018feb69c2196ae153fbd6b9d08b94895743 /src/dolphinmainwindow.cpp
parent66fcfc24b5d8aa7f09432ecced7b1dc8d6c1dfe1 (diff)
fix incorrect view reset when unmounting similarly-named devices
Previously, unmounting a device would incorrectly reset views containing: - Paths with similar names (e.g. "/media/disk" and "/media/disk_2") - Substrings of the mounted path Now only resets views showing either: 1. The exact mounted path (e.g. "/media/disk") 2. Its subdirectories (e.g. "/media/disk/docs")
Diffstat (limited to 'src/dolphinmainwindow.cpp')
-rw-r--r--src/dolphinmainwindow.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp
index 297ab000e..2697b12fb 100644
--- a/src/dolphinmainwindow.cpp
+++ b/src/dolphinmainwindow.cpp
@@ -1726,7 +1726,11 @@ void DolphinMainWindow::setViewsToHomeIfMountPathOpen(const QString &mountPath)
{
const QVector<DolphinViewContainer *> theViewContainers = viewContainers();
for (DolphinViewContainer *viewContainer : theViewContainers) {
- if (viewContainer && viewContainer->url().toLocalFile().startsWith(mountPath)) {
+ if (!viewContainer) {
+ continue;
+ }
+ const auto viewPath = viewContainer->url().toLocalFile();
+ if (viewPath.startsWith(mountPath + QLatin1String("/")) || viewPath == mountPath) {
viewContainer->setUrl(QUrl::fromLocalFile(QDir::homePath()));
}
}