class KParts.BrowserExtension


Table of contents
Modules
kparts Classes
All Classes
Module kparts
Namespace kparts
Class KParts.BrowserExtension
Inherits QObject

The Browser Extension is an extension (yes, no kidding) to KParts.ReadOnlyPart, which allows a better integration of parts with browsers (in particular Konqueror). Remember that ReadOnlyPart only has openUrl(KUrl) and a few arguments() but not much more. For full-fledged browsing, we need much more than that, including enabling/disabling of standard actions (print, copy, paste...), allowing parts to save and restore their data into the back/forward history, allowing parts to control the location bar URL, to requests URLs to be opened by the hosting browser, etc.

The part developer needs to define its own class derived from BrowserExtension, to implement the virtual methods [and the standard-actions slots, see below].

The way to associate the BrowserExtension with the part is to simply create the BrowserExtension as a child of the part (in QObject's terms). The hosting application will look for it automatically.

Another aspect of the browser integration is that a set of standard actions are provided by the browser, but implemented by the part (for the actions it supports).

The following standard actions are defined by the host of the view :

[selection-dependent actions]

  • cut : Copy selected items to clipboard and store 'not cut' in clipboard.
  • copy : Copy selected items to clipboard and store 'cut' in clipboard.
  • paste : Paste clipboard into view URL.
  • pasteTo(const KUrl &) : Paste clipboard into given URL.
  • rename : Rename item in place.
  • trash : Move selected items to trash.
  • del : Delete selected items (couldn't call it delete!).
  • shred : Shred selected items (secure deletion) - DEPRECATED.
  • properties : Show file/document properties.
  • editMimeType : show file/document's mimetype properties.
  • searchProvider : Lookup selected text at default search provider
  • [normal actions]

  • print : Print :-)
  • reparseConfiguration : Re-read configuration and apply it.
  • refreshMimeTypes : If the view uses mimetypes it should re-determine them.
  • The view defines a slot with the name of the action in order to implement the action. The browser will detect the slot automatically and connect its action to it when appropriate (i.e. when the view is active).

    The selection-dependent actions are disabled by default and the view should enable them when the selection changes, emitting enableAction().

    The normal actions do not depend on the selection. You need to enable 'print' when printing is possible - you can even do that in the constructor.

    A special case is the configuration slots, not connected to any action directly, and having parameters.

    [configuration slot]

  • setSaveViewPropertiesLocally( bool ): If true, view properties are saved into .directory
  • otherwise, they are saved globally.
  • disableScrolling: no scrollbars


  • enums

    enum details

    methods