Skip to content
Snippets Groups Projects
Commit c2cf086b authored by Ming Rui Zhang's avatar Ming Rui Zhang
Browse files

newaccountmodel: make account files to be cleared for account deletion

1. Close db when removing an account
2. Clear SIP account folder

Change-Id: I1b8b26b5841528eb5a7315faed023051193277c3
parent c849dce0
No related branches found
No related tags found
No related merge requests found
...@@ -320,6 +320,13 @@ NewAccountModel::exportOnRing(const QString& accountId, const QString& password) ...@@ -320,6 +320,13 @@ NewAccountModel::exportOnRing(const QString& accountId, const QString& password)
void void
NewAccountModel::removeAccount(const QString& accountId) const NewAccountModel::removeAccount(const QString& accountId) const
{ {
auto account = pimpl_->accounts.find(accountId);
if (account == pimpl_->accounts.end()) {
return;
}
// Close db here for its removal
account->second.second->close();
ConfigurationManager::instance().removeAccount(accountId); ConfigurationManager::instance().removeAccount(accountId);
} }
...@@ -764,6 +771,11 @@ NewAccountModelPimpl::removeFromAccounts(const QString& accountId) ...@@ -764,6 +771,11 @@ NewAccountModelPimpl::removeFromAccounts(const QString& accountId)
return; return;
} }
auto& accountInfo = account->second.first; auto& accountInfo = account->second.first;
if (accountInfo.profileInfo.type == profile::Type::SIP) {
auto accountDir = QDir(authority::storage::getPath() + accountId);
accountDir.removeRecursively();
}
/* Inform client about account removal. Do *not* free account structures /* Inform client about account removal. Do *not* free account structures
before we are sure that the client stopped using it, otherwise we might before we are sure that the client stopped using it, otherwise we might
get into use-after-free troubles. */ get into use-after-free troubles. */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment