BrowserExtension Class Reference
from PyKDE4.kparts import *
Inherits: QObject
Namespace: KParts
Detailed Description
Enumerations | |
PopupFlag | { DefaultPopupItems, ShowNavigationItems, ShowUp, ShowReload, ShowBookmark, ShowCreateDirectory, ShowTextSelectionItems, NoDeletion, IsLink, ShowUrlOperations, ShowProperties } |
Methods | |
__init__ (self, KParts.ReadOnlyPart parent) | |
QString | actionText (self, QString name) |
addWebSideBar (self, KUrl url, QString name) | |
KParts.BrowserArguments | browserArguments (self) |
KParts.BrowserInterface | browserInterface (self) |
createNewWindow (self, KUrl a0, KParts.OpenUrlArguments a1=KParts.OpenUrlArguments(), KParts.BrowserArguments a2=KParts.BrowserArguments(), KParts.WindowArgs a3=KParts.WindowArgs(), KParts.ReadOnlyPart a4=0) | |
enableAction (self, QString name, bool enabled) | |
infoMessage (self, QString a0) | |
bool | isActionEnabled (self, QString name) |
bool | isURLDropHandlingEnabled (self) |
itemsRemoved (self, KFileItemList items) | |
loadingProgress (self, int percent) | |
mouseOverInfo (self, KFileItem item) | |
moveTopLevelWidget (self, int x, int y) | |
openUrlNotify (self) | |
openUrlRequest (self, KUrl url, KParts.OpenUrlArguments arguments=KParts.OpenUrlArguments(), KParts.BrowserArguments browserArguments=KParts.BrowserArguments()) | |
openUrlRequestDelayed (self, KUrl url, KParts.OpenUrlArguments arguments, KParts.BrowserArguments browserArguments) | |
pasteRequest (self) | |
popupMenu (self, QPoint global, KFileItemList items, KParts.OpenUrlArguments args=KParts.OpenUrlArguments(), KParts.BrowserArguments browserArgs=KParts.BrowserArguments(), KParts.BrowserExtension.PopupFlags flags=KParts.BrowserExtension.DefaultPopupItems, KParts.BrowserExtension.ActionGroupMap actionGroups=KParts.BrowserExtension.ActionGroupMap()) | |
popupMenu (self, QPoint global, KUrl url, mode_t mode=-1, KParts.OpenUrlArguments args=KParts.OpenUrlArguments(), KParts.BrowserArguments browserArgs=KParts.BrowserArguments(), KParts.BrowserExtension.PopupFlags flags=KParts.BrowserExtension.DefaultPopupItems, KParts.BrowserExtension.ActionGroupMap actionGroups=KParts.BrowserExtension.ActionGroupMap()) | |
requestFocus (self, KParts.ReadOnlyPart part) | |
resizeTopLevelWidget (self, int w, int h) | |
restoreState (self, QDataStream stream) | |
saveState (self, QDataStream stream) | |
selectionInfo (self, KFileItemList items) | |
selectionInfo (self, QString text) | |
selectionInfo (self, KUrl.List urls) | |
setActionText (self, QString name, QString text) | |
setBrowserArguments (self, KParts.BrowserArguments args) | |
setBrowserInterface (self, KParts.BrowserInterface impl) | |
setIconUrl (self, KUrl url) | |
setLocationBarUrl (self, QString url) | |
setPageSecurity (self, int a0) | |
setURLDropHandlingEnabled (self, bool enable) | |
speedProgress (self, int bytesPerSecond) | |
int | xOffset (self) |
int | yOffset (self) |
Static Methods | |
KParts.BrowserExtension.ActionSlotMap | actionSlotMap () |
KParts.BrowserExtension.ActionSlotMap | actionSlotMapPtr () |
KParts.BrowserExtension | childObject (QObject obj) |
Method Documentation
__init__ | ( | self, | ||
KParts.ReadOnlyPart | parent | |||
) |
Constructor
- Parameters:
-
parent The KParts.ReadOnlyPart that this extension ... "extends" :)
KParts.BrowserExtension.ActionSlotMap actionSlotMap | ( | ) |
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:
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)
KParts.BrowserExtension.ActionSlotMap actionSlotMapPtr | ( | ) |
- Returns:
- a pointer to the static action-slot map. Preferred method to get it. The map is created if it doesn't exist yet
- Returns:
- the text of an action, if it was set explicitly 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.
Ask the hosting application to add a new HTML (aka Mozilla/Netscape) SideBar entry.
KParts.BrowserArguments browserArguments | ( | self ) |
Retrieve the set of parameters to use for opening the URL (this must be called from openUrl() in the part).
- See also:
- BrowserArguments
KParts.BrowserInterface browserInterface | ( | self ) |
KParts.BrowserExtension childObject | ( | QObject | obj | |
) |
Queries obj for a child object which inherits from this BrowserExtension class. Convenience method.
createNewWindow | ( | self, | ||
KUrl | a0, | |||
KParts.OpenUrlArguments | a1=KParts.OpenUrlArguments(), | |||
KParts.BrowserArguments | a2=KParts.BrowserArguments(), | |||
KParts.WindowArgs | a3=KParts.WindowArgs(), | |||
KParts.ReadOnlyPart | a4=0 | |||
) |
Asks the hosting browser to open a new window for the given url and return a reference to the content part.
arguments is optional additional information about how to open the url,
- See also:
- KParts.OpenUrlArguments
browserArguments is optional additional information for web browsers,
- See also:
- KParts.BrowserArguments
The request for a pointer to the part is only fulfilled/processed if the mimeType is set in the browserArguments. (otherwise the request cannot be processed synchronously).
enableAction | ( | self, | ||
QString | name, | |||
bool | enabled | |||
) |
Enables or disable a standard action held by the browser.
See class documentation for the list of standard actions.
infoMessage | ( | self, | ||
QString | a0 | |||
) |
bool isActionEnabled | ( | self, | ||
QString | 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.
bool isURLDropHandlingEnabled | ( | self ) |
Returns whether url drop handling is enabled. See setURLDropHandlingEnabled for more information about this property.
itemsRemoved | ( | self, | ||
KFileItemList | items | |||
) |
Inform the host about items that have been removed.
loadingProgress | ( | self, | ||
int | percent | |||
) |
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.
mouseOverInfo | ( | self, | ||
KFileItem | item | |||
) |
Inform the hosting application that the user moved the mouse over an item. Used when the mouse is on an URL.
moveTopLevelWidget | ( | self, | ||
int | x, | |||
int | y | |||
) |
Ask the hosting application to move the top level widget.
openUrlNotify | ( | self ) |
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.
openUrlRequest | ( | self, | ||
KUrl | url, | |||
KParts.OpenUrlArguments | arguments=KParts.OpenUrlArguments(), | |||
KParts.BrowserArguments | browserArguments=KParts.BrowserArguments() | |||
) |
Asks 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().
openUrlRequestDelayed | ( | self, | ||
KUrl | url, | |||
KParts.OpenUrlArguments | arguments, | |||
KParts.BrowserArguments | browserArguments | |||
) |
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.
pasteRequest | ( | self ) |
Asks the hosting browser to perform a paste (using openUrlRequestDelayed())
popupMenu | ( | self, | ||
QPoint | global, | |||
KFileItemList | items, | |||
KParts.OpenUrlArguments | args=KParts.OpenUrlArguments(), | |||
KParts.BrowserArguments | browserArgs=KParts.BrowserArguments(), | |||
KParts.BrowserExtension.PopupFlags | flags=KParts.BrowserExtension.DefaultPopupItems, | |||
KParts.BrowserExtension.ActionGroupMap | actionGroups=KParts.BrowserExtension.ActionGroupMap() | |||
) |
Emit this to make the browser show a standard popup menu for the files items.
- Parameters:
-
global global coordinates where the popup should be shown items list of file items which the popup applies to args OpenUrlArguments, mostly for metadata here browserArguments BrowserArguments, mostly for referrer flags enables/disables certain builtin actions in the popupmenu actionGroups named groups of actions which should be inserted into the popup, see ActionGroupMap
popupMenu | ( | self, | ||
QPoint | global, | |||
KUrl | url, | |||
mode_t | mode=-1, | |||
KParts.OpenUrlArguments | args=KParts.OpenUrlArguments(), | |||
KParts.BrowserArguments | browserArgs=KParts.BrowserArguments(), | |||
KParts.BrowserExtension.PopupFlags | flags=KParts.BrowserExtension.DefaultPopupItems, | |||
KParts.BrowserExtension.ActionGroupMap | actionGroups=KParts.BrowserExtension.ActionGroupMap() | |||
) |
Emit this to make the browser show a standard popup menu for the given url.
Give as much information about this URL as possible, like args.mimeType and the file type mode
- Parameters:
-
global global coordinates where the popup should be shown url the URL this popup applies to mode the file type of the url (S_IFREG, S_IFDIR...) args OpenUrlArguments, set the mimetype of the URL using setMimeType() browserArguments BrowserArguments, mostly for referrer flags enables/disables certain builtin actions in the popupmenu actionGroups named groups of actions which should be inserted into the popup, see ActionGroupMap
requestFocus | ( | self, | ||
KParts.ReadOnlyPart | part | |||
) |
Ask the hosting application to focus part.
resizeTopLevelWidget | ( | self, | ||
int | w, | |||
int | h | |||
) |
Ask the hosting application to resize the top level widget.
restoreState | ( | self, | ||
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).
saveState | ( | self, | ||
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).
selectionInfo | ( | self, | ||
KFileItemList | items | |||
) |
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.)
selectionInfo | ( | self, | ||
QString | text | |||
) |
Inform the hosting application about the current selection. Used when some text is selected.
selectionInfo | ( | self, | ||
KUrl.List | urls | |||
) |
Inform the hosting application about the current selection. Used when a set of URLs is selected.
Change the text of a standard action held by the browser. This can be used to change "Paste" into "Paste Image" for instance.
See class documentation for the list of standard actions.
setBrowserArguments | ( | self, | ||
KParts.BrowserArguments | 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:
- BrowserArguments
setBrowserInterface | ( | self, | ||
KParts.BrowserInterface | impl | |||
) |
setIconUrl | ( | self, | ||
KUrl | url | |||
) |
Sets the URL of an icon for the currently displayed page.
setLocationBarUrl | ( | self, | ||
QString | url | |||
) |
Updates the URL shown in the browser's location bar to url.
setPageSecurity | ( | self, | ||
int | a0 | |||
) |
Tell the host (browser) about security state of current page enum PageSecurity { NotCrypted, Encrypted, Mixed };
setURLDropHandlingEnabled | ( | self, | ||
bool | 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.
speedProgress | ( | self, | ||
int | bytesPerSecond | |||
) |
- See also:
- loadingProgress
int xOffset | ( | self ) |
Returns the current x offset.
For a scrollview, implement this using contentsX().
int yOffset | ( | self ) |
Returns the current y offset.
For a scrollview, implement this using contentsY().
Enumeration Documentation
PopupFlag |
Set of flags passed via the popupMenu signal, to ask for some items in the popup menu.
- Enumerator:
-
DefaultPopupItems = 0x0000 ShowNavigationItems = 0x0001 ShowUp = 0x0002 ShowReload = 0x0004 ShowBookmark = 0x0008 ShowCreateDirectory = 0x0010 ShowTextSelectionItems = 0x0020 NoDeletion = 0x0040 IsLink = 0x0080 ShowUrlOperations = 0x0100 ShowProperties = 0x200