Diffstat (limited to 'noncore/settings/aqpkg/networkpkgmgr.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/aqpkg/networkpkgmgr.cpp | 46 |
1 files changed, 13 insertions, 33 deletions
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp index ee37157..91afe02 100644 --- a/noncore/settings/aqpkg/networkpkgmgr.cpp +++ b/noncore/settings/aqpkg/networkpkgmgr.cpp @@ -62,15 +62,12 @@ NetworkPackageManager::NetworkPackageManager( QWidget *parent, const char *name showUninstalledPkgs = false; showInstalledPkgs = false; showUpgradedPkgs = false; categoryFilterEnabled = false; initGui(); - setupConnections(); - - //updateData(); } NetworkPackageManager::~NetworkPackageManager() { } @@ -144,17 +141,15 @@ void NetworkPackageManager :: selectLocalPackage( const QString &pkg ) void NetworkPackageManager :: initGui() { QLabel *l = new QLabel( tr( "Servers" ), this ); serversList = new QComboBox( this ); + connect( serversList, SIGNAL(activated( int )), this, SLOT(serverSelected( int ))); + packagesList = new QListView( this ); - update = new QPushButton( tr( "Refresh Lists" ), this ); - download = new QPushButton( tr( "Download" ), this ); - upgrade = new QPushButton( tr( "Upgrade" ), this ); - apply = new QPushButton( tr( "Apply" ), this ); QVBoxLayout *vbox = new QVBoxLayout( this, 0, -1 ); QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1 ); hbox1->addWidget( l ); hbox1->addWidget( serversList ); @@ -177,27 +172,14 @@ void NetworkPackageManager :: initGui() hbox4->addWidget( b ); } } vbox->addWidget( packagesList ); packagesList->addColumn( tr( "Packages" ) ); - - QHBoxLayout *hbox2 = new QHBoxLayout( vbox, -1 ); - hbox2->addWidget( update ); - hbox2->addWidget( download ); - hbox2->addWidget( upgrade ); - hbox2->addWidget( apply ); -} - -void NetworkPackageManager :: setupConnections() -{ - connect( serversList, SIGNAL(activated( int )), this, SLOT(serverSelected( int ))); - connect( apply, SIGNAL(released()), this, SLOT(applyChanges()) ); - connect( download, SIGNAL(released()), this, SLOT(downloadPackage()) ); - connect( upgrade, SIGNAL( released()), this, SLOT(upgradePackages()) ); - connect( update, SIGNAL(released()), this, SLOT(updateServer()) ); + + downloadEnabled = TRUE; } void NetworkPackageManager :: serverSelected( int index ) { serverSelected( index, TRUE ); } @@ -337,28 +319,26 @@ void NetworkPackageManager :: serverSelected( int, bool raiseProgress ) packagesList->insertItem( item ); } // If the local server or the local ipkgs server disable the download button if ( serverName == LOCAL_SERVER ) { - upgrade->setEnabled( false ); - download->setText( tr( "Download" ) ); - download->setEnabled( true ); + downloadEnabled = TRUE; + emit appEnableUpgrade( FALSE ); } else if ( serverName == LOCAL_IPKGS ) { - upgrade->setEnabled( false ); - download->setEnabled( true ); - download->setText( tr( "Remove" ) ); + downloadEnabled = FALSE; + emit appEnableUpgrade( FALSE ); } else { - upgrade->setEnabled( true ); - download->setEnabled( true ); - download->setText( tr( "Download" ) ); + downloadEnabled = TRUE; + emit appEnableUpgrade( TRUE ); } + emit appEnableDownload( downloadEnabled ); // Display this widget once everything is done if ( doProgress && raiseProgress ) { emit appRaiseMainWidget(); } @@ -418,13 +398,13 @@ void NetworkPackageManager :: upgradePackages() } void NetworkPackageManager :: downloadPackage() { bool doUpdate = true; - if ( download->text() == tr( "Download" ) ) + if ( downloadEnabled ) { // See if any packages are selected bool found = false; if ( serversList->currentText() != LOCAL_SERVER ) { for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); @@ -442,13 +422,13 @@ void NetworkPackageManager :: downloadPackage() if ( found ) downloadSelectedPackages(); else downloadRemotePackage(); } - else if ( download->text() == tr( "Remove" ) ) + else { doUpdate = false; for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); item != 0 ; item = (QCheckListItem *)item->nextSibling() ) { |