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"
19 #include <qpushbutton.h>
20 #include <qlistview.h>
21 #include <qlineedit.h>
23 QThesaurusDialog::QThesaurusDialog(QThesaurus * form)
24 : QThesaurusDialogBase(0, 0, false, 0),
27 connect(closePB, SIGNAL(clicked()),
28 form, SLOT(slotClose()));
32 void QThesaurusDialog::change_adaptor()
38 void QThesaurusDialog::closeEvent(QCloseEvent * e)
45 void QThesaurusDialog::entryChanged()
51 void QThesaurusDialog::replaceClicked()
57 void QThesaurusDialog::selectionChanged(QListViewItem * item)
59 if (form_->readOnly())
62 string const entry(item->text(0).latin1());
63 replaceED->setText(entry.c_str());
64 replacePB->setEnabled(true);
69 void QThesaurusDialog::selectionClicked(QListViewItem * item)
71 entryED->setText(item->text(0));
72 selectionChanged(item);
77 void QThesaurusDialog::updateLists()
81 std::vector<string> matches;
83 meaningsLV->setUpdatesEnabled(false);
85 Thesaurus::Meanings meanings = form_->controller().getMeanings(entryED->text().latin1());
87 for (Thesaurus::Meanings::const_iterator cit = meanings.begin();
88 cit != meanings.end(); ++cit) {
89 QListViewItem * i = new QListViewItem(meaningsLV);
90 i->setText(0, cit->first.c_str());
92 for (std::vector<string>::const_iterator cit2 = cit->second.begin();
93 cit2 != cit->second.end(); ++cit2) {
94 QListViewItem * i2 = new QListViewItem(i);
95 i2->setText(0, cit2->c_str());
100 meaningsLV->setUpdatesEnabled(true);
101 meaningsLV->update();