1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

autofill: port foreach -> range-based for

Signed-off-by: Juraj Oravec <sgd.orava@gmail.com>
This commit is contained in:
Juraj Oravec 2019-12-30 19:16:12 +01:00
parent ea75f18c5b
commit 40c06eaaae
No known key found for this signature in database
GPG Key ID: 63ACB65056BC8D07
2 changed files with 9 additions and 8 deletions

View File

@ -188,7 +188,7 @@ void AutoFill::saveForm(WebPage *page, const QUrl &frameUrl, const PageFormData
if (isStored(frameUrl)) {
const QVector<PasswordEntry> &list = getFormData(frameUrl);
foreach (const PasswordEntry &data, list) {
for (const PasswordEntry &data : list) {
if (data.username == formData.username) {
updateData = data;
updateLastUsed(updateData);
@ -256,9 +256,9 @@ QByteArray AutoFill::exportPasswords()
stream.writeStartElement(QStringLiteral("passwords"));
stream.writeAttribute(QStringLiteral("version"), QStringLiteral("1.0"));
QVector<PasswordEntry> entries = m_manager->getAllEntries();
const QVector<PasswordEntry> entries = m_manager->getAllEntries();
foreach (const PasswordEntry &entry, entries) {
for (const PasswordEntry &entry : entries) {
stream.writeStartElement(QStringLiteral("entry"));
stream.writeTextElement(QStringLiteral("server"), entry.host);
stream.writeTextElement(QStringLiteral("username"), entry.username);
@ -318,7 +318,8 @@ bool AutoFill::importPasswords(const QByteArray &data)
if (entry.isValid()) {
bool containsEntry = false;
foreach (const PasswordEntry &e, m_manager->getEntries(QUrl(entry.host))) {
const auto entries = m_manager->getEntries(QUrl(entry.host));
for (const PasswordEntry &e : entries) {
if (e.username == entry.username) {
containsEntry = true;
break;

View File

@ -609,17 +609,17 @@ void MasterPasswordDialog::clearMasterPasswordAndConvert(bool forcedAskPass)
}
if (m_backend->hasPermission()) {
QVector<PasswordEntry> list = m_backend->getAllEntries();
const QVector<PasswordEntry> list = m_backend->getAllEntries();
PasswordBackend* databaseBackend = mApp->autoFill()->passwordManager()->availableBackends().value(QSL("database"));
if (!databaseBackend) {
return;
}
QVector<PasswordEntry> databaseList = databaseBackend->getAllEntries();
const QVector<PasswordEntry> databaseList = databaseBackend->getAllEntries();
bool allDataMoved = true;
foreach (const PasswordEntry &entry, list) {
for (const PasswordEntry &entry : list) {
bool sameEntry = false;
foreach (const PasswordEntry &dbEntry, databaseList) {
for (const PasswordEntry &dbEntry : databaseList) {
sameEntry = samePasswordEntry(dbEntry, entry);
if (sameEntry) {
allDataMoved = false;