Simplify KDEConnectPlugin::recievePacket
- We do not need the return type. If a plugin declares it can handle the packet it should do so. We don't have any fallback logic in place and the packet types are namespaced with the plugin IDs anyway. - Provide a default implementation with a warning, not all plugins need to overwrite this
This commit is contained in:
parent
2edc139522
commit
1631ada5b3
77 changed files with 106 additions and 206 deletions
|
@ -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;
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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<bool>(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
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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<QString>(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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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<QString>(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<qint64>(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"
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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<QVariantMap>(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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -23,5 +23,4 @@ public:
|
|||
Q_SCRIPTABLE void ring();
|
||||
|
||||
QString dbusPath() const override;
|
||||
bool receivePacket(const NetworkPacket &np) override;
|
||||
};
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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<bool>(QStringLiteral("isLocked"));
|
||||
|
@ -77,8 +77,6 @@ bool LockDevicePlugin::receivePacket(const NetworkPacket &np)
|
|||
|
||||
sendState();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void LockDevicePlugin::sendState()
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<bool>(QStringLiteral("isLocked"));
|
||||
|
@ -111,8 +111,6 @@ bool LockDevicePlugin::receivePacket(const NetworkPacket &np)
|
|||
|
||||
sendState();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void LockDevicePlugin::sendState()
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<QString>(QStringLiteral("event")) == QLatin1String("mute")) {
|
||||
// TODO: mute code
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void MMTelephonyPlugin::onModemAdded(const QString &path)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -279,10 +279,10 @@ bool MprisControlPlugin::sendAlbumArt(std::variant<NetworkPacket, QString> 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<bool>(QStringLiteral("requestPlayerList"))) {
|
||||
sendPlayerList();
|
||||
if (!valid_player) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
auto player = it.value();
|
||||
|
||||
if (np.has(QStringLiteral("albumArtUrl"))) {
|
||||
return sendAlbumArt(name, player, np.get<QString>(QStringLiteral("albumArtUrl")));
|
||||
sendAlbumArt(name, player, np.get<QString>(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"
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<bool>(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()
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<QString>(QStringLiteral("player"));
|
||||
|
@ -62,8 +62,6 @@ bool MprisRemotePlugin::receivePacket(const NetworkPacket &np)
|
|||
}
|
||||
}
|
||||
Q_EMIT propertiesChanged();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
long MprisRemotePlugin::position() const
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -33,10 +33,10 @@ void NotificationsPlugin::connected()
|
|||
sendPacket(np);
|
||||
}
|
||||
|
||||
bool NotificationsPlugin::receivePacket(const NetworkPacket &np)
|
||||
void NotificationsPlugin::receivePacket(const NetworkPacket &np)
|
||||
{
|
||||
if (np.get<bool>(QStringLiteral("request")))
|
||||
return false;
|
||||
return;
|
||||
|
||||
if (np.get<bool>(QStringLiteral("isCancel"))) {
|
||||
QString id = np.get<QString>(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<QString>(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()
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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<QString>(QStringLiteral("event")) != QLatin1String("talking")) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (np.get<QString>(QStringLiteral("event")) != QLatin1String("ringing") && np.get<QString>(QStringLiteral("event")) != QLatin1String("talking")) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -208,8 +208,6 @@ bool PauseMusicPlugin::receivePacket(const NetworkPacket &np)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#include "moc_pausemusicplugin-win.cpp"
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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<QString>(QStringLiteral("event")) != QLatin1String("talking")) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
} else { // Pause as soon as it rings
|
||||
if (np.get<QString>(QStringLiteral("event")) != QLatin1String("ringing") && np.get<QString>(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"
|
||||
|
|
|
@ -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<QString> pausedSources;
|
||||
|
|
|
@ -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<bool>(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)
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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<QString>(QStringLiteral("message"), i18n("Ping!")),
|
||||
QStringLiteral("dialog-ok"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void PingPlugin::sendPing()
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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<bool>(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"
|
||||
|
|
|
@ -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<PresenterView> m_view;
|
||||
|
|
|
@ -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<bool>(QStringLiteral("canAddCommand"));
|
||||
setCommands(np.get<QByteArray>(QStringLiteral("commandList")));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void RemoteCommandsPlugin::connected()
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<QString>(QStringLiteral("key")),
|
||||
|
@ -71,16 +71,13 @@ bool RemoteKeyboardPlugin::receivePacket(const NetworkPacket &np)
|
|||
np.get<int>(QStringLiteral("shift"), false),
|
||||
np.get<int>(QStringLiteral("ctrl"), false),
|
||||
np.get<int>(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<bool>(QStringLiteral("state"))) {
|
||||
m_remoteState = np.get<bool>(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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<QJsonArray>(QStringLiteral("sinkList")));
|
||||
|
@ -43,8 +43,6 @@ bool RemoteSystemVolumePlugin::receivePacket(const NetworkPacket &np)
|
|||
Q_EMIT mutedChanged(name, np.get<int>(QStringLiteral("muted")));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void RemoteSystemVolumePlugin::sendVolume(const QString &name, int volume)
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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<bool>(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()
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -19,8 +19,6 @@ public:
|
|||
explicit ScreensaverInhibitPlugin(QObject *parent, const QVariantList &args);
|
||||
~ScreensaverInhibitPlugin() override;
|
||||
|
||||
bool receivePacket(const NetworkPacket &np) override;
|
||||
|
||||
private:
|
||||
QProcess *m_caffeinateProcess;
|
||||
};
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -17,6 +17,4 @@ class ScreensaverInhibitPlugin : public KdeConnectPlugin
|
|||
public:
|
||||
explicit ScreensaverInhibitPlugin(QObject *parent, const QVariantList &args);
|
||||
~ScreensaverInhibitPlugin() override;
|
||||
|
||||
bool receivePacket(const NetworkPacket &np) override;
|
||||
};
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -18,8 +18,6 @@ public:
|
|||
explicit ScreensaverInhibitPlugin(QObject *parent, const QVariantList &args);
|
||||
~ScreensaverInhibitPlugin() override;
|
||||
|
||||
bool receivePacket(const NetworkPacket &np) override;
|
||||
|
||||
private:
|
||||
uint inhibitCookie;
|
||||
};
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -26,8 +26,6 @@ public:
|
|||
explicit SendNotificationsPlugin(QObject *parent, const QVariantList &args);
|
||||
~SendNotificationsPlugin() override;
|
||||
|
||||
bool receivePacket(const NetworkPacket &np) override;
|
||||
|
||||
protected:
|
||||
NotificationsListener *notificationsListener;
|
||||
};
|
||||
|
|
|
@ -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<QString> 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<QString>(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"
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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<QString>(QStringLiteral("name"));
|
||||
|
||||
|
@ -447,7 +447,6 @@ bool SystemvolumePlugin::receivePacket(const NetworkPacket &np)
|
|||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#include "moc_systemvolumeplugin-win.cpp"
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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<bool>(QStringLiteral("isCancel"))) {
|
||||
if (m_currentCallNotification) {
|
||||
m_currentCallNotification->close();
|
||||
}
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
// ignore old style sms packet
|
||||
if (np.get<QString>(QStringLiteral("event")) == QLatin1String("sms")) {
|
||||
return false;
|
||||
if (np.get<QString>(QStringLiteral("event")) != QLatin1String("sms")) {
|
||||
createNotification(np);
|
||||
}
|
||||
|
||||
createNotification(np);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void TelephonyPlugin::sendMutePacket()
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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<QString>(QS("url")));
|
||||
|
@ -76,7 +76,6 @@ bool VirtualMonitorPlugin::receivePacket(const NetworkPacket &received)
|
|||
stop();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
QString VirtualMonitorPlugin::dbusPath() const
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue