summaryrefslogtreecommitdiffstats
path: root/libkonq
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-04-15 03:03:58 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-04-15 03:03:58 -0500
commit41c013e06c430febb6a5353286573c968ca01440 (patch)
tree0fee1f29c1dc2ac11009aeef169cf9376303d22a /libkonq
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')
-rw-r--r--libkonq/kivfreespaceoverlay.cc50
-rw-r--r--libkonq/konq_dirpart.cc21
-rw-r--r--libkonq/konq_propsview.cc2
-rw-r--r--libkonq/tdefileivi.cc28
4 files changed, 62 insertions, 39 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 {
diff --git a/libkonq/konq_dirpart.cc b/libkonq/konq_dirpart.cc
index 0e88a9925..9f08dfb3c 100644
--- a/libkonq/konq_dirpart.cc
+++ b/libkonq/konq_dirpart.cc
@@ -440,8 +440,9 @@ void KonqDirPart::updatePasteAction() // KDE4: merge into method above
void KonqDirPart::newItems( const KFileItemList & entries )
{
d->dirSizeDirty = true;
- if ( m_findPart )
+ if ( m_findPart ) {
emitTotalCount();
+ }
emit itemsAdded( entries );
}
@@ -454,8 +455,9 @@ void KonqDirPart::deleteItem( KFileItem * fileItem )
void KonqDirPart::emitTotalCount()
{
- if ( !d->dirLister || d->dirLister->url().isEmpty() )
+ if ( !d->dirLister || d->dirLister->url().isEmpty() ) {
return;
+ }
if ( d->dirSizeDirty ) {
m_lDirSize = 0;
m_lFileCount = 0;
@@ -465,12 +467,14 @@ void KonqDirPart::emitTotalCount()
{
if ( !it.current()->isDir() )
{
- if (!it.current()->isLink()) // symlinks don't contribute to the size
+ if (!it.current()->isLink()) { // symlinks don't contribute to the size
m_lDirSize += it.current()->size();
+ }
m_lFileCount++;
}
- else
+ else {
m_lDirCount++;
+ }
}
d->dirSizeDirty = false;
}
@@ -521,10 +525,12 @@ void KonqDirPart::emitCounts( const KFileItemList & lst )
void KonqDirPart::emitCounts( const KFileItemList & lst, bool selectionChanged )
{
- if ( lst.count() == 0 )
+ if ( lst.count() == 0 ) {
emitTotalCount();
- else
+ }
+ else {
emitCounts( lst );
+ }
// Yes, the caller could do that too :)
// But this bool could also be used to cache the TQString for the last
@@ -533,8 +539,9 @@ void KonqDirPart::emitCounts( const KFileItemList & lst, bool selectionChanged )
// MiB: no, I don't think it's worth it. Especially regarding the
// loss of readability of the code. Thus, this will be removed in
// KDE 4.0.
- if ( selectionChanged )
+ if ( selectionChanged ) {
emit m_extension->selectionInfo( lst );
+ }
}
void KonqDirPart::emitMouseOver( const KFileItem* item )
diff --git a/libkonq/konq_propsview.cc b/libkonq/konq_propsview.cc
index edaff588b..f9a69b8f6 100644
--- a/libkonq/konq_propsview.cc
+++ b/libkonq/konq_propsview.cc
@@ -94,7 +94,7 @@ KonqPropsView::KonqPropsView( TDEInstance * instance, KonqPropsView * defaultPro
d->descending = config->readBoolEntry( "SortDescending", false );
m_bShowDot = config->readBoolEntry( "ShowDotFiles", false );
m_bShowDirectoryOverlays = config->readBoolEntry( "ShowDirectoryOverlays", false );
- m_bShowFreeSpaceOverlays = config->readBoolEntry( "ShowFreeSpaceOverlays", false );
+ m_bShowFreeSpaceOverlays = config->readBoolEntry( "ShowFreeSpaceOverlays", true );
m_dontPreview = config->readListEntry( "DontPreview" );
m_dontPreview.remove("audio/"); //Use the separate setting.
diff --git a/libkonq/tdefileivi.cc b/libkonq/tdefileivi.cc
index bff31c890..eb7703a83 100644
--- a/libkonq/tdefileivi.cc
+++ b/libkonq/tdefileivi.cc
@@ -440,19 +440,33 @@ void KFileIVI::paintOverlayProgressBar( TQPainter *p ) const
// p->setBrush(TQt::green);
// p->drawPie(rect, 1440, (((100-d->m_progress)*5760)/100));
- // Progress bar
+// // Horizontal progress bar
+// TQRect rect = pixmapRect(true);
+// int verticalOffset = 0;
+// int usedBarWidth = ((d->m_progress*pixmapRect().width())/100);
+// int endPosition = x() + rect.x() + usedBarWidth;
+//
+// p->save();
+//
+// p->setPen(TQPen::NoPen);
+// p->setBrush(TQt::red);
+// p->drawRect(TQRect(x() + rect.x(), y() + rect.y() + (pixmapRect().height() - verticalOffset), usedBarWidth, 1));
+// p->setBrush(TQt::green);
+// p->drawRect(TQRect(endPosition, y() + rect.y() + (pixmapRect().height() - verticalOffset), pixmapRect().width() - usedBarWidth, 1));
+
+ // Vertical progress bar
TQRect rect = pixmapRect(true);
- int verticalOffset = 0;
- int usedBarWidth = ((d->m_progress*pixmapRect().width())/100);
- int endPosition = x() + rect.x() + usedBarWidth;
+ int horizontalOffset = 0;
+ int usedBarHeight = (((100-d->m_progress)*pixmapRect().height())/100);
+ int endPosition = y() + rect.y() + usedBarHeight;
p->save();
p->setPen(TQPen::NoPen);
- p->setBrush(TQt::red);
- p->drawRect(TQRect(x() + rect.x(), y() + rect.y() + (pixmapRect().height() - verticalOffset), usedBarWidth, 1));
p->setBrush(TQt::green);
- p->drawRect(TQRect(endPosition, y() + rect.y() + (pixmapRect().height() - verticalOffset), pixmapRect().width() - usedBarWidth, 1));
+ p->drawRect(TQRect(x() + rect.x() + (pixmapRect().width() - horizontalOffset), y() + rect.y(), 1, usedBarHeight));
+ p->setBrush(TQt::red);
+ p->drawRect(TQRect(x() + rect.x() + (pixmapRect().width() - horizontalOffset), endPosition, 1, pixmapRect().height() - usedBarHeight));
p->restore();
}