Diffstat (limited to 'noncore/settings/aqpkg/networkpkgmgr.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/aqpkg/networkpkgmgr.cpp | 44 |
1 files changed, 12 insertions, 32 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 | |||
62 | showUninstalledPkgs = false; | 62 | showUninstalledPkgs = false; |
63 | showInstalledPkgs = false; | 63 | showInstalledPkgs = false; |
64 | showUpgradedPkgs = false; | 64 | showUpgradedPkgs = false; |
65 | categoryFilterEnabled = false; | 65 | categoryFilterEnabled = false; |
66 | 66 | ||
67 | initGui(); | 67 | initGui(); |
68 | setupConnections(); | ||
69 | |||
70 | //updateData(); | ||
71 | } | 68 | } |
72 | 69 | ||
73 | NetworkPackageManager::~NetworkPackageManager() | 70 | NetworkPackageManager::~NetworkPackageManager() |
74 | { | 71 | { |
75 | } | 72 | } |
76 | 73 | ||
@@ -144,17 +141,15 @@ void NetworkPackageManager :: selectLocalPackage( const QString &pkg ) | |||
144 | 141 | ||
145 | 142 | ||
146 | void NetworkPackageManager :: initGui() | 143 | 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 ); |
158 | hbox1->addWidget( l ); | 153 | hbox1->addWidget( l ); |
159 | hbox1->addWidget( serversList ); | 154 | hbox1->addWidget( serversList ); |
160 | 155 | ||
@@ -178,26 +173,13 @@ void NetworkPackageManager :: initGui() | |||
178 | } | 173 | } |
179 | } | 174 | } |
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 | |||
191 | void 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 | ||
200 | void NetworkPackageManager :: serverSelected( int index ) | 182 | void NetworkPackageManager :: serverSelected( int index ) |
201 | { | 183 | { |
202 | serverSelected( index, TRUE ); | 184 | serverSelected( index, TRUE ); |
203 | } | 185 | } |
@@ -337,28 +319,26 @@ void NetworkPackageManager :: serverSelected( int, bool raiseProgress ) | |||
337 | packagesList->insertItem( item ); | 319 | packagesList->insertItem( item ); |
338 | } | 320 | } |
339 | 321 | ||
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 ) |
362 | { | 342 | { |
363 | emit appRaiseMainWidget(); | 343 | emit appRaiseMainWidget(); |
364 | } | 344 | } |
@@ -418,13 +398,13 @@ void NetworkPackageManager :: upgradePackages() | |||
418 | } | 398 | } |
419 | 399 | ||
420 | 400 | ||
421 | void NetworkPackageManager :: downloadPackage() | 401 | void 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; |
428 | if ( serversList->currentText() != LOCAL_SERVER ) | 408 | if ( serversList->currentText() != LOCAL_SERVER ) |
429 | { | 409 | { |
430 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); | 410 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); |
@@ -442,13 +422,13 @@ void NetworkPackageManager :: downloadPackage() | |||
442 | if ( found ) | 422 | if ( found ) |
443 | downloadSelectedPackages(); | 423 | downloadSelectedPackages(); |
444 | else | 424 | else |
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(); |
452 | item != 0 ; | 432 | item != 0 ; |
453 | item = (QCheckListItem *)item->nextSibling() ) | 433 | item = (QCheckListItem *)item->nextSibling() ) |
454 | { | 434 | { |