Fixup some messed contents when getting list of messages from SQL.

This commit is contained in:
Martin Rotter 2017-10-03 07:55:39 +02:00
parent 2b85b06b48
commit ec70e94c7d
3 changed files with 13 additions and 8 deletions

View File

@ -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;

View File

@ -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.") <<

View File

@ -351,7 +351,7 @@ QList<Message> 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<Message> 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<Message> 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);