rename url -> source, start adding custom data API to feeds too
This commit is contained in:
parent
6558b9ea03
commit
0610e17128
28 changed files with 97 additions and 67 deletions
|
@ -37,16 +37,9 @@ CREATE TABLE Feeds (
|
|||
date_created INTEGER,
|
||||
icon BLOB,
|
||||
category INTEGER NOT NULL CHECK (category >= -1), /* Root feeds contain -1 here. */
|
||||
encoding TEXT,
|
||||
source_type INTEGER,
|
||||
url TEXT,
|
||||
post_process TEXT,
|
||||
protected INTEGER(1) NOT NULL CHECK (protected >= 0 AND protected <= 1),
|
||||
username TEXT,
|
||||
password TEXT,
|
||||
source TEXT,
|
||||
update_type INTEGER(1) NOT NULL CHECK (update_type >= 0),
|
||||
update_interval INTEGER NOT NULL DEFAULT 15 CHECK (update_interval >= 1),
|
||||
type INTEGER,
|
||||
account_id INTEGER NOT NULL,
|
||||
custom_id TEXT,
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ void FeedDownloader::stopRunningUpdate() {
|
|||
void FeedDownloader::updateOneFeed(Feed* feed) {
|
||||
qDebugNN << LOGSEC_FEEDDOWNLOADER
|
||||
<< "Downloading new messages for feed ID '"
|
||||
<< feed->customId() << "' URL: '" << feed->url() << "' title: '" << feed->title() << "' in thread: '"
|
||||
<< feed->customId() << "' URL: '" << feed->source() << "' title: '" << feed->title() << "' in thread: '"
|
||||
<< QThread::currentThreadId() << "'.";
|
||||
|
||||
bool error_during_obtaining = false;
|
||||
|
@ -123,7 +123,7 @@ void FeedDownloader::updateOneFeed(Feed* feed) {
|
|||
QList<Message> msgs = feed->obtainNewMessages(&error_during_obtaining);
|
||||
|
||||
qDebugNN << LOGSEC_FEEDDOWNLOADER << "Downloaded " << msgs.size() << " messages for feed ID '"
|
||||
<< feed->customId() << "' URL: '" << feed->url() << "' title: '" << feed->title() << "' in thread: '"
|
||||
<< feed->customId() << "' URL: '" << feed->source() << "' title: '" << feed->title() << "' in thread: '"
|
||||
<< QThread::currentThreadId() << "'. Operation took " << tmr.nsecsElapsed() / 1000 << " microseconds.";
|
||||
|
||||
// Now, sanitize messages (tweak encoding etc.).
|
||||
|
@ -290,7 +290,7 @@ void FeedDownloader::updateOneFeed(Feed* feed) {
|
|||
|
||||
// Now make sure, that messages are actually stored to SQL in a locked state.
|
||||
qDebugNN << LOGSEC_FEEDDOWNLOADER << "Saving messages of feed ID '"
|
||||
<< feed->customId() << "' URL: '" << feed->url() << "' title: '" << feed->title() << "' in thread: '"
|
||||
<< feed->customId() << "' URL: '" << feed->source() << "' title: '" << feed->title() << "' in thread: '"
|
||||
<< QThread::currentThreadId() << "'.";
|
||||
|
||||
int updated_messages = feed->updateMessages(msgs, error_during_obtaining);
|
||||
|
|
|
@ -133,8 +133,8 @@ void FeedsView::copyUrlOfSelectedFeeds() const {
|
|||
QStringList urls;
|
||||
|
||||
for (const auto* feed : feeds) {
|
||||
if (!feed->url().isEmpty()) {
|
||||
urls << feed->url();
|
||||
if (!feed->source().isEmpty()) {
|
||||
urls << feed->source();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1510,7 +1510,7 @@ bool DatabaseQueries::storeAccountTree(const QSqlDatabase& db, RootItem* tree_ro
|
|||
|
||||
query_feed.bindValue(QSL(":title"), feed->title());
|
||||
query_feed.bindValue(QSL(":icon"), qApp->icons()->toByteArray(feed->icon()));
|
||||
query_feed.bindValue(QSL(":url"), feed->url());
|
||||
query_feed.bindValue(QSL(":url"), feed->source());
|
||||
query_feed.bindValue(QSL(":category"), feed->parent()->id());
|
||||
query_feed.bindValue(QSL(":protected"), 0);
|
||||
query_feed.bindValue(QSL(":update_type"), int(feed->autoUpdateType()));
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include <QThread>
|
||||
|
||||
Feed::Feed(RootItem* parent)
|
||||
: RootItem(parent), m_url(QString()), m_status(Status::Normal), m_autoUpdateType(AutoUpdateType::DefaultAutoUpdate),
|
||||
: RootItem(parent), m_source(QString()), m_status(Status::Normal), m_autoUpdateType(AutoUpdateType::DefaultAutoUpdate),
|
||||
m_autoUpdateInitialInterval(DEFAULT_AUTO_UPDATE_INTERVAL), m_autoUpdateRemainingInterval(DEFAULT_AUTO_UPDATE_INTERVAL),
|
||||
m_messageFilters(QList<QPointer<MessageFilter>>()) {
|
||||
|
||||
|
@ -33,7 +33,7 @@ Feed::Feed(RootItem* parent)
|
|||
Feed::Feed(const QSqlRecord& record) : Feed(nullptr) {
|
||||
setTitle(record.value(FDS_DB_TITLE_INDEX).toString());
|
||||
setId(record.value(FDS_DB_ID_INDEX).toInt());
|
||||
setUrl(record.value(FDS_DB_URL_INDEX).toString());
|
||||
setSource(record.value(FDS_DB_URL_INDEX).toString());
|
||||
setCustomId(record.value(FDS_DB_CUSTOM_ID_INDEX).toString());
|
||||
|
||||
if (customId().isEmpty()) {
|
||||
|
@ -66,7 +66,7 @@ Feed::Feed(const Feed& other) : RootItem(other) {
|
|||
|
||||
setCountOfAllMessages(other.countOfAllMessages());
|
||||
setCountOfUnreadMessages(other.countOfUnreadMessages());
|
||||
setUrl(other.url());
|
||||
setSource(other.source());
|
||||
setStatus(other.status());
|
||||
setAutoUpdateType(other.autoUpdateType());
|
||||
setAutoUpdateInitialInterval(other.autoUpdateInitialInterval());
|
||||
|
@ -144,6 +144,14 @@ int Feed::countOfUnreadMessages() const {
|
|||
return m_unreadCount;
|
||||
}
|
||||
|
||||
QVariantHash Feed::customDatabaseData() const {
|
||||
return {};
|
||||
}
|
||||
|
||||
void Feed::setCustomDatabaseData(const QVariantHash& data) {
|
||||
Q_UNUSED(data)
|
||||
}
|
||||
|
||||
void Feed::setCountOfAllMessages(int count_all_messages) {
|
||||
m_totalCount = count_all_messages;
|
||||
}
|
||||
|
@ -218,12 +226,12 @@ void Feed::setStatus(const Feed::Status& status) {
|
|||
m_status = status;
|
||||
}
|
||||
|
||||
QString Feed::url() const {
|
||||
return m_url;
|
||||
QString Feed::source() const {
|
||||
return m_source;
|
||||
}
|
||||
|
||||
void Feed::setUrl(const QString& url) {
|
||||
m_url = url;
|
||||
void Feed::setSource(const QString& source) {
|
||||
m_source = source;
|
||||
}
|
||||
|
||||
void Feed::appendMessageFilter(MessageFilter* filter) {
|
||||
|
@ -290,7 +298,7 @@ int Feed::updateMessages(const QList<Message>& messages, bool error_during_obtai
|
|||
qApp->database()->connection(QSL("feed_upd"));
|
||||
|
||||
updated_messages = DatabaseQueries::updateMessages(database, messages, custom_id, account_id,
|
||||
url(), force_update, &anything_updated, &ok);
|
||||
source(), force_update, &anything_updated, &ok);
|
||||
}
|
||||
else {
|
||||
qDebugNN << LOGSEC_CORE
|
||||
|
|
|
@ -49,6 +49,8 @@ class Feed : public RootItem {
|
|||
virtual QList<Message> obtainNewMessages(bool* error_during_obtaining);
|
||||
virtual int countOfAllMessages() const;
|
||||
virtual int countOfUnreadMessages() const;
|
||||
virtual QVariantHash customDatabaseData() const;
|
||||
virtual void setCustomDatabaseData(const QVariantHash& data);
|
||||
|
||||
void setCountOfAllMessages(int count_all_messages);
|
||||
void setCountOfUnreadMessages(int count_unread_messages);
|
||||
|
@ -72,8 +74,8 @@ class Feed : public RootItem {
|
|||
Status status() const;
|
||||
void setStatus(const Status& status);
|
||||
|
||||
QString url() const;
|
||||
void setUrl(const QString& url);
|
||||
QString source() const;
|
||||
void setSource(const QString& source);
|
||||
|
||||
bool passwordProtected() const;
|
||||
void setPasswordProtected(bool passwordProtected);
|
||||
|
@ -99,7 +101,7 @@ class Feed : public RootItem {
|
|||
QString getStatusDescription() const;
|
||||
|
||||
private:
|
||||
QString m_url;
|
||||
QString m_source;
|
||||
Status m_status;
|
||||
AutoUpdateType m_autoUpdateType;
|
||||
int m_autoUpdateInitialInterval{};
|
||||
|
|
|
@ -288,7 +288,7 @@ QVariantHash ServiceRoot::customDatabaseData() const {
|
|||
return {};
|
||||
}
|
||||
|
||||
void ServiceRoot::setCustomDatabaseData(const QVariantHash& data) const {
|
||||
void ServiceRoot::setCustomDatabaseData(const QVariantHash& data) {
|
||||
Q_UNUSED(data)
|
||||
}
|
||||
|
||||
|
@ -524,7 +524,7 @@ QStringList ServiceRoot::textualFeedUrls(const QList<Feed*>& feeds) const {
|
|||
stringy_urls.reserve(feeds.size());
|
||||
|
||||
for (const Feed* feed : feeds) {
|
||||
stringy_urls.append(!feed->url().isEmpty() ? feed->url() : QL1S("no-url"));
|
||||
stringy_urls.append(!feed->source().isEmpty() ? feed->source() : QL1S("no-url"));
|
||||
}
|
||||
|
||||
return stringy_urls;
|
||||
|
|
|
@ -54,7 +54,7 @@ class ServiceRoot : public RootItem {
|
|||
virtual LabelOperation supportedLabelOperations() const;
|
||||
virtual void saveAccountDataToDatabase();
|
||||
virtual QVariantHash customDatabaseData() const;
|
||||
virtual void setCustomDatabaseData(const QVariantHash& json) const;
|
||||
virtual void setCustomDatabaseData(const QVariantHash& data);
|
||||
|
||||
// Returns list of specific actions for "Add new item" main window menu.
|
||||
// So typical list of returned actions could look like:
|
||||
|
|
|
@ -60,7 +60,7 @@ QVariantHash FeedlyServiceRoot::customDatabaseData() const {
|
|||
return data;
|
||||
}
|
||||
|
||||
void FeedlyServiceRoot::setCustomDatabaseData(const QVariantHash& data) const {
|
||||
void FeedlyServiceRoot::setCustomDatabaseData(const QVariantHash& data) {
|
||||
m_network->setUsername(data["username"].toString());
|
||||
m_network->setDeveloperAccessToken(data["dat"].toString());
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ class FeedlyServiceRoot : public ServiceRoot, public CacheForServiceRoot {
|
|||
virtual void saveAllCachedData(bool ignore_errors);
|
||||
virtual LabelOperation supportedLabelOperations() const;
|
||||
virtual QVariantHash customDatabaseData() const;
|
||||
virtual void setCustomDatabaseData(const QVariantHash& data) const;
|
||||
virtual void setCustomDatabaseData(const QVariantHash& data);
|
||||
|
||||
FeedlyNetwork* network() const;
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ QVariantHash GmailServiceRoot::customDatabaseData() const {
|
|||
return data;
|
||||
}
|
||||
|
||||
void GmailServiceRoot::setCustomDatabaseData(const QVariantHash& data) const {
|
||||
void GmailServiceRoot::setCustomDatabaseData(const QVariantHash& data) {
|
||||
m_network->setUsername(data["username"].toString());
|
||||
m_network->setBatchSize(data["batch_size"].toInt());
|
||||
m_network->oauth()->setClientId(data["client_id"].toString());
|
||||
|
|
|
@ -30,7 +30,7 @@ class GmailServiceRoot : public ServiceRoot, public CacheForServiceRoot {
|
|||
virtual QString additionalTooltip() const;
|
||||
virtual void saveAllCachedData(bool ignore_errors);
|
||||
virtual QVariantHash customDatabaseData() const;
|
||||
virtual void setCustomDatabaseData(const QVariantHash& data) const;
|
||||
virtual void setCustomDatabaseData(const QVariantHash& data);
|
||||
|
||||
protected:
|
||||
virtual RootItem* obtainNewTreeForSyncIn() const;
|
||||
|
|
|
@ -292,7 +292,7 @@ RootItem* GreaderNetwork::decodeTagsSubscriptions(const QString& categories, con
|
|||
auto* feed = new GreaderFeed();
|
||||
|
||||
feed->setDescription(url);
|
||||
feed->setUrl(url);
|
||||
feed->setSource(url);
|
||||
feed->setTitle(title);
|
||||
feed->setCustomId(id);
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ QVariantHash GreaderServiceRoot::customDatabaseData() const {
|
|||
return data;
|
||||
}
|
||||
|
||||
void GreaderServiceRoot::setCustomDatabaseData(const QVariantHash& data) const {
|
||||
void GreaderServiceRoot::setCustomDatabaseData(const QVariantHash& data) {
|
||||
m_network->setService(GreaderServiceRoot::Service(data["service"].toInt()));
|
||||
m_network->setUsername(data["username"].toString());
|
||||
TextFactory::decrypt(data["password"].toString());
|
||||
|
|
|
@ -30,7 +30,7 @@ class GreaderServiceRoot : public ServiceRoot, public CacheForServiceRoot {
|
|||
virtual void saveAllCachedData(bool ignore_errors);
|
||||
virtual LabelOperation supportedLabelOperations() const;
|
||||
virtual QVariantHash customDatabaseData() const;
|
||||
virtual void setCustomDatabaseData(const QVariantHash& data) const;
|
||||
virtual void setCustomDatabaseData(const QVariantHash& data);
|
||||
|
||||
GreaderNetwork* network() const;
|
||||
|
||||
|
|
|
@ -421,7 +421,7 @@ RootItem* InoreaderNetworkFactory::decodeFeedCategoriesData(const QString& categ
|
|||
auto* feed = new InoreaderFeed();
|
||||
|
||||
feed->setDescription(url);
|
||||
feed->setUrl(url);
|
||||
feed->setSource(url);
|
||||
feed->setTitle(title);
|
||||
feed->setCustomId(id);
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ QVariantHash InoreaderServiceRoot::customDatabaseData() const {
|
|||
return data;
|
||||
}
|
||||
|
||||
void InoreaderServiceRoot::setCustomDatabaseData(const QVariantHash& data) const {
|
||||
void InoreaderServiceRoot::setCustomDatabaseData(const QVariantHash& data) {
|
||||
m_network->setUsername(data["username"].toString());
|
||||
m_network->setBatchSize(data["batch_size"].toInt());
|
||||
m_network->oauth()->setClientId(data["client_id"].toString());
|
||||
|
|
|
@ -28,7 +28,7 @@ class InoreaderServiceRoot : public ServiceRoot, public CacheForServiceRoot {
|
|||
virtual QString additionalTooltip() const;
|
||||
virtual void saveAllCachedData(bool ignore_errors);
|
||||
virtual QVariantHash customDatabaseData() const;
|
||||
virtual void setCustomDatabaseData(const QVariantHash& data) const;
|
||||
virtual void setCustomDatabaseData(const QVariantHash& data);
|
||||
|
||||
protected:
|
||||
virtual RootItem* obtainNewTreeForSyncIn() const;
|
||||
|
|
|
@ -531,16 +531,16 @@ RootItem* OwnCloudGetFeedsCategoriesResponse::feedsCategories(bool obtain_icons)
|
|||
}
|
||||
|
||||
feed->setCustomId(QString::number(item["id"].toInt()));
|
||||
feed->setUrl(item["url"].toString());
|
||||
feed->setSource(item["url"].toString());
|
||||
|
||||
if (feed->url().isEmpty()) {
|
||||
feed->setUrl(item["link"].toString());
|
||||
if (feed->source().isEmpty()) {
|
||||
feed->setSource(item["link"].toString());
|
||||
}
|
||||
|
||||
feed->setTitle(item["title"].toString());
|
||||
|
||||
if (feed->title().isEmpty()) {
|
||||
if (feed->url().isEmpty()) {
|
||||
if (feed->source().isEmpty()) {
|
||||
// We cannot add feed which has no title and no url to RSS Guard!!!
|
||||
qCriticalNN << LOGSEC_NEXTCLOUD
|
||||
<< "Skipping feed with custom ID"
|
||||
|
@ -549,7 +549,7 @@ RootItem* OwnCloudGetFeedsCategoriesResponse::feedsCategories(bool obtain_icons)
|
|||
continue;
|
||||
}
|
||||
else {
|
||||
feed->setTitle(feed->url());
|
||||
feed->setTitle(feed->source());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -140,7 +140,7 @@ QVariantHash OwnCloudServiceRoot::customDatabaseData() const {
|
|||
return data;
|
||||
}
|
||||
|
||||
void OwnCloudServiceRoot::setCustomDatabaseData(const QVariantHash& data) const {
|
||||
void OwnCloudServiceRoot::setCustomDatabaseData(const QVariantHash& data) {
|
||||
m_network->setAuthUsername(data["auth_username"].toString());
|
||||
m_network->setAuthPassword(TextFactory::decrypt(data["auth_password"].toString()));
|
||||
m_network->setUrl(data["url"].toString());
|
||||
|
|
|
@ -27,7 +27,7 @@ class OwnCloudServiceRoot : public ServiceRoot, public CacheForServiceRoot {
|
|||
virtual QString code() const;
|
||||
virtual void saveAllCachedData(bool ignore_errors);
|
||||
virtual QVariantHash customDatabaseData() const;
|
||||
virtual void setCustomDatabaseData(const QVariantHash& data) const;
|
||||
virtual void setCustomDatabaseData(const QVariantHash& data);
|
||||
|
||||
OwnCloudNetworkFactory* network() const;
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ void FormStandardFeedDetails::apply() {
|
|||
new_feed->setType(type);
|
||||
new_feed->setSourceType(m_standardFeedDetails->sourceType());
|
||||
new_feed->setPostProcessScript(m_standardFeedDetails->m_ui.m_txtPostProcessScript->textEdit()->toPlainText());
|
||||
new_feed->setUrl(m_standardFeedDetails->m_ui.m_txtSource->textEdit()->toPlainText());
|
||||
new_feed->setSource(m_standardFeedDetails->m_ui.m_txtSource->textEdit()->toPlainText());
|
||||
new_feed->setPasswordProtected(m_authDetails->m_gbAuthentication->isChecked());
|
||||
new_feed->setUsername(m_authDetails->m_txtUsername->lineEdit()->text());
|
||||
new_feed->setPassword(m_authDetails->m_txtPassword->lineEdit()->text());
|
||||
|
|
|
@ -329,7 +329,7 @@ void StandardFeedDetails::setExistingFeed(StandardFeed* feed) {
|
|||
m_ui.m_txtTitle->lineEdit()->setText(feed->title());
|
||||
m_ui.m_txtDescription->lineEdit()->setText(feed->description());
|
||||
m_ui.m_btnIcon->setIcon(feed->icon());
|
||||
m_ui.m_txtSource->textEdit()->setPlainText(feed->url());
|
||||
m_ui.m_txtSource->textEdit()->setPlainText(feed->source());
|
||||
m_ui.m_txtPostProcessScript->textEdit()->setPlainText(feed->postProcessScript());
|
||||
m_ui.m_cmbType->setCurrentIndex(m_ui.m_cmbType->findData(QVariant::fromValue(int(feed->type()))));
|
||||
m_ui.m_cmbEncoding->setCurrentIndex(m_ui.m_cmbEncoding->findData(feed->encoding(),
|
||||
|
|
|
@ -98,6 +98,30 @@ bool StandardFeed::deleteViaGui() {
|
|||
}
|
||||
}
|
||||
|
||||
QVariantHash StandardFeed::customDatabaseData() const {
|
||||
QVariantHash data;
|
||||
|
||||
data["source_type"] = int(sourceType());
|
||||
data["type"] = int(type());
|
||||
data["encoding"] = encoding();
|
||||
data["post_process"] = postProcessScript();
|
||||
data["protected"] = passwordProtected();
|
||||
data["username"] = username();
|
||||
data["password"] = TextFactory::encrypt(password());
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
void StandardFeed::setCustomDatabaseData(const QVariantHash& data) {
|
||||
setSourceType(SourceType(data["source_type"].toInt()));
|
||||
setType(Type(data["type"].toInt()));
|
||||
setEncoding(data["encoding"].toString());
|
||||
setPostProcessScript(data["post_process"].toString());
|
||||
setPasswordProtected(data["protected"].toBool());
|
||||
setUsername(data["username"].toString());
|
||||
setPassword(TextFactory::decrypt(data["password"].toString()));
|
||||
}
|
||||
|
||||
QString StandardFeed::typeToString(StandardFeed::Type type) {
|
||||
switch (type) {
|
||||
case Type::Atom10:
|
||||
|
@ -137,7 +161,7 @@ QString StandardFeed::sourceTypeToString(StandardFeed::SourceType type) {
|
|||
void StandardFeed::fetchMetadataForItself() {
|
||||
bool result;
|
||||
StandardFeed* metadata = guessFeed(sourceType(),
|
||||
url(),
|
||||
source(),
|
||||
postProcessScript(),
|
||||
&result,
|
||||
username(),
|
||||
|
@ -147,7 +171,7 @@ void StandardFeed::fetchMetadataForItself() {
|
|||
if (metadata != nullptr && result) {
|
||||
// Some properties are not updated when new metadata are fetched.
|
||||
metadata->setParent(parent());
|
||||
metadata->setUrl(url());
|
||||
metadata->setSource(source());
|
||||
metadata->setPasswordProtected(passwordProtected());
|
||||
metadata->setUsername(username());
|
||||
metadata->setPassword(password());
|
||||
|
@ -181,7 +205,7 @@ StandardFeed::SourceType StandardFeed::sourceType() const {
|
|||
return m_sourceType;
|
||||
}
|
||||
|
||||
void StandardFeed::setSourceType(const SourceType& source_type) {
|
||||
void StandardFeed::setSourceType(SourceType source_type) {
|
||||
m_sourceType = source_type;
|
||||
}
|
||||
|
||||
|
@ -478,7 +502,7 @@ bool StandardFeed::addItself(RootItem* parent) {
|
|||
QSqlDatabase database = qApp->database()->connection(metaObject()->className());
|
||||
bool ok;
|
||||
int new_id = DatabaseQueries::addStandardFeed(database, parent->id(), parent->getParentServiceRoot()->accountId(),
|
||||
title(), description(), creationDate(), icon(), encoding(), url(),
|
||||
title(), description(), creationDate(), icon(), encoding(), source(),
|
||||
passwordProtected(), username(), password(), autoUpdateType(),
|
||||
autoUpdateInitialInterval(), sourceType(), postProcessScript(),
|
||||
type(), &ok);
|
||||
|
@ -502,7 +526,7 @@ bool StandardFeed::editItself(StandardFeed* new_feed_data) {
|
|||
|
||||
if (!DatabaseQueries::editStandardFeed(database, new_parent->id(), original_feed->id(), new_feed_data->title(),
|
||||
new_feed_data->description(), new_feed_data->icon(),
|
||||
new_feed_data->encoding(), new_feed_data->url(), new_feed_data->passwordProtected(),
|
||||
new_feed_data->encoding(), new_feed_data->source(), new_feed_data->passwordProtected(),
|
||||
new_feed_data->username(), new_feed_data->password(),
|
||||
new_feed_data->autoUpdateType(), new_feed_data->autoUpdateInitialInterval(),
|
||||
new_feed_data->sourceType(), new_feed_data->postProcessScript(),
|
||||
|
@ -519,7 +543,7 @@ bool StandardFeed::editItself(StandardFeed* new_feed_data) {
|
|||
original_feed->setIcon(new_feed_data->icon());
|
||||
original_feed->setEncoding(new_feed_data->encoding());
|
||||
original_feed->setDescription(new_feed_data->description());
|
||||
original_feed->setUrl(new_feed_data->url());
|
||||
original_feed->setSource(new_feed_data->source());
|
||||
original_feed->setPasswordProtected(new_feed_data->passwordProtected());
|
||||
original_feed->setUsername(new_feed_data->username());
|
||||
original_feed->setPassword(new_feed_data->password());
|
||||
|
@ -556,14 +580,14 @@ QList<Message> StandardFeed::obtainNewMessages(bool* error_during_obtaining) {
|
|||
if (sourceType() == SourceType::Url) {
|
||||
qDebugNN << LOGSEC_CORE
|
||||
<< "Downloading URL"
|
||||
<< QUOTE_W_SPACE(url())
|
||||
<< QUOTE_W_SPACE(source())
|
||||
<< "to obtain feed data.";
|
||||
|
||||
QByteArray feed_contents;
|
||||
QList<QPair<QByteArray, QByteArray>> headers;
|
||||
|
||||
headers << NetworkFactory::generateBasicAuthHeader(username(), password());
|
||||
m_networkError = NetworkFactory::performNetworkOperation(url(),
|
||||
m_networkError = NetworkFactory::performNetworkOperation(source(),
|
||||
download_timeout,
|
||||
QByteArray(),
|
||||
feed_contents,
|
||||
|
@ -579,7 +603,7 @@ QList<Message> StandardFeed::obtainNewMessages(bool* error_during_obtaining) {
|
|||
<< "Error"
|
||||
<< QUOTE_W_SPACE(m_networkError)
|
||||
<< "during fetching of new messages for feed"
|
||||
<< QUOTE_W_SPACE_DOT(url());
|
||||
<< QUOTE_W_SPACE_DOT(source());
|
||||
setStatus(Status::NetworkError);
|
||||
*error_during_obtaining = true;
|
||||
return QList<Message>();
|
||||
|
@ -603,12 +627,12 @@ QList<Message> StandardFeed::obtainNewMessages(bool* error_during_obtaining) {
|
|||
else {
|
||||
qDebugNN << LOGSEC_CORE
|
||||
<< "Running custom script"
|
||||
<< QUOTE_W_SPACE(url())
|
||||
<< QUOTE_W_SPACE(source())
|
||||
<< "to obtain feed data.";
|
||||
|
||||
// Use script to generate feed file.
|
||||
try {
|
||||
formatted_feed_contents = generateFeedFileWithScript(url(), download_timeout);
|
||||
formatted_feed_contents = generateFeedFileWithScript(source(), download_timeout);
|
||||
}
|
||||
catch (const ScriptException& ex) {
|
||||
qCriticalNN << LOGSEC_CORE
|
||||
|
|
|
@ -53,6 +53,9 @@ class StandardFeed : public Feed {
|
|||
bool editViaGui();
|
||||
bool deleteViaGui();
|
||||
|
||||
virtual QVariantHash customDatabaseData() const;
|
||||
virtual void setCustomDatabaseData(const QVariantHash& data);
|
||||
|
||||
// Obtains data related to this feed.
|
||||
Qt::ItemFlags additionalFlags() const;
|
||||
bool performDragDropChange(RootItem* target_item);
|
||||
|
@ -66,7 +69,7 @@ class StandardFeed : public Feed {
|
|||
void setType(Type type);
|
||||
|
||||
SourceType sourceType() const;
|
||||
void setSourceType(const SourceType& source_type);
|
||||
void setSourceType(SourceType source_type);
|
||||
|
||||
QString encoding() const;
|
||||
void setEncoding(const QString& encoding);
|
||||
|
|
|
@ -89,7 +89,7 @@ bool FeedsImportExportModel::exportToOMPL20(QByteArray& result) {
|
|||
|
||||
outline_feed.setAttribute(QSL("type"), QSL("rss"));
|
||||
outline_feed.setAttribute(QSL("text"), child_feed->title());
|
||||
outline_feed.setAttribute(QSL("xmlUrl"), child_feed->url());
|
||||
outline_feed.setAttribute(QSL("xmlUrl"), child_feed->source());
|
||||
outline_feed.setAttribute(QSL("description"), child_feed->description());
|
||||
outline_feed.setAttribute(QSL("encoding"), child_feed->encoding());
|
||||
outline_feed.setAttribute(QSL("title"), child_feed->title());
|
||||
|
@ -196,7 +196,7 @@ void FeedsImportExportModel::importAsOPML20(const QByteArray& data, bool fetch_m
|
|||
custom_proxy)) != nullptr &&
|
||||
result) {
|
||||
// We should obtain fresh metadata from online feed source.
|
||||
guessed->setUrl(feed_url);
|
||||
guessed->setSource(feed_url);
|
||||
active_model_item->appendChild(guessed);
|
||||
succeded++;
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ void FeedsImportExportModel::importAsOPML20(const QByteArray& data, bool fetch_m
|
|||
new_feed->setTitle(feed_title);
|
||||
new_feed->setDescription(feed_description);
|
||||
new_feed->setEncoding(feed_encoding);
|
||||
new_feed->setUrl(feed_url);
|
||||
new_feed->setSource(feed_url);
|
||||
new_feed->setCreationDate(QDateTime::currentDateTime());
|
||||
new_feed->setIcon(feed_icon);
|
||||
|
||||
|
@ -285,7 +285,7 @@ void FeedsImportExportModel::importAsOPML20(const QByteArray& data, bool fetch_m
|
|||
|
||||
bool FeedsImportExportModel::exportToTxtURLPerLine(QByteArray& result) {
|
||||
for (const Feed* const feed : sourceModel()->rootItem()->getSubTreeFeeds()) {
|
||||
result += feed->url() + QL1S("\n");
|
||||
result += feed->source() + QL1S("\n");
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -318,14 +318,14 @@ void FeedsImportExportModel::importAsTxtURLPerLine(const QByteArray& data, bool
|
|||
url, {}, &result, {}, {},
|
||||
custom_proxy)) != nullptr &&
|
||||
result) {
|
||||
guessed->setUrl(url);
|
||||
guessed->setSource(url);
|
||||
root_item->appendChild(guessed);
|
||||
succeded++;
|
||||
}
|
||||
else {
|
||||
auto* feed = new StandardFeed();
|
||||
|
||||
feed->setUrl(url);
|
||||
feed->setSource(url);
|
||||
feed->setTitle(url);
|
||||
feed->setCreationDate(QDateTime::currentDateTime());
|
||||
feed->setIcon(qApp->icons()->fromTheme(QSL("application-rss+xml")));
|
||||
|
|
|
@ -200,7 +200,7 @@ QVariantHash TtRssServiceRoot::customDatabaseData() const {
|
|||
return data;
|
||||
}
|
||||
|
||||
void TtRssServiceRoot::setCustomDatabaseData(const QVariantHash& data) const {
|
||||
void TtRssServiceRoot::setCustomDatabaseData(const QVariantHash& data) {
|
||||
m_network->setUsername( data["username"].toString());
|
||||
m_network->setPassword(TextFactory::decrypt(data["password"].toString()));
|
||||
m_network->setAuthIsUsed(data["auth_protected"].toBool());
|
||||
|
|
|
@ -32,7 +32,7 @@ class TtRssServiceRoot : public ServiceRoot, public CacheForServiceRoot {
|
|||
virtual QString additionalTooltip() const;
|
||||
virtual void saveAllCachedData(bool ignore_errors);
|
||||
virtual QVariantHash customDatabaseData() const;
|
||||
virtual void setCustomDatabaseData(const QVariantHash& data) const;
|
||||
virtual void setCustomDatabaseData(const QVariantHash& data);
|
||||
|
||||
// Access to network.
|
||||
TtRssNetworkFactory* network() const;
|
||||
|
|
Loading…
Add table
Reference in a new issue