bool  QWebHistoryInterface_QtDShell::__override_historyContains(const QString&  url0, bool static_call) const
{
    if (static_call) {
        return false;
    } else {
        return historyContains((const QString& )url0);
    }
}
Exemplo n.º 2
0
void HistoryManager::addHistoryEntry(const QString &url)
{
    QWebSettings *globalSettings = QWebSettings::globalSettings();
    if (globalSettings->testAttribute(QWebSettings::PrivateBrowsingEnabled))
        return;

    QUrl cleanUrl(url);

    // don't store about: urls (home page related)
    if (cleanUrl.scheme() == QString("about"))
        return;

    cleanUrl.setPassword(QString());
    cleanUrl.setHost(cleanUrl.host().toLower());
    QString checkUrlString = cleanUrl.toString();

    HistoryItem item;
    
    // NOTE
    // check if the url has just been visited.
    // if so, remove previous entry from history, update and prepend it
    if(historyContains(checkUrlString))
    {
        int index = m_historyFilterModel->historyLocation(checkUrlString);
        item = m_history.at(index);
        m_history.removeOne(item);
        emit entryRemoved(item);
        
        item.dateTime = QDateTime::currentDateTime();
        item.visitCount++;
    }
    else
    {
        item = HistoryItem(checkUrlString, QDateTime::currentDateTime());
    }
    
    m_history.prepend(item);
    emit entryAdded(item);
    
    if (m_history.count() == 1)
        checkForExpired();
}
Exemplo n.º 3
0
// --- ADD HISTORY ENTRY ---
// Used by Webkit. Adds a new history entry if it doesn't exist yet in the database.
// NOTE: currently not called as this doesn't add a title. New overloaded function
// now being called from main window after load.
void HistoryDatabase::addHistoryEntry(const QString &url) {
    if (historyContains(url)) {
        reportVisit(url);
        return;
    }
    
    qDebug() << "Adding history entry:" << url;
    QSqlQuery query(db);
    query.prepare("INSERT INTO history (url, title, visit_count, lastModified) VALUES (:url, :title, :visit_count, :lastModified)");
    query.bindValue(":url", url);
    query.bindValue(":title", "Unknown");
    query.bindValue(":visit_count", 0);
    query.bindValue(":lastModified", QDateTime::currentDateTime().toTime_t());
    int err = query.exec();
    if (!err) {
        qDebug("Inserting new entry into history table failed.");
        qDebug() << "Cause: " << db.lastError().text();
        return;
    }
}