diff --git a/src/core/Entry.cpp b/src/core/Entry.cpp index 8e379dba9..1254aef28 100644 --- a/src/core/Entry.cpp +++ b/src/core/Entry.cpp @@ -362,21 +362,22 @@ void Entry::addHistoryItem(Entry* entry) Q_EMIT modified(); } -void Entry::removeHistoryItems(QList historyEntries) +void Entry::removeHistoryItems(const QList& historyEntries) { - bool emitModified = historyEntries.count() > 0; + if (historyEntries.isEmpty()) { + return; + } + Q_FOREACH (Entry* entry, historyEntries) { Q_ASSERT(!entry->parent()); Q_ASSERT(entry->uuid() == uuid()); - int numberOfRemovedEntries = m_history.removeAll(entry); - Q_ASSERT(numberOfRemovedEntries > 0); - Q_UNUSED(numberOfRemovedEntries); + Q_ASSERT(m_history.contains(entry)); + + m_history.removeOne(entry); delete entry; } - if (emitModified) { - Q_EMIT modified(); - } + Q_EMIT modified(); } void Entry::truncateHistory() diff --git a/src/core/Entry.h b/src/core/Entry.h index 0a1c9a3dd..909a036ef 100644 --- a/src/core/Entry.h +++ b/src/core/Entry.h @@ -108,7 +108,7 @@ public: QList historyItems(); const QList& historyItems() const; void addHistoryItem(Entry* entry); - void removeHistoryItems(QList historyEntries); + void removeHistoryItems(const QList& historyEntries); void truncateHistory(); Entry* clone() const; QString resolvePlaceholders(const QString& str) const; diff --git a/src/core/Group.cpp b/src/core/Group.cpp index 3c2fec757..29e41e00c 100644 --- a/src/core/Group.cpp +++ b/src/core/Group.cpp @@ -267,7 +267,7 @@ void Group::setLastTopVisibleEntry(Entry* entry) set(m_lastTopVisibleEntry, entry); } -void Group::setExpires(const bool& value) +void Group::setExpires(bool value) { if (m_timeInfo.expires() != value) { m_timeInfo.setExpires(value); diff --git a/src/core/Group.h b/src/core/Group.h index 33c362fa8..f7c7ba752 100644 --- a/src/core/Group.h +++ b/src/core/Group.h @@ -69,7 +69,7 @@ public: void setAutoTypeEnabled(TriState enable); void setSearchingEnabled(TriState enable); void setLastTopVisibleEntry(Entry* entry); - void setExpires(const bool& value); + void setExpires(bool value); void setExpiryTime(const QDateTime& dateTime); void setUpdateTimeinfo(bool value);