File indexing completed on 2025-03-23 12:49:53
0001 /* 0002 SPDX-FileCopyrightText: 2013 Lukáš Tinkl <ltinkl@redhat.com> 0003 SPDX-FileCopyrightText: 2014 Jan Grulich <jgrulich@redhat.com> 0004 0005 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0006 */ 0007 0008 #include "manager.h" 0009 #include "manager_p.h" 0010 #include "vethdevice_p.h" 0011 0012 NetworkManager::VethDevicePrivate::VethDevicePrivate(const QString &path, VethDevice *q) 0013 : DevicePrivate(path, q) 0014 #ifdef NMQT_STATIC 0015 , iface(NetworkManagerPrivate::DBUS_SERVICE, path, QDBusConnection::sessionBus()) 0016 #else 0017 , iface(NetworkManagerPrivate::DBUS_SERVICE, path, QDBusConnection::systemBus()) 0018 #endif 0019 { 0020 } 0021 0022 NetworkManager::VethDevicePrivate::~VethDevicePrivate() 0023 { 0024 } 0025 0026 NetworkManager::VethDevice::VethDevice(const QString &path, QObject *parent) 0027 : Device(*new VethDevicePrivate(path, this), parent) 0028 { 0029 Q_D(VethDevice); 0030 0031 QVariantMap initialProperties = NetworkManagerPrivate::retrieveInitialProperties(d->iface.staticInterfaceName(), path); 0032 if (!initialProperties.isEmpty()) { 0033 d->propertiesChanged(initialProperties); 0034 } 0035 } 0036 0037 NetworkManager::VethDevice::~VethDevice() 0038 { 0039 } 0040 0041 NetworkManager::Device::Type NetworkManager::VethDevice::type() const 0042 { 0043 return NetworkManager::Device::Veth; 0044 } 0045 0046 QString NetworkManager::VethDevice::peer() const 0047 { 0048 Q_D(const VethDevice); 0049 return d->peer; 0050 } 0051 0052 void NetworkManager::VethDevicePrivate::propertyChanged(const QString &property, const QVariant &value) 0053 { 0054 Q_Q(VethDevice); 0055 0056 if (property == QLatin1String("Peer")) { 0057 peer = value.toString(); 0058 Q_EMIT q->peerChanged(peer); 0059 } else { 0060 DevicePrivate::propertyChanged(property, value); 0061 } 0062 } 0063 0064 #include "moc_vethdevice.cpp" 0065 #include "moc_vethdevice_p.cpp"