1 | /* |
---|
2 | |
---|
3 | Copyright 2014 S. Razi Alavizadeh |
---|
4 | Copyright 2012-2014 Adam Reichold |
---|
5 | |
---|
6 | This file is part of qpdfview. |
---|
7 | |
---|
8 | qpdfview is free software: you can redistribute it and/or modify |
---|
9 | it under the terms of the GNU General Public License as published by |
---|
10 | the Free Software Foundation, either version 2 of the License, or |
---|
11 | (at your option) any later version. |
---|
12 | |
---|
13 | qpdfview is distributed in the hope that it will be useful, |
---|
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
16 | GNU General Public License for more details. |
---|
17 | |
---|
18 | You should have received a copy of the GNU General Public License |
---|
19 | along with qpdfview. If not, see <http://www.gnu.org/licenses/>. |
---|
20 | |
---|
21 | */ |
---|
22 | |
---|
23 | #ifndef BOOKMARKMENU_H |
---|
24 | #define BOOKMARKMENU_H |
---|
25 | |
---|
26 | #include <QMenu> |
---|
27 | |
---|
28 | #include <QPair> |
---|
29 | |
---|
30 | class QFileInfo; |
---|
31 | |
---|
32 | #include "global.h" |
---|
33 | |
---|
34 | namespace qpdfview |
---|
35 | { |
---|
36 | |
---|
37 | class BookmarkMenu : public QMenu |
---|
38 | { |
---|
39 | Q_OBJECT |
---|
40 | |
---|
41 | public: |
---|
42 | BookmarkMenu(const QFileInfo& fileInfo, QWidget* parent = 0); |
---|
43 | |
---|
44 | QString absoluteFilePath() const { return menuAction()->data().toString(); } |
---|
45 | |
---|
46 | void addJumpToPageAction(int page, const QString& label); |
---|
47 | void removeJumpToPageAction(int page); |
---|
48 | |
---|
49 | signals: |
---|
50 | void openTriggered(const QString& filePath); |
---|
51 | void openInNewTabTriggered(const QString& filePath); |
---|
52 | void jumpToPageTriggered(const QString& filePath, int page); |
---|
53 | void removeBookmarkTriggered(const QString& filePath); |
---|
54 | |
---|
55 | protected slots: |
---|
56 | void on_open_triggered(); |
---|
57 | void on_openInNewTab_triggered(); |
---|
58 | void on_jumpToPage_triggered(QAction* action); |
---|
59 | void on_removeBookmark_triggered(); |
---|
60 | |
---|
61 | private: |
---|
62 | Q_DISABLE_COPY(BookmarkMenu) |
---|
63 | |
---|
64 | QAction* m_openAction; |
---|
65 | QAction* m_openInNewTabAction; |
---|
66 | QActionGroup* m_jumpToPageActionGroup; |
---|
67 | QAction* m_separatorAction; |
---|
68 | QAction* m_removeBookmarkAction; |
---|
69 | |
---|
70 | }; |
---|
71 | |
---|
72 | } // qpdfview |
---|
73 | |
---|
74 | #endif // BOOKMARKMENU_H |
---|