Commit 0179eea6 authored by Ralf Habacker's avatar Ralf Habacker
Browse files

Convert enumeration MyMoneyReport::ERowType into a class to be more type safe

Summary:
CCBUG:391091

Test Plan: compiled on linux

Reviewers: #kmymoney

Reviewed By: #kmymoney, tbaumgart

Differential Revision: https://phabricator.kde.org/D11083
parent 2f575bbe
......@@ -73,7 +73,7 @@ KBalanceChartDlg::~KBalanceChartDlg()
KReportChartView* KBalanceChartDlg::drawChart(const MyMoneyAccount& account)
{
MyMoneyReport reportCfg = MyMoneyReport(
MyMoneyReport::eAssetLiability,
MyMoneyReport::Row::AssetLiability,
MyMoneyReport::Column::Months,
MyMoneyTransactionFilter::last3ToNext3Months,
MyMoneyReport::eDetailTotal,
......
......@@ -65,7 +65,7 @@
KReportConfigurationFilterDlg::KReportConfigurationFilterDlg(
MyMoneyReport report, QWidget *parent)
: KFindTransactionDlg(parent, report.rowType() == MyMoneyReport::eAccount),
: KFindTransactionDlg(parent, report.rowType() == MyMoneyReport::Row::Account),
m_tab2(0),
m_tab3(0),
m_tabChart(0),
......@@ -114,7 +114,7 @@ KReportConfigurationFilterDlg::KReportConfigurationFilterDlg(
} else if (m_initialState.reportType() == MyMoneyReport::Report::QueryTable) {
// eInvestmentHoldings is a special-case report, and you cannot configure the
// rows & columns of that report.
if (m_initialState.rowType() < MyMoneyReport::eAccountByTopAccount) {
if (m_initialState.rowType() < MyMoneyReport::Row::AccountByTopAccount) {
m_tab3 = new kMyMoneyReportConfigTab3Decl(m_ui->m_criteriaTab);
m_tab3->setObjectName("kMyMoneyReportConfigTab3");
m_ui->m_criteriaTab->insertTab(1, m_tab3, i18n("Rows/Columns"));
......@@ -162,7 +162,7 @@ void KReportConfigurationFilterDlg::slotSearch()
// modify the rowtype only if the widget is enabled
if (m_tab2->findChild<KComboBox*>("m_comboRows")->isEnabled()) {
MyMoneyReport::ERowType rt[2] = { MyMoneyReport::eExpenseIncome, MyMoneyReport::eAssetLiability };
MyMoneyReport::Row::Type rt[2] = { MyMoneyReport::Row::ExpenseIncome, MyMoneyReport::Row::AssetLiability };
m_currentState.setRowType(rt[m_tab2->findChild<KComboBox*>("m_comboRows")->currentIndex()]);
}
......@@ -184,7 +184,7 @@ void KReportConfigurationFilterDlg::slotSearch()
m_currentState.setIncludingUnusedAccounts(m_tab2->findChild<QCheckBox*>("m_checkUnused")->isChecked());
if (m_tab2->findChild<KMyMoneyGeneralCombo*>("m_comboBudget")->isEnabled()) {
m_currentState.setBudget(m_budgets[m_tab2->findChild<KMyMoneyGeneralCombo*>("m_comboBudget")->currentItem()].id(), m_initialState.rowType() == MyMoneyReport::eBudgetActual);
m_currentState.setBudget(m_budgets[m_tab2->findChild<KMyMoneyGeneralCombo*>("m_comboBudget")->currentItem()].id(), m_initialState.rowType() == MyMoneyReport::Row::BudgetActual);
} else {
m_currentState.setBudget(QString(), false);
}
......@@ -194,7 +194,7 @@ void KReportConfigurationFilterDlg::slotSearch()
m_currentState.setMovingAverageDays(m_tab2->findChild<QSpinBox*>("m_movingAverageDays")->value());
}
} else if (m_tab3) {
MyMoneyReport::ERowType rtq[8] = { MyMoneyReport::eCategory, MyMoneyReport::eTopCategory, MyMoneyReport::eTag, MyMoneyReport::ePayee, MyMoneyReport::eAccount, MyMoneyReport::eTopAccount, MyMoneyReport::eMonth, MyMoneyReport::eWeek };
MyMoneyReport::Row::Type rtq[8] = { MyMoneyReport::Row::Category, MyMoneyReport::Row::TopCategory, MyMoneyReport::Row::Tag, MyMoneyReport::Row::Payee, MyMoneyReport::Row::Account, MyMoneyReport::Row::TopAccount, MyMoneyReport::Row::Month, MyMoneyReport::Row::Week };
m_currentState.setRowType(rtq[m_tab3->findChild<KComboBox*>("m_comboOrganizeBy")->currentIndex()]);
unsigned qc = MyMoneyReport::QueryColumns::None;
......@@ -318,9 +318,9 @@ void KReportConfigurationFilterDlg::slotReset()
combo = m_tab2->findChild<KComboBox*>("m_comboRows");
switch (m_initialState.rowType()) {
case MyMoneyReport::eExpenseIncome:
case MyMoneyReport::eBudget:
case MyMoneyReport::eBudgetActual:
case MyMoneyReport::Row::ExpenseIncome:
case MyMoneyReport::Row::Budget:
case MyMoneyReport::Row::BudgetActual:
combo->setCurrentItem(i18n("Income & Expenses"), false); // income / expense
break;
default:
......@@ -365,8 +365,8 @@ void KReportConfigurationFilterDlg::slotReset()
}
//load budgets combo
if (m_initialState.rowType() == MyMoneyReport::eBudget
|| m_initialState.rowType() == MyMoneyReport::eBudgetActual) {
if (m_initialState.rowType() == MyMoneyReport::Row::Budget
|| m_initialState.rowType() == MyMoneyReport::Row::BudgetActual) {
m_tab2->findChild<KComboBox*>("m_comboRows")->setEnabled(false);
m_tab2->findChild<QFrame*>("m_budgetFrame")->setEnabled(!m_budgets.empty());
int i = 0;
......@@ -393,29 +393,29 @@ void KReportConfigurationFilterDlg::slotReset()
} else if (m_tab3) {
KComboBox *combo = m_tab3->findChild<KComboBox*>("m_comboOrganizeBy");
switch (m_initialState.rowType()) {
case MyMoneyReport::Column::NoColumns:
case MyMoneyReport::eCategory:
case MyMoneyReport::Row::NoRows:
case MyMoneyReport::Row::Category:
combo->setCurrentItem(i18n("Categories"), false);
break;
case MyMoneyReport::eTopCategory:
case MyMoneyReport::Row::TopCategory:
combo->setCurrentItem(i18n("Top Categories"), false);
break;
case MyMoneyReport::eTag:
case MyMoneyReport::Row::Tag:
combo->setCurrentItem(i18n("Tags"), false);
break;
case MyMoneyReport::ePayee:
case MyMoneyReport::Row::Payee:
combo->setCurrentItem(i18n("Payees"), false);
break;
case MyMoneyReport::eAccount:
case MyMoneyReport::Row::Account:
combo->setCurrentItem(i18n("Accounts"), false);
break;
case MyMoneyReport::eTopAccount:
case MyMoneyReport::Row::TopAccount:
combo->setCurrentItem(i18n("Top Accounts"), false);
break;
case MyMoneyReport::eMonth:
case MyMoneyReport::Row::Month:
combo->setCurrentItem(i18n("Month"), false);
break;
case MyMoneyReport::eWeek:
case MyMoneyReport::Row::Week:
combo->setCurrentItem(i18n("Week"), false);
break;
default:
......
......@@ -4289,7 +4289,7 @@ void KMyMoneyApp::slotAccountTransactionReport()
// currently selected account.
if (!d->m_selectedAccount.id().isEmpty()) {
MyMoneyReport report(
MyMoneyReport::eAccount,
MyMoneyReport::Row::Account,
MyMoneyReport::QueryColumns::Number | MyMoneyReport::QueryColumns::Payee | MyMoneyReport::QueryColumns::Category,
MyMoneyTransactionFilter::yearToDate,
MyMoneyReport::eDetailAll,
......
......@@ -34,14 +34,12 @@
#include "mymoneyfile.h"
#include "reportdebug.h"
const QStringList MyMoneyReport::Row::kText = QString("none,assetliability,expenseincome,category,topcategory,account,tag,payee,month,week,topaccount,topaccount-account,equitytype,accounttype,institution,budget,budgetactual,schedule,accountinfo,accountloaninfo,accountreconcile,cashflow").split(',');
const MyMoneyReport::Report::Type MyMoneyReport::Report::kTypeArray[] = { NoReport, PivotTable, PivotTable, QueryTable, QueryTable, QueryTable, QueryTable, QueryTable, QueryTable, QueryTable, QueryTable, QueryTable, QueryTable, QueryTable, QueryTable, PivotTable, PivotTable, InfoTable, InfoTable, InfoTable, QueryTable, QueryTable, NoReport };
const QStringList MyMoneyReport::Column::kTypeText = QString("none,months,bimonths,quarters,4,5,6,weeks,8,9,10,11,years").split(',');
// if you add names here, don't forget to update the bitmap for QueryColumns::Type
// and shift the bit for QueryColumns::end one position to the left
const QStringList MyMoneyReport::QueryColumns::kText = QString("none,number,payee,category,tag,memo,account,reconcileflag,action,shares,price,performance,loan,balance").split(',');
const QStringList MyMoneyReport::kRowTypeText = QString("none,assetliability,expenseincome,category,topcategory,account,tag,payee,month,week,topaccount,topaccount-account,equitytype,accounttype,institution,budget,budgetactual,schedule,accountinfo,accountloaninfo,accountreconcile,cashflow").split(',');
const QStringList MyMoneyReport::kDetailLevelText = QString("none,all,top,group,total,invalid").split(',');
const QStringList MyMoneyReport::kChartTypeText = QString("none,line,bar,pie,ring,stackedbar,invalid").split(',');
......@@ -51,6 +49,35 @@ const QStringList kStateText = QString("all,notreconciled,cleared,reconciled,fro
const QStringList kDateLockText = QString("alldates,untiltoday,currentmonth,currentyear,monthtodate,yeartodate,yeartomonth,lastmonth,lastyear,last7days,last30days,last3months,last6months,last12months,next7days,next30days,next3months,next6months,next12months,userdefined,last3tonext3months,last11Months,currentQuarter,lastQuarter,nextQuarter,currentFiscalYear,lastFiscalYear,today,next18months").split(',');
const QStringList kAccountTypeText = QString("unknown,checkings,savings,cash,creditcard,loan,certificatedep,investment,moneymarket,asset,liability,currency,income,expense,assetloan,stock,equity,invalid").split(',');
QString MyMoneyReport::Row::toString(Type type)
{
switch(type) {
case NoRows : return "NoRows";
case AssetLiability : return "AssetLiability";
case ExpenseIncome : return "ExpenseIncome";
case Category : return "Category";
case TopCategory : return "TopCategory";
case Account : return "Account";
case Tag : return "Tag";
case Payee : return "Payee";
case Month : return "Month";
case Week : return "Week";
case TopAccount : return "TopAccount";
case AccountByTopAccount: return "AccountByTopAccount";
case EquityType : return "EquityType";
case AccountType : return "AccountType";
case Institution : return "Institution";
case Budget : return "Budget";
case BudgetActual : return "BudgetActual";
case Schedule : return "Schedule";
case AccountInfo : return "AccountInfo";
case AccountLoanInfo : return "AccountLoanInfo";
case AccountReconcile : return "AccountReconcile";
case CashFlow : return "CashFlow";
default : return "undefined";
}
}
QString MyMoneyReport::Report::toString(Type type)
{
switch(type) {
......@@ -70,8 +97,8 @@ MyMoneyReport::MyMoneyReport() :
m_tax(false),
m_investments(false),
m_loans(false),
m_reportType(Report::kTypeArray[eExpenseIncome]),
m_rowType(eExpenseIncome),
m_reportType(Report::kTypeArray[Row::ExpenseIncome]),
m_rowType(Row::ExpenseIncome),
m_columnType(Column::Months),
m_columnsAreDays(false),
m_queryColumns(QueryColumns::None),
......@@ -107,7 +134,7 @@ MyMoneyReport::MyMoneyReport(const QString& id, const MyMoneyReport& right) :
setId(id);
}
MyMoneyReport::MyMoneyReport(ERowType _rt, unsigned _ct, dateOptionE _dl, EDetailLevel _ss, const QString& _name, const QString& _comment) :
MyMoneyReport::MyMoneyReport(Row::Type _rt, unsigned _ct, dateOptionE _dl, EDetailLevel _ss, const QString& _name, const QString& _comment) :
m_name(_name),
m_comment(_comment),
m_detailLevel(_ss),
......@@ -152,17 +179,17 @@ MyMoneyReport::MyMoneyReport(ERowType _rt, unsigned _ct, dateOptionE _dl, EDetai
setDateFilter(_dl);
//throw exception if the type is inconsistent
if ((_rt > static_cast<ERowType>(sizeof(Report::kTypeArray) / sizeof(Report::kTypeArray[0])))
if ((_rt > static_cast<Row::Type>(sizeof(Report::kTypeArray) / sizeof(Report::kTypeArray[0])))
|| (m_reportType == Report::NoReport))
throw MYMONEYEXCEPTION("Invalid report type");
//add the corresponding account groups
if (_rt == MyMoneyReport::eAssetLiability) {
if (_rt == MyMoneyReport::Row::AssetLiability) {
addAccountGroup(MyMoneyAccount::Asset);
addAccountGroup(MyMoneyAccount::Liability);
m_showRowTotals = true;
}
if (_rt == MyMoneyReport::eAccount) {
if (_rt == MyMoneyReport::Row::Account) {
addAccountGroup(MyMoneyAccount::Asset);
addAccountGroup(MyMoneyAccount::AssetLoan);
addAccountGroup(MyMoneyAccount::Cash);
......@@ -178,22 +205,22 @@ MyMoneyReport::MyMoneyReport(ERowType _rt, unsigned _ct, dateOptionE _dl, EDetai
addAccountGroup(MyMoneyAccount::Stock);
m_showRowTotals = true;
}
if (_rt == MyMoneyReport::eExpenseIncome) {
if (_rt == MyMoneyReport::Row::ExpenseIncome) {
addAccountGroup(MyMoneyAccount::Expense);
addAccountGroup(MyMoneyAccount::Income);
m_showRowTotals = true;
}
//FIXME take this out once we have sorted out all issues regarding budget of assets and liabilities -- asoliverez@gmail.com
if (_rt == MyMoneyReport::eBudget || _rt == MyMoneyReport::eBudgetActual) {
if (_rt == MyMoneyReport::Row::Budget || _rt == MyMoneyReport::Row::BudgetActual) {
addAccountGroup(MyMoneyAccount::Expense);
addAccountGroup(MyMoneyAccount::Income);
}
if (_rt == MyMoneyReport::eAccountInfo) {
if (_rt == MyMoneyReport::Row::AccountInfo) {
addAccountGroup(MyMoneyAccount::Asset);
addAccountGroup(MyMoneyAccount::Liability);
}
//cash flow reports show splits for all account groups
if (_rt == MyMoneyReport::eCashFlow) {
if (_rt == MyMoneyReport::Row::CashFlow) {
addAccountGroup(MyMoneyAccount::Expense);
addAccountGroup(MyMoneyAccount::Income);
addAccountGroup(MyMoneyAccount::Asset);
......@@ -201,7 +228,7 @@ MyMoneyReport::MyMoneyReport(ERowType _rt, unsigned _ct, dateOptionE _dl, EDetai
}
#ifdef DEBUG_REPORTS
QDebug dbg = qDebug();
dbg << _name << toString(_rt) << Report::toString(m_reportType);
dbg << _name << Row::toString(_rt) << Report::toString(m_reportType);
foreach(const MyMoneyAccount::accountTypeE accountType, m_accountGroups)
dbg << MyMoneyAccount::accountTypeToString(accountType);
if (m_accounts.size() > 0)
......@@ -271,7 +298,7 @@ void MyMoneyReport::validDateRange(QDate& _db, QDate& _de)
_db = _de;
}
void MyMoneyReport::setRowType(ERowType _rt)
void MyMoneyReport::setRowType(Row::Type _rt)
{
m_rowType = _rt;
m_reportType = Report::kTypeArray[_rt];
......@@ -279,11 +306,11 @@ void MyMoneyReport::setRowType(ERowType _rt)
m_accountGroupFilter = false;
m_accountGroups.clear();
if (_rt == MyMoneyReport::eAssetLiability) {
if (_rt == MyMoneyReport::Row::AssetLiability) {
addAccountGroup(MyMoneyAccount::Asset);
addAccountGroup(MyMoneyAccount::Liability);
}
if (_rt == MyMoneyReport::eExpenseIncome) {
if (_rt == MyMoneyReport::Row::ExpenseIncome) {
addAccountGroup(MyMoneyAccount::Expense);
addAccountGroup(MyMoneyAccount::Income);
}
......@@ -318,7 +345,7 @@ void MyMoneyReport::addAccountGroup(MyMoneyAccount::accountTypeE type)
bool MyMoneyReport::includesAccountGroup(MyMoneyAccount::accountTypeE type) const
{
bool result = (! m_accountGroupFilter)
|| (isIncludingTransfers() && m_rowType == MyMoneyReport::eExpenseIncome)
|| (isIncludingTransfers() && m_rowType == MyMoneyReport::Row::ExpenseIncome)
|| m_accountGroups.contains(type);
return result;
......@@ -343,7 +370,7 @@ bool MyMoneyReport::includes(const MyMoneyAccount& acc) const
result = acc.isLoan() && includesAccount(acc.id());
else if (isInvestmentsOnly())
result = acc.isInvest() && includesAccount(acc.id());
else if (isIncludingTransfers() && m_rowType == MyMoneyReport::eExpenseIncome)
else if (isIncludingTransfers() && m_rowType == MyMoneyReport::Row::ExpenseIncome)
// If transfers are included, ONLY include this account if it is NOT
// included in the report itself!!
result = ! includesAccount(acc.id());
......@@ -379,7 +406,7 @@ void MyMoneyReport::write(QDomElement& e, QDomDocument *doc, bool anonymous) con
e.setAttribute("tax", m_tax);
e.setAttribute("investments", m_investments);
e.setAttribute("loans", m_loans);
e.setAttribute("rowtype", kRowTypeText[m_rowType]);
e.setAttribute("rowtype", Row::kText[m_rowType]);
e.setAttribute("datelock", kDateLockText[m_dateLock]);
e.setAttribute("includeschedules", m_includeSchedules);
e.setAttribute("columnsaredays", m_columnsAreDays);
......@@ -724,14 +751,14 @@ bool MyMoneyReport::read(const QDomElement& e)
}
setDateFilter(static_cast<dateOptionE>(i));
i = kRowTypeText.indexOf(e.attribute("rowtype", "expenseincome"));
i = Row::kText.indexOf(e.attribute("rowtype", "expenseincome"));
if (i != -1) {
setRowType(static_cast<ERowType>(i));
setRowType(static_cast<Row::Type>(i));
// recent versions of KMyMoney always showed a total column for
// income/expense reports. We turn it on for backward compatibility
// here. If the total column is turned off, the flag will be reset
// in the next step
if (i == eExpenseIncome)
if (i == Row::ExpenseIncome)
m_showRowTotals = true;
}
if (e.hasAttribute("showrowtotals"))
......@@ -837,32 +864,3 @@ void MyMoneyReport::setLineWidth(int width)
{
m_lineWidth = width;
}
QString MyMoneyReport::toString(ERowType type)
{
switch(type) {
case eNoRows : return "eNoRows";
case eAssetLiability : return "eAssetLiability";
case eExpenseIncome : return "eExpenseIncome";
case eCategory : return "eCategory";
case eTopCategory : return "eTopCategory";
case eAccount : return "eAccount";
case eTag : return "eTag";
case ePayee : return "ePayee";
case eMonth : return "eMonth";
case eWeek : return "eWeek";
case eTopAccount : return "eTopAccount";
case eAccountByTopAccount: return "eAccountByTopAccount";
case eEquityType : return "eEquityType";
case eAccountType : return "eAccountType";
case eInstitution : return "eInstitution";
case eBudget : return "eBudget";
case eBudgetActual : return "eBudgetActual";
case eSchedule : return "eSchedule";
case eAccountInfo : return "eAccountInfo";
case eAccountLoanInfo : return "eAccountLoanInfo";
case eAccountReconcile : return "eAccountReconcile";
case eCashFlow : return "eCashFlow";
default : return "undefined";
}
}
......@@ -56,7 +56,19 @@ class KMM_MYMONEY_EXPORT MyMoneyReport: public MyMoneyObject, public MyMoneyTran
{
public:
// When adding a new row type, be sure to add a corresponding entry in kTypeArray
enum ERowType { eNoRows = 0, eAssetLiability, eExpenseIncome, eCategory, eTopCategory, eAccount, eTag, ePayee, eMonth, eWeek, eTopAccount, eAccountByTopAccount, eEquityType, eAccountType, eInstitution, eBudget, eBudgetActual, eSchedule, eAccountInfo, eAccountLoanInfo, eAccountReconcile, eCashFlow};
class Row {
public:
enum Type { NoRows = 0, AssetLiability, ExpenseIncome, Category, TopCategory, Account, Tag, Payee, Month, Week, TopAccount, AccountByTopAccount, EquityType, AccountType, Institution, Budget, BudgetActual, Schedule, AccountInfo, AccountLoanInfo, AccountReconcile, CashFlow};
/**
* Return row type as string.
*
* @param type type to get string for
* @return row type converted to string
*/
static QString toString(Type type);
static const QStringList kText;
};
class Report {
public:
enum Type { NoReport = 0, PivotTable, QueryTable, InfoTable };
......@@ -87,13 +99,12 @@ public:
enum EDetailLevel { eDetailNone = 0, eDetailAll, eDetailTop, eDetailGroup, eDetailTotal, eDetailEnd };
enum EChartType { eChartNone = 0, eChartLine, eChartBar, eChartPie, eChartRing, eChartStackedBar, eChartEnd };
static const QStringList kRowTypeText;
static const QStringList kDetailLevelText;
static const QStringList kChartTypeText;
public:
MyMoneyReport();
MyMoneyReport(ERowType _rt, unsigned _ct, dateOptionE _dl, EDetailLevel _ss, const QString& _name, const QString& _comment);
MyMoneyReport(Row::Type _rt, unsigned _ct, dateOptionE _dl, EDetailLevel _ss, const QString& _name, const QString& _comment);
MyMoneyReport(const QString& id, const MyMoneyReport& right);
/**
......@@ -113,14 +124,14 @@ public:
Report::Type reportType() const {
return m_reportType;
}
ERowType rowType() const {
Row::Type rowType() const {
return m_rowType;
}
Column::Type columnType() const {
return m_columnType;
}
bool isRunningSum() const {
return (m_rowType == eAssetLiability);
return (m_rowType == Row::AssetLiability);
}
bool isConvertCurrency() const {
return m_convertCurrency;
......@@ -229,7 +240,7 @@ public:
void setConvertCurrency(bool _f) {
m_convertCurrency = _f;
}
void setRowType(ERowType _rt);
void setRowType(Row::Type _rt);
void setColumnType(Column::Type _ct) {
m_columnType = _ct;
}
......@@ -507,14 +518,6 @@ public:
*/
static void setLineWidth(int width);
/**
* Return row type as string.
*
* @param type type to get string for
* @return row type converted to string
*/
static QString toString(ERowType type);
private:
/**
* The user-assigned name of the report
......@@ -565,7 +568,7 @@ private:
/**
* What sort of values should show up on the ROWS of this report
*/
enum ERowType m_rowType;
Row::Type m_rowType;
/**
* What sort of values should show up on the COLUMNS of this report,
* in the case of a 'PivotTable' report. Really this is used more as a
......
......@@ -593,7 +593,7 @@ void ListTable::render(QString& result, QString& csv) const
QString grandtotal_csv = grandtotal.formatMoney(fraction, false);
//If we order by Tags don't show the Grand total as we can have multiple tags per transaction
if (m_config.rowType() != MyMoneyReport::eTag) {
if (m_config.rowType() != MyMoneyReport::Row::Tag) {
result += "<tr class=\"sectionfooter\">"
"<td class=\"left0\" "
"colspan=\"" + QString::number(columns.count() - 1 - postcolumns.count()) + "\">" +
......
......@@ -72,15 +72,15 @@ ObjectInfoTable::ObjectInfoTable(const MyMoneyReport& _report): ListTable(_repor
void ObjectInfoTable::init()
{
switch (m_config.rowType()) {
case MyMoneyReport::eSchedule:
case MyMoneyReport::Row::Schedule:
constructScheduleTable();
m_columns = "nextduedate,name";
break;
case MyMoneyReport::eAccountInfo:
case MyMoneyReport::Row::AccountInfo:
constructAccountTable();
m_columns = "institution,type,name";
break;
case MyMoneyReport::eAccountLoanInfo:
case MyMoneyReport::Row::AccountLoanInfo:
constructAccountLoanTable();
m_columns = "institution,type,name";
break;
......@@ -92,12 +92,12 @@ void ObjectInfoTable::init()
m_subtotal = "value";
switch (m_config.rowType()) {
case MyMoneyReport::eSchedule:
case MyMoneyReport::Row::Schedule:
m_group = "type";
m_subtotal = "value";
break;
case MyMoneyReport::eAccountInfo:
case MyMoneyReport::eAccountLoanInfo:
case MyMoneyReport::Row::AccountInfo:
case MyMoneyReport::Row::AccountLoanInfo:
m_group = "topcategory,institution";
m_subtotal = "currentbalance";
break;
......@@ -108,17 +108,17 @@ void ObjectInfoTable::init()
QString sort = m_group + ',' + m_columns + ",id,rank";
switch (m_config.rowType()) {
case MyMoneyReport::eSchedule:
case MyMoneyReport::Row::Schedule:
if (m_config.detailLevel() == MyMoneyReport::eDetailAll) {
m_columns = "name,payee,paymenttype,occurence,nextduedate,category"; // krazy:exclude=spelling
} else {
m_columns = "name,payee,paymenttype,occurence,nextduedate"; // krazy:exclude=spelling
}
break;
case MyMoneyReport::eAccountInfo:
case MyMoneyReport::Row::AccountInfo:
m_columns = "type,name,number,description,openingdate,currencyname,balancewarning,maxbalancelimit,creditwarning,maxcreditlimit,tax,favorite";
break;
case MyMoneyReport::eAccountLoanInfo:
case MyMoneyReport::Row::AccountLoanInfo:
m_columns = "type,name,number,description,openingdate,currencyname,payee,loanamount,interestrate,nextinterestchange,periodicpayment,finalpayment,favorite";
break;
default:
......
......@@ -134,7 +134,7 @@ void PivotTable::init()
//
// Initialize outer groups of the grid
//
if (m_config_f.rowType() == MyMoneyReport::eAssetLiability) {
if (m_config_f.rowType() == MyMoneyReport::Row::AssetLiability) {
m_grid.insert(KMyMoneyUtils::accountTypeToString(MyMoneyAccount::Asset), PivotOuterGroup(m_numColumns));
m_grid.insert(KMyMoneyUtils::accountTypeToString(MyMoneyAccount::Liability), PivotOuterGroup(m_numColumns, PivotOuterGroup::m_kDefaultSortOrder, true /* inverted */));
} else {
......@@ -236,7 +236,7 @@ void PivotTable::init()
// whether asset & liability transactions are actually to be considered
// transfers
bool al_transfers = (m_config_f.rowType() == MyMoneyReport::eExpenseIncome) && (m_config_f.isIncludingTransfers());
bool al_transfers = (m_config_f.rowType() == MyMoneyReport::Row::ExpenseIncome) && (m_config_f.isIncludingTransfers());
//this is to store balance for loan accounts when not included in the report
QMap<QString, MyMoneyMoney> loanBalances;
......@@ -1146,7 +1146,7 @@ void PivotTable::calculateTotals()
// Outer Row Group Totals
//
const bool isIncomeExpense = (m_config_f.rowType() == MyMoneyReport::eExpenseIncome);
const bool isIncomeExpense = (m_config_f.rowType() == MyMoneyReport::Row::ExpenseIncome);
const bool invert_total = (*it_outergroup).m_inverted;
int column = 1;
while (column < m_numColumns) {
......@@ -1972,7 +1972,7 @@ void PivotTable::calculateForecast()
}
//run forecast
if (m_config_f.rowType() == MyMoneyReport::eAssetLiability) { //asset and liability
if (m_config_f.rowType() == MyMoneyReport::Row::AssetLiability) { //asset and liability
forecast.doForecast();
} else { //income and expenses
MyMoneyBudget budget;
......
......@@ -95,7 +95,7 @@ void PivotTableTest::testNetWorthSingle()
{
try {
MyMoneyReport filter;
filter.setRowType(MyMoneyReport::eAssetLiability);
filter.setRowType(MyMoneyReport::Row::AssetLiability);
filter.setDateFilter(QDate(2004, 1, 1), QDate(2004, 7, 1).addDays(-1));
XMLandback(filter);
PivotTable networth_f(filter);
......@@ -120,7 +120,7 @@ void PivotTableTest::testNetWorthOfsetting()
// that it calculates the totals correctly.
MyMoneyReport filter;
filter.setRowType(MyMoneyReport::eAssetLiability);
filter.setRowType(MyMoneyReport::Row::AssetLiability);
filter.setDateFilter(QDate(2004, 1, 1), QDate(2005, 1, 1).addDays(-1));
XMLandback(filter);
PivotTable networth_f(filter);
......@@ -136,7 +136,7 @@ void PivotTableTest::testNetWorthOpeningPrior()
// the period of the report.
MyMoneyReport filter;
filter.setRowType(MyMoneyReport::eAssetLiability);
filter.setRowType(MyMoneyReport::Row::AssetLiability);
filter.setDateFilter(QDate(2005, 8, 1), QDate(2005, 12, 31));
filter.setName("Net Worth Opening Prior 1");
XMLandback(filter);
......@@ -173,7 +173,7 @@ void PivotTableTest::testNetWorthDateFilter()
// so the report should be zero.
MyMoneyReport filter;
filter.setRowType(MyMoneyReport::eAssetLiability);
filter.setRowType(MyMoneyReport::Row::AssetLiability);
filter.setDateFilter(QDate(2004, 1, 1), QDate(2004, 2, 1).addDays(-1));
XMLandback(filter);
PivotTable networth_f(filter);
......@@ -186,7 +186,7 @@ void PivotTableTest::testSpendingEmpty()
// test a spending report with no entries
MyMoneyReport filter;
filter.setRowType(MyMoneyReport::eExpenseIncome);
filter.setRowType(MyMoneyReport::Row::ExpenseIncome);
XMLandback(filter);
PivotTable spending_f1(filter);
QVERIFY(spending_f1.m_grid.m_total[eActual].m_total == moZero);
......@@ -202,7 +202,7 @@ void PivotTableTest::testSingleTransaction()
TransactionHelper t(QDate(2004, 10, 31), MyMoneySplit::ActionWithdrawal, moSolo, acChecking, acSolo);
MyMoneyReport filter;
filter.setRowType(MyMoneyReport::eExpenseIncome);
filter.setRowType(MyMoneyReport::Row::ExpenseIncome);
filter.setDateFilter(QDate(2004, 9, 1), QDate(2005, 1, 1).addDays(-1));
filter.setName("Spending with Single Transaction.html");
XMLandback(filter);
......@@ -216,7 +216,7 @@ void PivotTableTest::testSingleTransaction()
QVERIFY(spending_f.m_grid.m_total[eActual].m_total == (-moSolo));
filter.clear();
filter.setRowType(MyMoneyReport::eAssetLiability);
filter.setRowType(MyMoneyReport::Row::AssetLiability);