summaryrefslogtreecommitdiffstats
path: root/khelpcenter/view.h
blob: 7742edae958c4fd97f2e760dbfd2638004462793 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#ifndef __view_h__
#define __view_h__

#include <tdehtml_part.h>

#include "glossary.h"
#include "navigator.h"

class TDEActionCollection;

namespace DOM {
  class Node;
}

namespace KHC {

class Formatter;

class View : public TDEHTMLPart
{
    Q_OBJECT
  public:
    View( TQWidget *parentWidget, const char *widgetName,
          TQObject *parent, const char *name, TDEHTMLPart::GUIProfile prof,
          TDEActionCollection *col );

    ~View();

    virtual bool openURL( const KURL &url );

    virtual void saveState( TQDataStream &stream );
    virtual void restoreState( TQDataStream &stream );

    enum State { Docu, About, Search };

    int state() const { return mState; }
    TQString title() const { return mTitle; }

    static TQString langLookup( const TQString &fname );

    void beginSearchResult();
    void writeSearchResult( const TQString & );
    void endSearchResult();

    void beginInternal( const KURL & );
    KURL internalUrl() const;

    int zoomStepping() const { return m_zoomStepping; }

    Formatter *formatter() const { return mFormatter; }

    void copySelectedText();

  public 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);

  signals:
    void searchResultCacheAvailable();

  protected:
    bool eventFilter( TQObject *o, TQEvent *e );

  private slots:
    void setTitle( const TQString &title );
    void showMenu( const TQString& url, const TQPoint& pos);

  private:
    void showAboutPage();
    KURL urlFromLinkNode( const DOM::Node &n ) const;
 
    int mState;
    TQString mTitle;

    TQString mSearchResult;
    KURL mInternalUrl;

    int m_zoomStepping;

    Formatter *mFormatter;
    TDEActionCollection *mActionCollection;
    TQString mCopyURL;
};

}

#endif