Fix removing entry from history and improve logic of history tab showing

This commit is contained in:
qycyfjy 2023-10-21 05:50:55 +08:00 committed by Jonathan White
parent 99e42b1fce
commit 067deb9bd7
2 changed files with 3 additions and 1 deletions

View File

@ -1151,6 +1151,7 @@ bool EditEntryWidget::commitEntry()
}
m_historyModel->setEntries(m_entry->historyItems(), m_entry);
setPageHidden(m_historyWidget, m_history || m_entry->historyItems().count() < 1);
m_advancedUi->attachmentsWidget->linkAttachments(m_entry->attachments());
showMessage(tr("Entry updated successfully."), MessageWidget::Positive);

View File

@ -158,9 +158,10 @@ void EntryHistoryModel::deleteIndex(QModelIndex index)
{
auto entry = entryFromIndex(index);
if (entry) {
beginRemoveRows(QModelIndex(), m_historyEntries.indexOf(entry), m_historyEntries.indexOf(entry));
beginRemoveRows(QModelIndex(), index.row(), index.row());
m_historyEntries.removeAll(entry);
m_deletedHistoryEntries << entry;
m_historyModifications.erase(m_historyModifications.begin() + index.row());
endRemoveRows();
}
}