void MainWindow::clearWebHistory() { QWebHistory *history = view->history(); history->clear(); for (const auto &item : pageHistoryItems) { pageHistoryMenu->removeAction(item); } pageHistoryItems.clear(); visitedUrls.clear(); }
static void clearHistory(QWebPage* page) { // QWebHistory::clear() leaves current page, so remove it as well by setting // max item count to 0, and then setting it back to it's original value. QWebHistory* history = page->history(); int itemCount = history->maximumItemCount(); history->clear(); history->setMaximumItemCount(0); history->setMaximumItemCount(itemCount); }
void WebKitBrowserExtension::restoreState(QDataStream &stream) { KUrl u; QByteArray historyData; qint32 xOfs = -1, yOfs = -1, historyItemIndex = -1; stream >> u >> xOfs >> yOfs >> historyItemIndex >> historyData; QWebHistory* history = (view() ? view()->page()->history() : 0); if (history) { bool success = false; if (history->count() == 0) { // Handle restoration: crash recovery, tab close undo, session restore if (!historyData.isEmpty()) { historyData = qUncompress(historyData); // uncompress the history data... QBuffer buffer (&historyData); if (buffer.open(QIODevice::ReadOnly)) { QDataStream stream (&buffer); view()->page()->setProperty("HistoryNavigationLocked", true); stream >> *history; QWebHistoryItem currentItem (history->currentItem()); if (currentItem.isValid()) { if (currentItem.userData().isNull() && (xOfs != -1 || yOfs != -1)) { const QPoint scrollPos (xOfs, yOfs); currentItem.setUserData(scrollPos); } // NOTE 1: The following Konqueror specific workaround is necessary // because Konqueror only preserves information for the last visited // page. However, we save the entire history content in saveState and // and hence need to elimiate all but the current item here. // NOTE 2: This condition only applies when Konqueror is restored from // abnormal termination ; a crash and/or a session restoration. if (QCoreApplication::applicationName() == QLatin1String("konqueror")) { history->clear(); } //kDebug() << "Restoring URL:" << currentItem.url(); m_part->setProperty("NoEmitOpenUrlNotification", true); history->goToItem(currentItem); } } } success = (history->count() > 0); } else { // Handle navigation: back and forward button navigation.
static PyObject *meth_QWebHistory_clear(PyObject *sipSelf, PyObject *sipArgs) { PyObject *sipParseErr = NULL; { QWebHistory *sipCpp; if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_QWebHistory, &sipCpp)) { sipCpp->clear(); Py_INCREF(Py_None); return Py_None; } } /* Raise an exception if the arguments couldn't be parsed. */ sipNoMethod(sipParseErr, sipName_QWebHistory, sipName_clear, doc_QWebHistory_clear); return NULL; }
void TestRunner::removeAllVisitedLinks() { QWebHistory* history = m_drt->webPage()->history(); history->clear(); DumpRenderTreeSupportQt::dumpVisitedLinksCallbacks(true); }
void NavigationBar::clearHistory() { QWebHistory* history = m_window->weView()->page()->history(); history->clear(); refreshHistory(); }
void NavigationBar::clearHistory() { QWebHistory* history = p_QupZilla->weView()->page()->history(); history->clear(); refreshHistory(); }