author | andyq <andyq> | 2002-12-27 15:02:07 (UTC) |
---|---|---|
committer | andyq <andyq> | 2002-12-27 15:02:07 (UTC) |
commit | c1dcf67a3c213aa062107c5c3de8413b66ac4b29 (patch) (side-by-side diff) | |
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() { pIpkg->setDestination( it->destination->getDestinationName() ); pIpkg->setDestinationDir( it->destination->getDestinationPath() ); pIpkg->setPackage( it->packageName ); int tmpFlags = flags; if ( it->destination->linkToRoot() ) tmpFlags |= MAKE_LINKS; pIpkg->setFlags( tmpFlags ); pIpkg->runIpkg(); } pIpkg->setOption( "install" ); pIpkg->setDestination( dest ); pIpkg->setDestinationDir( destDir ); pIpkg->setFlags( instFlags ); for ( it = installList.begin() ; it != installList.end() ; ++it ) { pIpkg->setPackage( it->packageName ); pIpkg->runIpkg(); } flags |= FORCE_REINSTALL; for ( it = updateList.begin() ; it != updateList.end() ; ++it ) { if ( it->option == "R" ) pIpkg->setOption( "reinstall" ); else pIpkg->setOption( "upgrade" ); pIpkg->setDestination( it->destination->getDestinationName() ); pIpkg->setDestinationDir( it->destination->getDestinationPath() ); pIpkg->setPackage( it->packageName ); int tmpFlags = flags; if ( it->destination->linkToRoot() && it->recreateLinks ) tmpFlags |= MAKE_LINKS; pIpkg->setFlags( tmpFlags ); pIpkg->runIpkg(); } delete pIpkg; } btnOptions->setEnabled( true ); // btnInstall->setEnabled( true ); btnInstall->setText( tr( "Close" ) ); - displayAvailableSpace( destination->currentText() ); + if ( destination->currentText() != 0 && destination->currentText() != "" ) + displayAvailableSpace( destination->currentText() ); } void InstallDlgImpl :: displayText(const QString &text ) { QString t = output->text() + "\n" + 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 ); } |