diff options
Diffstat (limited to 'kmymoney2/mymoney/mymoneyfile.cpp')
-rw-r--r-- | kmymoney2/mymoney/mymoneyfile.cpp | 126 |
1 files changed, 63 insertions, 63 deletions
diff --git a/kmymoney2/mymoney/mymoneyfile.cpp b/kmymoney2/mymoney/mymoneyfile.cpp index 4b354ef..c36c163 100644 --- a/kmymoney2/mymoney/mymoneyfile.cpp +++ b/kmymoney2/mymoney/mymoneyfile.cpp @@ -175,7 +175,7 @@ void MyMoneyFile::addInstitution(MyMoneyInstitution& institution) { // perform some checks to see that the institution stuff is OK. For // now we assume that the institution must have a name, the ID is not set - // and it does not have a tqparent (MyMoneyFile). + // and it does not have a parent (MyMoneyFile). if(institution.name().length() == 0 || institution.id().length() != 0) @@ -318,7 +318,7 @@ void MyMoneyFile::modifyAccount(const MyMoneyAccount& _account) addNotification(account.id()); } -void MyMoneyFile::reparentAccount(MyMoneyAccount &account, MyMoneyAccount& tqparent) +void MyMoneyFile::reparentAccount(MyMoneyAccount &account, MyMoneyAccount& parent) { checkTransaction(__PRETTY_FUNCTION__); @@ -326,27 +326,27 @@ void MyMoneyFile::reparentAccount(MyMoneyAccount &account, MyMoneyAccount& tqpar if(isStandardAccount(account.id())) throw new MYMONEYEXCEPTION("Unable to reparent the standard account groups"); - if(account.accountGroup() == tqparent.accountGroup() - || (account.accountType() == MyMoneyAccount::Income && tqparent.accountType() == MyMoneyAccount::Expense) - || (account.accountType() == MyMoneyAccount::Expense && tqparent.accountType() == MyMoneyAccount::Income)) { + if(account.accountGroup() == parent.accountGroup() + || (account.accountType() == MyMoneyAccount::Income && parent.accountType() == MyMoneyAccount::Expense) + || (account.accountType() == MyMoneyAccount::Expense && parent.accountType() == MyMoneyAccount::Income)) { - if(account.isInvest() && tqparent.accountType() != MyMoneyAccount::Investment) + if(account.isInvest() && parent.accountType() != MyMoneyAccount::Investment) throw new MYMONEYEXCEPTION("Unable to reparent Stock to non-investment account"); - if(tqparent.accountType() == MyMoneyAccount::Investment && !account.isInvest()) + if(parent.accountType() == MyMoneyAccount::Investment && !account.isInvest()) throw new MYMONEYEXCEPTION("Unable to reparent non-stock to investment account"); // clear all changed objects from cache MyMoneyNotifier notifier(this); - // keep a notification of the current tqparent + // keep a notification of the current parent addNotification(account.parentAccountId()); - m_storage->reparentAccount(account, tqparent); + m_storage->reparentAccount(account, parent); - // and also keep one for the account itself and the new tqparent + // and also keep one for the account itself and the new parent addNotification(account.id()); - addNotification(tqparent.id()); + addNotification(parent.id()); } else throw new MYMONEYEXCEPTION("Unable to reparent to different account type"); @@ -429,14 +429,14 @@ void MyMoneyFile::removeAccount(const MyMoneyAccount& account) { checkTransaction(__PRETTY_FUNCTION__); - MyMoneyAccount tqparent; + MyMoneyAccount parent; MyMoneyAccount acc; MyMoneyInstitution institution; - // check that the account and its tqparent exist + // check that the account and its parent exist // this will throw an exception if the id is unknown acc = MyMoneyFile::account(account.id()); - tqparent = MyMoneyFile::account(account.parentAccountId()); + parent = MyMoneyFile::account(account.parentAccountId()); if(!acc.institutionId().isEmpty()) institution = MyMoneyFile::institution(acc.institutionId()); @@ -455,8 +455,8 @@ void MyMoneyFile::removeAccount(const MyMoneyAccount& account) TQStringList::ConstIterator it; for(it = acc.accountList().begin(); it != acc.accountList().end(); ++it) addNotification(*it); - // don't forget the tqparent and a possible institution - addNotification(tqparent.id()); + // don't forget the parent and a possible institution + addNotification(parent.id()); addNotification(account.institutionId()); if(!institution.id().isEmpty()) { @@ -542,7 +542,7 @@ void MyMoneyFile::removeInstitution(const MyMoneyInstitution& institution) addNotification(institution.id(), false); } -void MyMoneyFile::addAccount(MyMoneyAccount& account, MyMoneyAccount& tqparent) +void MyMoneyFile::addAccount(MyMoneyAccount& account, MyMoneyAccount& parent) { checkTransaction(__PRETTY_FUNCTION__); @@ -550,7 +550,7 @@ void MyMoneyFile::addAccount(MyMoneyAccount& account, MyMoneyAccount& tqparent) // perform some checks to see that the account stuff is OK. For // now we assume that the account must have a name, has no - // transaction and sub-accounts and tqparent account + // transaction and sub-accounts and parent account // it's own ID is not set and it does not have a pointer to (MyMoneyFile) if(account.name().length() == 0) @@ -563,15 +563,15 @@ void MyMoneyFile::addAccount(MyMoneyAccount& account, MyMoneyAccount& tqparent) throw new MYMONEYEXCEPTION("New account must have no sub-accounts"); if(!account.parentAccountId().isEmpty()) - throw new MYMONEYEXCEPTION("New account must have no tqparent-id"); + throw new MYMONEYEXCEPTION("New account must have no parent-id"); if(account.accountType() == MyMoneyAccount::UnknownAccountType) throw new MYMONEYEXCEPTION("Account has invalid type"); - // make sure, that the tqparent account exists + // make sure, that the parent account exists // if not, an exception is thrown. If it exists, // get a copy of the current data - MyMoneyAccount acc = MyMoneyFile::account(tqparent.id()); + MyMoneyAccount acc = MyMoneyFile::account(parent.id()); #if 0 // TODO: remove the following code as we now can have multiple accounts @@ -589,22 +589,22 @@ void MyMoneyFile::addAccount(MyMoneyAccount& account, MyMoneyAccount& tqparent) } #endif - // FIXME: make sure, that the tqparent has the same type + // FIXME: make sure, that the parent has the same type // I left it out here because I don't know, if there is // a tight coupling between e.g. checking accounts and the // class asset. It certainly does not make sense to create an // expense account under an income account. Maybe it does, I don't know. - // We enforce, that a stock account can never be a tqparent and - // that the tqparent for a stock account must be an investment. Also, - // an investment cannot have another investment account as it's tqparent - if(tqparent.isInvest()) - throw new MYMONEYEXCEPTION("Stock account cannot be tqparent account"); + // We enforce, that a stock account can never be a parent and + // that the parent for a stock account must be an investment. Also, + // an investment cannot have another investment account as it's parent + if(parent.isInvest()) + throw new MYMONEYEXCEPTION("Stock account cannot be parent account"); - if(account.isInvest() && tqparent.accountType() != MyMoneyAccount::Investment) - throw new MYMONEYEXCEPTION("Stock account must have investment account as tqparent "); + if(account.isInvest() && parent.accountType() != MyMoneyAccount::Investment) + throw new MYMONEYEXCEPTION("Stock account must have investment account as parent "); - if(!account.isInvest() && tqparent.accountType() == MyMoneyAccount::Investment) + if(!account.isInvest() && parent.accountType() == MyMoneyAccount::Investment) throw new MYMONEYEXCEPTION("Investment account can only have stock accounts as tqchildren"); // clear all changed objects from cache @@ -622,10 +622,10 @@ void MyMoneyFile::addAccount(MyMoneyAccount& account, MyMoneyAccount& tqparent) account.setOpeningDate(TQDate::tqcurrentDate()); } - account.setParentAccountId(tqparent.id()); + account.setParentAccountId(parent.id()); m_storage->addAccount(account); - m_storage->addAccount(tqparent, account); + m_storage->addAccount(parent, account); if(account.institutionId().length() != 0) { institution.addAccountId(account.id()); @@ -634,7 +634,7 @@ void MyMoneyFile::addAccount(MyMoneyAccount& account, MyMoneyAccount& tqparent) } d->m_cache.preloadAccount(account); - addNotification(tqparent.id()); + addNotification(parent.id()); } MyMoneyTransaction MyMoneyFile::createOpeningBalanceTransaction(const MyMoneyAccount& acc, const MyMoneyMoney& balance) @@ -793,8 +793,8 @@ const MyMoneyAccount MyMoneyFile::createOpeningBalanceAccount(const MyMoneySecur acc.setAccountType(MyMoneyAccount::Equity); acc.setCurrencyId(security.id()); - MyMoneyAccount tqparent = equity(); - this->addAccount(acc, tqparent); + MyMoneyAccount parent = equity(); + this->addAccount(acc, parent); return acc; } @@ -1351,7 +1351,7 @@ const TQStringList MyMoneyFile::consistencyCheck(void) TQMap<TQString, bool> interestAccounts; - MyMoneyAccount tqparent; + MyMoneyAccount parent; MyMoneyAccount child; MyMoneyAccount toplevel; @@ -1408,14 +1408,14 @@ const TQStringList MyMoneyFile::consistencyCheck(void) try { bool dropOut = false; while(!isStandardAccount(parentId) && !dropOut) { - tqparent = account(parentId); - if(tqparent.id() == (*it_a).id()) { - // tqparent loops, so we need to re-tqparent to toplevel account - // find tqparent account in our list + parent = account(parentId); + if(parent.id() == (*it_a).id()) { + // parent loops, so we need to re-parent to toplevel account + // find parent account in our list problemCount++; TQValueList<MyMoneyAccount>::Iterator it_b; for(it_b = list.begin(); it_b != list.end(); ++it_b) { - if((*it_b).id() == tqparent.id()) { + if((*it_b).id() == parent.id()) { if(problemAccount != (*it_a).name()) { problemAccount = (*it_a).name(); rc << i18n("* Problem with account '%1'").tqarg(problemAccount); @@ -1432,51 +1432,51 @@ const TQStringList MyMoneyFile::consistencyCheck(void) } } } - parentId = tqparent.parentAccountId(); + parentId = parent.parentAccountId(); } } catch(MyMoneyException *e) { - // if we don't know about a tqparent, we catch it later + // if we don't know about a parent, we catch it later delete e; } - // check that the tqparent exists + // check that the parent exists parentId = (*it_a).parentAccountId(); try { - tqparent = account(parentId); - if((*it_a).accountGroup() != tqparent.accountGroup()) { + parent = account(parentId); + if((*it_a).accountGroup() != parent.accountGroup()) { problemCount++; if(problemAccount != (*it_a).name()) { problemAccount = (*it_a).name(); rc << i18n("* Problem with account '%1'").tqarg(problemAccount); } - // the tqparent belongs to a different group, so we reconnect to the + // the parent belongs to a different group, so we reconnect to the // master group account (asset, liability, etc) to which this account // should belong and update it in the engine. - rc << i18n(" * Parent account '%1' belongs to a different group.").tqarg(tqparent.name()); - rc << i18n(" New tqparent account is the top level account '%1'.").tqarg(toplevel.name()); + rc << i18n(" * Parent account '%1' belongs to a different group.").tqarg(parent.name()); + rc << i18n(" New parent account is the top level account '%1'.").tqarg(toplevel.name()); (*it_a).setParentAccountId(toplevel.id()); // make sure to rebuild the sub-accounts of the top account // and the one we removed this account from if(accountRebuild.contains(toplevel.id()) == 0) accountRebuild << toplevel.id(); - if(accountRebuild.contains(tqparent.id()) == 0) - accountRebuild << tqparent.id(); - } else if(!tqparent.accountList().contains((*it_a).id())) { + if(accountRebuild.contains(parent.id()) == 0) + accountRebuild << parent.id(); + } else if(!parent.accountList().contains((*it_a).id())) { problemCount++; if(problemAccount != (*it_a).name()) { problemAccount = (*it_a).name(); rc << i18n("* Problem with account '%1'").tqarg(problemAccount); } - // tqparent exists, but does not have a reference to the account - rc << i18n(" * Parent account '%1' does not contain '%2' as sub-account.").tqarg(tqparent.name(), problemAccount); - if(accountRebuild.contains(tqparent.id()) == 0) - accountRebuild << tqparent.id(); + // parent exists, but does not have a reference to the account + rc << i18n(" * Parent account '%1' does not contain '%2' as sub-account.").tqarg(parent.name(), problemAccount); + if(accountRebuild.contains(parent.id()) == 0) + accountRebuild << parent.id(); } } catch(MyMoneyException *e) { delete e; - // apparently, the tqparent does not exist anymore. we reconnect to the + // apparently, the parent does not exist anymore. we reconnect to the // master group account (asset, liability, etc) to which this account // should belong and update it in the engine. problemCount++; @@ -1484,8 +1484,8 @@ const TQStringList MyMoneyFile::consistencyCheck(void) problemAccount = (*it_a).name(); rc << i18n("* Problem with account '%1'").tqarg(problemAccount); } - rc << i18n(" * The tqparent with id %1 does not exist anymore.").tqarg(parentId); - rc << i18n(" New tqparent account is the top level account '%1'.").tqarg(toplevel.name()); + rc << i18n(" * The parent with id %1 does not exist anymore.").tqarg(parentId); + rc << i18n(" New parent account is the top level account '%1'.").tqarg(toplevel.name()); (*it_a).setParentAccountId(toplevel.id()); addNotification((*it_a).id()); @@ -1777,7 +1777,7 @@ TQString MyMoneyFile::createCategory(const MyMoneyAccount& base, const TQString& { checkTransaction(__PRETTY_FUNCTION__); - MyMoneyAccount tqparent = base; + MyMoneyAccount parent = base; TQString categoryText; if(base.id() != expense().id() && base.id() != income().id()) @@ -1802,7 +1802,7 @@ TQString MyMoneyFile::createCategory(const MyMoneyAccount& base, const TQString& { TQString categoryId = categoryToAccount(categoryText); if (categoryId.isEmpty()) - addAccount(categoryAccount, tqparent); + addAccount(categoryAccount, parent); else { categoryAccount = account(categoryId); @@ -1812,13 +1812,13 @@ TQString MyMoneyFile::createCategory(const MyMoneyAccount& base, const TQString& { qDebug("Unable to add account %s, %s, %s: %s", categoryAccount.name().latin1(), - tqparent.name().latin1(), + parent.name().latin1(), categoryText.latin1(), e->what().latin1()); delete e; } - tqparent = categoryAccount; + parent = categoryAccount; } return categoryToAccount(name); |