khtml Library API Documentation

KHTMLPart Class Reference

This class is khtml's main class. HTML Browser Widget. More...

#include <khtml_part.h>

Inheritance diagram for KHTMLPart:

KParts::ReadOnlyPart KParts::Part QObject KParts::PartBase KXMLGUIClient List of all members.

Public Types

enum  GUIProfile { DefaultGUI, BrowserViewGUI }

Public Slots

void setActiveNode (const DOM::Node &node)
 Sets the focussed node of the document to the specified node.

void stopAnimations ()
 Stops all animated images on the current and child pages.

QCString dcopObjectId () const

Signals

void onURL (const QString &url)
 Emitted if the cursor is moved over an URL.

void popupMenu (const QString &url, const QPoint &point)
 Emitted when the user clicks the right mouse button on the document.

void selectionChanged ()
 This signal is emitted when the selection changes.

void nodeActivated (const DOM::Node &)
 This signal is emitted when an element retrieves the keyboard focus.

void docCreated ()

Public Member Functions

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

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

virtual bool openURL (const KURL &url)
 Opens the specified URL url.

virtual bool closeURL ()
 Stops loading the document and kill all data requests (for images, etc.).

virtual void showError (KIO::Job *job)
 is called when a certain error situation (i.e.

DOM::HTMLDocument htmlDocument () const
 Returns a reference to the DOM HTML document (for non-HTML documents, returns null).

DOM::Document document () const
 Returns a reference to the DOM document.

DOM::Node activeNode () const
 Returns the node that has the keyboard focus.

KParts::BrowserExtensionbrowserExtension () const
 Returns a pointer to the KParts::BrowserExtension.

KParts::LiveConnectExtensionliveConnectExtension (const khtml::RenderPart *) const
KParts::BrowserHostExtensionbrowserHostExtension () const
KHTMLViewview () const
 Returns a pointer to the HTML document's view.

void setJScriptEnabled (bool enable)
 Enable/disable Javascript support.

bool jScriptEnabled () const
 Returns true if Javascript support is enabled or false otherwise.

void setMetaRefreshEnabled (bool enable)
 Enable/disable the automatic forwarding by <meta http-equiv="refresh" ....>.

bool metaRefreshEnabled () const
 Returns true if automatic forwarding is enabled.

QVariant executeScript (const QString &script)
 Execute the specified snippet of JavaScript code.

QVariant executeScript (const DOM::Node &n, const QString &script)
 Same as above except the Node parameter specifying the 'this' value.

void setDNDEnabled (bool b)
 Enables or disables Drag'n'Drop support.

bool dndEnabled () const
 Returns whether Dragn'n'Drop support is enabled or not.

void setJavaEnabled (bool enable)
 Enables/disables Java applet support.

bool javaEnabled () const
 Return if Java applet support is enabled/disabled.

KJavaAppletContext * javaContext ()
 Returns the java context of the applets.

KJavaAppletContext * createJavaContext ()
 Returns the java context of the applets.

void setPluginsEnabled (bool enable)
 Enables or disables plugins via, default is enabled.

bool pluginsEnabled () const
 Returns trie if plugins are enabled/disabled.

void setAutoloadImages (bool enable)
 Specifies whether images contained in the document should be loaded automatically or not.

bool autoloadImages () const
 Returns whether images contained in the document are loaded automatically or not.

void setOnlyLocalReferences (bool enable)
 Security option.

bool onlyLocalReferences () const
 Returnd whether references should be loaded ( default false ).

void enableJScript (bool e)
void enableJava (bool e)
void enablePlugins (bool e)
void autoloadImages (bool e)
void enableMetaRefresh (bool e)
bool setCharset (const QString &, bool)
KURL baseURL () const
QString baseTarget () const
KURL backgroundURL () const
 Returns the URL for the background Image (used by save background).

void scheduleRedirection (int delay, const QString &url, bool lockHistory=true)
 Schedules a redirection after delay seconds.

virtual void begin (const KURL &url=KURL(), int xOffset=0, int yOffset=0)
 Clears the widget and prepares it for new content.

virtual void write (const char *str, int len=-1)
 Writes another part of the HTML code to the widget.

virtual void write (const QString &str)
 Writes another part of the HTML code to the widget.

virtual void end ()
 Call this after your last call to write().

void paint (QPainter *, const QRect &, int=0, bool *=0)
 Paints the HTML page to a QPainter.

bool setEncoding (const QString &name, bool override=false)
 Sets the encoding the page uses.

QString encoding () const
 Returns the encoding the page currently uses.

void setUserStyleSheet (const KURL &url)
 Sets a user defined style sheet to be used on top of the HTML 4 default style sheet.

void setUserStyleSheet (const QString &styleSheet)
 Sets a user defined style sheet to be used on top of the HTML 4 default style sheet.

void setStandardFont (const QString &name)
 Sets the standard font style.

void setFixedFont (const QString &name)
 Sets the fixed font style.

bool gotoAnchor (const QString &name)
 Finds the anchor named name.

void setURLCursor (const QCursor &c)
 Sets the cursor to use when the cursor is on a link.

QCursor urlCursor () const
 Returns the cursor which is used when the cursor is on a link.

void findTextBegin ()
 Initiates a text search.

bool findTextNext (const QString &str, bool forward, bool caseSensitive, bool isRegExp)
 Finds the next occurence of the string or expression.

void setZoomFactor (int percent)
 Sets the Zoom factor.

int zoomFactor () const
 Returns the current zoom factor.

virtual QString selectedText () const
 Returns the text the user has marked.

DOM::Range selection () const
 Returns the selected part of the HTML.

void setSelection (const DOM::Range &)
 Sets the current selection.

bool hasSelection () const
 Has the user selected anything?

void selectAll ()
 Marks all text in the document as selected.

void show ()
 Convenience method to show the document's view.

void hide ()
 Convenience method to hide the document's view.

KParts::PartManagerpartManager ()
 Returns a reference to the partmanager instance which manages html frame objects.

virtual void saveState (QDataStream &stream)
 Saves the KHTMLPart's complete state (including child frame objects) to the provided QDataStream.

virtual void restoreState (QDataStream &stream)
 Restores the KHTMLPart's previously saved state (including child frame objects) from the provided QDataStream.

DOM::Node nodeUnderMouse () const
 Returns the Node currently under the mouse.

const KHTMLSettingssettings () const
KHTMLPartparentPart ()
 Returns a pointer to the parent KHTMLPart if the part is a frame in an HTML frameset.

QStringList frameNames () const
 Returns a list of names of all frame (including iframe) objects of the current document.

QPtrList< KParts::ReadOnlyPartframes () const
KHTMLPartfindFrame (const QString &f)
 Finds a frame by name.

KHTMLPartfindFrameParent (KParts::ReadOnlyPart *callingPart, const QString &f, khtml::ChildFrame **childFrame=0)
KParts::ReadOnlyPartcurrentFrame () const
 Return the current frame (the one that has focus) Not necessarily a direct child of ours, framesets can be nested.

bool frameExists (const QString &frameName)
 Returns whether a frame with the specified name is exists or not.

void setJSStatusBarText (const QString &text)
 Called by KJS.

void setJSDefaultStatusBarText (const QString &text)
 Called by KJS.

QString jsStatusBarText () const
 Called by KJS.

QString jsDefaultStatusBarText () const
 Called by KJS.

QString referrer () const
 Referrer used for links in this page.

QString pageReferrer () const
 Referrer used to obtain this page.

QString lastModified () const
 Last-modified date (in raw string format), if received in the [HTTP] headers.

void preloadStyleSheet (const QString &url, const QString &stylesheet)
 Loads a style sheet into the stylesheet cache.

void preloadScript (const QString &url, const QString &script)
 Loads a script into the script cache.

bool restored () const

Protected Member Functions

KURL completeURL (const QString &url)
 returns a KURL object for the given url.

void htmlError (int errorCode, const QString &text, const KURL &reqUrl)
 presents a detailed error message to the user.

virtual void customEvent (QCustomEvent *event)
virtual void khtmlMousePressEvent (khtml::MousePressEvent *event)
 Eventhandler of the khtml::MousePressEvent.

virtual void khtmlMouseDoubleClickEvent (khtml::MouseDoubleClickEvent *)
 Eventhandler for the khtml::MouseDoubleClickEvent.

virtual void khtmlMouseMoveEvent (khtml::MouseMoveEvent *event)
 Eventhandler for the khtml::MouseDoubleMoveEvent.

virtual void khtmlMouseReleaseEvent (khtml::MouseReleaseEvent *event)
 Eventhandler for the khtml::MouseMoveEvent.

virtual void khtmlDrawContentsEvent (khtml::DrawContentsEvent *)
 Eventhandler for the khtml::DrawContentsEvent.

virtual void guiActivateEvent (KParts::GUIActivateEvent *event)
 Internal reimplementation of KParts::Part::guiActivateEvent .

virtual bool openFile ()
 Internal empty reimplementation of KParts::ReadOnlyPart::openFile .

virtual void urlSelected (const QString &url, int button, int state, const QString &_target, KParts::URLArgs args=KParts::URLArgs())
virtual KParts::ReadOnlyPartcreatePart (QWidget *parentWidget, const char *widgetName, QObject *parent, const char *name, const QString &mimetype, QString &serviceName, QStringList &serviceTypes, const QStringList &params)
 This method is called when a new embedded object (include html frames) is to be created.

bool pluginPageQuestionAsked (const QString &mimetype) const
void setPluginPageQuestionAsked (const QString &mimetype)

Friends

class DOM::HTMLTitleElementImpl
class DOM::HTMLFrameElementImpl
class DOM::HTMLIFrameElementImpl
class DOM::HTMLObjectElementImpl
class DOM::HTMLAnchorElementImpl
class DOM::HTMLMetaElementImpl
class DOM::NodeImpl
class KHTMLRun
class DOM::HTMLFormElementImpl
class khtml::RenderPartObject
class KJS::Window
class KJS::WindowFunc
class KJS::JSEventListener
class KJS::DOMDocument
class KJSProxy
class KHTMLPartBrowserExtension
class DOM::DocumentImpl
class DOM::HTMLDocumentImpl
class KHTMLPartBrowserHostExtension
class khtml::HTMLTokenizer
class XMLTokenizer
class khtml::RenderWidget
class khtml::CSSStyleSelector
class KHTMLPartIface
class KHTMLPartFunction
class KHTMLPartPrivate

Detailed Description

This class is khtml's main class. HTML Browser Widget.

It features an almost complete web browser, and html renderer.

The easiest way to use this class (if you just want to display a an HTML page at some URL) is the following:

KURL url = "http://www.kde.org"; KHTMLPart *w = new KHTMLPart(); w->openURL(url); w->view()->resize(500, 400); w->show();

If Java and JavaScript are enabled by default depends on the user's settings. If you do not need them, and escpecially if you display unfiltered data from untrusted sources, it is strongly recommended to turn them off. In that case, you should also turn off the automatic redirect and plugins:

w->setJScriptEnabled(false); w->setJavaEnabled(false); w->setMetaRefreshEnabled(false); w->setPluginsEnabled(false);

Some apps want to write their HTML code directly into the widget instead of it opening an url. You can also do that in the following way:

QString myHTMLCode = ...; KHTMLPart *w = new KHTMLPart(); w->begin(); w->write(myHTMLCode); ... w->end();

You can do as many calls to write as you want. But there are two write() methods, one accepting a QString one accepting a char * argument. You should use one or the other (but not both) since the method using the char * argument does an additional decoding step to convert the written data to Unicode.

Author:
Lars Knoll (knoll@kde.org)
Version:
Id
khtml_part.h,v 1.197.2.6 2003/07/10 12:13:14 waba Exp

Definition at line 145 of file khtml_part.h.


Constructor & Destructor Documentation

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

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

Definition at line 138 of file khtml_part.cpp.

References KStdAccel::name(), parentPart(), and KParts::PartBase::setInstance().

KHTMLPart::~KHTMLPart  )  [virtual]
 

Destructor.

Definition at line 262 of file khtml_part.cpp.

References closeURL(), and QObject::disconnect().


Member Function Documentation

bool KHTMLPart::openURL const KURL url  )  [virtual]
 

Opens the specified URL url.

Reimplemented from KParts::ReadOnlyPart::openURL .

Reimplemented from KParts::ReadOnlyPart.

Definition at line 337 of file khtml_part.cpp.

References closeURL(), KParts::ReadOnlyPart::completed(), QObject::connect(), KParts::URLArgs::contentType(), QValueList< KURL >::count(), KParts::URLArgs::doPost(), QValueList< KURL >::first(), KIO::get(), gotoAnchor(), KURL::hasRef(), KURL::hasSubURL(), KURL::host(), htmlError(), KIO::http_post(), QMap< QString, QString >::insert(), QString::isEmpty(), KURL::join(), KParts::ReadOnlyPart::m_url, KParts::URLArgs::metaData(), parentPart(), KURL::path(), QValueList< KURL >::pop_front(), KParts::URLArgs::postData, KURL::prettyURL(), KURL::protocol(), KURL::queryItem(), KParts::URLArgs::redirectedRequest(), KParts::URLArgs::reload, KURL::setPath(), KURL::split(), KParts::ReadOnlyPart::started(), QString::startsWith(), QString::toInt(), KURL::url(), and KParts::Part::widget().

