author | andyq <andyq> | 2003-02-10 18:20:16 (UTC) |
---|---|---|
committer | andyq <andyq> | 2003-02-10 18:20:16 (UTC) |
commit | 2bc5aaa5c480c2b8924593f1010c7efd3bd50693 (patch) (side-by-side diff) | |
tree | 1009b6d88a7773a59d4742a1376cafe1a4729b02 | |
parent | ee2434f70b0dbc88072748a52b353ab226669a47 (diff) | |
download | opie-2bc5aaa5c480c2b8924593f1010c7efd3bd50693.zip opie-2bc5aaa5c480c2b8924593f1010c7efd3bd50693.tar.gz opie-2bc5aaa5c480c2b8924593f1010c7efd3bd50693.tar.bz2 |
Fixed bug where feed names could have spaces in them
-rw-r--r-- | noncore/settings/aqpkg/settingsimpl.cpp | 21 |
1 files changed, 16 insertions, 5 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 @@ -293,71 +293,82 @@ void SettingsImpl :: editServer( int sel ) } void SettingsImpl :: newServer() { newserver = true; servername->setText( "" ); serverurl->setText( "" ); servername->setFocus(); active->setChecked( true ); } void SettingsImpl :: removeServer() { changed = true; Server *s = dataMgr->getServer( servers->currentText() ); dataMgr->getServerList().removeRef( s ); servers->removeItem( currentSelectedServer ); } void SettingsImpl :: changeServerDetails() { changed = true; QString newName = servername->text(); + + // Convert any spaces to underscores + char *tmpStr = new char[newName.length() + 1]; + for ( unsigned int i = 0 ; i < newName.length() ; ++i ) + { + if ( newName[i] == ' ' ) + tmpStr[i] = '_'; + else + tmpStr[i] = newName[i].latin1(); + } + tmpStr[newName.length()] = '\0'; + + newName = tmpStr; + delete tmpStr; + if ( !newserver ) { 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().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; Destination *d = dataMgr->getDestination( destinations->currentText() ); destinationName = d->getDestinationName(); destinationname->setText( d->getDestinationName() ); destinationurl->setText( d->getDestinationPath() ); linkToRoot->setChecked( d->linkToRoot() ); } void SettingsImpl :: newDestination() |