Commit 75cb34d2 authored by Harald Sitter's avatar Harald Sitter 🏳️‍🌈
Browse files

split portalicon into standalone class

so it may be used by more portals than just notification
parent 5fd51eff
Pipeline #165738 passed with stage
in 45 seconds
......@@ -64,6 +64,7 @@ set(xdg_desktop_portal_kde_SRCS
waylandintegration_p.h
xdg-desktop-portal-kde.cpp
resources.qrc
portalicon.cpp
)
if (QT_MAJOR_VERSION EQUAL "5")
......
......@@ -13,30 +13,14 @@
#include <QDBusMetaType>
#include <QLoggingCategory>
QDBusArgument &operator<<(QDBusArgument &argument, const NotificationPortal::PortalIcon &icon)
{
argument.beginStructure();
argument << icon.str << icon.data;
argument.endStructure();
return argument;
}
const QDBusArgument &operator>>(const QDBusArgument &argument, NotificationPortal::PortalIcon &icon)
{
argument.beginStructure();
argument >> icon.str >> icon.data;
argument.endStructure();
return argument;
}
Q_DECLARE_METATYPE(NotificationPortal::PortalIcon)
#include "portalicon.h"
Q_LOGGING_CATEGORY(XdgDesktopPortalKdeNotification, "xdp-kde-notification")
NotificationPortal::NotificationPortal(QObject *parent)
: QDBusAbstractAdaptor(parent)
{
qDBusRegisterMetaType<PortalIcon>();
PortalIcon::registerDBusType();
}
NotificationPortal::~NotificationPortal()
......
......@@ -19,11 +19,6 @@ class NotificationPortal : public QDBusAbstractAdaptor
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.freedesktop.impl.portal.Notification")
public:
struct PortalIcon {
QString str;
QDBusVariant data;
};
explicit NotificationPortal(QObject *parent);
~NotificationPortal() override;
......
/*
* SPDX-FileCopyrightText: 2016 Red Hat Inc
*
* SPDX-License-Identifier: LGPL-2.0-or-later
*
* SPDX-FileCopyrightText: 2016 Jan Grulich <jgrulich@redhat.com>
*/
#include "portalicon.h"
QDBusArgument &operator<<(QDBusArgument &argument, const PortalIcon &icon)
{
argument.beginStructure();
argument << icon.str << icon.data;
argument.endStructure();
return argument;
}
const QDBusArgument &operator>>(const QDBusArgument &argument, PortalIcon &icon)
{
argument.beginStructure();
argument >> icon.str >> icon.data;
argument.endStructure();
return argument;
}
/*
* SPDX-FileCopyrightText: 2016 Red Hat Inc
*
* SPDX-License-Identifier: LGPL-2.0-or-later
*
* SPDX-FileCopyrightText: 2016 Jan Grulich <jgrulich@redhat.com>
*/
#pragma once
#include <QDBusArgument>
#include <QDBusMetaType>
struct PortalIcon {
QString str;
QDBusVariant data;
static int registerDBusType()
{
return qDBusRegisterMetaType<PortalIcon>();
}
};
QDBusArgument &operator<<(QDBusArgument &argument, const PortalIcon &icon);
const QDBusArgument &operator>>(const QDBusArgument &argument, PortalIcon &icon);
Q_DECLARE_METATYPE(PortalIcon)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment