KDEWebKit
kwebwallet.h
Go to the documentation of this file.
00001 /* 00002 * This file is part of the KDE project. 00003 * 00004 * Copyright (C) 2009 Dawit Alemayehu <adawit@kde.org> 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Library General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Library General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Library General Public License 00017 * along with this library; see the file COPYING.LIB. If not, write to 00018 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 * Boston, MA 02110-1301, USA. 00020 * 00021 */ 00022 #ifndef KWEBWALLET_H 00023 #define KWEBWALLET_H 00024 00025 #include <kdewebkit_export.h> 00026 00027 #include <kurl.h> 00028 00029 #include <QtCore/QObject> 00030 #include <QtCore/QString> 00031 #include <QtCore/QList> 00032 #include <QtCore/QPair> 00033 #include <QtGui/QWidget> 00034 #include <QtCore/QtGlobal> 00035 00036 class QWebFrame; 00037 class QWebPage; 00038 00039 00064 class KDEWEBKIT_EXPORT KWebWallet : public QObject 00065 { 00066 Q_OBJECT 00067 00068 public: 00069 00073 struct WebForm 00074 { 00079 typedef QPair<QString, QString> WebField; 00080 00082 QUrl url; 00084 QString name; 00086 QString index; 00088 QList<WebField> fields; 00089 }; 00090 00094 typedef QList<WebForm> WebFormList; 00095 00108 explicit KWebWallet(QObject* parent = 0, WId wid = 0); 00109 00113 virtual ~KWebWallet(); 00114 00131 WebFormList formsWithCachedData(QWebFrame* frame, bool recursive = true) const; 00132 00145 void saveFormData(QWebFrame *frame, bool recursive = true, bool ignorePasswordFields = false); 00146 00154 void fillFormData(QWebFrame *frame, bool recursive = true); 00155 00168 void removeFormData (QWebFrame *frame, bool recursive); 00169 00178 void removeFormData(const WebFormList &forms); 00179 00180 public Q_SLOTS: 00193 void acceptSaveFormDataRequest(const QString &key); 00194 00203 void rejectSaveFormDataRequest(const QString &key); 00204 00205 Q_SIGNALS: 00219 void saveFormDataRequested(const QString &key, const QUrl &url); 00220 00229 void saveFormDataCompleted(const QUrl &url, bool ok); 00230 00240 void fillFormRequestCompleted(bool ok); 00241 00245 void walletClosed(); 00246 00247 protected: 00254 WebFormList formsToFill(const KUrl &url) const; 00255 00262 WebFormList formsToSave(const QString &key) const; 00263 00267 WebFormList formsToDelete() const; 00268 00273 virtual bool hasCachedFormData(const WebForm &form) const; 00274 00280 void fillWebForm(const KUrl &url, const WebFormList &forms); 00281 00292 virtual void fillFormDataFromCache(const KUrl::List &list); 00293 00302 virtual void saveFormDataToCache(const QString &key); 00303 00312 virtual void removeFormDataFromCache(const WebFormList &forms); 00313 00314 private: 00315 class KWebWalletPrivate; 00316 friend class KWebWalletPrivate; 00317 KWebWalletPrivate * const d; 00318 00319 Q_PRIVATE_SLOT(d, void _k_openWalletDone(bool)) 00320 Q_PRIVATE_SLOT(d, void _k_walletClosed()) 00321 }; 00322 00323 #endif // KWEBWALLET_H
KDE 4.6 API Reference