mirror of
https://bitbucket.org/smil3y/kde-playground.git
synced 2025-02-23 10:22:50 +00:00
95 lines
1.8 KiB
C++
95 lines
1.8 KiB
C++
|
|
#ifndef KHC_VIEW_H
|
|
#define KHC_VIEW_H
|
|
|
|
#include <KWebView>
|
|
|
|
#include "glossary.h"
|
|
#include "navigator.h"
|
|
|
|
#include <QEvent>
|
|
|
|
class KActionCollection;
|
|
|
|
namespace DOM {
|
|
class Node;
|
|
class HTMLLinkElement;
|
|
}
|
|
|
|
namespace KHC {
|
|
|
|
class Formatter;
|
|
|
|
class View : public KWebView
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
View( QWidget *parentWidget, QObject *parent, KActionCollection *col );
|
|
|
|
~View();
|
|
|
|
virtual bool openUrl( const KUrl &url );
|
|
|
|
virtual void saveState( QDataStream &stream );
|
|
virtual void restoreState( QDataStream &stream );
|
|
|
|
enum State { Docu, About, Search };
|
|
|
|
int state() const { return mState; }
|
|
QString title() const { return mTitle; }
|
|
|
|
static QString langLookup( const QString &fname );
|
|
|
|
void beginSearchResult();
|
|
void writeSearchResult( const QString & );
|
|
void endSearchResult();
|
|
|
|
void beginInternal( const KUrl & );
|
|
KUrl internalUrl() const;
|
|
|
|
int fontScaleStepping() const { return m_fontScaleStepping; }
|
|
|
|
Formatter *formatter() const { return mFormatter; }
|
|
|
|
void copySelectedText();
|
|
|
|
public Q_SLOTS:
|
|
void lastSearch();
|
|
void slotIncFontSizes();
|
|
void slotDecFontSizes();
|
|
void slotReload( const KUrl &url = KUrl() );
|
|
void slotCopyLink();
|
|
bool nextPage(bool checkOnly = false);
|
|
bool prevPage(bool checkOnly = false);
|
|
|
|
Q_SIGNALS:
|
|
void searchResultCacheAvailable();
|
|
|
|
protected:
|
|
bool eventFilter( QObject *o, QEvent *e );
|
|
|
|
private Q_SLOTS:
|
|
void setTitle( const QString &title );
|
|
void showMenu( const QString& url, const QPoint& pos);
|
|
|
|
private:
|
|
KUrl urlFromLinkNode( const DOM::HTMLLinkElement &link ) const;
|
|
|
|
int mState;
|
|
QString mTitle;
|
|
|
|
QString mSearchResult;
|
|
KUrl mInternalUrl;
|
|
|
|
int m_fontScaleStepping;
|
|
|
|
Formatter *mFormatter;
|
|
KActionCollection *mActionCollection;
|
|
QString mCopyURL;
|
|
};
|
|
|
|
}
|
|
|
|
#endif //KHC_VIEW_H
|
|
|
|
// vim:ts=2:sw=2:et
|