summaryrefslogtreecommitdiff
authordrw <drw>2004-04-22 14:30:24 (UTC)
committer drw <drw>2004-04-22 14:30:24 (UTC)
commit00977d309bc991ffb4a84216881b53432c6d0b47 (patch) (unidiff)
tree7888656814ad09fb8930c198caadc56561687918
parent162c71d6528515ea4b28520e9708c8ce9ca7fba2 (diff)
downloadopie-00977d309bc991ffb4a84216881b53432c6d0b47.zip
opie-00977d309bc991ffb4a84216881b53432c6d0b47.tar.gz
opie-00977d309bc991ffb4a84216881b53432c6d0b47.tar.bz2
Fixed disabling of screen blanking, implemented prev/next page scrolling and fixed search OWait useage
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/dagger/ChangeLog7
-rw-r--r--noncore/apps/dagger/README2
-rw-r--r--noncore/apps/dagger/TODO6
-rw-r--r--noncore/apps/dagger/mainwindow.cpp17
-rw-r--r--noncore/apps/dagger/mainwindow.h4
-rw-r--r--noncore/apps/dagger/navbar.cpp16
-rw-r--r--noncore/apps/dagger/navbar.h8
-rw-r--r--noncore/apps/dagger/opie-dagger.control4
-rw-r--r--noncore/apps/dagger/searchbar.cpp8
-rw-r--r--noncore/apps/dagger/textwidget.cpp8
-rw-r--r--noncore/apps/dagger/textwidget.h4
11 files changed, 50 insertions, 34 deletions
diff --git a/noncore/apps/dagger/ChangeLog b/noncore/apps/dagger/ChangeLog
index feb9a19..108419e 100644
--- a/noncore/apps/dagger/ChangeLog
+++ b/noncore/apps/dagger/ChangeLog
@@ -1,4 +1,11 @@
12004-04-22 Dan Williams <drw@handhelds.org>
2
3 * Released version 0.9.1
4 * Fixed the disabling of screen blanking
5 * Implement previous/next page scrolling
6 * Animate search OWait
7
12004-04-06 Dan Williams <drw@handhelds.org> 82004-04-06 Dan Williams <drw@handhelds.org>
2 9
3 * Released version 0.9.0 10 * Released version 0.9.0
4 * Initial check-in of new application 11 * Initial check-in of new application
diff --git a/noncore/apps/dagger/README b/noncore/apps/dagger/README
index 4a4bb61..00e9eed 100644
--- a/noncore/apps/dagger/README
+++ b/noncore/apps/dagger/README
@@ -1,53 +1,53 @@
1/************************************************************************ 1/************************************************************************
2/* 2/*
3/* Opie - Dagger 3/* Opie - Dagger
4/* =============== 4/* ===============
5/* Version 0.9.0 5/* Version 0.9.1
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 - April, 2004
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 (best to use version 1.5.x 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 Dan Williams
52 52
53====================== 53======================
diff --git a/noncore/apps/dagger/TODO b/noncore/apps/dagger/TODO
index 2548dd3..1530bd6 100644
--- a/noncore/apps/dagger/TODO
+++ b/noncore/apps/dagger/TODO
@@ -1,27 +1,25 @@
1/************************************************************************ 1/************************************************************************
2/* 2/*
3/* Opie - Dagger 3/* Opie - Dagger
4/* =============== 4/* ===============
5/* Version 0.9.0 5/* Version 0.9.1
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 - April, 2004
13------------------------------------ 13------------------------------------
14 14
15====================== 15======================
16= Current release = 16= Current release =
17====================== 17======================
18 18
191. Implement search function callback to animate OWait dialog 191. Implement module installation
202. Implement previous/next page scrolling
213. Fix disablement of screen blanking
22 20
23====================== 21======================
24= Future releases = 22= Future releases =
25====================== 23======================
26 24
271. Margin notes \ No newline at end of file 251. Margin notes \ No newline at end of file
diff --git a/noncore/apps/dagger/mainwindow.cpp b/noncore/apps/dagger/mainwindow.cpp
index ace8f36..b2e00e8 100644
--- a/noncore/apps/dagger/mainwindow.cpp
+++ b/noncore/apps/dagger/mainwindow.cpp
@@ -28,197 +28,200 @@ file; see the file COPYING. If not, write to the Free Software Foundation, Inc.,
28#include <qpe/qpeapplication.h> 28#include <qpe/qpeapplication.h>
29#include <qpe/resource.h> 29#include <qpe/resource.h>
30 30
31#include <qaction.h> 31#include <qaction.h>
32#include <qclipboard.h> 32#include <qclipboard.h>
33#include <qmenubar.h> 33#include <qmenubar.h>
34#include <qobjectlist.h> 34#include <qobjectlist.h>
35#include <qpopupmenu.h> 35#include <qpopupmenu.h>
36#include <qtimer.h> 36#include <qtimer.h>
37#include <qtoolbar.h> 37#include <qtoolbar.h>
38 38
39#include <markupfiltmgr.h> 39#include <markupfiltmgr.h>
40 40
41MainWindow::MainWindow( QWidget *parent, const char *name, WFlags /*fl*/ ) 41MainWindow::MainWindow( QWidget *parent, const char *name, WFlags /*fl*/ )
42 : QMainWindow( parent, name, WStyle_ContextHelp ) 42 : QMainWindow( parent, name, WStyle_ContextHelp )
43 , m_config( "dagger" ) 43 , m_config( "dagger" )
44 , m_tabs( this ) 44 , m_tabs( this )
45 , m_autoScrollTimer( this ) 45 , m_autoScrollTimer( this )
46{ 46{
47 // Initialize sword library manager 47 // Initialize sword library manager
48 m_config.setGroup( "Sword" ); 48 m_config.setGroup( "Sword" );
49 m_modulePath = m_config.readEntry( "ModPath", "/usr/local/share/sword" ); 49 m_modulePath = m_config.readEntry( "ModPath", "/usr/local/share/sword" );
50 m_swordMgr = new sword::SWMgr( m_modulePath.latin1(), true, 50 m_swordMgr = new sword::SWMgr( m_modulePath.latin1(), true,
51 new sword::MarkupFilterMgr( sword::FMT_HTMLHREF ) ); 51 new sword::MarkupFilterMgr( sword::FMT_HTMLHREF ) );
52 52
53 // Retrieve list of available Sword module options (e.g. footnotes, Strong's numbers, etc.) 53 // Retrieve list of available Sword module options (e.g. footnotes, Strong's numbers, etc.)
54 sword::OptionsList swordOpts = m_swordMgr->getGlobalOptions(); 54 sword::OptionsList swordOpts = m_swordMgr->getGlobalOptions();
55 for ( sword::OptionsList::iterator it = swordOpts.begin(); it != swordOpts.end(); it++ ) 55 for ( sword::OptionsList::iterator it = swordOpts.begin(); it != swordOpts.end(); it++ )
56 m_actionSwordOpts.append( new QAction( (*it).c_str(), QString::null, 0, this, 0 ) ); 56 m_actionSwordOpts.append( new QAction( (*it).c_str(), QString::null, 0, this, 0 ) );
57 m_actionSwordOpts.sort(); 57 m_actionSwordOpts.sort();
58 58
59 // Initialize user interface 59 // Initialize user interface
60 setCaption( tr( "Dagger" ) ); 60 setCaption( tr( "Dagger" ) );
61 initUI(); 61 initUI();
62 62
63 connect( &m_tabs, SIGNAL(currentChanged(QWidget *)), this, SLOT( slotTextDisplayed(QWidget *)) ); 63 connect( &m_tabs, SIGNAL(currentChanged(QWidget *)), this, SLOT( slotTextDisplayed(QWidget *)) );
64 connect( &m_autoScrollTimer, SIGNAL(timeout()), this, SLOT(slotNavNextVerse()) ); 64 connect( &m_autoScrollTimer, SIGNAL(timeout()), this, SLOT(slotNavNextVerse()) );
65 65
66 m_bibleIcon = new QPixmap( Resource::loadPixmap( "dagger/bibletext" ) ); 66 m_bibleIcon = new QPixmap( Resource::loadPixmap( "dagger/bibletext" ) );
67 m_commentaryIcon = new QPixmap( Resource::loadPixmap( "dagger/commentary" ) ); 67 m_commentaryIcon = new QPixmap( Resource::loadPixmap( "dagger/commentary" ) );
68 m_lexiconIcon = new QPixmap( Resource::loadPixmap( "dagger/lexicon" ) ); 68 m_lexiconIcon = new QPixmap( Resource::loadPixmap( "dagger/lexicon" ) );
69 69
70 // Load initial configuration 70 // Load initial configuration
71 QTimer::singleShot( 100, this, SLOT( initConfig() ) ); 71 QTimer::singleShot( 100, this, SLOT( initConfig() ) );
72} 72}
73 73
74MainWindow::~MainWindow() 74MainWindow::~MainWindow()
75{ 75{
76 // Re-enable screen blanking if it was disabled
77 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
78
76 // Save Sword options 79 // Save Sword options
77 m_config.setGroup( "Sword" ); 80 m_config.setGroup( "Sword" );
78 m_config.writeEntry( "ModPath", m_modulePath ); 81 m_config.writeEntry( "ModPath", m_modulePath );
79 82
80 for ( QAction *a = m_actionSwordOpts.first(); a; a = m_actionSwordOpts.next() ) 83 for ( QAction *a = m_actionSwordOpts.first(); a; a = m_actionSwordOpts.next() )
81 m_config.writeEntry( a->text(), a->isOn() ); 84 m_config.writeEntry( a->text(), a->isOn() );
82 85
83 // Save configuration options 86 // Save configuration options
84 m_config.setGroup( "Config" ); 87 m_config.setGroup( "Config" );
85 m_config.writeEntry( "AlwaysOpenNew", m_alwaysOpenNew ); 88 m_config.writeEntry( "AlwaysOpenNew", m_alwaysOpenNew );
86 m_config.writeEntry( "AutoScroll", m_navToolbar->autoScrollRate() ); 89 m_config.writeEntry( "AutoScroll", m_navToolbar->autoScrollRate() );
87 m_config.writeEntry( "DisableScreenBlanking", m_disableScreenBlank ); 90 m_config.writeEntry( "DisableScreenBlanking", m_disableScreenBlank );
88 m_config.writeEntry( "CopyFormat", m_copyFormat ); 91 m_config.writeEntry( "CopyFormat", m_copyFormat );
89 m_config.writeEntry( "NavBar", m_actionViewNavToolbar->isOn() ); 92 m_config.writeEntry( "NavBar", m_actionViewNavToolbar->isOn() );
90 m_config.writeEntry( "NumVerses", m_numVerses ); 93 m_config.writeEntry( "NumVerses", m_numVerses );
91 m_config.writeEntry( "SearchBar", m_actionViewSearchToolbar->isOn() ); 94 m_config.writeEntry( "SearchBar", m_actionViewSearchToolbar->isOn() );
92 95
93 // Save text font 96 // Save text font
94 m_config.setGroup( "Font"); 97 m_config.setGroup( "Font");
95 m_config.writeEntry( "Family", m_textFont.family() ); 98 m_config.writeEntry( "Family", m_textFont.family() );
96 m_config.writeEntry( "Italic", m_textFont.italic() ); 99 m_config.writeEntry( "Italic", m_textFont.italic() );
97 m_config.writeEntry( "Size", m_textFont.pointSize() ); 100 m_config.writeEntry( "Size", m_textFont.pointSize() );
98 m_config.writeEntry( "Weight", m_textFont.weight() ); 101 m_config.writeEntry( "Weight", m_textFont.weight() );
99 102
100 // Save bookmarks 103 // Save bookmarks
101 m_config.setGroup( "Bookmarks"); 104 m_config.setGroup( "Bookmarks");
102 m_config.clearGroup(); 105 m_config.clearGroup();
103 int index = 3; 106 int index = 3;
104 int id = m_bookmarkMenu->idAt( index ); 107 int id = m_bookmarkMenu->idAt( index );
105 while ( id != -1 ) 108 while ( id != -1 )
106 { 109 {
107 QString bookmark = m_bookmarkMenu->text( id ); 110 QString bookmark = m_bookmarkMenu->text( id );
108 int pos = bookmark.find( " (" ); 111 int pos = bookmark.find( " (" );
109 QString key = bookmark.left( pos ); 112 QString key = bookmark.left( pos );
110 pos += 2; 113 pos += 2;
111 QString module = bookmark.mid( pos, bookmark.find( ")", pos ) - pos ); 114 QString module = bookmark.mid( pos, bookmark.find( ")", pos ) - pos );
112 QString modkey; 115 QString modkey;
113 modkey.sprintf( "%s/%s", module.latin1(), key.latin1() ); 116 modkey.sprintf( "%s/%s", module.latin1(), key.latin1() );
114 m_config.writeEntry( QString::number( index - 2 ), modkey ); 117 m_config.writeEntry( QString::number( index - 2 ), modkey );
115 118
116 ++index; 119 ++index;
117 id = m_bookmarkMenu->idAt( index ); 120 id = m_bookmarkMenu->idAt( index );
118 } 121 }
119 122
120 // Save opened modules 123 // Save opened modules
121 m_config.setGroup( "Session"); 124 m_config.setGroup( "Session");
122 m_config.clearGroup(); 125 m_config.clearGroup();
123 QObjectList *childlist = queryList( "TextWidget" ); 126 QObjectList *childlist = queryList( "TextWidget" );
124 QObjectListIt it( *childlist ); 127 QObjectListIt it( *childlist );
125 TextWidget *module; 128 TextWidget *module;
126 int count = 1; 129 int count = 1;
127 while ( ( module = reinterpret_cast<TextWidget *>(it.current()) ) != 0 ) 130 while ( ( module = reinterpret_cast<TextWidget *>(it.current()) ) != 0 )
128 { 131 {
129 QString modkey; 132 QString modkey;
130 modkey.sprintf( "%s/%s", module->getModuleName().latin1(), module->getAbbrevKey().latin1() ); 133 modkey.sprintf( "%s/%s", module->getModuleName().latin1(), module->getAbbrevKey().latin1() );
131 m_config.writeEntry( QString::number( count ), modkey ); 134 m_config.writeEntry( QString::number( count ), modkey );
132 ++count; 135 ++count;
133 ++it; 136 ++it;
134 } 137 }
135} 138}
136 139
137bool MainWindow::eventFilter( QObject *obj, QEvent *event ) 140bool MainWindow::eventFilter( QObject *obj, QEvent *event )
138{ 141{
139 if ( event->type() == QEvent::KeyPress ) 142 if ( event->type() == QEvent::KeyPress )
140 { 143 {
141 QKeyEvent *keyev = reinterpret_cast<QKeyEvent *>(event); 144 QKeyEvent *keyev = reinterpret_cast<QKeyEvent *>(event);
142 if ( keyev->key() == Key_Up ) 145 if ( keyev->key() == Key_Up )
143 { 146 {
144 slotNavPrevVerse(); 147 slotNavPrevVerse();
145 return true; 148 return true;
146 } 149 }
147 else if ( keyev->key() == Key_Down ) 150 else if ( keyev->key() == Key_Down )
148 { 151 {
149 slotNavNextVerse(); 152 slotNavNextVerse();
150 return true; 153 return true;
151 } 154 }
152 } 155 }
153 156
154 return QWidget::eventFilter( obj, event ); 157 return QWidget::eventFilter( obj, event );
155} 158}
156 159
157void MainWindow::initUI() 160void MainWindow::initUI()
158{ 161{
159 setCentralWidget( &m_tabs ); 162 setCentralWidget( &m_tabs );
160 m_tabs.installEventFilter( this ); 163 m_tabs.installEventFilter( this );
161 164
162 setToolBarsMovable( false ); 165 setToolBarsMovable( false );
163 m_barDock = new QToolBar( this ); 166 m_barDock = new QToolBar( this );
164 m_barDock->setHorizontalStretchable( true ); 167 m_barDock->setHorizontalStretchable( true );
165 168
166 m_menuBar = new QMenuBar( m_barDock ); 169 m_menuBar = new QMenuBar( m_barDock );
167 m_menuBar->setMargin( 0 ); 170 m_menuBar->setMargin( 0 );
168 171
169 // Allocate toolbars 172 // Allocate toolbars
170 m_navToolbar = new NavBar( this ); 173 m_navToolbar = new NavBar( this );
171 m_navToolbar->navBtnsEnable( false ); 174 m_navToolbar->navBtnsEnable( false );
172 connect( m_navToolbar, SIGNAL(prevChapter()), this, SLOT(slotNavPrevChapter()) ); 175 connect( m_navToolbar, SIGNAL(prevPage()), this, SLOT(slotNavPrevPage()) );
173 connect( m_navToolbar, SIGNAL(prevVerse()), this, SLOT(slotNavPrevVerse()) ); 176 connect( m_navToolbar, SIGNAL(prevVerse()), this, SLOT(slotNavPrevVerse()) );
174 connect( m_navToolbar, SIGNAL(keyChanged(const QString &)), this, SLOT(slotNavKeyChanged(const QString &)) ); 177 connect( m_navToolbar, SIGNAL(keyChanged(const QString &)), this, SLOT(slotNavKeyChanged(const QString &)) );
175 connect( m_navToolbar, SIGNAL(nextVerse()), this, SLOT(slotNavNextVerse()) ); 178 connect( m_navToolbar, SIGNAL(nextVerse()), this, SLOT(slotNavNextVerse()) );
176 connect( m_navToolbar, SIGNAL(nextChapter()), this, SLOT(slotNavNextChapter()) ); 179 connect( m_navToolbar, SIGNAL(nextPage()), this, SLOT(slotNavNextPage()) );
177 connect( m_navToolbar, SIGNAL(autoScroll(bool)), this, SLOT(slotNavAutoScroll(bool)) ); 180 connect( m_navToolbar, SIGNAL(autoScroll(bool)), this, SLOT(slotNavAutoScroll(bool)) );
178 connect( m_navToolbar, SIGNAL(scrollRateChanged(int)), this, SLOT(slotNavScrollRateChanged(int)) ); 181 connect( m_navToolbar, SIGNAL(scrollRateChanged(int)), this, SLOT(slotNavScrollRateChanged(int)) );
179 182
180 m_searchToolbar = new SearchBar( this ); 183 m_searchToolbar = new SearchBar( this );
181 connect( m_searchToolbar, SIGNAL(sigResultClicked(const QString &)), this, SLOT(slotSearchResultClicked(const QString &)) ); 184 connect( m_searchToolbar, SIGNAL(sigResultClicked(const QString &)), this, SLOT(slotSearchResultClicked(const QString &)) );
182 185
183 // Text menu 186 // Text menu
184 QPopupMenu *popup = new QPopupMenu( this ); 187 QPopupMenu *popup = new QPopupMenu( this );
185 188
186 QAction *a = new QAction( tr( "Open..." ), Resource::loadPixmap( "fileopen" ), QString::null, 0, this, 0 ); 189 QAction *a = new QAction( tr( "Open..." ), Resource::loadPixmap( "fileopen" ), QString::null, 0, this, 0 );
187 connect( a, SIGNAL(activated()), this, SLOT(slotTextOpen()) ); 190 connect( a, SIGNAL(activated()), this, SLOT(slotTextOpen()) );
188 a->addTo( popup ); 191 a->addTo( popup );
189 192
190 m_actionTextClose = new QAction( tr( "Close" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 193 m_actionTextClose = new QAction( tr( "Close" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
191 connect( m_actionTextClose, SIGNAL(activated()), this, SLOT(slotTextClose()) ); 194 connect( m_actionTextClose, SIGNAL(activated()), this, SLOT(slotTextClose()) );
192 m_actionTextClose->addTo( popup ); 195 m_actionTextClose->addTo( popup );
193 196
194 popup->insertSeparator(); 197 popup->insertSeparator();
195 198
196 // TODO - need to implent 199 // TODO - need to implent
197 a = new QAction( tr( "Install..." ), Resource::loadPixmap( "install" ), QString::null, 0, this, 0 ); 200 a = new QAction( tr( "Install..." ), Resource::loadPixmap( "install" ), QString::null, 0, this, 0 );
198 a->setEnabled( false ); 201 a->setEnabled( false );
199 connect( a, SIGNAL(activated()), this, SLOT(slotTextInstall()) ); 202 connect( a, SIGNAL(activated()), this, SLOT(slotTextInstall()) );
200 a->addTo( popup ); 203 a->addTo( popup );
201 204
202 m_menuBar->insertItem( tr( "Text" ), popup ); 205 m_menuBar->insertItem( tr( "Text" ), popup );
203 206
204 // Edit menu 207 // Edit menu
205 popup = new QPopupMenu( this ); 208 popup = new QPopupMenu( this );
206 209
207 m_actionEditCopy = new QAction( tr( "Copy" ), Resource::loadPixmap( "copy" ), QString::null, 0, this, 0 ); 210 m_actionEditCopy = new QAction( tr( "Copy" ), Resource::loadPixmap( "copy" ), QString::null, 0, this, 0 );
208 connect( m_actionEditCopy, SIGNAL(activated()), this, SLOT(slotEditCopy()) ); 211 connect( m_actionEditCopy, SIGNAL(activated()), this, SLOT(slotEditCopy()) );
209 m_actionEditCopy->addTo( popup ); 212 m_actionEditCopy->addTo( popup );
210 213
211 popup->insertSeparator(); 214 popup->insertSeparator();
212 215
213 a = new QAction( tr( "Configure..." ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 ); 216 a = new QAction( tr( "Configure..." ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 );
214 connect( a, SIGNAL(activated()), this, SLOT(slotEditConfigure()) ); 217 connect( a, SIGNAL(activated()), this, SLOT(slotEditConfigure()) );
215 a->addTo( popup ); 218 a->addTo( popup );
216 219
217 m_menuBar->insertItem( tr( "Edit" ), popup ); 220 m_menuBar->insertItem( tr( "Edit" ), popup );
218 221
219 // Bookmark menu 222 // Bookmark menu
220 m_bookmarkMenu = new QPopupMenu( this ); 223 m_bookmarkMenu = new QPopupMenu( this );
221 224
222 m_actionBookmarkAdd = new QAction( tr( "Add" ), Resource::loadPixmap( "dagger/bookmarkadd" ), QString::null, 0, this, 0 ); 225 m_actionBookmarkAdd = new QAction( tr( "Add" ), Resource::loadPixmap( "dagger/bookmarkadd" ), QString::null, 0, this, 0 );
223 connect( m_actionBookmarkAdd, SIGNAL(activated()), this, SLOT(slotBookmarkAdd()) ); 226 connect( m_actionBookmarkAdd, SIGNAL(activated()), this, SLOT(slotBookmarkAdd()) );
224 m_actionBookmarkAdd->addTo( m_bookmarkMenu ); 227 m_actionBookmarkAdd->addTo( m_bookmarkMenu );
@@ -287,97 +290,97 @@ void MainWindow::openModule( const QString &modulename, const QString &key )
287 { 290 {
288 // Open module in new tab 291 // Open module in new tab
289 QString icon; 292 QString icon;
290 QString type = module->Type(); 293 QString type = module->Type();
291 294
292 if ( type == "Biblical Texts" ) 295 if ( type == "Biblical Texts" )
293 icon = "dagger/bibletext"; 296 icon = "dagger/bibletext";
294 else if ( type == "Commentaries" ) 297 else if ( type == "Commentaries" )
295 icon = "dagger/commentary"; 298 icon = "dagger/commentary";
296 else if ( type == "Lexicons / Dictionaries" ) 299 else if ( type == "Lexicons / Dictionaries" )
297 icon = "dagger/lexicon"; 300 icon = "dagger/lexicon";
298 301
299 tw = new TextWidget( this, module, m_numVerses, &m_textFont ); 302 tw = new TextWidget( this, module, m_numVerses, &m_textFont );
300 connect( tw, SIGNAL(sigRefClicked(const QString &)), 303 connect( tw, SIGNAL(sigRefClicked(const QString &)),
301 this, SLOT(slotTextRefClicked(const QString &)) ); 304 this, SLOT(slotTextRefClicked(const QString &)) );
302 connect( this, SIGNAL(sigNumVersesChanged(int)), tw, SLOT(slotNumVersesChanged(int)) ); 305 connect( this, SIGNAL(sigNumVersesChanged(int)), tw, SLOT(slotNumVersesChanged(int)) );
303 connect( this, SIGNAL(sigFontChanged(const QFont *)), tw, SLOT(slotFontChanged(const QFont *)) ); 306 connect( this, SIGNAL(sigFontChanged(const QFont *)), tw, SLOT(slotFontChanged(const QFont *)) );
304 connect( this, SIGNAL(sigOptionChanged()), tw, SLOT(slotOptionChanged()) ); 307 connect( this, SIGNAL(sigOptionChanged()), tw, SLOT(slotOptionChanged()) );
305 308
306 m_tabs.addTab( tw, icon, modulename ); 309 m_tabs.addTab( tw, icon, modulename );
307 310
308 m_actionTextClose->setEnabled( true ); 311 m_actionTextClose->setEnabled( true );
309 m_actionEditCopy->setEnabled( true ); 312 m_actionEditCopy->setEnabled( true );
310 m_actionBookmarkAdd->setEnabled( true ); 313 m_actionBookmarkAdd->setEnabled( true );
311 314
312 // Set key if one is present 315 // Set key if one is present
313 if ( !key.isNull() ) 316 if ( !key.isNull() )
314 tw->setKey( key ); 317 tw->setKey( key );
315 } 318 }
316 } 319 }
317} 320}
318 321
319int MainWindow::findBookmark( const QString &bookmark ) 322int MainWindow::findBookmark( const QString &bookmark )
320{ 323{
321 int index = 3; 324 int index = 3;
322 int id = m_bookmarkMenu->idAt( index ); 325 int id = m_bookmarkMenu->idAt( index );
323 while ( ( id != -1 ) && ( m_bookmarkMenu->text( id ) != bookmark ) ) 326 while ( ( id != -1 ) && ( m_bookmarkMenu->text( id ) != bookmark ) )
324 { 327 {
325 ++index; 328 ++index;
326 id = m_bookmarkMenu->idAt( index ); 329 id = m_bookmarkMenu->idAt( index );
327 } 330 }
328 331
329 return id; 332 return id;
330} 333}
331 334
332void MainWindow::enableScreenBlanking( bool enable ) 335void MainWindow::enableScreenBlanking( bool enable )
333{ 336{
334 enable ? QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable 337 enable ? QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable
335 : QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Disable; 338 : QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::DisableSuspend;
336} 339}
337 340
338void MainWindow::initConfig() 341void MainWindow::initConfig()
339{ 342{
340 bool show; 343 bool show;
341 344
342 m_config.setGroup( "Sword" ); 345 m_config.setGroup( "Sword" );
343 for ( QAction *a = m_actionSwordOpts.first(); a; a = m_actionSwordOpts.next() ) 346 for ( QAction *a = m_actionSwordOpts.first(); a; a = m_actionSwordOpts.next() )
344 { 347 {
345 show = m_config.readBoolEntry( a->text(), false ); 348 show = m_config.readBoolEntry( a->text(), false );
346 a->setOn( show ); 349 a->setOn( show );
347 m_swordMgr->setGlobalOption ( a->text(), show ? "On" : "Off" ); 350 m_swordMgr->setGlobalOption ( a->text(), show ? "On" : "Off" );
348 } 351 }
349 352
350 // Display/hide toolbars based on last run 353 // Display/hide toolbars based on last run
351 m_config.setGroup( "Config" ); 354 m_config.setGroup( "Config" );
352 355
353 m_alwaysOpenNew = m_config.readBoolEntry( "AlwaysOpenNew", false ); 356 m_alwaysOpenNew = m_config.readBoolEntry( "AlwaysOpenNew", false );
354 m_navToolbar->setAutoScrollRate( m_config.readNumEntry( "AutoScroll", 50 ) ); 357 m_navToolbar->setAutoScrollRate( m_config.readNumEntry( "AutoScroll", 50 ) );
355 m_disableScreenBlank = m_config.readBoolEntry( "DisableScreenBlanking", false ); 358 m_disableScreenBlank = m_config.readBoolEntry( "DisableScreenBlanking", false );
356 enableScreenBlanking( !m_disableScreenBlank ); 359 enableScreenBlanking( !m_disableScreenBlank );
357 m_copyFormat = m_config.readNumEntry( "CopyFormat", 0 ); 360 m_copyFormat = m_config.readNumEntry( "CopyFormat", 0 );
358 361
359 show = m_config.readBoolEntry( "NavBar", false ); 362 show = m_config.readBoolEntry( "NavBar", false );
360 m_actionViewNavToolbar->setOn( show ); 363 m_actionViewNavToolbar->setOn( show );
361 slotViewNavToolbar( show ); 364 slotViewNavToolbar( show );
362 365
363 m_numVerses = m_config.readNumEntry( "NumVerses", 5 ); 366 m_numVerses = m_config.readNumEntry( "NumVerses", 5 );
364 367
365 show = m_config.readBoolEntry( "SearchBar", false ); 368 show = m_config.readBoolEntry( "SearchBar", false );
366 m_actionViewSearchToolbar->setOn( show ); 369 m_actionViewSearchToolbar->setOn( show );
367 slotViewSearchToolbar( show ); 370 slotViewSearchToolbar( show );
368 371
369 // Set text font 372 // Set text font
370 m_config.setGroup( "Font" ); 373 m_config.setGroup( "Font" );
371 QString fontFamily = m_config.readEntry( "Family", QString::null ); 374 QString fontFamily = m_config.readEntry( "Family", QString::null );
372 !fontFamily.isNull() ? m_textFont = QFont( fontFamily, 375 !fontFamily.isNull() ? m_textFont = QFont( fontFamily,
373 m_config.readNumEntry( "Size", -1 ), 376 m_config.readNumEntry( "Size", -1 ),
374 m_config.readNumEntry( "Weight", QFont::Normal ), 377 m_config.readNumEntry( "Weight", QFont::Normal ),
375 m_config.readBoolEntry( "Italic", false ) ) 378 m_config.readBoolEntry( "Italic", false ) )
376 : m_textFont = font(); // If font is not configured, set to default widget font 379 : m_textFont = font(); // If font is not configured, set to default widget font
377 380
378 // Load bookmarks 381 // Load bookmarks
379 m_config.setGroup( "Bookmarks"); 382 m_config.setGroup( "Bookmarks");
380 int count = 1; 383 int count = 1;
381 QString key = m_config.readEntry( QString::number( count ), QString::null ); 384 QString key = m_config.readEntry( QString::number( count ), QString::null );
382 while ( !key.isNull() ) 385 while ( !key.isNull() )
383 { 386 {
@@ -552,148 +555,148 @@ void MainWindow::slotBookmarkRemove()
552 int menuId = findBookmark( text->getFullKey() ); 555 int menuId = findBookmark( text->getFullKey() );
553 if ( menuId != -1 ) 556 if ( menuId != -1 )
554 { 557 {
555 // Bookmark found, remove 558 // Bookmark found, remove
556 m_bookmarkMenu->removeItem( menuId ); 559 m_bookmarkMenu->removeItem( menuId );
557 560
558 //If this was the last bookmark, disable the remove option 561 //If this was the last bookmark, disable the remove option
559 if ( m_bookmarkMenu->idAt( 3 ) == -1 ) 562 if ( m_bookmarkMenu->idAt( 3 ) == -1 )
560 m_actionBookmarkRemove->setEnabled( false ); 563 m_actionBookmarkRemove->setEnabled( false );
561 } 564 }
562 } 565 }
563} 566}
564 567
565void MainWindow::slotBookmarkSelected() 568void MainWindow::slotBookmarkSelected()
566{ 569{
567 const QAction *action = reinterpret_cast<const QAction *>(sender()); 570 const QAction *action = reinterpret_cast<const QAction *>(sender());
568 if ( action ) 571 if ( action )
569 { 572 {
570 QString bookmark = action->text(); 573 QString bookmark = action->text();
571 int pos = bookmark.find( " (" ); 574 int pos = bookmark.find( " (" );
572 QString key = bookmark.left( pos ); 575 QString key = bookmark.left( pos );
573 pos += 2; 576 pos += 2;
574 QString module = bookmark.mid( pos, bookmark.find( ")", pos ) - pos ); 577 QString module = bookmark.mid( pos, bookmark.find( ")", pos ) - pos );
575 578
576 openModule( module, key ); 579 openModule( module, key );
577 } 580 }
578} 581}
579 582
580void MainWindow::slotViewSwordOption( bool enabled ) 583void MainWindow::slotViewSwordOption( bool enabled )
581{ 584{
582 const QAction *action = reinterpret_cast<const QAction*>(sender()); 585 const QAction *action = reinterpret_cast<const QAction*>(sender());
583 m_swordMgr->setGlobalOption ( action->text(), enabled ? "On" : "Off" ); 586 m_swordMgr->setGlobalOption ( action->text(), enabled ? "On" : "Off" );
584 587
585 emit sigOptionChanged(); 588 emit sigOptionChanged();
586} 589}
587 590
588void MainWindow::slotViewNavToolbar( bool enabled ) 591void MainWindow::slotViewNavToolbar( bool enabled )
589{ 592{
590 enabled ? m_navToolbar->show() 593 enabled ? m_navToolbar->show()
591 : m_navToolbar->hide(); 594 : m_navToolbar->hide();
592} 595}
593 596
594void MainWindow::slotViewSearchToolbar( bool enabled ) 597void MainWindow::slotViewSearchToolbar( bool enabled )
595{ 598{
596 enabled ? m_searchToolbar->show() 599 enabled ? m_searchToolbar->show()
597 : m_searchToolbar->hide(); 600 : m_searchToolbar->hide();
598} 601}
599 602
600void MainWindow::slotNavPrevChapter() 603void MainWindow::slotNavPrevPage()
601{ 604{
602 TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget()); 605 TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget());
603 if ( text ) 606 if ( text )
604 { 607 {
605 text->prevChapter(); 608 text->prevPage();
606 setCaption( QString( "%1 - Dagger" ).arg( text->getFullKey() ) ); 609 setCaption( QString( "%1 - Dagger" ).arg( text->getFullKey() ) );
607 m_navToolbar->setKey( text->getAbbrevKey() ); 610 m_navToolbar->setKey( text->getAbbrevKey() );
608 } 611 }
609} 612}
610 613
611void MainWindow::slotNavPrevVerse() 614void MainWindow::slotNavPrevVerse()
612{ 615{
613 TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget()); 616 TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget());
614 if ( text ) 617 if ( text )
615 { 618 {
616 text->prevVerse(); 619 text->prevVerse();
617 setCaption( QString( "%1 - Dagger" ).arg( text->getFullKey() ) ); 620 setCaption( QString( "%1 - Dagger" ).arg( text->getFullKey() ) );
618 m_navToolbar->setKey( text->getAbbrevKey() ); 621 m_navToolbar->setKey( text->getAbbrevKey() );
619 } 622 }
620} 623}
621 624
622void MainWindow::slotNavKeyChanged( const QString &newKey ) 625void MainWindow::slotNavKeyChanged( const QString &newKey )
623{ 626{
624 QString key = newKey; 627 QString key = newKey;
625 key.replace( QRegExp( "[-=.]" ), ":" ); 628 key.replace( QRegExp( "[-=.]" ), ":" );
626 629
627 TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget()); 630 TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget());
628 if ( text ) 631 if ( text )
629 { 632 {
630 text->setKey( key ); 633 text->setKey( key );
631 setCaption( QString( "%1 - Dagger" ).arg( text->getFullKey() ) ); 634 setCaption( QString( "%1 - Dagger" ).arg( text->getFullKey() ) );
632 } 635 }
633} 636}
634 637
635void MainWindow::slotNavNextVerse() 638void MainWindow::slotNavNextVerse()
636{ 639{
637 TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget()); 640 TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget());
638 if ( text ) 641 if ( text )
639 { 642 {
640 text->nextVerse(); 643 text->nextVerse();
641 setCaption( QString( "%1 - Dagger" ).arg( text->getFullKey() ) ); 644 setCaption( QString( "%1 - Dagger" ).arg( text->getFullKey() ) );
642 m_navToolbar->setKey( text->getAbbrevKey() ); 645 m_navToolbar->setKey( text->getAbbrevKey() );
643 } 646 }
644} 647}
645 648
646void MainWindow::slotNavNextChapter() 649void MainWindow::slotNavNextPage()
647{ 650{
648 TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget()); 651 TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget());
649 if ( text ) 652 if ( text )
650 { 653 {
651 text->nextChapter(); 654 text->nextPage();
652 setCaption( QString( "%1 - Dagger" ).arg( text->getFullKey() ) ); 655 setCaption( QString( "%1 - Dagger" ).arg( text->getFullKey() ) );
653 m_navToolbar->setKey( text->getAbbrevKey() ); 656 m_navToolbar->setKey( text->getAbbrevKey() );
654 } 657 }
655} 658}
656 659
657void MainWindow::slotNavAutoScroll( bool enabled ) 660void MainWindow::slotNavAutoScroll( bool enabled )
658{ 661{
659 m_autoScrollTimer.stop(); 662 m_autoScrollTimer.stop();
660 663
661 if ( enabled ) 664 if ( enabled )
662 m_autoScrollTimer.start( m_navToolbar->autoScrollRate() * 100 ); 665 m_autoScrollTimer.start( m_navToolbar->autoScrollRate() * 100 );
663} 666}
664 667
665void MainWindow::slotNavScrollRateChanged( int newRate ) 668void MainWindow::slotNavScrollRateChanged( int newRate )
666{ 669{
667 if ( m_autoScrollTimer.isActive() ) 670 if ( m_autoScrollTimer.isActive() )
668 { 671 {
669 m_autoScrollTimer.stop(); 672 m_autoScrollTimer.stop();
670 m_autoScrollTimer.start( newRate * 100 ); 673 m_autoScrollTimer.start( newRate * 100 );
671 } 674 }
672} 675}
673 676
674void MainWindow::slotSearchResultClicked( const QString &key ) 677void MainWindow::slotSearchResultClicked( const QString &key )
675{ 678{
676 TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget()); 679 TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget());
677 if ( text ) 680 if ( text )
678 { 681 {
679 text->setKey( key ); 682 text->setKey( key );
680 setCaption( QString( "%1 - Dagger" ).arg( text->getFullKey() ) ); 683 setCaption( QString( "%1 - Dagger" ).arg( text->getFullKey() ) );
681 m_navToolbar->setKey( text->getAbbrevKey() ); 684 m_navToolbar->setKey( text->getAbbrevKey() );
682 } 685 }
683} 686}
684 687
685void MainWindow::slotTextRefClicked( const QString &ref ) 688void MainWindow::slotTextRefClicked( const QString &ref )
686{ 689{
687 //owarn << "Reference: " << ref << oendl; 690 //owarn << "Reference: " << ref << oendl;
688 if ( !ref.isNull() ) 691 if ( !ref.isNull() )
689 { 692 {
690 TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget()); 693 TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget());
691 if ( text ) 694 if ( text )
692 { 695 {
693 QString module; 696 QString module;
694 QString key( ref ); 697 QString key( ref );
695 key.remove( 0, 2 ); 698 key.remove( 0, 2 );
696 699
697 QChar book = ref.at( 1 ); 700 QChar book = ref.at( 1 );
698 // TODO- this is ugly, need better way to determine type of reference 701 // TODO- this is ugly, need better way to determine type of reference
699 // take a look at SWModule::getRawEntry() 702 // take a look at SWModule::getRawEntry()
diff --git a/noncore/apps/dagger/mainwindow.h b/noncore/apps/dagger/mainwindow.h
index 0c7f3c8..b114e33 100644
--- a/noncore/apps/dagger/mainwindow.h
+++ b/noncore/apps/dagger/mainwindow.h
@@ -66,69 +66,69 @@ private:
66 QToolBar *m_barDock; // Main toolbar which contains menu and all other toolbars 66 QToolBar *m_barDock; // Main toolbar which contains menu and all other toolbars
67 QMenuBar *m_menuBar; // Application menu bar 67 QMenuBar *m_menuBar; // Application menu bar
68 QPopupMenu *m_bookmarkMenu; // Pointer to bookmark menu 68 QPopupMenu *m_bookmarkMenu; // Pointer to bookmark menu
69 NavBar *m_navToolbar; // Text navigation toolbar 69 NavBar *m_navToolbar; // Text navigation toolbar
70 SearchBar *m_searchToolbar; // Text search toolbar 70 SearchBar *m_searchToolbar; // Text search toolbar
71 Opie::Ui::OTabWidget m_tabs; // Main widget in which all texts, notes, etc. will be displayed 71 Opie::Ui::OTabWidget m_tabs; // Main widget in which all texts, notes, etc. will be displayed
72 72
73 // Other visual items 73 // Other visual items
74 QPixmap *m_bibleIcon; // Icon used for bible modules 74 QPixmap *m_bibleIcon; // Icon used for bible modules
75 QPixmap *m_commentaryIcon; // Icon used for commentary modules 75 QPixmap *m_commentaryIcon; // Icon used for commentary modules
76 QPixmap *m_lexiconIcon; // Icon used for lexicon modules 76 QPixmap *m_lexiconIcon; // Icon used for lexicon modules
77 77
78 QTimer m_autoScrollTimer; // Timer for auto-scrolling of bible texts 78 QTimer m_autoScrollTimer; // Timer for auto-scrolling of bible texts
79 79
80 // Menubar/toolbar actions 80 // Menubar/toolbar actions
81 SwordOptionList m_actionSwordOpts; // List of actions for sword options 81 SwordOptionList m_actionSwordOpts; // List of actions for sword options
82 // (e.g. footnotes, Strong's numbers, etc.) 82 // (e.g. footnotes, Strong's numbers, etc.)
83 QAction *m_actionTextClose; // Action for closing currently opened module 83 QAction *m_actionTextClose; // Action for closing currently opened module
84 QAction *m_actionEditCopy; // Action for copying text from current module 84 QAction *m_actionEditCopy; // Action for copying text from current module
85 QAction *m_actionBookmarkAdd; // Action for adding a bookmark 85 QAction *m_actionBookmarkAdd; // Action for adding a bookmark
86 QAction *m_actionBookmarkRemove; // Action for removing a bookmark 86 QAction *m_actionBookmarkRemove; // Action for removing a bookmark
87 QAction *m_actionViewNavToolbar; // Action for displaying/hiding the navigation toolbar 87 QAction *m_actionViewNavToolbar; // Action for displaying/hiding the navigation toolbar
88 QAction *m_actionViewSearchToolbar; // Action for displaying/hiding the search toolbar 88 QAction *m_actionViewSearchToolbar; // Action for displaying/hiding the search toolbar
89 89
90 void initUI(); 90 void initUI();
91 void openModule( const QString &modulename, const QString &key = 0x0 ); 91 void openModule( const QString &modulename, const QString &key = 0x0 );
92 int findBookmark( const QString &bookmark ); 92 int findBookmark( const QString &bookmark );
93 void enableScreenBlanking( bool enable ); 93 void enableScreenBlanking( bool enable );
94 94
95private slots: 95private slots:
96 void initConfig(); 96 void initConfig();
97 97
98 void slotTextDisplayed( QWidget *textWidget ); 98 void slotTextDisplayed( QWidget *textWidget );
99 99
100 // Menubar/toolbar action slots 100 // Menubar/toolbar action slots
101 void slotTextOpen(); 101 void slotTextOpen();
102 void slotTextClose(); 102 void slotTextClose();
103 void slotTextInstall(); 103 void slotTextInstall();
104 void slotEditCopy(); 104 void slotEditCopy();
105 void slotEditConfigure(); 105 void slotEditConfigure();
106 void slotBookmarkAdd(); 106 void slotBookmarkAdd();
107 void slotBookmarkRemove(); 107 void slotBookmarkRemove();
108 void slotBookmarkSelected(); 108 void slotBookmarkSelected();
109 void slotViewSwordOption( bool enabled ); 109 void slotViewSwordOption( bool enabled );
110 void slotViewNavToolbar( bool enabled ); 110 void slotViewNavToolbar( bool enabled );
111 void slotViewSearchToolbar( bool enabled ); 111 void slotViewSearchToolbar( bool enabled );
112 112
113 // Navigation toolbar slots 113 // Navigation toolbar slots
114 void slotNavPrevChapter(); 114 void slotNavPrevPage();
115 void slotNavPrevVerse(); 115 void slotNavPrevVerse();
116 void slotNavKeyChanged( const QString &newKey ); 116 void slotNavKeyChanged( const QString &newKey );
117 void slotNavNextVerse(); 117 void slotNavNextVerse();
118 void slotNavNextChapter(); 118 void slotNavNextPage();
119 void slotNavAutoScroll( bool enabled ); 119 void slotNavAutoScroll( bool enabled );
120 void slotNavScrollRateChanged( int newRate ); 120 void slotNavScrollRateChanged( int newRate );
121 121
122 // Search toolbar slots 122 // Search toolbar slots
123 void slotSearchResultClicked( const QString &key ); 123 void slotSearchResultClicked( const QString &key );
124 124
125 // Text widget slots 125 // Text widget slots
126 void slotTextRefClicked( const QString &ref ); 126 void slotTextRefClicked( const QString &ref );
127 127
128signals: 128signals:
129 void sigNumVersesChanged( int numVerses ); 129 void sigNumVersesChanged( int numVerses );
130 void sigFontChanged( const QFont *newFont ); 130 void sigFontChanged( const QFont *newFont );
131 void sigOptionChanged(); 131 void sigOptionChanged();
132}; 132};
133 133
134#endif 134#endif
diff --git a/noncore/apps/dagger/navbar.cpp b/noncore/apps/dagger/navbar.cpp
index 4781af0..212dc36 100644
--- a/noncore/apps/dagger/navbar.cpp
+++ b/noncore/apps/dagger/navbar.cpp
@@ -1,93 +1,93 @@
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 "navbar.h" 18#include "navbar.h"
19 19
20#include <qpe/config.h> 20#include <qpe/config.h>
21#include <qpe/resource.h> 21#include <qpe/resource.h>
22 22
23#include <qaction.h> 23#include <qaction.h>
24#include <qlineedit.h> 24#include <qlineedit.h>
25 25
26NavBar::NavBar( QMainWindow *parent ) 26NavBar::NavBar( QMainWindow *parent )
27 : QToolBar( QString::null, parent, QMainWindow::Top, true ) 27 : QToolBar( QString::null, parent, QMainWindow::Top, true )
28{ 28{
29 // Initialize UI 29 // Initialize UI
30 m_actionPrevChapter = new QAction( tr( "Previous chapter" ), Resource::loadPixmap( "fastback" ), 30 m_actionPrevPage = new QAction( tr( "Previous page" ), Resource::loadPixmap( "fastback" ),
31 QString::null, 0, this, 0 ); 31 QString::null, 0, this, 0 );
32 m_actionPrevChapter->addTo( this ); 32 m_actionPrevPage->addTo( this );
33 connect( m_actionPrevChapter, SIGNAL(activated()), this, SIGNAL(prevChapter()) ); 33 connect( m_actionPrevPage, SIGNAL(activated()), this, SIGNAL(prevPage()) );
34 34
35 m_actionPrevVerse = new QAction( tr( "Previous verse" ), Resource::loadPixmap( "back" ), 35 m_actionPrevVerse = new QAction( tr( "Previous verse" ), Resource::loadPixmap( "back" ),
36 QString::null, 0, this, 0 ); 36 QString::null, 0, this, 0 );
37 m_actionPrevVerse->addTo( this ); 37 m_actionPrevVerse->addTo( this );
38 connect( m_actionPrevVerse, SIGNAL(activated()), this, SIGNAL(prevVerse()) ); 38 connect( m_actionPrevVerse, SIGNAL(activated()), this, SIGNAL(prevVerse()) );
39 39
40 m_key = new QLineEdit( this ); 40 m_key = new QLineEdit( this );
41 setStretchableWidget( m_key ); 41 setStretchableWidget( m_key );
42 connect(m_key, SIGNAL(textChanged(const QString &)), this, SIGNAL(keyChanged(const QString &)) ); 42 connect(m_key, SIGNAL(textChanged(const QString &)), this, SIGNAL(keyChanged(const QString &)) );
43 43
44 m_actionNextVerse = new QAction( tr( "Next verse" ), Resource::loadPixmap( "forward" ), 44 m_actionNextVerse = new QAction( tr( "Next verse" ), Resource::loadPixmap( "forward" ),
45 QString::null, 0, this, 0 ); 45 QString::null, 0, this, 0 );
46 m_actionNextVerse->addTo( this ); 46 m_actionNextVerse->addTo( this );
47 connect( m_actionNextVerse, SIGNAL(activated()), this, SIGNAL(nextVerse()) ); 47 connect( m_actionNextVerse, SIGNAL(activated()), this, SIGNAL(nextVerse()) );
48 48
49 m_actionNextChapter = new QAction( tr( "Next chapter" ), Resource::loadPixmap( "fastforward" ), 49 m_actionNextPage = new QAction( tr( "Next page" ), Resource::loadPixmap( "fastforward" ),
50 QString::null, 0, this, 0 ); 50 QString::null, 0, this, 0 );
51 m_actionNextChapter->addTo( this ); 51 m_actionNextPage->addTo( this );
52 connect( m_actionNextChapter, SIGNAL(activated()), this, SIGNAL(nextChapter()) ); 52 connect( m_actionNextPage, SIGNAL(activated()), this, SIGNAL(nextPage()) );
53 53
54 addSeparator(); 54 addSeparator();
55 55
56 m_scrollRate = new QSpinBox( 1, 100, 1, this ); 56 m_scrollRate = new QSpinBox( 1, 100, 1, this );
57 m_scrollRate->setMinimumWidth( 35 ); 57 m_scrollRate->setMinimumWidth( 35 );
58 connect( m_scrollRate, SIGNAL(valueChanged(int)), this, SIGNAL(scrollRateChanged(int)) ); 58 connect( m_scrollRate, SIGNAL(valueChanged(int)), this, SIGNAL(scrollRateChanged(int)) );
59 59
60 m_actionScroll = new QAction( tr( "Auto-scroll" ), Resource::loadPixmap( "dagger/autoscroll" ), 60 m_actionScroll = new QAction( tr( "Auto-scroll" ), Resource::loadPixmap( "dagger/autoscroll" ),
61 QString::null, 0, this, 0 ); 61 QString::null, 0, this, 0 );
62 m_actionScroll->setToggleAction( true ); 62 m_actionScroll->setToggleAction( true );
63 connect( m_actionScroll, SIGNAL(toggled(bool)), this, SIGNAL(autoScroll(bool)) ); 63 connect( m_actionScroll, SIGNAL(toggled(bool)), this, SIGNAL(autoScroll(bool)) );
64 m_actionScroll->addTo( this ); 64 m_actionScroll->addTo( this );
65 65
66 if ( parent ) 66 if ( parent )
67 { 67 {
68 installEventFilter( parent ); 68 installEventFilter( parent );
69 m_key->installEventFilter( parent ); 69 m_key->installEventFilter( parent );
70 } 70 }
71} 71}
72 72
73void NavBar::navBtnsEnable( bool enabled ) 73void NavBar::navBtnsEnable( bool enabled )
74{ 74{
75 m_actionPrevChapter->setEnabled( enabled ); 75 m_actionPrevPage->setEnabled( enabled );
76 m_actionPrevVerse->setEnabled( enabled ); 76 m_actionPrevVerse->setEnabled( enabled );
77 m_actionNextVerse->setEnabled( enabled ); 77 m_actionNextVerse->setEnabled( enabled );
78 m_actionNextChapter->setEnabled( enabled ); 78 m_actionNextPage->setEnabled( enabled );
79 m_scrollRate->setEnabled( enabled ); 79 m_scrollRate->setEnabled( enabled );
80 m_actionScroll->setEnabled( enabled ); 80 m_actionScroll->setEnabled( enabled );
81} 81}
82 82
83void NavBar::setKey( const QString &newKey ) 83void NavBar::setKey( const QString &newKey )
84{ 84{
85 disconnect( m_key, SIGNAL(textChanged(const QString &)), 0, 0 ); 85 disconnect( m_key, SIGNAL(textChanged(const QString &)), 0, 0 );
86 m_key->setText( newKey ); 86 m_key->setText( newKey );
87 connect(m_key, SIGNAL(textChanged(const QString &)), this, SIGNAL(keyChanged(const QString &)) ); 87 connect(m_key, SIGNAL(textChanged(const QString &)), this, SIGNAL(keyChanged(const QString &)) );
88} 88}
89 89
90void NavBar::setAutoScrollRate( int scrollRate ) 90void NavBar::setAutoScrollRate( int scrollRate )
91{ 91{
92 m_scrollRate->setValue( scrollRate ); 92 m_scrollRate->setValue( scrollRate );
93} 93}
diff --git a/noncore/apps/dagger/navbar.h b/noncore/apps/dagger/navbar.h
index a37d6ff..0df2bf0 100644
--- a/noncore/apps/dagger/navbar.h
+++ b/noncore/apps/dagger/navbar.h
@@ -1,58 +1,58 @@
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#ifndef NAVBAR_H 18#ifndef NAVBAR_H
19#define NAVBAR_H 19#define NAVBAR_H
20 20
21#include <qspinbox.h> 21#include <qspinbox.h>
22#include <qtoolbar.h> 22#include <qtoolbar.h>
23 23
24class QAction; 24class QAction;
25class QLineEdit; 25class QLineEdit;
26 26
27class NavBar : public QToolBar 27class NavBar : public QToolBar
28{ 28{
29 Q_OBJECT 29 Q_OBJECT
30 30
31public: 31public:
32 NavBar( QMainWindow *parent = 0x0 ); 32 NavBar( QMainWindow *parent = 0x0 );
33 33
34 void navBtnsEnable( bool enabled ); 34 void navBtnsEnable( bool enabled );
35 void setKey( const QString &newKey ); 35 void setKey( const QString &newKey );
36 void setAutoScrollRate( int scrollRate ); 36 void setAutoScrollRate( int scrollRate );
37 const int autoScrollRate() { return m_scrollRate->value(); } 37 const int autoScrollRate() { return m_scrollRate->value(); }
38 38
39private: 39private:
40 QAction *m_actionPrevChapter; // Action for going back 1 chapter 40 QAction *m_actionPrevPage; // Action for going back 1 page
41 QAction *m_actionPrevVerse; // Action for going back 1 verse 41 QAction *m_actionPrevVerse; // Action for going back 1 verse
42 QLineEdit *m_key; // Edit box to enter key to goto 42 QLineEdit *m_key; // Edit box to enter key to goto
43 QAction *m_actionNextVerse; // Action for going forward 1 verse 43 QAction *m_actionNextVerse; // Action for going forward 1 verse
44 QAction *m_actionNextChapter; // Action for going forward 1 chapter 44 QAction *m_actionNextPage; // Action for going forward 1 page
45 QSpinBox *m_scrollRate; // Spin box to adjust rate of auto-scrolling 45 QSpinBox *m_scrollRate; // Spin box to adjust rate of auto-scrolling
46 QAction *m_actionScroll; // Action to start/stop auto-scrolling 46 QAction *m_actionScroll; // Action to start/stop auto-scrolling
47 47
48signals: 48signals:
49 void prevChapter(); 49 void prevPage();
50 void prevVerse(); 50 void prevVerse();
51 void keyChanged( const QString &newKey ); 51 void keyChanged( const QString &newKey );
52 void nextVerse(); 52 void nextVerse();
53 void nextChapter(); 53 void nextPage();
54 void autoScroll( bool enabled ); 54 void autoScroll( bool enabled );
55 void scrollRateChanged( int newRate ); 55 void scrollRateChanged( int newRate );
56}; 56};
57 57
58#endif 58#endif
diff --git a/noncore/apps/dagger/opie-dagger.control b/noncore/apps/dagger/opie-dagger.control
index c401f03..4ded1f2 100644
--- a/noncore/apps/dagger/opie-dagger.control
+++ b/noncore/apps/dagger/opie-dagger.control
@@ -1,11 +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
6Replaces: dagger
7Architecture: arm 6Architecture: arm
8Source: http://draknor.net/dagger/
9Maintainer: Dan Williams (drw@handhelds.org) 7Maintainer: Dan Williams (drw@handhelds.org)
10Description: A Bible study program utilizing the Sword library. 8Description: A Bible study program utilizing the Sword library.
11Version: 0.9.0 9Version: 0.9.1$EXTRAVERSION
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
@@ -1,159 +1,165 @@
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/owait.h> 21#include <opie2/owait.h>
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 );
46 m_actionFind->setEnabled( false ); 51 m_actionFind->setEnabled( false );
47 m_actionFind->addTo( this ); 52 m_actionFind->addTo( this );
48 connect( m_actionFind, SIGNAL(activated()), this, SLOT(slotFind()) ); 53 connect( m_actionFind, SIGNAL(activated()), this, SLOT(slotFind()) );
49 54
50 addSeparator(); 55 addSeparator();
51 56
52 m_actionPrev = new QAction( tr( "Previous result" ), Resource::loadPixmap( "back" ), 57 m_actionPrev = new QAction( tr( "Previous result" ), Resource::loadPixmap( "back" ),
53 QString::null, 0, this, 0 ); 58 QString::null, 0, this, 0 );
54 m_actionPrev->setEnabled( false ); 59 m_actionPrev->setEnabled( false );
55 m_actionPrev->addTo( this ); 60 m_actionPrev->addTo( this );
56 connect( m_actionPrev, SIGNAL(activated()), this, SLOT(slotPrev()) ); 61 connect( m_actionPrev, SIGNAL(activated()), this, SLOT(slotPrev()) );
57 62
58 m_resultList = new QComboBox( this ); 63 m_resultList = new QComboBox( this );
59 m_resultList->setEnabled( false ); 64 m_resultList->setEnabled( false );
60 connect( m_resultList, SIGNAL(activated(const QString &)), this, SIGNAL(sigResultClicked(const QString &)) ); 65 connect( m_resultList, SIGNAL(activated(const QString &)), this, SIGNAL(sigResultClicked(const QString &)) );
61 66
62 m_actionNext = new QAction( tr( "Next result" ), Resource::loadPixmap( "forward" ), 67 m_actionNext = new QAction( tr( "Next result" ), Resource::loadPixmap( "forward" ),
63 QString::null, 0, this, 0 ); 68 QString::null, 0, this, 0 );
64 m_actionNext->setEnabled( false ); 69 m_actionNext->setEnabled( false );
65 m_actionNext->addTo( this ); 70 m_actionNext->addTo( this );
66 connect( m_actionNext, SIGNAL(activated()), this, SLOT(slotNext()) ); 71 connect( m_actionNext, SIGNAL(activated()), this, SLOT(slotNext()) );
67 72
68 if ( parent ) 73 if ( parent )
69 { 74 {
70 installEventFilter( parent ); 75 installEventFilter( parent );
71 // TODO - install for all controls 76 // TODO - install for all controls
72 m_searchText->installEventFilter( parent ); 77 m_searchText->installEventFilter( parent );
73 } 78 }
74} 79}
75 80
76void SearchBar::setCurrModule( TextWidget *currText ) 81void SearchBar::setCurrModule( TextWidget *currText )
77{ 82{
78 m_actionFind->setEnabled( ( m_searchText->text() != "" ) && currText ); 83 m_actionFind->setEnabled( ( m_searchText->text() != "" ) && currText );
79 84
80 if ( !m_currText || ( currText->getModuleName() != m_currText->getModuleName() ) ) 85 if ( !m_currText || ( currText->getModuleName() != m_currText->getModuleName() ) )
81 { 86 {
82 m_actionPrev->setEnabled( false ); 87 m_actionPrev->setEnabled( false );
83 m_resultList->clear(); 88 m_resultList->clear();
84 m_resultList->setEnabled( false ); 89 m_resultList->setEnabled( false );
85 m_actionNext->setEnabled( false ); 90 m_actionNext->setEnabled( false );
86 } 91 }
87 92
88 m_currText = currText; 93 m_currText = currText;
89} 94}
90 95
91void SearchBar::slotTextChanged( const QString &newText ) 96void SearchBar::slotTextChanged( const QString &newText )
92{ 97{
93 m_actionFind->setEnabled( ( newText != "" ) && m_currText ); 98 m_actionFind->setEnabled( ( newText != "" ) && m_currText );
94} 99}
95 100
96void SearchBar::slotFind() 101void SearchBar::slotFind()
97{ 102{
98 m_resultList->clear(); 103 m_resultList->clear();
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() );
124 } 130 }
125 131
126 // Goto first result in list 132 // Goto first result in list
127 m_resultList->setCurrentItem( 0 ); 133 m_resultList->setCurrentItem( 0 );
128 emit sigResultClicked( m_resultList->currentText() ); 134 emit sigResultClicked( m_resultList->currentText() );
129 } 135 }
130 else 136 else
131 { 137 {
132 // Reset application title 138 // Reset application title
133 pWidget->setCaption( caption ); 139 pWidget->setCaption( caption );
134 } 140 }
135 141
136 // UI clean-up 142 // UI clean-up
137 wait.hide(); 143 wait.hide();
138 144
139 m_actionPrev->setEnabled( false ); 145 m_actionPrev->setEnabled( false );
140 m_resultList->setEnabled( found ); 146 m_resultList->setEnabled( found );
141 m_actionNext->setEnabled( count > 1 ); 147 m_actionNext->setEnabled( count > 1 );
142} 148}
143 149
144void SearchBar::slotPrev() 150void SearchBar::slotPrev()
145{ 151{
146 int item = m_resultList->currentItem() - 1; 152 int item = m_resultList->currentItem() - 1;
147 m_resultList->setCurrentItem( item ); 153 m_resultList->setCurrentItem( item );
148 emit sigResultClicked( m_resultList->currentText() ); 154 emit sigResultClicked( m_resultList->currentText() );
149 155
150 m_actionPrev->setEnabled( item > 0 ); 156 m_actionPrev->setEnabled( item > 0 );
151 m_actionNext->setEnabled( item < m_resultList->count() - 1 ); 157 m_actionNext->setEnabled( item < m_resultList->count() - 1 );
152} 158}
153 159
154void SearchBar::slotNext() 160void SearchBar::slotNext()
155{ 161{
156 int item = m_resultList->currentItem() + 1; 162 int item = m_resultList->currentItem() + 1;
157 m_resultList->setCurrentItem( item ); 163 m_resultList->setCurrentItem( item );
158 emit sigResultClicked( m_resultList->currentText() ); 164 emit sigResultClicked( m_resultList->currentText() );
159 165
diff --git a/noncore/apps/dagger/textwidget.cpp b/noncore/apps/dagger/textwidget.cpp
index 8ff620d..9f7de66 100644
--- a/noncore/apps/dagger/textwidget.cpp
+++ b/noncore/apps/dagger/textwidget.cpp
@@ -33,120 +33,124 @@ TextWidget::TextWidget( QWidget *parent, sword::SWModule *module, int numVerses,
33 QVBoxLayout *layout = new QVBoxLayout( this, 2, 2 ); 33 QVBoxLayout *layout = new QVBoxLayout( this, 2, 2 );
34 34
35 m_textView = new QTextBrowser( this ); 35 m_textView = new QTextBrowser( this );
36 m_textView->installEventFilter( parent ); 36 m_textView->installEventFilter( parent );
37 m_textView->setMinimumHeight( 20 ); 37 m_textView->setMinimumHeight( 20 );
38 m_textView->setHScrollBarMode( QTextView::AlwaysOff ); 38 m_textView->setHScrollBarMode( QTextView::AlwaysOff );
39 m_textView->setTextFormat( QTextView::RichText ); 39 m_textView->setTextFormat( QTextView::RichText );
40 connect( m_textView, SIGNAL(highlighted(const QString &)), 40 connect( m_textView, SIGNAL(highlighted(const QString &)),
41 this, SIGNAL(sigRefClicked(const QString &)) ); 41 this, SIGNAL(sigRefClicked(const QString &)) );
42 layout->addWidget( m_textView ); 42 layout->addWidget( m_textView );
43 43
44 // Set font 44 // Set font
45 if ( font ) 45 if ( font )
46 setFont( *font ); 46 setFont( *font );
47 47
48 // Set initial text 48 // Set initial text
49 if ( m_module ) 49 if ( m_module )
50 { 50 {
51 m_isBibleText = !strcmp( module->Type(), "Biblical Texts" ); 51 m_isBibleText = !strcmp( module->Type(), "Biblical Texts" );
52 if ( m_isBibleText ) 52 if ( m_isBibleText )
53 { 53 {
54 m_key = new sword::VerseKey( "g" ); 54 m_key = new sword::VerseKey( "g" );
55 55
56 //connect( m_textView, SIGNAL(highlighted(const QString&)), 56 //connect( m_textView, SIGNAL(highlighted(const QString&)),
57 // this, SLOT(slotReferenceClicked(const QString&)) ); 57 // this, SLOT(slotReferenceClicked(const QString&)) );
58 //connect( parent, SIGNAL( strongsNumbers( bool ) ), this, SLOT( slotStrongsNumbers( bool ) ) ); 58 //connect( parent, SIGNAL( strongsNumbers( bool ) ), this, SLOT( slotStrongsNumbers( bool ) ) );
59 } 59 }
60 else 60 else
61 { 61 {
62 m_key = new sword::SWKey( "" ); 62 m_key = new sword::SWKey( "" );
63 } 63 }
64 m_module->SetKey( m_key ); 64 m_module->SetKey( m_key );
65 setText(); 65 setText();
66 } 66 }
67} 67}
68 68
69TextWidget::~TextWidget() 69TextWidget::~TextWidget()
70{ 70{
71 // TODO - why does this cause a SIGSEV??? 71 // TODO - why does this cause a SIGSEV???
72 //delete m_key; 72 //delete m_key;
73} 73}
74 74
75QString TextWidget::getCurrVerse() 75QString TextWidget::getCurrVerse()
76{ 76{
77 m_module->SetKey( m_key->getText() ); 77 m_module->SetKey( m_key->getText() );
78 return ( QString ) m_module->StripText(); 78 return ( QString ) m_module->StripText();
79} 79}
80 80
81void TextWidget::prevChapter() 81void TextWidget::prevPage()
82{ 82{
83 (*m_key) -= m_numVerses;
84 setText();
83} 85}
84 86
85void TextWidget::prevVerse() 87void TextWidget::prevVerse()
86{ 88{
87 (*m_key)--; 89 (*m_key)--;
88 setText(); 90 setText();
89} 91}
90 92
91void TextWidget::setKey( const QString &newKey ) 93void TextWidget::setKey( const QString &newKey )
92{ 94{
93 m_key->setText( newKey.latin1() ); 95 m_key->setText( newKey.latin1() );
94 setText(); 96 setText();
95} 97}
96 98
97void TextWidget::nextVerse() 99void TextWidget::nextVerse()
98{ 100{
99 (*m_key)++; 101 (*m_key)++;
100 setText(); 102 setText();
101} 103}
102 104
103void TextWidget::nextChapter() 105void TextWidget::nextPage()
104{ 106{
107 (*m_key) += m_numVerses;
108 setText();
105} 109}
106 110
107void TextWidget::slotNumVersesChanged( int numVerses ) 111void TextWidget::slotNumVersesChanged( int numVerses )
108{ 112{
109 m_numVerses = numVerses; 113 m_numVerses = numVerses;
110 setText(); 114 setText();
111} 115}
112 116
113void TextWidget::slotFontChanged( const QFont *newFont ) 117void TextWidget::slotFontChanged( const QFont *newFont )
114{ 118{
115 setFont( *newFont ); 119 setFont( *newFont );
116 // TODO - shouldn't have to reset text, but couldn't get repaint() to work 120 // TODO - shouldn't have to reset text, but couldn't get repaint() to work
117 setText(); 121 setText();
118} 122}
119 123
120void TextWidget::slotOptionChanged() 124void TextWidget::slotOptionChanged()
121{ 125{
122 setText(); 126 setText();
123} 127}
124 128
125void TextWidget::setText() 129void TextWidget::setText()
126{ 130{
127 if ( m_key->Error() ) 131 if ( m_key->Error() )
128 return; 132 return;
129 133
130 m_module->SetKey( m_key->getText() ); 134 m_module->SetKey( m_key->getText() );
131 m_fullKey = QString( "%1 (%2)" ).arg( m_key->getShortText() ).arg( m_module->Name() ); 135 m_fullKey = QString( "%1 (%2)" ).arg( m_key->getShortText() ).arg( m_module->Name() );
132 136
133 if ( m_isBibleText ) 137 if ( m_isBibleText )
134 { 138 {
135 m_textView->setVScrollBarMode( QTextView::AlwaysOff ); 139 m_textView->setVScrollBarMode( QTextView::AlwaysOff );
136 140
137 m_abbrevKey = m_key->getShortText(); 141 m_abbrevKey = m_key->getShortText();
138 142
139 QString fullText; 143 QString fullText;
140 144
141 for ( int i = 0; i < m_numVerses; i++ ) 145 for ( int i = 0; i < m_numVerses; i++ )
142 { 146 {
143 QString key = ( QString ) m_module->KeyText(); 147 QString key = ( QString ) m_module->KeyText();
144 QString verseStr = ( QString ) *m_module; 148 QString verseStr = ( QString ) *m_module;
145 149
146 // Format current verse (adding chapter and/or book headings if necessary) 150 // Format current verse (adding chapter and/or book headings if necessary)
147 int verse = static_cast<sword::VerseKey>(m_module->Key()).Verse(); 151 int verse = static_cast<sword::VerseKey>(m_module->Key()).Verse();
148 if ( verse == 1 ) 152 if ( verse == 1 )
149 { 153 {
150 int chapter = static_cast<sword::VerseKey>(m_module->Key()).Chapter(); 154 int chapter = static_cast<sword::VerseKey>(m_module->Key()).Chapter();
151 if ( chapter == 1 ) 155 if ( chapter == 1 )
152 { 156 {
diff --git a/noncore/apps/dagger/textwidget.h b/noncore/apps/dagger/textwidget.h
index 647eae9..f78ef69 100644
--- a/noncore/apps/dagger/textwidget.h
+++ b/noncore/apps/dagger/textwidget.h
@@ -1,73 +1,73 @@
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#ifndef TEXTWIDGET_H 18#ifndef TEXTWIDGET_H
19#define TEXTWIDGET_H 19#define TEXTWIDGET_H
20 20
21#include <qwidget.h> 21#include <qwidget.h>
22 22
23#include <swkey.h> 23#include <swkey.h>
24#include <swmodule.h> 24#include <swmodule.h>
25 25
26class QTextBrowser; 26class QTextBrowser;
27 27
28class TextWidget : public QWidget 28class TextWidget : public QWidget
29{ 29{
30 Q_OBJECT 30 Q_OBJECT
31 31
32public: 32public:
33 TextWidget( QWidget *parent = 0x0, sword::SWModule *module = 0x0, int numVerses = 5, 33 TextWidget( QWidget *parent = 0x0, sword::SWModule *module = 0x0, int numVerses = 5,
34 const QFont *font = 0x0 ); 34 const QFont *font = 0x0 );
35 ~TextWidget(); 35 ~TextWidget();
36 36
37 const QString &getFullKey() { return m_fullKey; } 37 const QString &getFullKey() { return m_fullKey; }
38 const QString &getAbbrevKey() { return m_abbrevKey; } 38 const QString &getAbbrevKey() { return m_abbrevKey; }
39 QString getModuleName() { return QString( m_module->Name() ); } 39 QString getModuleName() { return QString( m_module->Name() ); }
40 sword::SWModule *getModule() { return m_module; } 40 sword::SWModule *getModule() { return m_module; }
41 QString getCurrVerse(); 41 QString getCurrVerse();
42 42
43 bool isBibleText() const { return m_isBibleText; } 43 bool isBibleText() const { return m_isBibleText; }
44 44
45 void prevChapter(); 45 void prevPage();
46 void prevVerse(); 46 void prevVerse();
47 void setKey( const QString &newKey ); 47 void setKey( const QString &newKey );
48 void nextVerse(); 48 void nextVerse();
49 void nextChapter(); 49 void nextPage();
50 50
51public slots: 51public slots:
52 void slotNumVersesChanged( int numVerses ); 52 void slotNumVersesChanged( int numVerses );
53 void slotFontChanged( const QFont *newFont ); 53 void slotFontChanged( const QFont *newFont );
54 void slotOptionChanged(); 54 void slotOptionChanged();
55 55
56private: 56private:
57 sword::SWModule *m_module; // Sword module to display in this widget 57 sword::SWModule *m_module; // Sword module to display in this widget
58 sword::SWKey *m_key; // Current module key 58 sword::SWKey *m_key; // Current module key
59 bool m_isBibleText; // Indicates whether module is a Bible or not 59 bool m_isBibleText; // Indicates whether module is a Bible or not
60 60
61 QTextBrowser *m_textView; // Displays module's text 61 QTextBrowser *m_textView; // Displays module's text
62 QString m_fullKey; // Contains full key text in format 'key (module)' 62 QString m_fullKey; // Contains full key text in format 'key (module)'
63 QString m_abbrevKey; // Contains abbreviated key text 63 QString m_abbrevKey; // Contains abbreviated key text
64 64
65 int m_numVerses; // Number of verses to display at a time for Bible modules 65 int m_numVerses; // Number of verses to display at a time for Bible modules
66 66
67 void setText(); 67 void setText();
68 68
69signals: 69signals:
70 void sigRefClicked( const QString &ref ); 70 void sigRefClicked( const QString &ref );
71}; 71};
72 72
73#endif 73#endif