1 | /* |
2 | This file is part of the KDE project |
3 | SPDX-FileCopyrightText: 2009 Harald Hvaal <haraldhv@stud.ntnu.no> |
4 | |
5 | SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only |
6 | */ |
7 | #ifndef _KIO_DNDPOPUPMENUPLUGIN_H_ |
8 | #define |
9 | |
10 | #include "kiogui_export.h" |
11 | #include <QList> |
12 | #include <QObject> |
13 | |
14 | class KFileItemListProperties; |
15 | class QUrl; |
16 | class QAction; |
17 | |
18 | namespace KIO |
19 | { |
20 | /*! |
21 | * \class KIO::DndPopupMenuPlugin |
22 | * \inheaderfile KIO/DndPopupMenuPlugin |
23 | * \inmodule KIOGui |
24 | * |
25 | * \brief Base class for drag and drop popup menus. |
26 | * |
27 | * This can be used for adding dynamic menu items to the normal copy/move/link |
28 | * here menu appearing in KIO-based file managers. In the setup method you may check |
29 | * the properties of the dropped files, and if applicable, append your own |
30 | * QAction that the user may trigger in the menu. |
31 | * |
32 | * The plugin should have Json metadata and be installed into kf6/kio_dnd/. |
33 | * |
34 | * \since 5.6 |
35 | */ |
36 | class KIOGUI_EXPORT : public QObject |
37 | { |
38 | Q_OBJECT |
39 | public: |
40 | /*! |
41 | * Constructor. |
42 | */ |
43 | (QObject *parent); |
44 | () override; |
45 | |
46 | /*! |
47 | * Implement the setup method in the plugin in order to create actions |
48 | * in the given actionCollection and add it to the menu using menu->addAction(). |
49 | * The popup menu will be set as parent of the actions. |
50 | * |
51 | * \a popupMenuInfo all the information about the source URLs being dropped |
52 | * |
53 | * \a destination the URL to where the file(s) were dropped |
54 | * |
55 | * Returns a QList with the QActions that will be plugged into the menu. |
56 | */ |
57 | virtual QList<QAction *> (const KFileItemListProperties &, const QUrl &destination) = 0; |
58 | }; |
59 | |
60 | } |
61 | |
62 | #endif |
63 | |