#include <qstringlist.h>
#include <qtoolbutton.h>
-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" );
return m_name;
}
+ /**
+ * sets the internal list of items to @p list
+ */
void setItemlist( QValueList<GlossaryItem*> 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<GlossaryItem*>
+ */
+ virtual QValueList<GlossaryItem*> readItems( QDomDocument &itemDocument );
+
/**
* Read a glossary from an XML file.
*
* @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<GlossaryItem*> readItems( QDomDocument &itemDocument );
-
bool loadLayout( QDomDocument&, const KURL& url );
-
+
QValueList<GlossaryItem*> m_itemlist;
+ /**
+ * the name of the glossary
+ */
QString m_name;
};