akregator/src

article.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 AKREGATOR_ARTICLE_H
00027 #define AKREGATOR_ARTICLE_H
00028 
00029 class QDateTime;
00030 class QDomDocument;
00031 class QDomElement;
00032 class QString;
00033 class QStringList;
00034 class QWidget;
00035 
00036 template <class T> class QValueList;
00037 
00038 typedef unsigned int uint;
00039 
00040 class KURL;
00041 class KURLLabel;
00042 
00043 namespace RSS
00044 {
00045     class Article;
00046     class Enclosure;
00047 }
00048 
00049 namespace Akregator
00050 {
00051     namespace Backend
00052     {
00053         class FeedStorage;
00054     }
00055     class Feed;
00057     class Article
00058     {
00059         public:
00060             enum Status { Unread=0, Read, New };
00061             typedef QValueList<Article> List;
00062 
00063             Article();
00067             Article(const QString& guid, Feed* feed);
00071             Article(RSS::Article article, Feed* feed);
00072             
00073             Article(RSS::Article article, Backend::FeedStorage* archive);
00074             Article(const Article &other);
00075             Article &operator=(const Article &other);
00076             bool operator==(const Article &other) const;
00077             bool operator!=(const Article &other) const { return !operator==(other); }
00078             virtual ~Article();
00079 
00080             bool isNull() const;
00081             
00082             int status() const;
00083             void setStatus(int s);
00084 
00085             void offsetPubDate(int secs);
00086 
00087             QString title() const;
00088             KURL link() const;
00089             
00090             QString author() const;
00091             
00092             QString description() const;
00093             QString guid() const;
00095             bool keep() const;
00096             void setKeep(bool keep);
00097             bool isDeleted() const;
00098             
00099             RSS::Enclosure enclosure() const;
00100             
00101             void setDeleted();
00102             
00103 
00104             Feed* feed() const;
00105 
00108             uint hash() const;
00109 
00112             bool guidIsHash() const;
00113             
00114             bool guidIsPermaLink() const;
00115             
00116             const QDateTime& pubDate() const;
00117             
00118             KURL commentsLink() const;
00119             
00120             int comments() const;
00121             
00122             void addTag(const QString& tag);
00123             void removeTag(const QString& tag);
00124             bool hasTag(const QString& tag) const;
00125             QStringList tags() const;
00126             
00127             bool operator<(const Article &other) const;
00128             bool operator<=(const Article &other) const;
00129             bool operator>(const Article &other) const;
00130             bool operator>=(const Article &other) const;
00131 
00132 
00133         private:
00134             void initialize(RSS::Article article, Backend::FeedStorage* archive);
00135             static QString buildTitle(const QString& description);
00136             
00137             struct Private;
00138             Private *d;
00139     };
00140 }
00141 
00142 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys