]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QSpellcheckerDialog.C
Joao latest bits
[lyx.git] / src / frontends / qt2 / QSpellcheckerDialog.C
1 /**
2  * \file QSpellcheckerDialog.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author John Levon
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13
14 #include "QSpellcheckerDialog.h"
15 #include "QSpellchecker.h"
16
17 #include <qpushbutton.h>
18 #include <qlistbox.h>
19 #include <qcombobox.h>
20
21
22 QSpellcheckerDialog::QSpellcheckerDialog(QSpellchecker * form)
23         : QSpellcheckerDialogBase(0, 0, false, 0),
24         form_(form)
25 {
26         connect(closePB, SIGNAL(clicked()),
27                 form, SLOT(slotClose()));
28 }
29
30
31 void QSpellcheckerDialog::acceptClicked()
32 {
33         form_->accept();
34 }
35
36
37 void QSpellcheckerDialog::addClicked()
38 {
39         form_->add();
40 }
41
42
43 void QSpellcheckerDialog::replaceClicked()
44 {
45         form_->replace();
46 }
47
48
49 void QSpellcheckerDialog::ignoreClicked()
50 {
51         form_->ignore();
52 }
53
54
55 void QSpellcheckerDialog::suggestionChanged(const QString & str)
56 {
57         if (replaceCO->count() != 0)
58                 replaceCO->changeItem(str, 0);
59         else
60                 replaceCO->insertItem(str);
61
62         replaceCO->setCurrentItem(0);
63 }
64
65
66 void QSpellcheckerDialog::replaceChanged(const QString & str)
67 {
68         if (suggestionsLB->currentText() == str)
69                 return;
70
71         unsigned int i = 0;
72         for (; i < suggestionsLB->count(); ++i) {
73                 if (suggestionsLB->text(i) == str)
74                         break;
75         }
76
77         if (i != suggestionsLB->count())
78                 suggestionsLB->setCurrentItem(i);
79 }
80
81
82 void QSpellcheckerDialog::closeEvent(QCloseEvent * e)
83 {
84         form_->slotWMHide();
85         e->accept();
86 }
87
88
89 void QSpellcheckerDialog::reject()
90 {
91         form_->slotWMHide();
92         QSpellcheckerDialogBase::reject();
93 }