moved kdeaccessibility kdeaddons kdeadmin kdeartwork kdebindings kdeedu kdegames...
[kdeedu.git] / kvoctrain / kvoctrain / entry-dialogs / MCEntryPage.cpp
blob6043f9a228cdba505594421d38d306101730bb4c
1 /***************************************************************************
3 dialog page for multiple choice suggestions
5 -----------------------------------------------------------------------
7 begin : Mon Oct 29 18:09:29 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 "MCEntryPage.h"
28 #include "EntryDlg.h"
30 #include <langset.h>
32 #include <qlineedit.h>
35 MCEntryPage::MCEntryPage(EntryDlg *_dlgbook, bool multi_sel, const MultipleChoice &mc, QWidget *parent, const char *name)
36 : MCEntryPageForm( parent, name ), dlgbook(_dlgbook)
38 multiplechoice = mc;
40 connect( mc1Field, SIGNAL(textChanged(const QString&)), SLOT(mc1Changed(const QString&)) );
41 connect( mc2Field, SIGNAL(textChanged(const QString&)), SLOT(mc2Changed(const QString&)) );
42 connect( mc3Field, SIGNAL(textChanged(const QString&)), SLOT(mc3Changed(const QString&)) );
43 connect( mc4Field, SIGNAL(textChanged(const QString&)), SLOT(mc4Changed(const QString&)) );
44 connect( mc5Field, SIGNAL(textChanged(const QString&)), SLOT(mc5Changed(const QString&)) );
46 setData(multi_sel, mc);
50 void MCEntryPage::setData(bool multi_sel, const MultipleChoice &mc)
52 mc1Field->setText (mc.mc1());
53 mc2Field->setText (mc.mc2());
54 mc3Field->setText (mc.mc3());
55 mc4Field->setText (mc.mc4());
56 mc5Field->setText (mc.mc5());
58 if (multi_sel)
60 mc1Field->setEnabled(false);
61 mc2Field->setEnabled(false);
62 mc3Field->setEnabled(false);
63 mc4Field->setEnabled(false);
64 mc5Field->setEnabled(false);
67 setModified(false);
71 void MCEntryPage::mc1Changed(const QString& s)
73 setModified(true);
74 multiplechoice.setMC1 (s);
78 void MCEntryPage::mc2Changed(const QString& s)
80 setModified(true);
81 multiplechoice.setMC2 (s);
85 void MCEntryPage::mc3Changed(const QString& s)
87 setModified(true);
88 multiplechoice.setMC3 (s);
92 void MCEntryPage::mc4Changed(const QString& s)
94 setModified(true);
95 multiplechoice.setMC4 (s);
99 void MCEntryPage::mc5Changed(const QString& s)
101 setModified(true);
102 multiplechoice.setMC5 (s);
106 bool MCEntryPage::isModified()
108 return modified;
112 void MCEntryPage::setModified(bool mod)
114 modified = mod;
115 if (mod)
116 emit sigModified();
120 void MCEntryPage::setEnabled(int enable)
122 bool ena = enable == EntryDlg::EnableAll;
124 mc1Field->setEnabled (ena);
125 mc2Field->setEnabled (ena);
126 mc3Field->setEnabled (ena);
127 mc4Field->setEnabled (ena);
128 mc5Field->setEnabled (ena);
131 #include "MCEntryPage.moc"