Falkon Develop
Cross-platform Qt-based web browser
autofill.h
Go to the documentation of this file.
1/* ============================================================
2* Falkon - Qt web browser
3* Copyright (C) 2010-2018 David Rosca <nowrep@gmail.com>
4*
5* This program is free software: you can redistribute it and/or modify
6* it under the terms of the GNU General Public License as published by
7* the Free Software Foundation, either version 3 of the License, or
8* (at your option) any later version.
9*
10* This program is distributed in the hope that it will be useful,
11* but WITHOUT ANY WARRANTY; without even the implied warranty of
12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13* GNU General Public License for more details.
14*
15* You should have received a copy of the GNU General Public License
16* along with this program. If not, see <http://www.gnu.org/licenses/>.
17* ============================================================ */
18#ifndef AUTOFILL_H
19#define AUTOFILL_H
20
21#include <QObject>
22#include <QPointer>
23
24#include "qzcommon.h"
25
26class QUrl;
27class QWebEnginePage;
28
29class WebPage;
30class BrowserWindow;
31class PasswordManager;
33struct PageFormData;
34struct PasswordEntry;
35
37 QString username;
38 QString password;
39 QByteArray postData;
40
41 bool isValid() const {
42 return !password.isEmpty();
43 }
44};
45
46class FALKON_EXPORT AutoFill : public QObject
47{
48 Q_OBJECT
49
50public:
51 explicit AutoFill(QObject* parent = nullptr);
52
53 PasswordManager* passwordManager() const;
54 void loadSettings();
55
56 bool isStored(const QUrl &url);
57 bool isStoringEnabled(const QUrl &url);
58 void blockStoringforUrl(const QUrl &url);
59
60 QVector<PasswordEntry> getFormData(const QUrl &url);
61 QVector<PasswordEntry> getAllFormData();
62
63 void updateLastUsed(PasswordEntry &data);
64
65 void addEntry(const QUrl &url, const QString &name, const QString &pass);
66 void addEntry(const QUrl &url, const PageFormData &formData);
67
68 void updateEntry(const QUrl &url, const QString &name, const QString &pass);
69 bool updateEntry(const PasswordEntry &entry);
70
71 void removeEntry(const PasswordEntry &entry);
72 void removeAllEntries();
73
74 void saveForm(WebPage *page, const QUrl &frameUrl, const PageFormData &formData);
75 QStringList completePage(WebPage *page, const QUrl &frameUrl);
76
77 QByteArray exportPasswords();
78 bool importPasswords(const QByteArray &data);
79
80private:
81 PasswordManager* m_manager;
82 bool m_isStoring = false;
83 bool m_isAutoComplete = false;
84 QPointer<AutoFillNotification> m_lastNotification;
85 WebPage *m_lastNotificationPage = nullptr;
86
87};
88
89#endif // AUTOFILL_H
#define FALKON_EXPORT
Definition: qzcommon.h:28
QString password
Definition: autofill.h:38
QByteArray postData
Definition: autofill.h:39
QString username
Definition: autofill.h:37
bool isValid() const
Definition: autofill.h:41