summaryrefslogtreecommitdiff
authorandyq <andyq>2002-12-20 13:11:54 (UTC)
committer andyq <andyq>2002-12-20 13:11:54 (UTC)
commit3bdaf9ff6bea6d7263bebff83dcdc05d4506d442 (patch) (unidiff)
tree9716e4fcd62d371a1955759287a972bee8f77e48
parent48bab4b65417d12dac1e2ef61f9b059fc5dabdcc (diff)
downloadopie-3bdaf9ff6bea6d7263bebff83dcdc05d4506d442.zip
opie-3bdaf9ff6bea6d7263bebff83dcdc05d4506d442.tar.gz
opie-3bdaf9ff6bea6d7263bebff83dcdc05d4506d442.tar.bz2
Refreshes available space on current destination after packages finished installing
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/installdlgimpl.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/noncore/settings/aqpkg/installdlgimpl.cpp b/noncore/settings/aqpkg/installdlgimpl.cpp
index 80c06ba..bd07828 100644
--- a/noncore/settings/aqpkg/installdlgimpl.cpp
+++ b/noncore/settings/aqpkg/installdlgimpl.cpp
@@ -218,64 +218,66 @@ void InstallDlgImpl :: installSelected()
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
251 displayAvailableSpace( destination->currentText() );
250} 252}
251 253
252 254
253void InstallDlgImpl :: displayText(const QString &text ) 255void InstallDlgImpl :: displayText(const QString &text )
254{ 256{
255 QString t = output->text() + "\n" + text; 257 QString t = output->text() + "\n" + text;
256 output->setText( t ); 258 output->setText( t );
257 output->setCursorPosition( output->numLines(), 0 ); 259 output->setCursorPosition( output->numLines(), 0 );
258} 260}
259 261
260 262
261void InstallDlgImpl :: displayAvailableSpace( const QString &text ) 263void InstallDlgImpl :: displayAvailableSpace( const QString &text )
262{ 264{
263 vector<Destination>::iterator d = dataMgr->getDestination( text ); 265 vector<Destination>::iterator d = dataMgr->getDestination( text );
264 QString destDir = d->getDestinationPath(); 266 QString destDir = d->getDestinationPath();
265 267
266 long blockSize = 0; 268 long blockSize = 0;
267 long totalBlocks = 0; 269 long totalBlocks = 0;
268 long availBlocks = 0; 270 long availBlocks = 0;
269 QString space; 271 QString space;
270 if ( Utils::getStorageSpace( (const char *)destDir, &blockSize, &totalBlocks, &availBlocks ) ) 272 if ( Utils::getStorageSpace( (const char *)destDir, &blockSize, &totalBlocks, &availBlocks ) )
271 { 273 {
272 long mult = blockSize / 1024; 274 long mult = blockSize / 1024;
273 long div = 1024 / blockSize; 275 long div = 1024 / blockSize;
274 276
275 if ( !mult ) mult = 1; 277 if ( !mult ) mult = 1;
276 if ( !div ) div = 1; 278 if ( !div ) div = 1;
277// long total = totalBlocks * mult / div; 279// long total = totalBlocks * mult / div;
278 long avail = availBlocks * mult / div; 280 long avail = availBlocks * mult / div;
279// long used = total - avail; 281// long used = total - avail;
280 282
281 space.sprintf( "%ld Kb", avail ); 283 space.sprintf( "%ld Kb", avail );