diff --git a/src/gui/dialogs/formsettings.cpp b/src/gui/dialogs/formsettings.cpp index a84469654..97be413a2 100755 --- a/src/gui/dialogs/formsettings.cpp +++ b/src/gui/dialogs/formsettings.cpp @@ -68,7 +68,7 @@ FormSettings::FormSettings(QWidget *parent) : QDialog(parent), m_ui(new Ui::Form // Setup behavior. m_ui->m_listSettings->setCurrentRow(0); - m_ui->m_treeLanguages->setColumnCount(5); + m_ui->m_treeLanguages->setColumnCount(4); m_ui->m_treeLanguages->setHeaderHidden(false); m_ui->m_treeLanguages->setHeaderLabels(QStringList() << /*: Language column of language list. */ tr("Language") @@ -89,7 +89,6 @@ FormSettings::FormSettings(QWidget *parent) : QDialog(parent), m_ui(new Ui::Form m_ui->m_treeLanguages->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents); m_ui->m_treeLanguages->header()->setSectionResizeMode(2, QHeaderView::ResizeToContents); m_ui->m_treeLanguages->header()->setSectionResizeMode(3, QHeaderView::ResizeToContents); - m_ui->m_treeLanguages->header()->setSectionResizeMode(4, QHeaderView::ResizeToContents); // Setup skins. m_ui->m_treeSkins->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents); diff --git a/src/gui/dialogs/formsettings.ui b/src/gui/dialogs/formsettings.ui index 8c2271efc..4ee095da7 100755 --- a/src/gui/dialogs/formsettings.ui +++ b/src/gui/dialogs/formsettings.ui @@ -88,7 +88,7 @@ - 0 + 4 @@ -417,8 +417,8 @@ Authors of this application are NOT responsible for lost data. 0 0 - 100 - 30 + 782 + 451 @@ -495,8 +495,8 @@ Authors of this application are NOT responsible for lost data. 0 0 - 167 - 219 + 776 + 425 diff --git a/src/miscellaneous/databasequeries.cpp b/src/miscellaneous/databasequeries.cpp index 8c9ef8fc5..fb4701034 100644 --- a/src/miscellaneous/databasequeries.cpp +++ b/src/miscellaneous/databasequeries.cpp @@ -51,6 +51,18 @@ bool DatabaseQueries::markMessageImportant(QSqlDatabase db, int id, RootItem::Im return q.exec(); } +bool DatabaseQueries::markFeedsReadUnread(QSqlDatabase db, const QStringList &ids, int account_id, RootItem::ReadStatus read) { + QSqlQuery query_read_msg(db); + query_read_msg.setForwardOnly(true); + query_read_msg.prepare(QString("UPDATE Messages SET is_read = :read " + "WHERE feed IN (%1) AND is_deleted = 0 AND is_pdeleted = 0 AND account_id = :account_id;").arg(ids.join(QSL(", ")))); + + query_read_msg.bindValue(QSL(":read"), read == RootItem::Read ? 1 : 0); + query_read_msg.bindValue(QSL(":account_id"), account_id); + + return query_read_msg.exec(); +} + bool DatabaseQueries::markBinReadUnread(QSqlDatabase db, int account_id, RootItem::ReadStatus read) { QSqlQuery q(db); q.setForwardOnly(true); diff --git a/src/miscellaneous/databasequeries.h b/src/miscellaneous/databasequeries.h index 8f9264b8e..36941d7e6 100644 --- a/src/miscellaneous/databasequeries.h +++ b/src/miscellaneous/databasequeries.h @@ -27,6 +27,7 @@ class DatabaseQueries { public: static bool markMessagesReadUnread(QSqlDatabase db, const QStringList &ids, RootItem::ReadStatus read); static bool markMessageImportant(QSqlDatabase db, int id, RootItem::Importance importance); + static bool markFeedsReadUnread(QSqlDatabase db, const QStringList &ids, int account_id, RootItem::ReadStatus read); static bool markBinReadUnread(QSqlDatabase db, int account_id, RootItem::ReadStatus read); static bool markAccountReadUnread(QSqlDatabase db, int account_id, RootItem::ReadStatus read); static bool switchMessagesImportance(QSqlDatabase db, const QStringList &ids); diff --git a/src/services/abstract/serviceroot.cpp b/src/services/abstract/serviceroot.cpp index d4636dbb6..5b3dc693e 100755 --- a/src/services/abstract/serviceroot.cpp +++ b/src/services/abstract/serviceroot.cpp @@ -279,16 +279,9 @@ QStringList ServiceRoot::customIDSOfMessagesForItem(RootItem *item) { } bool ServiceRoot::markFeedsReadUnread(QList items, RootItem::ReadStatus read) { - QSqlDatabase db_handle = qApp->database()->connection(metaObject()->className(), DatabaseFactory::FromSettings); - QSqlQuery query_read_msg(db_handle); - query_read_msg.setForwardOnly(true); - query_read_msg.prepare(QString("UPDATE Messages SET is_read = :read " - "WHERE feed IN (%1) AND is_deleted = 0 AND is_pdeleted = 0 AND account_id = :account_id;").arg(textualFeedIds(items).join(QSL(", ")))); + QSqlDatabase database = qApp->database()->connection(metaObject()->className(), DatabaseFactory::FromSettings); - query_read_msg.bindValue(QSL(":read"), read == RootItem::Read ? 1 : 0); - query_read_msg.bindValue(QSL(":account_id"), accountId()); - - if (query_read_msg.exec()) { + if (DatabaseQueries::markFeedsReadUnread(database, textualFeedIds(items), accountId(), read)) { QList itemss; foreach (Feed *feed, items) {