2
* Copyright (C) 2008 Laurent Montel <montel@kde.org>
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20
#include "preferencesdlg.h"
21
#include <QHBoxLayout>
23
#include <sonnet/configwidget.h>
25
#include <KConfigGroup>
28
PreferencesDialog::PreferencesDialog( QWidget *parent )
29
: KPageDialog( parent )
32
setButtons( Ok | Cancel );
33
setDefaultButton( Ok );
35
m_pageMisc = new MiscPage( this );
36
KPageWidgetItem *page = new KPageWidgetItem( m_pageMisc , i18n( "General" ) );
37
page->setIcon( KIcon( "kmenuedit" ) );
40
m_pageSpellChecking = new SpellCheckingPage( this );
41
page = new KPageWidgetItem( m_pageSpellChecking , i18n( "Spell Checking" ) );
42
page->setHeader( i18n( "Spell checking Options" ) );
43
page->setIcon( KIcon( "tools-check-spelling" ) );
46
connect( this, SIGNAL( okClicked() ), this, SLOT( slotSave() ) );
49
void PreferencesDialog::slotSave()
51
m_pageSpellChecking->saveOptions();
52
m_pageMisc->saveOptions();
55
SpellCheckingPage::SpellCheckingPage( QWidget *parent )
58
QHBoxLayout *lay = new QHBoxLayout( this );
59
m_confPage = new Sonnet::ConfigWidget(&( *KGlobal::config() ), this );
60
lay->addWidget( m_confPage );
64
void SpellCheckingPage::saveOptions()
69
MiscPage::MiscPage( QWidget *parent )
72
QVBoxLayout *lay = new QVBoxLayout( this );
73
m_showHiddenEntries = new QCheckBox( i18n( "Show hidden entries" ), this );
74
lay->addWidget( m_showHiddenEntries );
78
KConfigGroup grp( KGlobal::config(), "General" );
79
m_showHiddenEntries->setChecked( grp.readEntry( "ShowHidden", false ) );
82
void MiscPage::saveOptions()
84
KConfigGroup grp( KGlobal::config(), "General" );
85
grp.writeEntry( "ShowHidden", m_showHiddenEntries->isChecked() );
89
#include "preferencesdlg.moc"