]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Allow to cancel the loading of search results.
authorPeter Penz <peter.penz19@gmail.com>
Sat, 20 Nov 2010 17:17:35 +0000 (17:17 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Sat, 20 Nov 2010 17:17:35 +0000 (17:17 +0000)
BUG: 257421
FIXED-IN: 4.6.0

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

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

index 9e927ee9810a108b80f65b597518976defce08d3..bfab87cc8d8845a1ee5e8fd9fc796b0782edde66 100644 (file)
@@ -164,6 +164,8 @@ DolphinViewContainer::DolphinViewContainer(const KUrl& url, QWidget* parent) :
 
     // initialize status bar
     m_statusBar = new DolphinStatusBar(this, m_view);
+    connect(m_statusBar, SIGNAL(stopPressed()), this, SLOT(stopLoading()));
+
     m_statusBarTimer = new QTimer(this);
     m_statusBarTimer->setSingleShot(true);
     m_statusBarTimer->setInterval(300);
@@ -550,6 +552,11 @@ void DolphinViewContainer::closeSearchBox()
     setSearchModeEnabled(false);
 }
 
+void DolphinViewContainer::stopLoading()
+{
+    m_view->stopLoading();
+}
+
 bool DolphinViewContainer::isSearchUrl(const KUrl& url) const
 {
     const QString protocol = url.protocol();
index 44f5dd9060c610e16089156c0383a39c82b59443..a780722ba17d4122d94e442dfbd87dbbfa2da07f 100644 (file)
@@ -248,6 +248,12 @@ private slots:
     void startSearching(const QString& text);
     void closeSearchBox();
 
+    /**
+     * Stops the loading of a directory. Is connected with the "stopPressed" signal
+     * from the statusbar.
+     */
+    void stopLoading();
+
 private:
     /**
      * @return True if the URL protocol is a search URL (e. g. nepomuksearch:// or filenamesearch://).
index 687c009358f311beace0b0853c3d74d04f8f2672..4cfa3aeaec85dfd13664713d4a0b460e46880a04 100644 (file)
@@ -52,6 +52,7 @@ DolphinStatusBar::DolphinStatusBar(QWidget* parent, DolphinView* view) :
     m_zoomSlider(0),
     m_zoomIn(0),
     m_progressBar(0),
+    m_stopButton(0),
     m_progress(100),
     m_messageTimeStamp()
 {
@@ -100,6 +101,13 @@ DolphinStatusBar::DolphinStatusBar(QWidget* parent, DolphinView* view) :
     m_spaceInfo->setUrl(m_view->url());
 
     // Initialize progress information
+    m_stopButton = new QToolButton(this);
+    m_stopButton->setIcon(KIcon("process-stop"));
+    // TODO: Add tooltip for KDE SC 4.7.0, if new strings are allowed again
+    m_stopButton->setAutoRaise(true);
+    m_stopButton->hide();
+    connect(m_stopButton, SIGNAL(clicked()), this, SIGNAL(stopPressed()));
+
     m_progressText = new QLabel(this);
     m_progressText->hide();
 
@@ -126,6 +134,7 @@ DolphinStatusBar::DolphinStatusBar(QWidget* parent, DolphinView* view) :
     topLayout->addWidget(m_messageLabel);
     topLayout->addWidget(m_zoomWidget);
     topLayout->addWidget(m_spaceInfo);
+    topLayout->addWidget(m_stopButton);
     topLayout->addWidget(m_progressText);
     topLayout->addWidget(m_progressBar);
 
@@ -341,11 +350,13 @@ void DolphinStatusBar::updateProgressInfo()
         // Show the progress information and hide the extensions
         setExtensionsVisible(false);
         if (!isErrorShown) {
+            m_stopButton->show();
             m_progressText->show();
             m_progressBar->show();
         }
     } else {
         // Hide the progress information and show the extensions
+        m_stopButton->hide();
         m_progressText->hide();
         m_progressBar->hide();
         setExtensionsVisible(true);
index 35c207fcdde9db1921cf20416f66adbea142503f..2c1378372b62df2aa9b2bdc3efa47a2ef3f2bc50 100644 (file)
@@ -115,6 +115,12 @@ public:
      */
     void refresh();
 
+signals:
+    /**
+     * Is emitted if the stop-button has been pressed during showing a progress.
+     */
+    void stopPressed();
+
 protected:
     /** @see QWidget::contextMenuEvent() */
     virtual void contextMenuEvent(QContextMenuEvent* event);
@@ -165,6 +171,7 @@ private:
 
     QLabel* m_progressText;
     QProgressBar* m_progressBar;
+    QToolButton* m_stopButton;
     int m_progress;
 
     // Timestamp when the last message has been set that has not the type