summaryrefslogtreecommitdiff
path: root/noncore/settings/aqpkg/networkpkgmgr.cpp
Side-by-side diff
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
@@ -56,27 +56,24 @@ NetworkPackageManager::NetworkPackageManager( QWidget *parent, const char *name
cfg.setGroup( "settings" );
currentlySelectedServer = cfg.readEntry( "selectedServer", "local" );
showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" );
#endif
showUninstalledPkgs = false;
showInstalledPkgs = false;
showUpgradedPkgs = false;
categoryFilterEnabled = false;
initGui();
- setupConnections();
-
- //updateData();
}
NetworkPackageManager::~NetworkPackageManager()
{
}
void NetworkPackageManager :: setDataManager( DataManager *dm )
{
dataMgr = dm;
}
void NetworkPackageManager :: updateData()
@@ -138,29 +135,27 @@ void NetworkPackageManager :: selectLocalPackage( const QString &pkg )
{
item->setOn( true );
break;
}
}
}
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 );
QHBoxLayout *hbox3 = new QHBoxLayout( vbox, -1 );
QHBoxLayout *hbox4 = new QHBoxLayout( vbox, -1 );
if ( showJumpTo )
{
@@ -171,39 +166,26 @@ void NetworkPackageManager :: initGui()
text[0] = 'A' + i;
LetterPushButton *b = new LetterPushButton( text, this );
connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) );
if ( i < 13 )
hbox3->addWidget( b );
else
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 );
}
void NetworkPackageManager :: serverSelected( int, bool raiseProgress )
{
// display packages
QString serverName = serversList->currentText();
currentlySelectedServer = serverName;
@@ -331,40 +313,38 @@ void NetworkPackageManager :: serverSelected( int, bool raiseProgress )
{
if ( it->isInstalled() )
new QCheckListItem( item, QString( tr( "V. Installed - " ) ) + it->getInstalledVersion() );
}
}
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();
}
}
void NetworkPackageManager :: updateServer()
{
QString serverName = serversList->currentText();
@@ -412,49 +392,49 @@ void NetworkPackageManager :: upgradePackages()
dlg.showDlg();
// Reload data
dataMgr->reloadServerData();
serverSelected(-1);
}
}
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();
item != 0 && !found;
item = (QCheckListItem *)item->nextSibling() )
{
if ( item->isOn() )
found = true;
}
}
// If user selected some packages then download the and store the locally
// otherwise, display dialog asking user what package to download from an http server
// and whether to install it
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() )
{
if ( item->isOn() )
{
QString name = item->text();
int pos = name.find( "*" );
name.truncate( pos );