2 * \file QSpellchecker.C
3 * Copyright 2001 the LyX Team
4 * Read the file COPYING
6 * \author John Levon <moz@compsoc.man.ac.uk>
11 #include "ControlSpellchecker.h"
12 #include "QSpellcheckerDialog.h"
13 #include "QSpellchecker.h"
17 #include <qprogressbar.h>
18 #include <qmessagebox.h>
19 #include <qlineedit.h>
20 #include <qpushbutton.h>
22 #include <qcombobox.h>
24 typedef Qt2CB<ControlSpellchecker, Qt2DB<QSpellcheckerDialog> > base_class;
26 QSpellchecker::QSpellchecker()
27 : base_class(_("Spellchecker"))
32 void QSpellchecker::build_dialog()
34 dialog_.reset(new QSpellcheckerDialog(this));
36 bc().setCancel(dialog_->closePB);
37 dialog_->wordED->setReadOnly(true);
41 void QSpellchecker::update_contents()
43 dialog_->wordED->setText("");
44 dialog_->replaceCO->clear();
45 dialog_->suggestionsLB->clear();
49 void QSpellchecker::accept()
51 controller().ignoreAll();
55 void QSpellchecker::add()
57 controller().insert();
61 void QSpellchecker::ignore()
67 void QSpellchecker::replace()
69 controller().replace(dialog_->replaceCO->currentText().latin1());
73 void QSpellchecker::spellcheck()
76 dialog_->spellcheckPB->setEnabled(false);
80 void QSpellchecker::stop()
83 dialog_->spellcheckPB->setEnabled(true);
88 void QSpellchecker::partialUpdate(int id)
92 dialog_->spellcheckPR->setProgress(controller().getProgress());
96 dialog_->wordED->setText(controller().getWord().c_str());
97 dialog_->suggestionsLB->clear();
100 while (!(w = controller().getSuggestion()).empty()) {
101 dialog_->suggestionsLB->insertItem(w.c_str());
106 dialog_->spellcheckPB->setEnabled(true);
108 QMessageBox::information(0, _("Spellcheck complete"), controller().getMessage().c_str() , _("OK"));