2
* Copyright (C) 2012 - 2015 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
4
* This library is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU Lesser General Public
6
* License as published by the Free Software Foundation; either
7
* version 2.1 of the License, or (at your option) any later version.
9
* This library is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
* Lesser General Public License for more details.
14
* You should have received a copy of the GNU Lesser General Public
15
* License along with this library; if not, write to the Free Software
16
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24
#include "libfmqtglobals.h"
26
#include <qabstractitemmodel.h>
31
struct _FmFileActionItem;
37
class LIBFM_QT_API FileMenu : public QMenu {
41
explicit FileMenu(FmFileInfoList* files, FmFileInfo* info, FmPath* cwd, QWidget* parent = 0);
42
explicit FileMenu(FmFileInfoList* files, FmFileInfo* info, FmPath* cwd, const QString& title, QWidget* parent = 0);
49
void setUseTrash(bool trash);
51
bool confirmDelete() {
52
return confirmDelete_;
55
void setConfirmDelete(bool confirm) {
56
confirmDelete_ = confirm;
59
QAction* openAction() {
63
QAction* openWithMenuAction() {
64
return openWithMenuAction_;
67
QAction* openWithAction() {
68
return openWithAction_;
71
QAction* separator1() {
75
QAction* createAction() {
79
QAction* separator2() {
83
QAction* cutAction() {
87
QAction* copyAction() {
91
QAction* pasteAction() {
95
QAction* deleteAction() {
99
QAction* unTrashAction() {
100
return unTrashAction_;
103
QAction* renameAction() {
104
return renameAction_;
107
QAction* separator3() {
111
QAction* propertiesAction() {
112
return propertiesAction_;
115
FmFileInfoList* files() {
119
FmFileInfo* firstFile() {
127
void setFileLauncher(FileLauncher* launcher) {
128
fileLauncher_ = launcher;
131
FileLauncher* fileLauncher() {
132
return fileLauncher_;
135
bool sameType() const {
139
bool sameFilesystem() const {
140
return sameFilesystem_;
143
bool allVirtual() const {
147
bool allTrash() const {
151
bool confirmTrash() const {
152
return confirmTrash_;
155
void setConfirmTrash(bool value) {
156
confirmTrash_ = value;
160
void createMenu(FmFileInfoList* files, FmFileInfo* info, FmPath* cwd);
161
#ifdef CUSTOM_ACTIONS
162
void addCustomActionItem(QMenu* menu, struct _FmFileActionItem* item);
164
void openFilesWithApp(GAppInfo* app);
167
void onOpenTriggered();
168
void onOpenWithTriggered();
169
void onFilePropertiesTriggered();
170
void onApplicationTriggered();
171
#ifdef CUSTOM_ACTIONS
172
void onCustomActionTrigerred();
176
void onExtractHere();
178
void onCutTriggered();
179
void onCopyTriggered();
180
void onPasteTriggered();
181
void onRenameTriggered();
182
void onDeleteTriggered();
183
void onUnTrashTriggered();
186
FmFileInfoList* files_;
191
bool confirmTrash_; // Confirm before moving files into "trash can"
194
bool sameFilesystem_;
198
QAction* openAction_;
199
QAction* openWithMenuAction_;
200
QAction* openWithAction_;
201
QAction* separator1_;
202
QAction* createAction_;
203
QAction* separator2_;
205
QAction* copyAction_;
206
QAction* pasteAction_;
207
QAction* deleteAction_;
208
QAction* unTrashAction_;
209
QAction* renameAction_;
210
QAction* separator3_;
211
QAction* propertiesAction_;
213
FileLauncher* fileLauncher_;
218
#endif // FM_FILEMENU_H