From 8b9594b68d04c11d04f00fdca2572c5ba2c90e9a Mon Sep 17 00:00:00 2001 From: Dario Freddi Date: Thu, 15 Oct 2009 14:18:05 +0200 Subject: Fix a bug where the history index goes wrong after the first turning back. This bug was present also before my previous commit Signed-off-by: Dario Freddi --- src/mainwindow.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 79e20dbd..7f2bcdeb 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1058,9 +1058,10 @@ void MainWindow::slotAboutToShowBackMenu() int limit = 0; for (int i = history->backItems(historyCount).count() - 1; i >= 0; --i) { + qDebug() << history->currentItemIndex(); QWebHistoryItem item = history->backItems(history->count()).at(i); KAction *action = new KAction(this); - action->setData(-1*(historyCount - i - 1)); + action->setData(history->currentItemIndex() - (i + 1)); QIcon icon = Application::icon(item.url()); action->setIcon(icon); action->setText(item.title()); @@ -1077,9 +1078,11 @@ void MainWindow::slotOpenActionUrl(QAction *action) { int offset = action->data().toInt(); QWebHistory *history = currentTab()->history(); + qDebug() << offset; + qDebug() << history->itemAt(offset).isValid(); if (offset < 0) { - history->goToItem(history->backItems(-1*offset).first()); // back + history->goToItem(history->itemAt(offset)); // back } else { -- cgit v1.2.1