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"
22 #include "qt_helpers.h"
24 #include <qpushbutton.h>
25 #include <qlistview.h>
26 #include <qlineedit.h>
31 QThesaurusDialog::QThesaurusDialog(QThesaurus * form)
32 : QThesaurusDialogBase(0, 0, false, 0),
35 connect(closePB, SIGNAL(clicked()),
36 form, SLOT(slotClose()));
40 void QThesaurusDialog::change_adaptor()
46 void QThesaurusDialog::closeEvent(QCloseEvent * e)
53 void QThesaurusDialog::entryChanged()
59 void QThesaurusDialog::replaceClicked()
65 void QThesaurusDialog::selectionChanged(QListViewItem * item)
67 if (form_->readOnly())
70 string const entry(fromqstr(item->text(0)));
71 replaceED->setText(toqstr(entry));
72 replacePB->setEnabled(true);
77 void QThesaurusDialog::selectionClicked(QListViewItem * item)
79 entryED->setText(item->text(0));
80 selectionChanged(item);
85 void QThesaurusDialog::updateLists()
89 std::vector<string> matches;
91 meaningsLV->setUpdatesEnabled(false);
93 Thesaurus::Meanings meanings = form_->controller().getMeanings(fromqstr(entryED->text()));
95 for (Thesaurus::Meanings::const_iterator cit = meanings.begin();
96 cit != meanings.end(); ++cit) {
97 QListViewItem * i = new QListViewItem(meaningsLV);
98 i->setText(0, toqstr(cit->first));
100 for (std::vector<string>::const_iterator cit2 = cit->second.begin();
101 cit2 != cit->second.end(); ++cit2) {
102 QListViewItem * i2 = new QListViewItem(i);
103 i2->setText(0, toqstr(*cit2));
108 meaningsLV->setUpdatesEnabled(true);
109 meaningsLV->update();