author | andyq <andyq> | 2002-11-03 12:41:54 (UTC) |
---|---|---|
committer | andyq <andyq> | 2002-11-03 12:41:54 (UTC) |
commit | b9aad2af4da88816effbc09f8d609bcabaf1f492 (patch) (unidiff) | |
tree | c8b260212063d2dab559656a3eb3073f1793d116 /noncore/settings/aqpkg/networkpkgmgr.cpp | |
parent | 57e4563332689305ac247ca2e259b37c3592f389 (diff) | |
download | opie-b9aad2af4da88816effbc09f8d609bcabaf1f492.zip opie-b9aad2af4da88816effbc09f8d609bcabaf1f492.tar.gz opie-b9aad2af4da88816effbc09f8d609bcabaf1f492.tar.bz2 |
Added find next facility
Diffstat (limited to 'noncore/settings/aqpkg/networkpkgmgr.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/aqpkg/networkpkgmgr.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp index 78d3df5..a058285 100644 --- a/noncore/settings/aqpkg/networkpkgmgr.cpp +++ b/noncore/settings/aqpkg/networkpkgmgr.cpp | |||
@@ -630,78 +630,82 @@ InstallData NetworkPackageManager :: dealWithItem( QCheckListItem *item ) | |||
630 | else | 630 | else |
631 | item.recreateLinks = false; | 631 | item.recreateLinks = false; |
632 | 632 | ||
633 | // User hit cancel (on dlg - assume remove) | 633 | // User hit cancel (on dlg - assume remove) |
634 | return item; | 634 | return item; |
635 | } | 635 | } |
636 | } | 636 | } |
637 | 637 | ||
638 | void NetworkPackageManager :: displayText( const QString &t ) | 638 | void NetworkPackageManager :: displayText( const QString &t ) |
639 | { | 639 | { |
640 | cout << t << endl; | 640 | cout << t << endl; |
641 | } | 641 | } |
642 | 642 | ||
643 | 643 | ||
644 | void NetworkPackageManager :: letterPushed( QString t ) | 644 | void NetworkPackageManager :: letterPushed( QString t ) |
645 | { | 645 | { |
646 | QCheckListItem *top = (QCheckListItem *)packagesList->firstChild(); | 646 | QCheckListItem *top = (QCheckListItem *)packagesList->firstChild(); |
647 | QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); | 647 | QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); |
648 | if ( packagesList->firstChild() == 0 ) | 648 | if ( packagesList->firstChild() == 0 ) |
649 | return; | 649 | return; |
650 | 650 | ||
651 | QCheckListItem *item; | 651 | QCheckListItem *item; |
652 | if ( start == 0 ) | 652 | if ( start == 0 ) |
653 | { | 653 | { |
654 | item = (QCheckListItem *)packagesList->firstChild(); | 654 | item = (QCheckListItem *)packagesList->firstChild(); |
655 | start = top; | 655 | start = top; |
656 | } | 656 | } |
657 | else | 657 | else |
658 | item = (QCheckListItem *)start->nextSibling(); | 658 | item = (QCheckListItem *)start->nextSibling(); |
659 | 659 | ||
660 | if ( item == 0 ) | 660 | if ( item == 0 ) |
661 | item = (QCheckListItem *)packagesList->firstChild(); | 661 | item = (QCheckListItem *)packagesList->firstChild(); |
662 | do | 662 | do |
663 | { | 663 | { |
664 | if ( item->text().lower().startsWith( t.lower() ) ) | 664 | if ( item->text().lower().startsWith( t.lower() ) ) |
665 | { | 665 | { |
666 | packagesList->setSelected( item, true ); | 666 | packagesList->setSelected( item, true ); |
667 | packagesList->ensureItemVisible( item ); | 667 | packagesList->ensureItemVisible( item ); |
668 | break; | 668 | break; |
669 | } | 669 | } |
670 | 670 | ||
671 | item = (QCheckListItem *)item->nextSibling(); | 671 | item = (QCheckListItem *)item->nextSibling(); |
672 | if ( !item ) | 672 | if ( !item ) |
673 | item = (QCheckListItem *)packagesList->firstChild(); | 673 | item = (QCheckListItem *)packagesList->firstChild(); |
674 | } while ( item != start); | 674 | } while ( item != start); |
675 | } | 675 | } |
676 | 676 | ||
677 | 677 | ||
678 | void NetworkPackageManager :: searchForPackage() | 678 | void NetworkPackageManager :: searchForPackage( bool findNext ) |
679 | { | 679 | { |
680 | bool ok = FALSE; | 680 | bool ok = false; |
681 | QString searchText = InputDialog::getText( "Search for package", "Enter package to search for", QString::null, &ok, this ).lower(); | 681 | if ( !findNext || lastSearchText.isEmpty() ) |
682 | if ( ok && !searchText.isEmpty() ) | 682 | lastSearchText = InputDialog::getText( "Search for package", "Enter package to search for", lastSearchText, &ok, this ).lower(); |
683 | else | ||
684 | ok = true; | ||
685 | |||
686 | if ( ok && !lastSearchText.isEmpty() ) | ||
683 | { | 687 | { |
684 | cout << "searching for " << searchText << endl; | 688 | cout << "searching for " << lastSearchText << endl; |
685 | // look through package list for text startng at current position | 689 | // look through package list for text startng at current position |
686 | vector<InstallData> workingPackages; | 690 | vector<InstallData> workingPackages; |
687 | QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); | 691 | QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); |
688 | if ( start != 0 ) | 692 | if ( start != 0 ) |
689 | start = (QCheckListItem *)start->nextSibling(); | 693 | start = (QCheckListItem *)start->nextSibling(); |
690 | 694 | ||
691 | if ( start == 0 ) | 695 | if ( start == 0 ) |
692 | start = (QCheckListItem *)packagesList->firstChild(); | 696 | start = (QCheckListItem *)packagesList->firstChild(); |
693 | 697 | ||
694 | for ( QCheckListItem *item = start; item != 0 ; | 698 | for ( QCheckListItem *item = start; item != 0 ; |
695 | item = (QCheckListItem *)item->nextSibling() ) | 699 | item = (QCheckListItem *)item->nextSibling() ) |
696 | { | 700 | { |
697 | cout << "checking " << item->text().lower() << endl; | 701 | cout << "checking " << item->text().lower() << endl; |
698 | if ( item->text().lower().find( searchText ) != -1 ) | 702 | if ( item->text().lower().find( lastSearchText ) != -1 ) |
699 | { | 703 | { |
700 | cout << "matched " << item->text() << endl; | 704 | cout << "matched " << item->text() << endl; |
701 | packagesList->ensureItemVisible( item ); | 705 | packagesList->ensureItemVisible( item ); |
702 | packagesList->setCurrentItem( item ); | 706 | packagesList->setCurrentItem( item ); |
703 | break; | 707 | break; |
704 | } | 708 | } |
705 | } | 709 | } |
706 | } | 710 | } |
707 | } \ No newline at end of file | 711 | } \ No newline at end of file |