<table><tr><td style="">jgrulich added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D18689">View Revision</a></tr></table><br /><div><div><p>That sounds like a bug in NetworkManager, because ActivatingConnection should be the one which will become PrimaryConnection, that's what the documentation says, that's the reason why we use it. If it's a NM bug, we still need a workaround.</p>
<p>In your code, you can simplify it with:</p>
<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">if (connection && !UiUtils::isConnectionTypeSupported(connection->type()) {
connection = NetworkManager::primaryConnection();
}</pre></div>
<p>Problem is that isConnectionTypeSupported() will return true if you have virtual connections enabled. We should maybe add additional method to to UiUtils to identify virtual connections (this new one can be then used inside isConnectionTypeSupported())</p>
<p>I would suggest.</p>
<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">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;
}</pre></div>
<p>With this you can simply use</p>
<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">if (connection && isConnectionTypeVirtual(connection->type()) {
connection = NetworkManager::primaryConnection;
}</pre></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R116 Plasma Network Management Applet</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D18689">https://phabricator.kde.org/D18689</a></div></div><br /><div><strong>To: </strong>rthomas, jgrulich, Plasma<br /><strong>Cc: </strong>plasma-devel, jraleigh, GB_2, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart<br /></div>