From c503452d56003ddb05e3266865abf02b04e0b785 Mon Sep 17 00:00:00 2001 From: Emmanuel Pescosta Date: Mon, 29 Oct 2012 20:54:53 +0100 Subject: [PATCH] Fix Bug 153984 - Clicking cancel on the authentication dialog for fish/sftp/ftp kioslave gets dolphin stuck on "Loading folder" BUG: 153984 REVIEW: 107116 --- src/dolphinviewcontainer.cpp | 11 +++++++++++ src/dolphinviewcontainer.h | 6 ++++++ src/kitemviews/kfileitemmodel.cpp | 2 ++ src/kitemviews/kfileitemmodel.h | 5 +++++ src/views/dolphinview.cpp | 1 + src/views/dolphinview.h | 6 ++++++ 6 files changed, 31 insertions(+) diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp index 8a566cffd..6e99437d9 100644 --- a/src/dolphinviewcontainer.cpp +++ b/src/dolphinviewcontainer.cpp @@ -111,6 +111,7 @@ DolphinViewContainer::DolphinViewContainer(const KUrl& url, QWidget* parent) : connect(m_view, SIGNAL(redirection(KUrl,KUrl)), this, SLOT(redirect(KUrl,KUrl))); connect(m_view, SIGNAL(directoryLoadingStarted()), this, SLOT(slotDirectoryLoadingStarted())); connect(m_view, SIGNAL(directoryLoadingCompleted()), this, SLOT(slotDirectoryLoadingCompleted())); + connect(m_view, SIGNAL(directoryLoadingCanceled()), this, SLOT(slotDirectoryLoadingCanceled())); connect(m_view, SIGNAL(itemCountChanged()), this, SLOT(delayedStatusBarUpdate())); connect(m_view, SIGNAL(directoryLoadingProgress(int)), this, SLOT(updateDirectoryLoadingProgress(int))); connect(m_view, SIGNAL(directorySortingProgress(int)), this, SLOT(updateDirectorySortingProgress(int))); @@ -451,6 +452,16 @@ void DolphinViewContainer::slotDirectoryLoadingCompleted() } } +void DolphinViewContainer::slotDirectoryLoadingCanceled() +{ + if (!m_statusBar->progressText().isEmpty()) { + m_statusBar->setProgressText(QString()); + m_statusBar->setProgress(100); + } + + showErrorMessage("Directory loading has been canceled."); +} + void DolphinViewContainer::slotUrlIsFileError(const KUrl& url) { const KFileItem item(KFileItem::Unknown, KFileItem::Unknown, url); diff --git a/src/dolphinviewcontainer.h b/src/dolphinviewcontainer.h index 8a0309b0c..0300273c1 100644 --- a/src/dolphinviewcontainer.h +++ b/src/dolphinviewcontainer.h @@ -195,6 +195,12 @@ private slots: */ void slotDirectoryLoadingCompleted(); + /** + * Updates the statusbar to show, that the directory loading has + * been canceled. + */ + void slotDirectoryLoadingCanceled(); + /** * Is called if the URL set by DolphinView::setUrl() represents * a file and not a directory. Takes care to activate the file. diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp index 61f512a8e..231bfe077 100644 --- a/src/kitemviews/kfileitemmodel.cpp +++ b/src/kitemviews/kfileitemmodel.cpp @@ -716,6 +716,8 @@ void KFileItemModel::slotCanceled() { m_maximumUpdateIntervalTimer->stop(); dispatchPendingItemsToInsert(); + + emit directoryLoadingCanceled(); } void KFileItemModel::slotNewItems(const KFileItemList& items) diff --git a/src/kitemviews/kfileitemmodel.h b/src/kitemviews/kfileitemmodel.h index 5bcebce24..ef9dc98b9 100644 --- a/src/kitemviews/kfileitemmodel.h +++ b/src/kitemviews/kfileitemmodel.h @@ -216,6 +216,11 @@ signals: */ void directoryLoadingCompleted(); + /** + * Is emitted after the loading of a directory has been canceled. + */ + void directoryLoadingCanceled(); + /** * Informs about the progress in percent when loading a directory. It is assured * that the signal directoryLoadingStarted() has been emitted before. diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index 9051d9827..67045032d 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -154,6 +154,7 @@ DolphinView::DolphinView(const KUrl& url, QWidget* parent) : connect(m_model, SIGNAL(directoryLoadingStarted()), this, SLOT(slotDirectoryLoadingStarted())); connect(m_model, SIGNAL(directoryLoadingCompleted()), this, SLOT(slotDirectoryLoadingCompleted())); + connect(m_model, SIGNAL(directoryLoadingCanceled()), this, SIGNAL(directoryLoadingCanceled())); connect(m_model, SIGNAL(directoryLoadingProgress(int)), this, SIGNAL(directoryLoadingProgress(int))); connect(m_model, SIGNAL(directorySortingProgress(int)), this, SIGNAL(directorySortingProgress(int))); connect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet)), diff --git a/src/views/dolphinview.h b/src/views/dolphinview.h index 7d8e8b76a..1feaf0f11 100644 --- a/src/views/dolphinview.h +++ b/src/views/dolphinview.h @@ -483,6 +483,12 @@ signals: */ void directoryLoadingCompleted(); + /** + * Is emitted after the directory loading triggered by DolphinView::setUrl() + * has been canceled. + */ + void directoryLoadingCanceled(); + /** * Is emitted after DolphinView::setUrl() has been invoked and provides * the information how much percent of the current directory have been loaded. -- 2.47.3