summaryrefslogtreecommitdiff
path: root/noncore
authorllornkcor <llornkcor>2002-08-06 13:59:45 (UTC)
committer llornkcor <llornkcor>2002-08-06 13:59:45 (UTC)
commit64888e9cd2f4c8f40f08a6712e2fd27220ff14ad (patch) (side-by-side diff)
tree862bcda0849bf79b3eeb6fbab1ef18d08b005dc9 /noncore
parentb980135ff5ce5447ca41411b6ace74ce2803fadb (diff)
downloadopie-64888e9cd2f4c8f40f08a6712e2fd27220ff14ad.zip
opie-64888e9cd2f4c8f40f08a6712e2fd27220ff14ad.tar.gz
opie-64888e9cd2f4c8f40f08a6712e2fd27220ff14ad.tar.bz2
re-add missing diskspace function
Diffstat (limited to 'noncore') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp20
-rw-r--r--noncore/apps/advancedfm/advancedfm.pro2
2 files changed, 17 insertions, 5 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index b169a79..7ee78c0 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -1,45 +1,45 @@
/***************************************************************************
AdvancedFm.cpp
-------------------
** Created: Sat Mar 9 23:33:09 2002
copyright : (C) 2002 by ljp
email : ljp@llornkcor.com
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
#define DEVELOPERS_VERSION
#define QTOPIA_INTERNAL_FSLP // to get access to fileproperties
#include "advancedfm.h"
#include "inputDialog.h"
#include "filePermissions.h"
#include "output.h"
-#include <opie/ofileselector.h>
-#include <opie/ofiledialog.h>
+// #include <opie/ofileselector.h>
+// #include <opie/ofiledialog.h>
#include <qpe/lnkproperties.h>
#include <qpe/filemanager.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/qpemenubar.h>
#include <qpe/qpetoolbar.h>
#include <qpe/qpeapplication.h>
#include <qpe/resource.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/config.h>
#include <qpe/mimetype.h>
#include <qpe/applnk.h>
#include <qpe/ir.h>
//#include <opie/ofileselector.h>
#include <qmultilineedit.h>
#include <qtextstream.h>
#include <qpushbutton.h>
#include <qtoolbutton.h>
#include <qdatetime.h>
#include <qdir.h>
#include <qfile.h>
@@ -1711,50 +1711,63 @@ void AdvancedFm::parsetab(const QString &fileName) {
fsList << filesystemType;
fileSystemTypeList << mountDir+"::"+filesystemType;
}
}
}
endmntent( mntfp );
}
QString AdvancedFm::getFileSystemType(const QString &currentText) {
parsetab("/etc/mtab"); //why did TT forget filesystem type?
QString current = currentText;//.right( currentText.length()-1);
QString baseFs;
for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) {
QString temp = (*it);
QString path = temp.left(temp.find("::",0,TRUE) );
path = path.right( path.length()-1);
if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2);
if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) {
return temp.right( temp.length() - temp.find("::",0,TRUE) - 2);
}
}
return baseFs;
}
-QString AdvancedFm::getDiskSpace( const QString &) {
+QString AdvancedFm::getDiskSpace( 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 "";
}
void AdvancedFm::doBeam() {
Ir ir;
if(!ir.supported()){
} else {
QStringList curFileList = getPath();
if( curFileList.count() > 0) {
if (TabWidget->currentPageIndex() == 0) {
for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
QString curFile = currentDir.canonicalPath()+"/"+(*it);
if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1);
Ir *file = new Ir(this, "IR");
connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * )));
file->send( curFile, curFile );
}
} else {
for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it);
@@ -1847,42 +1860,41 @@ void AdvancedFm::showFileMenu() {
if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) //bad hack for Sharp zaurus failings
m->insertItem( tr( "Properties" ), this, SLOT( doProperties() ));
m->setCheckable(TRUE);
if (!b)
m->setItemChecked(m->idAt(0),TRUE);
else
m->setItemChecked(m->idAt(0),FALSE);
if(Ir::supported())
m->insertItem( tr( "Beam File" ), this, SLOT( doBeam() ));
m->setFocus();
m->exec( QCursor::pos() );
sleep(1);
if(m) delete m;
}
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.pro b/noncore/apps/advancedfm/advancedfm.pro
index e99ab12..0f0f770 100644
--- a/noncore/apps/advancedfm/advancedfm.pro
+++ b/noncore/apps/advancedfm/advancedfm.pro
@@ -1,25 +1,25 @@
TEMPLATE = app
CONFIG += qt warn_on release
HEADERS = advancedfm.h inputDialog.h filePermissions.h output.h
SOURCES = advancedfm.cpp inputDialog.cpp filePermissions.cpp output.cpp main.cpp
TARGET = advancedfm
REQUIRES=medium-config
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
DESTDIR = $(OPIEDIR)/bin
-LIBS += -lqpe -lopie
+LIBS += -lqpe
TRANSLATIONS = ../../../i18n/de/advancedfm.ts \
../../../i18n/en/advancedfm.ts \
../../../i18n/es/advancedfm.ts \
../../../i18n/fr/advancedfm.ts \
../../../i18n/hu/advancedfm.ts \
../../../i18n/ja/advancedfm.ts \
../../../i18n/ko/advancedfm.ts \
../../../i18n/no/advancedfm.ts \
../../../i18n/pl/advancedfm.ts \
../../../i18n/pt/advancedfm.ts \
../../../i18n/pt_BR/advancedfm.ts \
../../../i18n/sl/advancedfm.ts \
../../../i18n/zh_CN/advancedfm.ts \
../../../i18n/zh_TW/advancedfm.ts