Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/dialogs/transactioneditor.cpp
Context not available. | |||||
53 | #include <kmymoneyaccountcompletion.h> | 53 | #include <kmymoneyaccountcompletion.h> | ||
---|---|---|---|---|---|
54 | #include "kmymoneyaccountselector.h" | 54 | #include "kmymoneyaccountselector.h" | ||
55 | #include "mymoneyfile.h" | 55 | #include "mymoneyfile.h" | ||
56 | #include "mymoneyprice.h" | ||||
57 | #include "mymoneysecurity.h" | ||||
56 | #include "kmymoneyutils.h" | 58 | #include "kmymoneyutils.h" | ||
57 | #include "transactionform.h" | 59 | #include "transactionform.h" | ||
58 | #include "kmymoneyglobalsettings.h" | 60 | #include "kmymoneyglobalsettings.h" | ||
Context not available. | |||||
67 | using namespace Icons; | 69 | using namespace Icons; | ||
68 | 70 | | |||
69 | TransactionEditor::TransactionEditor() : | 71 | TransactionEditor::TransactionEditor() : | ||
70 | m_paymentMethod(MyMoneySchedule::STYPE_ANY), | 72 | m_paymentMethod(eMyMoney::Schedule::PaymentType::Any), | ||
71 | m_regForm(0), | 73 | m_regForm(0), | ||
72 | m_item(0), | 74 | m_item(0), | ||
73 | m_initialAction(ActionNone), | 75 | m_initialAction(ActionNone), | ||
Context not available. | |||||
77 | } | 79 | } | ||
78 | 80 | | |||
79 | TransactionEditor::TransactionEditor(TransactionEditorContainer* regForm, KMyMoneyRegister::Transaction* item, const KMyMoneyRegister::SelectedTransactions& list, const QDate& lastPostDate) : | 81 | TransactionEditor::TransactionEditor(TransactionEditorContainer* regForm, KMyMoneyRegister::Transaction* item, const KMyMoneyRegister::SelectedTransactions& list, const QDate& lastPostDate) : | ||
80 | m_paymentMethod(MyMoneySchedule::STYPE_ANY), | 82 | m_paymentMethod(eMyMoney::Schedule::PaymentType::Any), | ||
81 | m_transactions(list), | 83 | m_transactions(list), | ||
82 | m_regForm(regForm), | 84 | m_regForm(regForm), | ||
83 | m_item(item), | 85 | m_item(item), | ||
Context not available. | |||||
652 | // turn object creation on, so that moving the focus does | 654 | // turn object creation on, so that moving the focus does | ||
653 | // not screw up the dialog that might be popping up | 655 | // not screw up the dialog that might be popping up | ||
654 | emit objectCreation(true); | 656 | emit objectCreation(true); | ||
655 | emit scheduleTransaction(*it_ts, MyMoneySchedule::OCCUR_ONCE); | 657 | emit scheduleTransaction(*it_ts, eMyMoney::Schedule::Occurrence::Once); | ||
656 | emit objectCreation(false); | 658 | emit objectCreation(false); | ||
657 | 659 | | |||
658 | newTransactionCreated = false; | 660 | newTransactionCreated = false; | ||
Context not available. | |||||
859 | 861 | | |||
860 | bool showNumberField = true; | 862 | bool showNumberField = true; | ||
861 | switch (m_account.accountType()) { | 863 | switch (m_account.accountType()) { | ||
862 | case MyMoneyAccount::Savings: | 864 | case eMyMoney::Account::Savings: | ||
863 | case MyMoneyAccount::Cash: | 865 | case eMyMoney::Account::Cash: | ||
864 | case MyMoneyAccount::Loan: | 866 | case eMyMoney::Account::Loan: | ||
865 | case MyMoneyAccount::AssetLoan: | 867 | case eMyMoney::Account::AssetLoan: | ||
866 | case MyMoneyAccount::Asset: | 868 | case eMyMoney::Account::Asset: | ||
867 | case MyMoneyAccount::Liability: | 869 | case eMyMoney::Account::Liability: | ||
868 | case MyMoneyAccount::Equity: | 870 | case eMyMoney::Account::Equity: | ||
869 | showNumberField = KMyMoneyGlobalSettings::alwaysShowNrField(); | 871 | showNumberField = KMyMoneyGlobalSettings::alwaysShowNrField(); | ||
870 | break; | 872 | break; | ||
871 | 873 | | |||
872 | case MyMoneyAccount::Income: | 874 | case eMyMoney::Account::Income: | ||
873 | case MyMoneyAccount::Expense: | 875 | case eMyMoney::Account::Expense: | ||
874 | showNumberField = false; | 876 | showNumberField = false; | ||
875 | break; | 877 | break; | ||
876 | 878 | | |||
Context not available. | |||||
1001 | // load the account widget | 1003 | // load the account widget | ||
1002 | KMyMoneyCategory* account = dynamic_cast<KMyMoneyCategory*>(haveWidget("account")); | 1004 | KMyMoneyCategory* account = dynamic_cast<KMyMoneyCategory*>(haveWidget("account")); | ||
1003 | if (account) { | 1005 | if (account) { | ||
1004 | aSet.addAccountGroup(MyMoneyAccount::Asset); | 1006 | aSet.addAccountGroup(eMyMoney::Account::Asset); | ||
1005 | aSet.addAccountGroup(MyMoneyAccount::Liability); | 1007 | aSet.addAccountGroup(eMyMoney::Account::Liability); | ||
1006 | aSet.removeAccountType(MyMoneyAccount::AssetLoan); | 1008 | aSet.removeAccountType(eMyMoney::Account::AssetLoan); | ||
1007 | aSet.removeAccountType(MyMoneyAccount::CertificateDep); | 1009 | aSet.removeAccountType(eMyMoney::Account::CertificateDep); | ||
1008 | aSet.removeAccountType(MyMoneyAccount::Investment); | 1010 | aSet.removeAccountType(eMyMoney::Account::Investment); | ||
1009 | aSet.removeAccountType(MyMoneyAccount::Stock); | 1011 | aSet.removeAccountType(eMyMoney::Account::Stock); | ||
1010 | aSet.removeAccountType(MyMoneyAccount::MoneyMarket); | 1012 | aSet.removeAccountType(eMyMoney::Account::MoneyMarket); | ||
1011 | aSet.removeAccountType(MyMoneyAccount::Loan); | 1013 | aSet.removeAccountType(eMyMoney::Account::Loan); | ||
1012 | aSet.load(account->selector()); | 1014 | aSet.load(account->selector()); | ||
1013 | account->completion()->setSelected(m_account.id()); | 1015 | account->completion()->setSelected(m_account.id()); | ||
1014 | account->slotItemSelected(m_account.id()); | 1016 | account->slotItemSelected(m_account.id()); | ||
Context not available. | |||||
1032 | QList<MyMoneySplit>::const_iterator it_s; | 1034 | QList<MyMoneySplit>::const_iterator it_s; | ||
1033 | for (it_s = m_transaction.splits().constBegin(); !haveEquityAccount && it_s != m_transaction.splits().constEnd(); ++it_s) { | 1035 | for (it_s = m_transaction.splits().constBegin(); !haveEquityAccount && it_s != m_transaction.splits().constEnd(); ++it_s) { | ||
1034 | MyMoneyAccount acc = MyMoneyFile::instance()->account((*it_s).accountId()); | 1036 | MyMoneyAccount acc = MyMoneyFile::instance()->account((*it_s).accountId()); | ||
1035 | if (acc.accountType() == MyMoneyAccount::Equity) | 1037 | if (acc.accountType() == eMyMoney::Account::Equity) | ||
1036 | haveEquityAccount = true; | 1038 | haveEquityAccount = true; | ||
1037 | } | 1039 | } | ||
1038 | 1040 | | |||
1039 | aSet.clear(); | 1041 | aSet.clear(); | ||
1040 | aSet.addAccountGroup(MyMoneyAccount::Asset); | 1042 | aSet.addAccountGroup(eMyMoney::Account::Asset); | ||
1041 | aSet.addAccountGroup(MyMoneyAccount::Liability); | 1043 | aSet.addAccountGroup(eMyMoney::Account::Liability); | ||
1042 | aSet.addAccountGroup(MyMoneyAccount::Income); | 1044 | aSet.addAccountGroup(eMyMoney::Account::Income); | ||
1043 | aSet.addAccountGroup(MyMoneyAccount::Expense); | 1045 | aSet.addAccountGroup(eMyMoney::Account::Expense); | ||
1044 | if (KMyMoneyGlobalSettings::expertMode() || haveEquityAccount) | 1046 | if (KMyMoneyGlobalSettings::expertMode() || haveEquityAccount) | ||
1045 | aSet.addAccountGroup(MyMoneyAccount::Equity); | 1047 | aSet.addAccountGroup(eMyMoney::Account::Equity); | ||
1046 | 1048 | | |||
1047 | aSet.removeAccountType(MyMoneyAccount::CertificateDep); | 1049 | aSet.removeAccountType(eMyMoney::Account::CertificateDep); | ||
1048 | aSet.removeAccountType(MyMoneyAccount::Investment); | 1050 | aSet.removeAccountType(eMyMoney::Account::Investment); | ||
1049 | aSet.removeAccountType(MyMoneyAccount::Stock); | 1051 | aSet.removeAccountType(eMyMoney::Account::Stock); | ||
1050 | aSet.removeAccountType(MyMoneyAccount::MoneyMarket); | 1052 | aSet.removeAccountType(eMyMoney::Account::MoneyMarket); | ||
1051 | aSet.load(category->selector()); | 1053 | aSet.load(category->selector()); | ||
1052 | 1054 | | |||
1053 | // if an account is specified then remove it from the widget so that the user | 1055 | // if an account is specified then remove it from the widget so that the user | ||
Context not available. | |||||
1073 | dynamic_cast<kMyMoneyLineEdit*>(w)->loadText(m_split.number()); | 1075 | dynamic_cast<kMyMoneyLineEdit*>(w)->loadText(m_split.number()); | ||
1074 | if (m_transaction.id().isEmpty() // new transaction | 1076 | if (m_transaction.id().isEmpty() // new transaction | ||
1075 | && dynamic_cast<kMyMoneyLineEdit*>(w)->text().isEmpty() // no number filled in | 1077 | && dynamic_cast<kMyMoneyLineEdit*>(w)->text().isEmpty() // no number filled in | ||
1076 | && m_account.accountType() == MyMoneyAccount::Checkings // checkings account | 1078 | && m_account.accountType() == eMyMoney::Account::Checkings // checkings account | ||
1077 | && KMyMoneyGlobalSettings::autoIncCheckNumber() // and auto inc number turned on? | 1079 | && KMyMoneyGlobalSettings::autoIncCheckNumber() // and auto inc number turned on? | ||
1078 | && action != KMyMoneyRegister::ActionDeposit // only transfers or withdrawals | 1080 | && action != KMyMoneyRegister::ActionDeposit // only transfers or withdrawals | ||
1079 | && m_paymentMethod == MyMoneySchedule::STYPE_WRITECHEQUE) {// only for STYPE_WRITECHEQUE | 1081 | && m_paymentMethod == eMyMoney::Schedule::PaymentType::WriteChecque) {// only for WriteChecque | ||
1080 | assignNextNumber(); | 1082 | assignNextNumber(); | ||
1081 | } | 1083 | } | ||
1082 | } | 1084 | } | ||
Context not available. | |||||
1221 | QString categoryId = category->selectedItem(); | 1223 | QString categoryId = category->selectedItem(); | ||
1222 | 1224 | | |||
1223 | AccountSet aSet; | 1225 | AccountSet aSet; | ||
1224 | aSet.addAccountGroup(MyMoneyAccount::Asset); | 1226 | aSet.addAccountGroup(eMyMoney::Account::Asset); | ||
1225 | aSet.addAccountGroup(MyMoneyAccount::Liability); | 1227 | aSet.addAccountGroup(eMyMoney::Account::Liability); | ||
1226 | aSet.addAccountGroup(MyMoneyAccount::Income); | 1228 | aSet.addAccountGroup(eMyMoney::Account::Income); | ||
1227 | aSet.addAccountGroup(MyMoneyAccount::Expense); | 1229 | aSet.addAccountGroup(eMyMoney::Account::Expense); | ||
1228 | if (KMyMoneyGlobalSettings::expertMode()) | 1230 | if (KMyMoneyGlobalSettings::expertMode()) | ||
1229 | aSet.addAccountGroup(MyMoneyAccount::Equity); | 1231 | aSet.addAccountGroup(eMyMoney::Account::Equity); | ||
1230 | aSet.load(category->selector()); | 1232 | aSet.load(category->selector()); | ||
1231 | 1233 | | |||
1232 | // if an account is specified then remove it from the widget so that the user | 1234 | // if an account is specified then remove it from the widget so that the user | ||
Context not available. | |||||
1595 | if (!id.isEmpty()) { | 1597 | if (!id.isEmpty()) { | ||
1596 | MyMoneyAccount acc = MyMoneyFile::instance()->account(id); | 1598 | MyMoneyAccount acc = MyMoneyFile::instance()->account(id); | ||
1597 | if (acc.isAssetLiability() | 1599 | if (acc.isAssetLiability() | ||
1598 | || acc.accountGroup() == MyMoneyAccount::Equity) { | 1600 | || acc.accountGroup() == eMyMoney::Account::Equity) { | ||
1599 | if (tabbar) { | 1601 | if (tabbar) { | ||
1600 | tabbar->setCurrentIndex(KMyMoneyRegister::ActionTransfer); | 1602 | tabbar->setCurrentIndex(KMyMoneyRegister::ActionTransfer); | ||
1601 | tabbar->setTabEnabled(KMyMoneyRegister::ActionDeposit, false); | 1603 | tabbar->setTabEnabled(KMyMoneyRegister::ActionDeposit, false); | ||
Context not available. |