-rw-r--r-- | noncore/settings/aqpkg/mainwin.cpp | 9 | ||||
-rw-r--r-- | noncore/settings/aqpkg/mainwin.h | 1 | ||||
-rw-r--r-- | noncore/settings/aqpkg/networkpkgmgr.cpp | 34 | ||||
-rw-r--r-- | noncore/settings/aqpkg/networkpkgmgr.h | 2 |
4 files changed, 44 insertions, 2 deletions
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp index 9f19dfa..0b5a5eb 100644 --- a/noncore/settings/aqpkg/mainwin.cpp +++ b/noncore/settings/aqpkg/mainwin.cpp @@ -46,2 +46,5 @@ MainWindow :: MainWindow( QWidget *p, char *name ) + QPopupMenu *edit = new QPopupMenu( this );
+ edit->insertItem( "&Search", this, SLOT(searchForPackage()), Qt::CTRL+Qt::Key_F );
+
// Create the main menu
@@ -49,2 +52,3 @@ MainWindow :: MainWindow( QWidget *p, char *name ) menu->insertItem( "&Settings", settings );
+ menu->insertItem( "&Edit", edit );
menu->insertItem( "&Help", help );
@@ -91,2 +95,7 @@ void MainWindow :: displayHelp() +void MainWindow :: searchForPackage()
+{
+ networkPkgWindow->searchForPackage();
+}
+
void MainWindow :: displayAbout()
diff --git a/noncore/settings/aqpkg/mainwin.h b/noncore/settings/aqpkg/mainwin.h index a9e290c..9fa0eca 100644 --- a/noncore/settings/aqpkg/mainwin.h +++ b/noncore/settings/aqpkg/mainwin.h @@ -44,2 +44,3 @@ public slots: void displayHelp();
+ void searchForPackage();
void displayAbout();
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp index ccce401..78d3df5 100644 --- a/noncore/settings/aqpkg/networkpkgmgr.cpp +++ b/noncore/settings/aqpkg/networkpkgmgr.cpp @@ -472,3 +472,3 @@ void NetworkPackageManager :: applyChanges() - vector<InstallData> workingPackages; + vector<InstallData> workingPackages; for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); @@ -675 +675,33 @@ void NetworkPackageManager :: letterPushed( QString t ) } + + +void NetworkPackageManager :: searchForPackage() +{ + bool ok = FALSE; + QString searchText = InputDialog::getText( "Search for package", "Enter package to search for", QString::null, &ok, this ).lower(); + if ( ok && !searchText.isEmpty() ) + { + cout << "searching for " << searchText << endl; + // look through package list for text startng at current position + vector<InstallData> workingPackages; + QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); + if ( start != 0 ) + start = (QCheckListItem *)start->nextSibling(); + + if ( start == 0 ) + start = (QCheckListItem *)packagesList->firstChild(); + + for ( QCheckListItem *item = start; item != 0 ; + item = (QCheckListItem *)item->nextSibling() ) + { + cout << "checking " << item->text().lower() << endl; + if ( item->text().lower().find( searchText ) != -1 ) + { + cout << "matched " << item->text() << endl; + packagesList->ensureItemVisible( item ); + packagesList->setCurrentItem( item ); + break; + } + } + } +}
\ No newline at end of file diff --git a/noncore/settings/aqpkg/networkpkgmgr.h b/noncore/settings/aqpkg/networkpkgmgr.h index 3c437b4..3a111ff 100644 --- a/noncore/settings/aqpkg/networkpkgmgr.h +++ b/noncore/settings/aqpkg/networkpkgmgr.h @@ -42,3 +42,3 @@ public: void updateData(); - + void searchForPackage(); private: |