diff --git a/core/networkpackage.cpp b/core/networkpackage.cpp index 9fa850cf9..2e2d97592 100644 --- a/core/networkpackage.cpp +++ b/core/networkpackage.cpp @@ -166,6 +166,7 @@ void NetworkPackage::encrypt(QCA::PublicKey& key) QByteArray serialized = serialize(); int chunkSize = key.maximumEncryptSize(NetworkPackage::EncryptionAlgorithm); + Q_ASSERT(chunkSize>0); QStringList chunks; while (!serialized.isEmpty()) { diff --git a/fileitemactionplugin/kdeconnectsendfile.desktop b/fileitemactionplugin/kdeconnectsendfile.desktop index 34d6fbbf2..864e1d4c9 100644 --- a/fileitemactionplugin/kdeconnectsendfile.desktop +++ b/fileitemactionplugin/kdeconnectsendfile.desktop @@ -31,7 +31,7 @@ Name[tr]=KDE Bağlantı servisi ile dosya gönderin Name[uk]=Надсилання файла за допомогою служби з’єднання KDE Name[x-test]=xxSend file via KDE Connect servicexx Name[zh_CN]=通过 KDE Connect 服务发送文件 -X-KDE-Library=kdeconnectfiletiemaction +X-KDE-Library=kdeconnectfileitemaction X-KDE-Submenu=Connect X-KDE-Submenu[ar]=اتّصل,اتصل X-KDE-Submenu[ast]=Coneutar diff --git a/plasmoid/package/contents/ui/DeviceDelegate.qml b/plasmoid/package/contents/ui/DeviceDelegate.qml index 34dfb1952..a4f70eb30 100644 --- a/plasmoid/package/contents/ui/DeviceDelegate.qml +++ b/plasmoid/package/contents/ui/DeviceDelegate.qml @@ -48,7 +48,8 @@ PlasmaComponents.ListItem Layout.fillWidth: true } - PlasmaComponents.Button + //Find my phone + PlasmaComponents.Button { FindMyPhone { id: findmyphone @@ -56,14 +57,16 @@ PlasmaComponents.ListItem } id: ring - iconSource: "preferences-desktop-notification" + iconSource: "question" visible: findmyphone.available + tooltip: i18n("Ring my phone") onClicked: { findmyphone.ring() } } + //SFTP PlasmaComponents.Button { Sftp { @@ -74,6 +77,7 @@ PlasmaComponents.ListItem id: browse iconSource: "document-open-folder" visible: sftp.available + tooltip: i18n("Browse this device") onClicked: { sftp.browse() diff --git a/plasmoid/package/contents/ui/FullRepresentation.qml b/plasmoid/package/contents/ui/FullRepresentation.qml index 99f25ed31..d6c8663d4 100644 --- a/plasmoid/package/contents/ui/FullRepresentation.qml +++ b/plasmoid/package/contents/ui/FullRepresentation.qml @@ -29,10 +29,10 @@ Item { property alias devicesModel: devicesView.model PlasmaExtras.Heading { - width: parent.width + anchors.centerIn: parent level: 3 opacity: 0.6 - text: i18n("No Paired Devices Available") + text: i18n("No paired devices available") visible: devicesView.count==0 } diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index bc907493f..2a49306f4 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -7,6 +7,7 @@ add_subdirectory(clipboard) add_subdirectory(telephony) add_subdirectory(share) add_subdirectory(notifications) +add_subdirectory(sendnotifications) add_subdirectory(battery) add_subdirectory(runcommand) if(NOT WIN32) diff --git a/plugins/battery/batteryplugin.h b/plugins/battery/batteryplugin.h index c643f04f9..e50e8eb0e 100644 --- a/plugins/battery/batteryplugin.h +++ b/plugins/battery/batteryplugin.h @@ -24,7 +24,7 @@ #include #include -#define PACKAGE_TYPE_BATTERY QLatin1String("kdeconnect.battery") +#define PACKAGE_TYPE_BATTERY QLatin1String("kdeconnect.battery.request") Q_DECLARE_LOGGING_CATEGORY(KDECONNECT_PLUGIN_BATTERY) class BatteryDbusInterface; diff --git a/plugins/battery/kdeconnect_battery.json b/plugins/battery/kdeconnect_battery.json index c02b83ac8..eb67008ef 100644 --- a/plugins/battery/kdeconnect_battery.json +++ b/plugins/battery/kdeconnect_battery.json @@ -67,9 +67,9 @@ "Website": "http://albertvaka.wordpress.com" }, "X-KdeConnect-OutgoingPackageType": [ - "kdeconnect.battery" + "kdeconnect.battery.request" ], "X-KdeConnect-SupportedPackageType": [ "kdeconnect.battery" ] -} \ No newline at end of file +} diff --git a/plugins/findmyphone/findmyphoneplugin.h b/plugins/findmyphone/findmyphoneplugin.h index 03d15a683..6853670f5 100644 --- a/plugins/findmyphone/findmyphoneplugin.h +++ b/plugins/findmyphone/findmyphoneplugin.h @@ -25,7 +25,7 @@ #include -#define PACKAGE_TYPE_FINDMYPHONE QStringLiteral("kdeconnect.findmyphone") +#define PACKAGE_TYPE_FINDMYPHONE QStringLiteral("kdeconnect.findmyphone.request") class FindMyPhonePlugin : public KdeConnectPlugin diff --git a/plugins/findmyphone/kdeconnect_findmyphone.json b/plugins/findmyphone/kdeconnect_findmyphone.json index 122315f42..213f20924 100644 --- a/plugins/findmyphone/kdeconnect_findmyphone.json +++ b/plugins/findmyphone/kdeconnect_findmyphone.json @@ -12,7 +12,7 @@ "Name[x-test]": "xxDavid Edmundsonxx" } ], - "Description": "Find your lost phone by making it play an alarm sound ", + "Description": "Find your lost phone by making it play an alarm sound", "Description[ast]": "Alcuentra'l to preséu perdíu faciéndolu sonar ", "Description[ca@valencia]": "Troba el vostra telèfon perdut fent que reproduïsca un so d'alarma ", "Description[ca]": "Troba el vostra telèfon perdut fent que reprodueixi un so d'alarma ", @@ -39,28 +39,7 @@ "Icon": "edit-find", "Id": "kdeconnect_findmyphone", "License": "GPL", - "Name": "Find My Phone", - "Name[ast]": "Alcontrar el mio teléfonu", - "Name[ca@valencia]": "Troba el meu telèfon", - "Name[ca]": "Troba el meu telèfon", - "Name[cs]": "Najít můj telefon", - "Name[de]": "Telefon suchen", - "Name[es]": "Encontrar mi teléfono", - "Name[fi]": "Löydä puhelimeni", - "Name[gl]": "Atopar o móbil", - "Name[it]": "Trova il mio telefono", - "Name[ko]": "내 휴대폰 찾기", - "Name[nl]": "Zoek mijn telefoon", - "Name[pl]": "Znajdź mój telefon", - "Name[pt]": "Descobrir o Meu Telefone", - "Name[pt_BR]": "Encontrar meu telefone", - "Name[ru]": "Поиск телефона", - "Name[sk]": "Nájsť môj telefón", - "Name[sv]": "Hitta min telefon", - "Name[tr]": "Telefonumu Bul", - "Name[uk]": "Знайти телефон", - "Name[x-test]": "xxFind My Phonexx", - "Name[zh_CN]": "找到我的手机", + "Name": "Ring my phone", "ServiceTypes": [ "KdeConnect/Plugin" ], @@ -68,6 +47,6 @@ "Website": "http://kde.org" }, "X-KdeConnect-OutgoingPackageType": [ - "kdeconnect.findmyphone" + "kdeconnect.findmyphone.request" ] -} \ No newline at end of file +} diff --git a/plugins/lockdevice/kdeconnect_lockdevice.json b/plugins/lockdevice/kdeconnect_lockdevice.json index b163b48d4..cf00f95e7 100644 --- a/plugins/lockdevice/kdeconnect_lockdevice.json +++ b/plugins/lockdevice/kdeconnect_lockdevice.json @@ -64,9 +64,11 @@ "Website": "https://kde.org" }, "X-KdeConnect-OutgoingPackageType": [ + "kdeconnect.lock.request", "kdeconnect.lock" ], "X-KdeConnect-SupportedPackageType": [ + "kdeconnect.lock.request", "kdeconnect.lock" ] -} \ No newline at end of file +} diff --git a/plugins/lockdevice/lockdeviceplugin.cpp b/plugins/lockdevice/lockdeviceplugin.cpp index a24b66b9f..d48626070 100644 --- a/plugins/lockdevice/lockdeviceplugin.cpp +++ b/plugins/lockdevice/lockdeviceplugin.cpp @@ -52,7 +52,7 @@ bool LockDevicePlugin::isLocked() const } void LockDevicePlugin::setLocked(bool locked) { - NetworkPackage np(PACKAGE_TYPE_LOCK); + NetworkPackage np(PACKAGE_TYPE_LOCK_REQUEST); np.set("setLocked", locked); sendPackage(np); } @@ -95,7 +95,7 @@ void LockDevicePlugin::connected() { QDBusConnection::sessionBus().registerObject(dbusPath(), this, QDBusConnection::ExportAllContents); - NetworkPackage np(PACKAGE_TYPE_LOCK); + NetworkPackage np(PACKAGE_TYPE_LOCK_REQUEST); np.set("requestLocked", QVariant()); sendPackage(np); } diff --git a/plugins/lockdevice/lockdeviceplugin.h b/plugins/lockdevice/lockdeviceplugin.h index 834ae3a13..b1672ce00 100644 --- a/plugins/lockdevice/lockdeviceplugin.h +++ b/plugins/lockdevice/lockdeviceplugin.h @@ -28,6 +28,7 @@ class OrgFreedesktopScreenSaverInterface; #define PACKAGE_TYPE_LOCK QLatin1String("kdeconnect.lock") +#define PACKAGE_TYPE_LOCK_REQUEST QLatin1String("kdeconnect.lock.request") class Q_DECL_EXPORT LockDevicePlugin : public KdeConnectPlugin diff --git a/plugins/mousepad/CMakeLists.txt b/plugins/mousepad/CMakeLists.txt index 85798afbe..f76ce51d5 100644 --- a/plugins/mousepad/CMakeLists.txt +++ b/plugins/mousepad/CMakeLists.txt @@ -1,22 +1,32 @@ -set(kdeconnect_mousepad_SRCS - mousepadplugin.cpp -) +find_package(LibFakeKey) +set_package_properties(LibFakeKey PROPERTIES DESCRIPTION "fake key events" + URL "https://www.yoctoproject.org/tools-resources/projects/matchbox" + TYPE OPTIONAL + PURPOSE "Needed for the remote mousepad plugin" + ) -find_package(XTest REQUIRED) -find_package(X11 REQUIRED) -find_package(LibFakeKey REQUIRED) -find_package(Qt5X11Extras REQUIRED) +if (LibFakeKey_FOUND) + find_package(XTest REQUIRED) + find_package(X11 REQUIRED) + find_package(Qt5X11Extras REQUIRED) +endif() find_package(KF5Wayland 5.3.90) +set(HAVE_X11 ${LibFakeKey_FOUND}) set(HAVE_WAYLAND ${KF5Wayland_FOUND}) configure_file(config-mousepad.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-mousepad.h ) -kdeconnect_add_plugin(kdeconnect_mousepad JSON kdeconnect_mousepad.json SOURCES ${kdeconnect_mousepad_SRCS}) +kdeconnect_add_plugin(kdeconnect_mousepad JSON kdeconnect_mousepad.json SOURCES mousepadplugin.cpp) -include_directories(${XTEST_INCLUDE_DIRS} ${X11_INCLUDE_DIR} ${LibFakeKey_INCLUDE_DIRS}) +if (HAVE_X11) + include_directories(${XTEST_INCLUDE_DIRS} ${X11_INCLUDE_DIR} ${LibFakeKey_INCLUDE_DIRS}) +endif() -target_link_libraries(kdeconnect_mousepad kdeconnectcore Qt5::Gui Qt5::X11Extras ${X11_LIBRARIES} ${XTEST_LIBRARIES} ${LibFakeKey_LIBRARIES} KF5::I18n) +target_link_libraries(kdeconnect_mousepad kdeconnectcore Qt5::Gui KF5::I18n) if(HAVE_WAYLAND) target_link_libraries(kdeconnect_mousepad KF5::WaylandClient) endif() +if(HAVE_X11) + target_link_libraries(kdeconnect_mousepad Qt5::X11Extras ${X11_LIBRARIES} ${XTEST_LIBRARIES} ${LibFakeKey_LIBRARIES}) +endif() diff --git a/plugins/mousepad/config-mousepad.h.cmake b/plugins/mousepad/config-mousepad.h.cmake index e6830040c..e962b6ab5 100644 --- a/plugins/mousepad/config-mousepad.h.cmake +++ b/plugins/mousepad/config-mousepad.h.cmake @@ -1 +1,2 @@ #cmakedefine01 HAVE_WAYLAND +#cmakedefine01 HAVE_X11 diff --git a/plugins/mousepad/kdeconnect_mousepad.json b/plugins/mousepad/kdeconnect_mousepad.json index e90d2133f..463ff09cf 100644 --- a/plugins/mousepad/kdeconnect_mousepad.json +++ b/plugins/mousepad/kdeconnect_mousepad.json @@ -67,6 +67,6 @@ }, "X-KdeConnect-OutgoingPackageType": [], "X-KdeConnect-SupportedPackageType": [ - "kdeconnect.mousepad" + "kdeconnect.input.request" ] -} \ No newline at end of file +} diff --git a/plugins/mousepad/mousepadplugin.cpp b/plugins/mousepad/mousepadplugin.cpp index cc172ab1f..ac9eaa051 100644 --- a/plugins/mousepad/mousepadplugin.cpp +++ b/plugins/mousepad/mousepadplugin.cpp @@ -24,10 +24,13 @@ #include #include #include + +#if HAVE_X11 #include #include #include #include +#endif #if HAVE_WAYLAND #include @@ -45,6 +48,7 @@ enum MouseButtons { MouseWheelDown = 5 }; +#if HAVE_X11 //Translation table to keep in sync within all the implementations int SpecialKeysMap[] = { 0, // Invalid @@ -81,12 +85,19 @@ int SpecialKeysMap[] = { XK_F11, // 31 XK_F12, // 32 }; +#endif template size_t arraySize(T(&arr)[N]) { (void)arr; return N; } MousepadPlugin::MousepadPlugin(QObject* parent, const QVariantList& args) - : KdeConnectPlugin(parent, args), m_fakekey(nullptr), m_x11(QX11Info::isPlatformX11()) + : KdeConnectPlugin(parent, args) +#if HAVE_X11 + , m_fakekey(nullptr) + , m_x11(QX11Info::isPlatformX11()) +#else + , m_x11(false) +#endif #if HAVE_WAYLAND , m_waylandInput(nullptr) , m_waylandAuthenticationRequested(false) @@ -99,17 +110,21 @@ MousepadPlugin::MousepadPlugin(QObject* parent, const QVariantList& args) MousepadPlugin::~MousepadPlugin() { +#if HAVE_X11 if (m_fakekey) { free(m_fakekey); m_fakekey = nullptr; } +#endif } bool MousepadPlugin::receivePackage(const NetworkPackage& np) { +#if HAVE_X11 if (m_x11) { return handlePackageX11(np); } +#endif #if HAVE_WAYLAND if (m_waylandInput) { if (!m_waylandAuthenticationRequested) { @@ -122,6 +137,7 @@ bool MousepadPlugin::receivePackage(const NetworkPackage& np) return false; } +#if HAVE_X11 bool MousepadPlugin::handlePackageX11(const NetworkPackage &np) { //qDebug() << np.serialize(); @@ -229,6 +245,7 @@ bool MousepadPlugin::handlePackageX11(const NetworkPackage &np) } return true; } +#endif #if HAVE_WAYLAND void MousepadPlugin::setupWaylandIntegration() diff --git a/plugins/mousepad/mousepadplugin.h b/plugins/mousepad/mousepadplugin.h index 110f58e28..da8fad8a3 100644 --- a/plugins/mousepad/mousepadplugin.h +++ b/plugins/mousepad/mousepadplugin.h @@ -25,7 +25,7 @@ #include #include -#define PACKAGE_TYPE_MOUSEPAD QLatin1String("kdeconnect.mousepad") +#define PACKAGE_TYPE_INPUT_REQUEST QLatin1String("kdeconnect.input.request") struct FakeKey; @@ -52,13 +52,17 @@ public: virtual void connected() override { } private: +#if HAVE_X11 bool handlePackageX11(const NetworkPackage& np); +#endif #if HAVE_WAYLAND void setupWaylandIntegration(); bool handPackageWayland(const NetworkPackage& np); #endif +#if HAVE_X11 FakeKey* m_fakekey; +#endif const bool m_x11; #if HAVE_WAYLAND KWayland::Client::FakeInput *m_waylandInput; diff --git a/plugins/mpriscontrol/kdeconnect_mpriscontrol.json b/plugins/mpriscontrol/kdeconnect_mpriscontrol.json index 872ce3790..5cfeb88ea 100644 --- a/plugins/mpriscontrol/kdeconnect_mpriscontrol.json +++ b/plugins/mpriscontrol/kdeconnect_mpriscontrol.json @@ -70,6 +70,6 @@ "kdeconnect.mpris" ], "X-KdeConnect-SupportedPackageType": [ - "kdeconnect.mpris" + "kdeconnect.mpris.request" ] -} \ No newline at end of file +} diff --git a/plugins/mpriscontrol/mpriscontrolplugin.h b/plugins/mpriscontrol/mpriscontrolplugin.h index f61438a04..9a963f596 100644 --- a/plugins/mpriscontrol/mpriscontrolplugin.h +++ b/plugins/mpriscontrol/mpriscontrolplugin.h @@ -28,7 +28,7 @@ #include -#define PACKAGE_TYPE_MPRIS QLatin1String("kdeconnect.mpris") +#define PACKAGE_TYPE_MPRIS QLatin1String("kdeconnect.mpris.request") Q_DECLARE_LOGGING_CATEGORY(KDECONNECT_PLUGIN_MPRIS) diff --git a/plugins/mprisremote/kdeconnect_mprisremote.json b/plugins/mprisremote/kdeconnect_mprisremote.json index 50ffc1591..8815bde2c 100644 --- a/plugins/mprisremote/kdeconnect_mprisremote.json +++ b/plugins/mprisremote/kdeconnect_mprisremote.json @@ -51,9 +51,9 @@ "Website": "https://kde.org" }, "X-KdeConnect-OutgoingPackageType": [ - "kdeconnect.mpris" + "kdeconnect.mpris.request" ], "X-KdeConnect-SupportedPackageType": [ "kdeconnect.mpris" ] -} \ No newline at end of file +} diff --git a/plugins/mprisremote/mprisremoteplugin.cpp b/plugins/mprisremote/mprisremoteplugin.cpp index 4f2e34007..c9be7da1e 100644 --- a/plugins/mprisremote/mprisremoteplugin.cpp +++ b/plugins/mprisremote/mprisremoteplugin.cpp @@ -52,7 +52,7 @@ MprisRemotePlugin::~MprisRemotePlugin() bool MprisRemotePlugin::receivePackage(const NetworkPackage& np) { - if (np.type() != PACKAGE_TYPE_MPRIS) + if (np.type() != PACKAGE_TYPE_MPRIS_REQUEST) return false; if (np.has("nowPlaying") || np.has("volume") || np.has("isPlaying") || np.has("length") || np.has("pos")) { @@ -97,7 +97,7 @@ QString MprisRemotePlugin::dbusPath() const void MprisRemotePlugin::requestPlayerStatus() { - NetworkPackage np(PACKAGE_TYPE_MPRIS); + NetworkPackage np(PACKAGE_TYPE_MPRIS_REQUEST); np.set("player",m_player); np.set("requestNowPlaying",true); np.set("requestVolume",true); @@ -106,14 +106,14 @@ void MprisRemotePlugin::requestPlayerStatus() void MprisRemotePlugin::requestPlayerList() { - NetworkPackage np(PACKAGE_TYPE_MPRIS); + NetworkPackage np(PACKAGE_TYPE_MPRIS_REQUEST); np.set("requestPlayerList", true); sendPackage(np); } void MprisRemotePlugin::sendAction(const QString& action) { - NetworkPackage np(PACKAGE_TYPE_MPRIS); + NetworkPackage np(PACKAGE_TYPE_MPRIS_REQUEST); np.set("player", m_player); np.set("action", action); sendPackage(np); @@ -121,7 +121,7 @@ void MprisRemotePlugin::sendAction(const QString& action) void MprisRemotePlugin::seek(int offset) const { - NetworkPackage np(PACKAGE_TYPE_MPRIS); + NetworkPackage np(PACKAGE_TYPE_MPRIS_REQUEST); np.set("player", m_player); np.set("Seek", offset); sendPackage(np); @@ -129,7 +129,7 @@ void MprisRemotePlugin::seek(int offset) const void MprisRemotePlugin::setVolume(int volume) { - NetworkPackage np(PACKAGE_TYPE_MPRIS); + NetworkPackage np(PACKAGE_TYPE_MPRIS_REQUEST); np.set("player", m_player); np.set("setVolume",volume); sendPackage(np); @@ -137,7 +137,7 @@ void MprisRemotePlugin::setVolume(int volume) void MprisRemotePlugin::setPosition(int position) { - NetworkPackage np(PACKAGE_TYPE_MPRIS); + NetworkPackage np(PACKAGE_TYPE_MPRIS_REQUEST); np.set("player", m_player); np.set("SetPosition", position); sendPackage(np); diff --git a/plugins/mprisremote/mprisremoteplugin.h b/plugins/mprisremote/mprisremoteplugin.h index 886e6c5ad..606eae1f9 100644 --- a/plugins/mprisremote/mprisremoteplugin.h +++ b/plugins/mprisremote/mprisremoteplugin.h @@ -25,7 +25,7 @@ #include -#define PACKAGE_TYPE_MPRIS QLatin1String("kdeconnect.mpris") +#define PACKAGE_TYPE_MPRIS_REQUEST QLatin1String("kdeconnect.mpris.request") class Q_DECL_EXPORT MprisRemotePlugin : public KdeConnectPlugin diff --git a/plugins/notifications/CMakeLists.txt b/plugins/notifications/CMakeLists.txt index 464811ede..ecf325116 100644 --- a/plugins/notifications/CMakeLists.txt +++ b/plugins/notifications/CMakeLists.txt @@ -4,8 +4,6 @@ set(kdeconnect_notifications_SRCS notification.cpp notificationsplugin.cpp notificationsdbusinterface.cpp - notificationslistener.cpp - notifyingapplication.cpp ) kdeconnect_add_plugin(kdeconnect_notifications JSON kdeconnect_notifications.json SOURCES ${kdeconnect_notifications_SRCS}) @@ -18,24 +16,3 @@ target_link_libraries(kdeconnect_notifications KF5::IconThemes KF5::ConfigCore ) - -####################################### -# Config - -set( kdeconnect_notifications_config_SRCS - notifications_config.cpp - notifyingapplication.cpp - notifyingapplicationmodel.cpp -) -ki18n_wrap_ui( kdeconnect_notifications_config_SRCS notifications_config.ui ) - -add_library(kdeconnect_notifications_config MODULE ${kdeconnect_notifications_config_SRCS} ) -target_link_libraries( kdeconnect_notifications_config - kdeconnectcore - kdeconnectpluginkcm - KF5::I18n - KF5::KCMUtils -) - -install( TARGETS kdeconnect_notifications_config DESTINATION ${PLUGIN_INSTALL_DIR} ) -install( FILES kdeconnect_notifications_config.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) diff --git a/plugins/notifications/kdeconnect_notifications.json b/plugins/notifications/kdeconnect_notifications.json index d69643676..52bb3df4d 100644 --- a/plugins/notifications/kdeconnect_notifications.json +++ b/plugins/notifications/kdeconnect_notifications.json @@ -8,58 +8,12 @@ "Name[x-test]": "xxAlbert Vacaxx" } ], - "Description": "Show phone notifications on your computer and keep them in sync", - "Description[ast]": "Amuesa los avisos del preséu nel to ordenador in caltiénlos sincronizaos", - "Description[ca@valencia]": "Mostra les notificacions del telèfon a l'ordinador i les manté sincronitzades", - "Description[ca]": "Mostra les notificacions del telèfon a l'ordinador i les manté sincronitzades", - "Description[cs]": "Zobrazit upozornění telefonu v počítači a udržovat je synchronizovaná", - "Description[de]": "Benachrichtigungen auf Ihren Rechner anzeigen und abgleichen", - "Description[es]": "Mostrar notificaciones del teléfono en su equipo y mantenerlas en sincronía", - "Description[fi]": "Näytä puhelimen ilmoitukset tietokoneellasi ja pidä ne ajan tasalla", - "Description[gl]": "Mostre notificacións dun teléfono móbil no computador e deixe que as notificacións se sincronicen co teléfono.", - "Description[hu]": "A telefon értesítéseinek megjelenítése a számítógépén és azok szinkronizációja", - "Description[it]": "Mostra le notifiche del telefono sul tuo computer e tienile sincronizzate", - "Description[ko]": "휴대폰 알림을 컴퓨터에 표시하기", - "Description[nl]": "Telefoonmeldingen op uw computer tonen en ze gesynchroniseerd houden", - "Description[nn]": "Vis telefonvarslingar på datamaskina, og hald dei synkronisert", - "Description[pl]": "Pokaż powiadomienia telefonu na swoim komputerze i synchronizuj je", - "Description[pt]": "Mostrar as notificações do telefone no seu computador e mantê-las sincronizadas", - "Description[pt_BR]": "Mostra as notificações do celular no seu computador e as mantém sincronizadas", - "Description[ru]": "Показ уведомлений с телефона на компьютере и их синхронизация", - "Description[sk]": "Zobraziť oznámenia telefónu na vašom počítači a udržať ich synchronizované", - "Description[sv]": "Visa telefonunderrättelser på datorn och håll dem synkroniserade", - "Description[tr]": "Telefon bildirimlerini bilgisayarınızla eşitler ve eşzamanlı tutar", - "Description[uk]": "Показ сповіщень з телефону на вашому комп’ютері та підтримання синхронізації даних сповіщень", - "Description[x-test]": "xxShow phone notifications on your computer and keep them in syncxx", - "Description[zh_CN]": "在电脑显示手机通知并保持同步", + "Description": "Show device's notifications on this computer and keep them in sync", "EnabledByDefault": true, "Icon": "preferences-desktop-notification", "Id": "kdeconnect_notifications", "License": "GPL", - "Name": "Notification sync", - "Name[ast]": "Sincronización d'avisos", - "Name[ca@valencia]": "Sincronització de les notificacions", - "Name[ca]": "Sincronització de les notificacions", - "Name[cs]": "Synchronizace upozornění", - "Name[de]": "Benachrichtigungs-Abgleich", - "Name[es]": "Sincronización de notificaciones", - "Name[fi]": "Ilmoitusten synkronointi", - "Name[gl]": "Sincronización de notificacións", - "Name[hu]": "Értesítésszinkronizáció", - "Name[it]": "Sincronizzazione notifiche", - "Name[ko]": "알림 동기화", - "Name[nl]": "Synchronisatie van meldingen", - "Name[nn]": "Synkronisering av varslingar", - "Name[pl]": "Powiadomienia synchronizacji", - "Name[pt]": "Sincronização de notificações", - "Name[pt_BR]": "Sincronização de notificações", - "Name[ru]": "Синхронизация уведомлений", - "Name[sk]": "Synchronizácia pripomienok", - "Name[sv]": "Underrättelsesynkronisering", - "Name[tr]": "Bildirim eşitleme", - "Name[uk]": "Синхронізація сповіщень", - "Name[x-test]": "xxNotification syncxx", - "Name[zh_CN]": "通知同步", + "Name": "Receive notifications", "ServiceTypes": [ "KdeConnect/Plugin" ], @@ -67,9 +21,9 @@ "Website": "http://albertvaka.wordpress.com" }, "X-KdeConnect-OutgoingPackageType": [ - "kdeconnect.notification" + "kdeconnect.notification.request" ], "X-KdeConnect-SupportedPackageType": [ "kdeconnect.notification" ] -} \ No newline at end of file +} diff --git a/plugins/notifications/notificationsdbusinterface.cpp b/plugins/notifications/notificationsdbusinterface.cpp index 8d4a02178..34bd373e8 100644 --- a/plugins/notifications/notificationsdbusinterface.cpp +++ b/plugins/notifications/notificationsdbusinterface.cpp @@ -70,7 +70,7 @@ void NotificationsDbusInterface::processPackage(const NetworkPackage& np) removeNotification(id); } else if (np.get("isRequest")) { for (const auto& n: mNotifications) { - NetworkPackage np(PACKAGE_TYPE_NOTIFICATION); + NetworkPackage np(PACKAGE_TYPE_NOTIFICATION_REQUEST); np.set("id", n->internalId()); np.set("appName", n->appName()); np.set("ticker", n->ticker()); @@ -154,7 +154,7 @@ void NotificationsDbusInterface::removeNotification(const QString& internalId) void NotificationsDbusInterface::dismissRequested(const QString& internalId) { - NetworkPackage np(PACKAGE_TYPE_NOTIFICATION); + NetworkPackage np(PACKAGE_TYPE_NOTIFICATION_REQUEST); np.set("cancel", internalId); mPlugin->sendPackage(np); diff --git a/plugins/notifications/notificationsplugin.cpp b/plugins/notifications/notificationsplugin.cpp index f47f5d8dc..5cc281d95 100644 --- a/plugins/notifications/notificationsplugin.cpp +++ b/plugins/notifications/notificationsplugin.cpp @@ -21,7 +21,6 @@ #include "notificationsplugin.h" #include "notificationsdbusinterface.h" -#include "notificationslistener.h" #include "notification_debug.h" #include @@ -34,12 +33,11 @@ NotificationsPlugin::NotificationsPlugin(QObject* parent, const QVariantList& ar : KdeConnectPlugin(parent, args) { notificationsDbusInterface = new NotificationsDbusInterface(this); - notificationsListener = new NotificationsListener(this, notificationsDbusInterface); } void NotificationsPlugin::connected() { - NetworkPackage np(PACKAGE_TYPE_NOTIFICATION); + NetworkPackage np(PACKAGE_TYPE_NOTIFICATION_REQUEST); np.set("request", true); sendPackage(np); } diff --git a/plugins/notifications/notificationsplugin.h b/plugins/notifications/notificationsplugin.h index a0e240539..46bd1e2e7 100644 --- a/plugins/notifications/notificationsplugin.h +++ b/plugins/notifications/notificationsplugin.h @@ -24,7 +24,8 @@ #include #include -#define PACKAGE_TYPE_NOTIFICATION QLatin1String("kdeconnect.notification") + +#define PACKAGE_TYPE_NOTIFICATION_REQUEST QLatin1String("kdeconnect.notification.request") /* * This class is just a proxy for NotificationsDbusInterface diff --git a/plugins/remotecontrol/kdeconnect_remotecontrol.json b/plugins/remotecontrol/kdeconnect_remotecontrol.json index 819497cd9..e283f770e 100644 --- a/plugins/remotecontrol/kdeconnect_remotecontrol.json +++ b/plugins/remotecontrol/kdeconnect_remotecontrol.json @@ -64,7 +64,7 @@ "Website": "https://kde.org" }, "X-KdeConnect-OutgoingPackageType": [ - "kdeconnect.mousepad" + "kdeconnect.input.request" ], "X-KdeConnect-SupportedPackageType": [] -} \ No newline at end of file +} diff --git a/plugins/remotecontrol/remotecontrolplugin.cpp b/plugins/remotecontrol/remotecontrolplugin.cpp index 02469f804..283e3425d 100644 --- a/plugins/remotecontrol/remotecontrolplugin.cpp +++ b/plugins/remotecontrol/remotecontrolplugin.cpp @@ -44,7 +44,7 @@ RemoteControlPlugin::~RemoteControlPlugin() void RemoteControlPlugin::moveCursor(const QPoint &p) { - NetworkPackage np(PACKAGE_TYPE_MOUSEPAD); + NetworkPackage np(PACKAGE_TYPE_INPUT_REQUEST); np.set("dx", p.x()); np.set("dy", p.y()); sendPackage(np); @@ -52,7 +52,7 @@ void RemoteControlPlugin::moveCursor(const QPoint &p) void RemoteControlPlugin::sendCommand(const QString &name, bool val) { - NetworkPackage np(PACKAGE_TYPE_MOUSEPAD); + NetworkPackage np(PACKAGE_TYPE_INPUT_REQUEST); np.set(name, val); sendPackage(np); } diff --git a/plugins/remotecontrol/remotecontrolplugin.h b/plugins/remotecontrol/remotecontrolplugin.h index 96d0269b8..7236fdd3c 100644 --- a/plugins/remotecontrol/remotecontrolplugin.h +++ b/plugins/remotecontrol/remotecontrolplugin.h @@ -25,7 +25,7 @@ #include -#define PACKAGE_TYPE_MOUSEPAD QLatin1String("kdeconnect.mousepad") +#define PACKAGE_TYPE_INPUT_REQUEST QLatin1String("kdeconnect.input.request") class Q_DECL_EXPORT RemoteControlPlugin : public KdeConnectPlugin diff --git a/plugins/runcommand/kdeconnect_runcommand.json b/plugins/runcommand/kdeconnect_runcommand.json index b38b6deb3..0e82d8b74 100644 --- a/plugins/runcommand/kdeconnect_runcommand.json +++ b/plugins/runcommand/kdeconnect_runcommand.json @@ -71,6 +71,6 @@ "kdeconnect.runcommand" ], "X-KdeConnect-SupportedPackageType": [ - "kdeconnect.runcommand" + "kdeconnect.runcommand.request" ] -} \ No newline at end of file +} diff --git a/plugins/sendnotifications/CMakeLists.txt b/plugins/sendnotifications/CMakeLists.txt new file mode 100644 index 000000000..76ad88824 --- /dev/null +++ b/plugins/sendnotifications/CMakeLists.txt @@ -0,0 +1,38 @@ +find_package(KF5 REQUIRED COMPONENTS Notifications KCMUtils I18n IconThemes) + +set(kdeconnect_sendnotifications_SRCS + sendnotificationsplugin.cpp + notificationslistener.cpp + notifyingapplication.cpp +) + +kdeconnect_add_plugin(kdeconnect_sendnotifications JSON kdeconnect_sendnotifications.json SOURCES ${kdeconnect_sendnotifications_SRCS}) + +target_link_libraries(kdeconnect_sendnotifications + kdeconnectcore + Qt5::DBus + KF5::Notifications + KF5::I18n + KF5::IconThemes +) + +####################################### +# Config + +set( kdeconnect_sendnotifications_config_SRCS + sendnotifications_config.cpp + notifyingapplication.cpp + notifyingapplicationmodel.cpp +) +ki18n_wrap_ui( kdeconnect_sendnotifications_config_SRCS sendnotifications_config.ui ) + +add_library(kdeconnect_sendnotifications_config MODULE ${kdeconnect_sendnotifications_config_SRCS} ) +target_link_libraries( kdeconnect_sendnotifications_config + kdeconnectcore + kdeconnectpluginkcm + KF5::I18n + KF5::KCMUtils +) + +install( TARGETS kdeconnect_sendnotifications_config DESTINATION ${PLUGIN_INSTALL_DIR} ) +install( FILES kdeconnect_sendnotifications_config.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) diff --git a/plugins/sendnotifications/kdeconnect_sendnotifications.json b/plugins/sendnotifications/kdeconnect_sendnotifications.json new file mode 100644 index 000000000..4cec226d2 --- /dev/null +++ b/plugins/sendnotifications/kdeconnect_sendnotifications.json @@ -0,0 +1,29 @@ +{ + "Encoding": "UTF-8", + "KPlugin": { + "Authors": [ + { + "Email": "holger.k@elberer.de", + "Name": "Holger Kaelberer", + "Name[x-test]": "xxAlbert Vacaxx" + } + ], + "Description": "Broadcast this computer's notifications, so the can be shown in other devices.", + "EnabledByDefault": false, + "Icon": "preferences-desktop-notification", + "Id": "kdeconnect_sendnotifications", + "License": "GPL", + "Name": "Send notifications", + "ServiceTypes": [ + "KdeConnect/Plugin" + ], + "Version": "0.1", + "Website": "http://albertvaka.wordpress.com" + }, + "X-KdeConnect-OutgoingPackageType": [ + "kdeconnect.notification" + ], + "X-KdeConnect-SupportedPackageType": [ + "kdeconnect.notification.request" + ] +} diff --git a/plugins/notifications/kdeconnect_notifications_config.desktop b/plugins/sendnotifications/kdeconnect_sendnotifications_config.desktop similarity index 93% rename from plugins/notifications/kdeconnect_notifications_config.desktop rename to plugins/sendnotifications/kdeconnect_sendnotifications_config.desktop index b582e1f97..51d937ab1 100644 --- a/plugins/notifications/kdeconnect_notifications_config.desktop +++ b/plugins/sendnotifications/kdeconnect_sendnotifications_config.desktop @@ -2,8 +2,8 @@ Type=Service X-KDE-ServiceTypes=KCModule -X-KDE-Library=kdeconnect_notifications_config -X-KDE-ParentComponents=kdeconnect_notifications +X-KDE-Library=kdeconnect_sendnotifications_config +X-KDE-ParentComponents=kdeconnect_sendnotifications Name=Notification synchronization plugin settings Name[ar]=إعدادات ملحقة مزامنة الإخطارات diff --git a/plugins/notifications/notificationslistener.cpp b/plugins/sendnotifications/notificationslistener.cpp similarity index 84% rename from plugins/notifications/notificationslistener.cpp rename to plugins/sendnotifications/notificationslistener.cpp index 34a91919b..6e7fafff9 100644 --- a/plugins/notifications/notificationslistener.cpp +++ b/plugins/sendnotifications/notificationslistener.cpp @@ -33,16 +33,13 @@ #include #include "notificationslistener.h" -#include "notificationsplugin.h" -#include "notification_debug.h" -#include "notificationsdbusinterface.h" +#include "sendnotificationsplugin.h" +#include "sendnotification_debug.h" #include "notifyingapplication.h" -NotificationsListener::NotificationsListener(KdeConnectPlugin* aPlugin, - NotificationsDbusInterface* aDbusInterface) +NotificationsListener::NotificationsListener(KdeConnectPlugin* aPlugin) : QDBusAbstractAdaptor(aPlugin), - mPlugin(aPlugin), - dbusInterface(aDbusInterface) + mPlugin(aPlugin) { qRegisterMetaTypeStreamOperators("NotifyingApplication"); @@ -51,12 +48,12 @@ NotificationsListener::NotificationsListener(KdeConnectPlugin* aPlugin, this, QDBusConnection::ExportScriptableContents); if (!ret) - qCWarning(KDECONNECT_PLUGIN_NOTIFICATION) + qCWarning(KDECONNECT_PLUGIN_SENDNOTIFICATION) << "Error registering notifications listener for device" << mPlugin->device()->name() << ":" << QDBusConnection::sessionBus().lastError(); else - qCDebug(KDECONNECT_PLUGIN_NOTIFICATION) + qCDebug(KDECONNECT_PLUGIN_SENDNOTIFICATION) << "Registered notifications listener for device" << mPlugin->device()->name(); @@ -73,7 +70,7 @@ NotificationsListener::NotificationsListener(KdeConnectPlugin* aPlugin, NotificationsListener::~NotificationsListener() { - qCDebug(KDECONNECT_PLUGIN_NOTIFICATION) << "Destroying NotificationsListener"; + qCDebug(KDECONNECT_PLUGIN_SENDNOTIFICATION) << "Destroying NotificationsListener"; QDBusInterface iface("org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus"); QDBusMessage res = iface.call("RemoveMatch", @@ -104,7 +101,7 @@ void NotificationsListener::loadApplications() if (!applications.contains(app.name)) applications.insert(app.name, app); } - //qCDebug(KDECONNECT_PLUGIN_NOTIFICATION) << "Loaded" << applications.size() << " applications"; + //qCDebug(KDECONNECT_PLUGIN_SENDNOTIFICATION) << "Loaded" << applications.size() << " applications"; } uint NotificationsListener::Notify(const QString &appName, uint replacesId, @@ -116,7 +113,7 @@ uint NotificationsListener::Notify(const QString &appName, uint replacesId, static int id = 0; Q_UNUSED(actions); - //qCDebug(KDECONNECT_PLUGIN_NOTIFICATION) << "Got notification appName=" << appName << "replacesId=" << replacesId << "appIcon=" << appIcon << "summary=" << summary << "body=" << body << "actions=" << actions << "hints=" << hints << "timeout=" << timeout; + //qCDebug(KDECONNECT_PLUGIN_SENDNOTIFICATION) << "Got notification appName=" << appName << "replacesId=" << replacesId << "appIcon=" << appIcon << "summary=" << summary << "body=" << body << "actions=" << actions << "hints=" << hints << "timeout=" << timeout; // skip our own notifications if (appName == mTranslatedAppName) @@ -135,7 +132,7 @@ uint NotificationsListener::Notify(const QString &appName, uint replacesId, for (const auto& a: applications.values()) list << QVariant::fromValue(a); mPlugin->config()->setList("applications", list); - //qCDebug(KDECONNECT_PLUGIN_NOTIFICATION) << "Added new application to config:" << app; + //qCDebug(KDECONNECT_PLUGIN_SENDNOTIFICATION) << "Added new application to config:" << app; } else app = applications.value(appName); @@ -164,8 +161,8 @@ uint NotificationsListener::Notify(const QString &appName, uint replacesId, app.blacklistExpression.match(ticker).hasMatch()) return 0; - //qCDebug(KDECONNECT_PLUGIN_NOTIFICATION) << "Sending notification from" << appName << ":" < 0 ? replacesId : ++id)); np.set("appName", appName); np.set("ticker", ticker); @@ -184,11 +181,11 @@ uint NotificationsListener::Notify(const QString &appName, uint replacesId, KIconTheme hicolor(QStringLiteral("hicolor")); if (hicolor.isValid()) { iconPath = hicolor.iconPath(appIcon + ".png", size, KIconLoader::MatchBest); - //qCDebug(KDECONNECT_PLUGIN_NOTIFICATION) << "Found non-png icon in default theme trying fallback to hicolor:" << iconPath; + //qCDebug(KDECONNECT_PLUGIN_SENDNOTIFICATION) << "Found non-png icon in default theme trying fallback to hicolor:" << iconPath; } } if (iconPath.endsWith(QLatin1String(".png"))) { - //qCDebug(KDECONNECT_PLUGIN_NOTIFICATION) << "Appending icon " << iconPath; + //qCDebug(KDECONNECT_PLUGIN_SENDNOTIFICATION) << "Appending icon " << iconPath; QSharedPointer iconFile(new QFile(iconPath)); np.setPayload(iconFile, iconFile->size()); } diff --git a/plugins/notifications/notificationslistener.h b/plugins/sendnotifications/notificationslistener.h similarity index 88% rename from plugins/notifications/notificationslistener.h rename to plugins/sendnotifications/notificationslistener.h index 7ba01d8c7..aeed3a745 100644 --- a/plugins/notifications/notificationslistener.h +++ b/plugins/sendnotifications/notificationslistener.h @@ -22,7 +22,6 @@ #include class KdeConnectPlugin; -class NotificationsDbusInterface; class Notification; struct NotifyingApplication; @@ -32,13 +31,11 @@ class NotificationsListener : public QDBusAbstractAdaptor Q_CLASSINFO("D-Bus Interface", "org.freedesktop.Notifications") public: - explicit NotificationsListener(KdeConnectPlugin* aPlugin, - NotificationsDbusInterface* aDbusInterface); + explicit NotificationsListener(KdeConnectPlugin* aPlugin); virtual ~NotificationsListener(); protected: KdeConnectPlugin* mPlugin; - NotificationsDbusInterface* dbusInterface; QHash applications; public Q_SLOTS: diff --git a/plugins/notifications/notifyingapplication.cpp b/plugins/sendnotifications/notifyingapplication.cpp similarity index 100% rename from plugins/notifications/notifyingapplication.cpp rename to plugins/sendnotifications/notifyingapplication.cpp diff --git a/plugins/notifications/notifyingapplication.h b/plugins/sendnotifications/notifyingapplication.h similarity index 100% rename from plugins/notifications/notifyingapplication.h rename to plugins/sendnotifications/notifyingapplication.h diff --git a/plugins/notifications/notifyingapplicationmodel.cpp b/plugins/sendnotifications/notifyingapplicationmodel.cpp similarity index 100% rename from plugins/notifications/notifyingapplicationmodel.cpp rename to plugins/sendnotifications/notifyingapplicationmodel.cpp diff --git a/plugins/notifications/notifyingapplicationmodel.h b/plugins/sendnotifications/notifyingapplicationmodel.h similarity index 100% rename from plugins/notifications/notifyingapplicationmodel.h rename to plugins/sendnotifications/notifyingapplicationmodel.h diff --git a/plugins/sendnotifications/sendnotification_debug.h b/plugins/sendnotifications/sendnotification_debug.h new file mode 100644 index 000000000..9050139ae --- /dev/null +++ b/plugins/sendnotifications/sendnotification_debug.h @@ -0,0 +1,28 @@ +/** + * Copyright 2014 Alejandro Fiestas Olivares + * + * 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 SENDNOTIFICATION_DEBUG_H +#define SENDNOTIFICATION_DEBUG_H + +#include + +Q_DECLARE_LOGGING_CATEGORY(KDECONNECT_PLUGIN_SENDNOTIFICATION) + +#endif //NOTIFICATION_DEBUG_H diff --git a/plugins/notifications/notifications_config.cpp b/plugins/sendnotifications/sendnotifications_config.cpp similarity index 85% rename from plugins/notifications/notifications_config.cpp rename to plugins/sendnotifications/sendnotifications_config.cpp index d9532a78d..59a42dfe6 100644 --- a/plugins/notifications/notifications_config.cpp +++ b/plugins/sendnotifications/sendnotifications_config.cpp @@ -18,18 +18,18 @@ * along with this program. If not, see . */ -#include "notifications_config.h" -#include "ui_notifications_config.h" +#include "sendnotifications_config.h" +#include "ui_sendnotifications_config.h" #include "notifyingapplicationmodel.h" #include #include -K_PLUGIN_FACTORY(NotificationsConfigFactory, registerPlugin();) +K_PLUGIN_FACTORY(SendNotificationsConfigFactory, registerPlugin();) -NotificationsConfig::NotificationsConfig(QWidget *parent, const QVariantList& args) - : KdeConnectPluginKcm(parent, args, "kdeconnect_notifications_config") - , m_ui(new Ui::NotificationsConfigUi()) +SendNotificationsConfig::SendNotificationsConfig(QWidget *parent, const QVariantList& args) + : KdeConnectPluginKcm(parent, args, "kdeconnect_sendnotifications_config") + , m_ui(new Ui::SendNotificationsConfigUi()) , appModel(new NotifyingApplicationModel) { qRegisterMetaTypeStreamOperators("NotifyingApplication"); @@ -58,12 +58,12 @@ NotificationsConfig::NotificationsConfig(QWidget *parent, const QVariantList& ar connect(config(), SIGNAL(configChanged()), this, SLOT(loadApplications())); } -NotificationsConfig::~NotificationsConfig() +SendNotificationsConfig::~SendNotificationsConfig() { delete m_ui; } -void NotificationsConfig::defaults() +void SendNotificationsConfig::defaults() { KCModule::defaults(); m_ui->check_persistent->setChecked(false); @@ -73,7 +73,7 @@ void NotificationsConfig::defaults() Q_EMIT changed(true); } -void NotificationsConfig::loadApplications() +void SendNotificationsConfig::loadApplications() { appModel->clearApplications(); QVariantList list = config()->getList("applications"); @@ -85,7 +85,7 @@ void NotificationsConfig::loadApplications() } } -void NotificationsConfig::load() +void SendNotificationsConfig::load() { KCModule::load(); bool persistent = config()->get("generalPersistent", false); @@ -101,7 +101,7 @@ void NotificationsConfig::load() Q_EMIT changed(false); } -void NotificationsConfig::save() +void SendNotificationsConfig::save() { config()->set("generalPersistent", m_ui->check_persistent->isChecked()); config()->set("generalIncludeBody", m_ui->check_body->isChecked()); @@ -116,4 +116,4 @@ void NotificationsConfig::save() Q_EMIT changed(false); } -#include "notifications_config.moc" +#include "sendnotifications_config.moc" diff --git a/plugins/notifications/notifications_config.h b/plugins/sendnotifications/sendnotifications_config.h similarity index 81% rename from plugins/notifications/notifications_config.h rename to plugins/sendnotifications/sendnotifications_config.h index fedbfc6c8..3a5b17675 100644 --- a/plugins/notifications/notifications_config.h +++ b/plugins/sendnotifications/sendnotifications_config.h @@ -18,24 +18,24 @@ * along with this program. If not, see . */ -#ifndef NOTIFICATIONS_CONFIG_H -#define NOTIFICATIONS_CONFIG_H +#ifndef SENDNOTIFICATIONS_CONFIG_H +#define SENDNOTIFICATIONS_CONFIG_H #include "kcmplugin/kdeconnectpluginkcm.h" namespace Ui { - class NotificationsConfigUi; + class SendNotificationsConfigUi; } class NotifyingApplicationModel; -class NotificationsConfig +class SendNotificationsConfig : public KdeConnectPluginKcm { Q_OBJECT public: - NotificationsConfig(QWidget *parent, const QVariantList&); - virtual ~NotificationsConfig(); + SendNotificationsConfig(QWidget *parent, const QVariantList&); + virtual ~SendNotificationsConfig(); public Q_SLOTS: virtual void save() override; @@ -46,7 +46,7 @@ private Q_SLOTS: void loadApplications(); private: - Ui::NotificationsConfigUi* m_ui; + Ui::SendNotificationsConfigUi* m_ui; NotifyingApplicationModel* appModel; }; diff --git a/plugins/notifications/notifications_config.ui b/plugins/sendnotifications/sendnotifications_config.ui similarity index 98% rename from plugins/notifications/notifications_config.ui rename to plugins/sendnotifications/sendnotifications_config.ui index 83b26cc02..c1ef29a70 100644 --- a/plugins/notifications/notifications_config.ui +++ b/plugins/sendnotifications/sendnotifications_config.ui @@ -1,7 +1,7 @@ - NotificationsConfigUi - + SendNotificationsConfigUi + Qt::WindowModal diff --git a/plugins/sendnotifications/sendnotificationsplugin.cpp b/plugins/sendnotifications/sendnotificationsplugin.cpp new file mode 100644 index 000000000..40dcf8c36 --- /dev/null +++ b/plugins/sendnotifications/sendnotificationsplugin.cpp @@ -0,0 +1,54 @@ +/** + * Copyright 2013 Albert Vaca + * + * 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 "sendnotificationsplugin.h" + +#include "notificationslistener.h" +#include "sendnotification_debug.h" + +#include + +K_PLUGIN_FACTORY_WITH_JSON( KdeConnectPluginFactory, "kdeconnect_sendnotifications.json", registerPlugin< SendNotificationsPlugin >(); ) + +Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_SENDNOTIFICATION, "kdeconnect.plugin.sendnotification") + +SendNotificationsPlugin::SendNotificationsPlugin(QObject* parent, const QVariantList& args) + : KdeConnectPlugin(parent, args) +{ + notificationsListener = new NotificationsListener(this); +} + +SendNotificationsPlugin::~SendNotificationsPlugin() +{ + delete notificationsListener; +} + +bool SendNotificationsPlugin::receivePackage(const NetworkPackage& np) +{ + Q_UNUSED(np); + return true; +} + +void SendNotificationsPlugin::connected() +{ + +} + +#include "sendnotificationsplugin.moc" diff --git a/plugins/sendnotifications/sendnotificationsplugin.h b/plugins/sendnotifications/sendnotificationsplugin.h new file mode 100644 index 000000000..b724758c8 --- /dev/null +++ b/plugins/sendnotifications/sendnotificationsplugin.h @@ -0,0 +1,55 @@ +/** + * Copyright 2013 Albert Vaca + * + * 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 SENDNOTIFICATIONSPLUGIN_H +#define SENDNOTIFICATIONSPLUGIN_H + +#include + +#include +#define PACKAGE_TYPE_NOTIFICATION_REQUEST QLatin1String("kdeconnect.notification") + +/* + * This class is just a proxy for NotificationsDbusInterface + * because it can not inherit from QDBusAbstractAdaptor and + * KdeConnectPlugin at the same time (both are QObject) + */ +class NotificationsDbusInterface; +class NotificationsListener; + +class SendNotificationsPlugin + : public KdeConnectPlugin +{ + Q_OBJECT + +public: + explicit SendNotificationsPlugin(QObject *parent, const QVariantList &args); + virtual ~SendNotificationsPlugin(); + +public Q_SLOTS: + virtual bool receivePackage(const NetworkPackage& np) override; + virtual void connected() override; + +protected: + NotificationsListener* notificationsListener; + +}; + +#endif diff --git a/plugins/sftp/kdeconnect_sftp.json b/plugins/sftp/kdeconnect_sftp.json index afc8b2c6a..5555b3900 100644 --- a/plugins/sftp/kdeconnect_sftp.json +++ b/plugins/sftp/kdeconnect_sftp.json @@ -68,9 +68,9 @@ "Website": "http://albertvaka.wordpress.com" }, "X-KdeConnect-OutgoingPackageType": [ - "kdeconnect.sftp" + "kdeconnect.sftp.request" ], "X-KdeConnect-SupportedPackageType": [ "kdeconnect.sftp" ] -} \ No newline at end of file +} diff --git a/plugins/sftp/sftpplugin.h b/plugins/sftp/sftpplugin.h index 011ed22ce..49aea49ab 100644 --- a/plugins/sftp/sftpplugin.h +++ b/plugins/sftp/sftpplugin.h @@ -24,7 +24,7 @@ #include #include -#define PACKAGE_TYPE_SFTP QLatin1String("kdeconnect.sftp") +#define PACKAGE_TYPE_SFTP QLatin1String("kdeconnect.sftp.request") class KNotification; diff --git a/plugins/share/kdeconnect_share.json b/plugins/share/kdeconnect_share.json index 804255bf0..384d71150 100644 --- a/plugins/share/kdeconnect_share.json +++ b/plugins/share/kdeconnect_share.json @@ -67,9 +67,9 @@ "Website": "http://albertvaka.wordpress.com" }, "X-KdeConnect-OutgoingPackageType": [ - "kdeconnect.share" + "kdeconnect.share.request" ], "X-KdeConnect-SupportedPackageType": [ - "kdeconnect.share" + "kdeconnect.share.request" ] -} \ No newline at end of file +} diff --git a/plugins/share/shareplugin.h b/plugins/share/shareplugin.h index 4149e21d1..43bb95474 100644 --- a/plugins/share/shareplugin.h +++ b/plugins/share/shareplugin.h @@ -26,7 +26,7 @@ #include -#define PACKAGE_TYPE_SHARE QLatin1String("kdeconnect.share") +#define PACKAGE_TYPE_SHARE QLatin1String("kdeconnect.share.request") class SharePlugin : public KdeConnectPlugin diff --git a/plugins/telephony/kdeconnect_telephony.json b/plugins/telephony/kdeconnect_telephony.json index e32a5c131..34cf45f9a 100644 --- a/plugins/telephony/kdeconnect_telephony.json +++ b/plugins/telephony/kdeconnect_telephony.json @@ -67,9 +67,10 @@ "Website": "http://albertvaka.wordpress.com" }, "X-KdeConnect-OutgoingPackageType": [ - "kdeconnect.telephony" + "kdeconnect.telephony.request", + "kdeconnect.sms.request" ], "X-KdeConnect-SupportedPackageType": [ "kdeconnect.telephony" ] -} \ No newline at end of file +} diff --git a/plugins/telephony/telephonyplugin.cpp b/plugins/telephony/telephonyplugin.cpp index 449a22d13..239f80d86 100644 --- a/plugins/telephony/telephonyplugin.cpp +++ b/plugins/telephony/telephonyplugin.cpp @@ -144,7 +144,7 @@ void TelephonyPlugin::sendMutePackage() void TelephonyPlugin::sendSms(const QString& phoneNumber, const QString& messageBody) { - NetworkPackage np(PACKAGE_TYPE_TELEPHONY); + NetworkPackage np(PACKAGE_TYPE_SMS); np.set("sendSms", true); np.set("phoneNumber", phoneNumber); np.set("messageBody", messageBody); diff --git a/plugins/telephony/telephonyplugin.h b/plugins/telephony/telephonyplugin.h index 231b0c797..95300a205 100644 --- a/plugins/telephony/telephonyplugin.h +++ b/plugins/telephony/telephonyplugin.h @@ -31,7 +31,8 @@ #include "kdeconnecttelepathyprotocolfactory.h" #endif -#define PACKAGE_TYPE_TELEPHONY QLatin1String("kdeconnect.telephony") +#define PACKAGE_TYPE_TELEPHONY QLatin1String("kdeconnect.telephony.request") +#define PACKAGE_TYPE_SMS QLatin1String("kdeconnect.sms.request") Q_DECLARE_LOGGING_CATEGORY(KDECONNECT_PLUGIN_TELEPHONY) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index b9e6a0062..1d45b86ab 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -57,10 +57,8 @@ ecm_add_test(devicetest.cpp ${lanlinkprovidertest_sources} TEST_NAME devicetest ecm_add_test(downloadjobtest.cpp ../core/backends/lan/downloadjob.cpp TEST_NAME downloadjobtest LINK_LIBRARIES ${kdeconnect_libraries}) ecm_add_test(testnotificationlistener.cpp - ../plugins/notifications/notificationslistener.cpp - ../plugins/notifications/notificationsplugin.cpp - ../plugins/notifications/notification.cpp - ../plugins/notifications/notifyingapplication.cpp - ../plugins/notifications/notificationsdbusinterface.cpp + ../plugins/sendnotifications/sendnotificationsplugin.cpp + ../plugins/sendnotifications/notificationslistener.cpp + ../plugins/sendnotifications/notifyingapplication.cpp TEST_NAME testnotificationlistener LINK_LIBRARIES ${kdeconnect_libraries} Qt5::DBus KF5::Notifications KF5::IconThemes) diff --git a/tests/testnotificationlistener.cpp b/tests/testnotificationlistener.cpp index b43a7d394..45597fa5b 100644 --- a/tests/testnotificationlistener.cpp +++ b/tests/testnotificationlistener.cpp @@ -31,18 +31,17 @@ #include "core/device.h" #include "core/kdeconnectplugin.h" #include "kdeconnect-version.h" -#include "plugins/notifications/notificationsplugin.h" -#include "plugins/notifications/notificationslistener.h" -#include "plugins/notifications/notificationsdbusinterface.h" -#include "plugins/notifications/notifyingapplication.h" +#include "plugins/sendnotifications/sendnotificationsplugin.h" +#include "plugins/sendnotifications/notificationslistener.h" +#include "plugins/sendnotifications/notifyingapplication.h" // Tweaked NotificationsPlugin for testing -class TestNotificationsPlugin : public NotificationsPlugin +class TestNotificationsPlugin : public SendNotificationsPlugin { Q_OBJECT public: explicit TestNotificationsPlugin(QObject *parent, const QVariantList &args) - : NotificationsPlugin(parent, args) + : SendNotificationsPlugin(parent, args) { } @@ -59,10 +58,6 @@ public: notificationsListener = value; } - NotificationsDbusInterface* getNotificationsDbusInterface() const - { - return notificationsDbusInterface; - } }; // Tweaked Device for testing: @@ -116,9 +111,8 @@ class TestedNotificationsListener: public NotificationsListener { public: - explicit TestedNotificationsListener(KdeConnectPlugin* aPlugin, - NotificationsDbusInterface* aDbusInterface) - : NotificationsListener(aPlugin, aDbusInterface) + explicit TestedNotificationsListener(KdeConnectPlugin* aPlugin) + : NotificationsListener(aPlugin) {} virtual ~TestedNotificationsListener() @@ -160,7 +154,7 @@ void TestNotificationListener::testNotify() // QString dId("testid"); - TestDevice *d = new TestDevice(nullptr, dId); // not setting any parent or we will double free the dbusInterface + TestDevice *d = new TestDevice(nullptr, dId); int proxiedNotifications = 0; QCOMPARE(proxiedNotifications, d->getSentPackages()); @@ -172,7 +166,7 @@ void TestNotificationListener::testNotify() delete plugin->getNotificationsListener(); // inject our tweaked NotificationsListener: - TestedNotificationsListener* listener = new TestedNotificationsListener(plugin, plugin->getNotificationsDbusInterface()); + TestedNotificationsListener* listener = new TestedNotificationsListener(plugin); QVERIFY(listener); plugin->setNotificationsListener(listener); QCOMPARE(listener, plugin->getNotificationsListener());