[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kmymoney/4.6] kmymoney/models: Only load the child accounts if there are any, otherwise MyMoneyFile
From:       Cristian_OneČ› <onet.cristian () gmail ! com>
Date:       2012-11-16 6:51:46
Message-ID: 20121116065146.84D57A6091 () git ! kde ! org
[Download RAW message or body]

Git commit ff5ec06b2eee8b367a2bbd2a50f5c04de7fa45ee by Cristian OneČ›.
Committed on 16/11/2012 at 07:49.
Pushed by conet into branch '4.6'.

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

BUG: 309105
(cherry picked from commit e492b20918f569e218b65925b7f758aeef01d865)

M  +7    -5    kmymoney/models/accountsmodel.cpp

http://commits.kde.org/kmymoney/ff5ec06b2eee8b367a2bbd2a50f5c04de7fa45ee

diff --git a/kmymoney/models/accountsmodel.cpp b/kmymoney/models/accountsmodel.cpp
index 37816f5..3679314 100644
--- a/kmymoney/models/accountsmodel.cpp
+++ b/kmymoney/models/accountsmodel.cpp
@@ -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);
+      }
     }
   }
 }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic