diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 1b1690c1..ad6f056e 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -1,49 +1,50 @@ include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}/core) add_definitions(-DTRANSLATION_DOMAIN=\"kdeconnect-plugins\") install(FILES kdeconnect_plugin.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR}) add_subdirectory(ping) add_subdirectory(battery) add_subdirectory(sendnotifications) add_subdirectory(mpriscontrol) +add_subdirectory(NetworkStatusPlugin) add_subdirectory(photo) add_subdirectory(remotecommands) add_subdirectory(mprisremote) add_subdirectory(remotecontrol) add_subdirectory(lockdevice) add_subdirectory(remotesystemvolume) if(NOT SAILFISHOS) add_subdirectory(clipboard) add_subdirectory(contacts) add_subdirectory(share) add_subdirectory(remotekeyboard) add_subdirectory(notifications) add_subdirectory(findmyphone) add_subdirectory(telephony) add_subdirectory(mousepad) add_subdirectory(sms) add_subdirectory(runcommand) add_subdirectory(presenter) add_subdirectory(screensaver-inhibit) if(NOT APPLE) add_subdirectory(sftp) endif() if(KF5PulseAudioQt_FOUND OR WIN32) add_subdirectory(pausemusic) endif() if(Qt5Multimedia_FOUND AND (KF5PulseAudioQt_FOUND OR WIN32)) add_subdirectory(findthisdevice) endif() if (WIN32 OR APPLE OR KF5PulseAudioQt_FOUND) add_subdirectory(systemvolume) endif() endif() # If we split notifications per plugin, in several notifyrc files, they won't # appear in the same group in the Notifications KCM install(FILES kdeconnect.notifyrc DESTINATION ${KNOTIFYRC_INSTALL_DIR}) diff --git a/plugins/NetworkStatusPlugin/CMakeLists.txt b/plugins/NetworkStatusPlugin/CMakeLists.txt new file mode 100644 index 00000000..79940c59 --- /dev/null +++ b/plugins/NetworkStatusPlugin/CMakeLists.txt @@ -0,0 +1,11 @@ +set(kdeconnect_NetworkStatusPlugin_SRCS + NetworkStatusPlugin.cpp +) + +kdeconnect_add_plugin(kdeconnect_NetworkStatusPlugin JSON kdeconnect_NetworkStatusPlugin.json SOURCES ${kdeconnect_NetworkStatusPlugin_SRCS}) + +target_link_libraries(kdeconnect_NetworkStatusPlugin + kdeconnectcore + Qt5::DBus + KF5::I18n +) diff --git a/plugins/NetworkStatusPlugin/NetworkStatusPlugin.cpp b/plugins/NetworkStatusPlugin/NetworkStatusPlugin.cpp new file mode 100644 index 00000000..33c784cc --- /dev/null +++ b/plugins/NetworkStatusPlugin/NetworkStatusPlugin.cpp @@ -0,0 +1,56 @@ +/** + * Copyright 2020 T.H.Arjun + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License or (at your option) version 3 or any later version + * accepted by the membership of KDE e.V. (or its successor approved + * by the membership of KDE e.V.), which shall act as a proxy + * defined in Section 14 of version 3 of the license. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "NetworkStatusPlugin.h" + +#include +#include + +#include + + +K_PLUGIN_CLASS_WITH_JSON(NetworkStatusPlugin, "kdeconnect_NetworkStatusPlugin.json") + +Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_NETWORKSTATUSPLUGIN, "kdeconnect.plugin.NetworkStatusPlugin") + +NetworkStatusPlugin:: NetworkStatusPlugin(QObject* parent, const QVariantList& args) + : KdeConnectPlugin(parent, args) +{ + +} + +void NetworkStatusPlugin::connected() +{ + NetworkPacket np(PACKET_TYPE_NETWORK_STATUS_REQUEST, {{QStringLiteral("request"),true}}); + sendPacket(np); +} + +NetworkStatusPlugin::~NetworkStatusPlugin() +{ +} + +bool NetworkStatusPlugin::receivePacket(const NetworkPacket& np) +{ + qDebug()<<"Network Status Plugin Received a Packet"<< np< + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License or (at your option) version 3 or any later version + * accepted by the membership of KDE e.V. (or its successor approved + * by the membership of KDE e.V.), which shall act as a proxy + * defined in Section 14 of version 3 of the license. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef NETWORKSTATUSPLUGIN_H +#define NETWORKSTATUSPLUGIN_H + +#include +#include + +#define PACKET_TYPE_NETWORK_STATUS_REQUEST QStringLiteral("kdeconnect.networkStatus.request") + +Q_DECLARE_LOGGING_CATEGORY(KDECONNECT_NETWORK_STATUS_PLUGIN) + + +class NetworkStatusPlugin + : public KdeConnectPlugin +{ + Q_OBJECT + +public: + explicit NetworkStatusPlugin(QObject* parent, const QVariantList& args); + ~NetworkStatusPlugin() override; + + bool receivePacket(const NetworkPacket& np) override; + void connected() override; +}; + +#endif \ No newline at end of file diff --git a/plugins/NetworkStatusPlugin/README b/plugins/NetworkStatusPlugin/README new file mode 100644 index 00000000..75e77118 --- /dev/null +++ b/plugins/NetworkStatusPlugin/README @@ -0,0 +1 @@ +Updates the network status of remote device. diff --git a/plugins/NetworkStatusPlugin/kdeconnect_NetworkStatusPlugin.json b/plugins/NetworkStatusPlugin/kdeconnect_NetworkStatusPlugin.json new file mode 100644 index 00000000..a8e6e941 --- /dev/null +++ b/plugins/NetworkStatusPlugin/kdeconnect_NetworkStatusPlugin.json @@ -0,0 +1,28 @@ +{ + "KPlugin": { + "Authors": [ + { + "Email": "arjunth2001@gmail.com", + "Name": "T.H.Arjun" + + } + ], + "Description": "Receive Network Status Updates", + "EnabledByDefault": true, + "Icon": "dialog-ok", + "Id": "kdeconnect_NetworkStatusPlugin", + "License": "GPL", + "Name": "NetworkStatusPlugin", + "ServiceTypes": [ + "KdeConnect/Plugin" + ], + "Version": "0.1", + "Website": "https://arjunth2001.github.io" + }, + "X-KdeConnect-OutgoingPacketType": [ + "kdeconnect.networkStatus.request" + ], + "X-KdeConnect-SupportedPacketType": [ + "kdeconnect.networkStatus" + ] +}