summaryrefslogtreecommitdiffstats
path: root/network/abstractnetworkmodel.cpp
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2022-01-28 16:54:55 -0500
committerScott Murray <scott.murray@konsulko.com>2022-01-28 17:00:09 -0500
commit5ef90db242ad29c9772f2237b477c58ef65545c7 (patch)
treef9b7b2e56a0aaec37bb9ef99faa316465613b941 /network/abstractnetworkmodel.cpp
parent0fee9bfb0f656b78f34c44542329760be2980892 (diff)
Re-enable network supportmarlin_12.92.0marlin/12.92.012.92.0
Rework network support code to use new connman-glib library instead of the previously disabled agl-service-network API. The only user visible change is that a few extra previously exported header files have been pruned from installation to avoid exposing GLib usage and potentially requiring users needing to build against it. Bug-AGL: SPEC-4182 Signed-off-by: Scott Murray <scott.murray@konsulko.com> Change-Id: Iab8f3c9d04ee603e06b80dfd92ac03d9d52af477
Diffstat (limited to 'network/abstractnetworkmodel.cpp')
-rw-r--r--network/abstractnetworkmodel.cpp55
1 files changed, 28 insertions, 27 deletions
diff --git a/network/abstractnetworkmodel.cpp b/network/abstractnetworkmodel.cpp
index ad5a31a..d8cd984 100644
--- a/network/abstractnetworkmodel.cpp
+++ b/network/abstractnetworkmodel.cpp
@@ -10,56 +10,57 @@ AbstractNetworkModel::AbstractNetworkModel(QObject *parent)
void AbstractNetworkModel::addNetwork(ConnectionProfile *network)
{
- beginInsertRows(QModelIndex(), rowCount(), rowCount());
- m_networks.insert(rowCount(), network);
- endInsertRows();
+ int start_rows = rowCount();
+ beginInsertRows(QModelIndex(), rowCount(), rowCount());
+ m_networks.insert(rowCount(), network);
+ endInsertRows();
}
void AbstractNetworkModel::removeNetwork(ConnectionProfile *network)
{
- if (m_networks.isEmpty() || (network == nullptr))
- return;
+ if (m_networks.isEmpty() || (network == nullptr))
+ return;
- int row = m_networks.indexOf(network);
- beginRemoveRows(QModelIndex(), row, row);
- m_networks.removeAt(row);
- endRemoveRows();
- delete network;
+ int row = m_networks.indexOf(network);
+ beginRemoveRows(QModelIndex(), row, row);
+ m_networks.removeAt(row);
+ endRemoveRows();
+ delete network;
}
void AbstractNetworkModel::removeAllNetworks()
{
- if (m_networks.isEmpty())
- return;
+ if (m_networks.isEmpty())
+ return;
- beginRemoveRows(QModelIndex(), 0, m_networks.count() - 1);
- qDeleteAll(m_networks.begin(), m_networks.end());
- endRemoveRows();
- m_networks.clear();
+ beginRemoveRows(QModelIndex(), 0, m_networks.count() - 1);
+ qDeleteAll(m_networks.begin(), m_networks.end());
+ endRemoveRows();
+ m_networks.clear();
}
ConnectionProfile *AbstractNetworkModel::getNetwork(QString service)
{
- if (m_networks.isEmpty())
- return nullptr;
+ if (m_networks.isEmpty())
+ return nullptr;
- for (auto network : m_networks) {
- if (network->service() == service)
- return network;
- }
+ for (auto network : m_networks) {
+ if (network->service() == service)
+ return network;
+ }
- return nullptr;
+ return nullptr;
}
int AbstractNetworkModel::rowCount(const QModelIndex &parent) const
{
- Q_UNUSED(parent);
- return m_networks.count();
+ Q_UNUSED(parent);
+ return m_networks.count();
}
QModelIndex AbstractNetworkModel::indexOf(ConnectionProfile *network)
{
- int row = m_networks.indexOf(network);
+ int row = m_networks.indexOf(network);
- return index(row);
+ return index(row);
}