summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/aqpkg/settingsimpl.cpp36
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
@@ -283,17 +283,27 @@ void SettingsImpl :: setupData()
//------------------ Servers tab ----------------------
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()
{
newserver = true;
servername->setText( "" );
serverurl->setText( "" );
@@ -302,15 +312,18 @@ void SettingsImpl :: newServer()
}
void SettingsImpl :: removeServer()
{
changed = true;
Server *s = dataMgr->getServer( servers->currentText() );
+ if ( s )
+ {
dataMgr->getServerList().removeRef( s );
servers->removeItem( currentSelectedServer );
}
+}
void SettingsImpl :: changeServerDetails()
{
changed = true;
QString newName = servername->text();
@@ -329,28 +342,29 @@ void SettingsImpl :: changeServerDetails()
newName = tmpStr;
delete tmpStr;
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 )
{
// Update server name
s->setServerName( newName );
}
// Update list box
servers->changeItem( newName, currentSelectedServer );
}
+ }
else
{
Server s( newName, serverurl->text() );
dataMgr->getServerList().append( new Server( newName, serverurl->text() ) );
dataMgr->getServerList().last()->setActive( active->isChecked() );
servers->insertItem( newName );
@@ -362,17 +376,27 @@ void SettingsImpl :: changeServerDetails()
//------------------ Destinations tab ----------------------
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()
{
newdestination = true;
destinationname->setText( "" );
destinationurl->setText( "" );
@@ -381,15 +405,18 @@ void SettingsImpl :: newDestination()
}
void SettingsImpl :: removeDestination()
{
changed = true;
Destination *d = dataMgr->getDestination( destinations->currentText() );
+ if ( d )
+ {
dataMgr->getDestinationList().removeRef( d );
destinations->removeItem( currentSelectedDestination );
}
+}
void SettingsImpl :: changeDestinationDetails()
{
changed = true;
#ifdef QWS
@@ -398,13 +425,14 @@ void SettingsImpl :: changeDestinationDetails()
#endif
QString newName = destinationname->text();
if ( !newdestination )
{
Destination *d = dataMgr->getDestination( destinations->currentText() );
-
+ if ( d )
+ {
// 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 )
@@ -412,19 +440,21 @@ void SettingsImpl :: changeDestinationDetails()
// 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().append( new Destination( newName, destinationurl->text() ) );
destinations->insertItem( newName );
destinations->setCurrentItem( destinations->count() );
newdestination = false;