From 2c8693f46846301e0c6833a996bc1364bf17ffc2 Mon Sep 17 00:00:00 2001 From: Jan Mulder Date: Tue, 23 Jan 2018 21:50:11 +0100 Subject: [PATCH] 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 --- core/connectionlistmodel.cpp | 8 +++++--- 1 file 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()