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
16 #include "ControlThesaurus.h"
17 #include "QThesaurusDialog.h"
18 #include "QThesaurus.h"
19 #include "qt_helpers.h"
21 #include <qpushbutton.h>
22 #include <qlistview.h>
23 #include <qlineedit.h>
28 QThesaurusDialog::QThesaurusDialog(QThesaurus * form)
29 : QThesaurusDialogBase(0, 0, false, 0),
32 // hide the pointless QHeader
33 QWidget * w = static_cast<QWidget*>(meaningsLV->child("list view header"));
37 connect(closePB, SIGNAL(clicked()),
38 form, SLOT(slotClose()));
42 void QThesaurusDialog::change_adaptor()
48 void QThesaurusDialog::closeEvent(QCloseEvent * e)
55 void QThesaurusDialog::entryChanged()
61 void QThesaurusDialog::replaceClicked()
67 void QThesaurusDialog::selectionChanged(QListViewItem * item)
69 if (form_->readOnly())
72 string const entry(fromqstr(item->text(0)));
73 replaceED->setText(toqstr(entry));
74 replacePB->setEnabled(true);
79 void QThesaurusDialog::selectionClicked(QListViewItem * item)
81 entryED->setText(item->text(0));
82 selectionChanged(item);
87 void QThesaurusDialog::updateLists()
91 std::vector<string> matches;
93 meaningsLV->setUpdatesEnabled(false);
95 Thesaurus::Meanings meanings = form_->controller().getMeanings(fromqstr(entryED->text()));
97 for (Thesaurus::Meanings::const_iterator cit = meanings.begin();
98 cit != meanings.end(); ++cit) {
99 QListViewItem * i = new QListViewItem(meaningsLV);
100 i->setText(0, toqstr(cit->first));
102 for (std::vector<string>::const_iterator cit2 = cit->second.begin();
103 cit2 != cit->second.end(); ++cit2) {
104 QListViewItem * i2 = new QListViewItem(i);
105 i2->setText(0, toqstr(*cit2));
110 meaningsLV->setUpdatesEnabled(true);
111 meaningsLV->update();