]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Show an undetermined progress indication within one second after changing an URL.
authorPeter Penz <peter.penz19@gmail.com>
Fri, 10 Dec 2010 22:54:37 +0000 (22:54 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Fri, 10 Dec 2010 22:54:37 +0000 (22:54 +0000)
Update to SVN commit 1205329:
- Fix issue that an undetermined progress is shown when switching between columns of the column-view.
- Fix issue that no undetermined progress is shown when editing the URL directly in the URL navigator

BUG: 234894
BUG: 163004
FIXED-IN: 4.6.0

svn path=/trunk/KDE/kdebase/apps/; revision=1205345

src/dolphinviewcontainer.cpp
src/dolphinviewcontainer.h
src/views/dolphinview.cpp

index 240cfb783a5bb8316596201f8804efc9814bbfa9..06682202d746c45c09d0ce372ee8f1c222a0f38b 100644 (file)
@@ -117,8 +117,8 @@ DolphinViewContainer::DolphinViewContainer(const KUrl& url, QWidget* parent) :
     m_proxyModel->setSourceModel(m_dolphinModel);
     m_proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
 
-    connect(m_dirLister, SIGNAL(started(KUrl)),
-            this, SLOT(initializeProgress()));
+    // TODO: In the case of the column view the directory lister changes. Let the DolphinView
+    // inform the container about this information for KDE SC 4.7
     connect(m_dirLister, SIGNAL(clear()),
             this, SLOT(delayedStatusBarUpdate()));
     connect(m_dirLister, SIGNAL(percent(int)),
@@ -127,8 +127,6 @@ DolphinViewContainer::DolphinViewContainer(const KUrl& url, QWidget* parent) :
             this, SLOT(delayedStatusBarUpdate()));
     connect(m_dirLister, SIGNAL(newItems(KFileItemList)),
             this, SLOT(delayedStatusBarUpdate()));
-    connect(m_dirLister, SIGNAL(completed()),
-            this, SLOT(slotDirListerCompleted()));
     connect(m_dirLister, SIGNAL(infoMessage(const QString&)),
             this, SLOT(showInfoMessage(const QString&)));
     connect(m_dirLister, SIGNAL(errorMessage(const QString&)),
@@ -153,6 +151,10 @@ DolphinViewContainer::DolphinViewContainer(const KUrl& url, QWidget* parent) :
             this, SLOT(redirect(KUrl, KUrl)));
     connect(m_view, SIGNAL(selectionChanged(const KFileItemList&)),
             this, SLOT(delayedStatusBarUpdate()));
+    connect(m_view, SIGNAL(startedPathLoading(KUrl)),
+            this, SLOT(slotStartedPathLoading()));
+    connect(m_view, SIGNAL(finishedPathLoading(KUrl)),
+            this, SLOT(slotFinishedPathLoading()));
 
     connect(m_urlNavigator, SIGNAL(urlChanged(const KUrl&)),
             this, SLOT(slotUrlNavigatorLocationChanged(const KUrl&)));
@@ -297,11 +299,6 @@ void DolphinViewContainer::setUrl(const KUrl& newUrl)
         if (isActive()) {
             emit writeStateChanged(false);
         }
-
-        // Trigger an undetermined progress indication. The progress
-        // information in percent will be triggered by the percent() signal
-        // of the directory lister later.
-        updateProgress(-1);
     }
 }
 
@@ -354,26 +351,31 @@ void DolphinViewContainer::updateStatusBar()
     }
 }
 
