# class BrowserRun

###

Module | kparts
Namespace | KParts
Class | BrowserRun
Inherits | KRun

This class extends KRun to provide additional functionality for browsers: - "save or open" dialog boxes - "save" functionality - support for HTTP POST (including saving the result to a temp file if opening a separate application) - warning before launching executables off the web - custom error handling (i.e. treating errors as HTML pages) - generation of SSL metadata depending on the previous URL shown by the part Author David Faure <faure@kde.org>

### enums

- AskEmbedOrSaveFlags { InlineDisposition, AttachmentDisposition }
- AskSaveResult { Save, Open, Cancel }
- NonEmbeddableResult { Handled, NotHandled, Delayed }

enum details

### methods

- BrowserRun (url, args, browserArgs, part, window, removeReferrer, trustedSource, hideErrorDialog)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  url | KUrl |
  args | KParts.OpenUrlArguments |
  browserArgs | KParts.BrowserArguments |
  part | KParts.ReadOnlyPart |
  window | QWidget |
  removeReferrer | bool |
  trustedSource | bool |
  hideErrorDialog | bool | 0

  url - the URL we're probing

  args - URL args - includes reload, metaData, etc.

  browserArgs - browser-related args - includes data for a HTTP POST, etc.

  part - the part going to open this URL - can be 0 if not created yet

  window - the mainwindow - passed to KIO.Job.setWindow()

  removeReferrer - if true, the "referrer" metadata from args isn't passed on

  trustedSource - if false, a warning will be shown before launching an executable. Always pass false for trustedSource, except for local directory views.

  hideErrorDialog - if true, no dialog will be shown in case of errors.

- allowExecution (mimeType, url)

  returns bool
  static

  Argument | Type | Default
  --- | --- | ---
  mimeType | QString |
  url | KUrl |

- arguments ( )

  returns KParts.OpenUrlArguments

- askEmbedOrSave (url, mimeType, suggestedFileName, flags)

  returns KParts::BrowserRun.AskSaveResult
  static

  Argument | Type | Default
  --- | --- | ---
  url | KUrl |
  mimeType | QString |
  suggestedFileName | QString | QString()
  flags | int | 0

  Similar to askSave but for the case where the current application is able to embed the url itself (instead of passing it to another app).

  url - the URL in question

  mimeType - the mimetype of the URL

  suggestedFileName - optional filename suggested by the server

  flags - set to AttachmentDisposition if suggested by the server Returns Save, Open or Cancel.

- askSave (url, offer, mimeType, suggestedFileName)

  returns KParts::BrowserRun.AskSaveResult
  static

  Argument | Type | Default
  --- | --- | ---
  url | KUrl |
  offer | KService.Ptr |
  mimeType | QString |
  suggestedFileName | QString | QString()

  Ask the user whether to save or open a url in another application.

  url - the URL in question

  offer - the application that will be used to open the URL

  mimeType - the mimetype of the URL

  suggestedFileName - optional file name suggested by the server Returns Save, Open or Cancel.

- browserArguments ( )

  returns KParts.BrowserArguments

- contentDisposition ( )

  returns QString

  Returns Suggested disposition by the server (e.g. HTTP content-disposition)

- handleError (job)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  job | KJob |

  Called when an error happens. NOTE: job could be 0, if you passed hideErrorDialog=true. The default implementation shows a message box, but only when job != 0 .... It is strongly recommended to reimplement this method if you passed hideErrorDialog=true.

- handleNonEmbeddable (mimeType)

  returns KParts::BrowserRun.NonEmbeddableResult
  Not implemented

  Argument | Type | Default
  --- | --- | ---
  mimeType | QString |

  Helper for foundMimeType: call this if the mimetype couldn't be embedded

- hideErrorDialog ( )

  returns bool

- init ( )

  returns Nothing

  Reimplemented from KRun

- isTextExecutable (mimeType)

  returns bool
  static

  Argument | Type | Default
  --- | --- | ---
  mimeType | QString |

- part ( )

  returns KParts.ReadOnlyPart

- save (url, suggestedFileName)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  url | KUrl |
  suggestedFileName | QString |

- scanFile ( )

  returns Nothing

  Reimplemented from KRun

- serverSuggestsSave ( )

  returns bool

- simpleSave (url, suggestedFileName, window)

  returns Nothing
  static

  Argument | Type | Default
  --- | --- | ---
  url | KUrl |
  suggestedFileName | QString |
  window | QWidget | 0

- slotBrowserMimetype (job, type)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  job | KIO.Job |
  type | QString |

- slotBrowserScanFinished (job)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  job | KJob |

- slotCopyToTempFileResult (job)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  job | KJob |

- slotStatResult (job)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  job | KJob |

- url ( )

  returns KUrl

### enums - detail

- AskEmbedOrSaveFlags { InlineDisposition, AttachmentDisposition }

  | InlineDisposition | - 0 | - |
  | AttachmentDisposition | - 1 | - |

- AskSaveResult { Save, Open, Cancel }

  | Save | - | - |
  | Open | - | - |
  | Cancel | - | - |

- NonEmbeddableResult { Handled, NotHandled, Delayed }

  NotHandled means that foundMimeType should call KRun.foundMimeType, i.e. launch an external app.

  | Handled | - | - |
  | NotHandled | - | - |
  | Delayed | - | - |