class KHTMLPart


Internal Use Only
Definition#include <khtml_part.h>
InheritsKParts::ReadOnlyPart
Annotated List
Files
Globals
Hierarchy
Index
Main

Public Types

Public Methods

Signals


Detailed Description

enum GUIProfile {DefaultGUI, BrowserViewGUI }

 KHTMLPart ( QWidget *parentWidget = 0, const char *widgetname = 0, QObject *parent = 0, const char *name = 0, GUIProfile prof = DefaultGUI )

Construct a new KHTMLPart.

KHTML basically consists of two objects: The KHTMLPart itself, holding the document data (DOM document), and the KHTMLView, derived from QScrollview, in which the document content is rendered in. You can specify two different parent objects for a KHTMLPart, one parent for the KHTMLPart document and on parent for the KHTMLView. If the second parent argument is 0L, then parentWidget is used as parent for both objects, the part and the view.

 KHTMLPart ( KHTMLView *view, QObject *parent = 0, const char *name = 0, GUIProfile prof = DefaultGUI )

KHTMLPart ()

[virtual]

Destructor.

bool  openURL ( const KURL &url )

[virtual]

Opens the specified URL url.

Reimplemented from KParts::ReadOnlyPart::openURL .

bool  closeURL ()

[virtual]

Stop loading the document and kill all data requests (for images, etc.)

DOM::HTMLDocument  htmlDocument ()

[const]

Retrieve a reference to the DOM document.

KParts::BrowserExtension * browserExtension ()

[const]

Retrieve a pointer to the KParts::BrowserExtension

KHTMLViewview ()

[const]

Retrieve a pointer to the HTML document's view.

void  enableJScript ( bool enable )

Enable/disable Javascript support. Note that this will in either case permanently override the default usersetting. If you want to have the default UserSettings, don't call this method.

bool  jScriptEnabled ()

[const]

Returns true if Javascript support is enabled or false otherwise.

QVariant  executeScript ( const QString &script )

Execute the specified snippet of JavaScript code.

Returns true if JavaScript was enabled, no error occured and the code returned true itself or false otherwise.

QVariant  executeScript ( const DOM::Node &n, const QString &script )

Same as above except the Node parameter specifying the 'this' value.

void  setDNDEnabled ( bool b )

bool  dndEnabled ()

[const]

void  enableJava ( bool enable )

Enable/disable Java applet support. Note that calling this function will permanently override the User settings about Java applet support. Not calling this function is the only way to let the default settings apply.

bool  javaEnabled ()

[const]

Return if Java applet support is enabled/disabled.

KJavaAppletContext * javaContext ()

Return the java context of the applets. If no applet exists, 0 is returned.

KJavaAppletContext * createJavaContext ()

Return the java context of the applets. If no context exists yet, a new one is created.

void  autoloadImages ( bool enable )

Should images be loaded automatically? Default is true.

(not implemented at the moment)

bool  autoloadImages ()

[const]

void  begin ( const KURL &url = KURL(), int xOffset = 0, int yOffset = 0 )

[virtual]

Clear the widget and prepares it for new content.

If you want url() to return for example "file:/tmp/test.html", you can use the following code:


 view->begin( KURL("file:/tmp/test.html" ) );

All child frames and the old document are removed if you call this method.

Parameters:
urlis the url of the document to be displayed. Even if you are generating the HTML on the fly, it may be useful to specify a directory so that any pixmaps are found.
xOffsetis the initial horizontal scrollbar value. Usually you don't want to use this.
yOffsetis the initial vertical scrollbar value. Usually you don't want to use this.

void  write ( const char *str, int len = -1 )

[virtual]

Write another part of the HTML code to the widget.

You may call this function many times in sequence. But remember: The fewer calls you make, the faster the widget will be.

The HTML code is send through a decoder which decodes the stream to Unicode.

The len parameter is needed for streams encoded in utf-16, since these can have \0 chars in them. In case the encoding you're using isn't utf-16, you can safely leave out the length parameter.

Attention: Don't mix calls to write( const char *) with calls to write( const QString & ).

The result might not be what you want.

void  write ( const QString &str )

[virtual]

Write another part of the HTML code to the widget.

You may call this function many times in sequence. But remember: The fewer calls you make, the faster the widget will be.

void  end ()

[virtual]

Call this after your last call to write().

void  setBaseURL ( const KURL &url )

Mainly used internally.

Sets the document's base URL.

KURL  baseURL ()

[const]

Retrieve the base URL of this document

The base URL is ususally set by a <base url=...> tag in the document head.

void  setBaseTarget ( const QString &target )

Mainly used internally.

Sets the document's base target.

QString  baseTarget ()

[const]

Retrieve the base target of this document.

The base target is ususally set by a <base target=...> tag in the document head.

KURL  completeURL ( const QString &url, const QString &target = QString::null )

void  scheduleRedirection ( int delay, const QString &url )

bool  setCharset ( const QString &name, bool override = false )

Set the charset to use for displaying HTML pages.

If override is true, it will override charset specifications of the document.

bool  setEncoding ( const QString &name, bool override = false )

Set the encoding the page uses.

This can be different from the charset. The widget will try to reload the current page in the new encoding, if url() is not empty.

void  setUserStyleSheet (const KURL &url)

Set a user defined style sheet to be used on top of the HTML 4 default style sheet.

This gives a wide range of possibilities to change the layout of the page.

void  setUserStyleSheet (const QString &styleSheet)

Set a user defined style sheet to be used on top of the HTML 4 default style sheet.

This gives a wide range of possibilities to change the layout of the page.

void  setFontSizes (const QValueList<int> &newFontSizes )

Set point sizes to be associated with the HTML-sizes used in <FONT size=Html-Font-Size>

Html-Font-Sizes range from 0 (smallest) to 6 (biggest), but you can specify up to 15 font sizes, the bigger ones will get used, if <font size=+1> extends over 7, or if a 'font-size: larger' style declaration gets into this region.

They are related to the CSS font sizes by 0 == xx-small to 6 == xx-large.

QValueList<int>  fontSizes ()

[const]

Get point sizes to be associated with the HTML-sizes used in <FONT size=Html-Font-Size>

Html-Font-Sizes range from 0 (smallest) to 6 (biggest).

They are related to the CSS font sizes by 0 == xx-small to 6 == xx-large.

void  resetFontSizes ()

Reset the point sizes to be associated with the HTML-sizes used in <FONT size=Html-Font-Size> to their default.

Html-Font-Sizes range from 1 (smallest) to 7 (biggest).

void  setStandardFont ( const QString &name )

Set the standard font style.

Parameters:
nameThe font name to use for standard text.

void  setFixedFont ( const QString &name )

Set the fixed font style.

Parameters:
nameThe font name to use for fixed text, e.g. the <tt>&lt;pre&gt;</tt> tag.

bool  gotoAnchor ( const QString &name )

Find the anchor named name.

If the anchor is found, the widget scrolls to the closest position. Returns if the anchor has been found.

void  setURLCursor ( const QCursor &c )

Set the cursor to use when the cursor is on a link.

const QCursor&  urlCursor ()

[const]

Retrieve the cursor which is used when the cursor is on a link.

void  findTextBegin ()

Initiate a text search.

bool  findTextNext ( const QRegExp &exp, bool forward )

Find the next occurrance of the expression.

bool  findTextNext ( const QString &str, bool forward, bool caseSensitive )

Find the next occurence of the string.

QString  selectedText ()

[const virtual]

Get the text the user has marked.

DOM::Range  selection ()

[const]

Retrieve the selected part of the HTML.

bool  hasSelection ()

[const]

Has the user selected anything?

Call selectedText() to retrieve the selected text.

Returns: true if there is text selected.

void  selectAll ()

void  show ()

Convenience method to show the document's view.

Equivalent to widget()->show() or view()->show() .

void  hide ()

Convenience method to hide the document's view.

Equivalent to widget()->hide() or view()->hide().

KParts::PartManager * partManager ()

void  saveState ( QDataStream &stream )

[virtual]

Save the KHTMLPart's complete state (including child frame objects) to the provided QDataStream.

You can use this method to provide history functionality.

This is called from the saveState() method of the browserExtension().

void  restoreState ( QDataStream &stream )

[virtual]

Restore the KHTMLPart's previously saved state (including child frame objects) from the provided QDataStream.

This is called from the restoreState() method of the browserExtension() .

bool  restoreURL ( const KURL &url )

DOM::Node  nodeUnderMouse ()

[const]

Retrieve the Node currently under the mouse

const KHTMLSettings * settings ()

[const]

KHTMLPartparentPart ()

Retrieve a pointer to the parent KHTMLPart if the part is a frame in an HTML frameset.

Returns 0L otherwise.

QStringList  frameNames ()

[const]

const QList<KParts::ReadOnlyPart>  frames ()

[const]

KHTMLPartfindFrame ( const QString &f )

Find a frame by name. Returns 0L if frame can't be found.

bool  frameExists ( const QString &frameName )

Returns whether a frame with the specified name is exists or not. In contrary to the @findFrame method this one also returns true if the frame is defined but no displaying component has been found/loaded, yet.

bool  openURLInFrame ( const KURL &url, const KParts::URLArgs &urlArgs )

void  onURL ( const QString &url )

[signal]

Eemitted if the cursor is moved over an URL.

void  popupMenu (const QString &url, const QPoint &point)

[signal]

Emitted when the user clicks the right mouse button on the document.

void  selectionChanged ()

[signal]

protected: bool  event ( QEvent *event )

[virtual signal]

void  khtmlMousePressEvent ( khtml::MousePressEvent *event )

[virtual signal]

void  khtmlMouseDoubleClickEvent ( khtml::MouseDoubleClickEvent * )

[virtual signal]

void  khtmlMouseMoveEvent ( khtml::MouseMoveEvent *event )

[virtual signal]

void  khtmlMouseReleaseEvent ( khtml::MouseReleaseEvent *event )

[virtual signal]

void  khtmlDrawContentsEvent ( khtml::DrawContentsEvent * )

[virtual signal]

void  guiActivateEvent ( KParts::GUIActivateEvent *event )

[virtual signal]

bool  openFile ()

[virtual signal]

Internal empty reimplementation of KParts::ReadOnlyPart::openFile .

void  overURL ( const QString &url, const QString &target )

[virtual signal]

void  urlSelected ( const QString &url, int button = 0, int state = 0, const QString &_target = QString::null )

[virtual signal]

bool  processObjectRequest ( khtml::ChildFrame *child, const KURL &url, const QString &mimetype )

[signal]

void  submitForm ( const char *action, const QString &url, const QByteArray &formData, const QString &target, const QString& contentType = QString::null, const QString& boundary = QString::null )

[virtual signal]

void  popupMenu ( const QString &url )

[virtual signal]

KParts::ReadOnlyPart * createPart ( QWidget *parentWidget, const char *widgetName, QObject *parent, const char *name, const QString &mimetype, QString &serviceName, QStringList &serviceTypes, const QStringList &params)

[virtual signal]

void  updateFontSize ( int add )

[signal]

void  setFontBaseInternal ( int base, bool absolute )

[signal]

protected slots: /** * Internal. Called by the @ref BrowserExtension . */ void  reparseConfiguration ()

[signal]

private slots: /** * @internal */ void  slotData ( KIO::Job*, const QByteArray &data )

[signal]

void  slotRestoreData ( const QByteArray &data )

[signal]

void  slotFinished ( KIO::Job* )

[signal]

void  slotFinishedParsing ()

[signal]

void  slotRedirect ()

[signal]

void  slotRedirection (KIO::Job*, const KURL&)

[signal]

void  slotViewDocumentSource ()

[virtual signal]

void  slotViewFrameSource ()

[virtual signal]

void  slotSaveBackground ()

[virtual signal]

void  slotSaveDocument ()

[virtual signal]

void  slotSaveFrame ()

[virtual signal]

void  slotSecurity ()

[virtual signal]

void  slotSetEncoding ()

[virtual signal]

void  slotFind ()

[virtual signal]

void  slotFindDone ()

[signal]

void  slotFindDialogDestroyed ()

[signal]

void  slotIncFontSizes ()

[signal]

void  slotDecFontSizes ()

[signal]

void  slotLoadImages ()

[signal]

void  updateActions ()

[signal]

void  slotPartRemoved ( KParts::Part *part )

[signal]

void  slotActiveFrameChanged ( KParts::Part *part )

[signal]

void  slotChildStarted ( KIO::Job *job )

[signal]

void  slotChildCompleted ()

[signal]

void  slotChildURLRequest ( const KURL &url, const KParts::URLArgs &args )

[signal]

void  slotLoaderRequestDone ( const DOM::DOMString &baseURL, khtml::CachedObject *obj )

[signal]

void  checkCompleted ()

[signal]

void  slotShowDocument ( const QString &url, const QString &target )

[signal]

void  slotAutoScroll ()

[signal]

void  slotPrintFrame ()

[signal]

void  slotSelectAll ()

[signal]

private: void  startAutoScroll ()

[signal]

void  stopAutoScroll ()

[signal]

void  emitSelectionChanged ()

[signal]

void  init ( KHTMLView *view, GUIProfile prof )

[signal]

void  clear ()

[signal]

bool  scheduleScript ( const DOM::Node &n, const QString& script)

[signal]

QVariant  executeScheduledScript ()

[signal]

bool  requestFrame ( khtml::RenderPart *frame, const QString &url, const QString &frameName, const QStringList &args = QStringList() )

[signal]

QString  requestFrameName ()

[signal]

This function returns a sequence of names. All names in a sequence are different but the sequence is always the same. The sequence is reset in clear().

bool  requestObject ( khtml::RenderPart *frame, const QString &url, const QString &serviceType, const QStringList &args = QStringList() )

[signal]

bool  requestObject ( khtml::ChildFrame *child, const KURL &url, const KParts::URLArgs &args = KParts::URLArgs() )

[signal]

DOM::HTMLDocumentImpl * docImpl ()

[const signal]

khtml::ChildFrame * frame ( const QObject *obj )

[signal]

khtml::ChildFrame * recursiveFrameRequest ( const KURL &url, const KParts::URLArgs &args, bool callParent = true )

[signal]

bool  checkLinkSecurity (KURL linkURL)

[signal]

KJSProxy * jScript ()

[signal]