From a2c9c05de2dfabbb2bb614390c8e03023dad2bd1 Mon Sep 17 00:00:00 2001 From: Méven Car Date: Tue, 29 Nov 2022 18:16:59 +0000 Subject: 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. --- src/views/dolphinview.cpp | 1 + src/views/dolphinview.h | 5 +++++ 2 files changed, 6 insertions(+) (limited to 'src/views') diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index 1da3ebf85..5f331dc27 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -195,6 +195,7 @@ DolphinView::DolphinView(const QUrl& url, QWidget* parent) : connect(m_model, &KFileItemModel::directoryRedirection, this, &DolphinView::slotDirectoryRedirection); connect(m_model, &KFileItemModel::urlIsFileError, this, &DolphinView::urlIsFileError); connect(m_model, &KFileItemModel::fileItemsChanged, this, &DolphinView::fileItemsChanged); + connect(m_model, &KFileItemModel::currentDirectoryRemoved, this, &DolphinView::currentDirectoryRemoved); connect(this, &DolphinView::itemCountChanged, this, &DolphinView::updatePlaceholderLabel); diff --git a/src/views/dolphinview.h b/src/views/dolphinview.h index aff4c51a8..50b1b9270 100644 --- a/src/views/dolphinview.h +++ b/src/views/dolphinview.h @@ -637,6 +637,11 @@ Q_SIGNALS: void fileItemsChanged(const KFileItemList &changedFileItems); + /** + * Emitted when the current directory of the model was removed. + */ + void currentDirectoryRemoved(); + protected: /** Changes the zoom level if Control is pressed during a wheel event. */ void wheelEvent(QWheelEvent* event) override; -- cgit v1.3