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

[AutoFill] Added password icon into locationbar to choose username.

Closes #735
This commit is contained in:
nowrep 2013-02-08 18:44:26 +01:00
parent 3ccc0a67c1
commit 67d6d380cd
32 changed files with 465 additions and 59 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 713 B

View File

@ -175,6 +175,12 @@ IconProvider
qproperty-pixmap: url(images/navigation-dropdown.png);
}
#locationbar-autofillicon
{
margin-bottom: 1px;
qproperty-pixmap: url(images/key.png);
}
/*BookmarksToolbar*/
#bookmarksbar QToolButton
{

Binary file not shown.

After

Width:  |  Height:  |  Size: 713 B

View File

@ -184,6 +184,11 @@ IconProvider
qproperty-pixmap: url(images/arrow-down.gif);
}
#locationbar-autofillicon
{
qproperty-pixmap: url(images/key.png);
}
/*WebSearchBar*/
#websearchbar
{

Binary file not shown.

After

Width:  |  Height:  |  Size: 713 B

View File

@ -166,6 +166,12 @@ IconProvider
qproperty-pixmap: url(images/navigation-dropdown.png);
}
#locationbar-autofillicon
{
margin-bottom: 1px;
qproperty-pixmap: url(images/key.png);
}
/*BookmarksToolbar*/
#bookmarksbar QToolButton
{

Binary file not shown.

After

Width:  |  Height:  |  Size: 713 B

View File

@ -170,6 +170,12 @@ IconProvider
qproperty-pixmap: url(images/navigation-dropdown.png);
}
#locationbar-autofillicon
{
margin-bottom: 1px;
qproperty-pixmap: url(images/key.png);
}
/*BookmarksToolbar*/
#bookmarksbar QToolButton
{

Binary file not shown.

After

Width:  |  Height:  |  Size: 713 B

View File

@ -181,6 +181,11 @@ IconProvider
qproperty-pixmap: url(images/navigation-dropdown.png);
}
#locationbar-autofillicon
{
qproperty-pixmap: url(images/key.png);
}
/*BookmarksToolbar*/
#bookmarksbar QToolButton
{

View File

@ -184,6 +184,7 @@ void AutoFill::addEntry(const QUrl &url, const QString &name, const QString &pas
server = url.toString();
}
// Multiple-usernames for HTTP Authorization not supported
query.prepare("SELECT username FROM autofill WHERE server=?");
query.addBindValue(server);
query.exec();
@ -203,20 +204,12 @@ void AutoFill::addEntry(const QUrl &url, const QString &name, const QString &pas
///WEB Form
void AutoFill::addEntry(const QUrl &url, const PageFormData &formData)
{
QSqlQuery query;
QString server = url.host();
if (server.isEmpty()) {
server = url.toString();
}
query.prepare("SELECT data FROM autofill WHERE server=?");
query.addBindValue(server);
query.exec();
if (query.next()) {
return;
}
QSqlQuery query;
query.prepare("INSERT INTO autofill (server, data, username, password, last_used) "
"VALUES (?,?,?,?,strftime('%s', 'now'))");
query.bindValue(0, server);
@ -261,23 +254,29 @@ void AutoFill::updateEntry(const PageFormData &formData, const AutoFillData &upd
mApp->dbWriter()->executeQuery(query);
}
void AutoFill::completePage(WebPage* page)
QList<AutoFillData> AutoFill::completePage(WebPage* page)
{
QList<AutoFillData> list;
if (!page) {
return;
return list;
}
QUrl pageUrl = page->url();
if (!isStored(pageUrl)) {
return;
return list;
}
const AutoFillData data = getFirstFormData(pageUrl);
list = getFormData(pageUrl);
if (!list.isEmpty()) {
const AutoFillData data = getFirstFormData(pageUrl);
if (data.isValid()) {
PageFormCompleter completer(page);
completer.completePage(data.postData);
}
return list;
}
void AutoFill::post(const QNetworkRequest &request, const QByteArray &outgoingData)

View File

@ -65,7 +65,7 @@ public:
void updateEntry(const PageFormData &formData, const AutoFillData &updateData);
void post(const QNetworkRequest &request, const QByteArray &outgoingData);
void completePage(WebPage* frame);
QList<AutoFillData> completePage(WebPage* page);
static QByteArray exportPasswords();
static bool importPasswords(const QByteArray &data);

View File

@ -0,0 +1,37 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2013 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* ============================================================ */
#include "autofillicon.h"
AutoFillIcon::AutoFillIcon(QWidget* parent)
: ClickableLabel(parent)
{
setObjectName("locationbar-autofillicon");
setCursor(Qt::PointingHandCursor);
setToolTip(tr("Choose username to login"));
setFocusPolicy(Qt::ClickFocus);
}
void AutoFillIcon::setFormData(const QList<AutoFillData> &data)
{
m_data = data;
}
QList<AutoFillData> AutoFillIcon::formData() const
{
return m_data;
}

View File

@ -0,0 +1,40 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2013 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* ============================================================ */
#ifndef AUTOFILLICON_H
#define AUTOFILLICON_H
#include "qz_namespace.h"
#include "clickablelabel.h"
#include "autofill.h"
struct AutoFillData;
class QT_QUPZILLA_EXPORT AutoFillIcon : public ClickableLabel
{
public:
explicit AutoFillIcon(QWidget* parent = 0);
void setFormData(const QList<AutoFillData> &data);
QList<AutoFillData> formData() const;
private:
QList<AutoFillData> m_data;
};
#endif // AUTOFILLICON_H

View File

@ -24,7 +24,7 @@
AutoFillNotification::AutoFillNotification(const QUrl &url, const PageFormData &formData, const AutoFillData &updateData)
: AnimatedWidget(AnimatedWidget::Down, 300, 0)
, ui(new Ui::AutoFillWidget)
, ui(new Ui::AutoFillNotification)
, m_url(url)
, m_formData(formData)
, m_updateData(updateData)

View File

@ -15,8 +15,8 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* ============================================================ */
#ifndef AUTOFILLWIDGET_H
#define AUTOFILLWIDGET_H
#ifndef AUTOFILLNOTIFICATION_H
#define AUTOFILLNOTIFICATION_H
#include <QUrl>
@ -27,7 +27,7 @@
namespace Ui
{
class AutoFillWidget;
class AutoFillNotification;
}
class AnimatedWidget;
@ -48,11 +48,11 @@ private slots:
void never();
private:
Ui::AutoFillWidget* ui;
Ui::AutoFillNotification* ui;
QUrl m_url;
PageFormData m_formData;
AutoFillData m_updateData;
};
#endif // AUTOFILLWIDGET_H
#endif // AUTOFILLNOTIFICATION_H

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AutoFillWidget</class>
<widget class="QWidget" name="AutoFillWidget">
<class>AutoFillNotification</class>
<widget class="QWidget" name="AutoFillNotification">
<property name="geometry">
<rect>
<x>0</x>

View File

@ -0,0 +1,82 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2013 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* ============================================================ */
#include "autofillwidget.h"
#include "ui_autofillwidget.h"
#include "pageformcompleter.h"
#include "autofill.h"
#include "qztools.h"
#include "webview.h"
#include "webpage.h"
#include <QPushButton>
AutoFillWidget::AutoFillWidget(WebView* view, QWidget* parent)
: LocationBarPopup(parent)
, ui(new Ui::AutoFillWidget)
, m_view(view)
{
ui->setupUi(this);
}
void AutoFillWidget::setFormData(const QList<AutoFillData> &data)
{
m_data = data;
for (int i = 0; i < data.count(); ++i) {
const AutoFillData d = data.at(i);
if (d.username.isEmpty()) {
continue;
}
QPushButton* button = new QPushButton(this);
button->setText(tr("Login"));
button->setToolTip(d.username);
button->setProperty("data-index", i);
QLabel* label = new QLabel(this);
label->setText(tr("Login as <b>%1</b>").arg(d.username));
ui->gridLayout->addWidget(label, i, 0);
ui->gridLayout->addWidget(button, i, 1);
connect(button, SIGNAL(clicked()), this, SLOT(loginToPage()));
}
}
void AutoFillWidget::loginToPage()
{
QPushButton* button = qobject_cast<QPushButton*>(sender());
if (!button || !m_view) {
return;
}
bool ok;
int index = button->property("data-index").toInt(&ok);
if (ok && QzTools::listContainsIndex(m_data, index)) {
const AutoFillData data = m_data.at(index);
PageFormCompleter completer(m_view->page());
completer.completePage(data.postData);
}
close();
}
AutoFillWidget::~AutoFillWidget()
{
delete ui;
}

View File

@ -0,0 +1,55 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2013 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* ============================================================ */
#ifndef AUTOFILLWIDGET_H
#define AUTOFILLWIDGET_H
#include <QWidget>
#include <QList>
#include "qz_namespace.h"
#include "locationbarpopup.h"
namespace Ui
{
class AutoFillWidget;
}
class WebView;
struct AutoFillData;
class QT_QUPZILLA_EXPORT AutoFillWidget : public LocationBarPopup
{
Q_OBJECT
public:
explicit AutoFillWidget(WebView* view, QWidget* parent = 0);
~AutoFillWidget();
void setFormData(const QList<AutoFillData> &data);
private slots:
void loginToPage();
private:
Ui::AutoFillWidget* ui;
WebView* m_view;
QList<AutoFillData> m_data;
};
#endif // AUTOFILLWIDGET_H

View File

@ -0,0 +1,95 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AutoFillWidget</class>
<widget class="QWidget" name="AutoFillWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>211</width>
<height>54</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="Frame" name="frame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../data/icons.qrc">:/icons/other/keys.png</pixmap>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Choose username to login</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>10</number>
</property>
<property name="horizontalSpacing">
<number>6</number>
</property>
<property name="verticalSpacing">
<number>0</number>
</property>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Frame</class>
<extends>QFrame</extends>
<header>frame.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../data/icons.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 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
@ -17,7 +17,6 @@
* ============================================================ */
#include "bookmarkicon.h"
#include "mainapplication.h"
#include "qupzilla.h"
#include "tabbedwebview.h"
#include "locationbar.h"
#include "bookmarksmodel.h"
@ -27,9 +26,8 @@
#include <QStyle>
#include <QContextMenuEvent>
BookmarkIcon::BookmarkIcon(QupZilla* mainClass, QWidget* parent)
BookmarkIcon::BookmarkIcon(QWidget* parent)
: ClickableLabel(parent)
, p_QupZilla(mainClass)
, m_bookmarksModel(0)
, m_speedDial(mApp->plugins()->speedDial())
{

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 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
@ -25,13 +25,12 @@
#include "qz_namespace.h"
class SpeedDial;
class QupZilla;
class QT_QUPZILLA_EXPORT BookmarkIcon : public ClickableLabel
{
Q_OBJECT
public:
explicit BookmarkIcon(QupZilla* mainClass, QWidget* parent = 0);
explicit BookmarkIcon(QWidget* parent = 0);
void checkBookmark(const QUrl &url, bool forceCheck = false);
private slots:
@ -46,7 +45,6 @@ private:
void setBookmarkSaved();
void setBookmarkDisabled();
QupZilla* p_QupZilla;
BookmarksModel* m_bookmarksModel;
SpeedDial* m_speedDial;

View File

@ -33,10 +33,9 @@
#define HIDE_DELAY 270
BookmarksWidget::BookmarksWidget(QupZilla* mainClass, WebView* view, QWidget* parent)
BookmarksWidget::BookmarksWidget(WebView* view, QWidget* parent)
: LocationBarPopup(parent)
, ui(new Ui::BookmarksWidget)
, p_QupZilla(mainClass)
, m_url(view->url())
, m_view(view)
, m_bookmarksModel(mApp->bookmarksModel())

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 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
@ -32,14 +32,13 @@ class BookmarksWidget;
class WebView;
class SpeedDial;
class BookmarksModel;
class QupZilla;
class BookmarksTree;
class QT_QUPZILLA_EXPORT BookmarksWidget : public LocationBarPopup
{
Q_OBJECT
public:
explicit BookmarksWidget(QupZilla* mainClass, WebView* view, QWidget* parent = 0);
explicit BookmarksWidget(WebView* view, QWidget* parent = 0);
~BookmarksWidget();
signals:
@ -56,7 +55,6 @@ private:
void loadBookmark();
Ui::BookmarksWidget* ui;
QupZilla* p_QupZilla;
QUrl m_url;
int m_bookmarkId;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 546 B

View File

@ -210,6 +210,8 @@ SOURCES += \
autofill/pageformcompleter.cpp \
autofill/autofill.cpp \
network/schemehandlers/ftpschemehandler.cpp \
autofill/autofillicon.cpp \
autofill/autofillwidget.cpp
HEADERS += \
webview/tabpreview.h \
@ -374,6 +376,8 @@ HEADERS += \
autofill/pageformcompleter.h \
autofill/autofill.h \
network/schemehandlers/ftpschemehandler.h \
autofill/autofillicon.h \
autofill/autofillwidget.h
FORMS += \
preferences/autofillmanager.ui \
@ -422,6 +426,7 @@ FORMS += \
session/recoverywidget.ui \
tools/html5permissions/html5permissionsnotification.ui \
tools/html5permissions/html5permissionsdialog.ui \
autofill/autofillwidget.ui
RESOURCES += \
data/icons.qrc \

View File

@ -39,6 +39,8 @@
#include "iconprovider.h"
#include "qzsettings.h"
#include "colors.h"
#include "autofillicon.h"
#include "autofillwidget.h"
#include <QMimeData>
#include <QClipboard>
@ -60,20 +62,22 @@ LocationBar::LocationBar(QupZilla* mainClass)
setObjectName("locationbar");
setDragEnabled(true);
m_bookmarkIcon = new BookmarkIcon(p_QupZilla);
m_bookmarkIcon = new BookmarkIcon(this);
m_goIcon = new GoIcon(this);
m_rssIcon = new RssIcon(this);
m_rssIcon->setToolTip(tr("Add RSS from this page..."));
m_siteIcon = new SiteIcon(this);
m_autofillIcon = new AutoFillIcon(this);
DownIcon* down = new DownIcon(this);
////RTL Support
////if we don't add 'm_siteIcon' by following code, then we should use suitable padding-left value
//// but then, when typing RTL text the layout dynamically changed and within RTL layout direction
//// padding-left is equivalent to padding-right and vice versa, and because style sheet is
//// not changed dynamically this create padding problems.
// RTL Support
// if we don't add 'm_siteIcon' by following code, then we should use suitable padding-left value
// but then, when typing RTL text the layout dynamically changed and within RTL layout direction
// padding-left is equivalent to padding-right and vice versa, and because style sheet is
// not changed dynamically this create padding problems.
addWidget(m_siteIcon, LineEdit::LeftSide);
addWidget(m_autofillIcon, LineEdit::RightSide);
addWidget(m_goIcon, LineEdit::RightSide);
addWidget(m_bookmarkIcon, LineEdit::RightSide);
addWidget(m_rssIcon, LineEdit::RightSide);
@ -88,6 +92,7 @@ LocationBar::LocationBar(QupZilla* mainClass)
connect(m_goIcon, SIGNAL(clicked(QPoint)), this, SLOT(urlEnter()));
connect(m_rssIcon, SIGNAL(clicked(QPoint)), this, SLOT(rssIconClicked()));
connect(m_bookmarkIcon, SIGNAL(clicked(QPoint)), this, SLOT(bookmarkIconClicked()));
connect(m_autofillIcon, SIGNAL(clicked(QPoint)), this, SLOT(autofillIconClicked()));
connect(down, SIGNAL(clicked(QPoint)), this, SLOT(showMostVisited()));
connect(mApp->searchEnginesManager(), SIGNAL(activeEngineChanged()), this, SLOT(updatePlaceHolderText()));
connect(mApp->searchEnginesManager(), SIGNAL(defaultEngineChanged()), this, SLOT(updatePlaceHolderText()));
@ -97,6 +102,11 @@ LocationBar::LocationBar(QupZilla* mainClass)
clearIcon();
updatePlaceHolderText();
// Hide icons by default
m_goIcon->hide();
m_rssIcon->hide();
m_autofillIcon->hide();
}
void LocationBar::setWebView(TabbedWebView* view)
@ -244,10 +254,17 @@ void LocationBar::rssIconClicked()
void LocationBar::bookmarkIconClicked()
{
BookmarksWidget* bWidget = new BookmarksWidget(p_QupZilla, m_webView, this);
BookmarksWidget* bWidget = new BookmarksWidget(m_webView, this);
bWidget->showAt(this);
}
void LocationBar::autofillIconClicked()
{
AutoFillWidget* widget = new AutoFillWidget(m_webView, this);
widget->setFormData(m_autofillIcon->formData());
widget->showAt(this);
}
void LocationBar::showRSSIcon(bool state)
{
m_rssIcon->setVisible(state);
@ -534,14 +551,10 @@ void LocationBar::keyReleaseEvent(QKeyEvent* event)
LineEdit::keyReleaseEvent(event);
}
LocationBar::~LocationBar()
{
delete m_bookmarkIcon;
}
void LocationBar::onLoadStarted()
{
m_progressVisible = true;
m_autofillIcon->hide();
}
void LocationBar::onLoadProgress(int progress)
@ -557,6 +570,13 @@ void LocationBar::onLoadFinished()
if (qzSettings->showLoadingProgress) {
QTimer::singleShot(700, this, SLOT(hideProgress()));
}
WebPage* page = qobject_cast<WebPage*>(m_webView->page());
if (page && page->hasMultipleUsernames()) {
m_autofillIcon->setFormData(page->autoFillData());
m_autofillIcon->show();
}
}
void LocationBar::loadSettings()
@ -732,3 +752,7 @@ void LocationBar::paintEvent(QPaintEvent* event)
p.drawText(currentRect, currentText, opt);
}
LocationBar::~LocationBar()
{
}

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 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
@ -28,11 +28,12 @@ class QupZilla;
class LineEdit;
class LocationCompleter;
class ClickableLabel;
class BookmarkIcon;
class TabbedWebView;
class BookmarkIcon;
class SiteIcon;
class GoIcon;
class RssIcon;
class AutoFillIcon;
class QT_QUPZILLA_EXPORT LocationBar : public LineEdit
{
@ -66,6 +67,7 @@ private slots:
void showSiteInfo();
void rssIconClicked();
void bookmarkIconClicked();
void autofillIconClicked();
void urlEnter();
void clearIcon();
void showRSSIcon(bool state);
@ -111,6 +113,7 @@ private:
GoIcon* m_goIcon;
RssIcon* m_rssIcon;
SiteIcon* m_siteIcon;
AutoFillIcon* m_autofillIcon;
QupZilla* p_QupZilla;
TabbedWebView* m_webView;

View File

@ -229,6 +229,7 @@ void WebPage::finished()
mainFrame()->setZoomFactor(mainFrame()->zoomFactor() - 1);
}
// File scheme watcher
if (url().scheme() == QLatin1String("file")) {
QFileInfo info(url().toLocalFile());
if (info.isFile()) {
@ -248,6 +249,10 @@ void WebPage::finished()
m_fileWatcher->removePaths(m_fileWatcher->files());
}
// Autofill
m_autoFillData = mApp->autoFill()->completePage(this);
// AdBlock
cleanBlockedObjects();
}
@ -571,6 +576,21 @@ void WebPage::addAdBlockRule(const AdBlockRule* rule, const QUrl &url)
}
}
QList<WebPage::AdBlockedEntry> WebPage::adBlockedEntries() const
{
return m_adBlockedEntries;
}
bool WebPage::hasMultipleUsernames() const
{
return m_autoFillData.count() > 1;
}
QList<AutoFillData> WebPage::autoFillData() const
{
return m_autoFillData;
}
void WebPage::cleanBlockedObjects()
{
AdBlockManager* manager = AdBlockManager::instance();

View File

@ -22,6 +22,7 @@
#include <QSslCertificate>
#include "qz_namespace.h"
#include "autofill.h"
class QWebSecurityOrigin;
class QFileSystemWatcher;
@ -62,7 +63,10 @@ public:
void javaScriptAlert(QWebFrame* originatingFrame, const QString &msg);
void addAdBlockRule(const AdBlockRule* rule, const QUrl &url);
QList<AdBlockedEntry> adBlockedEntries() { return m_adBlockedEntries; }
QList<AdBlockedEntry> adBlockedEntries() const;
bool hasMultipleUsernames() const;
QList<AutoFillData> autoFillData() const;
void scheduleAdjustPage();
bool isRunningLoop();
@ -133,6 +137,7 @@ private:
QSslCertificate m_sslCert;
QList<QSslCertificate> m_rejectedSslCerts;
QList<AdBlockedEntry> m_adBlockedEntries;
QList<AutoFillData> m_autoFillData;
QWebPage::NavigationType m_lastRequestType;
QUrl m_lastRequestUrl;

View File

@ -22,7 +22,6 @@
#include "qztools.h"
#include "iconprovider.h"
#include "history.h"
#include "autofill.h"
#include "pluginproxy.h"
#include "downloadmanager.h"
#include "sourceviewer.h"
@ -381,8 +380,6 @@ void WebView::slotLoadFinished()
mApp->history()->addHistoryEntry(this);
}
mApp->autoFill()->completePage(page());
m_isReloading = false;
m_lastUrl = url();
}

View File

@ -247,6 +247,13 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AutoFillIcon</name>
<message>
<source>Choose username to login</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AutoFillManager</name>
<message>
@ -368,9 +375,10 @@
<source>Do you want QupZilla to update saved password %1?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AutoFillWidget</name>
<message>
<source>Update</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Remember</source>
<translation type="unfinished"></translation>
@ -383,8 +391,23 @@
<source>Not Now</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AutoFillWidget</name>
<message>
<source>Update</source>
<source>Form</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Choose username to login</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Login</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Login as &lt;b&gt;%1&lt;/b&gt;</source>
<translation type="unfinished"></translation>
</message>
</context>