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"
24 #include <qprogressbar.h>
25 #include <qmessagebox.h>
26 #include <qlineedit.h>
27 #include <qpushbutton.h>
29 #include <qcombobox.h>
31 typedef Qt2CB<ControlSpellchecker, Qt2DB<QSpellcheckerDialog> > base_class;
34 QSpellchecker::QSpellchecker()
35 : base_class(_("Spellchecker"))
40 void QSpellchecker::build_dialog()
42 dialog_.reset(new QSpellcheckerDialog(this));
44 bc().setCancel(dialog_->closePB);
45 dialog_->wordED->setReadOnly(true);
49 void QSpellchecker::update_contents()
51 dialog_->wordED->setText("");
52 dialog_->replaceCO->clear();
53 dialog_->suggestionsLB->clear();
54 dialog_->spellcheckPR->setProgress(0.0);
58 void QSpellchecker::accept()
60 controller().ignoreAll();
64 void QSpellchecker::add()
66 controller().insert();
70 void QSpellchecker::ignore()
76 void QSpellchecker::replace()
78 controller().replace(dialog_->replaceCO->currentText().latin1());
82 void QSpellchecker::spellcheck()
85 dialog_->spellcheckPB->setEnabled(false);
89 void QSpellchecker::stop()
92 dialog_->spellcheckPB->setEnabled(true);
97 void QSpellchecker::partialUpdate(int id)
101 dialog_->spellcheckPR->setProgress(controller().getProgress());
105 dialog_->wordED->setText(controller().getWord().c_str());
106 dialog_->suggestionsLB->clear();
109 while (!(w = controller().getSuggestion()).empty()) {
110 dialog_->suggestionsLB->insertItem(w.c_str());
116 dialog_->spellcheckPB->setEnabled(true);
118 lyxerr << controller().getMessage() << endl;
119 QMessageBox::information(0, _("Spellcheck complete"),
120 controller().getMessage().c_str(),