Commit bc4d82c1 authored by Jan Grulich's avatar Jan Grulich

plasma-nm Connection Icon not showing correct icon when using a bridge

Summary:
This bug has already been reported in bug 397352

Whenever I'm adding a bridge interface to my system, plasma-nm changes the connection icon to a disconnected state even though an active wired or wireless connection is present. In my case, even though I have an active WiFi connection running in the background, as soon as I add the bridge interface, the connection icon changes from 'network-wireless-100' to 'network-wireless-available'.

This is probably happening because when the bridge becomes active, NetworkManager considers it the 'ActivatingConnection' and we are choosing the icon based on the 'ActivatingConnection' without running any checks on it. If the 'ActivatingConnection' returns an invalid object we move onto the 'PrimaryConnection'. I have made this diff to only consider the ActivatingConnection for the icon if the first Device for that connection is a "Wifi", "Ethernet", "Modem" or "Bluetooth". If it's not then move to the PrimaryConnection.

BUG: 397352

Reviewers: jgrulich, #plasma

Reviewed By: jgrulich

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D18689
parent 5000fc97
......@@ -313,7 +313,10 @@ void ConnectionIcon::setIcons()
}
NetworkManager::ActiveConnection::Ptr connection = NetworkManager::activatingConnection();
if (!connection) {
// Set icon based on the current primary connection if the activating connection is virtual
// since we're not setting icons for virtual connections
if (!connection || (connection && UiUtils::isConnectionTypeVirtual(connection->type()))) {
connection = NetworkManager::primaryConnection();
}
......
......@@ -131,6 +131,19 @@ bool UiUtils::isConnectionTypeSupported(NetworkManager::ConnectionSettings::Conn
return true;
}
bool UiUtils::isConnectionTypeVirtual(NetworkManager::ConnectionSettings::ConnectionType type)
{
if (type == NetworkManager::ConnectionSettings::Bond ||
type == NetworkManager::ConnectionSettings::Bridge ||
type == NetworkManager::ConnectionSettings::Infiniband ||
type == NetworkManager::ConnectionSettings::Team ||
type == NetworkManager::ConnectionSettings::Vlan) {
return true;
}
return false;
}
QString UiUtils::interfaceTypeLabel(const NetworkManager::Device::Type type, const NetworkManager::Device::Ptr iface)
{
QString deviceText;
......
......@@ -71,6 +71,12 @@ public:
*/
static bool isConnectionTypeSupported(NetworkManager::ConnectionSettings::ConnectionType type);
/**
* @return true if the connection is virtual.
* @param type Type of the network connection
*/
static bool isConnectionTypeVirtual(NetworkManager::ConnectionSettings::ConnectionType type);
/**
* @return a human-readable description for the network interface type for use as label
* @param type the type of the network interface
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment