diff -Nru plasma-nm-5.21.4/debian/changelog plasma-nm-5.21.4/debian/changelog --- plasma-nm-5.21.4/debian/changelog 2021-04-07 10:10:43.000000000 +0000 +++ plasma-nm-5.21.4/debian/changelog 2021-04-15 13:06:39.000000000 +0000 @@ -1,3 +1,13 @@ +plasma-nm (4:5.21.4-0ubuntu2) hirsute; urgency=medium + + * Cherry-pick upstream bugfix patches: + - upstream_fix-password-filed-focus.patch + https://bugs.kde.org/435430 + - upstream_forward-opeconnect-usergroup.patch + https://bugs.kde.org/435561 + + -- Rik Mills Thu, 15 Apr 2021 14:06:39 +0100 + plasma-nm (4:5.21.4-0ubuntu1) hirsute; urgency=medium * New upstream bugfix and translation release (5.21.4) diff -Nru plasma-nm-5.21.4/debian/patches/series plasma-nm-5.21.4/debian/patches/series --- plasma-nm-5.21.4/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 +++ plasma-nm-5.21.4/debian/patches/series 2021-04-15 13:06:39.000000000 +0000 @@ -0,0 +1,2 @@ +upstream_forward-opeconnect-usergroup.patch +upstream_fix-password-filed-focus.patch diff -Nru plasma-nm-5.21.4/debian/patches/upstream_fix-password-filed-focus.patch plasma-nm-5.21.4/debian/patches/upstream_fix-password-filed-focus.patch --- plasma-nm-5.21.4/debian/patches/upstream_fix-password-filed-focus.patch 1970-01-01 00:00:00.000000000 +0000 +++ plasma-nm-5.21.4/debian/patches/upstream_fix-password-filed-focus.patch 2021-04-15 13:06:39.000000000 +0000 @@ -0,0 +1,308 @@ +From 64dc6234b6980172bb53084c16a0e4e693d6011a Mon Sep 17 00:00:00 2001 +From: Jan Grulich +Date: Thu, 8 Apr 2021 12:18:31 +0200 +Subject: [PATCH] Applet: delay model updates on expanded password field + +This should prevent random jumps between different connections while user +is typing password to the password field + +BUG:435430 +--- + applet/contents/ui/ConnectionItem.qml | 17 ++-- + libs/models/networkmodel.cpp | 113 ++++++++++++++++---------- + libs/models/networkmodel.h | 18 +++- + 3 files changed, 94 insertions(+), 54 deletions(-) + +diff --git a/applet/contents/ui/ConnectionItem.qml b/applet/contents/ui/ConnectionItem.qml +index 1a1f4485..83c55a97 100644 +--- a/applet/contents/ui/ConnectionItem.qml ++++ b/applet/contents/ui/ConnectionItem.qml +@@ -184,21 +184,16 @@ PlasmaExtras.ExpandableListItem { + onAccepted: { + stateChangeButton.trigger() + connectionItem.customExpandedViewContent = detailsComponent +- scanTimer.running = true + } + + onAcceptableInputChanged: { + stateChangeButton.enabled = acceptableInput + } + +- onActiveFocusChanged: { +- scanTimer.running = !activeFocus +- } +- + Component.onCompleted: { + stateChangeButton.enabled = false + passwordField.forceActiveFocus() +- appletProxyModel.dynamicSortFilter = true ++ full.connectionModel.delayModelUpdates = true + } + + Component.onDestruction: { +@@ -248,7 +243,7 @@ PlasmaExtras.ExpandableListItem { + handler.deactivateConnection(ConnectionPath, DevicePath) + } + } else if (predictableWirelessPassword) { +- appletProxyModel.dynamicSortFilter = false ++ full.connectionModel.delayModelUpdates = true + connectionItem.customExpandedViewContent = passwordDialogComponent + connectionItem.expand() + } +@@ -307,9 +302,13 @@ PlasmaExtras.ExpandableListItem { + } + + // Re-activate the default button if the password field is hidden without +- // sending a password, and start the scan timer ++ // sending a password + onItemCollapsed: { + stateChangeButton.enabled = true; +- scanTimer.running = true; ++ full.connectionModel.delayModelUpdates = false; ++ } ++ ++ Component.onDestruction: { ++ full.connectionModel.delayModelUpdates = false; + } + } +diff --git a/libs/models/networkmodel.cpp b/libs/models/networkmodel.cpp +index 8b343947..e3b7fa5c 100644 +--- a/libs/models/networkmodel.cpp ++++ b/libs/models/networkmodel.cpp +@@ -158,6 +158,26 @@ QHash NetworkModel::roleNames() const + return roles; + } + ++void NetworkModel::setDelayModelUpdates(bool delayUpdates) ++{ ++ m_delayModelUpdates = delayUpdates; ++ ++ // Process queue ++ if (!delayUpdates) { ++ while (!m_updateQueue.isEmpty()) { ++ QPair update = m_updateQueue.dequeue(); ++ if (update.first == ItemAdded) { ++ insertItem(update.second); ++ } else if (update.first == ItemRemoved) { ++ removeItem(update.second); ++ } else if (update.first == ItemPropertyChanged) { ++ updateItem(update.second); ++ } ++ } ++ } ++} ++ ++ + void NetworkModel::initialize() + { + // Initialize existing connections +@@ -351,14 +371,8 @@ void NetworkModel::addAvailableConnection(const QString &connection, const Netwo + // Find an accesspoint which could be removed, because it will be merged with a connection + for (NetworkModelItem *secondItem : m_list.returnItems(NetworkItemsList::Ssid, item->ssid())) { + if (secondItem->itemType() == NetworkModelItem::AvailableAccessPoint && secondItem->devicePath() == item->devicePath()) { +- const int row = m_list.indexOf(secondItem); ++ removeItem(secondItem); + qCDebug(PLASMA_NM) << "Access point " << secondItem->name() << ": merged to " << item->name() << " connection"; +- if (row >= 0) { +- beginRemoveRows(QModelIndex(), row, row); +- m_list.removeItem(secondItem); +- secondItem->deleteLater(); +- endRemoveRows(); +- } + break; + } + } +@@ -419,10 +433,7 @@ void NetworkModel::addConnection(const NetworkManager::Connection::Ptr &connecti + + item->invalidateDetails(); + +- const int index = m_list.count(); +- beginInsertRows(QModelIndex(), index, index); +- m_list.insertItem(item); +- endInsertRows(); ++ insertItem(item); + qCDebug(PLASMA_NM) << "New connection " << item->name() << " added"; + } + +@@ -513,10 +524,7 @@ void NetworkModel::addWirelessNetwork(const NetworkManager::WirelessNetwork::Ptr + item->setSecurityType(securityType); + item->invalidateDetails(); + +- const int index = m_list.count(); +- beginInsertRows(QModelIndex(), index, index); +- m_list.insertItem(item); +- endInsertRows(); ++ insertItem(item); + qCDebug(PLASMA_NM) << "New wireless network " << item->name() << " added"; + } + +@@ -539,10 +547,7 @@ void NetworkModel::checkAndCreateDuplicate(const QString &connection, const QStr + NetworkModelItem *duplicatedItem = new NetworkModelItem(originalItem); + duplicatedItem->invalidateDetails(); + +- const int index = m_list.count(); +- beginInsertRows(QModelIndex(), index, index); +- m_list.insertItem(duplicatedItem); +- endInsertRows(); ++ insertItem(duplicatedItem); + } + } + +@@ -563,8 +568,46 @@ void NetworkModel::setDeviceStatisticsRefreshRateMs(const QString &devicePath, u + } + } + +-void NetworkModel::updateItem(NetworkModelItem*item) ++void NetworkModel::insertItem(NetworkModelItem *item) + { ++ if (m_delayModelUpdates) { ++ m_updateQueue.enqueue(QPair(NetworkModel::ItemAdded, item)); ++ return; ++ } ++ ++ const int index = m_list.count(); ++ beginInsertRows(QModelIndex(), index, index); ++ m_list.insertItem(item); ++ endInsertRows(); ++} ++ ++void NetworkModel::removeItem(NetworkModelItem *item) ++{ ++ if (m_delayModelUpdates) { ++ m_updateQueue.enqueue(QPair(NetworkModel::ItemRemoved, item)); ++ return; ++ } ++ ++ const int row = m_list.indexOf(item); ++ if (row >= 0) { ++ beginRemoveRows(QModelIndex(), row, row); ++ m_list.removeItem(item); ++ item->deleteLater(); ++ endRemoveRows(); ++ } ++} ++ ++void NetworkModel::updateItem(NetworkModelItem *item) ++{ ++ const QVector changedRoles = item->changedRoles(); ++ // Check only primary roles which can change item order ++ if (m_delayModelUpdates && (changedRoles.contains(ConnectionStateRole) || ++ changedRoles.contains(ItemTypeRole) || ++ changedRoles.contains(SignalRole))) { ++ m_updateQueue.enqueue(QPair(NetworkModel::ItemPropertyChanged, item)); ++ return; ++ } ++ + const int row = m_list.indexOf(item); + + if (row >= 0) { +@@ -709,14 +752,8 @@ void NetworkModel::availableConnectionDisappeared(const QString &connection) + } + + if (item->duplicate()) { +- const int row = m_list.indexOf(item); +- if (row >= 0) { +- qCDebug(PLASMA_NM) << "Duplicate item " << item->name() << " removed completely"; +- beginRemoveRows(QModelIndex(), row, row); +- m_list.removeItem(item); +- item->deleteLater(); +- endRemoveRows(); +- } ++ removeItem(item); ++ qCDebug(PLASMA_NM) << "Duplicate item " << item->name() << " removed completely"; + } else { + updateItem(item); + } +@@ -767,14 +804,8 @@ void NetworkModel::connectionRemoved(const QString &connection) + } + + if (remove) { +- const int row = m_list.indexOf(item); +- if (row >= 0) { +- qCDebug(PLASMA_NM) << "Item " << item->name() << " removed completely"; +- beginRemoveRows(QModelIndex(), row, row); +- m_list.removeItem(item); +- item->deleteLater(); +- endRemoveRows(); +- } ++ removeItem(item); ++ qCDebug(PLASMA_NM) << "Item " << item->name() << " removed completely"; + } + remove = false; + } +@@ -1004,14 +1035,8 @@ void NetworkModel::wirelessNetworkDisappeared(const QString &ssid) + for (NetworkModelItem *item : m_list.returnItems(NetworkItemsList::Ssid, ssid, device->uni())) { + // Remove the entire item, because it's only AP or it's a duplicated available connection + if (item->itemType() == NetworkModelItem::AvailableAccessPoint || item->duplicate()) { +- const int row = m_list.indexOf(item); +- if (row >= 0) { +- qCDebug(PLASMA_NM) << "Wireless network " << item->name() << " removed completely"; +- beginRemoveRows(QModelIndex(), row, row); +- m_list.removeItem(item); +- item->deleteLater(); +- endRemoveRows(); +- } ++ removeItem(item); ++ qCDebug(PLASMA_NM) << "Wireless network " << item->name() << " removed completely"; + // Remove only AP and device from the item and leave it as an unavailable connection + } else { + if (item->mode() == NetworkManager::WirelessSetting::Infrastructure) { +diff --git a/libs/models/networkmodel.h b/libs/models/networkmodel.h +index ed16597f..ebe6db52 100644 +--- a/libs/models/networkmodel.h ++++ b/libs/models/networkmodel.h +@@ -38,6 +38,10 @@ class Q_DECL_EXPORT NetworkModel : public QAbstractListModel + { + Q_OBJECT + public: ++ // HACK: Delay model updates to prevent jumping password entry in the applet ++ // BUG: 435430 ++ Q_PROPERTY(bool delayModelUpdates WRITE setDelayModelUpdates) ++ + explicit NetworkModel(QObject *parent = nullptr); + ~NetworkModel() override; + +@@ -73,9 +77,16 @@ public: + }; + Q_ENUMS(ItemRole) + ++ enum ModelChangeType { ++ ItemAdded, ++ ItemRemoved, ++ ItemPropertyChanged ++ }; ++ + int rowCount(const QModelIndex &parent) const override; + QVariant data(const QModelIndex &index, int role) const override; + QHash roleNames() const override; ++ void setDelayModelUpdates(bool delayUpdates); + + public Q_SLOTS: + void onItemUpdated(); +@@ -110,7 +121,9 @@ private Q_SLOTS: + + void initialize(); + private: ++ bool m_delayModelUpdates = false; + NetworkItemsList m_list; ++ QQueue > m_updateQueue; + + void addActiveConnection(const NetworkManager::ActiveConnection::Ptr &activeConnection); + void addAvailableConnection(const QString &connection, const NetworkManager::Device::Ptr &device); +@@ -123,9 +136,12 @@ private: + void initializeSignals(const NetworkManager::Connection::Ptr &connection); + void initializeSignals(const NetworkManager::Device::Ptr &device); + void initializeSignals(const NetworkManager::WirelessNetwork::Ptr &network); +- void updateItem(NetworkModelItem *item); + void updateFromWirelessNetwork(NetworkModelItem *item, const NetworkManager::WirelessNetwork::Ptr &network, const NetworkManager::WirelessDevice::Ptr &device); + ++ void insertItem(NetworkModelItem *item); ++ void removeItem(NetworkModelItem *item); ++ void updateItem(NetworkModelItem *item); ++ + NetworkManager::WirelessSecurityType alternativeWirelessSecurity(const NetworkManager::WirelessSecurityType type); + }; + +-- +GitLab + diff -Nru plasma-nm-5.21.4/debian/patches/upstream_forward-opeconnect-usergroup.patch plasma-nm-5.21.4/debian/patches/upstream_forward-opeconnect-usergroup.patch --- plasma-nm-5.21.4/debian/patches/upstream_forward-opeconnect-usergroup.patch 1970-01-01 00:00:00.000000000 +0000 +++ plasma-nm-5.21.4/debian/patches/upstream_forward-opeconnect-usergroup.patch 2021-04-15 13:06:39.000000000 +0000 @@ -0,0 +1,38 @@ +From aa872eca0575af615ca918acbb1c8e743d1074d5 Mon Sep 17 00:00:00 2001 +From: Aaron Barany +Date: Wed, 14 Apr 2021 11:57:19 -0700 +Subject: [PATCH] Forward opeconnect usergroup + +Forward the usergroup for openconnect (provided by the URL path) to the +NetworkManager service by incorporating it in NM_OPENCONNECT_KEY_GATEWAY. +This ensures that the VPN session in the NetworkManager service uses the +same usergroup as provided with the gateway when the initial connection +was made through the UI. + +BUG: 435561 +--- + vpn/openconnect/openconnectauth.cpp | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/vpn/openconnect/openconnectauth.cpp b/vpn/openconnect/openconnectauth.cpp +index 323943a8..c514d11d 100644 +--- a/vpn/openconnect/openconnectauth.cpp ++++ b/vpn/openconnect/openconnectauth.cpp +@@ -383,7 +383,13 @@ QVariantMap OpenconnectAuthWidget::setting() const + secrets.unite(d->secrets); + QString host(openconnect_get_hostname(d->vpninfo)); + const QString port = QString::number(openconnect_get_port(d->vpninfo)); +- secrets.insert(QLatin1String(NM_OPENCONNECT_KEY_GATEWAY), host + ':' + port); ++ QString gateway = host + ':' + port; ++ const char* urlpath = openconnect_get_urlpath(d->vpninfo); ++ if (urlpath) { ++ gateway += '/'; ++ gateway += urlpath; ++ } ++ secrets.insert(QLatin1String(NM_OPENCONNECT_KEY_GATEWAY), gateway); + + secrets.insert(QLatin1String(NM_OPENCONNECT_KEY_COOKIE), QLatin1String(openconnect_get_cookie(d->vpninfo))); + openconnect_clear_cookie(d->vpninfo); +-- +GitLab +