Version: 4.0.0 (using KDE 4.4.4) OS: Linux Page history in the Documentation toolview doesn't work the way one would usually expect, and the way web browsers and other programs work. Going back and switching to another page just adds the new page at the end of the history list, without removing items that followed the current history location, so going back again doesn't take you to the page you were viewing before switching pages. Reproducible: Always Steps to Reproduce: - Open documentation for QWidget. - Click on QAbstractButton from inheritance list. The QAbstractButton page loads. - Click the Back button. You return to QWidget. - Click on QDialog from inheritance list. The QDialog page loads. - Click the Back button. I'd expect to return to QWidget, but I'm taken to QAbstractButton instead. (Mostly note to self in case I get around to fixing it myself.) The fix would be in DocumentationView::addHistory in kdevplatform shell/documentationview.cpp. Probably clearing mHistory items between mCurrent and mHistory.end(). Watch out for off-by-one when doing that. Also should investigate if it's possible to write tests. By the way, the bugzilla component "documentation viewer" is in the kdevelop product, however it's actually part of kdevplatform.
commit 9611a4c2ad0f5430f2fa4a69e53e389458426b35 Author: Nicolás Alvarez <nicolas.alvarez@gmail.com> Date: Fri Jul 23 21:08:55 2010 -0300 Fix behavior of page history in the documentation viewer. BUG:245279 diff --git a/shell/documentationview.cpp b/shell/documentationview.cpp index fe4e0e1..71486f3 100644 --- a/shell/documentationview.cpp +++ b/shell/documentationview.cpp @@ -180,6 +180,15 @@ void DocumentationView::addHistory(KSharedPtr< KDevelop::IDocumentation > doc) { mBack->setEnabled( !mHistory.isEmpty() ); mForward->setEnabled(false); + + // clear all history following the current item, unless we're already + // at the end (otherwise this code crashes when history is empty, which + // happens when addHistory is first called on startup to add the + // homepage) + if (mCurrent+1 < mHistory.end()) { + mHistory.erase(mCurrent+1, mHistory.end()); + } + mHistory.append(doc); mCurrent=mHistory.end()-1; }
commit 776ebc2360fb54d5f2e3aed75ff7be9b7527e07b Author: Nicolás Alvarez <nicolas.alvarez@gmail.com> Date: Fri Jul 23 21:08:55 2010 -0300 backport to stable: Fix behavior of page history in the documentation viewer. BUG:245279 diff --git a/shell/documentationview.cpp b/shell/documentationview.cpp index fe4e0e1..71486f3 100644 --- a/shell/documentationview.cpp +++ b/shell/documentationview.cpp @@ -180,6 +180,15 @@ void DocumentationView::addHistory(KSharedPtr< KDevelop::IDocumentation > doc) { mBack->setEnabled( !mHistory.isEmpty() ); mForward->setEnabled(false); + + // clear all history following the current item, unless we're already + // at the end (otherwise this code crashes when history is empty, which + // happens when addHistory is first called on startup to add the + // homepage) + if (mCurrent+1 < mHistory.end()) { + mHistory.erase(mCurrent+1, mHistory.end()); + } + mHistory.append(doc); mCurrent=mHistory.end()-1; }
commit 88171a9a7e301406567dde04ebe6237d5d4d4d17 Author: Nicolás Alvarez <nicolas.alvarez@gmail.com> Date: Fri Jul 23 21:08:55 2010 -0300 Fix behavior of page history in the documentation viewer. BUG:245279 diff --git a/shell/documentationview.cpp b/shell/documentationview.cpp index fe4e0e1..71486f3 100644 --- a/shell/documentationview.cpp +++ b/shell/documentationview.cpp @@ -180,6 +180,15 @@ void DocumentationView::addHistory(KSharedPtr< KDevelop::IDocumentation > doc) { mBack->setEnabled( !mHistory.isEmpty() ); mForward->setEnabled(false); + + // clear all history following the current item, unless we're already + // at the end (otherwise this code crashes when history is empty, which + // happens when addHistory is first called on startup to add the + // homepage) + if (mCurrent+1 < mHistory.end()) { + mHistory.erase(mCurrent+1, mHistory.end()); + } + mHistory.append(doc); mCurrent=mHistory.end()-1; }