diff options
| author | Felix (xq) Queißner <git@mq32.de> | 2020-06-06 20:12:38 +0200 |
|---|---|---|
| committer | Felix (xq) Queißner <git@mq32.de> | 2020-06-06 20:12:38 +0200 |
| commit | 9e1995b8672136b196bc4dccdb127e20156a630c (patch) | |
| tree | d6a5bf13f316ffc4659dd30c8981e65ba63ff48e /tabbrowsinghistory.cpp | |
| parent | 0fd0f2d919d748280c48383840fe7c4d988bbd00 (diff) | |
| download | kristall-9e1995b8672136b196bc4dccdb127e20156a630c.tar.gz | |
Starts to implement history management.
Diffstat (limited to 'tabbrowsinghistory.cpp')
| -rw-r--r-- | tabbrowsinghistory.cpp | 19 |
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 |
