KHTML
khtml_part.h
Go to the documentation of this file.
00001 // -*- c-basic-offset: 2 -*- 00002 /* This file is part of the KDE project 00003 * 00004 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> 00005 * 1999-2001 Lars Knoll <knoll@kde.org> 00006 * 1999-2001 Antti Koivisto <koivisto@kde.org> 00007 * 2000-2001 Simon Hausmann <hausmann@kde.org> 00008 * 2000-2001 Dirk Mueller <mueller@kde.org> 00009 * 2000 Stefan Schimanski <1Stein@gmx.de> 00010 * 00011 * This library is free software; you can redistribute it and/or 00012 * modify it under the terms of the GNU Library General Public 00013 * License as published by the Free Software Foundation; either 00014 * version 2 of the License, or (at your option) any later version. 00015 * 00016 * This library is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00019 * Library General Public License for more details. 00020 * 00021 * You should have received a copy of the GNU Library General Public License 00022 * along with this library; see the file COPYING.LIB. If not, write to 00023 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00024 * Boston, MA 02110-1301, USA. 00025 */ 00026 #ifndef __khtml_part_h__ 00027 #define __khtml_part_h__ 00028 00029 #include "dom/dom_doc.h" 00030 #include "dom/dom2_range.h" 00031 00032 #include <kparts/part.h> 00033 #include <kparts/browserextension.h> 00034 #include <kdemacros.h> 00035 #include <kfind.h> 00036 #include <kfinddialog.h> 00037 #include <klocalizedstring.h> 00038 #include <kencodingdetector.h> 00039 #include <QtCore/QRegExp> 00040 00041 class KHTMLPartPrivate; 00042 class KHTMLPartBrowserExtension; 00043 class KJSProxy; 00044 class KHTMLView; 00045 class KHTMLViewBar; 00046 class KHTMLFindBar; 00047 class KHTMLSettings; 00048 class KJavaAppletContext; 00049 class KJSErrorDlg; 00050 00051 namespace DOM 00052 { 00053 class HTMLDocument; 00054 class HTMLDocumentImpl; 00055 class DocumentImpl; 00056 class Document; 00057 class XMLDocumentImpl; 00058 class HTMLTitleElementImpl; 00059 class HTMLFrameElementImpl; 00060 class HTMLIFrameElementImpl; 00061 class HTMLObjectElementImpl; 00062 class HTMLFormElementImpl; 00063 class HTMLAnchorElementImpl; 00064 class HTMLMetaElementImpl; 00065 class NodeImpl; 00066 class ElementImpl; 00067 class Node; 00068 class HTMLEventListener; 00069 class EventListener; 00070 class HTMLPartContainerElementImpl; 00071 class HTMLObjectBaseElementImpl; 00072 class Position; 00073 class Selection; 00074 class Range; 00075 class Editor; 00076 } 00077 00078 namespace WebCore 00079 { 00080 class SVGDocumentExtensions; 00081 } 00082 00083 namespace KJS 00084 { 00085 class Interpreter; 00086 class HTMLElement; 00087 } 00088 00089 namespace khtml 00090 { 00091 class DocLoader; 00092 class RenderPart; 00093 class ChildFrame; 00094 class MousePressEvent; 00095 class MouseDoubleClickEvent; 00096 class MouseMoveEvent; 00097 class MouseReleaseEvent; 00098 class DrawContentsEvent; 00099 class CachedObject; 00100 class RenderWidget; 00101 class RenderBlock; 00102 class CSSStyleSelector; 00103 class HTMLTokenizer; 00104 class XMLTokenizer; 00105 struct EditorContext; 00106 class EditCommandImpl; 00107 class KHTMLPartAccessor; 00108 } 00109 00110 namespace KJS { 00111 class Window; 00112 class WindowFunc; 00113 class ExternalFunc; 00114 class JSEventListener; 00115 class JSLazyEventListener; 00116 class JSNodeFilter; 00117 class DOMDocument; 00118 class SourceFile; 00119 class ScheduledAction; 00120 class DOMSelection; 00121 class DOMSelectionProtoFunc; 00122 class KHTMLPartScriptable; 00123 } 00124 00125 namespace KParts 00126 { 00127 class PartManager; 00128 class ScriptableExtension; 00129 } 00130 00131 namespace KWallet 00132 { 00133 class Wallet; 00134 } 00135 00206 class KHTML_EXPORT KHTMLPart : public KParts::ReadOnlyPart 00207 { 00208 Q_OBJECT 00209 friend class KHTMLView; 00210 friend class DOM::HTMLTitleElementImpl; 00211 friend class DOM::HTMLFrameElementImpl; 00212 friend class DOM::HTMLIFrameElementImpl; 00213 friend class DOM::HTMLObjectBaseElementImpl; 00214 friend class DOM::HTMLObjectElementImpl; 00215 friend class DOM::HTMLAnchorElementImpl; 00216 friend class DOM::HTMLMetaElementImpl; 00217 friend class DOM::NodeImpl; 00218 friend class DOM::ElementImpl; 00219 friend class KHTMLRun; 00220 friend class DOM::HTMLFormElementImpl; 00221 friend class KJS::Window; 00222 friend class KJS::ScheduledAction; 00223 friend class KJS::JSNodeFilter; 00224 friend class KJS::WindowFunc; 00225 friend class KJS::ExternalFunc; 00226 friend class KJS::JSEventListener; 00227 friend class KJS::JSLazyEventListener; 00228 friend class KJS::DOMDocument; 00229 friend class KJS::HTMLElement; 00230 friend class KJS::SourceFile; 00231 friend class KJS::DOMSelection; 00232 friend class KJS::DOMSelectionProtoFunc; 00233 friend class KJS::KHTMLPartScriptable; 00234 friend class KJSProxy; 00235 friend class KHTMLPartBrowserExtension; 00236 friend class DOM::DocumentImpl; 00237 friend class DOM::HTMLDocumentImpl; 00238 friend class DOM::Selection; 00239 friend class DOM::Editor; 00240 friend class KHTMLPartBrowserHostExtension; 00241 friend class khtml::HTMLTokenizer; 00242 friend class khtml::XMLTokenizer; 00243 friend class khtml::RenderWidget; 00244 friend class khtml::RenderBlock; 00245 friend class khtml::CSSStyleSelector; 00246 friend class khtml::EditCommandImpl; 00247 friend class khtml::KHTMLPartAccessor; 00248 friend class KHTMLPartIface; 00249 friend class KHTMLPartFunction; 00250 friend class KHTMLPopupGUIClient; 00251 friend class KHTMLFind; 00252 friend class StorePass; 00253 friend class WebCore::SVGDocumentExtensions; 00254 00255 Q_PROPERTY( bool javaScriptEnabled READ jScriptEnabled WRITE setJScriptEnabled ) 00256 Q_PROPERTY( bool javaEnabled READ javaEnabled WRITE setJavaEnabled ) 00257 Q_PROPERTY( bool dndEnabled READ dndEnabled WRITE setDNDEnabled ) 00258 Q_PROPERTY( bool pluginsEnabled READ pluginsEnabled WRITE setPluginsEnabled ) 00259 Q_PROPERTY( DNSPrefetch dnsPrefetch READ dnsPrefetch WRITE setDNSPrefetch ) 00260 00261 /* 00262 * 00263 * Don't add setOnlyLocalReferences here. It shouldn't be accessible via DBus. 00264 * 00265 **/ 00266 Q_PROPERTY( bool modified READ isModified ) 00267 Q_PROPERTY( QString encoding READ encoding WRITE setEncoding ) 00268 Q_PROPERTY( QString lastModified READ lastModified ) 00269 Q_PROPERTY( bool metaRefreshEnabled READ metaRefreshEnabled WRITE setMetaRefreshEnabled ) 00270 00271 public: 00272 enum GUIProfile { DefaultGUI, BrowserViewGUI /* ... */ }; 00273 00281 enum DNSPrefetch { 00282 DNSPrefetchDisabled=0, 00283 DNSPrefetchEnabled, 00284 DNSPrefetchOnlyWWWAndSLD 00285 }; 00286 00299 KHTMLPart( QWidget *parentWidget = 0, 00300 QObject *parent = 0, GUIProfile prof = DefaultGUI ); 00319 KHTMLPart( KHTMLView *view, QObject *parent = 0, GUIProfile prof = DefaultGUI ); 00320 00324 virtual ~KHTMLPart(); 00325 00331 virtual bool openUrl( const KUrl &url ); 00332 00336 virtual bool closeUrl(); 00337 00344 virtual void showError( KJob* job ); 00345 00349 DOM::HTMLDocument htmlDocument() const; 00350 00354 DOM::Document document() const; 00355 00359 QString documentSource() const; 00360 00364 DOM::Node activeNode() const; 00365 00369 KParts::BrowserExtension *browserExtension() const; 00370 KParts::BrowserHostExtension *browserHostExtension() const; 00371 00375 KHTMLView *view() const; 00376 00383 void setJScriptEnabled( bool enable ); 00384 00389 bool jScriptEnabled() const; 00390 00408 KJS::Interpreter *jScriptInterpreter(); 00409 00421 void setStatusMessagesEnabled( bool enable ); 00422 00426 bool statusMessagesEnabled() const; 00427 00431 void setMetaRefreshEnabled( bool enable ); 00432 00436 bool metaRefreshEnabled() const; 00437 00442 QVariant executeScript( const DOM::Node &n, const QString &script ); 00443 00448 void setDNDEnabled( bool b ); 00449 00453 bool dndEnabled() const; 00454 00461 void setJavaEnabled( bool enable ); 00462 00466 bool javaEnabled() const; 00467 00471 void setPluginsEnabled( bool enable ); 00472 00476 bool pluginsEnabled() const; 00477 00484 void setAutoloadImages( bool enable ); 00491 bool autoloadImages() const; 00492 00509 void setOnlyLocalReferences( bool enable ); 00510 00520 void setForcePermitLocalImages( bool enable ); 00521 00534 void setDNSPrefetch( DNSPrefetch pmode ); 00535 00544 DNSPrefetch dnsPrefetch() const; 00545 00550 bool onlyLocalReferences() const; 00551 00558 bool forcePermitLocalImages() const; 00559 00562 bool isCaretMode() const; 00563 00567 bool isEditable() const; 00568 00581 void setCaretPosition(DOM::Node node, long offset, bool extendSelection = false); 00582 00586 enum CaretDisplayPolicy { 00587 CaretVisible, 00588 CaretInvisible, 00589 CaretBlink 00590 }; 00591 00595 CaretDisplayPolicy caretDisplayPolicyNonFocused() const; 00596 00606 void setCaretDisplayPolicyNonFocused(CaretDisplayPolicy policy); 00607 00608 #ifndef KDE_NO_COMPAT 00609 KUrl baseURL() const; 00610 #endif 00611 00615 KUrl backgroundURL() const; 00616 00620 void scheduleRedirection( int delay, const QString &url, bool lockHistory = true ); 00621 00644 virtual void begin( const KUrl &url = KUrl(), int xOffset = 0, int yOffset = 0 ); 00645 00666 virtual void write( const char *str, int len = -1 ); 00667 00679 // FIXME KDE5: always honour doctype, remove setAlwaysHonourDoctype() 00680 virtual void write( const QString &str ); 00681 00685 virtual void end(); 00686 00687 /* 00688 * Prints the current HTML page laid out for the printer. 00689 * 00690 * (not implemented at the moment) 00691 */ 00692 // void print(QPainter *, int pageHeight, int pageWidth); 00693 00697 void paint( QPainter *, const QRect &, int = 0, bool * = 0 ); 00698 00705 bool setEncoding( const QString &name, bool override = false ); 00706 00712 QString encoding() const; 00713 00723 void setUserStyleSheet( const KUrl &url ); 00724 00734 void setUserStyleSheet( const QString &styleSheet ); 00735 00736 public: 00737 00743 void setStandardFont( const QString &name ); 00744 00751 void setFixedFont( const QString &name ); 00752 00760 bool gotoAnchor( const QString &name ); 00761 00767 bool nextAnchor(); 00768 00772 bool prevAnchor(); 00773 00777 void setURLCursor( const QCursor &c ); 00778 00782 QCursor urlCursor() const; 00783 00787 enum FindOptions 00788 { 00789 FindLinksOnly = 1 * KFind::MinimumUserOption, 00790 FindNoPopups = 2 * KFind::MinimumUserOption 00791 //FindIncremental = 4 * KFind::MinimumUserOption 00792 }; 00793 00798 void findText(); 00799 00807 void findText( const QString &str, long options, QWidget *parent = 0, 00808 KFindDialog *findDialog = 0 ); 00809 00813 void findTextBegin(); 00814 00820 bool findTextNext( bool reverse = false ); 00821 00831 void setZoomFactor(int percent); 00832 00836 int zoomFactor() const; 00837 00847 void setFontScaleFactor(int percent); 00848 00852 int fontScaleFactor() const; 00853 00857 virtual QString selectedText() const; 00858 00865 QString selectedTextAsHTML() const; 00866 00870 DOM::Range selection() const; 00871 00882 void selection(DOM::Node &startNode, long &startOffset, 00883 DOM::Node &endNode, long &endOffset) const; 00884 00888 void setSelection( const DOM::Range & ); 00889 00898 bool hasSelection() const; 00899 00904 DOM::Editor *editor() const; 00905 00909 void selectAll(); 00910 00916 void show(); 00917 00923 void hide(); 00924 00929 KParts::PartManager *partManager(); 00930 00938 virtual void saveState( QDataStream &stream ); 00948 virtual void restoreState( QDataStream &stream ); 00949 00956 DOM::Node nodeUnderMouse() const; 00957 00965 DOM::Node nonSharedNodeUnderMouse() const; 00966 00970 const KHTMLSettings *settings() const; 00971 00978 // ### KDE5 make const 00979 KHTMLPart *parentPart(); 00980 00986 QStringList frameNames() const; 00987 00988 QList<KParts::ReadOnlyPart*> frames() const; 00989 00993 KHTMLPart *findFrame( const QString &f ); 00994 01002 KHTMLPart *findFrameParent( KParts::ReadOnlyPart *callingPart, const QString &f, khtml::ChildFrame **childFrame=0 ); 01003 01009 KParts::ReadOnlyPart *currentFrame() const; 01010 01017 bool frameExists( const QString &frameName ); 01018 01022 KJSProxy *framejScript(KParts::ReadOnlyPart *framePart); 01023 01027 KParts::ReadOnlyPart *findFramePart( const QString &f ); 01033 void setJSStatusBarText( const QString &text ); 01034 01040 void setJSDefaultStatusBarText( const QString &text ); 01041 01047 QString jsStatusBarText() const; 01048 01054 QString jsDefaultStatusBarText() const; 01055 01059 QString referrer() const; 01060 01064 QString pageReferrer() const; 01065 01069 QString lastModified() const; 01070 01074 void preloadStyleSheet( const QString &url, const QString &stylesheet ); 01075 01079 void preloadScript( const QString &url, const QString &script ); 01080 01086 bool isPointInsideSelection(int x, int y); 01087 01091 bool restored() const; 01092 01102 // ### KDE5 remove - fix write( const QString &str ) instead 01103 void setAlwaysHonourDoctype( bool b = true ); 01104 01105 // ### KDE5 remove me 01106 enum FormNotification { NoNotification = 0, Before, Only, Unused=255 }; 01112 void setFormNotification(FormNotification fn); 01113 01119 FormNotification formNotification() const; 01120 01127 KUrl toplevelURL(); 01128 01134 bool isModified() const; 01135 01139 void setSuppressedPopupIndicator( bool enable, KHTMLPart *originPart = 0 ); 01140 01144 bool inProgress() const; 01145 01146 Q_SIGNALS: 01150 void onURL( const QString &url ); 01151 01157 void popupMenu( const QString &url, const QPoint &point ); 01158 01162 void selectionChanged(); 01163 01171 void nodeActivated( const DOM::Node & ); 01172 01175 void docCreated(); 01176 01187 void caretPositionChanged(const DOM::Node &node, long offset); 01188 01189 01195 void formSubmitNotification(const char *action, const QString& url, 01196 const QByteArray& formData, const QString& target, 01197 const QString& contentType, const QString& boundary); 01198 01202 void configurationChanged(); 01203 01204 01205 protected: 01206 01211 KUrl completeURL( const QString &url ); 01212 01219 void htmlError( int errorCode, const QString& text, const KUrl& reqUrl ); 01220 01221 virtual void customEvent( QEvent *event ); 01222 01226 virtual void khtmlMousePressEvent( khtml::MousePressEvent *event ); 01230 virtual void khtmlMouseDoubleClickEvent( khtml::MouseDoubleClickEvent * ); 01234 virtual void khtmlMouseMoveEvent( khtml::MouseMoveEvent *event ); 01238 virtual void khtmlMouseReleaseEvent( khtml::MouseReleaseEvent *event ); 01242 virtual void khtmlDrawContentsEvent( khtml::DrawContentsEvent * ); 01243 01247 virtual void guiActivateEvent( KParts::GUIActivateEvent *event ); 01248 01252 virtual bool openFile(); 01253 01254 virtual bool urlSelected( const QString &url, int button, int state, 01255 const QString &_target, 01256 const KParts::OpenUrlArguments& args = KParts::OpenUrlArguments(), 01257 const KParts::BrowserArguments& browserArgs = KParts::BrowserArguments() ); 01258 01267 virtual KParts::ReadOnlyPart *createPart( QWidget *parentWidget, 01268 QObject *parent, 01269 const QString &mimetype, QString &serviceName, 01270 QStringList &serviceTypes, const QStringList ¶ms); 01271 01272 // This is for RenderPartObject. We want to ask the 'download plugin?' 01273 // question only once per mimetype 01274 bool pluginPageQuestionAsked( const QString& mimetype ) const; 01275 void setPluginPageQuestionAsked( const QString& mimetype ); 01276 01277 enum PageSecurity { NotCrypted, Encrypted, Mixed }; 01278 void setPageSecurity( PageSecurity sec ); 01279 01283 virtual bool doOpenStream( const QString& mimeType ); 01284 01288 virtual bool doWriteStream( const QByteArray& data ); 01289 01293 virtual bool doCloseStream(); 01294 01298 virtual void timerEvent(QTimerEvent *); 01299 01306 bool mayPrefetchHostname( const QString& name ); 01307 01311 void updateZoomFactor(); 01312 01313 public Q_SLOTS: 01314 01324 void setActiveNode( const DOM::Node &node ); 01325 01329 void stopAnimations(); 01330 01338 QVariant executeScript( const QString &script ); 01339 01349 void setCaretMode(bool enable); 01350 01361 void setEditable(bool enable); 01362 01378 void setCaretVisible(bool show); 01379 01380 // ### KDE4 FIXME: 01381 // Remove this and make the one below protected+virtual slot. 01382 // Warning: this is effectively "internal". Be careful. 01383 void submitFormProxy( const char *action, const QString &url, 01384 const QByteArray &formData, 01385 const QString &target, 01386 const QString& contentType = QString(), 01387 const QString& boundary = QString() ); 01388 01389 protected Q_SLOTS: 01390 01396 virtual void slotFinished( KJob* ); 01397 01398 protected: 01404 virtual void startingJob( KIO::Job * ) {} 01405 01406 private Q_SLOTS: 01407 01411 void reparseConfiguration(); 01412 01416 void slotData( KIO::Job*, const QByteArray &data ); 01420 void slotInfoMessage( KJob*, const QString& msg ); 01424 void slotRestoreData( const QByteArray &data ); 01428 void slotFinishedParsing(); 01432 void slotRedirect(); 01436 void slotRedirection( KIO::Job*, const KUrl& ); 01440 void slotDebugScript(); 01444 void slotDebugDOMTree(); 01448 void slotDebugRenderTree(); 01449 01450 void slotDebugFrameTree(); 01451 01455 void slotStopAnimations(); 01459 virtual void slotViewDocumentSource(); 01463 virtual void slotViewFrameSource(); 01467 void slotViewPageInfo(); 01471 virtual void slotSaveBackground(); 01475 virtual void slotSaveDocument(); 01479 virtual void slotSaveFrame(); 01483 virtual void slotSecurity(); 01487 virtual void slotSetEncoding(const QString &); 01488 01492 virtual void slotUseStylesheet(); 01493 01494 virtual void slotFind(); 01495 virtual void slotFindDone(); // ### remove me 01496 virtual void slotFindDialogDestroyed(); // ### remove me 01497 void slotFindNext(); 01498 void slotFindPrev(); 01499 void slotFindAheadText(); 01500 void slotFindAheadLink(); 01501 01502 void slotIncZoom(); 01503 void slotDecZoom(); 01504 void slotIncZoomFast(); 01505 void slotDecZoomFast(); 01506 01507 void slotIncFontSize(); 01508 void slotDecFontSize(); 01509 void slotIncFontSizeFast(); 01510 void slotDecFontSizeFast(); 01511 01512 void slotLoadImages(); 01513 void slotWalletClosed(); 01514 void launchWalletManager(); 01515 void walletMenu(); 01516 void delNonPasswordStorableSite(); 01517 void removeStoredPasswordForm(QAction* action); 01518 void addWalletFormKey(const QString& walletFormKey); 01519 01523 void submitFormAgain(); 01524 01528 void updateActions(); 01532 void slotPartRemoved( KParts::Part *part ); 01536 void slotActiveFrameChanged( KParts::Part *part ); 01540 void slotChildStarted( KIO::Job *job ); 01544 void slotChildCompleted(); 01548 void slotChildCompleted( bool ); 01552 void slotParentCompleted(); 01556 void slotChildURLRequest( const KUrl &url, const KParts::OpenUrlArguments&, const KParts::BrowserArguments &args ); 01560 void slotChildDocCreated(); 01564 void slotRequestFocus( KParts::ReadOnlyPart * ); 01565 void slotLoaderRequestStarted( khtml::DocLoader*, khtml::CachedObject* obj); 01566 void slotLoaderRequestDone( khtml::DocLoader*, khtml::CachedObject *obj ); 01567 void checkCompleted(); 01568 01572 void slotAutoScroll(); 01573 01574 void slotPrintFrame(); 01575 01576 void slotSelectAll(); 01577 01581 void slotProgressUpdate(); 01582 01583 /* 01584 * @internal 01585 */ 01586 void slotJobPercent( KJob*, unsigned long ); 01587 01588 /* 01589 * @internal 01590 */ 01591 void slotJobDone( KJob* ); 01592 01593 /* 01594 * @internal 01595 */ 01596 void slotUserSheetStatDone( KJob* ); 01597 01598 /* 01599 * @internal 01600 */ 01601 void slotJobSpeed( KJob*, unsigned long ); 01602 01606 void slotClearSelection(); 01607 01611 void slotZoomView( int ); 01612 01616 void slotAutomaticDetectionLanguage(KEncodingDetector::AutoDetectScript scri); 01617 01621 void slotToggleCaretMode(); 01622 01626 void suppressedPopupMenu(); 01627 01631 void togglePopupPassivePopup(); 01632 01636 void showSuppressedPopups(); 01637 01641 void launchJSConfigDialog(); 01642 01646 void launchJSErrorDialog(); 01647 01651 void removeJSErrorExtension(); 01652 01656 void disableJSErrorExtension(); 01657 01661 void jsErrorDialogContextMenu(); 01662 01668 void restoreScrollPosition(); 01669 01670 void walletOpened(KWallet::Wallet*); 01671 01672 private: 01673 01674 KJSErrorDlg *jsErrorExtension(); 01675 01676 enum StatusBarPriority { BarDefaultText, BarHoverText, BarOverrideText }; 01677 void setStatusBarText( const QString& text, StatusBarPriority p); 01678 01679 bool restoreURL( const KUrl &url ); 01680 void clearCaretRectIfNeeded(); 01681 void setFocusNodeIfNeeded(const DOM::Selection &); 01682 void selectionLayoutChanged(); 01683 void notifySelectionChanged(bool closeTyping=true); 01684 void resetFromScript(); 01685 void emitSelectionChanged(); 01686 void onFirstData(); 01687 // Returns whether callingHtmlPart may access this part 01688 bool checkFrameAccess(KHTMLPart *callingHtmlPart); 01689 bool openUrlInFrame(const KUrl &url, const KParts::OpenUrlArguments& arguments, const KParts::BrowserArguments &browserArguments); 01690 void startAutoScroll(); 01691 void stopAutoScroll(); 01692 void overURL( const QString &url, const QString &target, bool shiftPressed = false ); 01693 void resetHoverText(); // Undo overURL and reset HoverText 01694 01695 KParts::ScriptableExtension *scriptableExtension( const DOM::NodeImpl *); 01696 01697 KWallet::Wallet* wallet(); 01698 01699 void openWallet(DOM::HTMLFormElementImpl*); 01700 void saveToWallet(const QString& key, const QMap<QString,QString>& data); 01701 void dequeueWallet(DOM::HTMLFormElementImpl*); 01702 void saveLoginInformation(const QString& host, const QString& key, const QMap<QString, QString>& walletMap); 01703 01704 void enableFindAheadActions(bool); 01705 01709 KHTMLViewBar *pTopViewBar() const; 01710 01714 KHTMLViewBar *pBottomViewBar() const; 01715 01719 bool pFindTextNextInThisFrame( bool reverse ); 01720 01724 // ### KDE4 FIXME: 01725 // It is desirable to be able to filter form submissions as well. 01726 // For instance, forms can have a target and an inheriting class 01727 // might want to filter based on the target. Make this protected 01728 // and virtual, or provide a better solution. 01729 // See the web_module for the sidebar for an example where this is 01730 // necessary. 01731 void submitForm( const char *action, const QString &url, const QByteArray &formData, 01732 const QString &target, const QString& contentType = QString(), 01733 const QString& boundary = QString() ); 01734 01735 void popupMenu( const QString &url ); 01736 01737 void init( KHTMLView *view, GUIProfile prof ); 01738 01739 01740 void clear(); 01741 01742 QVariant crossFrameExecuteScript(const QString& target, const QString& script); 01743 01751 QString requestFrameName(); 01752 01753 // Requests loading of a frame or iframe element 01754 bool loadFrameElement( DOM::HTMLPartContainerElementImpl *frame, const QString &url, const QString &frameName, 01755 const QStringList &args = QStringList(), bool isIFrame = false ); 01756 01757 // Requests loading of an object or embed element. Returns true if 01758 // loading succeeded. 01759 bool loadObjectElement( DOM::HTMLPartContainerElementImpl *frame, const QString &url, const QString &serviceType, 01760 const QStringList &args = QStringList() ); 01761 01762 // Tries an open a URL in given ChildFrame with all known navigation information 01763 // like mimetype and the like in the KParts arguments. 01764 // 01765 // Returns true if it's done -- which excludes the case when it's still resolving 01766 // the mimetype. 01767 // ### refine comment wrt to error case 01768 bool requestObject( khtml::ChildFrame *child, const KUrl &url, 01769 const KParts::OpenUrlArguments &args = KParts::OpenUrlArguments(), 01770 const KParts::BrowserArguments& browserArgs = KParts::BrowserArguments() ); 01771 01772 // This method does the loading inside a ChildFrame once we know what mimetype to 01773 // load it as 01774 bool processObjectRequest( khtml::ChildFrame *child, const KUrl &url, const QString &mimetype ); 01775 01776 // helper for reporting ChildFrame load failure 01777 void childLoadFailure( khtml::ChildFrame *child ); 01778 01779 // Updates the ChildFrame to use the particular part, hooking up the various 01780 // signals, connections, etc. 01781 void connectToChildPart( khtml::ChildFrame *child, KParts::ReadOnlyPart *part, 01782 const QString &mimetype ); 01783 01784 // Low-level navigation of the part itself --- this doesn't ask the user 01785 // to save things or such, and assumes that all the ChildFrame info is already 01786 // filed in with things like the mimetype and so on 01787 // 01788 // Returns if successful or not 01789 bool navigateChild( khtml::ChildFrame *child, const KUrl& url ); 01790 01791 // Helper for executing javascript: or about: protocols 01792 bool navigateLocalProtocol( khtml::ChildFrame *child, KParts::ReadOnlyPart *part, 01793 const KUrl& url ); 01794 01795 01796 DOM::EventListener *createHTMLEventListener( QString code, QString name, DOM::NodeImpl *node, bool svg = false ); 01797 01798 DOM::HTMLDocumentImpl *docImpl() const; 01799 DOM::DocumentImpl *xmlDocImpl() const; 01800 khtml::ChildFrame *frame( const QObject *obj ); 01801 01802 khtml::ChildFrame *recursiveFrameRequest( KHTMLPart *callingHtmlPart, const KUrl &url, 01803 const KParts::OpenUrlArguments& args, const KParts::BrowserArguments &browserArgs, 01804 bool callParent = true ); 01805 01806 bool checkLinkSecurity( const KUrl &linkURL,const KLocalizedString &message = KLocalizedString(), const QString &button = QString() ); 01807 QVariant executeScript( const QString& filename, int baseLine, const DOM::Node &n, const QString& script ); 01808 01809 KJSProxy *jScript(); 01810 01811 KHTMLPart *opener(); 01812 long cacheId() const; 01813 void setOpener( KHTMLPart *_opener ); 01814 bool openedByJS(); 01815 void setOpenedByJS( bool _openedByJS ); 01816 01817 void checkEmitLoadEvent(); 01818 void emitLoadEvent(); 01819 01820 bool initFindNode( bool selection, bool reverse, bool fromCursor ); 01821 01831 void extendSelectionTo(int x, int y, const DOM::Node &innerNode); 01835 bool isExtendingSelection() const; 01836 KEncodingDetector *createDecoder(); 01837 QString defaultEncoding() const; 01838 01840 QString defaultExtension() const; 01841 01845 void zoomIn(const int stepping[], int count); 01849 void zoomOut(const int stepping[], int count); 01850 01851 void incFontSize(const int stepping[], int count); 01852 01853 void decFontSize(const int stepping[], int count); 01854 01855 void emitCaretPositionChanged(const DOM::Position &pos); 01856 01857 void setDebugScript( bool enable ); 01858 01859 void runAdFilter(); 01860 01861 khtml::EditorContext *editorContext() const; 01862 01867 void initCaret(); 01868 01872 const DOM::Selection &caret() const; 01873 01877 const DOM::Selection &dragCaret() const; 01878 01882 void setCaret(const DOM::Selection &, bool closeTyping=true); 01883 01887 void setDragCaret(const DOM::Selection &); 01888 01892 void clearSelection(); 01893 01897 void invalidateSelection(); 01898 01902 void setSelectionVisible(bool flag=true); 01903 01907 void paintCaret(QPainter *p, const QRect &rect) const; 01908 01912 void paintDragCaret(QPainter *p, const QRect &rect) const; 01913 01921 QString simplifiedSelectedText() const; 01922 01923 bool handleMouseMoveEventDrag(khtml::MouseMoveEvent *event); 01924 bool handleMouseMoveEventOver(khtml::MouseMoveEvent *event); 01925 void handleMouseMoveEventSelection(khtml::MouseMoveEvent *event); 01926 01927 void handleMousePressEventSingleClick(khtml::MousePressEvent *event); 01928 void handleMousePressEventDoubleClick(khtml::MouseDoubleClickEvent *event); 01929 void handleMousePressEventTripleClick(khtml::MouseDoubleClickEvent *event); 01930 01931 KHTMLPartPrivate *d; 01932 friend class KHTMLPartPrivate; 01933 01934 public: // So we don't end up having to add 50 more friends 01935 01937 KHTMLPartPrivate* impl() { return d; } 01938 }; 01939 01940 01941 #endif
KDE 4.6 API Reference