summaryrefslogtreecommitdiff
authorandyq <andyq>2002-11-03 12:41:54 (UTC)
committer andyq <andyq>2002-11-03 12:41:54 (UTC)
commitb9aad2af4da88816effbc09f8d609bcabaf1f492 (patch) (unidiff)
treec8b260212063d2dab559656a3eb3073f1793d116
parent57e4563332689305ac247ca2e259b37c3592f389 (diff)
downloadopie-b9aad2af4da88816effbc09f8d609bcabaf1f492.zip
opie-b9aad2af4da88816effbc09f8d609bcabaf1f492.tar.gz
opie-b9aad2af4da88816effbc09f8d609bcabaf1f492.tar.bz2
Added find next facility
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/mainwin.cpp11
-rw-r--r--noncore/settings/aqpkg/mainwin.h1
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.cpp16
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.h3
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
@@ -25,40 +25,42 @@
25#include "settingsimpl.h" 25#include "settingsimpl.h"
26#include "helpwindow.h" 26#include "helpwindow.h"
27#include "utils.h" 27#include "utils.h"
28#include "global.h" 28#include "global.h"
29 29
30MainWindow :: MainWindow( QWidget *p, char *name ) 30MainWindow :: MainWindow( QWidget *p, char *name )
31 :QMainWindow( p, name ) 31 :QMainWindow( p, name )
32{ 32{
33#ifdef QWS 33#ifdef QWS
34 showMaximized(); 34 showMaximized();
35#endif 35#endif
36 36
37 setCaption( "AQPkg - Package Manager" ); 37 setCaption( "AQPkg - Package Manager" );
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
44 QPopupMenu *settings = new QPopupMenu( this ); 45 QPopupMenu *settings = new QPopupMenu( this );
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 );
52 menu->insertItem( "&Settings", settings ); 54 menu->insertItem( "&Settings", settings );
53 menu->insertItem( "&Edit", edit ); 55 menu->insertItem( "&Edit", edit );
54 menu->insertItem( "&Help", help ); 56 menu->insertItem( "&Help", help );
55 57
56 mgr = new DataManager(); 58 mgr = new DataManager();
57 mgr->loadServers(); 59 mgr->loadServers();
58 60
59 stack = new QWidgetStack( this ); 61 stack = new QWidgetStack( this );
60 62
61 networkPkgWindow = new NetworkPackageManager( mgr, stack ); 63 networkPkgWindow = new NetworkPackageManager( mgr, stack );
62 stack->addWidget( networkPkgWindow, 1 ); 64 stack->addWidget( networkPkgWindow, 1 );
63 65
64 setCentralWidget( stack ); 66 setCentralWidget( stack );
@@ -82,23 +84,28 @@ void MainWindow :: displaySettings()
82{ 84{
83 SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true ); 85 SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true );
84 if ( dlg->showDlg( 0 ) ) 86 if ( dlg->showDlg( 0 ) )
85 networkPkgWindow->updateData(); 87 networkPkgWindow->updateData();
86 delete dlg; 88 delete dlg;
87} 89}
88 90
89void MainWindow :: displayHelp() 91void MainWindow :: displayHelp()
90{ 92{
91 HelpWindow *dlg = new HelpWindow( this ); 93 HelpWindow *dlg = new HelpWindow( this );
92 dlg->exec(); 94 dlg->exec();
93 delete dlg; 95 delete dlg;
94} 96}
95 97
96void MainWindow :: searchForPackage() 98void MainWindow :: searchForPackage()
97{ 99{
98 networkPkgWindow->searchForPackage(); 100 networkPkgWindow->searchForPackage( false );
101}
102
103void MainWindow :: repeatSearchForPackage()
104{
105 networkPkgWindow->searchForPackage( true );
99} 106}
100 107
101void MainWindow :: displayAbout() 108void MainWindow :: displayAbout()
102{ 109{
103 QMessageBox::about( this, "About AQPkg", VERSION_TEXT ); 110 QMessageBox::about( this, "About AQPkg", VERSION_TEXT );
104} 111}
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
@@ -30,20 +30,21 @@ class MainWindow :public QMainWindow
30 Q_OBJECT 30 Q_OBJECT
31public: 31public:
32 32
33 MainWindow( QWidget *p = 0, char *name = 0 ); 33 MainWindow( QWidget *p = 0, char *name = 0 );
34 ~MainWindow(); 34 ~MainWindow();
35 35
36private: 36private:
37 DataManager *mgr; 37 DataManager *mgr;
38 38
39 QWidgetStack *stack; 39 QWidgetStack *stack;
40 NetworkPackageManager *networkPkgWindow; 40 NetworkPackageManager *networkPkgWindow;
41 41
42public slots: 42public 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};
49#endif 50#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
@@ -662,46 +662,50 @@ void NetworkPackageManager :: letterPushed( QString t )
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
678void NetworkPackageManager :: searchForPackage() 678void 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
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
@@ -27,45 +27,46 @@
27#include "datamgr.h" 27#include "datamgr.h"
28#include "progressdlg.h" 28#include "progressdlg.h"
29class InstallData; 29class InstallData;
30 30
31/** NetworkPackageManager is the base class of the project */ 31/** NetworkPackageManager is the base class of the project */
32class NetworkPackageManager : public QWidget 32class NetworkPackageManager : public QWidget
33{ 33{
34 Q_OBJECT 34 Q_OBJECT
35public: 35public:
36 /** construtor */ 36 /** construtor */
37 NetworkPackageManager( DataManager *dataManager, QWidget* parent=0, const char *name=0); 37 NetworkPackageManager( DataManager *dataManager, QWidget* parent=0, const char *name=0);
38 /** destructor */ 38 /** destructor */
39 ~NetworkPackageManager(); 39 ~NetworkPackageManager();
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 );
44private: 44private:
45 DataManager *dataMgr; 45 DataManager *dataMgr;
46 46
47 QComboBox *serversList; 47 QComboBox *serversList;
48 QListView *packagesList; 48 QListView *packagesList;
49 QPushButton *update; 49 QPushButton *update;
50 QPushButton *upgrade; 50 QPushButton *upgrade;
51 QPushButton *download; 51 QPushButton *download;
52 QPushButton *apply; 52 QPushButton *apply;
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;
59 60
60 void timerEvent ( QTimerEvent * ); 61 void timerEvent ( QTimerEvent * );
61 62
62 void initGui(); 63 void initGui();
63 void setupConnections(); 64 void setupConnections();
64 void showProgressDialog( char *initialText ); 65 void showProgressDialog( char *initialText );
65 InstallData dealWithItem( QCheckListItem *item ); 66 InstallData dealWithItem( QCheckListItem *item );
66 QString stickyOption; 67 QString stickyOption;
67 68
68public slots: 69public slots:
69 void serverSelected( int index ); 70 void serverSelected( int index );
70 void applyChanges(); 71 void applyChanges();
71 void upgradePackages(); 72 void upgradePackages();