summaryrefslogtreecommitdiff
path: root/src/history/historymanager.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2011-07-10 17:21:47 +0200
committerAndrea Diamantini <adjam7@gmail.com>2011-07-18 11:37:08 +0200
commita656e6c5fd5662a3d990115e2b5851570149d594 (patch)
tree06f85884c8c81b1c1d6db697b2f47d4aef779ae8 /src/history/historymanager.cpp
parentImproving SSL widget & dialog, step 3 (diff)
downloadrekonq-a656e6c5fd5662a3d990115e2b5851570149d594.tar.xz
WARNING: HISTORY_VERSION upgrade!!
This commit changes rekonq history data struct to manage also the first time you visited a site. This way we can "expose" this new info in the SSL widget. (We can obviously do a lot more with it...)
Diffstat (limited to 'src/history/historymanager.cpp')
-rw-r--r--src/history/historymanager.cpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/history/historymanager.cpp b/src/history/historymanager.cpp
index 742e957c..0b5e9e48 100644
--- a/src/history/historymanager.cpp
+++ b/src/history/historymanager.cpp
@@ -59,7 +59,7 @@
#include <QtAlgorithms>
-static const unsigned int HISTORY_VERSION = 24;
+static const unsigned int HISTORY_VERSION = 25;
HistoryManager::HistoryManager(QObject *parent)
@@ -123,7 +123,7 @@ void HistoryManager::addHistoryEntry(const QString &url)
m_history.removeOne(item);
emit entryRemoved(item);
- item.dateTime = QDateTime::currentDateTime();
+ item.lastDateTimeVisit = QDateTime::currentDateTime();
item.visitCount++;
}
else
@@ -172,7 +172,7 @@ void HistoryManager::checkForExpired()
while(!m_history.isEmpty())
{
- QDateTime checkForExpired = m_history.last().dateTime;
+ QDateTime checkForExpired = m_history.last().lastDateTimeVisit;
checkForExpired.setDate(checkForExpired.date().addDays(m_historyLimit));
if(now.daysTo(checkForExpired) > 7)
{
@@ -352,23 +352,33 @@ void HistoryManager::load()
{
case HISTORY_VERSION: // default case
stream >> item.url;
- stream >> item.dateTime;
+ stream >> item.firstDateTimeVisit;
+ stream >> item.lastDateTimeVisit;
stream >> item.title;
stream >> item.visitCount;
break;
- case 23: // this will be used to upgrade previous structure...
+ case 24: // this was history structure for rekonq < 0.8
stream >> item.url;
- stream >> item.dateTime;
+ stream >> item.lastDateTimeVisit;
+ stream >> item.title;
+ stream >> item.visitCount;
+ item.firstDateTimeVisit = item.lastDateTimeVisit;
+ break;
+
+ case 23: // this will be used to upgrade previous structure...
+ stream >> item.url;
+ stream >> item.lastDateTimeVisit;
stream >> item.title;
item.visitCount = 1;
+ item.firstDateTimeVisit = item.lastDateTimeVisit;
break;
default:
continue;
};
- if(!item.dateTime.isValid())
+ if (!item.lastDateTimeVisit.isValid())
continue;
if(item == lastInsertedItem)
@@ -446,7 +456,7 @@ void HistoryManager::save()
QByteArray data;
QDataStream stream(&data, QIODevice::WriteOnly);
HistoryItem item = m_history.at(i);
- stream << HISTORY_VERSION << item.url << item.dateTime << item.title << item.visitCount;
+ stream << HISTORY_VERSION << item.url << item.firstDateTimeVisit << item.lastDateTimeVisit << item.title << item.visitCount;
out << data;
}
tempFile.close();