/usr/include/kwebpage.h is in kdelibs5-dev 4:4.8.2-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 | /*
* This file is part of the KDE project.
*
* Copyright (C) 2008 Dirk Mueller <mueller@kde.org>
* Copyright (C) 2008 Urs Wolfer <uwolfer @ kde.org>
* Copyright (C) 2008 Michael Howell <mhowell123@gmail.com>
* Copyright (C) 2009,2010 Dawit Alemayehu <adawit @ kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/
#ifndef KWEBPAGE_H
#define KWEBPAGE_H
#include <kdewebkit_export.h>
#include <QtWebKit/QWebPage>
class KWebWallet;
class KUrl;
class KJob;
namespace KIO {
class MetaData;
}
/**
* @short 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
* @code
* page->wallet()->fillFormData(page->mainFrame());
* @endcode
*
* @see KIO::Integration
* @see KWebWallet
*
* @author Urs Wolfer <uwolfer @ kde.org>
* @author Dawit Alemayehu <adawit @ kde.org>
*
* @since 4.4
*/
class KDEWEBKIT_EXPORT KWebPage : public QWebPage
{
Q_OBJECT
Q_FLAGS (Integration)
public:
/**
* Flags for setting the desired level of integration.
*/
enum IntegrationFlags
{
/**
* Provide only very basic integration such as using KDE icons for the
* actions provided by QWebPage.
*/
NoIntegration = 0x01,
/**
* Use KIO to handle network requests.
*
* @see KIO::Integration::AccessManager
*/
KIOIntegration = 0x02,
/**
* Use KPart componenets, if available, to display content in
* <embed> and <object> tags.
*/
KPartsIntegration = 0x04,
/**
* Use KWallet to store login credentials and other form data from web
* sites.
*
* @see wallet() and setWallet()
*/
KWalletIntegration = 0x08
};
Q_DECLARE_FLAGS(Integration, IntegrationFlags)
/**
* Constructs a KWebPage with parent @p 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 @ref IntegrationFlags to control how much integration should
* be used.
*
* @see KIO::Integration::CookieJar
* @see KIO::Integration::AccessManager
* @see wallet() and setWallet()
*/
explicit KWebPage(QObject *parent = 0, Integration flags = Integration());
/**
* Destroys the KWebPage.
*/
~KWebPage();
/**
* Whether access to remote content is permitted.
*
* If this is @c 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 @c true.
*
* @see setAllowExternalContent()
* @see KIO::Integration::AccessManager::isExternalContentAllowed()
*
* @return @c true if access to remote content is permitted, @c false otherwise
*/
bool isExternalContentAllowed() 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.
*
* @return the wallet integration manager, or 0 if KDE wallet integration
* is disabled
*/
KWebWallet *wallet() const;
/**
* Set whether to allow remote content.
*
* If KIO integration is not enabled, this method will have no effect.
*
* @see isExternalContentAllowed()
* @see KIO::Integration::AccessManager::setAllowExternalContent(bool)
*
* @param allow @c true if access to remote content should be allowed,
* @c false if only local content should be accessible
*/
void setAllowExternalContent(bool allow);
/**
* Set the @ref KWebWallet that is used to store form data.
*
* This KWebPage will take ownership of @p 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 @p wallet after calling
* this function.
*
* @see KWebWallet
*
* @param wallet the KWebWallet to be used for storing form data, or
* 0 to disable KWallet integration
*/
void setWallet(KWebWallet* wallet);
public Q_SLOTS:
/**
* Download @p request using KIO.
*
* This slot first prompts the user where to save the requested
* resource and then downloads it using KIO.
*/
virtual void downloadRequest(const QNetworkRequest &request);
/**
* Download @p url using KIO.
*
* This slot first prompts the user where to save the requested
* resource and then downloads it using KIO.
*/
virtual void downloadUrl(const KUrl &url);
/**
* Download the resource specified by @p 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 @p 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 handleReply
*/
void downloadResponse(QNetworkReply *reply);
protected:
/**
* Get an item of session metadata.
*
* Retrieves the value of the permanent (per-session) metadata for @p key.
*
* If KIO integration is disabled, this will always return an empty string.
*
* @see KIO::Integration::AccessManager::sessionMetaData
* @see setSessionMetaData
*
* @param key the key of the metadata to retrieve
* @return the value of the metadata associated with @p key, or an
* empty string if there is no such metadata
*/
QString sessionMetaData(const QString &key) const;
/**
* Get an item of request metadata.
*
* Retrieves the value of the temporary (per-request) metadata for @p key.
*
* If KIO integration is disabled, this will always return an empty string.
*
* @see KIO::Integration::AccessManager::requestMetaData
* @see setRequestMetaData
*
* @param key the key of the metadata to retrieve
* @return the value of the metadata associated with @p key, or an
* empty string if there is no such metadata
*/
QString requestMetaData(const QString &key) const;
/**
* 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 KIO::Integration::AccessManager::sessionMetaData
*
* @param key the key for the metadata; any existing metadata associated
* with this key will be overwritten
* @param value the value to associate with @p key
*/
void setSessionMetaData(const QString &key, const QString &value);
/**
* 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 KIO::Integration::AccessManager::requestMetaData
*
* @param key the key for the metadata; any existing metadata associated
* with this key will be overwritten
* @param value the value to associate with @p key
*/
void setRequestMetaData(const QString &key, const QString &value);
/**
* Remove an item of session metadata.
*
* Removes the permanent (per-session) metadata associated with @p key.
*
* @see KIO::Integration::AccessManager::sessionMetaData
* @see setSessionMetaData
*
* @param key the key for the metadata to remove
*/
void removeSessionMetaData(const QString &key);
/**
* Remove an item of request metadata.
*
* Removes the temporary (per-request) metadata associated with @p key.
*
* @see KIO::Integration::AccessManager::requestMetaData
* @see setRequestMetaData
*
* @param key the key for the metadata to remove
*/
void removeRequestMetaData(const QString &key);
/**
* @reimp
*
* 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
* @p url, that user-agent will be returned. Otherwise, QWebPage's
* default user agent is returned.
*
* @see KProtocolManager::userAgentForHost.
* @see QWebPage::userAgentForUrl.
*/
virtual QString userAgentForUrl(const QUrl& url) const;
/**
* @reimp
*
* 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 QWebPage::acceptNavigationRequest
*/
virtual bool acceptNavigationRequest(QWebFrame * frame, const QNetworkRequest & request, NavigationType type);
/**
* Attempts to handle @p reply and returns true on success, false otherwise.
*
* In KDE 4.8 and higher, if @p 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.
*
* @param reply the QNetworkReply object to be handled.
* @param contentType if not null, it will be set to the content-type specified in @p reply, if any.
* @param metaData if not null, it will be set to the KIO meta-data specified in @p reply, if any.
* @since 4.6.3
*/
bool handleReply (QNetworkReply* reply, QString* contentType = 0, KIO::MetaData* metaData = 0);
private:
class KWebPagePrivate;
KWebPagePrivate* const d;
Q_PRIVATE_SLOT(d, void _k_copyResultToTempFile(KJob *))
};
Q_DECLARE_OPERATORS_FOR_FLAGS(KWebPage::Integration)
#endif // KWEBPAGE_H
|