• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KDEWebKit

Public Types | Public Slots | Public Member Functions | Protected Member Functions | List of all members
KWebPage Class Reference

#include <kwebpage.h>

Inheritance diagram for KWebPage:
Inheritance graph
[legend]

Public Types

enum  IntegrationFlags { NoIntegration = 0x01, KIOIntegration = 0x02, KPartsIntegration = 0x04, KWalletIntegration = 0x08 }
 

Public Slots

virtual void downloadRequest (const QNetworkRequest &request)
 
void downloadResponse (QNetworkReply *reply)
 
virtual void downloadUrl (const KUrl &url)
 

Public Member Functions

 KWebPage (QObject *parent=0, Integration flags=Integration())
 
 ~KWebPage ()
 
bool isExternalContentAllowed () const
 
void setAllowExternalContent (bool allow)
 
void setWallet (KWebWallet *wallet)
 
KWebWallet * wallet () const
 

Protected Member Functions

virtual bool acceptNavigationRequest (QWebFrame *frame, const QNetworkRequest &request, NavigationType type)
 
bool handleReply (QNetworkReply *reply, QString *contentType=0, KIO::MetaData *metaData=0)
 
void removeRequestMetaData (const QString &key)
 
void removeSessionMetaData (const QString &key)
 
QString requestMetaData (const QString &key) const
 
QString sessionMetaData (const QString &key) const
 
void setRequestMetaData (const QString &key, const QString &value)
 
void setSessionMetaData (const QString &key, const QString &value)
 
virtual QString userAgentForUrl (const QUrl &url) const
 

Detailed Description

An enhanced QWebPage that provides integration into the KDE environment.

This is a convenience class that provides full integration with KDE technologies such as KIO for network request handling, KCookiejar for cookie handling, KParts for embedding non-html content and KWallet for storing form data. It also sets standard icons for many of the actions provided by QWebPage.

Most of this integration happens behind the scenes. If you want KWallet integration, however, you will have to provide a mechanism for deciding whether to allow form data to be stored. To do this, you will need to connect to the KWebWallet::saveFormDataRequested signal and call either KWebWallet::acceptSaveFormDataRequest or KWebWallet::rejectSaveFormDataRequest, typically after asking the user whether they want to save the form data. If you do not do this, no form data will be saved.

KWebPage will also not automatically load form data for you. You should connect to QWebPage::loadFinished and, if the page was loaded successfully, call

page->wallet()->fillFormData(page->mainFrame());
See also
KIO::Integration
KWebWallet
Author
Urs Wolfer <uwolfer @ kde.org>
Dawit Alemayehu <adawit @ kde.org>
Since
4.4

Definition at line 75 of file kwebpage.h.

Member Enumeration Documentation

enum KWebPage::IntegrationFlags

Flags for setting the desired level of integration.

Enumerator
NoIntegration 

Provide only very basic integration such as using KDE icons for the actions provided by QWebPage.

KIOIntegration 

Use KIO to handle network requests.

See also
KIO::Integration::AccessManager
KPartsIntegration 

Use KPart componenets, if available, to display content in <embed> and <object> tags.

KWalletIntegration 

Use KWallet to store login credentials and other form data from web sites.

See also
wallet() and setWallet()

Definition at line 84 of file kwebpage.h.

Constructor & Destructor Documentation

KWebPage::KWebPage ( QObject *  parent = 0,
Integration  flags = Integration() 
)
explicit

Constructs a KWebPage with parent parent.

Note that if no integration flags are set (the default), all integration options are activated. If you inherit from this class you can use the flags in IntegrationFlags to control how much integration should be used.

See also
KIO::Integration::CookieJar
KIO::Integration::AccessManager
wallet() and setWallet()

Definition at line 222 of file kwebpage.cpp.

KWebPage::~KWebPage ( )

Destroys the KWebPage.

Definition at line 285 of file kwebpage.cpp.

Member Function Documentation

bool KWebPage::acceptNavigationRequest ( QWebFrame *  frame,
const QNetworkRequest &  request,
NavigationType  type 
)
protectedvirtual
Reimplemented from superclass.

This performs various integration-related actions when navigation is requested. If you override this method, make sure you call the parent's implementation unless you want to block the request outright.

If you do override acceptNavigationRequest and call this method, however, be aware of the effect of the page's linkDelegationPolicy on how * QWebPage::acceptNavigationRequest behaves.

See also
QWebPage::acceptNavigationRequest

Definition at line 445 of file kwebpage.cpp.

void KWebPage::downloadRequest ( const QNetworkRequest &  request)
virtualslot

Download request using KIO.

This slot first prompts the user where to save the requested resource and then downloads it using KIO.

Definition at line 323 of file kwebpage.cpp.

void KWebPage::downloadResponse ( QNetworkReply *  reply)
slot

Download the resource specified by reply using KIO.

This slot first prompts the user where to save the requested resource and then downloads it using KIO.

In KDE 4.8 and higher, if reply contains a QObject property called "DownloadManagerExe", then an attempt will be made to the command specified by that property to download the specified resource.

If the "DownloadManagerExe" property is not defined or the command specified by it could not be successfully executed, then the user will be prompted for the action to take.

Since
4.5
See also
handleReply

Definition at line 340 of file kwebpage.cpp.

void KWebPage::downloadUrl ( const KUrl &  url)
virtualslot

Download url using KIO.

This slot first prompts the user where to save the requested resource and then downloads it using KIO.

Definition at line 335 of file kwebpage.cpp.

