| 1 | /* |
| 2 | SPDX-FileCopyrightText: 2012-2013 Jan Grulich <jgrulich@redhat.com> |
| 3 | SPDX-FileCopyrightText: 2013 Daniel Nicoletti <dantti12@gmail.com> |
| 4 | |
| 5 | SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
| 6 | */ |
| 7 | |
| 8 | #include "adsldevice_p.h" |
| 9 | |
| 10 | NetworkManager::AdslDevicePrivate::AdslDevicePrivate(const QString &path, AdslDevice *q) |
| 11 | : DevicePrivate(path, q) |
| 12 | #ifdef NMQT_STATIC |
| 13 | , iface(NetworkManagerPrivate::DBUS_SERVICE, path, QDBusConnection::sessionBus()) |
| 14 | #else |
| 15 | , iface(NetworkManagerPrivate::DBUS_SERVICE, path, QDBusConnection::systemBus()) |
| 16 | #endif |
| 17 | , carrier(false) |
| 18 | { |
| 19 | } |
| 20 | |
| 21 | NetworkManager::AdslDevice::~AdslDevice() |
| 22 | { |
| 23 | } |
| 24 | |
| 25 | NetworkManager::AdslDevice::AdslDevice(const QString &path, QObject *parent) |
| 26 | : Device(*new AdslDevicePrivate(path, this), parent) |
| 27 | { |
| 28 | Q_D(AdslDevice); |
| 29 | |
| 30 | QVariantMap initialProperties = NetworkManagerPrivate::retrieveInitialProperties(interfaceName: d->iface.staticInterfaceName(), path); |
| 31 | if (!initialProperties.isEmpty()) { |
| 32 | d->propertiesChanged(properties: initialProperties); |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | NetworkManager::AdslDevicePrivate::~AdslDevicePrivate() |
| 37 | { |
| 38 | } |
| 39 | |
| 40 | NetworkManager::Device::Type NetworkManager::AdslDevice::type() const |
| 41 | { |
| 42 | return NetworkManager::Device::Adsl; |
| 43 | } |
| 44 | |
| 45 | bool NetworkManager::AdslDevice::carrier() const |
| 46 | { |
| 47 | Q_D(const AdslDevice); |
| 48 | |
| 49 | return d->carrier; |
| 50 | } |
| 51 | |
| 52 | void NetworkManager::AdslDevicePrivate::propertyChanged(const QString &property, const QVariant &value) |
| 53 | { |
| 54 | Q_Q(AdslDevice); |
| 55 | |
| 56 | if (property == QLatin1String("Carrier" )) { |
| 57 | carrier = value.toBool(); |
| 58 | Q_EMIT q->carrierChanged(plugged: carrier); |
| 59 | } else { |
| 60 | DevicePrivate::propertyChanged(property, value); |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | #include "moc_adsldevice.cpp" |
| 65 | #include "moc_adsldevice_p.cpp" |
| 66 | |