From: Frederik Gladhorn Date: Thu, 6 Sep 2007 13:42:06 +0000 (+0000) Subject: Fix bugs when reading the inQuery attribute (no default value). X-Git-Tag: v3.94.0~70 X-Git-Url: https://git.rmz.fi/?a=commitdiff_plain;h=dd1b849f9700f6e0b95555db407961867d5ee5ac;p=libqmvoc.git Fix bugs when reading the inQuery attribute (no default value). Make copy ctor, operator=/== complete for the lesson class. svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=709057 --- diff --git a/keduvocdocument/keduvockvtml2reader.cpp b/keduvocdocument/keduvockvtml2reader.cpp index 52e9e3c..5890fb1 100644 --- a/keduvocdocument/keduvockvtml2reader.cpp +++ b/keduvocdocument/keduvockvtml2reader.cpp @@ -449,9 +449,7 @@ bool KEduVocKvtml2Reader::readLesson( QDomElement &lessonElement ) //true currentElement = lessonElement.firstChildElement( KVTML_QUERY ); - if ( !currentElement.isNull() ) { - m_doc->lesson(lessonId).setInQuery(currentElement.text() == KVTML_TRUE); - } + m_doc->lesson(lessonId).setInQuery(currentElement.text() == KVTML_TRUE); //true currentElement = lessonElement.firstChildElement( KVTML_CURRENT ); diff --git a/keduvocdocument/keduvockvtmlreader.cpp b/keduvocdocument/keduvockvtmlreader.cpp index 03f5b96..43af42e 100644 --- a/keduvocdocument/keduvockvtmlreader.cpp +++ b/keduvocdocument/keduvockvtmlreader.cpp @@ -237,10 +237,10 @@ bool KEduVocKvtmlReader::readLesson( QDomElement &domElementParent ) } } - bool inQuery; + bool inQuery = false; attribute = currentElement.attributeNode( KV_LESS_QUERY ); if ( !attribute.isNull() ) { - inQuery = attribute.value().toInt() != 0; + inQuery = (attribute.value().toInt() != 0); } s = currentElement.text(); diff --git a/keduvocdocument/keduvoclesson.cpp b/keduvocdocument/keduvoclesson.cpp index df3346f..665e760 100644 --- a/keduvocdocument/keduvoclesson.cpp +++ b/keduvocdocument/keduvoclesson.cpp @@ -40,6 +40,7 @@ KEduVocLesson::KEduVocLesson( const KEduVocLesson &other ) { d->m_entries = other.d->m_entries; d->m_name = other.d->m_name; + d->m_inQuery = other.d->m_inQuery; } KEduVocLesson::~KEduVocLesson() @@ -51,12 +52,15 @@ KEduVocLesson& KEduVocLesson::operator= ( const KEduVocLesson &other ) { d->m_entries = other.d->m_entries; d->m_name = other.d->m_name; + d->m_inQuery = other.d->m_inQuery; return *this; } bool KEduVocLesson::operator==(const KEduVocLesson &other) { - return d->m_entries == other.d->m_entries && d->m_name == other.d->m_name; + return d->m_entries == other.d->m_entries && + d->m_name == other.d->m_name && + d->m_inQuery == other.d->m_inQuery;; } void KEduVocLesson::setName( const QString &name )