summaryrefslogtreecommitdiff
path: root/noncore/settings/aqpkg
Unidiff
Diffstat (limited to 'noncore/settings/aqpkg') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/aqpkg/install.ui64
-rw-r--r--noncore/settings/aqpkg/installdlgimpl.cpp35
-rw-r--r--noncore/settings/aqpkg/installdlgimpl.h2
3 files changed, 83 insertions, 18 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
@@ -9,13 +9,13 @@
9 <property stdset="1"> 9 <property stdset="1">
10 <name>geometry</name> 10 <name>geometry</name>
11 <rect> 11 <rect>
12 <x>0</x> 12 <x>0</x>
13 <y>0</y> 13 <y>0</y>
14 <width>196</width> 14 <width>196</width>
15 <height>271</height> 15 <height>278</height>
16 </rect> 16 </rect>
17 </property> 17 </property>
18 <property stdset="1"> 18 <property stdset="1">
19 <name>caption</name> 19 <name>caption</name>
20 <string>Install</string> 20 <string>Install</string>
21 </property> 21 </property>
@@ -25,31 +25,42 @@
25 <number>11</number> 25 <number>11</number>
26 </property> 26 </property>
27 <property stdset="1"> 27 <property stdset="1">
28 <name>spacing</name> 28 <name>spacing</name>
29 <number>6</number> 29 <number>6</number>
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>
37 <property stdset="1"> 44 <property stdset="1">
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>
51 <property stdset="1"> 62 <property stdset="1">
52 <name>name</name> 63 <name>name</name>
53 <cstring>GroupBox2</cstring> 64 <cstring>GroupBox2</cstring>
54 </property> 65 </property>
55 <property stdset="1"> 66 <property stdset="1">
@@ -71,32 +82,43 @@
71 <name>name</name> 82 <name>name</name>
72 <cstring>output</cstring> 83 <cstring>output</cstring>
73 </property> 84 </property>
74 </widget> 85 </widget>
75 </grid> 86 </grid>
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>
83 <property stdset="1"> 94 <property stdset="1">
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>
94 <property stdset="1"> 105 <property stdset="1">
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>
98 </widget> 120 </widget>
99 </grid> 121 </grid>
100</widget> 122</widget>
101<connections> 123<connections>
102 <connection> 124 <connection>
@@ -108,11 +130,17 @@
108 <connection> 130 <connection>
109 <sender>btnInstall</sender> 131 <sender>btnInstall</sender>
110 <signal>clicked()</signal> 132 <signal>clicked()</signal>
111 <receiver>InstallDlg</receiver> 133 <receiver>InstallDlg</receiver>
112 <slot>installSelected()</slot> 134 <slot>installSelected()</slot>
113 </connection> 135 </connection>
136 <connection>
137 <sender>destination</sender>
138 <signal>highlighted(const QString&amp;)</signal>
139 <receiver>InstallDlg</receiver>
140 <slot>displayAvailableSpace( const QString&amp; )</slot>
141 </connection>
142 <slot access="public">displayAvailableSpace( const QString&amp; )</slot>
114 <slot access="public">installSelected()</slot> 143 <slot access="public">installSelected()</slot>
115 <slot access="public">displayText(const QString &amp;)</slot>
116 <slot access="public">optionsSelected()</slot> 144 <slot access="public">optionsSelected()</slot>
117</connections> 145</connections>
118</UI> 146</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
@@ -15,25 +15,28 @@
15 * * 15 * *
16 ***************************************************************************/ 16 ***************************************************************************/
17 17
18#ifdef QWS 18#ifdef QWS
19#include <qpe/config.h> 19#include <qpe/config.h>
20#include <qpe/qpeapplication.h> 20#include <qpe/qpeapplication.h>
21#include <qpe/storage.h>
21#endif 22#endif
22 23
23#include <qmultilineedit.h> 24#include <qmultilineedit.h>
24#include <qdialog.h> 25#include <qdialog.h>
25#include <qcombobox.h> 26#include <qcombobox.h>
26#include <qcheckbox.h> 27#include <qcheckbox.h>
27#include <qpushbutton.h> 28#include <qpushbutton.h>
29#include <qlabel.h>
28 30
29 31
30#include "datamgr.h" 32#include "datamgr.h"
31#include "instoptionsimpl.h" 33#include "instoptionsimpl.h"
32#include "destination.h" 34#include "destination.h"
33#include "installdlgimpl.h" 35#include "installdlgimpl.h"
36#include "utils.h"
34#include "global.h" 37#include "global.h"
35 38
36InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl ) 39InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl )
37 : InstallDlg( parent, name, modal, fl ) 40 : InstallDlg( parent, name, modal, fl )
38{ 41{
39 pIpkg = 0; 42 pIpkg = 0;
@@ -98,12 +101,14 @@ InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *d
98 type = " (ReInstall)"; 101 type = " (ReInstall)";
99 upgrade += " " + item.packageName + type + "\n"; 102 upgrade += " " + item.packageName + type + "\n";
100 } 103 }
101 } 104 }
102 105
103 output->setText( remove + install + upgrade ); 106 output->setText( remove + install + upgrade );
107
108 displayAvailableSpace( destination->currentText() );
104} 109}
105 110
106InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, QWidget *parent, const char *name, bool modal, WFlags fl ) 111InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, QWidget *parent, const char *name, bool modal, WFlags fl )
107 : InstallDlg( parent, name, modal, fl ) 112 : InstallDlg( parent, name, modal, fl )
108{ 113{
109 pIpkg = ipkg; 114 pIpkg = ipkg;
@@ -234,6 +239,36 @@ void InstallDlgImpl :: installSelected()
234void InstallDlgImpl :: displayText(const QString &text ) 239void InstallDlgImpl :: displayText(const QString &text )
235{ 240{
236 QString t = output->text() + "\n" + text; 241 QString t = output->text() + "\n" + text;
237 output->setText( t ); 242 output->setText( t );
238 output->setCursorPosition( output->numLines(), 0 ); 243 output->setCursorPosition( output->numLines(), 0 );
239} 244}
245
246
247void 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
@@ -41,12 +41,13 @@ public:
41 InstallDlgImpl( Ipkg *ipkg, QString initialText, QWidget * parent = 0, const char* name = 0, bool modal = false, WFlags fl = 0 ); 41 InstallDlgImpl( Ipkg *ipkg, QString initialText, QWidget * parent = 0, const char* name = 0, bool modal = false, WFlags fl = 0 );
42 ~InstallDlgImpl(); 42 ~InstallDlgImpl();
43 43
44 bool showDlg(); 44 bool showDlg();
45 bool upgradeServer( QString &server ); 45 bool upgradeServer( QString &server );
46 46
47
47protected: 48protected:
48 49
49private: 50private:
50 DataManager *dataMgr; 51 DataManager *dataMgr;
51 vector<InstallData> installList; 52 vector<InstallData> installList;
52 vector<InstallData> removeList; 53 vector<InstallData> removeList;
@@ -57,9 +58,10 @@ private:
57 58
58 bool runIpkg( QString &option, const QString& package, const QString& dest, int flags ); 59 bool runIpkg( QString &option, const QString& package, const QString& dest, int flags );
59 60
60 void optionsSelected(); 61 void optionsSelected();
61 void installSelected(); 62 void installSelected();
62 void displayText(const QString &text ); 63 void displayText(const QString &text );
64 void displayAvailableSpace( const QString &text);
63}; 65};
64 66
65#endif 67#endif