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 dndpopupmenuplugin.h <KIO/DndPopupMenuPlugin>
22 *
23 * Base class for drag and drop popup menus
24 *
25 * This can be used for adding dynamic menu items to the normal copy/move/link
26 * here menu appearing in KIO-based file managers. In the setup method you may check
27 * the properties of the dropped files, and if applicable, append your own
28 * QAction that the user may trigger in the menu.
29 *
30 * The plugin should have Json metadata and be installed into kf6/kio_dnd/.
31 *
32 * @author Harald Hvaal <metellius@gmail.com>
33 * @since 5.6
34 */
35class KIOGUI_EXPORT DndPopupMenuPlugin : public QObject
36{
37 Q_OBJECT
38public:
39 /**
40 * Constructor.
41 */
42 DndPopupMenuPlugin(QObject *parent);
43 ~DndPopupMenuPlugin() override;
44
45 /**
46 * Implement the setup method in the plugin in order to create actions
47 * in the given actionCollection and add it to the menu using menu->addAction().
48 * The popup menu will be set as parent of the actions.
49 *
50 * @param popupMenuInfo all the information about the source URLs being dropped
51 * @param destination the URL to where the file(s) were dropped
52 * @return a QList with the QActions that will be plugged into the menu.
53 */
54 virtual QList<QAction *> setup(const KFileItemListProperties &popupMenuInfo, const QUrl &destination) = 0;
55};
56
57}
58
59#endif
60

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