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 _KIO_DNDPOPUPMENUPLUGIN_H_
9
10#include "kiogui_export.h"
11#include <QList>
12#include <QObject>
13
14class KFileItemListProperties;
15class QUrl;
16class QAction;
17
18namespace 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 */
36class KIOGUI_EXPORT DndPopupMenuPlugin : public QObject
37{
38 Q_OBJECT
39public:
40 /*!
41 * Constructor.
42 */
43 DndPopupMenuPlugin(QObject *parent);
44 ~DndPopupMenuPlugin() 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 *> setup(const KFileItemListProperties &popupMenuInfo, const QUrl &destination) = 0;
58};
59
60}
61
62#endif
63

source code of kio/src/gui/dndpopupmenuplugin.h