-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 32 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.h | 2 |
2 files changed, 29 insertions, 5 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index 96a2d0a..16dc7da 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -72,2 +72,4 @@ | |||
72 | #include <errno.h> | 72 | #include <errno.h> |
73 | #include <sys/vfs.h> | ||
74 | #include <mntent.h> | ||
73 | 75 | ||
@@ -306,3 +308,3 @@ void AdvancedFm::populateLocalView() | |||
306 | QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); | 308 | QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); |
307 | setCaption("AdvancedFm :: "+fs); | 309 | setCaption("AdvancedFm :: "+fs+" :: "+checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" ); |
308 | bool isDir=FALSE; | 310 | bool isDir=FALSE; |
@@ -404,3 +406,3 @@ void AdvancedFm::populateRemoteView() | |||
404 | QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); | 406 | QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); |
405 | setCaption("AdvancedFm :: "+fs); | 407 | setCaption("AdvancedFm :: "+fs+" :: "+checkDiskSpace((const QString &) currentRemoteDir.canonicalPath())+" kB free" ); |
406 | bool isDir=FALSE; | 408 | bool isDir=FALSE; |
@@ -1468,2 +1470,4 @@ void AdvancedFm::runCommand() { | |||
1468 | } | 1470 | } |
1471 | pclose(fp); | ||
1472 | |||
1469 | } | 1473 | } |
@@ -1523,2 +1527,3 @@ void AdvancedFm::fileStatus() { | |||
1523 | } | 1527 | } |
1528 | pclose(fp); | ||
1524 | } | 1529 | } |
@@ -1838,4 +1843,3 @@ void AdvancedFm::showFileMenu() { | |||
1838 | 1843 | ||
1839 | void AdvancedFm::cancelMenuTimer() | 1844 | void AdvancedFm::cancelMenuTimer() { |
1840 | { | ||
1841 | 1845 | ||
@@ -1845 +1849,21 @@ void AdvancedFm::cancelMenuTimer() | |||
1845 | } | 1849 | } |
1850 | |||
1851 | QString AdvancedFm::checkDiskSpace(const QString &path) { | ||
1852 | |||
1853 | struct statfs fss; | ||
1854 | if ( !statfs( path.latin1(), &fss ) ) { | ||
1855 | int blkSize = fss.f_bsize; | ||
1856 | // int totalBlks = fs.f_blocks; | ||
1857 | int availBlks = fss.f_bavail; | ||
1858 | |||
1859 | long mult = blkSize / 1024; | ||
1860 | long div = 1024 / blkSize; | ||
1861 | if ( !mult ) mult = 1; | ||
1862 | if ( !div ) div = 1; | ||
1863 | |||
1864 | |||
1865 | return QString::number(availBlks * mult / div); | ||
1866 | } | ||
1867 | return ""; | ||
1868 | } | ||
1869 | |||
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h index 45f00ad..78f0bad 100644 --- a/noncore/apps/advancedfm/advancedfm.h +++ b/noncore/apps/advancedfm/advancedfm.h | |||
@@ -115,3 +115,3 @@ protected: | |||
115 | void parsetab(const QString &fileName); | 115 | void parsetab(const QString &fileName); |
116 | 116 | QString checkDiskSpace(const QString &); | |
117 | protected slots: | 117 | protected slots: |