Line data Source code
1 : #ifndef RELOADNEWSOPERATION_H
2 : #define RELOADNEWSOPERATION_H
3 :
4 : #include <QList>
5 :
6 : #include "DBOperation.h"
7 : #include "../models/FeedItem.h"
8 : #include "../models/NewsItem.h"
9 :
10 : /*!
11 : \brief Reloads specific NewsItems from the database by their IDs.
12 :
13 : This operation is used when items have been unloaded from memory
14 : to save resources, and need to be reloaded when the user scrolls
15 : back to view them.
16 : */
17 : class ReloadNewsOperation : public DBOperation
18 : {
19 : Q_OBJECT
20 : public:
21 : /*!
22 : \param parent The operation manager
23 : \param feedItem The feed item that owns these news items
24 : \param ids List of news item IDs to reload
25 : */
26 : explicit ReloadNewsOperation(OperationManager *parent, FeedItem* feedItem, const QList<qint64>& ids);
27 :
28 4 : virtual ~ReloadNewsOperation() = default;
29 :
30 : public slots:
31 : virtual void execute() override;
32 :
33 : /*!
34 : \return List of reloaded NewsItem objects.
35 : */
36 4 : inline QList<NewsItem*>& getReloadedItems() { return reloadedItems; }
37 :
38 : private:
39 : FeedItem* feedItem;
40 : QList<qint64> idsToReload;
41 : QList<NewsItem*> reloadedItems;
42 : };
43 :
44 : #endif // RELOADNEWSOPERATION_H
|