Merge branch 'master' into sslrefactor
This commit is contained in:
commit
9aa794b0da
55 changed files with 367 additions and 225 deletions
|
@ -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()) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include <QLoggingCategory>
|
||||
#include <core/kdeconnectplugin.h>
|
||||
|
||||
#define PACKAGE_TYPE_BATTERY QLatin1String("kdeconnect.battery")
|
||||
#define PACKAGE_TYPE_BATTERY QLatin1String("kdeconnect.battery.request")
|
||||
|
||||
Q_DECLARE_LOGGING_CATEGORY(KDECONNECT_PLUGIN_BATTERY)
|
||||
class BatteryDbusInterface;
|
||||
|
|
|
@ -67,9 +67,9 @@
|
|||
"Website": "http://albertvaka.wordpress.com"
|
||||
},
|
||||
"X-KdeConnect-OutgoingPackageType": [
|
||||
"kdeconnect.battery"
|
||||
"kdeconnect.battery.request"
|
||||
],
|
||||
"X-KdeConnect-SupportedPackageType": [
|
||||
"kdeconnect.battery"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include <core/kdeconnectplugin.h>
|
||||
|
||||
#define PACKAGE_TYPE_FINDMYPHONE QStringLiteral("kdeconnect.findmyphone")
|
||||
#define PACKAGE_TYPE_FINDMYPHONE QStringLiteral("kdeconnect.findmyphone.request")
|
||||
|
||||
class FindMyPhonePlugin
|
||||
: public KdeConnectPlugin
|
||||
|
|
|
@ -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"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,9 +64,11 @@
|
|||
"Website": "https://kde.org"
|
||||
},
|
||||
"X-KdeConnect-OutgoingPackageType": [
|
||||
"kdeconnect.lock.request",
|
||||
"kdeconnect.lock"
|
||||
],
|
||||
"X-KdeConnect-SupportedPackageType": [
|
||||
"kdeconnect.lock.request",
|
||||
"kdeconnect.lock"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
#cmakedefine01 HAVE_WAYLAND
|
||||
#cmakedefine01 HAVE_X11
|
||||
|
|
|
@ -67,6 +67,6 @@
|
|||
},
|
||||
"X-KdeConnect-OutgoingPackageType": [],
|
||||
"X-KdeConnect-SupportedPackageType": [
|
||||
"kdeconnect.mousepad"
|
||||
"kdeconnect.input.request"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,10 +24,13 @@
|
|||
#include <KLocalizedString>
|
||||
#include <QDebug>
|
||||
#include <QGuiApplication>
|
||||
|
||||
#if HAVE_X11
|
||||
#include <QX11Info>
|
||||
#include <X11/extensions/XTest.h>
|
||||
#include <X11/keysym.h>
|
||||
#include <fakekey/fakekey.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_WAYLAND
|
||||
#include <KWayland/Client/connection_thread.h>
|
||||
|
@ -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 <typename T, size_t N>
|
||||
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()
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include <core/kdeconnectplugin.h>
|
||||
#include <config-mousepad.h>
|
||||
|
||||
#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;
|
||||
|
|
|
@ -70,6 +70,6 @@
|
|||
"kdeconnect.mpris"
|
||||
],
|
||||
"X-KdeConnect-SupportedPackageType": [
|
||||
"kdeconnect.mpris"
|
||||
"kdeconnect.mpris.request"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
#include <core/kdeconnectplugin.h>
|
||||
|
||||
#define PACKAGE_TYPE_MPRIS QLatin1String("kdeconnect.mpris")
|
||||
#define PACKAGE_TYPE_MPRIS QLatin1String("kdeconnect.mpris.request")
|
||||
|
||||
Q_DECLARE_LOGGING_CATEGORY(KDECONNECT_PLUGIN_MPRIS)
|
||||
|
||||
|
|
|
@ -51,9 +51,9 @@
|
|||
"Website": "https://kde.org"
|
||||
},
|
||||
"X-KdeConnect-OutgoingPackageType": [
|
||||
"kdeconnect.mpris"
|
||||
"kdeconnect.mpris.request"
|
||||
],
|
||||
"X-KdeConnect-SupportedPackageType": [
|
||||
"kdeconnect.mpris"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include <core/kdeconnectplugin.h>
|
||||
|
||||
#define PACKAGE_TYPE_MPRIS QLatin1String("kdeconnect.mpris")
|
||||
#define PACKAGE_TYPE_MPRIS_REQUEST QLatin1String("kdeconnect.mpris.request")
|
||||
|
||||
class Q_DECL_EXPORT MprisRemotePlugin
|
||||
: public KdeConnectPlugin
|
||||
|
|
|
@ -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} )
|
||||
|
|
|
@ -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"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ void NotificationsDbusInterface::processPackage(const NetworkPackage& np)
|
|||
removeNotification(id);
|
||||
} else if (np.get<bool>("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<QString>("cancel", internalId);
|
||||
mPlugin->sendPackage(np);
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "notificationsplugin.h"
|
||||
|
||||
#include "notificationsdbusinterface.h"
|
||||
#include "notificationslistener.h"
|
||||
#include "notification_debug.h"
|
||||
|
||||
#include <KPluginFactory>
|
||||
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,8 @@
|
|||
#include <knotification.h>
|
||||
|
||||
#include <core/kdeconnectplugin.h>
|
||||
#define PACKAGE_TYPE_NOTIFICATION QLatin1String("kdeconnect.notification")
|
||||
|
||||
#define PACKAGE_TYPE_NOTIFICATION_REQUEST QLatin1String("kdeconnect.notification.request")
|
||||
|
||||
/*
|
||||
* This class is just a proxy for NotificationsDbusInterface
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
"Website": "https://kde.org"
|
||||
},
|
||||
"X-KdeConnect-OutgoingPackageType": [
|
||||
"kdeconnect.mousepad"
|
||||
"kdeconnect.input.request"
|
||||
],
|
||||
"X-KdeConnect-SupportedPackageType": []
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include <core/kdeconnectplugin.h>
|
||||
|
||||
#define PACKAGE_TYPE_MOUSEPAD QLatin1String("kdeconnect.mousepad")
|
||||
#define PACKAGE_TYPE_INPUT_REQUEST QLatin1String("kdeconnect.input.request")
|
||||
|
||||
class Q_DECL_EXPORT RemoteControlPlugin
|
||||
: public KdeConnectPlugin
|
||||
|
|
|
@ -71,6 +71,6 @@
|
|||
"kdeconnect.runcommand"
|
||||
],
|
||||
"X-KdeConnect-SupportedPackageType": [
|
||||
"kdeconnect.runcommand"
|
||||
"kdeconnect.runcommand.request"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
38
plugins/sendnotifications/CMakeLists.txt
Normal file
38
plugins/sendnotifications/CMakeLists.txt
Normal file
|
@ -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} )
|
29
plugins/sendnotifications/kdeconnect_sendnotifications.json
Normal file
29
plugins/sendnotifications/kdeconnect_sendnotifications.json
Normal file
|
@ -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"
|
||||
]
|
||||
}
|
|
@ -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]=إعدادات ملحقة مزامنة الإخطارات
|
|
@ -33,16 +33,13 @@
|
|||
#include <core/kdeconnectplugin.h>
|
||||
|
||||
#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>("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<NotifyingApplication>(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 << ":" <<ticker << "; appIcon=" << appIcon;
|
||||
NetworkPackage np(PACKAGE_TYPE_NOTIFICATION);
|
||||
//qCDebug(KDECONNECT_PLUGIN_SENDNOTIFICATION) << "Sending notification from" << appName << ":" <<ticker << "; appIcon=" << appIcon;
|
||||
NetworkPackage np(PACKAGE_TYPE_NOTIFICATION_REQUEST);
|
||||
np.set("id", QString::number(replacesId > 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<QIODevice> iconFile(new QFile(iconPath));
|
||||
np.setPayload(iconFile, iconFile->size());
|
||||
}
|
|
@ -22,7 +22,6 @@
|
|||
#include <core/device.h>
|
||||
|
||||
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<QString, NotifyingApplication> applications;
|
||||
|
||||
public Q_SLOTS:
|
28
plugins/sendnotifications/sendnotification_debug.h
Normal file
28
plugins/sendnotifications/sendnotification_debug.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
/**
|
||||
* Copyright 2014 Alejandro Fiestas Olivares <afiestas@kde.org>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef SENDNOTIFICATION_DEBUG_H
|
||||
#define SENDNOTIFICATION_DEBUG_H
|
||||
|
||||
#include <QLoggingCategory>
|
||||
|
||||
Q_DECLARE_LOGGING_CATEGORY(KDECONNECT_PLUGIN_SENDNOTIFICATION)
|
||||
|
||||
#endif //NOTIFICATION_DEBUG_H
|
|
@ -18,18 +18,18 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "notifications_config.h"
|
||||
#include "ui_notifications_config.h"
|
||||
#include "sendnotifications_config.h"
|
||||
#include "ui_sendnotifications_config.h"
|
||||
#include "notifyingapplicationmodel.h"
|
||||
|
||||
#include <KCModule>
|
||||
#include <KPluginFactory>
|
||||
|
||||
K_PLUGIN_FACTORY(NotificationsConfigFactory, registerPlugin<NotificationsConfig>();)
|
||||
K_PLUGIN_FACTORY(SendNotificationsConfigFactory, registerPlugin<SendNotificationsConfig>();)
|
||||
|
||||
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>("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"
|
|
@ -18,24 +18,24 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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;
|
||||
|
||||
};
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>NotificationsConfigUi</class>
|
||||
<widget class="QWidget" name="NotificationsConfigUi">
|
||||
<class>SendNotificationsConfigUi</class>
|
||||
<widget class="QWidget" name="SendNotificationsConfigUi">
|
||||
<property name="windowModality">
|
||||
<enum>Qt::WindowModal</enum>
|
||||
</property>
|
54
plugins/sendnotifications/sendnotificationsplugin.cpp
Normal file
54
plugins/sendnotifications/sendnotificationsplugin.cpp
Normal file
|
@ -0,0 +1,54 @@
|
|||
/**
|
||||
* Copyright 2013 Albert Vaca <albertvaka@gmail.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "sendnotificationsplugin.h"
|
||||
|
||||
#include "notificationslistener.h"
|
||||
#include "sendnotification_debug.h"
|
||||
|
||||
#include <KPluginFactory>
|
||||
|
||||
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"
|
55
plugins/sendnotifications/sendnotificationsplugin.h
Normal file
55
plugins/sendnotifications/sendnotificationsplugin.h
Normal file
|
@ -0,0 +1,55 @@
|
|||
/**
|
||||
* Copyright 2013 Albert Vaca <albertvaka@gmail.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef SENDNOTIFICATIONSPLUGIN_H
|
||||
#define SENDNOTIFICATIONSPLUGIN_H
|
||||
|
||||
#include <knotification.h>
|
||||
|
||||
#include <core/kdeconnectplugin.h>
|
||||
#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
|
|
@ -68,9 +68,9 @@
|
|||
"Website": "http://albertvaka.wordpress.com"
|
||||
},
|
||||
"X-KdeConnect-OutgoingPackageType": [
|
||||
"kdeconnect.sftp"
|
||||
"kdeconnect.sftp.request"
|
||||
],
|
||||
"X-KdeConnect-SupportedPackageType": [
|
||||
"kdeconnect.sftp"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include <core/kdeconnectplugin.h>
|
||||
#include <core/device.h>
|
||||
|
||||
#define PACKAGE_TYPE_SFTP QLatin1String("kdeconnect.sftp")
|
||||
#define PACKAGE_TYPE_SFTP QLatin1String("kdeconnect.sftp.request")
|
||||
|
||||
class KNotification;
|
||||
|
||||
|
|
|
@ -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"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include <core/kdeconnectplugin.h>
|
||||
|
||||
#define PACKAGE_TYPE_SHARE QLatin1String("kdeconnect.share")
|
||||
#define PACKAGE_TYPE_SHARE QLatin1String("kdeconnect.share.request")
|
||||
|
||||
class SharePlugin
|
||||
: public KdeConnectPlugin
|
||||
|
|
|
@ -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"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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());
|
||||
|
|
Loading…
Reference in a new issue