Referenced by restoreState(), and setEncoding().

bool KHTMLPart::closeURL  )  [virtual]
 

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

Reimplemented from KParts::ReadOnlyPart.

Definition at line 492 of file khtml_part.cpp.

References KHTMLPageCache::cancelEntry(), KHTMLPageCache::cancelFetch(), KStdAccel::end(), end(), KParts::ReadOnlyPart::m_url, nodeActivated(), KURL::prettyURL(), and KHTMLPageCache::self().

Referenced by openURL(), restoreState(), setEncoding(), and ~KHTMLPart().

void KHTMLPart::showError KIO::Job job  )  [virtual]
 

is called when a certain error situation (i.e.

connection timed out) occured. default implementation either shows a KIO error dialog or loads a more verbose error description a as page, depending on the users configuration. job is the job that signaled the error situation

Definition at line 1153 of file khtml_part.cpp.

References KIO::Job::error(), KIO::Job::errorText(), htmlError(), and KIO::Job::showErrorDialog().

DOM::HTMLDocument KHTMLPart::htmlDocument  )  const
 

Returns a reference to the DOM HTML document (for non-HTML documents, returns null).

Definition at line 561 of file khtml_part.cpp.

DOM::Document KHTMLPart::document  )  const
 

Returns a reference to the DOM document.

Definition at line 569 of file khtml_part.cpp.

Referenced by selection().

DOM::Node KHTMLPart::activeNode  )  const
 

Returns the node that has the keyboard focus.

Definition at line 5090 of file khtml_part.cpp.

KParts::BrowserExtension * KHTMLPart::browserExtension  )  const
 

Returns a pointer to the KParts::BrowserExtension.

Definition at line 574 of file khtml_part.cpp.

KHTMLView * KHTMLPart::view  )  const
 

Returns a pointer to the HTML document's view.

Definition at line 584 of file khtml_part.cpp.

Referenced by khtmlMouseMoveEvent().

void KHTMLPart::setJScriptEnabled 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.

Definition at line 589 of file khtml_part.cpp.

References jScriptEnabled().

bool KHTMLPart::jScriptEnabled  )  const
 

Returns true if Javascript support is enabled or false otherwise.

Definition at line 598 of file khtml_part.cpp.

Referenced by setJScriptEnabled().

void KHTMLPart::setMetaRefreshEnabled bool  enable  ) 
 

Enable/disable the automatic forwarding by <meta http-equiv="refresh" ....>.

Definition at line 605 of file khtml_part.cpp.

bool KHTMLPart::metaRefreshEnabled  )  const
 

Returns true if automatic forwarding is enabled.

Definition at line 610 of file khtml_part.cpp.

QVariant KHTMLPart::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. This class or method is obsolete, it is provided for compatibility only., use the one below.

Definition at line 662 of file khtml_part.cpp.

QVariant KHTMLPart::executeScript const DOM::Node n,
const QString script
 

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

Definition at line 670 of file khtml_part.cpp.

References DOM::Node::isNull(), QString::latin1(), DOM::Node::nodeName(), DOM::Node::nodeType(), and DOM::DOMString::string().

void KHTMLPart::setDNDEnabled bool  b  ) 
 

Enables or disables Drag'n'Drop support.

A drag operation is started if the users drags a link.

Definition at line 4336 of file khtml_part.cpp.

bool KHTMLPart::dndEnabled  )  const
 

Returns whether Dragn'n'Drop support is enabled or not.

Definition at line 4341 of file khtml_part.cpp.

void KHTMLPart::setJavaEnabled bool  enable  ) 
 

Enables/disables 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.

Definition at line 715 of file khtml_part.cpp.

bool KHTMLPart::javaEnabled  )  const
 

Return if Java applet support is enabled/disabled.

Definition at line 721 of file khtml_part.cpp.

KJavaAppletContext * KHTMLPart::javaContext  ) 
 

Returns the java context of the applets.

If no applet exists, 0 is returned.

Definition at line 732 of file khtml_part.cpp.

KJavaAppletContext * KHTMLPart::createJavaContext  ) 
 

Returns the java context of the applets.

If no context exists yet, a new one is created.

Definition at line 741 of file khtml_part.cpp.

References QObject::connect(), and KParts::Part::setStatusBarText().

void KHTMLPart::setPluginsEnabled bool  enable  ) 
 

Enables or disables plugins via, default is enabled.

Definition at line 760 of file khtml_part.cpp.

bool KHTMLPart::pluginsEnabled  )  const
 

Returns trie if plugins are enabled/disabled.

Definition at line 766 of file khtml_part.cpp.

void KHTMLPart::setAutoloadImages bool  enable  ) 
 

Specifies whether images contained in the document should be loaded automatically or not.

Note:
Request will be ignored if called before begin().

Definition at line 846 of file khtml_part.cpp.

References KXMLGUIClient::actionCollection(), QPtrList::append(), KXMLGUIClient::plugActionList(), and KXMLGUIClient::unplugActionList().

Referenced by begin().

bool KHTMLPart::autoloadImages  )  const
 

Returns whether images contained in the document are loaded automatically or not.

Note:
that the returned information is unrelieable as long as no begin() was called.

Definition at line 870 of file khtml_part.cpp.

void KHTMLPart::setOnlyLocalReferences bool  enable  ) 
 

Security option.

Specify whether only local references ( stylesheets, images, scripts, subdocuments ) should be loaded. ( default false - everything is loaded, if the more specific options allow )

Definition at line 1910 of file khtml_part.cpp.

bool KHTMLPart::onlyLocalReferences  )  const
 

Returnd whether references should be loaded ( default false ).

Definition at line 1905 of file khtml_part.cpp.

KURL KHTMLPart::backgroundURL  )  const
 

Returns the URL for the background Image (used by save background).

Definition at line 2796 of file khtml_part.cpp.

References KParts::ReadOnlyPart::m_url.

void KHTMLPart::scheduleRedirection int  delay,
const QString url,
bool  lockHistory = true
 

Schedules a redirection after delay seconds.

Definition at line 1732 of file khtml_part.cpp.

void KHTMLPart::begin const KURL url = KURL(),
int  xOffset = 0,
int  yOffset = 0
[virtual]
 

Clears 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" ) );

Parameters:
url is 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.
xOffset is the initial horizontal scrollbar value. Usually you don't want to use this.
yOffset is the initial vertical scrollbar value. Usually you don't want to use this.
All child frames and the old document are removed if you call this method.

Definition at line 1304 of file khtml_part.cpp.

References QValueList< KURL >::begin(), QObject::connect(), KParts::URLArgs::docState, QString::fromLatin1(), QString::isEmpty(), QValueList< KURL >::isEmpty(), KURL::isEmpty(), KURL::isValid(), KParts::ReadOnlyPart::m_url, KURL::prettyURL(), KURL::protocol(), KParts::URLArgs::serviceType, setAutoloadImages(), KURL::setPass(), KURL::setQuery(), KURL::setRef(), KURL::setUser(), setUserStyleSheet(), KParts::Part::setWindowCaption(), KURL::split(), QString::startsWith(), KURL::url(), KParts::URLArgs::xOffset, and KParts::URLArgs::yOffset.

Referenced by htmlError().

void KHTMLPart::write const char *  str,
int  len = -1
[virtual]
 

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

Definition at line 1390 of file khtml_part.cpp.

References encoding(), QString::isEmpty(), KParts::ReadOnlyPart::m_url, and KURL::url().

Referenced by end(), and htmlError().

void KHTMLPart::write const QString str  )  [virtual]
 

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

Definition at line 1428 of file khtml_part.cpp.

References QString::isNull(), KParts::ReadOnlyPart::m_url, and KURL::url().

void KHTMLPart::end  )  [virtual]
 

Call this after your last call to write().

Definition at line 1445 of file khtml_part.cpp.

References write().

Referenced by closeURL(), htmlError(), and stopAnimations().

void KHTMLPart::paint QPainter ,
const QRect ,
int  = 0,
bool *  = 0
 

Paints the HTML page to a QPainter.

See KHTMLView::paint for details

Definition at line 1454 of file khtml_part.cpp.

bool KHTMLPart::setEncoding const QString name,
bool  override = false
 

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

Definition at line 1804 of file khtml_part.cpp.

References closeURL(), KURL::isEmpty(), KParts::ReadOnlyPart::m_url, KStdAccel::name(), and openURL().

QString KHTMLPart::encoding  )  const
 

Returns the encoding the page currently uses.

Note that the encoding might be different from the charset.

Definition at line 1822 of file khtml_part.cpp.

References KHTMLSettings::encoding().

Referenced by restoreState(), and write().

void KHTMLPart::setUserStyleSheet const KURL url  ) 
 

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

Definition at line 1833 of file khtml_part.cpp.

References KURL::url().

Referenced by begin().

void KHTMLPart::setUserStyleSheet const QString styleSheet  ) 
 

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

Definition at line 1839 of file khtml_part.cpp.

void KHTMLPart::setStandardFont const QString name  ) 
 

Sets the standard font style.

Parameters:
name The font name to use for standard text.

Definition at line 1885 of file khtml_part.cpp.

References KStdAccel::name().

void KHTMLPart::setFixedFont const QString name  ) 
 

Sets the fixed font style.

Parameters:
name The font name to use for fixed text, e.g. the <pre> tag.

Definition at line 1890 of file khtml_part.cpp.

References KStdAccel::name().

bool KHTMLPart::gotoAnchor const QString name  ) 
 

Finds the anchor named name.

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

Definition at line 1845 of file khtml_part.cpp.

References KStdAccel::name().

Referenced by openURL().

void KHTMLPart::setURLCursor const QCursor c  ) 
 

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

Definition at line 1895 of file khtml_part.cpp.

QCursor KHTMLPart::urlCursor  )  const
 

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

Definition at line 1900 of file khtml_part.cpp.

void KHTMLPart::findTextBegin  ) 
 

Initiates a text search.

Definition at line 1915 of file khtml_part.cpp.

bool KHTMLPart::findTextNext const QString str,
bool  forward,
bool  caseSensitive,
bool  isRegExp
 

Finds the next occurence of the string or expression.

If isRegExp is true then str is converted to a QRegExp, and caseSensitive is ignored.

Definition at line 1976 of file khtml_part.cpp.

References KStdAccel::forward(), DOM::DOMString::implementation(), QString::length(), QRegExp::matchedLength(), KStdAccel::next(), QRegExp::search(), QRegExp::setCaseSensitive(), and QConstString::string().

void KHTMLPart::setZoomFactor int  percent  ) 
 

Sets the Zoom factor.

The value is given in percent, larger values mean a generally larger font and larger page contents. It is not guaranteed that all parts of the page are scaled with the same factor though.

The given value should be in the range of 20..300, values outside that range are not guaranteed to work. A value of 100 will disable all zooming and show the page with the sizes determined via the given lengths in the stylesheets.

Definition at line 4142 of file khtml_part.cpp.

References KStdAccel::end(), QApplication::restoreOverrideCursor(), and QApplication::setOverrideCursor().

Referenced by restoreState().

int KHTMLPart::zoomFactor  )  const
 

Returns the current zoom factor.

Definition at line 4102 of file khtml_part.cpp.

Referenced by khtml::CSSStyleSelector::CSSStyleSelector(), KHTMLView::print(), and restoreState().

QString KHTMLPart::selectedText  )  const [virtual]
 

Returns the text the user has marked.

Definition at line 2304 of file khtml_part.cpp.

References DOM::Node::elementId(), KStdAccel::end(), DOM::Node::firstChild(), DOM::Node::handle(), QString::isEmpty(), DOM::Node::isNull(), QString::left(), QString::length(), QString::mid(), KStdAccel::next(), DOM::Node::nextSibling(), DOM::Node::nodeType(), DOM::Node::nodeValue(), DOM::Node::parentNode(), and DOM::DOMString::string().

Referenced by khtmlMouseReleaseEvent().

DOM::Range KHTMLPart::selection  )  const
 

Returns the selected part of the HTML.

Definition at line 2432 of file khtml_part.cpp.

References DOM::Document::createRange(), and document().

void KHTMLPart::setSelection const DOM::Range &   ) 
 

Sets the current selection.

Definition at line 2441 of file khtml_part.cpp.

bool KHTMLPart::hasSelection  )  const
 

Has the user selected anything?

Call selectedText() to retrieve the selected text.

Returns:
true if there is text selected.

Definition at line 2422 of file khtml_part.cpp.

void KHTMLPart::selectAll  ) 
 

Marks all text in the document as selected.

Definition at line 4895 of file khtml_part.cpp.

References KStdAccel::next().

void KHTMLPart::show  ) 
 

Convenience method to show the document's view.

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

Definition at line 4078 of file khtml_part.cpp.

void KHTMLPart::hide  ) 
 

Convenience method to hide the document's view.

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

Definition at line 4084 of file khtml_part.cpp.

KParts::PartManager * KHTMLPart::partManager  ) 
 

Returns a reference to the partmanager instance which manages html frame objects.

Definition at line 3291 of file khtml_part.cpp.

References QObject::connect().

Referenced by currentFrame().

void KHTMLPart::saveState QDataStream stream  )  [virtual]
 

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

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

Definition at line 3816 of file khtml_part.cpp.

References KStdAccel::end(), KParts::ReadOnlyPart::m_url, and KURL::url().

void KHTMLPart::restoreState QDataStream stream  )  [virtual]
 

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

See also:
saveState()
This is called from the restoreState() method of the browserExtension() .

Definition at line 3894 of file khtml_part.cpp.

References QValueList< KURL >::begin(), closeURL(), QValueList< KURL >::ConstIterator(), KParts::URLArgs::docState, encoding(), frameNames(), KHTMLPageCache::isValid(), openURL(), KHTMLPageCache::self(), setZoomFactor(), KParts::URLArgs::xOffset, KParts::URLArgs::yOffset, and zoomFactor().

DOM::Node KHTMLPart::nodeUnderMouse  )  const
 

Returns the Node currently under the mouse.

Definition at line 4090 of file khtml_part.cpp.

KHTMLPart * KHTMLPart::parentPart  ) 
 

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

Returns 0L otherwise.

Definition at line 3780 of file khtml_part.cpp.

References QObject::parent().

Referenced by khtmlMouseMoveEvent(), khtmlMousePressEvent(), khtmlMouseReleaseEvent(), KHTMLPart(), and openURL().

QStringList KHTMLPart::frameNames  )  const
 

Returns a list of names of all frame (including iframe) objects of the current document.

Note that this method is not working recursively for sub-frames.

Definition at line 4294 of file khtml_part.cpp.

References KStdAccel::end().

Referenced by restoreState().

KHTMLPart * KHTMLPart::findFrame const QString f  ) 
 

Finds a frame by name.

Returns 0L if frame can't be found.

Definition at line 3740 of file khtml_part.cpp.

References QObject::inherits().

KParts::ReadOnlyPart * KHTMLPart::currentFrame  )  const
 

Return the current frame (the one that has focus) Not necessarily a direct child of ours, framesets can be nested.

Returns "this" if this part isn't a frameset.

Definition at line 3753 of file khtml_part.cpp.

