moved kdeaccessibility kdeaddons kdeadmin kdeartwork kdebindings kdeedu kdegames...
[kdeedu.git] / kvoctrain / kvoctrain / kvt-core / kvd_rb_kvtml1.cpp
blob32cd0fd2de13ed3efc4b2058a7d8f059ce4586d9
1 /***************************************************************************
3 $Id$
5 read big body of a kvtml document
7 -----------------------------------------------------------------------
9 begin : Thu Mar 11 20:50:53 MET 1999
11 copyright : (C) 1999-2001 Ewald Arnold
12 (C) 2001 The KDE-EDU team
13 email : kvoctrain@ewald-arnold.de
15 -----------------------------------------------------------------------
17 ***************************************************************************/
19 /***************************************************************************
20 * *
21 * This program is free software; you can redistribute it and/or modify *
22 * it under the terms of the GNU General Public License as published by *
23 * the Free Software Foundation; either version 2 of the License, or *
24 * (at your option) any later version. *
25 * *
26 ***************************************************************************/
29 #include "QueryManager.h"
30 #include "UsageManager.h"
32 #include <kapplication.h>
33 #include <klocale.h>
34 #include <kmessagebox.h>
36 bool kvoctrainDoc::extract_T_DESCR_attr (XmlReader &xml,
37 XmlElement &elem, int &no)
39 no = 0;
40 list<XmlAttribute>::const_iterator first = elem.attributes ().begin ();
41 while (first != elem.attributes ().end ()) {
42 if ((*first).name () == KV_LESS_NO)
43 no = (*first).intValue();
44 else {
45 if (!unknownAttribute(xml.lineNumber(), "descr", (*first).name ()))
46 return false;
48 first++;
50 return true;
54 bool kvoctrainDoc::extract_T_GROUP_attr (XmlReader &xml,
55 XmlElement &elem)
57 list<XmlAttribute>::const_iterator first = elem.attributes ().begin ();
58 while (first != elem.attributes ().end ()) {
60 if ((*first).name () == KV_SIZEHINT)
61 width = (*first).intValue();
62 else */ {
63 if (!unknownAttribute(xml.lineNumber(), "type", (*first).name ()))
64 return false;
66 first++;
68 return true;
72 bool kvoctrainDoc::loadTypeNameKvtMl (XmlElement elem, XmlReader& xml)
74 bool endOfGroup = false;
75 QString s;
76 type_descr.clear();
78 if (!extract_T_GROUP_attr (xml, elem))
79 return false;
81 do {
82 if (! xml.readElement (elem))
83 break;
85 if (elem.tag () == KV_TYPE_GRP) {
86 if (! elem.isEndTag ()) {
87 errorKvtMl (xml.lineNumber(),
88 i18n("expected ending tag <%1>").arg(KV_TYPE_GRP));
89 return false;
91 else
92 endOfGroup = true;
95 else if (elem.tag () == KV_TYPE_DESC && !elem.isEndTag() ) {
96 int no;
97 if (!extract_T_DESCR_attr (xml, elem, no))
98 return false;
100 if (!xml.readElement (elem)) {
101 errorKvtMl (xml.lineNumber(), i18n("I/O failure") );
102 return false;
105 if (elem.tag() == "#PCDATA") { // element data
106 s = xml.getText();
108 if (! xml.readElement (elem) ) {
109 errorKvtMl (xml.lineNumber(), i18n("I/O failure") );
110 return false;
112 else if (elem.tag() != KV_TYPE_DESC || !elem.isEndTag() ) {
113 errorKvtMl (xml.lineNumber(),
114 i18n("expected ending tag <%1>").arg(KV_TYPE_DESC));
115 return false;
118 else {
119 if (elem.tag() != KV_TYPE_DESC || !elem.isEndTag() ) {
120 errorKvtMl (xml.lineNumber(),
121 i18n("expected ending tag <%1>").arg(KV_TYPE_DESC));
122 return false;
125 s = "";
127 type_descr.push_back (s);
129 else {
130 if (elem.isEndTag() ) {
131 errorKvtMl (xml.lineNumber(),
132 i18n("unexpected ending tag <%1>" ).arg(elem.tag()));
133 return false;
135 else {
136 unknownElement (xml.lineNumber(), elem.tag() );
137 return false;
140 } while (! endOfGroup);
142 return true;
146 bool kvoctrainDoc::loadTenseNameKvtMl (XmlElement elem, XmlReader& xml)
148 bool endOfGroup = false;
149 QString s;
150 tense_descr.clear();
152 if (!extract_T_GROUP_attr (xml, elem))
153 return false;
155 do {
156 if (! xml.readElement (elem))
157 break;
159 if (elem.tag () == KV_TENSE_GRP) {
160 if (! elem.isEndTag ()) {
161 errorKvtMl (xml.lineNumber(),
162 i18n("expected ending tag <%1>").arg(KV_TENSE_GRP));
163 return false;
165 else
166 endOfGroup = true;
169 else if (elem.tag () == KV_TENSE_DESC && !elem.isEndTag() ) {
170 int no;
171 if (!extract_T_DESCR_attr (xml, elem, no))
172 return false;
174 if (!xml.readElement (elem)) {
175 errorKvtMl (xml.lineNumber(), i18n("I/O failure") );
176 return false;
179 if (elem.tag() == "#PCDATA") { // element data
180 s = xml.getText();
182 if (! xml.readElement (elem) ) {
183 errorKvtMl (xml.lineNumber(), i18n("I/O failure") );
184 return false;
186 else if (elem.tag() != KV_TENSE_DESC || !elem.isEndTag() ) {
187 errorKvtMl (xml.lineNumber(),
188 i18n("expected ending tag <%1>").arg(KV_TENSE_DESC));
189 return false;
192 else {
193 if (elem.tag() != KV_TENSE_DESC || !elem.isEndTag() ) {
194 errorKvtMl (xml.lineNumber(),
195 i18n("expected ending tag <%1>").arg(KV_TENSE_DESC));
196 return false;
199 s = "";
201 tense_descr.push_back (s);
203 else {
204 if (elem.isEndTag() ) {
205 errorKvtMl (xml.lineNumber(),
206 i18n("unexpected ending tag <%1>" ).arg(elem.tag()));
207 return false;
209 else {
210 unknownElement (xml.lineNumber(), elem.tag() );
211 return false;
214 } while (! endOfGroup);
216 return true;
220 bool kvoctrainDoc::loadUsageNameKvtMl (XmlElement elem, XmlReader& xml)
222 bool endOfGroup = false;
223 QString s;
224 usage_descr.clear();
226 if (!extract_T_GROUP_attr (xml, elem))
227 return false;
229 do {
230 if (! xml.readElement (elem))
231 break;
233 if (elem.tag () == KV_USAGE_GRP) {
234 if (! elem.isEndTag ()) {
235 errorKvtMl (xml.lineNumber(),
236 i18n("expected ending tag <%1>").arg(KV_USAGE_GRP));
237 return false;
239 else
240 endOfGroup = true;
243 else if (elem.tag () == KV_USAGE_DESC && !elem.isEndTag() ) {
244 int no;
245 if (!extract_T_DESCR_attr (xml, elem, no))
246 return false;
248 if (!xml.readElement (elem)) {
249 errorKvtMl (xml.lineNumber(), i18n("I/O failure") );
250 return false;
253 if (elem.tag() == "#PCDATA") { // element data
254 s = xml.getText();
256 if (! xml.readElement (elem) ) {
257 errorKvtMl (xml.lineNumber(), i18n("I/O failure") );
258 return false;
260 else if (elem.tag() != KV_USAGE_DESC || !elem.isEndTag() ) {
261 errorKvtMl (xml.lineNumber(),
262 i18n("expected ending tag <%1>").arg(KV_USAGE_DESC));
263 return false;
266 else {
267 if (elem.tag() != KV_USAGE_DESC || !elem.isEndTag() ) {
268 errorKvtMl (xml.lineNumber(),
269 i18n("expected ending tag <%1>").arg(KV_USAGE_DESC));
270 return false;
273 s = "";
275 usage_descr.push_back (s);
277 else {
278 if (elem.isEndTag() ) {
279 errorKvtMl (xml.lineNumber(),
280 i18n("unexpected ending tag <%1>" ).arg(elem.tag()));
281 return false;
283 else {
284 unknownElement (xml.lineNumber(), elem.tag() );
285 return false;
288 } while (! endOfGroup);
290 return true;
294 bool kvoctrainDoc::extract_O_T_attr (
295 XmlReader &xml,
296 XmlElement &elem,
297 QString &lang,
298 grade_t &grade, grade_t &rev_grade,
299 int &count, int &rev_count,
300 time_t &date, time_t &rev_date,
301 QString &remark,
302 int &bcount, int &rev_bcount,
303 QString &query_id,
304 QString &pronunce,
305 int &width,
306 QString &type,
307 QString &faux_ami_f,
308 QString &faux_ami_t,
309 QString &synonym,
310 QString &example,
311 QString &antonym,
312 QString &usage,
313 QString &paraphrase)
315 grade = KV_NORM_GRADE;
316 rev_grade = KV_NORM_GRADE;
317 count = 0;
318 rev_count = 0;
319 bcount = 0;
320 rev_bcount = 0;
321 date = 0;
322 rev_date = 0;
323 remark = "";
324 lang = "";
325 query_id = "";
326 pronunce = "";
327 faux_ami_t = "";
328 faux_ami_f = "";
329 synonym = "";
330 example = "";
331 usage = "";
332 paraphrase = "";
333 antonym = "";
334 width = -1;
335 //type = exprtype
336 list<XmlAttribute>::const_iterator first = elem.attributes ().begin ();
337 int pos;
338 while (first != elem.attributes ().end ()) {
340 if ((*first).name () == KV_LANG)
341 lang = (*first).stringValue();
343 else if ((*first).name () == KV_SIZEHINT)
344 width = (*first).intValue();
346 else if ((*first).name () == KV_CHARSET) {
349 else if ((*first).name () == KV_GRADE) {
350 QString s = (*first).stringValue();
352 if ((pos = s.find(';')) >= 1) {
353 grade = s.left(pos).toInt();
354 rev_grade = s.mid(pos+1, s.length()).toInt();
356 else
357 grade = s.toInt();
360 else if ((*first).name () == KV_COUNT) {
361 QString s = (*first).stringValue();
362 if ((pos = s.find(';')) >= 1) {
363 count = s.left(pos).toInt();
364 rev_count = s.mid(pos+1, s.length()).toInt();
366 else
367 count = s.toInt();
370 else if ((*first).name () == KV_BAD) {
371 QString s = (*first).stringValue();
372 if ((pos = s.find(';')) >= 1) {
373 bcount = s.left(pos).toInt();
374 rev_bcount = s.mid(pos+1, s.length()).toInt();
375 } else
376 bcount = s.toInt();
379 else if ((*first).name () == KV_DATE) {
380 QString s = (*first).stringValue();
381 if ((pos = s.find(';')) >= 1) {
382 date = s.left(pos).toInt();
383 rev_date = s.mid(pos+1, s.length()).toInt();
385 else {
386 date = s.toInt();
390 else if ((*first).name () == KV_DATE2) {
391 QString s = (*first).stringValue();
392 if ((pos = s.find(';')) >= 1) {
393 date = decompressDate (s.left(pos));
394 rev_date = decompressDate (s.mid(pos+1, s.length()));
396 else {
397 date = decompressDate (s);
401 else if ((*first).name () == KV_REMARK) {
402 remark = (*first).stringValue();
405 else if ((*first).name () == KV_FAUX_AMI_F) {
406 faux_ami_f = (*first).stringValue();
409 else if ((*first).name () == KV_FAUX_AMI_T) {
410 faux_ami_t = (*first).stringValue();
413 else if ((*first).name () == KV_SYNONYM) {
414 synonym = (*first).stringValue();
417 else if ((*first).name () == KV_EXAMPLE) {
418 example = (*first).stringValue();
421 else if ((*first).name () == KV_USAGE) {
422 usage = (*first).stringValue();
424 if (usage.length() != 0 && usage.left(1) == UL_USER_USAGE) {
425 int num = QMIN(usage.mid (1, 40).toInt(), 1000); // paranioa check
426 if( num > (int) usage_descr.size() ) { // description missing ?
427 QString s;
428 for (int i = usage_descr.size(); i < num; i++) {
429 s.setNum (i+1);
430 s.insert (0, "#"); // invent descr according to number
431 usage_descr.push_back (s);
437 else if ((*first).name () == KV_PARAPHRASE) {
438 paraphrase = (*first).stringValue();
441 else if ((*first).name () == KV_ANTONYM) {
442 antonym = (*first).stringValue();
445 else if ((*first).name () == KV_EXPRTYPE) {
446 type = (*first).stringValue();
447 if (type == "1")
448 type = QM_VERB;
449 else if (type == "2") // convert from pre-0.5 versions
450 type = QM_NOUN;
451 else if (type == "3")
452 type = QM_NAME;
454 if (type.length() != 0 && type.left(1) == QM_USER_TYPE) {
455 int num = QMIN(type.mid (1, 40).toInt(), 1000); // paranoia check
456 if( num > (int) type_descr.size() ) { // description missing ?
457 QString s;
458 for (int i = type_descr.size(); i < num; i++) {
459 s.setNum (i+1);
460 s.insert (0, "#"); // invent descr according to number
461 type_descr.push_back (s);
467 else if ((*first).name () == KV_PRONUNCE) {
468 pronunce = (*first).stringValue();
471 else if ((*first).name () == KV_QUERY) {
472 query_id = (*first).stringValue();
475 else {
476 if (!unknownAttribute(xml.lineNumber(), "o> or <t", (*first).name ()))
477 return false;
479 first++;
482 return true;
486 bool kvoctrainDoc::extract_KVT_E_attr (
487 XmlReader& xml,
488 XmlElement &elem,
489 int &lesson,
490 bool &sel,
491 bool &active,
492 QString &type)
494 lesson = 0;
495 sel = false;
496 active = true;
497 type = "";
498 list<XmlAttribute>::const_iterator first = elem.attributes ().begin ();
499 while (first != elem.attributes ().end ()) {
500 if ((*first).name () == KV_LESS_MEMBER)
501 lesson = (*first).intValue();
502 else if ((*first).name () == KV_SELECTED)
503 sel = (*first).intValue() != 0;
504 else if ((*first).name () == KV_INACTIVE)
505 active = !(*first).intValue() != 0;
506 else if ((*first).name () == KV_EXPRTYPE) {
507 type = (*first).stringValue();
508 if (type == "1")
509 type = QM_VERB;
510 else if (type == "2") // convert from pre-0.5 versions
511 type = QM_NOUN;
512 else if (type == "3")
513 type = QM_NAME;
515 if (type.length() != 0 && type.left(1) == QM_USER_TYPE) {
516 int num = QMIN(type.mid (1, 40).toInt(), 1000); // paranoia check
517 if( num > (int) type_descr.size() ) { // description missing ?
518 QString s;
519 for (int i = type_descr.size(); i < num; i++) {
520 s.setNum (i+1);
521 s.insert (0, "#"); // invent descr according to number
522 type_descr.push_back (s);
527 else {
528 if (!unknownAttribute(xml.lineNumber(), "e", (*first).name ()))
529 return false;
531 first++;
533 return true;
537 bool kvoctrainDoc::loadComparison (Comparison &comp, XmlElement elem,
538 XmlReader &xml)
540 <comparison>
541 <l1>good</l1>
542 <l2>better</l2>
543 <l3>best</l3>
544 </comparison>
547 bool endOfGroup = false;
548 QString s;
549 comp.clear();
551 do {
552 if (! xml.readElement (elem))
553 break;
555 if (elem.tag () == KV_COMPARISON_GRP) {
556 if (! elem.isEndTag ()) {
557 errorKvtMl (xml.lineNumber(),
558 i18n("expected ending tag <%1>").arg(elem.tag()));
559 return false;
561 else
562 endOfGroup = true;
566 else if (elem.tag () == KV_COMP_L1 && !elem.isEndTag() ) {
567 if (!extract_simple_tag (KV_COMP_L1, xml, elem, s))
568 return false;
569 comp.setL1(s);
572 else if (elem.tag () == KV_COMP_L2 && !elem.isEndTag() ) {
573 if (!extract_simple_tag (KV_COMP_L2, xml, elem, s))
574 return false;
575 comp.setL2(s);
578 else if (elem.tag () == KV_COMP_L3 && !elem.isEndTag() ) {
579 if (!extract_simple_tag (KV_COMP_L3, xml, elem, s))
580 return false;
581 comp.setL3(s);
584 else {
585 if (elem.isEndTag() ) {
586 errorKvtMl (xml.lineNumber(),
587 i18n("unexpected ending tag <%1>").arg(elem.tag()));
588 return false;
590 else {
591 unknownElement (xml.lineNumber(), elem.tag() );
592 return false;
595 } while (! endOfGroup);
597 return true;
601 bool kvoctrainDoc::loadMultipleChoice (MultipleChoice &mc, XmlElement elem,
602 XmlReader &xml)
604 <multiplechoice>
605 <mc1>good</mc1>
606 <mc2>better</mc2>
607 <mc3>best</mc3>
608 <mc4>best 2</mc4>
609 <mc5>best 3</mc5>
610 </multiplechoice>
614 bool endOfGroup = false;
615 QString s;
616 mc.clear();
618 do {
619 if (! xml.readElement (elem))
620 break;
622 if (elem.tag () == KV_MULTIPLECHOICE_GRP) {
623 if (! elem.isEndTag ()) {
624 errorKvtMl (xml.lineNumber(),
625 i18n("expected ending tag <%1>").arg(elem.tag()));
626 return false;
628 else
629 endOfGroup = true;
633 else if (elem.tag () == KV_MC_1 && !elem.isEndTag() ) {
634 if (!extract_simple_tag (KV_MC_1, xml, elem, s))
635 return false;
636 mc.setMC1(s);
639 else if (elem.tag () == KV_MC_2 && !elem.isEndTag() ) {
640 if (!extract_simple_tag (KV_MC_2, xml, elem, s))
641 return false;
642 mc.setMC2(s);
645 else if (elem.tag () == KV_MC_3 && !elem.isEndTag() ) {
646 if (!extract_simple_tag (KV_MC_3, xml, elem, s))
647 return false;
648 mc.setMC3(s);
651 else if (elem.tag () == KV_MC_4 && !elem.isEndTag() ) {
652 if (!extract_simple_tag (KV_MC_4, xml, elem, s))
653 return false;
654 mc.setMC4(s);
657 else if (elem.tag () == KV_MC_5 && !elem.isEndTag() ) {
658 if (!extract_simple_tag (KV_MC_5, xml, elem, s))
659 return false;
660 mc.setMC5(s);
663 else {
664 if (elem.isEndTag() ) {
665 errorKvtMl (xml.lineNumber(),
666 i18n("unexpected ending tag <%1>").arg(elem.tag()));
667 return false;
669 else {
670 unknownElement (xml.lineNumber(), elem.tag() );
671 return false;
674 } while (! endOfGroup);
676 mc.normalize();
677 return true;
681 bool kvoctrainDoc::parseBody_kvtml (XmlElement elem, XmlReader& xml)
683 bool endOfBody = false;
684 bool lessgroup = false;
685 bool optgroup = false;
686 bool attrgroup = false;
687 bool tensegroup = false;
688 bool usagegroup = false;
689 bool articlegroup = false;
690 bool conjuggroup = false;
692 int ent_no = 0;
693 int ent_percent = (int) lines / 100;
694 float f_ent_percent = (int) lines / 100.0;
695 if (lines != 0)
696 emit progressChanged(this, 0);
698 do {
699 if (! xml.readElement (elem) ) {
700 errorKvtMl (xml.lineNumber(), i18n("I/O failure") );
701 return false;
704 if (elem.tag () == KV_DOCTYPE) {
705 if (! elem.isEndTag ()) {
706 errorKvtMl (xml.lineNumber(),
707 i18n("expected ending tag <%1>").arg(elem.tag()));
708 return false;
710 else
711 endOfBody = true;
714 else if (elem.tag () == KV_LESS_GRP && !elem.isEndTag() ) {
715 if (lessgroup) {
716 errorKvtMl (xml.lineNumber(),
717 i18n("repeated occurrence of tag <%1>").arg(elem.tag()));
718 return false;
720 lessgroup = true;
721 if (!loadLessonKvtMl (elem, xml))
722 return false;
725 else if (elem.tag () == KV_ARTICLE_GRP && !elem.isEndTag() ) {
726 if (articlegroup) {
727 errorKvtMl (xml.lineNumber(),
728 i18n("repeated occurrence of tag <%1>").arg(elem.tag()));
729 return false;
731 articlegroup = true;
732 if (!loadArticleKvtMl (elem, xml))
733 return false;
736 else if (elem.tag () == KV_CONJUG_GRP && !elem.isEndTag() ) {
737 if (conjuggroup) {
738 errorKvtMl (xml.lineNumber(),
739 i18n("repeated occurrence of tag <%1>").arg(elem.tag()));
740 return false;
742 conjuggroup = true;
743 if (!loadConjugKvtMl (conjugations, KV_CON_ENTRY, elem, xml))
744 return false;
747 else if (elem.tag () == KV_OPTION_GRP && !elem.isEndTag() ) {
748 if (optgroup) {
749 errorKvtMl (xml.lineNumber(),
750 i18n("repeated occurrence of tag <%1>").arg(elem.tag()));
751 return false;
753 optgroup = true;
754 if (!loadOptionsKvtMl (elem, xml))
755 return false;
758 else if (elem.tag () == KV_TYPE_GRP && !elem.isEndTag() ) {
759 if (attrgroup) {
760 errorKvtMl (xml.lineNumber(),
761 i18n("repeated occurrence of tag <%1>").arg(elem.tag()));
762 return false;
764 attrgroup = true;
765 if (!loadTypeNameKvtMl (elem, xml))
766 return false;
769 else if (elem.tag () == KV_TENSE_GRP && !elem.isEndTag() ) {
770 if (tensegroup) {
771 errorKvtMl (xml.lineNumber(),
772 i18n("repeated occurrence of tag <%1>").arg(elem.tag()));
773 return false;
775 tensegroup = true;
776 if (!loadTenseNameKvtMl (elem, xml))
777 return false;
778 // Conjugation::setTenseNames(tense_descr);
781 else if (elem.tag () == KV_USAGE_GRP && !elem.isEndTag() ) {
782 if (usagegroup) {
783 errorKvtMl (xml.lineNumber(),
784 i18n("repeated occurrence of tag <%1>").arg(elem.tag()));
785 return false;
787 usagegroup = true;
788 if (!loadUsageNameKvtMl (elem, xml))
789 return false;
792 else if (elem.tag () == KV_EXPR && !elem.isEndTag() ) {
793 // found expression <e>
795 if (lines != 0) {
796 ent_no++;
797 if (ent_percent != 0 && (ent_no % ent_percent) == 0 )
798 emit progressChanged(this, ent_no / f_ent_percent);
800 if (!parseBody_e (elem, xml)) return false;
803 else {
804 if (elem.isEndTag() ) {
805 errorKvtMl (xml.lineNumber(),
806 i18n("unexpected ending tag <%1>" ).arg(elem.tag()));
807 return false;
809 else {
810 unknownElement (xml.lineNumber(), elem.tag());
811 return false;
815 } while (! endOfBody);
817 return true;
821 bool kvoctrainDoc::unknownAttribute (int line, const QString &name,
822 const QString &attr )
824 if (unknown_attr) // show dialog only once
825 return true; // proceed
827 unknown_attr = true;
829 QString ln = i18n("File:\t%1\nLine:\t%2\n").arg(URL().path()).arg(line);
831 QString format = i18n(
832 "Your document contains an unknown attribute <%1> " // keep trailing space
833 "in tag <%2>.\n"
834 "Maybe your version of KVocTrain is too old, "
835 "or the document is damaged.\n"
836 "If you proceed and save afterwards you are likely to lose data;\n"
837 "do you want to proceed anyway?\n"
839 QString msg = format.arg(attr).arg(name);
841 QApplication::setOverrideCursor( arrowCursor, true );
842 QString s = kapp->makeStdCaption(i18n("Unknown attribute"));
843 bool result = (KMessageBox::warningContinueCancel(0, ln+msg, s) == KMessageBox::Continue);
844 QApplication::restoreOverrideCursor();
845 return result;
849 void kvoctrainDoc::unknownElement (int line, const QString &elem )
851 unknown_elem = true;
853 QString ln = i18n("File:\t%1\nLine:\t%2\n").arg(URL().path()).arg(line);
855 QString format = i18n(
856 "Your document contains an unknown tag <%1>. " // keep trailing space
857 "Maybe your version of KVocTrain is too old, "
858 "or the document is damaged.\n"
859 "Loading is aborted because KVocTrain cannot "
860 "read documents with unknown elements.\n"
862 QString msg = format.arg(elem);
863 QApplication::setOverrideCursor( arrowCursor, true );
864 QString s = kapp->makeStdCaption(i18n("Unknown element"));
865 KMessageBox::sorry(0, ln+msg, s);
866 QApplication::restoreOverrideCursor();
870 void kvoctrainDoc::errorKvtMl (int line, const QString &text )
872 QApplication::setOverrideCursor( arrowCursor, true );
873 QString s = kapp->makeStdCaption(i18n("Error"));
874 QString ln = i18n("File:\t%1\nLine:\t%2\n").arg(URL().path()).arg(line);
876 QString msg = text;
877 KMessageBox::error(0, ln+msg, s);
878 QApplication::restoreOverrideCursor();
882 void kvoctrainDoc::warningKvtMl (int line, const QString &text )
884 QApplication::setOverrideCursor( arrowCursor, true );
885 QString s = kapp->makeStdCaption(i18n("Warning"));
886 QString ln = i18n("File:\t%1\nLine:\t%2\n").arg(URL().path()).arg(line);
887 QString msg = text;
888 KMessageBox::information(0, ln+msg, s);
889 QApplication::restoreOverrideCursor();