summaryrefslogtreecommitdiff
path: root/noncore/apps/dagger/mainwindow.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/dagger/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/dagger/mainwindow.cpp17
1 files changed, 10 insertions, 7 deletions
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
@@ -64,24 +64,27 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags /*fl*/ )
connect( &m_autoScrollTimer, SIGNAL(timeout()), this, SLOT(slotNavNextVerse()) );
m_bibleIcon = new QPixmap( Resource::loadPixmap( "dagger/bibletext" ) );
m_commentaryIcon = new QPixmap( Resource::loadPixmap( "dagger/commentary" ) );
m_lexiconIcon = new QPixmap( Resource::loadPixmap( "dagger/lexicon" ) );
// Load initial configuration
QTimer::singleShot( 100, this, SLOT( initConfig() ) );
}
MainWindow::~MainWindow()
{
+ // Re-enable screen blanking if it was disabled
+ QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
+
// Save Sword options
m_config.setGroup( "Sword" );
m_config.writeEntry( "ModPath", m_modulePath );
for ( QAction *a = m_actionSwordOpts.first(); a; a = m_actionSwordOpts.next() )
m_config.writeEntry( a->text(), a->isOn() );
// Save configuration options
m_config.setGroup( "Config" );
m_config.writeEntry( "AlwaysOpenNew", m_alwaysOpenNew );
m_config.writeEntry( "AutoScroll", m_navToolbar->autoScrollRate() );
m_config.writeEntry( "DisableScreenBlanking", m_disableScreenBlank );
@@ -160,29 +163,29 @@ void MainWindow::initUI()
m_tabs.installEventFilter( this );
setToolBarsMovable( false );
m_barDock = new QToolBar( this );
m_barDock->setHorizontalStretchable( true );
m_menuBar = new QMenuBar( m_barDock );
m_menuBar->setMargin( 0 );
// Allocate toolbars
m_navToolbar = new NavBar( this );
m_navToolbar->navBtnsEnable( false );
- connect( m_navToolbar, SIGNAL(prevChapter()), this, SLOT(slotNavPrevChapter()) );
+ connect( m_navToolbar, SIGNAL(prevPage()), this, SLOT(slotNavPrevPage()) );
connect( m_navToolbar, SIGNAL(prevVerse()), this, SLOT(slotNavPrevVerse()) );
connect( m_navToolbar, SIGNAL(keyChanged(const QString &)), this, SLOT(slotNavKeyChanged(const QString &)) );
connect( m_navToolbar, SIGNAL(nextVerse()), this, SLOT(slotNavNextVerse()) );
- connect( m_navToolbar, SIGNAL(nextChapter()), this, SLOT(slotNavNextChapter()) );
+ connect( m_navToolbar, SIGNAL(nextPage()), this, SLOT(slotNavNextPage()) );
connect( m_navToolbar, SIGNAL(autoScroll(bool)), this, SLOT(slotNavAutoScroll(bool)) );
connect( m_navToolbar, SIGNAL(scrollRateChanged(int)), this, SLOT(slotNavScrollRateChanged(int)) );
m_searchToolbar = new SearchBar( this );
connect( m_searchToolbar, SIGNAL(sigResultClicked(const QString &)), this, SLOT(slotSearchResultClicked(const QString &)) );
// Text menu
QPopupMenu *popup = new QPopupMenu( this );
QAction *a = new QAction( tr( "Open..." ), Resource::loadPixmap( "fileopen" ), QString::null, 0, this, 0 );
connect( a, SIGNAL(activated()), this, SLOT(slotTextOpen()) );
a->addTo( popup );
@@ -323,25 +326,25 @@ int MainWindow::findBookmark( const QString &bookmark )
while ( ( id != -1 ) && ( m_bookmarkMenu->text( id ) != bookmark ) )
{
++index;
id = m_bookmarkMenu->idAt( index );
}
return id;
}
void MainWindow::enableScreenBlanking( bool enable )
{
enable ? QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable
- : QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Disable;
+ : QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::DisableSuspend;
}
void MainWindow::initConfig()
{
bool show;
m_config.setGroup( "Sword" );
for ( QAction *a = m_actionSwordOpts.first(); a; a = m_actionSwordOpts.next() )
{
show = m_config.readBoolEntry( a->text(), false );
a->setOn( show );
m_swordMgr->setGlobalOption ( a->text(), show ? "On" : "Off" );
@@ -588,30 +591,30 @@ void MainWindow::slotViewSwordOption( bool enabled )
void MainWindow::slotViewNavToolbar( bool enabled )
{
enabled ? m_navToolbar->show()
: m_navToolbar->hide();
}
void MainWindow::slotViewSearchToolbar( bool enabled )
{
enabled ? m_searchToolbar->show()
: m_searchToolbar->hide();
}
-void MainWindow::slotNavPrevChapter()
+void MainWindow::slotNavPrevPage()
{
TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget());
if ( text )
{
- text->prevChapter();
+ text->prevPage();
setCaption( QString( "%1 - Dagger" ).arg( text->getFullKey() ) );
m_navToolbar->setKey( text->getAbbrevKey() );
}
}
void MainWindow::slotNavPrevVerse()
{
TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget());
if ( text )
{
text->prevVerse();
setCaption( QString( "%1 - Dagger" ).arg( text->getFullKey() ) );
@@ -634,30 +637,30 @@ void MainWindow::slotNavKeyChanged( const QString &newKey )
void MainWindow::slotNavNextVerse()
{
TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget());
if ( text )
{
text->nextVerse();
setCaption( QString( "%1 - Dagger" ).arg( text->getFullKey() ) );
m_navToolbar->setKey( text->getAbbrevKey() );
}
}
-void MainWindow::slotNavNextChapter()
+void MainWindow::slotNavNextPage()
{
TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget());
if ( text )
{
- text->nextChapter();
+ text->nextPage();
setCaption( QString( "%1 - Dagger" ).arg( text->getFullKey() ) );
m_navToolbar->setKey( text->getAbbrevKey() );
}
}
void MainWindow::slotNavAutoScroll( bool enabled )
{
m_autoScrollTimer.stop();
if ( enabled )
m_autoScrollTimer.start( m_navToolbar->autoScrollRate() * 100 );
}