author | drw <drw> | 2004-11-16 17:52:25 (UTC) |
---|---|---|
committer | drw <drw> | 2004-11-16 17:52:25 (UTC) |
commit | e83f5b12337c22f365323aa00806b638a971e3a2 (patch) (unidiff) | |
tree | fc9c4a34ffc7c2400ccd373f6947626cded6075f | |
parent | 3ba09273d96a32263bb22bfbc32fcc6290bde6e8 (diff) | |
download | opie-e83f5b12337c22f365323aa00806b638a971e3a2.zip opie-e83f5b12337c22f365323aa00806b638a971e3a2.tar.gz opie-e83f5b12337c22f365323aa00806b638a971e3a2.tar.bz2 |
Minor UI tweak - fix double entry in source feed configuration when adding a new feed
-rw-r--r-- | noncore/settings/packagemanager/oipkgconfigdlg.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/settings/packagemanager/oipkgconfigdlg.cpp b/noncore/settings/packagemanager/oipkgconfigdlg.cpp index ea0aef0..25052f8 100644 --- a/noncore/settings/packagemanager/oipkgconfigdlg.cpp +++ b/noncore/settings/packagemanager/oipkgconfigdlg.cpp | |||
@@ -354,288 +354,288 @@ void OIpkgConfigDlg::initOptionsWidget() | |||
354 | layout->addWidget( m_optForceDepends ); | 354 | layout->addWidget( m_optForceDepends ); |
355 | 355 | ||
356 | m_optForceReinstall = new QCheckBox( tr( "Force Reinstall" ), container ); | 356 | m_optForceReinstall = new QCheckBox( tr( "Force Reinstall" ), container ); |
357 | QWhatsThis::add( m_optForceReinstall, tr( "Tap here to enable or disable the '-force-reinstall' option for Ipkg." ) ); | 357 | QWhatsThis::add( m_optForceReinstall, tr( "Tap here to enable or disable the '-force-reinstall' option for Ipkg." ) ); |
358 | layout->addWidget( m_optForceReinstall ); | 358 | layout->addWidget( m_optForceReinstall ); |
359 | 359 | ||
360 | m_optForceRemove = new QCheckBox( tr( "Force Remove" ), container ); | 360 | m_optForceRemove = new QCheckBox( tr( "Force Remove" ), container ); |
361 | QWhatsThis::add( m_optForceRemove, tr( "Tap here to enable or disable the '-force-removal-of-dependent-packages' option for Ipkg." ) ); | 361 | QWhatsThis::add( m_optForceRemove, tr( "Tap here to enable or disable the '-force-removal-of-dependent-packages' option for Ipkg." ) ); |
362 | layout->addWidget( m_optForceRemove ); | 362 | layout->addWidget( m_optForceRemove ); |
363 | 363 | ||
364 | m_optForceOverwrite = new QCheckBox( tr( "Force Overwrite" ), container ); | 364 | m_optForceOverwrite = new QCheckBox( tr( "Force Overwrite" ), container ); |
365 | QWhatsThis::add( m_optForceOverwrite, tr( "Tap here to enable or disable the '-force-overwrite' option for Ipkg." ) ); | 365 | QWhatsThis::add( m_optForceOverwrite, tr( "Tap here to enable or disable the '-force-overwrite' option for Ipkg." ) ); |
366 | layout->addWidget( m_optForceOverwrite ); | 366 | layout->addWidget( m_optForceOverwrite ); |
367 | 367 | ||
368 | QLabel *l = new QLabel( tr( "Information Level" ), container ); | 368 | QLabel *l = new QLabel( tr( "Information Level" ), container ); |
369 | QWhatsThis::add( l, tr( "Select information level for Ipkg." ) ); | 369 | QWhatsThis::add( l, tr( "Select information level for Ipkg." ) ); |
370 | layout->addWidget( l ); | 370 | layout->addWidget( l ); |
371 | 371 | ||
372 | m_optVerboseIpkg = new QComboBox( container ); | 372 | m_optVerboseIpkg = new QComboBox( container ); |
373 | QWhatsThis::add( m_optVerboseIpkg, tr( "Select information level for Ipkg." ) ); | 373 | QWhatsThis::add( m_optVerboseIpkg, tr( "Select information level for Ipkg." ) ); |
374 | m_optVerboseIpkg->insertItem( tr( "Errors only" ) ); | 374 | m_optVerboseIpkg->insertItem( tr( "Errors only" ) ); |
375 | m_optVerboseIpkg->insertItem( tr( "Normal messages" ) ); | 375 | m_optVerboseIpkg->insertItem( tr( "Normal messages" ) ); |
376 | m_optVerboseIpkg->insertItem( tr( "Informative messages" ) ); | 376 | m_optVerboseIpkg->insertItem( tr( "Informative messages" ) ); |
377 | m_optVerboseIpkg->insertItem( tr( "Troubleshooting output" ) ); | 377 | m_optVerboseIpkg->insertItem( tr( "Troubleshooting output" ) ); |
378 | layout->addWidget( m_optVerboseIpkg ); | 378 | layout->addWidget( m_optVerboseIpkg ); |
379 | 379 | ||
380 | layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); | 380 | layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); |
381 | } | 381 | } |
382 | 382 | ||
383 | void OIpkgConfigDlg::initData() | 383 | void OIpkgConfigDlg::initData() |
384 | { | 384 | { |
385 | // Read ipkg configuration (server/destination/proxy) information | 385 | // Read ipkg configuration (server/destination/proxy) information |
386 | if ( m_ipkg && !m_installOptions ) | 386 | if ( m_ipkg && !m_installOptions ) |
387 | { | 387 | { |
388 | m_configs = m_ipkg->configItems(); | 388 | m_configs = m_ipkg->configItems(); |
389 | if ( m_configs ) | 389 | if ( m_configs ) |
390 | { | 390 | { |
391 | for ( OConfItemListIterator configIt( *m_configs ); configIt.current(); ++configIt ) | 391 | for ( OConfItemListIterator configIt( *m_configs ); configIt.current(); ++configIt ) |
392 | { | 392 | { |
393 | OConfItem *config = configIt.current(); | 393 | OConfItem *config = configIt.current(); |
394 | 394 | ||
395 | // Add configuration item to the appropriate dialog controls | 395 | // Add configuration item to the appropriate dialog controls |
396 | if ( config ) | 396 | if ( config ) |
397 | { | 397 | { |
398 | if ( config->type() == OConfItem::Source ) | 398 | if ( config->type() == OConfItem::Source ) |
399 | { | 399 | { |
400 | m_serverList->insertItem( config->name() ); | 400 | m_serverList->insertItem( config->name() ); |
401 | } | 401 | } |
402 | else if ( config->type() == OConfItem::Destination ) | 402 | else if ( config->type() == OConfItem::Destination ) |
403 | { | 403 | { |
404 | m_destList->insertItem( config->name() ); | 404 | m_destList->insertItem( config->name() ); |
405 | } | 405 | } |
406 | else if ( config->type() == OConfItem::Option ) | 406 | else if ( config->type() == OConfItem::Option ) |
407 | { | 407 | { |
408 | if ( config->name() == "http_proxy" ) | 408 | if ( config->name() == "http_proxy" ) |
409 | { | 409 | { |
410 | m_proxyHttpServer->setText( config->value() ); | 410 | m_proxyHttpServer->setText( config->value() ); |
411 | m_proxyHttpActive->setChecked( config->active() ); | 411 | m_proxyHttpActive->setChecked( config->active() ); |
412 | } | 412 | } |
413 | else if ( config->name() == "ftp_proxy" ) | 413 | else if ( config->name() == "ftp_proxy" ) |
414 | { | 414 | { |
415 | m_proxyFtpServer->setText( config->value() ); | 415 | m_proxyFtpServer->setText( config->value() ); |
416 | m_proxyFtpActive->setChecked( config->active() ); | 416 | m_proxyFtpActive->setChecked( config->active() ); |
417 | } | 417 | } |
418 | else if ( config->name() == "proxy_username" ) | 418 | else if ( config->name() == "proxy_username" ) |
419 | { | 419 | { |
420 | m_proxyUsername->setText( config->value() ); | 420 | m_proxyUsername->setText( config->value() ); |
421 | } | 421 | } |
422 | else if ( config->name() == "proxy_password" ) | 422 | else if ( config->name() == "proxy_password" ) |
423 | { | 423 | { |
424 | m_proxyPassword->setText( config->value() ); | 424 | m_proxyPassword->setText( config->value() ); |
425 | } | 425 | } |
426 | } | 426 | } |
427 | } | 427 | } |
428 | } | 428 | } |
429 | } | 429 | } |
430 | } | 430 | } |
431 | 431 | ||
432 | // Get Ipkg execution options | 432 | // Get Ipkg execution options |
433 | int options = m_ipkg->ipkgExecOptions(); | 433 | int options = m_ipkg->ipkgExecOptions(); |
434 | if ( options & FORCE_DEPENDS ) | 434 | if ( options & FORCE_DEPENDS ) |
435 | m_optForceDepends->setChecked( true ); | 435 | m_optForceDepends->setChecked( true ); |
436 | if ( options & FORCE_REINSTALL ) | 436 | if ( options & FORCE_REINSTALL ) |
437 | m_optForceReinstall->setChecked( true ); | 437 | m_optForceReinstall->setChecked( true ); |
438 | if ( options & FORCE_REMOVE ) | 438 | if ( options & FORCE_REMOVE ) |
439 | m_optForceRemove->setChecked( true ); | 439 | m_optForceRemove->setChecked( true ); |
440 | if ( options & FORCE_OVERWRITE ) | 440 | if ( options & FORCE_OVERWRITE ) |
441 | m_optForceOverwrite->setChecked( true ); | 441 | m_optForceOverwrite->setChecked( true ); |
442 | 442 | ||
443 | m_optVerboseIpkg->setCurrentItem( m_ipkg->ipkgExecVerbosity() ); | 443 | m_optVerboseIpkg->setCurrentItem( m_ipkg->ipkgExecVerbosity() ); |
444 | } | 444 | } |
445 | 445 | ||
446 | OConfItem *OIpkgConfigDlg::findConfItem( OConfItem::Type type, const QString &name ) | 446 | OConfItem *OIpkgConfigDlg::findConfItem( OConfItem::Type type, const QString &name ) |
447 | { | 447 | { |
448 | // Find selected server in list | 448 | // Find selected server in list |
449 | OConfItemListIterator configIt( *m_configs ); | 449 | OConfItemListIterator configIt( *m_configs ); |
450 | OConfItem *config = 0x0; | 450 | OConfItem *config = 0x0; |
451 | for ( ; configIt.current(); ++configIt ) | 451 | for ( ; configIt.current(); ++configIt ) |
452 | { | 452 | { |
453 | config = configIt.current(); | 453 | config = configIt.current(); |
454 | if ( config->type() == type && config->name() == name ) | 454 | if ( config->type() == type && config->name() == name ) |
455 | break; | 455 | break; |
456 | } | 456 | } |
457 | 457 | ||
458 | if ( config && config->type() == type && config->name() == name ) | 458 | if ( config && config->type() == type && config->name() == name ) |
459 | return config; | 459 | return config; |
460 | 460 | ||
461 | return 0x0; | 461 | return 0x0; |
462 | } | 462 | } |
463 | 463 | ||
464 | void OIpkgConfigDlg::slotServerEdit( int index ) | 464 | void OIpkgConfigDlg::slotServerEdit( int index ) |
465 | { | 465 | { |
466 | m_serverNew = false; | 466 | m_serverNew = false; |
467 | m_serverCurrent = index; | 467 | m_serverCurrent = index; |
468 | 468 | ||
469 | // Find selected server in list | 469 | // Find selected server in list |
470 | OConfItem *server = findConfItem( OConfItem::Source, m_serverList->currentText() ); | 470 | OConfItem *server = findConfItem( OConfItem::Source, m_serverList->currentText() ); |
471 | 471 | ||
472 | // Display server details | 472 | // Display server details |
473 | if ( server ) | 473 | if ( server ) |
474 | { | 474 | { |
475 | m_serverCurrName = server->name(); | 475 | m_serverCurrName = server->name(); |
476 | m_serverName->setText( server->name() ); | 476 | m_serverName->setText( server->name() ); |
477 | m_serverLocation->setText( server->value() ); | 477 | m_serverLocation->setText( server->value() ); |
478 | m_serverActive->setChecked( server->active() ); | 478 | m_serverActive->setChecked( server->active() ); |
479 | m_serverName->setFocus(); | 479 | m_serverName->setFocus(); |
480 | } | 480 | } |
481 | } | 481 | } |
482 | 482 | ||
483 | void OIpkgConfigDlg::slotServerNew() | 483 | void OIpkgConfigDlg::slotServerNew() |
484 | { | 484 | { |
485 | m_serverNew = true; | 485 | m_serverNew = true; |
486 | 486 | ||
487 | m_serverName->setText( QString::null ); | 487 | m_serverName->setText( QString::null ); |
488 | m_serverLocation->setText( QString::null ); | 488 | m_serverLocation->setText( QString::null ); |
489 | m_serverActive->setChecked( true ); | 489 | m_serverActive->setChecked( true ); |
490 | m_serverName->setFocus(); | 490 | m_serverName->setFocus(); |
491 | } | 491 | } |
492 | 492 | ||
493 | void OIpkgConfigDlg::slotServerDelete() | 493 | void OIpkgConfigDlg::slotServerDelete() |
494 | { | 494 | { |
495 | // Find selected server in list | 495 | // Find selected server in list |
496 | OConfItem *server = findConfItem( OConfItem::Source, m_serverList->currentText() ); | 496 | OConfItem *server = findConfItem( OConfItem::Source, m_serverList->currentText() ); |
497 | 497 | ||
498 | // Delete server | 498 | // Delete server |
499 | if ( server ) | 499 | if ( server ) |
500 | { | 500 | { |
501 | m_configs->removeRef( server ); | 501 | m_configs->removeRef( server ); |
502 | m_serverList->removeItem( m_serverCurrent ); | 502 | m_serverList->removeItem( m_serverCurrent ); |
503 | } | 503 | } |
504 | } | 504 | } |
505 | 505 | ||
506 | void OIpkgConfigDlg::slotServerUpdate() | 506 | void OIpkgConfigDlg::slotServerUpdate() |
507 | { | 507 | { |
508 | QString newName = m_serverName->text(); | 508 | QString newName = m_serverName->text(); |
509 | 509 | ||
510 | // Convert any spaces to underscores | 510 | // Convert any spaces to underscores |
511 | newName.replace( QRegExp( " " ), "_" ); | 511 | newName.replace( QRegExp( " " ), "_" ); |
512 | 512 | ||
513 | if ( !m_serverNew ) | 513 | if ( !m_serverNew ) |
514 | { | 514 | { |
515 | // Find selected server in list | 515 | // Find selected server in list |
516 | OConfItem *server = findConfItem( OConfItem::Source, m_serverCurrName ); | 516 | OConfItem *server = findConfItem( OConfItem::Source, m_serverCurrName ); |
517 | 517 | ||
518 | // Delete server | 518 | // Delete server |
519 | if ( server ) | 519 | if ( server ) |
520 | { | 520 | { |
521 | // Update url | 521 | // Update url |
522 | server->setValue( m_serverLocation->text() ); | 522 | server->setValue( m_serverLocation->text() ); |
523 | server->setActive( m_serverActive->isChecked() ); | 523 | server->setActive( m_serverActive->isChecked() ); |
524 | 524 | ||
525 | // Check if server name has changed, if it has then we need to replace the key in the map | 525 | // Check if server name has changed, if it has then we need to replace the key in the map |
526 | if ( m_serverCurrName != newName ) | 526 | if ( m_serverCurrName != newName ) |
527 | { | 527 | { |
528 | // Update server name | 528 | // Update server name |
529 | server->setName( newName ); | 529 | server->setName( newName ); |
530 | 530 | ||
531 | // Update list box | 531 | // Update list box |
532 | m_serverList->changeItem( newName, m_serverCurrent ); | 532 | m_serverList->changeItem( newName, m_serverCurrent ); |
533 | } | 533 | } |
534 | } | 534 | } |
535 | } | 535 | } |
536 | else | 536 | else |
537 | { | 537 | { |
538 | // Add new destination to configuration list | 538 | // Add new destination to configuration list |
539 | m_configs->append( new OConfItem( OConfItem::Source, newName, | 539 | m_configs->append( new OConfItem( OConfItem::Source, newName, |
540 | m_serverLocation->text(), m_serverActive->isChecked() ) ); | 540 | m_serverLocation->text(), m_serverActive->isChecked() ) ); |
541 | m_configs->sort(); | 541 | m_configs->sort(); |
542 | 542 | ||
543 | m_serverList->insertItem( newName ); | 543 | m_serverList->insertItem( newName ); |
544 | m_serverList->setCurrentItem( m_serverList->count() ); | 544 | m_serverList->setCurrentItem( m_serverList->count() ); |
545 | m_serverNew = false; | 545 | m_serverNew = false; |
546 | m_serverList->insertItem( newName ); | 546 | // m_serverList->insertItem( newName ); |
547 | } | 547 | } |
548 | } | 548 | } |
549 | 549 | ||
550 | void OIpkgConfigDlg::slotDestEdit( int index ) | 550 | void OIpkgConfigDlg::slotDestEdit( int index ) |
551 | { | 551 | { |
552 | m_destNew = false; | 552 | m_destNew = false; |
553 | m_destCurrent = index; | 553 | m_destCurrent = index; |
554 | 554 | ||
555 | // Find selected destination in list | 555 | // Find selected destination in list |
556 | OConfItem *destination = findConfItem( OConfItem::Destination, m_destList->currentText() ); | 556 | OConfItem *destination = findConfItem( OConfItem::Destination, m_destList->currentText() ); |
557 | 557 | ||
558 | // Display destination details | 558 | // Display destination details |
559 | if ( destination ) | 559 | if ( destination ) |
560 | { | 560 | { |
561 | m_destCurrName = destination->name(); | 561 | m_destCurrName = destination->name(); |
562 | m_destName->setText( destination->name() ); | 562 | m_destName->setText( destination->name() ); |
563 | m_destLocation->setText( destination->value() ); | 563 | m_destLocation->setText( destination->value() ); |
564 | m_destActive->setChecked( destination->active() ); | 564 | m_destActive->setChecked( destination->active() ); |
565 | m_destName->setFocus(); | 565 | m_destName->setFocus(); |
566 | } | 566 | } |
567 | } | 567 | } |
568 | 568 | ||
569 | void OIpkgConfigDlg::slotDestNew() | 569 | void OIpkgConfigDlg::slotDestNew() |
570 | { | 570 | { |
571 | m_destNew = true; | 571 | m_destNew = true; |
572 | 572 | ||
573 | m_destName->setText( QString::null ); | 573 | m_destName->setText( QString::null ); |
574 | m_destLocation->setText( QString::null ); | 574 | m_destLocation->setText( QString::null ); |
575 | m_destActive->setChecked( true ); | 575 | m_destActive->setChecked( true ); |
576 | m_destName->setFocus(); | 576 | m_destName->setFocus(); |
577 | } | 577 | } |
578 | 578 | ||
579 | void OIpkgConfigDlg::slotDestDelete() | 579 | void OIpkgConfigDlg::slotDestDelete() |
580 | { | 580 | { |
581 | // Find selected destination in list | 581 | // Find selected destination in list |
582 | OConfItem *destination = findConfItem( OConfItem::Destination, m_destList->currentText() ); | 582 | OConfItem *destination = findConfItem( OConfItem::Destination, m_destList->currentText() ); |
583 | 583 | ||
584 | // Delete destination | 584 | // Delete destination |
585 | if ( destination ) | 585 | if ( destination ) |
586 | { | 586 | { |
587 | m_configs->removeRef( destination ); | 587 | m_configs->removeRef( destination ); |
588 | m_destList->removeItem( m_destCurrent ); | 588 | m_destList->removeItem( m_destCurrent ); |
589 | } | 589 | } |
590 | } | 590 | } |
591 | 591 | ||
592 | void OIpkgConfigDlg::slotDestSelectPath() | 592 | void OIpkgConfigDlg::slotDestSelectPath() |
593 | { | 593 | { |
594 | QString path = Opie::Ui::OFileDialog::getDirectory( 0, m_destLocation->text() ); | 594 | QString path = Opie::Ui::OFileDialog::getDirectory( 0, m_destLocation->text() ); |
595 | if ( path.at( path.length() - 1 ) == '/' ) | 595 | if ( path.at( path.length() - 1 ) == '/' ) |
596 | path.truncate( path.length() - 1 ); | 596 | path.truncate( path.length() - 1 ); |
597 | m_destLocation->setText( path ); | 597 | m_destLocation->setText( path ); |
598 | } | 598 | } |
599 | 599 | ||
600 | void OIpkgConfigDlg::slotDestUpdate() | 600 | void OIpkgConfigDlg::slotDestUpdate() |
601 | { | 601 | { |
602 | QString newName = m_destName->text(); | 602 | QString newName = m_destName->text(); |
603 | 603 | ||
604 | // Convert any spaces to underscores | 604 | // Convert any spaces to underscores |
605 | newName.replace( QRegExp( " " ), "_" ); | 605 | newName.replace( QRegExp( " " ), "_" ); |
606 | 606 | ||
607 | if ( !m_destNew ) | 607 | if ( !m_destNew ) |
608 | { | 608 | { |
609 | // Find selected destination in list | 609 | // Find selected destination in list |
610 | OConfItem *destination = findConfItem( OConfItem::Destination, m_destCurrName ); | 610 | OConfItem *destination = findConfItem( OConfItem::Destination, m_destCurrName ); |
611 | 611 | ||
612 | // Display destination details | 612 | // Display destination details |
613 | if ( destination ) | 613 | if ( destination ) |
614 | { | 614 | { |
615 | // Update url | 615 | // Update url |
616 | destination->setValue( m_destLocation->text() ); | 616 | destination->setValue( m_destLocation->text() ); |
617 | destination->setActive( m_destActive->isChecked() ); | 617 | destination->setActive( m_destActive->isChecked() ); |
618 | 618 | ||
619 | // Check if destination name has changed, if it has then we need to replace the key in the map | 619 | // Check if destination name has changed, if it has then we need to replace the key in the map |
620 | if ( m_destCurrName != newName ) | 620 | if ( m_destCurrName != newName ) |
621 | { | 621 | { |
622 | // Update destination name | 622 | // Update destination name |
623 | destination->setName( newName ); | 623 | destination->setName( newName ); |
624 | 624 | ||
625 | // Update list box | 625 | // Update list box |
626 | m_destList->changeItem( newName, m_destCurrent ); | 626 | m_destList->changeItem( newName, m_destCurrent ); |
627 | } | 627 | } |
628 | } | 628 | } |
629 | } | 629 | } |
630 | else | 630 | else |
631 | { | 631 | { |
632 | // Add new destination to configuration list | 632 | // Add new destination to configuration list |
633 | m_configs->append( new OConfItem( OConfItem::Destination, newName, | 633 | m_configs->append( new OConfItem( OConfItem::Destination, newName, |
634 | m_destLocation->text(), m_destActive->isChecked() ) ); | 634 | m_destLocation->text(), m_destActive->isChecked() ) ); |
635 | m_configs->sort(); | 635 | m_configs->sort(); |
636 | 636 | ||
637 | m_destList->insertItem( newName ); | 637 | m_destList->insertItem( newName ); |
638 | m_destList->setCurrentItem( m_destList->count() ); | 638 | m_destList->setCurrentItem( m_destList->count() ); |
639 | m_destNew = false; | 639 | m_destNew = false; |
640 | } | 640 | } |
641 | } | 641 | } |