-rw-r--r-- | noncore/settings/aqpkg/install.ui | 64 | ||||
-rw-r--r-- | noncore/settings/aqpkg/installdlgimpl.cpp | 37 | ||||
-rw-r--r-- | noncore/settings/aqpkg/installdlgimpl.h | 2 |
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 @@ | |||
14 | <width>196</width> | 14 | <width>196</width> |
15 | <height>271</height> | 15 | <height>278</height> |
16 | </rect> | 16 | </rect> |
@@ -30,7 +30,14 @@ | |||
30 | </property> | 30 | </property> |
31 | <widget row="0" column="0" > | 31 | <widget row="0" column="1" > |
32 | <class>QLabel</class> | 32 | <class>QComboBox</class> |
33 | <property stdset="1"> | 33 | <property stdset="1"> |
34 | <name>name</name> | 34 | <name>name</name> |
35 | <cstring>TextLabel1</cstring> | 35 | <cstring>destination</cstring> |
36 | </property> | ||
37 | </widget> | ||
38 | <widget row="3" column="0" > | ||
39 | <class>QPushButton</class> | ||
40 | <property stdset="1"> | ||
41 | <name>name</name> | ||
42 | <cstring>btnInstall</cstring> | ||
36 | </property> | 43 | </property> |
@@ -38,13 +45,17 @@ | |||
38 | <name>text</name> | 45 | <name>text</name> |
39 | <string>Destination</string> | 46 | <string>Start</string> |
40 | </property> | 47 | </property> |
41 | </widget> | 48 | </widget> |
42 | <widget row="0" column="1" > | 49 | <widget row="3" column="1" > |
43 | <class>QComboBox</class> | 50 | <class>QPushButton</class> |
44 | <property stdset="1"> | 51 | <property stdset="1"> |
45 | <name>name</name> | 52 | <name>name</name> |
46 | <cstring>destination</cstring> | 53 | <cstring>btnOptions</cstring> |
54 | </property> | ||
55 | <property stdset="1"> | ||
56 | <name>text</name> | ||
57 | <string>Options</string> | ||
47 | </property> | 58 | </property> |
48 | </widget> | 59 | </widget> |
49 | <widget row="1" column="0" rowspan="1" colspan="2" > | 60 | <widget row="2" column="0" rowspan="1" colspan="2" > |
50 | <class>QGroupBox</class> | 61 | <class>QGroupBox</class> |
@@ -76,7 +87,7 @@ | |||
76 | </widget> | 87 | </widget> |
77 | <widget row="2" column="0" > | 88 | <widget row="0" column="0" > |
78 | <class>QPushButton</class> | 89 | <class>QLabel</class> |
79 | <property stdset="1"> | 90 | <property stdset="1"> |
80 | <name>name</name> | 91 | <name>name</name> |
81 | <cstring>btnInstall</cstring> | 92 | <cstring>TextLabel1</cstring> |
82 | </property> | 93 | </property> |
@@ -84,10 +95,10 @@ | |||
84 | <name>text</name> | 95 | <name>text</name> |
85 | <string>Start</string> | 96 | <string>Destination</string> |
86 | </property> | 97 | </property> |
87 | </widget> | 98 | </widget> |
88 | <widget row="2" column="1" > | 99 | <widget row="1" column="0" > |
89 | <class>QPushButton</class> | 100 | <class>QLabel</class> |
90 | <property stdset="1"> | 101 | <property stdset="1"> |
91 | <name>name</name> | 102 | <name>name</name> |
92 | <cstring>btnOptions</cstring> | 103 | <cstring>TextLabel3</cstring> |
93 | </property> | 104 | </property> |
@@ -95,3 +106,14 @@ | |||
95 | <name>text</name> | 106 | <name>text</name> |
96 | <string>Options</string> | 107 | <string>Space Avail</string> |
108 | </property> | ||
109 | </widget> | ||
110 | <widget row="1" column="1" > | ||
111 | <class>QLabel</class> | ||
112 | <property stdset="1"> | ||
113 | <name>name</name> | ||
114 | <cstring>txtAvailableSpace</cstring> | ||
115 | </property> | ||
116 | <property stdset="1"> | ||
117 | <name>text</name> | ||
118 | <string>100000000</string> | ||
97 | </property> | 119 | </property> |
@@ -113,4 +135,10 @@ | |||
113 | </connection> | 135 | </connection> |
136 | <connection> | ||
137 | <sender>destination</sender> | ||
138 | <signal>highlighted(const QString&)</signal> | ||
139 | <receiver>InstallDlg</receiver> | ||
140 | <slot>displayAvailableSpace( const QString& )</slot> | ||
141 | </connection> | ||
142 | <slot access="public">displayAvailableSpace( const QString& )</slot> | ||
114 | <slot access="public">installSelected()</slot> | 143 | <slot access="public">installSelected()</slot> |
115 | <slot access="public">displayText(const QString &)</slot> | ||
116 | <slot access="public">optionsSelected()</slot> | 144 | <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 @@ | |||
20 | #include <qpe/qpeapplication.h> | 20 | #include <qpe/qpeapplication.h> |
21 | #include <qpe/storage.h> | ||
21 | #endif | 22 | #endif |
@@ -27,2 +28,3 @@ | |||
27 | #include <qpushbutton.h> | 28 | #include <qpushbutton.h> |
29 | #include <qlabel.h> | ||
28 | 30 | ||
@@ -33,2 +35,3 @@ | |||
33 | #include "installdlgimpl.h" | 35 | #include "installdlgimpl.h" |
36 | #include "utils.h" | ||
34 | #include "global.h" | 37 | #include "global.h" |
@@ -103,2 +106,4 @@ InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *d | |||
103 | output->setText( remove + install + upgrade ); | 106 | output->setText( remove + install + upgrade ); |
107 | |||
108 | displayAvailableSpace( destination->currentText() ); | ||
104 | } | 109 | } |
@@ -179,3 +184,3 @@ void InstallDlgImpl :: installSelected() | |||
179 | connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); | 184 | connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); |
180 | 185 | ||
181 | // First run through the remove list, then the install list then the upgrade list | 186 | // First run through the remove list, then the install list then the upgrade list |
@@ -239 +244,31 @@ void InstallDlgImpl :: displayText(const QString &text ) | |||
239 | } | 244 | } |
245 | |||
246 | |||
247 | void InstallDlgImpl :: displayAvailableSpace( const QString &text ) | ||
248 | { | ||
249 | vector<Destination>::iterator d = dataMgr->getDestination( text ); | ||
250 | QString destDir = d->getDestinationPath(); | ||
251 | |||
252 | long blockSize = 0; | ||
253 | long totalBlocks = 0; | ||
254 | long availBlocks = 0; | ||
255 | QString space; | ||
256 | if ( Utils::getStorageSpace( (const char *)destDir, &blockSize, &totalBlocks, &availBlocks ) ) | ||
257 | { | ||
258 | long mult = blockSize / 1024; | ||
259 | long div = 1024 / blockSize; | ||
260 | |||
261 | if ( !mult ) mult = 1; | ||
262 | if ( !div ) div = 1; | ||
263 | // long total = totalBlocks * mult / div; | ||
264 | long avail = availBlocks * mult / div; | ||
265 | // long used = total - avail; | ||
266 | |||
267 | space.sprintf( "%ld Kb", avail ); | ||
268 | } | ||
269 | else | ||
270 | space = "Unknown"; | ||
271 | |||
272 | txtAvailableSpace->setText( space ); | ||
273 | } | ||
274 | |||
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: | |||
46 | 46 | ||
47 | |||
47 | protected: | 48 | protected: |
@@ -62,2 +63,3 @@ private: | |||
62 | void displayText(const QString &text ); | 63 | void displayText(const QString &text ); |
64 | void displayAvailableSpace( const QString &text); | ||
63 | }; | 65 | }; |