fix #1136
This commit is contained in:
parent
2b4f910953
commit
3f0f26e28e
@ -7486,17 +7486,17 @@ Also, you can post-process generated feed data with yet another script if you wi
|
|||||||
<translation>Error when loading initial feeds</translation>
|
<translation>Error when loading initial feeds</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/librssguard/services/standard/standardserviceroot.cpp" line="301"/>
|
<location filename="../src/librssguard/services/standard/standardserviceroot.cpp" line="308"/>
|
||||||
<source>Fetch metadata</source>
|
<source>Fetch metadata</source>
|
||||||
<translation>Fetch metadata</translation>
|
<translation>Fetch metadata</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/librssguard/services/standard/standardserviceroot.cpp" line="461"/>
|
<location filename="../src/librssguard/services/standard/standardserviceroot.cpp" line="468"/>
|
||||||
<source>Export feeds</source>
|
<source>Export feeds</source>
|
||||||
<translation>Export feeds</translation>
|
<translation>Export feeds</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/librssguard/services/standard/standardserviceroot.cpp" line="462"/>
|
<location filename="../src/librssguard/services/standard/standardserviceroot.cpp" line="469"/>
|
||||||
<source>Import feeds</source>
|
<source>Import feeds</source>
|
||||||
<translation>Import feeds</translation>
|
<translation>Import feeds</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -7521,22 +7521,22 @@ Also, you can post-process generated feed data with yet another script if you wi
|
|||||||
<translation>Cannot add feed because another critical operation is ongoing.</translation>
|
<translation>Cannot add feed because another critical operation is ongoing.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/librssguard/services/standard/standardserviceroot.cpp" line="427"/>
|
<location filename="../src/librssguard/services/standard/standardserviceroot.cpp" line="434"/>
|
||||||
<source>Cannot add category</source>
|
<source>Cannot add category</source>
|
||||||
<translation>Cannot add category</translation>
|
<translation>Cannot add category</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/librssguard/services/standard/standardserviceroot.cpp" line="428"/>
|
<location filename="../src/librssguard/services/standard/standardserviceroot.cpp" line="435"/>
|
||||||
<source>Cannot add category because another critical operation is ongoing.</source>
|
<source>Cannot add category because another critical operation is ongoing.</source>
|
||||||
<translation>Cannot add category because another critical operation is ongoing.</translation>
|
<translation>Cannot add category because another critical operation is ongoing.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/librssguard/services/standard/standardserviceroot.cpp" line="415"/>
|
<location filename="../src/librssguard/services/standard/standardserviceroot.cpp" line="422"/>
|
||||||
<source>Import was completely successful.</source>
|
<source>Import was completely successful.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/librssguard/services/standard/standardserviceroot.cpp" line="412"/>
|
<location filename="../src/librssguard/services/standard/standardserviceroot.cpp" line="419"/>
|
||||||
<source>Some feeds/categories were not imported due to error, check debug log for more details.</source>
|
<source>Some feeds/categories were not imported due to error, check debug log for more details.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -392,6 +392,12 @@ void FeedsModel::setupFonts() {
|
|||||||
m_boldStrikedFont.setStrikeOut(true);
|
m_boldStrikedFont.setStrikeOut(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FeedsModel::informAboutDatabaseCleanup() {
|
||||||
|
for (ServiceRoot* acc : serviceRoots()) {
|
||||||
|
acc->onDatabaseCleanup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void FeedsModel::reloadWholeLayout() {
|
void FeedsModel::reloadWholeLayout() {
|
||||||
emit layoutAboutToBeChanged();
|
emit layoutAboutToBeChanged();
|
||||||
emit layoutChanged();
|
emit layoutChanged();
|
||||||
|
@ -79,6 +79,7 @@ class RSSGUARD_DLLSPEC FeedsModel : public QAbstractItemModel {
|
|||||||
RootItem* rootItem() const;
|
RootItem* rootItem() const;
|
||||||
|
|
||||||
void setupFonts();
|
void setupFonts();
|
||||||
|
void informAboutDatabaseCleanup();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void loadActivatedServiceAccounts();
|
void loadActivatedServiceAccounts();
|
||||||
|
@ -145,6 +145,7 @@ void FormMain::showDbCleanupAssistant() {
|
|||||||
// Reload needed stuff.
|
// Reload needed stuff.
|
||||||
qApp->feedUpdateLock()->unlock();
|
qApp->feedUpdateLock()->unlock();
|
||||||
tabWidget()->feedMessageViewer()->messagesView()->reloadSelections();
|
tabWidget()->feedMessageViewer()->messagesView()->reloadSelections();
|
||||||
|
qApp->feedReader()->feedsModel()->informAboutDatabaseCleanup();
|
||||||
qApp->feedReader()->feedsModel()->reloadCountsOfWholeModel();
|
qApp->feedReader()->feedsModel()->reloadCountsOfWholeModel();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -479,6 +479,8 @@ UnreadNode* ServiceRoot::unreadNode() const {
|
|||||||
return m_unreadNode;
|
return m_unreadNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ServiceRoot::onDatabaseCleanup() {}
|
||||||
|
|
||||||
void ServiceRoot::syncIn() {
|
void ServiceRoot::syncIn() {
|
||||||
QIcon original_icon = icon();
|
QIcon original_icon = icon();
|
||||||
|
|
||||||
|
@ -59,6 +59,7 @@ class ServiceRoot : public RootItem {
|
|||||||
SearchsNode* probesNode() const;
|
SearchsNode* probesNode() const;
|
||||||
UnreadNode* unreadNode() const;
|
UnreadNode* unreadNode() const;
|
||||||
|
|
||||||
|
virtual void onDatabaseCleanup();
|
||||||
virtual void updateCounts(bool including_total_count);
|
virtual void updateCounts(bool including_total_count);
|
||||||
virtual bool canBeDeleted() const;
|
virtual bool canBeDeleted() const;
|
||||||
virtual bool deleteViaGui();
|
virtual bool deleteViaGui();
|
||||||
|
@ -81,6 +81,7 @@ void FormStandardFeedDetails::apply() {
|
|||||||
std_feed->setIcon(m_standardFeedDetails->m_ui.m_btnIcon->icon());
|
std_feed->setIcon(m_standardFeedDetails->m_ui.m_btnIcon->icon());
|
||||||
|
|
||||||
std_feed->setSource(m_standardFeedDetails->m_ui.m_txtSource->textEdit()->toPlainText());
|
std_feed->setSource(m_standardFeedDetails->m_ui.m_txtSource->textEdit()->toPlainText());
|
||||||
|
std_feed->setLastEtag({});
|
||||||
|
|
||||||
std_feed->setEncoding(m_standardFeedDetails->m_ui.m_cmbEncoding->currentText());
|
std_feed->setEncoding(m_standardFeedDetails->m_ui.m_cmbEncoding->currentText());
|
||||||
std_feed->setType(type);
|
std_feed->setType(type);
|
||||||
|
@ -40,11 +40,11 @@
|
|||||||
StandardFeed::StandardFeed(RootItem* parent_item) : Feed(parent_item) {
|
StandardFeed::StandardFeed(RootItem* parent_item) : Feed(parent_item) {
|
||||||
m_type = Type::Rss0X;
|
m_type = Type::Rss0X;
|
||||||
m_sourceType = SourceType::Url;
|
m_sourceType = SourceType::Url;
|
||||||
m_encoding = m_postProcessScript = QString();
|
m_encoding = m_postProcessScript = {};
|
||||||
|
|
||||||
m_protection = NetworkFactory::NetworkAuthentication::NoAuthentication;
|
m_protection = NetworkFactory::NetworkAuthentication::NoAuthentication;
|
||||||
m_username = QString();
|
m_username = {};
|
||||||
m_password = QString();
|
m_password = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
StandardFeed::StandardFeed(const StandardFeed& other) : Feed(other) {
|
StandardFeed::StandardFeed(const StandardFeed& other) : Feed(other) {
|
||||||
@ -386,6 +386,14 @@ bool StandardFeed::removeItself() {
|
|||||||
return DatabaseQueries::deleteFeed(database, this, getParentServiceRoot()->accountId());
|
return DatabaseQueries::deleteFeed(database, this, getParentServiceRoot()->accountId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString StandardFeed::lastEtag() const {
|
||||||
|
return m_lastEtag;
|
||||||
|
}
|
||||||
|
|
||||||
|
void StandardFeed::setLastEtag(const QString& etag) {
|
||||||
|
m_lastEtag = etag;
|
||||||
|
}
|
||||||
|
|
||||||
StandardFeed::Type StandardFeed::type() const {
|
StandardFeed::Type StandardFeed::type() const {
|
||||||
return m_type;
|
return m_type;
|
||||||
}
|
}
|
||||||
|
@ -104,6 +104,9 @@ class StandardFeed : public Feed {
|
|||||||
bool provide_input,
|
bool provide_input,
|
||||||
const QString& input = {});
|
const QString& input = {});
|
||||||
|
|
||||||
|
QString lastEtag() const;
|
||||||
|
void setLastEtag(const QString& etag);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void fetchMetadataForItself();
|
void fetchMetadataForItself();
|
||||||
|
|
||||||
@ -119,6 +122,7 @@ class StandardFeed : public Feed {
|
|||||||
NetworkFactory::NetworkAuthentication m_protection = NetworkFactory::NetworkAuthentication::NoAuthentication;
|
NetworkFactory::NetworkAuthentication m_protection = NetworkFactory::NetworkAuthentication::NoAuthentication;
|
||||||
QString m_username;
|
QString m_username;
|
||||||
QString m_password;
|
QString m_password;
|
||||||
|
QString m_lastEtag;
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(StandardFeed::SourceType)
|
Q_DECLARE_METATYPE(StandardFeed::SourceType)
|
||||||
|
@ -48,6 +48,12 @@ StandardServiceRoot::~StandardServiceRoot() {
|
|||||||
qDeleteAll(m_feedContextMenu);
|
qDeleteAll(m_feedContextMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void StandardServiceRoot::onDatabaseCleanup() {
|
||||||
|
for (Feed* fd : getSubTreeFeeds()) {
|
||||||
|
qobject_cast<StandardFeed*>(fd)->setLastEtag({});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void StandardServiceRoot::start(bool freshly_activated) {
|
void StandardServiceRoot::start(bool freshly_activated) {
|
||||||
DatabaseQueries::loadRootFromDatabase<StandardCategory, StandardFeed>(this);
|
DatabaseQueries::loadRootFromDatabase<StandardCategory, StandardFeed>(this);
|
||||||
|
|
||||||
@ -175,6 +181,12 @@ QList<Message> StandardServiceRoot::obtainNewMessages(Feed* feed,
|
|||||||
|
|
||||||
headers << NetworkFactory::generateBasicAuthHeader(f->protection(), f->username(), f->password());
|
headers << NetworkFactory::generateBasicAuthHeader(f->protection(), f->username(), f->password());
|
||||||
|
|
||||||
|
if (!f->lastEtag().isEmpty()) {
|
||||||
|
headers.append({QSL("If-None-Match").toLocal8Bit(), f->lastEtag().toLocal8Bit()});
|
||||||
|
|
||||||
|
qDebugNN << "Using ETag value:" << QUOTE_W_SPACE_DOT(f->lastEtag());
|
||||||
|
}
|
||||||
|
|
||||||
auto network_result = NetworkFactory::performNetworkOperation(feed->source(),
|
auto network_result = NetworkFactory::performNetworkOperation(feed->source(),
|
||||||
download_timeout,
|
download_timeout,
|
||||||
{},
|
{},
|
||||||
@ -186,14 +198,15 @@ QList<Message> StandardServiceRoot::obtainNewMessages(Feed* feed,
|
|||||||
{},
|
{},
|
||||||
networkProxy());
|
networkProxy());
|
||||||
|
|
||||||
// qDebugNN << "etag:" << network_result.m_headers["ETag"];
|
|
||||||
|
|
||||||
if (network_result.m_networkError != QNetworkReply::NetworkError::NoError) {
|
if (network_result.m_networkError != QNetworkReply::NetworkError::NoError) {
|
||||||
qWarningNN << LOGSEC_CORE << "Error" << QUOTE_W_SPACE(network_result.m_networkError)
|
qWarningNN << LOGSEC_CORE << "Error" << QUOTE_W_SPACE(network_result.m_networkError)
|
||||||
<< "during fetching of new messages for feed" << QUOTE_W_SPACE_DOT(feed->source());
|
<< "during fetching of new messages for feed" << QUOTE_W_SPACE_DOT(feed->source());
|
||||||
throw FeedFetchException(Feed::Status::NetworkError,
|
throw FeedFetchException(Feed::Status::NetworkError,
|
||||||
NetworkFactory::networkErrorText(network_result.m_networkError));
|
NetworkFactory::networkErrorText(network_result.m_networkError));
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
f->setLastEtag(network_result.m_headers.value(QSL("ETag")));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (f->sourceType() == StandardFeed::SourceType::LocalFile) {
|
else if (f->sourceType() == StandardFeed::SourceType::LocalFile) {
|
||||||
feed_contents = IOFactory::readFile(feed->source());
|
feed_contents = IOFactory::readFile(feed->source());
|
||||||
|
@ -24,6 +24,7 @@ class StandardServiceRoot : public ServiceRoot {
|
|||||||
explicit StandardServiceRoot(RootItem* parent = nullptr);
|
explicit StandardServiceRoot(RootItem* parent = nullptr);
|
||||||
virtual ~StandardServiceRoot();
|
virtual ~StandardServiceRoot();
|
||||||
|
|
||||||
|
virtual void onDatabaseCleanup();
|
||||||
virtual void start(bool freshly_activated);
|
virtual void start(bool freshly_activated);
|
||||||
virtual void stop();
|
virtual void stop();
|
||||||
virtual QString code() const;
|
virtual QString code() const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user