Changeset View
Changeset View
Standalone View
Standalone View
libs/models/networkmodel.cpp
Show First 20 Lines • Show All 275 Lines • ▼ Show 20 Line(s) | 267 | { | |||
---|---|---|---|---|---|
276 | } | 276 | } | ||
277 | 277 | | |||
278 | // Check whether we have a base connection | 278 | // Check whether we have a base connection | ||
279 | if (!m_list.contains(NetworkItemsList::Uuid, connection->uuid())) { | 279 | if (!m_list.contains(NetworkItemsList::Uuid, connection->uuid())) { | ||
280 | // Active connection appeared before a base connection, so we have to add its base connection first | 280 | // Active connection appeared before a base connection, so we have to add its base connection first | ||
281 | addConnection(connection); | 281 | addConnection(connection); | ||
282 | } | 282 | } | ||
283 | 283 | | |||
284 | beginResetModel(); | | |||
285 | for (NetworkModelItem *item : m_list.returnItems(NetworkItemsList::NetworkItemsList::Uuid, connection->uuid())) { | 284 | for (NetworkModelItem *item : m_list.returnItems(NetworkItemsList::NetworkItemsList::Uuid, connection->uuid())) { | ||
286 | if (((device && device->uni() == item->devicePath()) || item->devicePath().isEmpty()) || item->type() == NetworkManager::ConnectionSettings::Vpn) { | 285 | if (((device && device->uni() == item->devicePath()) || item->devicePath().isEmpty()) || item->type() == NetworkManager::ConnectionSettings::Vpn) { | ||
287 | item->setActiveConnectionPath(activeConnection->path()); | 286 | item->setActiveConnectionPath(activeConnection->path()); | ||
288 | item->setConnectionState(activeConnection->state()); | 287 | item->setConnectionState(activeConnection->state()); | ||
289 | if (activeConnection->vpn()) { | 288 | if (activeConnection->vpn()) { | ||
290 | NetworkManager::VpnConnection::Ptr vpnConnection = activeConnection.objectCast<NetworkManager::VpnConnection>(); | 289 | NetworkManager::VpnConnection::Ptr vpnConnection = activeConnection.objectCast<NetworkManager::VpnConnection>(); | ||
291 | NetworkManager::VpnConnection::State state = vpnConnection->state(); | 290 | NetworkManager::VpnConnection::State state = vpnConnection->state(); | ||
292 | if (state == NetworkManager::VpnConnection::Prepare || | 291 | if (state == NetworkManager::VpnConnection::Prepare || | ||
Show All 12 Lines | |||||
305 | qCDebug(PLASMA_NM) << "Item " << item->name() << ": active connection state changed to " << item->connectionState(); | 304 | qCDebug(PLASMA_NM) << "Item " << item->name() << ": active connection state changed to " << item->connectionState(); | ||
306 | 305 | | |||
307 | if (device && device->uni() == item->devicePath()) { | 306 | if (device && device->uni() == item->devicePath()) { | ||
308 | auto deviceStatistics = device->deviceStatistics(); | 307 | auto deviceStatistics = device->deviceStatistics(); | ||
309 | item->setRxBytes(deviceStatistics->rxBytes()); | 308 | item->setRxBytes(deviceStatistics->rxBytes()); | ||
310 | item->setTxBytes(deviceStatistics->txBytes()); | 309 | item->setTxBytes(deviceStatistics->txBytes()); | ||
311 | } | 310 | } | ||
312 | } | 311 | } | ||
312 | int row = m_list.indexOf(item); | ||||
313 | Q_EMIT dataChanged(index(row, 0), index(row, 0), item->changedRoles()); | ||||
jgrulich: Shouldn't you add item->changedRoles() as the last parameter? | |||||
314 | item->clearChangedRoles(); | ||||
313 | } | 315 | } | ||
314 | endResetModel(); | | |||
315 | } | 316 | } | ||
316 | 317 | | |||
317 | void NetworkModel::addAvailableConnection(const QString &connection, const NetworkManager::Device::Ptr &device) | 318 | void NetworkModel::addAvailableConnection(const QString &connection, const NetworkManager::Device::Ptr &device) | ||
318 | { | 319 | { | ||
319 | if (!device) { | 320 | if (!device) { | ||
320 | return; | 321 | return; | ||
321 | } | 322 | } | ||
322 | 323 | | |||
▲ Show 20 Lines • Show All 761 Lines • Show Last 20 Lines |
Shouldn't you add item->changedRoles() as the last parameter?