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(ControlSpellchecker & c)
27 : base_class(c, _("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::options()
75 controller().options();
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"));