KParts::BrowserExtension Class Reference
The Browser Extension is an extension (yes, no kidding) to KParts::ReadOnlyPart, which allows a better integration of parts with browsers (in particular Konqueror). More...
#include <browserextension.h>
Inheritance diagram for KParts::BrowserExtension:


Public Types | |
typedef QMap< QCString, QCString > | ActionSlotMap |
typedef QMap< QCString, int > | ActionNumberMap |
Signals | |
void | enableAction (const char *name, bool enabled) |
Enables or disable a standard action held by the browser. | |
void | openURLRequest (const KURL &url, const KParts::URLArgs &args=KParts::URLArgs()) |
Asks the host (browser) to open url . | |
void | openURLRequestDelayed (const KURL &url, const KParts::URLArgs &args=KParts::URLArgs()) |
This signal is emitted when openURLRequest is called, after a 0-seconds timer. | |
void | openURLNotify () |
Tells the hosting browser that the part opened a new URL (which can be queried via KParts::Part::url(). | |
void | setLocationBarURL (const QString &url) |
Updates the URL shown in the browser's location bar to url . | |
void | setIconURL (const KURL &url) |
Sets the URL of an icon for the currently displayed page. | |
void | createNewWindow (const KURL &url, const KParts::URLArgs &args=KParts::URLArgs()) |
Asks the hosting browser to open a new window for the given url . | |
void | createNewWindow (const KURL &url, const KParts::URLArgs &args, const KParts::WindowArgs &windowArgs, KParts::ReadOnlyPart *&part) |
Asks the hosting browser to open a new window for the given url and return a reference to the content part. | |
void | loadingProgress (int percent) |
Since the part emits the jobid in the started() signal, progress information is automatically displayed. | |
void | speedProgress (int bytesPerSecond) |
void | infoMessage (const QString &) |
void | popupMenu (const QPoint &global, const KFileItemList &items) |
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) |
Emit this to make the browser show a standard popup menu at the point global for the files items . | |
void | popupMenu (const QPoint &global, const KURL &url, const QString &mimeType, mode_t mode=(mode_t)-1) |
Emit this to make the browser show a standard popup menu at the point global for the given url . | |
void | popupMenu (KXMLGUIClient *client, const QPoint &global, const KURL &url, const QString &mimeType, mode_t mode=(mode_t)-1) |
Emit this to make the browser show a standard popup menu at the point global for the given url . | |
void | selectionInfo (const KFileItemList &items) |
Inform the hosting application about the current selection. | |
void | selectionInfo (const QString &text) |
Inform the hosting application about the current selection. | |
void | selectionInfo (const KURL::List &urls) |
Inform the hosting application about the current selection. | |
void | mouseOverInfo (const KFileItem *item) |
Inform the hosting application that the user moved the mouse over an item. | |
Public Member Functions | |
BrowserExtension (KParts::ReadOnlyPart *parent, const char *name=0L) | |
Constructor. | |
virtual void | setURLArgs (const URLArgs &args) |
Set the parameters to use for opening the next URL. | |
URLArgs | urlArgs () const |
Retrieve the set of parameters to use for opening the URL (this must be called from openURL() in the part). | |
virtual int | xOffset () |
Returns the current x offset. | |
virtual int | yOffset () |
Returns the current y offset. | |
virtual 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). | |
virtual void | restoreState (QDataStream &stream) |
Used by the browser to restore the view in the state it was when we left it. | |
bool | isURLDropHandlingEnabled () const |
Returns whether url drop handling is enabled. | |
void | setURLDropHandlingEnabled (bool enable) |
Enables or disables url drop handling. | |
void | setBrowserInterface (BrowserInterface *impl) |
BrowserInterface * | browserInterface () const |
bool | isActionEnabled (const char *name) const |
Static Public Member Functions | |
ActionSlotMap | actionSlotMap () |
Returns a map containing the action names as keys and corresponding SLOT()'ified method names as data entries. | |
ActionSlotMap * | actionSlotMapPtr () |
BrowserExtension * | childObject (QObject *obj) |
Queries obj for a child object which inherits from this BrowserExtension class. | |
Protected Member Functions | |
virtual void | virtual_hook (int id, void *data) |
Detailed Description
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 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).properties
: Show file/document properties.editMimeType
: show file/document's mimetype properties.
print
: Print :-)reparseConfiguration
: Re-read configuration and apply it.refreshMimeTypes
: If the view uses mimetypes it should re-determine them.
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 )
: Iftrue
, view properties are saved into .directory otherwise, they are saved globally.
Definition at line 278 of file browserextension.h.
Constructor & Destructor Documentation
|
Constructor.
Definition at line 326 of file browserextension.cpp. References QMap::begin(), QObject::connect(), enableAction(), QMap::end(), QObject::metaObject(), KStdAccel::name(), and openURLRequest(). |
Member Function Documentation
|
Set the parameters to use for opening the next URL. This is called by the "hosting" application, to pass parameters to the part.
Definition at line 363 of file browserextension.cpp. Referenced by restoreState(). |
|
Retrieve the set of parameters to use for opening the URL (this must be called from openURL() in the part).
Definition at line 368 of file browserextension.cpp. Referenced by restoreState(). |
|
Returns the current x offset. For a scrollview, implement this using contentsX(). Definition at line 373 of file browserextension.cpp. Referenced by saveState(). |
|
Returns the current y offset. For a scrollview, implement this using contentsY(). Definition at line 378 of file browserextension.cpp. Referenced by saveState(). |
|
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). Definition at line 383 of file browserextension.cpp. References KParts::ReadOnlyPart::url(), xOffset(), and yOffset(). |
|
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). Definition at line 388 of file browserextension.cpp. References KParts::ReadOnlyPart::openURL(), setURLArgs(), urlArgs(), KParts::URLArgs::xOffset, and KParts::URLArgs::yOffset. |
|
Returns whether url drop handling is enabled. See setURLDropHandlingEnabled for more information about this property. Definition at line 403 of file browserextension.cpp. |
|
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. Definition at line 408 of file browserextension.cpp. |
|
Definition at line 461 of file browserextension.cpp. References KStdAccel::name(). |
|
Returns 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:
|
|
Definition at line 473 of file browserextension.cpp. Referenced by actionSlotMap(). |
|
Queries Convenience method. Definition at line 515 of file browserextension.cpp. References QObject::children(). |
|
Enables or disable a standard action held by the browser. See class documentation for the list of standard actions. Referenced by BrowserExtension(). |
|
Asks the host (browser) to open
To set a reload, the x and y offsets, the service type etc., fill in the appropriate fields in the Referenced by BrowserExtension(). |
|
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. |
|
Tells 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. |
|
Updates the URL shown in the browser's location bar to
|
|
Sets the URL of an icon for the currently displayed page.
|
|
Asks the hosting browser to open a new window for the given
The
|
|
Asks the hosting browser to open a new window for the given
The request for a reference to the part is only fullfilled/processed if the serviceType is set in the |
|
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. |
|
|
|
Emit this to make the browser show a standard popup menu at the point
|
|
Emit this to make the browser show a standard popup menu at the point
The GUI described by |
|
Emit this to make the browser show a standard popup menu at the point
Give as much information about this URL as possible, like the |
|
Emit this to make the browser show a standard popup menu at the point
Give as much information about this URL as possible, like the |
|
Inform the hosting application about the current selection. Used when a set of files/URLs is selected (with full information about those URLs, including size, permissions etc.) |
|
Inform the hosting application about the current selection. Used when some text is selected. |
|
Inform the hosting application about the current selection. Used when a set of URLs is selected. |
|
Inform the hosting application that the user moved the mouse over an item. Used when the mouse is on an URL. |
The documentation for this class was generated from the following files: