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 | |
parent | 57e4563332689305ac247ca2e259b37c3592f389 (diff) | |
download | opie-b9aad2af4da88816effbc09f8d609bcabaf1f492.zip opie-b9aad2af4da88816effbc09f8d609bcabaf1f492.tar.gz opie-b9aad2af4da88816effbc09f8d609bcabaf1f492.tar.bz2 |
Added find next facility
-rw-r--r-- | noncore/settings/aqpkg/mainwin.cpp | 11 | ||||
-rw-r--r-- | noncore/settings/aqpkg/mainwin.h | 1 | ||||
-rw-r--r-- | noncore/settings/aqpkg/networkpkgmgr.cpp | 16 | ||||
-rw-r--r-- | noncore/settings/aqpkg/networkpkgmgr.h | 3 |
4 files changed, 22 insertions, 9 deletions
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp index 0b5a5eb..3c72f2b 100644 --- a/noncore/settings/aqpkg/mainwin.cpp +++ b/noncore/settings/aqpkg/mainwin.cpp | |||
@@ -38,6 +38,7 @@ MainWindow :: MainWindow( QWidget *p, char *name ) | |||
38 | 38 | ||
39 | // Create our menu | 39 | // Create our menu |
40 | QPopupMenu *help = new QPopupMenu( this ); | 40 | QPopupMenu *help = new QPopupMenu( this ); |
41 | |||
41 | help->insertItem( "&General", this, SLOT(displayHelp()), Qt::CTRL+Qt::Key_H ); | 42 | help->insertItem( "&General", this, SLOT(displayHelp()), Qt::CTRL+Qt::Key_H ); |
42 | help->insertItem( "&About", this, SLOT(displayAbout()), Qt::CTRL+Qt::Key_A ); | 43 | help->insertItem( "&About", this, SLOT(displayAbout()), Qt::CTRL+Qt::Key_A ); |
43 | 44 | ||
@@ -45,7 +46,8 @@ MainWindow :: MainWindow( QWidget *p, char *name ) | |||
45 | settings->insertItem( "&Settings", this, SLOT(displaySettings()), Qt::CTRL+Qt::Key_S ); | 46 | settings->insertItem( "&Settings", this, SLOT(displaySettings()), Qt::CTRL+Qt::Key_S ); |
46 | 47 | ||
47 | QPopupMenu *edit = new QPopupMenu( this ); | 48 | QPopupMenu *edit = new QPopupMenu( this ); |
48 | edit->insertItem( "&Search", this, SLOT(searchForPackage()), Qt::CTRL+Qt::Key_F ); | 49 | edit->insertItem( "&Find", this, SLOT(searchForPackage()), Qt::CTRL+Qt::Key_F ); |
50 | edit->insertItem( "&Find Next", this, SLOT(repeatSearchForPackage()), Qt::CTRL+Qt::Key_R ); | ||
49 | 51 | ||
50 | // Create the main menu | 52 | // Create the main menu |
51 | QMenuBar *menu = menuBar(); //new QMenuBar( this ); | 53 | QMenuBar *menu = menuBar(); //new QMenuBar( this ); |
@@ -95,7 +97,12 @@ void MainWindow :: displayHelp() | |||
95 | 97 | ||
96 | void MainWindow :: searchForPackage() | 98 | void MainWindow :: searchForPackage() |
97 | { | 99 | { |
98 | networkPkgWindow->searchForPackage(); | 100 | networkPkgWindow->searchForPackage( false ); |
101 | } | ||
102 | |||
103 | void MainWindow :: repeatSearchForPackage() | ||
104 | { | ||
105 | networkPkgWindow->searchForPackage( true ); | ||
99 | } | 106 | } |
100 | 107 | ||
101 | void MainWindow :: displayAbout() | 108 | void MainWindow :: displayAbout() |
diff --git a/noncore/settings/aqpkg/mainwin.h b/noncore/settings/aqpkg/mainwin.h index 9fa0eca..267233f 100644 --- a/noncore/settings/aqpkg/mainwin.h +++ b/noncore/settings/aqpkg/mainwin.h | |||
@@ -43,6 +43,7 @@ public slots: | |||
43 | void setDocument( const QString &doc ); | 43 | void setDocument( const QString &doc ); |
44 | void displayHelp(); | 44 | void displayHelp(); |
45 | void searchForPackage(); | 45 | void searchForPackage(); |
46 | void repeatSearchForPackage(); | ||
46 | void displayAbout(); | 47 | void displayAbout(); |
47 | void displaySettings(); | 48 | void displaySettings(); |
48 | }; | 49 | }; |
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 | |||
@@ -675,13 +675,17 @@ void NetworkPackageManager :: letterPushed( QString t ) | |||
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(); |
@@ -695,7 +699,7 @@ void NetworkPackageManager :: searchForPackage() | |||
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 ); |
diff --git a/noncore/settings/aqpkg/networkpkgmgr.h b/noncore/settings/aqpkg/networkpkgmgr.h index 3a111ff..20f6e2d 100644 --- a/noncore/settings/aqpkg/networkpkgmgr.h +++ b/noncore/settings/aqpkg/networkpkgmgr.h | |||
@@ -40,7 +40,7 @@ public: | |||
40 | 40 | ||
41 | void selectLocalPackage( const QString &pkg ); | 41 | void selectLocalPackage( const QString &pkg ); |
42 | void updateData(); | 42 | void updateData(); |
43 | void searchForPackage(); | 43 | void searchForPackage( bool findNext ); |
44 | private: | 44 | private: |
45 | DataManager *dataMgr; | 45 | DataManager *dataMgr; |
46 | 46 | ||
@@ -53,6 +53,7 @@ private: | |||
53 | 53 | ||
54 | ProgressDlg *progressDlg; | 54 | ProgressDlg *progressDlg; |
55 | QString currentlySelectedServer; | 55 | QString currentlySelectedServer; |
56 | QString lastSearchText; | ||
56 | 57 | ||
57 | bool showJumpTo; | 58 | bool showJumpTo; |
58 | int timerId; | 59 | int timerId; |