diff options
author | Jan Mulder <jlmulder@xs4all.nl> | 2018-01-23 21:50:11 +0100 |
---|---|---|
committer | Jan Mulder <jlmulder@xs4all.nl> | 2018-01-24 16:19:09 +0100 |
commit | 2c8693f46846301e0c6833a996bc1364bf17ffc2 (patch) | |
tree | 0a07ea201fb28931757c59871d04b7081e41676a | |
parent | d5cb30efac8f257dd7f8015f9a2a9a24f7df932a (diff) | |
download | subsurface-2c8693f46846301e0c6833a996bc1364bf17ffc2.tar.gz |
Do not add double ConnectionList items
Refuse to add a ConnectionList row, when the row is already
there. This, obviously, prevents double items.
Fixes: #1069
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
-rw-r--r-- | core/connectionlistmodel.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/core/connectionlistmodel.cpp b/core/connectionlistmodel.cpp index 7f8b9894b..812c6508d 100644 --- a/core/connectionlistmodel.cpp +++ b/core/connectionlistmodel.cpp @@ -38,9 +38,11 @@ int ConnectionListModel::rowCount(const QModelIndex &parent) const void ConnectionListModel::addAddress(const QString address) { - beginInsertRows(QModelIndex(), rowCount(), rowCount()); - m_addresses.append(address); - endInsertRows(); + if (!m_addresses.contains(address)) { + beginInsertRows(QModelIndex(), rowCount(), rowCount()); + m_addresses.append(address); + endInsertRows(); + } } void ConnectionListModel::removeAllAddresses() |