21 #include "configwidget.h"
27 #include <keditlistbox.h>
28 #include <kcombobox.h>
29 #include <tdelocale.h>
31 #include <tqcheckbox.h>
36 class ConfigWidget::Private
43 ConfigWidget::ConfigWidget(
Broker *broker, TQWidget *parent,
const char *name )
44 : TQWidget( parent, name )
49 ConfigWidget::~ConfigWidget()
54 void ConfigWidget::init(
Broker *broker )
59 TQVBoxLayout *layout =
new TQVBoxLayout(
this, 0, 0,
"KSpell2ConfigUILayout");
60 d->ui =
new KSpell2ConfigUI(
this );
62 TQStringList langs = d->broker->languages();
64 d->ui->m_langCombo->insertStringList( langs );
65 setCorrectLanguage( langs );
67 d->ui->m_skipUpperCB->setChecked( !d->broker->settings()->checkUppercase() );
68 d->ui->m_skipRunTogetherCB->setChecked( d->broker->settings()->skipRunTogether() );
69 TQStringList ignoreList = d->broker->settings()->currentIgnoreList();
71 d->ui->m_ignoreListBox->insertStringList( ignoreList );
72 d->ui->m_bgSpellCB->setChecked( d->broker->settings()->backgroundCheckerEnabled() );
73 d->ui->m_bgSpellCB->hide();
74 connect( d->ui->m_ignoreListBox, TQ_SIGNAL(changed()), TQ_SLOT(slotChanged()) );
76 layout->addWidget( d->ui );
79 void KSpell2::ConfigWidget::save()
82 d->broker->settings()->save();
85 void ConfigWidget::setFromGUI()
87 d->broker->settings()->setDefaultLanguage(
88 d->ui->m_langCombo->currentText() );
89 d->broker->settings()->setCheckUppercase(
90 !d->ui->m_skipUpperCB->isChecked() );
91 d->broker->settings()->setSkipRunTogether(
92 d->ui->m_skipRunTogetherCB->isChecked() );
93 d->broker->settings()->setBackgroundCheckerEnabled(
94 d->ui->m_bgSpellCB->isChecked() );
97 void ConfigWidget::slotChanged()
99 d->broker->settings()->setCurrentIgnoreList(
100 d->ui->m_ignoreListBox->items() );
103 void ConfigWidget::setCorrectLanguage(
const TQStringList& langs)
106 for ( TQStringList::const_iterator itr = langs.begin();
107 itr != langs.end(); ++itr, ++idx ) {
108 if ( *itr == d->broker->settings()->defaultLanguage() )
109 d->ui->m_langCombo->setCurrentItem( idx );
113 void ConfigWidget::setBackgroundCheckingButtonShown(
bool b )
115 d->ui->m_bgSpellCB->setShown( b );
118 bool ConfigWidget::backgroundCheckingButtonShown()
const
120 return d->ui->m_bgSpellCB->isShown();
123 void ConfigWidget::slotDefault()
125 d->ui->m_skipUpperCB->setChecked(
false );
126 d->ui->m_skipRunTogetherCB->setChecked(
false );
127 d->ui->m_bgSpellCB->setChecked(
true );
128 d->ui->m_ignoreListBox->clear();
131 #include "configwidget.moc"
Class used to deal with dictionaries.