rssguard/src/librssguard/services/standard/standardserviceroot.h
2021-06-25 13:36:23 +02:00

59 lines
1.7 KiB
C++

// For license of this file, see <project-root-folder>/LICENSE.md.
#ifndef STANDARDSERVICEROOT_H
#define STANDARDSERVICEROOT_H
#include "services/abstract/serviceroot.h"
#include "services/standard/standardfeed.h"
#include <QCoreApplication>
#include <QPair>
class StandardCategory;
class FeedsImportExportModel;
class QMenu;
class StandardServiceRoot : public ServiceRoot {
Q_OBJECT
friend class FormStandardFeedDetails;
friend class FormStandardImportExport;
public:
explicit StandardServiceRoot(RootItem* parent = nullptr);
virtual ~StandardServiceRoot();
virtual void start(bool freshly_activated);
virtual void stop();
virtual QString code() const;
virtual bool canBeEdited() const;
virtual bool editViaGui();
virtual bool supportsFeedAdding() const;
virtual bool supportsCategoryAdding() const;
virtual Qt::ItemFlags additionalFlags() const;
virtual QList<Message> obtainNewMessages(const QList<Feed*>& feeds);
QList<QAction*> serviceMenu();
QList<QAction*> getContextMenuForFeed(StandardFeed* feed);
public slots:
void addNewFeed(RootItem* selected_item, const QString& url = QString());
void addNewCategory(RootItem* selected_item);
private slots:
void importFeeds();
void exportFeeds();
private:
// Takes structure residing under given root item and adds feeds/categories from
// it to active structure.
// NOTE: This is used for import/export of the model.
bool mergeImportExportModel(FeedsImportExportModel* model, RootItem* target_root_node, QString& output_message);
QPointer<StandardFeed> m_feedForMetadata = {};
QList<QAction*> m_feedContextMenu = {};
};
#endif // STANDARDSERVICEROOT_H