2 * \file QSpellchecker.C
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS
14 #pragma implementation
17 #include "ControlSpellchecker.h"
18 #include "QSpellcheckerDialog.h"
19 #include "QSpellchecker.h"
23 #include <qprogressbar.h>
24 #include <qmessagebox.h>
25 #include <qlineedit.h>
26 #include <qpushbutton.h>
28 #include <qcombobox.h>
30 typedef Qt2CB<ControlSpellchecker, Qt2DB<QSpellcheckerDialog> > base_class;
33 QSpellchecker::QSpellchecker()
34 : base_class(_("Spellchecker"))
39 void QSpellchecker::build_dialog()
41 dialog_.reset(new QSpellcheckerDialog(this));
43 bc().setCancel(dialog_->closePB);
44 dialog_->wordED->setReadOnly(true);
48 void QSpellchecker::update_contents()
50 dialog_->wordED->setText("");
51 dialog_->replaceCO->clear();
52 dialog_->suggestionsLB->clear();
53 dialog_->spellcheckPR->setProgress(0.0);
57 void QSpellchecker::accept()
59 controller().ignoreAll();
63 void QSpellchecker::add()
65 controller().insert();
69 void QSpellchecker::ignore()
75 void QSpellchecker::replace()
77 controller().replace(dialog_->replaceCO->currentText().latin1());
81 void QSpellchecker::spellcheck()
84 dialog_->spellcheckPB->setEnabled(false);
88 void QSpellchecker::stop()
91 dialog_->spellcheckPB->setEnabled(true);
96 void QSpellchecker::partialUpdate(int id)
100 dialog_->spellcheckPR->setProgress(controller().getProgress());
104 dialog_->wordED->setText(controller().getWord().c_str());
105 dialog_->suggestionsLB->clear();
108 while (!(w = controller().getSuggestion()).empty()) {
109 dialog_->suggestionsLB->insertItem(w.c_str());
114 dialog_->spellcheckPB->setEnabled(true);
116 QMessageBox::information(0, _("Spellcheck complete"),
117 controller().getMessage().c_str(),