2016-05-25 19:49:13 +01:00
|
|
|
/**
|
2020-08-17 10:48:10 +01:00
|
|
|
* SPDX-FileCopyrightText: 2013 Albert Vaca <albertvaka@gmail.com>
|
2016-05-25 19:49:13 +01:00
|
|
|
*
|
2020-08-17 10:48:10 +01:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
2016-05-25 19:49:13 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "sendnotificationsplugin.h"
|
|
|
|
|
2023-07-30 18:05:15 +01:00
|
|
|
#if defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN)
|
|
|
|
#include "dbusnotificationslistener.h"
|
|
|
|
#elif defined(Q_OS_WIN)
|
|
|
|
#include "windowsnotificationslistener.h"
|
|
|
|
#include <windows.h>
|
2016-05-25 19:49:13 +01:00
|
|
|
|
2023-07-30 18:05:15 +01:00
|
|
|
#include <appmodel.h> // GetCurrentPackageFullName
|
|
|
|
#endif
|
2016-05-25 19:49:13 +01:00
|
|
|
#include <KPluginFactory>
|
|
|
|
|
2019-06-12 21:16:54 +01:00
|
|
|
K_PLUGIN_CLASS_WITH_JSON(SendNotificationsPlugin, "kdeconnect_sendnotifications.json")
|
2016-05-25 19:49:13 +01:00
|
|
|
|
2022-09-10 22:23:52 +01:00
|
|
|
SendNotificationsPlugin::SendNotificationsPlugin(QObject *parent, const QVariantList &args)
|
2016-05-25 19:49:13 +01:00
|
|
|
: KdeConnectPlugin(parent, args)
|
|
|
|
{
|
2023-07-30 18:05:15 +01:00
|
|
|
#if defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN)
|
|
|
|
notificationsListener = new DBusNotificationsListener(this);
|
|
|
|
#elif defined(Q_OS_WIN)
|
|
|
|
std::uint32_t bufferLength = 100;
|
|
|
|
std::array<wchar_t, 100> buffer;
|
|
|
|
if (GetCurrentPackageFullName(&bufferLength, buffer.data()) == ERROR_SUCCESS) {
|
|
|
|
notificationsListener = new WindowsNotificationsListener(this);
|
|
|
|
}
|
|
|
|
#endif
|
2016-05-25 19:49:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
SendNotificationsPlugin::~SendNotificationsPlugin()
|
|
|
|
{
|
|
|
|
delete notificationsListener;
|
|
|
|
}
|
|
|
|
|
2023-07-26 09:15:11 +01:00
|
|
|
#include "moc_sendnotificationsplugin.cpp"
|
2016-05-25 19:49:13 +01:00
|
|
|
#include "sendnotificationsplugin.moc"
|