summaryrefslogtreecommitdiff
path: root/noncore/apps/dagger/searchbar.cpp
Unidiff
Diffstat (limited to 'noncore/apps/dagger/searchbar.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/dagger/searchbar.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/noncore/apps/dagger/searchbar.cpp b/noncore/apps/dagger/searchbar.cpp
index 747d696..ff434dd 100644
--- a/noncore/apps/dagger/searchbar.cpp
+++ b/noncore/apps/dagger/searchbar.cpp
@@ -22,24 +22,29 @@ file; see the file COPYING. If not, write to the Free Software Foundation, Inc.,
22 22
23#include <qpe/qpeapplication.h> 23#include <qpe/qpeapplication.h>
24#include <qpe/resource.h> 24#include <qpe/resource.h>
25 25
26#include <qaction.h> 26#include <qaction.h>
27#include <qcombobox.h> 27#include <qcombobox.h>
28#include <qlineedit.h> 28#include <qlineedit.h>
29 29
30#include <listkey.h> 30#include <listkey.h>
31#include <regex.h> 31#include <regex.h>
32#include <versekey.h> 32#include <versekey.h>
33 33
34void searchCallback( char /*percent*/, void */*userData*/ )
35{
36 qApp->processEvents();
37}
38
34SearchBar::SearchBar( QMainWindow *parent ) 39SearchBar::SearchBar( QMainWindow *parent )
35 : QToolBar( QString::null, parent, QMainWindow::Top, true ) 40 : QToolBar( QString::null, parent, QMainWindow::Top, true )
36 , m_currText( 0x0 ) 41 , m_currText( 0x0 )
37{ 42{
38 // Initialize UI 43 // Initialize UI
39 m_searchText = new QLineEdit( this ); 44 m_searchText = new QLineEdit( this );
40 setStretchableWidget( m_searchText ); 45 setStretchableWidget( m_searchText );
41 connect(m_searchText, SIGNAL(textChanged(const QString &)), 46 connect(m_searchText, SIGNAL(textChanged(const QString &)),
42 this, SLOT(slotTextChanged(const QString &)) ); 47 this, SLOT(slotTextChanged(const QString &)) );
43 48
44 m_actionFind = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 49 m_actionFind = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null,
45 0, this, 0 ); 50 0, this, 0 );
@@ -99,25 +104,26 @@ void SearchBar::slotFind()
99 104
100 // Change application title and display Opie wait dialog to indicate search is beginning 105 // Change application title and display Opie wait dialog to indicate search is beginning
101 QWidget *pWidget = reinterpret_cast<QWidget *>(parent()); 106 QWidget *pWidget = reinterpret_cast<QWidget *>(parent());
102 QString caption = pWidget->caption(); 107 QString caption = pWidget->caption();
103 pWidget->setCaption( "Searching..." ); 108 pWidget->setCaption( "Searching..." );
104 109
105 Opie::Ui::OWait wait( pWidget ); 110 Opie::Ui::OWait wait( pWidget );
106 wait.show(); 111 wait.show();
107 qApp->processEvents(); 112 qApp->processEvents();
108 113
109 // Perform search 114 // Perform search
110 // TODO - implement search callback function to animate wait cursor 115 // TODO - implement search callback function to animate wait cursor
111 sword::ListKey results = m_currText->getModule()->Search( m_searchText->text().latin1(), REG_ICASE, 0 ); 116 sword::ListKey results = m_currText->getModule()->Search( m_searchText->text().latin1(), 0, REG_ICASE, 0, 0,
117 &searchCallback );
112 118
113 // Process results 119 // Process results
114 int count = results.Count(); 120 int count = results.Count();
115 bool found = count > 0; 121 bool found = count > 0;
116 if ( found ) 122 if ( found )
117 { 123 {
118 // Populate results combo box 124 // Populate results combo box
119 sword::VerseKey key; 125 sword::VerseKey key;
120 for ( int i = 0; i < count; i++ ) 126 for ( int i = 0; i < count; i++ )
121 { 127 {
122 key.setText( results.GetElement( i )->getText() ); 128 key.setText( results.GetElement( i )->getText() );
123 m_resultList->insertItem( key.getShortText() ); 129 m_resultList->insertItem( key.getShortText() );