24#include <QProgressBar>
32#include "ui_k3spellui.h"
37#define NONSORTINGCOLUMN 2
39class K3SpellDlg::K3SpellDlgPrivate {
47 , d(0),progressbar( false )
57 kDebug() <<
"dospellchecking is " << cg.
readEntry(
"K3Spell_DoSpellChecking",
false);
58 if ( (cg.
readEntry(
"K3Spell_DoSpellChecking",
false) ==
true) )
60 Q_UNUSED( _progressbar );
61 d =
new K3SpellDlgPrivate;
64 connect( d->ui.m_replaceBtn, SIGNAL(clicked()),
66 connect(
this, SIGNAL(
ready(
bool)),
67 d->ui.m_replaceBtn, SLOT(setEnabled(
bool)) );
69 connect( d->ui.m_replaceAllBtn, SIGNAL(clicked()),
this, SLOT(
replaceAll()));
70 connect(
this, SIGNAL(
ready(
bool)), d->ui.m_replaceAllBtn, SLOT(setEnabled(
bool)));
72 connect( d->ui.m_skipBtn, SIGNAL(clicked()),
this, SLOT(
ignore()));
73 connect(
this, SIGNAL(
ready(
bool)), d->ui.m_skipBtn, SLOT(setEnabled(
bool)));
75 connect( d->ui.m_skipAllBtn, SIGNAL(clicked()),
this, SLOT(
ignoreAll()));
76 connect(
this, SIGNAL(
ready(
bool)), d->ui.m_skipAllBtn, SLOT(setEnabled(
bool)));
78 connect( d->ui.m_addBtn, SIGNAL(clicked()),
this, SLOT(
add()));
79 connect(
this, SIGNAL(
ready(
bool)), d->ui.m_addBtn, SLOT(setEnabled(
bool)));
81 connect( d->ui.m_suggestBtn, SIGNAL(clicked()),
this, SLOT(
suggest()));
82 connect(
this, SIGNAL(
ready(
bool)), d->ui.m_suggestBtn, SLOT(setEnabled(
bool)) );
83 d->ui.m_suggestBtn->hide();
87 connect( d->ui.m_replacement, SIGNAL(
textChanged(QString)),
90 connect( d->ui.m_replacement, SIGNAL(returnPressed()), SLOT(
replace()) );
91 connect( d->ui.m_suggestions, SIGNAL(selectionChanged(
Q3ListViewItem*)),
94 connect( d->ui.m_suggestions, SIGNAL(doubleClicked(
Q3ListViewItem*,QPoint,
int)),
97 d->spellConfig->fillDicts( d->ui.m_language );
98 connect( d->ui.m_language, SIGNAL(activated(
int)),
99 d->spellConfig, SLOT(sSetDictionary(
int)) );
100 connect( d->spellConfig, SIGNAL(configChanged()),
103 setHelp(
"spelldlg",
"k3spell" );
125 d->ui.m_suggestions->clear();
127 for ( QStringList::Iterator it = _sugg->begin(); it != _sugg->end(); ++it ) {
129 d->ui.m_suggestions->lastItem() );
130 item->setText( 0, *it );
132 kDebug(750) <<
"K3SpellDlg::init [" << word <<
"]";
136 d->ui.m_unknownWord->setText( _word );
138 if ( sugg->count() == 0 ) {
139 d->ui.m_replacement->setText( _word );
140 d->ui.m_replaceBtn->setEnabled(
false );
141 d->ui.m_replaceAllBtn->setEnabled(
false );
142 d->ui.m_suggestBtn->setEnabled(
false );
144 d->ui.m_replacement->setText( (*sugg)[0] );
145 d->ui.m_replaceBtn->setEnabled(
true );
146 d->ui.m_replaceAllBtn->setEnabled(
true );
147 d->ui.m_suggestBtn->setEnabled(
false );
148 d->ui.m_suggestions->setSelected( d->ui.m_suggestions->firstChild(),
true );
154 const QString& context )
159 d->ui.m_suggestions->clear();
161 for ( QStringList::Iterator it = _sugg->begin(); it != _sugg->end(); ++it ) {
163 d->ui.m_suggestions->lastItem() );
164 item->setText( 0, *it );
167 kDebug(750) <<
"K3SpellDlg::init [" << word <<
"]";
171 d->ui.m_unknownWord->setText( _word );
172 d->ui.m_contextLabel->setText( context );
174 if ( sugg->count() == 0 ) {
175 d->ui.m_replacement->setText( _word );
176 d->ui.m_replaceBtn->setEnabled(
false );
177 d->ui.m_replaceAllBtn->setEnabled(
false );
178 d->ui.m_suggestBtn->setEnabled(
false );
180 d->ui.m_replacement->setText( (*sugg)[0] );
181 d->ui.m_replaceBtn->setEnabled(
true );
182 d->ui.m_replaceAllBtn->setEnabled(
true );
183 d->ui.m_suggestBtn->setEnabled(
false );
184 d->ui.m_suggestions->setSelected( d->ui.m_suggestions->firstChild(),
true );
199 progbar->setValue( (
int) p );
205 d->ui.m_replaceBtn->setEnabled(
true );
206 d->ui.m_replaceAllBtn->setEnabled(
true );
207 d->ui.m_suggestBtn->setEnabled(
true );
214 d->ui.m_replacement->setText( item->text( 0 ) );
264 newword = d->ui.m_replacement->text();
278 newword = d->ui.m_replacement->text();
285 newword = d->ui.m_replacement->text();
292 d->spellConfig->writeGlobalSettings();
296#include "k3spelldlg.moc"
A configuration class/dialog for K3Spell.
QString replacement() const
K3SpellDlg(QWidget *parent, bool _progressbar=false, bool _modal=false)
void slotProgress(unsigned int p)
Adjust the progress bar to p percent.
void slotSelectionChanged(Q3ListViewItem *item)
virtual void closeEvent(QCloseEvent *e)
void command(int)
This signal is emitted when a button is pressed.
void textChanged(const QString &)
void init(const QString &_word, QStringList *_sugg)
Change the misspelled word and suggested replacements and enable the disabled buttons on the dialog b...
QString readEntry(const char *key, const char *aDefault=0) const
void setHelp(const QString &anchor, const QString &appname=QString())
virtual QSize sizeHint() const
void setButtons(ButtonCodes buttonMask)
void setButtonText(ButtonCode id, const QString &text)
void setDefaultButton(ButtonCode id)
virtual void setCaption(const QString &caption)
QString i18n(const char *text)
KSharedConfigPtr config()