summaryrefslogtreecommitdiff
path: root/noncore/settings/aqpkg/networkpkgmgr.cpp
Unidiff
Diffstat (limited to 'noncore/settings/aqpkg/networkpkgmgr.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.cpp46
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
@@ -65,9 +65,6 @@ NetworkPackageManager::NetworkPackageManager( QWidget *parent, const char *name
65 categoryFilterEnabled = false; 65 categoryFilterEnabled = false;
66 66
67 initGui(); 67 initGui();
68 setupConnections();
69
70 //updateData();
71} 68}
72 69
73NetworkPackageManager::~NetworkPackageManager() 70NetworkPackageManager::~NetworkPackageManager()
@@ -147,11 +144,9 @@ void NetworkPackageManager :: initGui()
147{ 144{
148 QLabel *l = new QLabel( tr( "Servers" ), this ); 145 QLabel *l = new QLabel( tr( "Servers" ), this );
149 serversList = new QComboBox( this ); 146 serversList = new QComboBox( this );
147 connect( serversList, SIGNAL(activated( int )), this, SLOT(serverSelected( int )));
148
150 packagesList = new QListView( this ); 149 packagesList = new QListView( this );
151 update = new QPushButton( tr( "Refresh Lists" ), this );
152 download = new QPushButton( tr( "Download" ), this );
153 upgrade = new QPushButton( tr( "Upgrade" ), this );
154 apply = new QPushButton( tr( "Apply" ), this );
155 150
156 QVBoxLayout *vbox = new QVBoxLayout( this, 0, -1 ); 151 QVBoxLayout *vbox = new QVBoxLayout( this, 0, -1 );
157 QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1 ); 152 QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1 );
@@ -180,21 +175,8 @@ void NetworkPackageManager :: initGui()
180 175
181 vbox->addWidget( packagesList ); 176 vbox->addWidget( packagesList );
182 packagesList->addColumn( tr( "Packages" ) ); 177 packagesList->addColumn( tr( "Packages" ) );
183 178
184 QHBoxLayout *hbox2 = new QHBoxLayout( vbox, -1 ); 179 downloadEnabled = TRUE;
185 hbox2->addWidget( update );
186 hbox2->addWidget( download );
187 hbox2->addWidget( upgrade );
188 hbox2->addWidget( apply );
189}
190
191void NetworkPackageManager :: setupConnections()
192{
193 connect( serversList, SIGNAL(activated( int )), this, SLOT(serverSelected( int )));
194 connect( apply, SIGNAL(released()), this, SLOT(applyChanges()) );
195 connect( download, SIGNAL(released()), this, SLOT(downloadPackage()) );
196 connect( upgrade, SIGNAL( released()), this, SLOT(upgradePackages()) );
197 connect( update, SIGNAL(released()), this, SLOT(updateServer()) );
198} 180}
199 181
200void NetworkPackageManager :: serverSelected( int index ) 182void NetworkPackageManager :: serverSelected( int index )
@@ -340,22 +322,20 @@ void NetworkPackageManager :: serverSelected( int, bool raiseProgress )
340 // If the local server or the local ipkgs server disable the download button 322 // If the local server or the local ipkgs server disable the download button
341 if ( serverName == LOCAL_SERVER ) 323 if ( serverName == LOCAL_SERVER )
342 { 324 {
343 upgrade->setEnabled( false ); 325 downloadEnabled = TRUE;
344 download->setText( tr( "Download" ) ); 326 emit appEnableUpgrade( FALSE );
345 download->setEnabled( true );
346 } 327 }
347 else if ( serverName == LOCAL_IPKGS ) 328 else if ( serverName == LOCAL_IPKGS )
348 { 329 {
349 upgrade->setEnabled( false ); 330 downloadEnabled = FALSE;
350 download->setEnabled( true ); 331 emit appEnableUpgrade( FALSE );
351 download->setText( tr( "Remove" ) );
352 } 332 }
353 else 333 else
354 { 334 {
355 upgrade->setEnabled( true ); 335 downloadEnabled = TRUE;
356 download->setEnabled( true ); 336 emit appEnableUpgrade( TRUE );
357 download->setText( tr( "Download" ) );
358 } 337 }
338 emit appEnableDownload( downloadEnabled );
359 339
360 // Display this widget once everything is done 340 // Display this widget once everything is done
361 if ( doProgress && raiseProgress ) 341 if ( doProgress && raiseProgress )
@@ -421,7 +401,7 @@ void NetworkPackageManager :: upgradePackages()
421void NetworkPackageManager :: downloadPackage() 401void NetworkPackageManager :: downloadPackage()
422{ 402{
423 bool doUpdate = true; 403 bool doUpdate = true;
424 if ( download->text() == tr( "Download" ) ) 404 if ( downloadEnabled )
425 { 405 {
426 // See if any packages are selected 406 // See if any packages are selected
427 bool found = false; 407 bool found = false;
@@ -445,7 +425,7 @@ void NetworkPackageManager :: downloadPackage()
445 downloadRemotePackage(); 425 downloadRemotePackage();
446 426
447 } 427 }
448 else if ( download->text() == tr( "Remove" ) ) 428 else
449 { 429 {
450 doUpdate = false; 430 doUpdate = false;
451 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 431 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();