diff options
Diffstat (limited to 'src/kitemviews')
| -rw-r--r-- | src/kitemviews/kfileitemmodel.cpp | 7 | ||||
| -rw-r--r-- | src/kitemviews/kfileitemmodel.h | 5 |
2 files changed, 12 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); diff --git a/src/kitemviews/kfileitemmodel.h b/src/kitemviews/kfileitemmodel.h index f4c09b6c5..74aec17a9 100644 --- a/src/kitemviews/kfileitemmodel.h +++ b/src/kitemviews/kfileitemmodel.h @@ -263,6 +263,11 @@ Q_SIGNALS: */ void fileItemsChanged(const KFileItemList &changedFileItems); + /** + * It is emitted when the parent directory was removed. + */ + void currentDirectoryRemoved(); + protected: void onGroupedSortingChanged(bool current) override; void onSortRoleChanged(const QByteArray& current, const QByteArray& previous, bool resortItems = true) override; |
