2 * \file QThesaurusDialog.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
14 #pragma implementation
19 #include "ControlThesaurus.h"
20 #include "QThesaurusDialog.h"
21 #include "QThesaurus.h"
23 #include <qpushbutton.h>
24 #include <qlistview.h>
25 #include <qlineedit.h>
30 QThesaurusDialog::QThesaurusDialog(QThesaurus * form)
31 : QThesaurusDialogBase(0, 0, false, 0),
34 connect(closePB, SIGNAL(clicked()),
35 form, SLOT(slotClose()));
39 void QThesaurusDialog::change_adaptor()
45 void QThesaurusDialog::closeEvent(QCloseEvent * e)
52 void QThesaurusDialog::entryChanged()
58 void QThesaurusDialog::replaceClicked()
64 void QThesaurusDialog::selectionChanged(QListViewItem * item)
66 if (form_->readOnly())
69 string const entry(item->text(0).latin1());
70 replaceED->setText(entry.c_str());
71 replacePB->setEnabled(true);
76 void QThesaurusDialog::selectionClicked(QListViewItem * item)
78 entryED->setText(item->text(0));
79 selectionChanged(item);
84 void QThesaurusDialog::updateLists()
88 std::vector<string> matches;
90 meaningsLV->setUpdatesEnabled(false);
92 Thesaurus::Meanings meanings = form_->controller().getMeanings(entryED->text().latin1());
94 for (Thesaurus::Meanings::const_iterator cit = meanings.begin();
95 cit != meanings.end(); ++cit) {
96 QListViewItem * i = new QListViewItem(meaningsLV);
97 i->setText(0, cit->first.c_str());
99 for (std::vector<string>::const_iterator cit2 = cit->second.begin();
100 cit2 != cit->second.end(); ++cit2) {
101 QListViewItem * i2 = new QListViewItem(i);
102 i2->setText(0, cit2->c_str());
107 meaningsLV->setUpdatesEnabled(true);
108 meaningsLV->update();