summaryrefslogtreecommitdiffstats
path: root/network/wirednetworkmodel.cpp
diff options
context:
space:
mode:
authorRaquel Medina <raquel.medina@konsulko.com>2019-07-22 15:04:17 +0200
committerraquel medina <raquel.medina@konsulko.com>2019-07-22 20:58:34 +0000
commit4617d8b63620de9729a07c5d17e8b3113fbb58a3 (patch)
tree353b4fc0dc2ab182f509a6a7b128e53073fab343 /network/wirednetworkmodel.cpp
parent61d01475342f6811458d1ae70c23aeaed5348143 (diff)
network: use roles to signal model changeshalibut_8.0.0halibut/8.0.08.0.0
This commit provides: - use of specific roles to signal model changes for wired and wifi network models. - fix to correctly broadcast wifi strength on initial connection to previously unknown wifi service. Bug-AGL: SPEC-2339 Signed-off-by: Raquel Medina <raquel.medina@konsulko.com> Change-Id: I35922d6c96b8b89fd4d376cddd8f4113cf18dbca
Diffstat (limited to 'network/wirednetworkmodel.cpp')
-rw-r--r--network/wirednetworkmodel.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/network/wirednetworkmodel.cpp b/network/wirednetworkmodel.cpp
index eb8988b..01a50fb 100644
--- a/network/wirednetworkmodel.cpp
+++ b/network/wirednetworkmodel.cpp
@@ -1,5 +1,6 @@
#include "wirednetworkmodel.h"
#include "connectionprofile.h"
+#include <QVector>
#include <QDebug>
WiredNetworkModel::WiredNetworkModel(QObject *parent)
@@ -46,17 +47,20 @@ QHash<int, QByteArray> WiredNetworkModel::roleNames() const {
void WiredNetworkModel::updateProperties(QString service, QJsonObject properties)
{
ConnectionProfile *network;
+ QVector<int> vroles;
- // FIXME: add role parameter to emits
if ((network = getNetwork(service))) {
if (properties.contains("ipv4")) {
QString address = properties.value("ipv4").toObject().value("address").toString();
network->setAddress(address);
- emit dataChanged(indexOf(network), indexOf(network));
+ vroles.push_back(AddressRole);
}
if (properties.contains("state")) {
network->setState(properties.value("state").toString());
- emit dataChanged(indexOf(network), indexOf(network));
+ vroles.push_back(StateRole);
}
+ if (!vroles.isEmpty())
+ emit dataChanged(indexOf(network), indexOf(network), vroles);
+
}
}