summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/dagger/ChangeLog8
-rw-r--r--noncore/apps/dagger/README8
-rw-r--r--noncore/apps/dagger/TODO7
-rw-r--r--noncore/apps/dagger/mainwindow.cpp68
-rw-r--r--noncore/apps/dagger/opie-dagger.control2
-rw-r--r--noncore/apps/dagger/searchbar.cpp2
6 files changed, 51 insertions, 44 deletions
diff --git a/noncore/apps/dagger/ChangeLog b/noncore/apps/dagger/ChangeLog
index 108419e..22b20d4 100644
--- a/noncore/apps/dagger/ChangeLog
+++ b/noncore/apps/dagger/ChangeLog
@@ -1,11 +1,19 @@
12005-08-09 Dan Williams <drw@handhelds.org>
2
3 * Released version 0.9.2
4 * Added support for Sword v1.5.8
5 * Implemented morph tag cross-referencing
6 * Fix crash when last module is closed
7 * Fix display of key when module is opened
8
12004-04-22 Dan Williams <drw@handhelds.org> 92004-04-22 Dan Williams <drw@handhelds.org>
2 10
3 * Released version 0.9.1 11 * Released version 0.9.1
4 * Fixed the disabling of screen blanking 12 * Fixed the disabling of screen blanking
5 * Implement previous/next page scrolling 13 * Implement previous/next page scrolling
6 * Animate search OWait 14 * Animate search OWait
7 15
82004-04-06 Dan Williams <drw@handhelds.org> 162004-04-06 Dan Williams <drw@handhelds.org>
9 17
10 * Released version 0.9.0 18 * Released version 0.9.0
11 * Initial check-in of new application 19 * Initial check-in of new application
diff --git a/noncore/apps/dagger/README b/noncore/apps/dagger/README
index 00e9eed..47b8eee 100644
--- a/noncore/apps/dagger/README
+++ b/noncore/apps/dagger/README
@@ -1,61 +1,61 @@
1/************************************************************************ 1/************************************************************************
2/* 2/*
3/* Opie - Dagger 3/* Opie - Dagger
4/* =============== 4/* ===============
5/* Version 0.9.1 5/* Version 0.9.2
6/* 6/*
7/* A Bible study/reader application 7/* A Bible study/reader application
8/* 8/*
9/************************************************************************ 9/************************************************************************
10 10
11--------------------------------------------- 11---------------------------------------------
12 Release Notes for Opie-Dagger - April, 2004 12 Release Notes for Opie-Dagger - August, 2005
13--------------------------------------------- 13---------------------------------------------
14 14
15====================== 15======================
16= To-do = 16= To-do =
17====================== 17======================
18 18
19- See $OPIEDIR/noncore/apps/dagger/TODO for more info. 19- See $OPIEDIR/noncore/apps/dagger/TODO for more info.
20 20
21====================== 21======================
22= Build = 22= Build =
23====================== 23======================
24 24
25In order to build opie-dagger, libsword needs to be present on 25In order to build opie-dagger, libsword needs to be present on
26the build system along with the appropriate headers. 26the build system along with the appropriate headers.
27 27
28- libsword source (best to use version 1.5.x or greater): 28- libsword source (requires version 1.5.8 or greater):
29 - http://www.crosswire.org/sword/ 29 - http://www.crosswire.org/sword/
30 30
31- the Sword library headers need to be located in an appropriate 31- the Sword library headers need to be located in an appropriate
32 include directory 32 include directory
33 33
34====================== 34======================
35= Run = 35= Run =
36====================== 36======================
37 37
38- In order to use opie-dagger, libsword must be installed 38- In order to use opie-dagger, libsword must be installed
39 on the system. 39 on the system.
40- One or more Sword modules need to be installed, see 40- One or more Sword modules need to be installed, see
41 http://www.crosswire.org/sword/ to download modules 41 http://www.crosswire.org/sword/ to download modules
42- When run for the first time, the path needs to be set to the 42- When run for the first time, the path needs to be set to the
43 directory where the Sword modules are located. Select 'Edit->Configure' 43 directory where the Sword modules are located. Select 'Edit->Configure'
44 from the menu bar and enter the path on the 'General' tab. Restart 44 from the menu bar and enter the path on the 'General' tab. Restart
45 Dagger. 45 Dagger.
46 46
47====================== 47======================
48= Credits = 48= Credits =
49====================== 49======================
50 50
51- Opie-Dagger is (C) 2004 Dan Williams 51- Opie-Dagger is (C) 2004, 2005 Dan Williams
52 52
53====================== 53======================
54= Links = 54= Links =
55====================== 55======================
56 56
57- Opie Project: http://opie.handhelds.org 57- Opie Project: http://opie.handhelds.org
58- OpenZaurus Project: http://openzaurus.org 58- OpenZaurus Project: http://openzaurus.org
59- Familiar Project: http://familiar.handhelds.org 59- Familiar Project: http://familiar.handhelds.org
60- Crosswire Society http://www.crosswire.org/ 60- Crosswire Society http://www.crosswire.org/
61- The Sword Project http://www.crosswire.org/sword/ 61- The Sword Project http://www.crosswire.org/sword/
diff --git a/noncore/apps/dagger/TODO b/noncore/apps/dagger/TODO
index 1530bd6..21426aa 100644
--- a/noncore/apps/dagger/TODO
+++ b/noncore/apps/dagger/TODO
@@ -1,25 +1,28 @@
1/************************************************************************ 1/************************************************************************
2/* 2/*
3/* Opie - Dagger 3/* Opie - Dagger
4/* =============== 4/* ===============
5/* Version 0.9.1 5/* Version 0.9.2
6/* 6/*
7/* A Bible study/reader application 7/* A Bible study/reader application
8/* 8/*
9/************************************************************************ 9/************************************************************************
10 10
11------------------------------------ 11------------------------------------
12To-do for Opie-Dagger - April, 2004 12To-do for Opie-Dagger - August, 2005
13------------------------------------ 13------------------------------------
14 14
15====================== 15======================
16= Current release = 16= Current release =
17====================== 17======================
18 18
191. Implement module installation 191. Implement module installation
202. Fix support for other languages
213. Fix display sleep prevention
224. Implement footnote cross-referencing
20 23
21====================== 24======================
22= Future releases = 25= Future releases =
23====================== 26======================
24 27
251. Margin notes \ No newline at end of file 281. Margin notes \ No newline at end of file
diff --git a/noncore/apps/dagger/mainwindow.cpp b/noncore/apps/dagger/mainwindow.cpp
index 1f2d521..f61df68 100644
--- a/noncore/apps/dagger/mainwindow.cpp
+++ b/noncore/apps/dagger/mainwindow.cpp
@@ -232,192 +232,194 @@ void MainWindow::initUI()
232 Opie::Core::OResource::loadPixmap( "dagger/bookmarkadd", Opie::Core::OResource::SmallIcon ), 232 Opie::Core::OResource::loadPixmap( "dagger/bookmarkadd", Opie::Core::OResource::SmallIcon ),
233 QString::null, 0, this, 0 ); 233 QString::null, 0, this, 0 );
234 connect( m_actionBookmarkAdd, SIGNAL(activated()), this, SLOT(slotBookmarkAdd()) ); 234 connect( m_actionBookmarkAdd, SIGNAL(activated()), this, SLOT(slotBookmarkAdd()) );
235 m_actionBookmarkAdd->addTo( m_bookmarkMenu ); 235 m_actionBookmarkAdd->addTo( m_bookmarkMenu );
236 236
237 m_actionBookmarkRemove = new QAction( tr( "Remove" ), 237 m_actionBookmarkRemove = new QAction( tr( "Remove" ),
238 Opie::Core::OResource::loadPixmap( "dagger/bookmarkremove", Opie::Core::OResource::SmallIcon ), 238 Opie::Core::OResource::loadPixmap( "dagger/bookmarkremove", Opie::Core::OResource::SmallIcon ),
239 QString::null, 0, this, 0 ); 239 QString::null, 0, this, 0 );
240 connect( m_actionBookmarkRemove, SIGNAL(activated()), this, SLOT(slotBookmarkRemove()) ); 240 connect( m_actionBookmarkRemove, SIGNAL(activated()), this, SLOT(slotBookmarkRemove()) );
241 m_actionBookmarkRemove->addTo( m_bookmarkMenu ); 241 m_actionBookmarkRemove->addTo( m_bookmarkMenu );
242 242
243 m_bookmarkMenu->insertSeparator(); 243 m_bookmarkMenu->insertSeparator();
244 244
245 m_menuBar->insertItem( tr( "Bookmark" ), m_bookmarkMenu ); 245 m_menuBar->insertItem( tr( "Bookmark" ), m_bookmarkMenu );
246 246
247 // View menu 247 // View menu
248 popup = new QPopupMenu( this ); 248 popup = new QPopupMenu( this );
249 249
250 // Retrieve list of available Sword module options (e.g. footnotes, Strong's numbers, etc.) 250 // Retrieve list of available Sword module options (e.g. footnotes, Strong's numbers, etc.)
251 for ( a = m_actionSwordOpts.first(); a; a = m_actionSwordOpts.next() ) 251 for ( a = m_actionSwordOpts.first(); a; a = m_actionSwordOpts.next() )
252 { 252 {
253 a->setToggleAction( true ); 253 a->setToggleAction( true );
254 connect( a, SIGNAL(toggled(bool)), this, SLOT(slotViewSwordOption(bool)) ); 254 connect( a, SIGNAL(toggled(bool)), this, SLOT(slotViewSwordOption(bool)) );
255 a->addTo( popup ); 255 a->addTo( popup );
256 } 256 }
257 257
258 popup->insertSeparator(); 258 popup->insertSeparator();
259 259
260 m_actionViewNavToolbar = new QAction( tr( "Navigation toolbar" ), QString::null, 0, this, 0 ); 260 m_actionViewNavToolbar = new QAction( tr( "Navigation toolbar" ), QString::null, 0, this, 0 );
261 m_actionViewNavToolbar->setToggleAction( true ); 261 m_actionViewNavToolbar->setToggleAction( true );
262 connect( m_actionViewNavToolbar, SIGNAL(toggled(bool)), this, SLOT(slotViewNavToolbar(bool)) ); 262 connect( m_actionViewNavToolbar, SIGNAL(toggled(bool)), this, SLOT(slotViewNavToolbar(bool)) );
263 m_actionViewNavToolbar->addTo( popup ); 263 m_actionViewNavToolbar->addTo( popup );
264 264
265 m_actionViewSearchToolbar = new QAction( tr( "Search toolbar" ), QString::null, 0, this, 0 ); 265 m_actionViewSearchToolbar = new QAction( tr( "Search toolbar" ), QString::null, 0, this, 0 );
266 m_actionViewSearchToolbar->setToggleAction( true ); 266 m_actionViewSearchToolbar->setToggleAction( true );
267 connect( m_actionViewSearchToolbar, SIGNAL(toggled(bool)), this, SLOT(slotViewSearchToolbar(bool)) ); 267 connect( m_actionViewSearchToolbar, SIGNAL(toggled(bool)), this, SLOT(slotViewSearchToolbar(bool)) );
268 m_actionViewSearchToolbar->addTo( popup ); 268 m_actionViewSearchToolbar->addTo( popup );
269 269
270 m_menuBar->insertItem( tr( "View" ), popup ); 270 m_menuBar->insertItem( tr( "View" ), popup );
271} 271}
272 272
273void MainWindow::openModule( const QString &modulename, const QString &key ) 273void MainWindow::openModule( const QString &modulename, const QString &key )
274{ 274{
275 sword::SWModule *module = m_swordMgr->Modules[ modulename.latin1() ]; 275 sword::SWModule *module = m_swordMgr->Modules[ modulename.latin1() ];
276 if ( module ) 276 if ( module )
277 { 277 {
278 TextWidget *tw = 0x0; 278 TextWidget *tw = 0x0;
279 279
280 if ( !m_alwaysOpenNew ) 280 if ( !m_alwaysOpenNew )
281 { 281 {
282 // Try to find if the module is already opened, if so will use that TextWidget 282 // Try to find if the module is already opened, if so will use that TextWidget
283 QObjectList *childlist = queryList( "TextWidget" ); 283 QObjectList *childlist = queryList( "TextWidget" );
284 QObjectListIt it( *childlist ); 284 QObjectListIt it( *childlist );
285 while ( ( tw = reinterpret_cast<TextWidget *>(it.current()) ) != 0 && 285 while ( ( tw = reinterpret_cast<TextWidget *>(it.current()) ) != 0 &&
286 tw->getModuleName() != modulename ) 286 tw->getModuleName() != modulename )
287 ++it; 287 ++it;
288 if ( tw && tw->getModuleName() == modulename ) 288 if ( tw && tw->getModuleName() == modulename )
289 { 289 {
290 // Set key if one is present 290 // Set key if one is present
291 if ( !key.isNull() ) 291 if ( !key.isNull() )
292 tw->setKey( key ); 292 tw->setKey( key );
293 293
294 // Raise tab 294 // Raise tab
295 m_tabs.setCurrentTab( tw ); 295 m_tabs.setCurrentTab( tw );
296 } 296 }
297 } 297 }
298 298
299 if ( m_alwaysOpenNew || !tw ) 299 if ( m_alwaysOpenNew || !tw )
300 { 300 {
301 // Open module in new tab 301 // Open module in new tab
302 QString icon; 302 QString icon;
303 QString type = module->Type(); 303 QString type = module->Type();
304 304
305 if ( type == "Biblical Texts" ) 305 if ( type == "Biblical Texts" )
306 icon = "dagger/bibletext"; 306 icon = "dagger/bibletext";
307 else if ( type == "Commentaries" ) 307 else if ( type == "Commentaries" )
308 icon = "dagger/commentary"; 308 icon = "dagger/commentary";
309 else if ( type == "Lexicons / Dictionaries" ) 309 else if ( type == "Lexicons / Dictionaries" )
310 icon = "dagger/lexicon"; 310 icon = "dagger/lexicon";
311 311
312 tw = new TextWidget( this, module, m_numVerses, &m_textFont ); 312 tw = new TextWidget( this, module, m_numVerses, &m_textFont );
313 connect( tw, SIGNAL(sigRefClicked(const QString &)), 313 connect( tw, SIGNAL(sigRefClicked(const QString &)),
314 this, SLOT(slotTextRefClicked(const QString &)) ); 314 this, SLOT(slotTextRefClicked(const QString &)) );
315 connect( this, SIGNAL(sigNumVersesChanged(int)), tw, SLOT(slotNumVersesChanged(int)) ); 315 connect( this, SIGNAL(sigNumVersesChanged(int)), tw, SLOT(slotNumVersesChanged(int)) );
316 connect( this, SIGNAL(sigFontChanged(const QFont *)), tw, SLOT(slotFontChanged(const QFont *)) ); 316 connect( this, SIGNAL(sigFontChanged(const QFont *)), tw, SLOT(slotFontChanged(const QFont *)) );
317 connect( this, SIGNAL(sigOptionChanged()), tw, SLOT(slotOptionChanged()) ); 317 connect( this, SIGNAL(sigOptionChanged()), tw, SLOT(slotOptionChanged()) );
318 318
319 m_tabs.addTab( tw, icon, modulename ); 319 m_tabs.addTab( tw, icon, modulename );
320 320
321 m_actionTextClose->setEnabled( true ); 321 m_actionTextClose->setEnabled( true );
322 m_actionEditCopy->setEnabled( true ); 322 m_actionEditCopy->setEnabled( true );
323 m_actionBookmarkAdd->setEnabled( true ); 323 m_actionBookmarkAdd->setEnabled( true );
324 324
325 // Set key if one is present 325 // Set key if one is present
326 if ( !key.isNull() ) 326 if ( !key.isNull() )
327 tw->setKey( key ); 327 tw->setKey( key );
328 setCaption( QString( "%1 - Dagger" ).arg( tw->getFullKey() ) );
329 m_navToolbar->setKey( tw->getAbbrevKey() );
328 } 330 }
329 } 331 }
330} 332}
331 333
332int MainWindow::findBookmark( const QString &bookmark ) 334int MainWindow::findBookmark( const QString &bookmark )
333{ 335{
334 int index = 3; 336 int index = 3;
335 int id = m_bookmarkMenu->idAt( index ); 337 int id = m_bookmarkMenu->idAt( index );
336 while ( ( id != -1 ) && ( m_bookmarkMenu->text( id ) != bookmark ) ) 338 while ( ( id != -1 ) && ( m_bookmarkMenu->text( id ) != bookmark ) )
337 { 339 {
338 ++index; 340 ++index;
339 id = m_bookmarkMenu->idAt( index ); 341 id = m_bookmarkMenu->idAt( index );
340 } 342 }
341 343
342 return id; 344 return id;
343} 345}
344 346
345void MainWindow::enableScreenBlanking( bool enable ) 347void MainWindow::enableScreenBlanking( bool enable )
346{ 348{
347 enable ? QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable 349 enable ? QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable
348 : QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::DisableSuspend; 350 : QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::DisableSuspend;
349} 351}
350 352
351void MainWindow::initConfig() 353void MainWindow::initConfig()
352{ 354{
353 bool show; 355 bool show;
354 356
355 m_config.setGroup( "Sword" ); 357 m_config.setGroup( "Sword" );
356 for ( QAction *a = m_actionSwordOpts.first(); a; a = m_actionSwordOpts.next() ) 358 for ( QAction *a = m_actionSwordOpts.first(); a; a = m_actionSwordOpts.next() )
357 { 359 {
358 show = m_config.readBoolEntry( a->text(), false ); 360 show = m_config.readBoolEntry( a->text(), false );
359 a->setOn( show ); 361 a->setOn( show );
360 m_swordMgr->setGlobalOption ( a->text(), show ? "On" : "Off" ); 362 m_swordMgr->setGlobalOption ( a->text(), show ? "On" : "Off" );
361 } 363 }
362 364
363 // Display/hide toolbars based on last run 365 // Display/hide toolbars based on last run
364 m_config.setGroup( "Config" ); 366 m_config.setGroup( "Config" );
365 367
366 m_alwaysOpenNew = m_config.readBoolEntry( "AlwaysOpenNew", false ); 368 m_alwaysOpenNew = m_config.readBoolEntry( "AlwaysOpenNew", false );
367 m_navToolbar->setAutoScrollRate( m_config.readNumEntry( "AutoScroll", 50 ) ); 369 m_navToolbar->setAutoScrollRate( m_config.readNumEntry( "AutoScroll", 50 ) );
368 m_disableScreenBlank = m_config.readBoolEntry( "DisableScreenBlanking", false ); 370 m_disableScreenBlank = m_config.readBoolEntry( "DisableScreenBlanking", false );
369 enableScreenBlanking( !m_disableScreenBlank ); 371 enableScreenBlanking( !m_disableScreenBlank );
370 m_copyFormat = m_config.readNumEntry( "CopyFormat", 0 ); 372 m_copyFormat = m_config.readNumEntry( "CopyFormat", 0 );
371 373
372 show = m_config.readBoolEntry( "NavBar", false ); 374 show = m_config.readBoolEntry( "NavBar", false );
373 m_actionViewNavToolbar->setOn( show ); 375 m_actionViewNavToolbar->setOn( show );
374 slotViewNavToolbar( show ); 376 slotViewNavToolbar( show );
375 377
376 m_numVerses = m_config.readNumEntry( "NumVerses", 5 ); 378 m_numVerses = m_config.readNumEntry( "NumVerses", 5 );
377 379
378 show = m_config.readBoolEntry( "SearchBar", false ); 380 show = m_config.readBoolEntry( "SearchBar", false );
379 m_actionViewSearchToolbar->setOn( show ); 381 m_actionViewSearchToolbar->setOn( show );
380 slotViewSearchToolbar( show ); 382 slotViewSearchToolbar( show );
381 383
382 // Set text font 384 // Set text font
383 m_config.setGroup( "Font" ); 385 m_config.setGroup( "Font" );
384 QString fontFamily = m_config.readEntry( "Family", QString::null ); 386 QString fontFamily = m_config.readEntry( "Family", QString::null );
385 !fontFamily.isNull() ? m_textFont = QFont( fontFamily, 387 !fontFamily.isNull() ? m_textFont = QFont( fontFamily,
386 m_config.readNumEntry( "Size", -1 ), 388 m_config.readNumEntry( "Size", -1 ),
387 m_config.readNumEntry( "Weight", QFont::Normal ), 389 m_config.readNumEntry( "Weight", QFont::Normal ),
388 m_config.readBoolEntry( "Italic", false ) ) 390 m_config.readBoolEntry( "Italic", false ) )
389 : m_textFont = font(); // If font is not configured, set to default widget font 391 : m_textFont = font(); // If font is not configured, set to default widget font
390 392
391 // Load bookmarks 393 // Load bookmarks
392 m_config.setGroup( "Bookmarks"); 394 m_config.setGroup( "Bookmarks");
393 int count = 1; 395 int count = 1;
394 QString key = m_config.readEntry( QString::number( count ), QString::null ); 396 QString key = m_config.readEntry( QString::number( count ), QString::null );
395 while ( !key.isNull() ) 397 while ( !key.isNull() )
396 { 398 {
397 int pos = key.find( "/" ); 399 int pos = key.find( "/" );
398 if ( pos > -1 ) 400 if ( pos > -1 )
399 { 401 {
400 QString bookmark; 402 QString bookmark;
401 bookmark.sprintf( "%s (%s)", key.right( key.length() - ( pos + 1 ) ).latin1(), 403 bookmark.sprintf( "%s (%s)", key.right( key.length() - ( pos + 1 ) ).latin1(),
402 key.left( pos ).latin1() ); 404 key.left( pos ).latin1() );
403 QAction *a = new QAction( bookmark, QString::null, 0, this, 0 ); 405 QAction *a = new QAction( bookmark, QString::null, 0, this, 0 );
404 a->addTo( m_bookmarkMenu ); 406 a->addTo( m_bookmarkMenu );
405 connect( a, SIGNAL(activated()), this, SLOT(slotBookmarkSelected()) ); 407 connect( a, SIGNAL(activated()), this, SLOT(slotBookmarkSelected()) );
406 } 408 }
407 409
408 ++count; 410 ++count;
409 key = m_config.readEntry( QString::number( count ), QString::null ); 411 key = m_config.readEntry( QString::number( count ), QString::null );
410 } 412 }
411 m_actionBookmarkRemove->setEnabled( count > 1 ); 413 m_actionBookmarkRemove->setEnabled( count > 1 );
412 414
413 // Load opened modules 415 // Load opened modules
414 m_config.setGroup( "Session"); 416 m_config.setGroup( "Session");
415 QString first; 417 QString first;
416 count = 1; 418 count = 1;
417 key = m_config.readEntry( QString::number( count ), QString::null ); 419 key = m_config.readEntry( QString::number( count ), QString::null );
418 while ( !key.isNull() ) 420 while ( !key.isNull() )
419 { 421 {
420 int pos = key.find( "/" ); 422 int pos = key.find( "/" );
421 if ( pos > -1 ) 423 if ( pos > -1 )
422 { 424 {
423 if ( count == 1 ) 425 if ( count == 1 )
@@ -541,213 +543,207 @@ void MainWindow::slotBookmarkAdd()
541 { 543 {
542 // See if bookmark doesn't already exists 544 // See if bookmark doesn't already exists
543 QString bookmark = text->getFullKey(); 545 QString bookmark = text->getFullKey();
544 int menuId = findBookmark( bookmark ); 546 int menuId = findBookmark( bookmark );
545 if ( menuId == -1 ) 547 if ( menuId == -1 )
546 { 548 {
547 // Bookmark not found, add 549 // Bookmark not found, add
548 QAction *a = new QAction( bookmark, QString::null, 0, this, 0 ); 550 QAction *a = new QAction( bookmark, QString::null, 0, this, 0 );
549 a->addTo( m_bookmarkMenu ); 551 a->addTo( m_bookmarkMenu );
550 connect( a, SIGNAL(activated()), this, SLOT(slotBookmarkSelected()) ); 552 connect( a, SIGNAL(activated()), this, SLOT(slotBookmarkSelected()) );
551 553
552 // Make sure remove option is enabled 554 // Make sure remove option is enabled
553 m_actionBookmarkRemove->setEnabled( true ); 555 m_actionBookmarkRemove->setEnabled( true );
554 556
555 } 557 }
556 } 558 }
557} 559}
558 560
559void MainWindow::slotBookmarkRemove() 561void MainWindow::slotBookmarkRemove()
560{ 562{
561 TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget()); 563 TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget());
562 if ( text ) 564 if ( text )
563 { 565 {
564 // See if bookmark exists for current module key 566 // See if bookmark exists for current module key
565 int menuId = findBookmark( text->getFullKey() ); 567 int menuId = findBookmark( text->getFullKey() );
566 if ( menuId != -1 ) 568 if ( menuId != -1 )
567 { 569 {
568 // Bookmark found, remove 570 // Bookmark found, remove
569 m_bookmarkMenu->removeItem( menuId ); 571 m_bookmarkMenu->removeItem( menuId );
570 572
571 //If this was the last bookmark, disable the remove option 573 //If this was the last bookmark, disable the remove option
572 if ( m_bookmarkMenu->idAt( 3 ) == -1 ) 574 if ( m_bookmarkMenu->idAt( 3 ) == -1 )
573 m_actionBookmarkRemove->setEnabled( false ); 575 m_actionBookmarkRemove->setEnabled( false );
574 } 576 }
575 } 577 }
576} 578}
577 579
578void MainWindow::slotBookmarkSelected() 580void MainWindow::slotBookmarkSelected()
579{ 581{
580 const QAction *action = reinterpret_cast<const QAction *>(sender()); 582 const QAction *action = reinterpret_cast<const QAction *>(sender());
581 if ( action ) 583 if ( action )
582 { 584 {
583 QString bookmark = action->text(); 585 QString bookmark = action->text();
584 int pos = bookmark.find( " (" ); 586 int pos = bookmark.find( " (" );
585 QString key = bookmark.left( pos ); 587 QString key = bookmark.left( pos );
586 pos += 2; 588 pos += 2;
587 QString module = bookmark.mid( pos, bookmark.find( ")", pos ) - pos ); 589 QString module = bookmark.mid( pos, bookmark.find( ")", pos ) - pos );
588 590
589 openModule( module, key ); 591 openModule( module, key );
590 } 592 }
591} 593}
592 594
593void MainWindow::slotViewSwordOption( bool enabled ) 595void MainWindow::slotViewSwordOption( bool enabled )
594{ 596{
595 const QAction *action = reinterpret_cast<const QAction*>(sender()); 597 const QAction *action = reinterpret_cast<const QAction*>(sender());
596 m_swordMgr->setGlobalOption ( action->text(), enabled ? "On" : "Off" ); 598 m_swordMgr->setGlobalOption ( action->text(), enabled ? "On" : "Off" );
597 599
598 emit sigOptionChanged(); 600 emit sigOptionChanged();
599} 601}
600 602
601void MainWindow::slotViewNavToolbar( bool enabled ) 603void MainWindow::slotViewNavToolbar( bool enabled )
602{ 604{
603 enabled ? m_navToolbar->show() 605 enabled ? m_navToolbar->show()
604 : m_navToolbar->hide(); 606 : m_navToolbar->hide();
605} 607}
606 608
607void MainWindow::slotViewSearchToolbar( bool enabled ) 609void MainWindow::slotViewSearchToolbar( bool enabled )
608{ 610{
609 enabled ? m_searchToolbar->show() 611 enabled ? m_searchToolbar->show()
610 : m_searchToolbar->hide(); 612 : m_searchToolbar->hide();
611} 613}
612 614
613void MainWindow::slotNavPrevPage() 615void MainWindow::slotNavPrevPage()
614{ 616{
615 TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget()); 617 TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget());
616 if ( text ) 618 if ( text )
617 { 619 {
618 text->prevPage(); 620 text->prevPage();
619 setCaption( QString( "%1 - Dagger" ).arg( text->getFullKey() ) ); 621 setCaption( QString( "%1 - Dagger" ).arg( text->getFullKey() ) );
620 m_navToolbar->setKey( text->getAbbrevKey() ); 622 m_navToolbar->setKey( text->getAbbrevKey() );
621 } 623 }
622} 624}
623 625
624void MainWindow::slotNavPrevVerse() 626void MainWindow::slotNavPrevVerse()
625{ 627{
626 TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget()); 628 TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget());
627 if ( text ) 629 if ( text )
628 { 630 {
629 text->prevVerse(); 631 text->prevVerse();
630 setCaption( QString( "%1 - Dagger" ).arg( text->getFullKey() ) ); 632 setCaption( QString( "%1 - Dagger" ).arg( text->getFullKey() ) );
631 m_navToolbar->setKey( text->getAbbrevKey() ); 633 m_navToolbar->setKey( text->getAbbrevKey() );
632 } 634 }
633} 635}
634 636
635void MainWindow::slotNavKeyChanged( const QString &newKey ) 637void MainWindow::slotNavKeyChanged( const QString &newKey )
636{ 638{
637 QString key = newKey;
638 key.replace( QRegExp( "[-=.]" ), ":" );
639
640 TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget()); 639 TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget());
641 if ( text ) 640 if ( text )
642 { 641 {
642 QString key = newKey;
643 if ( text->isBibleText() )
644 key.replace( QRegExp( "[-=.]" ), ":" );
645
643 text->setKey( key ); 646 text->setKey( key );
644 setCaption( QString( "%1 - Dagger" ).arg( text->getFullKey() ) ); 647 setCaption( QString( "%1 - Dagger" ).arg( text->getFullKey() ) );
645 } 648 }
646} 649}
647 650
648void MainWindow::slotNavNextVerse() 651void MainWindow::slotNavNextVerse()
649{ 652{
650 TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget()); 653 TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget());
651 if ( text ) 654 if ( text )
652 { 655 {
653 text->nextVerse(); 656 text->nextVerse();
654 setCaption( QString( "%1 - Dagger" ).arg( text->getFullKey() ) ); 657 setCaption( QString( "%1 - Dagger" ).arg( text->getFullKey() ) );
655 m_navToolbar->setKey( text->getAbbrevKey() ); 658 m_navToolbar->setKey( text->getAbbrevKey() );
656 } 659 }
657} 660}
658 661
659void MainWindow::slotNavNextPage() 662void MainWindow::slotNavNextPage()
660{ 663{
661 TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget()); 664 TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget());
662 if ( text ) 665 if ( text )
663 { 666 {
664 text->nextPage(); 667 text->nextPage();
665 setCaption( QString( "%1 - Dagger" ).arg( text->getFullKey() ) ); 668 setCaption( QString( "%1 - Dagger" ).arg( text->getFullKey() ) );
666 m_navToolbar->setKey( text->getAbbrevKey() ); 669 m_navToolbar->setKey( text->getAbbrevKey() );
667 } 670 }
668} 671}
669 672
670void MainWindow::slotNavAutoScroll( bool enabled ) 673void MainWindow::slotNavAutoScroll( bool enabled )
671{ 674{
672 m_autoScrollTimer.stop(); 675 m_autoScrollTimer.stop();
673 676
674 if ( enabled ) 677 if ( enabled )
675 m_autoScrollTimer.start( m_navToolbar->autoScrollRate() * 100 ); 678 m_autoScrollTimer.start( m_navToolbar->autoScrollRate() * 100 );
676} 679}
677 680
678void MainWindow::slotNavScrollRateChanged( int newRate ) 681void MainWindow::slotNavScrollRateChanged( int newRate )
679{ 682{
680 if ( m_autoScrollTimer.isActive() ) 683 if ( m_autoScrollTimer.isActive() )
681 { 684 {
682 m_autoScrollTimer.stop(); 685 m_autoScrollTimer.stop();
683 m_autoScrollTimer.start( newRate * 100 ); 686 m_autoScrollTimer.start( newRate * 100 );
684 } 687 }
685} 688}
686 689
687void MainWindow::slotSearchResultClicked( const QString &key ) 690void MainWindow::slotSearchResultClicked( const QString &key )
688{ 691{
689 TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget()); 692 TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget());
690 if ( text ) 693 if ( text )
691 { 694 {
692 text->setKey( key ); 695 text->setKey( key );
693 setCaption( QString( "%1 - Dagger" ).arg( text->getFullKey() ) ); 696 setCaption( QString( "%1 - Dagger" ).arg( text->getFullKey() ) );
694 m_navToolbar->setKey( text->getAbbrevKey() ); 697 m_navToolbar->setKey( text->getAbbrevKey() );
695 } 698 }
696} 699}
697 700
698void MainWindow::slotTextRefClicked( const QString &ref ) 701void MainWindow::slotTextRefClicked( const QString &ref )
699{ 702{
700//printf( "Ref clicked: '%s'\n", ref.latin1() ); 703//printf( "Ref clicked: '%s'\n", ref.latin1() );
701/* 704/*
702Ref clicked: 'type=Strongs value=G3482' 705Ref clicked: 'passagestudy.jsp?action=showStrongs&type=Hebrew&value=07225'
703Ref clicked: 'type=Strongs value=H07225' 706Ref clicked: 'passagestudy.jsp?action=showStrongs&type=Greek&value=602'
704Ref clicked: 'type=morph class=x-Robinson:N-PRI value=N-PRI' 707Ref clicked: 'passagestudy.jsp?action=showMorph&type=x-Robinson%3AN-NSF&value=N-NSF'
705Ref clicked: 'type=morph class=x-StrongsMorph:TH8804 value=TH8804' 708Ref clicked: 'passagestudy.jsp?action=showNote&type=n&value=1&module=KJV&passage=Genesis+1%3A5'
706*/ 709*/
707 //owarn << "Reference: " << ref << oendl; 710 //owarn << "Reference: " << ref << oendl;
708 if ( !ref.isNull() ) 711 if ( !ref.isNull() )
709 { 712 {
710 TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget()); 713 TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget());
711 if ( text ) 714 if ( text )
712 { 715 {
716 // Parse action
717 int pos = ref.find( '&', 28 );
718 QString actionStr = ref.mid( 28, pos - 28 );
719
713 // Parse type 720 // Parse type
714 int pos = ref.find( "type=", 0, false ) + 5; 721 pos = ref.find( "type=", pos, false ) + 5;
715 QString typeStr = ref.mid( pos, ref.find( ' ', pos ) - pos ); 722 QString typeStr = ref.mid( pos, ref.find( '&', pos ) - pos );
716 723
717 // Parse class (for morph. only)
718 QString classStr;
719 if ( typeStr == "morph" )
720 {
721 pos = ref.find( "class=", 0, false ) + 5;
722 QString classStr = ref.mid( pos, ref.find( ' ', pos ) - pos );
723
724 // TODO - need to strip 'x-' from beginning and ':key' at end?
725 }
726
727 // Parse value 724 // Parse value
728 pos = ref.find( "value=", 0, false ) + 6; 725 pos = ref.find( "value=", 0, false ) + 6;
729 QString valueStr = ref.mid( pos, ref.find( ' ', pos ) - pos ); 726 QString valueStr = ref.mid( pos, ref.find( ' ', pos ) - pos );
730 727
731 if ( typeStr == "Strongs" ) 728 if ( actionStr == "Strongs" )
729 {
730 QString module = actionStr;
731 module.append( typeStr );
732
733 // Open reference
734 openModule( module, valueStr );
735 }
736 else if ( actionStr == "Morph" )
732 { 737 {
733 //Determine if is a Hebrew or Greek reference 738 QString module = typeStr.mid( 2, typeStr.find( '%', 2 ) - 2 );
734 QString module; 739
735 if ( valueStr.at( 0 ) == 'H' )
736 module = "StrongsHebrew";
737 else
738 module = "StrongsGreek";
739
740 // Get key
741 QString key( valueStr );
742 key.remove( 0, 1 );
743 // Open reference 740 // Open reference
744 openModule( module, key ); 741 openModule( module, valueStr );
745 } 742 }
746 else if ( typeStr == "morph" ) 743 else if ( actionStr == "Note" )
747 { 744 {
748 QMessageBox::information( this, tr( "Morphological Tags" ), 745 // TODO
749 tr( "Morphological tag cross-referencing not implemented yet." ) );
750 } 746 }
751 } 747 }
752 } 748 }
753} 749}
diff --git a/noncore/apps/dagger/opie-dagger.control b/noncore/apps/dagger/opie-dagger.control
index 4ded1f2..e613ddb 100644
--- a/noncore/apps/dagger/opie-dagger.control
+++ b/noncore/apps/dagger/opie-dagger.control
@@ -1,9 +1,9 @@
1Package: opie-dagger 1Package: opie-dagger
2Files: plugins/application/libdagger.so* bin/dagger pics/dagger apps/Applications/dagger.desktop 2Files: plugins/application/libdagger.so* bin/dagger pics/dagger apps/Applications/dagger.desktop
3Priority: optional 3Priority: optional
4Section: opie/applications 4Section: opie/applications
5Depends: task-opie-minimal, libopiecore2, libopieui2 5Depends: task-opie-minimal, libopiecore2, libopieui2
6Architecture: arm 6Architecture: arm
7Maintainer: Dan Williams (drw@handhelds.org) 7Maintainer: Dan Williams (drw@handhelds.org)
8Description: A Bible study program utilizing the Sword library. 8Description: A Bible study program utilizing the Sword library.
9Version: 0.9.1$EXTRAVERSION 9Version: 0.9.2$EXTRAVERSION
diff --git a/noncore/apps/dagger/searchbar.cpp b/noncore/apps/dagger/searchbar.cpp
index b195f67..463a19f 100644
--- a/noncore/apps/dagger/searchbar.cpp
+++ b/noncore/apps/dagger/searchbar.cpp
@@ -1,182 +1,182 @@
1/* 1/*
2Dagger - A Bible study program utilizing the Sword library. 2Dagger - A Bible study program utilizing the Sword library.
3Copyright (c) 2004 Dan Williams <drw@handhelds.org> 3Copyright (c) 2004 Dan Williams <drw@handhelds.org>
4 4
5This file is free software; you can redistribute it and/or modify it under 5This file is free software; you can redistribute it and/or modify it under
6the terms of the GNU General Public License as published by the Free Software 6the terms of the GNU General Public License as published by the Free Software
7Foundation; either version 2 of the License, or (at your option) any later version. 7Foundation; either version 2 of the License, or (at your option) any later version.
8 8
9This file is distributed in the hope that it will be useful, but WITHOUT ANY 9This file is distributed in the hope that it will be useful, but WITHOUT ANY
10WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 10WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11PARTICULAR PURPOSE. See the GNU General Public License for more details. 11PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 12
13You should have received a copy of the GNU General Public License along with this 13You should have received a copy of the GNU General Public License along with this
14file; see the file COPYING. If not, write to the Free Software Foundation, Inc., 14file; see the file COPYING. If not, write to the Free Software Foundation, Inc.,
1559 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 1559 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16*/ 16*/
17 17
18#include "searchbar.h" 18#include "searchbar.h"
19#include "textwidget.h" 19#include "textwidget.h"
20 20
21#include <opie2/oresource.h> 21#include <opie2/oresource.h>
22#include <opie2/owait.h> 22#include <opie2/owait.h>
23 23
24#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.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#include <qwhatsthis.h> 29#include <qwhatsthis.h>
30 30
31#include <listkey.h> 31#include <listkey.h>
32#include <regex.h> 32#include <regex.h>
33#include <versekey.h> 33#include <versekey.h>
34 34
35void searchCallback( char /*percent*/, void */*userData*/ ) 35void searchCallback( char /*percent*/, void */*userData*/ )
36{ 36{
37 qApp->processEvents(); 37 qApp->processEvents();
38} 38}
39 39
40SearchBar::SearchBar( QMainWindow *parent ) 40SearchBar::SearchBar( QMainWindow *parent )
41 : QToolBar( QString::null, parent, QMainWindow::Top, true ) 41 : QToolBar( QString::null, parent, QMainWindow::Top, true )
42 , m_currText( 0x0 ) 42 , m_currText( 0x0 )
43{ 43{
44 // Initialize UI 44 // Initialize UI
45 m_searchText = new QLineEdit( this ); 45 m_searchText = new QLineEdit( this );
46 setStretchableWidget( m_searchText ); 46 setStretchableWidget( m_searchText );
47 QWhatsThis::add( m_searchText, tr( "Enter text to search for here." ) ); 47 QWhatsThis::add( m_searchText, tr( "Enter text to search for here." ) );
48 connect(m_searchText, SIGNAL(textChanged(const QString &)), 48 connect(m_searchText, SIGNAL(textChanged(const QString &)),
49 this, SLOT(slotTextChanged(const QString &)) ); 49 this, SLOT(slotTextChanged(const QString &)) );
50 50
51 m_actionFind = new QAction( tr( "Find" ), 51 m_actionFind = new QAction( tr( "Find" ),
52 Opie::Core::OResource::loadPixmap( "find", Opie::Core::OResource::SmallIcon ), 52 Opie::Core::OResource::loadPixmap( "find", Opie::Core::OResource::SmallIcon ),
53 QString::null, 0, this, 0 ); 53 QString::null, 0, this, 0 );
54 m_actionFind->setEnabled( false ); 54 m_actionFind->setEnabled( false );
55 m_actionFind->addTo( this ); 55 m_actionFind->addTo( this );
56 m_actionFind->setWhatsThis( tr( "Tap here search the current module for the text entered to the left." ) ); 56 m_actionFind->setWhatsThis( tr( "Tap here search the current module for the text entered to the left." ) );
57 connect( m_actionFind, SIGNAL(activated()), this, SLOT(slotFind()) ); 57 connect( m_actionFind, SIGNAL(activated()), this, SLOT(slotFind()) );
58 58
59 addSeparator(); 59 addSeparator();
60 60
61 m_actionPrev = new QAction( tr( "Previous result" ), 61 m_actionPrev = new QAction( tr( "Previous result" ),
62 Opie::Core::OResource::loadPixmap( "back", Opie::Core::OResource::SmallIcon ), 62 Opie::Core::OResource::loadPixmap( "back", Opie::Core::OResource::SmallIcon ),
63 QString::null, 0, this, 0 ); 63 QString::null, 0, this, 0 );
64 m_actionPrev->setEnabled( false ); 64 m_actionPrev->setEnabled( false );
65 m_actionPrev->addTo( this ); 65 m_actionPrev->addTo( this );
66 m_actionPrev->setWhatsThis( tr( "Tap here to view the previous search result." ) ); 66 m_actionPrev->setWhatsThis( tr( "Tap here to view the previous search result." ) );
67 connect( m_actionPrev, SIGNAL(activated()), this, SLOT(slotPrev()) ); 67 connect( m_actionPrev, SIGNAL(activated()), this, SLOT(slotPrev()) );
68 68
69 m_resultList = new QComboBox( this ); 69 m_resultList = new QComboBox( this );
70 m_resultList->setEnabled( false ); 70 m_resultList->setEnabled( false );
71 QWhatsThis::add( m_resultList, tr( "Select the desired search result here." ) ); 71 QWhatsThis::add( m_resultList, tr( "Select the desired search result here." ) );
72 connect( m_resultList, SIGNAL(activated(const QString &)), this, SIGNAL(sigResultClicked(const QString &)) ); 72 connect( m_resultList, SIGNAL(activated(const QString &)), this, SIGNAL(sigResultClicked(const QString &)) );
73 73
74 m_actionNext = new QAction( tr( "Next result" ), 74 m_actionNext = new QAction( tr( "Next result" ),
75 Opie::Core::OResource::loadPixmap( "forward", Opie::Core::OResource::SmallIcon ), 75 Opie::Core::OResource::loadPixmap( "forward", Opie::Core::OResource::SmallIcon ),
76 QString::null, 0, this, 0 ); 76 QString::null, 0, this, 0 );
77 m_actionNext->setEnabled( false ); 77 m_actionNext->setEnabled( false );
78 m_actionNext->addTo( this ); 78 m_actionNext->addTo( this );
79 m_actionNext->setWhatsThis( tr( "Tap here to view the next search result." ) ); 79 m_actionNext->setWhatsThis( tr( "Tap here to view the next search result." ) );
80 connect( m_actionNext, SIGNAL(activated()), this, SLOT(slotNext()) ); 80 connect( m_actionNext, SIGNAL(activated()), this, SLOT(slotNext()) );
81 81
82 if ( parent ) 82 if ( parent )
83 { 83 {
84 installEventFilter( parent ); 84 installEventFilter( parent );
85 // TODO - install for all controls 85 // TODO - install for all controls
86 m_searchText->installEventFilter( parent ); 86 m_searchText->installEventFilter( parent );
87 } 87 }
88} 88}
89 89
90void SearchBar::setCurrModule( TextWidget *currText ) 90void SearchBar::setCurrModule( TextWidget *currText )
91{ 91{
92 m_actionFind->setEnabled( ( m_searchText->text() != "" ) && currText ); 92 m_actionFind->setEnabled( ( m_searchText->text() != "" ) && currText );
93 93
94 if ( !m_currText || ( currText->getModuleName() != m_currText->getModuleName() ) ) 94 if ( !m_currText || !currText || ( currText->getModuleName() != m_currText->getModuleName() ) )
95 { 95 {
96 m_actionPrev->setEnabled( false ); 96 m_actionPrev->setEnabled( false );
97 m_resultList->clear(); 97 m_resultList->clear();
98 m_resultList->setEnabled( false ); 98 m_resultList->setEnabled( false );
99 m_actionNext->setEnabled( false ); 99 m_actionNext->setEnabled( false );
100 } 100 }
101 101
102 m_currText = currText; 102 m_currText = currText;
103} 103}
104 104
105void SearchBar::slotTextChanged( const QString &newText ) 105void SearchBar::slotTextChanged( const QString &newText )
106{ 106{
107 m_actionFind->setEnabled( ( newText != "" ) && m_currText ); 107 m_actionFind->setEnabled( ( newText != "" ) && m_currText );
108} 108}
109 109
110void SearchBar::slotFind() 110void SearchBar::slotFind()
111{ 111{
112 m_resultList->clear(); 112 m_resultList->clear();
113 113
114 // Change application title and display Opie wait dialog to indicate search is beginning 114 // Change application title and display Opie wait dialog to indicate search is beginning
115 QWidget *pWidget = reinterpret_cast<QWidget *>(parent()); 115 QWidget *pWidget = reinterpret_cast<QWidget *>(parent());
116 QString caption = pWidget->caption(); 116 QString caption = pWidget->caption();
117 pWidget->setCaption( "Searching..." ); 117 pWidget->setCaption( "Searching..." );
118 118
119 Opie::Ui::OWait wait( pWidget ); 119 Opie::Ui::OWait wait( pWidget );
120 wait.show(); 120 wait.show();
121 qApp->processEvents(); 121 qApp->processEvents();
122 122
123 // Perform search 123 // Perform search
124 // TODO - implement search callback function to animate wait cursor 124 // TODO - implement search callback function to animate wait cursor
125 sword::ListKey results = m_currText->getModule()->Search( m_searchText->text().latin1(), 0, REG_ICASE, 0, 0, 125 sword::ListKey results = m_currText->getModule()->Search( m_searchText->text().latin1(), 0, REG_ICASE, 0, 0,
126 &searchCallback ); 126 &searchCallback );
127 127
128 // Process results 128 // Process results
129 int count = results.Count(); 129 int count = results.Count();
130 bool found = count > 0; 130 bool found = count > 0;
131 if ( found ) 131 if ( found )
132 { 132 {
133 // Populate results combo box 133 // Populate results combo box
134 sword::VerseKey key; 134 sword::VerseKey key;
135 for ( int i = 0; i < count; i++ ) 135 for ( int i = 0; i < count; i++ )
136 { 136 {
137 key.setText( results.GetElement( i )->getText() ); 137 key.setText( results.GetElement( i )->getText() );
138 m_resultList->insertItem( key.getShortText() ); 138 m_resultList->insertItem( key.getShortText() );
139 } 139 }
140 140
141 // Goto first result in list 141 // Goto first result in list
142 m_resultList->setCurrentItem( 0 ); 142 m_resultList->setCurrentItem( 0 );
143 emit sigResultClicked( m_resultList->currentText() ); 143 emit sigResultClicked( m_resultList->currentText() );
144 } 144 }
145 else 145 else
146 { 146 {
147 // Reset application title 147 // Reset application title
148 pWidget->setCaption( caption ); 148 pWidget->setCaption( caption );
149 } 149 }
150 150
151 // UI clean-up 151 // UI clean-up
152 wait.hide(); 152 wait.hide();
153 153
154 m_actionPrev->setEnabled( false ); 154 m_actionPrev->setEnabled( false );
155 m_resultList->setEnabled( found ); 155 m_resultList->setEnabled( found );
156 m_actionNext->setEnabled( count > 1 ); 156 m_actionNext->setEnabled( count > 1 );
157} 157}
158 158
159void SearchBar::slotPrev() 159void SearchBar::slotPrev()
160{ 160{
161 int item = m_resultList->currentItem() - 1; 161 int item = m_resultList->currentItem() - 1;
162 m_resultList->setCurrentItem( item ); 162 m_resultList->setCurrentItem( item );
163 emit sigResultClicked( m_resultList->currentText() ); 163 emit sigResultClicked( m_resultList->currentText() );
164 164
165 m_actionPrev->setEnabled( item > 0 ); 165 m_actionPrev->setEnabled( item > 0 );
166 m_actionNext->setEnabled( item < m_resultList->count() - 1 ); 166 m_actionNext->setEnabled( item < m_resultList->count() - 1 );
167} 167}
168 168
169void SearchBar::slotNext() 169void SearchBar::slotNext()
170{ 170{
171 int item = m_resultList->currentItem() + 1; 171 int item = m_resultList->currentItem() + 1;
172 m_resultList->setCurrentItem( item ); 172 m_resultList->setCurrentItem( item );
173 emit sigResultClicked( m_resultList->currentText() ); 173 emit sigResultClicked( m_resultList->currentText() );
174 174
175 m_actionPrev->setEnabled( true ); 175 m_actionPrev->setEnabled( true );
176 m_actionNext->setEnabled( item < m_resultList->count() - 1 ); 176 m_actionNext->setEnabled( item < m_resultList->count() - 1 );
177} 177}
178 178
179void SearchBar::slotCloseBtn() 179void SearchBar::slotCloseBtn()
180{ 180{
181 hide(); 181 hide();
182} 182}