Use Q_FOREACH instead of QListIterator.

This commit is contained in:
Felix Geyer 2012-05-14 17:56:43 +02:00
parent cd41727583
commit 924130e0fe
4 changed files with 6 additions and 18 deletions

View File

@ -129,9 +129,7 @@ void KeePass2XmlWriter::writeCustomIcons()
{
m_xml.writeStartElement("CustomIcons");
QListIterator<Uuid> i(m_meta->customIconsOrder());
while (i.hasNext()) {
Uuid uuid = i.next();
Q_FOREACH (const Uuid& uuid, m_meta->customIconsOrder()) {
writeIcon(uuid, m_meta->customIcon(uuid));
}

View File

@ -351,9 +351,7 @@ bool DatabaseWidget::canDeleteCurrentGoup()
void DatabaseWidget::truncateHistories()
{
QList<Entry*> allEntries = m_db->rootGroup()->entriesRecursive(false);
QListIterator<Entry*> i(allEntries);
while (i.hasNext()) {
Entry* entry = i.next();
Q_FOREACH (Entry* entry, allEntries) {
entry->truncateHistory();
}
}

View File

@ -459,18 +459,14 @@ void EditEntryWidget::removeCustomIcon()
int iconUsedCount = 0;
QList<Entry*> allEntries = m_database->rootGroup()->entriesRecursive(true);
QListIterator<Entry*> iEntries(allEntries);
while (iEntries.hasNext()) {
Entry* entry = iEntries.next();
Q_FOREACH (const Entry* entry, allEntries) {
if (iconUuid == entry->iconUuid() && entry != m_entry) {
iconUsedCount++;
}
}
QList<const Group*> allGroups = m_database->rootGroup()->groupsRecursive(true);
QListIterator<const Group*> iGroups(allGroups);
while (iGroups.hasNext()) {
const Group* group = iGroups.next();
Q_FOREACH (const Group* group, allGroups) {
if (iconUuid == group->iconUuid()) {
iconUsedCount++;
}

View File

@ -75,9 +75,7 @@ void EntryModel::setEntries(const QList<Entry*>& entries)
m_allGroups = entries.at(0)->group()->database()->rootGroup()->groupsRecursive(true);
}
QListIterator<const Group*> iGroups(m_allGroups);
while (iGroups.hasNext()) {
const Group* group = iGroups.next();
Q_FOREACH (const Group* group, m_allGroups) {
makeConnections(group);
}
@ -248,9 +246,7 @@ void EntryModel::severConnections()
disconnect(m_group, 0, this, 0);
}
QListIterator<const Group*> i(m_allGroups);
while (i.hasNext()) {
const Group* group = i.next();
Q_FOREACH (const Group* group, m_allGroups) {
disconnect(group, 0, this, 0);
}
}