2 * \file QThesaurusDialog.C
3 * Copyright 2001 the LyX Team
4 * Read the file COPYING
6 * \author John Levon <moz@compsoc.man.ac.uk>
14 #include "ControlThesaurus.h"
15 #include "QThesaurusDialog.h"
17 #include "QThesaurus.h"
20 #include <qpushbutton.h>
22 #include <qlineedit.h>
24 QThesaurusDialog::QThesaurusDialog(QThesaurus * form)
25 : QThesaurusDialogBase(0, 0, false, 0),
28 connect(closePB, SIGNAL(clicked()),
29 form, SLOT(slotClose()));
33 void QThesaurusDialog::change_adaptor()
39 void QThesaurusDialog::closeEvent(QCloseEvent * e)
46 void QThesaurusDialog::entryChanged()
52 void QThesaurusDialog::replaceClicked()
58 void QThesaurusDialog::selectionChanged(const QString & str)
60 if (form_->readOnly())
63 string const entry(str.latin1());
64 replaceED->setText(entry.c_str());
65 replacePB->setEnabled(true);
70 void QThesaurusDialog::selectionClicked(const QString & str)
72 selectionChanged(str);
73 entryED->setText(str);
78 void QThesaurusDialog::updateLists()
80 ControlThesaurus & control(form_->controller());
81 string const entry(entryED->text().latin1());
83 std::vector<string> matches;
85 matches = control.getNouns(entry);
86 for (std::vector<string>::const_iterator cit = matches.begin();
87 cit != matches.end(); ++cit)
88 nounsLB->insertItem(cit->c_str());
89 matches = control.getVerbs(entry);
90 for (std::vector<string>::const_iterator cit = matches.begin();
91 cit != matches.end(); ++cit)
92 verbsLB->insertItem(cit->c_str());
93 matches = control.getAdjectives(entry);
94 for (std::vector<string>::const_iterator cit = matches.begin();
95 cit != matches.end(); ++cit)
96 adjectivesLB->insertItem(cit->c_str());
97 matches = control.getAdverbs(entry);
98 for (std::vector<string>::const_iterator cit = matches.begin();
99 cit != matches.end(); ++cit)
100 adverbsLB->insertItem(cit->c_str());
101 matches = control.getOthers(entry);
102 for (std::vector<string>::const_iterator cit = matches.begin();
103 cit != matches.end(); ++cit)
104 otherLB->insertItem(cit->c_str());