From: Carsten Niehaus Date: Mon, 4 Jul 2005 11:20:20 +0000 (+0000) Subject: * make one methods virtual X-Git-Tag: v3.4.90~18 X-Git-Url: https://git.rmz.fi/?a=commitdiff_plain;h=8c938aebeb4546e386af8f0a046ddf639982d980;p=libqmvoc.git * make one methods virtual * API-DOC * rename some parameters * make more code work svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=431447 --- diff --git a/kdeeduui/kdeeduglossary.cpp b/kdeeduui/kdeeduglossary.cpp index fad0048..f6b0208 100644 --- a/kdeeduui/kdeeduglossary.cpp +++ b/kdeeduui/kdeeduglossary.cpp @@ -29,29 +29,29 @@ #include #include -bool Glossary::loadLayout( QDomDocument &questionDocument, const KURL& url ) +bool Glossary::loadLayout( QDomDocument &Document, const KURL& url ) { QFile layoutFile( url.path() ); if (!layoutFile.exists()) kdDebug() << "no such file: " << layoutFile.name() << endl; -//X -//X //TODO really needed? -//X if (!layoutFile.open(IO_ReadOnly)) -//X return false; -//X -//X ///Check if document is well-formed -//X if (!questionDocument.setContent(&layoutFile)) -//X { -//X kdDebug() << "wrong xml" << endl; -//X layoutFile.close(); -//X return false; -//X } -//X layoutFile.close(); + + if (!layoutFile.open(IO_ReadOnly)) + return false; + + ///Check if document is well-formed + if (!Document.setContent(&layoutFile)) + { + kdDebug() << "wrong xml" << endl; + layoutFile.close(); + return false; + } + layoutFile.close(); return true; } + Glossary* Glossary::readFromXML( const KURL& url ) { QDomDocument doc( "document" ); diff --git a/kdeeduui/kdeeduglossary.h b/kdeeduui/kdeeduglossary.h index 63e9543..e8c11ee 100644 --- a/kdeeduui/kdeeduglossary.h +++ b/kdeeduui/kdeeduglossary.h @@ -69,10 +69,23 @@ class Glossary return m_name; } + /** + * sets the internal list of items to @p list + */ void setItemlist( QValueList list ){ m_itemlist = list; } + static Glossary* readFromXML( const KURL& url ); + + private: + /** + * This methods parses the given xml-code. It will extract + * the information of the items and return them as a + * QValueList + */ + virtual QValueList readItems( QDomDocument &itemDocument ); + /** * Read a glossary from an XML file. * @@ -81,15 +94,13 @@ class Glossary * @return a pointer to the loaded glossary. Even in case of * error, this won't return 0 but an empty Glossary. */ - static Glossary* readFromXML( const KURL& url ); - - private: - QValueList readItems( QDomDocument &itemDocument ); - bool loadLayout( QDomDocument&, const KURL& url ); - + QValueList m_itemlist; + /** + * the name of the glossary + */ QString m_name; };