diff --git a/src/core/feedsmodelstandardfeed.cpp b/src/core/feedsmodelstandardfeed.cpp index 623297e7a..8fc7a1f4c 100755 --- a/src/core/feedsmodelstandardfeed.cpp +++ b/src/core/feedsmodelstandardfeed.cpp @@ -322,8 +322,7 @@ bool FeedsModelStandardFeed::removeItself() { } void FeedsModelStandardFeed::updateMessages(const QList &messages) { - int feed_id = id(), message_id; - qint64 message_creation_date; + int feed_id = id(); QSqlDatabase database = DatabaseFactory::instance()->connection("FeedsModelStandardFeed", DatabaseFactory::FromSettings); diff --git a/src/core/parsingfactory.cpp b/src/core/parsingfactory.cpp old mode 100644 new mode 100755 index dbd6a52ae..b4b5df76b --- a/src/core/parsingfactory.cpp +++ b/src/core/parsingfactory.cpp @@ -52,11 +52,10 @@ QList ParsingFactory::parseAsATOM10(const QString &data) { // Deal with link. QDomNodeList elem_links = message_item.toElement().elementsByTagName("link"); - for (int i = 0; i < elem_links.size(); i++) { - QDomNode elem_link = elem_links.at(i); + for (int i = 0; i < elem_links.size(); i++) { + new_message.m_url = elem_links.at(i).attributes().namedItem("href").toAttr().value(); - if (elem_link.attributes().namedItem("rel").toAttr().value() == "alternate") { - new_message.m_url = elem_link.attributes().namedItem("href").toAttr().value(); + if (!new_message.m_url.isNull() && !new_message.m_url.isEmpty()) { break; } } @@ -214,9 +213,12 @@ QList ParsingFactory::parseAsRSS20(const QString &data) { // Deal with creation date. new_message.m_created = TextFactory::parseDateTime(message_item.namedItem("pubDate").toElement().text()); - new_message.m_createdFromFeed = !new_message.m_created.isNull(); - if (!new_message.m_createdFromFeed) { + if (new_message.m_created.isNull()) { + new_message.m_created = TextFactory::parseDateTime(message_item.namedItem("date").toElement().text()); + } + + if (!(new_message.m_createdFromFeed = !new_message.m_created.isNull())) { // Date was NOT obtained from the feed, // set current date as creation date for the message. new_message.m_created = current_time; diff --git a/src/core/textfactory.cpp b/src/core/textfactory.cpp old mode 100644 new mode 100755 index e5288fb5a..4848f6e46 --- a/src/core/textfactory.cpp +++ b/src/core/textfactory.cpp @@ -24,8 +24,8 @@ QDateTime TextFactory::parseDateTime(const QString &date_time) { date_patterns << "yyyy-MM-ddTHH:mm:ss" << "MMM dd yyyy hh:mm:ss" << "MMM d yyyy hh:mm:ss" << "ddd, dd MMM yyyy HH:mm:ss" << "dd MMM yyyy" << "yyyy-MM-dd HH:mm:ss.z" << "yyyy-MM-dd" << - "YYYY" << "YYYY-MM" << "YYYY-MM-DD" << "YYYY-MM-DDThh:mm" << - "YYYY-MM-DDThh:mm:ss"; + "yyyy" << "yyyy-MM" << "yyyy-MM-dd" << "yyyy-MM-ddThh:mm" << + "yyyy-MM-ddThh:mm:ss"; // Check if last part of date is time zone offset, // represented as [+|-]hh:mm. @@ -85,8 +85,7 @@ QDateTime TextFactory::parseDateTime(const QString &date_time) { } QDateTime TextFactory::parseDateTime(qint64 milis_from_epoch) { - QDateTime converted = QDateTime::fromMSecsSinceEpoch(milis_from_epoch); - return converted; + return QDateTime::fromMSecsSinceEpoch(milis_from_epoch); } QString TextFactory::shorten(const QString &input, int text_length_limit) {