summaryrefslogtreecommitdiff
path: root/noncore/settings/aqpkg/networkpkgmgr.cpp
authorandyq <andyq>2002-10-25 18:58:30 (UTC)
committer andyq <andyq>2002-10-25 18:58:30 (UTC)
commit835fadbad01b725a46ffd68ca458fd39c7313ea0 (patch) (unidiff)
tree4fbc213e01292e4e850ad561c387f75098e2b059 /noncore/settings/aqpkg/networkpkgmgr.cpp
parent1d3135677f1f49b9cc87ebf01f1c4eaab3c450f4 (diff)
downloadopie-835fadbad01b725a46ffd68ca458fd39c7313ea0.zip
opie-835fadbad01b725a46ffd68ca458fd39c7313ea0.tar.gz
opie-835fadbad01b725a46ffd68ca458fd39c7313ea0.tar.bz2
Added version handling
Diffstat (limited to 'noncore/settings/aqpkg/networkpkgmgr.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.cpp81
1 files changed, 59 insertions, 22 deletions
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp
index 3971aea..02e4e73 100644
--- a/noncore/settings/aqpkg/networkpkgmgr.cpp
+++ b/noncore/settings/aqpkg/networkpkgmgr.cpp
@@ -45,2 +45,4 @@ using namespace std;
45 45
46extern int compareVersions( const char *v1, const char *v2 );
47
46NetworkPackageManager::NetworkPackageManager( DataManager *dataManager, QWidget *parent, const char *name) 48NetworkPackageManager::NetworkPackageManager( DataManager *dataManager, QWidget *parent, const char *name)
@@ -234,3 +236,6 @@ void NetworkPackageManager :: serverSelected( int )
234 if ( it->getVersion() != it->getInstalledVersion() ) 236 if ( it->getVersion() != it->getInstalledVersion() )
235 text += "*"; 237 {
238 if ( compareVersions( it->getInstalledVersion(), it->getVersion() ) == 1 )
239 text += "*";
240 }
236 } 241 }
@@ -535,18 +540,12 @@ InstallData NetworkPackageManager :: dealWithItem( QCheckListItem *item )
535 540
536 // Sticky option not implemented yet, but will eventually allow 541 // Now see if version is newer or not
537 // the user to say something like 'remove all' 542 int val = compareVersions( p->getInstalledVersion(), p->getVersion() );
538 if ( stickyOption == "" ) 543 if ( val == -2 )
539 { 544 {
540 QString msgtext; 545 // Error - should handle
541 msgtext.sprintf( "Do you wish to remove or reinstall\n%s?", (const char *)name ); 546 }
542 switch( QMessageBox::information( this, "Remove or ReInstall", 547 else if ( val == -1 )
543 msgtext, "Remove", "ReInstall" ) ) 548 {
544 { 549 // Version available is older - remove only
545 case 0: // Try again or Enter 550 item.option = "R";
546 item.option = "D";
547 break;
548 case 1: // Quit or Escape
549 item.option = "U";
550 break;
551 }
552 } 551 }
@@ -554,14 +553,52 @@ InstallData NetworkPackageManager :: dealWithItem( QCheckListItem *item )
554 { 553 {
555// item.option = stickyOption; 554 QString caption;
555 QString text;
556 QString secondButton;
557 QString secondOption;
558 if ( val == 0 )
559 {
560 // Version available is the same - option to remove or reinstall
561 caption = "Do you wish to remove or reinstall\n%s?";
562 text = "Remove or ReInstall";
563 secondButton = "ReInstall";
564 secondOption = "R";
565 }
566 else if ( val == 1 )
567 {
568 // Version available is newer - option to remove or upgrade
569 caption = "Do you wish to remove or upgrade\n%s?";
570 text = "Remove or Upgrade";
571 secondButton = "Upgrade";
572 secondOption = "U";
573 }
574
575 // Sticky option not implemented yet, but will eventually allow
576 // the user to say something like 'remove all'
577 if ( stickyOption == "" )
578 {
579 QString msgtext;
580 msgtext.sprintf( caption, (const char *)name );
581 switch( QMessageBox::information( this, text,
582 msgtext, "Remove", secondButton ) )
583 {
584 case 0: // Try again or Enter
585 item.option = "D";
586 break;
587 case 1: // Quit or Escape
588 item.option = secondOption;
589 break;
590 }
591 }
592 else
593 {
594// item.option = stickyOption;
595 }
556 } 596 }
597
557 598
558 // Check if we are reinstalling the same version 599 // Check if we are reinstalling the same version
559 if ( p->getVersion() != p->getInstalledVersion() ) 600 if ( item.option != "R" )
560 item.recreateLinks = true; 601 item.recreateLinks = true;
561 else 602 else
562 {
563 if ( item.option == "U" )
564 item.option = "R";
565 item.recreateLinks = false; 603 item.recreateLinks = false;
566 }
567 604