summaryrefslogtreecommitdiff
authorandyq <andyq>2003-02-10 18:20:16 (UTC)
committer andyq <andyq>2003-02-10 18:20:16 (UTC)
commit2bc5aaa5c480c2b8924593f1010c7efd3bd50693 (patch) (unidiff)
tree1009b6d88a7773a59d4742a1376cafe1a4729b02
parentee2434f70b0dbc88072748a52b353ab226669a47 (diff)
downloadopie-2bc5aaa5c480c2b8924593f1010c7efd3bd50693.zip
opie-2bc5aaa5c480c2b8924593f1010c7efd3bd50693.tar.gz
opie-2bc5aaa5c480c2b8924593f1010c7efd3bd50693.tar.bz2
Fixed bug where feed names could have spaces in them
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/settingsimpl.cpp25
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
@@ -269,118 +269,129 @@ void SettingsImpl :: setupData()
269 // add destinations 269 // add destinations
270 QListIterator<Destination> it2( dataMgr->getDestinationList() ); 270 QListIterator<Destination> it2( dataMgr->getDestinationList() );
271 for ( ; it2.current(); ++it2 ) 271 for ( ; it2.current(); ++it2 )
272 destinations->insertItem( it2.current()->getDestinationName() ); 272 destinations->insertItem( it2.current()->getDestinationName() );
273 273
274 // setup proxy tab 274 // setup proxy tab
275 txtHttpProxy->setText( dataMgr->getHttpProxy() ); 275 txtHttpProxy->setText( dataMgr->getHttpProxy() );
276 txtFtpProxy->setText( dataMgr->getFtpProxy() ); 276 txtFtpProxy->setText( dataMgr->getFtpProxy() );
277 txtUsername->setText( dataMgr->getProxyUsername() ); 277 txtUsername->setText( dataMgr->getProxyUsername() );
278 txtPassword->setText( dataMgr->getProxyPassword() ); 278 txtPassword->setText( dataMgr->getProxyPassword() );
279 chkHttpProxyEnabled->setChecked( dataMgr->getHttpProxyEnabled() ); 279 chkHttpProxyEnabled->setChecked( dataMgr->getHttpProxyEnabled() );
280 chkFtpProxyEnabled->setChecked( dataMgr->getFtpProxyEnabled() ); 280 chkFtpProxyEnabled->setChecked( dataMgr->getFtpProxyEnabled() );
281} 281}
282 282
283//------------------ Servers tab ---------------------- 283//------------------ Servers tab ----------------------
284 284
285void SettingsImpl :: editServer( int sel ) 285void SettingsImpl :: editServer( int sel )
286{ 286{
287 currentSelectedServer = sel; 287 currentSelectedServer = sel;
288 Server *s = dataMgr->getServer( servers->currentText() ); 288 Server *s = dataMgr->getServer( servers->currentText() );
289 serverName = s->getServerName(); 289 serverName = s->getServerName();
290 servername->setText( s->getServerName() ); 290 servername->setText( s->getServerName() );
291 serverurl->setText( s->getServerUrl() ); 291 serverurl->setText( s->getServerUrl() );
292 active->setChecked( s->isServerActive() ); 292 active->setChecked( s->isServerActive() );
293} 293}
294 294
295void SettingsImpl :: newServer() 295void SettingsImpl :: newServer()
296{ 296{
297 newserver = true; 297 newserver = true;
298 servername->setText( "" ); 298 servername->setText( "" );
299 serverurl->setText( "" ); 299 serverurl->setText( "" );
300 servername->setFocus(); 300 servername->setFocus();
301 active->setChecked( true ); 301 active->setChecked( true );
302} 302}
303 303
304void SettingsImpl :: removeServer() 304void SettingsImpl :: removeServer()
305{ 305{
306 changed = true; 306 changed = true;
307 Server *s = dataMgr->getServer( servers->currentText() ); 307 Server *s = dataMgr->getServer( servers->currentText() );
308 dataMgr->getServerList().removeRef( s ); 308 dataMgr->getServerList().removeRef( s );
309 servers->removeItem( currentSelectedServer ); 309 servers->removeItem( currentSelectedServer );
310} 310}
311 311
312void SettingsImpl :: changeServerDetails() 312void 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() );
323 s->setActive( active->isChecked() ); 338 s->setActive( active->isChecked() );
324 339
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() );
345 servers->insertItem( newName ); 356 servers->insertItem( newName );
346 servers->setCurrentItem( servers->count() ); 357 servers->setCurrentItem( servers->count() );
347 newserver = false; 358 newserver = false;
348 } 359 }
349} 360}
350 361
351//------------------ Destinations tab ---------------------- 362//------------------ Destinations tab ----------------------
352 363
353void SettingsImpl :: editDestination( int sel ) 364void SettingsImpl :: editDestination( int sel )
354{ 365{
355 currentSelectedDestination = sel; 366 currentSelectedDestination = sel;
356 Destination *d = dataMgr->getDestination( destinations->currentText() ); 367 Destination *d = dataMgr->getDestination( destinations->currentText() );
357 destinationName = d->getDestinationName(); 368 destinationName = d->getDestinationName();
358 destinationname->setText( d->getDestinationName() ); 369 destinationname->setText( d->getDestinationName() );
359 destinationurl->setText( d->getDestinationPath() ); 370 destinationurl->setText( d->getDestinationPath() );
360 linkToRoot->setChecked( d->linkToRoot() ); 371 linkToRoot->setChecked( d->linkToRoot() );
361} 372}
362 373
363void SettingsImpl :: newDestination() 374void SettingsImpl :: newDestination()
364{ 375{
365 newdestination = true; 376 newdestination = true;
366 destinationname->setText( "" ); 377 destinationname->setText( "" );
367 destinationurl->setText( "" ); 378 destinationurl->setText( "" );
368 destinationname->setFocus(); 379 destinationname->setFocus();
369 linkToRoot->setChecked( true ); 380 linkToRoot->setChecked( true );
370} 381}
371 382
372void SettingsImpl :: removeDestination() 383void SettingsImpl :: removeDestination()
373{ 384{
374 changed = true; 385 changed = true;
375 Destination *d = dataMgr->getDestination( destinations->currentText() ); 386 Destination *d = dataMgr->getDestination( destinations->currentText() );
376 dataMgr->getDestinationList().removeRef( d ); 387 dataMgr->getDestinationList().removeRef( d );
377 destinations->removeItem( currentSelectedDestination ); 388 destinations->removeItem( currentSelectedDestination );
378} 389}
379 390
380void SettingsImpl :: changeDestinationDetails() 391void SettingsImpl :: changeDestinationDetails()
381{ 392{
382 changed = true; 393 changed = true;
383 394
384#ifdef QWS 395#ifdef QWS
385 Config cfg( "aqpkg" ); 396 Config cfg( "aqpkg" );
386 cfg.setGroup( "destinations" ); 397 cfg.setGroup( "destinations" );