summaryrefslogtreecommitdiff
authorandyq <andyq>2002-10-16 23:08:56 (UTC)
committer andyq <andyq>2002-10-16 23:08:56 (UTC)
commitb1d16660979fa8bb767fa0a6fe2d966e5633abdc (patch) (side-by-side diff)
tree42390cc528f61bd44c0de7084d0fed8000bc10c4
parent593fe744126a398e2714070137b6f19e398d2c9d (diff)
downloadopie-b1d16660979fa8bb767fa0a6fe2d966e5633abdc.zip
opie-b1d16660979fa8bb767fa0a6fe2d966e5633abdc.tar.gz
opie-b1d16660979fa8bb767fa0a6fe2d966e5633abdc.tar.bz2
Handles commented servers nicely
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp
index 318b26d..3ce7960 100644
--- a/noncore/settings/aqpkg/networkpkgmgr.cpp
+++ b/noncore/settings/aqpkg/networkpkgmgr.cpp
@@ -38,101 +38,107 @@ using namespace std;
#include "networkpkgmgr.h"
#include "installdlgimpl.h"
#include "ipkg.h"
#include "inputdlg.h"
#include "letterpushbutton.h"
#include "global.h"
NetworkPackageManager::NetworkPackageManager( DataManager *dataManager, QWidget *parent, const char *name)
: QWidget(parent, name)
{
dataMgr = dataManager;
#ifdef QWS
// read download directory from config file
Config cfg( "aqpkg" );
cfg.setGroup( "settings" );
currentlySelectedServer = cfg.readEntry( "selectedServer", "local" );
#endif
initGui();
setupConnections();
progressDlg = 0;
timerId = startTimer( 100 );
}
NetworkPackageManager::~NetworkPackageManager()
{
}
void NetworkPackageManager :: timerEvent ( QTimerEvent * )
{
killTimer( timerId );
// showProgressDialog();
// Add server names to listbox
updateData();
// progressDlg->hide();
}
void NetworkPackageManager :: updateData()
{
serversList->clear();
packagesList->clear();
+
vector<Server>::iterator it;
int activeItem = -1;
int i;
for ( i = 0, it = dataMgr->getServerList().begin() ; it != dataMgr->getServerList().end() ; ++it, ++i )
{
+ if ( !it->isServerActive() )
+ {
+ i--;
+ continue;
+ }
serversList->insertItem( it->getServerName() );
if ( it->getServerName() == currentlySelectedServer )
activeItem = i;
}
// set selected server to be active server
if ( activeItem != -1 )
serversList->setCurrentItem( activeItem );
serverSelected( 0 );
}
void NetworkPackageManager :: initGui()
{
QLabel *l = new QLabel( "Servers", this );
serversList = new QComboBox( this );
packagesList = new QListView( this );
update = new QPushButton( "Refresh List", this );
download = new QPushButton( "Download", this );
upgrade = new QPushButton( "Upgrade", this );
apply = new QPushButton( "Apply", this );
QVBoxLayout *vbox = new QVBoxLayout( this, 0, -1, "VBox" );
QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1, "HBox1" );
hbox1->addWidget( l );
hbox1->addWidget( serversList );
QHBoxLayout *hbox3 = new QHBoxLayout( vbox, -1, "HBox1" );
QHBoxLayout *hbox4 = new QHBoxLayout( vbox, -1, "HBox1" );
char text[2];
text[1] = '\0';
for ( int i = 0 ; i < 26 ; ++i )
{
text[0] = 'A' + i;
LetterPushButton *b = new LetterPushButton( text, this );
connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) );
if ( i < 16 )
hbox3->addWidget( b );
else
hbox4->addWidget( b );
}
vbox->addWidget( packagesList );
packagesList->addColumn( "Packages" );
QHBoxLayout *hbox2 = new QHBoxLayout( vbox, -1, "HBox2" );
hbox2->addWidget( update );