From: <sv...@va...> - 2010-02-13 00:03:14
|
Author: cerion Date: 2010-02-13 00:03:03 +0000 (Sat, 13 Feb 2010) New Revision: 475 Log: fixed help history bug: list with one entry dies. Modified: branches/valkyrie_qt4port/help/help_handbook.cpp Modified: branches/valkyrie_qt4port/help/help_handbook.cpp =================================================================== --- branches/valkyrie_qt4port/help/help_handbook.cpp 2010-02-03 00:45:34 UTC (rev 474) +++ branches/valkyrie_qt4port/help/help_handbook.cpp 2010-02-13 00:03:03 UTC (rev 475) @@ -247,13 +247,20 @@ bool found = false; foreach( QAction* act, historyMenu->actions() ) { if ( act->text() == link ) { + historyMenu->removeAction( act ); if ( found ) { - // shouldn't ever get here, but just in case. - historyMenu->removeAction( act ); + // found more than once! + VK_DEBUG( "found double entry in historyMenu: ", qPrintable( act->text() ) ); + } else { + if ( ! historyMenu->actions().isEmpty() ) { + historyMenu->insertAction( historyMenu->actions().first(), act ); + } else { + historyMenu->addAction( act ); + } + found = true; + + // continue looking though the list, to check for double entries. } - historyMenu->removeAction( act ); - historyMenu->insertAction( historyMenu->actions().first(), act ); - found = true; } } if ( !found ) { |