summaryrefslogtreecommitdiff
authorandyq <andyq>2002-11-02 14:02:34 (UTC)
committer andyq <andyq>2002-11-02 14:02:34 (UTC)
commite622033e90f34ba60075f30a9049b0b266c61cb5 (patch) (unidiff)
tree19c93b79359661222902edf71e9ea89c6ff66aef
parentcf34849ac5c3eb9d16929cc88834973910209f74 (diff)
downloadopie-e622033e90f34ba60075f30a9049b0b266c61cb5.zip
opie-e622033e90f34ba60075f30a9049b0b266c61cb5.tar.gz
opie-e622033e90f34ba60075f30a9049b0b266c61cb5.tar.bz2
Nows asks before deleting local ipk files
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp
index dee834e..ccce401 100644
--- a/noncore/settings/aqpkg/networkpkgmgr.cpp
+++ b/noncore/settings/aqpkg/networkpkgmgr.cpp
@@ -349,32 +349,33 @@ void NetworkPackageManager :: upgradePackages()
349 // Now run upgrade 349 // Now run upgrade
350 Ipkg ipkg; 350 Ipkg ipkg;
351 ipkg.setOption( "upgrade" ); 351 ipkg.setOption( "upgrade" );
352 352
353 InstallDlgImpl dlg( &ipkg, "Upgrading installed packages", this, "Upgrade", true ); 353 InstallDlgImpl dlg( &ipkg, "Upgrading installed packages", this, "Upgrade", true );
354 dlg.showDlg(); 354 dlg.showDlg();
355 355
356 // Reload data 356 // Reload data
357 dataMgr->reloadServerData(); 357 dataMgr->reloadServerData();
358 serverSelected(-1); 358 serverSelected(-1);
359 } 359 }
360} 360}
361 361
362 362
363void NetworkPackageManager :: downloadPackage() 363void NetworkPackageManager :: downloadPackage()
364{ 364{
365 bool doUpdate = true;
365 if ( download->text() == "Download" ) 366 if ( download->text() == "Download" )
366 { 367 {
367 // First, write out ipkg_conf file so that ipkg can use it 368 // First, write out ipkg_conf file so that ipkg can use it
368 dataMgr->writeOutIpkgConf(); 369 dataMgr->writeOutIpkgConf();
369 370
370 // Display dialog to user asking where to download the files to 371 // Display dialog to user asking where to download the files to
371 bool ok = FALSE; 372 bool ok = FALSE;
372 QString dir = ""; 373 QString dir = "";
373#ifdef QWS 374#ifdef QWS
374 // read download directory from config file 375 // read download directory from config file
375 Config cfg( "aqpkg" ); 376 Config cfg( "aqpkg" );
376 cfg.setGroup( "settings" ); 377 cfg.setGroup( "settings" );
377 dir = cfg.readEntry( "downloadDir", "/home/root/Documents/application/ipkg" ); 378 dir = cfg.readEntry( "downloadDir", "/home/root/Documents/application/ipkg" );
378#endif 379#endif
379 380
380 QString text = InputDialog::getText( tr( "Download to where" ), tr( "Enter path to download to" ), dir, &ok, this ); 381 QString text = InputDialog::getText( tr( "Download to where" ), tr( "Enter path to download to" ), dir, &ok, this );
@@ -407,56 +408,68 @@ void NetworkPackageManager :: downloadPackage()
407 QString name = item->text(); 408 QString name = item->text();
408 int pos = name.find( "*" ); 409 int pos = name.find( "*" );
409 name.truncate( pos ); 410 name.truncate( pos );
410 411
411 // if (there is a (installed), remove it 412 // if (there is a (installed), remove it
412 pos = name.find( "(installed)" ); 413 pos = name.find( "(installed)" );
413 if ( pos > 0 ) 414 if ( pos > 0 )
414 name.truncate( pos - 1 ); 415 name.truncate( pos - 1 );
415 416
416 ipkg.setPackage( name ); 417 ipkg.setPackage( name );
417 ipkg.runIpkg( ); 418 ipkg.runIpkg( );
418 } 419 }
419 } 420 }
420 } 421 }
421 else if ( download->text() == "Remove" ) 422 else if ( download->text() == "Remove" )
422 { 423 {
424 doUpdate = false;
423 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 425 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
424 item != 0 ; 426 item != 0 ;
425 item = (QCheckListItem *)item->nextSibling() ) 427 item = (QCheckListItem *)item->nextSibling() )
426 { 428 {
427 if ( item->isOn() ) 429 if ( item->isOn() )
428 { 430 {
429 QString name = item->text(); 431 QString name = item->text();
430 int pos = name.find( "*" ); 432 int pos = name.find( "*" );
431 name.truncate( pos ); 433 name.truncate( pos );
432 434
433 // if (there is a (installed), remove it 435 // if (there is a (installed), remove it
434 pos = name.find( "(installed)" ); 436 pos = name.find( "(installed)" );
435 if ( pos > 0 ) 437 if ( pos > 0 )
436 name.truncate( pos - 1 ); 438 name.truncate( pos - 1 );
437 439
438 Package *p = dataMgr->getServer( serversList->currentText() )->getPackage( name ); 440 Package *p = dataMgr->getServer( serversList->currentText() )->getPackage( name );
439 QFile f( p->getFilename() ); 441
440 f.remove(); 442 QString msgtext;
443 msgtext.sprintf( "Are you sure you wish to delete\n%s?", (const char *)p->getPackageName() );
444 if ( QMessageBox::information( this, "Are you sure?",
445 msgtext, "No", "Yes" ) == 1 )
446 {
447 doUpdate = true;
448 QFile f( p->getFilename() );
449 f.remove();
450 }
441 } 451 }
442 } 452 }
443 } 453 }
444 454
445 dataMgr->reloadServerData(); 455 if ( doUpdate )
446 serverSelected( -1 ); 456 {
457 dataMgr->reloadServerData();
458 serverSelected( -1 );
459 }
447} 460}
448 461
449 462
450void NetworkPackageManager :: applyChanges() 463void NetworkPackageManager :: applyChanges()
451{ 464{
452 stickyOption = ""; 465 stickyOption = "";
453 466
454 // First, write out ipkg_conf file so that ipkg can use it 467 // First, write out ipkg_conf file so that ipkg can use it
455 dataMgr->writeOutIpkgConf(); 468 dataMgr->writeOutIpkgConf();
456 469
457 // Now for each selected item 470 // Now for each selected item
458 // deal with it 471 // deal with it
459 472
460 vector<InstallData> workingPackages; 473 vector<InstallData> workingPackages;
461 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 474 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
462 item != 0 ; 475 item != 0 ;