Fix lang column count.

This commit is contained in:
Martin Rotter 2016-04-06 09:43:05 +02:00
parent 3bc79c071c
commit 4dc7791b87
5 changed files with 21 additions and 16 deletions

View File

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

View File

@ -88,7 +88,7 @@
<item row="0" column="1">
<widget class="QStackedWidget" name="m_stackedSettings">
<property name="currentIndex">
<number>0</number>
<number>4</number>
</property>
<widget class="QWidget" name="m_pageGeneral">
<layout class="QFormLayout" name="formLayout_5">
@ -417,8 +417,8 @@ Authors of this application are NOT responsible for lost data.</string>
<rect>
<x>0</x>
<y>0</y>
<width>100</width>
<height>30</height>
<width>782</width>
<height>451</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
@ -495,8 +495,8 @@ Authors of this application are NOT responsible for lost data.</string>
<rect>
<x>0</x>
<y>0</y>
<width>167</width>
<height>219</height>
<width>776</width>
<height>425</height>
</rect>
</property>
<layout class="QFormLayout" name="formLayout">

View File

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

View File

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

View File

@ -279,16 +279,9 @@ QStringList ServiceRoot::customIDSOfMessagesForItem(RootItem *item) {
}
bool ServiceRoot::markFeedsReadUnread(QList<Feed*> 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<RootItem*> itemss;
foreach (Feed *feed, items) {