akregator/src

akregator_view.h

00001 /*
00002     This file is part of Akregator.
00003 
00004     Copyright (C) 2004 Stanislav Karchebny <Stanislav.Karchebny@kdemail.net>
00005                   2004 Sashmit Bhaduri <smt@vfemail.net>
00006                   2005 Frank Osterfeld <frank.osterfeld at kdemail.net>
00007 
00008     This program is free software; you can redistribute it and/or modify
00009     it under the terms of the GNU General Public License as published by
00010     the Free Software Foundation; either version 2 of the License, or
00011     (at your option) any later version.
00012 
00013     This program is distributed in the hope that it will be useful,
00014     but WITHOUT ANY WARRANTY; without even the implied warranty of
00015     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00016     GNU General Public License for more details.
00017 
00018     You should have received a copy of the GNU General Public License
00019     along with this program; if not, write to the Free Software
00020     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00021 
00022     As a special exception, permission is given to link this program
00023     with any edition of TQt, and distribute the resulting executable,
00024     without including the source code for TQt in the source distribution.
00025 */
00026 
00027 #ifndef _AKREGATORVIEW_H_
00028 #define _AKREGATORVIEW_H_
00029 
00030 #include <tqpixmap.h>
00031 #include <tqwidget.h>
00032 
00033 #include <kurl.h>
00034 
00035 #include "akregator_run.h"
00036 #include "feed.h"
00037 
00038 class TQSplitter;
00039 class TQDomDocument;
00040 class TQDomElement;
00041 class TQHBox;
00042 class TQToolButton;
00043 class TQListViewItem;
00044 class KComboBox;
00045 class TDEConfig;
00046 class KFileItem;
00047 class KLineEdit;
00048 class TDEListView;
00049 class TDEListViewItem;
00050 class KTabWidget;
00051 class Viewer;
00052 
00053 namespace TDEIO {
00054 
00055     class Job;
00056 }
00057 
00058 namespace Akregator {
00059 
00060     class AboutPageViewer;
00061     class ActionManagerImpl;
00062     class ArticleMatcher;
00063     class ArticleListView;
00064     class ArticleViewer;
00065     class BrowserRun;
00066     class Folder;
00067     class FeedList;
00068     class Frame;
00069     class NodeListView;
00070     class ListTabWidget;
00071     class Part;
00072     class SearchBar;
00073     class TabWidget;
00074     class Tag;
00075     class TagNodeList;
00076 
00080     class View : public TQWidget
00081     {
00082         Q_OBJECT
00083   
00084         public:
00085 
00092             View(Akregator::Part *part, TQWidget *parent, ActionManagerImpl* actionManager, const char* name);
00093 
00096             ~View();
00097 
00099             void saveSettings();
00100 
00101             void slotSettingsChanged();
00102 
00105             bool importFeeds(const TQDomDocument& doc);
00106 
00111             bool loadFeeds(const TQDomDocument& doc, Folder* parent = 0);
00112 
00116              TQDomDocument feedListToOPML();
00117 
00124             void addFeedToGroup(const TQString& url, const TQString& group);
00125 
00127             virtual void readProperties(TDEConfig* config);
00128             virtual void saveProperties(TDEConfig* config);
00129 
00130              Frame* currentFrame() const { return m_currentFrame; }
00131 
00132         signals:
00134             void signalUnreadCountChanged(int);
00135 
00136             void setWindowCaption(const TQString&);
00137             void setStatusBarText(const TQString&);
00138             void setProgress(int);
00139             void signalStarted(TDEIO::Job*);
00140             void signalCompleted();
00141             void signalCanceled(const TQString&);
00142 
00143         public slots:
00144 
00145             void slotOnShutdown();
00146 
00148             void slotNodeSelected(TreeNode* node);
00149 
00151             void slotArticleSelected(const Article&);
00152 
00154             void slotFeedTreeContextMenu(TDEListView*, TreeNode*, const TQPoint&);
00155 
00157             void slotSetTotalUnread();
00158 
00160             void slotMouseButtonPressed(int button, const Article& article, const TQPoint & pos, int c);
00161 
00163             void slotOpenArticleExternal(const Article& article, const TQPoint&, int);
00164 
00167             void slotOpenCurrentArticleExternal();
00168 
00171             void slotOpenCurrentArticleBackgroundTab();
00172 
00174             void slotOpenCurrentArticle();
00175 
00178             void slotCopyLinkAddress();
00179 
00183             void slotOpenNewTab(const KURL& url, bool background = false);
00184 
00187             void slotFrameChanged(Frame *f);
00188 
00190             void slotCaptionChanged(const TQString &);
00191 
00193             void slotFeedURLDropped (KURL::List &urls, TreeNode* after, Folder *parent);
00194 
00196             void slotMouseOverInfo(const KFileItem *kifi);
00197 
00199             void slotStatusText(const TQString &);
00200 
00201             void slotStarted();
00202             void slotCanceled(const TQString &);
00203             void slotCompleted();
00204             void slotLoadingProgress(int);
00205 
00206             void slotFetchingStarted();
00207             void slotFetchingStopped();
00208 
00209 
00211             void slotFeedFetched(Feed *);
00212 
00214             void slotFeedAdd();
00216             void slotFeedAddGroup();
00218             void slotFeedRemove();
00220             void slotFeedModify();
00222             void slotFetchCurrentFeed();
00224             void slotFetchAllFeeds();
00226             void slotMarkAllRead();
00228             void slotMarkAllFeedsRead();
00230             void slotOpenHomepage();
00231 
00233             void slotArticleToggleKeepFlag(bool enabled);
00235             void slotArticleDelete();
00237             void slotSetSelectedArticleRead();
00239             void slotSetSelectedArticleUnread();
00241             void slotSetSelectedArticleNew();
00243             void slotSetCurrentArticleReadDelayed();
00244 
00246             void slotTextToSpeechRequest();
00247 
00248             void slotAssignTag(const Tag& tag, bool assign);
00249             //void slotRemoveTag(const Tag& tag);
00250             void slotNewTag();
00251             void slotTagCreated(const Tag& tag);
00252             void slotTagRemoved(const Tag& tag);
00253 
00255             void slotNormalView();
00257             void slotWidescreenView();
00259             void slotCombinedView();
00261             void slotToggleShowQuickFilter();
00262 
00264             void slotPrevUnreadArticle();
00266             void slotNextUnreadArticle();
00267 
00268             void slotMoveCurrentNodeUp();
00269             void slotMoveCurrentNodeDown();
00270             void slotMoveCurrentNodeLeft();
00271             void slotMoveCurrentNodeRight();
00272 
00273         protected:
00274 
00275             void addFeed(const TQString& url, TreeNode* after, Folder* parent, bool autoExec = true);
00276 
00277             void connectToFeedList(FeedList* feedList);
00278             void disconnectFromFeedList(FeedList* feedList);
00279 
00280             void updateTagActions();
00281 
00282         protected slots:
00283 
00284             void connectFrame(Frame *);
00285 
00286             void setTabIcon(const TQPixmap&);
00287 
00288             void slotDoIntervalFetches();
00289             void slotDeleteExpiredArticles();
00290 
00292             void slotOpenURLReply(const KURL& url, Akregator::Viewer* currentViewer, Akregator::BrowserRun::OpeningMode mode);
00293 
00295             void slotUrlClickedInViewer(const KURL& url, Viewer* viewer, bool newTab, bool background);
00296 
00297             void slotOpenURL(const KURL& url, Akregator::Viewer* currentViewer, Akregator::BrowserRun::OpeningMode mode);
00298 
00299         public:         // compat with KDE-3.x assertions, remove for KDE 4
00300 //         private:
00301 
00302             enum ViewMode { NormalView=0, WidescreenView, CombinedView };
00303 
00304             FeedList* m_feedList;
00305             TagNodeList* m_tagNodeList;
00306             NodeListView* m_feedListView;
00307             NodeListView* m_tagNodeListView;
00308             ArticleListView *m_articleList;
00309             ArticleViewer *m_articleViewer;
00310             TabWidget *m_tabs;
00311 
00312             TQWidget *m_mainTab;
00313             Frame *m_mainFrame;
00314             Frame *m_currentFrame;
00315 
00316             SearchBar* m_searchBar;
00317 
00318             TQSplitter *m_articleSplitter;
00319             TQSplitter *m_horizontalSplitter;
00320        
00321             ListTabWidget* m_listTabWidget;
00322             Akregator::Part *m_part;
00323             ViewMode m_viewMode;
00324 
00325             TQTimer *m_fetchTimer;
00326             TQTimer* m_expiryTimer;
00327             TQTimer *m_markReadTimer;
00328 
00329             bool m_shuttingDown;
00330             bool m_displayingAboutPage;
00331 
00332             ActionManagerImpl* m_actionManager;
00333 
00334             TQPixmap m_keepFlagIcon;
00335             friend class EditNodePropertiesVisitor;
00336             class EditNodePropertiesVisitor;
00337             EditNodePropertiesVisitor* m_editNodePropertiesVisitor;
00338             friend class DeleteNodeVisitor;
00339             class DeleteNodeVisitor;
00340             DeleteNodeVisitor* m_deleteNodeVisitor;
00341     };
00342 }
00343 
00344 #endif // _AKREGATORVIEW_H_