From 6f9224784e962ac2cd172e4845d19eef58a4293f Mon Sep 17 00:00:00 2001 From: louib Date: Sun, 30 Jul 2017 13:38:10 -0400 Subject: [PATCH] Clearing deleted entries on applying. (#814) --- src/gui/entry/EditEntryWidget.cpp | 4 ++-- src/gui/entry/EntryHistoryModel.cpp | 5 +++++ src/gui/entry/EntryHistoryModel.h | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/gui/entry/EditEntryWidget.cpp b/src/gui/entry/EditEntryWidget.cpp index bea10b995..c8545e428 100644 --- a/src/gui/entry/EditEntryWidget.cpp +++ b/src/gui/entry/EditEntryWidget.cpp @@ -429,6 +429,7 @@ void EditEntryWidget::saveEntry() // must stand before beginUpdate() // we don't want to create a new history item, if only the history has changed m_entry->removeHistoryItems(m_historyModel->deletedEntries()); + m_historyModel->clearDeletedEntries(); m_autoTypeAssoc->removeEmpty(); @@ -912,8 +913,7 @@ void EditEntryWidget::deleteHistoryEntry() m_historyModel->deleteIndex(index); if (m_historyModel->rowCount() > 0) { m_historyUi->deleteAllButton->setEnabled(true); - } - else { + } else { m_historyUi->deleteAllButton->setEnabled(false); } } diff --git a/src/gui/entry/EntryHistoryModel.cpp b/src/gui/entry/EntryHistoryModel.cpp index ca21055c6..21f0aec43 100644 --- a/src/gui/entry/EntryHistoryModel.cpp +++ b/src/gui/entry/EntryHistoryModel.cpp @@ -115,6 +115,11 @@ void EntryHistoryModel::clear() endResetModel(); } +void EntryHistoryModel::clearDeletedEntries() +{ + m_deletedHistoryEntries.clear(); +} + QList EntryHistoryModel::deletedEntries() { return m_deletedHistoryEntries; diff --git a/src/gui/entry/EntryHistoryModel.h b/src/gui/entry/EntryHistoryModel.h index a7434e013..6d186f049 100644 --- a/src/gui/entry/EntryHistoryModel.h +++ b/src/gui/entry/EntryHistoryModel.h @@ -37,6 +37,7 @@ public: void setEntries(const QList& entries); void clear(); + void clearDeletedEntries(); QList deletedEntries(); void deleteIndex(QModelIndex index); void deleteAll();