1 | /* |
---|
2 | |
---|
3 | Copyright 2012-2013 Adam Reichold |
---|
4 | |
---|
5 | This file is part of qpdfview. |
---|
6 | |
---|
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. |
---|
11 | |
---|
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. |
---|
16 | |
---|
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/>. |
---|
19 | |
---|
20 | */ |
---|
21 | |
---|
22 | #ifndef RECENTLYUSEDMENU_H |
---|
23 | #define RECENTLYUSEDMENU_H |
---|
24 | |
---|
25 | #include <QMenu> |
---|
26 | |
---|
27 | class QFileInfo; |
---|
28 | |
---|
29 | namespace qpdfview |
---|
30 | { |
---|
31 | |
---|
32 | class RecentlyUsedMenu : public QMenu |
---|
33 | { |
---|
34 | Q_OBJECT |
---|
35 | |
---|
36 | public: |
---|
37 | explicit RecentlyUsedMenu(const QStringList& filePaths, int count, QWidget* parent = 0); |
---|
38 | |
---|
39 | void addOpenAction(const QFileInfo& fileInfo); |
---|
40 | void removeOpenAction(const QString& filePath); |
---|
41 | |
---|
42 | QStringList filePaths() const; |
---|
43 | |
---|
44 | signals: |
---|
45 | void openTriggered(const QString& filePath); |
---|
46 | |
---|
47 | protected slots: |
---|
48 | void on_open_triggered(QAction* action); |
---|
49 | void on_clearList_triggered(); |
---|
50 | |
---|
51 | private: |
---|
52 | Q_DISABLE_COPY(RecentlyUsedMenu) |
---|
53 | |
---|
54 | int m_count; |
---|
55 | |
---|
56 | QActionGroup* m_openActionGroup; |
---|
57 | QAction* m_separatorAction; |
---|
58 | QAction* m_clearListAction; |
---|
59 | |
---|
60 | }; |
---|
61 | |
---|
62 | } // qpdfview |
---|
63 | |
---|
64 | #endif // RECENTLYUSEDMENU_H |
---|