]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QSpellcheckerDialog.C
Some Qt graphics dialog improvements. Yet more work needed :/
[lyx.git] / src / frontends / qt2 / QSpellcheckerDialog.C
1 /**
2  * \file QSpellcheckerDialog.C
3  * Copyright 2001 the LyX Team
4  * Read the file COPYING
5  *
6  * \author John Levon <moz@compsoc.man.ac.uk>
7  */
8
9 #include <config.h>
10
11 #include "QSpellcheckerDialog.h"
12 #include "QSpellchecker.h"
13 #include "gettext.h"
14
15 #include <qpushbutton.h>
16 #include <qlineedit.h>
17 #include <qlistbox.h>
18 #include <qcombobox.h>
19
20 QSpellcheckerDialog::QSpellcheckerDialog(QSpellchecker * form)
21         : QSpellcheckerDialogBase(0, 0, false, 0),
22         form_(form)
23 {
24         connect(closePB, SIGNAL(clicked()),
25                 this, SLOT(stop()));
26 }
27
28
29 void QSpellcheckerDialog:: suggestionChanged(const QString & str)
30 {
31         if (replaceCO->count() != 0)
32                 replaceCO->changeItem(str, 0);
33         else
34                 replaceCO->insertItem(str);
35
36         replaceCO->setCurrentItem(0);
37 }
38
39
40 void QSpellcheckerDialog:: replaceChanged(const QString & str)
41 {
42         if (suggestionsLB->currentText() == str)
43                 return;
44
45         unsigned int i = 0;
46         for (; i < suggestionsLB->count(); ++i) {
47                 if (suggestionsLB->text(i) == str)
48                         break;
49         }
50
51         if (i != suggestionsLB->count())
52                 suggestionsLB->setCurrentItem(i);
53 }
54
55
56 void QSpellcheckerDialog::closeEvent(QCloseEvent * e)
57 {
58         form_->slotWMHide();
59         e->accept();
60 }