akregator/src

viewer.h
1 /*
2  This file is part of Akregator.
3 
4  Copyright (C) 2004 Teemu Rytilahti <tpr@d5k.net>
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program; if not, write to the Free Software
18  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 
20  As a special exception, permission is given to link this program
21  with any edition of TQt, and distribute the resulting executable,
22  without including the source code for TQt in the source distribution.
23 */
24 
25 #ifndef VIEWER_H
26 #define VIEWER_H
27 
28 #include <tdehtml_part.h>
29 
30 class KURL;
31 
32 namespace TDEIO
33 {
34  class MetaData;
35 }
36 
37 namespace Akregator
38 {
39  class Viewer : public TDEHTMLPart
40  {
41  TQ_OBJECT
42 
43  public:
44 
48  static void displayInExternalBrowser(const KURL &url, const TQString& mimetype=TQString());
49 
50  Viewer(TQWidget* parent, const char* name);
51  virtual ~Viewer();
52 
53  virtual bool closeURL();
54 
55 
56  public slots:
57 
58  void slotScrollUp();
59  void slotScrollDown();
60  void slotZoomIn();
61  void slotZoomOut();
62  void slotSetZoomFactor(int percent);
63  void slotPrint();
64  void setSafeMode();
65 
66  virtual void slotPaletteOrFontChanged() = 0;
67 
68  signals:
70  void urlClicked(const KURL& url, Viewer* viewer, bool newTab, bool background);
71 
72  protected: // methods
73  int pointsToPixel(int points) const;
74 
75  protected slots:
76 
77  // FIXME: Sort out how things are supposed to work and clean up the following slots
78 
80  virtual void urlSelected(const TQString &url, int button, int state, const TQString &_target, KParts::URLArgs args);
81 
83  virtual void slotOpenURLRequest(const KURL& url, const KParts::URLArgs& args);
84 
85  virtual void slotPopupMenu(KXMLGUIClient*, const TQPoint&, const KURL&, const KParts::URLArgs&, KParts::BrowserExtension::PopupFlags, mode_t);
86 
88  void slotCopyLinkAddress();
89 
91  virtual void slotCopy();
92 
94  virtual void slotOpenLinkInternal();
95 
97  virtual void slotOpenLinkInBrowser();
98 
100  virtual void slotOpenLinkInForegroundTab();
101 
103  virtual void slotOpenLinkInBackgroundTab();
104 
105  virtual void slotOpenLinkInThisTab();
106 
107  virtual void slotSaveLinkAs();
108 
110  void slotStarted(TDEIO::Job *);
111 
113  void slotCompleted();
114 
115  virtual void slotSelectionChanged();
116 
117  protected: // attributes
118  KURL m_url;
119 
120  };
121 }
122 
123 #endif // VIEWER_H