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();
56 void QSpellchecker::accept()
58 controller().ignoreAll();
62 void QSpellchecker::add()
64 controller().insert();
68 void QSpellchecker::ignore()
74 void QSpellchecker::replace()
76 controller().replace(dialog_->replaceCO->currentText().latin1());
80 void QSpellchecker::spellcheck()
83 dialog_->spellcheckPB->setEnabled(false);
87 void QSpellchecker::stop()
90 dialog_->spellcheckPB->setEnabled(true);
95 void QSpellchecker::partialUpdate(int id)
99 dialog_->spellcheckPR->setProgress(controller().getProgress());
103 dialog_->wordED->setText(controller().getWord().c_str());
104 dialog_->suggestionsLB->clear();
107 while (!(w = controller().getSuggestion()).empty()) {
108 dialog_->suggestionsLB->insertItem(w.c_str());
113 dialog_->spellcheckPB->setEnabled(true);
115 QMessageBox::information(0, _("Spellcheck complete"),
116 controller().getMessage().c_str(),