~ubuntu-branches/ubuntu/lucid/kchmviewer/lucid

« back to all changes in this revision

Viewing changes to src/kchmviewwindow.h

  • Committer: Bazaar Package Importer
  • Author(s): Jose Luis Tallon
  • Date: 2006-06-08 20:08:39 UTC
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20060608200839-8b7jodug8yvtj126
Tags: upstream-2.5
ImportĀ upstreamĀ versionĀ 2.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
class KCHMViewWindow
32
32
{
33
33
public:
34
 
        KCHMViewWindow ( QWidget * parent );
 
34
        KCHMViewWindow ( QTabWidget * parent );
35
35
    virtual ~KCHMViewWindow();
36
36
 
37
37
        //! Open a page from current chm archive
38
 
        bool    openUrl (const QString& url, bool addHistory = true);
 
38
        bool    openUrl (const QString& url );
39
39
        
40
40
        QString getBaseUrl() const      { return m_base_url; }
41
41
        QString getOpenedPage() const   { return m_openedPage; }
42
 
 
 
42
        QString getNewTabLink() const   { return m_newTabLinkKeeper; }
 
43
        
43
44
        //! true if url is remote (http/ftp/mailto/news etc.)
44
45
        static bool     isRemoteURL (const QString& url, QString& protocol);
45
46
        
53
54
        static QString makeURLabsoluteIfNeeded ( const QString & url );
54
55
        QString         makeURLabsolute ( const QString &url, bool set_as_base = true );
55
56
        
56
 
        void            navigateBack();
57
 
        void            navigateForward();
58
 
 
59
 
        void            setHistoryMaxSize (unsigned int size) { m_historyMaxSize = size; }
60
 
 
61
57
public: 
62
58
        // virtual members, which should be implemented by viewers
63
59
        //! Invalidate current view, doing all the cleanups etc.
79
75
        virtual void    addZoomFactor (int value) = 0;
80
76
 
81
77
        virtual QObject *       getQObject() = 0;
 
78
        virtual QWidget *       getQWidget() = 0;
82
79
 
83
80
        /*!
84
81
         * Return current scrollbar position in view window. Saved on program exit. 
90
87
        //! Sets the scrollbar position.
91
88
        virtual void    setScrollbarPosition(int pos) = 0;
92
89
 
93
 
        //! Should emit this signal (because KCHMViewWindow is not QObject derived)
94
 
        virtual void    emitSignalHistoryAvailabilityChanged (bool enable_backward, bool enable_forward) = 0;
95
 
 
96
90
        //! Select the content of the whole page
97
91
        virtual void    clipSelectAll() = 0;
98
92
 
99
93
        //! Copies the selected content to the clipboard
100
94
        virtual void    clipCopy() = 0;
101
95
 
 
96
        //! Returns the window title
 
97
        virtual QString getTitle() const;
 
98
        
 
99
        //! Navigation stuff
 
100
        virtual void    navigateBack();
 
101
        virtual void    navigateHome();
 
102
        virtual void    navigateForward();
 
103
        
 
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();
 
108
                
102
109
protected: /* signals */
103
110
        /*!
104
111
         * Emitted when the user clicked on the link, before the page changed.
107
114
         */
108
115
        virtual void    signalLinkClicked ( const QString & newlink, bool& follow_link ) = 0;
109
116
 
110
 
        /*!
111
 
         * Emitted when the backward/forward button status changed. Can be connected to enable/disable
112
 
         * appropriate toolbar buttons and/or menu items.
113
 
         */
114
 
        virtual void    signalHistoryAvailabilityChanged (bool enable_backward, bool enable_forward) = 0;
115
 
 
116
117
protected:
117
 
        //! Sets the scrollbar position.
118
118
        virtual bool    openPage ( const QString& url ) = 0;
119
 
 
120
 
        virtual void    checkHistoryAvailability ();
121
 
 
122
 
        QString                                 m_openedPage;
123
 
        QString                                 m_base_url;
124
 
 
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 );
 
120
        
 
121
        KQPopupMenu *   getContextMenu( const QString& link, QWidget * parent );
 
122
        KQPopupMenu *   createStandardContextMenu( QWidget * parent );
 
123
        
 
124
        //! History
 
125
        class KCHMUrlHistory
 
126
        {
 
127
                public:
 
128
                        KCHMUrlHistory() { scrollbarpos = 0; }
 
129
                        KCHMUrlHistory( const QString& _url, int _scrollbarpos )
 
130
                        : url(_url), scrollbarpos(_scrollbarpos) {};
 
131
                
 
132
                        const QString&  getUrl() const { return url; }
 
133
                        int                     getScrollPosition() const { return scrollbarpos; }
 
134
                        void                    setScrollPosition( int pos ) { scrollbarpos = pos; }
 
135
                        
 
136
                private:
 
137
                        QString         url;
 
138
                        int             scrollbarpos;
 
139
        };
 
140
 
 
141
        unsigned int    m_historyMaxSize;
 
142
        unsigned int    m_historyCurrentPos;
 
143
        
 
144
        QValueList<KCHMUrlHistory>              m_history;
 
145
        
 
146
        KQPopupMenu *   m_contextMenu;
 
147
        KQPopupMenu *   m_contextMenuLink;
 
148
        
 
149
        // This member keeps a "open new tab" link between getContextMenu() call and appropriate
 
150
        // slot call
 
151
        QString                 m_newTabLinkKeeper;
 
152
 
 
153
        QString                 m_openedPage;
 
154
        QString                 m_lastOpenedPage;
 
155
        QString                 m_base_url;
 
156
 
 
157
        QTabWidget      *       m_parentTabWidget;
130
158
};
131
159
 
132
160
#endif