QObject parent semantic in Device
This commit is contained in:
parent
d9018cb9f8
commit
b0c9f48efc
3 changed files with 10 additions and 8 deletions
|
@ -99,7 +99,7 @@ Daemon::Daemon(QObject *parent) : QObject(parent)
|
|||
const KConfigGroup& known = config->group("trusted_devices");
|
||||
const QStringList& list = known.groupList();
|
||||
Q_FOREACH(const QString& id, list) {
|
||||
Device* device = new Device(id);
|
||||
Device* device = new Device(this, id);
|
||||
connect(device, SIGNAL(reachableStatusChanged()),
|
||||
this, SLOT(onDeviceReachableStatusChanged()));
|
||||
mDevices[id] = device;
|
||||
|
@ -166,7 +166,7 @@ void Daemon::onNewDeviceLink(const NetworkPackage& identityPackage, DeviceLink*
|
|||
} else {
|
||||
//kDebug(kdeconnect_kded()) << "It is a new device";
|
||||
|
||||
Device* device = new Device(identityPackage, dl);
|
||||
Device* device = new Device(this, identityPackage, dl);
|
||||
connect(device, SIGNAL(reachableStatusChanged()), this, SLOT(onDeviceReachableStatusChanged()));
|
||||
mDevices[id] = device;
|
||||
|
||||
|
|
|
@ -21,8 +21,9 @@
|
|||
#include <QDBusConnection>
|
||||
#include <QFile>
|
||||
|
||||
Device::Device(const QString& id)
|
||||
: m_deviceId(id)
|
||||
Device::Device(QObject* parent, const QString& id)
|
||||
: QObject(parent)
|
||||
, m_deviceId(id)
|
||||
, m_pairStatus(Device::Paired)
|
||||
, m_protocolVersion(NetworkPackage::ProtocolVersion) //We don't know it yet
|
||||
{
|
||||
|
@ -45,8 +46,9 @@ Device::Device(const QString& id)
|
|||
QDBusConnection::sessionBus().registerObject(dbusPath(), this, QDBusConnection::ExportScriptableContents | QDBusConnection::ExportAdaptors);
|
||||
}
|
||||
|
||||
Device::Device(const NetworkPackage& identityPackage, DeviceLink* dl)
|
||||
: m_deviceId(identityPackage.get<QString>("deviceId"))
|
||||
Device::Device(QObject* parent, const NetworkPackage& identityPackage, DeviceLink* dl)
|
||||
: QObject(parent)
|
||||
, m_deviceId(identityPackage.get<QString>("deviceId"))
|
||||
, m_deviceName(identityPackage.get<QString>("deviceName"))
|
||||
, m_deviceType(str2type(identityPackage.get<QString>("deviceType")))
|
||||
, m_pairStatus(Device::NotPaired)
|
||||
|
|
|
@ -64,14 +64,14 @@ public:
|
|||
*
|
||||
* We already know it but we need to wait for an incoming DeviceLink to communicate
|
||||
*/
|
||||
Device(const QString& id);
|
||||
Device(QObject* parent, const QString& id);
|
||||
|
||||
/**
|
||||
* Device known via an incoming connection sent to us via a devicelink.
|
||||
*
|
||||
* We know everything but we don't trust it yet
|
||||
*/
|
||||
Device(const NetworkPackage& np, DeviceLink* dl);
|
||||
Device(QObject* parent, const NetworkPackage& np, DeviceLink* dl);
|
||||
|
||||
virtual ~Device();
|
||||
|
||||
|
|
Loading…
Reference in a new issue