Commit 860d83c7 authored by Enrico Ros's avatar Enrico Ros
Browse files

Converted configuration settings to KConfigXT. Internal save/write ops

ported.

svn path=/branches/kpdf_experiments/kdegraphics/kpdf/; revision=358208
parent 580c3b60
......@@ -28,7 +28,6 @@
#include <kactioncollection.h>
#include <kpopupmenu.h>
#include <klocale.h>
#include <kconfigbase.h>
#include <math.h>
#include <stdlib.h>
......@@ -37,6 +36,7 @@
#include "pageviewutils.h"
#include "pixmapwidget.h"
#include "page.h"
#include "settings.h"
// structure used internally by PageView for data storage
......@@ -142,7 +142,7 @@ PageView::~PageView()
delete d;
}
void PageView::setupActions( KActionCollection * ac, KConfigGroup * config )
void PageView::setupActions( KActionCollection * ac )
{
// Zoom actions ( higher scales takes lots of memory! )
d->aZoom = new KSelectAction( i18n( "Zoom" ), "viewmag", 0, this, SLOT( slotZoom() ), ac, "zoom_to" );
......@@ -168,12 +168,12 @@ void PageView::setupActions( KActionCollection * ac, KConfigGroup * config )
// View-Layout actions
d->aViewTwoPages = new KToggleAction( i18n("Two Pages"), "view_left_right", 0, ac, "view_twopages" );
connect( d->aViewTwoPages, SIGNAL( toggled( bool ) ), SLOT( slotTwoPagesToggled( bool ) ) );
d->aViewTwoPages->setChecked( config->readBoolEntry( "ViewTwoPages", false ) );
d->aViewTwoPages->setChecked( Settings::viewTwoPages() );
slotTwoPagesToggled( d->aViewTwoPages->isChecked() );
d->aViewContinous = new KToggleAction( i18n("Continous"), "view_text", 0, ac, "view_continous" );
connect( d->aViewContinous, SIGNAL( toggled( bool ) ), SLOT( slotContinousToggled( bool ) ) );
d->aViewContinous->setChecked( config->readBoolEntry( "ViewContinous", true ) );
d->aViewContinous->setChecked( Settings::viewContinous() );
slotContinousToggled( d->aViewContinous->isChecked() );
// Mouse-Mode actions
......@@ -200,15 +200,15 @@ void PageView::setupActions( KActionCollection * ac, KConfigGroup * config )
ss->setCheckedState(i18n("Hide &Scrollbars"));
connect( ss, SIGNAL( toggled( bool ) ), SLOT( slotToggleScrollBars( bool ) ) );
ss->setChecked( config->readBoolEntry( "ShowScrollBars", true ) );
ss->setChecked( Settings::showScrollBars() );
slotToggleScrollBars( ss->isChecked() );
}
void PageView::saveSettings( KConfigGroup * config )
void PageView::saveSettings()
{
config->writeEntry( "ShowScrollBars", hScrollBarMode() == AlwaysOn );
config->writeEntry( "ViewTwoPages", d->aViewTwoPages->isChecked() );
config->writeEntry( "ViewContinous", d->aViewContinous->isChecked() );
Settings::setShowScrollBars( hScrollBarMode() == AlwaysOn );
Settings::setViewTwoPages( d->aViewTwoPages->isChecked() );
Settings::setViewContinous( d->aViewContinous->isChecked() );
}
......
......@@ -26,7 +26,6 @@
class KURL;
class KActionCollection;
class KConfigGroup;
class PageWidget;
class PageViewPrivate;
......@@ -51,8 +50,8 @@ public:
enum MouseMode { MouseNormal, MouseSelection, MouseEdit };
// create actions that interact with this widget
void setupActions( KActionCollection * collection, KConfigGroup * config );
void saveSettings( KConfigGroup * config );
void setupActions( KActionCollection * collection );
void saveSettings();
// inherited from KPDFDocumentObserver
uint observerId() const { return PAGEVIEW_ID; }
......
......@@ -12,7 +12,6 @@
#include <qapplication.h>
#include <kaction.h>
#include <kactioncollection.h>
#include <kconfigbase.h>
#include <klocale.h>
#include <kiconloader.h>
#include <klineedit.h>
......@@ -22,6 +21,7 @@
// local includes
#include "searchwidget.h"
#include "document.h"
#include "settings.h"
//#include <qiconset.h>
SearchWidget::SearchWidget( QWidget * parent, KPDFDocument * document )
......@@ -54,19 +54,19 @@ SearchWidget::SearchWidget( QWidget * parent, KPDFDocument * document )
// search->setMinimumSize( QSize( sideLength, sideLength ) );
}
void SearchWidget::setupActions( KActionCollection * ac, KConfigGroup * config )
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( config->readBoolEntry( "ShowSearchBar", true ) );
ss->setChecked( Settings::showSearchBar() );
slotToggleSearchBar( ss->isChecked() );
}
void SearchWidget::saveSettings( KConfigGroup * config )
void SearchWidget::saveSettings()
{
config->writeEntry( "ShowSearchBar", isShown() );
Settings::setShowSearchBar( isShown() );
}
void SearchWidget::slotTextChanged( const QString & text )
......
......@@ -13,7 +13,6 @@
#include <qhbox.h>
class KActionCollection;
class KConfigGroup;
class KPopupMenu;
class KLineEdit;
......@@ -32,8 +31,8 @@ public:
SearchWidget( QWidget *parent, KPDFDocument *document );
// create actions that interact with this widget
void setupActions( KActionCollection * collection, KConfigGroup * config );
void saveSettings( KConfigGroup * config );
void setupActions( KActionCollection * collection );
void saveSettings();
private slots:
void slotTextChanged( const QString & text );
......
......@@ -9,7 +9,6 @@
#include <qtimer.h>
#include <klocale.h>
#include <kconfigbase.h>
#include <kurl.h>
#include <kurldrag.h>
#include <kaction.h>
......
......@@ -17,7 +17,6 @@
class QTimer;
class KActionCollection;
class KConfigGroup;
class ThumbnailWidget;
/**
......@@ -33,8 +32,8 @@ Q_OBJECT
// create actions that interact with this widget and load/save settings
uint observerId() const { return THUMBNAILS_ID; }
void setupActions( KActionCollection * /*collection*/, KConfigGroup * /*config*/ ) {};
void saveSettings( KConfigGroup * /*config*/ ) {};
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