Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qdesktopunixservices_p.h
Go to the documentation of this file.
1// Copyright (C) 2020 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:critical reason:execute-external-code
4
5#ifndef QDESKTOPUNIXSERVICES_H
6#define QDESKTOPUNIXSERVICES_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <qpa/qplatformservices.h>
20
21#include <QtCore/qpointer.h>
22#include <QtCore/QString>
23#include <QtCore/private/qglobal_p.h>
24
25QT_BEGIN_NAMESPACE
26
27class QDBusPendingCallWatcher;
28class QWindow;
29class QDBusServiceWatcher;
30
31class Q_GUI_EXPORT QDesktopUnixServices : public QPlatformServices
32{
33public:
34 enum class LaunchType { Browser, Document };
35
36 QDesktopUnixServices();
37 ~QDesktopUnixServices();
38
39 QByteArray desktopEnvironment() const override;
40
41 bool hasCapability(Capability capability) const override;
42 bool openUrl(const QUrl &url) override;
43 bool openDocument(const QUrl &url) override;
44 QPlatformServiceColorPicker *colorPicker(QWindow *parent = nullptr) override;
45
46 void setApplicationBadge(qint64 number);
47 virtual QString portalWindowIdentifier(QWindow *window);
48
49 virtual void registerDBusMenuForWindow(QWindow *window, const QString &service, const QString &path);
50 virtual void unregisterDBusMenuForWindow(QWindow *window);
51
52private:
53 QString m_webBrowser;
54 QString m_documentLauncher;
55#if QT_CONFIG(dbus)
56 QPointer<QDBusPendingCallWatcher> m_watcher = nullptr;
57 std::unique_ptr<QDBusServiceWatcher> m_portalWatcher;
58 bool m_hasNoPortal = false;
59#endif
60 bool m_hasScreenshotPortalWithColorPicking = false;
61
62 inline bool launchProcess(LaunchType type, const QUrl &url, const QString &xdgActivationToken);
63 inline QString portalFocusWindowIdentifier();
64};
65
66QT_END_NAMESPACE
67
68#endif // QDESKTOPUNIXSERVICES_H