author | andyq <andyq> | 2002-12-04 23:14:12 (UTC) |
---|---|---|
committer | andyq <andyq> | 2002-12-04 23:14:12 (UTC) |
commit | 128343cd009009e42ce6bcdfd45a294c7ea44f83 (patch) (unidiff) | |
tree | c27ae8892ce9038e5ae523aaecc4632fafb05929 | |
parent | 4c3a3a2eb2ed79f9e833d356b28c8be9a514ed50 (diff) | |
download | opie-128343cd009009e42ce6bcdfd45a294c7ea44f83.zip opie-128343cd009009e42ce6bcdfd45a294c7ea44f83.tar.gz opie-128343cd009009e42ce6bcdfd45a294c7ea44f83.tar.bz2 |
Added Available space for destination chosen
-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 | |||
@@ -1,118 +1,146 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>InstallDlg</class> | 2 | <class>InstallDlg</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QDialog</class> | 4 | <class>QDialog</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>InstallDlg</cstring> | 7 | <cstring>InstallDlg</cstring> |
8 | </property> | 8 | </property> |
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> |
22 | <grid> | 22 | <grid> |
23 | <property stdset="1"> | 23 | <property stdset="1"> |
24 | <name>margin</name> | 24 | <name>margin</name> |
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"> |
56 | <name>title</name> | 67 | <name>title</name> |
57 | <string>Output</string> | 68 | <string>Output</string> |
58 | </property> | 69 | </property> |
59 | <grid> | 70 | <grid> |
60 | <property stdset="1"> | 71 | <property stdset="1"> |
61 | <name>margin</name> | 72 | <name>margin</name> |
62 | <number>11</number> | 73 | <number>11</number> |
63 | </property> | 74 | </property> |
64 | <property stdset="1"> | 75 | <property stdset="1"> |
65 | <name>spacing</name> | 76 | <name>spacing</name> |
66 | <number>6</number> | 77 | <number>6</number> |
67 | </property> | 78 | </property> |
68 | <widget row="0" column="0" > | 79 | <widget row="0" column="0" > |
69 | <class>QMultiLineEdit</class> | 80 | <class>QMultiLineEdit</class> |
70 | <property stdset="1"> | 81 | <property stdset="1"> |
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> |
103 | <sender>btnOptions</sender> | 125 | <sender>btnOptions</sender> |
104 | <signal>clicked()</signal> | 126 | <signal>clicked()</signal> |
105 | <receiver>InstallDlg</receiver> | 127 | <receiver>InstallDlg</receiver> |
106 | <slot>optionsSelected()</slot> | 128 | <slot>optionsSelected()</slot> |
107 | </connection> | 129 | </connection> |
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&)</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> |
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 | |||
@@ -1,57 +1,60 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | installdlgimpl.cpp - description | 2 | installdlgimpl.cpp - description |
3 | ------------------- | 3 | ------------------- |
4 | begin : Mon Aug 26 2002 | 4 | begin : Mon Aug 26 2002 |
5 | copyright : (C) 2002 by Andy Qua | 5 | copyright : (C) 2002 by Andy Qua |
6 | email : andy.qua@blueyonder.co.uk | 6 | email : andy.qua@blueyonder.co.uk |
7 | ***************************************************************************/ | 7 | ***************************************************************************/ |
8 | 8 | ||
9 | /*************************************************************************** | 9 | /*************************************************************************** |
10 | * * | 10 | * * |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | * This program is free software; you can redistribute it and/or modify * |
12 | * it under the terms of the GNU General Public License as published by * | 12 | * it under the terms of the GNU General Public License as published by * |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * (at your option) any later version. * | 14 | * (at your option) any later version. * |
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 | ||
36 | InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl ) | 39 | InstallDlgImpl::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; |
40 | upgradePackages = false; | 43 | upgradePackages = false; |
41 | dataMgr = dataManager; | 44 | dataMgr = dataManager; |
42 | vector<Destination>::iterator dit; | 45 | vector<Destination>::iterator dit; |
43 | 46 | ||
44 | QString defaultDest = "root"; | 47 | QString defaultDest = "root"; |
45 | #ifdef QWS | 48 | #ifdef QWS |
46 | Config cfg( "aqpkg" ); | 49 | Config cfg( "aqpkg" ); |
47 | cfg.setGroup( "settings" ); | 50 | cfg.setGroup( "settings" ); |
48 | defaultDest = cfg.readEntry( "dest", "root" ); | 51 | defaultDest = cfg.readEntry( "dest", "root" ); |
49 | 52 | ||
50 | // Grab flags - Turn MAKE_LINKS on by default (if no flags found) | 53 | // Grab flags - Turn MAKE_LINKS on by default (if no flags found) |
51 | flags = cfg.readNumEntry( "installFlags", 0 ); | 54 | flags = cfg.readNumEntry( "installFlags", 0 ); |
52 | #else | 55 | #else |
53 | flags = 0; | 56 | flags = 0; |
54 | #endif | 57 | #endif |
55 | 58 | ||
56 | // Output text is read only | 59 | // Output text is read only |
57 | output->setReadOnly( true ); | 60 | output->setReadOnly( true ); |
@@ -80,48 +83,50 @@ InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *d | |||
80 | for ( it = packageList.begin() ; it != packageList.end() ; ++it ) | 83 | for ( it = packageList.begin() ; it != packageList.end() ; ++it ) |
81 | { | 84 | { |
82 | InstallData item = *it; | 85 | InstallData item = *it; |
83 | if ( item.option == "I" ) | 86 | if ( item.option == "I" ) |
84 | { | 87 | { |
85 | installList.push_back( item ); | 88 | installList.push_back( item ); |
86 | install += " " + item.packageName + "\n"; | 89 | install += " " + item.packageName + "\n"; |
87 | } | 90 | } |
88 | else if ( item.option == "D" ) | 91 | else if ( item.option == "D" ) |
89 | { | 92 | { |
90 | removeList.push_back( item ); | 93 | removeList.push_back( item ); |
91 | remove += " " + item.packageName + "\n"; | 94 | remove += " " + item.packageName + "\n"; |
92 | } | 95 | } |
93 | else if ( item.option == "U" || item.option == "R" ) | 96 | else if ( item.option == "U" || item.option == "R" ) |
94 | { | 97 | { |
95 | updateList.push_back( item ); | 98 | updateList.push_back( item ); |
96 | QString type = " (Upgrade)"; | 99 | QString type = " (Upgrade)"; |
97 | if ( item.option == "R" ) | 100 | if ( item.option == "R" ) |
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 | ||
106 | InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, QWidget *parent, const char *name, bool modal, WFlags fl ) | 111 | InstallDlgImpl::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; |
110 | output->setText( initialText ); | 115 | output->setText( initialText ); |
111 | } | 116 | } |
112 | 117 | ||
113 | 118 | ||
114 | InstallDlgImpl::~InstallDlgImpl() | 119 | InstallDlgImpl::~InstallDlgImpl() |
115 | { | 120 | { |
116 | } | 121 | } |
117 | 122 | ||
118 | bool InstallDlgImpl :: showDlg() | 123 | bool InstallDlgImpl :: showDlg() |
119 | { | 124 | { |
120 | showMaximized(); | 125 | showMaximized(); |
121 | bool ret = exec(); | 126 | bool ret = exec(); |
122 | 127 | ||
123 | return ret; | 128 | return ret; |
124 | } | 129 | } |
125 | 130 | ||
126 | void InstallDlgImpl :: optionsSelected() | 131 | void InstallDlgImpl :: optionsSelected() |
127 | { | 132 | { |
@@ -156,49 +161,49 @@ void InstallDlgImpl :: installSelected() | |||
156 | output->setText( "" ); | 161 | output->setText( "" ); |
157 | 162 | ||
158 | connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); | 163 | connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); |
159 | pIpkg->runIpkg(); | 164 | pIpkg->runIpkg(); |
160 | } | 165 | } |
161 | else | 166 | else |
162 | { | 167 | { |
163 | output->setText( "" ); | 168 | output->setText( "" ); |
164 | vector<Destination>::iterator d = dataMgr->getDestination( destination->currentText() ); | 169 | vector<Destination>::iterator d = dataMgr->getDestination( destination->currentText() ); |
165 | QString dest = d->getDestinationName(); | 170 | QString dest = d->getDestinationName(); |
166 | QString destDir = d->getDestinationPath(); | 171 | QString destDir = d->getDestinationPath(); |
167 | int instFlags = flags; | 172 | int instFlags = flags; |
168 | if ( d->linkToRoot() ) | 173 | if ( d->linkToRoot() ) |
169 | instFlags |= MAKE_LINKS; | 174 | instFlags |= MAKE_LINKS; |
170 | 175 | ||
171 | #ifdef QWS | 176 | #ifdef QWS |
172 | // Save settings | 177 | // Save settings |
173 | Config cfg( "aqpkg" ); | 178 | Config cfg( "aqpkg" ); |
174 | cfg.setGroup( "settings" ); | 179 | cfg.setGroup( "settings" ); |
175 | cfg.writeEntry( "dest", dest ); | 180 | cfg.writeEntry( "dest", dest ); |
176 | #endif | 181 | #endif |
177 | 182 | ||
178 | pIpkg = new Ipkg; | 183 | pIpkg = new Ipkg; |
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 |
182 | vector<InstallData>::iterator it; | 187 | vector<InstallData>::iterator it; |
183 | pIpkg->setOption( "remove" ); | 188 | pIpkg->setOption( "remove" ); |
184 | for ( it = removeList.begin() ; it != removeList.end() ; ++it ) | 189 | for ( it = removeList.begin() ; it != removeList.end() ; ++it ) |
185 | { | 190 | { |
186 | pIpkg->setDestination( it->destination->getDestinationName() ); | 191 | pIpkg->setDestination( it->destination->getDestinationName() ); |
187 | pIpkg->setDestinationDir( it->destination->getDestinationPath() ); | 192 | pIpkg->setDestinationDir( it->destination->getDestinationPath() ); |
188 | pIpkg->setPackage( it->packageName ); | 193 | pIpkg->setPackage( it->packageName ); |
189 | 194 | ||
190 | int tmpFlags = flags; | 195 | int tmpFlags = flags; |
191 | if ( it->destination->linkToRoot() ) | 196 | if ( it->destination->linkToRoot() ) |
192 | tmpFlags |= MAKE_LINKS; | 197 | tmpFlags |= MAKE_LINKS; |
193 | 198 | ||
194 | pIpkg->setFlags( tmpFlags ); | 199 | pIpkg->setFlags( tmpFlags ); |
195 | pIpkg->runIpkg(); | 200 | pIpkg->runIpkg(); |
196 | } | 201 | } |
197 | 202 | ||
198 | pIpkg->setOption( "install" ); | 203 | pIpkg->setOption( "install" ); |
199 | pIpkg->setDestination( dest ); | 204 | pIpkg->setDestination( dest ); |
200 | pIpkg->setDestinationDir( destDir ); | 205 | pIpkg->setDestinationDir( destDir ); |
201 | pIpkg->setFlags( instFlags ); | 206 | pIpkg->setFlags( instFlags ); |
202 | for ( it = installList.begin() ; it != installList.end() ; ++it ) | 207 | for ( it = installList.begin() ; it != installList.end() ; ++it ) |
203 | { | 208 | { |
204 | pIpkg->setPackage( it->packageName ); | 209 | pIpkg->setPackage( it->packageName ); |
@@ -216,24 +221,54 @@ void InstallDlgImpl :: installSelected() | |||
216 | pIpkg->setDestinationDir( it->destination->getDestinationPath() ); | 221 | pIpkg->setDestinationDir( it->destination->getDestinationPath() ); |
217 | pIpkg->setPackage( it->packageName ); | 222 | pIpkg->setPackage( it->packageName ); |
218 | 223 | ||
219 | int tmpFlags = flags; | 224 | int tmpFlags = flags; |
220 | if ( it->destination->linkToRoot() && it->recreateLinks ) | 225 | if ( it->destination->linkToRoot() && it->recreateLinks ) |
221 | tmpFlags |= MAKE_LINKS; | 226 | tmpFlags |= MAKE_LINKS; |
222 | pIpkg->setFlags( tmpFlags ); | 227 | pIpkg->setFlags( tmpFlags ); |
223 | pIpkg->runIpkg(); | 228 | pIpkg->runIpkg(); |
224 | } | 229 | } |
225 | 230 | ||
226 | delete pIpkg; | 231 | delete pIpkg; |
227 | } | 232 | } |
228 | 233 | ||
229 | btnOptions->setEnabled( true ); | 234 | btnOptions->setEnabled( true ); |
230 | btnInstall->setEnabled( true ); | 235 | btnInstall->setEnabled( true ); |
231 | btnInstall->setText( tr( "Close" ) ); | 236 | btnInstall->setText( tr( "Close" ) ); |
232 | } | 237 | } |
233 | 238 | ||
234 | void InstallDlgImpl :: displayText(const QString &text ) | 239 | void 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 | |||
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 | |||
@@ -23,43 +23,45 @@ using namespace std; | |||
23 | #include <qstring.h> | 23 | #include <qstring.h> |
24 | 24 | ||
25 | #include "ipkg.h" | 25 | #include "ipkg.h" |
26 | #include "install.h" | 26 | #include "install.h" |
27 | 27 | ||
28 | class InstallData | 28 | class InstallData |
29 | { | 29 | { |
30 | public: | 30 | public: |
31 | QString option; // I - install, D - delete, R- reinstall U - upgrade | 31 | QString option; // I - install, D - delete, R- reinstall U - upgrade |
32 | QString packageName; | 32 | QString packageName; |
33 | Destination *destination; | 33 | Destination *destination; |
34 | bool recreateLinks; | 34 | bool recreateLinks; |
35 | }; | 35 | }; |
36 | 36 | ||
37 | class InstallDlgImpl : public InstallDlg | 37 | class InstallDlgImpl : public InstallDlg |
38 | { | 38 | { |
39 | public: | 39 | public: |
40 | InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, QWidget * parent = 0, const char* name = 0, bool modal = false, WFlags fl = 0 ); | 40 | InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, 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 ); | 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 | |||
47 | protected: | 48 | protected: |
48 | 49 | ||
49 | private: | 50 | private: |
50 | DataManager *dataMgr; | 51 | DataManager *dataMgr; |
51 | vector<InstallData> installList; | 52 | vector<InstallData> installList; |
52 | vector<InstallData> removeList; | 53 | vector<InstallData> removeList; |
53 | vector<InstallData> updateList; | 54 | vector<InstallData> updateList; |
54 | int flags; | 55 | int flags; |
55 | Ipkg *pIpkg; | 56 | Ipkg *pIpkg; |
56 | bool upgradePackages; | 57 | bool upgradePackages; |
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 |