1
/***************************************************************************
2
create a KEduVocDocument from a Pauker file
3
-----------------------------------------------------------------------
4
copyright : (C) 2004, 2007 Peter Hedlund <peter.hedlund@kdemail.net>
6
***************************************************************************/
8
/***************************************************************************
10
* This program is free software; you can redistribute it and/or modify *
11
* it under the terms of the GNU General Public License as published by *
12
* the Free Software Foundation; either version 2 of the License, or *
13
* (at your option) any later version. *
15
***************************************************************************/
17
#include "keduvocpaukerreader.h"
23
#include "keduvocexpression.h"
24
#include "keduvoclesson.h"
25
#include "keduvocdocument.h"
27
KEduVocPaukerReader::KEduVocPaukerReader( KEduVocDocument * doc )
33
bool KEduVocPaukerReader::read( QIODevice * device )
40
if ( isStartElement() ) {
41
if ( name() == "Lesson" )
44
raiseError( i18n( "This is not a Pauker document" ) );
52
void KEduVocPaukerReader::readUnknownElement()
60
if ( isStartElement() )
66
void KEduVocPaukerReader::readPauker()
68
m_doc->setAuthor( "http://pauker.sf.net" );
69
///Pauker does not provide any column titles
70
m_doc->appendIdentifier();
71
m_doc->appendIdentifier();
79
if ( isStartElement() ) {
80
if ( name() == "Description" )
81
m_doc->setDocumentComment( readElementText() );
82
else if ( name() == "Batch" )
91
void KEduVocPaukerReader::readBatch()
99
if ( isStartElement() ) {
100
if ( name() == "Card" )
103
readUnknownElement();
109
void KEduVocPaukerReader::readCard()
117
if ( isEndElement() )
120
if ( isStartElement() ) {
121
if ( name() == "FrontSide" )
123
else if ( name() == "ReverseSide" )
126
readUnknownElement();
130
KEduVocLesson* lesson = new KEduVocLesson(i18n("Vocabulary"), m_doc->lesson());
131
m_doc->lesson()->appendChildContainer(lesson);
133
KEduVocExpression* expr = new KEduVocExpression( QStringList() << front << back);
134
lesson->appendEntry( expr );
138
QString KEduVocPaukerReader::readText()
145
if ( isEndElement() )
148
if ( isStartElement() ) {
149
if ( name() == "Text" )
150
result = readElementText();
152
readUnknownElement();