summaryrefslogtreecommitdiffstats
path: root/akregator/src/viewer.h
blob: 112e71b0d250f806ed73087896521cf0553b9ba5 (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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/*
    This file is part of Akregator.

    Copyright (C) 2004 Teemu Rytilahti <tpr@d5k.net>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

    As a special exception, permission is given to link this program
    with any edition of TQt, and distribute the resulting executable,
    without including the source code for TQt in the source distribution.
*/

#ifndef VIEWER_H
#define VIEWER_H

#include <tdehtml_part.h>

class KURL;

namespace TDEIO
{
    class MetaData;
}

namespace Akregator
{
    class Viewer : public TDEHTMLPart
    {
        Q_OBJECT
  
        public:

           /**
            * Display article in external browser.
            */
            static void displayInExternalBrowser(const KURL &url, const TQString& mimetype=TQString());    

            Viewer(TQWidget* parent, const char* name);
            virtual ~Viewer();

            virtual bool closeURL();
        
            
        public slots:
            
            void slotScrollUp(); 
            void slotScrollDown();
            void slotZoomIn();
            void slotZoomOut();
            void slotSetZoomFactor(int percent);
            void slotPrint();
            void setSafeMode();

            virtual void slotPaletteOrFontChanged() = 0;
        
        signals:
            /** This gets emitted when url gets clicked */
            void urlClicked(const KURL& url, Viewer* viewer, bool newTab, bool background);

            protected: // methods
            int pointsToPixel(int points) const;

        protected slots:
        
            // FIXME: Sort out how things are supposed to work and clean up the following slots

            /** reimplemented to handle url selection according to the settings for LMB and MMB */
            virtual void urlSelected(const TQString &url, int button, int state, const TQString &_target, KParts::URLArgs args);

            /** slot for handling openURLRequestDelayed() signal from the browserextension. Handles POST requests (for forms) only, other link handling goes to urlSelected(). Does nothing in Viewer, reimplemented in PageViewer to make forms working */
            virtual void slotOpenURLRequest(const KURL& url, const KParts::URLArgs& args);

            virtual void slotPopupMenu(KXMLGUIClient*, const TQPoint&, const KURL&, const KParts::URLArgs&, KParts::BrowserExtension::PopupFlags, mode_t);

            /** Copies current link to clipboard. */
            void slotCopyLinkAddress();

            /** Copies currently selected text to clipboard */
            virtual void slotCopy();

            /** Opens @c m_url inside this viewer */
            virtual void slotOpenLinkInternal();

            /** Opens @c m_url in external viewer, eg. Konqueror */
            virtual void slotOpenLinkInBrowser();

            /** Opens @c m_url in foreground tab */
            virtual void slotOpenLinkInForegroundTab();

            /** Opens @c m_url in background tab */
            virtual void slotOpenLinkInBackgroundTab();
            
            virtual void slotOpenLinkInThisTab();

            virtual void slotSaveLinkAs();

            /** This changes cursor to wait cursor */
            void slotStarted(TDEIO::Job *);

            /** This reverts cursor back to normal one */
            void slotCompleted();

            virtual void slotSelectionChanged();

        protected: // attributes
            KURL m_url;
            
    };
}

#endif // VIEWER_H