NetworkManagerQt

macvlandevice.cpp
1/*
2 SPDX-FileCopyrightText: 2013 Jan Grulich <jgrulich@redhat.com>
3
4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5*/
6
7#include "device_p.h"
8#include "macvlandevice_p.h"
9#include "manager.h"
10
11NetworkManager::MacVlanDevicePrivate::MacVlanDevicePrivate(const QString &path, MacVlanDevice *q)
12 : DevicePrivate(path, q)
13#ifdef NMQT_STATIC
14 , iface(NetworkManagerPrivate::DBUS_SERVICE, path, QDBusConnection::sessionBus())
15#else
16 , iface(NetworkManagerPrivate::DBUS_SERVICE, path, QDBusConnection::systemBus())
17#endif
18{
19}
20
21NetworkManager::MacVlanDevicePrivate::~MacVlanDevicePrivate()
22{
23}
24
25NetworkManager::MacVlanDevice::MacVlanDevice(const QString &path, QObject *parent)
26 : Device(*new MacVlanDevicePrivate(path, this), parent)
27{
28 Q_D(MacVlanDevice);
29
30 QVariantMap initialProperties = NetworkManagerPrivate::retrieveInitialProperties(d->iface.staticInterfaceName(), path);
31 if (!initialProperties.isEmpty()) {
32 d->propertiesChanged(initialProperties);
33 }
34}
35
36NetworkManager::MacVlanDevice::~MacVlanDevice()
37{
38}
39
44
45QString NetworkManager::MacVlanDevice::mode() const
46{
47 Q_D(const MacVlanDevice);
48 return d->mode;
49}
50
51bool NetworkManager::MacVlanDevice::noPromisc() const
52{
53 Q_D(const MacVlanDevice);
54 return d->noPromisc;
55}
56
57QString NetworkManager::MacVlanDevice::parent() const
58{
59 Q_D(const MacVlanDevice);
60 return d->parent;
61}
62
63void NetworkManager::MacVlanDevicePrivate::propertyChanged(const QString &property, const QVariant &value)
64{
65 Q_Q(MacVlanDevice);
66
67 if (property == QLatin1String("Mode")) {
68 mode = value.toString();
69 Q_EMIT q->modeChanged(mode);
70 } else if (property == QLatin1String("NoPromisc")) {
71 noPromisc = value.toBool();
72 Q_EMIT q->noPromiscChanged(noPromisc);
73 } else if (property == QLatin1String("Parent")) {
74 parent = value.toString();
75 Q_EMIT q->parentChanged(parent);
76 } else {
77 DevicePrivate::propertyChanged(property, value);
78 }
79}
80
81#include "moc_macvlandevice.cpp"
82#include "moc_macvlandevice_p.cpp"
Type
Device type.
Definition device.h:191
@ MacVlan
MacVlan virtual device.
Definition device.h:209
A macvlan device interface.
Type type() const override
Retrieves the interface type.
QString path(const QString &relativePath)
bool toBool() const const
QString toString() const const
Q_D(Todo)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:56:21 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.