Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/dialogs/kreportconfigurationfilterdlg.cpp
Show First 20 Lines • Show All 59 Lines • ▼ Show 20 Line(s) | |||||
60 | #include <kmymoneyaccountselector.h> | 60 | #include <kmymoneyaccountselector.h> | ||
61 | #include <mymoneyfile.h> | 61 | #include <mymoneyfile.h> | ||
62 | #include <mymoneyreport.h> | 62 | #include <mymoneyreport.h> | ||
63 | #include <ktoolinvocation.h> | 63 | #include <ktoolinvocation.h> | ||
64 | #include "ui_kfindtransactiondlgdecl.h" | 64 | #include "ui_kfindtransactiondlgdecl.h" | ||
65 | 65 | | |||
66 | KReportConfigurationFilterDlg::KReportConfigurationFilterDlg( | 66 | KReportConfigurationFilterDlg::KReportConfigurationFilterDlg( | ||
67 | MyMoneyReport report, QWidget *parent) | 67 | MyMoneyReport report, QWidget *parent) | ||
68 | : KFindTransactionDlg(parent, report.rowType() == MyMoneyReport::eAccount), | 68 | : KFindTransactionDlg(parent, report.rowType() == MyMoneyReport::Row::Account), | ||
69 | m_tab2(0), | 69 | m_tab2(0), | ||
70 | m_tab3(0), | 70 | m_tab3(0), | ||
71 | m_tabChart(0), | 71 | m_tabChart(0), | ||
72 | m_initialState(report), | 72 | m_initialState(report), | ||
73 | m_currentState(report) | 73 | m_currentState(report) | ||
74 | { | 74 | { | ||
75 | // | 75 | // | ||
76 | // Rework labeling | 76 | // Rework labeling | ||
Show All 32 Lines | 100 | if (m_initialState.reportType() == MyMoneyReport::Report::PivotTable) { | |||
109 | connect(m_ui->m_categoriesView, SIGNAL(stateChanged()), this, SLOT(slotUpdateCheckTransfers())); | 109 | connect(m_ui->m_categoriesView, SIGNAL(stateChanged()), this, SLOT(slotUpdateCheckTransfers())); | ||
110 | 110 | | |||
111 | m_tabChart = new kMyMoneyReportConfigTabChartDecl(m_ui->m_criteriaTab); | 111 | m_tabChart = new kMyMoneyReportConfigTabChartDecl(m_ui->m_criteriaTab); | ||
112 | m_tabChart->setObjectName("kMyMoneyReportConfigTabChart"); | 112 | m_tabChart->setObjectName("kMyMoneyReportConfigTabChart"); | ||
113 | m_ui->m_criteriaTab->insertTab(2, m_tabChart, i18n("Chart")); | 113 | m_ui->m_criteriaTab->insertTab(2, m_tabChart, i18n("Chart")); | ||
114 | } else if (m_initialState.reportType() == MyMoneyReport::Report::QueryTable) { | 114 | } else if (m_initialState.reportType() == MyMoneyReport::Report::QueryTable) { | ||
115 | // eInvestmentHoldings is a special-case report, and you cannot configure the | 115 | // eInvestmentHoldings is a special-case report, and you cannot configure the | ||
116 | // rows & columns of that report. | 116 | // rows & columns of that report. | ||
117 | if (m_initialState.rowType() < MyMoneyReport::eAccountByTopAccount) { | 117 | if (m_initialState.rowType() < MyMoneyReport::Row::AccountByTopAccount) { | ||
118 | m_tab3 = new kMyMoneyReportConfigTab3Decl(m_ui->m_criteriaTab); | 118 | m_tab3 = new kMyMoneyReportConfigTab3Decl(m_ui->m_criteriaTab); | ||
119 | m_tab3->setObjectName("kMyMoneyReportConfigTab3"); | 119 | m_tab3->setObjectName("kMyMoneyReportConfigTab3"); | ||
120 | m_ui->m_criteriaTab->insertTab(1, m_tab3, i18n("Rows/Columns")); | 120 | m_ui->m_criteriaTab->insertTab(1, m_tab3, i18n("Rows/Columns")); | ||
121 | } | 121 | } | ||
122 | } | 122 | } | ||
123 | 123 | | |||
124 | m_ui->m_criteriaTab->setCurrentIndex(m_ui->m_criteriaTab->indexOf(m_tab1)); | 124 | m_ui->m_criteriaTab->setCurrentIndex(m_ui->m_criteriaTab->indexOf(m_tab1)); | ||
125 | m_ui->m_criteriaTab->setMinimumSize(500, 200); | 125 | m_ui->m_criteriaTab->setMinimumSize(500, 200); | ||
Show All 31 Lines | 144 | { | |||
157 | 157 | | |||
158 | if (m_tab2) { | 158 | if (m_tab2) { | ||
159 | MyMoneyReport::EDetailLevel dl[4] = { MyMoneyReport::eDetailAll, MyMoneyReport::eDetailTop, MyMoneyReport::eDetailGroup, MyMoneyReport::eDetailTotal }; | 159 | MyMoneyReport::EDetailLevel dl[4] = { MyMoneyReport::eDetailAll, MyMoneyReport::eDetailTop, MyMoneyReport::eDetailGroup, MyMoneyReport::eDetailTotal }; | ||
160 | 160 | | |||
161 | m_currentState.setDetailLevel(dl[m_tab2->findChild<KComboBox*>("m_comboDetail")->currentIndex()]); | 161 | m_currentState.setDetailLevel(dl[m_tab2->findChild<KComboBox*>("m_comboDetail")->currentIndex()]); | ||
162 | 162 | | |||
163 | // modify the rowtype only if the widget is enabled | 163 | // modify the rowtype only if the widget is enabled | ||
164 | if (m_tab2->findChild<KComboBox*>("m_comboRows")->isEnabled()) { | 164 | if (m_tab2->findChild<KComboBox*>("m_comboRows")->isEnabled()) { | ||
165 | MyMoneyReport::ERowType rt[2] = { MyMoneyReport::eExpenseIncome, MyMoneyReport::eAssetLiability }; | 165 | MyMoneyReport::Row::Type rt[2] = { MyMoneyReport::Row::ExpenseIncome, MyMoneyReport::Row::AssetLiability }; | ||
166 | m_currentState.setRowType(rt[m_tab2->findChild<KComboBox*>("m_comboRows")->currentIndex()]); | 166 | m_currentState.setRowType(rt[m_tab2->findChild<KComboBox*>("m_comboRows")->currentIndex()]); | ||
167 | } | 167 | } | ||
168 | 168 | | |||
169 | m_currentState.setShowingRowTotals(false); | 169 | m_currentState.setShowingRowTotals(false); | ||
170 | if (m_tab2->findChild<KComboBox*>("m_comboRows")->currentIndex() == 0) | 170 | if (m_tab2->findChild<KComboBox*>("m_comboRows")->currentIndex() == 0) | ||
171 | m_currentState.setShowingRowTotals(m_tab2->findChild<QCheckBox*>("m_checkTotalColumn")->isChecked()); | 171 | m_currentState.setShowingRowTotals(m_tab2->findChild<QCheckBox*>("m_checkTotalColumn")->isChecked()); | ||
172 | 172 | | |||
173 | MyMoneyReport::Column::Type ct[6] = { MyMoneyReport::Column::Days, MyMoneyReport::Column::Weeks, MyMoneyReport::Column::Months, MyMoneyReport::Column::BiMonths, MyMoneyReport::Column::Quarters, MyMoneyReport::Column::Years }; | 173 | MyMoneyReport::Column::Type ct[6] = { MyMoneyReport::Column::Days, MyMoneyReport::Column::Weeks, MyMoneyReport::Column::Months, MyMoneyReport::Column::BiMonths, MyMoneyReport::Column::Quarters, MyMoneyReport::Column::Years }; | ||
174 | bool dy[6] = { true, true, false, false, false, false }; | 174 | bool dy[6] = { true, true, false, false, false, false }; | ||
175 | m_currentState.setColumnType(ct[m_tab2->findChild<KComboBox*>("m_comboColumns")->currentIndex()]); | 175 | m_currentState.setColumnType(ct[m_tab2->findChild<KComboBox*>("m_comboColumns")->currentIndex()]); | ||
176 | 176 | | |||
177 | //TODO (Ace) This should be implicit in the call above. MMReport needs fixin' | 177 | //TODO (Ace) This should be implicit in the call above. MMReport needs fixin' | ||
178 | m_currentState.setColumnsAreDays(dy[m_tab2->findChild<KComboBox*>("m_comboColumns")->currentIndex()]); | 178 | m_currentState.setColumnsAreDays(dy[m_tab2->findChild<KComboBox*>("m_comboColumns")->currentIndex()]); | ||
179 | 179 | | |||
180 | m_currentState.setIncludingSchedules(m_tab2->findChild<QCheckBox*>("m_checkScheduled")->isChecked()); | 180 | m_currentState.setIncludingSchedules(m_tab2->findChild<QCheckBox*>("m_checkScheduled")->isChecked()); | ||
181 | 181 | | |||
182 | m_currentState.setIncludingTransfers(m_tab2->findChild<QCheckBox*>("m_checkTransfers")->isChecked()); | 182 | m_currentState.setIncludingTransfers(m_tab2->findChild<QCheckBox*>("m_checkTransfers")->isChecked()); | ||
183 | 183 | | |||
184 | m_currentState.setIncludingUnusedAccounts(m_tab2->findChild<QCheckBox*>("m_checkUnused")->isChecked()); | 184 | m_currentState.setIncludingUnusedAccounts(m_tab2->findChild<QCheckBox*>("m_checkUnused")->isChecked()); | ||
185 | 185 | | |||
186 | if (m_tab2->findChild<KMyMoneyGeneralCombo*>("m_comboBudget")->isEnabled()) { | 186 | if (m_tab2->findChild<KMyMoneyGeneralCombo*>("m_comboBudget")->isEnabled()) { | ||
187 | m_currentState.setBudget(m_budgets[m_tab2->findChild<KMyMoneyGeneralCombo*>("m_comboBudget")->currentItem()].id(), m_initialState.rowType() == MyMoneyReport::eBudgetActual); | 187 | m_currentState.setBudget(m_budgets[m_tab2->findChild<KMyMoneyGeneralCombo*>("m_comboBudget")->currentItem()].id(), m_initialState.rowType() == MyMoneyReport::Row::BudgetActual); | ||
188 | } else { | 188 | } else { | ||
189 | m_currentState.setBudget(QString(), false); | 189 | m_currentState.setBudget(QString(), false); | ||
190 | } | 190 | } | ||
191 | 191 | | |||
192 | //set moving average days | 192 | //set moving average days | ||
193 | if (m_tab2->findChild<QSpinBox*>("m_movingAverageDays")->isEnabled()) { | 193 | if (m_tab2->findChild<QSpinBox*>("m_movingAverageDays")->isEnabled()) { | ||
194 | m_currentState.setMovingAverageDays(m_tab2->findChild<QSpinBox*>("m_movingAverageDays")->value()); | 194 | m_currentState.setMovingAverageDays(m_tab2->findChild<QSpinBox*>("m_movingAverageDays")->value()); | ||
195 | } | 195 | } | ||
196 | } else if (m_tab3) { | 196 | } else if (m_tab3) { | ||
197 | MyMoneyReport::ERowType rtq[8] = { MyMoneyReport::eCategory, MyMoneyReport::eTopCategory, MyMoneyReport::eTag, MyMoneyReport::ePayee, MyMoneyReport::eAccount, MyMoneyReport::eTopAccount, MyMoneyReport::eMonth, MyMoneyReport::eWeek }; | 197 | 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 }; | ||
198 | m_currentState.setRowType(rtq[m_tab3->findChild<KComboBox*>("m_comboOrganizeBy")->currentIndex()]); | 198 | m_currentState.setRowType(rtq[m_tab3->findChild<KComboBox*>("m_comboOrganizeBy")->currentIndex()]); | ||
199 | 199 | | |||
200 | unsigned qc = MyMoneyReport::QueryColumns::None; | 200 | unsigned qc = MyMoneyReport::QueryColumns::None; | ||
201 | 201 | | |||
202 | if (m_currentState.queryColumns() & MyMoneyReport::QueryColumns::Loan) | 202 | if (m_currentState.queryColumns() & MyMoneyReport::QueryColumns::Loan) | ||
203 | // once a loan report, always a loan report | 203 | // once a loan report, always a loan report | ||
204 | qc = MyMoneyReport::QueryColumns::Loan; | 204 | qc = MyMoneyReport::QueryColumns::Loan; | ||
205 | 205 | | |||
▲ Show 20 Lines • Show All 107 Lines • ▼ Show 20 Line(s) | 311 | case MyMoneyReport::eDetailGroup: | |||
313 | break; | 313 | break; | ||
314 | case MyMoneyReport::eDetailTotal: | 314 | case MyMoneyReport::eDetailTotal: | ||
315 | combo->setCurrentItem(i18n("Totals"), false); | 315 | combo->setCurrentItem(i18n("Totals"), false); | ||
316 | break; | 316 | break; | ||
317 | } | 317 | } | ||
318 | 318 | | |||
319 | combo = m_tab2->findChild<KComboBox*>("m_comboRows"); | 319 | combo = m_tab2->findChild<KComboBox*>("m_comboRows"); | ||
320 | switch (m_initialState.rowType()) { | 320 | switch (m_initialState.rowType()) { | ||
321 | case MyMoneyReport::eExpenseIncome: | 321 | case MyMoneyReport::Row::ExpenseIncome: | ||
322 | case MyMoneyReport::eBudget: | 322 | case MyMoneyReport::Row::Budget: | ||
323 | case MyMoneyReport::eBudgetActual: | 323 | case MyMoneyReport::Row::BudgetActual: | ||
324 | combo->setCurrentItem(i18n("Income & Expenses"), false); // income / expense | 324 | combo->setCurrentItem(i18n("Income & Expenses"), false); // income / expense | ||
325 | break; | 325 | break; | ||
326 | default: | 326 | default: | ||
327 | combo->setCurrentItem(i18n("Assets & Liabilities"), false); // asset / liability | 327 | combo->setCurrentItem(i18n("Assets & Liabilities"), false); // asset / liability | ||
328 | break; | 328 | break; | ||
329 | } | 329 | } | ||
330 | m_tab2->findChild<QCheckBox*>("m_checkTotalColumn")->setChecked(m_initialState.isShowingRowTotals()); | 330 | m_tab2->findChild<QCheckBox*>("m_checkTotalColumn")->setChecked(m_initialState.isShowingRowTotals()); | ||
331 | 331 | | |||
Show All 28 Lines | 359 | case MyMoneyReport::Column::Years: | |||
360 | combo->setCurrentItem(i18nc("@item the columns will display yearly data", "Yearly"), false); | 360 | combo->setCurrentItem(i18nc("@item the columns will display yearly data", "Yearly"), false); | ||
361 | break; | 361 | break; | ||
362 | default: | 362 | default: | ||
363 | break; | 363 | break; | ||
364 | } | 364 | } | ||
365 | } | 365 | } | ||
366 | 366 | | |||
367 | //load budgets combo | 367 | //load budgets combo | ||
368 | if (m_initialState.rowType() == MyMoneyReport::eBudget | 368 | if (m_initialState.rowType() == MyMoneyReport::Row::Budget | ||
369 | || m_initialState.rowType() == MyMoneyReport::eBudgetActual) { | 369 | || m_initialState.rowType() == MyMoneyReport::Row::BudgetActual) { | ||
370 | m_tab2->findChild<KComboBox*>("m_comboRows")->setEnabled(false); | 370 | m_tab2->findChild<KComboBox*>("m_comboRows")->setEnabled(false); | ||
371 | m_tab2->findChild<QFrame*>("m_budgetFrame")->setEnabled(!m_budgets.empty()); | 371 | m_tab2->findChild<QFrame*>("m_budgetFrame")->setEnabled(!m_budgets.empty()); | ||
372 | int i = 0; | 372 | int i = 0; | ||
373 | for (QVector<MyMoneyBudget>::const_iterator it_b = m_budgets.constBegin(); it_b != m_budgets.constEnd(); ++it_b) { | 373 | for (QVector<MyMoneyBudget>::const_iterator it_b = m_budgets.constBegin(); it_b != m_budgets.constEnd(); ++it_b) { | ||
374 | m_tab2->findChild<KMyMoneyGeneralCombo*>("m_comboBudget")->insertItem((*it_b).name(), i); | 374 | m_tab2->findChild<KMyMoneyGeneralCombo*>("m_comboBudget")->insertItem((*it_b).name(), i); | ||
375 | //set the current selected item | 375 | //set the current selected item | ||
376 | if ((m_initialState.budget() == "Any" && (*it_b).budgetStart().year() == QDate::currentDate().year()) | 376 | if ((m_initialState.budget() == "Any" && (*it_b).budgetStart().year() == QDate::currentDate().year()) | ||
377 | || m_initialState.budget() == (*it_b).id()) | 377 | || m_initialState.budget() == (*it_b).id()) | ||
Show All 10 Lines | |||||
388 | } | 388 | } | ||
389 | 389 | | |||
390 | m_tab2->findChild<QCheckBox*>("m_checkScheduled")->setChecked(m_initialState.isIncludingSchedules()); | 390 | m_tab2->findChild<QCheckBox*>("m_checkScheduled")->setChecked(m_initialState.isIncludingSchedules()); | ||
391 | m_tab2->findChild<QCheckBox*>("m_checkTransfers")->setChecked(m_initialState.isIncludingTransfers()); | 391 | m_tab2->findChild<QCheckBox*>("m_checkTransfers")->setChecked(m_initialState.isIncludingTransfers()); | ||
392 | m_tab2->findChild<QCheckBox*>("m_checkUnused")->setChecked(m_initialState.isIncludingUnusedAccounts()); | 392 | m_tab2->findChild<QCheckBox*>("m_checkUnused")->setChecked(m_initialState.isIncludingUnusedAccounts()); | ||
393 | } else if (m_tab3) { | 393 | } else if (m_tab3) { | ||
394 | KComboBox *combo = m_tab3->findChild<KComboBox*>("m_comboOrganizeBy"); | 394 | KComboBox *combo = m_tab3->findChild<KComboBox*>("m_comboOrganizeBy"); | ||
395 | switch (m_initialState.rowType()) { | 395 | switch (m_initialState.rowType()) { | ||
396 | case MyMoneyReport::Column::NoColumns: | 396 | case MyMoneyReport::Row::NoRows: | ||
397 | case MyMoneyReport::eCategory: | 397 | case MyMoneyReport::Row::Category: | ||
398 | combo->setCurrentItem(i18n("Categories"), false); | 398 | combo->setCurrentItem(i18n("Categories"), false); | ||
399 | break; | 399 | break; | ||
400 | case MyMoneyReport::eTopCategory: | 400 | case MyMoneyReport::Row::TopCategory: | ||
401 | combo->setCurrentItem(i18n("Top Categories"), false); | 401 | combo->setCurrentItem(i18n("Top Categories"), false); | ||
402 | break; | 402 | break; | ||
403 | case MyMoneyReport::eTag: | 403 | case MyMoneyReport::Row::Tag: | ||
404 | combo->setCurrentItem(i18n("Tags"), false); | 404 | combo->setCurrentItem(i18n("Tags"), false); | ||
405 | break; | 405 | break; | ||
406 | case MyMoneyReport::ePayee: | 406 | case MyMoneyReport::Row::Payee: | ||
407 | combo->setCurrentItem(i18n("Payees"), false); | 407 | combo->setCurrentItem(i18n("Payees"), false); | ||
408 | break; | 408 | break; | ||
409 | case MyMoneyReport::eAccount: | 409 | case MyMoneyReport::Row::Account: | ||
410 | combo->setCurrentItem(i18n("Accounts"), false); | 410 | combo->setCurrentItem(i18n("Accounts"), false); | ||
411 | break; | 411 | break; | ||
412 | case MyMoneyReport::eTopAccount: | 412 | case MyMoneyReport::Row::TopAccount: | ||
413 | combo->setCurrentItem(i18n("Top Accounts"), false); | 413 | combo->setCurrentItem(i18n("Top Accounts"), false); | ||
414 | break; | 414 | break; | ||
415 | case MyMoneyReport::eMonth: | 415 | case MyMoneyReport::Row::Month: | ||
416 | combo->setCurrentItem(i18n("Month"), false); | 416 | combo->setCurrentItem(i18n("Month"), false); | ||
417 | break; | 417 | break; | ||
418 | case MyMoneyReport::eWeek: | 418 | case MyMoneyReport::Row::Week: | ||
419 | combo->setCurrentItem(i18n("Week"), false); | 419 | combo->setCurrentItem(i18n("Week"), false); | ||
420 | break; | 420 | break; | ||
421 | default: | 421 | default: | ||
422 | throw MYMONEYEXCEPTION("KReportConfigurationFilterDlg::slotReset(): QueryTable report has invalid rowtype"); | 422 | throw MYMONEYEXCEPTION("KReportConfigurationFilterDlg::slotReset(): QueryTable report has invalid rowtype"); | ||
423 | } | 423 | } | ||
424 | 424 | | |||
425 | unsigned qc = m_initialState.queryColumns(); | 425 | unsigned qc = m_initialState.queryColumns(); | ||
426 | m_tab3->findChild<QCheckBox*>("m_checkNumber")->setChecked(qc & MyMoneyReport::QueryColumns::Number); | 426 | m_tab3->findChild<QCheckBox*>("m_checkNumber")->setChecked(qc & MyMoneyReport::QueryColumns::Number); | ||
▲ Show 20 Lines • Show All 241 Lines • Show Last 20 Lines |