fix #1698
This commit is contained in:
parent
d0bf0d872b
commit
eb8d258a09
9 changed files with 61 additions and 17 deletions
|
@ -14,6 +14,7 @@
|
|||
<file>scripts/gemini/style.css</file>
|
||||
|
||||
<file>sounds/boing.wav</file>
|
||||
<file>sounds/error.wav</file>
|
||||
<file>sounds/rooster.wav</file>
|
||||
<file>sounds/sheep.wav</file>
|
||||
<file>sounds/doorbell.wav</file>
|
||||
|
|
BIN
resources/sounds/error.wav
Normal file
BIN
resources/sounds/error.wav
Normal file
Binary file not shown.
|
@ -23,5 +23,10 @@
|
|||
"title": "GNU GPL v3.0 + Qt Company GPL Exception 1.0",
|
||||
"file": "COPYING_QT",
|
||||
"components": "Qt"
|
||||
},
|
||||
{
|
||||
"title": "Attribution 3.0",
|
||||
"text": "Error Bleep 4 by original_sound -- https://freesound.org/s/372197/ -- License: Attribution 3.0",
|
||||
"components": "Error Bleep 4"
|
||||
}
|
||||
]
|
|
@ -447,6 +447,7 @@ void FeedDownloader::updateOneFeed(ServiceRoot* acc,
|
|||
qCriticalNN << LOGSEC_NETWORK << "Error when fetching feed:" << QUOTE_W_SPACE(feed_ex.feedStatus())
|
||||
<< "message:" << QUOTE_W_SPACE_DOT(feed_ex.message());
|
||||
|
||||
m_results.appendErroredFeed(feed, feed_ex.message());
|
||||
feed->setStatus(feed_ex.feedStatus(), feed_ex.message());
|
||||
|
||||
if (feed_ex.feedStatus() == Feed::Status::NetworkError && !feed_ex.data().isNull()) {
|
||||
|
@ -468,6 +469,7 @@ void FeedDownloader::updateOneFeed(ServiceRoot* acc,
|
|||
qCriticalNN << LOGSEC_NETWORK << "Unknown error when fetching feed:"
|
||||
<< "message:" << QUOTE_W_SPACE_DOT(app_ex.message());
|
||||
|
||||
m_results.appendErroredFeed(feed, app_ex.message());
|
||||
feed->setStatus(Feed::Status::OtherError, app_ex.message());
|
||||
}
|
||||
|
||||
|
@ -484,6 +486,13 @@ void FeedDownloader::finalizeUpdate() {
|
|||
|
||||
m_feeds.clear();
|
||||
|
||||
if (!m_results.erroredFeeds().isEmpty()) {
|
||||
qApp->showGuiMessage(Notification::Event::ArticlesFetchingError,
|
||||
{QObject::tr("Some feed have error"),
|
||||
QObject::tr("Some feeds threw an error when fetching articles."),
|
||||
QSystemTrayIcon::MessageIcon::Critical});
|
||||
}
|
||||
|
||||
// Update of feeds has finished.
|
||||
// NOTE: This means that now "update lock" can be unlocked
|
||||
// and feeds can be added/edited/deleted and application
|
||||
|
@ -632,8 +641,17 @@ void FeedDownloadResults::appendUpdatedFeed(Feed* feed, const QList<Message>& up
|
|||
}
|
||||
}
|
||||
|
||||
void FeedDownloadResults::appendErroredFeed(Feed* feed, const QString& error) {
|
||||
m_erroredFeeds.insert(feed, error);
|
||||
}
|
||||
|
||||
void FeedDownloadResults::clear() {
|
||||
m_updatedFeeds.clear();
|
||||
m_erroredFeeds.clear();
|
||||
}
|
||||
|
||||
QHash<Feed*, QString> FeedDownloadResults::erroredFeeds() const {
|
||||
return m_erroredFeeds;
|
||||
}
|
||||
|
||||
QHash<Feed*, QList<Message>> FeedDownloadResults::updatedFeeds() const {
|
||||
|
|
|
@ -18,14 +18,18 @@ class MessageFilter;
|
|||
// Represents results of batch feed updates.
|
||||
class FeedDownloadResults {
|
||||
public:
|
||||
QHash<Feed*, QString> erroredFeeds() const;
|
||||
QHash<Feed*, QList<Message>> updatedFeeds() const;
|
||||
QString overview(int how_many_feeds) const;
|
||||
|
||||
void appendUpdatedFeed(Feed* feed, const QList<Message>& updated_unread_msgs);
|
||||
void appendErroredFeed(Feed* feed, const QString& error);
|
||||
void clear();
|
||||
|
||||
private:
|
||||
// QString represents title if the feed, int represents count of newly downloaded messages.
|
||||
QHash<Feed*, QList<Message>> m_updatedFeeds;
|
||||
QHash<Feed*, QString> m_erroredFeeds;
|
||||
};
|
||||
|
||||
struct FeedUpdateRequest {
|
||||
|
|
|
@ -107,10 +107,15 @@ void FormAbout::loadLicenseAndInformation() {
|
|||
QJsonDocument licenses_index = QJsonDocument::fromJson(IOFactory::readFile(APP_INFO_PATH + QSL("/licenses.json")));
|
||||
|
||||
for (const QJsonValue& license : licenses_index.array()) {
|
||||
const QJsonObject license_obj = license.toObject();
|
||||
const QString license_text =
|
||||
QJsonObject license_obj = license.toObject();
|
||||
QString license_text = license_obj.value(QSL("text")).toString();
|
||||
|
||||
if (license_text.isEmpty()) {
|
||||
license_text =
|
||||
QString::fromUtf8(IOFactory::readFile(APP_INFO_PATH + QSL("/") + license_obj[QSL("file")].toString()));
|
||||
const QString license_title =
|
||||
}
|
||||
|
||||
QString license_title =
|
||||
license_obj[QSL("title")].toString() + QSL(": ") + license_obj[QSL("components")].toString();
|
||||
|
||||
m_ui.m_cbLicenses->addItem(license_title, license_text);
|
||||
|
|
|
@ -43,13 +43,13 @@
|
|||
<string/>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
<enum>Qt::TextFormat::RichText</enum>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -68,16 +68,16 @@
|
|||
<string/>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
<enum>Qt::TextFormat::RichText</enum>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
<set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
<set>Qt::TextInteractionFlag::LinksAccessibleByMouse|Qt::TextInteractionFlag::TextSelectableByKeyboard|Qt::TextInteractionFlag::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -105,7 +105,7 @@
|
|||
<locale language="English" country="UnitedStates"/>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="m_tabInfo">
|
||||
<attribute name="title">
|
||||
|
@ -118,7 +118,7 @@
|
|||
<font/>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::DefaultContextMenu</enum>
|
||||
<enum>Qt::ContextMenuPolicy::DefaultContextMenu</enum>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
|
@ -143,7 +143,7 @@ li.checked::marker { content: "\2612"; }
|
|||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||
<set>Qt::TextInteractionFlag::LinksAccessibleByMouse|Qt::TextInteractionFlag::TextSelectableByMouse</set>
|
||||
</property>
|
||||
<property name="searchPaths">
|
||||
<stringlist/>
|
||||
|
@ -164,7 +164,11 @@ li.checked::marker { content: "\2612"; }
|
|||
<widget class="QComboBox" name="m_cbLicenses"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="m_tbLicenses"/>
|
||||
<widget class="QPlainTextEdit" name="m_tbLicenses">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="m_lblLicenses">
|
||||
|
@ -202,7 +206,7 @@ li.checked::marker { content: "\2612"; }
|
|||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||
<set>Qt::TextInteractionFlag::LinksAccessibleByMouse|Qt::TextInteractionFlag::TextSelectableByMouse</set>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
|
@ -224,7 +228,7 @@ li.checked::marker { content: "\2612"; }
|
|||
</attribute>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
<enum>QFormLayout::FieldGrowthPolicy::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QPlainTextEdit" name="m_tbResources">
|
||||
|
@ -240,7 +244,7 @@ li.checked::marker { content: "\2612"; }
|
|||
<item>
|
||||
<widget class="QDialogButtonBox" name="m_buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Ok</set>
|
||||
<set>QDialogButtonBox::StandardButton::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -119,6 +119,7 @@ QList<Notification::Event> Notification::allEvents() {
|
|||
return {Event::GeneralEvent,
|
||||
Event::NewUnreadArticlesFetched,
|
||||
Event::ArticlesFetchingStarted,
|
||||
Event::ArticlesFetchingError,
|
||||
Event::LoginDataRefreshed,
|
||||
Event::LoginFailure,
|
||||
Event::NewAppVersionAvailable,
|
||||
|
@ -152,6 +153,9 @@ QString Notification::nameForEvent(Notification::Event event) {
|
|||
case Notification::Event::NodePackageFailedToUpdate:
|
||||
return QObject::tr("Node.js - package(s) failed to update");
|
||||
|
||||
case Notification::Event::ArticlesFetchingError:
|
||||
return QObject::tr("Error when fetching articles");
|
||||
|
||||
default:
|
||||
return QObject::tr("Unknown event");
|
||||
}
|
||||
|
|
|
@ -40,7 +40,10 @@ class Notification {
|
|||
NodePackageUpdated = 7,
|
||||
|
||||
// Node.js - package failde to update.
|
||||
NodePackageFailedToUpdate = 8
|
||||
NodePackageFailedToUpdate = 8,
|
||||
|
||||
// There was at least one error during fetching articles.
|
||||
ArticlesFetchingError = 9
|
||||
};
|
||||
|
||||
explicit Notification(Event event = Event::NoEvent,
|
||||
|
|
Loading…
Add table
Reference in a new issue