Changeset View
Changeset View
Standalone View
Standalone View
applets/notifications/filemenu.h
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | Copyright (C) 2016,2019 Kai Uwe Broulik <kde@privat.broulik.de> | ||||
3 | | ||||
4 | This library is free software; you can redistribute it and/or | ||||
5 | modify it under the terms of the GNU Lesser General Public | ||||
6 | License as published by the Free Software Foundation; either | ||||
7 | version 2.1 of the License, or (at your option) any later version. | ||||
8 | | ||||
9 | This library is distributed in the hope that it will be useful, | ||||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
12 | Lesser General Public License for more details. | ||||
13 | | ||||
14 | You should have received a copy of the GNU Lesser General Public | ||||
15 | License along with this library; if not, write to the Free Software | ||||
16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||||
17 | */ | ||||
18 | | ||||
19 | #pragma once | ||||
20 | | ||||
21 | #include <QObject> | ||||
22 | #include <QPointer> | ||||
23 | #include <QUrl> | ||||
24 | | ||||
25 | class QAction; | ||||
26 | class QQuickItem; | ||||
27 | | ||||
28 | class FileMenu : public QObject | ||||
29 | { | ||||
30 | Q_OBJECT | ||||
31 | Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged) | ||||
32 | Q_PROPERTY(QQuickItem *visualParent READ visualParent WRITE setVisualParent NOTIFY visualParentChanged) | ||||
33 | Q_PROPERTY(bool visible READ visible WRITE setVisible NOTIFY visibleChanged) | ||||
34 | | ||||
35 | public: | ||||
36 | explicit FileMenu(QObject *parent = nullptr); | ||||
37 | ~FileMenu() override; | ||||
38 | | ||||
39 | QUrl url() const; | ||||
40 | void setUrl(const QUrl &url); | ||||
41 | | ||||
42 | QQuickItem *visualParent() const; | ||||
43 | void setVisualParent(QQuickItem *visualParent); | ||||
44 | | ||||
45 | bool visible() const; | ||||
46 | void setVisible(bool visible); | ||||
47 | | ||||
48 | Q_INVOKABLE void open(int x, int y); | ||||
49 | | ||||
50 | signals: | ||||
51 | void actionTriggered(QAction *action); | ||||
52 | | ||||
53 | void urlChanged(); | ||||
54 | void visualParentChanged(); | ||||
55 | void visibleChanged(); | ||||
56 | | ||||
57 | private: | ||||
58 | QUrl m_url; | ||||
59 | QPointer<QQuickItem> m_visualParent; | ||||
60 | bool m_visible = false; | ||||
61 | | ||||
62 | }; |