#include "statusbarmessagelabel.h"
#include "statusbarspaceinfo.h"
-#include <QLabel>
-#include <QProgressBar>
-#include <QTimer>
+#include <QtGui/QLabel>
+#include <QtGui/QProgressBar>
+#include <QtCore/QTimer>
#include <kiconloader.h>
#include <kvbox.h>
-DolphinStatusBar::DolphinStatusBar(DolphinView* parent) :
+DolphinStatusBar::DolphinStatusBar(QWidget* parent, const KUrl& url) :
KHBox(parent),
m_messageLabel(0),
m_spaceInfo(0),
m_messageLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
m_spaceInfo = new StatusBarSpaceInfo(this);
- m_spaceInfo->setUrl(parent->url());
+ m_spaceInfo->setUrl(url);
m_progressText = new QLabel(this);
m_progressText->hide();
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();
+ const int barHeight = contentHeight + 8;
- 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)
void DolphinStatusBar::resizeEvent(QResizeEvent* event)
{
QWidget::resizeEvent(event);
- QTimer::singleShot(0, this, SLOT(showSpaceInfo()));
+ QMetaObject::invokeMethod(this, "showSpaceInfo", Qt::QueuedConnection);
}
void DolphinStatusBar::updateProgressInfo()
// 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)) {
m_spaceInfo->hide();
}