Skip to content
Snippets Groups Projects
Commit 648acfbd authored by Emmanuel Lepage Vallée's avatar Emmanuel Lepage Vallée Committed by Stepan Salenikovich
Browse files

accountmodel: Correctly cancel changes

There was a few missing peices to correctly undo the changes
when canceling the AccountModel

Tuleap: #212
Change-Id: Icb296a424ad30017b8b6ba5cc49a2d3dc834394f
parent be330c4f
Branches
Tags
No related merge requests found
...@@ -547,11 +547,27 @@ void AccountModel::registerAllAccounts() ...@@ -547,11 +547,27 @@ void AccountModel::registerAllAccounts()
///Cancel all modifications ///Cancel all modifications
void AccountModel::cancel() { void AccountModel::cancel() {
foreach (Account* a, d_ptr->m_lAccounts) { foreach (Account* a, d_ptr->m_lAccounts) {
if (a->editState() == Account::EditState::MODIFIED_COMPLETE // Account::EditState::NEW is only for new and unmodified accounts
|| a->editState() == Account::EditState::MODIFIED_INCOMPLETE if (a->isNew())
|| a->editState() == Account::EditState::OUTDATED remove(a);
) else {
a->performAction(Account::EditAction::CANCEL); switch(a->editState()) {
case Account::EditState::NEW :
remove(a);
case Account::EditState::MODIFIED_INCOMPLETE:
case Account::EditState::MODIFIED_COMPLETE :
a << Account::EditAction::CANCEL;
break;
case Account::EditState::OUTDATED :
a << Account::EditAction::RELOAD;
break;
case Account::EditState::READY :
case Account::EditState::REMOVED :
case Account::EditState::EDITING :
case Account::EditState::COUNT__ :
break;
}
}
} }
d_ptr->m_lDeletedAccounts.clear(); d_ptr->m_lDeletedAccounts.clear();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment