| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
#ifndef BOOKMARKSITEMMODEL_H |
| 21 |
#define BOOKMARKSITEMMODEL_H |
| 22 |
|
| 23 |
#include <QAbstractItemModel> |
| 24 |
#include <QModelIndexList> |
| 25 |
|
| 26 |
#include "Library/LibraryData.h" |
| 27 |
|
| 28 |
class BookmarkItem; |
| 29 |
class LibraryManager; |
| 30 |
|
| 31 |
class BookmarksItemModel : public QAbstractItemModel |
| 32 |
{ |
| 33 |
Q_OBJECT |
| 34 |
public: |
| 35 |
BookmarksItemModel(LibraryManager* lib, QObject *parent = 0); |
| 36 |
~BookmarksItemModel(); |
| 37 |
|
| 38 |
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const; |
| 39 |
bool canFetchMore(const QModelIndex &parent) const; |
| 40 |
void fetchMore(const QModelIndex &parent); |
| 41 |
bool hasChildren(const QModelIndex &parent) const; |
| 42 |
|
| 43 |
QVariant headerData(int section, Qt::Orientation orientation, |
| 44 |
int role = Qt::DisplayRole) const; |
| 45 |
QModelIndex index(int row, int column, |
| 46 |
const QModelIndex &parent = QModelIndex()) const; |
| 47 |
|
| 48 |
BookmarkItem* invisibleRootItem() const; |
| 49 |
BookmarkItem* itemFromIndex(const QModelIndex &index) const; |
| 50 |
|
| 51 |
QModelIndex parent(const QModelIndex &index) const; |
| 52 |
int rowCount(const QModelIndex &parent = QModelIndex()) const; |
| 53 |
int columnCount(const QModelIndex &parent = QModelIndex()) const; |
| 54 |
|
| 55 |
bool insertRow(int row, const QModelIndex &parent); |
| 56 |
bool insertRows(int row, int count, const QModelIndex &parent); |
| 57 |
bool removeRow(int row, const QModelIndex & parent = QModelIndex()); |
| 58 |
bool removeRows(int row, int count, const QModelIndex &parent); |
| 59 |
|
| 60 |
|
| 61 |
Qt::DropActions supportedDropActions() const; |
| 62 |
Qt::DropActions supportedDragActions() const; |
| 63 |
Qt::ItemFlags flags(const QModelIndex &index) const; |
| 64 |
QStringList mimeTypes() const; |
| 65 |
QMimeData *mimeData(const QModelIndexList &indexes) const; |
| 66 |
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent); |
| 67 |
|
| 68 |
|
| 69 |
QVariant getCompleteData(const QModelIndex &index) const; |
| 70 |
|
| 71 |
public slots: |
| 72 |
void onFolderChanged(const QString &dirPath); |
| 73 |
private: |
| 74 |
QModelIndex findItem(const QString &dirPath); |
| 75 |
|
| 76 |
BookmarkItem *mRootItem; |
| 77 |
LibraryManager *mLibrary; |
| 78 |
}; |
| 79 |
|
| 80 |
#endif |