diff options
| author | Peter Penz <[email protected]> | 2009-08-01 20:30:23 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2009-08-01 20:30:23 +0000 |
| commit | 52478842e320536ce77eb1a13c235b2d5f98927f (patch) | |
| tree | 7f8a50a68b94ec5952c26d61a7fc2b2dc1213073 /src/statusbar | |
| parent | 99eacd9f56acf4ad21994508ee824b1ce1594be1 (diff) | |
Assure that non-default messages don't get hidden after a very short time by default messages.
svn path=/trunk/KDE/kdebase/apps/; revision=1005712
Diffstat (limited to 'src/statusbar')
| -rw-r--r-- | src/statusbar/dolphinstatusbar.cpp | 17 | ||||
| -rw-r--r-- | src/statusbar/dolphinstatusbar.h | 6 |
2 files changed, 22 insertions, 1 deletions
diff --git a/src/statusbar/dolphinstatusbar.cpp b/src/statusbar/dolphinstatusbar.cpp index aaa302a15..fe42011d3 100644 --- a/src/statusbar/dolphinstatusbar.cpp +++ b/src/statusbar/dolphinstatusbar.cpp @@ -48,7 +48,8 @@ DolphinStatusBar::DolphinStatusBar(QWidget* parent, DolphinView* view) : m_zoomSlider(0), m_zoomIn(0), m_progressBar(0), - m_progress(100) + m_progress(100), + m_messageTimeStamp() { setMargin(0); setSpacing(4); @@ -135,7 +136,21 @@ void DolphinStatusBar::setMessage(const QString& msg, return; } + const QTime currentTime = QTime::currentTime(); + const bool skipMessage = (type == Default) && + m_messageTimeStamp.isValid() && + (m_messageTimeStamp.msecsTo(currentTime) < 1000); + if (skipMessage) { + // A non-default message is shown just for a very short time. Don't hide + // the message by a default message, so that the user gets the chance to + // read the information. + return; + } + m_messageLabel->setMessage(msg, type); + if (type != Default) { + m_messageTimeStamp = currentTime; + } const int widthGap = m_messageLabel->widthGap(); if (widthGap > 0) { diff --git a/src/statusbar/dolphinstatusbar.h b/src/statusbar/dolphinstatusbar.h index a536ea178..a07313bab 100644 --- a/src/statusbar/dolphinstatusbar.h +++ b/src/statusbar/dolphinstatusbar.h @@ -22,6 +22,7 @@ #define DOLPHINSTATUSBAR_H #include <khbox.h> +#include <QTime> class DolphinView; class KUrl; @@ -179,6 +180,11 @@ private: QLabel* m_progressText; QProgressBar* m_progressBar; int m_progress; + + // Timestamp when the last message has been set that has not the type + // 'Default'. The timestamp is used to prevent that default messages + // hide more important messages after a very short delay. + QTime m_messageTimeStamp; }; #endif |
