summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-07-28 19:13:02 (UTC)
committer llornkcor <llornkcor>2002-07-28 19:13:02 (UTC)
commit46e20578c1cf19a964d7f4591eaebb879c6f20f5 (patch) (unidiff)
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) (ignore 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 @@
70#include <mntent.h> 70#include <mntent.h>
71#include <string.h> 71#include <string.h>
72#include <errno.h> 72#include <errno.h>
73#include <sys/vfs.h>
74#include <mntent.h>
73 75
74AdvancedFm::AdvancedFm( ) 76AdvancedFm::AdvancedFm( )
75 : QMainWindow( ) 77 : QMainWindow( )
@@ -304,7 +306,7 @@ void AdvancedFm::populateLocalView()
304 currentDir.setNameFilter(filterStr); 306 currentDir.setNameFilter(filterStr);
305 QString fileL, fileS, fileDate; 307 QString fileL, fileS, fileDate;
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;
309 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 311 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
310 QFileInfoListIterator it(*list); 312 QFileInfoListIterator it(*list);
@@ -402,7 +404,7 @@ void AdvancedFm::populateRemoteView()
402 QString fileL, fileS, fileDate; 404 QString fileL, fileS, fileDate;
403 405
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;
407 const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 409 const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
408 QFileInfoListIterator it(*list); 410 QFileInfoListIterator it(*list);
@@ -1466,6 +1468,8 @@ void AdvancedFm::runCommand() {
1466 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 1468 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
1467 } 1469 }
1468 } 1470 }
1471 pclose(fp);
1472
1469 } 1473 }
1470} 1474}
1471 1475
@@ -1521,6 +1525,7 @@ void AdvancedFm::fileStatus() {
1521 } 1525 }
1522 1526
1523 } 1527 }
1528 pclose(fp);
1524} 1529}
1525 1530
1526void AdvancedFm::mkDir() { 1531void AdvancedFm::mkDir() {
@@ -1836,10 +1841,29 @@ void AdvancedFm::showFileMenu() {
1836} 1841}
1837 1842
1838 1843
1839void AdvancedFm::cancelMenuTimer() 1844void AdvancedFm::cancelMenuTimer() {
1840{
1841 1845
1842 qDebug("selectionChanged: cancel menu timer"); 1846 qDebug("selectionChanged: cancel menu timer");
1843 if( menuTimer.isActive() ) 1847 if( menuTimer.isActive() )
1844 menuTimer.stop(); 1848 menuTimer.stop();
1845} 1849}
1850
1851QString 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
@@ -113,7 +113,7 @@ protected:
113 QString getDiskSpace(const QString &); 113 QString getDiskSpace(const QString &);
114 114
115 void parsetab(const QString &fileName); 115 void parsetab(const QString &fileName);
116 116QString checkDiskSpace(const QString &);
117protected slots: 117protected slots:
118 void showFileMenu(); 118 void showFileMenu();
119 void cancelMenuTimer(); 119 void cancelMenuTimer();