1 // vim: set tabstop=4 shiftwidth=4 expandtab:
2 /*
3 Gwenview: an image viewer
4 Copyright 2007 Aurélien Gâteau <agateau@kde.org>
5 
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License
8 as published by the Free Software Foundation; either version 2
9 of the License, or (at your option) any later version.
10 
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 
20 */
21 #ifndef FILEOPSCONTEXTMANAGERITEM_H
22 #define FILEOPSCONTEXTMANAGERITEM_H
23 
24 // Qt
25 
26 // KF
27 #include <KNewFileMenu>
28 #include <KService>
29 
30 // Local
31 #include "abstractcontextmanageritem.h"
32 
33 class QAction;
34 class QMimeData;
35 class QListView;
36 class KActionCollection;
37 class KXMLGUIClient;
38 
39 namespace Gwenview
40 {
41 class SideBarGroup;
42 
43 class FileOpsContextManagerItem : public AbstractContextManagerItem
44 {
45     Q_OBJECT
46 public:
47     FileOpsContextManagerItem(Gwenview::ContextManager *manager, QListView *thumbnailView, KActionCollection *actionCollection, KXMLGUIClient *client);
48     ~FileOpsContextManagerItem() override;
49 
50 private Q_SLOTS:
51     void updateActions();
52     void updatePasteAction();
53     void updateSideBarContent();
54 
55     void cut();
56     void copy();
57     void paste();
58     void rename();
59     void copyTo();
60     void moveTo();
61     void linkTo();
62     void trash();
63     void del();
64     void restore();
65     void showProperties();
66     void createFolder();
67     void populateOpenMenu();
68     void openWith(QAction *action);
69     void openContainingFolder();
70 
71 private:
72     QList<QUrl> urlList() const;
73     void updateServiceList();
74     QMimeData *selectionMimeData();
75     QUrl pasteTargetUrl() const;
76 
77     QListView *mThumbnailView;
78     KXMLGUIClient *mXMLGUIClient;
79     SideBarGroup *mGroup;
80     QAction *mCutAction;
81     QAction *mCopyAction;
82     QAction *mPasteAction;
83     QAction *mCopyToAction;
84     QAction *mMoveToAction;
85     QAction *mLinkToAction;
86     QAction *mRenameAction;
87     QAction *mTrashAction;
88     QAction *mDelAction;
89     QAction *mRestoreAction;
90     QAction *mShowPropertiesAction;
91     QAction *mCreateFolderAction;
92     QAction *mOpenWithAction;
93     QAction *mOpenContainingFolderAction;
94     QList<QAction *> mRegularFileActionList;
95     QList<QAction *> mTrashFileActionList;
96     KService::List mServiceList;
97     KNewFileMenu *mNewFileMenu;
98     bool mInTrash;
99 };
100 
101 } // namespace
102 
103 #endif /* FILEOPSCONTEXTMANAGERITEM_H */
104