akregator/src

akregator_part.h

00001 /*
00002     This file is part of Akregator.
00003 
00004     Copyright (C) 2004 Stanislav Karchebny <Stanislav.Karchebny@kdemail.net>
00005                   2005 Frank Osterfeld <frank.osterfeld at kdemail.net>
00006 
00007     This program is free software; you can redistribute it and/or modify
00008     it under the terms of the GNU General Public License as published by
00009     the Free Software Foundation; either version 2 of the License, or
00010     (at your option) any later version.
00011 
00012     This program is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00015     GNU General Public License for more details.
00016 
00017     You should have received a copy of the GNU General Public License
00018     along with this program; if not, write to the Free Software
00019     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020 
00021     As a special exception, permission is given to link this program
00022     with any edition of TQt, and distribute the resulting executable,
00023     without including the source code for TQt in the source distribution.
00024 */
00025 
00026 #ifndef _AKREGATORPART_H_
00027 #define _AKREGATORPART_H_
00028 
00029 #include <tdeparts/browserextension.h>
00030 #include <tdeparts/part.h>
00031 #include <kurl.h>
00032 
00033 #include "config.h"
00034 
00035 #include "akregator_partiface.h"
00036 
00037 class TQDomDocument;
00038 class TQTimer;
00039 
00040 class TDEAboutData;
00041 class TDEConfig;
00042 class KURL;
00043 
00044 namespace Akregator
00045 {
00046     namespace Backend
00047     {
00048         class Storage;
00049     }
00050 
00051     typedef KParts::ReadOnlyPart MyBasePart;
00052 
00053     class ActionManagerImpl;
00054     class View;
00055     class Part;
00056     class Feed;
00057     class Article;
00058     class TrayIcon;
00059 
00060     class BrowserExtension : public KParts::BrowserExtension
00061     {
00062         Q_OBJECT
00063   
00064 
00065         public:
00066             BrowserExtension(Part *p, const char *name );
00067         public slots:
00068             void saveSettings();
00069         private:
00070             Part *m_part;
00071     };
00072 
00077     class Part : public MyBasePart, virtual public AkregatorPartIface
00078     {
00079         Q_OBJECT
00080   
00081         public:
00082            typedef MyBasePart inherited;
00083 
00085             Part(TQWidget *parentWidget, const char *widgetName,
00086                           TQObject *parent, const char *name, const TQStringList&);
00087 
00089             virtual ~Part();
00090 
00092             static TDEAboutData *createAboutData();
00093 
00098             virtual bool openURL(const KURL& url);
00099 
00101             virtual void openStandardFeedList();
00102 
00103             virtual void fetchFeedUrl(const TQString&);
00104 
00106             virtual void fetchAllFeeds();
00107 
00115             virtual void addFeedsToGroup(const TQStringList& urls, const TQString& group);
00116 
00117             virtual void addFeed();
00118 
00125             virtual void readProperties(TDEConfig* config);
00126 
00130             virtual void saveProperties(TDEConfig* config);
00131 
00134             virtual bool mergePart(KParts::Part*);
00135 
00136             void loadTagSet(const TQString& path);
00137             void saveTagSet(const TQString& path);
00138 
00139         public slots:
00141             virtual void saveSettings();
00142 
00144             void slotSaveFeedList();
00145 
00146             void fileImport();
00147             void fileExport();
00148             void fileGetFeeds();
00149 
00150             void fileSendLink() { fileSendArticle(); }
00151             void fileSendFile() { fileSendArticle(true); }
00152             void fileSendArticle(bool attach=false);
00153 
00155             void showOptions();
00156             void showKNotifyOptions();
00157 
00158         signals:
00159             void showPart();
00160             void signalSettingsChanged();
00161 
00162 
00163         protected:
00164 
00166             virtual bool isTrayIconEnabled() const;
00167 
00169             void loadPlugins();
00170 
00172             virtual bool openFile();
00173 
00174             void importFile(const KURL& url);
00175             void exportFile(const KURL& url);
00176 
00178             TQWidget* getMainWindow();
00179 
00180             virtual KParts::Part *hitTest(TQWidget *widget, const TQPoint &globalPos);
00181 
00183             virtual void partActivateEvent(KParts::PartActivateEvent* event);
00184 
00185         protected slots:
00186             void slotOnShutdown();
00187             void slotSettingsChanged();
00188 
00189         private: // methods
00190 
00191             bool copyFile(const TQString& backup);
00192 
00194             void initFonts();
00195 
00197             static TQDomDocument createDefaultFeedList();
00198 
00199             bool tryToLock(const TQString& backendName);
00200 
00201          private: // attributes
00202 
00203             class ApplyFiltersInterceptor;
00204             ApplyFiltersInterceptor* m_applyFiltersInterceptor;
00205             TQString m_standardFeedList;
00206             TQString m_tagSetPath;
00207             bool m_standardListLoaded;
00208             bool m_shuttingDown;
00209 
00210             KParts::BrowserExtension *m_extension;
00211             KParts::Part* m_mergedPart;
00212             View* m_view;
00213 
00214             TQTimer* m_autosaveTimer;
00216             bool m_backedUpList;
00217             Backend::Storage* m_storage;
00218             ActionManagerImpl* m_actionManager;
00219     };
00220 }
00221 
00222 #endif // _AKREGATORPART_H_
00223 
00224 // vim: set et ts=4 sts=4 sw=4: