summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp
index 3ce7960..6f528a1 100644
--- a/noncore/settings/aqpkg/networkpkgmgr.cpp
+++ b/noncore/settings/aqpkg/networkpkgmgr.cpp
@@ -431,78 +431,94 @@ void NetworkPackageManager :: applyChanges()
431 e << lf; 431 e << lf;
432#endif 432#endif
433} 433}
434 434
435// decide what to do - either remove, upgrade or install 435// decide what to do - either remove, upgrade or install
436// Current rules: 436// Current rules:
437// If not installed - install 437// If not installed - install
438// If installed and different version available - upgrade 438// If installed and different version available - upgrade
439// If installed and version up to date - remove 439// If installed and version up to date - remove
440QString NetworkPackageManager :: dealWithItem( QCheckListItem *item ) 440QString NetworkPackageManager :: dealWithItem( QCheckListItem *item )
441{ 441{
442 QString name = item->text(); 442 QString name = item->text();
443 int pos = name.find( "*" ); 443 int pos = name.find( "*" );
444 name.truncate( pos ); 444 name.truncate( pos );
445 445
446 // if (there is a (installed), remove it 446 // if (there is a (installed), remove it
447 pos = name.find( "(installed)" ); 447 pos = name.find( "(installed)" );
448 if ( pos > 0 ) 448 if ( pos > 0 )
449 name.truncate( pos - 1 ); 449 name.truncate( pos - 1 );
450 450
451 // Get package 451 // Get package
452 Server *s = dataMgr->getServer( serversList->currentText() ); 452 Server *s = dataMgr->getServer( serversList->currentText() );
453 Package *p = s->getPackage( name ); 453 Package *p = s->getPackage( name );
454 454
455 // If the package has a filename then it is a local file 455 // If the package has a filename then it is a local file
456 if ( p->isPackageStoredLocally() ) 456 if ( p->isPackageStoredLocally() )
457 name = p->getFilename(); 457 name = p->getFilename();
458 QString option; 458 QString option;
459 QString dest = "root"; 459 QString dest = "root";
460 if ( !p->isInstalled() ) 460 if ( !p->isInstalled() )
461 return QString( "I" ) + name; 461 return QString( "I" ) + name;
462 else 462 else
463 { 463 {
464 if ( p->getVersion() == p->getInstalledVersion() ) 464 if ( p->getVersion() == p->getInstalledVersion() )
465 { 465 {
466 QString msgtext; 466 QString msgtext;
467 msgtext.sprintf( "Do you wish to remove or reinstall\n%s?", (const char *)name ); 467 msgtext.sprintf( "Do you wish to remove or reinstall\n%s?", (const char *)name );
468 switch( QMessageBox::information( this, "Remove or ReInstall", 468 switch( QMessageBox::information( this, "Remove or ReInstall",
469 msgtext, "Remove", "ReInstall" ) ) 469 msgtext, "Remove", "ReInstall" ) )
470 { 470 {
471 case 0: // Try again or Enter 471 case 0: // Try again or Enter
472 return QString( "D" ) + name; 472 return QString( "D" ) + name;
473 break; 473 break;
474 case 1: // Quit or Escape 474 case 1: // Quit or Escape
475 return QString( "U" ) + name; 475 return QString( "U" ) + name;
476 break; 476 break;
477 } 477 }
478 478
479 // User hit cancel (on dlg - assume remove) 479 // User hit cancel (on dlg - assume remove)
480 return QString( "D" ) + name; 480 return QString( "D" ) + name;
481 } 481 }
482 else 482 else
483 return QString( "U" ) + name; 483 return QString( "U" ) + name;
484 } 484 }
485} 485}
486 486
487void NetworkPackageManager :: displayText( const QString &t ) 487void NetworkPackageManager :: displayText( const QString &t )
488{ 488{
489 cout << t << endl; 489 cout << t << endl;
490} 490}
491 491
492 492
493void NetworkPackageManager :: letterPushed( QString t ) 493void NetworkPackageManager :: letterPushed( QString t )
494{ 494{
495 QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 495 QCheckListItem *top = (QCheckListItem *)packagesList->firstChild();
496 QCheckListItem *start = (QCheckListItem *)packagesList->currentItem();
497 if ( packagesList->firstChild() == 0 )
498 return;
499
500 QCheckListItem *item;
501 if ( start == 0 )
502 {
503 item = (QCheckListItem *)packagesList->firstChild();
504 start = top;
505 }
506 else
507 item = (QCheckListItem *)start->nextSibling();
508
509 if ( item == 0 )
510 item = (QCheckListItem *)packagesList->firstChild();
496 do 511 do
497 { 512 {
498 if ( item->text().lower().startsWith( t.lower() ) ) 513 if ( item->text().lower().startsWith( t.lower() ) )
499 { 514 {
500 cout << "Found - item->text()" << endl;
501 packagesList->setSelected( item, true ); 515 packagesList->setSelected( item, true );
502 packagesList->ensureItemVisible( item ); 516 packagesList->ensureItemVisible( item );
503 break; 517 break;
504 } 518 }
505 519
506 item = (QCheckListItem *)item->nextSibling(); 520 item = (QCheckListItem *)item->nextSibling();
507 } while ( item ); 521 if ( !item )
522 item = (QCheckListItem *)packagesList->firstChild();
523 } while ( item != start);
508} 524}