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;
32 QSpellchecker::QSpellchecker()
33 : base_class(_("Spellchecker"))
38 void QSpellchecker::build_dialog()
40 dialog_.reset(new QSpellcheckerDialog(this));
42 bc().setCancel(dialog_->closePB);
43 dialog_->wordED->setReadOnly(true);
47 void QSpellchecker::update_contents()
49 dialog_->wordED->setText("");
50 dialog_->replaceCO->clear();
51 dialog_->suggestionsLB->clear();
55 void QSpellchecker::accept()
57 controller().ignoreAll();
61 void QSpellchecker::add()
63 controller().insert();
67 void QSpellchecker::ignore()
73 void QSpellchecker::replace()
75 controller().replace(dialog_->replaceCO->currentText().latin1());
79 void QSpellchecker::spellcheck()
82 dialog_->spellcheckPB->setEnabled(false);
86 void QSpellchecker::stop()
89 dialog_->spellcheckPB->setEnabled(true);
94 void QSpellchecker::partialUpdate(int id)
98 dialog_->spellcheckPR->setProgress(controller().getProgress());
102 dialog_->wordED->setText(controller().getWord().c_str());
103 dialog_->suggestionsLB->clear();
106 while (!(w = controller().getSuggestion()).empty()) {
107 dialog_->suggestionsLB->insertItem(w.c_str());
112 dialog_->spellcheckPB->setEnabled(true);
114 QMessageBox::information(0, _("Spellcheck complete"), controller().getMessage().c_str() , _("OK"));