]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QSpellcheckerDialog.C
Get rid of the static_casts.
[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 #include "qt_helpers.h"
17
18 #include <qpushbutton.h>
19 #include <qlineedit.h>
20 #include <qlistbox.h>
21 #include <qcombobox.h>
22
23
24 QSpellcheckerDialog::QSpellcheckerDialog(QSpellchecker * form)
25         : QSpellcheckerDialogBase(0, 0, false, 0),
26         form_(form)
27 {
28         connect(closePB, SIGNAL(clicked()),
29                 form, SLOT(slotClose()));
30 }
31
32
33 void QSpellcheckerDialog::acceptClicked()
34 {
35         form_->accept();
36 }
37
38
39 void QSpellcheckerDialog::addClicked()
40 {
41         form_->add();
42 }
43
44
45 void QSpellcheckerDialog::replaceClicked()
46 {
47         form_->replace();
48 }
49
50
51 void QSpellcheckerDialog::ignoreClicked()
52 {
53         form_->ignore();
54 }
55
56
57 void QSpellcheckerDialog::suggestionChanged(QString const & str)
58 {
59         if (replaceCO->count() != 0)
60                 replaceCO->changeItem(str, 0);
61         else
62                 replaceCO->insertItem(str);
63
64         replaceCO->setCurrentItem(0);
65 }
66
67
68 void QSpellcheckerDialog::replaceChanged(QString const & str)
69 {
70         if (suggestionsLB->currentText() == str)
71                 return;
72
73         unsigned int i = 0;
74         for (; i < suggestionsLB->count(); ++i) {
75                 if (suggestionsLB->text(i) == str)
76                         break;
77         }
78
79         if (i != suggestionsLB->count())
80                 suggestionsLB->setCurrentItem(i);
81 }
82
83
84 void QSpellcheckerDialog::closeEvent(QCloseEvent * e)
85 {
86         form_->slotWMHide();
87         e->accept();
88 }
89
90
91 void QSpellcheckerDialog::reject()
92 {
93         form_->slotWMHide();
94         QSpellcheckerDialogBase::reject();
95 }