Diffstat (limited to 'noncore/settings/aqpkg/settingsimpl.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/aqpkg/settingsimpl.cpp | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/noncore/settings/aqpkg/settingsimpl.cpp b/noncore/settings/aqpkg/settingsimpl.cpp index c5a55d2..7541f0b 100644 --- a/noncore/settings/aqpkg/settingsimpl.cpp +++ b/noncore/settings/aqpkg/settingsimpl.cpp @@ -241,190 +241,192 @@ QWidget *SettingsImpl :: initProxyTab() label = new QLabel( tr( "Password:" ), container ); layout->addWidget( label, 3, 0 ); txtPassword = new QLineEdit( container ); layout->addWidget( txtPassword, 3, 1 ); QPushButton *btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), container ); connect( btn, SIGNAL( clicked() ), this, SLOT( proxyApplyChanges() ) ); layout->addMultiCellWidget( btn, 4, 4, 0, 1 ); return control; } void SettingsImpl :: setupData() { // add servers - vector<Server>::iterator it; - for ( it = dataMgr->getServerList().begin() ; it != dataMgr->getServerList().end() ; ++it ) + QString serverName; + QListIterator<Server> it( dataMgr->getServerList() ); + for ( ; it.current(); ++it ) { - if ( it->getServerName() == LOCAL_SERVER || it->getServerName() == LOCAL_IPKGS ) + serverName = it.current()->getServerName(); + if ( serverName == LOCAL_SERVER || serverName == LOCAL_IPKGS ) continue; - servers->insertItem( it->getServerName() ); + servers->insertItem( serverName ); } // add destinations - vector<Destination>::iterator it2; - for ( it2 = dataMgr->getDestinationList().begin() ; it2 != dataMgr->getDestinationList().end() ; ++it2 ) - destinations->insertItem( it2->getDestinationName() ); + QListIterator<Destination> it2( dataMgr->getDestinationList() ); + for ( ; it2.current(); ++it2 ) + destinations->insertItem( it2.current()->getDestinationName() ); // setup proxy tab txtHttpProxy->setText( dataMgr->getHttpProxy() ); txtFtpProxy->setText( dataMgr->getFtpProxy() ); txtUsername->setText( dataMgr->getProxyUsername() ); txtPassword->setText( dataMgr->getProxyPassword() ); chkHttpProxyEnabled->setChecked( dataMgr->getHttpProxyEnabled() ); chkFtpProxyEnabled->setChecked( dataMgr->getFtpProxyEnabled() ); } //------------------ Servers tab ---------------------- void SettingsImpl :: editServer( int sel ) { currentSelectedServer = sel; - vector<Server>::iterator s = dataMgr->getServer( servers->currentText() ); + Server *s = dataMgr->getServer( servers->currentText() ); serverName = s->getServerName(); servername->setText( s->getServerName() ); serverurl->setText( s->getServerUrl() ); active->setChecked( s->isServerActive() ); } void SettingsImpl :: newServer() { newserver = true; servername->setText( "" ); serverurl->setText( "" ); servername->setFocus(); active->setChecked( true ); } void SettingsImpl :: removeServer() { changed = true; - vector<Server>::iterator s = dataMgr->getServer( servers->currentText() ); - dataMgr->getServerList().erase( s ); + Server *s = dataMgr->getServer( servers->currentText() ); + dataMgr->getServerList().removeRef( s ); servers->removeItem( currentSelectedServer ); } void SettingsImpl :: changeServerDetails() { changed = true; QString newName = servername->text(); if ( !newserver ) { - vector<Server>::iterator s = dataMgr->getServer( servers->currentText() ); + Server *s = dataMgr->getServer( servers->currentText() ); // Update url s->setServerUrl( serverurl->text() ); s->setActive( active->isChecked() ); // Check if server name has changed, if it has then we need to replace the key in the map if ( serverName != newName ) { // Update server name s->setServerName( newName ); // See if this server is the active server // if ( dataMgr->getActiveServer() == serverName ) // dataMgr->setActiveServer( newName ); // Update list box servers->changeItem( newName, currentSelectedServer ); } } else { Server s( newName, serverurl->text() ); - dataMgr->getServerList().push_back( Server( newName, serverurl->text() ) ); - dataMgr->getServerList().end()->setActive( active->isChecked() ); + dataMgr->getServerList().append( new Server( newName, serverurl->text() ) ); + dataMgr->getServerList().last()->setActive( active->isChecked() ); servers->insertItem( newName ); servers->setCurrentItem( servers->count() ); newserver = false; } } //------------------ Destinations tab ---------------------- void SettingsImpl :: editDestination( int sel ) { currentSelectedDestination = sel; - vector<Destination>::iterator d = dataMgr->getDestination( destinations->currentText() ); + Destination *d = dataMgr->getDestination( destinations->currentText() ); destinationName = d->getDestinationName(); destinationname->setText( d->getDestinationName() ); destinationurl->setText( d->getDestinationPath() ); linkToRoot->setChecked( d->linkToRoot() ); } void SettingsImpl :: newDestination() { newdestination = true; destinationname->setText( "" ); destinationurl->setText( "" ); destinationname->setFocus(); linkToRoot->setChecked( true ); } void SettingsImpl :: removeDestination() { changed = true; - vector<Destination>::iterator d = dataMgr->getDestination( destinations->currentText() ); - dataMgr->getDestinationList().erase( d ); + Destination *d = dataMgr->getDestination( destinations->currentText() ); + dataMgr->getDestinationList().removeRef( d ); destinations->removeItem( currentSelectedDestination ); } void SettingsImpl :: changeDestinationDetails() { changed = true; #ifdef QWS Config cfg( "aqpkg" ); cfg.setGroup( "destinations" ); #endif QString newName = destinationname->text(); if ( !newdestination ) { - vector<Destination>::iterator d = dataMgr->getDestination( destinations->currentText() ); + Destination *d = dataMgr->getDestination( destinations->currentText() ); // Update url d->setDestinationPath( destinationurl->text() ); d->linkToRoot( linkToRoot->isChecked() ); // Check if server name has changed, if it has then we need to replace the key in the map if ( destinationName != newName ) { // Update server name d->setDestinationName( newName ); // Update list box destinations->changeItem( newName, currentSelectedDestination ); } #ifdef QWS QString key = newName; key += "_linkToRoot"; int val = d->linkToRoot(); cfg.writeEntry( key, val ); #endif } else { - dataMgr->getDestinationList().push_back( Destination( newName, destinationurl->text() ) ); + dataMgr->getDestinationList().append( new Destination( newName, destinationurl->text() ) ); destinations->insertItem( newName ); destinations->setCurrentItem( destinations->count() ); newdestination = false; #ifdef QWS QString key = newName; key += "_linkToRoot"; cfg.writeEntry( key, true ); #endif } } //------------------ Proxy tab ---------------------- void SettingsImpl :: proxyApplyChanges() { changed = true; |