summaryrefslogtreecommitdiffstats
path: root/libkonq/kivfreespaceoverlay.cc
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2013-04-15 03:03:58 -0500
committerTimothy Pearson <[email protected]>2013-04-15 03:03:58 -0500
commit41c013e06c430febb6a5353286573c968ca01440 (patch)
tree0fee1f29c1dc2ac11009aeef169cf9376303d22a /libkonq/kivfreespaceoverlay.cc
parent9e4aad6b3bc3c1b4781a3c1cef6968640d4f6e67 (diff)
downloadtdebase-41c013e06c430febb6a5353286573c968ca01440.tar.gz
tdebase-41c013e06c430febb6a5353286573c968ca01440.zip
Fix a number of issues with the media tdeioslave
This relates to Bug 1450 Add media disk space overlay and enable by default
Diffstat (limited to 'libkonq/kivfreespaceoverlay.cc')
-rw-r--r--libkonq/kivfreespaceoverlay.cc50
1 files changed, 26 insertions, 24 deletions
diff --git a/libkonq/kivfreespaceoverlay.cc b/libkonq/kivfreespaceoverlay.cc
index 614c8529a..3d2ecad63 100644
--- a/libkonq/kivfreespaceoverlay.cc
+++ b/libkonq/kivfreespaceoverlay.cc
@@ -85,35 +85,37 @@ void KIVFreeSpaceOverlay::slotCompleted()
{
KFileItem* item = m_freespace->item();
if (item) {
- bool isLocal = false;
- KURL localURL = item->mostLocalURL(isLocal);
- if (!isLocal) {
- m_freespace->setOverlayProgressBar(-1);
- }
- else {
- TQString localPath = localURL.path();
- if (localPath != "") {
- TDEIO::filesize_t m_total = 0;
- TDEIO::filesize_t m_used = 0;
- TDEIO::filesize_t m_free = 0;
-
- struct statvfs vfs;
- memset(&vfs, 0, sizeof(vfs));
-
- if ( ::statvfs(TQFile::encodeName(localPath), &vfs) != -1 )
- {
- m_total = static_cast<TDEIO::filesize_t>(vfs.f_blocks) * static_cast<TDEIO::filesize_t>(vfs.f_frsize);
- m_free = static_cast<TDEIO::filesize_t>(vfs.f_bavail) * static_cast<TDEIO::filesize_t>(vfs.f_frsize);
- m_used = m_total - m_free;
- m_freespace->setOverlayProgressBar((m_used/(m_total*1.0))*100.0);
+ if (item->mimetype().contains("_mounted")) {
+ bool isLocal = false;
+ KURL localURL = item->mostLocalURL(isLocal);
+ if (!isLocal) {
+ m_freespace->setOverlayProgressBar(-1);
+ }
+ else {
+ TQString localPath = localURL.path();
+ if (localPath != "") {
+ TDEIO::filesize_t m_total = 0;
+ TDEIO::filesize_t m_used = 0;
+ TDEIO::filesize_t m_free = 0;
+
+ struct statvfs vfs;
+ memset(&vfs, 0, sizeof(vfs));
+
+ if ( ::statvfs(TQFile::encodeName(localPath), &vfs) != -1 )
+ {
+ m_total = static_cast<TDEIO::filesize_t>(vfs.f_blocks) * static_cast<TDEIO::filesize_t>(vfs.f_frsize);
+ m_free = static_cast<TDEIO::filesize_t>(vfs.f_bavail) * static_cast<TDEIO::filesize_t>(vfs.f_frsize);
+ m_used = m_total - m_free;
+ m_freespace->setOverlayProgressBar((m_used/(m_total*1.0))*100.0);
+ }
+ else {
+ m_freespace->setOverlayProgressBar(-1);
+ }
}
else {
m_freespace->setOverlayProgressBar(-1);
}
}
- else {
- m_freespace->setOverlayProgressBar(-1);
- }
}
}
else {