KHTMLPart

Search for usage in LXR

#include <khtml_part.h>

Inheritance diagram for KHTMLPart:

Public Types

enum  CaretDisplayPolicy { CaretVisible, CaretInvisible, CaretBlink }
 
enum  DNSPrefetch { DNSPrefetchDisabled = 0, DNSPrefetchEnabled, DNSPrefetchOnlyWWWAndSLD }
 
enum  FindOptions { FindLinksOnly = 1 * KFind::MinimumUserOption, FindNoPopups = 2 * KFind::MinimumUserOption }
 
enum  FormNotification { NoNotification = 0, Before, Only, Unused = 255 }
 
enum  GUIProfile { DefaultGUI, BrowserViewGUI }
 

Properties

bool dndEnabled
 
DNSPrefetch dnsPrefetch
 
QString encoding
 
bool javaEnabled
 
bool javaScriptEnabled
 
QString lastModified
 
bool metaRefreshEnabled
 
bool modified
 
bool pluginsEnabled
 
- Properties inherited from QObject
 objectName
 

Signals

void caretPositionChanged (const DOM::Node &node, long offset)
 
void configurationChanged ()
 
void docCreated ()
 
void formSubmitNotification (const char *action, const QString &url, const QByteArray &formData, const QString &target, const QString &contentType, const QString &boundary)
 
void nodeActivated (const DOM::Node &)
 
void onURL (const QString &url)
 
void popupMenu (const QString &url, const QPoint &point)
 
void selectionChanged ()
 
- Signals inherited from KParts::ReadOnlyPart
void canceled (const QString &errMsg)
 
void completed ()
 
void completed (bool pendingAction)
 
void completedWithPendingAction ()
 
void started (KIO::Job *job)
 
void urlChanged (const QUrl &url)
 
- Signals inherited from KParts::Part
void setStatusBarText (const QString &text)
 
void setWindowCaption (const QString &caption)
 

Public Slots

QVariant executeScript (const QString &script)
 
void setActiveNode (const DOM::Node &node)
 
void setCaretMode (bool enable)
 
void setCaretVisible (bool show)
 
void setEditable (bool enable)
 
void stopAnimations ()
 
void submitFormProxy (const char *action, const QString &url, const QByteArray &formData, const QString &target, const QString &contentType=QString(), const QString &boundary=QString())
 
- Public Slots inherited from KParts::ReadOnlyPart

Public Member Functions

 KHTMLPart (KHTMLView *view, QObject *parent=nullptr, GUIProfile prof=DefaultGUI)
 
 KHTMLPart (QWidget *parentWidget=nullptr, QObject *parent=nullptr, GUIProfile prof=DefaultGUI)
 
virtual ~KHTMLPart ()
 
DOM::Node activeNode () const
 
bool autoloadImages () const
 
QUrl backgroundURL () const
 
QUrl baseURL () const
 
virtual void begin (const QUrl &url=QUrl(), int xOffset=0, int yOffset=0)
 
KParts::BrowserExtensionbrowserExtension () const
 
KParts::BrowserHostExtensionbrowserHostExtension () const
 
CaretDisplayPolicy caretDisplayPolicyNonFocused () const
 
bool closeUrl () override
 
KParts::ReadOnlyPartcurrentFrame () const
 
bool dndEnabled () const
 
DNSPrefetch dnsPrefetch () const
 
DOM::Document document () const
 
QString documentSource () const
 
DOM::Editoreditor () const
 
QString encoding () const
 
virtual void end ()
 
QVariant executeScript (const DOM::Node &n, const QString &script)
 
KHTMLPartfindFrame (const QString &f)
 
KHTMLPartfindFrameParent (KParts::ReadOnlyPart *callingPart, const QString &f, khtml::ChildFrame **childFrame=nullptr)
 
KParts::ReadOnlyPartfindFramePart (const QString &f)
 
void findText ()
 
void findText (const QString &str, long options, QWidget *parent=nullptr, KFindDialog *findDialog=nullptr)
 
void findTextBegin ()
 
bool findTextNext (bool reverse=false)
 
int fontScaleFactor () const
 
bool forcePermitLocalImages () const
 
FormNotification formNotification () const
 
bool frameExists (const QString &frameName)
 
KJSProxyframejScript (KParts::ReadOnlyPart *framePart)
 
QStringList frameNames () const
 
QList< KParts::ReadOnlyPart * > frames () const
 
bool gotoAnchor (const QString &name)
 
bool hasSelection () const
 
void hide ()
 
DOM::HTMLDocument htmlDocument () const
 
KHTMLPartPrivate * impl ()
 
bool inProgress () const
 
bool isCaretMode () const
 
bool isEditable () const
 
bool isModified () const
 
bool isPointInsideSelection (int x, int y)
 
bool javaEnabled () const
 
bool jScriptEnabled () const
 
KJS::InterpreterjScriptInterpreter ()
 
QString jsDefaultStatusBarText () const
 
QString jsStatusBarText () const
 
QString lastModified () const
 
bool metaRefreshEnabled () const
 
bool nextAnchor ()
 
DOM::Node nodeUnderMouse () const
 
DOM::Node nonSharedNodeUnderMouse () const
 
bool onlyLocalReferences () const
 
bool openUrl (const QUrl &url) override
 
QString pageReferrer () const
 
void paint (QPainter *, const QRect &, int=0, bool *=nullptr)
 
KHTMLPartparentPart ()
 
KParts::PartManagerpartManager ()
 
bool pluginsEnabled () const
 
void preloadScript (const QString &url, const QString &script)
 
void preloadStyleSheet (const QString &url, const QString &stylesheet)
 
bool prevAnchor ()
 
QString referrer () const
 
bool restored () const
 
virtual void restoreState (QDataStream &stream)
 
virtual void saveState (QDataStream &stream)
 
void scheduleRedirection (int delay, const QString &url, bool lockHistory=true)
 
void selectAll ()
 
virtual QString selectedText () const
 
QString selectedTextAsHTML () const
 
DOM::Range selection () const
 
void selection (DOM::Node &startNode, long &startOffset, DOM::Node &endNode, long &endOffset) const
 
void setAlwaysHonourDoctype (bool b=true)
 
void setAutoloadImages (bool enable)
 
void setCaretDisplayPolicyNonFocused (CaretDisplayPolicy policy)
 
void setCaretPosition (DOM::Node node, long offset, bool extendSelection=false)
 
void setDNDEnabled (bool b)
 
void setDNSPrefetch (DNSPrefetch pmode)
 
bool setEncoding (const QString &name, bool override=false)
 
void setFixedFont (const QString &name)
 
void setFontScaleFactor (int percent)
 
void setForcePermitLocalImages (bool enable)
 
void setFormNotification (FormNotification fn)
 
void setJavaEnabled (bool enable)
 
void setJScriptEnabled (bool enable)
 
void setJSDefaultStatusBarText (const QString &text)
 
void setJSStatusBarText (const QString &text)
 
void setMetaRefreshEnabled (bool enable)
 
void setOnlyLocalReferences (bool enable)
 
void setPluginsEnabled (bool enable)
 
void setSelection (const DOM::Range &)
 
void setStandardFont (const QString &name)
 
void setStatusMessagesEnabled (bool enable)
 
void setSuppressedPopupIndicator (bool enable, KHTMLPart *originPart=nullptr)
 
const KHTMLSettingssettings () const
 
void setURLCursor (const QCursor &c)
 
void setUserStyleSheet (const QString &styleSheet)
 
void setUserStyleSheet (const QUrl &url)
 
void setZoomFactor (int percent)
 
void show ()
 
virtual void showError (KJob *job)
 
bool statusMessagesEnabled () const
 
QUrl toplevelURL ()
 
QCursor urlCursor () const
 
KHTMLViewview () const
 
virtual void write (const char *str, int len=-1)
 
virtual void write (const QString &str)
 
int zoomFactor () const
 
- Public Member Functions inherited from KParts::ReadOnlyPart
 ReadOnlyPart (QObject *parent=nullptr)
 
OpenUrlArguments arguments () const
 
BrowserExtensionbrowserExtension () const
 
bool closeStream ()
 
bool isProgressInfoEnabled () const
 
bool openStream (const QString &mimeType, const QUrl &url)
 
void setArguments (const OpenUrlArguments &arguments)
 
void setProgressInfoEnabled (bool show)
 
void showProgressInfo (bool show)
 
QUrl url () const
 
bool writeStream (const QByteArray &data)
 
- Public Member Functions inherited from KParts::Part
 Part (QObject *parent=nullptr)
 
virtual void embed (QWidget *parentWidget)
 
virtual ParthitTest (QWidget *widget, const QPoint &globalPos)
 
KIconLoadericonLoader ()
 
bool isSelectable () const
 
PartManagermanager () const
 
KPluginMetaData metaData () const
 
void setAutoDeletePart (bool autoDeletePart)
 
void setAutoDeleteWidget (bool autoDeleteWidget)
 
virtual void setManager (PartManager *manager)
 
virtual void setSelectable (bool selectable)
 
virtual QWidgetwidget ()
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo ()
 
void dumpObjectInfo () const const
 
void dumpObjectTree ()
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
qobject_cast (const QObject *object)
 
