NetworkManagerQt

teamdevice.cpp
1 /*
2  SPDX-FileCopyrightText: 2013 Lukáš Tinkl <[email protected]>
3  SPDX-FileCopyrightText: 2014 Jan Grulich <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
6 */
7 
8 #include "device_p.h"
9 #include "manager.h"
10 #include "manager_p.h"
11 #include "teamdevice_p.h"
12 
13 NetworkManager::TeamDevicePrivate::TeamDevicePrivate(const QString &path, TeamDevice *q)
14  : DevicePrivate(path, q)
15 #ifdef NMQT_STATIC
16  , iface(NetworkManagerPrivate::DBUS_SERVICE, path, QDBusConnection::sessionBus())
17 #else
18  , iface(NetworkManagerPrivate::DBUS_SERVICE, path, QDBusConnection::systemBus())
19 #endif
20 {
21 }
22 
23 NetworkManager::TeamDevicePrivate::~TeamDevicePrivate()
24 {
25 }
26 
27 NetworkManager::TeamDevice::TeamDevice(const QString &path, QObject *parent)
28  : Device(*new TeamDevicePrivate(path, this), parent)
29 {
30  Q_D(TeamDevice);
31 
32  QVariantMap initialProperties = NetworkManagerPrivate::retrieveInitialProperties(d->iface.staticInterfaceName(), path);
33  if (!initialProperties.isEmpty()) {
34  d->propertiesChanged(initialProperties);
35  }
36 }
37 
38 NetworkManager::TeamDevice::~TeamDevice()
39 {
40 }
41 
43 {
45 }
46 
47 bool NetworkManager::TeamDevice::carrier() const
48 {
49  Q_D(const TeamDevice);
50 
51  return d->carrier;
52 }
53 
54 QString NetworkManager::TeamDevice::hwAddress() const
55 {
56  Q_D(const TeamDevice);
57 
58  return d->hwAddress;
59 }
60 
61 QStringList NetworkManager::TeamDevice::slaves() const
62 {
63  Q_D(const TeamDevice);
64  return d->slaves;
65 }
66 
67 QString NetworkManager::TeamDevice::config() const
68 {
69  Q_D(const TeamDevice);
70  return d->config;
71 }
72 
73 void NetworkManager::TeamDevicePrivate::propertyChanged(const QString &property, const QVariant &value)
74 {
75  Q_Q(TeamDevice);
76 
77  if (property == QLatin1String("Carrier")) {
78  carrier = value.toBool();
79  Q_EMIT q->carrierChanged(carrier);
80  } else if (property == QLatin1String("HwAddress")) {
81  hwAddress = value.toString();
82  Q_EMIT q->hwAddressChanged(hwAddress);
83  } else if (property == QLatin1String("Slaves")) {
85  const QList<QDBusObjectPath> opList = qdbus_cast<QList<QDBusObjectPath>>(value);
86  for (const QDBusObjectPath &op : opList) {
87  list << op.path();
88  }
89  slaves = list;
90  Q_EMIT q->slavesChanged(slaves);
91  } else if (property == QLatin1String("Config")) {
92  config = value.toString();
93  Q_EMIT q->configChanged(config);
94  } else {
95  DevicePrivate::propertyChanged(property, value);
96  }
97 }
98 
99 #include "moc_teamdevice.cpp"
100 #include "moc_teamdevice_p.cpp"
KIOFILEWIDGETS_EXPORT QStringList list(const QString &fileClass)
A team device interface.
Definition: teamdevice.h:20
Type type() const override
Retrieves the interface type.
Definition: teamdevice.cpp:42
Type
Device type.
Definition: device.h:177
KSharedConfigPtr config()
bool toBool() const const
QString path(const QString &relativePath)
@ Team
Team master device.
Definition: device.h:193
Q_D(Todo)
QString toString() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Thu Sep 28 2023 04:03:49 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.