summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-07-28 19:13:02 (UTC)
committer llornkcor <llornkcor>2002-07-28 19:13:02 (UTC)
commit46e20578c1cf19a964d7f4591eaebb879c6f20f5 (patch) (side-by-side diff)
treeb1a24972314e9719fbe21a1f351cfb9c3947da6e
parentb251444c6eb50d8b80f7a79cef8930f401a2ff4d (diff)
downloadopie-46e20578c1cf19a964d7f4591eaebb879c6f20f5.zip
opie-46e20578c1cf19a964d7f4591eaebb879c6f20f5.tar.gz
opie-46e20578c1cf19a964d7f4591eaebb879c6f20f5.tar.bz2
added freespace for current disk in caption
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp32
-rw-r--r--noncore/apps/advancedfm/advancedfm.h2
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
@@ -70,6 +70,8 @@
#include <mntent.h>
#include <string.h>
#include <errno.h>
+#include <sys/vfs.h>
+#include <mntent.h>
AdvancedFm::AdvancedFm( )
: QMainWindow( )
@@ -304,7 +306,7 @@ void AdvancedFm::populateLocalView()
currentDir.setNameFilter(filterStr);
QString fileL, fileS, fileDate;
QString fs= getFileSystemType((const QString &) currentDir.canonicalPath());
- setCaption("AdvancedFm :: "+fs);
+ setCaption("AdvancedFm :: "+fs+" :: "+checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" );
bool isDir=FALSE;
const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
QFileInfoListIterator it(*list);
@@ -402,7 +404,7 @@ void AdvancedFm::populateRemoteView()
QString fileL, fileS, fileDate;
QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath());
- setCaption("AdvancedFm :: "+fs);
+ setCaption("AdvancedFm :: "+fs+" :: "+checkDiskSpace((const QString &) currentRemoteDir.canonicalPath())+" kB free" );
bool isDir=FALSE;
const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
QFileInfoListIterator it(*list);
@@ -1466,6 +1468,8 @@ void AdvancedFm::runCommand() {
outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
}
}
+ pclose(fp);
+
}
}
@@ -1521,6 +1525,7 @@ void AdvancedFm::fileStatus() {
}
}
+ pclose(fp);
}
void AdvancedFm::mkDir() {
@@ -1836,10 +1841,29 @@ void AdvancedFm::showFileMenu() {
}
-void AdvancedFm::cancelMenuTimer()
-{
+void AdvancedFm::cancelMenuTimer() {
qDebug("selectionChanged: cancel menu timer");
if( menuTimer.isActive() )
menuTimer.stop();
}
+
+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
@@ -113,7 +113,7 @@ protected:
QString getDiskSpace(const QString &);
void parsetab(const QString &fileName);
-
+QString checkDiskSpace(const QString &);
protected slots:
void showFileMenu();
void cancelMenuTimer();