-void DolphinViewContainer::initializeProgress()
+void DolphinViewContainer::updateProgress(int percent)
+{
+    if (m_statusBar->progressText().isEmpty()) {
+        m_statusBar->setProgressText(i18nc("@info:progress", "Loading folder..."));
+    }
+    m_statusBar->setProgress(percent);
+}
+
+void DolphinViewContainer::slotStartedPathLoading()
 {
     if (isSearchUrl(url())) {
         // Search KIO-slaves usually don't provide any progress information. Give
-        // an immediate hint to the user that a searching is done:
+        // a hint to the user that a searching is done:
         updateStatusBar();
         m_statusBar->setProgressText(i18nc("@info", "Searching..."));
         m_statusBar->setProgress(-1);
+    } else {
+        // Trigger an undetermined progress indication. The progress
+        // information in percent will be triggered by the percent() signal
+        // of the directory lister later.
+        updateProgress(-1);
     }
- }
-
-void DolphinViewContainer::updateProgress(int percent)
-{
-    if (m_statusBar->progressText().isEmpty()) {
-        m_statusBar->setProgressText(i18nc("@info:progress", "Loading folder..."));
-    }
-    m_statusBar->setProgress(percent);
 }
 
-void DolphinViewContainer::slotDirListerCompleted()
+void DolphinViewContainer::slotFinishedPathLoading()
 {
     if (!m_statusBar->progressText().isEmpty()) {
         m_statusBar->setProgressText(QString());
index a780722ba17d4122d94e442dfbd87dbbfa2da07f..337452e5cc83e4693bb3c2037600b0314ac89f3e 100644 (file)
@@ -152,15 +152,19 @@ private slots:
      */
     void updateStatusBar();
 
-    void initializeProgress();
-
     void updateProgress(int percent);
 
+    /**
+     * Updates the statusbar to show an undetermined progress with the correct
+     * context information whether a searching or a directory loading is done.
+     */
+    void slotStartedPathLoading();
+
     /**
      * Assures that the viewport position is restored and updates the
      * statusbar to reflect the current content.
      */
-    void slotDirListerCompleted();
+    void slotFinishedPathLoading();
 
     /**
      * Handles clicking on an item. If the item is a directory, the
index c2e998e5a4f976c448bb155f8e3bd4cdee2ae7c7..46f7acf1304fdc7ecb256c77e6d6dec2824bdcce 100644 (file)
@@ -528,16 +528,14 @@ void DolphinView::setUrl(const KUrl& url)
     m_viewModeController->setUrl(url); // emits urlChanged, which we forward
     m_viewAccessor.prepareUrlChange(url);
     applyViewProperties();
-    loadDirectory(url);
 
     // When changing the URL there is no need to keep the version
     // data of the previous URL.
     m_viewAccessor.dirModel()->clearVersionData();
 
-    emit startedPathLoading(url);
-
     // Reconnect to the (probably) new selection model and directory lister
     connectViewAccessor();
+    loadDirectory(url);
 
     if (hadSelection || hasSelection()) {
         emitSelectionChangedSignal();
@@ -1278,6 +1276,8 @@ void DolphinView::connectViewAccessor()
     KDirLister* dirLister = m_viewAccessor.dirLister();
     connect(dirLister, SIGNAL(redirection(KUrl,KUrl)),
             this, SLOT(slotRedirection(KUrl,KUrl)));
+    connect(dirLister, SIGNAL(started(KUrl)),
+            this, SIGNAL(startedPathLoading(KUrl)));
     connect(dirLister, SIGNAL(completed()),
             this, SLOT(slotDirListerCompleted()));
     connect(dirLister, SIGNAL(refreshItems(const QList<QPair<KFileItem,KFileItem>>&)),
@@ -1293,6 +1293,8 @@ void DolphinView::disconnectViewAccessor()
     KDirLister* dirLister = m_viewAccessor.dirLister();
     disconnect(dirLister, SIGNAL(redirection(KUrl,KUrl)),
                this, SLOT(slotRedirection(KUrl,KUrl)));
+    disconnect(dirLister, SIGNAL(started(KUrl)),
+               this, SIGNAL(startedPathLoading(KUrl)));
     disconnect(dirLister, SIGNAL(completed()),
                this, SLOT(slotDirListerCompleted()));
     disconnect(dirLister, SIGNAL(refreshItems(const QList<QPair<KFileItem,KFileItem>>&)),