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 class KParts::BrowserExtension;
00044 
00045 namespace Akregator
00046 {
00047     namespace Backend
00048     {
00049         class Storage;
00050     }
00051 
00052     typedef KParts::ReadOnlyPart MyBasePart;
00053 
00054     class ActionManagerImpl;
00055     class View;
00056     class Part;
00057     class Feed;
00058     class Article;
00059     class TrayIcon;
00060 
00061     class BrowserExtension : public KParts::BrowserExtension
00062     {
00063         Q_OBJECT
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         public:
00081            typedef MyBasePart inherited;
00082 
00084             Part(QWidget *parentWidget, const char *widgetName,
00085                           QObject *parent, const char *name, const QStringList&);
00086 
00088             virtual ~Part();
00089 
00091             static KAboutData *createAboutData();
00092 
00097             virtual bool openURL(const KURL& url);
00098 
00100             virtual void openStandardFeedList();
00101 
00102             virtual void fetchFeedUrl(const QString&);
00103 
00105             virtual void fetchAllFeeds();
00106 
00114             virtual void addFeedsToGroup(const QStringList& urls, const QString& group);
00115 
00116             virtual void addFeed();
00117 
00124             virtual void readProperties(KConfig* config);
00125 
00129             virtual void saveProperties(KConfig* config);
00130 
00133             virtual bool mergePart(KParts::Part*);
00134 
00135             void loadTagSet(const QString& path);
00136             void saveTagSet(const QString& path);
00137 
00138         public slots:
00140             virtual void saveSettings();
00141 
00143             void slotSaveFeedList();
00144 
00145             void fileImport();
00146             void fileExport();
00147             void fileGetFeeds();
00148 
00149             void fileSendLink() { fileSendArticle(); }
00150             void fileSendFile() { fileSendArticle(true); }
00151             void fileSendArticle(bool attach=false);
00152 
00154             void showOptions();
00155             void showKNotifyOptions();
00156 
00157         signals:
00158             void showPart();
00159             void signalSettingsChanged();
00160 
00161 
00162         protected:
00163 
00165             virtual bool isTrayIconEnabled() const;
00166 
00168             void loadPlugins();
00169 
00171             virtual bool openFile();
00172 
00173             void importFile(const KURL& url);
00174             void exportFile(const KURL& url);
00175 
00177             QWidget* getMainWindow();
00178 
00179             virtual KParts::Part *hitTest(QWidget *widget, const QPoint &globalPos);
00180 
00182             virtual void partActivateEvent(KParts::PartActivateEvent* event);
00183 
00184         protected slots:
00185             void slotOnShutdown();
00186             void slotSettingsChanged();
00187 
00188         private: // methods
00189 
00190             bool copyFile(const QString& backup);
00191 
00193             void initFonts();
00194 
00196             static QDomDocument createDefaultFeedList();
00197 
00198             bool tryToLock(const QString& backendName);
00199 
00200          private: // attributes
00201 
00202             class ApplyFiltersInterceptor;
00203             ApplyFiltersInterceptor* m_applyFiltersInterceptor;
00204             QString m_standardFeedList;
00205             QString m_tagSetPath;
00206             bool m_standardListLoaded;
00207             bool m_shuttingDown;
00208 
00209             KParts::BrowserExtension *m_extension;
00210             KParts::Part* m_mergedPart;
00211             View* m_view;
00212 
00213             QTimer* m_autosaveTimer;
00215             bool m_backedUpList;
00216             Backend::Storage* m_storage;
00217             ActionManagerImpl* m_actionManager;
00218     };
00219 }
00220 
00221 #endif // _AKREGATORPART_H_
00222 
00223 // vim: set et ts=4 sts=4 sw=4:
KDE Home | KDE Accessibility Home | Description of Access Keys