22#include "ui_configui.h"
32#include <QtGui/QCheckBox>
33#include <QtGui/QLayout>
37class ConfigWidget::Private
58void ConfigWidget::init(
KConfig *config)
61 d->loader->settings()->restore(config);
64 QVBoxLayout *layout =
new QVBoxLayout(
this );
65 layout->setMargin( 0 );
66 layout->setObjectName(
"SonnetConfigUILayout" );
68 d->ui.setupUi( d->wdg );
71 d->ui.m_langCombo->setCurrentByDictionary( d->loader->settings()->defaultLanguage() );
73 d->ui.m_skipUpperCB->setChecked( !d->loader->settings()->checkUppercase() );
74 d->ui.m_skipRunTogetherCB->setChecked( d->loader->settings()->skipRunTogether() );
75 d->ui.m_checkerEnabledByDefaultCB->setChecked( d->loader->settings()->checkerEnabledByDefault() );
76 QStringList ignoreList = d->loader->settings()->currentIgnoreList();
78 d->ui.m_ignoreListBox->insertStringList( ignoreList );
79 d->ui.m_bgSpellCB->setChecked( d->loader->settings()->backgroundCheckerEnabled() );
80 d->ui.m_bgSpellCB->hide();
81 connect( d->ui.m_ignoreListBox, SIGNAL(changed()), SLOT(
slotChanged()) );
83 layout->addWidget( d->wdg );
84 connect(d->ui.m_langCombo, SIGNAL(dictionaryChanged(QString)),
this, SIGNAL(
configChanged()));
85 connect(d->ui.m_bgSpellCB, SIGNAL(clicked(
bool)),
this,SIGNAL(
configChanged()));
86 connect(d->ui.m_skipUpperCB, SIGNAL(clicked(
bool)),
this, SIGNAL(
configChanged()));
87 connect(d->ui.m_skipRunTogetherCB, SIGNAL(clicked(
bool)),
this, SIGNAL(
configChanged()));
88 connect(d->ui.m_checkerEnabledByDefaultCB, SIGNAL(clicked(
bool)),
this, SIGNAL(
configChanged()));
89 connect(d->ui.m_ignoreListBox, SIGNAL(changed()),
this, SIGNAL(
configChanged()));
95 d->loader->settings()->save(d->config);
98void ConfigWidget::setFromGui()
100 if (d->ui.m_langCombo->count() ) {
101 d->loader->settings()->setDefaultLanguage( d->ui.m_langCombo->currentDictionary() );
103 d->loader->settings()->setCheckUppercase(
104 !d->ui.m_skipUpperCB->isChecked() );
105 d->loader->settings()->setSkipRunTogether(
106 d->ui.m_skipRunTogetherCB->isChecked() );
107 d->loader->settings()->setBackgroundCheckerEnabled(
108 d->ui.m_bgSpellCB->isChecked() );
109 d->loader->settings()->setCheckerEnabledByDefault(
110 d->ui.m_checkerEnabledByDefaultCB->isChecked() );
115 d->loader->settings()->setCurrentIgnoreList(
116 d->ui.m_ignoreListBox->items() );
119void ConfigWidget::setCorrectLanguage(
const QStringList& )
126 d->ui.m_bgSpellCB->setVisible( b );
131 return !d->ui.m_bgSpellCB->isHidden();
136 d->ui.m_skipUpperCB->setChecked(
false );
137 d->ui.m_skipRunTogetherCB->setChecked(
false );
138 d->ui.m_checkerEnabledByDefaultCB->setChecked(
false );
139 d->ui.m_bgSpellCB->setChecked(
true );
140 d->ui.m_ignoreListBox->clear();
145 d->ui.m_langCombo->setCurrentByDictionary(
language );
150 if ( d->ui.m_langCombo->count() ) {
151 return d->ui.m_langCombo->currentDictionary();
157#include "configwidget.moc"
static Loader * openLoader()
KSharedConfigPtr config()