fix logic
[personal-kdelibs.git] / khtml / khtml_iface.h
bloba3dc813211000151e169f4945042e0be4cf0c829
1 /* This file is part of the KDE project
2 * Copyright (C) 2002 Stephan Kulow <coolo@kde.org>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
20 #ifndef __khtml_Iface_h__
21 #define __khtml_Iface_h__
23 #include <kurl.h>
24 #include <khtml_part.h>
25 #include <QtDBus/QtDBus>
27 class KHTMLPart;
29 /**
30 * D-BUS interface for KHTML
32 class KHTMLPartIface : public QDBusAbstractAdaptor
34 Q_OBJECT
35 Q_CLASSINFO("D-Bus Interface", "org.kde.KHTMLPart")
36 Q_PROPERTY(bool autoloadImages READ autoloadImages WRITE setAutoloadImages)
37 Q_PROPERTY(bool dndEnabled READ dndEnabled WRITE setDndEnabled)
38 Q_PROPERTY(QString encoding READ encoding WRITE setEncoding)
39 Q_PROPERTY(bool jScriptEnabled READ jScriptEnabled WRITE setJScriptEnabled)
40 Q_PROPERTY(bool javaEnabled READ javaEnabled WRITE setJavaEnabled)
41 Q_PROPERTY(QString lastModified READ lastModified)
42 Q_PROPERTY(bool metaRefreshEnabled READ metaRefreshEnabled WRITE setMetaRefreshEnabled)
43 Q_PROPERTY(bool onlyLocalReferences READ onlyLocalReferences WRITE setOnlyLocalReferences)
44 Q_PROPERTY(bool pluginsEnabled READ pluginsEnabled WRITE setPluginsEnabled)
45 Q_PROPERTY(QString url READ url)
47 public:
49 KHTMLPartIface( KHTMLPart * );
50 virtual ~KHTMLPartIface();
52 public Q_SLOTS:
53 /**
54 * @return the current URL
56 QString url() const;
58 bool closeUrl();
60 /**
61 * Enable/disable Javascript support. Note that this will
62 * in either case permanently override the default usersetting.
63 * If you want to have the default UserSettings, don't call this
64 * method.
66 void setJScriptEnabled( bool enable );
68 /**
69 * Returns @p true if Javascript support is enabled or @p false
70 * otherwise.
72 bool jScriptEnabled() const;
74 /**
75 * Enable/disable the automatic forwarding by <meta http-equiv="refresh" ....>
77 void setMetaRefreshEnabled( bool enable );
79 /**
80 * Returns @p true if automtaic forwarding is enabled.
82 bool metaRefreshEnabled() const;
84 /**
85 * Enables or disables Drag'n'Drop support. A drag operation is started if
86 * the users drags a link.
88 void setDndEnabled( bool b );
90 /**
91 * Returns whether Dragn'n'Drop support is enabled or not.
93 bool dndEnabled() const;
95 /**
96 * Enables/disables Java applet support. Note that calling this function
97 * will permanently override the User settings about Java applet support.
98 * Not calling this function is the only way to let the default settings
99 * apply.
101 void setJavaEnabled( bool enable );
104 * Return if Java applet support is enabled/disabled.
106 bool javaEnabled() const;
110 * Enables or disables plugins via, default is enabled
112 void setPluginsEnabled( bool enable );
115 * Returns trie if plugins are enabled/disabled.
117 bool pluginsEnabled() const;
120 * Specifies whether images contained in the document should be loaded
121 * automatically or not.
123 * @note Request will be ignored if called before begin().
125 void setAutoloadImages( bool enable );
128 * Returns whether images contained in the document are loaded automatically
129 * or not.
130 * @note that the returned information is unrelieable as long as no begin()
131 * was called.
133 bool autoloadImages() const;
136 * Security option.
138 * Specify whether only local references ( stylesheets, images, scripts, subdocuments )
139 * should be loaded. ( default false - everything is loaded, if the more specific
140 * options allow )
142 void setOnlyLocalReferences(bool enable);
145 * Returns whether references should be loaded ( default false )
147 bool onlyLocalReferences() const;
150 * Sets the encoding the page uses.
152 * This can be different from the charset. The widget will try to reload
153 * the current page in the new encoding, if url() is not empty.
155 bool setEncoding( const QString &name );
158 * Returns the encoding the page currently uses.
160 * Note that the encoding might be different from the charset.
162 QString encoding() const;
165 * Sets a user defined style sheet to be used on top of the HTML 4
166 * default style sheet.
168 * This gives a wide range of possibilities to
169 * change the layout of the page.
171 void setUserStyleSheet(const QString &styleSheet);
174 * Sets the fixed font style.
176 * @param name The font name to use for fixed text, e.g.
177 * the <tt>&lt;pre&gt;</tt> tag.
179 void setFixedFont( const QString &name );
182 * Finds the anchor named @p name.
184 * If the anchor is found, the widget
185 * scrolls to the closest position. Returns @p true if the anchor has
186 * been found.
188 bool gotoAnchor( const QString &name );
191 * Go to next Anchor.
193 * This is useful to navigate from outside of the navigator.
195 bool nextAnchor();
198 * Go to previous Anchor.
200 bool prevAnchor();
203 * Activate the node that currently has the focus
204 * (emulates pressing Return)
206 void activateNode();
209 * Returns the text the user has marked.
211 QString selectedText() const;
214 * Marks all text in the document as selected.
216 void selectAll();
219 * Last-modified date (in raw string format), if received in the [HTTP] headers.
221 QString lastModified() const;
224 * Print the contents of the current html view.
225 * @param quick if true, fully automated printing, without the print dialog.
227 Q_NOREPLY void print( bool quick );
229 void debugRenderTree();
230 void debugDOMTree();
231 void viewDocumentSource();
232 void viewFrameSource();
233 void saveBackground(const QString &url);
234 void saveDocument(const QString &url);
237 * Evaluate a given piece of Javascript code
239 QString evalJS(const QString &script);
242 * Stops display of animated images
244 void stopAnimations();
246 Q_SIGNALS:
247 void configurationChanged();
249 private:
250 KHTMLPart *part;
253 #endif