File indexing completed on 2023-05-30 09:09:52
0001 /* This file is part of the KDE project 0002 * Copyright (C) 2002 Stephan Kulow <coolo@kde.org> 0003 * 0004 * This library is free software; you can redistribute it and/or 0005 * modify it under the terms of the GNU Library General Public 0006 * License as published by the Free Software Foundation; either 0007 * version 2 of the License, or (at your option) any later version. 0008 * 0009 * This library is distributed in the hope that it will be useful, 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0012 * Library General Public License for more details. 0013 * 0014 * You should have received a copy of the GNU Library General Public License 0015 * along with this library; see the file COPYING.LIB. If not, write to 0016 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0017 * Boston, MA 02110-1301, USA. 0018 */ 0019 0020 #ifndef __khtml_Iface_h__ 0021 #define __khtml_Iface_h__ 0022 0023 #include <khtml_part.h> 0024 #include <QDBusAbstractAdaptor> 0025 0026 class KHTMLPart; 0027 0028 /** 0029 * D-BUS interface for KHTML 0030 */ 0031 class KHTMLPartIface : public QDBusAbstractAdaptor 0032 { 0033 Q_OBJECT 0034 Q_CLASSINFO("D-Bus Interface", "org.kde.KHTMLPart") 0035 Q_PROPERTY(bool autoloadImages READ autoloadImages WRITE setAutoloadImages) 0036 Q_PROPERTY(bool dndEnabled READ dndEnabled WRITE setDndEnabled) 0037 Q_PROPERTY(QString encoding READ encoding WRITE setEncoding) 0038 Q_PROPERTY(bool jScriptEnabled READ jScriptEnabled WRITE setJScriptEnabled) 0039 Q_PROPERTY(bool javaEnabled READ javaEnabled WRITE setJavaEnabled) 0040 Q_PROPERTY(QString lastModified READ lastModified) 0041 Q_PROPERTY(bool metaRefreshEnabled READ metaRefreshEnabled WRITE setMetaRefreshEnabled) 0042 Q_PROPERTY(bool onlyLocalReferences READ onlyLocalReferences WRITE setOnlyLocalReferences) 0043 Q_PROPERTY(bool pluginsEnabled READ pluginsEnabled WRITE setPluginsEnabled) 0044 Q_PROPERTY(QString url READ url) 0045 0046 public: 0047 0048 KHTMLPartIface(KHTMLPart *); 0049 virtual ~KHTMLPartIface(); 0050 0051 public Q_SLOTS: 0052 /** 0053 * @return the current URL 0054 */ 0055 QString url() const; 0056 0057 bool closeUrl(); 0058 0059 /** 0060 * Enable/disable Javascript support. Note that this will 0061 * in either case permanently override the default usersetting. 0062 * If you want to have the default UserSettings, don't call this 0063 * method. 0064 */ 0065 void setJScriptEnabled(bool enable); 0066 0067 /** 0068 * Returns @p true if Javascript support is enabled or @p false 0069 * otherwise. 0070 */ 0071 bool jScriptEnabled() const; 0072 0073 /** 0074 * Enable/disable the automatic forwarding by <meta http-equiv="refresh" ....> 0075 */ 0076 void setMetaRefreshEnabled(bool enable); 0077 0078 /** 0079 * Returns @p true if automtaic forwarding is enabled. 0080 */ 0081 bool metaRefreshEnabled() const; 0082 0083 /** 0084 * Enables or disables Drag'n'Drop support. A drag operation is started if 0085 * the users drags a link. 0086 */ 0087 void setDndEnabled(bool b); 0088 0089 /** 0090 * Returns whether Dragn'n'Drop support is enabled or not. 0091 */ 0092 bool dndEnabled() const; 0093 0094 /** 0095 * Enables/disables Java applet support. Note that calling this function 0096 * will permanently override the User settings about Java applet support. 0097 * Not calling this function is the only way to let the default settings 0098 * apply. 0099 */ 0100 void setJavaEnabled(bool enable); 0101 0102 /** 0103 * Return if Java applet support is enabled/disabled. 0104 */ 0105 bool javaEnabled() const; 0106 0107 /** 0108 * Enables or disables plugins via, default is enabled 0109 */ 0110 void setPluginsEnabled(bool enable); 0111 0112 /** 0113 * Returns trie if plugins are enabled/disabled. 0114 */ 0115 bool pluginsEnabled() const; 0116 0117 /** 0118 * Specifies whether images contained in the document should be loaded 0119 * automatically or not. 0120 * 0121 * @note Request will be ignored if called before begin(). 0122 */ 0123 void setAutoloadImages(bool enable); 0124 0125 /** 0126 * Returns whether images contained in the document are loaded automatically 0127 * or not. 0128 * @note that the returned information is unrelieable as long as no begin() 0129 * was called. 0130 */ 0131 bool autoloadImages() const; 0132 0133 /** 0134 * Security option. 0135 * 0136 * Specify whether only local references ( stylesheets, images, scripts, subdocuments ) 0137 * should be loaded. ( default false - everything is loaded, if the more specific 0138 * options allow ) 0139 */ 0140 void setOnlyLocalReferences(bool enable); 0141 0142 /** 0143 * Returns whether references should be loaded ( default false ) 0144 **/ 0145 bool onlyLocalReferences() const; 0146 0147 /** 0148 * Sets the encoding the page uses. 0149 * 0150 * This can be different from the charset. The widget will try to reload 0151 * the current page in the new encoding, if url() is not empty. 0152 */ 0153 bool setEncoding(const QString &name); 0154 0155 /** 0156 * Returns the encoding the page currently uses. 0157 * 0158 * Note that the encoding might be different from the charset. 0159 */ 0160 QString encoding() const; 0161 0162 /** 0163 * Sets a user defined style sheet to be used on top of the HTML 4 0164 * default style sheet. 0165 * 0166 * This gives a wide range of possibilities to 0167 * change the layout of the page. 0168 */ 0169 void setUserStyleSheet(const QString &styleSheet); 0170 0171 /** 0172 * Sets the fixed font style. 0173 * 0174 * @param name The font name to use for fixed text, e.g. 0175 * the <tt><pre></tt> tag. 0176 */ 0177 void setFixedFont(const QString &name); 0178 0179 /** 0180 * Finds the anchor named @p name. 0181 * 0182 * If the anchor is found, the widget 0183 * scrolls to the closest position. Returns @p true if the anchor has 0184 * been found. 0185 */ 0186 bool gotoAnchor(const QString &name); 0187 0188 /** 0189 * Go to next Anchor. 0190 * 0191 * This is useful to navigate from outside of the navigator. 0192 */ 0193 bool nextAnchor(); 0194 0195 /** 0196 * Go to previous Anchor. 0197 */ 0198 bool prevAnchor(); 0199 0200 /** 0201 * Activate the node that currently has the focus 0202 * (emulates pressing Return) 0203 */ 0204 void activateNode(); 0205 0206 /** 0207 * Returns the text the user has marked. 0208 */ 0209 QString selectedText() const; 0210 0211 /** 0212 * Marks all text in the document as selected. 0213 */ 0214 void selectAll(); 0215 0216 /** 0217 * Last-modified date (in raw string format), if received in the [HTTP] headers. 0218 */ 0219 QString lastModified() const; 0220 0221 /** 0222 * Print the contents of the current html view. 0223 * @param quick if true, fully automated printing, without the print dialog. 0224 */ 0225 Q_NOREPLY void print(bool quick); 0226 0227 void debugRenderTree(); 0228 void debugDOMTree(); 0229 void viewDocumentSource(); 0230 void viewFrameSource(); 0231 void saveBackground(const QString &url); 0232 void saveDocument(const QString &url); 0233 0234 /** 0235 * Evaluate a given piece of Javascript code 0236 */ 0237 QString evalJS(const QString &script); 0238 0239 /** 0240 * Stops display of animated images 0241 */ 0242 void stopAnimations(); 0243 0244 Q_SIGNALS: 0245 void configurationChanged(); 0246 0247 private: 0248 KHTMLPart *part; 0249 }; 0250 0251 #endif 0252