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