-rw-r--r-- | noncore/settings/aqpkg/settingsimpl.cpp | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/noncore/settings/aqpkg/settingsimpl.cpp b/noncore/settings/aqpkg/settingsimpl.cpp index 7541f0b..9f611da 100644 --- a/noncore/settings/aqpkg/settingsimpl.cpp +++ b/noncore/settings/aqpkg/settingsimpl.cpp | |||
@@ -311,12 +311,27 @@ void SettingsImpl :: removeServer() | |||
311 | 311 | ||
312 | void SettingsImpl :: changeServerDetails() | 312 | void SettingsImpl :: changeServerDetails() |
313 | { | 313 | { |
314 | changed = true; | 314 | changed = true; |
315 | 315 | ||
316 | QString newName = servername->text(); | 316 | QString newName = servername->text(); |
317 | |||
318 | // Convert any spaces to underscores | ||
319 | char *tmpStr = new char[newName.length() + 1]; | ||
320 | for ( unsigned int i = 0 ; i < newName.length() ; ++i ) | ||
321 | { | ||
322 | if ( newName[i] == ' ' ) | ||
323 | tmpStr[i] = '_'; | ||
324 | else | ||
325 | tmpStr[i] = newName[i].latin1(); | ||
326 | } | ||
327 | tmpStr[newName.length()] = '\0'; | ||
328 | |||
329 | newName = tmpStr; | ||
330 | delete tmpStr; | ||
331 | |||
317 | if ( !newserver ) | 332 | if ( !newserver ) |
318 | { | 333 | { |
319 | Server *s = dataMgr->getServer( servers->currentText() ); | 334 | Server *s = dataMgr->getServer( servers->currentText() ); |
320 | 335 | ||
321 | // Update url | 336 | // Update url |
322 | s->setServerUrl( serverurl->text() ); | 337 | s->setServerUrl( serverurl->text() ); |
@@ -325,20 +340,16 @@ void SettingsImpl :: changeServerDetails() | |||
325 | 340 | ||
326 | // Check if server name has changed, if it has then we need to replace the key in the map | 341 | // Check if server name has changed, if it has then we need to replace the key in the map |
327 | if ( serverName != newName ) | 342 | if ( serverName != newName ) |
328 | { | 343 | { |
329 | // Update server name | 344 | // Update server name |
330 | s->setServerName( newName ); | 345 | s->setServerName( newName ); |
331 | |||
332 | // See if this server is the active server | ||
333 | // if ( dataMgr->getActiveServer() == serverName ) | ||
334 | // dataMgr->setActiveServer( newName ); | ||
335 | |||
336 | // Update list box | ||
337 | servers->changeItem( newName, currentSelectedServer ); | ||
338 | } | 346 | } |
347 | |||
348 | // Update list box | ||
349 | servers->changeItem( newName, currentSelectedServer ); | ||
339 | } | 350 | } |
340 | else | 351 | else |
341 | { | 352 | { |
342 | Server s( newName, serverurl->text() ); | 353 | Server s( newName, serverurl->text() ); |
343 | dataMgr->getServerList().append( new Server( newName, serverurl->text() ) ); | 354 | dataMgr->getServerList().append( new Server( newName, serverurl->text() ) ); |
344 | dataMgr->getServerList().last()->setActive( active->isChecked() ); | 355 | dataMgr->getServerList().last()->setActive( active->isChecked() ); |