Changeset View
Changeset View
Standalone View
Standalone View
src/scriptengines/qml/plasmoid/dropmenu.h
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * Copyright 2008-2013 Aaron Seigo <aseigo@kde.org> | ||||
3 | * Copyright 2010-2013 Marco Martin <mart@kde.org> | ||||
4 | * | ||||
5 | * This program is free software; you can redistribute it and/or modify | ||||
6 | * it under the terms of the GNU Library General Public License as | ||||
7 | * published by the Free Software Foundation; either version 2, or | ||||
8 | * (at your option) any later version. | ||||
9 | * | ||||
10 | * This program is distributed in the hope that it will be useful, | ||||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
13 | * GNU General Public License for more details | ||||
14 | * | ||||
15 | * You should have received a copy of the GNU Library General Public | ||||
16 | * License along with this program; if not, write to the | ||||
17 | * Free Software Foundation, Inc., | ||||
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||||
19 | */ | ||||
20 | | ||||
21 | #ifndef DROPMENU_H | ||||
22 | #define DROPMENU_H | ||||
23 | | ||||
24 | #include <QObject> | ||||
25 | #include <QPoint> | ||||
26 | | ||||
27 | class QJSValue; | ||||
28 | class QMenu; | ||||
29 | class QAction; | ||||
30 | | ||||
31 | namespace KIO | ||||
32 | { | ||||
33 | class DropJob; | ||||
34 | } | ||||
35 | | ||||
36 | class ContainmentInterface; | ||||
37 | | ||||
38 | class DropMenu : public QObject | ||||
39 | { | ||||
40 | Q_OBJECT | ||||
41 | | ||||
42 | public: | ||||
43 | DropMenu(KIO::DropJob *dropJob, const QPoint &dropPoint, ContainmentInterface *parent = nullptr); | ||||
44 | ~DropMenu(); | ||||
45 | | ||||
46 | QList<QUrl> urls() const; | ||||
47 | QPoint dropPoint() const; | ||||
48 | void setUrls(const QList<QUrl> &urls); | ||||
49 | void setMultipleMimetypes(bool multipleMimetypes); | ||||
50 | | ||||
51 | void addAction(QAction *action); | ||||
52 | bool isDropjobMenu() const; | ||||
53 | bool isMultipleMimetypes() const; | ||||
54 | void show(); | ||||
55 | | ||||
56 | private: | ||||
57 | QPoint m_dropPoint; | ||||
58 | QMenu *m_menu = nullptr; | ||||
59 | QJSValue *m_dropCallback = nullptr; | ||||
60 | KIO::DropJob *m_dropJob = nullptr; | ||||
61 | QList<QAction *> m_dropActions = QList<QAction *>(); | ||||
62 | QList<QUrl> m_urls = QList<QUrl>(); | ||||
63 | bool m_multipleMimetypes = false; | ||||
64 | }; | ||||
65 | | ||||
66 | #endif |