31
31
class KCHMViewWindow
34
KCHMViewWindow ( QWidget * parent );
34
KCHMViewWindow ( QTabWidget * parent );
35
35
virtual ~KCHMViewWindow();
37
37
//! Open a page from current chm archive
38
bool openUrl (const QString& url, bool addHistory = true);
38
bool openUrl (const QString& url );
40
40
QString getBaseUrl() const { return m_base_url; }
41
41
QString getOpenedPage() const { return m_openedPage; }
42
QString getNewTabLink() const { return m_newTabLinkKeeper; }
43
44
//! true if url is remote (http/ftp/mailto/news etc.)
44
45
static bool isRemoteURL (const QString& url, QString& protocol);
53
54
static QString makeURLabsoluteIfNeeded ( const QString & url );
54
55
QString makeURLabsolute ( const QString &url, bool set_as_base = true );
57
void navigateForward();
59
void setHistoryMaxSize (unsigned int size) { m_historyMaxSize = size; }
62
58
// virtual members, which should be implemented by viewers
63
59
//! Invalidate current view, doing all the cleanups etc.
90
87
//! Sets the scrollbar position.
91
88
virtual void setScrollbarPosition(int pos) = 0;
93
//! Should emit this signal (because KCHMViewWindow is not QObject derived)
94
virtual void emitSignalHistoryAvailabilityChanged (bool enable_backward, bool enable_forward) = 0;
96
90
//! Select the content of the whole page
97
91
virtual void clipSelectAll() = 0;
99
93
//! Copies the selected content to the clipboard
100
94
virtual void clipCopy() = 0;
96
//! Returns the window title
97
virtual QString getTitle() const;
100
virtual void navigateBack();
101
virtual void navigateHome();
102
virtual void navigateForward();
104
//! Navigation auxiliary stuff
105
virtual void setHistoryMaxSize (unsigned int size) { m_historyMaxSize = size; }
106
virtual void addNavigationHistory( const QString & url, int scrollpos );
107
virtual void updateNavigationToolbar();
102
109
protected: /* signals */
104
111
* Emitted when the user clicked on the link, before the page changed.
108
115
virtual void signalLinkClicked ( const QString & newlink, bool& follow_link ) = 0;
111
* Emitted when the backward/forward button status changed. Can be connected to enable/disable
112
* appropriate toolbar buttons and/or menu items.
114
virtual void signalHistoryAvailabilityChanged (bool enable_backward, bool enable_forward) = 0;
117
//! Sets the scrollbar position.
118
118
virtual bool openPage ( const QString& url ) = 0;
120
virtual void checkHistoryAvailability ();
122
QString m_openedPage;
125
unsigned int m_historyMaxSize;
126
unsigned int m_historyCurrentSize;
127
unsigned int m_historyTopOffset;
128
QValueList<QString> m_history;
129
QValueList<QString>::iterator m_historyIterator;
119
virtual void handleStartPageAsImage( QString& link );
121
KQPopupMenu * getContextMenu( const QString& link, QWidget * parent );
122
KQPopupMenu * createStandardContextMenu( QWidget * parent );
128
KCHMUrlHistory() { scrollbarpos = 0; }
129
KCHMUrlHistory( const QString& _url, int _scrollbarpos )
130
: url(_url), scrollbarpos(_scrollbarpos) {};
132
const QString& getUrl() const { return url; }
133
int getScrollPosition() const { return scrollbarpos; }
134
void setScrollPosition( int pos ) { scrollbarpos = pos; }
141
unsigned int m_historyMaxSize;
142
unsigned int m_historyCurrentPos;
144
QValueList<KCHMUrlHistory> m_history;
146
KQPopupMenu * m_contextMenu;
147
KQPopupMenu * m_contextMenuLink;
149
// This member keeps a "open new tab" link between getContextMenu() call and appropriate
151
QString m_newTabLinkKeeper;
153
QString m_openedPage;
154
QString m_lastOpenedPage;
157
QTabWidget * m_parentTabWidget;