From 5db354eba414aac5945643c8b3933a46dc47a0b2 Mon Sep 17 00:00:00 2001 From: Carsten Niehaus Date: Sun, 24 Jul 2005 12:06:03 +0000 Subject: [PATCH] fix the use of -tag svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=438119 --- kdeeduui/kdeeduglossary.cpp | 23 +++++++++++++---------- kdeeduui/kdeeduglossary.h | 3 ++- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/kdeeduui/kdeeduglossary.cpp b/kdeeduui/kdeeduglossary.cpp index 3a1da51..7979028 100644 --- a/kdeeduui/kdeeduglossary.cpp +++ b/kdeeduui/kdeeduglossary.cpp @@ -70,11 +70,13 @@ bool Glossary::isEmpty() const } -Glossary* Glossary::readFromXML( const KURL& url ) +Glossary* Glossary::readFromXML( const KURL& url, const QString& path ) { QDomDocument doc( "document" ); Glossary *glossary = new Glossary(); + + glossary->setPicturePath( path ); if ( glossary->loadLayout( doc, url ) ) { @@ -98,8 +100,8 @@ void Glossary::fixImagePath() for ( ; it != itEnd ; ++it ) { - ( *it )->desc().replace("[img]", firstpart ); - ( *it )->desc().replace("[/img]", "\" />" ); + ( *it )->setDesc( ( *it )->desc().replace("[img]", firstpart ) ); + ( *it )->setDesc( ( *it )->desc().replace("[/img]", "\" />" ) ); } } @@ -124,9 +126,11 @@ QValueList Glossary::readItems( QDomDocument &itemDocument ) QDomNode nameNode = itemElement.namedItem( "name" ); QDomNode descNode = itemElement.namedItem( "desc" ); + QString picName = itemElement.namedItem( "picture" ).toElement().text(); QDomElement refNode = ( const QDomElement& ) itemElement.namedItem( "references" ).toElement(); QString desc = descNode.toElement().text(); + desc.prepend("[img]"+picName +"[/img]" ); desc.replace("[b]", "" ); desc.replace("[/b]", "" ); desc.replace("[i]", "" ); @@ -151,9 +155,9 @@ QValueList Glossary::readItems( QDomDocument &itemDocument ) GlossaryDialog::GlossaryDialog( bool folded, QWidget *parent, const char *name) - : KDialogBase( Plain, i18n( "Glossary" ), Close, Close, parent, name, false ) + : KDialogBase( Plain, i18n( "Glossary" ), Close, NoDefault, parent, name, false ) { - //this string will be used for all items. If a backgroundpicutures should + //this string will be used for all items. If a backgroundpicture should //be used call Glossary::setBackgroundPicture(). m_htmlbasestring = "" ; @@ -236,8 +240,8 @@ void GlossaryDialog::updateTree() { m_glosstree->clear(); - QValueList::iterator itGl = m_glossaries.begin(); - const QValueList::iterator itGlEnd = m_glossaries.end(); + QValueList::const_iterator itGl = m_glossaries.begin(); + const QValueList::const_iterator itGlEnd = m_glossaries.end(); for ( ; itGl != itGlEnd ; ++itGl ) { @@ -316,8 +320,8 @@ void GlossaryDialog::slotClicked( QListViewItem *item ) while ( !found && itGl != itGlEnd ) { QValueList items = ( *itGl )->itemlist(); - QValueList::iterator it = items.begin(); - const QValueList::iterator itEnd = items.end(); + QValueList::const_iterator it = items.begin(); + const QValueList::const_iterator itEnd = items.end(); while ( !found && it != itEnd ) { if ( ( *it )->name() == item->text( 0 ) ) @@ -345,7 +349,6 @@ void GlossaryDialog::slotClicked( QListViewItem *item ) m_htmlpart->begin(); m_htmlpart->write( html ); - kdDebug() << "the html " << html << endl; m_htmlpart->end(); return; } diff --git a/kdeeduui/kdeeduglossary.h b/kdeeduui/kdeeduglossary.h index 0eaf632..bd60958 100644 --- a/kdeeduui/kdeeduglossary.h +++ b/kdeeduui/kdeeduglossary.h @@ -89,11 +89,12 @@ class Glossary * Read a glossary from an XML file. * * @param url The path of the file to load + * @param path The path of the pictures. Will be used as m_picturepath * * @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 ); + static Glossary* readFromXML( const KURL& url, const QString& path = 0 ); /** * Every glossaryitem can show pictures. [img src="foo.png] -- 2.47.3