kdevhtmlpart.h
Go to the documentation of this file.00001 #ifndef __KDEVHTMLPART_H__ 00002 #define __KDEVHTMLPART_H__ 00003 00004 #include <stdlib.h> 00005 00006 #include <qdatetime.h> 00007 00008 #include <khtml_part.h> 00009 00010 class KAction; 00011 class KToolBarPopupAction; 00012 class KParts::ReadOnlyPart; 00013 00014 struct DocumentationHistoryEntry { 00015 KURL url; 00016 int id; 00017 00018 DocumentationHistoryEntry() {} 00019 DocumentationHistoryEntry( const KURL& u ): url( u ) 00020 { 00021 id = abs( QTime::currentTime().msecsTo( QTime() ) ); // nasty, but should provide a reasonably unique number 00022 } 00023 }; 00024 00025 class KDevHTMLPart : public KHTMLPart 00026 { 00027 Q_OBJECT 00028 00029 public: 00030 00031 enum Options { CanDuplicate=1, CanOpenInNewWindow=2 }; 00032 00033 KDevHTMLPart(); 00034 00035 void setContext(const QString &context); 00036 QString context() const; 00037 virtual bool openURL(const KURL &url); 00038 static QString resolveEnvVarsInURL(const QString& url); 00039 00040 void setOptions(int options) { m_options = options; } 00041 00042 signals: 00043 void fileNameChanged(KParts::ReadOnlyPart *part); 00044 00045 protected slots: 00046 00047 void slotStarted(KIO::Job *); 00048 void slotCompleted(); 00049 void slotCancelled(const QString &errMsg); 00050 00051 void openURLRequest(const KURL &url); 00052 void popup( const QString & url, const QPoint & p ); 00053 00054 void slotReload(); 00055 void slotStop(); 00056 virtual void slotDuplicate() = 0; 00057 virtual void slotOpenInNewWindow(const KURL &url) = 0; 00058 void slotPrint(); 00059 void slotCopy(); 00060 void slotSelectionChanged(); 00061 00062 void slotBack(); 00063 void slotForward(); 00064 void slotBackAboutToShow(); 00065 void slotForwardAboutToShow(); 00066 00067 void slotPopupActivated( int id ); 00068 void addHistoryEntry(); 00069 00070 00071 private: 00072 00073 QValueList< DocumentationHistoryEntry > m_history; 00074 QValueList< DocumentationHistoryEntry >::Iterator m_Current; 00075 00076 KToolBarPopupAction* m_backAction; 00077 KToolBarPopupAction* m_forwardAction; 00078 00079 bool m_restoring; 00080 00081 QString m_context; 00082 KAction *stopAction; 00083 KAction *reloadAction; 00084 KAction *duplicateAction; 00085 KAction *printAction; 00086 KAction *copyAction; 00087 00088 int m_options; 00089 }; 00090 00091 #endif