2
* Copyright (C) 2007 Aaron Seigo <aseigo@kde.org>
3
* Copyright (C) 2007 Petri Damsten <damu@iki.fi>
4
* Copyright (C) 2008 Rob Scheepmaker <r.scheepmaker@student.utwente.nl>
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU Library General Public License version 2 as
8
* published by the Free Software Foundation
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details
15
* You should have received a copy of the GNU Library General Public
16
* License along with this program; if not, write to the
17
* Free Software Foundation, Inc.,
18
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21
#ifndef RSS_DATAENGINE_H
22
#define RSS_DATAENGINE_H
24
#include <syndication/item.h>
25
#include <syndication/loader.h>
26
#include <syndication/feed.h>
27
#include <Solid/Networking>
28
#include <Plasma/DataEngine>
35
* This class can be used to fetch one or more rss feeds. By
36
* requesting a datasource with the url's of one or more rss
37
* feeds separated by " ", you will receive a merged list
38
* containing the items of all feeds requested. This list is
39
* sorted by timestamp.
40
* This class also fetches the favicons from all requested
43
class RssEngine : public Plasma::DataEngine
48
RssEngine(QObject* parent, const QVariantList& args);
52
bool sourceRequestEvent(const QString &name);
53
bool updateSourceEvent(const QString& name);
56
void processRss(Syndication::Loader* loader,
57
Syndication::FeedPtr feed,
58
Syndication::ErrorCode error);
59
void slotIconChanged(bool isHost, const QString& hostOrURL,
60
const QString& iconName);
61
void timeout(const QString & source);
62
void networkStatusChanged(Solid::Networking::Status status);
65
QVariantList mergeFeeds(QString source) const;
66
void updateFeeds(const QString & source,
67
const QString & title);
68
bool cachesUpToDate(const QString & source) const;
69
QString iconLocation(const KUrl & url) const;
71
QHash<Syndication::Loader*, QString> m_feedMap;
72
QHash<Syndication::Loader*, QString> m_sourceMap;
73
QHash<QString, QTimer*> m_timerMap;
74
QHash<QString, QVariantList> m_feedItems;
75
QHash<QString, QString> m_feedIcons;
76
QHash<QString, QString> m_feedTitles;
77
QHash<QString, QDateTime> m_feedTimes;
80
QVariantList m_rssSources;
81
QSet<QString> m_rssSourceNames;
83
QDBusInterface * m_favIconsModule;
84
QSignalMapper * m_signalMapper;
87
K_EXPORT_PLASMA_DATAENGINE(rss, RssEngine)