References KParts::PartManager::activePart(), QObject::inherits(), and partManager().

bool KHTMLPart::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.

Definition at line 3768 of file khtml_part.cpp.

void KHTMLPart::setJSStatusBarText const QString text  ) 
 

Called by KJS.

Sets the StatusBarText assigned via window.status

Definition at line 4198 of file khtml_part.cpp.

References KParts::Part::setStatusBarText().

void KHTMLPart::setJSDefaultStatusBarText const QString text  ) 
 

Called by KJS.

Sets the DefaultStatusBarText assigned via window.defaultStatus

Definition at line 4203 of file khtml_part.cpp.

References KParts::Part::setStatusBarText().

QString KHTMLPart::jsStatusBarText  )  const
 

Called by KJS.

Returns the StatusBarText assigned via window.status

Definition at line 4208 of file khtml_part.cpp.

QString KHTMLPart::jsDefaultStatusBarText  )  const
 

Called by KJS.

Returns the DefaultStatusBarText assigned via window.defaultStatus

Definition at line 4213 of file khtml_part.cpp.

QString KHTMLPart::referrer  )  const
 

Referrer used for links in this page.

Definition at line 4218 of file khtml_part.cpp.

QString KHTMLPart::pageReferrer  )  const
 

Referrer used to obtain this page.

Definition at line 4223 of file khtml_part.cpp.

References KURL::isValid(), KParts::ReadOnlyPart::m_url, KURL::protocol(), KURL::setPass(), KURL::setRef(), KURL::setUser(), and KURL::url().

QString KHTMLPart::lastModified  )  const
 

Last-modified date (in raw string format), if received in the [HTTP] headers.

Definition at line 4243 of file khtml_part.cpp.

References KURL::isLocalFile(), KParts::ReadOnlyPart::m_url, KURL::path(), and QDateTime::toString().

void KHTMLPart::preloadStyleSheet const QString url,
const QString stylesheet
 

Loads a style sheet into the stylesheet cache.

Definition at line 5125 of file khtml_part.cpp.

void KHTMLPart::preloadScript const QString url,
const QString script
 

Loads a script into the script cache.

Definition at line 5130 of file khtml_part.cpp.

void KHTMLPart::onURL const QString url  )  [signal]
 

Emitted if the cursor is moved over an URL.

Referenced by khtmlMouseMoveEvent().

void KHTMLPart::popupMenu const QString url,
const QPoint point
[signal]
 

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

Referenced by khtmlMouseMoveEvent(), and khtmlMousePressEvent().

void KHTMLPart::selectionChanged  )  [signal]
 

This signal is emitted when the selection changes.

Referenced by khtmlMouseReleaseEvent().

void KHTMLPart::nodeActivated const DOM::Node  )  [signal]
 

This signal is emitted when an element retrieves the keyboard focus.

Note that the signal argument can be a null node if no element is active, meaning a node has explicitly been deactivated without a new one becoming active.

Referenced by closeURL().

KURL KHTMLPart::completeURL const QString url  )  [protected]
 

returns a KURL object for the given url.

Use when you know what you're doing.

Definition at line 1722 of file khtml_part.cpp.

Referenced by khtmlMouseMoveEvent().

void KHTMLPart::htmlError int  errorCode,
const QString text,
const KURL reqUrl
[protected]
 

presents a detailed error message to the user.

errorCode kio error code, eg KIO::ERR_SERVER_TIMEOUT. text kio additional information text. url the url that triggered the error.

Definition at line 1170 of file khtml_part.cpp.

References QString::arg(), begin(), KIO::buildErrorString(), KParts::ReadOnlyPart::completed(), QDateTime::currentDateTime(), KStdAccel::description(), end(), KLocale::formatDateTime(), QString::fromLatin1(), KURL::htmlURL(), QStringList::join(), KGlobal::locale(), KParts::ReadOnlyPart::m_url, KIO::rawErrorDetail(), QString::replace(), KParts::ReadOnlyPart::started(), and write().

Referenced by openURL(), and showError().

void KHTMLPart::khtmlMousePressEvent khtml::MousePressEvent *  event  )  [protected, virtual]
 

Eventhandler of the khtml::MousePressEvent.

Definition at line 4381 of file khtml_part.cpp.

References QMouseEvent::button(), KNotifyClient::event(), QMouseEvent::globalPos(), DOM::Node::handle(), DOM::Node::isNull(), parentPart(), popupMenu(), and QMouseEvent::pos().

void KHTMLPart::khtmlMouseDoubleClickEvent khtml::MouseDoubleClickEvent *   )  [protected, virtual]
 

Eventhandler for the khtml::MouseDoubleClickEvent.

Definition at line 4446 of file khtml_part.cpp.

References QMouseEvent::button(), KNotifyClient::event(), DOM::Node::handle(), and DOM::Node::isNull().

