moved kdeaccessibility kdeaddons kdeadmin kdeartwork kdebindings kdeedu kdegames...
[kdeedu.git] / kvoctrain / kvoctrain / docprop-dialogs / LangPropPage.cpp
blob24fe8c2ed8539d3d14c963843babcc4791113278
1 /***************************************************************************
3 language properties dialog page
5 -----------------------------------------------------------------------
7 begin : Wed Oct 13 18:37:13 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 ***************************************************************************/
27 #include <langset.h>
28 #include <GrammerManager.h>
30 #include "LangPropPage.h"
32 #include <klocale.h>
34 #include <qlineedit.h>
35 #include <qcheckbox.h>
36 #include <qlabel.h>
38 LangPropPage::LangPropPage
40 kvoctrainDoc *_doc,
41 QString curr_lang,
42 const Conjugation &conjug,
43 const Article &art,
44 QWidget *parent,
45 const char *name
48 LangPropPageForm( parent, name ),
49 doc(_doc),
50 conjugations(conjug),
51 articles(art)
53 l_langcode->setText(curr_lang);
55 connect( indef_female, SIGNAL(textChanged(const QString&)), SLOT(indefFemaleChanged(const QString&)) );
56 connect( def_female, SIGNAL(textChanged(const QString&)), SLOT(defFemaleChanged(const QString&)) );
57 connect( def_male, SIGNAL(textChanged(const QString&)), SLOT(defMaleChanged(const QString&)) );
58 connect( indef_male, SIGNAL(textChanged(const QString&)), SLOT(indefMaleChanged(const QString&)) );
59 connect( def_natural, SIGNAL(textChanged(const QString&)), SLOT(defNaturalChanged(const QString&)) );
60 connect( indef_natural, SIGNAL(textChanged(const QString&)), SLOT(indefNaturalChanged(const QString&)) );
61 connect( first_singular, SIGNAL(textChanged(const QString&)), SLOT(firstSingularChanged(const QString&)) );
62 connect( first_plural, SIGNAL(textChanged(const QString&)), SLOT(firstPluralChanged(const QString&)) );
63 connect( second_singular, SIGNAL(textChanged(const QString&)), SLOT(secondSingularChanged(const QString&)) );
64 connect( second_plural, SIGNAL(textChanged(const QString&)), SLOT(secondPluralChanged(const QString&)) );
65 connect( thirdF_singular, SIGNAL(textChanged(const QString&)), SLOT(thirdFSingularChanged(const QString&)) );
66 connect( thirdF_plural, SIGNAL(textChanged(const QString&)), SLOT(thirdFPluralChanged(const QString&)) );
67 connect( thirdM_singular, SIGNAL(textChanged(const QString&)), SLOT(thirdMSingularChanged(const QString&)) );
68 connect( thirdM_plural, SIGNAL(textChanged(const QString&)), SLOT(thirdMPluralChanged(const QString&)) );
69 connect( thirdN_singular, SIGNAL(textChanged(const QString&)), SLOT(thirdNSingularChanged(const QString&)) );
70 connect( thirdN_plural, SIGNAL(textChanged(const QString&)), SLOT(thirdNPluralChanged(const QString&)) );
72 connect( thirdS_common, SIGNAL(toggled(bool)), SLOT(slotThirdSCommonToggled(bool)) );
73 connect( thirdP_common, SIGNAL(toggled(bool)), SLOT(slotThirdPCommonToggled(bool)) );
75 conjugations = conjug;
77 first_plural->setText (conjugations.pers1Plural (CONJ_PREFIX));
78 first_singular->setText (conjugations.pers1Singular (CONJ_PREFIX));
79 second_singular->setText (conjugations.pers2Singular (CONJ_PREFIX));
80 second_plural->setText (conjugations.pers2Plural (CONJ_PREFIX));
81 thirdF_plural->setText (conjugations.pers3FemalePlural (CONJ_PREFIX));
82 thirdF_singular->setText (conjugations.pers3FemaleSingular (CONJ_PREFIX));
83 thirdN_plural->setText (conjugations.pers3NaturalPlural (CONJ_PREFIX));
84 thirdN_singular->setText (conjugations.pers3NaturalSingular (CONJ_PREFIX));
85 thirdM_plural->setText (conjugations.pers3MalePlural (CONJ_PREFIX));
86 thirdM_singular->setText (conjugations.pers3MaleSingular (CONJ_PREFIX));
88 bool common = conjugations.pers3SingularCommon(CONJ_PREFIX);
89 thirdS_common->setChecked(common);
90 thirdM_singular->setEnabled(!common);
91 thirdN_singular->setEnabled(!common);
93 common = conjugations.pers3PluralCommon(CONJ_PREFIX);
94 thirdP_common->setChecked(common);
95 thirdN_plural->setEnabled(!common);
96 thirdM_plural->setEnabled(!common);
98 QString def, indef;
99 articles.female(def, indef);
100 def_female->setText (def);
101 indef_female->setText (indef);
103 articles.male(def, indef);
104 def_male->setText (def);
105 indef_male->setText (indef);
107 articles.natural(def, indef);
108 def_natural->setText (def);
109 indef_natural->setText (indef);
114 Conjugation LangPropPage::getConjugation()
116 conjugations.cleanUp();
117 return conjugations;
121 void LangPropPage::firstPluralChanged(const QString& s)
123 conjugations.setPers1Plural (CONJ_PREFIX, s);
127 void LangPropPage::firstSingularChanged(const QString& s)
129 conjugations.setPers1Singular (CONJ_PREFIX, s);
133 void LangPropPage::secondSingularChanged(const QString& s)
135 conjugations.setPers2Singular (CONJ_PREFIX, s);
139 void LangPropPage::secondPluralChanged(const QString& s)
141 conjugations.setPers2Plural (CONJ_PREFIX, s);
145 void LangPropPage::thirdFPluralChanged(const QString& s)
147 conjugations.setPers3FemalePlural (CONJ_PREFIX, s);
151 void LangPropPage::thirdFSingularChanged(const QString& s)
153 conjugations.setPers3FemaleSingular (CONJ_PREFIX, s);
157 void LangPropPage::thirdMSingularChanged(const QString& s)
159 conjugations.setPers3MaleSingular (CONJ_PREFIX, s);
163 void LangPropPage::thirdNSingularChanged(const QString& s)
165 conjugations.setPers3NaturalSingular(CONJ_PREFIX, s);
169 void LangPropPage::thirdNPluralChanged(const QString& s)
171 conjugations.setPers3NaturalPlural (CONJ_PREFIX, s);
175 void LangPropPage::thirdMPluralChanged(const QString& s)
177 conjugations.setPers3MalePlural (CONJ_PREFIX, s);
181 void LangPropPage::slotThirdSCommonToggled(bool common)
183 conjugations.setPers3SingularCommon(CONJ_PREFIX, common);
184 thirdN_singular->setEnabled(!common);
185 thirdM_singular->setEnabled(!common);
189 void LangPropPage::slotThirdPCommonToggled(bool common)
191 conjugations.setPers3PluralCommon(CONJ_PREFIX, common);
192 thirdN_plural->setEnabled(!common);
193 thirdM_plural->setEnabled(!common);
197 void LangPropPage::defFemaleChanged(const QString& s)
199 QString def, indef;
200 articles.female(def, indef);
201 articles.setFemale(s, indef);
205 void LangPropPage::indefFemaleChanged(const QString& s)
207 QString def, indef;
208 articles.female(def, indef);
209 articles.setFemale(def, s);
213 void LangPropPage::defMaleChanged(const QString& s)
215 QString def, indef;
216 articles.male(def, indef);
217 articles.setMale(s, indef);
221 void LangPropPage::indefMaleChanged(const QString& s)
223 QString def, indef;
224 articles.male(def, indef);
225 articles.setMale(def, s);
229 void LangPropPage::defNaturalChanged(const QString& s)
231 QString def, indef;
232 articles.natural(def, indef);
233 articles.setNatural(s, indef);
237 void LangPropPage::indefNaturalChanged(const QString& s)
239 QString def, indef;
240 articles.natural(def, indef);
241 articles.setNatural(def, s);
244 #include "LangPropPage.moc"