aboutsummaryrefslogtreecommitdiff
path: root/tabbrowsinghistory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tabbrowsinghistory.cpp')
-rw-r--r--tabbrowsinghistory.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/tabbrowsinghistory.cpp b/tabbrowsinghistory.cpp
index 1a2d07f..289d529 100644
--- a/tabbrowsinghistory.cpp
+++ b/tabbrowsinghistory.cpp
@@ -15,13 +15,30 @@ bool TabBrowsingHistory::canGoForward() const
return false;
}
-void TabBrowsingHistory::pushUrl(const QUrl &url)
+QModelIndex TabBrowsingHistory::pushUrl(QModelIndex const & position, const QUrl &url)
{
this->beginInsertRows(QModelIndex{}, this->history.length(),this->history.length() + 1);
+ if(position.isValid()) {
+ this->history.resize(position.row() + 1);
+ }
+
this->history.push_back(url);
this->endInsertRows();
+
+ return this->createIndex(this->history.size() - 1, 0);
+}
+
+QUrl TabBrowsingHistory::get(const QModelIndex &index) const
+{
+ if(not index.isValid())
+ return QUrl { };
+
+ if(index.row() >= history.size())
+ return QUrl { };
+ else
+ return history.at(index.row());
}
int TabBrowsingHistory::rowCount(const QModelIndex &parent) const