]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QSpellcheckerDialog.C
ws cleanup
[lyx.git] / src / frontends / qt2 / QSpellcheckerDialog.C
1 /**
2  * \file QSpellcheckerDialog.C
3  * Copyright 2001 the LyX Team
4  * Read the file COPYING
5  *
6  * \author John Levon <moz@compsoc.man.ac.uk>
7  */
8
9 #include <config.h>
10
11 #include "QSpellcheckerDialog.h"
12 #include "Dialogs.h"
13 #include "QSpellchecker.h"
14 #include "gettext.h"
15
16 #include <qpushbutton.h>
17 #include <qlineedit.h>
18 #include <qlistbox.h>
19 #include <qcombobox.h>
20
21 QSpellcheckerDialog::QSpellcheckerDialog(QSpellchecker * form)
22         : QSpellcheckerDialogBase(0, 0, false, 0),
23         form_(form)
24 {
25         connect(closePB, SIGNAL(clicked()),
26                 this, SLOT(stop()));
27 }
28
29
30 void QSpellcheckerDialog:: suggestionChanged(const QString & str)
31 {
32         if (replaceCO->count() != 0)
33                 replaceCO->changeItem(str, 0);
34         else
35                 replaceCO->insertItem(str);
36
37         replaceCO->setCurrentItem(0);
38 }
39
40
41 void QSpellcheckerDialog:: replaceChanged(const QString & str)
42 {
43         if (suggestionsLB->currentText() == str)
44                 return;
45
46         unsigned int i = 0;
47         for (; i < suggestionsLB->count(); ++i) {
48                 if (suggestionsLB->text(i) == str)
49                         break;
50         }
51
52         if (i != suggestionsLB->count())
53                 suggestionsLB->setCurrentItem(i);
54 }
55
56
57 void QSpellcheckerDialog::closeEvent(QCloseEvent * e)
58 {
59         form_->slotWMHide();
60         e->accept();
61 }