diff --git a/src/gui/entry/EditEntryWidget.cpp b/src/gui/entry/EditEntryWidget.cpp index 6d8ba5061..b84fa2488 100644 --- a/src/gui/entry/EditEntryWidget.cpp +++ b/src/gui/entry/EditEntryWidget.cpp @@ -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); diff --git a/src/gui/entry/EntryHistoryModel.cpp b/src/gui/entry/EntryHistoryModel.cpp index acde63cb5..618f4328f 100644 --- a/src/gui/entry/EntryHistoryModel.cpp +++ b/src/gui/entry/EntryHistoryModel.cpp @@ -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(); } }