author | andyq <andyq> | 2002-12-27 15:02:07 (UTC) |
---|---|---|
committer | andyq <andyq> | 2002-12-27 15:02:07 (UTC) |
commit | c1dcf67a3c213aa062107c5c3de8413b66ac4b29 (patch) (unidiff) | |
tree | 57b3f1972f6f5a105baf25b0b86e7da540fdf83f | |
parent | 349cf38c38899d4693e83061d52c847e032335db (diff) | |
download | opie-c1dcf67a3c213aa062107c5c3de8413b66ac4b29.zip opie-c1dcf67a3c213aa062107c5c3de8413b66ac4b29.tar.gz opie-c1dcf67a3c213aa062107c5c3de8413b66ac4b29.tar.bz2 |
Fixed bug where refresh lists would crash
-rw-r--r-- | noncore/settings/aqpkg/installdlgimpl.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/noncore/settings/aqpkg/installdlgimpl.cpp b/noncore/settings/aqpkg/installdlgimpl.cpp index bd07828..bf2c482 100644 --- a/noncore/settings/aqpkg/installdlgimpl.cpp +++ b/noncore/settings/aqpkg/installdlgimpl.cpp | |||
@@ -203,88 +203,89 @@ void InstallDlgImpl :: installSelected() | |||
203 | { | 203 | { |
204 | pIpkg->setDestination( it->destination->getDestinationName() ); | 204 | pIpkg->setDestination( it->destination->getDestinationName() ); |
205 | pIpkg->setDestinationDir( it->destination->getDestinationPath() ); | 205 | pIpkg->setDestinationDir( it->destination->getDestinationPath() ); |
206 | pIpkg->setPackage( it->packageName ); | 206 | pIpkg->setPackage( it->packageName ); |
207 | 207 | ||
208 | int tmpFlags = flags; | 208 | int tmpFlags = flags; |
209 | if ( it->destination->linkToRoot() ) | 209 | if ( it->destination->linkToRoot() ) |
210 | tmpFlags |= MAKE_LINKS; | 210 | tmpFlags |= MAKE_LINKS; |
211 | 211 | ||
212 | pIpkg->setFlags( tmpFlags ); | 212 | pIpkg->setFlags( tmpFlags ); |
213 | pIpkg->runIpkg(); | 213 | pIpkg->runIpkg(); |
214 | } | 214 | } |
215 | 215 | ||
216 | pIpkg->setOption( "install" ); | 216 | pIpkg->setOption( "install" ); |
217 | pIpkg->setDestination( dest ); | 217 | pIpkg->setDestination( dest ); |
218 | pIpkg->setDestinationDir( destDir ); | 218 | pIpkg->setDestinationDir( destDir ); |
219 | pIpkg->setFlags( instFlags ); | 219 | pIpkg->setFlags( instFlags ); |
220 | for ( it = installList.begin() ; it != installList.end() ; ++it ) | 220 | for ( it = installList.begin() ; it != installList.end() ; ++it ) |
221 | { | 221 | { |
222 | pIpkg->setPackage( it->packageName ); | 222 | pIpkg->setPackage( it->packageName ); |
223 | pIpkg->runIpkg(); | 223 | pIpkg->runIpkg(); |
224 | } | 224 | } |
225 | 225 | ||
226 | flags |= FORCE_REINSTALL; | 226 | flags |= FORCE_REINSTALL; |
227 | for ( it = updateList.begin() ; it != updateList.end() ; ++it ) | 227 | for ( it = updateList.begin() ; it != updateList.end() ; ++it ) |
228 | { | 228 | { |
229 | if ( it->option == "R" ) | 229 | if ( it->option == "R" ) |
230 | pIpkg->setOption( "reinstall" ); | 230 | pIpkg->setOption( "reinstall" ); |
231 | else | 231 | else |
232 | pIpkg->setOption( "upgrade" ); | 232 | pIpkg->setOption( "upgrade" ); |
233 | pIpkg->setDestination( it->destination->getDestinationName() ); | 233 | pIpkg->setDestination( it->destination->getDestinationName() ); |
234 | pIpkg->setDestinationDir( it->destination->getDestinationPath() ); | 234 | pIpkg->setDestinationDir( it->destination->getDestinationPath() ); |
235 | pIpkg->setPackage( it->packageName ); | 235 | pIpkg->setPackage( it->packageName ); |
236 | 236 | ||
237 | int tmpFlags = flags; | 237 | int tmpFlags = flags; |
238 | if ( it->destination->linkToRoot() && it->recreateLinks ) | 238 | if ( it->destination->linkToRoot() && it->recreateLinks ) |
239 | tmpFlags |= MAKE_LINKS; | 239 | tmpFlags |= MAKE_LINKS; |
240 | pIpkg->setFlags( tmpFlags ); | 240 | pIpkg->setFlags( tmpFlags ); |
241 | pIpkg->runIpkg(); | 241 | pIpkg->runIpkg(); |
242 | } | 242 | } |
243 | 243 | ||
244 | delete pIpkg; | 244 | delete pIpkg; |
245 | } | 245 | } |
246 | 246 | ||
247 | btnOptions->setEnabled( true ); | 247 | btnOptions->setEnabled( true ); |
248 | // btnInstall->setEnabled( true ); | 248 | // btnInstall->setEnabled( true ); |
249 | btnInstall->setText( tr( "Close" ) ); | 249 | btnInstall->setText( tr( "Close" ) ); |
250 | 250 | ||
251 | displayAvailableSpace( destination->currentText() ); | 251 | if ( destination->currentText() != 0 && destination->currentText() != "" ) |
252 | displayAvailableSpace( destination->currentText() ); | ||
252 | } | 253 | } |
253 | 254 | ||
254 | 255 | ||
255 | void InstallDlgImpl :: displayText(const QString &text ) | 256 | void InstallDlgImpl :: displayText(const QString &text ) |
256 | { | 257 | { |
257 | QString t = output->text() + "\n" + text; | 258 | QString t = output->text() + "\n" + text; |
258 | output->setText( t ); | 259 | output->setText( t ); |
259 | output->setCursorPosition( output->numLines(), 0 ); | 260 | output->setCursorPosition( output->numLines(), 0 ); |
260 | } | 261 | } |
261 | 262 | ||
262 | 263 | ||
263 | void InstallDlgImpl :: displayAvailableSpace( const QString &text ) | 264 | void InstallDlgImpl :: displayAvailableSpace( const QString &text ) |
264 | { | 265 | { |
265 | vector<Destination>::iterator d = dataMgr->getDestination( text ); | 266 | vector<Destination>::iterator d = dataMgr->getDestination( text ); |
266 | QString destDir = d->getDestinationPath(); | 267 | QString destDir = d->getDestinationPath(); |
267 | 268 | ||
268 | long blockSize = 0; | 269 | long blockSize = 0; |
269 | long totalBlocks = 0; | 270 | long totalBlocks = 0; |
270 | long availBlocks = 0; | 271 | long availBlocks = 0; |
271 | QString space; | 272 | QString space; |
272 | if ( Utils::getStorageSpace( (const char *)destDir, &blockSize, &totalBlocks, &availBlocks ) ) | 273 | if ( Utils::getStorageSpace( (const char *)destDir, &blockSize, &totalBlocks, &availBlocks ) ) |
273 | { | 274 | { |
274 | long mult = blockSize / 1024; | 275 | long mult = blockSize / 1024; |
275 | long div = 1024 / blockSize; | 276 | long div = 1024 / blockSize; |
276 | 277 | ||
277 | if ( !mult ) mult = 1; | 278 | if ( !mult ) mult = 1; |
278 | if ( !div ) div = 1; | 279 | if ( !div ) div = 1; |
279 | // long total = totalBlocks * mult / div; | 280 | // long total = totalBlocks * mult / div; |
280 | long avail = availBlocks * mult / div; | 281 | long avail = availBlocks * mult / div; |
281 | // long used = total - avail; | 282 | // long used = total - avail; |
282 | 283 | ||
283 | space.sprintf( "%ld Kb", avail ); | 284 | space.sprintf( "%ld Kb", avail ); |
284 | } | 285 | } |
285 | else | 286 | else |
286 | space = "Unknown"; | 287 | space = "Unknown"; |
287 | 288 | ||
288 | txtAvailableSpace->setText( space ); | 289 | txtAvailableSpace->setText( space ); |
289 | } | 290 | } |
290 | 291 | ||