qobject_cast (QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
QThreadthread () const const
 
- Public Member Functions inherited from KParts::PartBase
KAboutData componentData () const
 
void setPartObject (QObject *object)
 
- Public Member Functions inherited from KXMLGUIClient
 KXMLGUIClient (KXMLGUIClient *parent)
 
QActionaction (const char *name) const
 
virtual QActionaction (const QDomElement &element) const
 
virtual KActionCollectionactionCollection () const
 
QList< KXMLGUIClient * > childClients ()
 
KXMLGUIBuilderclientBuilder () const
 
virtual QString componentName () const
 
virtual QDomDocument domDocument () const
 
KXMLGUIFactoryfactory () const
 
void insertChildClient (KXMLGUIClient *child)
 
KXMLGUIClientparentClient () const
 
void plugActionList (const QString &name, const QList< QAction * > &actionList)
 
void reloadXML ()
 
void removeChildClient (KXMLGUIClient *child)
 
void replaceXMLFile (const QString &xmlfile, const QString &localxmlfile, bool merge=false)
 
void setClientBuilder (KXMLGUIBuilder *builder)
 
void setFactory (KXMLGUIFactory *factory)
 
void setXMLGUIBuildDocument (const QDomDocument &doc)
 
void unplugActionList (const QString &name)
 
virtual QString xmlFile () const
 
QDomDocument xmlguiBuildDocument () const
 

Protected Types

enum  PageSecurity { NotCrypted, Encrypted, Mixed }
 
- Protected Types inherited from KParts::PartBase
enum  PluginLoadingMode
 

Protected Slots

virtual void slotFinished (KJob *)
 
- Protected Slots inherited from KParts::Part
void slotWidgetDestroyed ()
 

Protected Member Functions

QUrl completeURL (const QString &url)
 
virtual KParts::ReadOnlyPartcreatePart (QWidget *parentWidget, QObject *parent, const QString &mimetype, QString &serviceName, QStringList &serviceTypes, const QStringList &params)
 
void customEvent (QEvent *event) override
 
bool doCloseStream () override
 
bool doOpenStream (const QString &mimeType) override
 
bool doWriteStream (const QByteArray &data) override
 
void guiActivateEvent (KParts::GUIActivateEvent *event) override
 
void htmlError (int errorCode, const QString &text, const QUrl &reqUrl)
 
virtual void khtmlDrawContentsEvent (khtml::DrawContentsEvent *)
 
virtual void khtmlMouseDoubleClickEvent (khtml::MouseDoubleClickEvent *)
 
virtual void khtmlMouseMoveEvent (khtml::MouseMoveEvent *event)
 
virtual void khtmlMousePressEvent (khtml::MousePressEvent *event)
 
virtual void khtmlMouseReleaseEvent (khtml::MouseReleaseEvent *event)
 
bool mayPrefetchHostname (const QString &name)
 
bool openFile () override
 
bool pluginPageQuestionAsked (const QString &mimetype) const
 
void setPageSecurity (PageSecurity sec)
 
void setPluginPageQuestionAsked (const QString &mimetype)
 
virtual void startingJob (KIO::Job *)
 
void timerEvent (QTimerEvent *) override
 
void updateZoomFactor ()
 
virtual bool urlSelected (const QString &url, int button, int state, const QString &_target, const KParts::OpenUrlArguments &args=KParts::OpenUrlArguments(), const KParts::BrowserArguments &browserArgs=KParts::BrowserArguments())
 
- Protected Member Functions inherited from KParts::ReadOnlyPart
void abortLoad ()
 
bool isLocalFileTemporary () const
 
QString localFilePath () const
 
void setLocalFilePath (const QString &localFilePath)
 
void setLocalFileTemporary (bool temp)
 
void setUrl (const QUrl &url)
 
- Protected Member Functions inherited from KParts::Part
QWidgethostContainer (const QString &containerName)
 
void loadPlugins ()
 
void loadPlugins (QObject *parent, KXMLGUIClient *parentGUIClient, const KAboutData &aboutData)
 
void loadPlugins (QObject *parent, KXMLGUIClient *parentGUIClient, const QString &parentInstanceName)
 
virtual void partActivateEvent (PartActivateEvent *event)
 
virtual void partSelectEvent (PartSelectEvent *event)
 
void setMetaData (const KPluginMetaData &metaData)
 
virtual void setWidget (QWidget *widget)
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
- Protected Member Functions inherited from KParts::PartBase
void loadPlugins (QObject *parent, KXMLGUIClient *parentGUIClient, const KAboutData &aboutData)
 
void loadPlugins (QObject *parent, KXMLGUIClient *parentGUIClient, const QString &parentInstanceName)
 
virtual void setComponentData (const KAboutData &componentData)
 
virtual void setComponentData (const KAboutData &pluginData, bool loadPlugins)
 
void setPluginInterfaceVersion (int version)
 
void setPluginLoadingMode (PluginLoadingMode loadingMode)
 
- Protected Member Functions inherited from KXMLGUIClient
void loadStandardsXmlFile ()
 
virtual void setComponentName (const QString &componentName, const QString &componentDisplayName)
 
virtual void setDOMDocument (const QDomDocument &document, bool merge=false)
 
virtual void setLocalXMLFile (const QString &file)
 
virtual void setXML (const QString &document, bool merge=false)
 
virtual void setXMLFile (const QString &file, bool merge=false, bool setXMLDoc=true)
 
virtual void stateChanged (const QString &newstate, ReverseStateChange reverse=StateNoReverse)
 

Additional Inherited Members

- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Static Public Member Functions inherited from KXMLGUIClient
static QString findVersionNumber (const QString &xml)
 
- Public Attributes inherited from QObject
typedef QObjectList
 
- Static Protected Member Functions inherited from KXMLGUIClient
static QString standardsXmlFileLocation ()
 
- Protected Attributes inherited from KParts::PartBase
 DoNotLoadPlugins
 
 LoadPlugins
 
 LoadPluginsIfEnabled
 

Detailed Description

This class is khtml's main class.

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

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

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

Java and JavaScript are enabled by default depending on the user's settings. If you do not need them, and especially 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->setJavaEnabled(false);

You may also wish to disable external references. This will prevent KHTML from loading images, frames, etc, or redirecting to external sites.

Some apps want to write their HTML code directly into the widget instead of opening an url. You can do this 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 wish. There are two write() methods, one accepting a QString and 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.

It is also possible to write content to the HTML part using the standard streaming API from KParts::ReadOnlyPart. The usage of the API is similar to that of the begin(), write(), end() process described above as the following example shows:

KHTMLPart *doc = new KHTMLPart();
doc->openStream( "text/html", QUrl() );
doc->writeStream( QCString( "<html><body><p>KHTML Rocks!</p></body></html>" ) );
doc->closeStream();

HTML Browser Widget

Author
Lars Knoll (knoll[email protected]@kde[email protected].org)

Definition at line 208 of file khtml_part.h.

Member Enumeration Documentation

◆ CaretDisplayPolicy

Enumeration for displaying the caret.

Enumerator
CaretVisible 

caret is displayed

CaretInvisible 

caret is not displayed

CaretBlink 

caret toggles between visible and invisible

Definition at line 588 of file khtml_part.h.

◆ DNSPrefetch

DNS Prefetching Mode enumeration.

  • DNSPrefetchDisabled do not prefetch hostnames
  • DNSPrefetchEnabled always prefetch hostnames
  • DNSPrefetchOnlyWWWAndSLD only do DNS prefetching for bare SLD and www sub-domain

Definition at line 283 of file khtml_part.h.

◆ FindOptions

Extra Find options that can be used when calling the extended findText().

Definition at line 789 of file khtml_part.h.

Constructor & Destructor Documentation

◆ KHTMLPart() [1/2]

KHTMLPart::KHTMLPart ( QWidget parentWidget = nullptr,
QObject parent = nullptr,
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 QScrollArea, 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 one 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 195 of file khtml_part.cpp.

◆ KHTMLPart() [2/2]

KHTMLPart::KHTMLPart ( KHTMLView view,
QObject parent = nullptr,
GUIProfile  prof = DefaultGUI 
)

Constructs a new KHTMLPart.

This constructor is useful if you wish to subclass KHTMLView. If the view passed as first argument to the constructor was built with a null KHTMLPart pointer, then the newly created KHTMLPart will be assigned as the view's part.

Therefore, you might either initialize the view as part of the initialization list of your derived KHTMLPart class constructor:

MyKHTMLPart() : KHTMLPart( new MyKHTMLView( this ), ...

Or separately build the KHTMLView beforehand:

KHTMLView * v = KHTMLView( 0L, parentWidget());
KHTMLPart * p = KHTMLPart( v ); // p will be assigned to v, so that v->part() == p

Definition at line 204 of file khtml_part.cpp.

◆ ~KHTMLPart()

KHTMLPart::~KHTMLPart ( )
virtual

Destructor.

Definition at line 557 of file khtml_part.cpp.

Member Function Documentation

◆ activeNode()

DOM::Node KHTMLPart::activeNode ( ) const

Returns the node that has the keyboard focus.

Definition at line 7136 of file khtml_part.cpp.

◆ autoloadImages()

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 1541 of file khtml_part.cpp.

◆ backgroundURL()

QUrl KHTMLPart::backgroundURL ( ) const

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

Definition at line 4078 of file khtml_part.cpp.

◆ begin()

void KHTMLPart::begin ( const QUrl url = QUrl(),
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( QUrl("file:/tmp/test.html" ) );
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.

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

Definition at line 2072 of file khtml_part.cpp.

◆ browserExtension()

KParts::BrowserExtension * KHTMLPart::browserExtension ( ) const

Returns a pointer to the KParts::BrowserExtension.

Definition at line 1089 of file khtml_part.cpp.

◆ caretDisplayPolicyNonFocused()

KHTMLPart::CaretDisplayPolicy KHTMLPart::caretDisplayPolicyNonFocused ( ) const

Returns the current caret policy when the view is not focused.

Definition at line 3063 of file khtml_part.cpp.

◆ caretPositionChanged

void KHTMLPart::caretPositionChanged ( const DOM::Node node,
long  offset 
)
signal

This signal is emitted whenever the caret position has been changed.

The signal transmits the position the DOM::Range way, the node and the zero-based offset within this node.

Parameters
nodenode which the caret is in. This can be null if the caret has been deactivated.
offsetoffset within the node. If the node is null, the offset is meaningless.

◆ closeUrl()

bool KHTMLPart::closeUrl ( )
overridevirtual

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

Reimplemented from KParts::ReadOnlyPart.

Definition at line 964 of file khtml_part.cpp.

◆ completeURL()

QUrl KHTMLPart::completeURL ( const QString url)
protected

returns a QUrl object for the given url.

Use when you know what you're doing.

Definition at line 2632 of file khtml_part.cpp.

◆ configurationChanged

void KHTMLPart::configurationChanged ( )
signal

Emitted whenever the configuration has changed.

◆ createPart()

KParts::ReadOnlyPart * KHTMLPart::createPart ( QWidget parentWidget,
QObject parent,
const QString mimetype,
QString serviceName,
QStringList serviceTypes,
const QStringList params 
)
protectedvirtual

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 4781 of file khtml_part.cpp.

◆ currentFrame()

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 5482 of file khtml_part.cpp.

◆ dndEnabled()

bool KHTMLPart::dndEnabled ( ) const

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

◆ dnsPrefetch()

DNSPrefetch KHTMLPart::dnsPrefetch ( ) const

Returns currently set DNS prefetching mode.

See DNSPrefetch enum for explanation of values.

Note
Always returns DNSPrefetchDisabled if setOnlyLocalReferences() mode is enabled.
Since
4.2

◆ docCreated

void KHTMLPart::docCreated ( )
signal

◆ doCloseStream()

bool KHTMLPart::doCloseStream ( )
overrideprotectedvirtual

Implements the streaming API of KParts::ReadOnlyPart.

Reimplemented from KParts::ReadOnlyPart.

Definition at line 2281 of file khtml_part.cpp.

◆ document()

DOM::Document KHTMLPart::document ( ) const

Returns a reference to the DOM document.

Definition at line 1057 of file khtml_part.cpp.

◆ documentSource()

QString KHTMLPart::documentSource ( ) const

Returns the content of the source document.

Definition at line 1062 of file khtml_part.cpp.

◆ doOpenStream()

bool KHTMLPart::doOpenStream ( const QString mimeType)
overrideprotectedvirtual

Implements the streaming API of KParts::ReadOnlyPart.

Reimplemented from KParts::ReadOnlyPart.

Definition at line 2264 of file khtml_part.cpp.

◆ doWriteStream()

bool KHTMLPart::doWriteStream ( const QByteArray data)
overrideprotectedvirtual

Implements the streaming API of KParts::ReadOnlyPart.

Reimplemented from KParts::ReadOnlyPart.

Definition at line 2275 of file khtml_part.cpp.

◆ editor()

DOM::Editor * KHTMLPart::editor ( ) const

Returns the instance of the attached html editor interface.

Definition at line 3672 of file khtml_part.cpp.

◆ encoding()

QString KHTMLPart::encoding ( ) const

Returns the encoding the page currently uses.

Note that the encoding might be different from the charset.

◆ end()

void KHTMLPart::end ( )
virtual

Call this after your last call to write().

Definition at line 2230 of file khtml_part.cpp.

◆ executeScript() [1/2]

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

Same as executeScript( const QString & ) except with the Node parameter specifying the 'this' value.

Definition at line 1382 of file khtml_part.cpp.

◆ executeScript [2/2]

QVariant KHTMLPart::executeScript ( const QString script)
slot

Execute the specified snippet of JavaScript code.

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

Deprecated:
, use executeString( DOM::Node(), script)

Definition at line 1377 of file khtml_part.cpp.

◆ findFrame()

KHTMLPart * KHTMLPart::findFrame ( const QString f)

Finds a frame by name.

Returns 0L if frame can't be found.

Definition at line 5465 of file khtml_part.cpp.

◆ findFrameParent()

KHTMLPart * KHTMLPart::findFrameParent ( KParts::ReadOnlyPart callingPart,
const QString f,
khtml::ChildFrame **  childFrame = nullptr 
)

Recursively finds the part containing the frame with name f and checks if it is accessible by callingPart Returns 0L if no suitable frame can't be found.

Returns parent part if a suitable frame was found and frame info in *childFrame

Definition at line 5363 of file khtml_part.cpp.

◆ findFramePart()

KParts::ReadOnlyPart * KHTMLPart::findFramePart ( const QString f)

Finds a frame by name.

Returns 0L if frame can't be found.

Definition at line 5476 of file khtml_part.cpp.

◆ findText() [1/2]

void KHTMLPart::findText ( )

Starts a new search by popping up a dialog asking the user what he wants to search for.

Definition at line 3189 of file khtml_part.cpp.

◆ findText() [2/2]

void KHTMLPart::findText ( const QString str,
long  options,
QWidget parent = nullptr,
KFindDialog findDialog = nullptr 
)

Starts a new search, but bypasses the user dialog.

Parameters
strThe string to search for.
optionsFind options.
parentParent used for centering popups like "string not found".
findDialogOptionally, you can supply your own dialog.

Definition at line 3197 of file khtml_part.cpp.

◆ findTextBegin()

void KHTMLPart::findTextBegin ( )

Initiates a text search.

Definition at line 3103 of file khtml_part.cpp.

◆ findTextNext()

bool KHTMLPart::findTextNext ( bool  reverse = false)

Finds the next occurrence of a string set by findText()

Parameters
reverseif true, revert seach direction (only if no find dialog is used)
Returns
true if a new match was found.

Definition at line 3206 of file khtml_part.cpp.

◆ fontScaleFactor()

int KHTMLPart::fontScaleFactor ( ) const

Returns the current font scale factor.

Definition at line 6078 of file khtml_part.cpp.

◆ forcePermitLocalImages()

bool KHTMLPart::forcePermitLocalImages ( ) const

If true, local image files will be loaded even when forbidden by the Kiosk/KAuthorized policies ( default false ).

See setForcePermitLocalImages.

Since
4.6

Definition at line 2923 of file khtml_part.cpp.

◆ formNotification()

KHTMLPart::FormNotification KHTMLPart::formNotification ( ) const

Determine if signal should be emitted before, instead or never when a submitForm() happens.

KDE5 remove me

Definition at line 7566 of file khtml_part.cpp.

◆ formSubmitNotification

void KHTMLPart::formSubmitNotification ( const char *  action,
const QString url,
const QByteArray formData,
const QString target,
const QString contentType,
const QString boundary 
)
signal

If form notification is on, this will be emitted either for a form submit or before the form submit according to the setting.

◆ frameExists()

bool KHTMLPart::frameExists ( const QString frameName)

Returns whether a frame with the specified name is exists or not.

In contrast 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 5499 of file khtml_part.cpp.

◆ framejScript()

KJSProxy * KHTMLPart::framejScript ( KParts::ReadOnlyPart framePart)

Returns child frame framePart its script interpreter.

Definition at line 5523 of file khtml_part.cpp.

◆ frameNames()

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 6233 of file khtml_part.cpp.

◆ gotoAnchor()

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 2825 of file khtml_part.cpp.

◆ guiActivateEvent()

void KHTMLPart::guiActivateEvent ( KParts::GUIActivateEvent event)
overrideprotectedvirtual

Internal reimplementation of KParts::Part::guiActivateEvent .

Reimplemented from KParts::ReadOnlyPart.

Definition at line 6829 of file khtml_part.cpp.

◆ hasSelection()

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 3410 of file khtml_part.cpp.

◆ hide()

void KHTMLPart::hide ( )

Convenience method to hide the document's view.

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

Definition at line 5864 of file khtml_part.cpp.

◆ htmlDocument()

DOM::HTMLDocument KHTMLPart::htmlDocument ( ) const

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

Definition at line 1048 of file khtml_part.cpp.

◆ htmlError()

void KHTMLPart::htmlError ( int  errorCode,
const QString text,
const QUrl 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 1877 of file khtml_part.cpp.

◆ impl()

KHTMLPartPrivate* KHTMLPart::impl ( )
inline

Access to internal APIs. Don't use outside

Definition at line 1934 of file khtml_part.h.

◆ inProgress()

bool KHTMLPart::inProgress ( ) const

Definition at line 7696 of file khtml_part.cpp.

◆ isCaretMode()

bool KHTMLPart::isCaretMode ( ) const

Returns whether caret mode is on/off.

Definition at line 3012 of file khtml_part.cpp.

◆ isEditable()

bool KHTMLPart::isEditable ( ) const

Returns true if the document is editable, false otherwise.

Definition at line 3035 of file khtml_part.cpp.

◆ isModified()

bool KHTMLPart::isModified ( ) const

Checks whether the page contains unsubmitted form changes.

Returns
true if form changes exist

Definition at line 7585 of file khtml_part.cpp.

◆ isPointInsideSelection()

bool KHTMLPart::isPointInsideSelection ( int  x,
int  y 
)

Returns whether the given point is inside the current selection.

The coordinates are content-coordinates.

Definition at line 6322 of file khtml_part.cpp.

◆ javaEnabled()

bool KHTMLPart::javaEnabled ( ) const

Return true if Java applet support is enabled, false if disabled.

◆ jScriptEnabled()

bool KHTMLPart::jScriptEnabled ( ) const

Returns true if Javascript support is enabled or false otherwise.

Definition at line 1149 of file khtml_part.cpp.

◆ jScriptInterpreter()

KJS::Interpreter * KHTMLPart::jScriptInterpreter ( )

Returns the JavaScript interpreter the part is using.

This method is mainly intended for applications which embed and extend the part and provides a mechanism for adding additional native objects to the interpreter (or removing the built-ins).

One thing people using this method to add things to the interpreter must consider, is that when you start writing new content to the part, the interpreter is cleared. This includes both use of the begin( const QUrl &, int, int ) method, and the openUrl( const QUrl & ) method. If you want your objects to have a longer lifespan, then you must retain a KJS::Object yourself to ensure that the reference count of your custom objects never reaches 0. You will also need to re-add your bindings every time this happens - one way to detect the need for this is to connect to the docCreated() signal, another is to reimplement the begin() method.

Definition at line 1125 of file khtml_part.cpp.

◆ jsDefaultStatusBarText()

QString KHTMLPart::jsDefaultStatusBarText ( ) const

Called by KJS.

Returns the DefaultStatusBarText assigned via window.defaultStatus

Definition at line 6134 of file khtml_part.cpp.

◆ jsStatusBarText()

QString KHTMLPart::jsStatusBarText ( ) const

Called by KJS.

Returns the StatusBarText assigned via window.status

Definition at line 6129 of file khtml_part.cpp.

◆ khtmlDrawContentsEvent()

void KHTMLPart::khtmlDrawContentsEvent ( khtml::DrawContentsEvent *  )
protectedvirtual

Eventhandler for the khtml::DrawContentsEvent.

Definition at line 6825 of file khtml_part.cpp.

◆ khtmlMouseDoubleClickEvent()

void KHTMLPart::khtmlMouseDoubleClickEvent ( khtml::MouseDoubleClickEvent *  event)
protectedvirtual

Eventhandler for the khtml::MouseDoubleClickEvent.

Definition at line 6542 of file khtml_part.cpp.

◆ khtmlMouseMoveEvent()

void KHTMLPart::khtmlMouseMoveEvent ( khtml::MouseMoveEvent *  event)
protectedvirtual

Eventhandler for the khtml::MouseMouseMoveEvent.

Definition at line 6749 of file khtml_part.cpp.

◆ khtmlMousePressEvent()

void KHTMLPart::khtmlMousePressEvent ( khtml::MousePressEvent *  event)
protectedvirtual

Eventhandler of the khtml::MousePressEvent.

Definition at line 6499 of file khtml_part.cpp.

◆ khtmlMouseReleaseEvent()

void KHTMLPart::khtmlMouseReleaseEvent ( khtml::MouseReleaseEvent *  event)
protectedvirtual

Eventhandler for the khtml::MouseMouseReleaseEvent.

Definition at line 6762 of file khtml_part.cpp.

◆ lastModified()

QString KHTMLPart::lastModified ( ) const

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

◆ mayPrefetchHostname()

bool KHTMLPart::mayPrefetchHostname ( const QString name)
protected

Will pre-resolve name according to dnsPrefetch current settings Returns true if the name will be pre-resolved.

Otherwise returns false.

Definition at line 3625 of file khtml_part.cpp.

◆ metaRefreshEnabled()

bool KHTMLPart::metaRefreshEnabled ( ) const

Returns true if automatic forwarding is enabled.

◆ nextAnchor()

bool KHTMLPart::nextAnchor ( )

Go to the next anchor.

This is useful to navigate from outside the navigator

Definition at line 2873 of file khtml_part.cpp.

◆ nodeActivated

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.

◆ nodeUnderMouse()

DOM::Node KHTMLPart::nodeUnderMouse ( ) const

Returns the Node currently under the mouse.

The returned node may be a shared node (e. g. an <area> node if the mouse is hovering over an image map).

Definition at line 5871 of file khtml_part.cpp.

◆ nonSharedNodeUnderMouse()

DOM::Node KHTMLPart::nonSharedNodeUnderMouse ( ) const

Returns the Node currently under the mouse that is not shared.

The returned node is always the node that is physically under the mouse pointer (irrespective of logically overlying elements like, e. g., <area> on image maps).

Definition at line 5876 of file khtml_part.cpp.

◆ onlyLocalReferences()

bool KHTMLPart::onlyLocalReferences ( ) const

Returns whether only file:/ or data:/ references are allowed to be loaded ( default false ).

See setOnlyLocalReferences.

Definition at line 2913 of file khtml_part.cpp.

◆ onURL

void KHTMLPart::onURL ( const QString url)
signal

Emitted if the cursor is moved over an URL.

◆ openFile()

bool KHTMLPart::openFile ( )
overrideprotectedvirtual

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

Reimplemented from KParts::ReadOnlyPart.

Definition at line 1693 of file khtml_part.cpp.

◆ openUrl()

bool KHTMLPart::openUrl ( const QUrl url)
overridevirtual

Opens the specified URL url.

Reimplemented from KParts::ReadOnlyPart::openUrl .

The format of the error url is that two variables are passed in the query: error = int kio error code, errText = QString error text from kio and the URL where the error happened is passed as a sub URL.

Reimplemented from KParts::ReadOnlyPart.

Definition at line 707 of file khtml_part.cpp.

◆ pageReferrer()

QString KHTMLPart::pageReferrer ( ) const

Referrer used to obtain this page.

Definition at line 6144 of file khtml_part.cpp.

◆ paint()

void KHTMLPart::paint ( QPainter p,
const QRect rc,
int  yOff = 0,
bool *  more = nullptr 
)

Paints the HTML page to a QPainter.

See KHTMLView::paint for details

Definition at line 2287 of file khtml_part.cpp.

◆ parentPart()

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 5545 of file khtml_part.cpp.

◆ partManager()

KParts::PartManager * KHTMLPart::partManager ( )

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

Definition at line 4838 of file khtml_part.cpp.

◆ pluginsEnabled()

bool KHTMLPart::pluginsEnabled ( ) const

Returns true if plugins are enabled, false if disabled.

◆ popupMenu

void KHTMLPart::popupMenu ( const QString url,
const QPoint point 
)
signal

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

See KParts::BrowserExtension for two more popupMenu signals emitted by khtml, with much more information in the signal.

◆ preloadScript()

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

Loads a script into the script cache.

Definition at line 7177 of file khtml_part.cpp.

◆ preloadStyleSheet()

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

Loads a style sheet into the stylesheet cache.

Definition at line 7172 of file khtml_part.cpp.

◆ prevAnchor()

bool KHTMLPart::prevAnchor ( )

Go to previous anchor.

Definition at line 2883 of file khtml_part.cpp.

◆ referrer()

QString KHTMLPart::referrer ( ) const

Referrer used for links in this page.

Definition at line 6139 of file khtml_part.cpp.

◆ restored()

bool KHTMLPart::restored ( ) const

Definition at line 7187 of file khtml_part.cpp.

◆ restoreState()

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 5671 of file khtml_part.cpp.

◆ saveState()

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 5583 of file khtml_part.cpp.

◆ scheduleRedirection()

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

Schedules a redirection after delay seconds.

Definition at line 2673 of file khtml_part.cpp.

◆ selectAll()

void KHTMLPart::selectAll ( )

Marks all text in the document as selected.

Definition at line 6951 of file khtml_part.cpp.

◆ selectedText()

QString KHTMLPart::selectedText ( ) const
virtual

Returns the text the user has marked.

Definition at line 3238 of file khtml_part.cpp.

◆ selectedTextAsHTML()

QString KHTMLPart::selectedTextAsHTML ( ) const

Return the text the user has marked.

This is guaranteed to be valid xml, and to contain the <html> and <body> tags.

FIXME probably should make virtual for 4.0 ?

Definition at line 3219 of file khtml_part.cpp.

◆ selection() [1/2]

DOM::Range KHTMLPart::selection ( ) const

Returns the selected part of the HTML.

Definition at line 3415 of file khtml_part.cpp.

◆ selection() [2/2]

void KHTMLPart::selection ( DOM::Node startNode,
long &  startOffset,
DOM::Node endNode,
long &  endOffset 
) const

Returns the selected part of the HTML by returning the starting and end position.

If there is no selection, both nodes and offsets are equal.

Parameters
startNodereturns node selection starts in
startOffsetreturns offset within starting node
endNodereturns node selection ends in
endOffsetreturns offset within end node.

Definition at line 3420 of file khtml_part.cpp.

◆ selectionChanged

void KHTMLPart::selectionChanged ( )
signal

This signal is emitted when the selection changes.

◆ setActiveNode

void KHTMLPart::setActiveNode ( const DOM::Node node)
slot

Sets the focused 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 visual indication of whether or not they are focused.

See activeNode

Parameters
nodeThe node to focus

Definition at line 7121 of file khtml_part.cpp.

◆ setAlwaysHonourDoctype()

void KHTMLPart::setAlwaysHonourDoctype ( bool  b = true)

Sets whether the document's Doctype should always be used to determine the parsing mode for the document.

Without this, parsing will be forced to strict mode when using the write( const QString &str ) method for backward compatibility reasons.

Definition at line 2204 of file khtml_part.cpp.

◆ setAutoloadImages()

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 1512 of file khtml_part.cpp.

◆ setCaretDisplayPolicyNonFocused()

void KHTMLPart::setCaretDisplayPolicyNonFocused ( CaretDisplayPolicy  policy)

Sets the caret display policy when the view is not focused.

Whenever the caret is in use, this property determines how the caret should be displayed when the document view is not focused.

The default policy is CaretInvisible.

Parameters
policynew display policy

Definition at line 3075 of file khtml_part.cpp.

◆ setCaretMode

void KHTMLPart::setCaretMode ( bool  enable)
slot

Enables/disables caret mode.

Enabling caret mode displays a caret which can be used to navigate the document using the keyboard only. Caret mode is switched off by default.

Parameters
enabletrue to enable, false to disable caret mode.

Definition at line 2993 of file khtml_part.cpp.

◆ setCaretPosition()

void KHTMLPart::setCaretPosition ( DOM::Node  node,
long  offset,
bool  extendSelection = false 
)

Sets the caret to the given position.

If the given location is invalid, it will snap to the nearest valid location. Immediately afterwards a caretPositionChanged signal containing the effective position is emitted

Parameters
nodenode to set to
offsetzero-based offset within the node
extendSelectionIf true, a selection will be spanned from the last caret position to the given one. Otherwise, any existing selection will be deselected.

Definition at line 3045 of file khtml_part.cpp.

◆ setCaretVisible

void KHTMLPart::setCaretVisible ( bool  show)
slot

Sets the visibility of the caret.

This methods displays or hides the caret regardless of the current caret display policy (see setCaretDisplayNonFocused), and regardless of focus.

The caret will be shown/hidden only under at least one of the following conditions:

  • the document is editable
  • the document is in caret mode
  • the document's currently focused element is editable
Parameters
showtrue to make visible, false to hide.

Definition at line 3085 of file khtml_part.cpp.

◆ setDNDEnabled()

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 6282 of file khtml_part.cpp.

◆ setDNSPrefetch()

void KHTMLPart::setDNSPrefetch ( DNSPrefetch  pmode)

Sets whether DNS Names found in loaded documents'anchors should be pre-fetched (pre-resolved).

Note that calling this function will permanently override the User settings about DNS prefetch support. Not calling this function is the only way to let the default settings apply.

Note
This setting has no effect if setOnlyLocalReferences() mode is enabled.
Parameters
pmodethe mode to set. See DNSPrefetch enum for explanation of values.
Since
4.2

Definition at line 1161 of file khtml_part.cpp.

◆ setEditable

void KHTMLPart::setEditable ( bool  enable)
slot

Makes the document editable.

Setting this property to true makes the document, and its subdocuments (such as frames, iframes, objects) editable as a whole. FIXME: insert more information about navigation, features etc. as seen fit

Parameters
enabletrue to set document editable, false to set it read-only.

Definition at line 3017 of file khtml_part.cpp.

◆ setEncoding()

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 2765 of file khtml_part.cpp.

◆ setFixedFont()

void KHTMLPart::setFixedFont ( const QString name)

Sets the fixed font style.

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

Definition at line 2898 of file khtml_part.cpp.

◆ setFontScaleFactor()

void KHTMLPart::setFontScaleFactor ( int  percent)

Sets the scale factor to be applied to fonts.

The value is given in percent, larger values mean generally larger fonts.

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 scaling of font sizes and show the page with the sizes determined via the given lengths in the stylesheets.

Definition at line 6047 of file khtml_part.cpp.

◆ setForcePermitLocalImages()

void KHTMLPart::setForcePermitLocalImages ( bool  enable)

Security option.

If this is set to true, content loaded from external URLs will be permitted to access images on disk regardless of of the Kiosk policy. You should be careful in enabling this, as it may make it easier to fake any HTML-based chrome or to perform other such user-confusion attack. false by default.

Since
4.6

Definition at line 2928 of file khtml_part.cpp.

◆ setFormNotification()

void KHTMLPart::setFormNotification ( KHTMLPart::FormNotification  fn)

Determine if signal should be emitted before, instead or never when a submitForm() happens.

KDE5 remove me

Definition at line 7561 of file khtml_part.cpp.

◆ setJavaEnabled()

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 1421 of file khtml_part.cpp.

◆ setJScriptEnabled()

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 1140 of file khtml_part.cpp.

◆ setJSDefaultStatusBarText()

void KHTMLPart::setJSDefaultStatusBarText ( const QString text)

Called by KJS.

Sets the DefaultStatusBarText assigned via window.defaultStatus

Definition at line 6124 of file khtml_part.cpp.

◆ setJSStatusBarText()

void KHTMLPart::setJSStatusBarText ( const QString text)

Called by KJS.

Sets the StatusBarText assigned via window.status

Definition at line 6119 of file khtml_part.cpp.

◆ setMetaRefreshEnabled()

void KHTMLPart::setMetaRefreshEnabled ( bool  enable)

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

>

Definition at line 1175 of file khtml_part.cpp.

◆ setOnlyLocalReferences()

void KHTMLPart::setOnlyLocalReferences ( bool  enable)

Security option.

Specify whether only file:/ or data:/ urls are allowed to be loaded without user confirmation by KHTML. ( for example referenced by stylesheets, images, scripts, subdocuments, embedded elements ).

This option is mainly intended for enabling the "mail reader mode", where you load untrusted content with a file:/ url.

Please note that enabling this option currently automatically disables Javascript, Java and Plugins support. This might change in the future if the security model is becoming more sophisticated, so don't rely on this behaviour.

( default false - everything is loaded unless forbidden by KApplication::authorizeURLAction).

Definition at line 2918 of file khtml_part.cpp.

◆ setPluginsEnabled()

void KHTMLPart::setPluginsEnabled ( bool  enable)

Enables or disables plugins, default is enabled.

Definition at line 1439 of file khtml_part.cpp.

◆ setSelection()

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

Sets the current selection.

Definition at line 3429 of file khtml_part.cpp.

◆ setStandardFont()

void KHTMLPart::setStandardFont ( const QString name)

Sets the standard font style.

Parameters
nameThe font name to use for standard text.

Definition at line 2893 of file khtml_part.cpp.

◆ setStatusMessagesEnabled()

void KHTMLPart::setStatusMessagesEnabled ( bool  enable)

Enable/disable statusbar messages.

When this class wants to set the statusbar text, it emits setStatusBarText(const QString & text) If you want to catch this for your own statusbar, note that it returns back a rich text string, starting with "<qt>". This you need to either pass this into your own QLabel or to strip out the tags before passing it to QStatusBar::message(const QString & message)

See also
KParts::Part::setStatusBarText( const QString & text )

Definition at line 1120 of file khtml_part.cpp.

◆ setSuppressedPopupIndicator()

void KHTMLPart::setSuppressedPopupIndicator ( bool  enable,
KHTMLPart originPart = nullptr 
)

Shows or hides the suppressed popup indicator.

Definition at line 7611 of file khtml_part.cpp.

◆ settings()

const KHTMLSettings * KHTMLPart::settings ( ) const

Definition at line 2616 of file khtml_part.cpp.

◆ setURLCursor()

void KHTMLPart::setURLCursor ( const QCursor c)

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

Definition at line 2903 of file khtml_part.cpp.

◆ setUserStyleSheet() [1/2]

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.

To have an effect this function has to be called after calling begin().

Definition at line 2818 of file khtml_part.cpp.

◆ setUserStyleSheet() [2/2]

void KHTMLPart::setUserStyleSheet ( const QUrl 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.

To have an effect this function has to be called after calling begin().

Definition at line 2811 of file khtml_part.cpp.

◆ setZoomFactor()

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.

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 5956 of file khtml_part.cpp.

◆ show()

void KHTMLPart::show ( )

Convenience method to show the document's view.

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

Definition at line 5857 of file khtml_part.cpp.

◆ showError()

void KHTMLPart::showError ( KJob job)
virtual

Called when a certain error situation (i.e.

connection timed out) occurred. The 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 1860 of file khtml_part.cpp.

◆ slotFinished

void KHTMLPart::slotFinished ( KJob job)
protectedvirtualslot

Called when the job downloading the page is finished.

Can be reimplemented, for instance to get metadata out of the job, but make sure to call KHTMLPart::slotFinished() too.

Definition at line 1977 of file khtml_part.cpp.

◆ startingJob()

virtual void KHTMLPart::startingJob ( KIO::Job )
inlineprotectedvirtual

Hook for adding code before a job is started.

This can be used to add metadata, like job->addMetaData("PropagateHttpHeader", "true") to get the HTTP headers.

Definition at line 1403 of file khtml_part.h.

◆ statusMessagesEnabled()

bool KHTMLPart::statusMessagesEnabled ( ) const

Returns true if status messages are enabled.

Definition at line 1135 of file khtml_part.cpp.

◆ stopAnimations

void KHTMLPart::stopAnimations ( )
slot

Stops all animated images on the current and child pages.

Definition at line 2295 of file khtml_part.cpp.

◆ timerEvent()

void KHTMLPart::timerEvent ( QTimerEvent e)
overrideprotectedvirtual

Reimplemented from QObject.

Definition at line 3600 of file khtml_part.cpp.

◆ toplevelURL()

QUrl KHTMLPart::toplevelURL ( )

Returns the toplevel (origin) URL of this document, even if this part is a frame or an iframe.

Returns
the actual original url.

Definition at line 7571 of file khtml_part.cpp.

◆ updateZoomFactor()

void KHTMLPart::updateZoomFactor ( )
protected

Definition at line 5976 of file khtml_part.cpp.

◆ urlCursor()

QCursor KHTMLPart::urlCursor ( ) const

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

Definition at line 2908 of file khtml_part.cpp.

◆ view()

KHTMLView * KHTMLPart::view ( ) const

Returns a pointer to the HTML document's view.

Definition at line 1099 of file khtml_part.cpp.

◆ write() [1/2]

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

Definition at line 2173 of file khtml_part.cpp.

◆ write() [2/2]

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.

For historic and backward compatibility reasons, this method will force the use of strict mode for the document, unless setAlwaysHonourDoctype() has been called previously.

Definition at line 2209 of file khtml_part.cpp.

◆ zoomFactor()

int KHTMLPart::zoomFactor ( ) const

Returns the current zoom factor.

Definition at line 5892 of file khtml_part.cpp.


The documentation for this class was generated from the following files:
void setJScriptEnabled(bool enable)
Enable/disable Javascript support.
void setOnlyLocalReferences(bool enable)
Security option.
void setMetaRefreshEnabled(bool enable)
Enable/disable automatic forwarding by <meta http-equiv="refresh" ....
void setJavaEnabled(bool enable)
Enables/disables Java applet support.
virtual void write(const char *str, int len=-1)
Writes another part of the HTML code to the widget.
This class is khtml's main class.
Definition: khtml_part.h:208
void setPluginsEnabled(bool enable)
Enables or disables plugins, default is enabled.
Renders and displays HTML in a QScrollArea.
Definition: khtmlview.h:97
KHTMLView * view() const
Returns a pointer to the HTML document's view.
bool openUrl(const QUrl &url) override
Opens the specified URL url.
Definition: khtml_part.cpp:707
virtual void begin(const QUrl &url=QUrl(), int xOffset=0, int yOffset=0)
Clears the widget and prepares it for new content.
bool openStream(const QString &mimeType, const QUrl &url)
void resize(int w, int h)
void show()
Convenience method to show the document's view.
KHTMLPart(QWidget *parentWidget=nullptr, QObject *parent=nullptr, GUIProfile prof=DefaultGUI)
Constructs a new KHTMLPart.
Definition: khtml_part.cpp:195
bool writeStream(const QByteArray &data)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon May 8 2023 03:55:36 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.