summaryrefslogtreecommitdiff
path: root/noncore/settings/aqpkg
authorandyq <andyq>2002-12-04 23:14:12 (UTC)
committer andyq <andyq>2002-12-04 23:14:12 (UTC)
commit128343cd009009e42ce6bcdfd45a294c7ea44f83 (patch) (side-by-side diff)
treec27ae8892ce9038e5ae523aaecc4632fafb05929 /noncore/settings/aqpkg
parent4c3a3a2eb2ed79f9e833d356b28c8be9a514ed50 (diff)
downloadopie-128343cd009009e42ce6bcdfd45a294c7ea44f83.zip
opie-128343cd009009e42ce6bcdfd45a294c7ea44f83.tar.gz
opie-128343cd009009e42ce6bcdfd45a294c7ea44f83.tar.bz2
Added Available space for destination chosen
Diffstat (limited to 'noncore/settings/aqpkg') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/install.ui64
-rw-r--r--noncore/settings/aqpkg/installdlgimpl.cpp37
-rw-r--r--noncore/settings/aqpkg/installdlgimpl.h2
3 files changed, 84 insertions, 19 deletions
diff --git a/noncore/settings/aqpkg/install.ui b/noncore/settings/aqpkg/install.ui
index daa0ff6..c5a3596 100644
--- a/noncore/settings/aqpkg/install.ui
+++ b/noncore/settings/aqpkg/install.ui
@@ -14,3 +14,3 @@
<width>196</width>
- <height>271</height>
+ <height>278</height>
</rect>
@@ -30,7 +30,14 @@
</property>
- <widget row="0" column="0" >
- <class>QLabel</class>
+ <widget row="0" column="1" >
+ <class>QComboBox</class>
<property stdset="1">
<name>name</name>
- <cstring>TextLabel1</cstring>
+ <cstring>destination</cstring>
+ </property>
+ </widget>
+ <widget row="3" column="0" >
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>btnInstall</cstring>
</property>
@@ -38,13 +45,17 @@
<name>text</name>
- <string>Destination</string>
+ <string>Start</string>
</property>
</widget>
- <widget row="0" column="1" >
- <class>QComboBox</class>
+ <widget row="3" column="1" >
+ <class>QPushButton</class>
<property stdset="1">
<name>name</name>
- <cstring>destination</cstring>
+ <cstring>btnOptions</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Options</string>
</property>
</widget>
- <widget row="1" column="0" rowspan="1" colspan="2" >
+ <widget row="2" column="0" rowspan="1" colspan="2" >
<class>QGroupBox</class>
@@ -76,7 +87,7 @@
</widget>
- <widget row="2" column="0" >
- <class>QPushButton</class>
+ <widget row="0" column="0" >
+ <class>QLabel</class>
<property stdset="1">
<name>name</name>
- <cstring>btnInstall</cstring>
+ <cstring>TextLabel1</cstring>
</property>
@@ -84,10 +95,10 @@
<name>text</name>
- <string>Start</string>
+ <string>Destination</string>
</property>
</widget>
- <widget row="2" column="1" >
- <class>QPushButton</class>
+ <widget row="1" column="0" >
+ <class>QLabel</class>
<property stdset="1">
<name>name</name>
- <cstring>btnOptions</cstring>
+ <cstring>TextLabel3</cstring>
</property>
@@ -95,3 +106,14 @@
<name>text</name>
- <string>Options</string>
+ <string>Space Avail</string>
+ </property>
+ </widget>
+ <widget row="1" column="1" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>txtAvailableSpace</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>100000000</string>
</property>
@@ -113,4 +135,10 @@
</connection>
+ <connection>
+ <sender>destination</sender>
+ <signal>highlighted(const QString&amp;)</signal>
+ <receiver>InstallDlg</receiver>
+ <slot>displayAvailableSpace( const QString&amp; )</slot>
+ </connection>
+ <slot access="public">displayAvailableSpace( const QString&amp; )</slot>
<slot access="public">installSelected()</slot>
- <slot access="public">displayText(const QString &amp;)</slot>
<slot access="public">optionsSelected()</slot>
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 );
+}
+
diff --git a/noncore/settings/aqpkg/installdlgimpl.h b/noncore/settings/aqpkg/installdlgimpl.h
index 9819b2e..2f80f08 100644
--- a/noncore/settings/aqpkg/installdlgimpl.h
+++ b/noncore/settings/aqpkg/installdlgimpl.h
@@ -46,2 +46,3 @@ public:
+
protected:
@@ -62,2 +63,3 @@ private:
void displayText(const QString &text );
+ void displayAvailableSpace( const QString &text);
};