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"); m_xml.writeStartElement("CustomIcons");
QListIterator<Uuid> i(m_meta->customIconsOrder()); Q_FOREACH (const Uuid& uuid, m_meta->customIconsOrder()) {
while (i.hasNext()) {
Uuid uuid = i.next();
writeIcon(uuid, m_meta->customIcon(uuid)); writeIcon(uuid, m_meta->customIcon(uuid));
} }

View File

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

View File

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

View File

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