mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
PageFormCompleter: Coding style
PageFormCompleter::getAllElementsFromPage doesn't need passing QWebPage *
This commit is contained in:
parent
2c1e4bd613
commit
2276a7f274
@ -49,7 +49,7 @@ PageFormData PageFormCompleter::extractFormData(const QByteArray &postData) cons
|
||||
return formData;
|
||||
}
|
||||
|
||||
const QWebElementCollection &allForms = getAllElementsFromPage(m_page, "form");
|
||||
const QWebElementCollection &allForms = getAllElementsFromPage("form");
|
||||
|
||||
// Find form that contains password value sent in data
|
||||
foreach (const QWebElement &formElement, allForms) {
|
||||
@ -100,7 +100,7 @@ bool PageFormCompleter::completePage(const QByteArray &data) const
|
||||
inputTypes << "text" << "password" << "email";
|
||||
|
||||
// Find all input elements in the page
|
||||
const QWebElementCollection &inputs = getAllElementsFromPage(m_page, "input");
|
||||
const QWebElementCollection &inputs = getAllElementsFromPage("input");
|
||||
|
||||
for (int i = 0; i < queryItems.count(); i++) {
|
||||
const QString &key = queryItems.at(i).first;
|
||||
@ -230,12 +230,16 @@ PageFormCompleter::QueryItems PageFormCompleter::createQueryItems(QByteArray dat
|
||||
return arguments;
|
||||
}
|
||||
|
||||
QWebElementCollection PageFormCompleter::getAllElementsFromPage(QWebPage* page, const QString &selector) const
|
||||
QWebElementCollection PageFormCompleter::getAllElementsFromPage(const QString &selector) const
|
||||
{
|
||||
QWebElementCollection list;
|
||||
|
||||
if (!m_page) {
|
||||
return list;
|
||||
}
|
||||
|
||||
QList<QWebFrame*> frames;
|
||||
frames.append(page->mainFrame());
|
||||
frames.append(m_page->mainFrame());
|
||||
while (!frames.isEmpty()) {
|
||||
QWebFrame* frame = frames.takeFirst();
|
||||
if (frame) {
|
||||
|
@ -55,7 +55,7 @@ private:
|
||||
QByteArray convertWebKitFormBoundaryIfNecessary(const QByteArray &data) const;
|
||||
QueryItem findUsername(const QWebElement &form) const;
|
||||
QueryItems createQueryItems(QByteArray data) const;
|
||||
QWebElementCollection getAllElementsFromPage(QWebPage* page, const QString &selector) const;
|
||||
QWebElementCollection getAllElementsFromPage(const QString &selector) const;
|
||||
|
||||
QWebPage* m_page;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user