org.kde.koala

Class BrowserExtension

public class BrowserExtension extends 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), with no other settings. For full-fledged browsing, we need much more than that, including many arguments about how to open this URL (see URLArgs), 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 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(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( boolean ): If true, view properties are saved into .directory otherwise, they are saved globally.
  • disableScrolling: no scrollbars
  • See BrowserExtensionSignals for signals emitted by BrowserExtension

    UNKNOWN: The Browser Extension is an extension (yes, no kidding) to KParts.ReadOnlyPart, which allows a better integration of parts with browsers (in particular Konqueror).

    Constructor Summary
    protected BrowserExtension(Class dummy)
    BrowserExtension(ReadOnlyPart parent, String name)
    Constructor
    BrowserExtension(ReadOnlyPart parent)
    Method Summary
    StringactionText(String name)
    BrowserInterfacebrowserInterface()
    static BrowserExtensionchildObject(QObject arg1)
    Queries obj for a child object which inherits from this BrowserExtension class.
    StringclassName()
    booleanisActionEnabled(String name)
    booleanisURLDropHandlingEnabled()
    Returns whether url drop handling is enabled.
    QMetaObjectmetaObject()
    voidpasteRequest()
    Asks the hosting browser to perform a paste (using openURLRequestDelayed)
    voidrestoreState(QDataStream stream)
    Used by the browser to restore the view in the state it was when we left it.
    voidsaveState(QDataStream stream)
    Used by the browser to save the current state of the view (in order to restore it if going back in navigation).
    voidsetBrowserInterface(BrowserInterface impl)
    voidsetURLArgs(URLArgs args)
    Set the parameters to use for opening the next URL.
    voidsetURLDropHandlingEnabled(boolean enable)
    Enables or disables url drop handling.
    URLArgsurlArgs()
    Retrieve the set of parameters to use for opening the URL (this must be called from openURL() in the part).
    intxOffset()
    Returns the current x offset.
    intyOffset()
    Returns the current y offset.

    Constructor Detail

    BrowserExtension

    protected BrowserExtension(Class dummy)

    BrowserExtension

    public BrowserExtension(ReadOnlyPart parent, String name)
    Constructor

    Parameters: parent The KParts.ReadOnlyPart that this extension ... "extends" :) name An optional name for the extension.

    UNKNOWN: Constructor

    BrowserExtension

    public BrowserExtension(ReadOnlyPart parent)

    Method Detail

    actionText

    public String actionText(String name)

    Returns: the text of an action, if it was set explicitely by the part. When the setActionText signal is emitted, the browserextension stores the text of the action internally, so that it's possible to query later for the text of the action, using this method.

    UNKNOWN:

    browserInterface

    public BrowserInterface browserInterface()

    childObject

    public static BrowserExtension childObject(QObject arg1)
    Queries obj for a child object which inherits from this BrowserExtension class. Convenience method.

    UNKNOWN: Queries obj for a child object which inherits from this BrowserExtension class.

    className

    public String className()

    isActionEnabled

    public boolean isActionEnabled(String name)

    Returns: the status (enabled/disabled) of an action. When the enableAction signal is emitted, the browserextension stores the status of the action internally, so that it's possible to query later for the status of the action, using this method.

    UNKNOWN:

    isURLDropHandlingEnabled

    public boolean isURLDropHandlingEnabled()
    Returns whether url drop handling is enabled. See setURLDropHandlingEnabled for more information about this property.

    UNKNOWN: Returns whether url drop handling is enabled.

    metaObject

    public QMetaObject metaObject()

    pasteRequest

    public void pasteRequest()
    Asks the hosting browser to perform a paste (using openURLRequestDelayed)

    UNKNOWN: Asks the hosting browser to perform a paste (using openURLRequestDelayed)

    restoreState

    public void restoreState(QDataStream stream)
    Used by the browser to restore the view in the state it was when we left it. If you saved additional properties, reimplement it but don't forget to call the parent method (probably first).

    UNKNOWN: Used by the browser to restore the view in the state it was when we left it.

    saveState

    public void saveState(QDataStream stream)
    Used by the browser to save the current state of the view (in order to restore it if going back in navigation). If you want to save additional properties, reimplement it but don't forget to call the parent method (probably first).

    UNKNOWN: Used by the browser to save the current state of the view (in order to restore it if going back in navigation).

    setBrowserInterface

    public void setBrowserInterface(BrowserInterface impl)

    setURLArgs

    public void setURLArgs(URLArgs args)
    Set the parameters to use for opening the next URL. This is called by the "hosting" application, to pass parameters to the part.

    See Also: URLArgs

    UNKNOWN: Set the parameters to use for opening the next URL.

    setURLDropHandlingEnabled

    public void setURLDropHandlingEnabled(boolean enable)
    Enables or disables url drop handling. URL drop handling is a property describing whether the hosting shell component is allowed to install an event filter on the part's widget, to listen for URI drop events. Set it to true if you are exporting a BrowserExtension implementation and do not provide any special URI drop handling. If set to false you can be sure to receive all those URI drop events unfiltered. Also note that the implementation as of Konqueror installs the event filter only on the part's widget itself, not on child widgets.

    UNKNOWN: Enables or disables url drop handling.

    urlArgs

    public URLArgs urlArgs()
    Retrieve the set of parameters to use for opening the URL (this must be called from openURL() in the part).

    See Also: URLArgs

    UNKNOWN: Retrieve the set of parameters to use for opening the URL (this must be called from openURL() in the part).

    xOffset

    public int xOffset()
    Returns the current x offset. For a scrollview, implement this using contentsX().

    UNKNOWN: Returns the current x offset.

    yOffset

    public int yOffset()
    Returns the current y offset. For a scrollview, implement this using contentsY().

    UNKNOWN: Returns the current y offset.