Add a generic "something changed" signal

This commit is contained in:
Albert Vaca 2018-05-29 20:51:35 +02:00
parent f09927a1f0
commit bf879a8579
2 changed files with 5 additions and 0 deletions

View file

@ -125,6 +125,7 @@ void Daemon::removeDevice(Device* device)
d->m_devices.remove(device->id());
device->deleteLater();
Q_EMIT deviceRemoved(device->id());
Q_EMIT deviceListChanged();
}
void Daemon::cleanDevices()
@ -194,6 +195,7 @@ void Daemon::onNewDeviceLink(const NetworkPacket& identityPacket, DeviceLink* dl
device->addLink(identityPacket, dl);
if (!wasReachable) {
Q_EMIT deviceVisibilityChanged(id, true);
Q_EMIT deviceListChanged();
}
} else {
qCDebug(KDECONNECT_CORE) << "It is a new device" << identityPacket.get<QString>(QStringLiteral("deviceName"));
@ -219,6 +221,7 @@ void Daemon::onDeviceStatusChanged()
removeDevice(device);
} else {
Q_EMIT deviceVisibilityChanged(device->id(), device->isReachable());
Q_EMIT deviceListChanged();
}
}
@ -277,6 +280,7 @@ void Daemon::addDevice(Device* device)
d->m_devices[id] = device;
Q_EMIT deviceAdded(id);
Q_EMIT deviceListChanged();
}
QStringList Daemon::pairingRequests() const

View file

@ -81,6 +81,7 @@ Q_SIGNALS:
Q_SCRIPTABLE void deviceAdded(const QString& id);
Q_SCRIPTABLE void deviceRemoved(const QString& id); //Note that paired devices will never be removed
Q_SCRIPTABLE void deviceVisibilityChanged(const QString& id, bool isVisible);
Q_SCRIPTABLE void deviceListChanged(); //Emitted when any of deviceAdded, deviceRemoved or deviceVisibilityChanged is emitted
Q_SCRIPTABLE void announcedNameChanged(const QString& announcedName);
Q_SCRIPTABLE void pairingRequestsChanged();