summaryrefslogtreecommitdiffstats
path: root/src/gui/platform/unix/dbusmenu
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/platform/unix/dbusmenu')
-rw-r--r--src/gui/platform/unix/dbusmenu/qdbusmenuadaptor.cpp56
-rw-r--r--src/gui/platform/unix/dbusmenu/qdbusmenuadaptor_p.h40
-rw-r--r--src/gui/platform/unix/dbusmenu/qdbusmenubar.cpp48
-rw-r--r--src/gui/platform/unix/dbusmenu/qdbusmenubar_p.h40
-rw-r--r--src/gui/platform/unix/dbusmenu/qdbusmenuconnection.cpp71
-rw-r--r--src/gui/platform/unix/dbusmenu/qdbusmenuconnection_p.h47
-rw-r--r--src/gui/platform/unix/dbusmenu/qdbusmenuregistrarproxy.cpp42
-rw-r--r--src/gui/platform/unix/dbusmenu/qdbusmenuregistrarproxy_p.h43
-rw-r--r--src/gui/platform/unix/dbusmenu/qdbusmenutypes.cpp102
-rw-r--r--src/gui/platform/unix/dbusmenu/qdbusmenutypes_p.h59
-rw-r--r--src/gui/platform/unix/dbusmenu/qdbusplatformmenu.cpp42
-rw-r--r--src/gui/platform/unix/dbusmenu/qdbusplatformmenu_p.h40
12 files changed, 119 insertions, 511 deletions
diff --git a/src/gui/platform/unix/dbusmenu/qdbusmenuadaptor.cpp b/src/gui/platform/unix/dbusmenu/qdbusmenuadaptor.cpp
index a9e508c666..a3b7b6db00 100644
--- a/src/gui/platform/unix/dbusmenu/qdbusmenuadaptor.cpp
+++ b/src/gui/platform/unix/dbusmenu/qdbusmenuadaptor.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
/*
This file was originally created by qdbusxml2cpp version 0.8
@@ -59,6 +23,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
QDBusMenuAdaptor::QDBusMenuAdaptor(QDBusPlatformMenu *topLevelMenu)
: QDBusAbstractAdaptor(topLevelMenu)
, m_topLevelMenu(topLevelMenu)
@@ -73,12 +39,12 @@ QDBusMenuAdaptor::~QDBusMenuAdaptor()
QString QDBusMenuAdaptor::status() const
{
qCDebug(qLcMenu);
- return QLatin1String("normal");
+ return "normal"_L1;
}
QString QDBusMenuAdaptor::textDirection() const
{
- return QLocale().textDirection() == Qt::RightToLeft ? QLatin1String("rtl") : QLatin1String("ltr");
+ return QLocale().textDirection() == Qt::RightToLeft ? "rtl"_L1 : "ltr"_L1;
}
uint QDBusMenuAdaptor::version() const
@@ -117,12 +83,12 @@ void QDBusMenuAdaptor::Event(int id, const QString &eventId, const QDBusVariant
Q_UNUSED(data);
Q_UNUSED(timestamp);
QDBusPlatformMenuItem *item = QDBusPlatformMenuItem::byId(id);
- qCDebug(qLcMenu) << id << (item ? item->text() : QLatin1String("")) << eventId;
- if (item && eventId == QLatin1String("clicked"))
+ qCDebug(qLcMenu) << id << (item ? item->text() : ""_L1) << eventId;
+ if (item && eventId == "clicked"_L1)
item->trigger();
- if (item && eventId == QLatin1String("hovered"))
+ if (item && eventId == "hovered"_L1)
emit item->hovered();
- if (eventId == QLatin1String("closed")) {
+ if (eventId == "closed"_L1) {
// There is no explicit AboutToHide method, so map closed event to aboutToHide method
const QDBusPlatformMenu *menu = nullptr;
if (item)
@@ -163,3 +129,5 @@ QDBusVariant QDBusMenuAdaptor::GetProperty(int id, const QString &name)
}
QT_END_NAMESPACE
+
+#include "moc_qdbusmenuadaptor_p.cpp"
diff --git a/src/gui/platform/unix/dbusmenu/qdbusmenuadaptor_p.h b/src/gui/platform/unix/dbusmenu/qdbusmenuadaptor_p.h
index 396f9d220f..b6f538f6b3 100644
--- a/src/gui/platform/unix/dbusmenu/qdbusmenuadaptor_p.h
+++ b/src/gui/platform/unix/dbusmenu/qdbusmenuadaptor_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtDBus module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
/*
This file was originally created by qdbusxml2cpp version 0.8
diff --git a/src/gui/platform/unix/dbusmenu/qdbusmenubar.cpp b/src/gui/platform/unix/dbusmenu/qdbusmenubar.cpp
index b13c875854..2c006366cb 100644
--- a/src/gui/platform/unix/dbusmenu/qdbusmenubar.cpp
+++ b/src/gui/platform/unix/dbusmenu/qdbusmenubar.cpp
@@ -1,52 +1,18 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Dmitry Shachnev <mitya57@gmail.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Dmitry Shachnev <mitya57@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qdbusmenubar_p.h"
#include "qdbusmenuregistrarproxy_p.h"
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
/* note: do not change these to QStringLiteral;
we are unloaded before QtDBus is done using the strings.
*/
-#define REGISTRAR_SERVICE QLatin1String("com.canonical.AppMenu.Registrar")
-#define REGISTRAR_PATH QLatin1String("/com/canonical/AppMenu/Registrar")
+#define REGISTRAR_SERVICE "com.canonical.AppMenu.Registrar"_L1
+#define REGISTRAR_PATH "/com/canonical/AppMenu/Registrar"_L1
QDBusMenuBar::QDBusMenuBar()
: QPlatformMenuBar()
@@ -177,3 +143,5 @@ void QDBusMenuBar::unregisterMenuBar()
}
QT_END_NAMESPACE
+
+#include "moc_qdbusmenubar_p.cpp"
diff --git a/src/gui/platform/unix/dbusmenu/qdbusmenubar_p.h b/src/gui/platform/unix/dbusmenu/qdbusmenubar_p.h
index 364e7da4b6..3028df7215 100644
--- a/src/gui/platform/unix/dbusmenu/qdbusmenubar_p.h
+++ b/src/gui/platform/unix/dbusmenu/qdbusmenubar_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Dmitry Shachnev <mitya57@gmail.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Dmitry Shachnev <mitya57@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QDBUSMENUBAR_P_H
#define QDBUSMENUBAR_P_H
diff --git a/src/gui/platform/unix/dbusmenu/qdbusmenuconnection.cpp b/src/gui/platform/unix/dbusmenu/qdbusmenuconnection.cpp
index d6eb8c255c..1023b16662 100644
--- a/src/gui/platform/unix/dbusmenu/qdbusmenuconnection.cpp
+++ b/src/gui/platform/unix/dbusmenu/qdbusmenuconnection.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <QtGui/qtgui-config.h>
@@ -55,12 +19,14 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
Q_DECLARE_LOGGING_CATEGORY(qLcMenu)
-const QString StatusNotifierWatcherService = QLatin1String("org.kde.StatusNotifierWatcher");
-const QString StatusNotifierWatcherPath = QLatin1String("/StatusNotifierWatcher");
-const QString StatusNotifierItemPath = QLatin1String("/StatusNotifierItem");
-const QString MenuBarPath = QLatin1String("/MenuBar");
+const QString StatusNotifierWatcherService = "org.kde.StatusNotifierWatcher"_L1;
+const QString StatusNotifierWatcherPath = "/StatusNotifierWatcher"_L1;
+const QString StatusNotifierItemPath = "/StatusNotifierItem"_L1;
+const QString MenuBarPath = "/MenuBar"_L1;
/*!
\class QDBusMenuConnection
@@ -70,20 +36,27 @@ const QString MenuBarPath = QLatin1String("/MenuBar");
*/
QDBusMenuConnection::QDBusMenuConnection(QObject *parent, const QString &serviceName)
: QObject(parent)
+ , m_serviceName(serviceName)
, m_connection(serviceName.isNull() ? QDBusConnection::sessionBus()
: QDBusConnection::connectToBus(QDBusConnection::SessionBus, serviceName))
, m_dbusWatcher(new QDBusServiceWatcher(StatusNotifierWatcherService, m_connection, QDBusServiceWatcher::WatchForRegistration, this))
- , m_statusNotifierHostRegistered(false)
+ , m_watcherRegistered(false)
{
#ifndef QT_NO_SYSTEMTRAYICON
- QDBusInterface systrayHost(StatusNotifierWatcherService, StatusNotifierWatcherPath, StatusNotifierWatcherService, m_connection);
- if (systrayHost.isValid() && systrayHost.property("IsStatusNotifierHostRegistered").toBool())
- m_statusNotifierHostRegistered = true;
+ // Start monitoring if any known tray-related services are registered.
+ if (m_connection.interface()->isServiceRegistered(StatusNotifierWatcherService))
+ m_watcherRegistered = true;
else
- qCDebug(qLcMenu) << "StatusNotifierHost is not registered";
+ qCDebug(qLcMenu) << "failed to find service" << StatusNotifierWatcherService;
#endif
}
+QDBusMenuConnection::~QDBusMenuConnection()
+{
+ if (!m_serviceName.isEmpty() && m_connection.isConnected())
+ QDBusConnection::disconnectFromBus(m_serviceName);
+}
+
void QDBusMenuConnection::dbusError(const QDBusError &error)
{
qWarning() << "QDBusTrayIcon encountered a D-Bus error:" << error;
@@ -124,7 +97,7 @@ bool QDBusMenuConnection::registerTrayIconWithWatcher(QDBusTrayIcon *item)
Q_UNUSED(item);
QDBusMessage registerMethod = QDBusMessage::createMethodCall(
StatusNotifierWatcherService, StatusNotifierWatcherPath, StatusNotifierWatcherService,
- QLatin1String("RegisterStatusNotifierItem"));
+ "RegisterStatusNotifierItem"_L1);
registerMethod.setArguments(QVariantList() << m_connection.baseService());
return m_connection.callWithCallback(registerMethod, this, SIGNAL(trayIconRegistered()), SLOT(dbusError(QDBusError)));
}
@@ -137,3 +110,5 @@ void QDBusMenuConnection::unregisterTrayIcon(QDBusTrayIcon *item)
#endif // QT_NO_SYSTEMTRAYICON
QT_END_NAMESPACE
+
+#include "moc_qdbusmenuconnection_p.cpp"
diff --git a/src/gui/platform/unix/dbusmenu/qdbusmenuconnection_p.h b/src/gui/platform/unix/dbusmenu/qdbusmenuconnection_p.h
index 37183b021d..37033e2fa3 100644
--- a/src/gui/platform/unix/dbusmenu/qdbusmenuconnection_p.h
+++ b/src/gui/platform/unix/dbusmenu/qdbusmenuconnection_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QDBUSMENUCONNECTION_H
#define QDBUSMENUCONNECTION_H
@@ -56,6 +20,7 @@
#include <QtDBus/QDBusVariant>
#include <QtGui/qtgui-config.h>
+#include <QtCore/private/qglobal_p.h>
Q_MOC_INCLUDE(<QtDBus/QDBusError>)
QT_BEGIN_NAMESPACE
@@ -71,9 +36,10 @@ class QDBusMenuConnection : public QObject
public:
QDBusMenuConnection(QObject *parent = nullptr, const QString &serviceName = QString());
+ ~QDBusMenuConnection();
QDBusConnection connection() const { return m_connection; }
QDBusServiceWatcher *dbusWatcher() const { return m_dbusWatcher; }
- bool isStatusNotifierHostRegistered() const { return m_statusNotifierHostRegistered; }
+ bool isWatcherRegistered() const { return m_watcherRegistered; }
#ifndef QT_NO_SYSTEMTRAYICON
bool registerTrayIconMenu(QDBusTrayIcon *item);
void unregisterTrayIconMenu(QDBusTrayIcon *item);
@@ -91,9 +57,10 @@ private Q_SLOTS:
void dbusError(const QDBusError &error);
private:
+ QString m_serviceName;
QDBusConnection m_connection;
QDBusServiceWatcher *m_dbusWatcher;
- bool m_statusNotifierHostRegistered;
+ bool m_watcherRegistered;
};
QT_END_NAMESPACE
diff --git a/src/gui/platform/unix/dbusmenu/qdbusmenuregistrarproxy.cpp b/src/gui/platform/unix/dbusmenu/qdbusmenuregistrarproxy.cpp
index c59b5a675e..089bf5de47 100644
--- a/src/gui/platform/unix/dbusmenu/qdbusmenuregistrarproxy.cpp
+++ b/src/gui/platform/unix/dbusmenu/qdbusmenuregistrarproxy.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Dmitry Shachnev <mitya57@gmail.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Dmitry Shachnev <mitya57@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
/*
* This file was originally created by qdbusxml2cpp version 0.8
@@ -62,3 +26,5 @@ QDBusMenuRegistrarInterface::~QDBusMenuRegistrarInterface()
}
QT_END_NAMESPACE
+
+#include "moc_qdbusmenuregistrarproxy_p.cpp"
diff --git a/src/gui/platform/unix/dbusmenu/qdbusmenuregistrarproxy_p.h b/src/gui/platform/unix/dbusmenu/qdbusmenuregistrarproxy_p.h
index cffc080f87..8041f3af0a 100644
--- a/src/gui/platform/unix/dbusmenu/qdbusmenuregistrarproxy_p.h
+++ b/src/gui/platform/unix/dbusmenu/qdbusmenuregistrarproxy_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Dmitry Shachnev <mitya57@gmail.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Dmitry Shachnev <mitya57@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
/*
* This file was originally created by qdbusxml2cpp version 0.8
@@ -66,6 +30,7 @@
#include <QtDBus/QDBusAbstractInterface>
#include <QtDBus/QDBusConnection>
#include <QtDBus/QDBusReply>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -98,7 +63,7 @@ public Q_SLOTS: // METHODS
{
QDBusMessage reply = call(QDBus::Block, QStringLiteral("GetMenuForWindow"), windowId);
QList<QVariant> arguments = reply.arguments();
- if (reply.type() == QDBusMessage::ReplyMessage && arguments.count() == 2)
+ if (reply.type() == QDBusMessage::ReplyMessage && arguments.size() == 2)
menuObjectPath = qdbus_cast<QDBusObjectPath>(arguments.at(1));
return reply;
}
diff --git a/src/gui/platform/unix/dbusmenu/qdbusmenutypes.cpp b/src/gui/platform/unix/dbusmenu/qdbusmenutypes.cpp
index c5bc4a1889..b7fd035883 100644
--- a/src/gui/platform/unix/dbusmenu/qdbusmenutypes.cpp
+++ b/src/gui/platform/unix/dbusmenu/qdbusmenutypes.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qdbusmenutypes_p.h"
@@ -56,6 +20,18 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
+QT_IMPL_METATYPE_EXTERN(QDBusMenuItem)
+QT_IMPL_METATYPE_EXTERN(QDBusMenuItemList)
+QT_IMPL_METATYPE_EXTERN(QDBusMenuItemKeys)
+QT_IMPL_METATYPE_EXTERN(QDBusMenuItemKeysList)
+QT_IMPL_METATYPE_EXTERN(QDBusMenuLayoutItem)
+QT_IMPL_METATYPE_EXTERN(QDBusMenuLayoutItemList)
+QT_IMPL_METATYPE_EXTERN(QDBusMenuEvent)
+QT_IMPL_METATYPE_EXTERN(QDBusMenuEventList)
+QT_IMPL_METATYPE_EXTERN(QDBusMenuShortcut)
+
const QDBusArgument &operator<<(QDBusArgument &arg, const QDBusMenuItem &item)
{
arg.beginStructure();
@@ -93,7 +69,7 @@ uint QDBusMenuLayoutItem::populate(int id, int depth, const QStringList &propert
qCDebug(qLcMenu) << id << "depth" << depth << propertyNames;
m_id = id;
if (id == 0) {
- m_properties.insert(QLatin1String("children-display"), QLatin1String("submenu"));
+ m_properties.insert("children-display"_L1, "submenu"_L1);
if (topLevelMenu)
populate(topLevelMenu, depth, propertyNames);
return 1; // revision
@@ -182,34 +158,34 @@ QDBusMenuItem::QDBusMenuItem(const QDBusPlatformMenuItem *item)
: m_id(item->dbusID())
{
if (item->isSeparator()) {
- m_properties.insert(QLatin1String("type"), QLatin1String("separator"));
+ m_properties.insert("type"_L1, "separator"_L1);
} else {
- m_properties.insert(QLatin1String("label"), convertMnemonic(item->text()));
+ m_properties.insert("label"_L1, convertMnemonic(item->text()));
if (item->menu())
- m_properties.insert(QLatin1String("children-display"), QLatin1String("submenu"));
- m_properties.insert(QLatin1String("enabled"), item->isEnabled());
+ m_properties.insert("children-display"_L1, "submenu"_L1);
+ m_properties.insert("enabled"_L1, item->isEnabled());
if (item->isCheckable()) {
- QString toggleType = item->hasExclusiveGroup() ? QLatin1String("radio") : QLatin1String("checkmark");
- m_properties.insert(QLatin1String("toggle-type"), toggleType);
- m_properties.insert(QLatin1String("toggle-state"), item->isChecked() ? 1 : 0);
+ QString toggleType = item->hasExclusiveGroup() ? "radio"_L1 : "checkmark"_L1;
+ m_properties.insert("toggle-type"_L1, toggleType);
+ m_properties.insert("toggle-state"_L1, item->isChecked() ? 1 : 0);
}
#ifndef QT_NO_SHORTCUT
const QKeySequence &scut = item->shortcut();
if (!scut.isEmpty()) {
QDBusMenuShortcut shortcut = convertKeySequence(scut);
- m_properties.insert(QLatin1String("shortcut"), QVariant::fromValue(shortcut));
+ m_properties.insert("shortcut"_L1, QVariant::fromValue(shortcut));
}
#endif
const QIcon &icon = item->icon();
if (!icon.name().isEmpty()) {
- m_properties.insert(QLatin1String("icon-name"), icon.name());
+ m_properties.insert("icon-name"_L1, icon.name());
} else if (!icon.isNull()) {
QBuffer buf;
icon.pixmap(16).save(&buf, "PNG");
- m_properties.insert(QLatin1String("icon-data"), buf.data());
+ m_properties.insert("icon-data"_L1, buf.data());
}
}
- m_properties.insert(QLatin1String("visible"), item->isVisible());
+ m_properties.insert("visible"_L1, item->isVisible());
}
QDBusMenuItemList QDBusMenuItem::items(const QList<int> &ids, const QStringList &propertyNames)
@@ -227,11 +203,11 @@ QString QDBusMenuItem::convertMnemonic(const QString &label)
{
// convert only the first occurrence of ampersand which is not at the end
// dbusmenu uses underscore instead of ampersand
- int idx = label.indexOf(QLatin1Char('&'));
- if (idx < 0 || idx == label.length() - 1)
+ int idx = label.indexOf(u'&');
+ if (idx < 0 || idx == label.size() - 1)
return label;
QString ret(label);
- ret[idx] = QLatin1Char('_');
+ ret[idx] = u'_';
return ret;
}
@@ -241,22 +217,22 @@ QDBusMenuShortcut QDBusMenuItem::convertKeySequence(const QKeySequence &sequence
QDBusMenuShortcut shortcut;
for (int i = 0; i < sequence.count(); ++i) {
QStringList tokens;
- int key = sequence[i].toCombined();
- if (key & Qt::MetaModifier)
+ auto modifiers = sequence[i].keyboardModifiers();
+ if (modifiers & Qt::MetaModifier)
tokens << QStringLiteral("Super");
- if (key & Qt::ControlModifier)
+ if (modifiers & Qt::ControlModifier)
tokens << QStringLiteral("Control");
- if (key & Qt::AltModifier)
+ if (modifiers & Qt::AltModifier)
tokens << QStringLiteral("Alt");
- if (key & Qt::ShiftModifier)
+ if (modifiers & Qt::ShiftModifier)
tokens << QStringLiteral("Shift");
- if (key & Qt::KeypadModifier)
+ if (modifiers & Qt::KeypadModifier)
tokens << QStringLiteral("Num");
- QString keyName = QKeySequencePrivate::keyName(key, QKeySequence::PortableText);
- if (keyName == QLatin1String("+"))
+ QString keyName = QKeySequencePrivate::keyName(sequence[i].key(), QKeySequence::PortableText);
+ if (keyName == "+"_L1)
tokens << QStringLiteral("plus");
- else if (keyName == QLatin1String("-"))
+ else if (keyName == "-"_L1)
tokens << QStringLiteral("minus");
else
tokens << keyName;
@@ -295,7 +271,7 @@ QDebug operator<<(QDebug d, const QDBusMenuLayoutItem &item)
{
QDebugStateSaver saver(d);
d.nospace();
- d << "QDBusMenuLayoutItem(id=" << item.m_id << ", properties=" << item.m_properties << ", " << item.m_children.count() << " children)";
+ d << "QDBusMenuLayoutItem(id=" << item.m_id << ", properties=" << item.m_properties << ", " << item.m_children.size() << " children)";
return d;
}
#endif
diff --git a/src/gui/platform/unix/dbusmenu/qdbusmenutypes_p.h b/src/gui/platform/unix/dbusmenu/qdbusmenutypes_p.h
index 092798d9e3..4775c0094d 100644
--- a/src/gui/platform/unix/dbusmenu/qdbusmenutypes_p.h
+++ b/src/gui/platform/unix/dbusmenu/qdbusmenutypes_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QDBUSMENUTYPES_H
#define QDBUSMENUTYPES_H
@@ -57,6 +21,7 @@
#include <QDBusConnection>
#include <QDBusObjectPath>
#include <QPixmap>
+#include <private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -142,14 +107,14 @@ QDebug operator<<(QDebug d, const QDBusMenuLayoutItem &item);
QT_END_NAMESPACE
-Q_DECLARE_METATYPE(QDBusMenuItem)
-Q_DECLARE_METATYPE(QDBusMenuItemList)
-Q_DECLARE_METATYPE(QDBusMenuItemKeys)
-Q_DECLARE_METATYPE(QDBusMenuItemKeysList)
-Q_DECLARE_METATYPE(QDBusMenuLayoutItem)
-Q_DECLARE_METATYPE(QDBusMenuLayoutItemList)
-Q_DECLARE_METATYPE(QDBusMenuEvent)
-Q_DECLARE_METATYPE(QDBusMenuEventList)
-Q_DECLARE_METATYPE(QDBusMenuShortcut)
+QT_DECL_METATYPE_EXTERN(QDBusMenuItem, Q_GUI_EXPORT)
+QT_DECL_METATYPE_EXTERN(QDBusMenuItemList, Q_GUI_EXPORT)
+QT_DECL_METATYPE_EXTERN(QDBusMenuItemKeys, Q_GUI_EXPORT)
+QT_DECL_METATYPE_EXTERN(QDBusMenuItemKeysList, Q_GUI_EXPORT)
+QT_DECL_METATYPE_EXTERN(QDBusMenuLayoutItem, Q_GUI_EXPORT)
+QT_DECL_METATYPE_EXTERN(QDBusMenuLayoutItemList, Q_GUI_EXPORT)
+QT_DECL_METATYPE_EXTERN(QDBusMenuEvent, Q_GUI_EXPORT)
+QT_DECL_METATYPE_EXTERN(QDBusMenuEventList, Q_GUI_EXPORT)
+QT_DECL_METATYPE_EXTERN(QDBusMenuShortcut, Q_GUI_EXPORT)
#endif
diff --git a/src/gui/platform/unix/dbusmenu/qdbusplatformmenu.cpp b/src/gui/platform/unix/dbusmenu/qdbusplatformmenu.cpp
index fc1b37f2f2..f25fb0831b 100644
--- a/src/gui/platform/unix/dbusmenu/qdbusplatformmenu.cpp
+++ b/src/gui/platform/unix/dbusmenu/qdbusplatformmenu.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qdbusplatformmenu_p.h"
@@ -306,3 +270,5 @@ QPlatformMenu *QDBusPlatformMenu::createSubMenu() const
}
QT_END_NAMESPACE
+
+#include "moc_qdbusplatformmenu_p.cpp"
diff --git a/src/gui/platform/unix/dbusmenu/qdbusplatformmenu_p.h b/src/gui/platform/unix/dbusmenu/qdbusplatformmenu_p.h
index aa0f303416..cb672fee48 100644
--- a/src/gui/platform/unix/dbusmenu/qdbusplatformmenu_p.h
+++ b/src/gui/platform/unix/dbusmenu/qdbusplatformmenu_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QDBUSPLATFORMMENU_H
#define QDBUSPLATFORMMENU_H