author | llornkcor <llornkcor> | 2002-07-28 19:13:02 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-07-28 19:13:02 (UTC) |
commit | 46e20578c1cf19a964d7f4591eaebb879c6f20f5 (patch) (side-by-side diff) | |
tree | b1a24972314e9719fbe21a1f351cfb9c3947da6e | |
parent | b251444c6eb50d8b80f7a79cef8930f401a2ff4d (diff) | |
download | opie-46e20578c1cf19a964d7f4591eaebb879c6f20f5.zip opie-46e20578c1cf19a964d7f4591eaebb879c6f20f5.tar.gz opie-46e20578c1cf19a964d7f4591eaebb879c6f20f5.tar.bz2 |
added freespace for current disk in caption
-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 @@ #include <errno.h> +#include <sys/vfs.h> +#include <mntent.h> @@ -306,3 +308,3 @@ void AdvancedFm::populateLocalView() QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); - setCaption("AdvancedFm :: "+fs); + setCaption("AdvancedFm :: "+fs+" :: "+checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" ); bool isDir=FALSE; @@ -404,3 +406,3 @@ void AdvancedFm::populateRemoteView() QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); - setCaption("AdvancedFm :: "+fs); + setCaption("AdvancedFm :: "+fs+" :: "+checkDiskSpace((const QString &) currentRemoteDir.canonicalPath())+" kB free" ); bool isDir=FALSE; @@ -1468,2 +1470,4 @@ void AdvancedFm::runCommand() { } + pclose(fp); + } @@ -1523,2 +1527,3 @@ void AdvancedFm::fileStatus() { } + pclose(fp); } @@ -1838,4 +1843,3 @@ void AdvancedFm::showFileMenu() { -void AdvancedFm::cancelMenuTimer() -{ +void AdvancedFm::cancelMenuTimer() { @@ -1845 +1849,21 @@ void AdvancedFm::cancelMenuTimer() } + +QString AdvancedFm::checkDiskSpace(const QString &path) { + + struct statfs fss; + if ( !statfs( path.latin1(), &fss ) ) { + int blkSize = fss.f_bsize; +// int totalBlks = fs.f_blocks; + int availBlks = fss.f_bavail; + + long mult = blkSize / 1024; + long div = 1024 / blkSize; + if ( !mult ) mult = 1; + if ( !div ) div = 1; + + + return QString::number(availBlks * mult / div); + } + return ""; +} + 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: void parsetab(const QString &fileName); - +QString checkDiskSpace(const QString &); protected slots: |