]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinstatusbar.cpp
The else path is never reached -> removed it (thanks to Simon St James for the hint)
[dolphin.git] / src / dolphinstatusbar.cpp
index edf242e669bc6c48340e27c587441dab8d319140..bd9b8bee8aef292c286298cf9479769e4e249c9f 100644 (file)
@@ -51,21 +51,20 @@ DolphinStatusBar::DolphinStatusBar(QWidget* parent, const KUrl& url) :
     m_progressBar = new QProgressBar(this);
     m_progressBar->hide();
 
-    const QSize size(m_progressBar->sizeHint());
-    const int barHeight = size.height();
+    const int contentHeight = QFontMetrics(m_messageLabel->font()).height() + 4;
+    const int barHeight = contentHeight + 4;
 
-    m_progressBar->setMaximumWidth(200);
     setMinimumHeight(barHeight);
     m_messageLabel->setMinimumTextHeight(barHeight);
-    m_spaceInfo->setFixedHeight(barHeight);
-
-    connect(parent, SIGNAL(urlChanged(const KUrl&)),
-            this, SLOT(updateSpaceInfoContent(const KUrl&)));
+    m_spaceInfo->setFixedHeight(contentHeight);
+    m_progressBar->setFixedHeight(contentHeight);
+    m_progressBar->setMaximumWidth(200);
 }
 
 
 DolphinStatusBar::~DolphinStatusBar()
-{}
+{
+}
 
 void DolphinStatusBar::setMessage(const QString& msg,
                                   Type type)
@@ -117,7 +116,7 @@ void DolphinStatusBar::setProgress(int percent)
 
     m_progressBar->setValue(m_progress);
     if (!m_progressBar->isVisible() || (percent == 100)) {
-        QTimer::singleShot(500, this, SLOT(updateProgressInfo()));
+        QTimer::singleShot(300, this, SLOT(updateProgressInfo()));
     }
 
     const QString& defaultText = m_messageLabel->defaultText();
@@ -147,7 +146,7 @@ const QString& DolphinStatusBar::defaultText() const
 void DolphinStatusBar::resizeEvent(QResizeEvent* event)
 {
     QWidget::resizeEvent(event);
-    QTimer::singleShot(0, this, SLOT(showSpaceInfo()));
+    QMetaObject::invokeMethod(this, "showSpaceInfo", Qt::QueuedConnection);
 }
 
 void DolphinStatusBar::updateProgressInfo()
@@ -180,14 +179,12 @@ void DolphinStatusBar::showSpaceInfo()
     const bool isProgressBarVisible = m_progressBar->isVisible();
 
     if (m_spaceInfo->isVisible()) {
-        // The space information is shown currently. Hide it
-        // if the progress bar is visible or if the status bar
-        // text does not fit into the available width.
-        const QSize size(m_progressBar->sizeHint());
-        if (isProgressBarVisible || (widthGap > 0)) {
+        // The space information is shown currently. Hide it if
+        // the status bar text does not fit into the available width.
+        if (widthGap > 0) {
             m_spaceInfo->hide();
         }
-    } else if (widthGap + m_spaceInfo->width() <= 0) {
+    } else if (!isProgressBarVisible && (widthGap + m_spaceInfo->width() <= 0)) {
         m_spaceInfo->show();
     }
 }