diff --git a/src/core/AutoTypeAssociations.cpp b/src/core/AutoTypeAssociations.cpp index d96901294..75d21fe3f 100644 --- a/src/core/AutoTypeAssociations.cpp +++ b/src/core/AutoTypeAssociations.cpp @@ -64,6 +64,17 @@ void AutoTypeAssociations::remove(int index) Q_EMIT modified(); } +void AutoTypeAssociations::removeEmpty() +{ + QMutableListIterator i(m_associations); + while (i.hasNext()) { + const Association& assoc = i.next(); + if (assoc.window.isEmpty() && assoc.sequence.isEmpty()) { + i.remove(); + } + } +} + void AutoTypeAssociations::update(int index, const AutoTypeAssociations::Association& association) { Q_ASSERT(index >= 0 && index < m_associations.size()); diff --git a/src/core/AutoTypeAssociations.h b/src/core/AutoTypeAssociations.h index dd7ddf782..c71a45b45 100644 --- a/src/core/AutoTypeAssociations.h +++ b/src/core/AutoTypeAssociations.h @@ -40,6 +40,7 @@ public: void copyDataFrom(const AutoTypeAssociations* other); void add(const AutoTypeAssociations::Association& association); void remove(int index); + void removeEmpty(); void update(int index, const AutoTypeAssociations::Association& association); AutoTypeAssociations::Association get(int index) const; QList getAll() const;