1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56:34 +01:00

History back/forward items count limited to 20

This commit is contained in:
nowrep 2011-08-23 17:49:21 +02:00
parent c93dbdaba2
commit 5853d72947
2 changed files with 12 additions and 0 deletions

View File

@ -548,6 +548,8 @@ void QupZilla::aboutToShowHistoryBackMenu()
m_menuBack->clear(); m_menuBack->clear();
QWebHistory* history = weView()->history(); QWebHistory* history = weView()->history();
int curindex = history->currentItemIndex(); int curindex = history->currentItemIndex();
int count = 0;
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()) { if (item.isValid()) {
@ -558,7 +560,10 @@ void QupZilla::aboutToShowHistoryBackMenu()
} }
QAction* action = m_menuBack->addAction(_iconForUrl(item.url()),title, this, SLOT(goAtHistoryIndex())); QAction* action = m_menuBack->addAction(_iconForUrl(item.url()),title, this, SLOT(goAtHistoryIndex()));
action->setData(i); action->setData(i);
count++;
} }
if (count == 20)
break;
} }
} }
@ -569,6 +574,8 @@ void QupZilla::aboutToShowHistoryNextMenu()
m_menuForward->clear(); m_menuForward->clear();
QWebHistory* history = weView()->history(); QWebHistory* history = weView()->history();
int curindex = history->currentItemIndex(); int curindex = history->currentItemIndex();
int count = 0;
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()) { if (item.isValid()) {
@ -579,7 +586,10 @@ void QupZilla::aboutToShowHistoryNextMenu()
} }
QAction* action = m_menuForward->addAction(_iconForUrl(item.url()),title, this, SLOT(goAtHistoryIndex())); QAction* action = m_menuForward->addAction(_iconForUrl(item.url()),title, this, SLOT(goAtHistoryIndex()));
action->setData(i); action->setData(i);
count++;
} }
if (count == 20)
break;
} }
} }

View File

@ -246,6 +246,8 @@ void WebView::loadFinished(bool state)
p_QupZilla->buttonReload()->setVisible(true); p_QupZilla->buttonReload()->setVisible(true);
p_QupZilla->ipLabel()->show(); p_QupZilla->ipLabel()->show();
} }
emit urlChanged(url());
} }
void WebView::titleChanged() void WebView::titleChanged()