Commit 23f93e3a authored by Pino Toscano's avatar Pino Toscano

Save & restore the value of "case sensitivity" and "from current page" options of the find bar.

svn path=/trunk/KDE/kdegraphics/okular/; revision=965341
parent ff9c6a6a
......@@ -262,4 +262,12 @@
<default code="true">userString</default>
</entry>
</group>
<group name="Search" >
<entry key="SearchCaseSensitive" type="Bool">
<default>false</default>
</entry>
<entry key="SearchFromCurrentPage" type="Bool">
<default>false</default>
</entry>
</group>
</kcfg>
......@@ -21,9 +21,11 @@
// local includes
#include "searchlineedit.h"
#include "core/document.h"
#include "settings.h"
FindBar::FindBar( Okular::Document * document, QWidget * parent )
: QWidget( parent )
, m_active( false )
{
QHBoxLayout * lay = new QHBoxLayout( this );
lay->setMargin( 2 );
......@@ -74,7 +76,13 @@ FindBar::FindBar( Okular::Document * document, QWidget * parent )
connect( m_caseSensitiveAct, SIGNAL( toggled( bool ) ), this, SLOT( caseSensitivityChanged() ) );
connect( m_fromCurrentPageAct, SIGNAL( toggled( bool ) ), this, SLOT( fromCurrentPageChanged() ) );
m_caseSensitiveAct->setChecked( Okular::Settings::searchCaseSensitive() );
m_fromCurrentPageAct->setChecked( Okular::Settings::searchFromCurrentPage() );
hide();
// "activate" it only at th very end
m_active = true;
}
FindBar::~FindBar()
......@@ -113,12 +121,20 @@ void FindBar::findPrev()
void FindBar::caseSensitivityChanged()
{
m_search->lineEdit()->setSearchCaseSensitivity( m_caseSensitiveAct->isChecked() ? Qt::CaseSensitive : Qt::CaseInsensitive );
if ( !m_active )
return;
Okular::Settings::setSearchCaseSensitive( m_caseSensitiveAct->isChecked() );
Okular::Settings::self()->writeConfig();
m_search->lineEdit()->restartSearch();
}
void FindBar::fromCurrentPageChanged()
{
m_search->lineEdit()->setSearchFromStart( !m_fromCurrentPageAct->isChecked() );
if ( !m_active )
return;
Okular::Settings::setSearchFromCurrentPage( m_fromCurrentPageAct->isChecked() );
Okular::Settings::self()->writeConfig();
}
#include "findbar.moc"
......@@ -45,6 +45,7 @@ class FindBar
SearchLineWidget * m_search;
QAction * m_caseSensitiveAct;
QAction * m_fromCurrentPageAct;
bool m_active;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment