• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeparts
 

tdeparts

  • KParts
  • BrowserExtension
Public Types | Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
KParts::BrowserExtension Class Reference

#include <browserextension.h>

Inherits TQObject.

Public Types

enum  {
  DefaultPopupItems =0x0000 , ShowNavigationItems =0x0001 , ShowUp =0x0002 , ShowReload =0x0004 ,
  ShowBookmark =0x0008 , ShowCreateDirectory =0x0010 , ShowTextSelectionItems =0x0020 , NoDeletion =0x0040
}
 
typedef uint PopupFlags
 
typedef TQMap< TQCString, TQCString > ActionSlotMap
 
typedef TQMap< TQCString, int > ActionNumberMap
 

Signals

void enableAction (const char *name, bool enabled)
 
void setActionText (const char *name, const TQString &text)
 
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 TQString &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 TQString &)
 
void popupMenu (const TQPoint &global, const KFileItemList &items)
 
void popupMenu (KXMLGUIClient *client, const TQPoint &global, const KFileItemList &items)
 
void popupMenu (KXMLGUIClient *client, const TQPoint &global, const KFileItemList &items, const KParts::URLArgs &args, KParts::BrowserExtension::PopupFlags i)
 
void popupMenu (const TQPoint &global, const KURL &url, const TQString &mimeType, mode_t mode=(mode_t) -1)
 
void popupMenu (KXMLGUIClient *client, const TQPoint &global, const KURL &url, const TQString &mimeType, mode_t mode=(mode_t) -1)
 
void popupMenu (KXMLGUIClient *client, const TQPoint &global, const KURL &url, const KParts::URLArgs &args, KParts::BrowserExtension::PopupFlags i, mode_t mode=(mode_t) -1)
 
void selectionInfo (const KFileItemList &items)
 
void selectionInfo (const TQString &text)
 
void selectionInfo (const KURL::List &urls)
 
void mouseOverInfo (const KFileItem *item)
 
void addWebSideBar (const KURL &url, const TQString &name)
 
void moveTopLevelWidget (int x, int y)
 
void resizeTopLevelWidget (int w, int h)
 
void requestFocus (KParts::ReadOnlyPart *part)
 
void setPageSecurity (int)
 
void itemsRemoved (const KFileItemList &items)
 

Public Member Functions

 BrowserExtension (KParts::ReadOnlyPart *parent, const char *name=0L)
 
virtual void setURLArgs (const URLArgs &args)
 
URLArgs urlArgs () const
 
virtual int xOffset ()
 
virtual int yOffset ()
 
virtual void saveState (TQDataStream &stream)
 
virtual void restoreState (TQDataStream &stream)
 
bool isURLDropHandlingEnabled () const
 
void setURLDropHandlingEnabled (bool enable)
 
void setBrowserInterface (BrowserInterface *impl)
 
BrowserInterface * browserInterface () const
 
bool isActionEnabled (const char *name) const
 
TQString actionText (const char *name) const
 
void pasteRequest ()
 

Static Public Member Functions

static ActionSlotMap actionSlotMap ()
 
static ActionSlotMap * actionSlotMapPtr ()
 
static BrowserExtension * childObject (TQObject *obj)
 

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 TQObject'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

Definition at line 308 of file browserextension.h.

Member Typedef Documentation

◆ ActionNumberMap

typedef TQMap<TQCString,int> KParts::BrowserExtension::ActionNumberMap

Definition at line 707 of file browserextension.h.

◆ ActionSlotMap

typedef TQMap<TQCString,TQCString> KParts::BrowserExtension::ActionSlotMap

Definition at line 435 of file browserextension.h.

◆ PopupFlags

typedef uint KParts::BrowserExtension::PopupFlags

Definition at line 325 of file browserextension.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Set of flags passed via the popupMenu signal, to ask for some items in the popup menu.

DefaultPopupItems: default value, no additional menu item ShowNavigationItems: show "back" and "forward" (usually done when clicking the background of the view, but not an item) ShowUp: show "up" (same thing, but not over e.g. HTTP). Requires ShowNavigationItems. ShowReload: show "reload" (usually done when clicking the background of the view, but not an item) ShowBookmark: show "add to bookmarks" (usually not done on the local filesystem) ShowCreateDirectory: show "create directory" (usually only done on the background of the view, or in hierarchical views like directory trees, where the new dir would be visible) ShowTextSelectionItems: set when selecting text, for a popup that only contains text-related items. NoDeletion: deletion, trashing and renaming not allowed (e.g. parent dir not writeable). (this is only needed if the protocol itself supports deletion, unlike e.g. HTTP)

KDE4 TODO: add IsLink flag, for "Bookmark This Link" and linkactions merging group. [currently it depends on which signal is emitted] add ShowURLOperation flags for copy,cut,paste,rename,trash,del [same thing]

Enumerator
NoDeletion 
Since
3.4

Definition at line 344 of file browserextension.h.

Constructor & Destructor Documentation

◆ BrowserExtension()

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

Constructor.

Parameters
parentThe KParts::ReadOnlyPart that this extension ... "extends" :)
nameAn optional name for the extension.

Definition at line 357 of file browserextension.cpp.

◆ ~BrowserExtension()

BrowserExtension::~BrowserExtension ( )
virtual

Definition at line 390 of file browserextension.cpp.

Member Function Documentation

◆ actionSlotMap()

BrowserExtension::ActionSlotMap BrowserExtension::actionSlotMap ( )
static

Returns a map containing the action names as keys and corresponding TQ_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, TQ_SIGNAL( yourSignal() ),
extension, mapIterator.data() )

(where "mapIterator" is your TQMap<TQCString,TQCString> iterator)

Definition at line 562 of file browserextension.cpp.

◆ actionSlotMapPtr()

BrowserExtension::ActionSlotMap * BrowserExtension::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

Definition at line 567 of file browserextension.cpp.

◆ actionText()

TQString BrowserExtension::actionText ( const char *  name) const
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.
Since
3.5

Definition at line 552 of file browserextension.cpp.

◆ addWebSideBar

void KParts::BrowserExtension::addWebSideBar ( const KURL &  url,
const TQString &  name 
)
signal

Ask the hosting application to add a new HTML (aka Mozilla/Netscape) SideBar entry.

◆ browserInterface()

BrowserInterface * BrowserExtension::browserInterface ( ) const

Definition at line 516 of file browserextension.cpp.

◆ childObject()

BrowserExtension * BrowserExtension::childObject ( TQObject *  obj)
static

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

Convenience method.

Definition at line 606 of file browserextension.cpp.

◆ createNewWindow [1/2]

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

Asks 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.

◆ createNewWindow [2/2]

void KParts::BrowserExtension::createNewWindow ( const KURL &  url,
const KParts::URLArgs &  args = KParts::URLArgs() 
)
signal

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

The args argument is optional additional information for the browser,

See also
KParts::URLArgs

◆ enableAction

void KParts::BrowserExtension::enableAction ( const char *  name,
bool  enabled 
)
signal

Enables or disable a standard action held by the browser.

See class documentation for the list of standard actions.

◆ isActionEnabled()

bool BrowserExtension::isActionEnabled ( const char *  name) 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.

Definition at line 534 of file browserextension.cpp.

◆ isURLDropHandlingEnabled()

bool BrowserExtension::isURLDropHandlingEnabled ( ) const

Returns whether url drop handling is enabled.

See setURLDropHandlingEnabled for more information about this property.

Definition at line 436 of file browserextension.cpp.

◆ itemsRemoved

void KParts::BrowserExtension::itemsRemoved ( const KFileItemList &  items)
signal

Inform the host about items that have been removed.

Since
3.5.5

◆ loadingProgress

void KParts::BrowserExtension::loadingProgress ( int  percent)
signal

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

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

◆ mouseOverInfo

void KParts::BrowserExtension::mouseOverInfo ( const KFileItem *  item)
signal

Inform the hosting application that the user moved the mouse over an item.

Used when the mouse is on an URL.

◆ moveTopLevelWidget

void KParts::BrowserExtension::moveTopLevelWidget ( int  x,
int  y 
)
signal

Ask the hosting application to move the top level widget.

◆ openURLNotify

void KParts::BrowserExtension::openURLNotify ( )
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.

◆ openURLRequest

void KParts::BrowserExtension::openURLRequest ( const KURL &  url,
const KParts::URLArgs &  args = KParts::URLArgs() 
)
signal

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

void KParts::BrowserExtension::openURLRequestDelayed ( const KURL &  url,
const KParts::URLArgs &  args = KParts::URLArgs() 
)
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.

◆ pasteRequest()

void BrowserExtension::pasteRequest ( )

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

Since
3.2

Definition at line 452 of file browserextension.cpp.

◆ popupMenu [1/5]

void KParts::BrowserExtension::popupMenu ( const TQPoint &  global,
const KFileItemList &  items 
)
signal

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

◆ popupMenu [2/5]

void KParts::BrowserExtension::popupMenu ( const TQPoint &  global,
const KURL &  url,
const TQString &  mimeType,
mode_t  mode = (mode_t) -1 
)
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...)

◆ popupMenu [3/5]

void KParts::BrowserExtension::popupMenu ( KXMLGUIClient *  client,
const TQPoint &  global,
const KFileItemList &  items 
)
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

◆ popupMenu [4/5]

void KParts::BrowserExtension::popupMenu ( KXMLGUIClient *  client,
const TQPoint &  global,
const KURL &  url,
const KParts::URLArgs &  args,
KParts::BrowserExtension::PopupFlags  i,
mode_t  mode = (mode_t) -1 
)
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 args.mimeType and the file type (mode: S_IFREG, S_IFDIR...) The GUI described by client is being merged with the popupmenu of the host

◆ popupMenu [5/5]

void KParts::BrowserExtension::popupMenu ( KXMLGUIClient *  client,
const TQPoint &  global,
const KURL &  url,
const TQString &  mimeType,
mode_t  mode = (mode_t) -1 
)
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

◆ requestFocus

void KParts::BrowserExtension::requestFocus ( KParts::ReadOnlyPart *  part)
signal

Ask the hosting application to focus part.

Since
3.4

◆ resizeTopLevelWidget

void KParts::BrowserExtension::resizeTopLevelWidget ( int  w,
int  h 
)
signal

Ask the hosting application to resize the top level widget.

◆ restoreState()

void BrowserExtension::restoreState ( TQDataStream &  stream)
virtual

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).

Definition at line 421 of file browserextension.cpp.

◆ saveState()

void BrowserExtension::saveState ( TQDataStream &  stream)
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 additional properties, reimplement it but don't forget to call the parent method (probably first).

Definition at line 416 of file browserextension.cpp.

◆ selectionInfo [1/3]

void KParts::BrowserExtension::selectionInfo ( const KFileItemList &  items)
signal

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 [2/3]

void KParts::BrowserExtension::selectionInfo ( const KURL::List &  urls)
signal

Inform the hosting application about the current selection.

Used when a set of URLs is selected.

◆ selectionInfo [3/3]

void KParts::BrowserExtension::selectionInfo ( const TQString &  text)
signal

Inform the hosting application about the current selection.

Used when some text is selected.

◆ setActionText

void KParts::BrowserExtension::setActionText ( const char *  name,
const TQString &  text 
)
signal

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.

Since
3.5

◆ setBrowserInterface()

void BrowserExtension::setBrowserInterface ( BrowserInterface *  impl)

Definition at line 511 of file browserextension.cpp.

◆ setIconURL

void KParts::BrowserExtension::setIconURL ( const KURL &  url)
signal

Sets the URL of an icon for the currently displayed page.

◆ setLocationBarURL

void KParts::BrowserExtension::setLocationBarURL ( const TQString &  url)
signal

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

◆ setPageSecurity

void KParts::BrowserExtension::setPageSecurity ( int  )
signal

Tell the host (browser) about security state of current page enum PageSecurity { NotCrypted, Encrypted, Mixed };.

Since
3.4

◆ setURLArgs()

void BrowserExtension::setURLArgs ( const URLArgs &  args)
virtual

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

Definition at line 396 of file browserextension.cpp.

◆ setURLDropHandlingEnabled()

void BrowserExtension::setURLDropHandlingEnabled ( 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.

Definition at line 441 of file browserextension.cpp.

◆ speedProgress

void KParts::BrowserExtension::speedProgress ( int  bytesPerSecond)
signal
See also
loadingProgress

◆ urlArgs()

URLArgs BrowserExtension::urlArgs ( ) const

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

See also
URLArgs

Definition at line 401 of file browserextension.cpp.

◆ virtual_hook()

void BrowserExtension::virtual_hook ( int  id,
void *  data 
)
protectedvirtual

Definition at line 683 of file browserextension.cpp.

◆ xOffset()

int BrowserExtension::xOffset ( )
virtual

Returns the current x offset.

For a scrollview, implement this using contentsX().

Definition at line 406 of file browserextension.cpp.

◆ yOffset()

int BrowserExtension::yOffset ( )
virtual

Returns the current y offset.

For a scrollview, implement this using contentsY().

Definition at line 411 of file browserextension.cpp.


The documentation for this class was generated from the following files:
  • browserextension.h
  • browserextension.cpp

tdeparts

Skip menu "tdeparts"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdeparts

Skip menu "tdeparts"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeparts by doxygen 1.9.4
This website is maintained by Timothy Pearson.