Skip to content

Commit

Permalink
fix #792
Browse files Browse the repository at this point in the history
  • Loading branch information
martinrotter committed Sep 7, 2022
1 parent a23a1a8 commit 4af15a8
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion resources/desktop/com.github.rssguard.appdata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<url type="donation">https://github.com/sponsors/martinrotter</url>
<content_rating type="oars-1.1" />
<releases>
<release version="4.2.4" date="2022-09-06"/>
<release version="4.2.4" date="2022-09-07"/>
</releases>
<content_rating type="oars-1.0">
<content_attribute id="violence-cartoon">none</content_attribute>
Expand Down
2 changes: 1 addition & 1 deletion resources/docs/Documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ I highly recommend to download RSS Guard only from reputable sources.
## Supported Operating Systems <a id="sos"></a>
RSS Guard is a cross-platform application, and at this point it is known to work on:
* Windows 7+
* GNU/Linux (including PinePhone and other Linux-based phone operating systems)
* GNU/Linux with glibc 2.31+ (including PinePhone and other Linux-based phone operating systems)
* BSD (FreeBSD, OpenBSD, NetBSD, etc.)
* macOS 10.13+
* OS/2 (ArcaOS, eComStation)
Expand Down
2 changes: 1 addition & 1 deletion src/librssguard/miscellaneous/skinfactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ QPair<QString, QUrl> SkinFactory::generateHtmlOfArticles(const QList<Message>& m
for (const Message& message : messages) {
QString enclosures;
QString enclosure_images;
bool is_plain = !Qt::mightBeRichText(message.m_contents.simplified());
bool is_plain = !TextFactory::couldBeHtml(message.m_contents);

for (const Enclosure& enclosure : message.m_enclosures) {
QString enc_url = QUrl::fromPercentEncoding(enclosure.m_url.toUtf8());
Expand Down
6 changes: 6 additions & 0 deletions src/librssguard/miscellaneous/textfactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ int TextFactory::stringWidth(const QString& string, const QFontMetrics& metrics)
return width;
}

bool TextFactory::couldBeHtml(const QString& string) {
const QString sstring = string.simplified();

return sstring.startsWith(QL1S("<!")) || Qt::mightBeRichText(sstring);
}

QDateTime TextFactory::parseDateTime(const QString& date_time) {
const QString input_date = date_time.simplified();
QDateTime dt;
Expand Down
3 changes: 2 additions & 1 deletion src/librssguard/miscellaneous/textfactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

class TextFactory {
private:

// Constructors and destructors.
TextFactory();

Expand All @@ -20,6 +19,8 @@ class TextFactory {
static int stringHeight(const QString& string, const QFontMetrics& metrics);
static int stringWidth(const QString& string, const QFontMetrics& metrics);

static bool couldBeHtml(const QString& string);

// Tries to parse input textual date/time representation.
// Returns invalid date/time if processing fails.
// NOTE: This method tries to always return time in UTC.
Expand Down

0 comments on commit 4af15a8

Please sign in to comment.