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

KDEWebKit

  • kdewebkit
kwebpage.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of the KDE project.
3  *
4  * Copyright (C) 2008 Dirk Mueller <mueller@kde.org>
5  * Copyright (C) 2008 Urs Wolfer <uwolfer @ kde.org>
6  * Copyright (C) 2008 Michael Howell <mhowell123@gmail.com>
7  * Copyright (C) 2009,2010 Dawit Alemayehu <adawit@kde.org>
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Library General Public
11  * License as published by the Free Software Foundation; either
12  * version 2 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Library General Public License for more details.
18  *
19  * You should have received a copy of the GNU Library General Public License
20  * along with this library; see the file COPYING.LIB. If not, write to
21  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22  * Boston, MA 02110-1301, USA.
23  *
24  */
25 
26 // Own
27 #include "kwebpage.h"
28 #include "kwebwallet.h"
29 
30 // Local
31 #include "kwebpluginfactory.h"
32 
33 // KDE
34 #include <kaction.h>
35 #include <kfiledialog.h>
36 #include <kprotocolmanager.h>
37 #include <kjobuidelegate.h>
38 #include <krun.h>
39 #include <kstandarddirs.h>
40 #include <kstandardshortcut.h>
41 #include <kurl.h>
42 #include <kdebug.h>
43 #include <kshell.h>
44 #include <kmimetypetrader.h>
45 #include <klocalizedstring.h>
46 #include <ktemporaryfile.h>
47 #include <kio/accessmanager.h>
48 #include <kio/job.h>
49 #include <kio/copyjob.h>
50 #include <kio/jobuidelegate.h>
51 #include <kio/renamedialog.h>
52 #include <kio/scheduler.h>
53 #include <kparts/browseropenorsavequestion.h>
54 
55 // Qt
56 #include <QtCore/QPointer>
57 #include <QtCore/QFileInfo>
58 #include <QtCore/QCoreApplication>
59 #include <QtWebKit/QWebFrame>
60 #include <QtNetwork/QNetworkReply>
61 
62 
63 #define QL1S(x) QLatin1String(x)
64 #define QL1C(x) QLatin1Char(x)
65 
66 static void reloadRequestWithoutDisposition (QNetworkReply* reply)
67 {
68  QNetworkRequest req (reply->request());
69  req.setRawHeader("x-kdewebkit-ignore-disposition", "true");
70 
71  QWebFrame* frame = qobject_cast<QWebFrame*> (req.originatingObject());
72  if (!frame)
73  return;
74 
75  frame->load(req);
76 }
77 
78 static bool isMimeTypeAssociatedWithSelf(const KService::Ptr &offer)
79 {
80  if (!offer)
81  return false;
82 
83  kDebug(800) << offer->desktopEntryName();
84 
85  const QString& appName = QCoreApplication::applicationName();
86 
87  if (appName == offer->desktopEntryName() || offer->exec().trimmed().startsWith(appName))
88  return true;
89 
90  // konqueror exception since it uses kfmclient to open html content...
91  if (appName == QL1S("konqueror") && offer->exec().trimmed().startsWith(QL1S("kfmclient")))
92  return true;
93 
94  return false;
95 }
96 
97 static void extractMimeType(const QNetworkReply* reply, QString& mimeType)
98 {
99  mimeType.clear();
100  const KIO::MetaData& metaData = reply->attribute(static_cast<QNetworkRequest::Attribute>(KIO::AccessManager::MetaData)).toMap();
101  if (metaData.contains(QL1S("content-type")))
102  mimeType = metaData.value(QL1S("content-type"));
103 
104  if (!mimeType.isEmpty())
105  return;
106 
107  if (!reply->hasRawHeader("Content-Type"))
108  return;
109 
110  const QString value (QL1S(reply->rawHeader("Content-Type").simplified().constData()));
111  const int index = value.indexOf(QL1C(';'));
112  mimeType = ((index == -1) ? value : value.left(index));
113 }
114 
115 static bool downloadResource (const KUrl& srcUrl, const QString& suggestedName = QString(),
116  QWidget* parent = 0, const KIO::MetaData& metaData = KIO::MetaData())
117 {
118  const QString fileName = suggestedName.isEmpty() ? srcUrl.fileName() : suggestedName;
119  // convert filename to URL using fromPath to avoid trouble with ':' in filenames (#184202)
120  KUrl destUrl = KFileDialog::getSaveFileName(KUrl::fromPath(fileName), QString(), parent);
121  if (!destUrl.isValid())
122  return false;
123 
124  // Using KIO::copy rather than file_copy, to benefit from "dest already exists" dialogs.
125  KIO::Job *job = KIO::copy(srcUrl, destUrl);
126 
127  if (!metaData.isEmpty())
128  job->setMetaData(metaData);
129 
130  job->addMetaData(QL1S("MaxCacheSize"), QL1S("0")); // Don't store in http cache.
131  job->addMetaData(QL1S("cache"), QL1S("cache")); // Use entry from cache if available.
132  job->ui()->setWindow((parent ? parent->window() : 0));
133  job->ui()->setAutoErrorHandlingEnabled(true);
134  return true;
135 }
136 
137 static bool isReplyStatusOk(const QNetworkReply* reply)
138 {
139  if (!reply || reply->error() != QNetworkReply::NoError)
140  return false;
141 
142  // Check HTTP status code only for http and webdav protocols...
143  const QString scheme = reply->url().scheme();
144  if (scheme.startsWith(QLatin1String("http"), Qt::CaseInsensitive) ||
145  scheme.startsWith(QLatin1String("webdav"), Qt::CaseInsensitive)) {
146  bool ok = false;
147  const int statusCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(&ok);
148  if (!ok || statusCode < 200 || statusCode > 299)
149  return false;
150  }
151 
152  return true;
153 }
154 
155 class KWebPage::KWebPagePrivate
156 {
157 public:
158  KWebPagePrivate(KWebPage* page)
159  : q(page)
160  , inPrivateBrowsingMode(false)
161  {
162  }
163 
164  QWidget* windowWidget()
165  {
166  return (window ? window.data() : q->view());
167  }
168 
169  void _k_copyResultToTempFile(KJob* job)
170  {
171  KIO::FileCopyJob* cJob = qobject_cast<KIO::FileCopyJob *>(job);
172  if (cJob && !cJob->error() ) {
173  // Same as KRun::foundMimeType but with a different URL
174  (void)KRun::runUrl(cJob->destUrl(), mimeType, window);
175  }
176  }
177 
178  void _k_receivedContentType(KIO::Job* job, const QString& mimetype)
179  {
180  KIO::TransferJob* tJob = qobject_cast<KIO::TransferJob*>(job);
181  if (tJob && !tJob->error()) {
182  tJob->putOnHold();
183  KIO::Scheduler::publishSlaveOnHold();
184  // Get suggested file name...
185  mimeType = mimetype;
186  const QString suggestedFileName (tJob->queryMetaData(QL1S("content-disposition-filename")));
187  // kDebug(800) << "suggested filename:" << suggestedFileName << ", mimetype:" << mimetype;
188  (void) downloadResource(tJob->url(), suggestedFileName, window, tJob->metaData());
189  }
190  }
191 
192  void _k_contentTypeCheckFailed(KJob* job)
193  {
194  KIO::TransferJob* tJob = qobject_cast<KIO::TransferJob*>(job);
195  // On error simply call downloadResource which will probably fail as well.
196  if (tJob && tJob->error()) {
197  (void)downloadResource(tJob->url(), QString(), window, tJob->metaData());
198  }
199  }
200 
201  KWebPage* q;
202  QPointer<QWidget> window;
203  QString mimeType;
204  QPointer<KWebWallet> wallet;
205  bool inPrivateBrowsingMode;
206 };
207 
208 static void setActionIcon(QAction* action, const QIcon& icon)
209 {
210  if (action) {
211  action->setIcon(icon);
212  }
213 }
214 
215 static void setActionShortcut(QAction* action, const KShortcut& shortcut)
216 {
217  if (action) {
218  action->setShortcuts(shortcut.toList());
219  }
220 }
221 
222 KWebPage::KWebPage(QObject *parent, Integration flags)
223  :QWebPage(parent), d(new KWebPagePrivate(this))
224 {
225  // KDE KParts integration for <embed> tag...
226  if (!flags || (flags & KPartsIntegration))
227  setPluginFactory(new KWebPluginFactory(this));
228 
229  QWidget *parentWidget = qobject_cast<QWidget*>(parent);
230  d->window = (parentWidget ? parentWidget->window() : 0);
231 
232  // KDE IO (KIO) integration...
233  if (!flags || (flags & KIOIntegration)) {
234  KIO::Integration::AccessManager *manager = new KIO::Integration::AccessManager(this);
235  // Disable QtWebKit's internal cache to avoid duplication with the one in KIO...
236  manager->setCache(0);
237  manager->setWindow(d->window);
238  manager->setEmitReadyReadOnMetaDataChange(true);
239  setNetworkAccessManager(manager);
240  }
241 
242  // KWallet integration...
243  if (!flags || (flags & KWalletIntegration)) {
244  setWallet(new KWebWallet(0, (d->window ? d->window->winId() : 0) ));
245  }
246 
247  setActionIcon(action(Back), KIcon("go-previous"));
248  setActionIcon(action(Forward), KIcon("go-next"));
249  setActionIcon(action(Reload), KIcon("view-refresh"));
250  setActionIcon(action(Stop), KIcon("process-stop"));
251  setActionIcon(action(Cut), KIcon("edit-cut"));
252  setActionIcon(action(Copy), KIcon("edit-copy"));
253  setActionIcon(action(Paste), KIcon("edit-paste"));
254  setActionIcon(action(Undo), KIcon("edit-undo"));
255  setActionIcon(action(Redo), KIcon("edit-redo"));
256  setActionIcon(action(InspectElement), KIcon("view-process-all"));
257  setActionIcon(action(OpenLinkInNewWindow), KIcon("window-new"));
258  setActionIcon(action(OpenFrameInNewWindow), KIcon("window-new"));
259  setActionIcon(action(OpenImageInNewWindow), KIcon("window-new"));
260  setActionIcon(action(CopyLinkToClipboard), KIcon("edit-copy"));
261  setActionIcon(action(CopyImageToClipboard), KIcon("edit-copy"));
262  setActionIcon(action(ToggleBold), KIcon("format-text-bold"));
263  setActionIcon(action(ToggleItalic), KIcon("format-text-italic"));
264  setActionIcon(action(ToggleUnderline), KIcon("format-text-underline"));
265  setActionIcon(action(DownloadLinkToDisk), KIcon("document-save"));
266  setActionIcon(action(DownloadImageToDisk), KIcon("document-save"));
267 
268  settings()->setWebGraphic(QWebSettings::MissingPluginGraphic, KIcon("preferences-plugin").pixmap(32, 32));
269  settings()->setWebGraphic(QWebSettings::MissingImageGraphic, KIcon("image-missing").pixmap(32, 32));
270  settings()->setWebGraphic(QWebSettings::DefaultFrameIconGraphic, KIcon("applications-internet").pixmap(32, 32));
271 
272  setActionShortcut(action(Back), KStandardShortcut::back());
273  setActionShortcut(action(Forward), KStandardShortcut::forward());
274  setActionShortcut(action(Reload), KStandardShortcut::reload());
275  setActionShortcut(action(Stop), KShortcut(QKeySequence(Qt::Key_Escape)));
276  setActionShortcut(action(Cut), KStandardShortcut::cut());
277  setActionShortcut(action(Copy), KStandardShortcut::copy());
278  setActionShortcut(action(Paste), KStandardShortcut::paste());
279  setActionShortcut(action(Undo), KStandardShortcut::undo());
280  setActionShortcut(action(Redo), KStandardShortcut::redo());
281  setActionShortcut(action(SelectAll), KStandardShortcut::selectAll());
282 }
283 
284 KWebPage::~KWebPage()
285 {
286  delete d;
287 }
288 
289 bool KWebPage::isExternalContentAllowed() const
290 {
291  KIO::AccessManager *manager = qobject_cast<KIO::AccessManager*>(networkAccessManager());
292  if (manager)
293  return manager->isExternalContentAllowed();
294  return true;
295 }
296 
297 KWebWallet *KWebPage::wallet() const
298 {
299  return d->wallet;
300 }
301 
302 void KWebPage::setAllowExternalContent(bool allow)
303 {
304  KIO::AccessManager *manager = qobject_cast<KIO::AccessManager*>(networkAccessManager());
305  if (manager)
306  manager->setExternalContentAllowed(allow);
307 }
308 
309 void KWebPage::setWallet(KWebWallet* wallet)
310 {
311  // Delete the current wallet if this object is its parent...
312  if (d->wallet && this == d->wallet->parent())
313  delete d->wallet;
314 
315  d->wallet = wallet;
316 
317  if (d->wallet)
318  d->wallet->setParent(this);
319 }
320 
321 
322 void KWebPage::downloadRequest(const QNetworkRequest& request)
323 {
324  KIO::TransferJob* job = KIO::get(request.url());
325  connect(job, SIGNAL(mimetype(KIO::Job*,QString)),
326  this, SLOT(_k_receivedContentType(KIO::Job*,QString)));
327  connect(job, SIGNAL(result(KJob*)),
328  this, SLOT(_k_receivedContentTypeResult(KJob*)));
329 
330  job->setMetaData(request.attribute(static_cast<QNetworkRequest::Attribute>(KIO::AccessManager::MetaData)).toMap());
331  job->addMetaData(QL1S("MaxCacheSize"), QL1S("0")); // Don't store in http cache.
332  job->addMetaData(QL1S("cache"), QL1S("cache")); // Use entry from cache if available.
333  job->ui()->setWindow(d->windowWidget());
334 }
335 
336 void KWebPage::downloadUrl(const KUrl &url)
337 {
338  downloadRequest(QNetworkRequest(url));
339 }
340 
341 void KWebPage::downloadResponse(QNetworkReply *reply)
342 {
343  Q_ASSERT(reply);
344 
345  if (!reply)
346  return;
347 
348  // Put the job on hold only for the protocols we know about (read: http).
349  KIO::Integration::AccessManager::putReplyOnHold(reply);
350 
351  QString mimeType;
352  KIO::MetaData metaData;
353 
354  if (handleReply(reply, &mimeType, &metaData)) {
355  return;
356  }
357 
358  const KUrl replyUrl (reply->url());
359 
360  // Ask KRun to handle the response when mimetype is unknown
361  if (mimeType.isEmpty()) {
362  (void)new KRun(replyUrl, d->windowWidget(), 0 , replyUrl.isLocalFile());
363  return;
364  }
365 
366  // Ask KRun::runUrl to handle the response when mimetype is inode/*
367  if (mimeType.startsWith(QL1S("inode/"), Qt::CaseInsensitive) &&
368  KRun::runUrl(replyUrl, mimeType, d->windowWidget(), false, false,
369  metaData.value(QL1S("content-disposition-filename")))) {
370  return;
371  }
372 }
373 
374 QString KWebPage::sessionMetaData(const QString &key) const
375 {
376  QString value;
377 
378  KIO::Integration::AccessManager *manager = qobject_cast<KIO::Integration::AccessManager *>(networkAccessManager());
379  if (manager)
380  value = manager->sessionMetaData().value(key);
381 
382  return value;
383 }
384 
385 QString KWebPage::requestMetaData(const QString &key) const
386 {
387  QString value;
388 
389  KIO::Integration::AccessManager *manager = qobject_cast<KIO::Integration::AccessManager *>(networkAccessManager());
390  if (manager)
391  value = manager->requestMetaData().value(key);
392 
393  return value;
394 }
395 
396 void KWebPage::setSessionMetaData(const QString &key, const QString &value)
397 {
398  KIO::Integration::AccessManager *manager = qobject_cast<KIO::Integration::AccessManager *>(networkAccessManager());
399  if (manager)
400  manager->sessionMetaData()[key] = value;
401 }
402 
403 void KWebPage::setRequestMetaData(const QString &key, const QString &value)
404 {
405  KIO::Integration::AccessManager *manager = qobject_cast<KIO::Integration::AccessManager *>(networkAccessManager());
406  if (manager)
407  manager->requestMetaData()[key] = value;
408 }
409 
410 void KWebPage::removeSessionMetaData(const QString &key)
411 {
412  KIO::Integration::AccessManager *manager = qobject_cast<KIO::Integration::AccessManager *>(networkAccessManager());
413  if (manager)
414  manager->sessionMetaData().remove(key);
415 }
416 
417 void KWebPage::removeRequestMetaData(const QString &key)
418 {
419  KIO::Integration::AccessManager *manager = qobject_cast<KIO::Integration::AccessManager *>(networkAccessManager());
420  if (manager)
421  manager->requestMetaData().remove(key);
422 }
423 
424 QString KWebPage::userAgentForUrl(const QUrl& _url) const
425 {
426  const KUrl url(_url);
427  const QString userAgent = KProtocolManager::userAgentForHost((url.isLocalFile() ? QL1S("localhost") : url.host()));
428 
429  if (userAgent == KProtocolManager::defaultUserAgent())
430  return QWebPage::userAgentForUrl(_url);
431 
432  return userAgent;
433 }
434 
435 static void setDisableCookieJarStorage(QNetworkAccessManager* manager, bool status)
436 {
437  if (manager) {
438  KIO::Integration::CookieJar *cookieJar = manager ? qobject_cast<KIO::Integration::CookieJar*>(manager->cookieJar()) : 0;
439  if (cookieJar) {
440  //kDebug(800) << "Store cookies ?" << !status;
441  cookieJar->setDisableCookieStorage(status);
442  }
443  }
444 }
445 
446 bool KWebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, NavigationType type)
447 {
448  kDebug(800) << "url:" << request.url() << ", type:" << type << ", frame:" << frame;
449 
450  if (frame && d->wallet && type == QWebPage::NavigationTypeFormSubmitted)
451  d->wallet->saveFormData(frame);
452 
453  // Make sure nothing is cached when private browsing mode is enabled...
454  if (settings()->testAttribute(QWebSettings::PrivateBrowsingEnabled)) {
455  if (!d->inPrivateBrowsingMode) {
456  setDisableCookieJarStorage(networkAccessManager(), true);
457  setSessionMetaData(QL1S("no-cache"), QL1S("true"));
458  d->inPrivateBrowsingMode = true;
459  }
460  } else {
461  if (d->inPrivateBrowsingMode) {
462  setDisableCookieJarStorage(networkAccessManager(), false);
463  removeSessionMetaData(QL1S("no-cache"));
464  d->inPrivateBrowsingMode = false;
465  }
466  }
467 
468  /*
469  If the navigation request is from the main frame, set the cross-domain
470  meta-data value to the current url for proper integration with KCookieJar...
471  */
472  if (frame == mainFrame() && type != QWebPage::NavigationTypeReload)
473  setSessionMetaData(QL1S("cross-domain"), request.url().toString());
474 
475  return QWebPage::acceptNavigationRequest(frame, request, type);
476 }
477 
478 bool KWebPage::handleReply(QNetworkReply* reply, QString* contentType, KIO::MetaData* metaData)
479 {
480  // Reply url...
481  const KUrl replyUrl (reply->url());
482 
483  // Get suggested file name...
484  const KIO::MetaData& data = reply->attribute(static_cast<QNetworkRequest::Attribute>(KIO::AccessManager::MetaData)).toMap();
485  const QString suggestedFileName = data.value(QL1S("content-disposition-filename"));
486  if (metaData) {
487  *metaData = data;
488  }
489 
490  // Get the mime-type...
491  QString mimeType;
492  extractMimeType(reply, mimeType);
493  if (contentType) {
494  *contentType = mimeType;
495  }
496 
497  // Let the calling function deal with handling empty or inode/* mimetypes...
498  if (mimeType.isEmpty() || mimeType.startsWith(QL1S("inode/"), Qt::CaseInsensitive)) {
499  return false;
500  }
501 
502  // Convert executable text files to plain text...
503  if (KParts::BrowserRun::isTextExecutable(mimeType))
504  mimeType = QL1S("text/plain");
505 
506  //kDebug(800) << "Content-disposition:" << suggestedFileName;
507  //kDebug(800) << "Got unsupported content of type:" << mimeType << "URL:" << replyUrl;
508  //kDebug(800) << "Error code:" << reply->error() << reply->errorString();
509 
510  if (isReplyStatusOk(reply)) {
511  while (true) {
512  KParts::BrowserOpenOrSaveQuestion::Result result;
513  KParts::BrowserOpenOrSaveQuestion dlg(d->windowWidget(), replyUrl, mimeType);
514  dlg.setSuggestedFileName(suggestedFileName);
515  dlg.setFeatures(KParts::BrowserOpenOrSaveQuestion::ServiceSelection);
516  result = dlg.askOpenOrSave();
517 
518  switch (result) {
519  case KParts::BrowserOpenOrSaveQuestion::Open:
520  // Handle Post operations that return content...
521  if (reply->operation() == QNetworkAccessManager::PostOperation) {
522  d->mimeType = mimeType;
523  QFileInfo finfo (suggestedFileName.isEmpty() ? replyUrl.fileName() : suggestedFileName);
524  KTemporaryFile tempFile;
525  tempFile.setSuffix(QL1C('.') + finfo.suffix());
526  tempFile.setAutoRemove(false);
527  tempFile.open();
528  KUrl destUrl;
529  destUrl.setPath(tempFile.fileName());
530  KIO::Job *job = KIO::file_copy(replyUrl, destUrl, 0600, KIO::Overwrite);
531  job->ui()->setWindow(d->windowWidget());
532  job->ui()->setAutoErrorHandlingEnabled(true);
533  connect(job, SIGNAL(result(KJob*)),
534  this, SLOT(_k_copyResultToTempFile(KJob*)));
535  return true;
536  }
537 
538  // Ask before running any executables...
539  if (KParts::BrowserRun::allowExecution(mimeType, replyUrl)) {
540  KService::Ptr offer = dlg.selectedService();
541  // HACK: The check below is necessary to break an infinite
542  // recursion that occurs whenever this function is called as a result
543  // of receiving content that can be rendered by the app using this engine.
544  // For example a text/html header that containing a content-disposition
545  // header is received by the app using this class.
546  if (isMimeTypeAssociatedWithSelf(offer)) {
547  reloadRequestWithoutDisposition(reply);
548  } else {
549  KUrl::List list;
550  list.append(replyUrl);
551  bool success = false;
552  // kDebug(800) << "Suggested file name:" << suggestedFileName;
553  if (offer) {
554  success = KRun::run(*offer, list, d->windowWidget() , false, suggestedFileName);
555  } else {
556  success = KRun::displayOpenWithDialog(list, d->windowWidget(), false, suggestedFileName);
557  if (!success)
558  break;
559  }
560  // For non KIO apps and cancelled Open With dialog, remove slave on hold.
561  if (!success || (offer && !offer->categories().contains(QL1S("KDE")))) {
562  KIO::SimpleJob::removeOnHold(); // Remove any slave-on-hold...
563  }
564  }
565  return true;
566  }
567  // TODO: Instead of silently failing when allowExecution fails, notify
568  // the user why the requested action cannot be fulfilled...
569  return false;
570  case KParts::BrowserOpenOrSaveQuestion::Save:
571  // Do not download local files...
572  if (!replyUrl.isLocalFile()) {
573  QString downloadCmd (reply->property("DownloadManagerExe").toString());
574  if (!downloadCmd.isEmpty()) {
575  downloadCmd += QLatin1Char(' ');
576  downloadCmd += KShell::quoteArg(replyUrl.url());
577  if (!suggestedFileName.isEmpty()) {
578  downloadCmd += QLatin1Char(' ');
579  downloadCmd += KShell::quoteArg(suggestedFileName);
580  }
581  // kDebug(800) << "download command:" << downloadCmd;
582  if (KRun::runCommand(downloadCmd, view()))
583  return true;
584  }
585  if (!downloadResource(replyUrl, suggestedFileName, d->windowWidget()))
586  break;
587  }
588  return true;
589  case KParts::BrowserOpenOrSaveQuestion::Cancel:
590  default:
591  KIO::SimpleJob::removeOnHold(); // Remove any slave-on-hold...
592  return true;
593  }
594  }
595  } else {
596  KService::Ptr offer = KMimeTypeTrader::self()->preferredService(mimeType);
597  if (isMimeTypeAssociatedWithSelf(offer)) {
598  reloadRequestWithoutDisposition(reply);
599  return true;
600  }
601  }
602 
603  return false;
604 }
605 
606 #include "kwebpage.moc"
607 
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Mon Dec 10 2012 14:00:53 by doxygen 1.8.1.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEWebKit

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

kdelibs-4.9.4 API Reference

Skip menu "kdelibs-4.9.4 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
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
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