From 41c013e06c430febb6a5353286573c968ca01440 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Mon, 15 Apr 2013 03:03:58 -0500 Subject: Fix a number of issues with the media tdeioslave This relates to Bug 1450 Add media disk space overlay and enable by default --- libkonq/kivfreespaceoverlay.cc | 50 ++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 24 deletions(-) (limited to 'libkonq/kivfreespaceoverlay.cc') 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(vfs.f_blocks) * static_cast(vfs.f_frsize); - m_free = static_cast(vfs.f_bavail) * static_cast(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(vfs.f_blocks) * static_cast(vfs.f_frsize); + m_free = static_cast(vfs.f_bavail) * static_cast(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 { -- cgit v1.2.1