File indexing completed on 2024-04-21 04:56:54
0001 /** 0002 * SPDX-FileCopyrightText: 2013 Albert Vaca <albertvaka@gmail.com> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 0007 #include "sendnotificationsplugin.h" 0008 0009 #if defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN) 0010 #include "dbusnotificationslistener.h" 0011 #elif defined(Q_OS_WIN) 0012 #include "windowsnotificationslistener.h" 0013 #include <windows.h> 0014 0015 #include <appmodel.h> // GetCurrentPackageFullName 0016 #endif 0017 #include <KPluginFactory> 0018 0019 K_PLUGIN_CLASS_WITH_JSON(SendNotificationsPlugin, "kdeconnect_sendnotifications.json") 0020 0021 SendNotificationsPlugin::SendNotificationsPlugin(QObject *parent, const QVariantList &args) 0022 : KdeConnectPlugin(parent, args) 0023 { 0024 #if defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN) 0025 notificationsListener = new DBusNotificationsListener(this); 0026 #elif defined(Q_OS_WIN) 0027 std::uint32_t bufferLength = 100; 0028 std::array<wchar_t, 100> buffer; 0029 if (GetCurrentPackageFullName(&bufferLength, buffer.data()) == ERROR_SUCCESS) { 0030 notificationsListener = new WindowsNotificationsListener(this); 0031 } 0032 #endif 0033 } 0034 0035 SendNotificationsPlugin::~SendNotificationsPlugin() 0036 { 0037 delete notificationsListener; 0038 } 0039 0040 #include "moc_sendnotificationsplugin.cpp" 0041 #include "sendnotificationsplugin.moc"