KDEWebKit
kwebpage.h
Go to the documentation of this file.
00001 /* 00002 * This file is part of the KDE project. 00003 * 00004 * Copyright (C) 2008 Dirk Mueller <mueller@kde.org> 00005 * Copyright (C) 2008 Urs Wolfer <uwolfer @ kde.org> 00006 * Copyright (C) 2008 Michael Howell <mhowell123@gmail.com> 00007 * Copyright (C) 2009,2010 Dawit Alemayehu <adawit @ kde.org> 00008 * 00009 * This library is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU Library General Public 00011 * License as published by the Free Software Foundation; either 00012 * version 2 of the License, or (at your option) any later version. 00013 * 00014 * This library is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 * Library General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU Library General Public License 00020 * along with this library; see the file COPYING.LIB. If not, write to 00021 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00022 * Boston, MA 02110-1301, USA. 00023 * 00024 */ 00025 #ifndef KWEBPAGE_H 00026 #define KWEBPAGE_H 00027 00028 #include <kdewebkit_export.h> 00029 00030 #include <QtWebKit/QWebPage> 00031 00032 class KWebWallet; 00033 class KUrl; 00034 class KJob; 00035 00036 namespace KIO { 00037 class MetaData; 00038 } 00039 00074 class KDEWEBKIT_EXPORT KWebPage : public QWebPage 00075 { 00076 Q_OBJECT 00077 Q_FLAGS (Integration) 00078 00079 public: 00083 enum IntegrationFlags 00084 { 00089 NoIntegration = 0x01, 00095 KIOIntegration = 0x02, 00100 KPartsIntegration = 0x04, 00107 KWalletIntegration = 0x08 00108 }; 00109 Q_DECLARE_FLAGS(Integration, IntegrationFlags) 00110 00111 00123 explicit KWebPage(QObject *parent = 0, Integration flags = Integration()); 00124 00128 ~KWebPage(); 00129 00143 bool isExternalContentAllowed() const; 00144 00155 KWebWallet *wallet() const; 00156 00168 void setAllowExternalContent(bool allow); 00169 00183 void setWallet(KWebWallet* wallet); 00184 00185 public Q_SLOTS: 00192 virtual void downloadRequest(const QNetworkRequest &request); 00193 00200 virtual void downloadUrl(const KUrl &url); 00201 00210 void downloadResponse(QNetworkReply *reply); 00211 00212 protected: 00227 QString sessionMetaData(const QString &key) const; 00228 00243 QString requestMetaData(const QString &key) const; 00244 00258 void setSessionMetaData(const QString &key, const QString &value); 00259 00274 void setRequestMetaData(const QString &key, const QString &value); 00275 00286 void removeSessionMetaData(const QString &key); 00287 00298 void removeRequestMetaData(const QString &key); 00299 00313 virtual QString userAgentForUrl(const QUrl& url) const; 00314 00330 virtual bool acceptNavigationRequest(QWebFrame * frame, const QNetworkRequest & request, NavigationType type); 00331 00340 bool handleReply (QNetworkReply* reply, QString* contentType = 0, KIO::MetaData* metaData = 0); 00341 00342 private: 00343 class KWebPagePrivate; 00344 KWebPagePrivate* const d; 00345 Q_PRIVATE_SLOT(d, void _k_copyResultToTempFile(KJob *)) 00346 }; 00347 00348 Q_DECLARE_OPERATORS_FOR_FLAGS(KWebPage::Integration) 00349 00350 #endif // KWEBPAGE_H
KDE 4.7 API Reference