From e0e0a726eab08703591d18b0b384b4a904396ac1 Mon Sep 17 00:00:00 2001 From: reionwong Date: Fri, 24 Sep 2021 16:58:33 +0800 Subject: [PATCH] Fix ubuntu build --- notificationd/CMakeLists.txt | 4 +- notificationd/dbus/notificationsadaptor.cpp | 61 ++++++++++++++ notificationd/dbus/notificationsadaptor.h | 88 +++++++++++++++++++++ notificationd/notificationserver.cpp | 2 +- 4 files changed, 153 insertions(+), 2 deletions(-) create mode 100644 notificationd/dbus/notificationsadaptor.cpp create mode 100644 notificationd/dbus/notificationsadaptor.h diff --git a/notificationd/CMakeLists.txt b/notificationd/CMakeLists.txt index 8da6083..4bffa1c 100644 --- a/notificationd/CMakeLists.txt +++ b/notificationd/CMakeLists.txt @@ -3,10 +3,12 @@ set(SRCS main.cpp notificationsmodel.cpp notificationserver.cpp notification.cpp + dbus/notificationsadaptor.cpp resources.qrc ) -qt_add_dbus_adaptor(SRCS org.freedesktop.Notifications.xml notificationserver.h NotificationServer) +# for Ubuntu +# qt_add_dbus_adaptor(SRCS org.freedesktop.Notifications.xml notificationserver.h NotificationServer) add_executable(cutefish-notificationd ${SRCS}) diff --git a/notificationd/dbus/notificationsadaptor.cpp b/notificationd/dbus/notificationsadaptor.cpp new file mode 100644 index 0000000..c74db2e --- /dev/null +++ b/notificationd/dbus/notificationsadaptor.cpp @@ -0,0 +1,61 @@ +/* + * This file was generated by qdbusxml2cpp version 0.8 + * Command line was: qdbusxml2cpp -m -a notificationsadaptor -i notificationserver.h -l NotificationServer /home/reion/Cutefish/core/notificationd/org.freedesktop.Notifications.xml + * + * qdbusxml2cpp is Copyright (C) 2020 The Qt Company Ltd. + * + * This is an auto-generated file. + * Do not edit! All changes made to it will be lost. + */ + +#include "notificationsadaptor.h" +#include +#include +#include +#include +#include +#include +#include + +/* + * Implementation of adaptor class NotificationsAdaptor + */ + +NotificationsAdaptor::NotificationsAdaptor(NotificationServer *parent) + : QDBusAbstractAdaptor(parent) +{ + // constructor + setAutoRelaySignals(true); +} + +NotificationsAdaptor::~NotificationsAdaptor() +{ + // destructor +} + +void NotificationsAdaptor::CloseNotification(uint id) +{ + // handle method call org.freedesktop.Notifications.CloseNotification + parent()->CloseNotification(id); +} + +QStringList NotificationsAdaptor::GetCapabilities() +{ + // handle method call org.freedesktop.Notifications.GetCapabilities + return parent()->GetCapabilities(); +} + +QString NotificationsAdaptor::GetServerInformation(QString &vendor, QString &version, QString &spec_version) +{ + // handle method call org.freedesktop.Notifications.GetServerInformation + return parent()->GetServerInformation(vendor, version, spec_version); +} + +uint NotificationsAdaptor::Notify(const QString &app_name, uint replaces_id, const QString &app_icon, const QString &summary, const QString &body, const QStringList &actions, const QVariantMap &hints, int expire_timeout) +{ + // handle method call org.freedesktop.Notifications.Notify + return parent()->Notify(app_name, replaces_id, app_icon, summary, body, actions, hints, expire_timeout); +} + + +#include "notificationsadaptor.moc" diff --git a/notificationd/dbus/notificationsadaptor.h b/notificationd/dbus/notificationsadaptor.h new file mode 100644 index 0000000..b6d265f --- /dev/null +++ b/notificationd/dbus/notificationsadaptor.h @@ -0,0 +1,88 @@ +/* + * This file was generated by qdbusxml2cpp version 0.8 + * Command line was: qdbusxml2cpp -m -a notificationsadaptor -i notificationserver.h -l NotificationServer /home/reion/Cutefish/core/notificationd/org.freedesktop.Notifications.xml + * + * qdbusxml2cpp is Copyright (C) 2020 The Qt Company Ltd. + * + * This is an auto-generated file. + * This file may have been hand-edited. Look for HAND-EDIT comments + * before re-generating it. + */ + +#ifndef NOTIFICATIONSADAPTOR_H +#define NOTIFICATIONSADAPTOR_H + +#include +#include +#include "notificationserver.h" +QT_BEGIN_NAMESPACE +class QByteArray; +template class QList; +template class QMap; +class QString; +class QStringList; +class QVariant; +QT_END_NAMESPACE + +/* + * Adaptor class for interface org.freedesktop.Notifications + */ +class NotificationsAdaptor: public QDBusAbstractAdaptor +{ + Q_OBJECT + Q_CLASSINFO("D-Bus Interface", "org.freedesktop.Notifications") + Q_CLASSINFO("D-Bus Introspection", "" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" + "") +public: + NotificationsAdaptor(NotificationServer *parent); + virtual ~NotificationsAdaptor(); + + inline NotificationServer *parent() const + { return static_cast(QObject::parent()); } + +public: // PROPERTIES +public Q_SLOTS: // METHODS + void CloseNotification(uint id); + QStringList GetCapabilities(); + QString GetServerInformation(QString &vendor, QString &version, QString &spec_version); + uint Notify(const QString &app_name, uint replaces_id, const QString &app_icon, const QString &summary, const QString &body, const QStringList &actions, const QVariantMap &hints, int expire_timeout); +Q_SIGNALS: // SIGNALS + void ActionInvoked(uint in0, const QString &in1); + void NotificationClosed(uint in0, uint in1); +}; + +#endif diff --git a/notificationd/notificationserver.cpp b/notificationd/notificationserver.cpp index 8324fe2..ae2fa80 100644 --- a/notificationd/notificationserver.cpp +++ b/notificationd/notificationserver.cpp @@ -5,7 +5,7 @@ */ #include "notificationserver.h" -#include "notificationsadaptor.h" +#include "dbus/notificationsadaptor.h" #include