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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
|
/*
This file is part of Akregator.
Copyright (C) 2004 Stanislav Karchebny <Stanislav.Karchebny@kdemail.net>
2004 Sashmit Bhaduri <smt@vfemail.net>
2005 Frank Osterfeld <frank.osterfeld at kdemail.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 _AKREGATORVIEW_H_
#define _AKREGATORVIEW_H_
#include <tqpixmap.h>
#include <tqwidget.h>
#include <kurl.h>
#include "akregator_run.h"
#include "feed.h"
class TQSplitter;
class TQDomDocument;
class TQDomElement;
class TQHBox;
class TQToolButton;
class TQListViewItem;
class KComboBox;
class KConfig;
class KFileItem;
class KLineEdit;
class KListView;
class KListViewItem;
class KTabWidget;
class Viewer;
namespace KIO {
class Job;
}
namespace Akregator {
class AboutPageViewer;
class ActionManagerImpl;
class ArticleMatcher;
class ArticleListView;
class ArticleViewer;
class BrowserRun;
class Folder;
class FeedList;
class Frame;
class NodeListView;
class ListTabWidget;
class Part;
class SearchBar;
class TabWidget;
class Tag;
class TagNodeList;
/**
* This is the main widget of the view, containing tree view, article list, viewer etc.
*/
class View : public TQWidget
{
Q_OBJECT
TQ_OBJECT
public:
/** constructor
@param part the Akregator::Part which contains this widget
@param tqparent tqparent widget
@param Actionmanager for this view
@param name the name of the widget (@ref TQWidget )
*/
View(Akregator::Part *part, TQWidget *tqparent, ActionManagerImpl* actionManager, const char* name);
/** destructor. Note that cleanups should be done in
slotOnShutdown(), so we don't risk accessing self-deleting objects after deletion. */
~View();
/** saves settings. Make sure that the Settings singleton is not destroyed yet when saveSettings is called */
void saveSettings();
void slotSettingsChanged();
/** Adds the feeds in @c doc to the "Imported Folder"
@param doc the DOM tree (OPML) of the feeds to import */
bool importFeeds(const TQDomDocument& doc);
/** Parse OPML presentation of feeds and read in articles archive, if present. If @c tqparent is @c NULL, the current
feed list is replaced by the parsed one
@param doc TQDomDocument generated from OPML
@param tqparent The tqparent group the new nodes */
bool loadFeeds(const TQDomDocument& doc, Folder* tqparent = 0);
/**
@return the displayed Feed List in OPML format
*/
TQDomDocument feedListToOPML();
/**
Add a feed to a group.
@param url The URL of the feed to add.
@param group The name of the folder into which the feed is added.
If the group does not exist, it is created. The feed is added as the last member of the group.
*/
void addFeedToGroup(const TQString& url, const TQString& group);
/** session management **/
virtual void readProperties(KConfig* config);
virtual void saveProperties(KConfig* config);
Frame* currentFrame() const { return m_currentFrame; }
signals:
/** emitted when the unread count of "All Feeds" was changed */
void signalUnreadCountChanged(int);
void setWindowCaption(const TQString&);
void seStatusBarText(const TQString&);
void setProgress(int);
void signalStarted(KIO::Job*);
void signalCompleted();
void signalCanceled(const TQString&);
public slots:
void slotOnShutdown();
/** selected tree node has changed */
void slotNodeSelected(TreeNode* node);
/** the article selection has changed */
void slotArticleSelected(const Article&);
/** Shows requested popup menu for feed tree */
void slotFeedTreeContextMenu(KListView*, TreeNode*, const TQPoint&);
/** emits @ref signalUnreadCountChanged(int) */
void slotSetTotalUnread();
/** special behaviour in article list view (TODO: move code there?) */
void slotMouseButtonPressed(int button, const Article& article, const TQPoint & pos, int c);
/** opens article of @c item in external browser */
void slotOpenArticleExternal(const Article& article, const TQPoint&, int);
/** opens the current article (currentItem) in external browser
TODO: use selected instead of current? */
void slotOpenCurrentArticleExternal();
/** opens the current article (currentItem) in background tab
TODO: use selected instead of current? */
void slotOpenCurrentArticleBackgroundTab();
/** opens current article in new tab, background/foreground depends on settings TODO: use selected instead of current? */
void slotOpenCurrentArticle();
/** copies the link of current article to clipboard
*/
void slotCopyLinkAddress();
/** opens a page viewer in a new tab and loads an URL
@param url the url to load
@param background whether the tab should be opened in the background or in the foreground (activated after creation) */
void slotOpenNewTab(const KURL& url, bool background = false);
/** called when another part/frame is activated. Updates progress bar, caption etc. accordingly
@param f the activated frame */
void slotFrameChanged(Frame *f);
/** sets the window caption after a frame change */
void slotCaptionChanged(const TQString &);
/** called when URLs are dropped into the tree view */
void slotFeedURLDropped (KURL::List &urls, TreeNode* after, Folder *tqparent);
/** displays a URL in the status bar when the user moves the mouse over a link */
void slotMouseOverInfo(const KFileItem *kifi);
/** sets the status bar text to a given string */
void sloStatusText(const TQString &);
void slotStarted();
void slotCanceled(const TQString &);
void slotCompleted();
void slotLoadingProgress(int);
void slotFetchingStarted();
void slotFetchingStopped();
/** Feed has been fetched, populate article view if needed and update counters. */
void slotFeedFetched(Feed *);
/** adds a new feed to the feed tree */
void slotFeedAdd();
/** adds a feed group to the feed tree */
void slotFeedAddGroup();
/** removes the currently selected feed (ask for confirmation)*/
void slotFeedRemove();
/** calls the properties dialog for feeds, starts renaming for feed groups */
void slotFeedModify();
/** fetches the currently selected feed */
void slotFetchCurrentFeed();
/** starts fetching of all feeds in the tree */
void slotFetchAllFeeds();
/** marks all articles in the currently selected feed as read */
void slotMarkAllRead();
/** marks all articles in all feeds in the tree as read */
void slotMarkAllFeedsRead();
/** opens the homepage of the currently selected feed */
void slotOpenHomepage();
/** toggles the keep flag of the currently selected article */
void slotArticleToggleKeepFlag(bool enabled);
/** deletes the currently selected article */
void slotArticleDelete();
/** marks the currently selected article as read */
void slotSetSelectedArticleRead();
/** marks the currently selected article as unread */
void slotSetSelectedArticleUnread();
/** marks the currently selected article as new */
void slotSetSelectedArticleNew();
/** marks the currenctly selected article as read after a user-set delay */
void slotSetCurrentArticleReadDelayed();
/** reads the currently selected articles using KTTSD */
void slotTextToSpeechRequest();
void slotAssignTag(const Tag& tag, bool assign);
//void slotRemoveTag(const Tag& tag);
void slotNewTag();
void slotTagCreated(const Tag& tag);
void slotTagRemoved(const Tag& tag);
/** switches view mode to normal view */
void slotNormalView();
/** switches view mode to widescreen view */
void slotWidescreenView();
/** switches view mode to combined view */
void slotCombinedView();
/** toggles the visibility of the filter bar */
void slotToggleShowQuickFilter();
/** selects the previous unread article in the article list */
void slotPrevUnreadArticle();
/** selects the next unread article in the article list */
void slotNextUnreadArticle();
void slotMoveCurrentNodeUp();
void slotMoveCurrentNodeDown();
void slotMoveCurrentNodeLeft();
void slotMoveCurrentNodeRight();
protected:
void addFeed(const TQString& url, TreeNode* after, Folder* tqparent, bool autoExec = true);
void connectToFeedList(FeedList* feedList);
void disconnectFromFeedList(FeedList* feedList);
void updateTagActions();
protected slots:
void connectFrame(Frame *);
void setTabIcon(const TQPixmap&);
void slotDoIntervalFetches();
void slotDeleteExpiredArticles();
/** HACK: receives signal from browserrun when the browserrun detects an HTML mimetype and actually loads the page TODO: Remove for KDE 4.0 */
void slotOpenURLReply(const KURL& url, Akregator::Viewer* currentViewer, Akregator::BrowserRun::OpeningMode mode);
/** HACK: part of the url opening hack for 3.5. called when a viewer emits urlClicked(). TODO: Remove for KDE4 */
void slotUrlClickedInViewer(const KURL& url, Viewer* viewer, bool newTab, bool background);
void slotOpenURL(const KURL& url, Akregator::Viewer* currentViewer, Akregator::BrowserRun::OpeningMode mode);
public: // compat with KDE-3.x assertions, remove for KDE 4
// private:
enum ViewMode { NormalView=0, WidescreenView, CombinedView };
FeedList* m_feedList;
TagNodeList* m_tagNodeList;
NodeListView* m_feedListView;
NodeListView* m_tagNodeListView;
ArticleListView *m_articleList;
ArticleViewer *m_articleViewer;
TabWidget *m_tabs;
TQWidget *m_mainTab;
Frame *m_mainFrame;
Frame *m_currentFrame;
SearchBar* m_searchBar;
TQSplitter *m_articleSplitter;
TQSplitter *m_horizontalSplitter;
ListTabWidget* m_listTabWidget;
Akregator::Part *m_part;
ViewMode m_viewMode;
TQTimer *m_fetchTimer;
TQTimer* m_expiryTimer;
TQTimer *m_markReadTimer;
bool m_shuttingDown;
bool m_displayingAboutPage;
ActionManagerImpl* m_actionManager;
TQPixmap m_keepFlagIcon;
friend class EditNodePropertiesVisitor;
class EditNodePropertiesVisitor;
EditNodePropertiesVisitor* m_editNodePropertiesVisitor;
friend class DeleteNodeVisitor;
class DeleteNodeVisitor;
DeleteNodeVisitor* m_deleteNodeVisitor;
};
}
#endif // _AKREGATORVIEW_H_
|