mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 02:36:34 +01:00
Fixed history in frames. Closes #361
This commit is contained in:
parent
79a548b365
commit
6b79ca55bf
@ -57,7 +57,6 @@
|
||||
#include "webinspectordockwidget.h"
|
||||
#include "bookmarksimportdialog.h"
|
||||
#include "globalfunctions.h"
|
||||
#include "webhistorywrapper.h"
|
||||
#include "enhancedmenu.h"
|
||||
#include "settings.h"
|
||||
#include "webtab.h"
|
||||
@ -77,6 +76,7 @@
|
||||
#include <QDesktopServices>
|
||||
#include <QPrintPreviewDialog>
|
||||
#include <QWebFrame>
|
||||
#include <QWebHistory>
|
||||
#include <QMessageBox>
|
||||
|
||||
const QString QupZilla::VERSION = "1.1.8";
|
||||
@ -813,12 +813,13 @@ void QupZilla::aboutToShowBookmarksMenu()
|
||||
|
||||
void QupZilla::aboutToShowHistoryMenu()
|
||||
{
|
||||
if (!weView()) {
|
||||
TabbedWebView* view = weView();
|
||||
if (!view) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_menuHistory->actions().at(0)->setEnabled(WebHistoryWrapper::canGoBack(weView()->history()));
|
||||
m_menuHistory->actions().at(1)->setEnabled(WebHistoryWrapper::canGoForward(weView()->history()));
|
||||
m_menuHistory->actions().at(0)->setEnabled(view->history()->canGoBack());
|
||||
m_menuHistory->actions().at(1)->setEnabled(view->history()->canGoForward());
|
||||
}
|
||||
|
||||
void QupZilla::aboutToHideHistoryMenu()
|
||||
|
@ -305,26 +305,25 @@ void NavigationBar::refreshHistory()
|
||||
}
|
||||
|
||||
QWebHistory* history = p_QupZilla->weView()->page()->history();
|
||||
m_buttonBack->setEnabled(WebHistoryWrapper::canGoBack(history));
|
||||
m_buttonNext->setEnabled(WebHistoryWrapper::canGoForward(history));
|
||||
m_buttonBack->setEnabled(history->canGoBack());
|
||||
m_buttonNext->setEnabled(history->canGoForward());
|
||||
}
|
||||
|
||||
void NavigationBar::goBack()
|
||||
{
|
||||
QWebHistory* history = p_QupZilla->weView()->page()->history();
|
||||
WebHistoryWrapper::goBack(history);
|
||||
history->back();
|
||||
}
|
||||
|
||||
void NavigationBar::goBackInNewTab()
|
||||
{
|
||||
QWebHistory* history = p_QupZilla->weView()->page()->history();
|
||||
QList<QWebHistoryItem> backItems = WebHistoryWrapper::backItems(1, history);
|
||||
|
||||
if (backItems.isEmpty()) {
|
||||
if (!history->canGoBack()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int itemIndex = WebHistoryWrapper::indexOfItem(history->items(), backItems.at(0));
|
||||
int itemIndex = WebHistoryWrapper::indexOfItem(history->items(), history->backItem());
|
||||
if (itemIndex == -1) {
|
||||
return;
|
||||
}
|
||||
@ -335,19 +334,18 @@ void NavigationBar::goBackInNewTab()
|
||||
void NavigationBar::goForward()
|
||||
{
|
||||
QWebHistory* history = p_QupZilla->weView()->page()->history();
|
||||
WebHistoryWrapper::goForward(history);
|
||||
history->forward();
|
||||
}
|
||||
|
||||
void NavigationBar::goForwardInNewTab()
|
||||
{
|
||||
QWebHistory* history = p_QupZilla->weView()->page()->history();
|
||||
QList<QWebHistoryItem> forwardItems = WebHistoryWrapper::forwardItems(1, history);
|
||||
|
||||
if (forwardItems.isEmpty()) {
|
||||
if (!history->canGoForward()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int itemIndex = WebHistoryWrapper::indexOfItem(history->items(), forwardItems.at(0));
|
||||
int itemIndex = WebHistoryWrapper::indexOfItem(history->items(), history->forwardItem());
|
||||
if (itemIndex == -1) {
|
||||
return;
|
||||
}
|
||||
|
@ -18,12 +18,9 @@
|
||||
#include "webhistorywrapper.h"
|
||||
|
||||
#include <QUrl>
|
||||
#include <QVariant>
|
||||
#include <QWebHistory>
|
||||
|
||||
WebHistoryWrapper::WebHistoryWrapper()
|
||||
{
|
||||
}
|
||||
|
||||
QList<QWebHistoryItem> WebHistoryWrapper::forwardItems(int maxItems, QWebHistory* history)
|
||||
{
|
||||
QList<QWebHistoryItem> list;
|
||||
|
@ -28,8 +28,6 @@ class QWebHistoryItem;
|
||||
class WebHistoryWrapper
|
||||
{
|
||||
public:
|
||||
explicit WebHistoryWrapper();
|
||||
|
||||
static QList<QWebHistoryItem> forwardItems(int maxItems, QWebHistory* history);
|
||||
static QList<QWebHistoryItem> backItems(int maxItems, QWebHistory* history);
|
||||
|
||||
|
@ -17,7 +17,6 @@
|
||||
* ============================================================ */
|
||||
#include "webview.h"
|
||||
#include "webpage.h"
|
||||
#include "webhistorywrapper.h"
|
||||
#include "mainapplication.h"
|
||||
#include "globalfunctions.h"
|
||||
#include "iconprovider.h"
|
||||
@ -271,8 +270,8 @@ void WebView::back()
|
||||
{
|
||||
QWebHistory* history = page()->history();
|
||||
|
||||
if (WebHistoryWrapper::canGoBack(history)) {
|
||||
WebHistoryWrapper::goBack(history);
|
||||
if (history->canGoBack()) {
|
||||
history->back();
|
||||
|
||||
emit urlChanged(url());
|
||||
emit iconChanged();
|
||||
@ -283,8 +282,8 @@ void WebView::forward()
|
||||
{
|
||||
QWebHistory* history = page()->history();
|
||||
|
||||
if (WebHistoryWrapper::canGoForward(history)) {
|
||||
WebHistoryWrapper::goForward(history);
|
||||
if (history->canGoForward()) {
|
||||
history->forward();
|
||||
|
||||
emit urlChanged(url());
|
||||
emit iconChanged();
|
||||
@ -691,11 +690,11 @@ void WebView::createPageContextMenu(QMenu* menu, const QPoint &pos)
|
||||
|
||||
QAction* action = menu->addAction(tr("&Back"), this, SLOT(back()));
|
||||
action->setIcon(IconProvider::standardIcon(QStyle::SP_ArrowBack));
|
||||
action->setEnabled(WebHistoryWrapper::canGoBack(history()));
|
||||
action->setEnabled(history()->canGoBack());
|
||||
|
||||
action = menu->addAction(tr("&Forward"), this, SLOT(forward()));
|
||||
action->setIcon(IconProvider::standardIcon(QStyle::SP_ArrowForward));
|
||||
action->setEnabled(WebHistoryWrapper::canGoForward(history()));
|
||||
action->setEnabled(history()->canGoForward());
|
||||
|
||||
menu->addAction(m_actionReload);
|
||||
menu->addAction(m_actionStop);
|
||||
|
Loading…
Reference in New Issue
Block a user