From dce971df1dfc419545ad77e3dc30e6fd69ab7d43 Mon Sep 17 00:00:00 2001
From: Benjamin C Meyer <ben@meyerhome.net>
Date: Sun, 9 Mar 2014 14:39:19 -0400
Subject: [PATCH 14/23] Expose HistoryManager::addHistoryEntry(QString)

addHistoryEntry(QString) could only be called by first getting
a pointer to the QWebHistoryInterface due to the existence of
the protected addHistoryEntry(HistoryEntry) which was renamed to
rependHistoryEntry() to make it more clear what it is doing.
---
 autotests/historymanager/tst_historymanager.cpp | 14 +++++++-------
 src/history/historymanager.cpp                  |  4 ++--
 src/history/historymanager.h                    |  2 +-
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git autotests/historymanager/tst_historymanager.cpp autotests/historymanager/tst_historymanager.cpp
index 2ff7104..2dc5461 100644
--- autotests/historymanager/tst_historymanager.cpp
+++ autotests/historymanager/tst_historymanager.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008 Benjamin C. Meyer <ben@meyerhome.net>
+ * Copyright 2008-2014 Benjamin C. Meyer <ben@meyerhome.net>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -78,8 +78,8 @@ public:
         setDaysToExpire(30);
     }
 
-    void addHistoryEntry(const HistoryEntry &item)
-        { HistoryManager::addHistoryEntry(item); }
+    void prependHistoryEntry(const HistoryEntry &item)
+        { HistoryManager::prependHistoryEntry(item); }
 };
 
 // This will be called before the first test function is executed.
@@ -132,7 +132,7 @@ void tst_HistoryManager::history_data()
 void tst_HistoryManager::history()
 {
     SubHistory history;
-    history.addHistoryEntry(HistoryEntry());
+    history.prependHistoryEntry(HistoryEntry());
     history.clear();
     QCOMPARE(history.daysToExpire(), 30);
     history.setDaysToExpire(-1);
@@ -200,7 +200,7 @@ void tst_HistoryManager::addHistoryEntry()
     SubHistory history;
     history.setHistory(initial);
     for (int i = 0; i < items.count(); ++i)
-        history.addHistoryEntry(items[i]);
+        history.prependHistoryEntry(items[i]);
     QCOMPARE(history.history().count(), expected.count());
     QCOMPARE(history.history(), expected);
 }
@@ -278,7 +278,7 @@ void tst_HistoryManager::daysToExpire()
     for (int i = 0; i < list.count(); ++i) {
         HistoryEntry item = list.at(i);
         item.dateTime = QDateTime::currentDateTime();
-        history.addHistoryEntry(item);
+        history.prependHistoryEntry(item);
     }
 }
 
@@ -387,7 +387,7 @@ void tst_HistoryManager::saveload()
         // add url
         HistoryEntry foo("http://new.com", QDateTime::currentDateTime().addDays(1));
         post.prepend(foo);
-        history.addHistoryEntry(foo);
+        history.prependHistoryEntry(foo);
     }
 
     {
diff --git src/history/historymanager.cpp src/history/historymanager.cpp
index 6d247ce..c342294 100644
--- src/history/historymanager.cpp
+++ src/history/historymanager.cpp
@@ -144,7 +144,7 @@ void HistoryManager::addHistoryEntry(const QString &url)
     cleanUrl.setPassword(QString());
     cleanUrl.setHost(cleanUrl.host().toLower());
     HistoryEntry item(atomicString(cleanUrl.toString()), QDateTime::currentDateTime());
-    addHistoryEntry(item);
+    prependHistoryEntry(item);
 }
 
 void HistoryManager::setHistory(const QList<HistoryEntry> &history, bool loadedAndSorted)
@@ -210,7 +210,7 @@ void HistoryManager::checkForExpired()
         m_expiredTimer.start(nextTimeout * 1000);
 }
 
-void HistoryManager::addHistoryEntry(const HistoryEntry &item)
+void HistoryManager::prependHistoryEntry(const HistoryEntry &item)
 {
     QWebSettings *globalSettings = QWebSettings::globalSettings();
     if (globalSettings->testAttribute(QWebSettings::PrivateBrowsingEnabled))
diff --git src/history/historymanager.h src/history/historymanager.h
index f5275e2..771b76e 100644
--- src/history/historymanager.h
+++ src/history/historymanager.h
@@ -139,7 +139,7 @@ private slots:
     void refreshFrecencies();
 
 protected:
-    void addHistoryEntry(const HistoryEntry &item);
+    void prependHistoryEntry(const HistoryEntry &item);
     void removeHistoryEntry(const HistoryEntry &item);
 
 private:
-- 
2.44.0

