author | andyq <andyq> | 2002-11-03 12:41:54 (UTC) |
---|---|---|
committer | andyq <andyq> | 2002-11-03 12:41:54 (UTC) |
commit | b9aad2af4da88816effbc09f8d609bcabaf1f492 (patch) (side-by-side diff) | |
tree | c8b260212063d2dab559656a3eb3073f1793d116 /noncore/settings/aqpkg | |
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 ) // Create our menu
QPopupMenu *help = new QPopupMenu( this );
+
help->insertItem( "&General", this, SLOT(displayHelp()), Qt::CTRL+Qt::Key_H );
help->insertItem( "&About", this, SLOT(displayAbout()), Qt::CTRL+Qt::Key_A );
@@ -45,7 +46,8 @@ MainWindow :: MainWindow( QWidget *p, char *name ) settings->insertItem( "&Settings", this, SLOT(displaySettings()), Qt::CTRL+Qt::Key_S );
QPopupMenu *edit = new QPopupMenu( this );
- edit->insertItem( "&Search", this, SLOT(searchForPackage()), Qt::CTRL+Qt::Key_F );
+ edit->insertItem( "&Find", this, SLOT(searchForPackage()), Qt::CTRL+Qt::Key_F );
+ edit->insertItem( "&Find Next", this, SLOT(repeatSearchForPackage()), Qt::CTRL+Qt::Key_R );
// Create the main menu
QMenuBar *menu = menuBar(); //new QMenuBar( this );
@@ -95,7 +97,12 @@ void MainWindow :: displayHelp() void MainWindow :: searchForPackage()
{
- networkPkgWindow->searchForPackage();
+ networkPkgWindow->searchForPackage( false );
+}
+
+void MainWindow :: repeatSearchForPackage()
+{
+ networkPkgWindow->searchForPackage( true );
}
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: void setDocument( const QString &doc );
void displayHelp();
void searchForPackage();
+ void repeatSearchForPackage();
void displayAbout();
void displaySettings();
};
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 ) } -void NetworkPackageManager :: searchForPackage() +void NetworkPackageManager :: searchForPackage( bool findNext ) { - bool ok = FALSE; - QString searchText = InputDialog::getText( "Search for package", "Enter package to search for", QString::null, &ok, this ).lower(); - if ( ok && !searchText.isEmpty() ) + bool ok = false; + if ( !findNext || lastSearchText.isEmpty() ) + lastSearchText = InputDialog::getText( "Search for package", "Enter package to search for", lastSearchText, &ok, this ).lower(); + else + ok = true; + + if ( ok && !lastSearchText.isEmpty() ) { - cout << "searching for " << searchText << endl; + cout << "searching for " << lastSearchText << endl; // look through package list for text startng at current position vector<InstallData> workingPackages; QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); @@ -695,7 +699,7 @@ void NetworkPackageManager :: searchForPackage() item = (QCheckListItem *)item->nextSibling() ) { cout << "checking " << item->text().lower() << endl; - if ( item->text().lower().find( searchText ) != -1 ) + if ( item->text().lower().find( lastSearchText ) != -1 ) { cout << "matched " << item->text() << endl; 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: void selectLocalPackage( const QString &pkg ); void updateData(); - void searchForPackage(); + void searchForPackage( bool findNext ); private: DataManager *dataMgr; @@ -53,6 +53,7 @@ private: ProgressDlg *progressDlg; QString currentlySelectedServer; + QString lastSearchText; bool showJumpTo; int timerId; |