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

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