]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Handle redirections (e.g. from fish://localhost) without breaking the column view...
authorDavid Faure <faure@kde.org>
Wed, 28 May 2008 23:07:09 +0000 (23:07 +0000)
committerDavid Faure <faure@kde.org>
Wed, 28 May 2008 23:07:09 +0000 (23:07 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=813954

src/dolphinpart.cpp
src/dolphinpart.h
src/dolphinview.cpp
src/dolphinview.h

index 296e101d614946c8580f75174db24f8e9174be3b..46867dbadd223e8482100787f77d5c6e32660f16 100644 (file)
@@ -100,6 +100,8 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantL
             this, SLOT(slotRequestItemInfo(KFileItem)));
     connect(m_view, SIGNAL(urlChanged(KUrl)),
             this, SLOT(slotUrlChanged(KUrl)));
+    connect(m_view, SIGNAL(requestUrlChange(KUrl)),
+            this, SLOT(slotRequestUrlChange(KUrl)));
     connect(m_view, SIGNAL(modeChanged()),
             this, SIGNAL(viewModeChanged())); // relay signal
 
@@ -356,6 +358,12 @@ void DolphinPart::slotOpenContextMenu(const KFileItem& _item, const KUrl&)
 }
 
 void DolphinPart::slotUrlChanged(const KUrl& url)
+{
+    QString prettyUrl = url.pathOrUrl();
+    emit m_extension->setLocationBarUrl(prettyUrl);
+}
+
+void DolphinPart::slotRequestUrlChange(const KUrl& url)
 {
     if (m_view->url() != url) {
         // If the view URL is not equal to 'url', then an inner URL change has
index cca1d7135838ecca3587da4149fd78d3dc435797..612c22aa7e3a58bdbe973cc14cdaec43b9cac4d2 100644 (file)
@@ -138,6 +138,11 @@ private Q_SLOTS:
      * Asks the host to open the URL \a url if the current view has
      * a different URL.
      */
+    void slotRequestUrlChange(const KUrl& url);
+
+    /**
+     * Informs the host that we are opening \a url (e.g. after a redirection).
+     */
     void slotUrlChanged(const KUrl& url);
 
     /**
index ae6ea5ec7bbfcaf3b9de5a19b6d86f389f7dba90..afd1e522d7b568bd0d5ce6af9c02428721583e4d 100644 (file)
@@ -102,7 +102,7 @@ DolphinView::DolphinView(QWidget* parent,
     connect(m_controller, SIGNAL(urlChanged(const KUrl&)),
             this, SIGNAL(urlChanged(const KUrl&)));
     connect(m_controller, SIGNAL(requestUrlChange(const KUrl&)),
-            this, SIGNAL(urlChanged(const KUrl&)));
+            this, SIGNAL(slotRequestUrlChange(const KUrl&)));
 
     connect(m_controller, SIGNAL(requestContextMenu(const QPoint&)),
             this, SLOT(openContextMenu(const QPoint&)));
@@ -125,6 +125,8 @@ DolphinView::DolphinView(QWidget* parent,
     connect(m_controller, SIGNAL(viewportEntered()),
             this, SLOT(clearHoverInformation()));
 
+    connect(m_dirLister, SIGNAL(redirection(KUrl, KUrl)),
+            this, SLOT(slotRedirection(KUrl, KUrl)));
     connect(m_dirLister, SIGNAL(completed()),
             this, SLOT(restoreCurrentItem()));
 
@@ -1203,4 +1205,16 @@ void DolphinView::pasteToUrl(const KUrl& url)
     }
 }
 
+void DolphinView::slotRequestUrlChange(const KUrl& url)
+{
+    emit requestUrlChange(url);
+    m_controller->setUrl(url);
+}
+
+void DolphinView::slotRedirection(const KUrl& oldUrl, const KUrl& newUrl)
+{
+    if (oldUrl == m_controller->url())
+        m_controller->setUrl(newUrl);
+}
+
 #include "dolphinview.moc"
index 121a7f6dad23e6356e06a803ff978ced2ea1b3b4..0936b06a3558fb037ab57d15249b4b9c856b645e 100644 (file)
@@ -420,6 +420,12 @@ signals:
     /** Is emitted if URL of the view has been changed to \a url. */
     void urlChanged(const KUrl& url);
 
+    /**
+     * Is emitted if the view requests a changing of the current
+     * URL to \a url (see DolphinController::triggerUrlChangeRequest()).
+     */
+    void requestUrlChange(const KUrl& url);
+
     /**
      * Is emitted when clicking on an item with the left mouse button.
      */
@@ -595,6 +601,18 @@ 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
+     */
+    void slotRequestUrlChange(const KUrl& url);
+
     /**
      * Restores the current item (= item that has the keyboard focus)
      * to m_currentItemUrl.