Small optimizations.

This commit is contained in:
Felix Geyer 2013-03-26 23:53:34 +01:00
parent 57b0c17733
commit 1c7e8f6921
4 changed files with 12 additions and 11 deletions

View File

@ -362,21 +362,22 @@ void Entry::addHistoryItem(Entry* entry)
Q_EMIT modified();
}
void Entry::removeHistoryItems(QList<Entry*> historyEntries)
void Entry::removeHistoryItems(const QList<Entry*>& 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()

View File

@ -108,7 +108,7 @@ public:
QList<Entry*> historyItems();
const QList<Entry*>& historyItems() const;
void addHistoryItem(Entry* entry);
void removeHistoryItems(QList<Entry*> historyEntries);
void removeHistoryItems(const QList<Entry*>& historyEntries);
void truncateHistory();
Entry* clone() const;
QString resolvePlaceholders(const QString& str) const;

View File

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

View File

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