summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (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
@@ -12,7 +12,7 @@
<x>0</x>
<y>0</y>
<width>196</width>
- <height>271</height>
+ <height>278</height>
</rect>
</property>
<property stdset="1">
@@ -28,25 +28,36 @@
<name>spacing</name>
<number>6</number>
</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>
<property stdset="1">
<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>
<property stdset="1">
<name>name</name>
@@ -74,26 +85,37 @@
</widget>
</grid>
</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>
<property stdset="1">
<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>
<property stdset="1">
<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>
</widget>
</grid>
@@ -111,8 +133,14 @@
<receiver>InstallDlg</receiver>
<slot>installSelected()</slot>
</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>
</connections>
</UI>
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
@@ -18,6 +18,7 @@
#ifdef QWS
#include <qpe/config.h>
#include <qpe/qpeapplication.h>
+#include <qpe/storage.h>
#endif
#include <qmultilineedit.h>
@@ -25,12 +26,14 @@
#include <qcombobox.h>
#include <qcheckbox.h>
#include <qpushbutton.h>
+#include <qlabel.h>
#include "datamgr.h"
#include "instoptionsimpl.h"
#include "destination.h"
#include "installdlgimpl.h"
+#include "utils.h"
#include "global.h"
InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl )
@@ -101,6 +104,8 @@ InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *d
}
output->setText( remove + install + upgrade );
+
+ displayAvailableSpace( destination->currentText() );
}
InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, QWidget *parent, const char *name, bool modal, WFlags fl )
@@ -177,7 +182,7 @@ void InstallDlgImpl :: installSelected()
pIpkg = new Ipkg;
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
vector<InstallData>::iterator it;
pIpkg->setOption( "remove" );
@@ -237,3 +242,33 @@ void InstallDlgImpl :: displayText(const QString &text )
output->setText( t );
output->setCursorPosition( output->numLines(), 0 );
}
+
+
+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
@@ -44,6 +44,7 @@ public:
bool showDlg();
bool upgradeServer( QString &server );
+
protected:
private:
@@ -60,6 +61,7 @@ private:
void optionsSelected();
void installSelected();
void displayText(const QString &text );
+ void displayAvailableSpace( const QString &text);
};
#endif