summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mainview.cpp8
-rw-r--r--src/walletwidget.cpp82
-rw-r--r--src/walletwidget.h53
-rw-r--r--src/webpage.cpp6
4 files changed, 149 insertions, 0 deletions
diff --git a/src/mainview.cpp b/src/mainview.cpp
index f4598f22..d190507e 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -48,6 +48,7 @@
#include <KStandardDirs>
#include <KPassivePopup>
#include <KLocalizedString>
+#include <kwebwallet.h>
// Qt Includes
#include <QtCore/QTimer>
@@ -544,6 +545,13 @@ void MainView::webViewLoadFinished(bool ok)
webViewIconChanged();
emit browserTabLoading(false);
+ // KWallet Integration
+ // TODO: Add check for sites exempt from automatic form filling...
+ if (webView->page()->wallet())
+ {
+ webView->page()->wallet()->fillFormData(webView->page()->mainFrame());
+ }
+
// don't display messages for background tabs
if (index != currentIndex())
{
diff --git a/src/walletwidget.cpp b/src/walletwidget.cpp
new file mode 100644
index 00000000..8c68e187
--- /dev/null
+++ b/src/walletwidget.cpp
@@ -0,0 +1,82 @@
+/* ============================================================
+*
+* This file is a part of the rekonq project
+*
+* Copyright (C) 2009 by Andrea Diamantini <adjam7 at gmail dot 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 2 of
+* the License or (at your option) version 3 or any later version
+* accepted by the membership of KDE e.V. (or its successor approved
+* by the membership of KDE e.V.), which shall act as a proxy
+* defined in Section 14 of version 3 of the license.
+*
+* 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 "walletwidget.h"
+#include "walletwidget.moc"
+
+#include <QLabel>
+#include <QPushButton>
+#include <QVBoxLayout>
+
+
+WalletWidget::WalletWidget(QObject *parent)
+ : QWidget(parent)
+{
+ QLabel *label = new QLabel( i18n("Do you want rekonq to remember the password for %1 on %2?"), this);
+ QPushButton *rememberButton = new QPushButton( i18n("remember"), this);
+ QPushButton *neverHereButton = new QPushButton( i18n("never for this site"), this);
+ QPushButton *notNowButton = new QPushButton( i18n("not now"), this);
+
+ connect(rememberButton, SIGNAL(clicked()), this, SLOT(rememberData()));
+ connect(neverHereButton, SIGNAL(clicked()), this, SLOT(neverRememberData()));
+ connect(notNowButton, SIGNAL(clicked()), this, SLOT(notNowRememberData()));
+
+ // layout
+ QVBoxLayout *layout = new QVBoxLayout;
+ layout->addWidget(label);
+ layout->addWidget(rememberButton);
+ layout->addWidget(neverHereButton);
+ layout->addWidget(notNowButton);
+
+ setLayout(layout);
+}
+
+
+WalletWidget::~WalletWidget()
+{
+}
+
+
+void WalletWidget::rememberData()
+{
+ WebView *w = Application::instance()->mainWindow()->currentTab();
+ w->page()->wallet()->saveFormData(w->page()->currentFrame());
+ hide();
+}
+
+
+void WalletWidget::neverRememberData()
+{
+ hide();
+}
+
+
+void WalletWidget::notNowRememberData()
+{
+ hide();
+}
+
+
diff --git a/src/walletwidget.h b/src/walletwidget.h
new file mode 100644
index 00000000..e9e6ce87
--- /dev/null
+++ b/src/walletwidget.h
@@ -0,0 +1,53 @@
+/* ============================================================
+*
+* This file is a part of the rekonq project
+*
+* Copyright (C) 2009 by Andrea Diamantini <adjam7 at gmail dot 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 2 of
+* the License or (at your option) version 3 or any later version
+* accepted by the membership of KDE e.V. (or its successor approved
+* by the membership of KDE e.V.), which shall act as a proxy
+* defined in Section 14 of version 3 of the license.
+*
+* 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 WALLET_WIDGET_H
+#define WALLET_WIDGET_H
+
+
+// Qt Includes
+#include <QWidget>
+
+// Forward Declarations
+class KMainWindow;
+
+
+class WalletWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ WalletWidget(QObject *parent);
+ ~WalletWidget();
+
+private slots:
+
+ void rememberData();
+ void neverRememberData();
+ void notNowRememberData();
+};
+
+#endif // WALLET_WIDGET_H
diff --git a/src/webpage.cpp b/src/webpage.cpp
index 89579c88..42704ab3 100644
--- a/src/webpage.cpp
+++ b/src/webpage.cpp
@@ -49,6 +49,7 @@
#include <KDebug>
#include <KToolInvocation>
#include <KProtocolManager>
+#include <kwebwallet.h>
#include <kparts/browseropenorsavequestion.h>
@@ -80,6 +81,11 @@ WebPage::WebPage(QObject *parent)
connect(networkAccessManager(), SIGNAL(finished(QNetworkReply*)), this, SLOT(manageNetworkErrors(QNetworkReply*)));
connect(this, SIGNAL(unsupportedContent(QNetworkReply *)), this, SLOT(handleUnsupportedContent(QNetworkReply *)));
+
+ // kwallet
+ KWebWallet *w = wallet();
+ connect(w, SIGNAL(saveFormDataRequested(const QString &, const QUrl &)),
+ w, SLOT(acceptSaveFormDataRequest(const QString &)));
}