mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-19 18:26:34 +01:00
QzTools: Add function to obtain url of QWebFrame
QWebFrame::url() may be empty, and in that case QWebFrame::baseUrl() should be used The issue with empty frame url caused AutoFill to not complete such frames. Closes #1465
This commit is contained in:
parent
011c5d4038
commit
dc29f6bde5
@ -1,3 +1,8 @@
|
||||
Version 1.8.1
|
||||
* not yet released
|
||||
* fixed: autofill not working for some frames
|
||||
* fixed: building on Mac
|
||||
|
||||
Version 1.8.0
|
||||
* released 25 September 2014
|
||||
* added support for window.beforeunload event
|
||||
|
@ -1187,7 +1187,7 @@ void BrowserWindow::printPage(QWebFrame* frame)
|
||||
connect(dialog, SIGNAL(paintRequested(QPrinter*)), weView(), SLOT(print(QPrinter*)));
|
||||
}
|
||||
else {
|
||||
dialog->printer()->setDocName(QzTools::getFileNameFromUrl(frame->url()));
|
||||
dialog->printer()->setDocName(QzTools::getFileNameFromUrl(QzTools::frameUrl(frame)));
|
||||
|
||||
connect(dialog, SIGNAL(paintRequested(QPrinter*)), frame, SLOT(print(QPrinter*)));
|
||||
}
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "pageformcompleter.h"
|
||||
#include "settings.h"
|
||||
#include "passwordmanager.h"
|
||||
#include "qztools.h"
|
||||
|
||||
#include <QXmlStreamWriter>
|
||||
#include <QXmlStreamReader>
|
||||
@ -178,12 +179,12 @@ QVector<PasswordEntry> AutoFill::completeFrame(QWebFrame* frame)
|
||||
return list;
|
||||
}
|
||||
|
||||
QUrl pageUrl = frame->url();
|
||||
if (!isStored(pageUrl)) {
|
||||
const QUrl frameUrl = QzTools::frameUrl(frame);
|
||||
if (!isStored(frameUrl)) {
|
||||
return list;
|
||||
}
|
||||
|
||||
list = getFormData(pageUrl);
|
||||
list = getFormData(frameUrl);
|
||||
|
||||
if (!list.isEmpty()) {
|
||||
const PasswordEntry entry = list.first();
|
||||
@ -221,9 +222,8 @@ void AutoFill::post(const QNetworkRequest &request, const QByteArray &outgoingDa
|
||||
return;
|
||||
}
|
||||
|
||||
const QUrl siteUrl = webPage->url();
|
||||
|
||||
if (!isStoringEnabled(siteUrl)) {
|
||||
const QUrl frameUrl = QzTools::frameUrl(frame);
|
||||
if (!isStoringEnabled(frameUrl)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -236,8 +236,8 @@ void AutoFill::post(const QNetworkRequest &request, const QByteArray &outgoingDa
|
||||
|
||||
PasswordEntry updateData;
|
||||
|
||||
if (isStored(siteUrl)) {
|
||||
const QVector<PasswordEntry> &list = getFormData(siteUrl);
|
||||
if (isStored(frameUrl)) {
|
||||
const QVector<PasswordEntry> &list = getFormData(frameUrl);
|
||||
|
||||
foreach (const PasswordEntry &data, list) {
|
||||
if (data.username == formData.username) {
|
||||
@ -257,7 +257,7 @@ void AutoFill::post(const QNetworkRequest &request, const QByteArray &outgoingDa
|
||||
}
|
||||
}
|
||||
|
||||
AutoFillNotification* aWidget = new AutoFillNotification(siteUrl, formData, updateData);
|
||||
AutoFillNotification* aWidget = new AutoFillNotification(frameUrl, formData, updateData);
|
||||
webView->addNotification(aWidget);
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ SourceViewer::SourceViewer(QWebFrame* frame, const QString &selectedHtml)
|
||||
, m_selectedHtml(selectedHtml)
|
||||
{
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
setWindowTitle(tr("Source of ") + frame->url().toString());
|
||||
setWindowTitle(tr("Source of ") + QzTools::frameUrl(frame).toString());
|
||||
m_layout = new QBoxLayout(QBoxLayout::TopToBottom, this);
|
||||
m_sourceEdit = new PlainEditWithLines(this);
|
||||
m_sourceEdit->setObjectName("sourceviewer-textedit");
|
||||
@ -46,7 +46,7 @@ SourceViewer::SourceViewer(QWebFrame* frame, const QString &selectedHtml)
|
||||
m_sourceEdit->setUndoRedoEnabled(false);
|
||||
|
||||
m_statusBar = new QStatusBar(this);
|
||||
m_statusBar->showMessage(frame->url().toString());
|
||||
m_statusBar->showMessage(QzTools::frameUrl(frame).toString());
|
||||
|
||||
QMenuBar* menuBar = new QMenuBar(this);
|
||||
m_layout->addWidget(m_sourceEdit);
|
||||
|
@ -382,7 +382,7 @@ QList<QWebFrame*> SpeedDial::cleanFrames()
|
||||
|
||||
for (int i = 0; i < m_webFrames.count(); i++) {
|
||||
QWebFrame* frame = m_webFrames.at(i).data();
|
||||
if (!frame || frame->url().toString() != QLatin1String("qupzilla:speeddial")) {
|
||||
if (!frame || QzTools::frameUrl(frame).toString() != QLatin1String("qupzilla:speeddial")) {
|
||||
m_webFrames.removeAt(i);
|
||||
i--;
|
||||
continue;
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include <QSysInfo>
|
||||
#include <QProcess>
|
||||
#include <QMessageBox>
|
||||
#include <QWebFrame>
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
#include <QUrlQuery>
|
||||
@ -215,6 +216,11 @@ QString QzTools::escapeSqlString(QString urlString)
|
||||
return urlString;
|
||||
}
|
||||
|
||||
QUrl QzTools::frameUrl(QWebFrame* frame)
|
||||
{
|
||||
return frame->url().isEmpty() ? frame->baseUrl() : frame->url();
|
||||
}
|
||||
|
||||
QString QzTools::ensureUniqueFilename(const QString &name, const QString &appendFormat)
|
||||
{
|
||||
if (!QFile::exists(name)) {
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
class QSslCertificate;
|
||||
class QFontMetrics;
|
||||
class QWebFrame;
|
||||
class QPixmap;
|
||||
class QIcon;
|
||||
class QWidget;
|
||||
@ -48,6 +49,7 @@ public:
|
||||
static QString urlEncodeQueryString(const QUrl &url);
|
||||
static QString fromPunycode(const QString &str);
|
||||
static QString escapeSqlString(QString urlString);
|
||||
static QUrl frameUrl(QWebFrame* frame);
|
||||
|
||||
static QString ensureUniqueFilename(const QString &name, const QString &appendFormat = QString("(%1)"));
|
||||
static QString getFileNameFromUrl(const QUrl &url);
|
||||
|
@ -201,7 +201,7 @@ void GM_Manager::frameLoadStart()
|
||||
return;
|
||||
}
|
||||
|
||||
const QUrl url = frame->url().isEmpty() ? frame->baseUrl() : frame->url();
|
||||
const QUrl url = QzTools::frameUrl(frame);
|
||||
const QString urlScheme = url.scheme();
|
||||
const QString urlString = url.toEncoded();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user