86 lines
2.4 KiB
Diff
86 lines
2.4 KiB
Diff
Index: src/rip/videodvd/k3bvideodvdrippingwidget.cpp
|
|
===================================================================
|
|
--- src/rip/videodvd/k3bvideodvdrippingwidget.cpp (revision 958507)
|
|
+++ src/rip/videodvd/k3bvideodvdrippingwidget.cpp (working copy)
|
|
@@ -26,7 +26,10 @@
|
|
#include <kurllabel.h>
|
|
#include <kdialog.h>
|
|
#include <klineedit.h>
|
|
+#include <kdeversion.h>
|
|
+#if KDE_IS_VERSION(4,2,0)
|
|
#include <KDiskFreeSpaceInfo>
|
|
+#endif
|
|
|
|
#include <qcombobox.h>
|
|
#include <qspinbox.h>
|
|
@@ -255,10 +258,17 @@
|
|
path.truncate( path.lastIndexOf('/') );
|
|
|
|
QPalette pal( m_labelFreeSpace->palette() );
|
|
+#if KDE_IS_VERSION(4,2,0)
|
|
KDiskFreeSpaceInfo free = KDiskFreeSpaceInfo::freeSpaceInfo( path );
|
|
if( free.isValid() ) {
|
|
m_labelFreeSpace->setText( KIO::convertSizeFromKiB(free.available()) );
|
|
if( free.available() < m_neededSize/1024 )
|
|
+#else
|
|
+ unsigned long size, avail;
|
|
+ if( K3b::kbFreeOnFs( path, size, avail ) ) {
|
|
+ m_labelFreeSpace->setText( KIO::convertSizeFromKiB(avail) );
|
|
+ if( avail < m_neededSize/1024 )
|
|
+#endif
|
|
pal.setColor( QPalette::Text, Qt::red );
|
|
else
|
|
pal.setColor( QPalette::Text, palette().color( QPalette::Text ) );
|
|
Index: libk3b/core/k3bglobals.cpp
|
|
===================================================================
|
|
--- libk3b/core/k3bglobals.cpp (revision 958522)
|
|
+++ libk3b/core/k3bglobals.cpp (working copy)
|
|
@@ -33,7 +33,17 @@
|
|
#include <kio/netaccess.h>
|
|
#include <kurl.h>
|
|
#include <kprocess.h>
|
|
+#if KDE_IS_VERSION(4,2,0)
|
|
#include <KDiskFreeSpaceInfo>
|
|
+#else
|
|
+#include <sys/stat.h>
|
|
+#ifdef HAVE_SYS_STATVFS_H
|
|
+# include <sys/statvfs.h>
|
|
+#endif
|
|
+#ifdef HAVE_SYS_VFS_H
|
|
+# include <sys/vfs.h>
|
|
+#endif
|
|
+#endif
|
|
|
|
#include <kmountpoint.h>
|
|
#include <Solid/Device>
|
|
@@ -209,6 +219,7 @@
|
|
|
|
bool K3b::kbFreeOnFs( const QString& path, unsigned long& size, unsigned long& avail )
|
|
{
|
|
+#if KDE_IS_VERSION(4,2,0)
|
|
KDiskFreeSpaceInfo fs = KDiskFreeSpaceInfo::freeSpaceInfo( path );
|
|
if ( fs.isValid() ) {
|
|
size = fs.size()/1024;
|
|
@@ -218,6 +229,21 @@
|
|
else {
|
|
return false;
|
|
}
|
|
+#else
|
|
+#ifdef HAVE_SYS_STATVFS_H
|
|
+ struct statvfs fs;
|
|
+ if( ::statvfs( QFile::encodeName(path), &fs ) == 0 ) {
|
|
+ unsigned long kBfak = fs.f_frsize/1024;
|
|
+
|
|
+ size = fs.f_blocks*kBfak;
|
|
+ avail = fs.f_bavail*kBfak;
|
|
+
|
|
+ return true;
|
|
+ }
|
|
+ else
|
|
+#endif
|
|
+ return false;
|
|
+#endif
|
|
}
|
|
|
|
|