Okular

bookmarkmanager.h
1 /***************************************************************************
2  * Copyright (C) 2006 by Pino Toscano <[email protected]> *
3  * *
4  * This program is free software; you can redistribute it and/or modify *
5  * it under the terms of the GNU General Public License as published by *
6  * the Free Software Foundation; either version 2 of the License, or *
7  * (at your option) any later version. *
8  ***************************************************************************/
9 
10 #ifndef _OKULAR_BOOKMARK_MANAGER_H_
11 #define _OKULAR_BOOKMARK_MANAGER_H_
12 
13 #include <KBookmark>
14 
15 #include "okularcore_export.h"
16 #include <QObject>
17 #include <QUrl>
18 
19 class QAction;
20 
21 namespace Okular
22 {
23 class Document;
24 class DocumentPrivate;
25 class DocumentViewport;
26 
33 class OKULARCORE_EXPORT BookmarkManager : public QObject
34 {
35  Q_OBJECT
36 
37 public:
38  ~BookmarkManager() override;
39 
43  QList<QUrl> files() const;
44 
48  KBookmark::List bookmarks(const QUrl &documentUrl) const;
49 
54  KBookmark::List bookmarks() const;
55 
60  KBookmark::List bookmarks(int page) const;
61 
66  KBookmark bookmark(int page) const;
67 
72  KBookmark bookmark(const DocumentViewport &viewport) const;
73 
77  void save() const;
78 
82  void addBookmark(int page);
83 
88  void addBookmark(const DocumentViewport &vp);
89 
96  bool addBookmark(const QUrl &documentUrl, const Okular::DocumentViewport &vp, const QString &title = QString());
97 
101  void removeBookmark(int page);
102 
107  void removeBookmark(const DocumentViewport &vp);
108 
112  int removeBookmark(const QUrl &documentUrl, const KBookmark &bm);
113 
121  void removeBookmarks(const QUrl &documentUrl, const KBookmark::List &list);
122 
127  void renameBookmark(KBookmark *bm, const QString &newName);
128 
134  void renameBookmark(const QUrl &documentUrl, const QString &newName);
135 
140  QString titleForUrl(const QUrl &documentUrl) const;
141 
145  bool isBookmarked(int page) const;
146 
151  bool isBookmarked(const DocumentViewport &viewport) const;
152 
157  KBookmark nextBookmark(const DocumentViewport &viewport) const;
158 
163  KBookmark previousBookmark(const DocumentViewport &viewport) const;
164 
171  QList<QAction *> actionsForUrl(const QUrl &documentUrl) const;
172 
173 Q_SIGNALS:
177  void openUrl(const QUrl &url);
178 
182  void saved();
183 
189  void bookmarksChanged(const QUrl &url);
190 
191 private:
192  class Private;
193  Private *const d;
194  friend class Private;
195 
196  // private interface used by the Document
197  friend class Document;
198  friend class DocumentPrivate;
199 
200  BookmarkManager(DocumentPrivate *document);
201 
202  void setUrl(const QUrl &url);
203  bool setPageBookmark(int page);
204  bool removePageBookmark(int page);
205 
206  Q_DISABLE_COPY(BookmarkManager)
207 };
208 
209 }
210 
211 #endif
global.h
Definition: action.h:19
The Document.
Definition: document.h:193
A view on the document.
Definition: document.h:1304
Bookmarks manager utility.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Tue Jan 19 2021 22:38:06 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.