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