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>
This commit is contained in:
Jan Mulder 2018-01-23 21:50:11 +01:00
parent d5cb30efac
commit 2c8693f468

View file

@ -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()