┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/statusbar/statusbarspaceinfo.cpp
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2012-04-12 23:57:51 +0200
committerPeter Penz <[email protected]>2012-04-13 00:11:36 +0200
commit31ee4085c2b2c374158fb956ac376399ff375b5a (patch)
tree1e48eb6c8b01a044abab1a186621c47e1f7e8215 /src/statusbar/statusbarspaceinfo.cpp
parent2c4e59a16f0a30fb0b6d8ef6cb44efff27166416 (diff)
Use KMessageWidget for error- and information-messages
See http://agateau.com/2011/04/21/kde-ux-2011/ for more details. This simplifies the statusbar in Dolphin a lot and allows to do a proper eliding in case if status-messages are too long: In this case a tooltip will show the whole status-message (thanks to Wolfgang Mader for the initial patch!). There is still missing some finetuning but the general approach seems to work quite nice. BUG: 249638 BUG: 245618 BUG: 146533 FIXED-IN: 4.9.0
Diffstat (limited to 'src/statusbar/statusbarspaceinfo.cpp')
-rw-r--r--src/statusbar/statusbarspaceinfo.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/statusbar/statusbarspaceinfo.cpp b/src/statusbar/statusbarspaceinfo.cpp
index 43e6b456d..61b28334a 100644
--- a/src/statusbar/statusbarspaceinfo.cpp
+++ b/src/statusbar/statusbarspaceinfo.cpp
@@ -35,7 +35,7 @@ StatusBarSpaceInfo::StatusBarSpaceInfo(QWidget* parent) :
// Use a timer to update the space information. Polling is useful
// here, as files can be deleted/added outside the scope of Dolphin.
m_timer = new QTimer(this);
- connect(m_timer, SIGNAL(timeout()), this, SLOT(refresh()));
+ connect(m_timer, SIGNAL(timeout()), this, SLOT(calculateSpaceInfo()));
}
StatusBarSpaceInfo::~StatusBarSpaceInfo()
@@ -44,8 +44,12 @@ StatusBarSpaceInfo::~StatusBarSpaceInfo()
void StatusBarSpaceInfo::setUrl(const KUrl& url)
{
- m_url = url;
- refresh();
+ if (m_url != url) {
+ m_url = url;
+ if (isVisible()) {
+ calculateSpaceInfo();
+ }
+ }
}
KUrl StatusBarSpaceInfo::url() const
@@ -57,7 +61,7 @@ void StatusBarSpaceInfo::showEvent(QShowEvent* event)
{
KCapacityBar::showEvent(event);
if (!event->spontaneous()) {
- refresh();
+ calculateSpaceInfo();
m_timer->start(10000);
}
}
@@ -68,12 +72,8 @@ void StatusBarSpaceInfo::hideEvent(QHideEvent* event)
KCapacityBar::hideEvent(event);
}
-void StatusBarSpaceInfo::refresh()
+void StatusBarSpaceInfo::calculateSpaceInfo()
{
- if (!isVisible()) {
- return;
- }
-
// KDiskFreeSpace is for local paths only
if (!m_url.isLocalFile()) {
setText(i18nc("@info:status", "Unknown size"));