Пример #1
0
Eina_Bool ewk_history_clear(Ewk_History* history)
{
    EWK_HISTORY_CORE_GET_OR_RETURN(history, core, false);

    WebCore::Page* page = core->page();
    if (page && page->groupPtr())
        page->groupPtr()->removeVisitedLinks();

    const int limit = ewk_history_limit_get(history);
    ewk_history_limit_set(history, 0);
    ewk_history_limit_set(history, limit);

    return true;
}
Пример #2
0
/*!
  Clears the history.

  \sa count(), items()
*/
void QWebHistory::clear()
{
    //shortcut to private BackForwardListImpl
    WebCore::BackForwardListImpl* lst = d->lst;

    //clear visited links
    WebCore::Page* page = static_cast<WebCore::BackForwardListImpl*>(lst)->page();
    if (page && page->groupPtr())
        page->groupPtr()->removeVisitedLinks();

    //if count() == 0 then just return
    if (!lst->entries().size())
        return;

    RefPtr<WebCore::HistoryItem> current = lst->currentItem();
    int capacity = lst->capacity();
    lst->setCapacity(0);

    lst->setCapacity(capacity);   //revert capacity
    lst->addItem(current.get());  //insert old current item
    lst->goToItem(current.get()); //and set it as current again

    d->page()->updateNavigationActions();
}