]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QSpellcheckerDialog.C
dont use pragma impementation and interface anymore
[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                 this, SLOT(stop()));
30 }
31
32
33 void QSpellcheckerDialog::stop()
34 {
35         form_->stop();
36 }
37
38
39 void QSpellcheckerDialog::acceptClicked()
40 {
41         form_->accept();
42 }
43
44
45 void QSpellcheckerDialog::spellcheckClicked()
46 {
47         form_->spellcheck();
48 }
49
50
51 void QSpellcheckerDialog::addClicked()
52 {
53         form_->add();
54 }
55
56
57 void QSpellcheckerDialog::replaceClicked()
58 {
59         form_->replace();
60 }
61
62
63 void QSpellcheckerDialog::ignoreClicked()
64 {
65         form_->ignore();
66 }
67
68
69 void QSpellcheckerDialog::suggestionChanged(QString const & str)
70 {
71         if (replaceCO->count() != 0)
72                 replaceCO->changeItem(str, 0);
73         else
74                 replaceCO->insertItem(str);
75
76         replaceCO->setCurrentItem(0);
77 }
78
79
80 void QSpellcheckerDialog::replaceChanged(QString const & str)
81 {
82         if (suggestionsLB->currentText() == str)
83                 return;
84
85         unsigned int i = 0;
86         for (; i < suggestionsLB->count(); ++i) {
87                 if (suggestionsLB->text(i) == str)
88                         break;
89         }
90
91         if (i != suggestionsLB->count())
92                 suggestionsLB->setCurrentItem(i);
93 }
94
95
96 void QSpellcheckerDialog::closeEvent(QCloseEvent * e)
97 {
98         form_->stop();
99         form_->slotWMHide();
100         e->accept();
101 }
102
103
104 void QSpellcheckerDialog::reject()
105 {
106         form_->slotWMHide();
107         QSpellcheckerDialogBase::reject();
108 }