moved kdeaccessibility kdeaddons kdeadmin kdeartwork kdebindings kdeedu kdegames...
[kdeedu.git] / kvoctrain / kvoctrain / entry-dialogs / AuxInfoEntryPage.cpp
blob0d4742d7e499b254bc655bdf335b95be4bb6b0a4
1 /***************************************************************************
3 edit "additional" properties
5 -----------------------------------------------------------------------
7 begin : Thu Nov 25 17:29:44 1999
9 copyright : (C) 1999-2001 Ewald Arnold <kvoctrain@ewald-arnold.de>
10 (C) 2001 The KDE-EDU team
11 (C) 2005 Peter Hedlund <peter@peterandlinda.com>
13 -----------------------------------------------------------------------
15 ***************************************************************************/
17 /***************************************************************************
18 * *
19 * This program is free software; you can redistribute it and/or modify *
20 * it under the terms of the GNU General Public License as published by *
21 * the Free Software Foundation; either version 2 of the License, or *
22 * (at your option) any later version. *
23 * *
24 ***************************************************************************/
26 #include <qmultilineedit.h>
28 #include "AuxInfoEntryPage.h"
29 #include "EntryDlg.h"
31 #include <langset.h>
33 #include <LineList.h>
35 AuxInfoEntryPage::AuxInfoEntryPage
37 EntryDlg *_dlgbook,
38 bool multi_sel,
39 QString syno,
40 QString anto,
41 QString exam,
42 QString rem,
43 QString para,
44 QWidget *parent,
45 const char *name
47 : AuxInfoEntryPageForm( parent, name ), dlgbook(_dlgbook)
50 QFontMetrics fm (synonym_line->font());
51 int sz = fm.lineSpacing();
53 synonym_line->setMaximumHeight(sz*3);
54 antonym_line->setMaximumHeight(sz*3);
55 para_line->setMaximumHeight(sz*3);
56 remark_line->setMaximumHeight(sz*3);
57 examp_line->setMaximumHeight(sz*3);
59 connect( para_line, SIGNAL(textChanged()), SLOT(slotParaSelected()) );
60 connect( remark_line, SIGNAL(textChanged()), SLOT(slotRemarkSelected()) );
61 connect( examp_line, SIGNAL(textChanged()), SLOT(slotExampSelected()) );
62 connect( antonym_line, SIGNAL(textChanged()), SLOT(slotAntonymSelected()) );
63 connect( synonym_line, SIGNAL(textChanged()), SLOT(slotSynonymSelected()) );
65 setData(multi_sel, syno, anto, exam, rem, para);
69 void AuxInfoEntryPage::setData(bool multi_sel, QString syno, QString anto, QString example, QString remark, QString para)
71 synonym_line->setText(syno);
72 antonym_line->setText(anto);
73 examp_line->setText(example);
74 remark_line->setText(remark);
75 para_line->setText(para);
77 if (multi_sel) {
78 synonym_line ->setEnabled(false);
79 antonym_line ->setEnabled(false);
80 remark_line ->setEnabled(false);
81 examp_line ->setEnabled(false);
82 para_line ->setEnabled(false);
85 setModified(false);
89 void AuxInfoEntryPage::slotSynonymSelected()
91 setModified(true);
92 synonym = synonym_line->text();
96 void AuxInfoEntryPage::slotAntonymSelected()
98 setModified(true);
99 antonym = antonym_line->text();
103 void AuxInfoEntryPage::slotRemarkSelected ()
105 setModified(true);
106 remark = remark_line->text();
110 void AuxInfoEntryPage::slotExampSelected ()
112 setModified(true);
113 example = examp_line->text();
117 void AuxInfoEntryPage::slotParaSelected ()
119 setModified(true);
120 paraphrase = para_line->text();
124 QString AuxInfoEntryPage::getSynonym ()
126 normalize(synonym);
127 return synonym;
131 QString AuxInfoEntryPage::getAntonym ()
133 normalize(antonym);
134 return antonym;
138 QString AuxInfoEntryPage::getExample ()
140 normalize(example);
141 return example;
145 QString AuxInfoEntryPage::getRemark ()
147 normalize(remark);
148 return remark;
152 QString AuxInfoEntryPage::getParaphrase ()
154 normalize(paraphrase);
155 return paraphrase;
159 void AuxInfoEntryPage::normalize (QString &str)
161 LineList ll (str);
162 ll.normalizeWS();
163 str = ll.allLines();
167 bool AuxInfoEntryPage::isModified()
169 return modified;
173 void AuxInfoEntryPage::setEnabled(int enable)
175 bool ena = enable == EntryDlg::EnableAll;
177 synonym_line->setEnabled (ena);
178 antonym_line->setEnabled (ena);
179 para_line->setEnabled (ena);
180 remark_line->setEnabled (ena);
181 examp_line->setEnabled (ena);
185 void AuxInfoEntryPage::setModified(bool mod)
187 modified = mod;
188 if (mod)
189 emit sigModified();
192 #include "AuxInfoEntryPage.moc"