1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

AutoFill: completePage now returns only list of usernames

This commit is contained in:
David Rosca 2018-01-28 13:13:04 +01:00
parent fa8fe079cb
commit e719a959d4
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8
3 changed files with 14 additions and 14 deletions

View File

@ -219,22 +219,26 @@ void AutoFill::saveForm(WebPage *page, const QUrl &frameUrl, const PageFormData
}
// Returns all saved passwords on this page
QVector<PasswordEntry> AutoFill::completePage(WebPage *page, const QUrl &frameUrl)
QStringList AutoFill::completePage(WebPage *page, const QUrl &frameUrl)
{
QVector<PasswordEntry> list;
QStringList usernames;
if (!page || !isStored(frameUrl))
return list;
return usernames;
list = getFormData(frameUrl);
const auto entries = getFormData(frameUrl);
if (!list.isEmpty()) {
PasswordEntry entry = list.at(0);
if (!entries.isEmpty()) {
PasswordEntry entry = entries.at(0);
updateLastUsed(entry);
page->runJavaScript(Scripts::completeFormData(entry.data), WebPage::SafeJsWorld);
}
return list;
usernames.reserve(entries.size());
for (const PasswordEntry &entry : entries) {
usernames.append(entry.username);
}
return usernames;
}
QByteArray AutoFill::exportPasswords()

View File

@ -1,6 +1,6 @@
/* ============================================================
* Falkon - Qt web browser
* Copyright (C) 2010-2017 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2018 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -72,7 +72,7 @@ public:
void removeAllEntries();
void saveForm(WebPage *page, const QUrl &frameUrl, const PageFormData &formData);
QVector<PasswordEntry> completePage(WebPage *page, const QUrl &frameUrl);
QStringList completePage(WebPage *page, const QUrl &frameUrl);
QByteArray exportPasswords();
bool importPasswords(const QByteArray &data);

View File

@ -241,11 +241,7 @@ void WebPage::finished()
}
// AutoFill
m_autoFillUsernames.clear();
const auto entries = mApp->autoFill()->completePage(this, url());
for (const PasswordEntry &entry : entries) {
m_autoFillUsernames.append(entry.username);
}
m_autoFillUsernames = mApp->autoFill()->completePage(this, url());
}
void WebPage::watchedFileChanged(const QString &file)