From: Carsten Niehaus Date: Tue, 5 Jul 2005 10:47:08 +0000 (+0000) Subject: After disabling half the code it at least is no longer crashing. We now know in which... X-Git-Tag: v3.4.90~14 X-Git-Url: https://git.rmz.fi/?a=commitdiff_plain;h=50196443374f1f4b1370b66a9664d52044875af6;p=libqmvoc.git After disabling half the code it at least is no longer crashing. We now know in which line it really crashes but don't understand why svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=431827 --- diff --git a/kdeeduui/kdeeduglossary.cpp b/kdeeduui/kdeeduglossary.cpp index 0b3c2b1..7939f8c 100644 --- a/kdeeduui/kdeeduglossary.cpp +++ b/kdeeduui/kdeeduglossary.cpp @@ -229,36 +229,53 @@ void GlossaryDialog::displayItem( const KURL& url, const KParts::URLArgs& ) slotClicked( found ); } -void GlossaryDialog::addGlossary( Glossary* newgloss ) +void GlossaryDialog::updateTree() { - m_glossaries.append( newgloss ); - - QValueList::iterator it = newgloss->itemlist().begin(); - const QValueList::iterator itEnd = newgloss->itemlist().end(); + QValueList::iterator itGl = m_glossaries.begin(); + const QValueList::iterator itGlEnd = m_glossaries.end(); - QListViewItem *main = new QListViewItem( m_glosstree, newgloss->name() ); - main->setExpandable( true ); - main->setSelectable( false ); - //XXX TMP!!! - bool foldinsubtrees = true; - for ( ; it != itEnd ; ++it ) + for ( ; itGl != itGlEnd ; ++itGl ) { - if ( foldinsubtrees ) - { - QChar thisletter = ( *it )->name().upper()[0]; - QListViewItem *thisletteritem = findTreeWithLetter( thisletter, main ); - if ( !thisletteritem ) - { - thisletteritem = new QListViewItem( main, thisletter ); - thisletteritem->setExpandable( true ); - thisletteritem->setSelectable( false ); - } - new QListViewItem( thisletteritem, ( *it )->name() ); - } - else - new QListViewItem( main, ( *it )->name() ); + QValueList::iterator it = ( *itGl )->itemlist().begin(); + const QValueList::iterator itEnd = ( *itGl )->itemlist().end(); + + QListViewItem *main = new QListViewItem( m_glosstree, ( *itGl )->name() ); + main->setExpandable( true ); + main->setSelectable( false ); + //XXX TMP!!! + bool foldinsubtrees = true; + + ///FIXME The next line is crashing for some unkown reasons... +//X for ( ; it != itEnd ; ++it ) +//X { +//X if ( foldinsubtrees ) +//X { +//X QChar thisletter = ( *it )->name().upper()[0]; + //X QListViewItem *thisletteritem = findTreeWithLetter( thisletter, main ); + //X if ( !thisletteritem ) + //X { + //X thisletteritem = new QListViewItem( main, thisletter ); + //X thisletteritem->setExpandable( true ); + //X thisletteritem->setSelectable( false ); + //X } + //X new QListViewItem( thisletteritem, ( *it )->name() ); +//X } + //X else + //X new QListViewItem( main, ( *it )->name() ); +//X } +//X main->sort(); } - main->sort(); +} + +void GlossaryDialog::addGlossary( Glossary* newgloss ) +{ + if ( !newgloss ) return; + m_glossaries.append( newgloss ); + + kdDebug() << "Count of the new glossary: " << newgloss->itemlist().count() << endl; + kdDebug() << "Number of glossaries: " << m_glossaries.count() << endl; + + updateTree(); } QListViewItem* GlossaryDialog::findTreeWithLetter( const QChar& l, QListViewItem* i ) @@ -277,41 +294,41 @@ void GlossaryDialog::slotClicked( QListViewItem *item ) { if ( !item ) return; - - QString html = m_htmlbasestring; - - /** - * The next lines are searching for the correct KnowledgeItem - * in the m_itemList. When it is found the HTML will be - * generated - */ - QValueList::iterator itGl = m_glossaries.begin(); - const QValueList::iterator itGlEnd = m_glossaries.end(); - bool found = false; - GlossaryItem *i = 0; - while ( !found && itGl != itGlEnd ) - { - QValueList::iterator it = ( *itGl )->itemlist().begin(); - const QValueList::iterator itEnd = ( *itGl )->itemlist().end(); - while ( !found && it != itEnd ) - { - if ( ( *it )->name() == item->text( 0 ) ) - { - i = *it; - found = true; - } - ++it; - } - ++itGl; - } - if ( found && i ) - { - html += i->toHtml() + ""; - m_htmlpart->begin(); - m_htmlpart->write( html ); - m_htmlpart->end(); - return; - } +//X +//X QString html = m_htmlbasestring; +//X +//X /** +//X * The next lines are searching for the correct KnowledgeItem +//X * in the m_itemList. When it is found the HTML will be +//X * generated +//X */ +//X QValueList::iterator itGl = m_glossaries.begin(); +//X const QValueList::iterator itGlEnd = m_glossaries.end(); +//X bool found = false; +//X GlossaryItem *i = 0; +//X while ( !found && itGl != itGlEnd ) +//X { +//X QValueList::iterator it = ( *itGl )->itemlist().begin(); +//X const QValueList::iterator itEnd = ( *itGl )->itemlist().end(); +//X while ( !found && it != itEnd ) +//X { +//X if ( ( *it )->name() == item->text( 0 ) ) +//X { +//X i = *it; +//X found = true; +//X } +//X ++it; +//X } +//X ++itGl; +//X } +//X if ( found && i ) +//X { +//X html += i->toHtml() + ""; +//X m_htmlpart->begin(); +//X m_htmlpart->write( html ); +//X m_htmlpart->end(); +//X return; +//X } } void GlossaryDialog::slotClose() diff --git a/kdeeduui/kdeeduglossary.h b/kdeeduui/kdeeduglossary.h index 85d2b5e..837556d 100644 --- a/kdeeduui/kdeeduglossary.h +++ b/kdeeduui/kdeeduglossary.h @@ -70,7 +70,8 @@ class Glossary * @returns the name of the glossary */ QString name()const{ - return m_name; + return "GlossaryName"; +//X return m_name; } /** @@ -150,7 +151,8 @@ class GlossaryItem } QString name() const { - return m_name; + return "moin moin"; +//X return m_name; } QString desc() const { @@ -198,9 +200,10 @@ class GlossaryDialog : public KDialogBase */ void addGlossary( Glossary* newgloss ); - private: QValueList m_glossaries; + + void updateTree(); KHTMLPart *m_htmlpart; QString m_htmlbasestring;