summaryrefslogtreecommitdiff
path: root/src/history/historymodels.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/historymodels.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/historymodels.cpp')
-rw-r--r--src/history/historymodels.cpp25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/history/historymodels.cpp b/src/history/historymodels.cpp
index e78c3ac1..0315513b 100644
--- a/src/history/historymodels.cpp
+++ b/src/history/historymodels.cpp
@@ -115,9 +115,11 @@ QVariant HistoryModel::data(const QModelIndex &index, int role) const
switch(role)
{
case DateTimeRole:
- return item.dateTime;
+ return item.lastDateTimeVisit;
case DateRole:
- return item.dateTime.date();
+ return item.lastDateTimeVisit.date();
+ case FirstDateTimeVisitRole:
+ return item.firstDateTimeVisit;
case UrlRole:
return QUrl(item.url);
case Qt::UserRole:
@@ -152,7 +154,7 @@ QVariant HistoryModel::data(const QModelIndex &index, int role) const
QString tooltip = "";
if(!item.title.isEmpty())
tooltip = item.title + '\n';
- tooltip += item.dateTime.toString(Qt::SystemLocaleShortDate) + '\n' + item.url;
+ tooltip += item.lastDateTimeVisit.toString(Qt::SystemLocaleShortDate) + '\n' + item.url;
return tooltip;
}
return QVariant();
@@ -188,7 +190,7 @@ bool HistoryModel::removeRows(int row, int count, const QModelIndex &parent)
}
-// -------------------------------------------------------------------------------------------------------------------------------------------------
+// ------------------------------------------------------------------------------------------------------------------
HistoryFilterModel::HistoryFilterModel(QAbstractItemModel *sourceModel, QObject *parent)
@@ -436,7 +438,7 @@ QVariant HistoryTreeModel::headerData(int section, Qt::Orientation orientation,
QVariant HistoryTreeModel::data(const QModelIndex &index, int role) const
{
- if((role == Qt::EditRole || role == Qt::DisplayRole))
+ if (role == Qt::EditRole || role == Qt::DisplayRole)
{
int start = index.internalId();
if(start == 0)
@@ -456,15 +458,24 @@ QVariant HistoryTreeModel::data(const QModelIndex &index, int role) const
}
}
}
- if(role == Qt::DecorationRole && index.column() == 0 && !index.parent().isValid())
+
+ if (role == Qt::DecorationRole && index.column() == 0 && !index.parent().isValid())
return KIcon("view-history");
- if(role == HistoryModel::DateRole && index.column() == 0 && index.internalId() == 0)
+
+ if (role == HistoryModel::DateRole && index.column() == 0 && index.internalId() == 0)
{
int offset = sourceDateRow(index.row());
QModelIndex idx = sourceModel()->index(offset, 0);
return idx.data(HistoryModel::DateRole);
}
+ if (role == HistoryModel::FirstDateTimeVisitRole && index.column() == 0 && index.internalId() == 0)
+ {
+ int offset = sourceDateRow(index.row());
+ QModelIndex idx = sourceModel()->index(offset, 0);
+ return idx.data(HistoryModel::FirstDateTimeVisitRole);
+ }
+
return QAbstractProxyModel::data(index, role);
}