Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/kmymoneyutils.cpp
Context not available. | |||||
49 | // Project Includes | 49 | // Project Includes | ||
---|---|---|---|---|---|
50 | 50 | | |||
51 | #include "mymoneyfile.h" | 51 | #include "mymoneyfile.h" | ||
52 | #include "mymoneyprice.h" | ||||
52 | #include "mymoneyforecast.h" | 53 | #include "mymoneyforecast.h" | ||
53 | #include "kmymoneyglobalsettings.h" | 54 | #include "kmymoneyglobalsettings.h" | ||
54 | #include "icons.h" | 55 | #include "icons.h" | ||
Context not available. | |||||
64 | { | 65 | { | ||
65 | } | 66 | } | ||
66 | 67 | | |||
67 | const QString KMyMoneyUtils::accountTypeToString(const MyMoneyAccount::accountTypeE accountType) | 68 | const QString KMyMoneyUtils::accountTypeToString(const eMyMoney::Account accountType) | ||
68 | { | 69 | { | ||
69 | return MyMoneyAccount::accountTypeToString(accountType); | 70 | return MyMoneyAccount::accountTypeToString(accountType); | ||
70 | } | 71 | } | ||
71 | 72 | | |||
72 | MyMoneyAccount::accountTypeE KMyMoneyUtils::stringToAccountType(const QString& type) | 73 | eMyMoney::Account KMyMoneyUtils::stringToAccountType(const QString& type) | ||
73 | { | 74 | { | ||
74 | MyMoneyAccount::accountTypeE rc = MyMoneyAccount::UnknownAccountType; | 75 | eMyMoney::Account rc = eMyMoney::Account::Unknown; | ||
75 | QString tmp = type.toLower(); | 76 | QString tmp = type.toLower(); | ||
76 | 77 | | |||
77 | if (tmp == i18n("Checking").toLower()) | 78 | if (tmp == i18n("Checking").toLower()) | ||
78 | rc = MyMoneyAccount::Checkings; | 79 | rc = eMyMoney::Account::Checkings; | ||
79 | else if (tmp == i18n("Savings").toLower()) | 80 | else if (tmp == i18n("Savings").toLower()) | ||
80 | rc = MyMoneyAccount::Savings; | 81 | rc = eMyMoney::Account::Savings; | ||
81 | else if (tmp == i18n("Credit Card").toLower()) | 82 | else if (tmp == i18n("Credit Card").toLower()) | ||
82 | rc = MyMoneyAccount::CreditCard; | 83 | rc = eMyMoney::Account::CreditCard; | ||
83 | else if (tmp == i18n("Cash").toLower()) | 84 | else if (tmp == i18n("Cash").toLower()) | ||
84 | rc = MyMoneyAccount::Cash; | 85 | rc = eMyMoney::Account::Cash; | ||
85 | else if (tmp == i18n("Loan").toLower()) | 86 | else if (tmp == i18n("Loan").toLower()) | ||
86 | rc = MyMoneyAccount::Loan; | 87 | rc = eMyMoney::Account::Loan; | ||
87 | else if (tmp == i18n("Certificate of Deposit").toLower()) | 88 | else if (tmp == i18n("Certificate of Deposit").toLower()) | ||
88 | rc = MyMoneyAccount::CertificateDep; | 89 | rc = eMyMoney::Account::CertificateDep; | ||
89 | else if (tmp == i18n("Investment").toLower()) | 90 | else if (tmp == i18n("Investment").toLower()) | ||
90 | rc = MyMoneyAccount::Investment; | 91 | rc = eMyMoney::Account::Investment; | ||
91 | else if (tmp == i18n("Money Market").toLower()) | 92 | else if (tmp == i18n("Money Market").toLower()) | ||
92 | rc = MyMoneyAccount::MoneyMarket; | 93 | rc = eMyMoney::Account::MoneyMarket; | ||
93 | else if (tmp == i18n("Asset").toLower()) | 94 | else if (tmp == i18n("Asset").toLower()) | ||
94 | rc = MyMoneyAccount::Asset; | 95 | rc = eMyMoney::Account::Asset; | ||
95 | else if (tmp == i18n("Liability").toLower()) | 96 | else if (tmp == i18n("Liability").toLower()) | ||
96 | rc = MyMoneyAccount::Liability; | 97 | rc = eMyMoney::Account::Liability; | ||
97 | else if (tmp == i18n("Currency").toLower()) | 98 | else if (tmp == i18n("Currency").toLower()) | ||
98 | rc = MyMoneyAccount::Currency; | 99 | rc = eMyMoney::Account::Currency; | ||
99 | else if (tmp == i18n("Income").toLower()) | 100 | else if (tmp == i18n("Income").toLower()) | ||
100 | rc = MyMoneyAccount::Income; | 101 | rc = eMyMoney::Account::Income; | ||
101 | else if (tmp == i18n("Expense").toLower()) | 102 | else if (tmp == i18n("Expense").toLower()) | ||
102 | rc = MyMoneyAccount::Expense; | 103 | rc = eMyMoney::Account::Expense; | ||
103 | else if (tmp == i18n("Investment Loan").toLower()) | 104 | else if (tmp == i18n("Investment Loan").toLower()) | ||
104 | rc = MyMoneyAccount::AssetLoan; | 105 | rc = eMyMoney::Account::AssetLoan; | ||
105 | else if (tmp == i18n("Stock").toLower()) | 106 | else if (tmp == i18n("Stock").toLower()) | ||
106 | rc = MyMoneyAccount::Stock; | 107 | rc = eMyMoney::Account::Stock; | ||
107 | else if (tmp == i18n("Equity").toLower()) | 108 | else if (tmp == i18n("Equity").toLower()) | ||
108 | rc = MyMoneyAccount::Equity; | 109 | rc = eMyMoney::Account::Equity; | ||
109 | 110 | | |||
110 | return rc; | 111 | return rc; | ||
111 | } | 112 | } | ||
112 | 113 | | |||
113 | const QString KMyMoneyUtils::occurrenceToString(const MyMoneySchedule::occurrenceE occurrence) | 114 | const QString KMyMoneyUtils::occurrenceToString(const eMyMoney::Schedule::Occurrence occurrence) | ||
114 | { | 115 | { | ||
115 | return i18nc("Frequency of schedule", MyMoneySchedule::occurrenceToString(occurrence).toLatin1()); | 116 | return i18nc("Frequency of schedule", MyMoneySchedule::occurrenceToString(occurrence).toLatin1()); | ||
116 | } | 117 | } | ||
117 | 118 | | |||
118 | const QString KMyMoneyUtils::paymentMethodToString(MyMoneySchedule::paymentTypeE paymentType) | 119 | const QString KMyMoneyUtils::paymentMethodToString(eMyMoney::Schedule::PaymentType paymentType) | ||
119 | { | 120 | { | ||
120 | return i18nc("Scheduled Transaction payment type", MyMoneySchedule::paymentMethodToString(paymentType).toLatin1()); | 121 | return i18nc("Scheduled Transaction payment type", MyMoneySchedule::paymentMethodToString(paymentType).toLatin1()); | ||
121 | } | 122 | } | ||
122 | 123 | | |||
123 | const QString KMyMoneyUtils::weekendOptionToString(MyMoneySchedule::weekendOptionE weekendOption) | 124 | const QString KMyMoneyUtils::weekendOptionToString(eMyMoney::Schedule::WeekendOption weekendOption) | ||
124 | { | 125 | { | ||
125 | return i18n(MyMoneySchedule::weekendOptionToString(weekendOption).toLatin1()); | 126 | return i18n(MyMoneySchedule::weekendOptionToString(weekendOption).toLatin1()); | ||
126 | } | 127 | } | ||
127 | 128 | | |||
128 | const QString KMyMoneyUtils::scheduleTypeToString(MyMoneySchedule::typeE type) | 129 | const QString KMyMoneyUtils::scheduleTypeToString(eMyMoney::Schedule::Type type) | ||
129 | { | 130 | { | ||
130 | return i18nc("Scheduled transaction type", MyMoneySchedule::scheduleTypeToString(type).toLatin1()); | 131 | return i18nc("Scheduled transaction type", MyMoneySchedule::scheduleTypeToString(type).toLatin1()); | ||
131 | } | 132 | } | ||
Context not available. | |||||
286 | return *it_s; | 287 | return *it_s; | ||
287 | } | 288 | } | ||
288 | // if we have a reference to an investment account, we remember it here | 289 | // if we have a reference to an investment account, we remember it here | ||
289 | if (acc.accountType() == MyMoneyAccount::Investment) | 290 | if (acc.accountType() == eMyMoney::Account::Investment) | ||
290 | investmentAccountSplit = *it_s; | 291 | investmentAccountSplit = *it_s; | ||
291 | } | 292 | } | ||
292 | } | 293 | } | ||
Context not available. | |||||
321 | MyMoneyAccount a, b; | 322 | MyMoneyAccount a, b; | ||
322 | a = MyMoneyFile::instance()->account(ida); | 323 | a = MyMoneyFile::instance()->account(ida); | ||
323 | b = MyMoneyFile::instance()->account(idb); | 324 | b = MyMoneyFile::instance()->account(idb); | ||
324 | if ((a.accountGroup() == MyMoneyAccount::Asset | 325 | if ((a.accountGroup() == eMyMoney::Account::Asset | ||
325 | || a.accountGroup() == MyMoneyAccount::Liability) | 326 | || a.accountGroup() == eMyMoney::Account::Liability) | ||
326 | && (b.accountGroup() == MyMoneyAccount::Asset | 327 | && (b.accountGroup() == eMyMoney::Account::Asset | ||
327 | || b.accountGroup() == MyMoneyAccount::Liability)) | 328 | || b.accountGroup() == eMyMoney::Account::Liability)) | ||
328 | return Transfer; | 329 | return Transfer; | ||
329 | return Normal; | 330 | return Normal; | ||
330 | } | 331 | } | ||
Context not available. | |||||
481 | MyMoneyTransaction t = schedule.transaction(); | 482 | MyMoneyTransaction t = schedule.transaction(); | ||
482 | 483 | | |||
483 | try { | 484 | try { | ||
484 | if (schedule.type() == MyMoneySchedule::TYPE_LOANPAYMENT) { | 485 | if (schedule.type() == eMyMoney::Schedule::Type::LoanPayment) { | ||
485 | calculateAutoLoan(schedule, t, QMap<QString, MyMoneyMoney>()); | 486 | calculateAutoLoan(schedule, t, QMap<QString, MyMoneyMoney>()); | ||
486 | } | 487 | } | ||
487 | } catch (const MyMoneyException &e) { | 488 | } catch (const MyMoneyException &e) { | ||
Context not available. | |||||
578 | MyMoneyAccount acc = file->account((*it_s).accountId()); | 579 | MyMoneyAccount acc = file->account((*it_s).accountId()); | ||
579 | if ((*it_s).id() == split.id()) { | 580 | if ((*it_s).id() == split.id()) { | ||
580 | security = file->security(acc.currencyId()); | 581 | security = file->security(acc.currencyId()); | ||
581 | } else if (acc.accountGroup() == MyMoneyAccount::Expense) { | 582 | } else if (acc.accountGroup() == eMyMoney::Account::Expense) { | ||
582 | feeSplits.append(*it_s); | 583 | feeSplits.append(*it_s); | ||
583 | // feeAmount += (*it_s).value(); | 584 | // feeAmount += (*it_s).value(); | ||
584 | } else if (acc.accountGroup() == MyMoneyAccount::Income) { | 585 | } else if (acc.accountGroup() == eMyMoney::Account::Income) { | ||
585 | interestSplits.append(*it_s); | 586 | interestSplits.append(*it_s); | ||
586 | // interestAmount += (*it_s).value(); | 587 | // interestAmount += (*it_s).value(); | ||
587 | } else { | 588 | } else { | ||
Context not available. |