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 Qt, and distribute the resulting executable,
00023     without including the source code for Qt in the source distribution.
00024 */
00025 
00026 #ifndef _AKREGATORPART_H_
00027 #define _AKREGATORPART_H_
00028 
00029 #include <kparts/browserextension.h>
00030 #include <kparts/part.h>
00031 #include <kurl.h>
00032 
00033 #include "config.h"
00034 
00035 #include "akregator_partiface.h"
00036 
00037 class QDomDocument;
00038 class QTimer;
00039 
00040 class KAboutData;
00041 class KConfig;
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         public:
00065             BrowserExtension(Part *p, const char *name );
00066         public slots:
00067             void saveSettings();
00068         private:
00069             Part *m_part;
00070     };
00071 
00076     class Part : public MyBasePart, virtual public AkregatorPartIface
00077     {
00078         Q_OBJECT
00079         public:
00080            typedef MyBasePart inherited;
00081 
00083             Part(QWidget *parentWidget, const char *widgetName,
00084                           QObject *parent, const char *name, const QStringList&);
00085 
00087             virtual ~Part();
00088 
00090             static KAboutData *createAboutData();
00091 
00096             virtual bool openURL(const KURL& url);
00097 
00099             virtual void openStandardFeedList();
00100 
00101             virtual void fetchFeedUrl(const QString&);
00102 
00104             virtual void fetchAllFeeds();
00105 
00113             virtual void addFeedsToGroup(const QStringList& urls, const QString& group);
00114 
00115             virtual void addFeed();
00116 
00123             virtual void readProperties(KConfig* config);
00124 
00128             virtual void saveProperties(KConfig* config);
00129 
00132             virtual bool mergePart(KParts::Part*);
00133 
00134             void loadTagSet(const QString& path);
00135             void saveTagSet(const QString& path);
00136 
00137         public slots:
00139             virtual void saveSettings();
00140 
00142             void slotSaveFeedList();
00143 
00144             void fileImport();
00145             void fileExport();
00146             void fileGetFeeds();
00147 
00148             void fileSendLink() { fileSendArticle(); }
00149             void fileSendFile() { fileSendArticle(true); }
00150             void fileSendArticle(bool attach=false);
00151 
00153             void showOptions();
00154             void showKNotifyOptions();
00155 
00156         signals:
00157             void showPart();
00158             void signalSettingsChanged();
00159 
00160 
00161         protected:
00162 
00164             virtual bool isTrayIconEnabled() const;
00165 
00167             void loadPlugins();
00168 
00170             virtual bool openFile();
00171 
00172             void importFile(const KURL& url);
00173             void exportFile(const KURL& url);
00174 
00176             QWidget* getMainWindow();
00177 
00178             virtual KParts::Part *hitTest(QWidget *widget, const QPoint &globalPos);
00179 
00181             virtual void partActivateEvent(KParts::PartActivateEvent* event);
00182 
00183         protected slots:
00184             void slotOnShutdown();
00185             void slotSettingsChanged();
00186 
00187         private: // methods
00188 
00189             bool copyFile(const QString& backup);
00190 
00192             void initFonts();
00193 
00195             static QDomDocument createDefaultFeedList();
00196 
00197             bool tryToLock(const QString& backendName);
00198 
00199          private: // attributes
00200 
00201             class ApplyFiltersInterceptor;
00202             ApplyFiltersInterceptor* m_applyFiltersInterceptor;
00203             QString m_standardFeedList;
00204             QString m_tagSetPath;
00205             bool m_standardListLoaded;
00206             bool m_shuttingDown;
00207 
00208             KParts::BrowserExtension *m_extension;
00209             KParts::Part* m_mergedPart;
00210             View* m_view;
00211 
00212             QTimer* m_autosaveTimer;
00214             bool m_backedUpList;
00215             Backend::Storage* m_storage;
00216             ActionManagerImpl* m_actionManager;
00217     };
00218 }
00219 
00220 #endif // _AKREGATORPART_H_
00221 
00222 // vim: set et ts=4 sts=4 sw=4:
KDE Home | KDE Accessibility Home | Description of Access Keys