2006-03-05 17:24:44 +00:00
|
|
|
/**
|
|
|
|
* \file QSpellcheckerDialog.C
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author John Levon
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#include "QSpellcheckerDialog.h"
|
|
|
|
#include "QSpellchecker.h"
|
|
|
|
|
2006-05-03 19:51:15 +00:00
|
|
|
#include <QListWidget>
|
2006-03-05 17:24:44 +00:00
|
|
|
#include <QPushButton>
|
|
|
|
#include <QCloseEvent>
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
|
|
|
|
|
|
|
QSpellcheckerDialog::QSpellcheckerDialog(QSpellchecker * form)
|
|
|
|
: form_(form)
|
|
|
|
{
|
|
|
|
setupUi(this);
|
|
|
|
|
|
|
|
connect(closePB, SIGNAL(clicked()),
|
|
|
|
form, SLOT(slotClose()));
|
2006-04-05 23:56:29 +00:00
|
|
|
|
2006-07-06 08:18:51 +00:00
|
|
|
connect( replaceCO, SIGNAL( highlighted(const QString&) ),
|
2006-05-03 19:51:15 +00:00
|
|
|
this, SLOT( replaceChanged(const QString &) ) );
|
2006-07-06 08:18:51 +00:00
|
|
|
connect( replacePB, SIGNAL( clicked() ),
|
2006-05-03 19:51:15 +00:00
|
|
|
this, SLOT( replaceClicked() ) );
|
2006-07-06 08:18:51 +00:00
|
|
|
connect( ignorePB, SIGNAL( clicked() ),
|
2006-05-03 19:51:15 +00:00
|
|
|
this, SLOT( ignoreClicked() ) );
|
2006-07-06 08:18:51 +00:00
|
|
|
connect( replacePB_3, SIGNAL( clicked() ),
|
2006-05-03 19:51:15 +00:00
|
|
|
this, SLOT( acceptClicked() ) );
|
2006-07-06 08:18:51 +00:00
|
|
|
connect( addPB, SIGNAL( clicked() ),
|
2006-05-03 19:51:15 +00:00
|
|
|
this, SLOT( addClicked() ) );
|
2006-07-06 08:18:51 +00:00
|
|
|
connect( suggestionsLW, SIGNAL( itemDoubleClicked(QListWidgetItem*) ),
|
2006-05-03 19:51:15 +00:00
|
|
|
this, SLOT( replaceClicked() ) );
|
2006-07-06 08:18:51 +00:00
|
|
|
connect( suggestionsLW, SIGNAL( itemClicked(QListWidgetItem*) ),
|
2006-05-03 19:51:15 +00:00
|
|
|
this, SLOT( suggestionChanged(QListWidgetItem*) ) );
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QSpellcheckerDialog::acceptClicked()
|
|
|
|
{
|
|
|
|
form_->accept();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QSpellcheckerDialog::addClicked()
|
|
|
|
{
|
|
|
|
form_->add();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QSpellcheckerDialog::replaceClicked()
|
|
|
|
{
|
|
|
|
form_->replace();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QSpellcheckerDialog::ignoreClicked()
|
|
|
|
{
|
|
|
|
form_->ignore();
|
|
|
|
}
|
|
|
|
|
2006-05-03 19:51:15 +00:00
|
|
|
void QSpellcheckerDialog::suggestionChanged(QListWidgetItem * item)
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
|
|
|
if (replaceCO->count() != 0)
|
2006-05-03 19:51:15 +00:00
|
|
|
replaceCO->changeItem(item->text(), 0);
|
2006-03-05 17:24:44 +00:00
|
|
|
else
|
2006-05-03 19:51:15 +00:00
|
|
|
replaceCO->insertItem(item->text());
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
replaceCO->setCurrentItem(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QSpellcheckerDialog::replaceChanged(const QString & str)
|
|
|
|
{
|
2006-05-03 19:51:15 +00:00
|
|
|
if (suggestionsLW->currentItem()->text() == str)
|
2006-03-05 17:24:44 +00:00
|
|
|
return;
|
|
|
|
|
2006-07-06 08:18:51 +00:00
|
|
|
for (int i = 0; i < suggestionsLW->count(); ++i) {
|
|
|
|
if (suggestionsLW->item(i)->text() == str) {
|
|
|
|
suggestionsLW->setCurrentRow(i);
|
2006-03-05 17:24:44 +00:00
|
|
|
break;
|
2006-07-06 08:18:51 +00:00
|
|
|
}
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QSpellcheckerDialog::closeEvent(QCloseEvent * e)
|
|
|
|
{
|
|
|
|
form_->slotWMHide();
|
|
|
|
e->accept();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QSpellcheckerDialog::reject()
|
|
|
|
{
|
|
|
|
form_->slotWMHide();
|
|
|
|
QDialog::reject();
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
2006-05-18 08:51:12 +00:00
|
|
|
|
|
|
|
#include "QSpellcheckerDialog_moc.cpp"
|