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_pageSpellChecking
= new SpellCheckingPage( this );
36 KPageWidgetItem
*page
= new KPageWidgetItem( m_pageSpellChecking
, i18n( "Spell Checking" ) );
37 page
->setHeader( i18n( "Spell checking Options" ) );
38 page
->setIcon( KIcon( "tools-check-spelling" ) );
41 m_pageMisc
= new MiscPage( this );
42 page
= new KPageWidgetItem( m_pageMisc
, i18n( "Misc" ) );
45 connect( this, SIGNAL( okClicked() ), this, SLOT( slotSave() ) );
48 void PreferencesDialog::slotSave()
50 m_pageSpellChecking
->saveOptions();
51 m_pageMisc
->saveOptions();
54 SpellCheckingPage::SpellCheckingPage( QWidget
*parent
)
57 QHBoxLayout
*lay
= new QHBoxLayout( this );
58 m_confPage
= new Sonnet::ConfigWidget(&( *KGlobal::config() ), this );
59 lay
->addWidget( m_confPage
);
63 void SpellCheckingPage::saveOptions()
68 MiscPage::MiscPage( QWidget
*parent
)
71 QHBoxLayout
*lay
= new QHBoxLayout( this );
72 QGroupBox
*group
= new QGroupBox(i18n( "General" ) ) ;
73 lay
->addWidget( group
);
74 QVBoxLayout
*vbox
= new QVBoxLayout
;
75 m_showHiddenEntries
= new QCheckBox( i18n( "Show hidden entries" ) );
76 vbox
->addWidget( m_showHiddenEntries
);
77 group
->setLayout( vbox
);
78 KConfigGroup
grp( KGlobal::config(), "General" );
79 m_showHiddenEntries
->setChecked( grp
.readEntry( "ShowHidden", false ) );
83 void MiscPage::saveOptions()
85 KConfigGroup
grp( KGlobal::config(), "General" );
86 grp
.writeEntry( "ShowHidden", m_showHiddenEntries
->isChecked() );
90 #include "preferencesdlg.moc"