-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 @@ -33,24 +33,26 @@ MainWindow :: MainWindow( QWidget *p, char *name ) #ifdef QWS
showMaximized();
#endif
setCaption( "AQPkg - Package Manager" );
// 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 );
QPopupMenu *settings = new QPopupMenu( this );
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 );
menu->insertItem( "&Settings", settings );
menu->insertItem( "&Edit", edit );
menu->insertItem( "&Help", help );
mgr = new DataManager();
@@ -90,15 +92,20 @@ void MainWindow :: displayHelp() {
HelpWindow *dlg = new HelpWindow( this );
dlg->exec();
delete dlg;
}
void MainWindow :: searchForPackage()
{
- networkPkgWindow->searchForPackage();
+ networkPkgWindow->searchForPackage( false );
+}
+
+void MainWindow :: repeatSearchForPackage()
+{
+ networkPkgWindow->searchForPackage( true );
}
void MainWindow :: displayAbout()
{
QMessageBox::about( this, "About AQPkg", VERSION_TEXT );
}
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 @@ -38,12 +38,13 @@ private: QWidgetStack *stack;
NetworkPackageManager *networkPkgWindow;
public slots:
void setDocument( const QString &doc );
void displayHelp();
void searchForPackage();
+ void repeatSearchForPackage();
void displayAbout();
void displaySettings();
};
#endif
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 @@ -670,37 +670,41 @@ void NetworkPackageManager :: letterPushed( QString t ) item = (QCheckListItem *)item->nextSibling(); if ( !item ) item = (QCheckListItem *)packagesList->firstChild(); } while ( item != start); } -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(); 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 ) + if ( item->text().lower().find( lastSearchText ) != -1 ) { cout << "matched " << item->text() << endl; packagesList->ensureItemVisible( item ); packagesList->setCurrentItem( item ); break; } } } 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 @@ -35,29 +35,30 @@ class NetworkPackageManager : public QWidget public: /** construtor */ NetworkPackageManager( DataManager *dataManager, QWidget* parent=0, const char *name=0); /** destructor */ ~NetworkPackageManager(); void selectLocalPackage( const QString &pkg ); void updateData(); - void searchForPackage(); + void searchForPackage( bool findNext ); private: DataManager *dataMgr; QComboBox *serversList; QListView *packagesList; QPushButton *update; QPushButton *upgrade; QPushButton *download; QPushButton *apply; ProgressDlg *progressDlg; QString currentlySelectedServer; + QString lastSearchText; bool showJumpTo; int timerId; void timerEvent ( QTimerEvent * ); void initGui(); void setupConnections(); |