author | andyq <andyq> | 2002-10-16 18:56:10 (UTC) |
---|---|---|
committer | andyq <andyq> | 2002-10-16 18:56:10 (UTC) |
commit | 73b4588d48fdb0c004646e5d8468f57a4a20ac14 (patch) (side-by-side diff) | |
tree | afe5da9173aa9ad8f77959fce921f22af944f75d | |
parent | 63d3299669d5147e16c56b016b0ee3cca2127a75 (diff) | |
download | opie-73b4588d48fdb0c004646e5d8468f57a4a20ac14.zip opie-73b4588d48fdb0c004646e5d8468f57a4a20ac14.tar.gz opie-73b4588d48fdb0c004646e5d8468f57a4a20ac14.tar.bz2 |
Updated GUI so that we can upgrade all packages within a feed.
User is asked whether to remove or reinstall when selecting a package with
the same version
-rw-r--r-- | noncore/settings/aqpkg/networkpkgmgr.cpp | 63 |
1 files changed, 60 insertions, 3 deletions
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp index 06e2a03..0bc01df 100644 --- a/noncore/settings/aqpkg/networkpkgmgr.cpp +++ b/noncore/settings/aqpkg/networkpkgmgr.cpp @@ -34,2 +34,3 @@ using namespace std; #include <qfile.h> +#include <qmessagebox.h> @@ -99,2 +100,3 @@ void NetworkPackageManager :: initGui() download = new QPushButton( "Download", this ); + upgrade = new QPushButton( "Upgrade", this ); apply = new QPushButton( "Apply", this ); @@ -112,2 +114,3 @@ void NetworkPackageManager :: initGui() hbox2->addWidget( download ); + hbox2->addWidget( upgrade ); hbox2->addWidget( apply ); @@ -120,2 +123,3 @@ void NetworkPackageManager :: setupConnections() connect( download, SIGNAL(released()), this, SLOT(downloadPackage()) ); + connect( upgrade, SIGNAL( released()), this, SLOT(upgradePackages()) ); connect( update, SIGNAL(released()), this, SLOT(updateServer()) ); @@ -123,3 +127,3 @@ void NetworkPackageManager :: setupConnections() -void NetworkPackageManager :: showProgressDialog() +void NetworkPackageManager :: showProgressDialog( char *initialText ) { @@ -127,3 +131,3 @@ void NetworkPackageManager :: showProgressDialog() progressDlg = new ProgressDlg( this, "Progress", false ); - progressDlg->setText( "Reading installed packages" ); + progressDlg->setText( initialText ); progressDlg->show(); @@ -177,7 +181,11 @@ void NetworkPackageManager :: serverSelected( int ) // If the local server or the local ipkgs server disable the download button - download->setText( "Download" ); if ( serverName == LOCAL_SERVER ) + { + upgrade->setEnabled( false ); + download->setText( "Download" ); download->setEnabled( false ); + } else if ( serverName == LOCAL_IPKGS ) { + upgrade->setEnabled( false ); download->setEnabled( true ); @@ -186,3 +194,7 @@ void NetworkPackageManager :: serverSelected( int ) else + { + upgrade->setEnabled( true ); download->setEnabled( true ); + download->setText( "Download" ); + } } @@ -227,2 +239,30 @@ void NetworkPackageManager :: updateServer() +void NetworkPackageManager :: upgradePackages() +{ + // We're gonna do an upgrade of all packages + // First warn user that this isn't recommended + QString text = "WARNING: Upgrading while\nOpie/Qtopia is running\nis NOT recommended!\n\nAre you sure?\n"; + QMessageBox warn("Warning", text, QMessageBox::Warning, + QMessageBox::Yes, + QMessageBox::No | QMessageBox::Escape | QMessageBox::Default , + 0, this ); + warn.adjustSize(); + + if ( warn.exec() == QMessageBox::Yes ) + { + // First, write out ipkg_conf file so that ipkg can use it + dataMgr->writeOutIpkgConf(); + + // Now run upgrade + InstallDlgImpl dlg( this, "Upgrade", true ); + dlg.showDlg(); + + // Reload data + dataMgr->reloadServerData( LOCAL_SERVER ); + + dataMgr->reloadServerData( serversList->currentText() ); + serverSelected(-1); + } +} + @@ -345,2 +385,3 @@ void NetworkPackageManager :: applyChanges() dataMgr->reloadServerData( LOCAL_SERVER ); + dataMgr->reloadServerData( serversList->currentText() ); @@ -386,3 +427,19 @@ QString NetworkPackageManager :: dealWithItem( QCheckListItem *item ) if ( p->getVersion() == p->getInstalledVersion() ) + { + QString msgtext; + msgtext.sprintf( "Do you wish to remove or reinstall\n%s?", (const char *)name ); + switch( QMessageBox::information( this, "Remove or ReInstall", + msgtext, "Remove", "ReInstall" ) ) + { + case 0: // Try again or Enter return QString( "D" ) + name; + break; + case 1: // Quit or Escape + return QString( "U" ) + name; + break; + } + + // User hit cancel (on dlg - assume remove) + return QString( "D" ) + name; + } else |