#include <QtCore/QTextStream>
#include <QtCore/QList>
-#include <QtCore/QIODevice>
+// #include <QtCore/QIODevice>
+#include <QDebug>
+#include <QFile>
-#include <klocale.h>
+// #include <klocale.h>
#include "keduvocdocument.h"
#include "keduvoclesson.h"
#include "keduvockvtmlreader.h"
#include "keduvoccommon_p.h"
-#include <KDebug>
+// #include <KDebug>
-KEduVocKvtml2Reader::KEduVocKvtml2Reader( QIODevice *file )
+KEduVocKvtml2Reader::KEduVocKvtml2Reader( QFile *file )
: m_inputFile( file )
{
// the file must be already open
if ( !m_inputFile->isOpen() ) {
- m_errorMessage = i18n( "file must be opened first" );
+ m_errorMessage = "file must be opened first" ;
}
+ qDebug("KEduVocKvtml2Reader constructor");
}
bool KEduVocKvtml2Reader::readDoc( KEduVocDocument *doc )
{
+ qDebug("KEduVocKvtml2Reader::readDoc");
m_doc = doc;
QDomDocument domDoc( "KEduVocDocument" );
QDomElement domElementKvtml = domDoc.documentElement();
if ( domElementKvtml.tagName() != KVTML_TAG ) {
- m_errorMessage = i18n( "This is not a KDE Vocabulary document." );
+ m_errorMessage = "This is not a KDE Vocabulary document." ;
return false;
}
if ( !groupElement.isNull() ) {
QDomNodeList entryList = groupElement.elementsByTagName( KVTML_IDENTIFIER );
if ( entryList.length() <= 0 ) {
- m_errorMessage = i18n( "missing identifier elements from identifiers tag" );
+ m_errorMessage = "missing identifier elements from identifiers tag" ;
return false;
}
}
// Additional cleanup: Put orphaned entries without a lesson into a default lesson.
- KEduVocLesson *defaultLesson = new KEduVocLesson(i18n("Default Lesson"), m_doc->lesson());
+ KEduVocLesson *defaultLesson = new KEduVocLesson("Default Lesson", m_doc->lesson());
// now make sure we don't have any orphan entries
foreach (KEduVocExpression * entry, m_allEntries) {
bool result = true;
int id = identifierElement.attribute( KVTML_ID ).toInt( &result );
if ( !result ) {
- m_errorMessage = i18n( "identifier missing id" );
+ m_errorMessage = "identifier missing id" ;
return false;
}
// get entry id
int id = entryElement.attribute( KVTML_ID ).toInt( &result );
if ( !result ) {
- m_errorMessage = i18n( "entry missing id" );
+ m_errorMessage = "entry missing id" ;
return false;
}
}
if ( expr->translationIndices().size() == 0 ) {
- kDebug() << "Found entry with no words in it." << id;
+ qDebug() << "Found entry with no words in it." << id;
expr->setTranslation(0, QString());
}
// image
currentElement = translationElement.firstChildElement( KVTML_IMAGE );
if ( !currentElement.isNull() ) {
- expr->translation(index)->setImageUrl( KUrl( m_doc->url(), currentElement.text() ) );
+ qCritical("Fixme: get image path...");
+ // expr->translation(index)->setImageUrl( KUrl( m_doc->url(), currentElement.text() ) );
}
// sound
currentElement = translationElement.firstChildElement( KVTML_SOUND );
if ( !currentElement.isNull() ) {
- expr->translation(index)->setSoundUrl( KUrl( m_doc->url(), currentElement.text() ) );
+ qCritical("Fixme: get sound path...");
+ // expr->translation(index)->setSoundUrl( KUrl( m_doc->url(), currentElement.text() ) );
}
return true;
}
-#include "keduvockvtml2reader.moc"
+// #include "keduvockvtml2reader.moc"