Some enhancements and fixes.
This commit is contained in:
parent
d3a9e7eee1
commit
5921b6466a
6 changed files with 45 additions and 17 deletions
|
|
@ -2,13 +2,14 @@
|
||||||
<center><h2>2.4.0</h2></center>
|
<center><h2>2.4.0</h2></center>
|
||||||
Added:
|
Added:
|
||||||
<ul>
|
<ul>
|
||||||
|
<li>Message previewer now displays MIME type of all podcasts too. This MIME type is also stored in DB.</li>
|
||||||
<li>Ability to fetch only new icon for feed from its online source.</li>
|
<li>Ability to fetch only new icon for feed from its online source.</li>
|
||||||
<li>Option to search highlighted text in web browser via Google, available from context menu. (issue #72)</li>
|
<li>Option to search highlighted text in web browser via Google, available from context menu. (issue #72)</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
Fixed:
|
Fixed:
|
||||||
<ul>
|
<ul>
|
||||||
<li></li>
|
<li>Titles and descriptions of feeds are now fetched correctly in feed add/edit dialog.</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<hr/>
|
<hr/>
|
||||||
|
|
|
||||||
|
|
@ -278,7 +278,6 @@ QPair<FeedsModelFeed*, QNetworkReply::NetworkError> FeedsModelFeed::guessFeed(co
|
||||||
DOWNLOAD_TIMEOUT,
|
DOWNLOAD_TIMEOUT,
|
||||||
icon_data)) == QNetworkReply::NoError) {
|
icon_data)) == QNetworkReply::NoError) {
|
||||||
// Icon for feed was downloaded and is stored now in _icon_data.
|
// Icon for feed was downloaded and is stored now in _icon_data.
|
||||||
result.first = new FeedsModelFeed();
|
|
||||||
result.first->setIcon(icon_data);
|
result.first->setIcon(icon_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,26 +31,48 @@
|
||||||
struct Enclosure {
|
struct Enclosure {
|
||||||
QString m_mimeType;
|
QString m_mimeType;
|
||||||
QString m_url;
|
QString m_url;
|
||||||
|
|
||||||
|
explicit Enclosure(const QString &url = QString(), const QString &mime = QString()) : m_url(url), m_mimeType(mime) {
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Represents single enclosure.
|
// Represents single enclosure.
|
||||||
class Enclosures {
|
class Enclosures {
|
||||||
public:
|
public:
|
||||||
static QStringList decodeEnclosuresFromString(const QString &enclosures_data) {
|
static QList<Enclosure> decodeEnclosuresFromString(const QString &enclosures_data) {
|
||||||
QStringList enclosures;
|
QList<Enclosure> enclosures;
|
||||||
|
|
||||||
foreach (const QString &single_enclosure, enclosures_data.split(ENCLOSURES_OUTER_SEPARATOR, QString::SkipEmptyParts)) {
|
foreach (const QString &single_enclosure, enclosures_data.split(ENCLOSURES_OUTER_SEPARATOR, QString::SkipEmptyParts)) {
|
||||||
enclosures.append(QByteArray::fromBase64(single_enclosure.toLocal8Bit()));
|
Enclosure enclosure;
|
||||||
|
|
||||||
|
if (single_enclosure.contains(ECNLOSURES_INNER_SEPARATOR)) {
|
||||||
|
QStringList mime_url = single_enclosure.split(ECNLOSURES_INNER_SEPARATOR);
|
||||||
|
|
||||||
|
enclosure.m_mimeType = QByteArray::fromBase64(mime_url.at(0).toLocal8Bit());
|
||||||
|
enclosure.m_url = QByteArray::fromBase64(mime_url.at(1).toLocal8Bit());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
enclosure.m_url = QByteArray::fromBase64(single_enclosure.toLocal8Bit());
|
||||||
|
}
|
||||||
|
|
||||||
|
enclosures.append(enclosure);
|
||||||
}
|
}
|
||||||
|
|
||||||
return enclosures;
|
return enclosures;
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString encodeEnclosuresToString(const QStringList &enclosures) {
|
static QString encodeEnclosuresToString(const QList<Enclosure> &enclosures) {
|
||||||
QStringList enclosures_str;
|
QStringList enclosures_str;
|
||||||
|
|
||||||
foreach (const QString &enclosure, enclosures) {
|
foreach (const Enclosure &enclosure, enclosures) {
|
||||||
enclosures_str.append(enclosure.toLocal8Bit().toBase64());
|
if (enclosure.m_mimeType.isEmpty()) {
|
||||||
|
enclosures_str.append(enclosure.m_url.toLocal8Bit().toBase64());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
enclosures_str.append(QString(enclosure.m_mimeType.toLocal8Bit().toBase64()) +
|
||||||
|
ECNLOSURES_INNER_SEPARATOR +
|
||||||
|
enclosure.m_url.toLocal8Bit().toBase64());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return enclosures_str.join(QString(ENCLOSURES_OUTER_SEPARATOR));
|
return enclosures_str.join(QString(ENCLOSURES_OUTER_SEPARATOR));
|
||||||
|
|
@ -62,7 +84,7 @@ class Message {
|
||||||
public:
|
public:
|
||||||
explicit Message() {
|
explicit Message() {
|
||||||
m_title = m_url = m_author = m_contents = "";
|
m_title = m_url = m_author = m_contents = "";
|
||||||
m_enclosures = QStringList();
|
m_enclosures = QList<Enclosure>();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString m_title;
|
QString m_title;
|
||||||
|
|
@ -71,7 +93,7 @@ class Message {
|
||||||
QString m_contents;
|
QString m_contents;
|
||||||
QDateTime m_created;
|
QDateTime m_created;
|
||||||
|
|
||||||
QStringList m_enclosures;
|
QList<Enclosure> m_enclosures;
|
||||||
|
|
||||||
// Is true if "created" date was obtained directly
|
// Is true if "created" date was obtained directly
|
||||||
// from the feed, otherwise is false
|
// from the feed, otherwise is false
|
||||||
|
|
|
||||||
|
|
@ -74,9 +74,9 @@ QList<Message> ParsingFactory::parseAsATOM10(const QString &data) {
|
||||||
QDomElement link = elem_links.at(i).toElement();
|
QDomElement link = elem_links.at(i).toElement();
|
||||||
|
|
||||||
if (link.attribute("rel") == "enclosure") {
|
if (link.attribute("rel") == "enclosure") {
|
||||||
new_message.m_enclosures.append(link.attribute("href"));
|
new_message.m_enclosures.append(Enclosure(link.attribute("href"), link.attribute("type")));
|
||||||
|
|
||||||
qDebug("Adding enclosure '%s' for the message.", qPrintable(new_message.m_enclosures.last()));
|
qDebug("Adding enclosure '%s' for the message.", qPrintable(new_message.m_enclosures.last().m_url));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
new_message.m_url = link.attribute("href");
|
new_message.m_url = link.attribute("href");
|
||||||
|
|
@ -84,7 +84,7 @@ QList<Message> ParsingFactory::parseAsATOM10(const QString &data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (new_message.m_url.isEmpty() && !new_message.m_enclosures.isEmpty()) {
|
if (new_message.m_url.isEmpty() && !new_message.m_enclosures.isEmpty()) {
|
||||||
new_message.m_url = new_message.m_enclosures.first();
|
new_message.m_url = new_message.m_enclosures.first().m_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deal with authors.
|
// Deal with authors.
|
||||||
|
|
@ -205,6 +205,7 @@ QList<Message> ParsingFactory::parseAsRSS20(const QString &data) {
|
||||||
QString elem_title = message_item.namedItem("title").toElement().text().simplified();
|
QString elem_title = message_item.namedItem("title").toElement().text().simplified();
|
||||||
QString elem_description = message_item.namedItem("description").toElement().text();
|
QString elem_description = message_item.namedItem("description").toElement().text();
|
||||||
QString elem_enclosure = message_item.namedItem("enclosure").toElement().attribute("url");
|
QString elem_enclosure = message_item.namedItem("enclosure").toElement().attribute("url");
|
||||||
|
QString elem_enclosure_type = message_item.namedItem("enclosure").toElement().attribute("type");
|
||||||
|
|
||||||
if (elem_description.isEmpty()) {
|
if (elem_description.isEmpty()) {
|
||||||
elem_description = message_item.namedItem("encoded").toElement().text();
|
elem_description = message_item.namedItem("encoded").toElement().text();
|
||||||
|
|
@ -229,7 +230,7 @@ QList<Message> ParsingFactory::parseAsRSS20(const QString &data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!elem_enclosure.isEmpty()) {
|
if (!elem_enclosure.isEmpty()) {
|
||||||
new_message.m_enclosures.append(elem_enclosure);
|
new_message.m_enclosures.append(Enclosure(elem_enclosure, elem_enclosure_type));
|
||||||
|
|
||||||
qDebug("Adding enclosure '%s' for the message.", qPrintable(elem_enclosure));
|
qDebug("Adding enclosure '%s' for the message.", qPrintable(elem_enclosure));
|
||||||
}
|
}
|
||||||
|
|
@ -238,7 +239,7 @@ QList<Message> ParsingFactory::parseAsRSS20(const QString &data) {
|
||||||
new_message.m_url = message_item.namedItem("link").toElement().text();
|
new_message.m_url = message_item.namedItem("link").toElement().text();
|
||||||
|
|
||||||
if (new_message.m_url.isEmpty() && !new_message.m_enclosures.isEmpty()) {
|
if (new_message.m_url.isEmpty() && !new_message.m_enclosures.isEmpty()) {
|
||||||
new_message.m_url = new_message.m_enclosures.first();
|
new_message.m_url = new_message.m_enclosures.first().m_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
new_message.m_author = message_item.namedItem("author").toElement().text();
|
new_message.m_author = message_item.namedItem("author").toElement().text();
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@
|
||||||
#define APP_DONATE_URL "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XMWPLPK893VH4"
|
#define APP_DONATE_URL "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XMWPLPK893VH4"
|
||||||
|
|
||||||
#define ENCLOSURES_OUTER_SEPARATOR '#'
|
#define ENCLOSURES_OUTER_SEPARATOR '#'
|
||||||
|
#define ECNLOSURES_INNER_SEPARATOR '&'
|
||||||
#define URI_SCHEME_FEED "feed://"
|
#define URI_SCHEME_FEED "feed://"
|
||||||
#define URI_SCHEME_HTTP "http://"
|
#define URI_SCHEME_HTTP "http://"
|
||||||
#define RELEASES_LIST "https://bitbucket.org/skunkos/rssguard/raw/master/resources/text/UPDATES?at=master"
|
#define RELEASES_LIST "https://bitbucket.org/skunkos/rssguard/raw/master/resources/text/UPDATES?at=master"
|
||||||
|
|
|
||||||
|
|
@ -244,8 +244,12 @@ void WebBrowser::navigateToMessages(const QList<Message> &messages) {
|
||||||
foreach (const Message &message, messages) {
|
foreach (const Message &message, messages) {
|
||||||
QString enclosures;
|
QString enclosures;
|
||||||
|
|
||||||
foreach (const QString &enclosure, message.m_enclosures) {
|
foreach (const Enclosure &enclosure, message.m_enclosures) {
|
||||||
enclosures += skin.m_enclosureMarkup.arg(enclosure);
|
if (!enclosure.m_mimeType.isEmpty()) {
|
||||||
|
enclosures += "[" + enclosure.m_mimeType + "] ";
|
||||||
|
}
|
||||||
|
|
||||||
|
enclosures += skin.m_enclosureMarkup.arg(enclosure.m_url);
|
||||||
enclosures += "<br>";
|
enclosures += "<br>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue