akregator/src

akregator_view.h
1 /*
2  This file is part of Akregator.
3 
4  Copyright (C) 2004 Stanislav Karchebny <Stanislav.Karchebny@kdemail.net>
5  2004 Sashmit Bhaduri <smt@vfemail.net>
6  2005 Frank Osterfeld <frank.osterfeld at kdemail.net>
7 
8  This program is free software; you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 2 of the License, or
11  (at your option) any later version.
12 
13  This program is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program; if not, write to the Free Software
20  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 
22  As a special exception, permission is given to link this program
23  with any edition of TQt, and distribute the resulting executable,
24  without including the source code for TQt in the source distribution.
25 */
26 
27 #ifndef _AKREGATORVIEW_H_
28 #define _AKREGATORVIEW_H_
29 
30 #include <tqpixmap.h>
31 #include <tqwidget.h>
32 
33 #include <kurl.h>
34 
35 #include "akregator_run.h"
36 #include "feed.h"
37 
38 class TQSplitter;
39 class TQDomDocument;
40 class TQDomElement;
41 class TQHBox;
42 class TQToolButton;
43 class TQListViewItem;
44 class KComboBox;
45 class TDEConfig;
46 class KFileItem;
47 class KLineEdit;
48 class TDEListView;
49 class TDEListViewItem;
50 class KTabWidget;
51 class Viewer;
52 
53 namespace TDEIO {
54 
55  class Job;
56 }
57 
58 namespace Akregator {
59 
60  class AboutPageViewer;
61  class ActionManagerImpl;
62  class ArticleMatcher;
63  class ArticleListView;
64  class ArticleViewer;
65  class BrowserRun;
66  class Folder;
67  class FeedList;
68  class Frame;
69  class NodeListView;
70  class ListTabWidget;
71  class Part;
72  class SearchBar;
73  class TabWidget;
74  class Tag;
75  class TagNodeList;
76 
80  class View : public TQWidget
81  {
82  TQ_OBJECT
83 
84  public:
85 
92  View(Akregator::Part *part, TQWidget *parent, ActionManagerImpl* actionManager, const char* name);
93 
96  ~View();
97 
99  void saveSettings();
100 
101  void slotSettingsChanged();
102 
105  bool importFeeds(const TQDomDocument& doc);
106 
111  bool loadFeeds(const TQDomDocument& doc, Folder* parent = 0);
112 
116  TQDomDocument feedListToOPML();
117 
124  void addFeedToGroup(const TQString& url, const TQString& group);
125 
127  virtual void readProperties(TDEConfig* config);
128  virtual void saveProperties(TDEConfig* config);
129 
130  Frame* currentFrame() const { return m_currentFrame; }
131 
132  signals:
135 
136  void setWindowCaption(const TQString&);
137  void setStatusBarText(const TQString&);
138  void setProgress(int);
139  void signalStarted(TDEIO::Job*);
140  void signalCompleted();
141  void signalCanceled(const TQString&);
142 
143  public slots:
144 
145  void slotOnShutdown();
146 
148  void slotNodeSelected(TreeNode* node);
149 
151  void slotArticleSelected(const Article&);
152 
154  void slotFeedTreeContextMenu(TDEListView*, TreeNode*, const TQPoint&);
155 
157  void slotSetTotalUnread();
158 
160  void slotMouseButtonPressed(int button, const Article& article, const TQPoint & pos, int c);
161 
163  void slotOpenArticleExternal(const Article& article, const TQPoint&, int);
164 
168 
172 
174  void slotOpenCurrentArticle();
175 
178  void slotCopyLinkAddress();
179 
183  void slotOpenNewTab(const KURL& url, bool background = false);
184 
187  void slotFrameChanged(Frame *f);
188 
190  void slotCaptionChanged(const TQString &);
191 
193  void slotFeedURLDropped (KURL::List &urls, TreeNode* after, Folder *parent);
194 
196  void slotMouseOverInfo(const KFileItem *kifi);
197 
199  void slotStatusText(const TQString &);
200 
201  void slotStarted();
202  void slotCanceled(const TQString &);
203  void slotCompleted();
204  void slotLoadingProgress(int);
205 
206  void slotFetchingStarted();
207  void slotFetchingStopped();
208 
209 
211  void slotFeedFetched(Feed *);
212 
214  void slotFeedAdd();
216  void slotFeedAddGroup();
218  void slotFeedRemove();
220  void slotFeedModify();
222  void slotFetchCurrentFeed();
224  void slotFetchAllFeeds();
226  void slotMarkAllRead();
228  void slotMarkAllFeedsRead();
230  void slotOpenHomepage();
231 
233  void slotArticleToggleKeepFlag(bool enabled);
235  void slotArticleDelete();
244 
247 
248  void slotAssignTag(const Tag& tag, bool assign);
249  //void slotRemoveTag(const Tag& tag);
250  void slotNewTag();
251  void slotTagCreated(const Tag& tag);
252  void slotTagRemoved(const Tag& tag);
253 
255  void slotNormalView();
257  void slotWidescreenView();
259  void slotCombinedView();
262 
264  void slotPrevUnreadArticle();
266  void slotNextUnreadArticle();
267 
268  void slotMoveCurrentNodeUp();
269  void slotMoveCurrentNodeDown();
270  void slotMoveCurrentNodeLeft();
271  void slotMoveCurrentNodeRight();
272 
273  protected:
274 
275  void addFeed(const TQString& url, TreeNode* after, Folder* parent, bool autoExec = true);
276 
277  void connectToFeedList(FeedList* feedList);
278  void disconnectFromFeedList(FeedList* feedList);
279 
280  void updateTagActions();
281 
282  protected slots:
283 
284  void connectFrame(Frame *);
285 
286  void setTabIcon(const TQPixmap&);
287 
288  void slotDoIntervalFetches();
289  void slotDeleteExpiredArticles();
290 
292  void slotOpenURLReply(const KURL& url, Akregator::Viewer* currentViewer, Akregator::BrowserRun::OpeningMode mode);
293 
295  void slotUrlClickedInViewer(const KURL& url, Viewer* viewer, bool newTab, bool background);
296 
297  void slotOpenURL(const KURL& url, Akregator::Viewer* currentViewer, Akregator::BrowserRun::OpeningMode mode);
298 
299  public: // compat with KDE-3.x assertions, remove for KDE 4
300 // private:
301 
302  enum ViewMode { NormalView=0, WidescreenView, CombinedView };
303 
304  FeedList* m_feedList;
305  TagNodeList* m_tagNodeList;
306  NodeListView* m_feedListView;
307  NodeListView* m_tagNodeListView;
308  ArticleListView *m_articleList;
309  ArticleViewer *m_articleViewer;
310  TabWidget *m_tabs;
311 
312  TQWidget *m_mainTab;
313  Frame *m_mainFrame;
314  Frame *m_currentFrame;
315 
316  SearchBar* m_searchBar;
317 
318  TQSplitter *m_articleSplitter;
319  TQSplitter *m_horizontalSplitter;
320 
321  ListTabWidget* m_listTabWidget;
322  Akregator::Part *m_part;
323  ViewMode m_viewMode;
324 
325  TQTimer *m_fetchTimer;
326  TQTimer* m_expiryTimer;
327  TQTimer *m_markReadTimer;
328 
329  bool m_shuttingDown;
330  bool m_displayingAboutPage;
331 
332  ActionManagerImpl* m_actionManager;
333 
334  TQPixmap m_keepFlagIcon;
335  friend class EditNodePropertiesVisitor;
336  class EditNodePropertiesVisitor;
337  EditNodePropertiesVisitor* m_editNodePropertiesVisitor;
338  friend class DeleteNodeVisitor;
339  class DeleteNodeVisitor;
340  DeleteNodeVisitor* m_deleteNodeVisitor;
341  };
342 }
343 
344 #endif // _AKREGATORVIEW_H_
Akregator-specific implementation of the ActionManager interface.
This HTML viewer is used to display articles.
Definition: articleviewer.h:49
A proxy class for RSS::Article with some additional methods to assist sorting.
Definition: article.h:58
The model of a feed tree, represents an OPML document.
Definition: feedlist.h:45
represents a feed
Definition: feed.h:63
Represents a folder (containing feeds and/or other folders)
Definition: folder.h:45
A widget containing multiple list views, e.g.
Definition: listtabwidget.h:46
This is a RSS Aggregator "Part".
Abstract base class for all kind of elements in the feed tree, like feeds and feed groups (and search...
Definition: treenode.h:52
This is the main widget of the view, containing tree view, article list, viewer etc.
void slotMouseButtonPressed(int button, const Article &article, const TQPoint &pos, int c)
special behaviour in article list view (TODO: move code there?)
void slotFeedURLDropped(KURL::List &urls, TreeNode *after, Folder *parent)
called when URLs are dropped into the tree view
void slotFeedAdd()
adds a new feed to the feed tree
bool importFeeds(const TQDomDocument &doc)
Adds the feeds in doc to the "Imported Folder".
void slotUrlClickedInViewer(const KURL &url, Viewer *viewer, bool newTab, bool background)
HACK: part of the url opening hack for 3.5.
void slotSetSelectedArticleRead()
marks the currently selected article as read
void slotFetchCurrentFeed()
fetches the currently selected feed
void slotOpenCurrentArticle()
opens current article in new tab, background/foreground depends on settings TODO: use selected instea...
TQDomDocument feedListToOPML()
void slotMouseOverInfo(const KFileItem *kifi)
displays a URL in the status bar when the user moves the mouse over a link
void slotOpenCurrentArticleExternal()
opens the current article (currentItem) in external browser TODO: use selected instead of current?
void slotSetCurrentArticleReadDelayed()
marks the currenctly selected article as read after a user-set delay
virtual void readProperties(TDEConfig *config)
session management
void slotPrevUnreadArticle()
selects the previous unread article in the article list
void slotFeedTreeContextMenu(TDEListView *, TreeNode *, const TQPoint &)
Shows requested popup menu for feed tree.
void saveSettings()
saves settings.
void slotOpenArticleExternal(const Article &article, const TQPoint &, int)
opens article of item in external browser
void slotNodeSelected(TreeNode *node)
selected tree node has changed
void slotSetSelectedArticleUnread()
marks the currently selected article as unread
void slotArticleToggleKeepFlag(bool enabled)
toggles the keep flag of the currently selected article
View(Akregator::Part *part, TQWidget *parent, ActionManagerImpl *actionManager, const char *name)
constructor
void slotOpenCurrentArticleBackgroundTab()
opens the current article (currentItem) in background tab TODO: use selected instead of current?
void slotCopyLinkAddress()
copies the link of current article to clipboard
void slotSetSelectedArticleNew()
marks the currently selected article as new
void slotArticleDelete()
deletes the currently selected article
void slotCaptionChanged(const TQString &)
sets the window caption after a frame change
void slotNormalView()
switches view mode to normal view
void signalUnreadCountChanged(int)
emitted when the unread count of "All Feeds" was changed
void slotOpenNewTab(const KURL &url, bool background=false)
opens a page viewer in a new tab and loads an URL
void slotFeedRemove()
removes the currently selected feed (ask for confirmation)
~View()
destructor.
void slotOpenURLReply(const KURL &url, Akregator::Viewer *currentViewer, Akregator::BrowserRun::OpeningMode mode)
HACK: receives signal from browserrun when the browserrun detects an HTML mimetype and actually loads...
void addFeedToGroup(const TQString &url, const TQString &group)
Add a feed to a group.
void slotMarkAllRead()
marks all articles in the currently selected feed as read
void slotFrameChanged(Frame *f)
called when another part/frame is activated.
void slotCombinedView()
switches view mode to combined view
void slotSetTotalUnread()
emits signalUnreadCountChanged(int)
void slotStatusText(const TQString &)
sets the status bar text to a given string
void slotToggleShowQuickFilter()
toggles the visibility of the filter bar
void slotFeedModify()
calls the properties dialog for feeds, starts renaming for feed groups
void slotOpenHomepage()
opens the homepage of the currently selected feed
void slotFetchAllFeeds()
starts fetching of all feeds in the tree
void slotWidescreenView()
switches view mode to widescreen view
void slotTextToSpeechRequest()
reads the currently selected articles using KTTSD
void slotArticleSelected(const Article &)
the article selection has changed
void slotFeedFetched(Feed *)
Feed has been fetched, populate article view if needed and update counters.
bool loadFeeds(const TQDomDocument &doc, Folder *parent=0)
Parse OPML presentation of feeds and read in articles archive, if present.
void slotMarkAllFeedsRead()
marks all articles in all feeds in the tree as read
void slotFeedAddGroup()
adds a feed group to the feed tree
void slotNextUnreadArticle()
selects the next unread article in the article list