Bit polishment added to removing/restoring messages.
This commit is contained in:
parent
45d974ed79
commit
3434d3d24e
@ -1 +1 @@
|
||||
Subproject commit aea11879635d0d6b029a7f6d49d1f31dd95b3c05
|
||||
Subproject commit 1bb36a305e8a23de1e4f3609d8fc4dfeb85ba6fe
|
@ -2,6 +2,7 @@
|
||||
—————
|
||||
|
||||
Added:
|
||||
▪ Messages which are not removed or restored are not instantly deleted from list, they are striked-through instead. This is more resource friendly.
|
||||
▪ Message list is now not reloaded when doing batch message operations.
|
||||
▪ Message list SQL queries are now fully adjustable. This will allow for integration of labels functionality in the future.
|
||||
▪ Auto-update status of feeds is now more general and complete. (issue #91)
|
||||
@ -15,6 +16,7 @@ Changed:
|
||||
▪ Tweaked some conditions for determining newly "updated" messages in ATOM format. (issue #103)
|
||||
|
||||
Fixed:
|
||||
▪ Fixed regression when restoring deleted messages.
|
||||
▪ Crash in TT-RSS plugin on application exit, when TT-RSS user needed to be logged out.
|
||||
|
||||
3.4.0
|
||||
|
@ -227,13 +227,21 @@ QVariant MessagesModel::data(const QModelIndex &idx, int role) const {
|
||||
|
||||
case Qt::FontRole: {
|
||||
QModelIndex idx_read = index(idx.row(), MSG_DB_READ_INDEX);
|
||||
QVariant data_read = m_cache->containsData(idx_read .row()) ? m_cache->data(idx_read ) : QSqlQueryModel::data(idx_read );
|
||||
QVariant data_read = data(idx_read, Qt::EditRole);
|
||||
|
||||
QModelIndex idx_del = index(idx.row(), MSG_DB_DELETED_INDEX);
|
||||
QVariant data_del = m_cache->containsData(idx_del.row()) ? m_cache->data(idx_del) : QSqlQueryModel::data(idx_del);
|
||||
const bool is_bin = qobject_cast<RecycleBin*>(loadedItem());
|
||||
const bool is_deleted = data_del.toBool();
|
||||
const bool striked = is_bin ^ is_deleted;
|
||||
const bool is_bin = qobject_cast<RecycleBin*>(loadedItem()) != nullptr;
|
||||
bool is_deleted;
|
||||
|
||||
if (is_bin) {
|
||||
QModelIndex idx_del = index(idx.row(), MSG_DB_PDELETED_INDEX);
|
||||
is_deleted = data(idx_del, Qt::EditRole).toBool();
|
||||
}
|
||||
else {
|
||||
QModelIndex idx_del = index(idx.row(), MSG_DB_DELETED_INDEX);
|
||||
is_deleted = data(idx_del, Qt::EditRole).toBool();
|
||||
}
|
||||
|
||||
const bool striked = is_deleted;
|
||||
|
||||
if (data_read.toBool()) {
|
||||
return striked ? m_normalStrikedFont : m_normalFont;
|
||||
@ -417,7 +425,12 @@ bool MessagesModel::setBatchMessagesDeleted(const QModelIndexList &messages) {
|
||||
msgs.append(msg);
|
||||
message_ids.append(QString::number(msg.m_id));
|
||||
|
||||
setData(index(message.row(), MSG_DB_DELETED_INDEX), 1);
|
||||
if (qobject_cast<RecycleBin*>(m_selectedItem) != nullptr) {
|
||||
setData(index(message.row(), MSG_DB_PDELETED_INDEX), 1);
|
||||
}
|
||||
else {
|
||||
setData(index(message.row(), MSG_DB_DELETED_INDEX), 1);
|
||||
}
|
||||
}
|
||||
|
||||
reloadWholeLayout();
|
||||
@ -482,6 +495,7 @@ bool MessagesModel::setBatchMessagesRestored(const QModelIndexList &messages) {
|
||||
msgs.append(msg);
|
||||
message_ids.append(QString::number(msg.m_id));
|
||||
|
||||
setData(index(message.row(), MSG_DB_PDELETED_INDEX), 0);
|
||||
setData(index(message.row(), MSG_DB_DELETED_INDEX), 0);
|
||||
}
|
||||
|
||||
|
@ -365,9 +365,10 @@ void MessagesView::deleteSelectedMessages() {
|
||||
const QModelIndexList mapped_indexes = m_proxyModel->mapListToSource(selected_indexes);
|
||||
|
||||
m_sourceModel->setBatchMessagesDeleted(mapped_indexes);
|
||||
current_index = m_proxyModel->index(current_index.row(), current_index.column());
|
||||
current_index = moveCursor(QAbstractItemView::MoveDown, Qt::NoModifier);
|
||||
|
||||
if (current_index.isValid()) {
|
||||
setCurrentIndex(current_index);
|
||||
emit currentMessageChanged(m_sourceModel->messageAt(m_proxyModel->mapToSource(current_index).row()), m_sourceModel->loadedItem());
|
||||
}
|
||||
else {
|
||||
|
@ -115,8 +115,9 @@ bool DatabaseQueries::deleteOrRestoreMessagesToFromBin(QSqlDatabase db, const QS
|
||||
QSqlQuery q(db);
|
||||
q.setForwardOnly(true);
|
||||
|
||||
return q.exec(QString(QSL("UPDATE Messages SET is_deleted = %2 WHERE id IN (%1);")).arg(ids.join(QSL(", ")),
|
||||
QString::number(deleted ? 1 : 0)));
|
||||
return q.exec(QString(QSL("UPDATE Messages SET is_deleted = %2, is_pdeleted = %3 WHERE id IN (%1);")).arg(ids.join(QSL(", ")),
|
||||
QString::number(deleted ? 1 : 0),
|
||||
QString::number(0)));
|
||||
}
|
||||
|
||||
bool DatabaseQueries::restoreBin(QSqlDatabase db, int account_id) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user