From 860d83c7e9c0bd53066a2122243d16f3d026d5c9 Mon Sep 17 00:00:00 2001 From: Enrico Ros Date: Wed, 27 Oct 2004 14:13:17 +0000 Subject: [PATCH] Converted configuration settings to KConfigXT. Internal save/write ops ported. svn path=/branches/kpdf_experiments/kdegraphics/kpdf/; revision=358208 --- kpdf/pageview.cpp | 18 +++++++++--------- kpdf/pageview.h | 5 ++--- kpdf/searchwidget.cpp | 10 +++++----- kpdf/searchwidget.h | 5 ++--- kpdf/thumbnaillist.cpp | 1 - kpdf/thumbnaillist.h | 5 ++--- 6 files changed, 20 insertions(+), 24 deletions(-) diff --git a/kpdf/pageview.cpp b/kpdf/pageview.cpp index febef54d5..3e2fe70dc 100644 --- a/kpdf/pageview.cpp +++ b/kpdf/pageview.cpp @@ -28,7 +28,6 @@ #include #include #include -#include #include #include @@ -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() ); } diff --git a/kpdf/pageview.h b/kpdf/pageview.h index 777f3824b..13263802f 100644 --- a/kpdf/pageview.h +++ b/kpdf/pageview.h @@ -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; } diff --git a/kpdf/searchwidget.cpp b/kpdf/searchwidget.cpp index 102db8174..2b7836d80 100644 --- a/kpdf/searchwidget.cpp +++ b/kpdf/searchwidget.cpp @@ -12,7 +12,6 @@ #include #include #include -#include #include #include #include @@ -22,6 +21,7 @@ // local includes #include "searchwidget.h" #include "document.h" +#include "settings.h" //#include 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 ) diff --git a/kpdf/searchwidget.h b/kpdf/searchwidget.h index d530cb46b..349960748 100644 --- a/kpdf/searchwidget.h +++ b/kpdf/searchwidget.h @@ -13,7 +13,6 @@ #include 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 ); diff --git a/kpdf/thumbnaillist.cpp b/kpdf/thumbnaillist.cpp index d8abb18ec..a52590a13 100644 --- a/kpdf/thumbnaillist.cpp +++ b/kpdf/thumbnaillist.cpp @@ -9,7 +9,6 @@ #include #include -#include #include #include #include diff --git a/kpdf/thumbnaillist.h b/kpdf/thumbnaillist.h index 8213d5045..027b1dee9 100644 --- a/kpdf/thumbnaillist.h +++ b/kpdf/thumbnaillist.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 & pages, bool documentChanged ); -- GitLab