# class BrowserExtension | The following standard actions are defined by the host of the view : More...
Full name | `KParts::BrowserExtension`
Definition | `#include <browserextension.h>`
Inherits | QObject (qt) [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Types

- typedef QMap<QCString,QCString> ActionSlotMap
- typedef QMap<QCString,int> ActionNumberMap

#### Public Methods

- BrowserExtension ( KParts::ReadOnlyPart *parent, const char *name = 0L )
- virtual ~BrowserExtension ()
- virtual void setURLArgs ( const URLArgs &args )
- virtual URLArgs urlArgs ()
- virtual int xOffset ()
- virtual int yOffset ()
- virtual void saveState ( QDataStream &stream )
- virtual void restoreState ( QDataStream &stream )
- bool isURLDropHandlingEnabled () const
- void setURLDropHandlingEnabled ( bool enable )
- bool isActionEnabled ( const char * name ) const

#### Signals

- void enableAction ( const char * name, bool enabled )
- void openURLRequest ( const KURL &url, const KParts::URLArgs &args = KParts::URLArgs() )
- void openURLRequestDelayed ( const KURL &url, const KParts::URLArgs &args = KParts::URLArgs() )
- void openURLNotify ()
- void setLocationBarURL ( const QString &url )
- void setIconURL ( const KURL &url )
- void createNewWindow ( const KURL &url, const KParts::URLArgs &args = KParts::URLArgs() )
- void createNewWindow ( const KURL &url, const KParts::URLArgs &args, const KParts::WindowArgs &windowArgs, KParts::ReadOnlyPart *&part )
- void loadingProgress ( int percent )
- void speedProgress ( int bytesPerSecond )
- void infoMessage ( const QString & )
- void popupMenu ( const QPoint &global, const KFileItemList &items )
- void popupMenu ( KXMLGUIClient *client, const QPoint &global, const KFileItemList &items )
- void popupMenu ( const QPoint &global, const KURL &url, const QString &mimeType, mode_t mode = (mode_t)-1 )
- void popupMenu ( KXMLGUIClient *client, const QPoint &global, const KURL &url, const QString &mimeType, mode_t mode = (mode_t)-1 )
- void selectionInfo ( const KFileItemList &items )
- void selectionInfo ( const QString &text )
- void selectionInfo ( const KURL::List &urls )

#### Public Static Methods

- static ActionSlotMap actionSlotMap ()
- static ActionSlotMap * actionSlotMapPtr ()
- static BrowserExtension * childObject ( QObject *obj )

## Detailed Description

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 selected items.
- `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).
- `properties` : Show file/document properties.
- `editMimeType` : show file/document's mimetype properties.

[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. For each slot that is defined in the second list, the action is automatically enabled.

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.

BrowserExtension ( KParts::ReadOnlyPart *parent, const char *name = 0L ) | ### BrowserExtension

Constructor

Parameters:

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

~BrowserExtension () | ### ~BrowserExtension

[virtual]

void setURLArgs ( const URLArgs &args ) | ### setURLArgs

[virtual]

URLArgs urlArgs () | ### urlArgs

[virtual]

int xOffset () | ### xOffset

[virtual]

Returns the current x offset.

For a scrollview, implement this using contentsX().

int yOffset () | ### yOffset

[virtual]

Returns the current y offset.

For a scrollview, implement this using contentsY().

void saveState ( QDataStream &stream ) | ### saveState

[virtual]

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 additionnal properties, reimplement it but don't forget to call the parent method (probably first).

void restoreState ( QDataStream &stream ) | ### restoreState

[virtual]

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

If you saved additionnal properties, reimplement it but don't forget to call the parent method (probably first).

bool isURLDropHandlingEnabled () | ### isURLDropHandlingEnabled

[const]

void setURLDropHandlingEnabled ( bool enable ) | ### setURLDropHandlingEnabled

bool isActionEnabled ( const char * name ) | ### isActionEnabled

[const]

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.

typedef QMap<QCString,QCString> ActionSlotMap | ### ActionSlotMap

ActionSlotMap actionSlotMap () | ### actionSlotMap

[static]

Retrieve a map containing the action names as keys and corresponding SLOT()'ified method names as data entries.

This is very useful for the host component, when connecting the own signals with the extension's slots. Basically you iterate over the map, check if the extension implements the slot and connect to the slot using the data value of your map iterator. Checking if the extension implements a certain slot can be done like this:

       extension->metaObject()->slotNames().contains( actionName + "()" )

(note that `actionName` is the iterator's key value if already iterating over the action slot map, returned by this method)

Connecting to the slot can be done like this:

       connect( yourObject, SIGNAL( yourSignal() ),
                extension, mapIterator.data() )

(where "mapIterator" is your QMap<QCString,QCString> iterator)

ActionSlotMap * actionSlotMapPtr () | ### actionSlotMapPtr

[static]

Returns: a pointer to the static action-slot map. Preferred method to get it. The map is created if it doesn't exist yet

BrowserExtension * childObject ( QObject *obj ) | ### childObject

[static]

Queries `obj` for a child object which inherits from this BrowserExtension class. Convenience method.

void enableAction ( const char * name, bool enabled ) | ### enableAction

[signal]

Enable or disable a standard action held by the browser.

See class documentation for the list of standard actions.

void openURLRequest ( const KURL &url, const KParts::URLArgs &args = KParts::URLArgs() ) | ### openURLRequest

[signal]

Ask the host (browser) to open `url` To set a reload, the x and y offsets, the service type etc., fill in the appropriate fields in the `args` structure. Hosts should not connect to this signal but to openURLRequestDelayed.

void openURLRequestDelayed ( const KURL &url, const KParts::URLArgs &args = KParts::URLArgs() ) | ### openURLRequestDelayed

[signal]

This signal is emitted when openURLRequest is called, after a 0-seconds timer. This allows the caller to terminate what it's doing first, before (usually) being destroyed. Parts should never use this signal, hosts should only connect to this signal.

void openURLNotify () | ### openURLNotify

[signal]

Tell the hosting browser that the part opened a new URL (which can be queried via KParts::Part::url().

This helps the browser to update/create an entry in the history. The part may not emit this signal together with openURLRequest(). Emit openURLRequest() if you want the browser to handle a URL the user asked to open (from within your part/document). This signal however is useful if you want to handle URLs all yourself internally, while still telling the hosting browser about new opened URLs, in order to provide a proper history functionality to the user. An example of usage is a html rendering component which wants to emit this signal when a child frame document changed its URL. Conclusion: you probably want to use openURLRequest() instead

void setLocationBarURL ( const QString &url ) | ### setLocationBarURL

[signal]

Update the URL shown in the browser's location bar to `url`.

void setIconURL ( const KURL &url ) | ### setIconURL

[signal]

URL of an icon for the currently displayed page

void createNewWindow ( const KURL &url, const KParts::URLArgs &args = KParts::URLArgs() ) | ### createNewWindow

[signal]

Ask the hosting browser to open a new window for the given `url`.

The `args` argument is optional additionnal information for the browser,

See also: URLArgs

void createNewWindow ( const KURL &url, const KParts::URLArgs &args, const KParts::WindowArgs &windowArgs, KParts::ReadOnlyPart *&part ) | ### createNewWindow

[signal]

Ask the hosting browser to open a new window for the given `url` and return a reference to the content part. The request for a reference to the part is only fullfilled/processed if the serviceType is set in the `args` . (otherwise the request cannot be processed synchroniously.

void loadingProgress ( int percent ) | ### loadingProgress

[signal]

Since the part emits the jobid in the started() signal, progress information is automatically displayed.

However, if you don't use a KIO::Job in the part, you can use loadingProgress() and speedProgress() to display progress information.

void speedProgress ( int bytesPerSecond ) | ### speedProgress

[signal]

See also: loadingProgress

void infoMessage ( const QString & ) | ### infoMessage

[signal]

void popupMenu ( const QPoint &global, const KFileItemList &items ) | ### popupMenu

[signal]

Emit this to make the browser show a standard popup menu at the point `global` for the files `items`.

void popupMenu ( KXMLGUIClient *client, const QPoint &global, const KFileItemList &items ) | ### popupMenu

[signal]

Emit this to make the browser show a standard popup menu at the point `global` for the files `items`.

The GUI described by `client` is being merged with the popupmenu of the host

void popupMenu ( const QPoint &global, const KURL &url, const QString &mimeType, mode_t mode = (mode_t)-1 ) | ### popupMenu

[signal]

Emit this to make the browser show a standard popup menu at the point `global` for the given `url`.

Give as much information about this URL as possible, like the `mimeType` and the file type (`mode:` S_IFREG, S_IFDIR...)

void popupMenu ( KXMLGUIClient *client, const QPoint &global, const KURL &url, const QString &mimeType, mode_t mode = (mode_t)-1 ) | ### popupMenu

[signal]

Emit this to make the browser show a standard popup menu at the point `global` for the given `url`.

Give as much information about this URL as possible, like the `mimeType` and the file type (`mode:` S_IFREG, S_IFDIR...) The GUI described by `client` is being merged with the popupmenu of the host

void selectionInfo ( const KFileItemList &items ) | ### selectionInfo

[signal]

void selectionInfo ( const QString &text ) | ### selectionInfo

[signal]

void selectionInfo ( const KURL::List &urls ) | ### selectionInfo

[signal]

typedef QMap<QCString,int> ActionNumberMap | ### ActionNumberMap

Generated by: root@i386.ports.openbsd.org on Wed Apr 25 13:58:48 2001, using kdoc 2.0a53.