From dc6bd8046f35993cae0f3659fd2420e18d0fe472 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Fri, 24 Oct 2008 19:52:28 +0000 Subject: [PATCH] Assure that no reloading is done if KDirLister emits a redirection, only change the the URL. Thanks to David Faure and Albert Alstals Cid for the detailed analysis! BUG: 155591 svn path=/trunk/KDE/kdebase/apps/; revision=875554 --- src/dolphinview.cpp | 9 +-------- src/dolphinview.h | 15 ++++++++------- src/dolphinviewcontainer.cpp | 11 +++++++++++ src/dolphinviewcontainer.h | 7 +++++++ 4 files changed, 27 insertions(+), 15 deletions(-) diff --git a/src/dolphinview.cpp b/src/dolphinview.cpp index 9d6038c2c..9e454ea71 100644 --- a/src/dolphinview.cpp +++ b/src/dolphinview.cpp @@ -126,7 +126,7 @@ DolphinView::DolphinView(QWidget* parent, this, SLOT(clearHoverInformation())); connect(m_dirLister, SIGNAL(redirection(KUrl, KUrl)), - this, SLOT(slotRedirection(KUrl, KUrl))); + this, SIGNAL(redirection(KUrl, KUrl))); connect(m_dirLister, SIGNAL(completed()), this, SLOT(restoreCurrentItem())); @@ -1027,13 +1027,6 @@ void DolphinView::slotDeleteFileFinished(KJob* job) } } -void DolphinView::slotRedirection(const KUrl& oldUrl, const KUrl& newUrl) -{ - if (oldUrl == m_controller->url()) { - m_controller->setUrl(newUrl); - } -} - void DolphinView::slotRequestUrlChange(const KUrl& url) { emit requestUrlChange(url); diff --git a/src/dolphinview.h b/src/dolphinview.h index 6c67f986b..170bc6bf8 100644 --- a/src/dolphinview.h +++ b/src/dolphinview.h @@ -85,7 +85,8 @@ public: { /** * The directory items are shown as icons including an - * icon name. */ + * icon name. + */ IconsView = 0, /** @@ -525,6 +526,12 @@ signals: */ void startedPathLoading(const KUrl& url); + /** + * Emitted when KDirLister emits redirection. + * Testcase: fish://localhost + */ + void redirection(const KUrl& oldUrl, const KUrl& newUrl); + protected: /** @see QWidget::mouseReleaseEvent */ virtual void mouseReleaseEvent(QMouseEvent* event); @@ -607,12 +614,6 @@ private slots: */ void slotDeleteFileFinished(KJob* job); - /** - * Called when KDirLister emits redirection. - * Testcase: fish://localhost - */ - void slotRedirection(const KUrl& oldUrl, const KUrl& newUrl); - /** * Is emitted if the controller requests a changing of the current * URL to \a url diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp index bed7d2758..3c1445fa5 100644 --- a/src/dolphinviewcontainer.cpp +++ b/src/dolphinviewcontainer.cpp @@ -140,6 +140,8 @@ DolphinViewContainer::DolphinViewContainer(DolphinMainWindow* mainWindow, this, SLOT(slotItemTriggered(KFileItem))); connect(m_view, SIGNAL(startedPathLoading(const KUrl&)), this, SLOT(saveRootUrl(const KUrl&))); + connect(m_view, SIGNAL(redirection(KUrl, KUrl)), + this, SLOT(redirect(KUrl, KUrl))); connect(m_urlNavigator, SIGNAL(urlChanged(const KUrl&)), this, SLOT(restoreView(const KUrl&))); @@ -370,6 +372,15 @@ void DolphinViewContainer::dropUrls(const KUrl& destination, QDropEvent* event) DolphinDropController::dropUrls(KFileItem(), destination, event, this); } +void DolphinViewContainer::redirect(const KUrl& oldUrl, const KUrl& newUrl) +{ + Q_UNUSED(oldUrl); + const bool block = m_urlNavigator->signalsBlocked(); + m_urlNavigator->blockSignals(true); + m_urlNavigator->setUrl(newUrl); + m_urlNavigator->blockSignals(block); +} + void DolphinViewContainer::slotItemTriggered(const KFileItem& item) { KUrl url = item.targetUrl(); diff --git a/src/dolphinviewcontainer.h b/src/dolphinviewcontainer.h index 4938835d8..1c6f8a6bc 100644 --- a/src/dolphinviewcontainer.h +++ b/src/dolphinviewcontainer.h @@ -212,6 +212,13 @@ private slots: * above the destination \a destination. */ void dropUrls(const KUrl& destination, QDropEvent* event); + + /** + * Is invoked when a redirection is done and changes the + * URL of the URL navigator to \a newUrl without triggering + * a reloading of the directory. + */ + void redirect(const KUrl& oldUrl, const KUrl& newUrl); private: bool m_showProgress; -- 2.47.3