From ddf5475b5f85397f185ff0275154f3a607d250f2 Mon Sep 17 00:00:00 2001 From: Martin Rotter Date: Wed, 3 Mar 2021 09:47:44 +0100 Subject: [PATCH] save --- .../services/standard/standardcategory.h | 21 ++++++------------ .../services/standard/standardfeed.h | 22 +++++++++---------- 2 files changed, 18 insertions(+), 25 deletions(-) diff --git a/src/librssguard/services/standard/standardcategory.h b/src/librssguard/services/standard/standardcategory.h index 6dcd23457..57f59afc0 100644 --- a/src/librssguard/services/standard/standardcategory.h +++ b/src/librssguard/services/standard/standardcategory.h @@ -5,15 +5,10 @@ #include "services/abstract/category.h" -#include #include -class FeedsModel; class StandardServiceRoot; -// Base class for all categories contained in FeedsModel. -// NOTE: This class should be derived to create PARTICULAR category types. -// NOTE: This class should not be instantiated directly. class StandardCategory : public Category { Q_OBJECT @@ -25,16 +20,14 @@ class StandardCategory : public Category { StandardServiceRoot* serviceRoot() const; - // Returns the actual data representation of standard category. - Qt::ItemFlags additionalFlags() const; - bool performDragDropChange(RootItem* target_item); - - bool canBeEdited() const; - bool canBeDeleted() const; - - bool editViaGui(); - bool deleteViaGui(); + virtual Qt::ItemFlags additionalFlags() const; + virtual bool performDragDropChange(RootItem* target_item); + virtual bool canBeEdited() const; + virtual bool editViaGui(); + virtual bool canBeDeleted() const; + virtual bool deleteViaGui(); + private: bool removeItself(); }; diff --git a/src/librssguard/services/standard/standardfeed.h b/src/librssguard/services/standard/standardfeed.h index b478372c8..3078145aa 100644 --- a/src/librssguard/services/standard/standardfeed.h +++ b/src/librssguard/services/standard/standardfeed.h @@ -20,6 +20,8 @@ class StandardServiceRoot; class StandardFeed : public Feed { Q_OBJECT + friend class StandardCategory; + public: enum class SourceType { Url = 0, @@ -35,16 +37,12 @@ class StandardFeed : public Feed { Json = 4 }; - // Constructors and destructors. explicit StandardFeed(RootItem* parent_item = nullptr); explicit StandardFeed(const StandardFeed& other); explicit StandardFeed(const QSqlRecord& record); virtual ~StandardFeed(); - StandardServiceRoot* serviceRoot() const; - QList contextMenuFeedsList(); - QString additionalTooltip() const; bool canBeDeleted() const; @@ -59,8 +57,6 @@ class StandardFeed : public Feed { Qt::ItemFlags additionalFlags() const; bool performDragDropChange(RootItem* target_item); - bool removeItself(); - // Other getters/setters. Type type() const; void setType(Type type); @@ -87,15 +83,11 @@ class StandardFeed : public Feed { QList obtainNewMessages(bool* error_during_obtaining); - static QStringList prepareExecutionLine(const QString& execution_line); - static QString generateFeedFileWithScript(const QString& execution_line, int run_timeout); - static QString postProcessFeedFileWithScript(const QString& execution_line, const QString raw_feed_data, int run_timeout); - // Tries to guess feed hidden under given URL // and uses given credentials. // Returns pointer to guessed feed (if at least partially // guessed) and retrieved error/status code from network layer - // or NULL feed. + // or nullptr feed. static StandardFeed* guessFeed(SourceType source_type, const QString& url, const QString& post_process_script, @@ -112,6 +104,14 @@ class StandardFeed : public Feed { void fetchMetadataForItself(); private: + StandardServiceRoot* serviceRoot() const; + bool removeItself(); + + static QStringList prepareExecutionLine(const QString& execution_line); + static QString generateFeedFileWithScript(const QString& execution_line, int run_timeout); + static QString postProcessFeedFileWithScript(const QString& execution_line, + const QString raw_feed_data, + int run_timeout); static QString runScriptProcess(const QStringList& cmd_args, const QString& working_directory, int run_timeout, bool provide_input, const QString& input = {});