summaryrefslogtreecommitdiff
path: root/noncore/settings/aqpkg/installdlgimpl.cpp
Side-by-side diff
Diffstat (limited to 'noncore/settings/aqpkg/installdlgimpl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/installdlgimpl.cpp37
1 files changed, 36 insertions, 1 deletions
diff --git a/noncore/settings/aqpkg/installdlgimpl.cpp b/noncore/settings/aqpkg/installdlgimpl.cpp
index 485fe3d..bfb4f62 100644
--- a/noncore/settings/aqpkg/installdlgimpl.cpp
+++ b/noncore/settings/aqpkg/installdlgimpl.cpp
@@ -20,2 +20,3 @@
#include <qpe/qpeapplication.h>
+#include <qpe/storage.h>
#endif
@@ -27,2 +28,3 @@
#include <qpushbutton.h>
+#include <qlabel.h>
@@ -33,2 +35,3 @@
#include "installdlgimpl.h"
+#include "utils.h"
#include "global.h"
@@ -103,2 +106,4 @@ InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *d
output->setText( remove + install + upgrade );
+
+ displayAvailableSpace( destination->currentText() );
}
@@ -179,3 +184,3 @@ void InstallDlgImpl :: installSelected()
connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
-
+
// First run through the remove list, then the install list then the upgrade list
@@ -239 +244,31 @@ void InstallDlgImpl :: displayText(const QString &text )
}
+
+
+void InstallDlgImpl :: displayAvailableSpace( const QString &text )
+{
+ vector<Destination>::iterator d = dataMgr->getDestination( text );
+ QString destDir = d->getDestinationPath();
+
+ long blockSize = 0;
+ long totalBlocks = 0;
+ long availBlocks = 0;
+ QString space;
+ if ( Utils::getStorageSpace( (const char *)destDir, &blockSize, &totalBlocks, &availBlocks ) )
+ {
+ long mult = blockSize / 1024;
+ long div = 1024 / blockSize;
+
+ if ( !mult ) mult = 1;
+ if ( !div ) div = 1;
+// long total = totalBlocks * mult / div;
+ long avail = availBlocks * mult / div;
+// long used = total - avail;
+
+ space.sprintf( "%ld Kb", avail );
+ }
+ else
+ space = "Unknown";
+
+ txtAvailableSpace->setText( space );
+}
+