summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorGravatar Jan Mulder <jlmulder@xs4all.nl>2017-10-11 19:31:45 +0200
committerGravatar Jan Mulder <jlmulder@xs4all.nl>2017-10-12 09:32:12 +0200
commit8b8863b6407f4c80bfb3f4a51ea8eeeedf7f0ab5 (patch)
tree61aa9efb498bd6b9a9504b775476c1ceefa754b9 /core
parentf7d120e39c2705ce20665134a27ff5727b588e6d (diff)
downloadsubsurface-8b8863b6407f4c80bfb3f4a51ea8eeeedf7f0ab5.tar.gz
Add function to clear connectionModel data
Preparation primarily for mobile. When we want to switch in one session from BT to cable connection and vise versa, we need a way to clear the model data containing the possible connections in use. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Diffstat (limited to 'core')
-rw-r--r--core/connectionlistmodel.cpp7
-rw-r--r--core/connectionlistmodel.h1
2 files changed, 8 insertions, 0 deletions
diff --git a/core/connectionlistmodel.cpp b/core/connectionlistmodel.cpp
index 3e1e0d71c..7f8b9894b 100644
--- a/core/connectionlistmodel.cpp
+++ b/core/connectionlistmodel.cpp
@@ -42,3 +42,10 @@ void ConnectionListModel::addAddress(const QString address)
m_addresses.append(address);
endInsertRows();
}
+
+void ConnectionListModel::removeAllAddresses()
+{
+ beginRemoveRows(QModelIndex(), 0, rowCount());
+ m_addresses.clear();
+ endRemoveRows();
+}
diff --git a/core/connectionlistmodel.h b/core/connectionlistmodel.h
index ec3a785fa..b7b1db5c9 100644
--- a/core/connectionlistmodel.h
+++ b/core/connectionlistmodel.h
@@ -15,6 +15,7 @@ public:
QString address(int idx) const;
int rowCount(const QModelIndex &parent = QModelIndex()) const;
void addAddress(const QString address);
+ void removeAllAddresses();
private:
QStringList m_addresses;
};