bool KWebPage::handleReply ( QNetworkReply *  reply,
QString *  contentType = 0,
KIO::MetaData *  metaData = 0 
)
protected

Attempts to handle reply and returns true on success, false otherwise.

In KDE 4.8 and higher, if reply contains a QObject property called "DownloadManagerExe", then an attempt will be made to let the command specified by that property to download the requested resource.

If the "DownloadManagerExe" property is not defined or the command specified by it could not be successfully executed, then the user will be prompted for the action to take.

Parameters
replythe QNetworkReply object to be handled.
contentTypeif not null, it will be set to the content-type specified in reply, if any.
metaDataif not null, it will be set to the KIO meta-data specified in reply, if any.
Since
4.6.3

Definition at line 477 of file kwebpage.cpp.

bool KWebPage::isExternalContentAllowed ( ) const

Whether access to remote content is permitted.

If this is false, only resources on the local system can be accessed through this web page. By default access to remote content is allowed.

If KIO integration is disabled, this will always return true.

See also
setAllowExternalContent()
KIO::Integration::AccessManager::isExternalContentAllowed()
Returns
true if access to remote content is permitted, false otherwise

Definition at line 290 of file kwebpage.cpp.

void KWebPage::removeRequestMetaData ( const QString &  key)
protected

Remove an item of request metadata.

Removes the temporary (per-request) metadata associated with key.

See also
KIO::Integration::AccessManager::requestMetaData
setRequestMetaData
Parameters
keythe key for the metadata to remove

Definition at line 416 of file kwebpage.cpp.

void KWebPage::removeSessionMetaData ( const QString &  key)
protected

Remove an item of session metadata.

Removes the permanent (per-session) metadata associated with key.

See also
KIO::Integration::AccessManager::sessionMetaData
setSessionMetaData
Parameters
keythe key for the metadata to remove

Definition at line 409 of file kwebpage.cpp.

QString KWebPage::requestMetaData ( const QString &  key) const
protected

Get an item of request metadata.

Retrieves the value of the temporary (per-request) metadata for key.

If KIO integration is disabled, this will always return an empty string.

See also
KIO::Integration::AccessManager::requestMetaData
setRequestMetaData
Parameters
keythe key of the metadata to retrieve
Returns
the value of the metadata associated with key, or an empty string if there is no such metadata

Definition at line 384 of file kwebpage.cpp.

QString KWebPage::sessionMetaData ( const QString &  key) const
protected

Get an item of session metadata.

Retrieves the value of the permanent (per-session) metadata for key.

If KIO integration is disabled, this will always return an empty string.

See also
KIO::Integration::AccessManager::sessionMetaData
setSessionMetaData
Parameters
keythe key of the metadata to retrieve
Returns
the value of the metadata associated with key, or an empty string if there is no such metadata

Definition at line 373 of file kwebpage.cpp.

void KWebPage::setAllowExternalContent ( bool  allow)

Set whether to allow remote content.

If KIO integration is not enabled, this method will have no effect.

See also
isExternalContentAllowed()
KIO::Integration::AccessManager::setAllowExternalContent(bool)
Parameters
allowtrue if access to remote content should be allowed, false if only local content should be accessible

Definition at line 303 of file kwebpage.cpp.

void KWebPage::setRequestMetaData ( const QString &  key,
const QString &  value 
)
protected

Set an item of metadata to be sent to the KIO slave with the next request.

If KIO integration is disabled, this method will have no effect.

Metadata set using this method will be deleted after it has been sent once.

See also
KIO::Integration::AccessManager::requestMetaData
Parameters
keythe key for the metadata; any existing metadata associated with this key will be overwritten
valuethe value to associate with key

Definition at line 402 of file kwebpage.cpp.

void KWebPage::setSessionMetaData ( const QString &  key,
const QString &  value 
)
protected

Set an item of metadata to be sent to the KIO slave with every request.

If KIO integration is disabled, this method will have no effect.

Metadata set using this method will be sent with every request.

See also
KIO::Integration::AccessManager::sessionMetaData
Parameters
keythe key for the metadata; any existing metadata associated with this key will be overwritten
valuethe value to associate with key

Definition at line 395 of file kwebpage.cpp.

void KWebPage::setWallet ( KWebWallet *  wallet)

Set the KWebWallet that is used to store form data.

This KWebPage will take ownership of wallet, so that the wallet is deleted when the KWebPage is deleted. If you do not want that to happen, you should call setParent() on wallet after calling this function.

See also
KWebWallet
Parameters
walletthe KWebWallet to be used for storing form data, or 0 to disable KWallet integration

Definition at line 310 of file kwebpage.cpp.

QString KWebPage::userAgentForUrl ( const QUrl &  url) const
protectedvirtual
Reimplemented from superclass.

This function is re-implemented to provide KDE user-agent management integration through KProtocolManager.

If a special user-agent has been configured for the host indicated by url, that user-agent will be returned. Otherwise, QWebPage's default user agent is returned.

See also
KProtocolManager::userAgentForHost.
QWebPage::userAgentForUrl.

Definition at line 423 of file kwebpage.cpp.

KWebWallet * KWebPage::wallet ( ) const

The wallet integration manager.

If you wish to use KDE wallet integration, you will have to connect to signals emitted by this object and react accordingly. See KWebWallet for more information.

Returns
the wallet integration manager, or 0 if KDE wallet integration is disabled

Definition at line 298 of file kwebpage.cpp.


The documentation for this class was generated from the following files:
  • kwebpage.h
  • kwebpage.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:51:09 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEWebKit

Skip menu "KDEWebKit"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal