Changeset View
Changeset View
Standalone View
Standalone View
libs/models/networkmodelitem.cpp
Show All 11 Lines | 1 | /* | |||
---|---|---|---|---|---|
12 | This library is distributed in the hope that it will be useful, | 12 | This library is distributed in the hope that it will be useful, | ||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | Lesser General Public License for more details. | 15 | Lesser General Public License for more details. | ||
16 | 16 | | |||
17 | You should have received a copy of the GNU Lesser General Public | 17 | You should have received a copy of the GNU Lesser General Public | ||
18 | License along with this library. If not, see <http://www.gnu.org/licenses/>. | 18 | License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
19 | */ | 19 | */ | ||
20 | | ||||
21 | #include "networkmodelitem.h" | 20 | #include "networkmodelitem.h" | ||
22 | #include "uiutils.h" | 21 | #include "uiutils.h" | ||
23 | 22 | | |||
24 | #include <NetworkManagerQt/AdslDevice> | 23 | #include <NetworkManagerQt/AdslDevice> | ||
25 | #include <NetworkManagerQt/BluetoothDevice> | 24 | #include <NetworkManagerQt/BluetoothDevice> | ||
26 | #include <NetworkManagerQt/BondDevice> | 25 | #include <NetworkManagerQt/BondDevice> | ||
27 | #include <NetworkManagerQt/BridgeDevice> | 26 | #include <NetworkManagerQt/BridgeDevice> | ||
28 | #include <NetworkManagerQt/InfinibandDevice> | 27 | #include <NetworkManagerQt/InfinibandDevice> | ||
▲ Show 20 Lines • Show All 171 Lines • ▼ Show 20 Line(s) | 166 | switch (m_type) { | |||
200 | case NetworkManager::ConnectionSettings::OLPCMesh: | 199 | case NetworkManager::ConnectionSettings::OLPCMesh: | ||
201 | break; | 200 | break; | ||
202 | case NetworkManager::ConnectionSettings::Pppoe: | 201 | case NetworkManager::ConnectionSettings::Pppoe: | ||
203 | return QStringLiteral("network-mobile-100"); | 202 | return QStringLiteral("network-mobile-100"); | ||
204 | break; | 203 | break; | ||
205 | case NetworkManager::ConnectionSettings::Vlan: | 204 | case NetworkManager::ConnectionSettings::Vlan: | ||
206 | break; | 205 | break; | ||
207 | case NetworkManager::ConnectionSettings::Vpn: | 206 | case NetworkManager::ConnectionSettings::Vpn: | ||
207 | case NetworkManager::ConnectionSettings::WireGuard: | ||||
208 | return QStringLiteral("network-vpn"); | 208 | return QStringLiteral("network-vpn"); | ||
209 | break; | 209 | break; | ||
210 | case NetworkManager::ConnectionSettings::Wired: | 210 | case NetworkManager::ConnectionSettings::Wired: | ||
211 | if (connectionState() == NetworkManager::ActiveConnection::Activated) { | 211 | if (connectionState() == NetworkManager::ActiveConnection::Activated) { | ||
212 | return QStringLiteral("network-wired-activated"); | 212 | return QStringLiteral("network-wired-activated"); | ||
213 | } else { | 213 | } else { | ||
214 | return QStringLiteral("network-wired"); | 214 | return QStringLiteral("network-wired"); | ||
215 | } | 215 | } | ||
Show All 31 Lines | |||||
247 | { | 247 | { | ||
248 | if (!m_devicePath.isEmpty() || | 248 | if (!m_devicePath.isEmpty() || | ||
249 | m_type == NetworkManager::ConnectionSettings::Bond || | 249 | m_type == NetworkManager::ConnectionSettings::Bond || | ||
250 | m_type == NetworkManager::ConnectionSettings::Bridge || | 250 | m_type == NetworkManager::ConnectionSettings::Bridge || | ||
251 | m_type == NetworkManager::ConnectionSettings::Vlan || | 251 | m_type == NetworkManager::ConnectionSettings::Vlan || | ||
252 | m_type == NetworkManager::ConnectionSettings::Team || | 252 | m_type == NetworkManager::ConnectionSettings::Team || | ||
253 | ((NetworkManager::status() == NetworkManager::Connected || | 253 | ((NetworkManager::status() == NetworkManager::Connected || | ||
254 | NetworkManager::status() == NetworkManager::ConnectedLinkLocal || | 254 | NetworkManager::status() == NetworkManager::ConnectedLinkLocal || | ||
255 | NetworkManager::status() == NetworkManager::ConnectedSiteOnly) && m_type == NetworkManager::ConnectionSettings::Vpn)) { | 255 | NetworkManager::status() == NetworkManager::ConnectedSiteOnly) && (m_type == NetworkManager::ConnectionSettings::Vpn || m_type == NetworkManager::ConnectionSettings::WireGuard))) { | ||
256 | if (m_connectionPath.isEmpty() && m_type == NetworkManager::ConnectionSettings::Wireless) { | 256 | if (m_connectionPath.isEmpty() && m_type == NetworkManager::ConnectionSettings::Wireless) { | ||
257 | return NetworkModelItem::AvailableAccessPoint; | 257 | return NetworkModelItem::AvailableAccessPoint; | ||
258 | } else { | 258 | } else { | ||
259 | return NetworkModelItem::AvailableConnection; | 259 | return NetworkModelItem::AvailableConnection; | ||
260 | } | 260 | } | ||
261 | } | 261 | } | ||
262 | return NetworkModelItem::UnavailableConnection; | 262 | return NetworkModelItem::UnavailableConnection; | ||
263 | } | 263 | } | ||
▲ Show 20 Lines • Show All 207 Lines • ▼ Show 20 Line(s) | 452 | { | |||
471 | 471 | | |||
472 | if (device && device->ipV6Config().isValid() && m_connectionState == NetworkManager::ActiveConnection::Activated) { | 472 | if (device && device->ipV6Config().isValid() && m_connectionState == NetworkManager::ActiveConnection::Activated) { | ||
473 | if (!device->ipV6Config().addresses().isEmpty()) { | 473 | if (!device->ipV6Config().addresses().isEmpty()) { | ||
474 | QHostAddress addr = device->ipV6Config().addresses().first().ip(); | 474 | QHostAddress addr = device->ipV6Config().addresses().first().ip(); | ||
475 | if (!addr.isNull()) { | 475 | if (!addr.isNull()) { | ||
476 | m_details << i18n("IPv6 Address") << addr.toString(); | 476 | m_details << i18n("IPv6 Address") << addr.toString(); | ||
477 | } | 477 | } | ||
478 | } | 478 | } | ||
479 | } | 479 | } | ||
480 | | ||||
481 | if (m_type == NetworkManager::ConnectionSettings::Wired) { | 480 | if (m_type == NetworkManager::ConnectionSettings::Wired) { | ||
jgrulich: There is already WireGuard device in NMQT with KF5 5.58 which you should be able to use. | |||||
andersonbruce: This was just an extraneous comment so it was removed | |||||
482 | NetworkManager::WiredDevice::Ptr wiredDevice = device.objectCast<NetworkManager::WiredDevice>(); | 481 | NetworkManager::WiredDevice::Ptr wiredDevice = device.objectCast<NetworkManager::WiredDevice>(); | ||
483 | if (wiredDevice) { | 482 | if (wiredDevice) { | ||
484 | if (m_connectionState == NetworkManager::ActiveConnection::Activated) { | 483 | if (m_connectionState == NetworkManager::ActiveConnection::Activated) { | ||
485 | m_details << i18n("Connection speed") << UiUtils::connectionSpeed(wiredDevice->bitRate()); | 484 | m_details << i18n("Connection speed") << UiUtils::connectionSpeed(wiredDevice->bitRate()); | ||
486 | } | 485 | } | ||
487 | m_details << i18n("MAC Address") << wiredDevice->permanentHardwareAddress(); | 486 | m_details << i18n("MAC Address") << wiredDevice->permanentHardwareAddress(); | ||
488 | } | 487 | } | ||
489 | } else if (m_type == NetworkManager::ConnectionSettings::Wireless) { | 488 | } else if (m_type == NetworkManager::ConnectionSettings::Wireless) { | ||
▲ Show 20 Lines • Show All 102 Lines • Show Last 20 Lines |
There is already WireGuard device in NMQT with KF5 5.58 which you should be able to use.