~lubuntu-dev/lxde/libfm-qt-debian-git

« back to all changes in this revision

Viewing changes to src/filemenu.h

  • Committer: Alf Gaida
  • Date: 2015-12-17 15:45:00 UTC
  • Revision ID: git-v1:99d4cf5e0b3761023e2285ffb96a79d050f0bdf4
Tags: upstream/0.10.0+20151214
Adding upstream version 0.10.0+20151214.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2012 - 2015  Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
 
3
 *
 
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.
 
8
 *
 
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.
 
13
 *
 
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
 
17
 *
 
18
 */
 
19
 
 
20
 
 
21
#ifndef FM_FILEMENU_H
 
22
#define FM_FILEMENU_H
 
23
 
 
24
#include "libfmqtglobals.h"
 
25
#include <QMenu>
 
26
#include <qabstractitemmodel.h>
 
27
#include <libfm/fm.h>
 
28
 
 
29
class QAction;
 
30
 
 
31
struct _FmFileActionItem;
 
32
 
 
33
namespace Fm {
 
34
 
 
35
class FileLauncher;
 
36
 
 
37
class LIBFM_QT_API FileMenu : public QMenu {
 
38
Q_OBJECT
 
39
 
 
40
public:
 
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);
 
43
  ~FileMenu();
 
44
 
 
45
  bool useTrash() {
 
46
    return useTrash_;
 
47
  }
 
48
 
 
49
  void setUseTrash(bool trash);
 
50
 
 
51
  bool confirmDelete() {
 
52
    return confirmDelete_;
 
53
  }
 
54
 
 
55
  void setConfirmDelete(bool confirm) {
 
56
    confirmDelete_ = confirm;
 
57
  }
 
58
 
 
59
  QAction* openAction() {
 
60
    return openAction_;
 
61
  }
 
62
 
 
63
  QAction* openWithMenuAction() {
 
64
    return openWithMenuAction_;
 
65
  }
 
66
 
 
67
  QAction* openWithAction() {
 
68
    return openWithAction_;
 
69
  }
 
70
 
 
71
  QAction* separator1() {
 
72
    return separator1_;
 
73
  }
 
74
 
 
75
  QAction* createAction() {
 
76
    return createAction_;
 
77
  }
 
78
 
 
79
  QAction* separator2() {
 
80
    return separator2_;
 
81
  }
 
82
 
 
83
  QAction* cutAction() {
 
84
    return cutAction_;
 
85
  }
 
86
 
 
87
  QAction* copyAction() {
 
88
    return copyAction_;
 
89
  }
 
90
 
 
91
  QAction* pasteAction() {
 
92
    return pasteAction_;
 
93
  }
 
94
 
 
95
  QAction* deleteAction() {
 
96
    return deleteAction_;
 
97
  }
 
98
 
 
99
  QAction* unTrashAction() {
 
100
    return unTrashAction_;
 
101
  }
 
102
 
 
103
  QAction* renameAction() {
 
104
    return renameAction_;
 
105
  }
 
106
 
 
107
  QAction* separator3() {
 
108
    return separator3_;
 
109
  }
 
110
 
 
111
  QAction* propertiesAction() {
 
112
    return propertiesAction_;
 
113
  }
 
114
 
 
115
  FmFileInfoList* files() {
 
116
    return files_;
 
117
  }
 
118
 
 
119
  FmFileInfo* firstFile() {
 
120
    return info_;
 
121
  }
 
122
 
 
123
  FmPath* cwd() {
 
124
    return cwd_;
 
125
  }
 
126
 
 
127
  void setFileLauncher(FileLauncher* launcher) {
 
128
    fileLauncher_ = launcher;
 
129
  }
 
130
 
 
131
  FileLauncher* fileLauncher() {
 
132
    return fileLauncher_;
 
133
  }
 
134
 
 
135
  bool sameType() const {
 
136
    return sameType_;
 
137
  }
 
138
 
 
139
  bool sameFilesystem() const {
 
140
    return sameFilesystem_;
 
141
  }
 
142
 
 
143
  bool allVirtual() const {
 
144
    return allVirtual_;
 
145
  }
 
146
 
 
147
  bool allTrash() const {
 
148
    return allTrash_;
 
149
  }
 
150
 
 
151
  bool confirmTrash() const {
 
152
    return confirmTrash_;
 
153
  }
 
154
 
 
155
  void setConfirmTrash(bool value) {
 
156
    confirmTrash_ = value;
 
157
  }
 
158
 
 
159
protected:
 
160
  void createMenu(FmFileInfoList* files, FmFileInfo* info, FmPath* cwd);
 
161
#ifdef CUSTOM_ACTIONS
 
162
  void addCustomActionItem(QMenu* menu, struct _FmFileActionItem* item);
 
163
#endif
 
164
  void openFilesWithApp(GAppInfo* app);
 
165
 
 
166
protected Q_SLOTS:
 
167
  void onOpenTriggered();
 
168
  void onOpenWithTriggered();
 
169
  void onFilePropertiesTriggered();
 
170
  void onApplicationTriggered();
 
171
#ifdef CUSTOM_ACTIONS
 
172
  void onCustomActionTrigerred();
 
173
#endif
 
174
  void onCompress();
 
175
  void onExtract();
 
176
  void onExtractHere();
 
177
 
 
178
  void onCutTriggered();
 
179
  void onCopyTriggered();
 
180
  void onPasteTriggered();
 
181
  void onRenameTriggered();
 
182
  void onDeleteTriggered();
 
183
  void onUnTrashTriggered();
 
184
 
 
185
private:
 
186
  FmFileInfoList* files_;
 
187
  FmFileInfo* info_;
 
188
  FmPath* cwd_;
 
189
  bool useTrash_;
 
190
  bool confirmDelete_;
 
191
  bool confirmTrash_; // Confirm before moving files into "trash can"
 
192
 
 
193
  bool sameType_;
 
194
  bool sameFilesystem_;
 
195
  bool allVirtual_;
 
196
  bool allTrash_;
 
197
 
 
198
  QAction* openAction_;
 
199
  QAction* openWithMenuAction_;
 
200
  QAction* openWithAction_;
 
201
  QAction* separator1_;
 
202
  QAction* createAction_;
 
203
  QAction* separator2_;
 
204
  QAction* cutAction_;
 
205
  QAction* copyAction_;
 
206
  QAction* pasteAction_;
 
207
  QAction* deleteAction_;
 
208
  QAction* unTrashAction_;
 
209
  QAction* renameAction_;
 
210
  QAction* separator3_;
 
211
  QAction* propertiesAction_;
 
212
 
 
213
  FileLauncher* fileLauncher_;
 
214
};
 
215
 
 
216
}
 
217
 
 
218
#endif // FM_FILEMENU_H