File indexing completed on 2024-05-12 16:01:54
0001 /************************************************************************** 0002 ** 0003 ** This file is part of Qt Creator 0004 ** 0005 ** SPDX-FileCopyrightText: 2011 Nokia Corporation and /or its subsidiary(-ies). 0006 ** 0007 ** Contact: Nokia Corporation (qt-info@nokia.com) 0008 ** 0009 ** 0010 ** SPDX-License-Identifier: LGPL-2.1-only 0011 ** 0012 ** In addition, as a special exception, Nokia gives you certain additional 0013 ** rights. These rights are described in the Nokia Qt LGPL Exception 0014 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 0015 ** 0016 ** Other Usage 0017 ** 0018 ** Alternatively, this file may be used in accordance with the terms and 0019 ** conditions contained in a signed written agreement between you and Nokia. 0020 ** 0021 ** If you have questions regarding the use of this file, please contact 0022 ** Nokia at qt-info@nokia.com. 0023 ** 0024 **************************************************************************/ 0025 0026 #ifndef KISRSSREADER_H 0027 #define KISRSSREADER_H 0028 0029 #include <QString> 0030 #include <QDateTime> 0031 #include <QXmlStreamReader> 0032 #include <QNetworkReply> 0033 #include <QFile> 0034 0035 #include <kritaui_export.h> 0036 0037 struct RssItem { 0038 QString source; 0039 QString title; 0040 QString link; 0041 QString description; 0042 QString category; 0043 QString blogName; 0044 QString blogIcon; 0045 QDateTime pubDate; 0046 0047 }; 0048 typedef QList<RssItem> RssItemList; 0049 0050 Q_DECLARE_METATYPE(RssItem); 0051 0052 0053 class KRITAUI_EXPORT KisRssReader 0054 { 0055 public: 0056 KisRssReader(); 0057 0058 enum RssRoles { 0059 TitleRole = Qt::UserRole + 1, 0060 DescriptionRole, 0061 LinkRole, 0062 PubDateRole, 0063 CategoryRole, 0064 BlogNameRole, 0065 BlogIconRole 0066 }; 0067 0068 RssItem parseItem(); 0069 RssItemList parseStream(QXmlStreamReader& streamReader); 0070 RssItemList parse(QNetworkReply *reply); 0071 RssItemList parse(QFile& file); 0072 0073 private: 0074 QXmlStreamReader m_streamReader; 0075 QString requestUrl; 0076 QString blogIcon; 0077 QString blogName; 0078 }; 0079 0080 #endif // KISRSSREADER_H