khtmlpart_p.h
00001 #ifndef khtmlpart_p_h
00002 #define khtmlpart_p_h
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include <kcursor.h>
00030 #include <klibloader.h>
00031 #include <kxmlguifactory.h>
00032 #include <kaction.h>
00033 #include <kparts/partmanager.h>
00034 #include <kparts/statusbarextension.h>
00035 #include <kparts/browserextension.h>
00036 #include <kwallet.h>
00037
00038 #include <qguardedptr.h>
00039 #include <qmap.h>
00040 #include <qtimer.h>
00041 #include <qvaluelist.h>
00042
00043 #include "html/html_formimpl.h"
00044 #include "khtml_run.h"
00045 #include "khtml_factory.h"
00046 #include "khtml_events.h"
00047 #include "khtml_ext.h"
00048 #include "khtml_iface.h"
00049 #include "khtml_settings.h"
00050 #include "misc/decoder.h"
00051 #include "ecma/kjs_proxy.h"
00052
00053 class KFind;
00054 class KFindDialog;
00055 class KPopupMenu;
00056 class KSelectAction;
00057 class KURLLabel;
00058 class KJavaAppletContext;
00059 class KJSErrorDlg;
00060
00061 namespace KIO
00062 {
00063 class Job;
00064 class TransferJob;
00065 }
00066 namespace KParts
00067 {
00068 class StatusBarExtension;
00069 }
00070
00071 namespace khtml
00072 {
00073 class ChildFrame : public QObject
00074 {
00075 Q_OBJECT
00076 public:
00077 enum Type { Frame, IFrame, Object };
00078
00079 ChildFrame() : QObject (0L, "khtml_child_frame") {
00080 m_jscript = 0L;
00081 m_kjs_lib = 0;
00082 m_bCompleted = false; m_bPreloaded = false; m_type = Frame; m_bNotify = false;
00083 m_bPendingRedirection = false;
00084 }
00085
00086 ~ChildFrame() {
00087 if (m_run) m_run->abort();
00088 delete m_jscript;
00089 if ( m_kjs_lib)
00090 m_kjs_lib->unload();
00091 }
00092
00093 QGuardedPtr<khtml::RenderPart> m_frame;
00094 QGuardedPtr<KParts::ReadOnlyPart> m_part;
00095 QGuardedPtr<KParts::BrowserExtension> m_extension;
00096 QGuardedPtr<KParts::LiveConnectExtension> m_liveconnect;
00097 QString m_serviceName;
00098 QString m_serviceType;
00099 KJSProxy *m_jscript;
00100 KLibrary *m_kjs_lib;
00101 bool m_bCompleted;
00102 QString m_name;
00103 KParts::URLArgs m_args;
00104 QGuardedPtr<KHTMLRun> m_run;
00105 bool m_bPreloaded;
00106 KURL m_workingURL;
00107 Type m_type;
00108 QStringList m_params;
00109 bool m_bNotify;
00110 bool m_bPendingRedirection;
00111 protected slots:
00112 void liveConnectEvent(const unsigned long, const QString&, const KParts::LiveConnectExtension::ArgList&);
00113 };
00114
00115 }
00116
00117 struct KHTMLFrameList : public QValueList<khtml::ChildFrame*>
00118 {
00119 Iterator find( const QString &name ) KDE_NO_EXPORT;
00120 };
00121
00122 typedef KHTMLFrameList::ConstIterator ConstFrameIt;
00123 typedef KHTMLFrameList::Iterator FrameIt;
00124
00125 static int khtml_part_dcop_counter = 0;
00126
00127
00128 class KHTMLWalletQueue : public QObject
00129 {
00130 Q_OBJECT
00131 public:
00132 KHTMLWalletQueue(QObject *parent) : QObject(parent) {
00133 wallet = 0L;
00134 }
00135
00136 virtual ~KHTMLWalletQueue() {
00137 delete wallet;
00138 wallet = 0L;
00139 }
00140
00141 KWallet::Wallet *wallet;
00142 typedef QPair<DOM::HTMLFormElementImpl*, QGuardedPtr<DOM::DocumentImpl> > Caller;
00143 typedef QValueList<Caller> CallerList;
00144 CallerList callers;
00145 QValueList<QPair<QString, QMap<QString, QString> > > savers;
00146
00147 signals:
00148 void walletOpened(KWallet::Wallet*);
00149
00150 public slots:
00151 void walletOpened(bool success) {
00152 if (!success) {
00153 delete wallet;
00154 wallet = 0L;
00155 }
00156 emit walletOpened(wallet);
00157 if (wallet) {
00158 if (!wallet->hasFolder(KWallet::Wallet::FormDataFolder())) {
00159 wallet->createFolder(KWallet::Wallet::FormDataFolder());
00160 }
00161 for (CallerList::Iterator i = callers.begin(); i != callers.end(); ++i) {
00162 if ((*i).first && (*i).second) {
00163 (*i).first->walletOpened(wallet);
00164 }
00165 }
00166 wallet->setFolder(KWallet::Wallet::FormDataFolder());
00167 for (QValueList<QPair<QString, QMap<QString, QString> > >::Iterator i = savers.begin(); i != savers.end(); ++i) {
00168 wallet->writeMap((*i).first, (*i).second);
00169 }
00170 }
00171 callers.clear();
00172 savers.clear();
00173 wallet = 0L;
00174 }
00175 };
00176
00177 class KHTMLPartPrivate
00178 {
00179 KHTMLPartPrivate(const KHTMLPartPrivate & other);
00180 public:
00181 KHTMLPartPrivate(QObject* parent)
00182 {
00183 m_doc = 0L;
00184 m_decoder = 0L;
00185 m_wallet = 0L;
00186 m_bWalletOpened = false;
00187 m_runningScripts = 0;
00188 m_job = 0L;
00189 m_bComplete = true;
00190 m_bLoadEventEmitted = true;
00191 m_cachePolicy = KIO::CC_Verify;
00192 m_manager = 0L;
00193 m_settings = new KHTMLSettings(*KHTMLFactory::defaultHTMLSettings());
00194 m_bClearing = false;
00195 m_bCleared = false;
00196 m_zoomFactor = 100;
00197 m_bDnd = true;
00198 m_startOffset = m_endOffset = 0;
00199 m_startBeforeEnd = true;
00200 m_extendAtEnd = true;
00201 m_linkCursor = KCursor::handCursor();
00202 m_loadedObjects = 0;
00203 m_totalObjectCount = 0;
00204 m_jobPercent = 0;
00205 m_haveEncoding = false;
00206 m_activeFrame = 0L;
00207 m_find = 0;
00208 m_findDialog = 0;
00209 m_ssl_in_use = false;
00210 m_jsedlg = 0;
00211 m_formNotification = KHTMLPart::NoNotification;
00212
00213 #ifndef Q_WS_QWS
00214 m_javaContext = 0;
00215 #endif
00216 m_cacheId = 0;
00217 m_frameNameId = 1;
00218
00219 m_restored = false;
00220
00221 m_focusNodeNumber = -1;
00222 m_focusNodeRestored = false;
00223
00224 m_bJScriptForce = false;
00225 m_bJScriptOverride = false;
00226 m_bJavaForce = false;
00227 m_bJavaOverride = false;
00228 m_bPluginsForce = false;
00229 m_bPluginsOverride = false;
00230 m_onlyLocalReferences = false;
00231
00232 m_caretMode = false;
00233 m_designMode = false;
00234
00235 m_metaRefreshEnabled = true;
00236 m_statusMessagesEnabled = true;
00237
00238 m_bFirstData = true;
00239 m_submitForm = 0;
00240 m_delayRedirect = 0;
00241 m_autoDetectLanguage = khtml::Decoder::SemiautomaticDetection;
00242
00243
00244 if(parent && parent->inherits("KHTMLPart"))
00245 {
00246 KHTMLPart* part = static_cast<KHTMLPart*>(parent);
00247 if(part->d)
00248 {
00249 m_bJScriptForce = part->d->m_bJScriptForce;
00250 m_bJScriptOverride = part->d->m_bJScriptOverride;
00251 m_bJavaForce = part->d->m_bJavaForce;
00252 m_bJavaOverride = part->d->m_bJavaOverride;
00253 m_bPluginsForce = part->d->m_bPluginsForce;
00254 m_bPluginsOverride = part->d->m_bPluginsOverride;
00255
00256 m_ssl_in_use = part->d->m_ssl_in_use;
00257 m_onlyLocalReferences = part->d->m_onlyLocalReferences;
00258 m_caretMode = part->d->m_caretMode;
00259 m_designMode = part->d->m_designMode;
00260 m_zoomFactor = part->d->m_zoomFactor;
00261 m_autoDetectLanguage = part->d->m_autoDetectLanguage;
00262 m_encoding = part->d->m_encoding;
00263 m_haveEncoding = part->d->m_haveEncoding;
00264 }
00265 }
00266
00267 m_focusNodeNumber = -1;
00268 m_focusNodeRestored = false;
00269 m_opener = 0;
00270 m_openedByJS = false;
00271 m_newJSInterpreterExists = false;
00272 m_dcopobject = 0;
00273 m_jobspeed = 0;
00274 m_dcop_counter = ++khtml_part_dcop_counter;
00275 m_statusBarWalletLabel = 0L;
00276 m_statusBarUALabel = 0L;
00277 m_statusBarJSErrorLabel = 0L;
00278 m_userStyleSheetLastModified = 0;
00279 m_wq = 0;
00280 }
00281 ~KHTMLPartPrivate()
00282 {
00283 delete m_dcopobject;
00284 delete m_statusBarExtension;
00285 delete m_extension;
00286 delete m_settings;
00287 delete m_wallet;
00288 #ifndef Q_WS_QWS
00289
00290 #endif
00291 }
00292
00293 QGuardedPtr<khtml::ChildFrame> m_frame;
00294 KHTMLFrameList m_frames;
00295 KHTMLFrameList m_objects;
00296
00297 QGuardedPtr<KHTMLView> m_view;
00298 KHTMLPartBrowserExtension *m_extension;
00299 KParts::StatusBarExtension *m_statusBarExtension;
00300 KHTMLPartBrowserHostExtension *m_hostExtension;
00301 KURLLabel* m_statusBarIconLabel;
00302 KURLLabel* m_statusBarWalletLabel;
00303 KURLLabel* m_statusBarUALabel;
00304 KURLLabel* m_statusBarJSErrorLabel;
00305 DOM::DocumentImpl *m_doc;
00306 khtml::Decoder *m_decoder;
00307 QString m_encoding;
00308 QString m_sheetUsed;
00309 long m_cacheId;
00310 QString scheduledScript;
00311 DOM::Node scheduledScriptNode;
00312
00313 KWallet::Wallet* m_wallet;
00314 int m_runningScripts;
00315 bool m_bOpenMiddleClick :1;
00316 bool m_bBackRightClick :1;
00317 bool m_bJScriptEnabled :1;
00318 bool m_bJScriptDebugEnabled :1;
00319 bool m_bJavaEnabled :1;
00320 bool m_bPluginsEnabled :1;
00321 bool m_bJScriptForce :1;
00322 bool m_bJScriptOverride :1;
00323 bool m_bJavaForce :1;
00324 bool m_bJavaOverride :1;
00325 bool m_bPluginsForce :1;
00326 bool m_metaRefreshEnabled :1;
00327 bool m_bPluginsOverride :1;
00328 bool m_restored :1;
00329 bool m_statusMessagesEnabled :1;
00330 bool m_bWalletOpened :1;
00331 int m_frameNameId;
00332 int m_dcop_counter;
00333 DCOPObject *m_dcopobject;
00334
00335 #ifndef Q_WS_QWS
00336 KJavaAppletContext *m_javaContext;
00337 #endif
00338
00339 KHTMLSettings *m_settings;
00340
00341 KIO::TransferJob * m_job;
00342
00343 QString m_statusBarText[3];
00344 unsigned long m_jobspeed;
00345 QString m_lastModified;
00346 QString m_httpHeaders;
00347 QString m_pageServices;
00348
00349
00350
00351 bool m_ssl_in_use;
00352 QString m_ssl_peer_certificate,
00353 m_ssl_peer_chain,
00354 m_ssl_peer_ip,
00355 m_ssl_cipher,
00356 m_ssl_cipher_desc,
00357 m_ssl_cipher_version,
00358 m_ssl_cipher_used_bits,
00359 m_ssl_cipher_bits,
00360 m_ssl_cert_state,
00361 m_ssl_parent_ip,
00362 m_ssl_parent_cert;
00363
00364 bool m_bComplete:1;
00365 bool m_bLoadEventEmitted:1;
00366 bool m_haveEncoding:1;
00367 bool m_onlyLocalReferences :1;
00368 bool m_redirectLockHistory:1;
00369
00370 KURL m_workingURL;
00371
00372 KIO::CacheControl m_cachePolicy;
00373 QTimer m_redirectionTimer;
00374 QTime m_parsetime;
00375 int m_delayRedirect;
00376 QString m_redirectURL;
00377
00378 KAction *m_paViewDocument;
00379 KAction *m_paViewFrame;
00380 KAction *m_paViewInfo;
00381 KAction *m_paSaveBackground;
00382 KAction *m_paSaveDocument;
00383 KAction *m_paSaveFrame;
00384 KAction *m_paSecurity;
00385 KActionMenu *m_paSetEncoding;
00386 KSelectAction *m_paUseStylesheet;
00387 KHTMLZoomFactorAction *m_paIncZoomFactor;
00388 KHTMLZoomFactorAction *m_paDecZoomFactor;
00389 KAction *m_paLoadImages;
00390 KAction *m_paFind;
00391 KAction *m_paFindNext;
00392 KAction *m_paPrintFrame;
00393 KAction *m_paSelectAll;
00394 KAction *m_paDebugScript;
00395 KAction *m_paDebugDOMTree;
00396 KAction *m_paDebugRenderTree;
00397 KAction *m_paStopAnimations;
00398 KToggleAction *m_paToggleCaretMode;
00399
00400 KParts::PartManager *m_manager;
00401
00402 QString m_popupMenuXML;
00403 KHTMLPart::GUIProfile m_guiProfile;
00404
00405 int m_zoomFactor;
00406
00407 QString m_strSelectedURL;
00408 QString m_strSelectedURLTarget;
00409 QString m_referrer;
00410 QString m_pageReferrer;
00411
00412 struct SubmitForm
00413 {
00414 const char *submitAction;
00415 QString submitUrl;
00416 QByteArray submitFormData;
00417 QString target;
00418 QString submitContentType;
00419 QString submitBoundary;
00420 };
00421
00422 SubmitForm *m_submitForm;
00423
00424 bool m_bMousePressed;
00425 bool m_bRightMousePressed;
00426 DOM::Node m_mousePressNode;
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436 DOM::Node m_selectionStart;
00437 long m_startOffset;
00438 DOM::Node m_selectionEnd;
00439 long m_endOffset;
00440 DOM::Node m_initialNode;
00441 long m_initialOffset;
00442 QString m_overURL;
00443 QString m_overURLTarget;
00444
00445 bool m_startBeforeEnd:1;
00446 bool m_extendAtEnd:1;
00447 enum { ExtendByChar, ExtendByWord, ExtendByLine } m_extendMode:2;
00448 bool m_bDnd:1;
00449 bool m_bFirstData:1;
00450 bool m_bClearing:1;
00451 bool m_bCleared:1;
00452 bool m_bSecurityInQuestion:1;
00453 bool m_focusNodeRestored:1;
00454
00455 int m_focusNodeNumber;
00456
00457 QPoint m_dragStartPos;
00458 #ifdef KHTML_NO_SELECTION
00459 QPoint m_dragLastPos;
00460 #endif
00461
00462 bool m_designMode;
00463 bool m_caretMode;
00464
00465 QCursor m_linkCursor;
00466 QTimer m_scrollTimer;
00467
00468 unsigned long m_loadedObjects;
00469 unsigned long m_totalObjectCount;
00470 unsigned int m_jobPercent;
00471
00472 KHTMLPart::FormNotification m_formNotification;
00473 QTimer m_progressUpdateTimer;
00474
00475 QStringList m_pluginPageQuestionAsked;
00476
00478 struct StringPortion
00479 {
00480
00481 StringPortion( int i, DOM::NodeImpl* n ) : index(i), node(n) { if (node) node->ref(); }
00482 StringPortion() : index(0), node(0) {}
00483 StringPortion( const StringPortion& other ) : node(0) { operator=(other); }
00484 StringPortion& operator=( const StringPortion& other ) {
00485 index=other.index;
00486 if (other.node) other.node->ref();
00487 if (node) node->deref();
00488 node=other.node;
00489 return *this;
00490 }
00491 ~StringPortion() { if (node) node->deref(); }
00492
00493 int index;
00494 DOM::NodeImpl *node;
00495 };
00496 QValueList<StringPortion> m_stringPortions;
00497
00498 KFind *m_find;
00499 KFindDialog *m_findDialog;
00500
00501 struct findState
00502 {
00503 findState()
00504 { options = 0; }
00505 QStringList history;
00506 QString text;
00507 int options;
00508 };
00509
00510 findState m_lastFindState;
00511
00512 KJSErrorDlg *m_jsedlg;
00513
00514 DOM::NodeImpl *m_findNode;
00515 DOM::NodeImpl *m_findNodeEnd;
00516 int m_findPos;
00517 int m_findPosEnd;
00519
00520
00521 KParts::Part * m_activeFrame;
00522 QGuardedPtr<KHTMLPart> m_opener;
00523 bool m_openedByJS;
00524 bool m_newJSInterpreterExists;
00525
00526 khtml::Decoder::AutoDetectLanguage m_autoDetectLanguage;
00527 KPopupMenu *m_automaticDetection;
00528 KSelectAction *m_manualDetection;
00529
00530 void setFlagRecursively(bool KHTMLPartPrivate::*flag, bool value);
00532 DOM::Node &caretNode() {
00533 return m_extendAtEnd ? m_selectionEnd : m_selectionStart;
00534 }
00536 long &caretOffset() {
00537 return m_extendAtEnd ? m_endOffset : m_startOffset;
00538 }
00539
00540 time_t m_userStyleSheetLastModified;
00541
00542 KHTMLWalletQueue *m_wq;
00543 };
00544
00545 #endif
This file is part of the documentation for khtml Library Version 3.3.2.