KWebPage Class Reference
An enhanced QWebPage that provides integration into the KDE environment. More...
#include <kwebpage.h>

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) |
| 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 sucessfully, call
page->wallet()->fillFormData(page->mainFrame());
- See also:
- KIO::Integration
- KWebWallet
- Since:
- 4.4
Definition at line 70 of file kwebpage.h.
Member Enumeration Documentation
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 79 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.
Definition at line 186 of file kwebpage.cpp.
| KWebPage::~KWebPage | ( | ) |
Destroys the KWebPage.
Definition at line 248 of file kwebpage.cpp.
Member Function Documentation
| bool KWebPage::acceptNavigationRequest | ( | QWebFrame * | frame, |
| const QNetworkRequest & | request, | ||
| NavigationType | type | ||
| ) | [protected, virtual] |
- Reimplemented from superclass.
This performs various integration-related actions when navigation is requested. If you override this method, you should ensure you call KWebPage::acceptNaviationRequest (unless you want to block the request outright), even if you do not use the return value.
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 483 of file kwebpage.cpp.
| void KWebPage::downloadRequest | ( | const QNetworkRequest & | request | ) | [virtual, slot] |
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 285 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.
- Since:
- 4.5
Definition at line 296 of file kwebpage.cpp.
| void KWebPage::downloadUrl | ( | const KUrl & | url | ) | [virtual, slot] |
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 291 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.
- Returns:
trueif access to remote content is permitted,falseotherwise
Definition at line 253 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.
- Parameters:
-
key the key for the metadata to remove
Definition at line 454 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.
- Parameters:
-
key the key for the metadata to remove
Definition at line 447 of file kwebpage.cpp.
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.
- Parameters:
-
key the 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 422 of file kwebpage.cpp.
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.
- Parameters:
-
key the 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 411 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:
-
allow trueif access to remote content should be allowed,falseif only local content should be accessible
Definition at line 266 of file kwebpage.cpp.
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.
- Parameters:
-
key the key for the metadata; any existing metadata associated with this key will be overwritten value the value to associate with key
Definition at line 440 of file kwebpage.cpp.
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.
- Parameters:
-
key the key for the metadata; any existing metadata associated with this key will be overwritten value the value to associate with key
Definition at line 433 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:
-
wallet the KWebWallet to be used for storing form data, or 0 to disable KWallet integration
Definition at line 273 of file kwebpage.cpp.
- 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 461 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 261 of file kwebpage.cpp.
The documentation for this class was generated from the following files:
KDE 4.6 API Reference