1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

[Fix] Fixed showing empty back/forward history menus.

This commit is contained in:
nowrep 2013-03-13 11:54:58 +01:00
parent eeb1231c75
commit a9cee1fffe

View File

@ -209,11 +209,10 @@ void NavigationBar::aboutToShowHistoryBackMenu()
int curindex = history->currentItemIndex(); int curindex = history->currentItemIndex();
int count = 0; int count = 0;
QUrl lastUrl = history->currentItem().url();
for (int i = curindex - 1; i >= 0; i--) { for (int i = curindex - 1; i >= 0; i--) {
QWebHistoryItem item = history->itemAt(i); QWebHistoryItem item = history->itemAt(i);
if (item.isValid() && lastUrl != item.url()) { if (item.isValid()) {
QString title = titleForUrl(item.title(), item.url()); QString title = titleForUrl(item.title(), item.url());
const QIcon &icon = iconForPage(item.url(), qIconProvider->standardIcon(QStyle::SP_ArrowBack)); const QIcon &icon = iconForPage(item.url(), qIconProvider->standardIcon(QStyle::SP_ArrowBack));
@ -222,8 +221,6 @@ void NavigationBar::aboutToShowHistoryBackMenu()
connect(act, SIGNAL(triggered()), this, SLOT(goAtHistoryIndex())); connect(act, SIGNAL(triggered()), this, SLOT(goAtHistoryIndex()));
connect(act, SIGNAL(middleClicked()), this, SLOT(goAtHistoryIndexInNewTab())); connect(act, SIGNAL(middleClicked()), this, SLOT(goAtHistoryIndexInNewTab()));
m_menuBack->addAction(act); m_menuBack->addAction(act);
lastUrl = item.url();
} }
count++; count++;
@ -246,11 +243,10 @@ void NavigationBar::aboutToShowHistoryNextMenu()
QWebHistory* history = p_QupZilla->weView()->history(); QWebHistory* history = p_QupZilla->weView()->history();
int curindex = history->currentItemIndex(); int curindex = history->currentItemIndex();
int count = 0; int count = 0;
QUrl lastUrl = history->currentItem().url();
for (int i = curindex + 1; i < history->count(); i++) { for (int i = curindex + 1; i < history->count(); i++) {
QWebHistoryItem item = history->itemAt(i); QWebHistoryItem item = history->itemAt(i);
if (item.isValid() && lastUrl != item.url()) { if (item.isValid()) {
QString title = titleForUrl(item.title(), item.url()); QString title = titleForUrl(item.title(), item.url());
const QIcon &icon = iconForPage(item.url(), qIconProvider->standardIcon(QStyle::SP_ArrowForward)); const QIcon &icon = iconForPage(item.url(), qIconProvider->standardIcon(QStyle::SP_ArrowForward));
@ -259,8 +255,6 @@ void NavigationBar::aboutToShowHistoryNextMenu()
connect(act, SIGNAL(triggered()), this, SLOT(goAtHistoryIndex())); connect(act, SIGNAL(triggered()), this, SLOT(goAtHistoryIndex()));
connect(act, SIGNAL(middleClicked()), this, SLOT(goAtHistoryIndexInNewTab())); connect(act, SIGNAL(middleClicked()), this, SLOT(goAtHistoryIndexInNewTab()));
m_menuForward->addAction(act); m_menuForward->addAction(act);
lastUrl = item.url();
} }
count++; count++;