• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KHTML

  • sources
  • kde-4.12
  • kdelibs
  • khtml
khtml_iface.cc
Go to the documentation of this file.
1 /* This file is part of the KDE project
2  *
3  * Copyright (C) 2002 Stephan Kulow <coolo@kde.org>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public License
16  * along with this library; see the file COPYING.LIB. If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20 
21 #include "khtml_iface.h"
22 #include "khtml_part.h"
23 #include "khtmlview.h"
24 #include "khtml_ext.h"
25 #include <kio/global.h>
26 #include <QtGui/QApplication>
27 #include <QtCore/QVariant>
28 
29 KHTMLPartIface::KHTMLPartIface( KHTMLPart *_part )
30  : QDBusAbstractAdaptor( _part ), part(_part)
31 {
32 }
33 
34 KHTMLPartIface::~KHTMLPartIface()
35 {
36 }
37 
38 QString KHTMLPartIface::url() const
39 {
40  return part->url().url();
41 }
42 
43 void KHTMLPartIface::setJScriptEnabled( bool enable )
44 {
45  part->setJScriptEnabled(enable);
46 }
47 
48 bool KHTMLPartIface::jScriptEnabled() const
49 {
50  return part->jScriptEnabled();
51 }
52 
53 bool KHTMLPartIface::closeUrl()
54 {
55  return part->closeUrl();
56 }
57 
58 bool KHTMLPartIface::metaRefreshEnabled() const
59 {
60  return part->metaRefreshEnabled();
61 }
62 
63 void KHTMLPartIface::setDndEnabled( bool b )
64 {
65  part->setDNDEnabled(b);
66 }
67 
68 bool KHTMLPartIface::dndEnabled() const
69 {
70  return part->dndEnabled();
71 }
72 
73 void KHTMLPartIface::setJavaEnabled( bool enable )
74 {
75  part->setJavaEnabled( enable );
76 }
77 
78 bool KHTMLPartIface::javaEnabled() const
79 {
80  return part->javaEnabled();
81 }
82 
83 void KHTMLPartIface::setPluginsEnabled( bool enable )
84 {
85  part->setPluginsEnabled( enable );
86 }
87 
88 bool KHTMLPartIface::pluginsEnabled() const
89 {
90  return part->pluginsEnabled();
91 }
92 
93 void KHTMLPartIface::setAutoloadImages( bool enable )
94 {
95  part->setAutoloadImages( enable );
96 }
97 
98 bool KHTMLPartIface::autoloadImages() const
99 {
100  return part->autoloadImages();
101 }
102 
103 void KHTMLPartIface::setOnlyLocalReferences(bool enable)
104 {
105  part->setOnlyLocalReferences(enable);
106 }
107 
108 void KHTMLPartIface::setMetaRefreshEnabled( bool enable )
109 {
110  part->setMetaRefreshEnabled(enable);
111 }
112 
113 bool KHTMLPartIface::onlyLocalReferences() const
114 {
115  return part->onlyLocalReferences();
116 }
117 
118 bool KHTMLPartIface::setEncoding( const QString &name )
119 {
120  return part->setEncoding(name);
121 }
122 
123 QString KHTMLPartIface::encoding() const
124 {
125  return part->encoding();
126 }
127 
128 void KHTMLPartIface::setFixedFont( const QString &name )
129 {
130  part->setFixedFont(name);
131 
132 }
133 
134 bool KHTMLPartIface::gotoAnchor( const QString &name )
135 {
136  return part->gotoAnchor(name);
137 }
138 
139 bool KHTMLPartIface::nextAnchor()
140 {
141  return part->nextAnchor();
142 }
143 
144 bool KHTMLPartIface::prevAnchor()
145 {
146  return part->prevAnchor();
147 }
148 
149 void KHTMLPartIface::activateNode()
150 {
151  KParts::ReadOnlyPart* p = part->currentFrame();
152  if ( p && p->widget() ) {
153  QKeyEvent ev( QKeyEvent::KeyPress, Qt::Key_Return, 0, "\n" );
154  QApplication::sendEvent( p->widget(), &ev );
155  }
156 }
157 
158 void KHTMLPartIface::selectAll()
159 {
160  part->selectAll();
161 }
162 
163 QString KHTMLPartIface::lastModified() const
164 {
165  return part->lastModified();
166 }
167 
168 void KHTMLPartIface::debugRenderTree()
169 {
170  part->slotDebugRenderTree();
171 }
172 
173 void KHTMLPartIface::debugDOMTree()
174 {
175  part->slotDebugDOMTree();
176 }
177 
178 void KHTMLPartIface::stopAnimations()
179 {
180  part->slotStopAnimations();
181 }
182 
183 void KHTMLPartIface::viewDocumentSource()
184 {
185  part->slotViewDocumentSource();
186 }
187 
188 void KHTMLPartIface::saveBackground(const QString &destination)
189 {
190  KUrl back = part->backgroundURL();
191  if (back.isEmpty())
192  return;
193 
194  KIO::MetaData metaData;
195  metaData["referrer"] = part->referrer();
196  KHTMLPopupGUIClient::saveURL( part->widget(), back, KUrl( destination ), metaData );
197 }
198 
199 void KHTMLPartIface::saveDocument(const QString &destination)
200 {
201  KUrl srcURL( part->url() );
202 
203  if ( srcURL.fileName(KUrl::ObeyTrailingSlash).isEmpty() )
204  srcURL.setFileName( "index.html" );
205 
206  KIO::MetaData metaData;
207  // Referrer unknown?
208  KHTMLPopupGUIClient::saveURL( part->widget(), srcURL, KUrl( destination ), metaData, part->cacheId() );
209 }
210 
211 void KHTMLPartIface::setUserStyleSheet(const QString &styleSheet)
212 {
213  part->setUserStyleSheet(styleSheet);
214 }
215 
216 QString KHTMLPartIface::selectedText() const
217 {
218  return part->selectedText();
219 }
220 
221 void KHTMLPartIface::viewFrameSource()
222 {
223  part->slotViewFrameSource();
224 }
225 
226 QString KHTMLPartIface::evalJS(const QString &script)
227 {
228  return part->executeScript(DOM::Node(), script).toString();
229 }
230 
231 void KHTMLPartIface::print( bool quick ) {
232  part->view()->print( quick );
233 }
234 
235 #include "khtml_iface.moc"
KHTMLPartIface::debugRenderTree
void debugRenderTree()
Definition: khtml_iface.cc:168
KHTMLPart::nextAnchor
bool nextAnchor()
Go to the next anchor.
Definition: khtml_part.cpp:2758
KHTMLPart::referrer
QString referrer() const
Referrer used for links in this page.
Definition: khtml_part.cpp:5946
KHTMLPartIface::setAutoloadImages
void setAutoloadImages(bool enable)
Specifies whether images contained in the document should be loaded automatically or not...
Definition: khtml_iface.cc:93
DOM::Node
The Node interface is the primary datatype for the entire Document Object Model.
Definition: dom_node.h:270
KHTMLPart::autoloadImages
bool autoloadImages() const
Returns whether images contained in the document are loaded automatically or not. ...
Definition: khtml_part.cpp:1480
KHTMLPartIface::setFixedFont
void setFixedFont(const QString &name)
Sets the fixed font style.
Definition: khtml_iface.cc:128
KHTMLPart::setUserStyleSheet
void setUserStyleSheet(const KUrl &url)
Sets a user defined style sheet to be used on top of the HTML 4 default style sheet.
Definition: khtml_part.cpp:2698
back
KAction * back(const QObject *recvr, const char *slot, QObject *parent)
QDBusAbstractAdaptor
KHTMLPartIface::debugDOMTree
void debugDOMTree()
Definition: khtml_iface.cc:173
khtml_part.h
KHTMLPart::onlyLocalReferences
bool onlyLocalReferences() const
Returns whether only file:/ or data:/ references are allowed to be loaded ( default false )...
Definition: khtml_part.cpp:2796
KHTMLPartIface::setEncoding
bool setEncoding(const QString &name)
Sets the encoding the page uses.
Definition: khtml_iface.cc:118
KHTMLPopupGUIClient::saveURL
static void saveURL(QWidget *parent, const QString &caption, const KUrl &url, const QMap< QString, QString > &metaData=KIO::MetaData(), const QString &filter=QString(), long cacheId=0, const QString &suggestedFilename=QString())
Definition: khtml_ext.cpp:859
KHTMLPartIface::saveDocument
void saveDocument(const QString &url)
Definition: khtml_iface.cc:199
KHTMLPartIface::nextAnchor
bool nextAnchor()
Go to next Anchor.
Definition: khtml_iface.cc:139
KHTMLPartIface::evalJS
QString evalJS(const QString &script)
Evaluate a given piece of Javascript code.
Definition: khtml_iface.cc:226
KHTMLPart
This class is khtml's main class.
Definition: khtml_part.h:206
KHTMLPart::setPluginsEnabled
void setPluginsEnabled(bool enable)
Enables or disables plugins, default is enabled.
Definition: khtml_part.cpp:1384
KHTMLPartIface::print
Q_NOREPLY void print(bool quick)
Print the contents of the current html view.
Definition: khtml_iface.cc:231
KHTMLPartIface::setUserStyleSheet
void setUserStyleSheet(const QString &styleSheet)
Sets a user defined style sheet to be used on top of the HTML 4 default style sheet.
Definition: khtml_iface.cc:211
KParts::Part::widget
virtual QWidget * widget()
khtml_ext.h
QString
global.h
KIO::MetaData
KHTMLPart::setEncoding
bool setEncoding(const QString &name, bool override=false)
Sets the encoding the page uses.
Definition: khtml_part.cpp:2656
KParts::ReadOnlyPart::url
KUrl url
KUrl
KHTMLPartIface::metaRefreshEnabled
bool metaRefreshEnabled() const
Returns true if automtaic forwarding is enabled.
KHTMLPart::setOnlyLocalReferences
void setOnlyLocalReferences(bool enable)
Security option.
Definition: khtml_part.cpp:2801
KHTMLPartIface::dndEnabled
bool dndEnabled() const
Returns whether Dragn'n'Drop support is enabled or not.
KHTMLPart::view
KHTMLView * view() const
Returns a pointer to the HTML document's view.
Definition: khtml_part.cpp:1056
KHTMLPartIface::saveBackground
void saveBackground(const QString &url)
Definition: khtml_iface.cc:188
KHTMLPart::encoding
QString encoding
Definition: khtml_part.h:267
KHTMLPartIface::activateNode
void activateNode()
Activate the node that currently has the focus (emulates pressing Return)
Definition: khtml_iface.cc:149
khtml_iface.h
KHTMLPart::setMetaRefreshEnabled
void setMetaRefreshEnabled(bool enable)
Enable/disable automatic forwarding by
Definition: khtml_part.cpp:1125
KHTMLPartIface::javaEnabled
bool javaEnabled() const
Return if Java applet support is enabled/disabled.
KHTMLPartIface::viewDocumentSource
void viewDocumentSource()
Definition: khtml_iface.cc:183
KHTMLPartIface::encoding
QString encoding() const
Returns the encoding the page currently uses.
KHTMLPartIface::setDndEnabled
void setDndEnabled(bool b)
Enables or disables Drag'n'Drop support.
Definition: khtml_iface.cc:63
KHTMLPartIface::lastModified
QString lastModified() const
Last-modified date (in raw string format), if received in the [HTTP] headers.
KHTMLPartIface::~KHTMLPartIface
virtual ~KHTMLPartIface()
Definition: khtml_iface.cc:34
KHTMLPartIface::setMetaRefreshEnabled
void setMetaRefreshEnabled(bool enable)
Enable/disable the automatic forwarding by
Definition: khtml_iface.cc:108
KHTMLPartIface::KHTMLPartIface
KHTMLPartIface(KHTMLPart *)
Definition: khtml_iface.cc:29
KHTMLPart::gotoAnchor
bool gotoAnchor(const QString &name)
Finds the anchor named name.
Definition: khtml_part.cpp:2710
KHTMLPart::setJavaEnabled
void setJavaEnabled(bool enable)
Enables/disables Java applet support.
Definition: khtml_part.cpp:1365
KHTMLPart::setFixedFont
void setFixedFont(const QString &name)
Sets the fixed font style.
Definition: khtml_part.cpp:2781
KHTMLPartIface::pluginsEnabled
bool pluginsEnabled() const
Returns trie if plugins are enabled/disabled.
KHTMLPartIface::setOnlyLocalReferences
void setOnlyLocalReferences(bool enable)
Security option.
Definition: khtml_iface.cc:103
KHTMLPart::metaRefreshEnabled
bool metaRefreshEnabled
Definition: khtml_part.h:269
KHTMLPart::prevAnchor
bool prevAnchor()
Go to previous anchor.
Definition: khtml_part.cpp:2767
KHTMLPartIface::onlyLocalReferences
bool onlyLocalReferences() const
Returns whether references should be loaded ( default false )
KHTMLPartIface::viewFrameSource
void viewFrameSource()
Definition: khtml_iface.cc:221
KHTMLPart::lastModified
QString lastModified
Definition: khtml_part.h:268
khtmlview.h
KHTMLPart::dndEnabled
bool dndEnabled
Definition: khtml_part.h:257
KHTMLPartIface::url
QString url() const
KUrl::setFileName
void setFileName(const QString &_txt)
KHTMLPart::setJScriptEnabled
void setJScriptEnabled(bool enable)
Enable/disable Javascript support.
Definition: khtml_part.cpp:1094
KHTMLPart::setDNDEnabled
void setDNDEnabled(bool b)
Enables or disables Drag'n'Drop support.
Definition: khtml_part.cpp:6080
KHTMLPartIface::jScriptEnabled
bool jScriptEnabled() const
Returns true if Javascript support is enabled or false otherwise.
KHTMLPartIface::selectAll
void selectAll()
Marks all text in the document as selected.
Definition: khtml_iface.cc:158
KHTMLPartIface::prevAnchor
bool prevAnchor()
Go to previous Anchor.
Definition: khtml_iface.cc:144
KHTMLPartIface::setPluginsEnabled
void setPluginsEnabled(bool enable)
Enables or disables plugins via, default is enabled.
Definition: khtml_iface.cc:83
KHTMLPartIface::selectedText
QString selectedText() const
Returns the text the user has marked.
Definition: khtml_iface.cc:216
KHTMLPartIface::setJScriptEnabled
void setJScriptEnabled(bool enable)
Enable/disable Javascript support.
Definition: khtml_iface.cc:43
KHTMLPartIface::closeUrl
bool closeUrl()
Definition: khtml_iface.cc:53
KUrl::ObeyTrailingSlash
KHTMLPart::executeScript
QVariant executeScript(const DOM::Node &n, const QString &script)
Same as executeScript( const QString & ) except with the Node parameter specifying the 'this' value...
Definition: khtml_part.cpp:1327
KHTMLPartIface::gotoAnchor
bool gotoAnchor(const QString &name)
Finds the anchor named name.
Definition: khtml_iface.cc:134
KHTMLPart::closeUrl
virtual bool closeUrl()
Stops loading the document and kills all data requests (for images, etc.)
Definition: khtml_part.cpp:919
KHTMLPartIface::setJavaEnabled
void setJavaEnabled(bool enable)
Enables/disables Java applet support.
Definition: khtml_iface.cc:73
KHTMLPartIface::autoloadImages
bool autoloadImages() const
Returns whether images contained in the document are loaded automatically or not. ...
KHTMLPart::javaEnabled
bool javaEnabled
Definition: khtml_part.h:256
KHTMLPart::selectedText
virtual QString selectedText() const
Returns the text the user has marked.
Definition: khtml_part.cpp:3101
KHTMLView::print
void print(bool quick=false)
Prints the HTML document.
Definition: khtmlview.cpp:3029
KHTMLPart::setAutoloadImages
void setAutoloadImages(bool enable)
Specifies whether images contained in the document should be loaded automatically or not...
Definition: khtml_part.cpp:1452
KHTMLPart::jScriptEnabled
bool jScriptEnabled() const
Returns true if Javascript support is enabled or false otherwise.
Definition: khtml_part.cpp:1103
KUrl::url
QString url(AdjustPathOption trailing=LeaveTrailingSlash) const
KHTMLPart::currentFrame
KParts::ReadOnlyPart * currentFrame() const
Return the current frame (the one that has focus) Not necessarily a direct child of ours...
Definition: khtml_part.cpp:5302
KHTMLPart::selectAll
void selectAll()
Marks all text in the document as selected.
Definition: khtml_part.cpp:6750
KHTMLPartIface::stopAnimations
void stopAnimations()
Stops display of animated images.
Definition: khtml_iface.cc:178
KHTMLPart::pluginsEnabled
bool pluginsEnabled
Definition: khtml_part.h:258
KHTMLPart::backgroundURL
KUrl backgroundURL() const
Returns the URL for the background Image (used by save background)
Definition: khtml_part.cpp:3934
KParts::ReadOnlyPart
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:51:21 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KHTML

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

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal