diff --git a/resources/text/CHANGELOG b/resources/text/CHANGELOG
index daaa0101e..4de4e2fbb 100644
--- a/resources/text/CHANGELOG
+++ b/resources/text/CHANGELOG
@@ -2,13 +2,14 @@
2.4.0
Added:
+- Message previewer now displays MIME type of all podcasts too. This MIME type is also stored in DB.
- Ability to fetch only new icon for feed from its online source.
- Option to search highlighted text in web browser via Google, available from context menu. (issue #72)
Fixed:
-
+- Titles and descriptions of feeds are now fetched correctly in feed add/edit dialog.
diff --git a/src/core/feedsmodelfeed.cpp b/src/core/feedsmodelfeed.cpp
index 58754f6e7..06415b073 100755
--- a/src/core/feedsmodelfeed.cpp
+++ b/src/core/feedsmodelfeed.cpp
@@ -278,7 +278,6 @@ QPair FeedsModelFeed::guessFeed(co
DOWNLOAD_TIMEOUT,
icon_data)) == QNetworkReply::NoError) {
// Icon for feed was downloaded and is stored now in _icon_data.
- result.first = new FeedsModelFeed();
result.first->setIcon(icon_data);
}
}
diff --git a/src/core/messagesmodel.h b/src/core/messagesmodel.h
index 823cdb901..fea678e2d 100755
--- a/src/core/messagesmodel.h
+++ b/src/core/messagesmodel.h
@@ -31,26 +31,48 @@
struct Enclosure {
QString m_mimeType;
QString m_url;
+
+ explicit Enclosure(const QString &url = QString(), const QString &mime = QString()) : m_url(url), m_mimeType(mime) {
+ }
};
// Represents single enclosure.
class Enclosures {
public:
- static QStringList decodeEnclosuresFromString(const QString &enclosures_data) {
- QStringList enclosures;
+ static QList decodeEnclosuresFromString(const QString &enclosures_data) {
+ QList enclosures;
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;
}
- static QString encodeEnclosuresToString(const QStringList &enclosures) {
+ static QString encodeEnclosuresToString(const QList &enclosures) {
QStringList enclosures_str;
- foreach (const QString &enclosure, enclosures) {
- enclosures_str.append(enclosure.toLocal8Bit().toBase64());
+ foreach (const Enclosure &enclosure, enclosures) {
+ 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));
@@ -62,7 +84,7 @@ class Message {
public:
explicit Message() {
m_title = m_url = m_author = m_contents = "";
- m_enclosures = QStringList();
+ m_enclosures = QList();
}
QString m_title;
@@ -71,7 +93,7 @@ class Message {
QString m_contents;
QDateTime m_created;
- QStringList m_enclosures;
+ QList m_enclosures;
// Is true if "created" date was obtained directly
// from the feed, otherwise is false
diff --git a/src/core/parsingfactory.cpp b/src/core/parsingfactory.cpp
index e9b0ca3ae..ea1e4a604 100755
--- a/src/core/parsingfactory.cpp
+++ b/src/core/parsingfactory.cpp
@@ -74,9 +74,9 @@ QList ParsingFactory::parseAsATOM10(const QString &data) {
QDomElement link = elem_links.at(i).toElement();
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 {
new_message.m_url = link.attribute("href");
@@ -84,7 +84,7 @@ QList ParsingFactory::parseAsATOM10(const QString &data) {
}
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.
@@ -205,6 +205,7 @@ QList ParsingFactory::parseAsRSS20(const QString &data) {
QString elem_title = message_item.namedItem("title").toElement().text().simplified();
QString elem_description = message_item.namedItem("description").toElement().text();
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()) {
elem_description = message_item.namedItem("encoded").toElement().text();
@@ -229,7 +230,7 @@ QList ParsingFactory::parseAsRSS20(const QString &data) {
}
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));
}
@@ -238,7 +239,7 @@ QList ParsingFactory::parseAsRSS20(const QString &data) {
new_message.m_url = message_item.namedItem("link").toElement().text();
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();
diff --git a/src/definitions/definitions.h.in b/src/definitions/definitions.h.in
index 0612d5c1c..3450079a2 100755
--- a/src/definitions/definitions.h.in
+++ b/src/definitions/definitions.h.in
@@ -39,6 +39,7 @@
#define APP_DONATE_URL "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XMWPLPK893VH4"
#define ENCLOSURES_OUTER_SEPARATOR '#'
+#define ECNLOSURES_INNER_SEPARATOR '&'
#define URI_SCHEME_FEED "feed://"
#define URI_SCHEME_HTTP "http://"
#define RELEASES_LIST "https://bitbucket.org/skunkos/rssguard/raw/master/resources/text/UPDATES?at=master"
diff --git a/src/network-web/webbrowser.cpp b/src/network-web/webbrowser.cpp
index cd32bcb16..ec999aad2 100755
--- a/src/network-web/webbrowser.cpp
+++ b/src/network-web/webbrowser.cpp
@@ -244,8 +244,12 @@ void WebBrowser::navigateToMessages(const QList &messages) {
foreach (const Message &message, messages) {
QString enclosures;
- foreach (const QString &enclosure, message.m_enclosures) {
- enclosures += skin.m_enclosureMarkup.arg(enclosure);
+ foreach (const Enclosure &enclosure, message.m_enclosures) {
+ if (!enclosure.m_mimeType.isEmpty()) {
+ enclosures += "[" + enclosure.m_mimeType + "] ";
+ }
+
+ enclosures += skin.m_enclosureMarkup.arg(enclosure.m_url);
enclosures += "
";
}