From ec70e94c7ddac6b35e50ec1b7ded33f98d1bbd86 Mon Sep 17 00:00:00 2001 From: Martin Rotter Date: Tue, 3 Oct 2017 07:55:39 +0200 Subject: [PATCH] Fixup some messed contents when getting list of messages from SQL. --- src/core/message.cpp | 5 +++-- src/core/messagesmodel.cpp | 10 +++++++--- src/miscellaneous/databasequeries.cpp | 6 +++--- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/core/message.cpp b/src/core/message.cpp index 4008267da..ff1edc6ed 100755 --- a/src/core/message.cpp +++ b/src/core/message.cpp @@ -71,11 +71,12 @@ Message::Message() { } Message Message::fromSqlRecord(const QSqlRecord& record, bool* result) { - if (record.count() != MSG_DB_CUSTOM_HASH_INDEX + 1) { + if (record.count() != MSG_DB_FEED_CUSTOM_ID_INDEX + 1) { if (result != nullptr) { *result = false; - return Message(); } + + return Message(); } Message message; diff --git a/src/core/messagesmodel.cpp b/src/core/messagesmodel.cpp index 7a3610cd0..9e358c305 100755 --- a/src/core/messagesmodel.cpp +++ b/src/core/messagesmodel.cpp @@ -151,7 +151,9 @@ Message MessagesModel::messageAt(int row_index) const { } void MessagesModel::setupHeaderData() { - m_headerData << /*: Tooltip for ID of message.*/ tr("Id") << + m_headerData << + + /*: Tooltip for ID of message.*/ tr("Id") << /*: Tooltip for "read" column in msg list.*/ tr("Read") << @@ -181,8 +183,10 @@ void MessagesModel::setupHeaderData() { /*: Tooltip for custom hash string of message.*/ tr("Custom hash") << - /*: Tooltip for custom ID of feed of message.*/ tr("Feed ID");; - m_tooltipData << tr("Id of the message.") << tr("Is message read?") << + /*: Tooltip for custom ID of feed of message.*/ tr("Feed ID"); + + m_tooltipData << + tr("Id of the message.") << tr("Is message read?") << tr("Is message deleted?") << tr("Is message important?") << tr("Id of feed which this message belongs to.") << tr("Title of the message.") << tr("Url of the message.") << diff --git a/src/miscellaneous/databasequeries.cpp b/src/miscellaneous/databasequeries.cpp index 55f20bac9..0a1384ed1 100755 --- a/src/miscellaneous/databasequeries.cpp +++ b/src/miscellaneous/databasequeries.cpp @@ -351,7 +351,7 @@ QList DatabaseQueries::getUndeletedMessagesForFeed(QSqlDatabase db, con QSqlQuery q(db); q.setForwardOnly(true); - q.prepare("SELECT * " + q.prepare("SELECT id, is_read, is_deleted, is_important, custom_id, title, url, author, date_created, contents, is_pdeleted, enclosures, account_id, custom_id, custom_hash, feed " "FROM Messages " "WHERE is_deleted = 0 AND is_pdeleted = 0 AND feed = :feed AND account_id = :account_id;"); q.bindValue(QSL(":feed"), feed_custom_id); @@ -385,7 +385,7 @@ QList DatabaseQueries::getUndeletedMessagesForBin(QSqlDatabase db, int QSqlQuery q(db); q.setForwardOnly(true); - q.prepare("SELECT * " + q.prepare("SELECT id, is_read, is_deleted, is_important, custom_id, title, url, author, date_created, contents, is_pdeleted, enclosures, account_id, custom_id, custom_hash, feed " "FROM Messages " "WHERE is_deleted = 1 AND is_pdeleted = 0 AND account_id = :account_id;"); q.bindValue(QSL(":account_id"), account_id); @@ -418,7 +418,7 @@ QList DatabaseQueries::getUndeletedMessagesForAccount(QSqlDatabase db, QSqlQuery q(db); q.setForwardOnly(true); - q.prepare("SELECT * " + q.prepare("SELECT id, is_read, is_deleted, is_important, custom_id, title, url, author, date_created, contents, is_pdeleted, enclosures, account_id, custom_id, custom_hash, feed " "FROM Messages " "WHERE is_deleted = 0 AND is_pdeleted = 0 AND account_id = :account_id;"); q.bindValue(QSL(":account_id"), account_id);