Changeset View
Changeset View
Standalone View
Standalone View
libs/declarative/connectionicon.cpp
Show First 20 Lines • Show All 276 Lines • ▼ Show 20 Line(s) | 275 | for (const NetworkManager::ActiveConnection::Ptr &activeConnection : NetworkManager::activeConnections()) { | |||
---|---|---|---|---|---|
277 | if (activeConnection->vpn()) { | 277 | if (activeConnection->vpn()) { | ||
278 | vpnConnection = activeConnection.objectCast<NetworkManager::VpnConnection>(); | 278 | vpnConnection = activeConnection.objectCast<NetworkManager::VpnConnection>(); | ||
279 | } | 279 | } | ||
280 | 280 | | |||
281 | if (!vpnConnection) { | 281 | if (!vpnConnection) { | ||
282 | if (activeConnection->state() == NetworkManager::ActiveConnection::Activating && UiUtils::isConnectionTypeSupported(activeConnection->type())) { | 282 | if (activeConnection->state() == NetworkManager::ActiveConnection::Activating && UiUtils::isConnectionTypeSupported(activeConnection->type())) { | ||
283 | connecting = true; | 283 | connecting = true; | ||
284 | } | 284 | } | ||
285 | if (activeConnection->type() == NetworkManager::ConnectionSettings::ConnectionType::WireGuard) { | ||||
286 | vpn = true; | ||||
287 | } | ||||
285 | } else { | 288 | } else { | ||
286 | if (vpnConnection->state() == NetworkManager::VpnConnection::Activated) { | 289 | if (vpnConnection->state() == NetworkManager::VpnConnection::Activated) { | ||
287 | vpn = true; | 290 | vpn = true; | ||
288 | } else if (vpnConnection->state() == NetworkManager::VpnConnection::Prepare || | 291 | } else if (vpnConnection->state() == NetworkManager::VpnConnection::Prepare || | ||
289 | vpnConnection->state() == NetworkManager::VpnConnection::NeedAuth || | 292 | vpnConnection->state() == NetworkManager::VpnConnection::NeedAuth || | ||
290 | vpnConnection->state() == NetworkManager::VpnConnection::Connecting || | 293 | vpnConnection->state() == NetworkManager::VpnConnection::Connecting || | ||
291 | vpnConnection->state() == NetworkManager::VpnConnection::GettingIpConfig) { | 294 | vpnConnection->state() == NetworkManager::VpnConnection::GettingIpConfig) { | ||
292 | connecting = true; | 295 | connecting = true; | ||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Line(s) | 338 | if (connection && connection->type() <= NetworkManager::ConnectionSettings::Cdma) { | |||
336 | connection = activeConnection; | 339 | connection = activeConnection; | ||
337 | } | 340 | } | ||
338 | } else if (type == NetworkManager::ConnectionSettings::Gsm) { | 341 | } else if (type == NetworkManager::ConnectionSettings::Gsm) { | ||
339 | if (connection && connection->type() <= NetworkManager::ConnectionSettings::Gsm) { | 342 | if (connection && connection->type() <= NetworkManager::ConnectionSettings::Gsm) { | ||
340 | connection = activeConnection; | 343 | connection = activeConnection; | ||
341 | } | 344 | } | ||
342 | } else if (type == NetworkManager::ConnectionSettings::Vpn) { | 345 | } else if (type == NetworkManager::ConnectionSettings::Vpn) { | ||
343 | connection = activeConnection; | 346 | connection = activeConnection; | ||
347 | } else if (type == NetworkManager::ConnectionSettings::WireGuard) { | ||||
348 | connection = activeConnection; | ||||
344 | } else if (type == NetworkManager::ConnectionSettings::Wired) { | 349 | } else if (type == NetworkManager::ConnectionSettings::Wired) { | ||
345 | if (connection && connection->type() != NetworkManager::ConnectionSettings::Vpn) { | 350 | if (connection && (connection->type() != NetworkManager::ConnectionSettings::Vpn | ||
351 | || connection->type() != NetworkManager::ConnectionSettings::WireGuard)) { | ||||
346 | connection = activeConnection; | 352 | connection = activeConnection; | ||
347 | } | 353 | } | ||
348 | } else if (type == NetworkManager::ConnectionSettings::Wireless) { | 354 | } else if (type == NetworkManager::ConnectionSettings::Wireless) { | ||
349 | if (connection && (connection->type() != NetworkManager::ConnectionSettings::Vpn && | 355 | if (connection && (connection->type() != NetworkManager::ConnectionSettings::Vpn && | ||
350 | (connection->type() != NetworkManager::ConnectionSettings::Wired))) { | 356 | (connection->type() != NetworkManager::ConnectionSettings::Wired))) { | ||
351 | connection = activeConnection; | 357 | connection = activeConnection; | ||
352 | } | 358 | } | ||
353 | } | 359 | } | ||
Show All 35 Lines | 394 | #else | |||
389 | setConnectionIcon("network-mobile-0"); | 395 | setConnectionIcon("network-mobile-0"); | ||
390 | setConnectionTooltipIcon("phone"); | 396 | setConnectionTooltipIcon("phone"); | ||
391 | #endif | 397 | #endif | ||
392 | } else { | 398 | } else { | ||
393 | setConnectionIcon("network-bluetooth-activated"); | 399 | setConnectionIcon("network-bluetooth-activated"); | ||
394 | setConnectionTooltipIcon("preferences-system-bluetooth"); | 400 | setConnectionTooltipIcon("preferences-system-bluetooth"); | ||
395 | } | 401 | } | ||
396 | } | 402 | } | ||
403 | } else if (type == 29) { // TODO change to WireGuard enum value once it is added | ||||
jgrulich: Do you want me to add this to NMQT? | |||||
Yes, please. This is part of the device type enum we discussed earlier where not all of the values defined in NM have been folded into NMQT yet. andersonbruce: Yes, please. This is part of the device type enum we discussed earlier where not all of the… | |||||
jgrulich: You can now use NetworkManager::Device::WireGuard. | |||||
There is still a discrepancy between the enum defined by NetworkManager and the one defined by NMQT. NetworkManager is returning a value of 29 but NetworkManager::Device::WireGuard has a value of 30. andersonbruce: There is still a discrepancy between the enum defined by NetworkManager and the one defined by… | |||||
This is correct, we are unfortunately +1 because back then there was a device which we add support for and later during the NM development cycle it was renamed and I couldn't just simply rename or remove an enum, because it would break ABI. You can see in NMQT that there is code converting NM device type to NMQT device type so we this coverd. jgrulich: This is correct, we are unfortunately +1 because back then there was a device which we add… | |||||
404 | // WireGuard is a VPN but is not implemented | ||||
405 | // in NetworkManager as a VPN, so we don't want to | ||||
406 | // do anything just because it has a device | ||||
407 | // associated with it. | ||||
397 | } else { | 408 | } else { | ||
398 | // Ignore other devices (bond/bridge/team etc.) | 409 | // Ignore other devices (bond/bridge/team etc.) | ||
399 | setDisconnectedIcon(); | 410 | setDisconnectedIcon(); | ||
400 | } | 411 | } | ||
401 | } | 412 | } | ||
402 | } else { | 413 | } else { | ||
403 | setDisconnectedIcon(); | 414 | setDisconnectedIcon(); | ||
404 | } | 415 | } | ||
▲ Show 20 Lines • Show All 236 Lines • Show Last 20 Lines |
Do you want me to add this to NMQT?