3
Copyright 2014 Adam Reichold
5
This file is part of qpdfview.
7
qpdfview is free software: you can redistribute it and/or modify
8
it under the terms of the GNU General Public License as published by
9
the Free Software Foundation, either version 2 of the License, or
10
(at your option) any later version.
12
qpdfview is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
GNU General Public License for more details.
17
You should have received a copy of the GNU General Public License
18
along with qpdfview. If not, see <http://www.gnu.org/licenses/>.
22
#ifndef BOOKMARKMODEL_H
23
#define BOOKMARKMODEL_H
25
#include <QAbstractListModel>
40
BookmarkItem(int page, const QString& label = QString(), const QString& comment = QString(), const QDateTime& modified = QDateTime::currentDateTime()) :
48
class BookmarkModel : public QAbstractListModel
53
explicit BookmarkModel(QObject* parent = 0);
56
inline bool isEmpty() const { return m_bookmarks.isEmpty(); }
58
void addBookmark(const BookmarkItem& bookmark);
59
void removeBookmark(const BookmarkItem& bookmark);
61
void findBookmark(BookmarkItem& bookmark) const;
64
static BookmarkModel* fromPath(const QString& path, bool create = false);
66
static QList< QString > knownPaths();
68
static void forgetPath(const QString& path);
69
static void forgetAllPaths();
74
PageRole = Qt::UserRole + 1,
80
Qt::ItemFlags flags(const QModelIndex&) const;
82
int columnCount(const QModelIndex& parent = QModelIndex()) const;
83
int rowCount(const QModelIndex& parent = QModelIndex()) const;
85
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
88
QList< BookmarkItem > m_bookmarks;
94
#endif // BOOKMARKMODEL_H