┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews/kfileitemmodel.cpp
diff options
context:
space:
mode:
authorMéven Car <[email protected]>2022-11-29 18:16:59 +0000
committerMéven Car <[email protected]>2022-11-29 18:16:59 +0000
commita2c9c05de2dfabbb2bb614390c8e03023dad2bd1 (patch)
tree5f34ae95e4cb0ea8ee95d3ee17c28b3cacd25ae9 /src/kitemviews/kfileitemmodel.cpp
parentde289800b22c654e8e3d8fbaea7bdb496a021b88 (diff)
Exit the deleted directory when it is removed
If current directory is a local file, try to find nearest dir ancestor and open it. Display warning to the user.
Diffstat (limited to 'src/kitemviews/kfileitemmodel.cpp')
-rw-r--r--src/kitemviews/kfileitemmodel.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp
index 1c48b2275..c08f8e964 100644
--- a/src/kitemviews/kfileitemmodel.cpp
+++ b/src/kitemviews/kfileitemmodel.cpp
@@ -1150,7 +1150,14 @@ void KFileItemModel::slotItemsDeleted(const KFileItemList& items)
indexesToRemove.reserve(items.count());
KFileItemList dirsChanged;
+ const auto currentDir = directory();
+
for (const KFileItem& item : items) {
+ if (item.url() == currentDir) {
+ Q_EMIT currentDirectoryRemoved();
+ return;
+ }
+
const int indexForItem = index(item);
if (indexForItem >= 0) {
indexesToRemove.append(indexForItem);