Clearing deleted entries on applying. (#814)

This commit is contained in:
louib 2017-07-30 13:38:10 -04:00 committed by GitHub
parent 34886dc7e0
commit 6f9224784e
3 changed files with 8 additions and 2 deletions

View File

@ -429,6 +429,7 @@ void EditEntryWidget::saveEntry()
// must stand before beginUpdate() // must stand before beginUpdate()
// we don't want to create a new history item, if only the history has changed // we don't want to create a new history item, if only the history has changed
m_entry->removeHistoryItems(m_historyModel->deletedEntries()); m_entry->removeHistoryItems(m_historyModel->deletedEntries());
m_historyModel->clearDeletedEntries();
m_autoTypeAssoc->removeEmpty(); m_autoTypeAssoc->removeEmpty();
@ -912,8 +913,7 @@ void EditEntryWidget::deleteHistoryEntry()
m_historyModel->deleteIndex(index); m_historyModel->deleteIndex(index);
if (m_historyModel->rowCount() > 0) { if (m_historyModel->rowCount() > 0) {
m_historyUi->deleteAllButton->setEnabled(true); m_historyUi->deleteAllButton->setEnabled(true);
} } else {
else {
m_historyUi->deleteAllButton->setEnabled(false); m_historyUi->deleteAllButton->setEnabled(false);
} }
} }

View File

@ -115,6 +115,11 @@ void EntryHistoryModel::clear()
endResetModel(); endResetModel();
} }
void EntryHistoryModel::clearDeletedEntries()
{
m_deletedHistoryEntries.clear();
}
QList<Entry*> EntryHistoryModel::deletedEntries() QList<Entry*> EntryHistoryModel::deletedEntries()
{ {
return m_deletedHistoryEntries; return m_deletedHistoryEntries;

View File

@ -37,6 +37,7 @@ public:
void setEntries(const QList<Entry*>& entries); void setEntries(const QList<Entry*>& entries);
void clear(); void clear();
void clearDeletedEntries();
QList<Entry*> deletedEntries(); QList<Entry*> deletedEntries();
void deleteIndex(QModelIndex index); void deleteIndex(QModelIndex index);
void deleteAll(); void deleteAll();