akregator/src

akregator_part.h
1 /*
2  This file is part of Akregator.
3 
4  Copyright (C) 2004 Stanislav Karchebny <Stanislav.Karchebny@kdemail.net>
5  2005 Frank Osterfeld <frank.osterfeld at kdemail.net>
6 
7  This program is free software; you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation; either version 2 of the License, or
10  (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 
21  As a special exception, permission is given to link this program
22  with any edition of TQt, and distribute the resulting executable,
23  without including the source code for TQt in the source distribution.
24 */
25 
26 #ifndef _AKREGATORPART_H_
27 #define _AKREGATORPART_H_
28 
29 #include <tdeparts/browserextension.h>
30 #include <tdeparts/part.h>
31 #include <kurl.h>
32 
33 #include "config.h"
34 
35 #include "akregator_partiface.h"
36 
37 class TQDomDocument;
38 class TQTimer;
39 
40 class TDEAboutData;
41 class TDEConfig;
42 class KURL;
43 
44 namespace Akregator
45 {
46  namespace Backend
47  {
48  class Storage;
49  }
50 
51  typedef KParts::ReadOnlyPart MyBasePart;
52 
53  class ActionManagerImpl;
54  class View;
55  class Part;
56  class Feed;
57  class Article;
58  class TrayIcon;
59 
60  class BrowserExtension : public KParts::BrowserExtension
61  {
62  TQ_OBJECT
63 
64 
65  public:
66  BrowserExtension(Part *p, const char *name );
67  public slots:
68  void saveSettings();
69  private:
70  Part *m_part;
71  };
72 
77  class Part : public MyBasePart, virtual public AkregatorPartIface
78  {
79  TQ_OBJECT
80 
81  public:
82  typedef MyBasePart inherited;
83 
85  Part(TQWidget *parentWidget, const char *widgetName,
86  TQObject *parent, const char *name, const TQStringList&);
87 
89  virtual ~Part();
90 
92  static TDEAboutData *createAboutData();
93 
98  virtual bool openURL(const KURL& url);
99 
101  virtual void openStandardFeedList();
102 
103  virtual void fetchFeedUrl(const TQString&);
104 
106  virtual void fetchAllFeeds();
107 
115  virtual void addFeedsToGroup(const TQStringList& urls, const TQString& group);
116 
117  virtual void addFeed();
118 
125  virtual void readProperties(TDEConfig* config);
126 
130  virtual void saveProperties(TDEConfig* config);
131 
134  virtual bool mergePart(KParts::Part*);
135 
136  void loadTagSet(const TQString& path);
137  void saveTagSet(const TQString& path);
138 
139  public slots:
141  virtual void saveSettings();
142 
144  void slotSaveFeedList();
145 
146  void fileImport();
147  void fileExport();
148  void fileGetFeeds();
149 
150  void fileSendLink() { fileSendArticle(); }
151  void fileSendFile() { fileSendArticle(true); }
152  void fileSendArticle(bool attach=false);
153 
155  void showOptions();
156  void showKNotifyOptions();
157 
158  signals:
159  void showPart();
160  void signalSettingsChanged();
161 
162 
163  protected:
164 
166  virtual bool isTrayIconEnabled() const;
167 
169  void loadPlugins();
170 
172  virtual bool openFile();
173 
174  void importFile(const KURL& url);
175  void exportFile(const KURL& url);
176 
178  TQWidget* getMainWindow();
179 
180  virtual KParts::Part *hitTest(TQWidget *widget, const TQPoint &globalPos);
181 
183  virtual void partActivateEvent(KParts::PartActivateEvent* event);
184 
185  protected slots:
186  void slotOnShutdown();
187  void slotSettingsChanged();
188 
189  private: // methods
190 
191  bool copyFile(const TQString& backup);
192 
194  void initFonts();
195 
197  static TQDomDocument createDefaultFeedList();
198 
199  bool tryToLock(const TQString& backendName);
200 
201  private: // attributes
202 
203  class ApplyFiltersInterceptor;
204  ApplyFiltersInterceptor* m_applyFiltersInterceptor;
205  TQString m_standardFeedList;
206  TQString m_tagSetPath;
207  bool m_standardListLoaded;
208  bool m_shuttingDown;
209 
210  KParts::BrowserExtension *m_extension;
211  KParts::Part* m_mergedPart;
212  View* m_view;
213 
214  TQTimer* m_autosaveTimer;
216  bool m_backedUpList;
217  Backend::Storage* m_storage;
218  ActionManagerImpl* m_actionManager;
219  };
220 }
221 
222 #endif // _AKREGATORPART_H_
Akregator-specific implementation of the ActionManager interface.
Storage is the main interface to the article archive.
Definition: storage.h:45
This is a RSS Aggregator "Part".
virtual bool openFile()
This must be implemented by each part.
TQWidget * getMainWindow()
FIXME: hack to get the tray icon working.
virtual void partActivateEvent(KParts::PartActivateEvent *event)
reimplemented to load/unload the merged parts on selection/deselection
virtual bool isTrayIconEnabled() const
static TDEAboutData * createAboutData()
Create TDEAboutData for this KPart.
virtual bool mergePart(KParts::Part *)
merges a nested part's GUI into the gui of this part
virtual void fetchAllFeeds()
Fetch all feeds in the feed tree.
virtual void saveProperties(TDEConfig *config)
This method is called when it is time for the app to save its properties for session management purpo...
void slotSaveFeedList()
Saves the standard feed list to it's default location.
virtual bool openURL(const KURL &url)
Opens feedlist.
Part(TQWidget *parentWidget, const char *widgetName, TQObject *parent, const char *name, const TQStringList &)
Default constructor.
virtual void openStandardFeedList()
Opens standard feedlist.
void loadPlugins()
loads all Akregator plugins
virtual void addFeedsToGroup(const TQStringList &urls, const TQString &group)
Add a feed to a group.
virtual ~Part()
Destructor.
virtual void readProperties(TDEConfig *config)
This method is called when this app is restored.
virtual void saveSettings()
Used to save settings after changing them from configuration dialog.
void showOptions()
Shows configuration dialog.
This is the main widget of the view, containing tree view, article list, viewer etc.