summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/dagger/configuredlg.cpp8
-rw-r--r--noncore/apps/dagger/navbar.cpp19
-rw-r--r--noncore/apps/dagger/opentextdlg.cpp4
-rw-r--r--noncore/apps/dagger/searchbar.cpp18
4 files changed, 25 insertions, 24 deletions
diff --git a/noncore/apps/dagger/configuredlg.cpp b/noncore/apps/dagger/configuredlg.cpp
index 42bc6da..791eeb1 100644
--- a/noncore/apps/dagger/configuredlg.cpp
+++ b/noncore/apps/dagger/configuredlg.cpp
@@ -1,120 +1,118 @@
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 "configuredlg.h" 18#include "configuredlg.h"
19 19
20#include <opie2/ofiledialog.h> 20#include <opie2/ofiledialog.h>
21 21#include <opie2/oresource.h>
22#include <qpe/resource.h>
23 22
24#include <qlabel.h> 23#include <qlabel.h>
25#include <qlayout.h> 24#include <qlayout.h>
26#include <qpushbutton.h> 25#include <qpushbutton.h>
27#include <qvbuttongroup.h> 26#include <qvbuttongroup.h>
28#include <qwhatsthis.h> 27#include <qwhatsthis.h>
29 28
30ConfigureDlg::ConfigureDlg( QWidget *parent, const QString &swordPath, bool alwaysOpenNew, int numVerses, 29ConfigureDlg::ConfigureDlg( QWidget *parent, const QString &swordPath, bool alwaysOpenNew, int numVerses,
31 bool disableBlanking, int copyFormat, const QFont *font ) 30 bool disableBlanking, int copyFormat, const QFont *font )
32 : QDialog( parent, QString::null, true, WStyle_ContextHelp ) 31 : QDialog( parent, QString::null, true, WStyle_ContextHelp )
33 , m_tabs( this ) 32 , m_tabs( this )
34{ 33{
35 setCaption( tr( "Configure Dagger" ) ); 34 setCaption( tr( "Configure Dagger" ) );
36 35
37 QVBoxLayout *layout = new QVBoxLayout( this ); 36 QVBoxLayout *layout = new QVBoxLayout( this );
38 layout->setMargin( 4 ); 37 layout->setMargin( 4 );
39 layout->addWidget( &m_tabs ); 38 layout->addWidget( &m_tabs );
40 39
41 // General tab 40 // General tab
42 QWidget *widget = new QWidget( this ); 41 QWidget *widget = new QWidget( this );
43 QGridLayout *grid = new QGridLayout( widget, 1, 2, 4, 2 ); 42 QGridLayout *grid = new QGridLayout( widget, 1, 2, 4, 2 );
44 grid->setRowStretch( 9, 5 ); 43 grid->setRowStretch( 9, 5 );
45 grid->setColStretch( 0, 2 ); 44 grid->setColStretch( 0, 2 );
46 45
47 QLabel *label = new QLabel( tr( "Path where Sword texts are located:" ), widget ); 46 QLabel *label = new QLabel( tr( "Path where Sword texts are located:" ), widget );
48 label->setAlignment( Qt::AlignLeft | Qt::AlignTop | Qt::WordBreak ); 47 label->setAlignment( Qt::AlignLeft | Qt::AlignTop | Qt::WordBreak );
49 QWhatsThis::add( label, tr( "Enter the path where the Sword modules (Bible texts, commentaries, etc.) can be found. This path should contain either the 'mods.conf' file or 'mods.d' sub-directory." ) ); 48 QWhatsThis::add( label, tr( "Enter the path where the Sword modules (Bible texts, commentaries, etc.) can be found. This path should contain either the 'mods.conf' file or 'mods.d' sub-directory." ) );
50 grid->addMultiCellWidget( label, 0, 0, 0, 1 ); 49 grid->addMultiCellWidget( label, 0, 0, 0, 1 );
51 m_swordPath = new QLineEdit( swordPath, widget ); 50 m_swordPath = new QLineEdit( swordPath, widget );
52 QWhatsThis::add( m_swordPath, tr( "Enter the path where the Sword texts (Bibles, commentaries, etc.) can be found. This path should contain either the 'mods.conf' file or 'mods.d' sub-directory." ) ); 51 QWhatsThis::add( m_swordPath, tr( "Enter the path where the Sword texts (Bibles, commentaries, etc.) can be found. This path should contain either the 'mods.conf' file or 'mods.d' sub-directory." ) );
53 grid->addWidget( m_swordPath, 1, 0 ); 52 grid->addWidget( m_swordPath, 1, 0 );
54 QPixmap pic; 53 QPushButton *btn = new QPushButton( Opie::Core::OResource::loadPixmap( "folder", Opie::Core::OResource::SmallIcon ),
55 pic.convertFromImage( Resource::loadImage( "folder" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); 54 QString::null, widget );
56 QPushButton *btn = new QPushButton( pic, QString::null, widget );
57 btn->setMaximumWidth( btn->height() ); 55 btn->setMaximumWidth( btn->height() );
58 QWhatsThis::add( btn, tr( "Tap here to select the path where the Sword texts (Bibles, commentaries, etc.) can be found. This path should contain either the 'mods.conf' file or 'mods.d' sub-directory." ) ); 56 QWhatsThis::add( btn, tr( "Tap here to select the path where the Sword texts (Bibles, commentaries, etc.) can be found. This path should contain either the 'mods.conf' file or 'mods.d' sub-directory." ) );
59 connect( btn, SIGNAL(clicked()), this, SLOT(slotSelectSwordPath()) ); 57 connect( btn, SIGNAL(clicked()), this, SLOT(slotSelectSwordPath()) );
60 grid->addWidget( btn, 1, 1 ); 58 grid->addWidget( btn, 1, 1 );
61 59
62 label = new QLabel( tr( "(Note: Dagger must be restarted for this option to take affect.)" ), widget ); 60 label = new QLabel( tr( "(Note: Dagger must be restarted for this option to take affect.)" ), widget );
63 label->setAlignment( Qt::AlignHCenter | Qt::AlignTop | Qt::WordBreak ); 61 label->setAlignment( Qt::AlignHCenter | Qt::AlignTop | Qt::WordBreak );
64 QWhatsThis::add( label, tr( "Enter the path where the Sword modules (Bible texts, commentaries, etc.) can be found. This path should contain either the 'mods.conf' file or 'mods.d' sub-directory." ) ); 62 QWhatsThis::add( label, tr( "Enter the path where the Sword modules (Bible texts, commentaries, etc.) can be found. This path should contain either the 'mods.conf' file or 'mods.d' sub-directory." ) );
65 grid->addMultiCellWidget( label, 2, 2, 0, 1 ); 63 grid->addMultiCellWidget( label, 2, 2, 0, 1 );
66 64
67 grid->addRowSpacing( 3, 15 ); 65 grid->addRowSpacing( 3, 15 );
68 66
69 m_alwaysOpenNew = new QCheckBox( tr( "Always open texts in new window?" ), widget ); 67 m_alwaysOpenNew = new QCheckBox( tr( "Always open texts in new window?" ), widget );
70 m_alwaysOpenNew->setChecked( alwaysOpenNew ); 68 m_alwaysOpenNew->setChecked( alwaysOpenNew );
71 QWhatsThis::add( m_alwaysOpenNew, tr( "Tap here to always open texts in a new window. If this option is not selected, only one copy of a Sword text will be opened." ) ); 69 QWhatsThis::add( m_alwaysOpenNew, tr( "Tap here to always open texts in a new window. If this option is not selected, only one copy of a Sword text will be opened." ) );
72 grid->addMultiCellWidget( m_alwaysOpenNew, 4, 4, 0, 1 ); 70 grid->addMultiCellWidget( m_alwaysOpenNew, 4, 4, 0, 1 );
73 71
74 grid->addRowSpacing( 5, 15 ); 72 grid->addRowSpacing( 5, 15 );
75 73
76 label = new QLabel( tr( "Number of verses to display at a time:" ), widget ); 74 label = new QLabel( tr( "Number of verses to display at a time:" ), widget );
77 label->setAlignment( Qt::AlignLeft | Qt::AlignTop | Qt::WordBreak ); 75 label->setAlignment( Qt::AlignLeft | Qt::AlignTop | Qt::WordBreak );
78 QWhatsThis::add( label, tr( "Enter the number of verses to display at a time. This also affects how far the scroll to previous/next page buttons on the Navigation bar scroll." ) ); 76 QWhatsThis::add( label, tr( "Enter the number of verses to display at a time. This also affects how far the scroll to previous/next page buttons on the Navigation bar scroll." ) );
79 grid->addWidget( label, 6, 0 ); 77 grid->addWidget( label, 6, 0 );
80 m_numVerses = new QSpinBox( 1, 20, 1, widget ); 78 m_numVerses = new QSpinBox( 1, 20, 1, widget );
81 m_numVerses->setValue( numVerses ); 79 m_numVerses->setValue( numVerses );
82 QWhatsThis::add( m_numVerses, tr( "Enter the number of verses to display at a time. This also affects how far the scroll to previous/next page buttons on the Navigation bar scroll." ) ); 80 QWhatsThis::add( m_numVerses, tr( "Enter the number of verses to display at a time. This also affects how far the scroll to previous/next page buttons on the Navigation bar scroll." ) );
83 grid->addWidget( m_numVerses, 6, 1 ); 81 grid->addWidget( m_numVerses, 6, 1 );
84 82
85 grid->addRowSpacing( 7, 15 ); 83 grid->addRowSpacing( 7, 15 );
86 84
87 m_disableScreenBlank = new QCheckBox( tr( "Disable automatic screen power-down?" ), widget ); 85 m_disableScreenBlank = new QCheckBox( tr( "Disable automatic screen power-down?" ), widget );
88 m_disableScreenBlank->setChecked( disableBlanking ); 86 m_disableScreenBlank->setChecked( disableBlanking );
89 QWhatsThis::add( m_disableScreenBlank, tr( "Tap here to disable Opie's automatic power management feature which will dim and turn off the screen after a specified time. This will only be effective while Dagger is running." ) ); 87 QWhatsThis::add( m_disableScreenBlank, tr( "Tap here to disable Opie's automatic power management feature which will dim and turn off the screen after a specified time. This will only be effective while Dagger is running." ) );
90 grid->addMultiCellWidget( m_disableScreenBlank, 8, 8, 0, 1 ); 88 grid->addMultiCellWidget( m_disableScreenBlank, 8, 8, 0, 1 );
91 89
92 m_tabs.addTab( widget, "SettingsIcon", tr( "General" ) ); 90 m_tabs.addTab( widget, "SettingsIcon", tr( "General" ) );
93 91
94 // Copy tab 92 // Copy tab
95 widget = new QWidget( this ); 93 widget = new QWidget( this );
96 QWhatsThis::add( widget, tr( "Select the format used when copying the current verse to the clipboard." ) ); 94 QWhatsThis::add( widget, tr( "Select the format used when copying the current verse to the clipboard." ) );
97 layout = new QVBoxLayout( widget ); 95 layout = new QVBoxLayout( widget );
98 layout->setMargin( 4 ); 96 layout->setMargin( 4 );
99 97
100 QVButtonGroup *bg = new QVButtonGroup( tr( "Select copy format" ), widget ); 98 QVButtonGroup *bg = new QVButtonGroup( tr( "Select copy format" ), widget );
101 m_copyTextFull = new QRadioButton( tr( "\"Verse (Book cc:vv, text)\"" ), bg ); 99 m_copyTextFull = new QRadioButton( tr( "\"Verse (Book cc:vv, text)\"" ), bg );
102 connect( m_copyTextFull, SIGNAL(clicked()), this, SLOT(slotCopyFormatSelected()) ); 100 connect( m_copyTextFull, SIGNAL(clicked()), this, SLOT(slotCopyFormatSelected()) );
103 m_copyFull = new QRadioButton( tr( "\"Verse (Book cc:vv)\"" ), bg ); 101 m_copyFull = new QRadioButton( tr( "\"Verse (Book cc:vv)\"" ), bg );
104 connect( m_copyFull, SIGNAL(clicked()), this, SLOT(slotCopyFormatSelected()) ); 102 connect( m_copyFull, SIGNAL(clicked()), this, SLOT(slotCopyFormatSelected()) );
105 m_copyVerse = new QRadioButton( tr( "\"Verse\"" ), bg ); 103 m_copyVerse = new QRadioButton( tr( "\"Verse\"" ), bg );
106 connect( m_copyVerse, SIGNAL(clicked()), this, SLOT(slotCopyFormatSelected()) ); 104 connect( m_copyVerse, SIGNAL(clicked()), this, SLOT(slotCopyFormatSelected()) );
107 m_copyKey = new QRadioButton( tr( "\"Book cc:vv\"" ), bg ); 105 m_copyKey = new QRadioButton( tr( "\"Book cc:vv\"" ), bg );
108 connect( m_copyKey, SIGNAL(clicked()), this, SLOT(slotCopyFormatSelected()) ); 106 connect( m_copyKey, SIGNAL(clicked()), this, SLOT(slotCopyFormatSelected()) );
109 layout->addWidget( bg ); 107 layout->addWidget( bg );
110 108
111 layout->addSpacing( 15 ); 109 layout->addSpacing( 15 );
112 110
113 label = new QLabel( tr( "Example:" ), widget ); 111 label = new QLabel( tr( "Example:" ), widget );
114 label->setAlignment( Qt::AlignLeft | Qt::AlignTop | Qt::WordBreak ); 112 label->setAlignment( Qt::AlignLeft | Qt::AlignTop | Qt::WordBreak );
115 layout->addWidget( label ); 113 layout->addWidget( label );
116 114
117 layout->addSpacing( 15 ); 115 layout->addSpacing( 15 );
118 116
119 m_copyExample = new QLabel( widget ); 117 m_copyExample = new QLabel( widget );
120 m_copyExample->setAlignment( Qt::AlignLeft | Qt::AlignTop | Qt::WordBreak ); 118 m_copyExample->setAlignment( Qt::AlignLeft | Qt::AlignTop | Qt::WordBreak );
diff --git a/noncore/apps/dagger/navbar.cpp b/noncore/apps/dagger/navbar.cpp
index ac49613..b28c677 100644
--- a/noncore/apps/dagger/navbar.cpp
+++ b/noncore/apps/dagger/navbar.cpp
@@ -1,105 +1,108 @@
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 <opie2/oresource.h> 20#include <opie2/oresource.h>
21 21
22#include <qpe/config.h> 22#include <qpe/config.h>
23#include <qpe/resource.h> 23#include <qpe/resource.h>
24 24
25#include <qaction.h> 25#include <qaction.h>
26#include <qlineedit.h> 26#include <qlineedit.h>
27#include <qwhatsthis.h> 27#include <qwhatsthis.h>
28 28
29using Opie::Core::OResource;
30
31NavBar::NavBar( QMainWindow *parent ) 29NavBar::NavBar( QMainWindow *parent )
32 : QToolBar( QString::null, parent, QMainWindow::Top, true ) 30 : QToolBar( QString::null, parent, QMainWindow::Top, true )
33{ 31{
34 // Initialize UI 32 // Initialize UI
35 m_actionPrevPage = new QAction( tr( "Previous page" ), OResource::loadPixmap( "fastback", OResource::SmallIcon ), 33 m_actionPrevPage = new QAction( tr( "Previous page" ),
34 Opie::Core::OResource::loadPixmap( "fastback", Opie::Core::OResource::SmallIcon ),
36 QString::null, 0, this, 0 ); 35 QString::null, 0, this, 0 );
37 m_actionPrevPage->setWhatsThis( tr( "Tap here to scroll backward one page." ) ); 36 m_actionPrevPage->setWhatsThis( tr( "Tap here to scroll backward one page." ) );
38 m_actionPrevPage->addTo( this ); 37 m_actionPrevPage->addTo( this );
39 connect( m_actionPrevPage, SIGNAL(activated()), this, SIGNAL(prevPage()) ); 38 connect( m_actionPrevPage, SIGNAL(activated()), this, SIGNAL(prevPage()) );
40 39
41 m_actionPrevVerse = new QAction( tr( "Previous verse" ), OResource::loadPixmap( "back", OResource::SmallIcon ), 40 m_actionPrevVerse = new QAction( tr( "Previous verse" ),
41 Opie::Core::OResource::loadPixmap( "back", Opie::Core::OResource::SmallIcon ),
42 QString::null, 0, this, 0 ); 42 QString::null, 0, this, 0 );
43 m_actionPrevVerse->setWhatsThis( tr( "Tap here to scroll backward one verse." ) ); 43 m_actionPrevVerse->setWhatsThis( tr( "Tap here to scroll backward one verse." ) );
44 m_actionPrevVerse->addTo( this ); 44 m_actionPrevVerse->addTo( this );
45 connect( m_actionPrevVerse, SIGNAL(activated()), this, SIGNAL(prevVerse()) ); 45 connect( m_actionPrevVerse, SIGNAL(activated()), this, SIGNAL(prevVerse()) );
46 46
47 m_key = new QLineEdit( this ); 47 m_key = new QLineEdit( this );
48 setStretchableWidget( m_key ); 48 setStretchableWidget( m_key );
49 QWhatsThis::add( m_key, tr( "Enter location to display here." ) ); 49 QWhatsThis::add( m_key, tr( "Enter location to display here." ) );
50 connect(m_key, SIGNAL(textChanged(const QString &)), this, SIGNAL(keyChanged(const QString &)) ); 50 connect(m_key, SIGNAL(textChanged(const QString &)), this, SIGNAL(keyChanged(const QString &)) );
51 51
52 m_actionNextVerse = new QAction( tr( "Next verse" ), OResource::loadPixmap( "forward", OResource::SmallIcon ), 52 m_actionNextVerse = new QAction( tr( "Next verse" ),
53 Opie::Core::OResource::loadPixmap( "forward", Opie::Core::OResource::SmallIcon ),
53 QString::null, 0, this, 0 ); 54 QString::null, 0, this, 0 );
54 m_actionNextVerse->setWhatsThis( tr( "Tap here to scroll forward one verse." ) ); 55 m_actionNextVerse->setWhatsThis( tr( "Tap here to scroll forward one verse." ) );
55 m_actionNextVerse->addTo( this ); 56 m_actionNextVerse->addTo( this );
56 connect( m_actionNextVerse, SIGNAL(activated()), this, SIGNAL(nextVerse()) ); 57 connect( m_actionNextVerse, SIGNAL(activated()), this, SIGNAL(nextVerse()) );
57 58
58 m_actionNextPage = new QAction( tr( "Next page" ), OResource::loadPixmap( "fastforward", OResource::SmallIcon ), 59 m_actionNextPage = new QAction( tr( "Next page" ),
59 QString::null, 0, this, 0 ); 60 Opie::Core::OResource::loadPixmap( "fastforward", Opie::Core::OResource::SmallIcon ),
61 QString::null, 0, this, 0 );
60 m_actionNextPage->setWhatsThis( tr( "Tap here to scroll forward one page." ) ); 62 m_actionNextPage->setWhatsThis( tr( "Tap here to scroll forward one page." ) );
61 m_actionNextPage->addTo( this ); 63 m_actionNextPage->addTo( this );
62 connect( m_actionNextPage, SIGNAL(activated()), this, SIGNAL(nextPage()) ); 64 connect( m_actionNextPage, SIGNAL(activated()), this, SIGNAL(nextPage()) );
63 65
64 addSeparator(); 66 addSeparator();
65 67
66 m_scrollRate = new QSpinBox( 1, 100, 1, this ); 68 m_scrollRate = new QSpinBox( 1, 100, 1, this );
67 m_scrollRate->setMinimumWidth( 35 ); 69 m_scrollRate->setMinimumWidth( 35 );
68 QWhatsThis::add( m_scrollRate, tr( "Adjust auto-scroll rate here. A larger value represents a slower scrolling rate." ) ); 70 QWhatsThis::add( m_scrollRate, tr( "Adjust auto-scroll rate here. A larger value represents a slower scrolling rate." ) );
69 connect( m_scrollRate, SIGNAL(valueChanged(int)), this, SIGNAL(scrollRateChanged(int)) ); 71 connect( m_scrollRate, SIGNAL(valueChanged(int)), this, SIGNAL(scrollRateChanged(int)) );
70 72
71 m_actionScroll = new QAction( tr( "Auto-scroll" ), OResource::loadPixmap( "dagger/autoscroll", OResource::SmallIcon ), 73 m_actionScroll = new QAction( tr( "Auto-scroll" ),
74 Opie::Core::OResource::loadPixmap( "dagger/autoscroll", Opie::Core::OResource::SmallIcon ),
72 QString::null, 0, this, 0 ); 75 QString::null, 0, this, 0 );
73 m_actionScroll->setToggleAction( true ); 76 m_actionScroll->setToggleAction( true );
74 m_actionScroll->setWhatsThis( tr( "Tap here to start or stop auto-scrolling." ) ); 77 m_actionScroll->setWhatsThis( tr( "Tap here to start or stop auto-scrolling." ) );
75 connect( m_actionScroll, SIGNAL(toggled(bool)), this, SIGNAL(autoScroll(bool)) ); 78 connect( m_actionScroll, SIGNAL(toggled(bool)), this, SIGNAL(autoScroll(bool)) );
76 m_actionScroll->addTo( this ); 79 m_actionScroll->addTo( this );
77 80
78 if ( parent ) 81 if ( parent )
79 { 82 {
80 installEventFilter( parent ); 83 installEventFilter( parent );
81 m_key->installEventFilter( parent ); 84 m_key->installEventFilter( parent );
82 } 85 }
83} 86}
84 87
85void NavBar::navBtnsEnable( bool enabled ) 88void NavBar::navBtnsEnable( bool enabled )
86{ 89{
87 m_actionPrevPage->setEnabled( enabled ); 90 m_actionPrevPage->setEnabled( enabled );
88 m_actionPrevVerse->setEnabled( enabled ); 91 m_actionPrevVerse->setEnabled( enabled );
89 m_actionNextVerse->setEnabled( enabled ); 92 m_actionNextVerse->setEnabled( enabled );
90 m_actionNextPage->setEnabled( enabled ); 93 m_actionNextPage->setEnabled( enabled );
91 m_scrollRate->setEnabled( enabled ); 94 m_scrollRate->setEnabled( enabled );
92 m_actionScroll->setEnabled( enabled ); 95 m_actionScroll->setEnabled( enabled );
93} 96}
94 97
95void NavBar::setKey( const QString &newKey ) 98void NavBar::setKey( const QString &newKey )
96{ 99{
97 disconnect( m_key, SIGNAL(textChanged(const QString &)), 0, 0 ); 100 disconnect( m_key, SIGNAL(textChanged(const QString &)), 0, 0 );
98 m_key->setText( newKey ); 101 m_key->setText( newKey );
99 connect(m_key, SIGNAL(textChanged(const QString &)), this, SIGNAL(keyChanged(const QString &)) ); 102 connect(m_key, SIGNAL(textChanged(const QString &)), this, SIGNAL(keyChanged(const QString &)) );
100} 103}
101 104
102void NavBar::setAutoScrollRate( int scrollRate ) 105void NavBar::setAutoScrollRate( int scrollRate )
103{ 106{
104 m_scrollRate->setValue( scrollRate ); 107 m_scrollRate->setValue( scrollRate );
105} 108}
diff --git a/noncore/apps/dagger/opentextdlg.cpp b/noncore/apps/dagger/opentextdlg.cpp
index 8c94a4b..7fd5cde 100644
--- a/noncore/apps/dagger/opentextdlg.cpp
+++ b/noncore/apps/dagger/opentextdlg.cpp
@@ -1,101 +1,101 @@
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 "opentextdlg.h" 18#include "opentextdlg.h"
19 19
20#include <qpe/resource.h> 20#include <qpe/applnk.h>
21 21
22#include <qheader.h> 22#include <qheader.h>
23#include <qlayout.h> 23#include <qlayout.h>
24#include <qpixmap.h> 24#include <qpixmap.h>
25 25
26OpenTextDlg::OpenTextDlg( QWidget *parent, sword::SWMgr *swordMgr, QPixmap *bibleIcon, 26OpenTextDlg::OpenTextDlg( QWidget *parent, sword::SWMgr *swordMgr, QPixmap *bibleIcon,
27 QPixmap *commentaryIcon, QPixmap *lexiconIcon ) 27 QPixmap *commentaryIcon, QPixmap *lexiconIcon )
28 : QDialog( parent, QString::null, true ) 28 : QDialog( parent, QString::null, true )
29 , m_textList( this ) 29 , m_textList( this )
30{ 30{
31 setCaption( tr( "Open text" ) ); 31 setCaption( tr( "Open text" ) );
32 32
33 QVBoxLayout *layout = new QVBoxLayout( this ); 33 QVBoxLayout *layout = new QVBoxLayout( this );
34 layout->setMargin( 4 ); 34 layout->setMargin( 4 );
35 layout->addWidget( &m_textList ); 35 layout->addWidget( &m_textList );
36 36
37 m_textList.setRootIsDecorated( true ); 37 m_textList.setRootIsDecorated( true );
38 m_textList.addColumn( tr( "Icon" ),35 ); 38 m_textList.addColumn( tr( "Icon" ) );
39 m_textList.addColumn( tr( "Text" ) ); 39 m_textList.addColumn( tr( "Text" ) );
40 m_textList.header()->hide(); 40 m_textList.header()->hide();
41 m_textList.setAllColumnsShowFocus( true ); 41 m_textList.setAllColumnsShowFocus( true );
42 m_textList.setSorting( 1 ); 42 m_textList.setSorting( 1 );
43 43
44 m_commentaries = new QListViewItem( &m_textList, QString::null, tr( "Commentaries" ) ); 44 m_commentaries = new QListViewItem( &m_textList, QString::null, tr( "Commentaries" ) );
45 m_commentaries->setPixmap( 0, *commentaryIcon ); 45 m_commentaries->setPixmap( 0, *commentaryIcon );
46 m_textList.insertItem( m_commentaries ); 46 m_textList.insertItem( m_commentaries );
47 m_lexicons = new QListViewItem( &m_textList, QString::null, tr( "Lexicons/Dictionaries" ) ); 47 m_lexicons = new QListViewItem( &m_textList, QString::null, tr( "Lexicons/Dictionaries" ) );
48 m_lexicons->setPixmap( 0, *lexiconIcon ); 48 m_lexicons->setPixmap( 0, *lexiconIcon );
49 m_textList.insertItem( m_lexicons ); 49 m_textList.insertItem( m_lexicons );
50 m_bibles = new QListViewItem( &m_textList, QString::null, tr( "Biblical Texts" ) ); 50 m_bibles = new QListViewItem( &m_textList, QString::null, tr( "Biblical Texts" ) );
51 m_bibles->setPixmap( 0, *bibleIcon ); 51 m_bibles->setPixmap( 0, *bibleIcon );
52 m_textList.insertItem( m_bibles ); 52 m_textList.insertItem( m_bibles );
53 connect( &m_textList, SIGNAL(clicked(QListViewItem*)), this, SLOT(slotItemClicked(QListViewItem*)) ); 53 connect( &m_textList, SIGNAL(clicked(QListViewItem*)), this, SLOT(slotItemClicked(QListViewItem*)) );
54 54
55 if ( swordMgr ) 55 if ( swordMgr )
56 { 56 {
57 sword::ModMap::iterator it; 57 sword::ModMap::iterator it;
58 QString type; 58 QString type;
59 QPixmap *icon = 0x0; 59 QPixmap *icon = 0x0;
60 QListViewItem *parent = 0x0; 60 QListViewItem *parent = 0x0;
61 61
62 for ( it = swordMgr->Modules.begin(); it != swordMgr->Modules.end(); it++ ) 62 for ( it = swordMgr->Modules.begin(); it != swordMgr->Modules.end(); it++ )
63 { 63 {
64 if ( it->second ) 64 if ( it->second )
65 { 65 {
66 type = it->second->Type(); 66 type = it->second->Type();
67 if ( type == "Biblical Texts" ) 67 if ( type == "Biblical Texts" )
68 { 68 {
69 icon = bibleIcon; 69 icon = bibleIcon;
70 parent = m_bibles; 70 parent = m_bibles;
71 } 71 }
72 else if ( type == "Commentaries" ) 72 else if ( type == "Commentaries" )
73 { 73 {
74 icon = commentaryIcon; 74 icon = commentaryIcon;
75 parent = m_commentaries; 75 parent = m_commentaries;
76 } 76 }
77 else if ( type == "Lexicons / Dictionaries" ) 77 else if ( type == "Lexicons / Dictionaries" )
78 { 78 {
79 icon = lexiconIcon; 79 icon = lexiconIcon;
80 parent = m_lexicons; 80 parent = m_lexicons;
81 } 81 }
82 82
83 parent->insertItem( new QListViewItem( parent, QString::null, it->first.c_str() ) ); 83 parent->insertItem( new QListViewItem( parent, QString::null, it->first.c_str() ) );
84 } 84 }
85 } 85 }
86 } 86 }
87 87
88 m_textList.sort(); 88 m_textList.sort();
89} 89}
90 90
91void OpenTextDlg::slotItemClicked( QListViewItem *item ) 91void OpenTextDlg::slotItemClicked( QListViewItem *item )
92{ 92{
93 if ( item == m_bibles || item == m_lexicons || item == m_commentaries ) 93 if ( item == m_bibles || item == m_lexicons || item == m_commentaries )
94 { 94 {
95 m_textList.clearSelection(); 95 m_textList.clearSelection();
96 if ( item->childCount() > 0 ) 96 if ( item->childCount() > 0 )
97 { 97 {
98 item->setOpen( !item->isOpen() ); 98 item->setOpen( !item->isOpen() );
99 } 99 }
100 } 100 }
101} 101}
diff --git a/noncore/apps/dagger/searchbar.cpp b/noncore/apps/dagger/searchbar.cpp
index b794bfd..b195f67 100644
--- a/noncore/apps/dagger/searchbar.cpp
+++ b/noncore/apps/dagger/searchbar.cpp
@@ -1,140 +1,140 @@
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#include <qpe/resource.h>
26 25
27#include <qaction.h> 26#include <qaction.h>
28#include <qcombobox.h> 27#include <qcombobox.h>
29#include <qlineedit.h> 28#include <qlineedit.h>
30#include <qwhatsthis.h> 29#include <qwhatsthis.h>
31 30
32#include <listkey.h> 31#include <listkey.h>
33#include <regex.h> 32#include <regex.h>
34#include <versekey.h> 33#include <versekey.h>
35 34
36using Opie::Core::OResource;
37
38void searchCallback( char /*percent*/, void */*userData*/ ) 35void searchCallback( char /*percent*/, void */*userData*/ )
39{ 36{
40 qApp->processEvents(); 37 qApp->processEvents();
41} 38}
42 39
43SearchBar::SearchBar( QMainWindow *parent ) 40SearchBar::SearchBar( QMainWindow *parent )
44 : QToolBar( QString::null, parent, QMainWindow::Top, true ) 41 : QToolBar( QString::null, parent, QMainWindow::Top, true )
45 , m_currText( 0x0 ) 42 , m_currText( 0x0 )
46{ 43{
47 // Initialize UI 44 // Initialize UI
48 m_searchText = new QLineEdit( this ); 45 m_searchText = new QLineEdit( this );
49 setStretchableWidget( m_searchText ); 46 setStretchableWidget( m_searchText );
50 QWhatsThis::add( m_searchText, tr( "Enter text to search for here." ) ); 47 QWhatsThis::add( m_searchText, tr( "Enter text to search for here." ) );
51 connect(m_searchText, SIGNAL(textChanged(const QString &)), 48 connect(m_searchText, SIGNAL(textChanged(const QString &)),
52 this, SLOT(slotTextChanged(const QString &)) ); 49 this, SLOT(slotTextChanged(const QString &)) );
53 50
54 m_actionFind = new QAction( tr( "Find" ), OResource::loadPixmap( "find", OResource::SmallIcon ), QString::null, 51 m_actionFind = new QAction( tr( "Find" ),
55 0, this, 0 ); 52 Opie::Core::OResource::loadPixmap( "find", Opie::Core::OResource::SmallIcon ),
53 QString::null, 0, this, 0 );
56 m_actionFind->setEnabled( false ); 54 m_actionFind->setEnabled( false );
57 m_actionFind->addTo( this ); 55 m_actionFind->addTo( this );
58 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." ) );
59 connect( m_actionFind, SIGNAL(activated()), this, SLOT(slotFind()) ); 57 connect( m_actionFind, SIGNAL(activated()), this, SLOT(slotFind()) );
60 58
61 addSeparator(); 59 addSeparator();
62 60
63 m_actionPrev = new QAction( tr( "Previous result" ), OResource::loadPixmap( "back", OResource::SmallIcon ), 61 m_actionPrev = new QAction( tr( "Previous result" ),
64 QString::null, 0, this, 0 ); 62 Opie::Core::OResource::loadPixmap( "back", Opie::Core::OResource::SmallIcon ),
63 QString::null, 0, this, 0 );
65 m_actionPrev->setEnabled( false ); 64 m_actionPrev->setEnabled( false );
66 m_actionPrev->addTo( this ); 65 m_actionPrev->addTo( this );
67 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." ) );
68 connect( m_actionPrev, SIGNAL(activated()), this, SLOT(slotPrev()) ); 67 connect( m_actionPrev, SIGNAL(activated()), this, SLOT(slotPrev()) );
69 68
70 m_resultList = new QComboBox( this ); 69 m_resultList = new QComboBox( this );
71 m_resultList->setEnabled( false ); 70 m_resultList->setEnabled( false );
72 QWhatsThis::add( m_resultList, tr( "Select the desired search result here." ) ); 71 QWhatsThis::add( m_resultList, tr( "Select the desired search result here." ) );
73 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 &)) );
74 73
75 m_actionNext = new QAction( tr( "Next result" ), OResource::loadPixmap( "forward", OResource::SmallIcon ), 74 m_actionNext = new QAction( tr( "Next result" ),
76 QString::null, 0, this, 0 ); 75 Opie::Core::OResource::loadPixmap( "forward", Opie::Core::OResource::SmallIcon ),
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->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