2001-09-01 03:52:21 +00:00
|
|
|
/**
|
|
|
|
* \file QSpellcheckerDialog.C
|
2002-09-24 13:57:09 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2001-09-01 03:52:21 +00:00
|
|
|
*
|
2002-09-24 13:57:09 +00:00
|
|
|
* \author John Levon
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS
|
2001-09-01 03:52:21 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2002-09-24 13:57:09 +00:00
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
2001-09-01 03:52:21 +00:00
|
|
|
#include "QSpellcheckerDialog.h"
|
|
|
|
#include "QSpellchecker.h"
|
|
|
|
#include "gettext.h"
|
|
|
|
|
|
|
|
#include <qpushbutton.h>
|
|
|
|
#include <qlineedit.h>
|
|
|
|
#include <qlistbox.h>
|
|
|
|
#include <qcombobox.h>
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2001-09-01 03:52:21 +00:00
|
|
|
QSpellcheckerDialog::QSpellcheckerDialog(QSpellchecker * form)
|
|
|
|
: QSpellcheckerDialogBase(0, 0, false, 0),
|
|
|
|
form_(form)
|
|
|
|
{
|
|
|
|
connect(closePB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(stop()));
|
|
|
|
}
|
|
|
|
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2002-09-24 13:57:09 +00:00
|
|
|
void QSpellcheckerDialog::stop()
|
|
|
|
{
|
|
|
|
form_->stop();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QSpellcheckerDialog::acceptClicked()
|
|
|
|
{
|
|
|
|
form_->accept();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QSpellcheckerDialog::spellcheckClicked()
|
|
|
|
{
|
|
|
|
form_->spellcheck();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QSpellcheckerDialog::addClicked()
|
|
|
|
{
|
|
|
|
form_->add();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QSpellcheckerDialog::replaceClicked()
|
|
|
|
{
|
|
|
|
form_->replace();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QSpellcheckerDialog::ignoreClicked()
|
|
|
|
{
|
|
|
|
form_->ignore();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
void QSpellcheckerDialog::suggestionChanged(QString const & str)
|
2001-09-01 03:52:21 +00:00
|
|
|
{
|
|
|
|
if (replaceCO->count() != 0)
|
|
|
|
replaceCO->changeItem(str, 0);
|
|
|
|
else
|
|
|
|
replaceCO->insertItem(str);
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2001-09-01 03:52:21 +00:00
|
|
|
replaceCO->setCurrentItem(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
void QSpellcheckerDialog::replaceChanged(QString const & str)
|
2001-09-01 03:52:21 +00:00
|
|
|
{
|
|
|
|
if (suggestionsLB->currentText() == str)
|
|
|
|
return;
|
|
|
|
|
2001-11-06 18:10:55 +00:00
|
|
|
unsigned int i = 0;
|
2001-09-01 03:52:21 +00:00
|
|
|
for (; i < suggestionsLB->count(); ++i) {
|
|
|
|
if (suggestionsLB->text(i) == str)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i != suggestionsLB->count())
|
|
|
|
suggestionsLB->setCurrentItem(i);
|
|
|
|
}
|
2002-03-21 21:21:28 +00:00
|
|
|
|
|
|
|
|
2001-09-01 03:52:21 +00:00
|
|
|
void QSpellcheckerDialog::closeEvent(QCloseEvent * e)
|
|
|
|
{
|
|
|
|
form_->slotWMHide();
|
|
|
|
e->accept();
|
|
|
|
}
|