void KHTMLPart::khtmlMouseMoveEvent khtml::MouseMoveEvent *  event  )  [protected, virtual]
 

Eventhandler for the khtml::MouseDoubleMoveEvent.

Definition at line 4550 of file khtml_part.cpp.

References khtml::RenderObject::absolutePosition(), KMultipleDrag::addDragObject(), QString::arg(), completeURL(), QScrollView::contentsToViewport(), KGlobalSettings::dndEventDelay(), QDragObject::drag(), DOM::Node::elementId(), KNotifyClient::event(), DOM::Node::firstChild(), QMouseEvent::globalPos(), DOM::Node::handle(), DOM::Node::isNull(), QPixmap::isNull(), DOM::DOMString::length(), KURLDrag::metaData(), KMimeType::mimeType(), KURLDrag::newDrag(), KStdAccel::next(), DOM::Node::nextSibling(), onURL(), DOM::Node::parentNode(), parentPart(), KMimeType::pixmapForURL(), popupMenu(), QMouseEvent::pos(), QDragObject::setPixmap(), KParts::Part::setStatusBarText(), KIcon::SizeMedium, QMouseEvent::state(), DOM::DOMString::string(), view(), QPoint::x(), QMouseEvent::x(), QPoint::y(), and QMouseEvent::y().

void KHTMLPart::khtmlMouseReleaseEvent khtml::MouseReleaseEvent *  event  )  [protected, virtual]
 

Eventhandler for the khtml::MouseMoveEvent.

Definition at line 4720 of file khtml_part.cpp.

References QMouseEvent::button(), KParts::BrowserInterface::callMethod(), QApplication::clipboard(), QObject::connect(), QObject::disconnect(), KNotifyClient::event(), KURIFilter::filterURI(), DOM::Node::firstChild(), DOM::Node::isNull(), KStdAccel::next(), DOM::Node::nextSibling(), DOM::Node::parentNode(), parentPart(), QString::replace(), selectedText(), selectionChanged(), KURIFilter::self(), KURIFilterData::setData(), KParts::Part::setStatusBarText(), QClipboard::setText(), QClipboard::text(), KURIFilterData::uri(), KURIFilterData::uriType(), and KURL::url().

void KHTMLPart::khtmlDrawContentsEvent khtml::DrawContentsEvent *   )  [protected, virtual]
 

Eventhandler for the khtml::DrawContentsEvent.

Definition at line 4823 of file khtml_part.cpp.

void KHTMLPart::guiActivateEvent KParts::GUIActivateEvent event  )  [protected, virtual]
 

Internal reimplementation of KParts::Part::guiActivateEvent .

Reimplemented from KParts::ReadOnlyPart.

Definition at line 4827 of file khtml_part.cpp.

References QPtrList::append(), KNotifyClient::event(), and KXMLGUIClient::plugActionList().

bool KHTMLPart::openFile  )  [protected, virtual]
 

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

Implements KParts::ReadOnlyPart.

Definition at line 984 of file khtml_part.cpp.

KParts::ReadOnlyPart * KHTMLPart::createPart QWidget parentWidget,
const char *  widgetName,
QObject parent,
const char *  name,
const QString mimetype,
QString serviceName,
QStringList serviceTypes,
const QStringList params
[protected, virtual]
 

This method is called when a new embedded object (include html frames) is to be created.

Reimplement it if you want to add support for certain embeddable objects without registering them in the KDE wide registry system (KSyCoCa) . Another reason for re-implementing this method could be if you want to derive from KTHMLPart and also want all html frame objects to be a object of your derived type, in which case you should return a new instance for the mimetype 'text/html' .

Definition at line 3250 of file khtml_part.cpp.

References QString::append(), QObject::className(), KLibFactory::create(), QFile::encodeName(), KLibLoader::factory(), KXMLGUIClient::factory(), QString::fromLatin1(), QObject::inherits(), QString::isEmpty(), KIO::mimetype(), KStdAccel::name(), KTrader::OfferList, KService::Ptr, KTrader::query(), KLibLoader::self(), and KTrader::self().

void KHTMLPart::setActiveNode const DOM::Node node  )  [slot]
 

Sets the focussed node of the document to the specified node.

If the node is a form control, the control will receive focus in the same way that it would if the user had clicked on it or tabbed to it with the keyboard. For most other types of elements, there is no visul indiction of whether or not they are focussed.

See activeNode

Parameters:
node The node to focus

Definition at line 5076 of file khtml_part.cpp.

References QRect::bottom(), DOM::Node::handle(), QRect::left(), QRect::right(), and QRect::top().

void KHTMLPart::stopAnimations  )  [slot]
 

Stops all animated images on the current and child pages.

Definition at line 1460 of file khtml_part.cpp.

References KStdAccel::end(), and end().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.4.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sun Feb 27 22:16:41 2005 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001