diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2020-01-17 10:25:27 +0200 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2020-01-17 11:18:34 +0200 |
commit | 5f708d4618d739d14442b85c466fdbac84a74cc8 (patch) | |
tree | e253289a1686f302df62d0f0865b9dcd6bfa6412 /lib/bookmarks/bookmarkmodel.cpp | |
parent | Add Firefox bookmarks.json format to libbookmarks (diff) | |
download | smolbote-5f708d4618d739d14442b85c466fdbac84a74cc8.tar.xz |
BookmarkItem::DateAdded and LastModified fields
- add read support in FFJson for DateAdded and LastModified fields
- add read/write support in Xbel for DateAdded and LastModified fields
- BookmarkModel: set DateAdded on appendBookmark and appendFolder
- EditBookmarkDialog: set LastModified field when saving changes
Diffstat (limited to 'lib/bookmarks/bookmarkmodel.cpp')
-rw-r--r-- | lib/bookmarks/bookmarkmodel.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/bookmarks/bookmarkmodel.cpp b/lib/bookmarks/bookmarkmodel.cpp index 895b178..05df3d7 100644 --- a/lib/bookmarks/bookmarkmodel.cpp +++ b/lib/bookmarks/bookmarkmodel.cpp @@ -12,6 +12,7 @@ #include <QBuffer> #include <QMimeData> #include <QRegularExpression> +#include <QDateTime> BookmarkModel::BookmarkModel(QObject *parent) : QAbstractItemModel(parent) @@ -132,6 +133,7 @@ QModelIndex BookmarkModel::appendBookmark(const QString &title, const QString &u int row = parentItem->childCount(); beginInsertRows(parent, row, row); auto *childItem = new BookmarkItem({ title, url }, BookmarkItem::Bookmark, parentItem); + childItem->setData(BookmarkItem::DateAdded, QDateTime::currentDateTime()); parentItem->appendChild(childItem); endInsertRows(); @@ -146,6 +148,7 @@ QModelIndex BookmarkModel::appendFolder(const QString &title, const QModelIndex beginInsertRows(parent, row, row); auto *childItem = new BookmarkItem({ title }, BookmarkItem::Folder, parentItem); + childItem->setData(BookmarkItem::DateAdded, QDateTime::currentDateTime()); parentItem->appendChild(childItem); endInsertRows(); |