khtml_iface.cc
/* This file is part of the KDE project
*
* Copyright (C) 2002 Stephan Kulow <coolo@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "khtml_iface.h"
#include "khtml_part.h"
#include "khtmlview.h"
#include "khtml_ext.h"
#include <kio/global.h>
#include <qapplication.h>
#include <qvariant.h>
KHTMLPartIface::KHTMLPartIface( KHTMLPart *_part )
: DCOPObject( _part->dcopObjectId() ), part(_part)
{
}
KHTMLPartIface::~KHTMLPartIface()
{
}
KURL KHTMLPartIface::url() const
{
return part->url();
}
void KHTMLPartIface::setJScriptEnabled( bool enable )
{
part->setJScriptEnabled(enable);
}
bool KHTMLPartIface::jScriptEnabled() const
{
return part->jScriptEnabled();
}
bool KHTMLPartIface::closeURL()
{
return part->closeURL();
}
bool KHTMLPartIface::metaRefreshEnabled() const
{
return part->metaRefreshEnabled();
}
void KHTMLPartIface::setDNDEnabled( bool b )
{
part->setDNDEnabled(b);
}
bool KHTMLPartIface::dndEnabled() const
{
return part->dndEnabled();
}
void KHTMLPartIface::setJavaEnabled( bool enable )
{
part->setJavaEnabled( enable );
}
bool KHTMLPartIface::javaEnabled() const
{
return part->javaEnabled();
}
void KHTMLPartIface::setPluginsEnabled( bool enable )
{
part->setPluginsEnabled( enable );
}
bool KHTMLPartIface::pluginsEnabled() const
{
return part->pluginsEnabled();
}
void KHTMLPartIface::setAutoloadImages( bool enable )
{
part->setAutoloadImages( enable );
}
bool KHTMLPartIface::autoloadImages() const
{
return part->autoloadImages();
}
void KHTMLPartIface::setOnlyLocalReferences(bool enable)
{
part->setOnlyLocalReferences(enable);
}
void KHTMLPartIface::setMetaRefreshEnabled( bool enable )
{
part->setMetaRefreshEnabled(enable);
}
bool KHTMLPartIface::onlyLocalReferences() const
{
return part->onlyLocalReferences();
}
bool KHTMLPartIface::setEncoding( const QString &name )
{
return part->setEncoding(name);
}
QString KHTMLPartIface::encoding() const
{
return part->encoding();
}
void KHTMLPartIface::setFixedFont( const QString &name )
{
part->setFixedFont(name);
}
bool KHTMLPartIface::gotoAnchor( const QString &name )
{
return part->gotoAnchor(name);
}
bool KHTMLPartIface::nextAnchor()
{
return part->nextAnchor();
}
bool KHTMLPartIface::prevAnchor()
{
return part->prevAnchor();
}
void KHTMLPartIface::activateNode()
{
KParts::ReadOnlyPart* p = part->currentFrame();
if ( p && p->widget() ) {
QKeyEvent ev( QKeyEvent::KeyPress, Qt::Key_Return, '\n', 0, "\n" );
QApplication::sendEvent( p->widget(), &ev );
}
}
void KHTMLPartIface::selectAll()
{
part->selectAll();
}
QString KHTMLPartIface::lastModified() const
{
return part->lastModified();
}
void KHTMLPartIface::debugRenderTree()
{
part->slotDebugRenderTree();
}
void KHTMLPartIface::debugDOMTree()
{
part->slotDebugDOMTree();
}
void KHTMLPartIface::stopAnimations()
{
part->slotStopAnimations();
}
void KHTMLPartIface::viewDocumentSource()
{
part->slotViewDocumentSource();
}
void KHTMLPartIface::saveBackground(const QString &destination)
{
KURL back = part->backgroundURL();
if (back.isEmpty())
return;
KIO::MetaData metaData;
metaData["referrer"] = part->referrer();
KHTMLPopupGUIClient::saveURL( back, KURL( destination ), metaData );
}
void KHTMLPartIface::saveDocument(const QString &destination)
{
KURL srcURL( part->url() );
if ( srcURL.fileName(false).isEmpty() )
srcURL.setFileName( "index.html" );
KIO::MetaData metaData;
// Referrer unknown?
KHTMLPopupGUIClient::saveURL( srcURL, KURL( destination ), metaData, part->cacheId() );
}
void KHTMLPartIface::setUserStyleSheet(const QString &styleSheet)
{
part->setUserStyleSheet(styleSheet);
}
QString KHTMLPartIface::selectedText() const
{
return part->selectedText();
}
void KHTMLPartIface::viewFrameSource()
{
part->slotViewFrameSource();
}
QString KHTMLPartIface::evalJS(const QString &script)
{
return part->executeScript(DOM::Node(), script).toString();
}
void KHTMLPartIface::print( bool quick ) {
part->view()->print( quick );
}
KHTMLPart::metaRefreshEnabled
bool metaRefreshEnabled() const
Returns true if automatic forwarding is enabled.
Definition: khtml_part.cpp:954
KURL
KHTMLPart::nextAnchor
bool nextAnchor()
Go to the next anchor.
Definition: khtml_part.cpp:2566
KHTMLPart::referrer
QString referrer() const
Referrer used for links in this page.
Definition: khtml_part.cpp:5804
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:274
KHTMLPartIface::setFixedFont
void setFixedFont(const QString &name)
Sets the fixed font style.
Definition: khtml_iface.cc:128
KHTMLPart::lastModified
QString lastModified() const
Last-modified date (in raw string format), if received in the [HTTP] headers.
Definition: khtml_part.cpp:5830
KHTMLPart::onlyLocalReferences
bool onlyLocalReferences() const
Returns whether only file:/ or data:/ references are allowed to be loaded ( default false )...
Definition: khtml_part.cpp:2604
KHTMLPartIface::setEncoding
bool setEncoding(const QString &name)
Sets the encoding the page uses.
Definition: khtml_iface.cc:118
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:184
KHTMLPart::setPluginsEnabled
void setPluginsEnabled(bool enable)
Enables or disables plugins, default is enabled.
Definition: khtml_part.cpp:1274
KHTMLPartIface::print
ASYNC 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()
KURL::isEmpty
bool isEmpty() const
KHTMLPart::setEncoding
bool setEncoding(const QString &name, bool override=false)
Sets the encoding the page uses.
Definition: khtml_part.cpp:2464
KHTMLPartIface::metaRefreshEnabled
bool metaRefreshEnabled() const
Returns true if automtaic forwarding is enabled.
Definition: khtml_iface.cc:58
KHTMLPart::setOnlyLocalReferences
void setOnlyLocalReferences(bool enable)
Security option.
Definition: khtml_part.cpp:2609
KHTMLPartIface::dndEnabled
bool dndEnabled() const
Returns whether Dragn'n'Drop support is enabled or not.
Definition: khtml_iface.cc:68
KHTMLPart::view
KHTMLView * view() const
Returns a pointer to the HTML document's view.
Definition: khtml_part.cpp:907
KHTMLPartIface::activateNode
void activateNode()
Activate the node that currently has the focus (emulates pressing Return)
Definition: khtml_iface.cc:149
KHTMLPart::setMetaRefreshEnabled
void setMetaRefreshEnabled(bool enable)
Enable/disable automatic forwarding by
Definition: khtml_part.cpp:949
KHTMLPart::closeURL
virtual bool closeURL()
Stops loading the document and kills all data requests (for images, etc.)
Definition: khtml_part.cpp:770
KHTMLPartIface::javaEnabled
bool javaEnabled() const
Return if Java applet support is enabled/disabled.
Definition: khtml_iface.cc:78
KHTMLPartIface::encoding
QString encoding() const
Returns the encoding the page currently uses.
Definition: khtml_iface.cc:123
KHTMLPartIface::lastModified
QString lastModified() const
Last-modified date (in raw string format), if received in the [HTTP] headers.
Definition: khtml_iface.cc:163
KHTMLPartIface::setMetaRefreshEnabled
void setMetaRefreshEnabled(bool enable)
Enable/disable the automatic forwarding by
Definition: khtml_iface.cc:108
KHTMLPartIface::url
KURL url() const
Definition: khtml_iface.cc:38
KStdAccel::back
const KShortcut & back()
KParts::ReadOnlyPart::url
KURL url() const
KHTMLPart::gotoAnchor
bool gotoAnchor(const QString &name)
Finds the anchor named name.
Definition: khtml_part.cpp:2518
KHTMLPart::setJavaEnabled
void setJavaEnabled(bool enable)
Enables/disables Java applet support.
Definition: khtml_part.cpp:1245
KHTMLPart::setFixedFont
void setFixedFont(const QString &name)
Sets the fixed font style.
Definition: khtml_part.cpp:2589
KHTMLPartIface::pluginsEnabled
bool pluginsEnabled() const
Returns trie if plugins are enabled/disabled.
Definition: khtml_iface.cc:88
KHTMLPartIface::setOnlyLocalReferences
void setOnlyLocalReferences(bool enable)
Security option.
Definition: khtml_iface.cc:103
KHTMLView::print
void print()
Prints the HTML document.
Definition: khtmlview.cpp:2740
KHTMLPart::prevAnchor
bool prevAnchor()
Go to previous anchor.
Definition: khtml_part.cpp:2575
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:2506
KHTMLPartIface::onlyLocalReferences
bool onlyLocalReferences() const
Returns whether references should be loaded ( default false )
Definition: khtml_iface.cc:113
KHTMLPart::backgroundURL
KURL backgroundURL() const
Returns the URL for the background Image (used by save background)
Definition: khtml_part.cpp:4114
KHTMLPart::setJScriptEnabled
void setJScriptEnabled(bool enable)
Enable/disable Javascript support.
Definition: khtml_part.cpp:931
KHTMLPart::setDNDEnabled
void setDNDEnabled(bool b)
Enables or disables Drag'n'Drop support.
Definition: khtml_part.cpp:5929
KHTMLPartIface::jScriptEnabled
bool jScriptEnabled() const
Returns true if Javascript support is enabled or false otherwise.
Definition: khtml_iface.cc:48
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::setDNDEnabled
void setDNDEnabled(bool b)
Enables or disables Drag'n'Drop support.
Definition: khtml_iface.cc:63
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:1187
KHTMLPartIface::gotoAnchor
bool gotoAnchor(const QString &name)
Finds the anchor named name.
Definition: khtml_iface.cc:134
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. ...
Definition: khtml_iface.cc:98
KHTMLPart::selectedText
virtual QString selectedText() const
Returns the text the user has marked.
Definition: khtml_part.cpp:3451
KHTMLPart::setAutoloadImages
void setAutoloadImages(bool enable)
Specifies whether images contained in the document should be loaded automatically or not...
Definition: khtml_part.cpp:1336
KHTMLPart::jScriptEnabled
bool jScriptEnabled() const
Returns true if Javascript support is enabled or false otherwise.
Definition: khtml_part.cpp:940
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:5273
KHTMLPart::selectAll
void selectAll()
Marks all text in the document as selected.
Definition: khtml_part.cpp:6744
KHTMLPartIface::stopAnimations
void stopAnimations()
Stops display of animated images.
Definition: khtml_iface.cc:178
KHTMLPart::encoding
QString encoding() const
Returns the encoding the page currently uses.
Definition: khtml_part.cpp:2482
KURL::setFileName
void setFileName(const QString &_txt)
KParts::ReadOnlyPart

KDE Home | KDE Accessibility Home | Description of Access Keys