strings
This commit is contained in:
parent
04a493b7ba
commit
c9674c8a47
@ -314,7 +314,7 @@ void FeedDownloader::updateOneFeed(Feed* feed) {
|
||||
<< "message:"
|
||||
<< QUOTE_W_SPACE_DOT(feed_ex.message());
|
||||
|
||||
feed->setStatus(feed_ex.feedStatus());
|
||||
feed->setStatus(feed_ex.feedStatus(), feed_ex.message());
|
||||
feed->getParentServiceRoot()->itemChanged({ feed });
|
||||
}
|
||||
|
||||
@ -324,7 +324,7 @@ void FeedDownloader::updateOneFeed(Feed* feed) {
|
||||
<< "message:"
|
||||
<< QUOTE_W_SPACE_DOT(app_ex.message());
|
||||
|
||||
feed->setStatus(Feed::Status::OtherError);
|
||||
feed->setStatus(Feed::Status::OtherError, app_ex.message());
|
||||
feed->getParentServiceRoot()->itemChanged({ feed });
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ Application::Application(const QString& id, int& argc, char** argv)
|
||||
m_notifications->save({
|
||||
Notification(Notification::Event::GeneralEvent,
|
||||
true),
|
||||
Notification(Notification::Event::NewArticlesFetched,
|
||||
Notification(Notification::Event::NewUnreadArticlesFetched,
|
||||
true,
|
||||
QSL("%1/rooster.wav").arg(SOUNDS_BUILTIN_DIRECTORY)),
|
||||
Notification(Notification::Event::NewAppVersionAvailable,
|
||||
@ -582,8 +582,8 @@ void Application::downloadRequested(QWebEngineDownloadItem* download_item) {
|
||||
void Application::onFeedUpdatesFinished(const FeedDownloadResults& results) {
|
||||
if (!results.updatedFeeds().isEmpty()) {
|
||||
// Now, inform about results via GUI message/notification.
|
||||
qApp->showGuiMessage(Notification::Event::NewArticlesFetched,
|
||||
tr("New articles fetched"),
|
||||
qApp->showGuiMessage(Notification::Event::NewUnreadArticlesFetched,
|
||||
tr("Unread articles fetched"),
|
||||
results.overview(10),
|
||||
QSystemTrayIcon::MessageIcon::NoIcon);
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ void Notification::playSound(Application* app) const {
|
||||
QList<Notification::Event> Notification::allEvents() {
|
||||
return {
|
||||
Event::GeneralEvent,
|
||||
Event::NewArticlesFetched,
|
||||
Event::NewUnreadArticlesFetched,
|
||||
Event::ArticlesFetchingStarted,
|
||||
Event::LoginDataRefreshed,
|
||||
Event::NewAppVersionAvailable,
|
||||
@ -44,8 +44,8 @@ QList<Notification::Event> Notification::allEvents() {
|
||||
|
||||
QString Notification::nameForEvent(Notification::Event event) {
|
||||
switch (event) {
|
||||
case Notification::Event::NewArticlesFetched:
|
||||
return QObject::tr("New articles fetched");
|
||||
case Notification::Event::NewUnreadArticlesFetched:
|
||||
return QObject::tr("New (unread) articles fetched");
|
||||
|
||||
case Notification::Event::ArticlesFetchingStarted:
|
||||
return QObject::tr("Fetching articles right now");
|
||||
|
@ -18,7 +18,7 @@ class Notification {
|
||||
GeneralEvent = 1,
|
||||
|
||||
// New (unread) messages were downloaded for some feed.
|
||||
NewArticlesFetched = 2,
|
||||
NewUnreadArticlesFetched = 2,
|
||||
|
||||
// RSS Guard started downloading messages for some feed.
|
||||
ArticlesFetchingStarted = 3,
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include <QThread>
|
||||
|
||||
Feed::Feed(RootItem* parent)
|
||||
: RootItem(parent), m_source(QString()), m_status(Status::Normal), m_autoUpdateType(AutoUpdateType::DefaultAutoUpdate),
|
||||
: RootItem(parent), m_source(QString()), m_status(Status::Normal), m_statusString(QString()), m_autoUpdateType(AutoUpdateType::DefaultAutoUpdate),
|
||||
m_autoUpdateInitialInterval(DEFAULT_AUTO_UPDATE_INTERVAL), m_autoUpdateRemainingInterval(DEFAULT_AUTO_UPDATE_INTERVAL),
|
||||
m_messageFilters(QList<QPointer<MessageFilter>>()) {
|
||||
setKind(RootItem::Kind::Feed);
|
||||
@ -38,7 +38,7 @@ Feed::Feed(const Feed& other) : RootItem(other) {
|
||||
setCountOfAllMessages(other.countOfAllMessages());
|
||||
setCountOfUnreadMessages(other.countOfUnreadMessages());
|
||||
setSource(other.source());
|
||||
setStatus(other.status());
|
||||
setStatus(other.status(), other.statusString());
|
||||
setAutoUpdateType(other.autoUpdateType());
|
||||
setAutoUpdateInitialInterval(other.autoUpdateInitialInterval());
|
||||
setAutoUpdateRemainingInterval(other.autoUpdateRemainingInterval());
|
||||
@ -143,8 +143,9 @@ Feed::Status Feed::status() const {
|
||||
return m_status;
|
||||
}
|
||||
|
||||
void Feed::setStatus(const Feed::Status& status) {
|
||||
void Feed::setStatus(const Feed::Status& status, const QString& status_text) {
|
||||
m_status = status;
|
||||
m_statusString = status_text;
|
||||
}
|
||||
|
||||
QString Feed::source() const {
|
||||
@ -297,6 +298,10 @@ QString Feed::getStatusDescription() const {
|
||||
}
|
||||
}
|
||||
|
||||
QString Feed::statusString() const {
|
||||
return m_statusString;
|
||||
}
|
||||
|
||||
QList<QPointer<MessageFilter>> Feed::messageFilters() const {
|
||||
return m_messageFilters;
|
||||
}
|
||||
|
@ -67,7 +67,8 @@ class Feed : public RootItem {
|
||||
void setAutoUpdateRemainingInterval(int auto_update_remaining_interval);
|
||||
|
||||
Status status() const;
|
||||
void setStatus(const Status& status);
|
||||
QString statusString() const;
|
||||
void setStatus(const Status& status, const QString& status_text = {});
|
||||
|
||||
QString source() const;
|
||||
void setSource(const QString& source);
|
||||
@ -90,6 +91,7 @@ class Feed : public RootItem {
|
||||
private:
|
||||
QString m_source;
|
||||
Status m_status;
|
||||
QString m_statusString;
|
||||
AutoUpdateType m_autoUpdateType;
|
||||
int m_autoUpdateInitialInterval{};
|
||||
int m_autoUpdateRemainingInterval{};
|
||||
|
@ -81,7 +81,6 @@ QList<Message> GmailServiceRoot::obtainNewMessages(const QList<Feed*>& feeds) {
|
||||
Feed::Status error = Feed::Status::Normal;
|
||||
|
||||
messages << network()->messages(feed->customId(), error, networkProxy());
|
||||
feed->setStatus(error);
|
||||
|
||||
if (error == Feed::Status::NetworkError || error == Feed::Status::AuthError || error == Feed::Status::ParsingError) {
|
||||
throw FeedFetchException(error);
|
||||
|
@ -64,7 +64,6 @@ QList<Message> GreaderServiceRoot::obtainNewMessages(const QList<Feed*>& feeds)
|
||||
Feed::Status error = Feed::Status::Normal;
|
||||
|
||||
messages << network()->streamContents(this, feed->customId(), error, networkProxy());
|
||||
feed->setStatus(error);
|
||||
|
||||
if (error == Feed::Status::NetworkError || error == Feed::Status::AuthError) {
|
||||
throw FeedFetchException(error);
|
||||
|
@ -63,7 +63,6 @@ QList<Message> InoreaderServiceRoot::obtainNewMessages(const QList<Feed*>& feeds
|
||||
Feed::Status error = Feed::Status::Normal;
|
||||
|
||||
messages << network()->messages(this, feed->customId(), error);
|
||||
feed->setStatus(error);
|
||||
|
||||
if (error == Feed::Status::NetworkError || error == Feed::Status::AuthError) {
|
||||
throw FeedFetchException(error);
|
||||
|
@ -39,7 +39,6 @@
|
||||
|
||||
StandardFeed::StandardFeed(RootItem* parent_item)
|
||||
: Feed(parent_item) {
|
||||
m_networkError = QNetworkReply::NetworkError::NoError;
|
||||
m_type = Type::Rss0X;
|
||||
m_sourceType = SourceType::Url;
|
||||
m_encoding = m_postProcessScript = QString();
|
||||
@ -51,7 +50,6 @@ StandardFeed::StandardFeed(RootItem* parent_item)
|
||||
|
||||
StandardFeed::StandardFeed(const StandardFeed& other)
|
||||
: Feed(other) {
|
||||
m_networkError = other.networkError();
|
||||
m_type = other.type();
|
||||
m_postProcessScript = other.postProcessScript();
|
||||
m_sourceType = other.sourceType();
|
||||
@ -66,11 +64,8 @@ QList<QAction*> StandardFeed::contextMenuFeedsList() {
|
||||
}
|
||||
|
||||
QString StandardFeed::additionalTooltip() const {
|
||||
return Feed::additionalTooltip() + tr("\nNetwork status: %1\n"
|
||||
"Encoding: %2\n"
|
||||
"Type: %3").arg(NetworkFactory::networkErrorText(m_networkError),
|
||||
encoding(),
|
||||
StandardFeed::typeToString(type()));
|
||||
return Feed::additionalTooltip() + tr("\nEncoding: %2\n"
|
||||
"Type: %3").arg(encoding(), StandardFeed::typeToString(type()));
|
||||
}
|
||||
|
||||
bool StandardFeed::canBeDeleted() const {
|
||||
@ -578,10 +573,6 @@ QString StandardFeed::runScriptProcess(const QStringList& cmd_args, const QStrin
|
||||
}
|
||||
}
|
||||
|
||||
void StandardFeed::setNetworkError(const QNetworkReply::NetworkError& network_error) {
|
||||
m_networkError = network_error;
|
||||
}
|
||||
|
||||
QString StandardFeed::generateFeedFileWithScript(const QString& execution_line, int run_timeout) {
|
||||
auto prepared_query = prepareExecutionLine(execution_line);
|
||||
|
||||
@ -595,7 +586,3 @@ QString StandardFeed::postProcessFeedFileWithScript(const QString& execution_lin
|
||||
|
||||
return runScriptProcess(prepared_query, qApp->userDataFolder(), run_timeout, true, raw_feed_data);
|
||||
}
|
||||
|
||||
QNetworkReply::NetworkError StandardFeed::networkError() const {
|
||||
return m_networkError;
|
||||
}
|
||||
|
@ -71,9 +71,6 @@ class StandardFeed : public Feed {
|
||||
QString password() const;
|
||||
void setPassword(const QString& password);
|
||||
|
||||
QNetworkReply::NetworkError networkError() const;
|
||||
void setNetworkError(const QNetworkReply::NetworkError& network_error);
|
||||
|
||||
// Tries to guess feed hidden under given URL
|
||||
// and uses given credentials.
|
||||
// Returns pointer to guessed feed (if at least partially
|
||||
@ -110,7 +107,6 @@ class StandardFeed : public Feed {
|
||||
SourceType m_sourceType;
|
||||
Type m_type;
|
||||
QString m_postProcessScript;
|
||||
QNetworkReply::NetworkError m_networkError;
|
||||
QString m_encoding;
|
||||
bool m_passwordProtected{};
|
||||
QString m_username;
|
||||
|
@ -162,7 +162,8 @@ QList<Message> StandardServiceRoot::obtainNewMessages(const QList<Feed*>& feeds)
|
||||
QList<QPair<QByteArray, QByteArray>> headers;
|
||||
|
||||
headers << NetworkFactory::generateBasicAuthHeader(feed->username(), feed->password());
|
||||
feed->setNetworkError(NetworkFactory::performNetworkOperation(feed->source(),
|
||||
|
||||
auto network_result = NetworkFactory::performNetworkOperation(feed->source(),
|
||||
download_timeout,
|
||||
{},
|
||||
feed_contents,
|
||||
@ -171,15 +172,15 @@ QList<Message> StandardServiceRoot::obtainNewMessages(const QList<Feed*>& feeds)
|
||||
false,
|
||||
{},
|
||||
{},
|
||||
networkProxy()).first);
|
||||
networkProxy()).first;
|
||||
|
||||
if (feed->networkError() != QNetworkReply::NetworkError::NoError) {
|
||||
if (network_result != QNetworkReply::NetworkError::NoError) {
|
||||
qWarningNN << LOGSEC_CORE
|
||||
<< "Error"
|
||||
<< QUOTE_W_SPACE(feed->networkError())
|
||||
<< QUOTE_W_SPACE(network_result)
|
||||
<< "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));
|
||||
}
|
||||
|
||||
// Encode downloaded data for further parsing.
|
||||
|
Loading…
x
Reference in New Issue
Block a user