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