Replace HTML Characters with Unicode in Entry Title

This commit is contained in:
Tobias Fella 2020-05-01 14:56:29 +02:00
parent bb49d372a8
commit cd2cd738e3

View File

@ -23,6 +23,7 @@
#include <QNetworkAccessManager> #include <QNetworkAccessManager>
#include <QNetworkReply> #include <QNetworkReply>
#include <QStandardPaths> #include <QStandardPaths>
#include <QTextDocument>
#include <Syndication/Syndication> #include <Syndication/Syndication>
@ -75,7 +76,10 @@ void Fetcher::fetch(QUrl url)
query.prepare(QStringLiteral("INSERT INTO Entries VALUES (:feed, :id, :title, :content, :created, :updated, :link);")); query.prepare(QStringLiteral("INSERT INTO Entries VALUES (:feed, :id, :title, :content, :created, :updated, :link);"));
query.bindValue(QStringLiteral(":feed"), url.toString()); query.bindValue(QStringLiteral(":feed"), url.toString());
query.bindValue(QStringLiteral(":id"), entry->id()); query.bindValue(QStringLiteral(":id"), entry->id());
query.bindValue(QStringLiteral(":title"), entry->title());
QTextDocument title;
title.setHtml(entry->title());
query.bindValue(QStringLiteral(":title"), title.toPlainText());
query.bindValue(QStringLiteral(":created"), static_cast<int>(entry->datePublished())); query.bindValue(QStringLiteral(":created"), static_cast<int>(entry->datePublished()));
query.bindValue(QStringLiteral(":updated"), static_cast<int>(entry->dateUpdated())); query.bindValue(QStringLiteral(":updated"), static_cast<int>(entry->dateUpdated()));
query.bindValue(QStringLiteral(":link"), entry->link()); query.bindValue(QStringLiteral(":link"), entry->link());