void NavigationBar::aboutToShowHistoryNextMenu() { if (!m_menuForward || !m_window->weView()) { return; } m_menuForward->clear(); QWebEngineHistory* history = m_window->weView()->history(); int curindex = history->currentItemIndex(); int count = 0; for (int i = curindex + 1; i < history->count(); i++) { QWebEngineHistoryItem item = history->itemAt(i); if (item.isValid()) { QString title = titleForUrl(item.title(), item.url()); const QIcon icon = iconForPage(item.url(), IconProvider::standardIcon(QStyle::SP_ArrowForward)); Action* act = new Action(icon, title); act->setData(i); connect(act, SIGNAL(triggered()), this, SLOT(loadHistoryIndex())); connect(act, SIGNAL(ctrlTriggered()), this, SLOT(loadHistoryIndexInNewTab())); m_menuForward->addAction(act); } count++; if (count == 20) { break; } } m_menuForward->addSeparator(); m_menuForward->addAction(tr("Clear history"), this, SLOT(clearHistory())); }
void NavigationBar::loadHistoryIndex() { QWebEngineHistory* history = m_window->weView()->page()->history(); if (QAction* action = qobject_cast<QAction*>(sender())) { loadHistoryItem(history->itemAt(action->data().toInt())); } }
void NavigationBar::goForwardInNewTab() { QWebEngineHistory* history = m_window->weView()->page()->history(); if (!history->canGoForward()) { return; } loadHistoryItemInNewTab(history->forwardItem()); }
void NavigationBar::refreshHistory() { if (mApp->isClosing() || !m_window->weView()) { return; } QWebEngineHistory* history = m_window->weView()->page()->history(); m_buttonBack->setEnabled(history->canGoBack()); m_buttonForward->setEnabled(history->canGoForward()); }
void WebView::forward() { QWebEngineHistory* history = page()->history(); if (history->canGoForward()) { history->forward(); emit urlChanged(url()); } }
void WebView::back() { QWebEngineHistory* history = page()->history(); if (history->canGoBack()) { history->back(); emit urlChanged(url()); } }
void NavigationBar::loadHistoryItemInNewTab(const QWebEngineHistoryItem &item) { TabWidget* tabWidget = m_window->tabWidget(); int tabIndex = tabWidget->duplicateTab(tabWidget->currentIndex()); QWebEngineHistory* history = m_window->weView(tabIndex)->page()->history(); history->goToItem(item); if (qzSettings->newTabPosition == Qz::NT_SelectedTab) { tabWidget->setCurrentIndex(tabIndex); } }
void NavigationBar::loadHistoryIndexInNewTab(int index) { if (QAction* action = qobject_cast<QAction*>(sender())) { index = action->data().toInt(); } if (index == -1) { return; } QWebEngineHistory* history = m_window->weView()->page()->history(); loadHistoryItemInNewTab(history->itemAt(index)); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void DREAM3DUserManualDialog::updateButtons(bool ok) { QWebEngineHistory* history = m_WebView->history(); // Check forwards navigation if (history->canGoForward() == false) { forwardBtn->setDisabled(true); } else { forwardBtn->setEnabled(true); } // Check backwards navigation if (history->canGoBack() == false || history->backItem().url().toDisplayString() == "about:blank") { backBtn->setDisabled(true); } else { backBtn->setEnabled(true); } }
void NavigationBar::goForward() { QWebEngineHistory* history = m_window->weView()->page()->history(); history->forward(); }
void NavigationBar::goBack() { QWebEngineHistory* history = m_window->weView()->page()->history(); history->back(); }
void NavigationBar::clearHistory() { QWebEngineHistory* history = m_window->weView()->page()->history(); history->clear(); refreshHistory(); }