void ReportAccount::calculateAccountHierarchy() { DEBUG_ENTER(Q_FUNC_INFO); MyMoneyFile* file = MyMoneyFile::instance(); QString resultid = id(); QString parentid = parentAccountId(); #ifdef DEBUG_HIDE_SENSITIVE m_nameHierarchy.prepend(file->account(resultid).id()); #else m_nameHierarchy.prepend(file->account(resultid).name()); #endif while (!parentid.isEmpty() && !file->isStandardAccount(parentid)) { // take on the identity of our parent resultid = parentid; // and try again parentid = file->account(resultid).parentAccountId(); #ifdef DEBUG_HIDE_SENSITIVE m_nameHierarchy.prepend(file->account(resultid).id()); #else m_nameHierarchy.prepend(file->account(resultid).name()); #endif } }
ReportAccount ReportAccount::topParent() const { DEBUG_ENTER(Q_FUNC_INFO); MyMoneyFile* file = MyMoneyFile::instance(); QString resultid = id(); QString parentid = parentAccountId(); while (!parentid.isEmpty() && !file->isStandardAccount(parentid)) { // take on the identity of our parent resultid = parentid; // and try again parentid = file->account(resultid).parentAccountId(); } return ReportAccount(resultid); }