Commit e492b209 authored by Cristian Oneț's avatar Cristian Oneț
Browse files

Only load the child accounts if there are any, otherwise...

Only load the child accounts if there are any, otherwise MyMoneyFile::accountList will return all accounts.

BUG: 309105
parent a5371f1e
......@@ -884,11 +884,13 @@ void InstitutionsModel::slotObjectAdded(MyMoneyFile::notificationObjectT objType
// load the investment sub-accounts if there are any - there could be sub-accounts if this is an add operation
// that was triggered in slotObjectModified on an already existing account which went trough a hierarchy change
QList<MyMoneyAccount> subAccounts;
d->m_file->accountList(subAccounts, account->accountList(), true);
for (QList<MyMoneyAccount>::ConstIterator it_a = subAccounts.constBegin(); it_a != subAccounts.constEnd(); ++it_a) {
if ((*it_a).isInvest()) {
static_cast<InstitutionsPrivate *>(d)->loadInstitution(this, *it_a);
if (!account->accountList().isEmpty()) {
QList<MyMoneyAccount> subAccounts;
d->m_file->accountList(subAccounts, account->accountList());
for (QList<MyMoneyAccount>::ConstIterator it_a = subAccounts.constBegin(); it_a != subAccounts.constEnd(); ++it_a) {
if ((*it_a).isInvest()) {
static_cast<InstitutionsPrivate *>(d)->loadInstitution(this, *it_a);
}
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment