diff --git a/core/kdeconnectplugin.cpp b/core/kdeconnectplugin.cpp index eafee365a..ae3847739 100644 --- a/core/kdeconnectplugin.cpp +++ b/core/kdeconnectplugin.cpp @@ -69,6 +69,10 @@ QString KdeConnectPlugin::dbusPath() const return {}; } +void KdeConnectPlugin::receivePacket(const NetworkPacket &np) +{ + qCWarning(KDECONNECT_CORE) << metaObject()->className() << "tried to send an recieve an unhandled packet type" << np.type(); +} QString KdeConnectPlugin::iconName() const { return d->iconName; diff --git a/core/kdeconnectplugin.h b/core/kdeconnectplugin.h index 0dfc1bedb..ff9dc1c53 100644 --- a/core/kdeconnectplugin.h +++ b/core/kdeconnectplugin.h @@ -41,7 +41,7 @@ public Q_SLOTS: * Returns true if it has handled the packet in some way * device.sendPacket can be used to send an answer back to the device */ - virtual bool receivePacket(const NetworkPacket &np) = 0; + virtual void receivePacket(const NetworkPacket &np); /** * This method will be called when a device is connected to this computer. diff --git a/plugins/battery/batteryplugin.cpp b/plugins/battery/batteryplugin.cpp index d4bf74270..82c9f78c1 100644 --- a/plugins/battery/batteryplugin.cpp +++ b/plugins/battery/batteryplugin.cpp @@ -106,10 +106,10 @@ void BatteryPlugin::slotChargeChanged() sendPacket(status); } -bool BatteryPlugin::receivePacket(const NetworkPacket &np) +void BatteryPlugin::receivePacket(const NetworkPacket &np) { if (PACKET_TYPE_BATTERY != np.type()) { - return false; + return; } m_isCharging = np.get(QStringLiteral("isCharging"), false); @@ -124,8 +124,6 @@ bool BatteryPlugin::receivePacket(const NetworkPacket &np) i18n("Battery at %1%", m_charge), QStringLiteral("battery-040")); } - - return true; } QString BatteryPlugin::dbusPath() const diff --git a/plugins/battery/batteryplugin.h b/plugins/battery/batteryplugin.h index bba477ec5..745d64f36 100644 --- a/plugins/battery/batteryplugin.h +++ b/plugins/battery/batteryplugin.h @@ -20,7 +20,7 @@ class BatteryPlugin : public KdeConnectPlugin public: explicit BatteryPlugin(QObject *parent, const QVariantList &args); - bool receivePacket(const NetworkPacket &np) override; + void receivePacket(const NetworkPacket &np) override; void connected() override; QString dbusPath() const override; diff --git a/plugins/bigscreen/bigscreenplugin.cpp b/plugins/bigscreen/bigscreenplugin.cpp index 8406361f3..fe4ff2eed 100644 --- a/plugins/bigscreen/bigscreenplugin.cpp +++ b/plugins/bigscreen/bigscreenplugin.cpp @@ -25,14 +25,13 @@ BigscreenPlugin::BigscreenPlugin(QObject *parent, const QVariantList &args) { } -bool BigscreenPlugin::receivePacket(const NetworkPacket &np) +void BigscreenPlugin::receivePacket(const NetworkPacket &np) { QString message = np.get(QStringLiteral("content")); /* Emit a signal that will be consumed by Plasma BigScreen: * https://invent.kde.org/plasma/plasma-bigscreen/-/blob/master/containments/homescreen/package/contents/ui/indicators/KdeConnect.qml */ Q_EMIT messageReceived(message); - return true; } QString BigscreenPlugin::dbusPath() const diff --git a/plugins/bigscreen/bigscreenplugin.h b/plugins/bigscreen/bigscreenplugin.h index d97ba7d99..79f676bfe 100644 --- a/plugins/bigscreen/bigscreenplugin.h +++ b/plugins/bigscreen/bigscreenplugin.h @@ -19,7 +19,7 @@ class BigscreenPlugin : public KdeConnectPlugin public: explicit BigscreenPlugin(QObject *parent, const QVariantList &args); - bool receivePacket(const NetworkPacket &np) override; + void receivePacket(const NetworkPacket &np) override; QString dbusPath() const override; Q_SIGNALS: diff --git a/plugins/clipboard/clipboardplugin.cpp b/plugins/clipboard/clipboardplugin.cpp index 83f4d8b2b..ba7b6fd42 100644 --- a/plugins/clipboard/clipboardplugin.cpp +++ b/plugins/clipboard/clipboardplugin.cpp @@ -79,23 +79,20 @@ void ClipboardPlugin::sendConnectPacket() sendPacket(np); } -bool ClipboardPlugin::receivePacket(const NetworkPacket &np) +void ClipboardPlugin::receivePacket(const NetworkPacket &np) { QString content = np.get(QStringLiteral("content")); if (np.type() == PACKET_TYPE_CLIPBOARD) { ClipboardListener::instance()->setText(content); - return true; } else if (np.type() == PACKET_TYPE_CLIPBOARD_CONNECT) { qint64 packetTime = np.get(QStringLiteral("timestamp")); // If the packetTime is 0, it means the timestamp is unknown (so do nothing). if (packetTime == 0 || packetTime < ClipboardListener::instance()->updateTimestamp()) { - return false; + return; } ClipboardListener::instance()->setText(content); - return true; } - return false; } #include "clipboardplugin.moc" diff --git a/plugins/clipboard/clipboardplugin.h b/plugins/clipboard/clipboardplugin.h index c350c9224..fcb871a86 100644 --- a/plugins/clipboard/clipboardplugin.h +++ b/plugins/clipboard/clipboardplugin.h @@ -49,7 +49,7 @@ public: Q_SCRIPTABLE void sendClipboard(const QString &content); QString dbusPath() const override; - bool receivePacket(const NetworkPacket &np) override; + void receivePacket(const NetworkPacket &np) override; void connected() override; bool isAutoShareDisabled(); diff --git a/plugins/connectivity-report/connectivity_reportplugin.cpp b/plugins/connectivity-report/connectivity_reportplugin.cpp index 4a183dd37..4d3846c4e 100644 --- a/plugins/connectivity-report/connectivity_reportplugin.cpp +++ b/plugins/connectivity-report/connectivity_reportplugin.cpp @@ -30,10 +30,10 @@ int ConnectivityReportPlugin::cellularNetworkStrength() const return m_cellularNetworkStrength; } -bool ConnectivityReportPlugin::receivePacket(const NetworkPacket &np) +void ConnectivityReportPlugin::receivePacket(const NetworkPacket &np) { if (PACKET_TYPE_CONNECTIVITY_REPORT != np.type()) { - return false; + return; } auto subscriptions = np.get(QStringLiteral("signalStrengths"), QVariantMap()); @@ -50,7 +50,6 @@ bool ConnectivityReportPlugin::receivePacket(const NetworkPacket &np) Q_EMIT refreshed(m_cellularNetworkType, m_cellularNetworkStrength); } } - return true; } QString ConnectivityReportPlugin::dbusPath() const diff --git a/plugins/connectivity-report/connectivity_reportplugin.h b/plugins/connectivity-report/connectivity_reportplugin.h index 13a601a9a..d1dfab728 100644 --- a/plugins/connectivity-report/connectivity_reportplugin.h +++ b/plugins/connectivity-report/connectivity_reportplugin.h @@ -41,7 +41,7 @@ class ConnectivityReportPlugin : public KdeConnectPlugin public: explicit ConnectivityReportPlugin(QObject *parent, const QVariantList &args); - bool receivePacket(const NetworkPacket &np) override; + void receivePacket(const NetworkPacket &np) override; QString dbusPath() const override; QString cellularNetworkType() const; diff --git a/plugins/contacts/contactsplugin.cpp b/plugins/contacts/contactsplugin.cpp index 86cdef296..d2570c216 100644 --- a/plugins/contacts/contactsplugin.cpp +++ b/plugins/contacts/contactsplugin.cpp @@ -44,19 +44,18 @@ void ContactsPlugin::connected() synchronizeRemoteWithLocal(); } -bool ContactsPlugin::receivePacket(const NetworkPacket &np) +void ContactsPlugin::receivePacket(const NetworkPacket &np) { // qCDebug(KDECONNECT_PLUGIN_CONTACTS) << "Packet Received for device " << device()->name(); // qCDebug(KDECONNECT_PLUGIN_CONTACTS) << np.body(); if (np.type() == PACKAGE_TYPE_CONTACTS_RESPONSE_UIDS_TIMESTAMPS) { - return handleResponseUIDsTimestamps(np); + handleResponseUIDsTimestamps(np); } else if (np.type() == PACKET_TYPE_CONTACTS_RESPONSE_VCARDS) { - return handleResponseVCards(np); + handleResponseVCards(np); } else { // Is this check necessary? qCDebug(KDECONNECT_PLUGIN_CONTACTS) << "Unknown packet type received from device: " << device()->name() << ". Maybe you need to upgrade KDE Connect?"; - return false; } } diff --git a/plugins/contacts/contactsplugin.h b/plugins/contacts/contactsplugin.h index 425235932..07ccf5156 100644 --- a/plugins/contacts/contactsplugin.h +++ b/plugins/contacts/contactsplugin.h @@ -83,7 +83,7 @@ class ContactsPlugin : public KdeConnectPlugin public: explicit ContactsPlugin(QObject *parent, const QVariantList &args); - bool receivePacket(const NetworkPacket &np) override; + void receivePacket(const NetworkPacket &np) override; void connected() override; QString dbusPath() const override; diff --git a/plugins/findmyphone/findmyphoneplugin.cpp b/plugins/findmyphone/findmyphoneplugin.cpp index 05bade58e..4756e7035 100644 --- a/plugins/findmyphone/findmyphoneplugin.cpp +++ b/plugins/findmyphone/findmyphoneplugin.cpp @@ -19,12 +19,6 @@ FindMyPhonePlugin::FindMyPhonePlugin(QObject *parent, const QVariantList &args) { } -bool FindMyPhonePlugin::receivePacket(const NetworkPacket &np) -{ - Q_UNUSED(np); - return false; -} - void FindMyPhonePlugin::ring() { NetworkPacket np(PACKET_TYPE_FINDMYPHONE_REQUEST); diff --git a/plugins/findmyphone/findmyphoneplugin.h b/plugins/findmyphone/findmyphoneplugin.h index 89c7be0b4..92eb6dd95 100644 --- a/plugins/findmyphone/findmyphoneplugin.h +++ b/plugins/findmyphone/findmyphoneplugin.h @@ -23,5 +23,4 @@ public: Q_SCRIPTABLE void ring(); QString dbusPath() const override; - bool receivePacket(const NetworkPacket &np) override; }; diff --git a/plugins/findthisdevice/findthisdeviceplugin.cpp b/plugins/findthisdevice/findthisdeviceplugin.cpp index fef78c336..6dba0f009 100644 --- a/plugins/findthisdevice/findthisdeviceplugin.cpp +++ b/plugins/findthisdevice/findthisdeviceplugin.cpp @@ -31,7 +31,7 @@ FindThisDevicePlugin::FindThisDevicePlugin(QObject *parent, const QVariantList & { } -bool FindThisDevicePlugin::receivePacket(const NetworkPacket &np) +void FindThisDevicePlugin::receivePacket(const NetworkPacket &np) { Q_UNUSED(np); @@ -40,7 +40,7 @@ bool FindThisDevicePlugin::receivePacket(const NetworkPacket &np) if (soundURL.isEmpty()) { qCWarning(KDECONNECT_PLUGIN_FINDTHISDEVICE) << "Not playing sound, no valid ring tone specified."; - return true; + return; } QMediaPlayer *player = new QMediaPlayer; @@ -84,8 +84,6 @@ bool FindThisDevicePlugin::receivePacket(const NetworkPacket &np) connect(player, &QMediaPlayer::playingChanged, player, &QObject::deleteLater); #endif // TODO: ensure to use built-in loudspeakers - - return true; } QString FindThisDevicePlugin::dbusPath() const diff --git a/plugins/findthisdevice/findthisdeviceplugin.h b/plugins/findthisdevice/findthisdeviceplugin.h index 366087bbe..83e0a10f1 100644 --- a/plugins/findthisdevice/findthisdeviceplugin.h +++ b/plugins/findthisdevice/findthisdeviceplugin.h @@ -30,7 +30,7 @@ public: explicit FindThisDevicePlugin(QObject *parent, const QVariantList &args); QString dbusPath() const override; - bool receivePacket(const NetworkPacket &np) override; + void receivePacket(const NetworkPacket &np) override; }; inline QString defaultSound() diff --git a/plugins/lockdevice/lockdeviceplugin-win.cpp b/plugins/lockdevice/lockdeviceplugin-win.cpp index ace415c55..f6695a397 100644 --- a/plugins/lockdevice/lockdeviceplugin-win.cpp +++ b/plugins/lockdevice/lockdeviceplugin-win.cpp @@ -38,7 +38,7 @@ void LockDevicePlugin::setLocked(bool locked) sendPacket(np); } -bool LockDevicePlugin::receivePacket(const NetworkPacket &np) +void LockDevicePlugin::receivePacket(const NetworkPacket &np) { if (np.has(QStringLiteral("isLocked"))) { bool locked = np.get(QStringLiteral("isLocked")); @@ -77,8 +77,6 @@ bool LockDevicePlugin::receivePacket(const NetworkPacket &np) sendState(); } - - return true; } void LockDevicePlugin::sendState() diff --git a/plugins/lockdevice/lockdeviceplugin-win.h b/plugins/lockdevice/lockdeviceplugin-win.h index ee4d71d23..493eead9d 100644 --- a/plugins/lockdevice/lockdeviceplugin-win.h +++ b/plugins/lockdevice/lockdeviceplugin-win.h @@ -27,7 +27,7 @@ public: QString dbusPath() const override; void connected() override; - bool receivePacket(const NetworkPacket &np) override; + void receivePacket(const NetworkPacket &np) override; Q_SIGNALS: Q_SCRIPTABLE void lockedChanged(bool locked); diff --git a/plugins/lockdevice/lockdeviceplugin.cpp b/plugins/lockdevice/lockdeviceplugin.cpp index e5a255e5f..82fc9afac 100644 --- a/plugins/lockdevice/lockdeviceplugin.cpp +++ b/plugins/lockdevice/lockdeviceplugin.cpp @@ -66,7 +66,7 @@ void LockDevicePlugin::setLocked(bool locked) sendPacket(np); } -bool LockDevicePlugin::receivePacket(const NetworkPacket &np) +void LockDevicePlugin::receivePacket(const NetworkPacket &np) { if (np.has(QStringLiteral("isLocked"))) { bool locked = np.get(QStringLiteral("isLocked")); @@ -111,8 +111,6 @@ bool LockDevicePlugin::receivePacket(const NetworkPacket &np) sendState(); } - - return true; } void LockDevicePlugin::sendState() diff --git a/plugins/lockdevice/lockdeviceplugin.h b/plugins/lockdevice/lockdeviceplugin.h index 66c555444..96aa93620 100644 --- a/plugins/lockdevice/lockdeviceplugin.h +++ b/plugins/lockdevice/lockdeviceplugin.h @@ -30,7 +30,7 @@ public: QString dbusPath() const override; void connected() override; - bool receivePacket(const NetworkPacket &np) override; + void receivePacket(const NetworkPacket &np) override; Q_SIGNALS: Q_SCRIPTABLE void lockedChanged(bool locked); diff --git a/plugins/mmtelephony/mmtelephonyplugin.cpp b/plugins/mmtelephony/mmtelephonyplugin.cpp index 892ab299a..d90fbb7aa 100644 --- a/plugins/mmtelephony/mmtelephonyplugin.cpp +++ b/plugins/mmtelephony/mmtelephonyplugin.cpp @@ -30,14 +30,11 @@ MMTelephonyPlugin::MMTelephonyPlugin(QObject *parent, const QVariantList &args) connect(ModemManager::notifier(), &ModemManager::Notifier::modemAdded, this, &MMTelephonyPlugin::onModemAdded); } -bool MMTelephonyPlugin::receivePacket(const NetworkPacket &np) +void MMTelephonyPlugin::receivePacket(const NetworkPacket &np) { if (np.get(QStringLiteral("event")) == QLatin1String("mute")) { // TODO: mute code - return true; } - - return true; } void MMTelephonyPlugin::onModemAdded(const QString &path) diff --git a/plugins/mmtelephony/mmtelephonyplugin.h b/plugins/mmtelephony/mmtelephonyplugin.h index f01ac6fc1..176f3a20e 100644 --- a/plugins/mmtelephony/mmtelephonyplugin.h +++ b/plugins/mmtelephony/mmtelephonyplugin.h @@ -37,7 +37,7 @@ public: explicit MMTelephonyPlugin(QObject *parent, const QVariantList &args); ~MMTelephonyPlugin() override = default; - bool receivePacket(const NetworkPacket &np) override; + void receivePacket(const NetworkPacket &np) override; private: void onCallAdded(ModemManager::Call::Ptr call); diff --git a/plugins/mousepad/mousepadplugin.cpp b/plugins/mousepad/mousepadplugin.cpp index 93d358a96..5d149512f 100644 --- a/plugins/mousepad/mousepadplugin.cpp +++ b/plugins/mousepad/mousepadplugin.cpp @@ -53,12 +53,10 @@ MousepadPlugin::~MousepadPlugin() delete m_impl; } -bool MousepadPlugin::receivePacket(const NetworkPacket &np) +void MousepadPlugin::receivePacket(const NetworkPacket &np) { if (m_impl) { - return m_impl->handlePacket(np); - } else { - return false; + m_impl->handlePacket(np); } } diff --git a/plugins/mousepad/mousepadplugin.h b/plugins/mousepad/mousepadplugin.h index 8c2b7404c..97f975710 100644 --- a/plugins/mousepad/mousepadplugin.h +++ b/plugins/mousepad/mousepadplugin.h @@ -23,7 +23,7 @@ public: explicit MousepadPlugin(QObject *parent, const QVariantList &args); ~MousepadPlugin() override; - bool receivePacket(const NetworkPacket &np) override; + void receivePacket(const NetworkPacket &np) override; void connected() override; private: diff --git a/plugins/mpriscontrol/mpriscontrolplugin-win.cpp b/plugins/mpriscontrol/mpriscontrolplugin-win.cpp index db5203759..411725bfb 100644 --- a/plugins/mpriscontrol/mpriscontrolplugin-win.cpp +++ b/plugins/mpriscontrol/mpriscontrolplugin-win.cpp @@ -279,10 +279,10 @@ bool MprisControlPlugin::sendAlbumArt(std::variant const } } -bool MprisControlPlugin::receivePacket(const NetworkPacket &np) +void MprisControlPlugin::receivePacket(const NetworkPacket &np) { if (np.has(QStringLiteral("playerList"))) { - return false; // Whoever sent this is an mpris client and not an mpris control! + return; // Whoever sent this is an mpris client and not an mpris control! } // Send the player list @@ -292,14 +292,15 @@ bool MprisControlPlugin::receivePacket(const NetworkPacket &np) if (!valid_player || np.get(QStringLiteral("requestPlayerList"))) { sendPlayerList(); if (!valid_player) { - return true; + return; } } auto player = it.value(); if (np.has(QStringLiteral("albumArtUrl"))) { - return sendAlbumArt(name, player, np.get(QStringLiteral("albumArtUrl"))); + sendAlbumArt(name, player, np.get(QStringLiteral("albumArtUrl"))); + return; } if (np.has(QStringLiteral("action"))) { @@ -366,8 +367,6 @@ bool MprisControlPlugin::receivePacket(const NetworkPacket &np) if (somethingToSend) { sendPacket(answer); } - - return true; } #include "moc_mpriscontrolplugin-win.cpp" diff --git a/plugins/mpriscontrol/mpriscontrolplugin-win.h b/plugins/mpriscontrol/mpriscontrolplugin-win.h index af7f7b368..75cc3a2a4 100644 --- a/plugins/mpriscontrol/mpriscontrolplugin-win.h +++ b/plugins/mpriscontrol/mpriscontrolplugin-win.h @@ -32,7 +32,7 @@ class MprisControlPlugin : public KdeConnectPlugin public: explicit MprisControlPlugin(QObject *parent, const QVariantList &args); - bool receivePacket(const NetworkPacket &np) override; + void receivePacket(const NetworkPacket &np) override; private: GlobalSystemMediaTransportControlsSessionManager sessionManager; diff --git a/plugins/mpriscontrol/mpriscontrolplugin.cpp b/plugins/mpriscontrol/mpriscontrolplugin.cpp index c3cb31725..c58851a1b 100644 --- a/plugins/mpriscontrol/mpriscontrolplugin.cpp +++ b/plugins/mpriscontrol/mpriscontrolplugin.cpp @@ -254,14 +254,15 @@ bool MprisControlPlugin::sendAlbumArt(const NetworkPacket &np) return true; } -bool MprisControlPlugin::receivePacket(const NetworkPacket &np) +void MprisControlPlugin::receivePacket(const NetworkPacket &np) { if (np.has(QStringLiteral("playerList"))) { - return false; // Whoever sent this is an mpris client and not an mpris control! + return; // Whoever sent this is an mpris client and not an mpris control! } if (np.has(QStringLiteral("albumArtUrl"))) { - return sendAlbumArt(np); + sendAlbumArt(np); + return; } // Send the player list @@ -271,7 +272,7 @@ bool MprisControlPlugin::receivePacket(const NetworkPacket &np) if (!valid_player || np.get(QStringLiteral("requestPlayerList"))) { sendPlayerList(); if (!valid_player) { - return true; + return; } } @@ -357,8 +358,6 @@ bool MprisControlPlugin::receivePacket(const NetworkPacket &np) answer.set(QStringLiteral("player"), player); sendPacket(answer); } - - return true; } void MprisControlPlugin::sendPlayerList() diff --git a/plugins/mpriscontrol/mpriscontrolplugin.h b/plugins/mpriscontrol/mpriscontrolplugin.h index 93df82914..a62cf5be1 100644 --- a/plugins/mpriscontrol/mpriscontrolplugin.h +++ b/plugins/mpriscontrol/mpriscontrolplugin.h @@ -51,7 +51,7 @@ class MprisControlPlugin : public KdeConnectPlugin public: explicit MprisControlPlugin(QObject *parent, const QVariantList &args); - bool receivePacket(const NetworkPacket &np) override; + void receivePacket(const NetworkPacket &np) override; private Q_SLOTS: void propertiesChanged(const QString &propertyInterface, const QVariantMap &properties); diff --git a/plugins/mprisremote/mprisremoteplugin.cpp b/plugins/mprisremote/mprisremoteplugin.cpp index ea4f5c47a..94105fed6 100644 --- a/plugins/mprisremote/mprisremoteplugin.cpp +++ b/plugins/mprisremote/mprisremoteplugin.cpp @@ -21,10 +21,10 @@ MprisRemotePlugin::MprisRemotePlugin(QObject *parent, const QVariantList &args) { } -bool MprisRemotePlugin::receivePacket(const NetworkPacket &np) +void MprisRemotePlugin::receivePacket(const NetworkPacket &np) { if (np.type() != PACKET_TYPE_MPRIS) - return false; + return; if (np.has(QStringLiteral("player"))) { const QString player = np.get(QStringLiteral("player")); @@ -62,8 +62,6 @@ bool MprisRemotePlugin::receivePacket(const NetworkPacket &np) } } Q_EMIT propertiesChanged(); - - return true; } long MprisRemotePlugin::position() const diff --git a/plugins/mprisremote/mprisremoteplugin.h b/plugins/mprisremote/mprisremoteplugin.h index 86c394d47..cb52f0f7a 100644 --- a/plugins/mprisremote/mprisremoteplugin.h +++ b/plugins/mprisremote/mprisremoteplugin.h @@ -48,7 +48,7 @@ public: void setPosition(int position); void setPlayer(const QString &player); - bool receivePacket(const NetworkPacket &np) override; + void receivePacket(const NetworkPacket &np) override; QString dbusPath() const override; Q_SCRIPTABLE void seek(int offset) const; diff --git a/plugins/notifications/notificationsplugin.cpp b/plugins/notifications/notificationsplugin.cpp index bb5d840c2..befccc657 100644 --- a/plugins/notifications/notificationsplugin.cpp +++ b/plugins/notifications/notificationsplugin.cpp @@ -33,10 +33,10 @@ void NotificationsPlugin::connected() sendPacket(np); } -bool NotificationsPlugin::receivePacket(const NetworkPacket &np) +void NotificationsPlugin::receivePacket(const NetworkPacket &np) { if (np.get(QStringLiteral("request"))) - return false; + return; if (np.get(QStringLiteral("isCancel"))) { QString id = np.get(QStringLiteral("id")); @@ -44,7 +44,7 @@ bool NotificationsPlugin::receivePacket(const NetworkPacket &np) if (id.startsWith(QLatin1String("org.kde.kdeconnect_tp::"))) id = id.mid(id.indexOf(QLatin1String("::")) + 2); removeNotification(id); - return true; + return; } QString id = np.get(QStringLiteral("id")); @@ -64,8 +64,6 @@ bool NotificationsPlugin::receivePacket(const NetworkPacket &np) noti = m_notifications.value(pubId); noti->update(np); } - - return true; } void NotificationsPlugin::clearNotifications() diff --git a/plugins/notifications/notificationsplugin.h b/plugins/notifications/notificationsplugin.h index 2dfc72ee9..dd3a22401 100644 --- a/plugins/notifications/notificationsplugin.h +++ b/plugins/notifications/notificationsplugin.h @@ -22,7 +22,7 @@ class NotificationsPlugin : public KdeConnectPlugin public: explicit NotificationsPlugin(QObject *parent, const QVariantList &args); - bool receivePacket(const NetworkPacket &np) override; + void receivePacket(const NetworkPacket &np) override; void connected() override; QString dbusPath() const override; diff --git a/plugins/pausemusic/pausemusicplugin-win.cpp b/plugins/pausemusic/pausemusicplugin-win.cpp index d6c7a6aa3..81e7f3e47 100644 --- a/plugins/pausemusic/pausemusicplugin-win.cpp +++ b/plugins/pausemusic/pausemusicplugin-win.cpp @@ -103,17 +103,17 @@ PauseMusicPlugin::~PauseMusicPlugin() CoUninitialize(); } -bool PauseMusicPlugin::receivePacket(const NetworkPacket &np) +void PauseMusicPlugin::receivePacket(const NetworkPacket &np) { bool pauseOnlyWhenTalking = config()->getBool(QStringLiteral("conditionTalking"), false); if (pauseOnlyWhenTalking) { if (np.get(QStringLiteral("event")) != QLatin1String("talking")) { - return true; + return; } } else { if (np.get(QStringLiteral("event")) != QLatin1String("ringing") && np.get(QStringLiteral("event")) != QLatin1String("talking")) { - return true; + return; } } @@ -208,8 +208,6 @@ bool PauseMusicPlugin::receivePacket(const NetworkPacket &np) } } } - - return true; } #include "moc_pausemusicplugin-win.cpp" diff --git a/plugins/pausemusic/pausemusicplugin-win.h b/plugins/pausemusic/pausemusicplugin-win.h index d7e1b4d9f..b591e154c 100644 --- a/plugins/pausemusic/pausemusicplugin-win.h +++ b/plugins/pausemusic/pausemusicplugin-win.h @@ -33,7 +33,7 @@ public: explicit PauseMusicPlugin(QObject *parent, const QVariantList &args); ~PauseMusicPlugin(); - bool receivePacket(const NetworkPacket &np) override; + void receivePacket(const NetworkPacket &np) override; private: void updatePlayersList(); diff --git a/plugins/pausemusic/pausemusicplugin.cpp b/plugins/pausemusic/pausemusicplugin.cpp index ea3febfaf..1488e7439 100644 --- a/plugins/pausemusic/pausemusicplugin.cpp +++ b/plugins/pausemusic/pausemusicplugin.cpp @@ -23,17 +23,17 @@ PauseMusicPlugin::PauseMusicPlugin(QObject *parent, const QVariantList &args) { } -bool PauseMusicPlugin::receivePacket(const NetworkPacket &np) +void PauseMusicPlugin::receivePacket(const NetworkPacket &np) { bool pauseOnlyWhenTalking = config()->getBool(QStringLiteral("conditionTalking"), false); if (pauseOnlyWhenTalking) { if (np.get(QStringLiteral("event")) != QLatin1String("talking")) { - return true; + return; } } else { // Pause as soon as it rings if (np.get(QStringLiteral("event")) != QLatin1String("ringing") && np.get(QStringLiteral("event")) != QLatin1String("talking")) { - return true; + return; } } @@ -102,8 +102,6 @@ bool PauseMusicPlugin::receivePacket(const NetworkPacket &np) pausedSources.clear(); } } - - return true; } #include "moc_pausemusicplugin.cpp" diff --git a/plugins/pausemusic/pausemusicplugin.h b/plugins/pausemusic/pausemusicplugin.h index 4aecd2d26..a4cec7d45 100644 --- a/plugins/pausemusic/pausemusicplugin.h +++ b/plugins/pausemusic/pausemusicplugin.h @@ -19,7 +19,7 @@ class PauseMusicPlugin : public KdeConnectPlugin public: explicit PauseMusicPlugin(QObject *parent, const QVariantList &args); - bool receivePacket(const NetworkPacket &np) override; + void receivePacket(const NetworkPacket &np) override; private: QSet pausedSources; diff --git a/plugins/photo/photoplugin.cpp b/plugins/photo/photoplugin.cpp index 6593aa4d6..3bdcd2dc8 100644 --- a/plugins/photo/photoplugin.cpp +++ b/plugins/photo/photoplugin.cpp @@ -20,14 +20,14 @@ PhotoPlugin::PhotoPlugin(QObject *parent, const QVariantList &args) { } -bool PhotoPlugin::receivePacket(const NetworkPacket &np) +void PhotoPlugin::receivePacket(const NetworkPacket &np) { if (np.get(QStringLiteral("cancel"))) { requestedFiles.takeFirst(); } if (requestedFiles.isEmpty() || !np.hasPayload()) { - return true; + return; } const QString url = requestedFiles.takeFirst(); @@ -36,7 +36,6 @@ bool PhotoPlugin::receivePacket(const NetworkPacket &np) Q_EMIT photoReceived(url); }); job->start(); - return true; } void PhotoPlugin::requestPhoto(const QString &url) diff --git a/plugins/photo/photoplugin.h b/plugins/photo/photoplugin.h index 23984e096..591e7670a 100644 --- a/plugins/photo/photoplugin.h +++ b/plugins/photo/photoplugin.h @@ -23,7 +23,7 @@ public: Q_SCRIPTABLE void requestPhoto(const QString &url); - bool receivePacket(const NetworkPacket &np) override; + void receivePacket(const NetworkPacket &np) override; QString dbusPath() const override; diff --git a/plugins/ping/pingplugin.cpp b/plugins/ping/pingplugin.cpp index 9c8bc5944..9b5616b28 100644 --- a/plugins/ping/pingplugin.cpp +++ b/plugins/ping/pingplugin.cpp @@ -30,14 +30,12 @@ PingPlugin::~PingPlugin() // qCDebug(KDECONNECT_PLUGIN_PING) << "Ping plugin destructor for device" << device()->name(); } -bool PingPlugin::receivePacket(const NetworkPacket &np) +void PingPlugin::receivePacket(const NetworkPacket &np) { Daemon::instance()->sendSimpleNotification(QStringLiteral("pingReceived"), device()->name(), np.get(QStringLiteral("message"), i18n("Ping!")), QStringLiteral("dialog-ok")); - - return true; } void PingPlugin::sendPing() diff --git a/plugins/ping/pingplugin.h b/plugins/ping/pingplugin.h index 70590deeb..b77bc9615 100644 --- a/plugins/ping/pingplugin.h +++ b/plugins/ping/pingplugin.h @@ -24,6 +24,6 @@ public: Q_SCRIPTABLE void sendPing(); Q_SCRIPTABLE void sendPing(const QString &customMessage); - bool receivePacket(const NetworkPacket &np) override; + void receivePacket(const NetworkPacket &np) override; QString dbusPath() const override; }; diff --git a/plugins/presenter/presenterplugin.cpp b/plugins/presenter/presenterplugin.cpp index b06341483..072702f21 100644 --- a/plugins/presenter/presenterplugin.cpp +++ b/plugins/presenter/presenterplugin.cpp @@ -58,12 +58,12 @@ PresenterPlugin::PresenterPlugin(QObject *parent, const QVariantList &args) m_timer->setSingleShot(true); } -bool PresenterPlugin::receivePacket(const NetworkPacket &np) +void PresenterPlugin::receivePacket(const NetworkPacket &np) { if (np.get(QStringLiteral("stop"), false)) { delete m_view; m_view = nullptr; - return true; + return; } if (!m_view) { @@ -88,7 +88,6 @@ bool PresenterPlugin::receivePacket(const NetworkPacket &np) QQuickItem *object = m_view->rootObject(); object->setProperty("xPos", m_xPos); object->setProperty("yPos", m_yPos); - return true; } #include "moc_presenterplugin.cpp" diff --git a/plugins/presenter/presenterplugin.h b/plugins/presenter/presenterplugin.h index 44400397a..dfa802743 100644 --- a/plugins/presenter/presenterplugin.h +++ b/plugins/presenter/presenterplugin.h @@ -23,7 +23,7 @@ class PresenterPlugin : public KdeConnectPlugin public: explicit PresenterPlugin(QObject *parent, const QVariantList &args); - bool receivePacket(const NetworkPacket &np) override; + void receivePacket(const NetworkPacket &np) override; private: QPointer m_view; diff --git a/plugins/remotecommands/remotecommandsplugin.cpp b/plugins/remotecommands/remotecommandsplugin.cpp index 1154c0f81..136bee09a 100644 --- a/plugins/remotecommands/remotecommandsplugin.cpp +++ b/plugins/remotecommands/remotecommandsplugin.cpp @@ -24,15 +24,12 @@ RemoteCommandsPlugin::RemoteCommandsPlugin(QObject *parent, const QVariantList & { } -bool RemoteCommandsPlugin::receivePacket(const NetworkPacket &np) +void RemoteCommandsPlugin::receivePacket(const NetworkPacket &np) { if (np.has(QStringLiteral("commandList"))) { m_canAddCommand = np.get(QStringLiteral("canAddCommand")); setCommands(np.get(QStringLiteral("commandList"))); - return true; } - - return false; } void RemoteCommandsPlugin::connected() diff --git a/plugins/remotecommands/remotecommandsplugin.h b/plugins/remotecommands/remotecommandsplugin.h index 27f5442c1..665d0993d 100644 --- a/plugins/remotecommands/remotecommandsplugin.h +++ b/plugins/remotecommands/remotecommandsplugin.h @@ -38,7 +38,7 @@ public: return m_canAddCommand; } - bool receivePacket(const NetworkPacket &np) override; + void receivePacket(const NetworkPacket &np) override; void connected() override; QString dbusPath() const override; diff --git a/plugins/remotecontrol/remotecontrolplugin.h b/plugins/remotecontrol/remotecontrolplugin.h index caeac0b2f..ca50ada22 100644 --- a/plugins/remotecontrol/remotecontrolplugin.h +++ b/plugins/remotecontrol/remotecontrolplugin.h @@ -20,10 +20,6 @@ class RemoteControlPlugin : public KdeConnectPlugin public: explicit RemoteControlPlugin(QObject *parent, const QVariantList &args); - bool receivePacket(const NetworkPacket & /*np*/) override - { - return false; - } QString dbusPath() const override; Q_SCRIPTABLE void moveCursor(const QPoint &p); diff --git a/plugins/remotekeyboard/remotekeyboardplugin.cpp b/plugins/remotekeyboard/remotekeyboardplugin.cpp index d8b8824fc..94a20b455 100644 --- a/plugins/remotekeyboard/remotekeyboardplugin.cpp +++ b/plugins/remotekeyboard/remotekeyboardplugin.cpp @@ -58,12 +58,12 @@ RemoteKeyboardPlugin::RemoteKeyboardPlugin(QObject *parent, const QVariantList & { } -bool RemoteKeyboardPlugin::receivePacket(const NetworkPacket &np) +void RemoteKeyboardPlugin::receivePacket(const NetworkPacket &np) { if (np.type() == PACKET_TYPE_MOUSEPAD_ECHO) { if (!np.has(QStringLiteral("isAck")) || !np.has(QStringLiteral("key"))) { qCWarning(KDECONNECT_PLUGIN_REMOTEKEYBOARD) << "Invalid packet of type" << PACKET_TYPE_MOUSEPAD_ECHO; - return false; + return; } // qCWarning(KDECONNECT_PLUGIN_REMOTEKEYBOARD) << "Received keypress" << np; Q_EMIT keyPressReceived(np.get(QStringLiteral("key")), @@ -71,16 +71,13 @@ bool RemoteKeyboardPlugin::receivePacket(const NetworkPacket &np) np.get(QStringLiteral("shift"), false), np.get(QStringLiteral("ctrl"), false), np.get(QStringLiteral("alt"), 0)); - return true; } else if (np.type() == PACKET_TYPE_MOUSEPAD_KEYBOARDSTATE) { // qCWarning(KDECONNECT_PLUGIN_REMOTEKEYBOARD) << "Received keyboardstate" << np; if (m_remoteState != np.get(QStringLiteral("state"))) { m_remoteState = np.get(QStringLiteral("state")); Q_EMIT remoteStateChanged(m_remoteState); } - return true; } - return false; } void RemoteKeyboardPlugin::sendKeyPress(const QString &key, int specialKey, bool shift, bool ctrl, bool alt, bool sendAck) const diff --git a/plugins/remotekeyboard/remotekeyboardplugin.h b/plugins/remotekeyboard/remotekeyboardplugin.h index 3d5da495a..c53dee6bb 100644 --- a/plugins/remotekeyboard/remotekeyboardplugin.h +++ b/plugins/remotekeyboard/remotekeyboardplugin.h @@ -28,7 +28,7 @@ private: public: explicit RemoteKeyboardPlugin(QObject *parent, const QVariantList &args); - bool receivePacket(const NetworkPacket &np) override; + void receivePacket(const NetworkPacket &np) override; QString dbusPath() const override; bool remoteState() const diff --git a/plugins/remotesystemvolume/remotesystemvolumeplugin.cpp b/plugins/remotesystemvolume/remotesystemvolumeplugin.cpp index a57c9bfc0..fd1d9fa4b 100644 --- a/plugins/remotesystemvolume/remotesystemvolumeplugin.cpp +++ b/plugins/remotesystemvolume/remotesystemvolumeplugin.cpp @@ -26,7 +26,7 @@ RemoteSystemVolumePlugin::RemoteSystemVolumePlugin(QObject *parent, const QVaria { } -bool RemoteSystemVolumePlugin::receivePacket(const NetworkPacket &np) +void RemoteSystemVolumePlugin::receivePacket(const NetworkPacket &np) { if (np.has(QStringLiteral("sinkList"))) { QJsonDocument document(np.get(QStringLiteral("sinkList"))); @@ -43,8 +43,6 @@ bool RemoteSystemVolumePlugin::receivePacket(const NetworkPacket &np) Q_EMIT mutedChanged(name, np.get(QStringLiteral("muted"))); } } - - return true; } void RemoteSystemVolumePlugin::sendVolume(const QString &name, int volume) diff --git a/plugins/remotesystemvolume/remotesystemvolumeplugin.h b/plugins/remotesystemvolume/remotesystemvolumeplugin.h index 424249087..a39618abb 100644 --- a/plugins/remotesystemvolume/remotesystemvolumeplugin.h +++ b/plugins/remotesystemvolume/remotesystemvolumeplugin.h @@ -23,7 +23,7 @@ class RemoteSystemVolumePlugin : public KdeConnectPlugin public: explicit RemoteSystemVolumePlugin(QObject *parent, const QVariantList &args); - bool receivePacket(const NetworkPacket &np) override; + void receivePacket(const NetworkPacket &np) override; void connected() override; QString dbusPath() const override; diff --git a/plugins/runcommand/runcommandplugin.cpp b/plugins/runcommand/runcommandplugin.cpp index 50d83a8c9..f09935705 100644 --- a/plugins/runcommand/runcommandplugin.cpp +++ b/plugins/runcommand/runcommandplugin.cpp @@ -37,11 +37,11 @@ RunCommandPlugin::RunCommandPlugin(QObject *parent, const QVariantList &args) connect(config(), &KdeConnectPluginConfig::configChanged, this, &RunCommandPlugin::sendConfig); } -bool RunCommandPlugin::receivePacket(const NetworkPacket &np) +void RunCommandPlugin::receivePacket(const NetworkPacket &np) { if (np.get(QStringLiteral("requestCommandList"), false)) { sendConfig(); - return true; + return; } if (np.has(QStringLiteral("key"))) { @@ -59,13 +59,10 @@ bool RunCommandPlugin::receivePacket(const NetworkPacket &np) #else QProcess::startDetached(QStringLiteral(COMMAND), QStringList{QStringLiteral(ARGS), commandJson[QStringLiteral("command")].toString()}); #endif - return true; } else if (np.has(QStringLiteral("setup"))) { OpenConfig oc; oc.openConfiguration(device()->id(), QStringLiteral("kdeconnect_runcommand")); } - - return false; } void RunCommandPlugin::connected() diff --git a/plugins/runcommand/runcommandplugin.h b/plugins/runcommand/runcommandplugin.h index 6dbb8a751..5f50f348f 100644 --- a/plugins/runcommand/runcommandplugin.h +++ b/plugins/runcommand/runcommandplugin.h @@ -22,7 +22,7 @@ class RunCommandPlugin : public KdeConnectPlugin public: explicit RunCommandPlugin(QObject *parent, const QVariantList &args); - bool receivePacket(const NetworkPacket &np) override; + void receivePacket(const NetworkPacket &np) override; void connected() override; private: diff --git a/plugins/screensaver-inhibit/screensaverinhibitplugin-macos.cpp b/plugins/screensaver-inhibit/screensaverinhibitplugin-macos.cpp index 745d1276d..95cbfb792 100644 --- a/plugins/screensaver-inhibit/screensaverinhibitplugin-macos.cpp +++ b/plugins/screensaver-inhibit/screensaverinhibitplugin-macos.cpp @@ -33,11 +33,5 @@ ScreensaverInhibitPlugin::~ScreensaverInhibitPlugin() } } -bool ScreensaverInhibitPlugin::receivePacket(const NetworkPacket &np) -{ - Q_UNUSED(np); - return false; -} - #include "moc_screensaverinhibitplugin-macos.cpp" #include "screensaverinhibitplugin-macos.moc" diff --git a/plugins/screensaver-inhibit/screensaverinhibitplugin-macos.h b/plugins/screensaver-inhibit/screensaverinhibitplugin-macos.h index f56d98544..8533e7390 100644 --- a/plugins/screensaver-inhibit/screensaverinhibitplugin-macos.h +++ b/plugins/screensaver-inhibit/screensaverinhibitplugin-macos.h @@ -19,8 +19,6 @@ public: explicit ScreensaverInhibitPlugin(QObject *parent, const QVariantList &args); ~ScreensaverInhibitPlugin() override; - bool receivePacket(const NetworkPacket &np) override; - private: QProcess *m_caffeinateProcess; }; diff --git a/plugins/screensaver-inhibit/screensaverinhibitplugin-win.cpp b/plugins/screensaver-inhibit/screensaverinhibitplugin-win.cpp index 7bdac2f02..284dd4997 100644 --- a/plugins/screensaver-inhibit/screensaverinhibitplugin-win.cpp +++ b/plugins/screensaver-inhibit/screensaverinhibitplugin-win.cpp @@ -23,11 +23,5 @@ ScreensaverInhibitPlugin::~ScreensaverInhibitPlugin() SetThreadExecutionState(ES_CONTINUOUS); } -bool ScreensaverInhibitPlugin::receivePacket(const NetworkPacket &np) -{ - Q_UNUSED(np); - return false; -} - #include "moc_screensaverinhibitplugin-win.cpp" #include "screensaverinhibitplugin-win.moc" diff --git a/plugins/screensaver-inhibit/screensaverinhibitplugin-win.h b/plugins/screensaver-inhibit/screensaverinhibitplugin-win.h index b74977dc9..d64b6819d 100644 --- a/plugins/screensaver-inhibit/screensaverinhibitplugin-win.h +++ b/plugins/screensaver-inhibit/screensaverinhibitplugin-win.h @@ -17,6 +17,4 @@ class ScreensaverInhibitPlugin : public KdeConnectPlugin public: explicit ScreensaverInhibitPlugin(QObject *parent, const QVariantList &args); ~ScreensaverInhibitPlugin() override; - - bool receivePacket(const NetworkPacket &np) override; }; diff --git a/plugins/screensaver-inhibit/screensaverinhibitplugin.cpp b/plugins/screensaver-inhibit/screensaverinhibitplugin.cpp index cd51d1dc7..ce372fa4f 100644 --- a/plugins/screensaver-inhibit/screensaverinhibitplugin.cpp +++ b/plugins/screensaver-inhibit/screensaverinhibitplugin.cpp @@ -42,11 +42,5 @@ ScreensaverInhibitPlugin::~ScreensaverInhibitPlugin() inhibitInterface.SimulateUserActivity(); } -bool ScreensaverInhibitPlugin::receivePacket(const NetworkPacket &np) -{ - Q_UNUSED(np); - return false; -} - #include "moc_screensaverinhibitplugin.cpp" #include "screensaverinhibitplugin.moc" diff --git a/plugins/screensaver-inhibit/screensaverinhibitplugin.h b/plugins/screensaver-inhibit/screensaverinhibitplugin.h index b3b0e282c..a0c327dd0 100644 --- a/plugins/screensaver-inhibit/screensaverinhibitplugin.h +++ b/plugins/screensaver-inhibit/screensaverinhibitplugin.h @@ -18,8 +18,6 @@ public: explicit ScreensaverInhibitPlugin(QObject *parent, const QVariantList &args); ~ScreensaverInhibitPlugin() override; - bool receivePacket(const NetworkPacket &np) override; - private: uint inhibitCookie; }; diff --git a/plugins/sendnotifications/sendnotificationsplugin.cpp b/plugins/sendnotifications/sendnotificationsplugin.cpp index 13d70fbc6..f2c6237d5 100644 --- a/plugins/sendnotifications/sendnotificationsplugin.cpp +++ b/plugins/sendnotifications/sendnotificationsplugin.cpp @@ -24,11 +24,5 @@ SendNotificationsPlugin::~SendNotificationsPlugin() delete notificationsListener; } -bool SendNotificationsPlugin::receivePacket(const NetworkPacket &np) -{ - Q_UNUSED(np); - return true; -} - #include "moc_sendnotificationsplugin.cpp" #include "sendnotificationsplugin.moc" diff --git a/plugins/sendnotifications/sendnotificationsplugin.h b/plugins/sendnotifications/sendnotificationsplugin.h index 4a161ae48..563b0f672 100644 --- a/plugins/sendnotifications/sendnotificationsplugin.h +++ b/plugins/sendnotifications/sendnotificationsplugin.h @@ -26,8 +26,6 @@ public: explicit SendNotificationsPlugin(QObject *parent, const QVariantList &args); ~SendNotificationsPlugin() override; - bool receivePacket(const NetworkPacket &np) override; - protected: NotificationsListener *notificationsListener; }; diff --git a/plugins/sftp/sftpplugin-win.cpp b/plugins/sftp/sftpplugin-win.cpp index facfd7bdc..5450e5e3f 100644 --- a/plugins/sftp/sftpplugin-win.cpp +++ b/plugins/sftp/sftpplugin-win.cpp @@ -32,7 +32,7 @@ bool SftpPlugin::startBrowsing() return false; } -bool SftpPlugin::receivePacket(const NetworkPacket &np) +void SftpPlugin::receivePacket(const NetworkPacket &np) { QStringList receivedFieldsList = np.body().keys(); QSet receivedFields(receivedFieldsList.begin(), receivedFieldsList.end()); @@ -41,11 +41,11 @@ bool SftpPlugin::receivePacket(const NetworkPacket &np) for (QString missingField : (expectedFields - receivedFields)) { qCWarning(KDECONNECT_PLUGIN_SFTP) << "Field" << missingField << "missing from packet."; } - return false; + return; } if (np.has(QStringLiteral("errorMessage"))) { qCWarning(KDECONNECT_PLUGIN_SFTP) << np.get(QStringLiteral("errorMessage")); - return false; + return; } QString path; @@ -73,7 +73,6 @@ bool SftpPlugin::receivePacket(const NetworkPacket &np) QMessageBox::Abort, QMessageBox::Abort); } - return true; } #include "moc_sftpplugin-win.cpp" diff --git a/plugins/sftp/sftpplugin-win.h b/plugins/sftp/sftpplugin-win.h index 689b01fef..3b4e0e9b5 100644 --- a/plugins/sftp/sftpplugin-win.h +++ b/plugins/sftp/sftpplugin-win.h @@ -22,7 +22,7 @@ class SftpPlugin : public KdeConnectPlugin public: explicit SftpPlugin(QObject *parent, const QVariantList &args); - bool receivePacket(const NetworkPacket &np) override; + void receivePacket(const NetworkPacket &np) override; QString dbusPath() const override { return QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/sftp"); diff --git a/plugins/sftp/sftpplugin.cpp b/plugins/sftp/sftpplugin.cpp index 3d5e9014f..7d5281ef6 100644 --- a/plugins/sftp/sftpplugin.cpp +++ b/plugins/sftp/sftpplugin.cpp @@ -121,13 +121,13 @@ bool SftpPlugin::startBrowsing() return false; } -bool SftpPlugin::receivePacket(const NetworkPacket &np) +void SftpPlugin::receivePacket(const NetworkPacket &np) { const QStringList keysList = np.body().keys(); const auto keys = QSet(keysList.begin(), keysList.end()); if (!(fields_c - keys).isEmpty() && !np.has(QStringLiteral("errorMessage"))) { // packet is invalid - return false; + return; } Q_EMIT packetReceived(np); @@ -144,7 +144,6 @@ bool SftpPlugin::receivePacket(const NetworkPacket &np) remoteDirectories.insert(mountPoint(), i18n("All files")); remoteDirectories.insert(mountPoint() + QStringLiteral("/DCIM/Camera"), i18n("Camera pictures")); } - return true; } QString SftpPlugin::mountPoint() diff --git a/plugins/sftp/sftpplugin.h b/plugins/sftp/sftpplugin.h index fc82a1366..9efe511e4 100644 --- a/plugins/sftp/sftpplugin.h +++ b/plugins/sftp/sftpplugin.h @@ -20,7 +20,7 @@ public: explicit SftpPlugin(QObject *parent, const QVariantList &args); ~SftpPlugin() override; - bool receivePacket(const NetworkPacket &np) override; + void receivePacket(const NetworkPacket &np) override; QString dbusPath() const override { return QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/sftp"); diff --git a/plugins/share/shareplugin.cpp b/plugins/share/shareplugin.cpp index cc9b95595..f87a64828 100644 --- a/plugins/share/shareplugin.cpp +++ b/plugins/share/shareplugin.cpp @@ -86,7 +86,7 @@ void SharePlugin::setDateCreated(const QUrl &destination, const qint64 timestamp receivedFile.setFileTime(QDateTime::fromMSecsSinceEpoch(timestamp), QFileDevice::FileTime(QFileDevice::FileBirthTime)); } -bool SharePlugin::receivePacket(const NetworkPacket &np) +void SharePlugin::receivePacket(const NetworkPacket &np) { /* //TODO: Write a test like this @@ -103,8 +103,6 @@ bool SharePlugin::receivePacket(const NetworkPacket &np) device()->sendPacket(out); - return true; - } */ @@ -206,8 +204,6 @@ bool SharePlugin::receivePacket(const NetworkPacket &np) } else { qCDebug(KDECONNECT_PLUGIN_SHARE) << "Error: Nothing attached!"; } - - return true; } void SharePlugin::finished(KJob *job, const qint64 dateModified, const qint64 dateCreated, const bool open) diff --git a/plugins/share/shareplugin.h b/plugins/share/shareplugin.h index 35b3089df..c5406d3b0 100644 --- a/plugins/share/shareplugin.h +++ b/plugins/share/shareplugin.h @@ -34,7 +34,7 @@ public: shareUrl(QUrl(file), true); } - bool receivePacket(const NetworkPacket &np) override; + void receivePacket(const NetworkPacket &np) override; QString dbusPath() const override; private Q_SLOTS: diff --git a/plugins/sms/smsplugin.cpp b/plugins/sms/smsplugin.cpp index 3bf13ef18..a14d07789 100644 --- a/plugins/sms/smsplugin.cpp +++ b/plugins/sms/smsplugin.cpp @@ -39,17 +39,15 @@ SmsPlugin::~SmsPlugin() // m_conversationInterface is self-deleting, see ~ConversationsDbusInterface for more information } -bool SmsPlugin::receivePacket(const NetworkPacket &np) +void SmsPlugin::receivePacket(const NetworkPacket &np) { if (np.type() == PACKET_TYPE_SMS_MESSAGES) { - return handleBatchMessages(np); + handleBatchMessages(np); } if (np.type() == PACKET_TYPE_SMS_ATTACHMENT_FILE && np.hasPayload()) { - return handleSmsAttachmentFile(np); + handleSmsAttachmentFile(np); } - - return true; } void SmsPlugin::sendSms(const QVariantList &addresses, const QString &textMessage, const QVariantList &attachmentUrls, const qint64 subID) diff --git a/plugins/sms/smsplugin.h b/plugins/sms/smsplugin.h index d05a012b7..be2bfb97c 100644 --- a/plugins/sms/smsplugin.h +++ b/plugins/sms/smsplugin.h @@ -146,7 +146,7 @@ public: explicit SmsPlugin(QObject *parent, const QVariantList &args); ~SmsPlugin() override; - bool receivePacket(const NetworkPacket &np) override; + void receivePacket(const NetworkPacket &np) override; QString dbusPath() const override; diff --git a/plugins/systemvolume/systemvolumeplugin-macos.cpp b/plugins/systemvolume/systemvolumeplugin-macos.cpp index 08a070daa..f5edff9bc 100644 --- a/plugins/systemvolume/systemvolumeplugin-macos.cpp +++ b/plugins/systemvolume/systemvolumeplugin-macos.cpp @@ -219,7 +219,7 @@ SystemvolumePlugin::~SystemvolumePlugin() AudioObjectRemovePropertyListener(kAudioObjectSystemObject, &kAudioDefaultOutputDevicePropertyAddress, &onDefaultChanged, (void *)this); } -bool SystemvolumePlugin::receivePacket(const NetworkPacket &np) +void SystemvolumePlugin::receivePacket(const NetworkPacket &np) { if (np.has(QStringLiteral("requestSinks"))) { sendSinkList(); @@ -238,8 +238,6 @@ bool SystemvolumePlugin::receivePacket(const NetworkPacket &np) } } } - - return true; } void SystemvolumePlugin::sendSinkList() diff --git a/plugins/systemvolume/systemvolumeplugin-macos.h b/plugins/systemvolume/systemvolumeplugin-macos.h index 59f4a10c2..b90c308f6 100644 --- a/plugins/systemvolume/systemvolumeplugin-macos.h +++ b/plugins/systemvolume/systemvolumeplugin-macos.h @@ -26,7 +26,7 @@ public: explicit SystemvolumePlugin(QObject *parent, const QVariantList &args); ~SystemvolumePlugin(); - bool receivePacket(const NetworkPacket &np) override; + void receivePacket(const NetworkPacket &np) override; void connected() override; void sendSinkList(); diff --git a/plugins/systemvolume/systemvolumeplugin-pulse.cpp b/plugins/systemvolume/systemvolumeplugin-pulse.cpp index e774e4738..668654b36 100644 --- a/plugins/systemvolume/systemvolumeplugin-pulse.cpp +++ b/plugins/systemvolume/systemvolumeplugin-pulse.cpp @@ -28,10 +28,10 @@ SystemvolumePlugin::SystemvolumePlugin(QObject *parent, const QVariantList &args { } -bool SystemvolumePlugin::receivePacket(const NetworkPacket &np) +void SystemvolumePlugin::receivePacket(const NetworkPacket &np) { if (!PulseAudioQt::Context::instance()->isValid()) - return false; + return; if (np.has(QStringLiteral("requestSinks"))) { sendSinkList(); @@ -53,7 +53,6 @@ bool SystemvolumePlugin::receivePacket(const NetworkPacket &np) } } } - return true; } void SystemvolumePlugin::sendSinkList() diff --git a/plugins/systemvolume/systemvolumeplugin-pulse.h b/plugins/systemvolume/systemvolumeplugin-pulse.h index e9f187b18..3a0a8e192 100644 --- a/plugins/systemvolume/systemvolumeplugin-pulse.h +++ b/plugins/systemvolume/systemvolumeplugin-pulse.h @@ -23,7 +23,7 @@ class SystemvolumePlugin : public KdeConnectPlugin public: explicit SystemvolumePlugin(QObject *parent, const QVariantList &args); - bool receivePacket(const NetworkPacket &np) override; + void receivePacket(const NetworkPacket &np) override; void connected() override; private: diff --git a/plugins/systemvolume/systemvolumeplugin-win.cpp b/plugins/systemvolume/systemvolumeplugin-win.cpp index 19f028351..a7b70b6b6 100644 --- a/plugins/systemvolume/systemvolumeplugin-win.cpp +++ b/plugins/systemvolume/systemvolumeplugin-win.cpp @@ -407,13 +407,13 @@ HRESULT SystemvolumePlugin::setDefaultAudioPlaybackDevice(QString &name, bool en return hr; } -bool SystemvolumePlugin::receivePacket(const NetworkPacket &np) +void SystemvolumePlugin::receivePacket(const NetworkPacket &np) { if (!valid) - return false; + return; if (np.has(QStringLiteral("requestSinks"))) { - return sendSinkList(); + sendSinkList(); } else { QString name = np.get(QStringLiteral("name")); @@ -447,7 +447,6 @@ bool SystemvolumePlugin::receivePacket(const NetworkPacket &np) } } } - return true; } #include "moc_systemvolumeplugin-win.cpp" diff --git a/plugins/systemvolume/systemvolumeplugin-win.h b/plugins/systemvolume/systemvolumeplugin-win.h index 3b60c69bb..3c3fb8327 100644 --- a/plugins/systemvolume/systemvolumeplugin-win.h +++ b/plugins/systemvolume/systemvolumeplugin-win.h @@ -29,7 +29,7 @@ class SystemvolumePlugin : public KdeConnectPlugin public: explicit SystemvolumePlugin(QObject *parent, const QVariantList &args); ~SystemvolumePlugin(); - bool receivePacket(const NetworkPacket &np) override; + void receivePacket(const NetworkPacket &np) override; void connected() override; private: diff --git a/plugins/telephony/telephonyplugin.cpp b/plugins/telephony/telephonyplugin.cpp index 5d03e2db1..e0b6d391b 100644 --- a/plugins/telephony/telephonyplugin.cpp +++ b/plugins/telephony/telephonyplugin.cpp @@ -73,23 +73,19 @@ void TelephonyPlugin::createNotification(const NetworkPacket &np) m_currentCallNotification->sendEvent(); } -bool TelephonyPlugin::receivePacket(const NetworkPacket &np) +void TelephonyPlugin::receivePacket(const NetworkPacket &np) { if (np.get(QStringLiteral("isCancel"))) { if (m_currentCallNotification) { m_currentCallNotification->close(); } - return true; + return; } // ignore old style sms packet - if (np.get(QStringLiteral("event")) == QLatin1String("sms")) { - return false; + if (np.get(QStringLiteral("event")) != QLatin1String("sms")) { + createNotification(np); } - - createNotification(np); - - return true; } void TelephonyPlugin::sendMutePacket() diff --git a/plugins/telephony/telephonyplugin.h b/plugins/telephony/telephonyplugin.h index 74bfc94f8..3611a2661 100644 --- a/plugins/telephony/telephonyplugin.h +++ b/plugins/telephony/telephonyplugin.h @@ -38,7 +38,7 @@ public: explicit TelephonyPlugin(QObject *parent, const QVariantList &args); ~TelephonyPlugin() override = default; - bool receivePacket(const NetworkPacket &np) override; + void receivePacket(const NetworkPacket &np) override; QString dbusPath() const override; public: diff --git a/plugins/virtualmonitor/virtualmonitorplugin.cpp b/plugins/virtualmonitor/virtualmonitorplugin.cpp index 42b85fac4..f070f239b 100644 --- a/plugins/virtualmonitor/virtualmonitorplugin.cpp +++ b/plugins/virtualmonitor/virtualmonitorplugin.cpp @@ -59,7 +59,7 @@ void VirtualMonitorPlugin::connected() sendPacket(np); } -bool VirtualMonitorPlugin::receivePacket(const NetworkPacket &received) +void VirtualMonitorPlugin::receivePacket(const NetworkPacket &received) { if (received.type() == PACKET_TYPE_VIRTUALMONITOR_REQUEST && received.has(QS("url"))) { QUrl url(received.get(QS("url"))); @@ -76,7 +76,6 @@ bool VirtualMonitorPlugin::receivePacket(const NetworkPacket &received) stop(); } } - return true; } QString VirtualMonitorPlugin::dbusPath() const diff --git a/plugins/virtualmonitor/virtualmonitorplugin.h b/plugins/virtualmonitor/virtualmonitorplugin.h index 3bab552ce..d714d79d1 100644 --- a/plugins/virtualmonitor/virtualmonitorplugin.h +++ b/plugins/virtualmonitor/virtualmonitorplugin.h @@ -28,7 +28,7 @@ public: void connected() override; QString dbusPath() const override; - bool receivePacket(const NetworkPacket &np) override; + void receivePacket(const NetworkPacket &np) override; private: void stop();