From 114a878c64ce6f8223cfd22d76a20eb16d177e5e Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- lib/widgets/kdevhtmlpart.h | 111 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 lib/widgets/kdevhtmlpart.h (limited to 'lib/widgets/kdevhtmlpart.h') diff --git a/lib/widgets/kdevhtmlpart.h b/lib/widgets/kdevhtmlpart.h new file mode 100644 index 00000000..944f1e9b --- /dev/null +++ b/lib/widgets/kdevhtmlpart.h @@ -0,0 +1,111 @@ +#ifndef __KDEVHTMLPART_H__ +#define __KDEVHTMLPART_H__ + +#include + +#include + +#include + +/** +@file kdevhtmlpart.h +Customized KHTML part for KDevelop. +*/ + +class KAction; +class KToolBarPopupAction; +class KParts::ReadOnlyPart; + +struct DocumentationHistoryEntry { + KURL url; + int id; + + DocumentationHistoryEntry() {} + DocumentationHistoryEntry( const KURL& u ): url( u ) + { + id = abs( QTime::currentTime().msecsTo( QTime() ) ); // nasty, but should provide a reasonably unique number + } +}; + +/** +Customized KHTML part for KDevelop. +Used as HTML documentation and file viewer. + +Represents customized BrowserViewGUI mode of KHTMLPart. Provides also actions for: +- reload; +- stop; +- duplicate; +- print; +- copy text; +- back; +- forward. +. +It has it's own popup menu and font/zoom settings. +*/ +class KDevHTMLPart : public KHTMLPart +{ + Q_OBJECT + +public: + + enum Options { CanDuplicate=1, CanOpenInNewWindow=2 }; + + KDevHTMLPart(); + + void setContext(const QString &context); + QString context() const; + virtual bool openURL(const KURL &url); + static QString resolveEnvVarsInURL(const QString& url); + + void setOptions(int options) { m_options = options; } + +signals: + void fileNameChanged(KParts::ReadOnlyPart *part); + +protected slots: + + void slotStarted(KIO::Job *); + void slotCompleted(); + void slotCancelled(const QString &errMsg); + + void openURLRequest(const KURL &url); + void popup( const QString & url, const QPoint & p ); + + void slotReload(); + void slotStop(); + virtual void slotDuplicate() = 0; + virtual void slotOpenInNewWindow(const KURL &url) = 0; + void slotPrint(); + void slotCopy(); + void slotSelectionChanged(); + + void slotBack(); + void slotForward(); + void slotBackAboutToShow(); + void slotForwardAboutToShow(); + + void slotPopupActivated( int id ); + void addHistoryEntry(); + + +private: + + QValueList< DocumentationHistoryEntry > m_history; + QValueList< DocumentationHistoryEntry >::Iterator m_Current; + + KToolBarPopupAction* m_backAction; + KToolBarPopupAction* m_forwardAction; + + bool m_restoring; + + QString m_context; + KAction *stopAction; + KAction *reloadAction; + KAction *duplicateAction; + KAction *printAction; + KAction *copyAction; + + int m_options; +}; + +#endif -- cgit v1.2.1