~ubuntu-branches/ubuntu/lucid/ktorrent/lucid

« back to all changes in this revision

Viewing changes to plugins/rssfeed/rssfeed.h

  • Committer: Bazaar Package Importer
  • Author(s): Richard Birnie
  • Date: 2008-06-03 20:32:46 UTC
  • mfrom: (1.1.20 upstream)
  • Revision ID: james.westby@ubuntu.com-20080603203246-dfyemn010uhsf433
Tags: 3.1~rc1+dfsg.1-1ubuntu1
* New upstream development release      
 - Dropped 01_support_external_libbtcore.diffm,
   97_fix_target_link_libraries.diff,
   99_libbtcore_scramble_soname.diff

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***************************************************************************
2
 
 *   Copyright (C) 2006 by Alan Jones                                      *
3
 
 *   skyphyr@gmail.com                                                     *
4
 
 *                                                                         *
5
 
 *   This program is free software; you can redistribute it and/or modify  *
6
 
 *   it under the terms of the GNU General Public License as published by  *
7
 
 *   the Free Software Foundation; either version 2 of the License, or     *
8
 
 *   (at your option) any later version.                                   *
9
 
 *                                                                         *
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.                          *
14
 
 *                                                                         *
15
 
 *   You should have received a copy of the GNU General Public License     *
16
 
 *   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.          *
19
 
 ***************************************************************************/
20
 
#ifndef RSSFEED_H
21
 
#define RSSFEED_H
22
 
 
23
 
#include <qobject.h>
24
 
#include <qstring.h>
25
 
#include <qdatetime.h>
26
 
#include <qvaluelist.h>
27
 
#include <qtimer.h>
28
 
#include <qdatastream.h>
29
 
 
30
 
#include <kurl.h>
31
 
 
32
 
#include "rss/loader.h"
33
 
#include "rss/document.h"
34
 
 
35
 
#include "rssarticle.h"
36
 
 
37
 
using namespace RSS;
38
 
 
39
 
namespace kt
40
 
{
41
 
        /**
42
 
         * @brief RssFeed Class
43
 
         * @author Alan Jones <skyphyr@gmail.com>
44
 
         * 
45
 
         * 
46
 
        */
47
 
        
48
 
        class RssFeed : public QObject
49
 
        {
50
 
                        Q_OBJECT
51
 
                public:
52
 
                        
53
 
                        /**
54
 
                         * Default constructor.
55
 
                         */
56
 
                        RssFeed(QObject * parent = 0);
57
 
                        RssFeed(KURL feedUrl, QString title = "", bool active = false, int articleAge = 3, bool ignoreTTL = false, QTime autoRefresh = QTime());
58
 
                        RssFeed(const RssFeed &other);
59
 
                        RssFeed &operator=(const RssFeed &other);
60
 
                        ~RssFeed();
61
 
                        
62
 
                        KURL feedUrl() const { return m_feedUrl; }
63
 
                        bool active() const { return m_active; }
64
 
                        int articleAge() const { return m_articleAge; }
65
 
                        QString title() const { return m_title; }
66
 
                        QTime autoRefresh() const { return m_autoRefresh; }
67
 
                        bool ignoreTTL() const { return m_ignoreTTL; }
68
 
                        
69
 
                        
70
 
                        RssArticle::List articles() const { return m_articles; }
71
 
                        
72
 
 
73
 
                public slots:
74
 
                        void refreshFeed();
75
 
                        void feedLoaded(Loader *feedLoader, Document doc, Status status);
76
 
                        
77
 
                        void clearArticles();
78
 
                        
79
 
                        void setFeedUrl( const KURL& url );
80
 
                        void setFeedUrl( const QString& url );
81
 
                        void setActive( bool active );
82
 
                        void setArticleAge( int articleAge );
83
 
                        void setTitle( const QString& title );
84
 
                        void setAutoRefresh( const QTime& autoRefresh );
85
 
                        void setIgnoreTTL( bool ignoreTTL );
86
 
                        void saveArticles();
87
 
                        
88
 
                        void setDownloaded(QString link, int downloaded);
89
 
                        
90
 
                signals:
91
 
                        void feedUrlChanged( const KURL& url );
92
 
                        void activeChanged( bool active );
93
 
                        void articleAgeChanged( int articleAge );
94
 
                        void titleChanged( const QString& title );
95
 
                        void updateTitle( const QString& title );
96
 
                        void autoRefreshChanged( const QTime& autoRefresh );
97
 
                        void ignoreTTLChanged( bool ignoreTTL );
98
 
                        
99
 
                        void articlesChanged( const RssArticle::List& articles );
100
 
                        
101
 
                        void scanRssArticle( RssArticle article );
102
 
 
103
 
                private:
104
 
                        KURL m_feedUrl;
105
 
                        bool m_active;
106
 
                        int m_articleAge;
107
 
                        QString m_title;
108
 
                        QTime m_autoRefresh;
109
 
                        bool m_ignoreTTL;
110
 
                        RssArticle::List m_articles;
111
 
                        QTimer refreshTimer;
112
 
                        
113
 
                        bool feedLoading;
114
 
                        
115
 
                        QString getFilename();
116
 
                        void initialize();
117
 
                        void startFeed();
118
 
                        void cleanArticles();
119
 
                        void loadArticles();
120
 
        };
121
 
 
122
 
        QDataStream &operator<<( QDataStream &out, const RssFeed &feed );
123
 
        QDataStream &operator>>( QDataStream &in, RssFeed &feed );
124
 
 
125
 
}
126
 
 
127
 
#endif