save
This commit is contained in:
parent
f29ea98bbb
commit
ddf5475b5f
@ -5,15 +5,10 @@
|
|||||||
|
|
||||||
#include "services/abstract/category.h"
|
#include "services/abstract/category.h"
|
||||||
|
|
||||||
#include <QCoreApplication>
|
|
||||||
#include <QSqlRecord>
|
#include <QSqlRecord>
|
||||||
|
|
||||||
class FeedsModel;
|
|
||||||
class StandardServiceRoot;
|
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 {
|
class StandardCategory : public Category {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -25,16 +20,14 @@ class StandardCategory : public Category {
|
|||||||
|
|
||||||
StandardServiceRoot* serviceRoot() const;
|
StandardServiceRoot* serviceRoot() const;
|
||||||
|
|
||||||
// Returns the actual data representation of standard category.
|
virtual Qt::ItemFlags additionalFlags() const;
|
||||||
Qt::ItemFlags additionalFlags() const;
|
virtual bool performDragDropChange(RootItem* target_item);
|
||||||
bool performDragDropChange(RootItem* target_item);
|
virtual bool canBeEdited() const;
|
||||||
|
virtual bool editViaGui();
|
||||||
bool canBeEdited() const;
|
virtual bool canBeDeleted() const;
|
||||||
bool canBeDeleted() const;
|
virtual bool deleteViaGui();
|
||||||
|
|
||||||
bool editViaGui();
|
|
||||||
bool deleteViaGui();
|
|
||||||
|
|
||||||
|
private:
|
||||||
bool removeItself();
|
bool removeItself();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -20,6 +20,8 @@ class StandardServiceRoot;
|
|||||||
class StandardFeed : public Feed {
|
class StandardFeed : public Feed {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
friend class StandardCategory;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum class SourceType {
|
enum class SourceType {
|
||||||
Url = 0,
|
Url = 0,
|
||||||
@ -35,16 +37,12 @@ class StandardFeed : public Feed {
|
|||||||
Json = 4
|
Json = 4
|
||||||
};
|
};
|
||||||
|
|
||||||
// Constructors and destructors.
|
|
||||||
explicit StandardFeed(RootItem* parent_item = nullptr);
|
explicit StandardFeed(RootItem* parent_item = nullptr);
|
||||||
explicit StandardFeed(const StandardFeed& other);
|
explicit StandardFeed(const StandardFeed& other);
|
||||||
explicit StandardFeed(const QSqlRecord& record);
|
explicit StandardFeed(const QSqlRecord& record);
|
||||||
virtual ~StandardFeed();
|
virtual ~StandardFeed();
|
||||||
|
|
||||||
StandardServiceRoot* serviceRoot() const;
|
|
||||||
|
|
||||||
QList<QAction*> contextMenuFeedsList();
|
QList<QAction*> contextMenuFeedsList();
|
||||||
|
|
||||||
QString additionalTooltip() const;
|
QString additionalTooltip() const;
|
||||||
|
|
||||||
bool canBeDeleted() const;
|
bool canBeDeleted() const;
|
||||||
@ -59,8 +57,6 @@ class StandardFeed : public Feed {
|
|||||||
Qt::ItemFlags additionalFlags() const;
|
Qt::ItemFlags additionalFlags() const;
|
||||||
bool performDragDropChange(RootItem* target_item);
|
bool performDragDropChange(RootItem* target_item);
|
||||||
|
|
||||||
bool removeItself();
|
|
||||||
|
|
||||||
// Other getters/setters.
|
// Other getters/setters.
|
||||||
Type type() const;
|
Type type() const;
|
||||||
void setType(Type type);
|
void setType(Type type);
|
||||||
@ -87,15 +83,11 @@ class StandardFeed : public Feed {
|
|||||||
|
|
||||||
QList<Message> obtainNewMessages(bool* error_during_obtaining);
|
QList<Message> 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
|
// Tries to guess feed hidden under given URL
|
||||||
// and uses given credentials.
|
// and uses given credentials.
|
||||||
// Returns pointer to guessed feed (if at least partially
|
// Returns pointer to guessed feed (if at least partially
|
||||||
// guessed) and retrieved error/status code from network layer
|
// guessed) and retrieved error/status code from network layer
|
||||||
// or NULL feed.
|
// or nullptr feed.
|
||||||
static StandardFeed* guessFeed(SourceType source_type,
|
static StandardFeed* guessFeed(SourceType source_type,
|
||||||
const QString& url,
|
const QString& url,
|
||||||
const QString& post_process_script,
|
const QString& post_process_script,
|
||||||
@ -112,6 +104,14 @@ class StandardFeed : public Feed {
|
|||||||
void fetchMetadataForItself();
|
void fetchMetadataForItself();
|
||||||
|
|
||||||
private:
|
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,
|
static QString runScriptProcess(const QStringList& cmd_args, const QString& working_directory,
|
||||||
int run_timeout, bool provide_input, const QString& input = {});
|
int run_timeout, bool provide_input, const QString& input = {});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user