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 <q3progressbar.h>
21 #include <qlineedit.h>
22 #include <qpushbutton.h>
23 #include <q3listbox.h>
30 typedef QController<ControlSpellchecker, QView<QSpellcheckerDialog> > base_class;
32 QSpellchecker::QSpellchecker(Dialog & parent)
33 : base_class(parent, _("Spellchecker"))
37 void QSpellchecker::build_dialog()
39 dialog_.reset(new QSpellcheckerDialog(this));
41 bcview().setCancel(dialog_->closePB);
42 dialog_->wordED->setReadOnly(true);
46 void QSpellchecker::update_contents()
52 void QSpellchecker::accept()
54 controller().ignoreAll();
58 void QSpellchecker::add()
60 controller().insert();
64 void QSpellchecker::ignore()
70 void QSpellchecker::replace()
72 controller().replace(fromqstr(dialog_->replaceCO->currentText()));
76 void QSpellchecker::partialUpdate(int s)
78 ControlSpellchecker::State const state =
79 static_cast<ControlSpellchecker::State>(s);
83 case ControlSpellchecker::SPELL_PROGRESSED:
84 dialog_->spellcheckPR->setProgress(controller().getProgress());
87 case ControlSpellchecker::SPELL_FOUND_WORD: {
88 dialog_->wordED->setText(toqstr(controller().getWord()));
89 dialog_->suggestionsLB->clear();
92 while (!(w = controller().getSuggestion()).empty()) {
93 dialog_->suggestionsLB->insertItem(toqstr(w));
96 if (dialog_->suggestionsLB->count() == 0) {
97 dialog_->suggestionChanged(dialog_->wordED->text());
99 dialog_->suggestionChanged(dialog_->suggestionsLB->text(0));
107 } // namespace frontend