Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/models/accountsproxymodel.cpp
Context not available. | |||||
51 | ~Private() { | 51 | ~Private() { | ||
---|---|---|---|---|---|
52 | } | 52 | } | ||
53 | 53 | | |||
54 | QList<MyMoneyAccount::accountTypeE> m_typeList; | 54 | QList<eMyMoney::Account> m_typeList; | ||
55 | bool m_hideClosedAccounts; | 55 | bool m_hideClosedAccounts; | ||
56 | bool m_hideEquityAccounts; | 56 | bool m_hideEquityAccounts; | ||
57 | bool m_hideUnusedIncomeExpenseAccounts; | 57 | bool m_hideUnusedIncomeExpenseAccounts; | ||
Context not available. | |||||
133 | /** | 133 | /** | ||
134 | * Add the given account group to the filter. | 134 | * Add the given account group to the filter. | ||
135 | * @param group The account group to be added. | 135 | * @param group The account group to be added. | ||
136 | * @see MyMoneyAccount::accountTypeE | 136 | * @see eMyMoney::Account | ||
137 | */ | 137 | */ | ||
138 | void AccountsProxyModel::addAccountGroup(const QVector<MyMoneyAccount::_accountTypeE> &groups) | 138 | void AccountsProxyModel::addAccountGroup(const QVector<eMyMoney::Account> &groups) | ||
139 | { | 139 | { | ||
140 | foreach (const auto group, groups) { | 140 | foreach (const auto group, groups) { | ||
141 | switch (group) { | 141 | switch (group) { | ||
142 | case MyMoneyAccount::Asset: | 142 | case eMyMoney::Account::Asset: | ||
143 | d->m_typeList << MyMoneyAccount::Checkings; | 143 | d->m_typeList << eMyMoney::Account::Checkings; | ||
144 | d->m_typeList << MyMoneyAccount::Savings; | 144 | d->m_typeList << eMyMoney::Account::Savings; | ||
145 | d->m_typeList << MyMoneyAccount::Cash; | 145 | d->m_typeList << eMyMoney::Account::Cash; | ||
146 | d->m_typeList << MyMoneyAccount::AssetLoan; | 146 | d->m_typeList << eMyMoney::Account::AssetLoan; | ||
147 | d->m_typeList << MyMoneyAccount::CertificateDep; | 147 | d->m_typeList << eMyMoney::Account::CertificateDep; | ||
148 | d->m_typeList << MyMoneyAccount::Investment; | 148 | d->m_typeList << eMyMoney::Account::Investment; | ||
149 | d->m_typeList << MyMoneyAccount::Stock; | 149 | d->m_typeList << eMyMoney::Account::Stock; | ||
150 | d->m_typeList << MyMoneyAccount::MoneyMarket; | 150 | d->m_typeList << eMyMoney::Account::MoneyMarket; | ||
151 | d->m_typeList << MyMoneyAccount::Asset; | 151 | d->m_typeList << eMyMoney::Account::Asset; | ||
152 | d->m_typeList << MyMoneyAccount::Currency; | 152 | d->m_typeList << eMyMoney::Account::Currency; | ||
153 | break; | 153 | break; | ||
154 | case MyMoneyAccount::Liability: | 154 | case eMyMoney::Account::Liability: | ||
155 | d->m_typeList << MyMoneyAccount::CreditCard; | 155 | d->m_typeList << eMyMoney::Account::CreditCard; | ||
156 | d->m_typeList << MyMoneyAccount::Loan; | 156 | d->m_typeList << eMyMoney::Account::Loan; | ||
157 | d->m_typeList << MyMoneyAccount::Liability; | 157 | d->m_typeList << eMyMoney::Account::Liability; | ||
158 | break; | 158 | break; | ||
159 | case MyMoneyAccount::Income: | 159 | case eMyMoney::Account::Income: | ||
160 | d->m_typeList << MyMoneyAccount::Income; | 160 | d->m_typeList << eMyMoney::Account::Income; | ||
161 | break; | 161 | break; | ||
162 | case MyMoneyAccount::Expense: | 162 | case eMyMoney::Account::Expense: | ||
163 | d->m_typeList << MyMoneyAccount::Expense; | 163 | d->m_typeList << eMyMoney::Account::Expense; | ||
164 | break; | 164 | break; | ||
165 | case MyMoneyAccount::Equity: | 165 | case eMyMoney::Account::Equity: | ||
166 | d->m_typeList << MyMoneyAccount::Equity; | 166 | d->m_typeList << eMyMoney::Account::Equity; | ||
167 | break; | 167 | break; | ||
168 | default: | 168 | default: | ||
169 | break; | 169 | break; | ||
Context not available. | |||||
175 | /** | 175 | /** | ||
176 | * Add the given account type to the filter. | 176 | * Add the given account type to the filter. | ||
177 | * @param type The account type to be added. | 177 | * @param type The account type to be added. | ||
178 | * @see MyMoneyAccount::accountTypeE | 178 | * @see eMyMoney::Account | ||
179 | */ | 179 | */ | ||
180 | void AccountsProxyModel::addAccountType(MyMoneyAccount::accountTypeE type) | 180 | void AccountsProxyModel::addAccountType(eMyMoney::Account type) | ||
181 | { | 181 | { | ||
182 | d->m_typeList << type; | 182 | d->m_typeList << type; | ||
183 | invalidateFilter(); | 183 | invalidateFilter(); | ||
Context not available. | |||||
186 | /** | 186 | /** | ||
187 | * Remove the given account type from the filter. | 187 | * Remove the given account type from the filter. | ||
188 | * @param type The account type to be removed. | 188 | * @param type The account type to be removed. | ||
189 | * @see MyMoneyAccount::accountTypeE | 189 | * @see eMyMoney::Account | ||
190 | */ | 190 | */ | ||
191 | void AccountsProxyModel::removeAccountType(MyMoneyAccount::accountTypeE type) | 191 | void AccountsProxyModel::removeAccountType(eMyMoney::Account type) | ||
192 | { | 192 | { | ||
193 | if (d->m_typeList.removeAll(type) > 0) { | 193 | if (d->m_typeList.removeAll(type) > 0) { | ||
194 | invalidateFilter(); | 194 | invalidateFilter(); | ||
Context not available. | |||||
222 | return false; | 222 | return false; | ||
223 | 223 | | |||
224 | // we hide equity accounts if not in expert mode | 224 | // we hide equity accounts if not in expert mode | ||
225 | if (account.accountType() == MyMoneyAccount::Equity && hideEquityAccounts()) | 225 | if (account.accountType() == eMyMoney::Account::Equity && hideEquityAccounts()) | ||
226 | return false; | 226 | return false; | ||
227 | 227 | | |||
228 | // we hide unused income and expense accounts if the specific flag is set | 228 | // we hide unused income and expense accounts if the specific flag is set | ||
229 | if ((account.accountType() == MyMoneyAccount::Income || account.accountType() == MyMoneyAccount::Expense) && hideUnusedIncomeExpenseAccounts()) { | 229 | if ((account.accountType() == eMyMoney::Account::Income || account.accountType() == eMyMoney::Account::Expense) && hideUnusedIncomeExpenseAccounts()) { | ||
230 | const auto totalValue = sourceModel()->data(source, (int)Role::TotalValue); | 230 | const auto totalValue = sourceModel()->data(source, (int)Role::TotalValue); | ||
231 | if (totalValue.isValid() && totalValue.value<MyMoneyMoney>().isZero()) { | 231 | if (totalValue.isValid() && totalValue.value<MyMoneyMoney>().isZero()) { | ||
232 | emit unusedIncomeExpenseAccountHidden(); | 232 | emit unusedIncomeExpenseAccountHidden(); | ||
Context not available. |