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.
13 #include "QSpellchecker.h"
14 #include "QSpellcheckerDialog.h"
16 #include "qt_helpers.h"
18 #include "controllers/ControlSpellchecker.h"
20 #include <qprogressbar.h>
21 #include <qlineedit.h>
22 #include <qpushbutton.h>
24 #include <qcombobox.h>
31 typedef QController<ControlSpellchecker, QView<QSpellcheckerDialog> > base_class;
34 QSpellchecker::QSpellchecker(Dialog & parent)
35 : base_class(parent, _("LyX: Spell-check Document"))
39 void QSpellchecker::build_dialog()
41 dialog_.reset(new QSpellcheckerDialog(this));
43 bcview().setCancel(dialog_->closePB);
44 dialog_->wordED->setReadOnly(true);
48 void QSpellchecker::update_contents()
54 void QSpellchecker::accept()
56 controller().ignoreAll();
60 void QSpellchecker::add()
62 controller().insert();
66 void QSpellchecker::ignore()
72 void QSpellchecker::replace()
74 controller().replace(fromqstr(dialog_->replaceCO->currentText()));
78 void QSpellchecker::partialUpdate(int s)
80 ControlSpellchecker::State const state =
81 static_cast<ControlSpellchecker::State>(s);
85 case ControlSpellchecker::SPELL_PROGRESSED:
86 dialog_->spellcheckPR->setProgress(controller().getProgress());
89 case ControlSpellchecker::SPELL_FOUND_WORD: {
90 dialog_->wordED->setText(toqstr(controller().getWord()));
91 dialog_->suggestionsLB->clear();
94 while (!(w = controller().getSuggestion()).empty()) {
95 dialog_->suggestionsLB->insertItem(toqstr(w));
98 if (dialog_->suggestionsLB->count() == 0) {
99 dialog_->suggestionChanged(dialog_->wordED->text());
101 dialog_->suggestionChanged(dialog_->suggestionsLB->text(0));
109 } // namespace frontend