Commit 69166fa9 authored by Enrico Ros's avatar Enrico Ros

Search widget using KConfigXT (removed actions/save params).

svn path=/branches/kpdf_experiments/kdegraphics/kpdf/; revision=358712
parent 6dfa03a9
......@@ -111,9 +111,9 @@ Part::Part(QWidget *parentWidget, const char *widgetName,
enableTOC( false );
QVBox * thumbsBox = new ThumbnailsBox( m_toolBox );
m_thumbnailList = new ThumbnailList( thumbsBox, document );
m_searchWidget = new SearchWidget( thumbsBox, document );
m_thumbnailList = new ThumbnailList( thumbsBox, document );
connect( m_thumbnailList, SIGNAL( urlDropped( const KURL& ) ), SLOT( openURL( const KURL & )));
m_searchWidget = new SearchWidget( thumbsBox, document );
m_toolBox->addItem( thumbsBox, QIconSet(SmallIcon("thumbnail")), i18n("Thumbnails") );
m_toolBox->setCurrentItem( thumbsBox );
......@@ -177,8 +177,6 @@ Part::Part(QWidget *parentWidget, const char *widgetName,
// attach the actions of the 2 children widgets too
m_pageView->setupActions( ac );
m_searchWidget->setupActions( ac );
m_thumbnailList->setupActions( ac );
// local settings
m_splitter->setSizes( Settings::splitterSizes() );
......@@ -197,8 +195,6 @@ Part::~Part()
Settings::setShowLeftPanel( m_toolBox->isShown() );
// save settings of internal widgets
m_pageView->saveSettings();
m_searchWidget->saveSettings();
m_thumbnailList->saveSettings();
// save config file
Settings::writeConfig();
......@@ -388,6 +384,8 @@ void Part::slotPreferences()
void Part::slotNewConfig()
{
// apply runtime changes TODO apply changes here
if ( Settings::showSearchBar() != m_searchWidget->isShown() )
m_searchWidget->setShown( Settings::showSearchBar() );
}
void Part::slotPrintPreview()
......
......@@ -30,10 +30,7 @@
<Action name="goto_page"/>
</Menu>
<Menu name="settings"><text>&amp;Settings</text>
<Action name="show_scrollbars" group="show_merge"/>
<Action name="show_leftpanel" group="show_merge"/>
<Action name="show_searchbar" group="show_merge"/>
<Action name="preferences" />
<Action name="preferences"/>
</Menu>
</MenuBar>
<ToolBar name="mainToolBar"><text>Main Toolbar</text>
......
......@@ -9,6 +9,7 @@
// qt/kde includes
#include <qtooltip.h>
//#include <qiconset.h>
#include <qapplication.h>
#include <kaction.h>
#include <kactioncollection.h>
......@@ -23,7 +24,6 @@
#include "document.h"
#include "settings.h"
//#include <qiconset.h>
SearchWidget::SearchWidget( QWidget * parent, KPDFDocument * document )
: QHBox( parent ), m_document( document ), m_caseSensitive( false )
{
......@@ -52,21 +52,14 @@ SearchWidget::SearchWidget( QWidget * parent, KPDFDocument * document )
int sideLength = m_lineEdit->sizeHint().height();
m_clearButton->setMinimumSize( QSize( sideLength, sideLength ) );
// search->setMinimumSize( QSize( sideLength, sideLength ) );
}
void SearchWidget::setupActions( KActionCollection * ac )
{
KToggleAction * ss = new KToggleAction( i18n( "Show Search Bar" ), 0, ac, "show_searchbar" );
ss->setCheckedState(i18n("Hide Search Bar"));
connect( ss, SIGNAL( toggled( bool ) ), SLOT( slotToggleSearchBar( bool ) ) );
ss->setChecked( Settings::showSearchBar() );
slotToggleSearchBar( ss->isChecked() );
// handle initial visiblity
setShown( Settings::showSearchBar() );
}
void SearchWidget::saveSettings()
void SearchWidget::hideEvent( QHideEvent * )
{
Settings::setShowSearchBar( isShown() );
m_document->slotSetFilter( QString::null, m_caseSensitive );
}
void SearchWidget::slotTextChanged( const QString & text )
......@@ -95,11 +88,4 @@ void SearchWidget::slotChangeCase( int index )
}
}
void SearchWidget::slotToggleSearchBar( bool visible )
{
setShown( visible );
if ( !visible )
m_document->slotSetFilter( QString::null, m_caseSensitive );
}
#include "searchwidget.moc"
......@@ -12,7 +12,6 @@
#include <qhbox.h>
class KActionCollection;
class KPopupMenu;
class KLineEdit;
......@@ -25,25 +24,23 @@ class KPDFDocument;
*/
class SearchWidget : public QHBox
{
Q_OBJECT
Q_OBJECT
public:
SearchWidget( QWidget *parent, KPDFDocument *document );
public:
SearchWidget( QWidget *parent, KPDFDocument *document );
// create actions that interact with this widget
void setupActions( KActionCollection * collection );
void saveSettings();
protected:
void hideEvent( QHideEvent * );
private slots:
void slotTextChanged( const QString & text );
void slotChangeCase( int index );
void slotToggleSearchBar( bool visible );
private:
KPDFDocument * m_document;
KLineEdit * m_lineEdit;
KPopupMenu * m_caseMenu;
bool m_caseSensitive;
private:
KPDFDocument * m_document;
KLineEdit * m_lineEdit;
KPopupMenu * m_caseMenu;
bool m_caseSensitive;
private slots:
void slotTextChanged( const QString & text );
void slotChangeCase( int index );
};
#endif
......@@ -30,10 +30,8 @@ Q_OBJECT
public:
ThumbnailList(QWidget *parent, KPDFDocument *document);
// create actions that interact with this widget and load/save settings
// return thumbnails observer id
uint observerId() const { return THUMBNAILS_ID; }
void setupActions( KActionCollection * /*collection*/ ) {};
void saveSettings() {};
// create thumbnails ( inherited as a DocumentObserver )
void pageSetup( const QValueVector<KPDFPage*> & pages, bool documentChanged );
......
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