aboutsummaryrefslogtreecommitdiff
path: root/lib/bookmarks/bookmarkmodel.h
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-09-25 14:44:01 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2018-09-25 14:44:01 +0200
commit9203de811f049c8e604a9c3065781157fa506155 (patch)
tree96096d8cbeefd58c988ddb97dcd51fa21873ffb6 /lib/bookmarks/bookmarkmodel.h
parentBookmarks: add BookmarkItem and BookmarkModel (diff)
downloadsmolbote-9203de811f049c8e604a9c3065781157fa506155.tar.xz
Bookmarks: integrate model/view
- fix addBookmark and search signals - fix drag'n'drop - add xbel::write
Diffstat (limited to 'lib/bookmarks/bookmarkmodel.h')
-rw-r--r--lib/bookmarks/bookmarkmodel.h21
1 files changed, 16 insertions, 5 deletions
diff --git a/lib/bookmarks/bookmarkmodel.h b/lib/bookmarks/bookmarkmodel.h
index 90fdb2a..ea51caf 100644
--- a/lib/bookmarks/bookmarkmodel.h
+++ b/lib/bookmarks/bookmarkmodel.h
@@ -9,8 +9,11 @@
#ifndef SMOLBOTE_BOOKMARKMODEL_H
#define SMOLBOTE_BOOKMARKMODEL_H
-#include <QAbstractItemModel>
#include "bookmarkitem.h"
+#include <QAbstractItemModel>
+
+/* TODO BookmarkModel: moving items internally instead of copying during drag-drop
+ */
class BookmarkModel : public QAbstractItemModel
{
@@ -30,22 +33,30 @@ public:
bool isItemExpanded(const QModelIndex &index) const;
int rowCount(const QModelIndex &index) const override;
- bool insertRows(int position, int rows, const QModelIndex &parent) override;
+ bool appendBookmark(const QString &title, const QString &url, const QModelIndex &parent);
bool removeRows(int position, int rows, const QModelIndex &parent) override;
- bool moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild) override;
int columnCount(const QModelIndex &index) const override;
+
Qt::DropActions supportedDropActions() const override;
+ QStringList mimeTypes() const override;
+ QMimeData *mimeData(const QModelIndexList &indexes) const override;
+ bool dropMimeData(const QMimeData *mimeData, Qt::DropAction action, int row, int column, const QModelIndex &parent) override;
QModelIndex index(int row, int column, const QModelIndex &parent) const override;
QModelIndex parent(const QModelIndex &index) const override;
- BookmarkItem *root() {
+ BookmarkItem *root()
+ {
return rootItem;
}
+ QStringList search(const QString &term) const;
+
private:
+ const QLatin1Literal mimeType = QLatin1Literal("application/xbel");
+
BookmarkItem *getItem(const QModelIndex &index) const;
BookmarkItem *rootItem;
};
-#endif //SMOLBOTE_BOOKMARKMODEL_H
+#endif // SMOLBOTE_BOOKMARKMODEL_H