]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Show a progress information when doing a Nepomuk search. As "sideeffect" some KDE3...
authorPeter Penz <peter.penz19@gmail.com>
Thu, 12 Nov 2009 22:45:47 +0000 (22:45 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Thu, 12 Nov 2009 22:45:47 +0000 (22:45 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=1048225

src/dolphinmainwindow.cpp
src/dolphinviewcontainer.cpp
src/dolphinviewcontainer.h
src/statusbar/dolphinstatusbar.cpp
src/statusbar/dolphinstatusbar.h

index a83a95fc16c432069763287fcaf31dc7446889a5..ee5994955ae69f9322c938e8a69eff67ae05b228 100644 (file)
@@ -1006,6 +1006,12 @@ void DolphinMainWindow::slotTestCanDecode(const QDragMoveEvent* event, bool& can
 void DolphinMainWindow::searchItems(const KUrl& url)
 {
     m_activeViewContainer->setUrl(url);
+
+    // The Nepomuk IO-slave does not provide any progress information. Give
+    // an immediate hint to the user that a searching is done:
+    DolphinStatusBar* statusBar = m_activeViewContainer->statusBar();
+    statusBar->setProgressText(i18nc("@info", "Searching..."));
+    statusBar->setProgress(-1);
 }
 
 void DolphinMainWindow::slotTabMoved(int from, int to)
index ae6953aad09666886d0aea385ddedcc607ca4c2a..7bb4b7bec3bfbfbf2474cd8ab5b4b5a4d8dea999 100644 (file)
@@ -67,7 +67,6 @@ DolphinViewContainer::DolphinViewContainer(DolphinMainWindow* mainWindow,
                                            QWidget* parent,
                                            const KUrl& url) :
     QWidget(parent),
-    m_showProgress(false),
     m_isFolderWritable(false),
     m_mainWindow(mainWindow),
     m_topLayout(0),
@@ -283,30 +282,17 @@ void DolphinViewContainer::updateStatusBar()
 
 void DolphinViewContainer::updateProgress(int percent)
 {
-    if (!m_showProgress) {
-        // Only show the directory loading progress if the status bar does
-        // not contain another progress information. This means that
-        // the directory loading progress information has the lowest priority.
-        const QString progressText(m_statusBar->progressText());
-        const QString loadingText(i18nc("@info:progress", "Loading folder..."));
-        m_showProgress = progressText.isEmpty() || (progressText == loadingText);
-        if (m_showProgress) {
-            m_statusBar->setProgressText(loadingText);
-            m_statusBar->setProgress(0);
-        }
-    }
-
-    if (m_showProgress) {
-        m_statusBar->setProgress(percent);
+    if (m_statusBar->progressText().isEmpty()) {
+        m_statusBar->setProgressText(i18nc("@info:progress", "Loading folder..."));
     }
+    m_statusBar->setProgress(percent);
 }
 
 void DolphinViewContainer::slotDirListerCompleted()
 {
-    if (m_showProgress) {
+    if (!m_statusBar->progressText().isEmpty()) {
         m_statusBar->setProgressText(QString());
         m_statusBar->setProgress(100);
-        m_showProgress = false;
     }
 
     updateStatusBar();
index 97bdccd2a0700ff10377baab4d5dd20caa8cf6c5..a691b278fd96cfa2215f574af3748ac711025cc1 100644 (file)
@@ -253,7 +253,6 @@ private slots:
     void slotHistoryChanged();
 
 private:
-    bool m_showProgress;
     bool m_isFolderWritable;
 
     DolphinMainWindow* m_mainWindow;
index c36651e0b6547eae8035b321cc8171fdb3c12144..79f2de2c42d0c023a830d1fcfffb49798430436a 100644 (file)
@@ -191,6 +191,9 @@ QString DolphinStatusBar::progressText() const
 
 void DolphinStatusBar::setProgress(int percent)
 {
+    // show a busy indicator if a value < 0 is provided:
+    m_progressBar->setMaximum((percent < 0) ? 0 : 100);
+
     if (percent < 0) {
         percent = 0;
     } else if (percent > 100) {
@@ -206,7 +209,7 @@ void DolphinStatusBar::setProgress(int percent)
 
     m_progressBar->setValue(m_progress);
     if (!m_progressBar->isVisible() || (percent == 100)) {
-        QTimer::singleShot(300, this, SLOT(updateProgressInfo()));
+        updateProgressInfo();
     }
 
     const QString& defaultText = m_messageLabel->defaultText();
@@ -252,24 +255,6 @@ void DolphinStatusBar::resizeEvent(QResizeEvent* event)
     QMetaObject::invokeMethod(this, "assureVisibleText", Qt::QueuedConnection);
 }
 
-void DolphinStatusBar::updateProgressInfo()
-{
-    const bool isErrorShown = (m_messageLabel->type() == Error);
-    if (m_progress < 100) {
-        // show the progress information and hide the extensions
-        setExtensionsVisible(false);
-        if (!isErrorShown) {
-            m_progressText->show();
-            m_progressBar->show();
-        }
-    } else {
-        // hide the progress information and show the extensions
-        m_progressText->hide();
-        m_progressBar->hide();
-        assureVisibleText();
-    }
-}
-
 void DolphinStatusBar::updateSpaceInfoContent(const KUrl& url)
 {
     m_spaceInfo->setUrl(url);
@@ -322,6 +307,24 @@ void DolphinStatusBar::showZoomSliderToolTip(int zoomLevel)
     QApplication::sendEvent(m_zoomSlider, &toolTipEvent);
 }
 
+void DolphinStatusBar::updateProgressInfo()
+{
+    const bool isErrorShown = (m_messageLabel->type() == Error);
+    if (m_progress < 100) {
+        // show the progress information and hide the extensions
+        setExtensionsVisible(false);
+        if (!isErrorShown) {
+            m_progressText->show();
+            m_progressBar->show();
+        }
+    } else {
+        // hide the progress information and show the extensions
+        m_progressText->hide();
+        m_progressBar->hide();
+        assureVisibleText();
+    }
+}
+
 void DolphinStatusBar::setExtensionsVisible(bool visible)
 {
     bool spaceInfoVisible = visible;
index a07313babb714293e7b8aeac818c1cd2955c14f6..2fed4788d9d6fca77c591516252ce69ce11982c0 100644 (file)
@@ -127,8 +127,6 @@ protected:
     virtual void resizeEvent(QResizeEvent* event);
 
 private slots:
-    void updateProgressInfo();
-
     /**
      * Is invoked, when the URL of the DolphinView, where the
      * statusbar belongs too, has been changed. The space information
@@ -153,6 +151,8 @@ private slots:
     void showZoomSliderToolTip(int zoomLevel);
 
 private:
+    void updateProgressInfo();
+
     /**
      * Makes the space information widget and zoom slider widget
      * visible, if \a visible is true and the settings allow to show