author | tille <tille> | 2003-05-13 13:46:19 (UTC) |
---|---|---|
committer | tille <tille> | 2003-05-13 13:46:19 (UTC) |
commit | ba4bb8e673fba43ae7a232942dea14d166991530 (patch) (side-by-side diff) | |
tree | e775ad637d5256eb1412e576c1bd5e77ed50406d /core/pim/osearch/mainwindow.cpp | |
parent | 1461a41433a732e3a615508e5de23f8acd91de6a (diff) | |
download | opie-ba4bb8e673fba43ae7a232942dea14d166991530.zip opie-ba4bb8e673fba43ae7a232942dea14d166991530.tar.gz opie-ba4bb8e673fba43ae7a232942dea14d166991530.tar.bz2 |
icons ;)
Diffstat (limited to 'core/pim/osearch/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/osearch/mainwindow.cpp | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/core/pim/osearch/mainwindow.cpp b/core/pim/osearch/mainwindow.cpp index e15cc7e..33a24bc 100644 --- a/core/pim/osearch/mainwindow.cpp +++ b/core/pim/osearch/mainwindow.cpp @@ -78,60 +78,64 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : detailsFrame->hide(); searches.append( new AdressSearch( resultsList, tr("adressbook") ) ); searches.append( new TodoSearch( resultsList, tr("todo") ) ); searches.append( new DatebookSearch( resultsList, tr("datebook") ) ); searches.append( new AppLnkSearch( resultsList, tr("applications") ) ); searches.append( new DocLnkSearch( resultsList, tr("documents") ) ); makeMenu(); setCentralWidget( mainFrame ); popupTimer = new QTimer(); + searchTimer = new QTimer(); connect(popupTimer, SIGNAL(timeout()), SLOT(showPopup())); + connect(searchTimer, SIGNAL(timeout()), SLOT(searchStringChanged())); connect(resultsList, SIGNAL(pressed(QListViewItem*)), SLOT(setCurrent(QListViewItem*))); connect(resultsList, SIGNAL(clicked(QListViewItem*)), SLOT(stopTimer(QListViewItem*))); connect(buttonGroupActions, SIGNAL(clicked(int)), SLOT( slotAction(int) ) ); } void MainWindow::makeMenu() { QPEToolBar *toolBar = new QPEToolBar( this ); QPEToolBar *searchBar = new QPEToolBar(this); QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); QPopupMenu *searchMenu = new QPopupMenu( menuBar ); // QPopupMenu *viewMenu = new QPopupMenu( menuBar ); // QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); // setToolBarsMovable( false ); toolBar->setHorizontalStretchable( true ); menuBar->insertItem( tr( "Search" ), searchMenu ); // menuBar->insertItem( tr( "View" ), viewMenu ); // menuBar->insertItem( tr( "Settings" ), cfgMenu ); //SEARCH - QAction *action = new QAction( tr("Search all"),QString::null, 0, this, 0 ); - connect( action, SIGNAL(activated()), this, SLOT(searchAll()) ); - action->addTo( searchMenu ); + SearchAllAction = new QAction( tr("Search all"),QString::null, 0, this, 0 ); + SearchAllAction->setIconSet( Resource::loadIconSet( "find" ) ); + connect( SearchAllAction, SIGNAL(activated()), this, SLOT(searchAll()) ); + SearchAllAction->addTo( searchMenu ); actionCaseSensitiv = new QAction( tr("Case sensitiv"),QString::null, 0, this, 0, true ); actionCaseSensitiv->addTo( searchMenu ); actionWildcards = new QAction( tr("Use wildcards"),QString::null, 0, this, 0, true ); actionWildcards->addTo( searchMenu ); addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); QLineEdit *searchEdit = new QLineEdit( searchBar, "seachEdit" ); searchBar->setHorizontalStretchable( TRUE ); searchBar->setStretchableWidget( searchEdit ); + SearchAllAction->addTo( searchBar ); connect( searchEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( setSearch( const QString & ) ) ); } MainWindow::~MainWindow() { } void MainWindow::setCurrent(QListViewItem *item) { if (!item) return; @@ -175,34 +179,42 @@ void MainWindow::stopTimer(QListViewItem*) { popupTimer->stop(); } void MainWindow::showPopup() { qDebug("showPopup"); if (!_currentItem) return; } void MainWindow::setSearch( const QString &key ) { - QRegExp re( key, actionCaseSensitiv->isOn(), actionWildcards->isOn() ); + searchTimer->stop(); + _searchString = key; + searchTimer->start( 300 ); +} + +void MainWindow::searchStringChanged() +{ + searchTimer->stop(); + QRegExp re( _searchString, actionCaseSensitiv->isOn(), actionWildcards->isOn() ); for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ) s->setSearch( re ); } void MainWindow::searchAll() { - bool openState; for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){ s->doSearch(); + //resultsList->repaint(); } } void MainWindow::slotAction( int act) { if (_currentItem->rtti() == OListViewItem::Result){ ResultItem *res = (ResultItem*)_currentItem; // ResultItem *res = dynamic_cast<ResultItem*>(item); res->action(act); } } |