-rw-r--r-- | noncore/settings/aqpkg/settingsimpl.cpp | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/noncore/settings/aqpkg/settingsimpl.cpp b/noncore/settings/aqpkg/settingsimpl.cpp index 9f611da..e2afada 100644 --- a/noncore/settings/aqpkg/settingsimpl.cpp +++ b/noncore/settings/aqpkg/settingsimpl.cpp @@ -286,11 +286,21 @@ void SettingsImpl :: editServer( int sel ) { currentSelectedServer = sel; Server *s = dataMgr->getServer( servers->currentText() ); + if ( s ) + { serverName = s->getServerName(); servername->setText( s->getServerName() ); serverurl->setText( s->getServerUrl() ); active->setChecked( s->isServerActive() ); } + else + { + serverName = ""; + servername->setText( "" ); + serverurl->setText( "" ); + active->setChecked( false ); + } +} void SettingsImpl :: newServer() { @@ -305,9 +315,12 @@ void SettingsImpl :: removeServer() { changed = true; Server *s = dataMgr->getServer( servers->currentText() ); + if ( s ) + { dataMgr->getServerList().removeRef( s ); servers->removeItem( currentSelectedServer ); } +} void SettingsImpl :: changeServerDetails() { @@ -332,12 +345,12 @@ void SettingsImpl :: changeServerDetails() if ( !newserver ) { Server *s = dataMgr->getServer( servers->currentText() ); - + if ( s ) + { // 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 ) { @@ -348,6 +361,7 @@ void SettingsImpl :: changeServerDetails() // Update list box servers->changeItem( newName, currentSelectedServer ); } + } else { Server s( newName, serverurl->text() ); @@ -365,11 +379,21 @@ void SettingsImpl :: editDestination( int sel ) { currentSelectedDestination = sel; Destination *d = dataMgr->getDestination( destinations->currentText() ); + if ( d ) + { destinationName = d->getDestinationName(); destinationname->setText( d->getDestinationName() ); destinationurl->setText( d->getDestinationPath() ); linkToRoot->setChecked( d->linkToRoot() ); } + else + { + destinationName = ""; + destinationname->setText( "" ); + destinationurl->setText( "" ); + linkToRoot->setChecked( false ); + } +} void SettingsImpl :: newDestination() { @@ -384,9 +408,12 @@ void SettingsImpl :: removeDestination() { changed = true; Destination *d = dataMgr->getDestination( destinations->currentText() ); + if ( d ) + { dataMgr->getDestinationList().removeRef( d ); destinations->removeItem( currentSelectedDestination ); } +} void SettingsImpl :: changeDestinationDetails() { @@ -401,7 +428,8 @@ void SettingsImpl :: changeDestinationDetails() if ( !newdestination ) { Destination *d = dataMgr->getDestination( destinations->currentText() ); - + if ( d ) + { // Update url d->setDestinationPath( destinationurl->text() ); d->linkToRoot( linkToRoot->isChecked() ); @@ -415,6 +443,7 @@ void SettingsImpl :: changeDestinationDetails() // Update list box destinations->changeItem( newName, currentSelectedDestination ); } + #ifdef QWS QString key = newName; key += "_linkToRoot"; @@ -422,6 +451,7 @@ void SettingsImpl :: changeDestinationDetails() cfg.writeEntry( key, val ); #endif } + } else { dataMgr->getDestinationList().append( new Destination( newName, destinationurl->text() ) ); |