18 #include <keduvocwordtype.h>
19 #include <keduvoctranslation.h>
20 #include <keduvocexpression.h>
21 #include <keduvocdocument.h>
22 #include <KMessageBox>
24 using namespace Editor;
32 connect(makeAdjectiveButton, SIGNAL(clicked()), SLOT(slotMakeAdjectiveButton()));
33 connect(makeAdverbButton, SIGNAL(clicked()), SLOT(slotMakeAdverbButton()));
35 connect(comparativeLineEdit, SIGNAL(editingFinished()), SLOT(slotComparativeChanged()));
36 connect(superlativeLineEdit, SIGNAL(editingFinished()), SLOT(slotSuperlativeChanged()));
41 comparativeLineEdit->setText(QString());
42 superlativeLineEdit->setText(QString());
43 comparativeLineEdit->setEnabled(
false);
44 superlativeLineEdit->setEnabled(
false);
47 m_translation = entry->translation(translation);
53 absoluteEntryLabel->setText(m_translation->text());
56 if(m_translation->wordType()) {
57 if(m_translation->wordType()->wordType() & KEduVocWordFlag::Adjective
58 || m_translation->wordType()->wordType() & KEduVocWordFlag::Adverb) {
59 comparativeLineEdit->setEnabled(
true);
60 superlativeLineEdit->setEnabled(
true);
62 comparativeLineEdit->setText(m_translation->comparative());
63 superlativeLineEdit->setText(m_translation->superlative());
68 absoluteEntryLabel->setText(QString());
72 void ComparisonWidget::slotMakeAdjectiveButton()
79 KEduVocWordType* container = m_doc->wordTypeContainer()->childOfType(KEduVocWordFlag::Adjective);
81 m_translation->setWordType(container);
82 comparativeLineEdit->setEnabled(
true);
83 superlativeLineEdit->setEnabled(
true);
84 comparativeLineEdit->setFocus();
87 KMessageBox::information(
this, i18n(
"Could not determine word type of adjectives"));
91 void ComparisonWidget::slotMakeAdverbButton()
98 KEduVocWordType* container = m_doc->wordTypeContainer()->childOfType(KEduVocWordFlag::Adverb);
100 m_translation->setWordType(container);
101 comparativeLineEdit->setEnabled(
true);
102 superlativeLineEdit->setEnabled(
true);
103 comparativeLineEdit->setFocus();
106 KMessageBox::information(
this, i18n(
"Could not determine word type of adverbs"));
115 void ComparisonWidget::slotComparativeChanged()
117 m_translation->setComparative(comparativeLineEdit->text());
120 void ComparisonWidget::slotSuperlativeChanged()
122 m_translation->setSuperlative(superlativeLineEdit->text());
126 #include "comparisonwidget.moc"